feat(kimi): thinking level selection for remote sessions (#2349)

* feat(kimi): thinking level selection for remote sessions

Kimi Code's ACP session advertises the active model's thinking levels as
a thought_level config option (`thinking`: off/on or off plus declared
efforts). Expose it like Grok's effort: a session RPC + hub route for the
options, the composer effort picker, and per-turn
session/set_config_option in the remote launcher. The runner forwards
--effort so resumed sessions keep the selection.

* fix(kimi): keep thinking options in step with model switches

Kimi Code answers session/set_model with no config options and pushes
the new model's thought_level via config_option_update; capture it
(opt-in in the ACP backend, same hunk as #2348), re-baseline the
launcher's level after a switch, report 'switch pending' until the next
turn applies it, and have the web poll until discovery succeeds.

* fix(kimi): gate thinking discovery on the model the backend applied

Compare the model the next queued turn carries with the backend's model
instead of session state, so an older queued batch or a failed switch
keeps discovery pending; forward the saved effort on terminal resume.
This commit is contained in:
SSU-WEI HUANG
2026-11-10 08:11:17 +08:00
committed by GitHub
parent 2161a9ff96
commit 2d400a2abd
27 changed files with 267 additions and 26 deletions
+3
View File
@@ -1052,6 +1052,9 @@ export type GrokReasoningEffortResponse = {
error?: string
}
/** Kimi's ACP `thought_level` (`thinking`) option for the active model. */
export type KimiReasoningEffortResponse = GrokReasoningEffortResponse
export type OpencodeReasoningEffortOption = {
value: string
name?: string
+3 -3
View File
@@ -53,9 +53,9 @@ describe('hasCapability', () => {
expect(hasCapability('pi', Capabilities.Effort)).toBe(true)
})
test('kimi supports model-change but not effort', () => {
test('kimi supports model-change and effort', () => {
expect(hasCapability('kimi', Capabilities.ModelChange)).toBe(true)
expect(hasCapability('kimi', Capabilities.Effort)).toBe(false)
expect(hasCapability('kimi', Capabilities.Effort)).toBe(true)
})
test('copilot supports model-change but not effort', () => {
@@ -149,7 +149,7 @@ describe('convenience functions', () => {
expect(supportsEffort('gemini')).toBe(false)
expect(supportsEffort('pi')).toBe(true)
expect(supportsEffort('grok')).toBe(true)
expect(supportsEffort('kimi')).toBe(false)
expect(supportsEffort('kimi')).toBe(true)
expect(supportsEffort(null)).toBe(false)
})
})
+1 -1
View File
@@ -13,7 +13,7 @@ const FLAVOR_CAPS: Record<AgentFlavor, ReadonlySet<Capability>> = {
agy: new Set([Capabilities.ModelChange, Capabilities.Effort]),
claude: new Set([Capabilities.ModelChange, Capabilities.Effort]),
gemini: new Set([Capabilities.ModelChange]),
kimi: new Set([Capabilities.ModelChange]),
kimi: new Set([Capabilities.ModelChange, Capabilities.Effort]),
copilot: new Set([Capabilities.ModelChange]),
grok: new Set([Capabilities.ModelChange, Capabilities.Effort]),
codex: new Set([Capabilities.ModelChange]),
+1
View File
@@ -51,6 +51,7 @@ export const RPC_METHODS = {
ListGrokReasoningEffortOptions: 'listGrokReasoningEffortOptions',
ListCopilotModelsForCwd: 'listCopilotModelsForCwd',
ListCopilotModels: 'listCopilotModels',
ListKimiReasoningEffortOptions: 'listKimiReasoningEffortOptions',
ListKimiModelsForCwd: 'listKimiModelsForCwd',
ListKimiModels: 'listKimiModels',
ListDshModels: 'listDshModels',