melchizedek-agents 0.20.0 → 1.0.1

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 (247) hide show
  1. package/.env.example +4 -5
  2. package/AGENT_SETUP.md +3 -3
  3. package/CHANGELOG.md +256 -0
  4. package/DOCUMENTATION.md +142 -150
  5. package/QUICKSTART.md +12 -11
  6. package/README.md +11 -11
  7. package/config/agents/examples/image_production.yaml +2 -2
  8. package/config/agents/syndicateSchema.yaml +52 -26
  9. package/dist/lib/a2a/app.d.ts +17 -12
  10. package/dist/lib/a2a/app.js +16 -6
  11. package/dist/lib/a2a/executor.d.ts +10 -14
  12. package/dist/lib/a2a/executor.js +10 -18
  13. package/dist/lib/a2a/remoteAgent.d.ts +5 -12
  14. package/dist/lib/a2a/remoteAgent.js +5 -12
  15. package/dist/lib/compile.d.ts +76 -86
  16. package/dist/lib/compile.js +100 -116
  17. package/dist/lib/compileNative.d.ts +44 -56
  18. package/dist/lib/compileNative.js +91 -89
  19. package/dist/lib/config.d.ts +6 -6
  20. package/dist/lib/config.js +6 -6
  21. package/dist/lib/doctor.d.ts +8 -14
  22. package/dist/lib/doctor.js +10 -46
  23. package/dist/lib/index.d.ts +12 -9
  24. package/dist/lib/index.js +10 -11
  25. package/dist/lib/loadSyndicate.d.ts +3 -3
  26. package/dist/lib/loadSyndicate.js +2 -2
  27. package/dist/lib/memory/erase.d.ts +1 -1
  28. package/dist/lib/memory/erase.js +1 -1
  29. package/dist/lib/memory/namespace.d.ts +12 -14
  30. package/dist/lib/memory/namespace.js +13 -14
  31. package/dist/lib/memory/providers.d.ts +4 -5
  32. package/dist/lib/memory/providers.js +12 -6
  33. package/dist/lib/memory/supabaseMemoryService.d.ts +9 -30
  34. package/dist/lib/memory/supabaseMemoryService.js +8 -30
  35. package/dist/lib/model.d.ts +6 -12
  36. package/dist/lib/model.js +6 -12
  37. package/dist/lib/models/adapterResolver.d.ts +21 -40
  38. package/dist/lib/models/adapterResolver.js +32 -40
  39. package/dist/lib/models/chatCompletionsAdapter.d.ts +12 -33
  40. package/dist/lib/models/chatCompletionsAdapter.js +13 -18
  41. package/dist/lib/models/circuitBreaker.d.ts +5 -5
  42. package/dist/lib/models/circuitBreaker.js +5 -5
  43. package/dist/lib/models/claudeAdapter.d.ts +9 -26
  44. package/dist/lib/models/claudeAdapter.js +11 -15
  45. package/dist/lib/models/claudeModels.d.ts +4 -4
  46. package/dist/lib/models/claudeModels.js +4 -4
  47. package/dist/lib/models/contract.d.ts +11 -11
  48. package/dist/lib/models/contract.js +6 -6
  49. package/dist/lib/models/errorResponse.d.ts +13 -20
  50. package/dist/lib/models/errorResponse.js +0 -12
  51. package/dist/lib/models/fallbackAdapter.d.ts +7 -8
  52. package/dist/lib/models/gatewayAdapter.d.ts +1 -1
  53. package/dist/lib/models/gatewayAdapter.js +1 -1
  54. package/dist/lib/models/geminiAdapter.d.ts +5 -6
  55. package/dist/lib/models/geminiAdapter.js +9 -10
  56. package/dist/lib/models/geminiState.d.ts +8 -8
  57. package/dist/lib/models/geminiState.js +8 -8
  58. package/dist/lib/models/genaiMapping.d.ts +82 -36
  59. package/dist/lib/models/genaiMapping.js +41 -41
  60. package/dist/lib/models/gptAdapter.d.ts +11 -11
  61. package/dist/lib/models/gptAdapter.js +13 -13
  62. package/dist/lib/models/kimiAdapter.d.ts +6 -7
  63. package/dist/lib/models/kimiAdapter.js +6 -9
  64. package/dist/lib/models/ollamaAdapter.d.ts +3 -3
  65. package/dist/lib/models/ollamaAdapter.js +3 -3
  66. package/dist/lib/models/providerMap.d.ts +6 -5
  67. package/dist/lib/models/providerMap.js +6 -5
  68. package/dist/lib/models/providerState.d.ts +3 -2
  69. package/dist/lib/models/providerState.js +3 -2
  70. package/dist/lib/models/reasoning.d.ts +1 -1
  71. package/dist/lib/models/registry.d.ts +26 -73
  72. package/dist/lib/models/registry.js +31 -144
  73. package/dist/lib/models/retry.d.ts +2 -2
  74. package/dist/lib/models/retry.js +2 -2
  75. package/dist/lib/models/schemaNormalize.d.ts +25 -55
  76. package/dist/lib/models/schemaNormalize.js +30 -100
  77. package/dist/lib/observability/lineage.d.ts +3 -3
  78. package/dist/lib/observability/lineage.js +10 -10
  79. package/dist/lib/observability/supabaseSpanExporter.js +1 -1
  80. package/dist/lib/observability/tracer.d.ts +25 -23
  81. package/dist/lib/observability/tracer.js +26 -63
  82. package/dist/lib/persistence/supabaseProvider.d.ts +4 -3
  83. package/dist/lib/runtime/approvals.d.ts +1 -1
  84. package/dist/lib/runtime/credentials.d.ts +1 -1
  85. package/dist/lib/runtime/events.d.ts +3 -4
  86. package/dist/lib/runtime/events.js +3 -4
  87. package/dist/lib/runtime/logging.d.ts +3 -8
  88. package/dist/lib/runtime/logging.js +3 -8
  89. package/dist/lib/runtime/memoryService.d.ts +4 -6
  90. package/dist/lib/runtime/memoryService.js +3 -5
  91. package/dist/lib/runtime/native/agentLoop.d.ts +18 -16
  92. package/dist/lib/runtime/native/agentLoop.js +38 -26
  93. package/dist/lib/runtime/native/compaction.d.ts +10 -11
  94. package/dist/lib/runtime/native/compaction.js +10 -11
  95. package/dist/lib/runtime/native/delegate.d.ts +13 -14
  96. package/dist/lib/runtime/native/delegate.js +11 -18
  97. package/dist/lib/runtime/native/history.d.ts +5 -6
  98. package/dist/lib/runtime/native/history.js +5 -6
  99. package/dist/lib/runtime/native/interrupts.d.ts +6 -6
  100. package/dist/lib/runtime/native/interrupts.js +6 -6
  101. package/dist/lib/runtime/native/request.d.ts +24 -24
  102. package/dist/lib/runtime/native/request.js +35 -24
  103. package/dist/lib/runtime/native/selfCorrection.d.ts +32 -32
  104. package/dist/lib/runtime/native/selfCorrection.js +34 -34
  105. package/dist/lib/runtime/native/step.d.ts +23 -23
  106. package/dist/lib/runtime/native/step.js +49 -27
  107. package/dist/lib/runtime/native/taskMode.d.ts +8 -8
  108. package/dist/lib/runtime/native/taskMode.js +8 -8
  109. package/dist/lib/runtime/native/telemetry.d.ts +11 -11
  110. package/dist/lib/runtime/native/telemetry.js +11 -11
  111. package/dist/lib/runtime/native/tempState.d.ts +4 -4
  112. package/dist/lib/runtime/native/tempState.js +4 -4
  113. package/dist/lib/runtime/nativeTurn.d.ts +29 -32
  114. package/dist/lib/runtime/nativeTurn.js +30 -41
  115. package/dist/lib/runtime/questions.d.ts +8 -9
  116. package/dist/lib/runtime/questions.js +1 -2
  117. package/dist/lib/runtime/runtimeFlag.d.ts +28 -14
  118. package/dist/lib/runtime/runtimeFlag.js +38 -16
  119. package/dist/lib/runtime/sessions.d.ts +10 -12
  120. package/dist/lib/runtime/sessions.js +10 -12
  121. package/dist/lib/runtime/syndicateTurn.d.ts +44 -45
  122. package/dist/lib/runtime/syndicateTurn.js +163 -158
  123. package/dist/lib/runtime/turnControl.d.ts +8 -8
  124. package/dist/lib/runtime/turnControl.js +8 -8
  125. package/dist/lib/session/supabaseSessionService.d.ts +7 -21
  126. package/dist/lib/session/supabaseSessionService.js +7 -43
  127. package/dist/lib/session/transcript.d.ts +16 -26
  128. package/dist/lib/session/transcript.js +17 -57
  129. package/dist/lib/storage/postgres/sessionService.d.ts +6 -20
  130. package/dist/lib/storage/postgres/sessionService.js +6 -39
  131. package/dist/lib/syndicateSchema.js +7 -6
  132. package/dist/lib/toolRegistry.d.ts +9 -14
  133. package/dist/lib/toolRegistry.js +36 -33
  134. package/dist/lib/tools/auth.d.ts +1 -1
  135. package/dist/lib/tools/auth.js +1 -1
  136. package/dist/lib/tools/examples.d.ts +2 -4
  137. package/dist/lib/tools/examples.js +2 -4
  138. package/dist/lib/tools/generateImageTool.d.ts +3 -3
  139. package/dist/lib/tools/generateImageTool.js +4 -5
  140. package/dist/lib/tools/inspectImageTool.d.ts +2 -2
  141. package/dist/lib/tools/inspectImageTool.js +3 -4
  142. package/dist/lib/tools/mcpToolFactory.d.ts +4 -24
  143. package/dist/lib/tools/mcpToolFactory.js +19 -9
  144. package/dist/lib/tools/memoryTools.d.ts +5 -6
  145. package/dist/lib/tools/memoryTools.js +5 -6
  146. package/dist/lib/tools/nativeTools.d.ts +9 -14
  147. package/dist/lib/tools/nativeTools.js +9 -14
  148. package/dist/lib/tools/openapiTools.d.ts +5 -7
  149. package/dist/lib/tools/openapiTools.js +6 -13
  150. package/dist/lib/tools/scienceTools.d.ts +3 -3
  151. package/dist/lib/tools/scienceTools.js +8 -10
  152. package/dist/lib/tools/skillToolset.d.ts +1 -2
  153. package/dist/lib/tools/skillToolset.js +1 -2
  154. package/dist/lib/tools/skills/executor.d.ts +1 -1
  155. package/dist/lib/tools/skills/executor.js +1 -1
  156. package/dist/lib/tools/skills/frontmatter.d.ts +2 -2
  157. package/dist/lib/tools/skills/frontmatter.js +2 -2
  158. package/dist/lib/tools/skills/tools.d.ts +8 -10
  159. package/dist/lib/tools/skills/tools.js +9 -11
  160. package/dist/lib/tools/tool.d.ts +24 -40
  161. package/dist/lib/tools/tool.js +24 -56
  162. package/dist/lib/tools/toolContract.d.ts +8 -13
  163. package/dist/lib/tools/toolContract.js +6 -17
  164. package/dist/lib/tools/webExtractTool.d.ts +2 -2
  165. package/dist/lib/tools/webExtractTool.js +3 -4
  166. package/dist/lib/tools/wikiTools.d.ts +2 -2
  167. package/dist/lib/tools/wikiTools.js +5 -6
  168. package/dist/lib/tools/xApiSearchTool.d.ts +2 -2
  169. package/dist/lib/tools/xApiSearchTool.js +3 -4
  170. package/dist/lib/tools/xaiSearchParams.d.ts +2 -5
  171. package/dist/lib/tools/xaiSearchParams.js +2 -5
  172. package/dist/lib/wiki/agentRun.d.ts +10 -11
  173. package/dist/lib/wiki/agentRun.js +24 -42
  174. package/dist/lib/workflow/agentNode.d.ts +10 -1
  175. package/dist/lib/workflow/agentNode.js +5 -3
  176. package/dist/lib/workflow/graph.d.ts +8 -9
  177. package/dist/lib/workflow/graph.js +12 -12
  178. package/dist/lib/workflow/nodeEvents.d.ts +5 -5
  179. package/dist/lib/workflow/nodeEvents.js +5 -5
  180. package/dist/lib/workflow/pause.d.ts +5 -4
  181. package/dist/lib/workflow/pause.js +5 -4
  182. package/dist/lib/workflow/resume.d.ts +4 -4
  183. package/dist/lib/workflow/resume.js +4 -4
  184. package/dist/lib/workflow/route.d.ts +7 -7
  185. package/dist/lib/workflow/route.js +8 -8
  186. package/dist/lib/workflow/scheduler.d.ts +44 -2
  187. package/dist/lib/workflow/scheduler.js +60 -6
  188. package/dist/lib/workflow/toolNode.d.ts +18 -29
  189. package/dist/lib/workflow/toolNode.js +29 -35
  190. package/dist/lib/workflow/turn.d.ts +29 -20
  191. package/dist/lib/workflow/turn.js +111 -24
  192. package/dist/lib/workflow.d.ts +34 -60
  193. package/dist/lib/workflow.js +34 -168
  194. package/dist/lib/workflowConfig.d.ts +2 -10
  195. package/dist/lib/workflowConfig.js +2 -31
  196. package/dist/scripts/a2a_server.js +1 -2
  197. package/dist/scripts/assistant_worker.d.ts +2 -2
  198. package/dist/scripts/assistant_worker.js +8 -7
  199. package/dist/scripts/doctor.d.ts +2 -2
  200. package/dist/scripts/doctor.js +2 -2
  201. package/dist/scripts/syndicate_chat.js +14 -24
  202. package/package.json +4 -10
  203. package/skills/briefs/_shared.md +2 -2
  204. package/skills/briefs/melchizedek-author.md +2 -2
  205. package/skills/briefs/melchizedek-models.md +6 -6
  206. package/skills/melchizedek-author/SKILL.md +2 -2
  207. package/skills/melchizedek-models/SKILL.md +5 -5
  208. package/dist/lib/adkPeer.d.ts +0 -63
  209. package/dist/lib/adkPeer.js +0 -240
  210. package/dist/lib/compileAdk.d.ts +0 -32
  211. package/dist/lib/compileAdk.js +0 -142
  212. package/dist/lib/models/adkGeminiAdapter.d.ts +0 -90
  213. package/dist/lib/models/adkGeminiAdapter.js +0 -369
  214. package/dist/lib/models/adkShim.d.ts +0 -111
  215. package/dist/lib/models/adkShim.js +0 -136
  216. package/dist/lib/models/claudeLlm.d.ts +0 -79
  217. package/dist/lib/models/claudeLlm.js +0 -87
  218. package/dist/lib/models/fallback.d.ts +0 -48
  219. package/dist/lib/models/fallback.js +0 -116
  220. package/dist/lib/models/gatewayLlm.d.ts +0 -36
  221. package/dist/lib/models/gatewayLlm.js +0 -44
  222. package/dist/lib/models/gptLlm.d.ts +0 -99
  223. package/dist/lib/models/gptLlm.js +0 -129
  224. package/dist/lib/models/grokLlm.d.ts +0 -50
  225. package/dist/lib/models/grokLlm.js +0 -56
  226. package/dist/lib/models/kimiLlm.d.ts +0 -31
  227. package/dist/lib/models/kimiLlm.js +0 -35
  228. package/dist/lib/models/ollamaLlm.d.ts +0 -37
  229. package/dist/lib/models/ollamaLlm.js +0 -42
  230. package/dist/lib/models/openAiCompatibleLlm.d.ts +0 -96
  231. package/dist/lib/models/openAiCompatibleLlm.js +0 -156
  232. package/dist/lib/models/tracedGemini.d.ts +0 -41
  233. package/dist/lib/models/tracedGemini.js +0 -98
  234. package/dist/lib/runtime/adkMemoryBridge.d.ts +0 -46
  235. package/dist/lib/runtime/adkMemoryBridge.js +0 -68
  236. package/dist/lib/runtime/adkSessionBridge.d.ts +0 -78
  237. package/dist/lib/runtime/adkSessionBridge.js +0 -176
  238. package/dist/lib/tools/adkTool.d.ts +0 -81
  239. package/dist/lib/tools/adkTool.js +0 -268
  240. package/dist/lib/tools/collectionsSearchTool.d.ts +0 -56
  241. package/dist/lib/tools/collectionsSearchTool.js +0 -71
  242. package/dist/lib/tools/urlContextTool.d.ts +0 -32
  243. package/dist/lib/tools/urlContextTool.js +0 -43
  244. package/dist/lib/tools/webSearchTool.d.ts +0 -51
  245. package/dist/lib/tools/webSearchTool.js +0 -82
  246. package/dist/lib/tools/xSearchTool.d.ts +0 -59
  247. package/dist/lib/tools/xSearchTool.js +0 -74
package/dist/lib/model.js CHANGED
@@ -1,24 +1,18 @@
1
1
  /**
2
2
  * lib/model.ts — the `melchizedek-agents/model` entry: the engine's model
3
- * layer on its own, with no @google/adk (ADR 0068).
3
+ * layer on its own (ADR 0068).
4
4
  *
5
5
  * What it holds: the model contract's types (ADR 0048), every provider's
6
6
  * contract adapter, resolveAdapter and resolveAdapterWithFallback over the
7
7
  * one prefix table (ADR 0060), FallbackAdapter and the circuit breaker's
8
8
  * helpers (ADR 0044). A consumer can call any model through it without
9
- * installing ADK, the peer dependency the rest of the package needs.
9
+ * loading the compiler or the runtime.
10
10
  *
11
- * What it leaves out, because each loads ADK: AdkGeminiAdapter, the ADK
12
- * shims (ClaudeLlm, GptLlm and the rest), TracedGemini, resolveModel and
13
- * registerAvailableProviders. They stay at `melchizedek-agents/models/*`.
11
+ * Gemini: resolveAdapter returns the engine's GeminiAdapter for a Gemini id;
12
+ * GEMINI_ADAPTER=adk throws, naming 1.0.0 (ADR 0107).
14
13
  *
15
- * Gemini: resolveAdapter here returns the engine's GeminiAdapter for a
16
- * Gemini id. Asking for `adk` (the option, or GEMINI_ADAPTER=adk) throws and
17
- * names `melchizedek-agents/models/registry`, whose resolveAdapter keeps
18
- * ADR 0060's default until gate G3.
19
- *
20
- * tests/packageSurface.test.ts walks this module's runtime import graph and
21
- * fails if any module in it names @google/adk.
14
+ * tests/packageSurface.test.ts walks this module's runtime import graph:
15
+ * @google/* appears in it only in the Gemini adapter and the genai mapping.
22
16
  */
23
17
  // ── Resolve an adapter by model id ──────────────────────────────────────────
24
18
  export { resolveAdapter, resolveAdapterWithFallback, geminiAdapterSetting } from './models/adapterResolver.js';
@@ -1,23 +1,18 @@
1
1
  /**
2
2
  * lib/models/adapterResolver.ts — one model id to one ModelAdapter on the
3
- * engine's own contract (ADR 0048, ADR 0060), with no @google/adk in its
4
- * import graph.
3
+ * engine's own contract (ADR 0048, ADR 0060, ADR 0107).
5
4
  *
6
- * WHY its own module: lib/models/registry.ts imports ADK (it registers the
7
- * ADK classes and builds TracedGemini), so the `melchizedek-agents/model`
8
- * entry (lib/model.ts) cannot load it. The routing step both paths share
9
- * (routeFor: the provider from the prefix table, the caller's endpoint merged
10
- * over the environment's, the transport from planTransport), the BYOK scoping
11
- * and the contract adapter table live here; registry.ts imports them for
12
- * resolveModel and for its own resolveAdapter.
5
+ * The routing step (routeFor: the provider from the prefix table, the
6
+ * caller's endpoint merged over the environment's, the transport from
7
+ * planTransport), the BYOK scoping and the contract adapter table live
8
+ * here. lib/models/registry.ts re-exports the resolver and builds
9
+ * resolveModel on it; `melchizedek-agents/model` (lib/model.ts) exports it
10
+ * with no compiler or runtime in its import graph (ADR 0068).
13
11
  *
14
- * GEMINI (ADR 0068, ADR 0100): a Gemini id gets the engine's GeminiAdapter
15
- * unless `adk` is asked for, by the option or by GEMINI_ADAPTER=adk.
16
- * `adapterResolver(adkGemini)` takes the factory for the temporary
17
- * AdkGeminiAdapter from its caller: registry.ts passes one, so `adk` works
18
- * there for one release (with @google/adk installed). The resolver exported
19
- * here has none, so asking it for `adk` throws and names the entry that has
20
- * it.
12
+ * GEMINI (ADR 0100, ADR 0107): a Gemini id gets the engine's GeminiAdapter.
13
+ * GEMINI_ADAPTER=engine, or the `gemini: 'engine'` option, is accepted and
14
+ * changes nothing; `adk`, the ADK Gemini adapter that 1.0.0 removed, throws
15
+ * an error naming the release.
21
16
  */
22
17
  import type { ModelAdapter } from './contract.ts';
23
18
  import type { ProviderEndpoint } from './endpoints.ts';
@@ -51,14 +46,9 @@ export declare function routeFor(model: string, apiKey: string | undefined, endp
51
46
  export declare function scopedKey(model: string, apiKey: string | undefined, keyProvider: ProviderId): string | undefined;
52
47
  /** A provider name as the A2A X-Provider header gives it; anything unknown reads as gemini. */
53
48
  export declare function normalizeProvider(provider?: string): ProviderId;
54
- /**
55
- * Which adapter serves a Gemini id on the contract path: `adk`, the temporary
56
- * AdkGeminiAdapter over ADK's Gemini (lib/models/adkGeminiAdapter.ts), or
57
- * `engine`, the engine's own GeminiAdapter on @google/genai
58
- * (lib/models/geminiAdapter.ts).
59
- */
60
- export type GeminiAdapterChoice = 'adk' | 'engine';
61
- /** GEMINI_ADAPTER as set (`adk` or `engine`), or undefined when unset. Any other value is a configuration error. */
49
+ /** Which adapter serves a Gemini id: the engine's GeminiAdapter (lib/models/geminiAdapter.ts), the only one since 1.0.0. */
50
+ export type GeminiAdapterChoice = 'engine';
51
+ /** GEMINI_ADAPTER as set (`engine`), or undefined when unset. `adk` throws, naming 1.0.0; any other value is a configuration error. */
62
52
  export declare function geminiAdapterSetting(env?: NodeJS.ProcessEnv): GeminiAdapterChoice | undefined;
63
53
  export interface ResolveAdapterOptions {
64
54
  /**
@@ -75,33 +65,24 @@ export interface ResolveAdapterOptions {
75
65
  /** Where requests go (ADR 0023), merged over the environment's endpoint for the model's provider. */
76
66
  endpoint?: Partial<ProviderEndpoint>;
77
67
  /**
78
- * Which Gemini adapter a Gemini id gets. Default: GEMINI_ADAPTER, else
79
- * `engine` (since 0.20.0, ADR 0100). `adk` is available for one release
80
- * through `melchizedek-agents/models/registry` with @google/adk installed;
81
- * `melchizedek-agents/model` has no `adk`.
68
+ * Which Gemini adapter a Gemini id gets: `engine`, the only one (ADR 0107).
69
+ * GEMINI_ADAPTER is still read, so `adk` there throws.
82
70
  */
83
71
  gemini?: GeminiAdapterChoice;
84
72
  }
85
73
  /** What a direct route's adapter is built from. */
86
74
  export type AdapterRoute = Pick<Route, 'model' | 'apiKey' | 'endpoint'>;
87
- /** Builds the temporary AdkGeminiAdapter; only lib/models/registry.ts supplies one. */
88
- export type AdkGeminiFactory = (route: AdapterRoute) => ModelAdapter;
89
75
  export interface AdapterResolver {
90
76
  resolveAdapter(modelId: string, options?: ResolveAdapterOptions): ModelAdapter;
91
77
  resolveAdapterWithFallback(modelId: string, fallbackId: string | undefined, options?: ResolveAdapterOptions, fallbackOptions?: FallbackAdapterOptions): ModelAdapter;
92
78
  }
93
- /**
94
- * A resolver over the one prefix table. A Gemini id gets GeminiAdapter
95
- * unless `adk` is asked for (ADR 0100). With `adkGemini`, `adk` gets
96
- * AdkGeminiAdapter (ADR 0060); without it, asking for `adk` throws (ADR 0068).
97
- */
98
- export declare function adapterResolver(adkGemini?: AdkGeminiFactory): AdapterResolver;
79
+ /** A resolver over the one prefix table. A Gemini id gets GeminiAdapter (ADR 0100, ADR 0107). */
80
+ export declare function adapterResolver(): AdapterResolver;
99
81
  /**
100
82
  * Resolves a model id to the engine's own ModelAdapter (ADR 0048), from the
101
- * prefix table and the transport rule resolveModel uses, with no ADK: the
102
- * provider's adapter when its key (env, BYOK or endpoint) is present, the
103
- * gateway's when it is absent and MODEL_GATEWAY is set. A Gemini id gets
104
- * GeminiAdapter (ADR 0068). The adapter opens no span and charges nothing:
83
+ * prefix table and the transport rule: the provider's adapter when its key
84
+ * (env, BYOK or endpoint) is present, the gateway's when it is absent and
85
+ * MODEL_GATEWAY is set. A Gemini id gets GeminiAdapter. The adapter opens no span and charges nothing:
105
86
  * its caller does (ADR 0053).
106
87
  */
107
88
  export declare function resolveAdapter(modelId: string, options?: ResolveAdapterOptions): ModelAdapter;
@@ -1,23 +1,18 @@
1
1
  /**
2
2
  * lib/models/adapterResolver.ts — one model id to one ModelAdapter on the
3
- * engine's own contract (ADR 0048, ADR 0060), with no @google/adk in its
4
- * import graph.
3
+ * engine's own contract (ADR 0048, ADR 0060, ADR 0107).
5
4
  *
6
- * WHY its own module: lib/models/registry.ts imports ADK (it registers the
7
- * ADK classes and builds TracedGemini), so the `melchizedek-agents/model`
8
- * entry (lib/model.ts) cannot load it. The routing step both paths share
9
- * (routeFor: the provider from the prefix table, the caller's endpoint merged
10
- * over the environment's, the transport from planTransport), the BYOK scoping
11
- * and the contract adapter table live here; registry.ts imports them for
12
- * resolveModel and for its own resolveAdapter.
5
+ * The routing step (routeFor: the provider from the prefix table, the
6
+ * caller's endpoint merged over the environment's, the transport from
7
+ * planTransport), the BYOK scoping and the contract adapter table live
8
+ * here. lib/models/registry.ts re-exports the resolver and builds
9
+ * resolveModel on it; `melchizedek-agents/model` (lib/model.ts) exports it
10
+ * with no compiler or runtime in its import graph (ADR 0068).
13
11
  *
14
- * GEMINI (ADR 0068, ADR 0100): a Gemini id gets the engine's GeminiAdapter
15
- * unless `adk` is asked for, by the option or by GEMINI_ADAPTER=adk.
16
- * `adapterResolver(adkGemini)` takes the factory for the temporary
17
- * AdkGeminiAdapter from its caller: registry.ts passes one, so `adk` works
18
- * there for one release (with @google/adk installed). The resolver exported
19
- * here has none, so asking it for `adk` throws and names the entry that has
20
- * it.
12
+ * GEMINI (ADR 0100, ADR 0107): a Gemini id gets the engine's GeminiAdapter.
13
+ * GEMINI_ADAPTER=engine, or the `gemini: 'engine'` option, is accepted and
14
+ * changes nothing; `adk`, the ADK Gemini adapter that 1.0.0 removed, throws
15
+ * an error naming the release.
21
16
  */
22
17
  import { ClaudeAdapter } from './claudeAdapter.js';
23
18
  import { mergeEndpoint } from './endpoints.js';
@@ -61,14 +56,21 @@ export function normalizeProvider(provider) {
61
56
  }
62
57
  return 'gemini';
63
58
  }
64
- /** GEMINI_ADAPTER as set (`adk` or `engine`), or undefined when unset. Any other value is a configuration error. */
59
+ /** The error for GEMINI_ADAPTER=adk, or the `gemini: 'adk'` option: the ADK Gemini adapter left in 1.0.0. */
60
+ function adkGeminiRemoved(source) {
61
+ return new Error(`${source} asks for the ADK Gemini adapter, which was removed in melchizedek-agents 1.0.0 (ADR 0107): ` +
62
+ `every Gemini id runs on the engine's GeminiAdapter. Unset ${source} (or set it to "engine").`);
63
+ }
64
+ /** GEMINI_ADAPTER as set (`engine`), or undefined when unset. `adk` throws, naming 1.0.0; any other value is a configuration error. */
65
65
  export function geminiAdapterSetting(env = process.env) {
66
66
  const raw = env.GEMINI_ADAPTER?.trim().toLowerCase();
67
67
  if (!raw)
68
68
  return undefined;
69
- if (raw === 'adk' || raw === 'engine')
69
+ if (raw === 'engine')
70
70
  return raw;
71
- throw new Error('GEMINI_ADAPTER must be "adk" or "engine".');
71
+ if (raw === 'adk')
72
+ throw adkGeminiRemoved('GEMINI_ADAPTER');
73
+ throw new Error('GEMINI_ADAPTER must be "engine" (the only Gemini adapter since 1.0.0).');
72
74
  }
73
75
  /** Each non-Gemini provider's contract adapter for a direct route. */
74
76
  const CONTRACT_ADAPTER = {
@@ -78,21 +80,12 @@ const CONTRACT_ADAPTER = {
78
80
  xai: (r) => new GrokAdapter({ model: r.model, apiKey: r.apiKey }),
79
81
  moonshot: (r) => new KimiAdapter({ model: r.model, apiKey: r.apiKey, baseUrl: r.endpoint?.baseURL }),
80
82
  };
81
- /**
82
- * A resolver over the one prefix table. A Gemini id gets GeminiAdapter
83
- * unless `adk` is asked for (ADR 0100). With `adkGemini`, `adk` gets
84
- * AdkGeminiAdapter (ADR 0060); without it, asking for `adk` throws (ADR 0068).
85
- */
86
- export function adapterResolver(adkGemini) {
83
+ /** A resolver over the one prefix table. A Gemini id gets GeminiAdapter (ADR 0100, ADR 0107). */
84
+ export function adapterResolver() {
87
85
  const geminiFor = (r, choice) => {
88
- const route = { model: r.model, apiKey: r.apiKey, endpoint: r.endpoint };
89
- if (choice === 'engine')
90
- return new GeminiAdapter(route);
91
- if (!adkGemini) {
92
- throw new Error('The ADK Gemini adapter is not available from melchizedek-agents/model, which loads no @google/adk. ' +
93
- 'Use gemini: "engine" (or unset GEMINI_ADAPTER), or resolve through melchizedek-agents/models/registry.');
94
- }
95
- return adkGemini(route);
86
+ if (choice !== 'engine')
87
+ throw adkGeminiRemoved(`The gemini option ("${choice}")`);
88
+ return new GeminiAdapter({ model: r.model, apiKey: r.apiKey, endpoint: r.endpoint });
96
89
  };
97
90
  function resolveAdapter(modelId, options = {}) {
98
91
  const keyProvider = options.keyProvider === undefined ? providerForModel(modelId) : normalizeProvider(options.keyProvider);
@@ -113,17 +106,16 @@ export function adapterResolver(adkGemini) {
113
106
  }
114
107
  return { resolveAdapter, resolveAdapterWithFallback };
115
108
  }
116
- const ADK_FREE = adapterResolver();
109
+ const RESOLVER = adapterResolver();
117
110
  /**
118
111
  * Resolves a model id to the engine's own ModelAdapter (ADR 0048), from the
119
- * prefix table and the transport rule resolveModel uses, with no ADK: the
120
- * provider's adapter when its key (env, BYOK or endpoint) is present, the
121
- * gateway's when it is absent and MODEL_GATEWAY is set. A Gemini id gets
122
- * GeminiAdapter (ADR 0068). The adapter opens no span and charges nothing:
112
+ * prefix table and the transport rule: the provider's adapter when its key
113
+ * (env, BYOK or endpoint) is present, the gateway's when it is absent and
114
+ * MODEL_GATEWAY is set. A Gemini id gets GeminiAdapter. The adapter opens no span and charges nothing:
123
115
  * its caller does (ADR 0053).
124
116
  */
125
117
  export function resolveAdapter(modelId, options = {}) {
126
- return ADK_FREE.resolveAdapter(modelId, options);
118
+ return RESOLVER.resolveAdapter(modelId, options);
127
119
  }
128
120
  /**
129
121
  * An agent's model and its `fallback_model:`: a FallbackAdapter (ADR 0044)
@@ -133,5 +125,5 @@ export function resolveAdapter(modelId, options = {}) {
133
125
  * server env.
134
126
  */
135
127
  export function resolveAdapterWithFallback(modelId, fallbackId, options = {}, fallbackOptions = {}) {
136
- return ADK_FREE.resolveAdapterWithFallback(modelId, fallbackId, options, fallbackOptions);
128
+ return RESOLVER.resolveAdapterWithFallback(modelId, fallbackId, options, fallbackOptions);
137
129
  }
@@ -11,9 +11,7 @@
11
11
  * is a small subclass supplying the endpoint, the auth headers, the wire
12
12
  * model name, its reasoning field, the tool choices it honours and its
13
13
  * error wording (lib/models/ollamaAdapter.ts, kimiAdapter.ts,
14
- * gatewayAdapter.ts). There is no ADK here: under ADK each adapter runs
15
- * behind its shim class (OllamaLlm, KimiLlm, GatewayLlm, through
16
- * OpenAiCompatibleLlm in lib/models/openAiCompatibleLlm.ts, ADR 0057).
14
+ * gatewayAdapter.ts; ADR 0057).
17
15
  * wiki/models/model-contract.md ("Chat completions") is the mapping spec.
18
16
  *
19
17
  * WHAT THE BASE PROVIDES (uniformly, for every subclass):
@@ -21,8 +19,8 @@
21
19
  * message first; user text and inline images (data URIs; a URL blob is
22
20
  * not sent); assistant text and tool_calls; one `tool` message per tool
23
21
  * result, its content the result's JSON in the genai envelope ({ result }
24
- * for a non-object, { error } for a failure), so the wire is what the ADK
25
- * path sent. Thinking is never sent.
22
+ * for a non-object, { error } for a failure), the wire ADK sent.
23
+ * Thinking is never sent.
26
24
  * - Tools as function tools, the schema as written (lowercase JSON Schema),
27
25
  * its strict form with `strict: true` when the declaration asks.
28
26
  * `toolChoice: 'none'` sends no tools; `required` and a named tool go as
@@ -57,24 +55,6 @@
57
55
  * llm.retries, llm.retry_without_thinking, and the search and drop marks.
58
56
  */
59
57
  import type { ModelAdapter, ModelRequest, ModelResponse, ReasoningSetting, ToolChoiceMode, Usage } from './contract.ts';
60
- /**
61
- * What an agent's older generateContentConfig spelling asks of a
62
- * chat-completions provider that the contract has no field for (ADR 0047;
63
- * "What the contract leaves out" in wiki/models/model-contract.md). Only the
64
- * ADK shim around these adapters sets it, from the LlmRequest, so an agent
65
- * keeps it on the ADK runtime; the native runtime never sets it.
66
- */
67
- export interface OlderSpelling {
68
- /**
69
- * An effort word that is not a contract level, such as Kimi K3's `max`,
70
- * sent as `reasoning_effort` as written, in place of `reasoning`'s word.
71
- */
72
- reasoningEffort?: string;
73
- }
74
- /** A ModelRequest, plus what the ADK path carries beside the contract. */
75
- export interface ChatCompletionsRequest extends ModelRequest {
76
- olderSpelling?: OlderSpelling;
77
- }
78
58
  type ChatContentPart = {
79
59
  type: 'text';
80
60
  text: string;
@@ -116,9 +96,9 @@ export interface ChatFailure {
116
96
  /** The providerState kind an opted-in adapter writes: an assistant message's reasoning_content. */
117
97
  export declare const REASONING_CONTENT_KIND = "reasoning_content";
118
98
  /**
119
- * The prefix of a call id the engine made when the provider returned none.
120
- * ADK uses it for its own ids and leaves such ids out of the requests it
121
- * builds, so on the ADK path the stored history reads as it did.
99
+ * The prefix of a call id the engine made when the provider returned none:
100
+ * ADK's prefix for its own ids, kept so sessions ADK wrote and sessions the
101
+ * engine writes read alike.
122
102
  */
123
103
  export declare const ENGINE_CALL_ID_PREFIX = "adk-";
124
104
  /**
@@ -210,13 +190,12 @@ export declare abstract class ChatCompletionsAdapter implements ModelAdapter {
210
190
  /**
211
191
  * The body fields for the request's reasoning. Default: `reasoning_effort`
212
192
  * as the effort word ADR 0047 gives this model (lib/models/reasoning.ts),
213
- * the field every chat-completions provider and gateway reads; the older
214
- * spelling's word as written when the ADK path carries one; nothing when
215
- * neither is set.
193
+ * the field every chat-completions provider and gateway reads; nothing
194
+ * when the request sets no reasoning.
216
195
  */
217
- protected reasoningFields(model: string, setting: ReasoningSetting | undefined, olderWord: string | undefined): Record<string, unknown>;
196
+ protected reasoningFields(model: string, setting: ReasoningSetting | undefined): Record<string, unknown>;
218
197
  /** Provider-specific body fields, merged last. */
219
- protected extraBodyFields(_request: ChatCompletionsRequest): Record<string, unknown>;
198
+ protected extraBodyFields(_request: ModelRequest): Record<string, unknown>;
220
199
  /**
221
200
  * Body fields enabling the provider's NATIVE web search, or null when the
222
201
  * provider has none (the base then drops the tool, marks the span and
@@ -270,9 +249,9 @@ export declare abstract class ChatCompletionsAdapter implements ModelAdapter {
270
249
  * usage, so budgets and the ledger still count it. A request that already
271
250
  * asks for no reasoning is not retried.
272
251
  */
273
- generate(request: ChatCompletionsRequest): AsyncGenerator<ModelResponse, void>;
252
+ generate(request: ModelRequest): AsyncGenerator<ModelResponse, void>;
274
253
  /** The chat messages this adapter sends for a request, the system message first. */
275
- messagesFor(request: ChatCompletionsRequest): ChatMessage[];
254
+ messagesFor(request: ModelRequest): ChatMessage[];
276
255
  /** The function tools this adapter sends for a request: none under `toolChoice: 'none'`. */
277
256
  toolsFor(request: ModelRequest): Array<Record<string, unknown>>;
278
257
  }
@@ -11,9 +11,7 @@
11
11
  * is a small subclass supplying the endpoint, the auth headers, the wire
12
12
  * model name, its reasoning field, the tool choices it honours and its
13
13
  * error wording (lib/models/ollamaAdapter.ts, kimiAdapter.ts,
14
- * gatewayAdapter.ts). There is no ADK here: under ADK each adapter runs
15
- * behind its shim class (OllamaLlm, KimiLlm, GatewayLlm, through
16
- * OpenAiCompatibleLlm in lib/models/openAiCompatibleLlm.ts, ADR 0057).
14
+ * gatewayAdapter.ts; ADR 0057).
17
15
  * wiki/models/model-contract.md ("Chat completions") is the mapping spec.
18
16
  *
19
17
  * WHAT THE BASE PROVIDES (uniformly, for every subclass):
@@ -21,8 +19,8 @@
21
19
  * message first; user text and inline images (data URIs; a URL blob is
22
20
  * not sent); assistant text and tool_calls; one `tool` message per tool
23
21
  * result, its content the result's JSON in the genai envelope ({ result }
24
- * for a non-object, { error } for a failure), so the wire is what the ADK
25
- * path sent. Thinking is never sent.
22
+ * for a non-object, { error } for a failure), the wire ADK sent.
23
+ * Thinking is never sent.
26
24
  * - Tools as function tools, the schema as written (lowercase JSON Schema),
27
25
  * its strict form with `strict: true` when the declaration asks.
28
26
  * `toolChoice: 'none'` sends no tools; `required` and a named tool go as
@@ -66,9 +64,9 @@ import { currentTurnSignal } from '../runtime/turnControl.js';
66
64
  /** The providerState kind an opted-in adapter writes: an assistant message's reasoning_content. */
67
65
  export const REASONING_CONTENT_KIND = 'reasoning_content';
68
66
  /**
69
- * The prefix of a call id the engine made when the provider returned none.
70
- * ADK uses it for its own ids and leaves such ids out of the requests it
71
- * builds, so on the ADK path the stored history reads as it did.
67
+ * The prefix of a call id the engine made when the provider returned none:
68
+ * ADK's prefix for its own ids, kept so sessions ADK wrote and sessions the
69
+ * engine writes read alike.
72
70
  */
73
71
  export const ENGINE_CALL_ID_PREFIX = 'adk-';
74
72
  // ── <think> blocks ───────────────────────────────────────────────────────────
@@ -203,7 +201,7 @@ export function sumUsage(a, b) {
203
201
  export function reasonsNotAtAll(setting) {
204
202
  return setting === 'none' || (typeof setting === 'object' && setting !== null && setting.budget_tokens <= 0);
205
203
  }
206
- /** A tool result as the tool message's content: the genai envelope, so the wire is what the ADK path sent. */
204
+ /** A tool result as the tool message's content: the genai envelope, the wire ADK sent. */
207
205
  function resultContent(part) {
208
206
  const response = part.isError ? { error: part.result } : isPlainObject(part.result) ? part.result : { result: part.result };
209
207
  return JSON.stringify(response);
@@ -329,12 +327,11 @@ export class ChatCompletionsAdapter {
329
327
  /**
330
328
  * The body fields for the request's reasoning. Default: `reasoning_effort`
331
329
  * as the effort word ADR 0047 gives this model (lib/models/reasoning.ts),
332
- * the field every chat-completions provider and gateway reads; the older
333
- * spelling's word as written when the ADK path carries one; nothing when
334
- * neither is set.
330
+ * the field every chat-completions provider and gateway reads; nothing
331
+ * when the request sets no reasoning.
335
332
  */
336
- reasoningFields(model, setting, olderWord) {
337
- const word = olderWord ?? (setting !== undefined ? reasoningConfig(model, setting).reasoningEffort : undefined);
333
+ reasoningFields(model, setting) {
334
+ const word = setting !== undefined ? reasoningConfig(model, setting).reasoningEffort : undefined;
338
335
  return word !== undefined ? { reasoning_effort: word } : {};
339
336
  }
340
337
  /** Provider-specific body fields, merged last. */
@@ -437,9 +434,7 @@ export class ChatCompletionsAdapter {
437
434
  return;
438
435
  setLlmSpanAttribute('llm.retry_without_thinking', held.error?.code ?? true);
439
436
  this.#warnOnce('retry', `⚠ ${model} thought without answering (${held.error?.code}); retrying once with thinking off.`);
440
- // The older spelling's effort word would ask for thinking again.
441
- const { olderSpelling: _older, ...rest } = request;
442
- const retry = { ...rest, reasoning: 'none' };
437
+ const retry = { ...request, reasoning: 'none' };
443
438
  for await (const response of this.#attempt(retry, model)) {
444
439
  if (response.partial) {
445
440
  yield response;
@@ -672,7 +667,7 @@ export class ChatCompletionsAdapter {
672
667
  ...(sampling.topP !== undefined ? { top_p: sampling.topP } : {}),
673
668
  ...(sampling.maxOutputTokens !== undefined ? { max_tokens: sampling.maxOutputTokens } : {}),
674
669
  ...(sampling.stop?.length ? { stop: [...sampling.stop] } : {}),
675
- ...this.reasoningFields(model, request.reasoning, request.olderSpelling?.reasoningEffort),
670
+ ...this.reasoningFields(model, request.reasoning),
676
671
  ...(tools.length > 0 ? { tools } : {}),
677
672
  ...(tools.length > 0 ? this.#toolChoice(choice, model, request.reasoning) : {}),
678
673
  ...this.#responseFormat(request),
@@ -3,11 +3,11 @@
3
3
  * `fallback_model:` (ADR 0044).
4
4
  *
5
5
  * WHY its own module:
6
- * Two wrappers answer a failing provider from an agent's fallback model:
7
- * FallbackLlm (lib/models/fallback.ts) around two ADK BaseLlm adapters,
8
- * and FallbackAdapter (lib/models/fallbackAdapter.ts) around two adapters
9
- * on the engine's own contract (ADR 0048). Both read and write the circuits
10
- * here, so a provider tripped on one path is skipped on the other.
6
+ * FallbackAdapter (lib/models/fallbackAdapter.ts) answers a failing
7
+ * provider from an agent's fallback model, around two adapters on the
8
+ * engine's own contract (ADR 0048), and the native loop's own fallback
9
+ * step does the same. Both read and write the circuits here, so a provider
10
+ * tripped on one path is skipped on the other.
11
11
  *
12
12
  * THE RULES:
13
13
  * - One circuit per provider id (lib/models/providerMap.ts), shared by
@@ -3,11 +3,11 @@
3
3
  * `fallback_model:` (ADR 0044).
4
4
  *
5
5
  * WHY its own module:
6
- * Two wrappers answer a failing provider from an agent's fallback model:
7
- * FallbackLlm (lib/models/fallback.ts) around two ADK BaseLlm adapters,
8
- * and FallbackAdapter (lib/models/fallbackAdapter.ts) around two adapters
9
- * on the engine's own contract (ADR 0048). Both read and write the circuits
10
- * here, so a provider tripped on one path is skipped on the other.
6
+ * FallbackAdapter (lib/models/fallbackAdapter.ts) answers a failing
7
+ * provider from an agent's fallback model, around two adapters on the
8
+ * engine's own contract (ADR 0048), and the native loop's own fallback
9
+ * step does the same. Both read and write the circuits here, so a provider
10
+ * tripped on one path is skipped on the other.
11
11
  *
12
12
  * THE RULES:
13
13
  * - One circuit per provider id (lib/models/providerMap.ts), shared by
@@ -4,11 +4,9 @@
4
4
  *
5
5
  * WHY this file exists:
6
6
  * Claude's translation reads a ModelRequest and yields ModelResponses, so
7
- * the native runtime (ADR 0045) can call it with no ADK in the path. On
8
- * the ADK path, ClaudeLlm (lib/models/claudeLlm.ts) is this adapter behind
9
- * the ADK shim (lib/models/adkShim.ts, ADR 0053): the shim charges the
10
- * turn and opens the llm.request span, and this adapter only decorates
11
- * that span with setLlmSpanAttribute.
7
+ * the native loop (ADR 0045) calls it directly: the loop charges the turn
8
+ * and opens the llm.request span (ADR 0053), and this adapter only
9
+ * decorates that span with setLlmSpanAttribute.
12
10
  *
13
11
  * THE MAPPING is the Anthropic table of wiki/models/model-contract.md;
14
12
  * wiki/models/claude-adapter.md records the choices made inside it:
@@ -22,15 +20,13 @@
22
20
  * the part they preceded as providerState (ADR 0046), and are replayed
23
21
  * before that part within the current turn's tool loop, for this model
24
22
  * only.
25
- * - A tool result's content is the JSON of the result in the shape the ADK
26
- * path stores it (`{ result }` for a value that is not an object,
27
- * `{ error }` for a failure), so both runtimes send the same bytes
28
- * (ADR 0055).
29
- * - ClaudeLlm adds `claudeReasoning`, the older reasoning spelling read as
30
- * ADR 0049 reads it, which this adapter reads in place of `reasoning`
31
- * (ClaudeModelRequest, ADR 0055). The native runtime never sets it.
23
+ * - A tool result's content is the JSON of the result in the shape the
24
+ * stored events keep it (`{ result }` for a value that is not an object,
25
+ * `{ error }` for a failure), the bytes ADK sent (ADR 0055).
26
+ * - Reasoning is the contract's `reasoning`, read by claudeReasoningOf
27
+ * (ADR 0049).
32
28
  * - `outputFormat: 'json'` sends nothing: the Messages API has no JSON
33
- * mode without a schema, and ClaudeLlm never sent one for
29
+ * mode without a schema, and ADK's Claude path never sent one for
34
30
  * `responseMimeType` alone (ADR 0061). The prompt asks for the JSON.
35
31
  *
36
32
  * THE ADAPTER RULES (contract.ts header) as this adapter keeps them:
@@ -45,25 +41,12 @@
45
41
  */
46
42
  import type { JsonSchema, ModelAdapter, ModelRequest, ModelResponse } from './contract.ts';
47
43
  import type { ProviderEndpoint } from './endpoints.ts';
48
- import type { ClaudeReasoning } from './claudeModels.ts';
49
44
  /** The provider id this adapter reports and writes its state under (lib/models/providerMap.ts). */
50
45
  export declare const ANTHROPIC_PROVIDER = "anthropic";
51
46
  /** The providerState kind this adapter writes: the signed blocks that preceded a part. */
52
47
  export declare const THINKING_STATE_KIND = "thinking_blocks";
53
48
  /** Name of the tool that carries an outputSchema answer where output_config.format is not used. */
54
49
  export declare const STRUCTURED_OUTPUT_TOOL = "structured_output";
55
- /**
56
- * A ModelRequest as the ADK path's ClaudeLlm hands it to this adapter
57
- * (ADR 0055). `claudeReasoning` is the agent's older reasoning spelling
58
- * (generateContentConfig.reasoningEffort and thinkingConfig.thinkingBudget)
59
- * read as ADR 0049 reads it, which `reasoning` cannot say in full: the effort
60
- * words `xhigh` and `max`, `minimal` as `low`, and the budget rows' reading
61
- * of the budget alone. When set it is read in place of `reasoning`. The
62
- * native runtime never sets it.
63
- */
64
- export interface ClaudeModelRequest extends ModelRequest {
65
- claudeReasoning?: ClaudeReasoning;
66
- }
67
50
  /** A tool definition as the Messages API takes it: a client tool, or Anthropic's web search server tool. */
68
51
  export type AnthropicTool = {
69
52
  name: string;
@@ -4,11 +4,9 @@
4
4
  *
5
5
  * WHY this file exists:
6
6
  * Claude's translation reads a ModelRequest and yields ModelResponses, so
7
- * the native runtime (ADR 0045) can call it with no ADK in the path. On
8
- * the ADK path, ClaudeLlm (lib/models/claudeLlm.ts) is this adapter behind
9
- * the ADK shim (lib/models/adkShim.ts, ADR 0053): the shim charges the
10
- * turn and opens the llm.request span, and this adapter only decorates
11
- * that span with setLlmSpanAttribute.
7
+ * the native loop (ADR 0045) calls it directly: the loop charges the turn
8
+ * and opens the llm.request span (ADR 0053), and this adapter only
9
+ * decorates that span with setLlmSpanAttribute.
12
10
  *
13
11
  * THE MAPPING is the Anthropic table of wiki/models/model-contract.md;
14
12
  * wiki/models/claude-adapter.md records the choices made inside it:
@@ -22,15 +20,13 @@
22
20
  * the part they preceded as providerState (ADR 0046), and are replayed
23
21
  * before that part within the current turn's tool loop, for this model
24
22
  * only.
25
- * - A tool result's content is the JSON of the result in the shape the ADK
26
- * path stores it (`{ result }` for a value that is not an object,
27
- * `{ error }` for a failure), so both runtimes send the same bytes
28
- * (ADR 0055).
29
- * - ClaudeLlm adds `claudeReasoning`, the older reasoning spelling read as
30
- * ADR 0049 reads it, which this adapter reads in place of `reasoning`
31
- * (ClaudeModelRequest, ADR 0055). The native runtime never sets it.
23
+ * - A tool result's content is the JSON of the result in the shape the
24
+ * stored events keep it (`{ result }` for a value that is not an object,
25
+ * `{ error }` for a failure), the bytes ADK sent (ADR 0055).
26
+ * - Reasoning is the contract's `reasoning`, read by claudeReasoningOf
27
+ * (ADR 0049).
32
28
  * - `outputFormat: 'json'` sends nothing: the Messages API has no JSON
33
- * mode without a schema, and ClaudeLlm never sent one for
29
+ * mode without a schema, and ADK's Claude path never sent one for
34
30
  * `responseMimeType` alone (ADR 0061). The prompt asks for the JSON.
35
31
  *
36
32
  * THE ADAPTER RULES (contract.ts header) as this adapter keeps them:
@@ -150,7 +146,7 @@ export function anthropicTools(request) {
150
146
  tools.push(WEB_SEARCH_TOOL);
151
147
  return tools;
152
148
  }
153
- /** A tool result's content: the JSON of the result in the shape the ADK path stores it. */
149
+ /** A tool result's content: the JSON of the result in the shape the stored events keep it (ADR 0055). */
154
150
  function toolResultBlock(part) {
155
151
  const response = part.isError ? { error: part.result } : isPlainObject(part.result) ? part.result : { result: part.result };
156
152
  return {
@@ -278,7 +274,7 @@ export class ClaudeAdapter {
278
274
  async #build(request, model, endpoint) {
279
275
  // ── The request surface this model takes (ADR 0049) ──────────────────────
280
276
  const gen = claudeGeneration(model);
281
- const reasoning = request.claudeReasoning ?? claudeReasoningOf(request.reasoning);
277
+ const reasoning = claudeReasoningOf(request.reasoning);
282
278
  // Adaptive generations: thinking, effort and drop_block from the table.
283
279
  // Budget generations keep the budget path below.
284
280
  const plan = gen.thinking === 'adaptive' ? adaptiveThinkingFor(gen, reasoning) : undefined;
@@ -20,8 +20,8 @@
20
20
  *
21
21
  * How hard a request asks Claude to think reaches the table as one
22
22
  * `ClaudeReasoning`: from the contract's `reasoning` (claudeReasoningOf),
23
- * or, on the ADK path, from the agent's generateContentConfig as ADR 0049
24
- * reads it (claudeReasoningFromConfig, ADR 0055).
23
+ * or from the agent's generateContentConfig as ADR 0049 reads it
24
+ * (claudeReasoningFromConfig, ADR 0055).
25
25
  */
26
26
  import type { ReasoningSetting } from './contract.ts';
27
27
  import type { Platform } from './endpoints.ts';
@@ -83,8 +83,8 @@ export declare function claudeReasoningOf(setting: ReasoningSetting | undefined)
83
83
  * The older spelling in an agent's generateContentConfig, read as ADR 0049
84
84
  * reads it: the effort word first (`xhigh` and `max` pass through,
85
85
  * `minimal` is `low`), else the thinking budget rounded up to a level; and
86
- * the thinking budget as given, which is all the budget rows read. The ADK
87
- * path's ClaudeLlm hands the adapter this (ADR 0055).
86
+ * the thinking budget as given, which is all the budget rows read
87
+ * (ADR 0055).
88
88
  */
89
89
  export declare function claudeReasoningFromConfig(cfg: Record<string, any>): ClaudeReasoning;
90
90
  /** The beta that lets a request set `thinking.block_binding`. */
@@ -20,8 +20,8 @@
20
20
  *
21
21
  * How hard a request asks Claude to think reaches the table as one
22
22
  * `ClaudeReasoning`: from the contract's `reasoning` (claudeReasoningOf),
23
- * or, on the ADK path, from the agent's generateContentConfig as ADR 0049
24
- * reads it (claudeReasoningFromConfig, ADR 0055).
23
+ * or from the agent's generateContentConfig as ADR 0049 reads it
24
+ * (claudeReasoningFromConfig, ADR 0055).
25
25
  */
26
26
  import { REASONING_BUDGETS } from './reasoning.js';
27
27
  const BUDGET = {
@@ -163,8 +163,8 @@ export function claudeReasoningOf(setting) {
163
163
  * The older spelling in an agent's generateContentConfig, read as ADR 0049
164
164
  * reads it: the effort word first (`xhigh` and `max` pass through,
165
165
  * `minimal` is `low`), else the thinking budget rounded up to a level; and
166
- * the thinking budget as given, which is all the budget rows read. The ADK
167
- * path's ClaudeLlm hands the adapter this (ADR 0055).
166
+ * the thinking budget as given, which is all the budget rows read
167
+ * (ADR 0055).
168
168
  */
169
169
  export function claudeReasoningFromConfig(cfg) {
170
170
  const effort = requestedEffort(cfg);