mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Fix SSE reliability and message delivery for production environments (#85)
* Switch to sync prompt endpoint for reliable message delivery Use the synchronous /message endpoint instead of /prompt_async to ensure the UI receives authoritative response data. This matches OpenCode TUI behavior and prevents message desync during sub-agent tasks. * Add SSE heartbeat to prevent Cloudflare 524 timeout
This commit is contained in:
1 parent
d78bb120ed
commit
a05535e0ef
6 files changed
+61
-10
No files matched your search
@@ -12,6 +12,9 @@ type CommandRequest = NonNullable<paths['/session/{sessionID}/command']['post'][
|
||||
type ShellRequest = NonNullable<paths['/session/{sessionID}/shell']['post']['requestBody']>['content']['application/json']
|
||||
type AgentListResponse = paths['/agent']['get']['responses']['200']['content']['application/json']
|
||||
type QuestionListResponse = paths['/question']['get']['responses']['200']['content']['application/json']
|
||||
type SendPromptResponse = paths['/session/{sessionID}/message']['post']['responses']['200']['content']['application/json']
|
||||
|
||||
export type { SendPromptResponse }
|
||||
|
||||
export class OpenCodeClient {
|
||||
private client: AxiosInstance
|
||||
@@ -78,8 +81,13 @@ export class OpenCodeClient {
|
||||
return response.data
|
||||
}
|
||||
|
||||
async sendPrompt(sessionID: string, data: SendPromptRequest): Promise<void> {
|
||||
await this.client.post(`/session/${sessionID}/prompt_async`, data)
|
||||
async sendPrompt(sessionID: string, data: SendPromptRequest): Promise<SendPromptResponse> {
|
||||
const response = await this.client.post<SendPromptResponse>(
|
||||
`/session/${sessionID}/message`,
|
||||
data,
|
||||
{ timeout: 0 }
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
async summarizeSession(sessionID: string, providerID: string, modelID: string) {
|
||||
|
||||
Reference in new issue
Block a user