mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix: reconcile stale queued messages (#1063)
Recover missed messages-consumed events from authoritative Hub state after session SSE reconnects.
This commit is contained in:
@@ -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)}`,
|
||||
|
||||
Reference in New Issue
Block a user