A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
add max thinking level so opus can match claude code's max reasoning (#229)
kt6323ff156b8d
diff --git a/packages/agent/CHANGELOG.md b/packages/agent/CHANGELOG.mdindex ce1c037d04..929330112c 100644--- a/packages/agent/CHANGELOG.md+++ b/packages/agent/CHANGELOG.md@@ -2,6 +2,10 @@## [Unreleased]+### Added++- Added `max` to the `ThinkingLevel` union so callers can request the top adaptive-thinking effort on supported Claude models.+## [0.1.3] - 2026-06-12## [0.1.2] - 2026-06-12diff --git a/packages/agent/src/types.ts b/packages/agent/src/types.tsindex 706a1be381..87feed164f 100644--- a/packages/agent/src/types.ts+++ b/packages/agent/src/types.ts@@ -266,10 +266,10 @@ export interface AgentLoopConfig extends SimpleStreamOptions {/*** Thinking/reasoning level for models that support it.- * Note: "xhigh" is only supported by selected model families. Use model thinking-level metadata- * from @earendil-works/pi-ai to detect support for a concrete model.+ * Note: "xhigh" and "max" are only supported by selected model families. Use model+ * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.*/-export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";+export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";/*** Extensible interface for custom app messages.diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.mdindex 6d7ce8cb81..16f8ae05b5 100644--- a/packages/ai/CHANGELOG.md+++ b/packages/ai/CHANGELOG.md@@ -2,6 +2,10 @@## [Unreleased]+### Added++- Added a `max` thinking level (above `xhigh`) and mapped each adaptive Claude family to the effort levels its API actually supports: Opus 4.6 / Sonnet 4.6 expose `max` (no `xhigh`); Opus 4.7 / Opus 4.8 / Fable 5 / Mythos 5 expose both `xhigh` and `max`; Mythos Preview exposes `max`. Adaptive thinking detection now also covers Opus 4.8 and the Fable/Mythos families on both the Anthropic and Bedrock providers.+## [0.1.3] - 2026-06-12## [0.1.2] - 2026-06-12diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.tsindex 5588922df4..c7ac3097ff 100644--- a/packages/ai/scripts/generate-models.ts+++ b/packages/ai/scripts/generate-models.ts@@ -209,8 +209,15 @@ function applyThinkingLevelMetadata(model: Model<any>): void {if (supportsOpenAiXhigh(model.id)) {mergeThinkingLevelMap(model, { xhigh: "xhigh" });}- if (model.id.includes("opus-4-6") || model.id.includes("opus-4.6")) {- mergeThinkingLevelMap(model, { xhigh: "max" });+ // Per-family effort support per the Anthropic effort docs. Opus 4.6 / Sonnet 4.6+ // have no xhigh; Fable 5 / Mythos 5 / Mythos Preview think every turn (off: null).+ if (+ model.id.includes("opus-4-6") ||+ model.id.includes("opus-4.6") ||+ model.id.includes("sonnet-4-6") ||+ model.id.includes("sonnet-4.6")+ ) {+ mergeThinkingLevelMap(model, { max: "max" });}if (model.id.includes("opus-4-7") ||@@ -218,7 +225,13 @@ function applyThinkingLevelMetadata(model: Model<any>): void {model.id.includes("opus-4-8") ||model.id.includes("opus-4.8")) {- mergeThinkingLevelMap(model, { xhigh: "xhigh" });+ mergeThinkingLevelMap(model, { xhigh: "xhigh", max: "max" });+ }+ if (model.id.includes("fable-5") || model.id.includes("mythos-5")) {+ mergeThinkingLevelMap(model, { off: null, xhigh: "xhigh", max: "max" });+ }+ if (model.id.includes("mythos-preview")) {+ mergeThinkingLevelMap(model, { off: null, max: "max" });}if (model.api === "openai-completions" && model.id.includes("deepseek-v4")) {mergeThinkingLevelMap(model, DEEPSEEK_V4_THINKING_LEVEL_MAP);diff --git a/packages/ai/src/models.generated.ts b/packages/ai/src/models.generated.tsindex f6356e94c5..ee7c34ac1b 100644--- a/packages/ai/src/models.generated.ts+++ b/packages/ai/src/models.generated.ts@@ -131,7 +131,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -149,7 +149,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -167,7 +167,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -202,6 +202,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -236,7 +237,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 16.5,@@ -254,7 +255,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -289,6 +290,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3.3,@@ -357,6 +359,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 11,@@ -408,7 +411,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5.5,@@ -426,7 +429,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5.5,@@ -444,7 +447,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5.5,@@ -479,6 +482,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3.3,@@ -496,6 +500,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -547,7 +552,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -565,7 +570,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -583,7 +588,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -618,6 +623,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -669,7 +675,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -687,7 +693,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -722,6 +728,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -1387,6 +1394,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -1455,7 +1463,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -1473,7 +1481,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -1491,7 +1499,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -1526,6 +1534,7 @@ export const MODELS = {provider: "amazon-bedrock",baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -1817,6 +1826,7 @@ export const MODELS = {provider: "anthropic",baseUrl: "https://api.anthropic.com",reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -1970,7 +1980,7 @@ export const MODELS = {provider: "anthropic",baseUrl: "https://api.anthropic.com",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -1988,7 +1998,7 @@ export const MODELS = {provider: "anthropic",baseUrl: "https://api.anthropic.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -2006,7 +2016,7 @@ export const MODELS = {provider: "anthropic",baseUrl: "https://api.anthropic.com",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -2092,6 +2102,7 @@ export const MODELS = {provider: "anthropic",baseUrl: "https://api.anthropic.com",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -2989,6 +3000,7 @@ export const MODELS = {provider: "cloudflare-ai-gateway",baseUrl: "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -3074,7 +3086,7 @@ export const MODELS = {provider: "cloudflare-ai-gateway",baseUrl: "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -3092,7 +3104,7 @@ export const MODELS = {provider: "cloudflare-ai-gateway",baseUrl: "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -3110,7 +3122,7 @@ export const MODELS = {provider: "cloudflare-ai-gateway",baseUrl: "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -3162,6 +3174,7 @@ export const MODELS = {provider: "cloudflare-ai-gateway",baseUrl: "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -4067,6 +4080,7 @@ export const MODELS = {headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false},reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -4122,7 +4136,7 @@ export const MODELS = {baseUrl: "https://api.individual.githubcopilot.com",headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -4141,7 +4155,7 @@ export const MODELS = {baseUrl: "https://api.individual.githubcopilot.com",headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -4160,7 +4174,7 @@ export const MODELS = {baseUrl: "https://api.individual.githubcopilot.com",headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -4217,6 +4231,7 @@ export const MODELS = {baseUrl: "https://api.individual.githubcopilot.com",headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -7524,7 +7539,7 @@ export const MODELS = {provider: "opencode",baseUrl: "https://opencode.ai/zen",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -7542,7 +7557,7 @@ export const MODELS = {provider: "opencode",baseUrl: "https://opencode.ai/zen",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -7560,7 +7575,7 @@ export const MODELS = {provider: "opencode",baseUrl: "https://opencode.ai/zen",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -7612,6 +7627,7 @@ export const MODELS = {provider: "opencode",baseUrl: "https://opencode.ai/zen",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -8598,6 +8614,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,+ thinkingLevelMap: {"off":null,"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -8683,7 +8700,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -8701,7 +8718,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 30,@@ -8719,7 +8736,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -8737,7 +8754,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 30,@@ -8755,7 +8772,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -8773,7 +8790,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 10,@@ -8825,6 +8842,7 @@ export const MODELS = {provider: "openrouter",baseUrl: "https://openrouter.ai/api/v1",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,@@ -12824,7 +12842,7 @@ export const MODELS = {baseUrl: "https://api.pinference.ai/api/v1",compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","supportsStrictMode":false},reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text"],cost: {input: 5,@@ -12843,7 +12861,7 @@ export const MODELS = {baseUrl: "https://api.pinference.ai/api/v1",compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","supportsStrictMode":false},reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text"],cost: {input: 5,@@ -12862,7 +12880,7 @@ export const MODELS = {baseUrl: "https://api.pinference.ai/api/v1",compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","supportsStrictMode":false},reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text"],cost: {input: 5,@@ -12899,6 +12917,7 @@ export const MODELS = {baseUrl: "https://api.pinference.ai/api/v1",compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","supportsStrictMode":false},reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text"],cost: {input: 3,@@ -13779,7 +13798,7 @@ export const MODELS = {provider: "vercel-ai-gateway",baseUrl: "https://ai-gateway.vercel.sh",reasoning: true,- thinkingLevelMap: {"xhigh":"max"},+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 5,@@ -13797,7 +13816,7 @@ export const MODELS = {provider: "vercel-ai-gateway",baseUrl: "https://ai-gateway.vercel.sh",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -13815,7 +13834,7 @@ export const MODELS = {provider: "vercel-ai-gateway",baseUrl: "https://ai-gateway.vercel.sh",reasoning: true,- thinkingLevelMap: {"xhigh":"xhigh"},+ thinkingLevelMap: {"xhigh":"xhigh","max":"max"},input: ["text", "image"],cost: {input: 5,@@ -13867,6 +13886,7 @@ export const MODELS = {provider: "vercel-ai-gateway",baseUrl: "https://ai-gateway.vercel.sh",reasoning: true,+ thinkingLevelMap: {"max":"max"},input: ["text", "image"],cost: {input: 3,diff --git a/packages/ai/src/models.ts b/packages/ai/src/models.tsindex 2125e685b9..144bd36913 100644--- a/packages/ai/src/models.ts+++ b/packages/ai/src/models.ts@@ -45,7 +45,7 @@ export function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usagereturn usage.cost;}-const EXTENDED_THINKING_LEVELS: ModelThinkingLevel[] = ["off", "minimal", "low", "medium", "high", "xhigh"];+const EXTENDED_THINKING_LEVELS: ModelThinkingLevel[] = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];export function getSupportedThinkingLevels<TApi extends Api>(model: Model<TApi>): ModelThinkingLevel[] {if (!model.reasoning) return ["off"];@@ -53,7 +53,7 @@ export function getSupportedThinkingLevels<TApi extends Api>(model: Model<TApi>)return EXTENDED_THINKING_LEVELS.filter((level) => {const mapped = model.thinkingLevelMap?.[level];if (mapped === null) return false;- if (level === "xhigh") return mapped !== undefined;+ if (level === "xhigh" || level === "max") return mapped !== undefined;return true;});}diff --git a/packages/ai/src/providers/amazon-bedrock.ts b/packages/ai/src/providers/amazon-bedrock.tsindex 1812d3c8da..47ff3f76c2 100644--- a/packages/ai/src/providers/amazon-bedrock.ts+++ b/packages/ai/src/providers/amazon-bedrock.ts@@ -21,7 +21,7 @@ import {ToolResultStatus,} from "@aws-sdk/client-bedrock-runtime";import type { DocumentType } from "@smithy/types";-import { calculateCost } from "../models.js";+import { calculateCost, clampThinkingLevel } from "../models.js";import type {Api,AssistantMessage,@@ -491,24 +491,30 @@ function getModelMatchCandidates(modelId: string, modelName?: string): string[]function supportsAdaptiveThinking(modelId: string, modelName?: string): boolean {const candidates = getModelMatchCandidates(modelId, modelName);- return candidates.some((s) => s.includes("opus-4-6") || s.includes("opus-4-7") || s.includes("sonnet-4-6"));-}--function supportsNativeXhighEffort(model: Model<"bedrock-converse-stream">): boolean {- const candidates = getModelMatchCandidates(model.id, model.name);- return candidates.some((s) => s.includes("opus-4-7"));+ return candidates.some(+ (s) =>+ s.includes("opus-4-6") ||+ s.includes("opus-4-7") ||+ s.includes("opus-4-8") ||+ s.includes("sonnet-4-6") ||+ s.includes("fable-5") ||+ s.includes("mythos-5") ||+ s.includes("mythos-preview"),+ );}function mapThinkingLevelToEffort(model: Model<"bedrock-converse-stream">,level: SimpleStreamOptions["reasoning"],): "low" | "medium" | "high" | "xhigh" | "max" {- if (level === "xhigh" && supportsNativeXhighEffort(model)) return "xhigh";-- const mapped = level ? model.thinkingLevelMap?.[level] : undefined;+ // Clamp to what the model actually supports so callers that bypass+ // clampThinkingLevel (e.g. passing reasoning: "xhigh" directly) can't send an+ // effort the model lacks — xhigh on a max-only model resolves to max, not xhigh.+ const effective = level ? clampThinkingLevel(model, level) : undefined;+ const mapped = effective ? model.thinkingLevelMap?.[effective] : undefined;if (typeof mapped === "string") return mapped as "low" | "medium" | "high" | "xhigh" | "max";- switch (level) {+ switch (effective) {case "minimal":case "low":return "low";@@ -516,6 +522,10 @@ function mapThinkingLevelToEffort(return "medium";case "high":return "high";+ case "xhigh":+ return "xhigh";+ case "max":+ return "max";default:return "high";}@@ -900,11 +910,12 @@ function buildAdditionalModelRequestFields(low: 2048,medium: 8192,high: 16384,- xhigh: 16384, // Claude doesn't support xhigh, clamp to high+ xhigh: 16384, // Budget-based Claude has no xhigh tier, clamp to high+ max: 16384, // Budget-based Claude has no max tier, clamp to high};- // Custom budgets override defaults (xhigh not in ThinkingBudgets, use high)- const level = options.reasoning === "xhigh" ? "high" : options.reasoning;+ // Custom budgets override defaults (xhigh/max not in ThinkingBudgets, use high)+ const level = options.reasoning === "xhigh" || options.reasoning === "max" ? "high" : options.reasoning;const budget = options.thinkingBudgets?.[level] ?? defaultBudgets[options.reasoning];return {diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.tsindex 62febfc311..3dafdf9d49 100644--- a/packages/ai/src/providers/anthropic.ts+++ b/packages/ai/src/providers/anthropic.ts@@ -7,7 +7,7 @@ import type {RawMessageStreamEvent,} from "@anthropic-ai/sdk/resources/messages.js";import { getEnvApiKey } from "../env-api-keys.js";-import { calculateCost } from "../models.js";+import { calculateCost, clampThinkingLevel } from "../models.js";import type {AnthropicMessagesCompat,Api,@@ -184,10 +184,10 @@ export interface AnthropicOptions extends StreamOptions {*/thinkingBudgetTokens?: number;/**- * Effort level for adaptive thinking (Opus 4.6+ and Sonnet 4.6).+ * Effort level for adaptive thinking (Opus 4.6+, Sonnet 4.6, Fable/Mythos).* Controls how much thinking Claude allocates:- * - "max": Always thinks with no constraints (Opus 4.6 only)- * - "xhigh": Highest reasoning level (Opus 4.7)+ * - "max": Always thinks with no constraints (Opus 4.6+, Sonnet 4.6, Fable/Mythos)+ * - "xhigh": Highest reasoning level (Opus 4.7+, Fable 5, Mythos 5)* - "high": Always thinks, deep reasoning (default)* - "medium": Moderate thinking, may skip for simple queries* - "low": Minimal thinking, skips for simple tasks@@ -679,29 +679,39 @@ export const streamAnthropic: StreamFunction<"anthropic-messages", AnthropicOpti* Check if a model supports adaptive thinking (Opus 4.6+, Sonnet 4.6)*/function supportsAdaptiveThinking(modelId: string): boolean {- // Adaptive-thinking model IDs (with or without date suffix)+ // Adaptive-thinking model IDs (with or without date suffix).return (modelId.includes("opus-4-6") ||modelId.includes("opus-4.6") ||modelId.includes("opus-4-7") ||modelId.includes("opus-4.7") ||+ modelId.includes("opus-4-8") ||+ modelId.includes("opus-4.8") ||modelId.includes("sonnet-4-6") ||- modelId.includes("sonnet-4.6")+ modelId.includes("sonnet-4.6") ||+ modelId.includes("fable-5") ||+ modelId.includes("mythos-5") ||+ modelId.includes("mythos-preview"));}/**- * Map ThinkingLevel to Anthropic effort levels for adaptive thinking.- * Note: effort "max" is only valid on Opus 4.6, while Opus 4.7 supports "xhigh".+ * Map ThinkingLevel to Anthropic effort levels for adaptive thinking. The effort is+ * driven by each model's `thinkingLevelMap` (see generate-models.ts); the switch is a+ * fallback for levels without an explicit mapping.*/function mapThinkingLevelToEffort(model: Model<"anthropic-messages">,level: SimpleStreamOptions["reasoning"],): AnthropicEffort {- const mapped = level ? model.thinkingLevelMap?.[level] : undefined;+ // Clamp to what the model actually supports so callers that bypass+ // clampThinkingLevel (e.g. passing reasoning: "xhigh" directly) can't send an+ // effort the model lacks — xhigh on a max-only model resolves to max, not xhigh.+ const effective = level ? clampThinkingLevel(model, level) : undefined;+ const mapped = effective ? model.thinkingLevelMap?.[effective] : undefined;if (typeof mapped === "string") return mapped as AnthropicEffort;- switch (level) {+ switch (effective) {case "minimal":case "low":return "low";@@ -709,6 +719,10 @@ function mapThinkingLevelToEffort(return "medium";case "high":return "high";+ case "xhigh":+ return "xhigh";+ case "max":+ return "max";default:return "high";}@@ -931,9 +945,9 @@ function buildParams(// Adaptive thinking: Claude decides when and how much to think.params.thinking = { type: "adaptive", display };if (options.effort) {- // The Anthropic SDK types can lag newly supported effort values such as "xhigh".+ // The Anthropic SDK types can lag newly supported effort values such as "xhigh"/"max".params.output_config =- options.effort === "xhigh"+ options.effort === "xhigh" || options.effort === "max"? ({ effort: options.effort } as unknown as NonNullable<MessageCreateParamsStreaming["output_config"]>)diff --git a/packages/ai/src/providers/azure-openai-responses.ts b/packages/ai/src/providers/azure-openai-responses.tsindex 5d4bc9c61a..8b425fbfc9 100644--- a/packages/ai/src/providers/azure-openai-responses.ts+++ b/packages/ai/src/providers/azure-openai-responses.ts@@ -42,7 +42,7 @@ function resolveDeploymentName(model: Model<"azure-openai-responses">, options?:// Azure OpenAI Responses-specific optionsexport interface AzureOpenAIResponsesOptions extends StreamOptions {- reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";+ reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max";reasoningSummary?: "auto" | "detailed" | "concise" | null;azureApiVersion?: string;azureResourceName?: string;diff --git a/packages/ai/src/providers/google-vertex.ts b/packages/ai/src/providers/google-vertex.tsindex e29adcb1b2..954fa511d9 100644--- a/packages/ai/src/providers/google-vertex.ts+++ b/packages/ai/src/providers/google-vertex.ts@@ -483,7 +483,7 @@ function buildParams(return params;}-type ClampedThinkingLevel = Exclude<PiThinkingLevel, "xhigh">;+type ClampedThinkingLevel = Exclude<PiThinkingLevel, "xhigh" | "max">;function isGemini3ProModel(model: Model<"google-generative-ai">): boolean {return /gemini-3(?:\.\d+)?-pro/.test(model.id.toLowerCase());diff --git a/packages/ai/src/providers/google.ts b/packages/ai/src/providers/google.tsindex fd1adfdd98..5af34c0a5e 100644--- a/packages/ai/src/providers/google.ts+++ b/packages/ai/src/providers/google.ts@@ -393,7 +393,7 @@ function buildParams(return params;}-type ClampedThinkingLevel = Exclude<ThinkingLevel, "xhigh">;+type ClampedThinkingLevel = Exclude<ThinkingLevel, "xhigh" | "max">;function isGemma4Model(model: Model<"google-generative-ai">): boolean {return /gemma-?4/.test(model.id.toLowerCase());diff --git a/packages/ai/src/providers/openai-codex-responses.ts b/packages/ai/src/providers/openai-codex-responses.tsindex 9df9c9ec73..669a3ab1d4 100644--- a/packages/ai/src/providers/openai-codex-responses.ts+++ b/packages/ai/src/providers/openai-codex-responses.ts@@ -68,7 +68,7 @@ const CODEX_RESPONSE_STATUSES = new Set<CodexResponseStatus>([// ============================================================================export interface OpenAICodexResponsesOptions extends StreamOptions {- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";reasoningSummary?: "auto" | "concise" | "detailed" | "off" | "on" | null;serviceTier?: ResponseCreateParamsStreaming["service_tier"];textVerbosity?: "low" | "medium" | "high";diff --git a/packages/ai/src/providers/openai-completions.ts b/packages/ai/src/providers/openai-completions.tsindex d8495eda82..667a9ecb08 100644--- a/packages/ai/src/providers/openai-completions.ts+++ b/packages/ai/src/providers/openai-completions.ts@@ -76,7 +76,7 @@ function isImageContentBlock(block: { type: string }): block is ImageContent {export interface OpenAICompletionsOptions extends StreamOptions {toolChoice?: "auto" | "none" | "required" | { type: "function"; function: { name: string } };- reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";+ reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max";}interface OpenAICompatCacheControl {diff --git a/packages/ai/src/providers/openai-responses.ts b/packages/ai/src/providers/openai-responses.tsindex 8cc446d3fd..6884d08d87 100644--- a/packages/ai/src/providers/openai-responses.ts+++ b/packages/ai/src/providers/openai-responses.ts@@ -53,7 +53,7 @@ function getPromptCacheRetention(// OpenAI Responses-specific optionsexport interface OpenAIResponsesOptions extends StreamOptions {- reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";+ reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max";reasoningSummary?: "auto" | "detailed" | "concise" | null;serviceTier?: ResponseCreateParamsStreaming["service_tier"];}diff --git a/packages/ai/src/providers/simple-options.ts b/packages/ai/src/providers/simple-options.tsindex 914ba5e78e..1e2e3303b7 100644--- a/packages/ai/src/providers/simple-options.ts+++ b/packages/ai/src/providers/simple-options.ts@@ -19,8 +19,9 @@ export function buildBaseOptions(model: Model<Api>, options?: SimpleStreamOption};}-export function clampReasoning(effort: ThinkingLevel | undefined): Exclude<ThinkingLevel, "xhigh"> | undefined {- return effort === "xhigh" ? "high" : effort;+export function clampReasoning(effort: ThinkingLevel | undefined): Exclude<ThinkingLevel, "xhigh" | "max"> | undefined {+ // Token-budget providers have no distinct xhigh/max budget tier; clamp both to high.+ return effort === "xhigh" || effort === "max" ? "high" : effort;}export function adjustMaxTokensForThinking(diff --git a/packages/ai/src/types.ts b/packages/ai/src/types.tsindex d428f81bb7..90f12b7c8d 100644--- a/packages/ai/src/types.ts+++ b/packages/ai/src/types.ts@@ -51,7 +51,7 @@ export type KnownProvider =| "xiaomi-token-plan-sgp";export type Provider = KnownProvider | string;-export type ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh";+export type ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";export type ModelThinkingLevel = "off" | ThinkingLevel;export type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;diff --git a/packages/ai/test/anthropic-thinking-disable.test.ts b/packages/ai/test/anthropic-thinking-disable.test.tsindex 8f871514c2..6fbf3c1d61 100644--- a/packages/ai/test/anthropic-thinking-disable.test.ts+++ b/packages/ai/test/anthropic-thinking-disable.test.ts@@ -138,6 +138,33 @@ describe("Anthropic thinking disable payload", () => {expect(payload.thinking).toEqual({ type: "adaptive", display: "summarized" });expect(payload.output_config).toEqual({ effort: "xhigh" });});++ it("maps max reasoning to effort=max for Claude Opus 4.7", async () => {+ const payload = await capturePayload(getModel("anthropic", "claude-opus-4-7"), { reasoning: "max" });++ expect(payload.thinking).toEqual({ type: "adaptive", display: "summarized" });+ expect(payload.output_config).toEqual({ effort: "max" });+ });++ it("maps max reasoning to effort=max for Claude Opus 4.6 (no native xhigh)", async () => {+ const payload = await capturePayload(getModel("anthropic", "claude-opus-4-6"), { reasoning: "max" });++ expect(payload.thinking).toEqual({ type: "adaptive", display: "summarized" });+ expect(payload.output_config).toEqual({ effort: "max" });+ });++ it("clamps xhigh reasoning to effort=max for Claude Opus 4.6 (no native xhigh)", async () => {+ const payload = await capturePayload(getModel("anthropic", "claude-opus-4-6"), { reasoning: "xhigh" });++ expect(payload.output_config).toEqual({ effort: "max" });+ });++ it("maps max reasoning to effort=max for Claude Sonnet 4.6 (no native xhigh)", async () => {+ const payload = await capturePayload(getModel("anthropic", "claude-sonnet-4-6"), { reasoning: "max" });++ expect(payload.thinking).toEqual({ type: "adaptive", display: "summarized" });+ expect(payload.output_config).toEqual({ effort: "max" });+ });});describe.skipIf(!process.env.ANTHROPIC_API_KEY)("Anthropic thinking disable E2E", () => {diff --git a/packages/ai/test/bedrock-thinking-payload.test.ts b/packages/ai/test/bedrock-thinking-payload.test.tsindex 63ed884559..54b348138d 100644--- a/packages/ai/test/bedrock-thinking-payload.test.ts+++ b/packages/ai/test/bedrock-thinking-payload.test.ts@@ -62,12 +62,7 @@ describe("Bedrock thinking payload", () => {});it("maps xhigh reasoning to effort=xhigh for Claude Opus 4.7", async () => {- const baseModel = getModel("amazon-bedrock", "global.anthropic.claude-opus-4-6-v1");- const model: Model<"bedrock-converse-stream"> = {- ...baseModel,- id: "global.anthropic.claude-opus-4-7-v1",- name: "Claude Opus 4.7 (Global)",- };+ const model = getModel("amazon-bedrock", "global.anthropic.claude-opus-4-7");const payload = await capturePayload(model, { reasoning: "xhigh" });@@ -76,6 +71,24 @@ describe("Bedrock thinking payload", () => {expect(payload.additionalModelRequestFields?.anthropic_beta).toBeUndefined();});+ it("clamps xhigh reasoning to effort=max for Claude Opus 4.6 (no native xhigh)", async () => {+ const model = getModel("amazon-bedrock", "global.anthropic.claude-opus-4-6-v1");++ const payload = await capturePayload(model, { reasoning: "xhigh" });++ expect(payload.additionalModelRequestFields?.output_config).toEqual({ effort: "max" });+ });++ it("maps max reasoning to effort=max for Claude Opus 4.6 (adaptive)", async () => {+ const model = getModel("amazon-bedrock", "global.anthropic.claude-opus-4-6-v1");++ const payload = await capturePayload(model, { reasoning: "max" });++ expect(payload.additionalModelRequestFields?.thinking).toEqual({ type: "adaptive", display: "summarized" });+ expect(payload.additionalModelRequestFields?.output_config).toEqual({ effort: "max" });+ expect(payload.additionalModelRequestFields?.anthropic_beta).toBeUndefined();+ });+it("omits display for GovCloud model ids on non-adaptive Claude thinking", async () => {const baseModel = getModel("amazon-bedrock", "us.anthropic.claude-sonnet-4-5-20250929-v1:0");const model: Model<"bedrock-converse-stream"> = {diff --git a/packages/ai/test/prime-inference-models.test.ts b/packages/ai/test/prime-inference-models.test.tsindex fbeba486fe..2c51ac82a4 100644--- a/packages/ai/test/prime-inference-models.test.ts+++ b/packages/ai/test/prime-inference-models.test.ts@@ -70,8 +70,9 @@ describe("Prime Inference models", () => {it("marks known reasoning-capable Prime Inference model families", () => {const opus48 = getModel("prime-inference", "anthropic/claude-opus-4.8");expect(opus48.reasoning).toBe(true);- expect(opus48.thinkingLevelMap).toEqual({ xhigh: "xhigh" });+ expect(opus48.thinkingLevelMap).toEqual({ xhigh: "xhigh", max: "max" });expect(getSupportedThinkingLevels(opus48)).toContain("xhigh");+ expect(getSupportedThinkingLevels(opus48)).toContain("max");expect(getModel("prime-inference", "anthropic/claude-opus-4.7").reasoning).toBe(true);const deepseekV4Flash = getModel("prime-inference", "deepseek/deepseek-v4-flash");diff --git a/packages/ai/test/supports-xhigh.test.ts b/packages/ai/test/supports-xhigh.test.tsindex 6a66ee94c8..dab0f7057b 100644--- a/packages/ai/test/supports-xhigh.test.ts+++ b/packages/ai/test/supports-xhigh.test.ts@@ -2,16 +2,42 @@ import { describe, expect, it } from "vitest";import { getModel, getSupportedThinkingLevels } from "../src/models.js";describe("getSupportedThinkingLevels", () => {- it("includes xhigh for Anthropic Opus 4.6 on anthropic-messages API", () => {+ it("includes max but not xhigh for Anthropic Opus 4.6 on anthropic-messages API", () => {const model = getModel("anthropic", "claude-opus-4-6");expect(model).toBeDefined();- expect(getSupportedThinkingLevels(model!)).toContain("xhigh");+ const levels = getSupportedThinkingLevels(model!);+ expect(levels).toContain("max");+ expect(levels).not.toContain("xhigh");});- it("includes xhigh for Anthropic Opus 4.7 on anthropic-messages API", () => {+ it("includes both xhigh and max for Anthropic Opus 4.7 on anthropic-messages API", () => {const model = getModel("anthropic", "claude-opus-4-7");expect(model).toBeDefined();- expect(getSupportedThinkingLevels(model!)).toContain("xhigh");+ const levels = getSupportedThinkingLevels(model!);+ expect(levels).toContain("xhigh");+ expect(levels).toContain("max");+ });++ it("includes both xhigh and max for Anthropic Opus 4.8 on anthropic-messages API", () => {+ const model = getModel("anthropic", "claude-opus-4-8");+ expect(model).toBeDefined();+ const levels = getSupportedThinkingLevels(model!);+ expect(levels).toContain("xhigh");+ expect(levels).toContain("max");+ });++ it("includes max but not xhigh for Anthropic Sonnet 4.6 (adaptive thinking)", () => {+ const model = getModel("anthropic", "claude-sonnet-4-6");+ expect(model).toBeDefined();+ const levels = getSupportedThinkingLevels(model!);+ expect(levels).toContain("max");+ expect(levels).not.toContain("xhigh");+ });++ it("does not include max for older budget-based Claude models", () => {+ const model = getModel("anthropic", "claude-sonnet-4-5");+ expect(model).toBeDefined();+ expect(getSupportedThinkingLevels(model!)).not.toContain("max");});it("does not include xhigh for non-Opus Anthropic models", () => {@@ -44,9 +70,11 @@ describe("getSupportedThinkingLevels", () => {expect(getSupportedThinkingLevels(model!)).toEqual(["off", "high", "xhigh"]);});- it("includes xhigh for OpenRouter Opus 4.6 (openai-completions API)", () => {+ it("includes max but not xhigh for OpenRouter Opus 4.6 (openai-completions API)", () => {const model = getModel("openrouter", "anthropic/claude-opus-4.6");expect(model).toBeDefined();- expect(getSupportedThinkingLevels(model!)).toContain("xhigh");+ const levels = getSupportedThinkingLevels(model!);+ expect(levels).toContain("max");+ expect(levels).not.toContain("xhigh");});});diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex 6d48e69c89..50e26ec885 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -4,6 +4,7 @@### Added+- Added a `max` thinking level to the thinking selector, `--thinking` flag, and settings, exposing the top reasoning effort on Claude models that support it (e.g. Opus 4.6+/Sonnet 4.6).- Added opt-in Prime Agent trace sharing with `/traces` and background uploads of persisted session JSONL files.- Added a first draft of daemon-backed cron jobs for scheduling prompts against long-running sessions without using `/goal`.diff --git a/packages/coding-agent/examples/extensions/preset.ts b/packages/coding-agent/examples/extensions/preset.tsindex f9338456b3..849f82d699 100644--- a/packages/coding-agent/examples/extensions/preset.ts+++ b/packages/coding-agent/examples/extensions/preset.ts@@ -52,7 +52,7 @@ interface Preset {/** Model ID (e.g., "claude-sonnet-4-5") */model?: string;/** Thinking level */- thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";+ thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";/** Tools to enable (replaces default set) */tools?: string[];/** Instructions to append to system prompt */@@ -100,7 +100,7 @@ function loadPresets(cwd: string): PresetsConfig {interface OriginalState {model: Model<Api> | undefined;- thinkingLevel: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";+ thinkingLevel: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";tools: string[];}diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.tsindex f1a7453506..d156c06a23 100644--- a/packages/coding-agent/src/cli/args.ts+++ b/packages/coding-agent/src/cli/args.ts@@ -52,7 +52,7 @@ export interface Args {diagnostics: Array<{ type: "warning" | "error"; message: string }>;}-const VALID_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const;+const VALID_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;const REMOVED_BUILTIN_TOOL_NAMES = new Set(["read", "write", "grep", "find", "ls"]);const BUILTIN_TOOL_NAMES = ["ipython", "bash", "edit"];@@ -252,7 +252,7 @@ ${chalk.bold("Options:")}--no-builtin-tools, -nbt Disable built-in tools by default but keep extension/custom tools enabled--tools, -t <tools> Comma-separated allowlist of tool names to enableApplies to built-in, extension, and custom tools- --thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh+ --thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh, max--extension, -e <path> Load an extension file (can be used multiple times)--no-extensions, -ne Disable extension discovery (explicit -e paths still work)--skill <path> Load a skill file or directory (can be used multiple times)diff --git a/packages/coding-agent/src/core/model-registry.ts b/packages/coding-agent/src/core/model-registry.tsindex e7452b8c7b..8b8ecefc70 100644--- a/packages/coding-agent/src/core/model-registry.ts+++ b/packages/coding-agent/src/core/model-registry.ts@@ -89,6 +89,7 @@ const ThinkingLevelMapSchema = Type.Object({medium: Type.Optional(ThinkingLevelMapValueSchema),high: Type.Optional(ThinkingLevelMapValueSchema),xhigh: Type.Optional(ThinkingLevelMapValueSchema),+ max: Type.Optional(ThinkingLevelMapValueSchema),});const OpenAICompletionsCompatSchema = Type.Object({diff --git a/packages/coding-agent/src/core/settings-manager.ts b/packages/coding-agent/src/core/settings-manager.tsindex e4a13419a1..a34798a2e8 100644--- a/packages/coding-agent/src/core/settings-manager.ts+++ b/packages/coding-agent/src/core/settings-manager.ts@@ -77,7 +77,7 @@ export interface Settings {onboardingCompleted?: boolean;defaultProvider?: string;defaultModel?: string;- defaultThinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";+ defaultThinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";transport?: TransportSetting; // default: "auto"steeringMode?: "all" | "one-at-a-time";followUpMode?: "all" | "one-at-a-time";@@ -648,11 +648,11 @@ export class SettingsManager {this.save();}- getDefaultThinkingLevel(): "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined {+ getDefaultThinkingLevel(): "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined {return this.settings.defaultThinkingLevel;}- setDefaultThinkingLevel(level: "off" | "minimal" | "low" | "medium" | "high" | "xhigh"): void {+ setDefaultThinkingLevel(level: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"): void {this.globalSettings.defaultThinkingLevel = level;this.markModified("defaultThinkingLevel");this.save();diff --git a/packages/coding-agent/src/modes/interactive/components/settings-selector.ts b/packages/coding-agent/src/modes/interactive/components/settings-selector.tsindex 019b9822ac..206fd4134d 100644--- a/packages/coding-agent/src/modes/interactive/components/settings-selector.ts+++ b/packages/coding-agent/src/modes/interactive/components/settings-selector.ts@@ -26,7 +26,8 @@ const THINKING_DESCRIPTIONS: Record<ThinkingLevel, string> = {low: "Light reasoning (~2k tokens)",medium: "Moderate reasoning (~8k tokens)",high: "Deep reasoning (~16k tokens)",- xhigh: "Maximum reasoning (~32k tokens)",+ xhigh: "Very deep reasoning (~32k tokens)",+ max: "Maximum reasoning (unconstrained)",};export interface SettingsConfig {diff --git a/packages/coding-agent/src/modes/interactive/components/thinking-selector.ts b/packages/coding-agent/src/modes/interactive/components/thinking-selector.tsindex 9eadb86f6a..59ca11cdc6 100644--- a/packages/coding-agent/src/modes/interactive/components/thinking-selector.ts+++ b/packages/coding-agent/src/modes/interactive/components/thinking-selector.ts@@ -14,7 +14,8 @@ const LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {low: "Light reasoning (~2k tokens)",medium: "Moderate reasoning (~8k tokens)",high: "Deep reasoning (~16k tokens)",- xhigh: "Maximum reasoning (~32k tokens)",+ xhigh: "Very deep reasoning (~32k tokens)",+ max: "Maximum reasoning (unconstrained)",};/**diff --git a/packages/coding-agent/src/modes/interactive/theme/theme.ts b/packages/coding-agent/src/modes/interactive/theme/theme.tsindex 0ac8912842..83de347200 100644--- a/packages/coding-agent/src/modes/interactive/theme/theme.ts+++ b/packages/coding-agent/src/modes/interactive/theme/theme.ts@@ -479,7 +479,9 @@ export class Theme {return this.mode;}- getThinkingBorderColor(level: "off" | "minimal" | "low" | "medium" | "high" | "xhigh"): (str: string) => string {+ getThinkingBorderColor(+ level: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max",+ ): (str: string) => string {// Map thinking levels to dedicated theme colorsswitch (level) {case "off":@@ -494,6 +496,9 @@ export class Theme {return (str: string) => this.fg("thinkingHigh", str);case "xhigh":return (str: string) => this.fg("thinkingXhigh", str);+ case "max":+ // Reuse the xhigh color: a dedicated max color would touch every theme preset.+ return (str: string) => this.fg("thinkingXhigh", str);default:return (str: string) => this.fg("thinkingOff", str);}