mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-28 23:01:34 +00:00
fix: verify Cursor chat store before reopen (#1037)
* test: reproduce issue #841 * test: cover Cursor chat store discovery * fix: verify Cursor chat store before resume (closes #841) * test: preserve non-Cursor resume behavior * test: cover conservative Cursor resume gating * fix: gate Cursor reopen until store verification * test: cover legacy Cursor drawer fallback * fix: scan unique legacy Cursor store drawer * test: preserve raw Cursor workspace path hashing * fix: hash raw Cursor workspace path * test: pin Cursor probe owner and machine * fix: probe Cursor store on recorded owner * test: normalize Cursor probe owner home * fix: normalize Cursor probe owner home
This commit is contained in:
@@ -79,4 +79,17 @@ describe('ApiClient error mapping', () => {
|
||||
expect(apiError.body).toContain('cursorSessionId')
|
||||
}
|
||||
})
|
||||
|
||||
it('loads the Cursor chat store status for the selected session', async () => {
|
||||
fetchMock.mockResolvedValueOnce(
|
||||
new Response(JSON.stringify({ onDisk: false, store: null }), { status: 200 })
|
||||
)
|
||||
|
||||
const api = new ApiClient('test-token')
|
||||
await expect(api.getCursorChatStoreStatus('session cursor')).resolves.toEqual({
|
||||
onDisk: false,
|
||||
store: null
|
||||
})
|
||||
expect(fetchMock.mock.calls[0]?.[0]).toBe('/api/sessions/session%20cursor/cursor-chat-store')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
CodexModelsResponse,
|
||||
CursorMigrateOutcome,
|
||||
CursorMigrateToAcpRequest,
|
||||
CursorChatStoreStatus,
|
||||
CursorModelsResponse,
|
||||
DeleteUploadResponse,
|
||||
FileReadResponse,
|
||||
@@ -389,6 +390,12 @@ export class ApiClient {
|
||||
return response.sessionId
|
||||
}
|
||||
|
||||
async getCursorChatStoreStatus(sessionId: string): Promise<CursorChatStoreStatus> {
|
||||
return await this.request<CursorChatStoreStatus>(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/cursor-chat-store`
|
||||
)
|
||||
}
|
||||
|
||||
async sendMessage(sessionId: string, text: string, localId?: string | null, attachments?: AttachmentMetadata[], scheduledAt?: number | null): Promise<void> {
|
||||
await this.request(`/api/sessions/${encodeURIComponent(sessionId)}/messages`, {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user