From 8d1b1178cdf90ac5a3995f9cc9daf7d081d85373 Mon Sep 17 00:00:00 2001 From: Ramiz Wachtler Date: Wed, 2 Sep 2026 14:53:49 +0200 Subject: [PATCH] docs(coding-agent): clarify session-scoped model/thinking-level changes (#9009) - fixes #8976 --- packages/coding-agent/docs/extensions.md | 6 ++++-- packages/coding-agent/src/core/extensions/types.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/coding-agent/docs/extensions.md b/packages/coding-agent/docs/extensions.md index 03ca0d53b..dd89ceba1 100644 --- a/packages/coding-agent/docs/extensions.md +++ b/packages/coding-agent/docs/extensions.md @@ -1703,7 +1703,7 @@ Typical `sourceInfo.source` values: ### pi.setModel(model) -Set the current model. Returns `false` if no API key is available for the model. See [models.md](models.md) for configuring custom models. +Set the model for the current session. The change is recorded in session history and restored when that session is resumed, but it does not change the configured `defaultProvider` or `defaultModel` used by new sessions. Returns `false` if authentication is not configured for the model's provider. See [models.md](models.md) for configuring custom models. ```typescript const model = ctx.modelRegistry.find("anthropic", "claude-sonnet-4-5"); @@ -1717,7 +1717,9 @@ if (model) { ### pi.getThinkingLevel() / pi.setThinkingLevel(level) -Get or set the thinking level. Level is clamped to model capabilities (non-reasoning models always use "off"). Changes emit `thinking_level_select`. +Get the current thinking level. Level is clamped to model capabilities (non-reasoning models always use "off"). Changes emit `thinking_level_select`. + +`pi.setThinkingLevel()` changes the thinking level for the current session. The change is recorded in session history and restored when that session is resumed, but it does not change the configured default used by new sessions. ```typescript const current = pi.getThinkingLevel(); // "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" diff --git a/packages/coding-agent/src/core/extensions/types.ts b/packages/coding-agent/src/core/extensions/types.ts index 0b9474664..eaff3a86e 100644 --- a/packages/coding-agent/src/core/extensions/types.ts +++ b/packages/coding-agent/src/core/extensions/types.ts @@ -1412,13 +1412,19 @@ export interface ExtensionAPI { // Model and Thinking Level // ========================================================================= - /** Set the current model. Returns false if no API key available. */ + /** + * Set the model for the current session without changing the configured default for new sessions. + * Returns false if authentication is not configured for the model's provider. + */ setModel(model: Model): Promise; /** Get current thinking level. */ getThinkingLevel(): ThinkingLevel; - /** Set thinking level (clamped to model capabilities). */ + /** + * Set the thinking level (clamped to model capabilities) for the current session without changing the configured default + * for new sessions. + */ setThinkingLevel(level: ThinkingLevel): void; // =========================================================================