@framers/agentos 0.10.23 → 0.10.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/api/AgentOS.d.ts.map +1 -1
  2. package/dist/api/AgentOS.js +3 -2
  3. package/dist/api/AgentOS.js.map +1 -1
  4. package/dist/api/agent.d.ts.map +1 -1
  5. package/dist/api/agent.js +25 -10
  6. package/dist/api/agent.js.map +1 -1
  7. package/dist/api/embedText.d.ts.map +1 -1
  8. package/dist/api/embedText.js +53 -17
  9. package/dist/api/embedText.js.map +1 -1
  10. package/dist/api/generateImage.d.ts.map +1 -1
  11. package/dist/api/generateImage.js +51 -7
  12. package/dist/api/generateImage.js.map +1 -1
  13. package/dist/api/generateText.d.ts +36 -6
  14. package/dist/api/generateText.d.ts.map +1 -1
  15. package/dist/api/generateText.js +102 -17
  16. package/dist/api/generateText.js.map +1 -1
  17. package/dist/api/model.d.ts.map +1 -1
  18. package/dist/api/model.js +6 -3
  19. package/dist/api/model.js.map +1 -1
  20. package/dist/api/runtime/SelfImprovementSessionManager.d.ts +34 -2
  21. package/dist/api/runtime/SelfImprovementSessionManager.d.ts.map +1 -1
  22. package/dist/api/runtime/SelfImprovementSessionManager.js +119 -33
  23. package/dist/api/runtime/SelfImprovementSessionManager.js.map +1 -1
  24. package/dist/api/runtime/provider-defaults.d.ts.map +1 -1
  25. package/dist/api/runtime/provider-defaults.js +5 -2
  26. package/dist/api/runtime/provider-defaults.js.map +1 -1
  27. package/dist/api/streamText.d.ts.map +1 -1
  28. package/dist/api/streamText.js +95 -19
  29. package/dist/api/streamText.js.map +1 -1
  30. package/dist/api/types/AgentOSInput.d.ts +11 -0
  31. package/dist/api/types/AgentOSInput.d.ts.map +1 -1
  32. package/dist/api/types.d.ts +14 -6
  33. package/dist/api/types.d.ts.map +1 -1
  34. package/dist/api/types.js.map +1 -1
  35. package/dist/cognition/emergent/AdaptPersonalityTool.d.ts +13 -4
  36. package/dist/cognition/emergent/AdaptPersonalityTool.d.ts.map +1 -1
  37. package/dist/cognition/emergent/AdaptPersonalityTool.js +32 -23
  38. package/dist/cognition/emergent/AdaptPersonalityTool.js.map +1 -1
  39. package/dist/cognition/emergent/EmergentCapabilityEngine.d.ts +18 -6
  40. package/dist/cognition/emergent/EmergentCapabilityEngine.d.ts.map +1 -1
  41. package/dist/cognition/emergent/EmergentCapabilityEngine.js.map +1 -1
  42. package/dist/cognition/emergent/SelfEvaluateTool.d.ts +10 -3
  43. package/dist/cognition/emergent/SelfEvaluateTool.d.ts.map +1 -1
  44. package/dist/cognition/emergent/SelfEvaluateTool.js +3 -2
  45. package/dist/cognition/emergent/SelfEvaluateTool.js.map +1 -1
  46. package/dist/cognition/substrate/CognitiveMemoryBridge.d.ts +51 -2
  47. package/dist/cognition/substrate/CognitiveMemoryBridge.d.ts.map +1 -1
  48. package/dist/cognition/substrate/CognitiveMemoryBridge.js +84 -2
  49. package/dist/cognition/substrate/CognitiveMemoryBridge.js.map +1 -1
  50. package/dist/cognition/substrate/ConversationHistoryManager.d.ts +8 -4
  51. package/dist/cognition/substrate/ConversationHistoryManager.d.ts.map +1 -1
  52. package/dist/cognition/substrate/ConversationHistoryManager.js +17 -5
  53. package/dist/cognition/substrate/ConversationHistoryManager.js.map +1 -1
  54. package/dist/cognition/substrate/GMI.d.ts +92 -5
  55. package/dist/cognition/substrate/GMI.d.ts.map +1 -1
  56. package/dist/cognition/substrate/GMI.js +291 -65
  57. package/dist/cognition/substrate/GMI.js.map +1 -1
  58. package/dist/cognition/substrate/GMIManager.d.ts +12 -0
  59. package/dist/cognition/substrate/GMIManager.d.ts.map +1 -1
  60. package/dist/cognition/substrate/GMIManager.js +22 -16
  61. package/dist/cognition/substrate/GMIManager.js.map +1 -1
  62. package/dist/cognition/substrate/IGMI.d.ts +23 -0
  63. package/dist/cognition/substrate/IGMI.d.ts.map +1 -1
  64. package/dist/cognition/substrate/IGMI.js.map +1 -1
  65. package/dist/cognition/substrate/MetapromptExecutor.d.ts +183 -28
  66. package/dist/cognition/substrate/MetapromptExecutor.d.ts.map +1 -1
  67. package/dist/cognition/substrate/MetapromptExecutor.js +431 -108
  68. package/dist/cognition/substrate/MetapromptExecutor.js.map +1 -1
  69. package/dist/cognition/substrate/personas/IPersonaDefinition.d.ts +5 -0
  70. package/dist/cognition/substrate/personas/IPersonaDefinition.d.ts.map +1 -1
  71. package/dist/cognition/substrate/personas/PersonaValidation.d.ts.map +1 -1
  72. package/dist/cognition/substrate/personas/PersonaValidation.js +30 -0
  73. package/dist/cognition/substrate/personas/PersonaValidation.js.map +1 -1
  74. package/dist/cognition/substrate/personas/SoulLoader.d.ts +14 -1
  75. package/dist/cognition/substrate/personas/SoulLoader.d.ts.map +1 -1
  76. package/dist/cognition/substrate/personas/SoulLoader.js +45 -12
  77. package/dist/cognition/substrate/personas/SoulLoader.js.map +1 -1
  78. package/dist/cognition/substrate/personas/definitions/default_assistant_persona.json +3 -35
  79. package/dist/cognition/substrate/personas/hexaco.d.ts +34 -0
  80. package/dist/cognition/substrate/personas/hexaco.d.ts.map +1 -0
  81. package/dist/cognition/substrate/personas/hexaco.js +66 -0
  82. package/dist/cognition/substrate/personas/hexaco.js.map +1 -0
  83. package/dist/cognition/substrate/userFeedback.d.ts +69 -0
  84. package/dist/cognition/substrate/userFeedback.d.ts.map +1 -0
  85. package/dist/cognition/substrate/userFeedback.js +107 -0
  86. package/dist/cognition/substrate/userFeedback.js.map +1 -0
  87. package/dist/core/conversation/ConversationMessage.d.ts +9 -0
  88. package/dist/core/conversation/ConversationMessage.d.ts.map +1 -1
  89. package/dist/core/conversation/ConversationMessage.js.map +1 -1
  90. package/dist/core/llm/IPromptEngine.d.ts +9 -0
  91. package/dist/core/llm/IPromptEngine.d.ts.map +1 -1
  92. package/dist/core/llm/IPromptEngine.js.map +1 -1
  93. package/dist/core/llm/PromptEngine.d.ts +30 -1
  94. package/dist/core/llm/PromptEngine.d.ts.map +1 -1
  95. package/dist/core/llm/PromptEngine.js +229 -92
  96. package/dist/core/llm/PromptEngine.js.map +1 -1
  97. package/dist/core/llm/providers/IProvider.d.ts +28 -8
  98. package/dist/core/llm/providers/IProvider.d.ts.map +1 -1
  99. package/dist/core/llm/providers/implementations/AnthropicProvider.d.ts +135 -49
  100. package/dist/core/llm/providers/implementations/AnthropicProvider.d.ts.map +1 -1
  101. package/dist/core/llm/providers/implementations/AnthropicProvider.js +294 -110
  102. package/dist/core/llm/providers/implementations/AnthropicProvider.js.map +1 -1
  103. package/dist/core/llm/providers/implementations/ClaudeCodeProvider.d.ts.map +1 -1
  104. package/dist/core/llm/providers/implementations/ClaudeCodeProvider.js +15 -1
  105. package/dist/core/llm/providers/implementations/ClaudeCodeProvider.js.map +1 -1
  106. package/dist/core/llm/providers/implementations/GeminiCLIProvider.d.ts +1 -1
  107. package/dist/core/llm/providers/implementations/GeminiCLIProvider.d.ts.map +1 -1
  108. package/dist/core/llm/providers/implementations/GeminiCLIProvider.js +51 -24
  109. package/dist/core/llm/providers/implementations/GeminiCLIProvider.js.map +1 -1
  110. package/dist/core/llm/providers/implementations/GeminiProvider.d.ts +19 -6
  111. package/dist/core/llm/providers/implementations/GeminiProvider.d.ts.map +1 -1
  112. package/dist/core/llm/providers/implementations/GeminiProvider.js +62 -24
  113. package/dist/core/llm/providers/implementations/GeminiProvider.js.map +1 -1
  114. package/dist/core/llm/providers/implementations/OpenAIProvider.d.ts +53 -2
  115. package/dist/core/llm/providers/implementations/OpenAIProvider.d.ts.map +1 -1
  116. package/dist/core/llm/providers/implementations/OpenAIProvider.js +77 -10
  117. package/dist/core/llm/providers/implementations/OpenAIProvider.js.map +1 -1
  118. package/dist/core/llm/providers/implementations/cacheLeakDetector.d.ts +15 -7
  119. package/dist/core/llm/providers/implementations/cacheLeakDetector.d.ts.map +1 -1
  120. package/dist/core/llm/providers/implementations/cacheLeakDetector.js +12 -7
  121. package/dist/core/llm/providers/implementations/cacheLeakDetector.js.map +1 -1
  122. package/dist/core/llm/providers/model-cache-capabilities.d.ts +24 -9
  123. package/dist/core/llm/providers/model-cache-capabilities.d.ts.map +1 -1
  124. package/dist/core/llm/providers/model-cache-capabilities.js +59 -44
  125. package/dist/core/llm/providers/model-cache-capabilities.js.map +1 -1
  126. package/dist/core/llm/providers/model-effort.d.ts +14 -0
  127. package/dist/core/llm/providers/model-effort.d.ts.map +1 -1
  128. package/dist/core/llm/providers/model-effort.js +22 -0
  129. package/dist/core/llm/providers/model-effort.js.map +1 -1
  130. package/dist/core/llm/providers/model-forced-tool-choice.d.ts +13 -6
  131. package/dist/core/llm/providers/model-forced-tool-choice.d.ts.map +1 -1
  132. package/dist/core/llm/providers/model-forced-tool-choice.js +14 -7
  133. package/dist/core/llm/providers/model-forced-tool-choice.js.map +1 -1
  134. package/dist/core/llm/providers/model-thinking.d.ts +64 -13
  135. package/dist/core/llm/providers/model-thinking.d.ts.map +1 -1
  136. package/dist/core/llm/providers/model-thinking.js +52 -12
  137. package/dist/core/llm/providers/model-thinking.js.map +1 -1
  138. package/dist/core/llm/streaming/StreamingBatcher.d.ts +4 -3
  139. package/dist/core/llm/streaming/StreamingBatcher.d.ts.map +1 -1
  140. package/dist/core/llm/streaming/StreamingBatcher.js +8 -3
  141. package/dist/core/llm/streaming/StreamingBatcher.js.map +1 -1
  142. package/dist/core/safety/LLMProviderHealthRegistry.d.ts +4 -0
  143. package/dist/core/safety/LLMProviderHealthRegistry.d.ts.map +1 -1
  144. package/dist/core/safety/LLMProviderHealthRegistry.js +26 -0
  145. package/dist/core/safety/LLMProviderHealthRegistry.js.map +1 -1
  146. package/dist/core/utils/sha256.d.ts +19 -0
  147. package/dist/core/utils/sha256.d.ts.map +1 -0
  148. package/dist/core/utils/sha256.js +101 -0
  149. package/dist/core/utils/sha256.js.map +1 -0
  150. package/dist/orchestration/pipeline/query/types.js +1 -1
  151. package/package.json +1 -1
@@ -5,12 +5,23 @@
5
5
  * 4-breakpoint cap) but MODEL-DEPENDENT in two behaviors that matter for
6
6
  * correct cache economics:
7
7
  *
8
- * 1. **Minimum cacheable prefix** — a marked prefix below the model's floor
9
- * silently never caches (create=0, no error). Floors per the pricing
10
- * docs: 4096 tokens (Opus 4.5-4.8, Haiku 4.5), 2048 (Fable/Mythos 5,
11
- * Sonnet 4.6, Haiku 3.x), 1024 (Sonnet 3.7-4.5).
8
+ * 1. **Minimum cacheable prefix**: a marked prefix below the model's floor
9
+ * silently never caches (create=0, no error). Floors per Anthropic's
10
+ * prompt-caching docs (2026-09-30):
12
11
  *
13
- * 2. **Prior-turn thinking retention** — on Opus 4.5+ and Sonnet 4.6+ (and
12
+ * | Floor | Models |
13
+ * | --- | --- |
14
+ * | 512 | Fable 5 / 5.1, Mythos 5 / 5.1, Opus 5 / 5.5, Sonnet 5.5 |
15
+ * | 1024 | Opus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5 and older Sonnet, Opus 4.0 / 4.1, Opus 3 |
16
+ * | 2048 | Opus 4.7, Mythos Preview, Haiku 3.x |
17
+ * | 4096 | Opus 4.5 / 4.6, Haiku 4.5 |
18
+ *
19
+ * The floors are not monotonic across generations, so each model gets
20
+ * its own row. Probes agree: nothing cached at about 820 tokens on the
21
+ * 1024-floor models, Sonnet 5 did not cache at 830 tokens, and Opus 4.5
22
+ * did not cache at 561.
23
+ *
24
+ * 2. **Prior-turn thinking retention**: on Opus 4.5+ and Sonnet 4.6+ (and
14
25
  * Fable/Mythos), thinking blocks from previous assistant turns are KEPT
15
26
  * in context by default, participate in prompt caching, and are billed
16
27
  * only when shown; on earlier Opus/Sonnet models and ALL Haiku models
@@ -20,15 +31,28 @@
20
31
  * may strip on non-retaining models (pure wire savings; cache-neutral
21
32
  * because the server discards them pre-cache either way).
22
33
  *
34
+ * The floor's one consumer is the cache-leak detector's `unmarked` threshold
35
+ * (cacheLeakDetector.ts); retention also drives the prior-thinking strip in
36
+ * AnthropicProvider.
37
+ *
23
38
  * Kept pure (no provider/SDK imports) like `model-thinking.ts` /
24
39
  * `model-effort.ts` so unit tests import no provider code. Matching is
25
40
  * prefix-tolerant (`anthropic/`, `anthropic:`, `anthropic.` and dated or
26
- * suffixed ids) with no `^` anchor, and defaults are chosen for UNKNOWN
27
- * (future) claude models: modern semantics (retains thinking) and the most
28
- * conservative floor (4096) so heuristics built on the floor stay
29
- * quiet-biased rather than noisy.
41
+ * suffixed ids) with no `^` anchor. An UNKNOWN (future) claude model gets
42
+ * modern semantics (retains thinking) and a 4096 floor, the highest of the
43
+ * table, so heuristics built on the floor stay quiet-biased rather than
44
+ * noisy.
30
45
  */
46
+ /** Floor for unknown claude ids: the highest in the table, so quiet-biased. */
31
47
  const MODERN_FLOOR = 4096;
48
+ /** Capabilities of a claude model that supports prompt caching. */
49
+ function caps(floor, retainsPriorThinking) {
50
+ return {
51
+ supportsPromptCaching: true,
52
+ minCacheablePrefixTokens: floor,
53
+ retainsPriorThinkingInContext: retainsPriorThinking,
54
+ };
55
+ }
32
56
  /**
33
57
  * Resolve the cache capabilities for an Anthropic model id.
34
58
  *
@@ -48,44 +72,35 @@ export function resolveCacheCapabilities(modelId) {
48
72
  };
49
73
  }
50
74
  // --- Haiku: never retains prior thinking, floors per generation ---
51
- if (/claude-haiku-4-5|claude-4-5-haiku/.test(id)) {
52
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 4096, retainsPriorThinkingInContext: false };
53
- }
54
- if (/claude-3-5-haiku|claude-3-haiku/.test(id)) {
55
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 2048, retainsPriorThinkingInContext: false };
56
- }
57
- // --- Fable / Mythos: modern semantics, 2048 floor ---
58
- if (/claude-(fable|mythos)-/.test(id)) {
59
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 2048, retainsPriorThinkingInContext: true };
60
- }
61
- // --- Opus 5: modern semantics (thinking on by default, retention holds).
62
- // Documented minimum cacheable prefix is 512; keep the same conservative
63
- // floor as the Fable/Mythos row so floor-based heuristics stay quiet-biased.
64
- if (/claude-opus-5/.test(id)) {
65
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 2048, retainsPriorThinkingInContext: true };
66
- }
75
+ if (/claude-haiku-4-5|claude-4-5-haiku/.test(id))
76
+ return caps(4096, false);
77
+ if (/claude-3-5-haiku|claude-3-haiku/.test(id))
78
+ return caps(2048, false);
79
+ // --- Fable, Mythos, Opus 5.x and Sonnet 5.5: modern semantics ---
80
+ // Mythos Preview runs before the Mythos 5.x match, which it does not share.
81
+ if (/claude-mythos-preview/.test(id))
82
+ return caps(2048, true);
83
+ // `sonnet-5-5\b` keeps Sonnet 5 (1024, below) out of this row.
84
+ if (/claude-(fable|mythos)-5|claude-opus-5|claude-sonnet-5-5\b/.test(id))
85
+ return caps(512, true);
67
86
  // --- Opus 4.x ---
68
- if (/claude-opus-4-(5|6|7|8)/.test(id)) {
69
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 4096, retainsPriorThinkingInContext: true };
70
- }
71
- if (/claude-opus-4|claude-3-opus/.test(id)) {
72
- // Opus 4.0/4.1 and Opus 3: pre-retention era. Floor not documented in
73
- // the current pricing table — keep the conservative 4096.
74
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 4096, retainsPriorThinkingInContext: false };
75
- }
87
+ if (/claude-opus-4-8/.test(id))
88
+ return caps(1024, true);
89
+ if (/claude-opus-4-7/.test(id))
90
+ return caps(2048, true);
91
+ if (/claude-opus-4-(5|6)/.test(id))
92
+ return caps(4096, true);
93
+ // Opus 4.0 / 4.1 and Opus 3: pre-retention era.
94
+ if (/claude-opus-4|claude-3-opus/.test(id))
95
+ return caps(1024, false);
76
96
  // --- Sonnet ---
77
- if (/claude-sonnet-4-6|claude-sonnet-5/.test(id)) {
78
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 2048, retainsPriorThinkingInContext: true };
79
- }
97
+ if (/claude-sonnet-4-6|claude-sonnet-5/.test(id))
98
+ return caps(1024, true);
80
99
  if (/claude-sonnet-4|claude-3-7-sonnet|claude-3-5-sonnet|claude-3-sonnet/.test(id)) {
81
- return { supportsPromptCaching: true, minCacheablePrefixTokens: 1024, retainsPriorThinkingInContext: false };
100
+ return caps(1024, false);
82
101
  }
83
- // Unknown / future claude model: assume modern semantics with the most
84
- // conservative floor, so floor-based heuristics stay quiet-biased.
85
- return {
86
- supportsPromptCaching: true,
87
- minCacheablePrefixTokens: MODERN_FLOOR,
88
- retainsPriorThinkingInContext: true,
89
- };
102
+ // Unknown / future claude model: modern semantics with the highest floor,
103
+ // so floor-based heuristics stay quiet-biased.
104
+ return caps(MODERN_FLOOR, true);
90
105
  }
91
106
  //# sourceMappingURL=model-cache-capabilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-cache-capabilities.js","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-cache-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAgBH,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEjC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACvB,iEAAiE;QACjE,mEAAmE;QACnE,OAAO;YACL,qBAAqB,EAAE,KAAK;YAC5B,wBAAwB,EAAE,YAAY;YACtC,6BAA6B,EAAE,KAAK;SACrC,CAAC;IACJ,CAAC;IAED,qEAAqE;IACrE,IAAI,mCAAmC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACjD,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,CAAC;IAC/G,CAAC;IACD,IAAI,iCAAiC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC/C,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,CA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IACnE,OAAO;QACL,qBAAqB,EAAE,IAAI;QAC3B,wBAAwB,EAAE,YAAY;QACtC,6BAA6B,EAAE,IAAI;KACpC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"model-cache-capabilities.js","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-cache-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAgBH,+EAA+E;AAC/E,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,mEAAmE;AACnE,SAAS,IAAI,CAAC,KAAa,EAAE,oBAA6B;IACxD,OAAO;QACL,qBAAqB,EAAE,IAAI;QAC3B,wBAAwB,EAAE,KAAK;QAC/B,6BAA6B,EAAE,oBAAoB;KACpD,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEjC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACvB,iEAAiE;QACjE,mEAAmE;QACnE,OAAO;YACL,qBAAqB,EAAE,KAAK;YAC5B,wBAAwB,EAAE,YAAY;YACtC,6BAA6B,EAAE,KAAK;SACrC,CAAC;IACJ,CAAC;IAED,qEAAqE;IACrE,IAAI,mCAAmC,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3E,IAAI,iCAAiC,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEzE,mEAAmE;IACnE,4EAA4E;IAC5E,IAAI,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9D,+DAA+D;IAC/D,IAAI,2DAA2D,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEjG,mBAAmB;IACnB,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5D,gDAAgD;IAChD,IAAI,6BAA6B,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAErE,iBAAiB;IACjB,IAAI,mCAAmC,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1E,IAAI,qEAAqE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACnF,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,0EAA0E;IAC1E,+CAA+C;IAC/C,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC"}
@@ -25,6 +25,20 @@ export type EffortLevel = (typeof EFFORT_LEVELS)[number];
25
25
  export declare function modelSupportsEffort(modelId: string): boolean;
26
26
  /** Whether a value is a valid effort level. */
27
27
  export declare function isEffortLevel(v: unknown): v is EffortLevel;
28
+ /**
29
+ * The `output_config.effort` to send to a Claude model, or undefined to omit
30
+ * it. Each model accepts its own ladder (Anthropic's model docs): Opus 4.5
31
+ * takes low, medium and high; Opus 4.6 and Sonnet 4.6 add max but not xhigh,
32
+ * which arrived with Opus 4.7; Opus 4.7 and later, Sonnet 5 and later, Fable
33
+ * and Mythos take all five. A level the model does not take is sent as
34
+ * `high` instead of returning 400. Matches bare and provider-prefixed ids,
35
+ * like {@link modelSupportsEffort}.
36
+ *
37
+ * @param modelId Anthropic-side model id.
38
+ * @param effort Caller-supplied effort value.
39
+ * @returns The level to send, or undefined for an unsupported model or value.
40
+ */
41
+ export declare function resolveAnthropicEffort(modelId: string, effort: unknown): EffortLevel | undefined;
28
42
  export declare function mapEffortToOpenAiReasoningEffort(effort: unknown): string | undefined;
29
43
  /**
30
44
  * Whether an OpenAI model accepts `reasoning.effort: 'xhigh'` on the
@@ -1 +1 @@
1
- {"version":3,"file":"model-effort.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-effort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,uFAAuF;AACvF,eAAO,MAAM,aAAa,oDAAqD,CAAC;AAChF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,WAAW,CAE1D;AAmBD,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzE;AA6BD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GACd,MAAM,GAAG,SAAS,CAKpB;AA8BD;;;;GAIG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAUpB"}
1
+ {"version":3,"file":"model-effort.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-effort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,uFAAuF;AACvF,eAAO,MAAM,aAAa,oDAAqD,CAAC;AAChF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,WAAW,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,CAKhG;AAmBD,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzE;AA6BD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GACd,MAAM,GAAG,SAAS,CAKpB;AA8BD;;;;GAIG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAUpB"}
@@ -28,6 +28,28 @@ export function modelSupportsEffort(modelId) {
28
28
  export function isEffortLevel(v) {
29
29
  return typeof v === 'string' && EFFORT_LEVELS.includes(v);
30
30
  }
31
+ /**
32
+ * The `output_config.effort` to send to a Claude model, or undefined to omit
33
+ * it. Each model accepts its own ladder (Anthropic's model docs): Opus 4.5
34
+ * takes low, medium and high; Opus 4.6 and Sonnet 4.6 add max but not xhigh,
35
+ * which arrived with Opus 4.7; Opus 4.7 and later, Sonnet 5 and later, Fable
36
+ * and Mythos take all five. A level the model does not take is sent as
37
+ * `high` instead of returning 400. Matches bare and provider-prefixed ids,
38
+ * like {@link modelSupportsEffort}.
39
+ *
40
+ * @param modelId Anthropic-side model id.
41
+ * @param effort Caller-supplied effort value.
42
+ * @returns The level to send, or undefined for an unsupported model or value.
43
+ */
44
+ export function resolveAnthropicEffort(modelId, effort) {
45
+ if (!isEffortLevel(effort) || !modelSupportsEffort(modelId))
46
+ return undefined;
47
+ if (/claude-opus-4-5/i.test(modelId) && (effort === 'xhigh' || effort === 'max'))
48
+ return 'high';
49
+ if (/claude-(opus|sonnet)-4-6/i.test(modelId) && effort === 'xhigh')
50
+ return 'high';
51
+ return effort;
52
+ }
31
53
  /**
32
54
  * OpenAI reasoning models (o-series, GPT-5 and GPT-6 families) take
33
55
  * `reasoning_effort` (none|low|medium|high|xhigh) — the OpenAI analogue of
@@ -1 +1 @@
1
- {"version":3,"file":"model-effort.js","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-effort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,uFAAuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAGhF;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,OAAO,mEAAmE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC3F,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,aAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;;;GASG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C,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACxF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,sBAAsB,GAAsB,EAAE,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,MAAe,EACf,OAAe;IAEf,MAAM,IAAI,GAAG,gCAAgC,CAAC,MAAM,CAAC,CAAC;IACtD,IACE,MAAM,KAAK,KAAK;WACb,IAAI,KAAK,OAAO;WAChB,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAC1E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -5,9 +5,10 @@
5
5
  * Anthropic structured output and `toolChoice: 'required'` both resolve to a
6
6
  * FORCED `tool_choice` on the Messages API (`{ type: 'tool', name }` or
7
7
  * `{ type: 'any' }`). Most Claude models accept this, and it is the most
8
- * reliable way to constrain output. Claude Fable 5 / 5.1 and Claude Opus 5.5
9
- * reject a forced `tool_choice` at the API level with a 400. Those models can
10
- * still call tools under `{ type: 'auto' }`; they only refuse to be forced.
8
+ * reliable way to constrain output. Claude Fable 5 / 5.1, Claude Mythos 5.1,
9
+ * Claude Opus 5.5 and Claude Sonnet 5.5 reject a forced `tool_choice` at the
10
+ * API level with a 400. Those models can still call tools under
11
+ * `{ type: 'auto' }`; they only refuse to be forced.
11
12
  *
12
13
  * Two consumers read this:
13
14
  * - {@link AnthropicProvider} clamps any resolved forced `tool_choice` to
@@ -26,22 +27,28 @@
26
27
  * Whether Anthropic will accept a forced `tool_choice` (`{ type: 'tool' }` or
27
28
  * `{ type: 'any' }`) for the given Claude model id.
28
29
  *
29
- * Deny-by-explicit-model. Two families reject forced tool use, and every other
30
- * current Claude model (Sonnet, Opus 5 and earlier, Haiku) accepts it:
30
+ * Deny-by-explicit-model. These models reject forced tool use, and every
31
+ * other current Claude model (Sonnet 5 and earlier, Opus 5 and earlier,
32
+ * Haiku) accepts it:
31
33
  *
32
34
  * - Claude Fable 5 and 5.1, including dated variants such as
33
35
  * `claude-fable-5-20260601`. The `fable-5` alternative also matches
34
36
  * `claude-fable-5-1` because `\b` matches at the hyphen, which is intended
35
37
  * since 5.1 is the same family under the same constraint.
38
+ * - Claude Mythos 5.1 (`claude-mythos-5-1`), per Anthropic's model docs.
36
39
  * - Claude Opus 5.5 (`claude-opus-5-5`). Claude Opus 5 accepts forced tool
37
40
  * use, so the pattern names the full `opus-5-5` id. A bare `opus-5` prefix
38
41
  * would deny Opus 5 as well.
42
+ * - Claude Sonnet 5.5 (`claude-sonnet-5-5`). Claude Sonnet 5 accepts forced
43
+ * tool use, so the pattern names the full `sonnet-5-5` id for the same
44
+ * reason.
39
45
  *
40
46
  * Live-probed 2026-09-29 on the Messages API. `{type:'tool'}` and
41
47
  * `{type:'any'}` both return HTTP 400 on `claude-opus-5-5` and
42
48
  * `claude-fable-5-1`, with the message `tool_choice: type "tool" and "any" are
43
49
  * not supported for this model.` The same two requests return 200 on
44
- * `claude-opus-5`.
50
+ * `claude-opus-5`. Both return HTTP 400 on `claude-sonnet-5-5` (probed
51
+ * 2026-09-30).
45
52
  *
46
53
  * `AnthropicProvider` clamps an unsupported forced choice to `{ type: 'auto' }`
47
54
  * and logs a warning. An extra entry here therefore costs guaranteed tool
@@ -1 +1 @@
1
- {"version":3,"file":"model-forced-tool-choice.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-forced-tool-choice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE"}
1
+ {"version":3,"file":"model-forced-tool-choice.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-forced-tool-choice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE"}
@@ -5,9 +5,10 @@
5
5
  * Anthropic structured output and `toolChoice: 'required'` both resolve to a
6
6
  * FORCED `tool_choice` on the Messages API (`{ type: 'tool', name }` or
7
7
  * `{ type: 'any' }`). Most Claude models accept this, and it is the most
8
- * reliable way to constrain output. Claude Fable 5 / 5.1 and Claude Opus 5.5
9
- * reject a forced `tool_choice` at the API level with a 400. Those models can
10
- * still call tools under `{ type: 'auto' }`; they only refuse to be forced.
8
+ * reliable way to constrain output. Claude Fable 5 / 5.1, Claude Mythos 5.1,
9
+ * Claude Opus 5.5 and Claude Sonnet 5.5 reject a forced `tool_choice` at the
10
+ * API level with a 400. Those models can still call tools under
11
+ * `{ type: 'auto' }`; they only refuse to be forced.
11
12
  *
12
13
  * Two consumers read this:
13
14
  * - {@link AnthropicProvider} clamps any resolved forced `tool_choice` to
@@ -26,22 +27,28 @@
26
27
  * Whether Anthropic will accept a forced `tool_choice` (`{ type: 'tool' }` or
27
28
  * `{ type: 'any' }`) for the given Claude model id.
28
29
  *
29
- * Deny-by-explicit-model. Two families reject forced tool use, and every other
30
- * current Claude model (Sonnet, Opus 5 and earlier, Haiku) accepts it:
30
+ * Deny-by-explicit-model. These models reject forced tool use, and every
31
+ * other current Claude model (Sonnet 5 and earlier, Opus 5 and earlier,
32
+ * Haiku) accepts it:
31
33
  *
32
34
  * - Claude Fable 5 and 5.1, including dated variants such as
33
35
  * `claude-fable-5-20260601`. The `fable-5` alternative also matches
34
36
  * `claude-fable-5-1` because `\b` matches at the hyphen, which is intended
35
37
  * since 5.1 is the same family under the same constraint.
38
+ * - Claude Mythos 5.1 (`claude-mythos-5-1`), per Anthropic's model docs.
36
39
  * - Claude Opus 5.5 (`claude-opus-5-5`). Claude Opus 5 accepts forced tool
37
40
  * use, so the pattern names the full `opus-5-5` id. A bare `opus-5` prefix
38
41
  * would deny Opus 5 as well.
42
+ * - Claude Sonnet 5.5 (`claude-sonnet-5-5`). Claude Sonnet 5 accepts forced
43
+ * tool use, so the pattern names the full `sonnet-5-5` id for the same
44
+ * reason.
39
45
  *
40
46
  * Live-probed 2026-09-29 on the Messages API. `{type:'tool'}` and
41
47
  * `{type:'any'}` both return HTTP 400 on `claude-opus-5-5` and
42
48
  * `claude-fable-5-1`, with the message `tool_choice: type "tool" and "any" are
43
49
  * not supported for this model.` The same two requests return 200 on
44
- * `claude-opus-5`.
50
+ * `claude-opus-5`. Both return HTTP 400 on `claude-sonnet-5-5` (probed
51
+ * 2026-09-30).
45
52
  *
46
53
  * `AnthropicProvider` clamps an unsupported forced choice to `{ type: 'auto' }`
47
54
  * and logs a warning. An extra entry here therefore costs guaranteed tool
@@ -55,6 +62,6 @@
55
62
  * model, `true` otherwise.
56
63
  */
57
64
  export function modelSupportsForcedToolChoice(modelId) {
58
- return !/^claude-(fable-5|opus-5-5)\b/i.test(modelId);
65
+ return !/^claude-(fable-5|mythos-5-1|opus-5-5|sonnet-5-5)\b/i.test(modelId);
59
66
  }
60
67
  //# sourceMappingURL=model-forced-tool-choice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-forced-tool-choice.js","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-forced-tool-choice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAe;IAC3D,OAAO,CAAC,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"model-forced-tool-choice.js","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-forced-tool-choice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAe;IAC3D,OAAO,CAAC,qDAAqD,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9E,CAAC"}
@@ -2,20 +2,23 @@
2
2
  * @fileoverview Extended-thinking helpers for the Anthropic
3
3
  * reasoning-default Claude models.
4
4
  *
5
- * The Opus 4.7 / 4.8 family and Fable 5 reason by default and accept ONLY
6
- * the adaptive thinking form on the Messages API: `thinking: { type:
7
- * 'adaptive' }`. The older manual form `thinking: { type: 'enabled',
8
- * budget_tokens }` is removed on this family and returns a 400
9
- * ('"thinking.type.enabled" is not supported for this model'). Fable 5 adds
10
- * one more constraint — an explicit `thinking: { type: 'disabled' }` also
11
- * 400s — but the provider only ever emits the adaptive form (or nothing),
12
- * never `disabled`, so that path is never hit. Depth is
5
+ * Turning thinking on: the Opus 4.7 / 4.8 family, Opus 5.x, Sonnet 5.x and
6
+ * Fable 5.x take ONLY the adaptive form as the on-switch on the Messages API:
7
+ * `thinking: { type: 'adaptive' }`. The older manual form `thinking: { type:
8
+ * 'enabled', budget_tokens }` is removed on this family and returns a 400
9
+ * ('"thinking.type.enabled" is not supported for this model'). Depth is
13
10
  * controlled by `output_config.effort`, not a token budget, so the
14
11
  * caller-facing `{ budgetTokens }` option acts as the on-switch and the
15
12
  * number itself is not sent. {@link AnthropicProvider} sends the block
16
13
  * through {@link resolveThinkingPayload} when a caller passes a thinking
17
14
  * budget AND the model supports it.
18
15
  *
16
+ * Turning thinking off (`thinking: false`): leaving the field out keeps the
17
+ * model's default, which is thinking ON for Opus 5, Sonnet 5 and Sonnet 5.5,
18
+ * and always on for Opus 5.5, Fable and Mythos. The models that can turn it
19
+ * off each take their own shape, and some only at a capped effort;
20
+ * {@link resolveThinkingOff} maps a model id to it.
21
+ *
19
22
  * This is the thinking-capability sibling of `modelSupportsTemperature`
20
23
  * in AnthropicProvider.ts — the same reasoning-default family that
21
24
  * REJECTS `temperature` is the family that ACCEPTS `thinking`. Kept in
@@ -27,10 +30,13 @@
27
30
  * `thinking` parameter.
28
31
  *
29
32
  * Allow-by-explicit-family: only the reasoning-default Opus 4.7 / 4.8
30
- * line, Sonnet 5, and Fable 5 (and their dated variants like
33
+ * line, Opus 5, Sonnet 5, and Fable 5 (and their dated variants like
31
34
  * `claude-opus-4-8-20260501`) accept it; every other Claude model ignores
32
- * or rejects it. Future reasoning-first siblings get added to the regex as
33
- * Anthropic releases them, in lockstep with `modelSupportsTemperature`.
35
+ * or rejects it. Opus 5.5, Sonnet 5.5 and Fable 5.1 match the `opus-5`,
36
+ * `sonnet-5` and `fable-5` alternatives on purpose, because `\b` matches at
37
+ * the hyphen before their trailing version digit. Future reasoning-first
38
+ * siblings get added to the regex as Anthropic releases them, in lockstep
39
+ * with `modelSupportsTemperature`.
34
40
  *
35
41
  * @param modelId Anthropic-side model id.
36
42
  * @returns `true` when Anthropic accepts a `thinking` block for this model.
@@ -58,10 +64,55 @@ export interface ResolvedThinkingPayload {
58
64
  * max_tokens change).
59
65
  *
60
66
  * @param modelId Anthropic-side model id.
61
- * @param thinking Caller-supplied `{ budgetTokens }`, or `undefined`.
67
+ * @param thinking Caller-supplied `{ budgetTokens }`; `false` (thinking
68
+ * off, see {@link resolveThinkingOff}) and `undefined` return `null`.
62
69
  * @param requestedMaxTokens The max_tokens already resolved for the request.
63
70
  */
64
71
  export declare function resolveThinkingPayload(modelId: string, thinking: {
65
72
  budgetTokens: number;
66
- } | undefined, requestedMaxTokens: number | undefined): ResolvedThinkingPayload | null;
73
+ } | false | undefined, requestedMaxTokens: number | undefined): ResolvedThinkingPayload | null;
74
+ /**
75
+ * How one model takes a request to turn thinking off.
76
+ *
77
+ * - `omit`: the model does not think unless asked, so leaving `thinking` out
78
+ * is off.
79
+ * - `send`: the model thinks by default and turns it off only for this
80
+ * `thinking` value. `maxEffort` is the highest `output_config.effort` the
81
+ * value is accepted with; absent means any effort.
82
+ * - `always_on`: the model always thinks and rejects every off shape.
83
+ */
84
+ export type ThinkingOffShape = {
85
+ kind: 'omit';
86
+ } | {
87
+ kind: 'send';
88
+ thinking: {
89
+ type: 'disabled';
90
+ } | {
91
+ type: 'between_tools';
92
+ };
93
+ maxEffort?: 'high';
94
+ } | {
95
+ kind: 'always_on';
96
+ };
97
+ /**
98
+ * The request shape that turns thinking off on a Claude model, for a caller
99
+ * passing `thinking: false`.
100
+ *
101
+ * | Model | Off shape | Source |
102
+ * | --- | --- | --- |
103
+ * | Sonnet 5.5 | `{ type: 'between_tools' }` at effort high or below | probed 2026-09-30: `disabled` returns 400, `between_tools` 200 |
104
+ * | Opus 5 | `{ type: 'disabled' }` at effort high or below | probed 2026-09-30: `disabled` 200, `between_tools` 400 |
105
+ * | Sonnet 5 | `{ type: 'disabled' }` | Anthropic's model docs |
106
+ * | Opus 5.5, Fable 5.x, Mythos 5.x | none: always on | probed 2026-09-30 on Opus 5.5 and Fable 5.1: both shapes return 400 |
107
+ * | everything else | omit the field | thinks only when asked |
108
+ *
109
+ * The 5.5 checks run first because `opus-5\b` and `sonnet-5\b` also match
110
+ * the 5.5 ids. An unknown id gets `omit`, which never sends a shape that
111
+ * could return 400. Anchored like {@link modelSupportsThinking}, so the id
112
+ * is the bare Anthropic-side one.
113
+ *
114
+ * @param modelId Anthropic-side model id, bare or dated.
115
+ * @returns The off shape for the model.
116
+ */
117
+ export declare function resolveThinkingOff(modelId: string): ThinkingOffShape;
67
118
  //# sourceMappingURL=model-thinking.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-thinking.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-thinking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,0EAA0E;AAC1E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A;CAAE,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAUpE"}
@@ -2,20 +2,23 @@
2
2
  * @fileoverview Extended-thinking helpers for the Anthropic
3
3
  * reasoning-default Claude models.
4
4
  *
5
- * The Opus 4.7 / 4.8 family and Fable 5 reason by default and accept ONLY
6
- * the adaptive thinking form on the Messages API: `thinking: { type:
7
- * 'adaptive' }`. The older manual form `thinking: { type: 'enabled',
8
- * budget_tokens }` is removed on this family and returns a 400
9
- * ('"thinking.type.enabled" is not supported for this model'). Fable 5 adds
10
- * one more constraint — an explicit `thinking: { type: 'disabled' }` also
11
- * 400s — but the provider only ever emits the adaptive form (or nothing),
12
- * never `disabled`, so that path is never hit. Depth is
5
+ * Turning thinking on: the Opus 4.7 / 4.8 family, Opus 5.x, Sonnet 5.x and
6
+ * Fable 5.x take ONLY the adaptive form as the on-switch on the Messages API:
7
+ * `thinking: { type: 'adaptive' }`. The older manual form `thinking: { type:
8
+ * 'enabled', budget_tokens }` is removed on this family and returns a 400
9
+ * ('"thinking.type.enabled" is not supported for this model'). Depth is
13
10
  * controlled by `output_config.effort`, not a token budget, so the
14
11
  * caller-facing `{ budgetTokens }` option acts as the on-switch and the
15
12
  * number itself is not sent. {@link AnthropicProvider} sends the block
16
13
  * through {@link resolveThinkingPayload} when a caller passes a thinking
17
14
  * budget AND the model supports it.
18
15
  *
16
+ * Turning thinking off (`thinking: false`): leaving the field out keeps the
17
+ * model's default, which is thinking ON for Opus 5, Sonnet 5 and Sonnet 5.5,
18
+ * and always on for Opus 5.5, Fable and Mythos. The models that can turn it
19
+ * off each take their own shape, and some only at a capped effort;
20
+ * {@link resolveThinkingOff} maps a model id to it.
21
+ *
19
22
  * This is the thinking-capability sibling of `modelSupportsTemperature`
20
23
  * in AnthropicProvider.ts — the same reasoning-default family that
21
24
  * REJECTS `temperature` is the family that ACCEPTS `thinking`. Kept in
@@ -27,10 +30,13 @@
27
30
  * `thinking` parameter.
28
31
  *
29
32
  * Allow-by-explicit-family: only the reasoning-default Opus 4.7 / 4.8
30
- * line, Sonnet 5, and Fable 5 (and their dated variants like
33
+ * line, Opus 5, Sonnet 5, and Fable 5 (and their dated variants like
31
34
  * `claude-opus-4-8-20260501`) accept it; every other Claude model ignores
32
- * or rejects it. Future reasoning-first siblings get added to the regex as
33
- * Anthropic releases them, in lockstep with `modelSupportsTemperature`.
35
+ * or rejects it. Opus 5.5, Sonnet 5.5 and Fable 5.1 match the `opus-5`,
36
+ * `sonnet-5` and `fable-5` alternatives on purpose, because `\b` matches at
37
+ * the hyphen before their trailing version digit. Future reasoning-first
38
+ * siblings get added to the regex as Anthropic releases them, in lockstep
39
+ * with `modelSupportsTemperature`.
34
40
  *
35
41
  * @param modelId Anthropic-side model id.
36
42
  * @returns `true` when Anthropic accepts a `thinking` block for this model.
@@ -53,7 +59,8 @@ export function modelSupportsThinking(modelId) {
53
59
  * max_tokens change).
54
60
  *
55
61
  * @param modelId Anthropic-side model id.
56
- * @param thinking Caller-supplied `{ budgetTokens }`, or `undefined`.
62
+ * @param thinking Caller-supplied `{ budgetTokens }`; `false` (thinking
63
+ * off, see {@link resolveThinkingOff}) and `undefined` return `null`.
57
64
  * @param requestedMaxTokens The max_tokens already resolved for the request.
58
65
  */
59
66
  export function resolveThinkingPayload(modelId, thinking, requestedMaxTokens) {
@@ -61,4 +68,37 @@ export function resolveThinkingPayload(modelId, thinking, requestedMaxTokens) {
61
68
  return null;
62
69
  return { thinking: { type: 'adaptive' }, maxTokens: requestedMaxTokens ?? 0 };
63
70
  }
71
+ /**
72
+ * The request shape that turns thinking off on a Claude model, for a caller
73
+ * passing `thinking: false`.
74
+ *
75
+ * | Model | Off shape | Source |
76
+ * | --- | --- | --- |
77
+ * | Sonnet 5.5 | `{ type: 'between_tools' }` at effort high or below | probed 2026-09-30: `disabled` returns 400, `between_tools` 200 |
78
+ * | Opus 5 | `{ type: 'disabled' }` at effort high or below | probed 2026-09-30: `disabled` 200, `between_tools` 400 |
79
+ * | Sonnet 5 | `{ type: 'disabled' }` | Anthropic's model docs |
80
+ * | Opus 5.5, Fable 5.x, Mythos 5.x | none: always on | probed 2026-09-30 on Opus 5.5 and Fable 5.1: both shapes return 400 |
81
+ * | everything else | omit the field | thinks only when asked |
82
+ *
83
+ * The 5.5 checks run first because `opus-5\b` and `sonnet-5\b` also match
84
+ * the 5.5 ids. An unknown id gets `omit`, which never sends a shape that
85
+ * could return 400. Anchored like {@link modelSupportsThinking}, so the id
86
+ * is the bare Anthropic-side one.
87
+ *
88
+ * @param modelId Anthropic-side model id, bare or dated.
89
+ * @returns The off shape for the model.
90
+ */
91
+ export function resolveThinkingOff(modelId) {
92
+ if (/^claude-sonnet-5-5\b/i.test(modelId)) {
93
+ return { kind: 'send', thinking: { type: 'between_tools' }, maxEffort: 'high' };
94
+ }
95
+ if (/^claude-(opus-5-5|fable-5|mythos-5)\b/i.test(modelId))
96
+ return { kind: 'always_on' };
97
+ if (/^claude-opus-5\b/i.test(modelId)) {
98
+ return { kind: 'send', thinking: { type: 'disabled' }, maxEffort: 'high' };
99
+ }
100
+ if (/^claude-sonnet-5\b/i.test(modelId))
101
+ return { kind: 'send', thinking: { type: 'disabled' } };
102
+ return { kind: 'omit' };
103
+ }
64
104
  //# sourceMappingURL=model-thinking.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-thinking.js","sourceRoot":"","sources":["../../../../src/core/llm/providers/model-thinking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,mDAAmD,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC3E,CAAC;AAQD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAe,EACf,QAA8C,EAC9C,kBAAsC;IAEtC,IAAI,CAAC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E,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7E,CAAC;IACD,IAAI,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC;IACjG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC"}
@@ -2,14 +2,15 @@
2
2
  * @fileoverview Backpressure batching wrapper for provider streaming chunks (`ModelCompletionResponse`).
3
3
  * Combines small, high-frequency deltas into larger aggregated chunks to reduce downstream
4
4
  * dispatch overhead (websocket emissions, DOM updates, etc.) while preserving core invariants:
5
- * - Text remains append-only (merged into a single `responseTextDelta` per batch).
5
+ * - Text remains append-only (merged into a single `responseTextDelta` per batch), and so does
6
+ * reasoning-summary text (`reasoningTextDelta`), kept apart from it.
6
7
  * - Tool/function argument deltas merged per (choiceIndex, toolCallId) into single consolidated delta.
7
8
  * - Exactly one terminal chunk with `isFinal: true` (forwarded from original final chunk).
8
9
  * - Usage & error surfaced only when FINAL chunk encountered (or if intermediate provider error semantics change).
9
10
  *
10
11
  * Flush Triggers (any):
11
12
  * 1. Latency: maxLatencyMs elapsed since first unflushed chunk arrival.
12
- * 2. Size: accumulated text delta length >= maxTextDeltaChars.
13
+ * 2. Size: accumulated text and reasoning delta length >= maxTextDeltaChars.
13
14
  * 3. Chunk Count: buffer size >= maxChunksPerBatch.
14
15
  * 4. Explicit final provider chunk.
15
16
  * 5. Manual tool argument size threshold (maxToolArgumentChars) exceeded.
@@ -28,7 +29,7 @@ import { ModelCompletionResponse } from '../providers/IProvider';
28
29
  export interface StreamingBatcherOptions {
29
30
  /** Max wall-clock latency before forcing a flush (milliseconds). */
30
31
  maxLatencyMs?: number;
31
- /** Max accumulated text delta characters before flush. */
32
+ /** Max accumulated text delta characters (answer and reasoning text together) before flush. */
32
33
  maxTextDeltaChars?: number;
33
34
  /** Max accumulated tool argument characters (combined per tool call) before flush. */
34
35
  maxToolArgumentChars?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"StreamingBatcher.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/streaming/StreamingBatcher.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sFAAsF;IACtF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAuGD;;;;;GAKG;AACH,wBAAuB,WAAW,CAChC,MAAM,EAAE,cAAc,CAAC,uBAAuB,EAAE,IAAI,EAAE,SAAS,CAAC,EAChE,OAAO,GAAE,uBAA4B,GACpC,cAAc,CAAC,uBAAuB,EAAE,IAAI,EAAE,SAAS,CAAC,CA0E1D;AAED,sFAAsF;AACtF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAAoC;gBACpC,OAAO,GAAE,uBAA4B;IAGjD,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,uBAAuB,EAAE,IAAI,EAAE,SAAS,CAAC;CAGvE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"StreamingBatcher.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/streaming/StreamingBatcher.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,kDAAkD;AAClD,MA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