fix(opencode): use ACP-reported reasoning effort options (#853)

* fix(opencode): use ACP-reported reasoning effort options

Expose thought_level options from OpenCode ACP to the web UI via RPC/API
instead of hardcoded presets, and validate effort values before setConfigOption.

Fixes #852

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(opencode): sync hub effort after coerced setConfigOption

When resolveThoughtLevelEffort falls back to a different supported value,
roll back session state after a successful ACP update so keepalive and the
web UI do not keep advertising the rejected effort.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
SSU-WEI HUANG
2026-06-10 13:57:03 +08:00
committed by GitHub
co-authored by Cursor
parent 3473a88d67
commit cad58cfa0b
18 changed files with 486 additions and 35 deletions
+7
View File
@@ -33,6 +33,7 @@ import type {
MachineListDirectoryResponse,
MachinePathsExistsResponse,
OpencodeModelsResponse,
OpencodeReasoningEffortResponse,
ReopenSessionResponse,
UploadFileResponse
} from '@hapi/protocol/apiTypes'
@@ -564,6 +565,12 @@ export class ApiClient {
)
}
async getSessionOpencodeReasoningEffortOptions(sessionId: string): Promise<OpencodeReasoningEffortResponse> {
return await this.request<OpencodeReasoningEffortResponse>(
`/api/sessions/${encodeURIComponent(sessionId)}/opencode-reasoning-effort-options`
)
}
async getSessionCursorModels(sessionId: string): Promise<CursorModelsResponse> {
return await this.request<CursorModelsResponse>(
`/api/sessions/${encodeURIComponent(sessionId)}/cursor-models`