fix: reconcile stale queued messages (#1063)

Recover missed messages-consumed events from authoritative Hub state after session SSE reconnects.
This commit is contained in:
Shawn Tian
2026-07-18 12:18:47 +08:00
committed by GitHub
parent 22e9b38f70
commit d809fca433
17 changed files with 704 additions and 10 deletions
+11
View File
@@ -39,6 +39,7 @@ import type {
MachinePathsExistsResponse,
OpencodeModelsResponse,
OpencodeReasoningEffortResponse,
QueuedStateResponse,
ReopenSessionResponse,
UploadFileResponse
} from '@hapi/protocol/apiTypes'
@@ -408,6 +409,16 @@ export class ApiClient {
})
}
async getQueuedState(sessionId: string, localIds: string[]): Promise<QueuedStateResponse> {
return await this.request<QueuedStateResponse>(
`/api/sessions/${encodeURIComponent(sessionId)}/messages/queued-state`,
{
method: 'POST',
body: JSON.stringify({ localIds })
}
)
}
async cancelMessage(sessionId: string, messageId: string): Promise<CancelMessageResponse> {
const response = await this.request(
`/api/sessions/${encodeURIComponent(sessionId)}/messages/${encodeURIComponent(messageId)}`,