fix: ACP NewSessionResponse 恢复返回 models 字段

67fdd4ca 那次合规审计误将 models 从响应里移除,但 SDK 0.19.2 的 schema 实际允许
models?: SessionModelState | null(标注 UNSTABLE 仅表示"未来可能变",并非
"agent 禁止返回")。标准 ACP 客户端(Cursor/Zed/VS Code/RCS)依赖此字段填充
模型选择器 —— 缺失会导致客户端 supportsModelSelection=false,模型切换 UI 不可用。

- createSessionMethod: return 里加回 models
- sessionLifecycle: getOrCreateSession 两处 return 透传 models(resume/load 路径)
- agent.test: 更新过时的 "models omitted for v1 compliance" 断言

Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-06-20 10:49:09 +08:00
parent 0103f45109
commit 704c6c7814
3 changed files with 21 additions and 7 deletions

View File

@@ -79,6 +79,9 @@ async function getOrCreateSession(
return {
sessionId: params.sessionId,
modes: existingSession.modes,
// Carry models over on reconnect so the client keeps its model selector
// populated (standard clients gate supportsModelSelection on this field).
models: existingSession.models,
configOptions: existingSession.configOptions,
}
}
@@ -150,6 +153,8 @@ async function getOrCreateSession(
return {
sessionId: response.sessionId,
modes: response.modes,
// createSession already returns models; pass it through. Same reason as above.
models: response.models,
configOptions: response.configOptions,
}
}