MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / setSessionConfigOption

Method setSessionConfigOption

packages/acp-adapter/src/server.ts:667–709  ·  view source on GitHub ↗

* Handle ACP `session/set_config_option` — the spec's generic * config-picker dispatch (PLAN D11). Routes by `params.configId`: * * - `'model'` → AcpSession.setModel (same path as * unstable_setSessionModel). * - `'mode'` → AcpSession.setMode (same path a

(
    params: SetSessionConfigOptionRequest,
  )

Source from the content-addressed store, hash-verified

665 * through the same notification channel with identical shape.
666 */
667 async setSessionConfigOption(
668 params: SetSessionConfigOptionRequest,
669 ): Promise<SetSessionConfigOptionResponse> {
670 const acpSession = this.sessions.get(params.sessionId);
671 if (!acpSession) {
672 throw RequestError.invalidParams(
673 { sessionId: params.sessionId },
674 `Unknown sessionId: ${params.sessionId}`,
675 );
676 }
677 const value = (params as { value: unknown }).value;
678 switch (params.configId) {
679 case 'model':
680 await acpSession.setModel(String(value));
681 break;
682 case 'mode':
683 await acpSession.setMode(String(value));
684 break;
685 case 'thinking': {
686 // Phase 16 changed the wire shape from boolean to a 2-entry
687 // `select` (`'on'` / `'off'`) for Zed UI compatibility. Strict
688 // equality with `'on'` keeps the parse deterministic — any
689 // other string (including a stale `true` / `false` boolean
690 // sent by a pre-Phase-16 client) reads as "off" rather than
691 // silently flipping based on truthiness.
692 await acpSession.setThinking(value === 'on');
693 break;
694 }
695 default:
696 throw RequestError.invalidParams(
697 { configId: params.configId },
698 `Unknown configId: ${params.configId}`,
699 );
700 }
701 return {
702 configOptions: await buildSessionConfigOptions(
703 this.harness,
704 acpSession.currentModelId,
705 acpSession.currentThinkingEnabled,
706 acpSession.currentModeId,
707 ),
708 };
709 }
710
711 /**
712 * Handle ACP `session/list`. Forwards to

Calls 5

getMethod · 0.65
setModelMethod · 0.45
setModeMethod · 0.45
setThinkingMethod · 0.45

Tested by

no test coverage detected