mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
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:
@@ -13,6 +13,7 @@ import type {
|
||||
ListDirectoryResponse,
|
||||
OpencodeModelsResponse,
|
||||
OpencodeModelSummary,
|
||||
OpencodeReasoningEffortResponse,
|
||||
PathExistsResponse,
|
||||
SlashCommandsResponse,
|
||||
UploadFileResponse
|
||||
@@ -37,6 +38,7 @@ export type RpcCursorModel = CursorModelSummary
|
||||
export type RpcListCursorModelsResponse = CursorModelsResponse
|
||||
export type RpcOpencodeModel = OpencodeModelSummary
|
||||
export type RpcListOpencodeModelsResponse = OpencodeModelsResponse
|
||||
export type RpcListOpencodeReasoningEffortOptionsResponse = OpencodeReasoningEffortResponse
|
||||
|
||||
export class RpcGateway {
|
||||
constructor(
|
||||
@@ -258,6 +260,10 @@ export class RpcGateway {
|
||||
return await this.machineRpc(machineId, RPC_METHODS.ListOpencodeModelsForCwd, { cwd }) as RpcListOpencodeModelsResponse
|
||||
}
|
||||
|
||||
async listOpencodeReasoningEffortOptionsForSession(sessionId: string): Promise<RpcListOpencodeReasoningEffortOptionsResponse> {
|
||||
return await this.sessionRpc(sessionId, RPC_METHODS.ListOpencodeReasoningEffortOptions, {}) as RpcListOpencodeReasoningEffortOptionsResponse
|
||||
}
|
||||
|
||||
private async sessionRpc(
|
||||
sessionId: string,
|
||||
method: string,
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
type RpcListCodexModelsResponse,
|
||||
type RpcListCursorModelsResponse,
|
||||
type RpcListOpencodeModelsResponse,
|
||||
type RpcListOpencodeReasoningEffortOptionsResponse,
|
||||
type RpcCursorModel,
|
||||
type RpcOpencodeModel,
|
||||
type RpcPathExistsResponse,
|
||||
@@ -49,6 +50,7 @@ export type {
|
||||
RpcListCodexModelsResponse,
|
||||
RpcListCursorModelsResponse,
|
||||
RpcListOpencodeModelsResponse,
|
||||
RpcListOpencodeReasoningEffortOptionsResponse,
|
||||
RpcCursorModel,
|
||||
RpcOpencodeModel,
|
||||
RpcPathExistsResponse,
|
||||
@@ -1088,4 +1090,8 @@ export class SyncEngine {
|
||||
async listOpencodeModelsForCwd(machineId: string, cwd: string): Promise<RpcListOpencodeModelsResponse> {
|
||||
return await this.rpcGateway.listOpencodeModelsForCwd(machineId, cwd)
|
||||
}
|
||||
|
||||
async listOpencodeReasoningEffortOptionsForSession(sessionId: string): Promise<RpcListOpencodeReasoningEffortOptionsResponse> {
|
||||
return await this.rpcGateway.listOpencodeReasoningEffortOptionsForSession(sessionId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user