melchizedek-agents 0.19.0 → 1.0.0

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 (242) hide show
  1. package/.env.example +4 -5
  2. package/AGENT_SETUP.md +3 -3
  3. package/CHANGELOG.md +492 -76
  4. package/DOCUMENTATION.md +153 -132
  5. package/QUICKSTART.md +14 -10
  6. package/README.md +12 -15
  7. package/config/agents/examples/image_production.yaml +2 -2
  8. package/config/agents/syndicateSchema.yaml +55 -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/adkPeer.d.ts +63 -0
  16. package/dist/lib/adkPeer.js +240 -0
  17. package/dist/lib/compile.d.ts +109 -81
  18. package/dist/lib/compile.js +163 -111
  19. package/dist/lib/compileAdk.d.ts +7 -4
  20. package/dist/lib/compileAdk.js +22 -12
  21. package/dist/lib/compileNative.d.ts +63 -49
  22. package/dist/lib/compileNative.js +136 -78
  23. package/dist/lib/config.d.ts +6 -6
  24. package/dist/lib/config.js +6 -6
  25. package/dist/lib/doctor.d.ts +22 -1
  26. package/dist/lib/doctor.js +27 -2
  27. package/dist/lib/index.d.ts +14 -7
  28. package/dist/lib/index.js +11 -7
  29. package/dist/lib/loadSyndicate.d.ts +3 -3
  30. package/dist/lib/loadSyndicate.js +2 -2
  31. package/dist/lib/memory/erase.d.ts +1 -1
  32. package/dist/lib/memory/erase.js +1 -1
  33. package/dist/lib/memory/namespace.d.ts +12 -14
  34. package/dist/lib/memory/namespace.js +13 -14
  35. package/dist/lib/memory/providers.d.ts +4 -5
  36. package/dist/lib/memory/providers.js +12 -6
  37. package/dist/lib/memory/supabaseMemoryService.d.ts +9 -30
  38. package/dist/lib/memory/supabaseMemoryService.js +8 -30
  39. package/dist/lib/model.d.ts +6 -12
  40. package/dist/lib/model.js +6 -12
  41. package/dist/lib/models/adapterResolver.d.ts +21 -38
  42. package/dist/lib/models/adapterResolver.js +33 -40
  43. package/dist/lib/models/adkGeminiAdapter.js +2 -0
  44. package/dist/lib/models/adkShim.d.ts +1 -1
  45. package/dist/lib/models/adkShim.js +1 -1
  46. package/dist/lib/models/capabilities.js +13 -10
  47. package/dist/lib/models/chatCompletionsAdapter.d.ts +12 -33
  48. package/dist/lib/models/chatCompletionsAdapter.js +13 -18
  49. package/dist/lib/models/circuitBreaker.d.ts +5 -5
  50. package/dist/lib/models/circuitBreaker.js +5 -5
  51. package/dist/lib/models/claudeAdapter.d.ts +9 -26
  52. package/dist/lib/models/claudeAdapter.js +11 -15
  53. package/dist/lib/models/claudeLlm.js +2 -2
  54. package/dist/lib/models/claudeModels.d.ts +4 -4
  55. package/dist/lib/models/claudeModels.js +4 -4
  56. package/dist/lib/models/contract.d.ts +11 -11
  57. package/dist/lib/models/contract.js +6 -6
  58. package/dist/lib/models/errorResponse.d.ts +13 -20
  59. package/dist/lib/models/errorResponse.js +0 -12
  60. package/dist/lib/models/fallback.d.ts +1 -1
  61. package/dist/lib/models/fallback.js +1 -1
  62. package/dist/lib/models/fallbackAdapter.d.ts +7 -8
  63. package/dist/lib/models/gatewayAdapter.d.ts +1 -1
  64. package/dist/lib/models/gatewayAdapter.js +1 -1
  65. package/dist/lib/models/gatewayLlm.js +2 -2
  66. package/dist/lib/models/geminiAdapter.d.ts +11 -10
  67. package/dist/lib/models/geminiAdapter.js +37 -15
  68. package/dist/lib/models/geminiState.d.ts +29 -8
  69. package/dist/lib/models/geminiState.js +34 -8
  70. package/dist/lib/models/genaiMapping.d.ts +104 -38
  71. package/dist/lib/models/genaiMapping.js +146 -43
  72. package/dist/lib/models/gptAdapter.d.ts +11 -11
  73. package/dist/lib/models/gptAdapter.js +13 -13
  74. package/dist/lib/models/gptLlm.js +2 -2
  75. package/dist/lib/models/grokLlm.js +2 -2
  76. package/dist/lib/models/kimiAdapter.d.ts +6 -7
  77. package/dist/lib/models/kimiAdapter.js +6 -9
  78. package/dist/lib/models/kimiLlm.js +2 -2
  79. package/dist/lib/models/ollamaAdapter.d.ts +3 -3
  80. package/dist/lib/models/ollamaAdapter.js +3 -3
  81. package/dist/lib/models/ollamaLlm.js +2 -2
  82. package/dist/lib/models/providerMap.d.ts +6 -5
  83. package/dist/lib/models/providerMap.js +6 -5
  84. package/dist/lib/models/providerState.d.ts +3 -2
  85. package/dist/lib/models/providerState.js +3 -2
  86. package/dist/lib/models/reasoning.d.ts +1 -1
  87. package/dist/lib/models/registry.d.ts +26 -69
  88. package/dist/lib/models/registry.js +32 -140
  89. package/dist/lib/models/retry.d.ts +2 -2
  90. package/dist/lib/models/retry.js +2 -2
  91. package/dist/lib/models/schemaNormalize.d.ts +25 -55
  92. package/dist/lib/models/schemaNormalize.js +30 -100
  93. package/dist/lib/models/tracedGemini.d.ts +1 -1
  94. package/dist/lib/models/tracedGemini.js +1 -1
  95. package/dist/lib/observability/lineage.d.ts +3 -3
  96. package/dist/lib/observability/lineage.js +10 -10
  97. package/dist/lib/observability/supabaseSpanExporter.js +1 -1
  98. package/dist/lib/observability/tracer.d.ts +25 -23
  99. package/dist/lib/observability/tracer.js +26 -63
  100. package/dist/lib/persistence/supabaseProvider.d.ts +4 -3
  101. package/dist/lib/runtime/adkSessionBridge.d.ts +1 -1
  102. package/dist/lib/runtime/adkSessionBridge.js +1 -1
  103. package/dist/lib/runtime/approvals.d.ts +6 -1
  104. package/dist/lib/runtime/approvals.js +39 -8
  105. package/dist/lib/runtime/credentials.d.ts +4 -2
  106. package/dist/lib/runtime/credentials.js +6 -1
  107. package/dist/lib/runtime/events.d.ts +3 -4
  108. package/dist/lib/runtime/events.js +3 -4
  109. package/dist/lib/runtime/logging.d.ts +3 -8
  110. package/dist/lib/runtime/logging.js +3 -8
  111. package/dist/lib/runtime/memoryService.d.ts +4 -6
  112. package/dist/lib/runtime/memoryService.js +3 -5
  113. package/dist/lib/runtime/native/agentLoop.d.ts +24 -16
  114. package/dist/lib/runtime/native/agentLoop.js +67 -37
  115. package/dist/lib/runtime/native/compaction.d.ts +10 -11
  116. package/dist/lib/runtime/native/compaction.js +10 -11
  117. package/dist/lib/runtime/native/delegate.d.ts +64 -12
  118. package/dist/lib/runtime/native/delegate.js +101 -25
  119. package/dist/lib/runtime/native/history.d.ts +5 -6
  120. package/dist/lib/runtime/native/history.js +5 -6
  121. package/dist/lib/runtime/native/interrupts.d.ts +12 -9
  122. package/dist/lib/runtime/native/interrupts.js +29 -10
  123. package/dist/lib/runtime/native/request.d.ts +25 -25
  124. package/dist/lib/runtime/native/request.js +36 -25
  125. package/dist/lib/runtime/native/selfCorrection.d.ts +75 -17
  126. package/dist/lib/runtime/native/selfCorrection.js +93 -19
  127. package/dist/lib/runtime/native/step.d.ts +34 -26
  128. package/dist/lib/runtime/native/step.js +78 -32
  129. package/dist/lib/runtime/native/taskMode.d.ts +8 -8
  130. package/dist/lib/runtime/native/taskMode.js +8 -8
  131. package/dist/lib/runtime/native/telemetry.d.ts +11 -11
  132. package/dist/lib/runtime/native/telemetry.js +11 -11
  133. package/dist/lib/runtime/native/tempState.d.ts +4 -4
  134. package/dist/lib/runtime/native/tempState.js +4 -4
  135. package/dist/lib/runtime/nativeTurn.d.ts +29 -32
  136. package/dist/lib/runtime/nativeTurn.js +30 -41
  137. package/dist/lib/runtime/questions.d.ts +8 -9
  138. package/dist/lib/runtime/questions.js +1 -2
  139. package/dist/lib/runtime/runtimeFlag.d.ts +35 -13
  140. package/dist/lib/runtime/runtimeFlag.js +46 -16
  141. package/dist/lib/runtime/sessions.d.ts +10 -12
  142. package/dist/lib/runtime/sessions.js +10 -12
  143. package/dist/lib/runtime/syndicateTurn.d.ts +46 -42
  144. package/dist/lib/runtime/syndicateTurn.js +182 -150
  145. package/dist/lib/runtime/turnControl.d.ts +8 -8
  146. package/dist/lib/runtime/turnControl.js +8 -8
  147. package/dist/lib/runtime/valueDepth.d.ts +23 -0
  148. package/dist/lib/runtime/valueDepth.js +41 -0
  149. package/dist/lib/session/supabaseSessionService.d.ts +7 -21
  150. package/dist/lib/session/supabaseSessionService.js +7 -43
  151. package/dist/lib/session/transcript.d.ts +16 -26
  152. package/dist/lib/session/transcript.js +17 -55
  153. package/dist/lib/storage/postgres/sessionService.d.ts +6 -20
  154. package/dist/lib/storage/postgres/sessionService.js +6 -39
  155. package/dist/lib/syndicateSchema.d.ts +2 -0
  156. package/dist/lib/syndicateSchema.js +32 -10
  157. package/dist/lib/toolRegistry.d.ts +20 -14
  158. package/dist/lib/toolRegistry.js +76 -33
  159. package/dist/lib/tools/adkTool.d.ts +1 -1
  160. package/dist/lib/tools/adkTool.js +1 -1
  161. package/dist/lib/tools/auth.d.ts +1 -1
  162. package/dist/lib/tools/auth.js +1 -1
  163. package/dist/lib/tools/collectionsSearchTool.d.ts +1 -1
  164. package/dist/lib/tools/collectionsSearchTool.js +1 -1
  165. package/dist/lib/tools/examples.d.ts +2 -4
  166. package/dist/lib/tools/examples.js +2 -4
  167. package/dist/lib/tools/generateImageTool.d.ts +3 -3
  168. package/dist/lib/tools/generateImageTool.js +4 -5
  169. package/dist/lib/tools/inspectImageTool.d.ts +2 -2
  170. package/dist/lib/tools/inspectImageTool.js +3 -4
  171. package/dist/lib/tools/mcpToolFactory.d.ts +4 -24
  172. package/dist/lib/tools/mcpToolFactory.js +19 -9
  173. package/dist/lib/tools/memoryTools.d.ts +5 -6
  174. package/dist/lib/tools/memoryTools.js +5 -6
  175. package/dist/lib/tools/nativeTools.d.ts +9 -14
  176. package/dist/lib/tools/nativeTools.js +9 -14
  177. package/dist/lib/tools/openapiTools.d.ts +5 -7
  178. package/dist/lib/tools/openapiTools.js +6 -13
  179. package/dist/lib/tools/scienceTools.d.ts +3 -3
  180. package/dist/lib/tools/scienceTools.js +8 -10
  181. package/dist/lib/tools/skillToolset.d.ts +1 -2
  182. package/dist/lib/tools/skillToolset.js +1 -2
  183. package/dist/lib/tools/skills/executor.d.ts +1 -1
  184. package/dist/lib/tools/skills/executor.js +1 -1
  185. package/dist/lib/tools/skills/frontmatter.d.ts +2 -2
  186. package/dist/lib/tools/skills/frontmatter.js +2 -2
  187. package/dist/lib/tools/skills/tools.d.ts +8 -10
  188. package/dist/lib/tools/skills/tools.js +9 -11
  189. package/dist/lib/tools/tool.d.ts +24 -40
  190. package/dist/lib/tools/tool.js +24 -56
  191. package/dist/lib/tools/toolContract.d.ts +8 -13
  192. package/dist/lib/tools/toolContract.js +6 -17
  193. package/dist/lib/tools/urlContextTool.d.ts +1 -1
  194. package/dist/lib/tools/urlContextTool.js +1 -1
  195. package/dist/lib/tools/webExtractTool.d.ts +2 -2
  196. package/dist/lib/tools/webExtractTool.js +3 -4
  197. package/dist/lib/tools/webSearchTool.d.ts +1 -1
  198. package/dist/lib/tools/webSearchTool.js +1 -1
  199. package/dist/lib/tools/wikiTools.d.ts +2 -2
  200. package/dist/lib/tools/wikiTools.js +5 -6
  201. package/dist/lib/tools/xApiSearchTool.d.ts +2 -2
  202. package/dist/lib/tools/xApiSearchTool.js +3 -4
  203. package/dist/lib/tools/xSearchTool.d.ts +1 -1
  204. package/dist/lib/tools/xSearchTool.js +1 -1
  205. package/dist/lib/tools/xaiSearchParams.d.ts +2 -5
  206. package/dist/lib/tools/xaiSearchParams.js +2 -5
  207. package/dist/lib/wiki/agentRun.d.ts +10 -11
  208. package/dist/lib/wiki/agentRun.js +24 -41
  209. package/dist/lib/workflow/agentNode.d.ts +31 -5
  210. package/dist/lib/workflow/agentNode.js +101 -8
  211. package/dist/lib/workflow/graph.d.ts +13 -13
  212. package/dist/lib/workflow/graph.js +25 -15
  213. package/dist/lib/workflow/nodeEvents.d.ts +5 -5
  214. package/dist/lib/workflow/nodeEvents.js +5 -5
  215. package/dist/lib/workflow/pause.d.ts +5 -4
  216. package/dist/lib/workflow/pause.js +5 -4
  217. package/dist/lib/workflow/resume.d.ts +14 -13
  218. package/dist/lib/workflow/resume.js +17 -16
  219. package/dist/lib/workflow/route.d.ts +7 -7
  220. package/dist/lib/workflow/route.js +8 -8
  221. package/dist/lib/workflow/scheduler.d.ts +54 -9
  222. package/dist/lib/workflow/scheduler.js +75 -8
  223. package/dist/lib/workflow/toolNode.d.ts +18 -29
  224. package/dist/lib/workflow/toolNode.js +29 -35
  225. package/dist/lib/workflow/turn.d.ts +29 -20
  226. package/dist/lib/workflow/turn.js +111 -24
  227. package/dist/lib/workflow.d.ts +38 -42
  228. package/dist/lib/workflow.js +38 -150
  229. package/dist/lib/workflowConfig.d.ts +6 -10
  230. package/dist/lib/workflowConfig.js +2 -27
  231. package/dist/scripts/a2a_server.js +1 -2
  232. package/dist/scripts/assistant_worker.d.ts +2 -2
  233. package/dist/scripts/assistant_worker.js +8 -7
  234. package/dist/scripts/doctor.d.ts +3 -1
  235. package/dist/scripts/doctor.js +4 -2
  236. package/dist/scripts/syndicate_chat.js +14 -24
  237. package/package.json +3 -6
  238. package/skills/briefs/_shared.md +2 -2
  239. package/skills/briefs/melchizedek-author.md +2 -2
  240. package/skills/briefs/melchizedek-models.md +6 -6
  241. package/skills/melchizedek-author/SKILL.md +2 -2
  242. package/skills/melchizedek-models/SKILL.md +5 -5
package/.env.example CHANGED
@@ -19,11 +19,10 @@ GOOGLE_GENAI_API_KEY=
19
19
  # keep their task list and job queue. Default: outputs/tasks.json.
20
20
  # MELCHIZEDEK_TASKS_FILE=outputs/tasks.json
21
21
 
22
- # ── Optional: runtime (ADR 0045) ──────────────────────────────────────────────
23
- # Which runtime runs a turn's agents: adk (default) or native (the engine's own loop).
24
- # MELCHIZEDEK_RUNTIME=adk
25
- # Which adapter serves a Gemini model id on the native path: adk (default) or engine.
26
- # GEMINI_ADAPTER=adk
22
+ # ── Runtime (ADR 0107) ────────────────────────────────────────────────────────
23
+ # Every turn runs on the engine's own loop. MELCHIZEDEK_RUNTIME and
24
+ # GEMINI_ADAPTER need no value: native and engine are the only ones, and adk
25
+ # (removed in 1.0.0) stops the server at startup.
27
26
 
28
27
  # ── Optional: MCP (Model Context Protocol) ────────────────────────────────────
29
28
  # ALLOW_PRIVATE_MCP: set to "true" to permit mcp_server_url values pointing at
package/AGENT_SETUP.md CHANGED
@@ -119,9 +119,9 @@ One-shot mode (answers and exits — this is also how you'll script it):
119
119
  npm run syndicate:critic -- "In two sentences, why did the Library of Alexandria decline?"
120
120
  ```
121
121
 
122
- And the floor of the whole framework — one agent, no syndicate, plain
123
- ADK. `scripts/direct_call.ts` is the ~30-line block you'll copy when an
124
- agent belongs inside your own code rather than behind a YAML:
122
+ And the floor of the whole framework — one model call, no syndicate, no
123
+ agent framework. `scripts/direct_call.ts` is the short block you'll copy when a
124
+ model call belongs inside your own code rather than behind a YAML:
125
125
 
126
126
  ```bash
127
127
  npm run demo:direct -- "In one sentence: what is an agent?"
package/CHANGELOG.md CHANGED
@@ -6,6 +6,498 @@ the starter pack and the templates), not the repo's full history.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 1.0.0 — 2026-10-08
10
+
11
+ Release 1.0.0: Google ADK is gone (ADR 0107). Every turn runs on the
12
+ engine's own agent loop and workflow scheduler, which have been the default
13
+ since 0.20.0; the ADK runtime, the ADK peer dependency and everything that
14
+ existed only for them are removed. What a conversation stores does not
15
+ change: sessions written by ADK, or by 0.x on either runtime, resume.
16
+
17
+ ### Breaking — read before upgrading
18
+
19
+ - **Breaking: the ADK runtime is removed.** `native` is the only runtime.
20
+ `MELCHIZEDEK_RUNTIME=adk` is a startup error: `createA2AApp` (the A2A
21
+ server), `melchizedek-chat` and `melchizedek-worker` throw the new
22
+ `RuntimeRemovedError`, which names 1.0.0 and the fix, and
23
+ `runSyndicateTurn` throws it for `runtime: 'adk'` before the session is
24
+ touched. `melchizedek-doctor` reports it as a problem (`--check` fails).
25
+ `MELCHIZEDEK_RUNTIME=native` is still accepted and changes nothing.
26
+ `RuntimeName` is `'native'`; `RUNTIMES` is `['native']`.
27
+ - **Breaking: `@google/adk` is no longer used.** It is gone from
28
+ `peerDependencies`, `peerDependenciesMeta` and `devDependencies`, and
29
+ nothing in the package loads it: uninstall it. The package has no
30
+ top-level `await` any more, so it loads from CommonJS through `require()`
31
+ again (Node's `require(esm)`: on by default from Node 22.12, behind
32
+ `--experimental-require-module` on 22.6–22.11). `@google/genai` stays a
33
+ dependency, used only by the Gemini adapter, the image tools and memory
34
+ embeddings.
35
+ - **Breaking: `runSyndicateTurn` takes the engine's session and memory
36
+ interfaces.** `sessionService` is a `SessionService`
37
+ (`lib/runtime/sessions.ts`: `create`, `get`, `list`, `delete`, `append`)
38
+ and `memoryService` a `MemoryService` (`lib/runtime/memoryService.ts`:
39
+ `ingest`, `search`), no longer ADK's `BaseSessionService` and
40
+ `BaseMemoryService`. The parameter names, the option keys and the result
41
+ are unchanged. `ingestTurnMemory` takes the same two interfaces and calls
42
+ `memoryService.ingest`. `TurnEvents.onEvent` receives a `TurnEvent` (the
43
+ JSON ADK's `Event` carried). `transformAgent` transformed ADK agents: any
44
+ value is refused with `UnsupportedOnRuntimeError` before the session is
45
+ touched.
46
+ - **Breaking: the stores and the memory service lose their ADK methods.**
47
+ `InProcessSessionService`, `PostgresSessionService`,
48
+ `SupabaseSessionService` and `ProjectedSessionService` are the engine's
49
+ `SessionService` only: `createSession`, `getSession`, `listSessions`,
50
+ `deleteSession` and `appendEvent` are gone (use `create`, `get`, `list`,
51
+ `delete`, `append(session, event)`). `ProjectedSessionService` takes an
52
+ engine store. `SupabaseVectorMemoryService` drops `addSessionToMemory`
53
+ and `searchMemory` (use `ingest(session, { extractionRules,
54
+ extractionModel })` and `search`); `namespacedMemoryService` pins `search`
55
+ and `ingest`. The A2A app's `storage.sessionService` and
56
+ `storage.memoryService` take the engine's interfaces. The stored rows are
57
+ unchanged.
58
+ - **Breaking: `GEMINI_ADAPTER=adk` is an error.** Every Gemini id runs on
59
+ the engine's `GeminiAdapter`. `GEMINI_ADAPTER=engine` (or
60
+ `{ gemini: 'engine' }`) is accepted and changes nothing; `adk` throws an
61
+ error naming 1.0.0. `GeminiAdapterChoice` is `'engine'`.
62
+ - **Breaking: removed exports.** From `melchizedek-agents`:
63
+ `AdkNotInstalledError`, `adkInstalled`, `asAdkSessionService`,
64
+ `asSessionService`, `compileGraph`, `compileSubagent`, `compileWorkflow`,
65
+ `CompiledWorkflow`, `toFunctionTool`, `registerAvailableProviders`,
66
+ `GatewayLlm`. From `melchizedek-agents/runtime`: the same runtime names,
67
+ and `retryPlugins` (self-correction is the loop's own, from `retries:`).
68
+ From `melchizedek-agents/compile`: `compileGraph`, `compileSubagent`,
69
+ `requireApprovalOn`, `requireApprovalOnBaseTool` (gate an own Tool with
70
+ `requireApproval`), and `CompileOptions.nodeConfig`. From
71
+ `melchizedek-agents/models/registry`: `registerAvailableProviders`,
72
+ `GatewayLlm`, `TracedGemini`. These subpaths resolved to deleted files and
73
+ are gone: `melchizedek-agents/models/adkShim`, `models/adkGeminiAdapter`,
74
+ `models/tracedGemini`, `models/claudeLlm`, `models/gptLlm`,
75
+ `models/grokLlm`, `models/kimiLlm`, `models/ollamaLlm`, `models/gatewayLlm`,
76
+ `models/openAiCompatibleLlm`, `models/fallback`, `tools/adkTool`,
77
+ `tools/webSearchTool`, `tools/urlContextTool`, `tools/xSearchTool`,
78
+ `tools/collectionsSearchTool` (the server-side tools are the markers in
79
+ `melchizedek-agents/tools/nativeTools`). `lib/workflow.ts` keeps the
80
+ `workflow:` block's contract; `compileWorkflow`, `assembleWorkflow`,
81
+ `toRetryConfig` and `nodeSettings` are gone. The exports map's paths are
82
+ unchanged.
83
+ - **Breaking: tools are the engine's own, and ADK tools are refused.** The
84
+ registry holds the engine's `Tool`, `InstructionTool`, `NativeToolMarker`
85
+ and `Toolset` (`lib/tools/tool.ts`), with no ADK `FunctionTool` around
86
+ them. `webExtractTool`, `generateImageTool`, `inspectImageTool`,
87
+ `xApiSearchTool`, `remoteAgentTool()`, `createMcpTools()` and
88
+ `buildOpenApiTools()` return own `Tool`s (`declaration()`,
89
+ `execute(args, ctx)`). `registerTool` refuses an ADK tool (anything with
90
+ `runAsync`) with an error that names 1.0.0 and `defineTool`, and refuses
91
+ an object that is not a tool. `toFunctionTool`'s replacement: define the
92
+ tool with `defineTool` (a zod schema and `execute(args, ctx)`) and
93
+ register it; a `defineTool` contract is the engine's `Tool`.
94
+ `runWikiAgent` (`melchizedek-agents/wiki/agentRun`) takes `tools: Tool[]`.
95
+ - **Breaking: a model resolver returns an id or a `ModelAdapter`.**
96
+ `CompileOptions.resolveModel` returns `string | ModelAdapter | undefined`
97
+ (`melchizedek-agents/model`), and the registry's `resolveModel` returns
98
+ the engine's `ModelAdapter`, with the same BYOK scoping. A resolver that
99
+ returns an ADK model class is refused with `UnsupportedOnRuntimeError`
100
+ before any model call. `registerAvailableProviders` is replaced by
101
+ `logProviderStatuses(log?)`, which returns and logs the provider statuses
102
+ and registers nothing: a model id resolves when an agent first calls it.
103
+ `modelExtractor`'s `resolve` seam returns a `ModelAdapter`.
104
+ - **Breaking: a resolver's plain `{ model, apiKey }` object is refused.**
105
+ Anything `resolveModel` returns that is neither a model id string, a
106
+ `ModelAdapter` (an object with `generate()` and a string `model`) nor
107
+ `undefined` is refused with `UnsupportedOnRuntimeError` when the agent is
108
+ compiled, before any model call; the message names 1.0.0 and the type of
109
+ what came back, never its contents. Before, the engine passed such an
110
+ object over and resolved the agent's YAML id on the environment's key, so a
111
+ BYOK caller ran on the operator's key. A BYOK resolver returns an adapter,
112
+ for example `new ClaudeAdapter({ model, apiKey })` from
113
+ `melchizedek-agents/model`.
114
+ - **Breaking: an ADK tool is refused everywhere.** An object with
115
+ `runAsync` is refused with an error naming 1.0.0 and `defineTool` wherever
116
+ it arrives: `registerTool`, a compiled agent's tool list, a workflow tool
117
+ node, a Toolset's `getTools()` and `extraTools` on a model request. Before,
118
+ the last two skipped it silently.
119
+ - **Breaking: `createA2AApp` stops on `GEMINI_ADAPTER=adk`** at startup with
120
+ the 1.0.0 error, as it does on `MELCHIZEDEK_RUNTIME=adk`, instead of
121
+ failing at the first Gemini call.
122
+ - **Breaking: dead model and tool exports removed.**
123
+ `melchizedek-agents/models/errorResponse` drops `providerErrorResponse` and
124
+ `isRetryableErrorResponse` (use `withRetryVerdict(response,
125
+ errorDecision(err))` and read `customMetadata['error.retryable']`);
126
+ `models/schemaNormalize` drops `toolDeclarationFor` (use
127
+ `contractToolDeclaration`); `models/claudeAdapter` drops
128
+ `ClaudeModelRequest` and its `claudeReasoning`; `models/chatCompletionsAdapter`
129
+ drops `ChatCompletionsRequest` and `OlderSpelling` (adapters take
130
+ `ModelRequest`). `melchizedek-agents/tools/toolContract` drops
131
+ `toolCallContextFrom`, and `melchizedek-agents/tools/tool` drops
132
+ `OWN_TOOL`; `toolOf`, `instructionToolOf` and `toolsetOf` no longer look
133
+ inside a wrapper. `nativeToolOf` recognises only the engine's own marker.
134
+ Kimi K3 no longer sends `reasoning_effort: max`, which had no contract
135
+ level and was reachable only through the removed older spelling.
136
+ - **Breaking: the doctor's runtime report has no `adk` field.**
137
+ `runtimeReport()` returns the runtime and its source, or the problem.
138
+
139
+ ### Migration
140
+
141
+ 1. `npm uninstall @google/adk`, and unset `MELCHIZEDEK_RUNTIME=adk` and
142
+ `GEMINI_ADAPTER=adk` wherever they are set.
143
+ 2. Replace `new InMemorySessionService()` and
144
+ `asAdkSessionService(new InProcessSessionService())` with
145
+ `new InProcessSessionService()` (or your Postgres or Supabase store), and
146
+ call `create` / `get` / `append(session, event)` where you called
147
+ `createSession` / `getSession` / `appendEvent`.
148
+ 3. Replace a custom `BaseMemoryService` with a `MemoryService`
149
+ (`ingest`, `search`).
150
+ 4. Replace ADK `FunctionTool`s and `toFunctionTool(...)` with `defineTool`
151
+ contracts, and register them with `registerTool`.
152
+ 5. Replace `registerAvailableProviders()` with `logProviderStatuses()`.
153
+ 6. A custom `resolveModel` returns a model id or a `ModelAdapter`
154
+ (`resolveAdapter` from `melchizedek-agents/model`), not an ADK `BaseLlm`.
155
+ A resolver that returned a plain `{ model, apiKey }` object returns an
156
+ adapter built with that key instead (`new ClaudeAdapter({ model, apiKey })`
157
+ or the provider's own adapter class); the plain object is refused.
158
+ 7. Run turns through `runSyndicateTurn` where you compiled ADK agents with
159
+ `compileGraph`, `compileSubagent` or `compileWorkflow`.
160
+
161
+ ### Fixed
162
+
163
+ - **Server-side tool calls are recorded again.** A GPT or Grok answer that
164
+ searched (web search, X search, collections) records its server-side tool
165
+ calls as `ToolCall` events and counts them in the ledger row's
166
+ `tool_calls`. Since 0.20.0 made the engine's loop the default, those
167
+ calls were lost: the record lived in the deleted ADK shim. The native step
168
+ carries them onto the final (`lib/runtime/native/step.ts`);
169
+ `tests/nativeLedgerCounts.test.ts` pins it.
170
+
171
+ ### Unchanged by design
172
+
173
+ - The stored Event JSON (`adk_sessions.events`, `adk_session_events`), the
174
+ interrupt names (`adk_request_confirmation`, `ask_user`,
175
+ `adk_request_input`, `adk_request_credential`) and their argument shapes,
176
+ the A2A surface, and the table names. The ADK-written session fixtures
177
+ (`tests/fixtures/sessions`) resume.
178
+
179
+ ### Added and changed
180
+
181
+ - **One output-token meaning on the ledger (ADR 0107).** For every
182
+ provider, `output_tokens` (and `llm.tokens.output`) excludes the thinking
183
+ and `thinking_tokens` carries it, so output plus thinking is the
184
+ provider's own output count. This is what the engine's loop has written
185
+ since 0.20.0; it supersedes the ledger clauses of ADR 0056 and ADR 0057,
186
+ which kept the provider's meaning on the ADK path. Rows written before
187
+ 0.20.0 for GPT, Grok, Kimi and the gateways used that older meaning: a
188
+ query comparing output across that boundary subtracts `thinking_tokens`
189
+ from those rows.
190
+
191
+ - **New exports.** From the barrel and `melchizedek-agents/runtime`:
192
+ `RuntimeRemovedError`, and the types `SessionService`, `Session`,
193
+ `SessionKey`, `MemoryService`, `MemoryEntry`, `MemoryIngestOptions`,
194
+ `MemorySearchRequest`, `MemorySearchResult` and `TurnEvent`. From the
195
+ barrel: `UnsupportedOnRuntimeError`, `logProviderStatuses`, and the types
196
+ `Tool` and `ToolContext`.
197
+ - **An import-graph test holds the line** (`tests/importGraph.test.ts`):
198
+ nothing under `lib/` or `scripts/` names Google ADK, and `@google/genai`
199
+ is imported only by the Gemini adapter and its genai mapping, the image
200
+ tools and memory embeddings.
201
+
202
+ - **A workflow syndicate runs its whole graph as a dispatch route or a
203
+ workflow node (ADR 0106).** A `yaml_reference` to a workflow syndicate
204
+ used to run its orchestrator alone there; it now runs the whole graph on
205
+ the child session filed under the entry's name, as a delegated subagent
206
+ already did (ADR 0098). As a plan-dispatch route its last output is the
207
+ turn's answer, and the conversation keeps the message and that answer. As
208
+ a workflow node its last output is the node's output. A `map` over
209
+ one and an `ask_user` node inside one are refused by name. Each nested
210
+ walk has its own node-run ceiling (ADR 0105). **Breaking for a direct
211
+ caller:** `compileSubagentSpec` refuses a workflow reference by name
212
+ instead of compiling its orchestrator; compile the entry
213
+ with `compileEntrySpec`. `melchizedek-agents/compile` adds
214
+ `compileEntrySpec`, `EntrySpec`, `workflowAgentSpecs`,
215
+ `workflowEntryNames` and `WorkflowSpec.workflows`; the exports map and the
216
+ barrel are unchanged.
217
+
218
+ - **Skill scripts on a workflow node (ADR 0106).** `skills.scripts: local`
219
+ is allowed on a workflow node's agent: each `run_skill_script` call pauses
220
+ the node and the walk for a person's approval, as `require_approval` does,
221
+ and runs once after it, with the minimal script environment of ADR 0086.
222
+ Still refused on an agent a `map` node runs.
223
+
224
+ - **Docs: `config/agents/syndicateSchema.yaml` describes the engine as it
225
+ runs.** Its comments say that the runtime runs every key, explain the ADK
226
+ spellings and "Maps to:" lines as spellings, prefer
227
+ `reasoning:` over `generateContentConfig.thinkingConfig`, and no longer
228
+ call Gemini "ADK-native", plan-dispatch "A2A-only", or `require_approval`
229
+ unsupported inside a workflow. Comments only.
230
+
231
+ - **A workflow walk has a node-run ceiling (ADR 0105).** `max_steps`
232
+ counts model calls, so a routed cycle through nodes that make none (a tool
233
+ node and its route step looping on each other) ran until the turn's
234
+ deadline. A walk now starts at most
235
+ `max(20 × max_steps, 100)` node runs (1,000 at the default of 50); the run
236
+ that would pass it fails its node with `NodeRunLimitError`, stored as the
237
+ workflow's node-error event, and the turn fails with the new error code
238
+ `NODE_RUN_LIMIT` and the progress line `Stopped: the workflow reached its
239
+ limit of <n> node runs`. A legitimate loop under the ceiling is unchanged;
240
+ raise `max_steps` to raise it.
241
+
242
+ - **Docs: the shipped documentation describes the engine as 1.0.0 runs it
243
+ (WS5-3, WS5-2b).** `README.md`, `QUICKSTART.md`, `DOCUMENTATION.md`,
244
+ `AGENT_SETUP.md` and the agent skills under `skills/` describe the
245
+ engine's own loop, model contract, tools, sessions and workflow
246
+ scheduler, with no ADK to install, and no longer call Gemini
247
+ "ADK-native".
248
+
249
+ ## 0.20.0 — 2026-10-08
250
+
251
+ Release 0.20.0: the native runtime is the default, and `@google/adk` is an
252
+ optional peer (ADR 0102).
253
+
254
+ ### Breaking — read before upgrading
255
+
256
+ - **Breaking: the native runtime is the default (WS5-1, ADR 0102).** A
257
+ turn with no `runtime` option and no `MELCHIZEDEK_RUNTIME` now runs on the
258
+ engine's own loop and scheduler (`DEFAULT_RUNTIME` is `native`), on every
259
+ surface: `runSyndicateTurn`, the A2A server, the bins, the wiki agents.
260
+ It stores the events the ADK runtime stores, and every session ADK wrote
261
+ resumes under it (`tests/sessionFixtures.test.ts`, ADR 0045's stop rule),
262
+ so a deployment that upgrades keeps its conversations. **To stay on ADK**
263
+ for this release: install `@google/adk@~2.2.0` beside the package and set
264
+ `MELCHIZEDEK_RUNTIME=adk` (or pass `runtime: 'adk'`); a conversation can
265
+ move between the runtimes either way. What differs on native: approval
266
+ gates on workflow nodes run on native only (ADR 0098); `context:`
267
+ compaction, `mode: task` and workflows run on the engine's ports of ADK's
268
+ compactor, task mode and scheduler (ADR 0078, ADR 0081, ADR 0087, ADR
269
+ 0095); a Gemini agent is not shown the reflection tool and stores no
270
+ `turnComplete` (ADR 0097, ADR 0100); self-correction's reflection call on
271
+ Gemini 3 is signed (ADR 0103); a caller's `transformAgent` is ADK-only,
272
+ and an `ask_user` tool listed on a workflow agent node (rather than an
273
+ `ask_user` node) is refused, each with `UnsupportedOnRuntimeError` before
274
+ any model call (ADR 0073, ADR 0092). **1.0.0
275
+ removes the adk runtime** (ADR 0045).
276
+ - **Breaking: `@google/adk` is an optional peer dependency.** npm no longer
277
+ installs it with the package; nothing on the native runtime loads it, and
278
+ `lib/adkPeer.ts` is the one module that tries to. Without it, everything
279
+ only ADK runs fails with the new `AdkNotInstalledError`, which names the
280
+ package and the install command: `MELCHIZEDEK_RUNTIME=adk`,
281
+ `compileGraph` / `compileSubagent` / `compileWorkflow`, `retryPlugins`,
282
+ `GEMINI_ADAPTER=adk`, a wiki agent on adk, and the ADK face of a tool, a
283
+ model shim or a session store (their `runAsync`, `generateContentAsync`,
284
+ `appendEvent`). The engine's classes that extend ADK's (the
285
+ `FunctionTool`s in the tool registry, the model shims, the session
286
+ stores) still construct and still carry their own Tool, adapter or store;
287
+ with ADK installed they are ADK's own classes, as before. An install of
288
+ ADK that fails to load for another reason is still an error. A
289
+ TypeScript consumer without ADK sees ADK's types in the declarations as
290
+ unresolved (use `skipLibCheck`). The package now uses a top-level
291
+ `await` to load the peer, so it cannot be `require()`d from CommonJS.
292
+ - **Breaking: a Gemini id gets the engine's `GeminiAdapter` by default
293
+ (ADR 0100).** `resolveAdapter` from `melchizedek-agents/models/registry`
294
+ and `geminiAdapterChoice()` default to `engine`; `GEMINI_ADAPTER=adk`
295
+ (or `{ gemini: 'adk' }`) keeps `AdkGeminiAdapter` for this release, with
296
+ `@google/adk` installed. The adk runtime keeps `TracedGemini`.
297
+ - **Breaking: `registerTool` refuses the framework's reserved names.**
298
+ `adk_request_confirmation`, `adk_request_credential`,
299
+ `adk_request_input`, `adk_handle_model_error`, `transfer_to_agent`,
300
+ `set_model_response`, `finish_task`, and `ask_user` unless it is the
301
+ framework's own tool, are refused as the registry name or the tool's own
302
+ name, with `{ override: true }` too: a tool under one of them would be
303
+ read as the framework's interrupt, delegation or answer.
304
+ `RESERVED_TOOL_NAMES` is exported from `melchizedek-agents/tools`.
305
+ - **Breaking: a workflow `map:` node refuses `retry` and `timeout`
306
+ (ADR 0103).** Neither runtime ever applied them: each item of a map runs
307
+ under the mapped agent's own node entry, as ADK runs it. A YAML that set
308
+ them on the map entry loaded and silently ignored them; it is now refused
309
+ at load with `workflow.nodes.<Map>.retry — retry on a map node is not
310
+ applied: each item runs under its agent's own retry; set it on
311
+ nodes.<Agent>` (and the same for `timeout`). Move the keys to the mapped
312
+ agent's entry. No shipped example or template sets them.
313
+
314
+ ### Added and changed
315
+
316
+ - **The doctor prints the runtime (ADR 0102).** `melchizedek-doctor` opens
317
+ with a `runtime` line: the runtime in use, where it came from
318
+ (`MELCHIZEDEK_RUNTIME` or the default) and whether `@google/adk` is
319
+ installed, with its version. `--check` also fails when
320
+ `MELCHIZEDEK_RUNTIME=adk` is set without ADK, or holds a value no turn
321
+ accepts. `runDoctor()` returns it as `runtime`, and `runtimeReport` is
322
+ exported from `lib/doctor.ts`.
323
+ - **New exports.** From the barrel and `melchizedek-agents/runtime`:
324
+ `describeRuntime` (the runtime and its source), `RuntimeSource`,
325
+ `AdkNotInstalledError`, `adkInstalled`, `InProcessSessionService` (a
326
+ session store that needs no ADK) and `asAdkSessionService` /
327
+ `asSessionService`; the barrel also exports `DEFAULT_RUNTIME` and
328
+ `RuntimeName`. A turn without ADK takes
329
+ `sessionService: asAdkSessionService(new InProcessSessionService())`.
330
+ The exports map does not change.
331
+ - **CI consumes the packed tarball twice**: without `@google/adk` a shipped
332
+ example's turn runs on native, and with it the same turn runs on adk.
333
+
334
+ - **The native loop's security gate (WS5-5, ADR 0101).** A model's answer is
335
+ now held to the model contract before either runtime stores it:
336
+ `modelResponseToLlmResponse` in `melchizedek-agents/models/genaiMapping`
337
+ drops a part the contract does not allow (an unknown kind, `null`, a text
338
+ part whose text is not a string, a tool result) and coerces a tool call's
339
+ name, id and arguments (`{}` for none, `{ raw }` otherwise); the new
340
+ `contractModelResponse` export is that check. A call's arguments or a
341
+ tool's result nested deeper than 64 levels is replaced by a short note
342
+ (`TOO_DEEP_ARGUMENTS`; on the native runtime `TOO_DEEP_RESULT`), where it
343
+ used to fail that turn and every later one on the session. A
344
+ `yaml_reference` chain that reaches itself, or goes past 16 levels, now
345
+ fails the compile with an Error naming the chain, on both runtimes; it
346
+ used to overflow the stack and stop the process. On the native runtime a
347
+ call id `__proto__` opens its approval as any id does, a credential
348
+ request in an event the user wrote is not pending, a resumed OAuth call
349
+ is the one the agent made, and a replayed grant runs nothing.
350
+ `wiki/operations/native-loop-security.md` is the threat model;
351
+ `tests/nativeFuzz.test.ts` fuzzes the loop.
352
+ - **On the native runtime, self-correction's reflection call is signed on
353
+ Gemini (ADR 0103).** When a Gemini 3 model calls the reserved
354
+ `adk_handle_model_error` tool, or answers `MALFORMED_FUNCTION_CALL`, the
355
+ reflection call stored in its place now carries the replaced call's
356
+ `thoughtSignature`, or Gemini's documented placeholder
357
+ (`skip_thought_signature_validator`) when there was none, so the next
358
+ request no longer fails with Gemini's "missing a thought_signature" 400.
359
+ On Gemini 2.x only a carried signature is added. The ADK runtime is
360
+ unchanged: ADK's plugin still stores the call unsigned. The stored event
361
+ differs from ADK's by that one field. `PLACEHOLDER_THOUGHT_SIGNATURE` is
362
+ still exported from `melchizedek-agents/models/geminiAdapter`.
363
+
364
+ - **A workflow node's `retry` takes `exceptions` and `jitter` (ADR 0103).**
365
+ `retry: { exceptions: [NodeTimeoutError] }` retries only a failure whose
366
+ error class or `name` is listed; `jitter` sets the backoff's randomness
367
+ (0 = none, default 1). Both runtimes honour them: the ADK runtime hands
368
+ them to ADK's `retryConfig`, the native scheduler applies them as ADK's
369
+ `retry_utils` does. `syndicate.schema.json` is regenerated; the `exports`
370
+ map is unchanged.
371
+
372
+ - **The capability matrix's Gemini column is asserted on the engine's own
373
+ Gemini adapter (WS3-6, ADR 0100).** Every Gemini cell is now evidence
374
+ `test`, checked against the request `GeminiAdapter` sends through the
375
+ real `@google/genai` client, as every other column is; `npm run doctor --
376
+ --matrix` says so. On the native runtime a Gemini agent's stored events no
377
+ longer carry `turnComplete`, as the ADK runtime's never have; nothing reads
378
+ the field. A Gemini answer that ran code through the engine's adapter
379
+ (`GEMINI_ADAPTER=engine`, or `GeminiAdapter` behind the shim) now stores
380
+ the `executableCode` and `codeExecutionResult` parts as ADK's Gemini stores
381
+ them, where the session held none before; `partsToGenai` in
382
+ `melchizedek-agents/models/genaiMapping` is the mapping that writes them
383
+ out. `scripts/gemini_engine_check.ts` is the live check gate G3 runs:
384
+ grounding, code execution, a function tool beside server-side tools, and a
385
+ two-turn session, with `GeminiAdapter` on both runtimes. `GeminiAdapter`
386
+ becomes the default in 0.20.0 (see Breaking above).
387
+
388
+ - **A workflow syndicate can be a subagent, and a workflow node can carry
389
+ an approval gate (WS4-7, ADR 0098).** A DELEGATE syndicate's
390
+ `yaml_reference` to a `workflow:` syndicate now runs the whole graph as
391
+ the subagent tool, under the entry's name and description, on both
392
+ runtimes: the graph's last output is the tool's answer. Before, only the
393
+ nested syndicate's orchestrator ran. A nested workflow with an
394
+ `ask_user` node is now refused by name at compile time (its pause could
395
+ not reach the caller); as a dispatch route or a workflow node, a
396
+ workflow syndicate is still its orchestrator alone. `require_approval`
397
+ on a workflow node's agent now validates (except on an agent a `map`
398
+ node runs): on the native runtime the gated call pauses the node and the
399
+ turn ends `input-required` with `result.approval`, and the person's
400
+ decision runs or refuses the pinned call once and walks on; another
401
+ message repeats the request. On the ADK runtime a gated workflow throws
402
+ `UnsupportedOnRuntimeError` before any model call, because ADK's resume
403
+ restarts the node and never runs the call. `melchizedek-agents/compile`
404
+ adds the `workflow` kind to `SpecTool`, and exports
405
+ `compileWorkflowSpec` and the `WorkflowSpec` type.
406
+ - **A Gemini agent on the native runtime is no longer shown the reflection
407
+ tool (WS4-6b, ADR 0097).** With `retries.model_errors` on (the default),
408
+ native declared `adk_handle_model_error` to every model. ADK's own Gemini
409
+ never sends it, and a Gemini 3 model that called it on native failed its
410
+ next step with Gemini's missing `thought_signature` 400 (a workflow
411
+ node then failed the turn `NODE_FAILED`). Native now sends a Gemini model
412
+ the same tools as ADK; a model on any other provider, or a Gemini adapter
413
+ a resolver returns behind `adkShim`, is still told of the tool, as on ADK.
414
+ ADK turns are unchanged.
415
+
416
+ ## 0.19.0 — 2026-10-08
417
+
418
+ The native runtime ships in this release as an opt-in: set
419
+ `MELCHIZEDEK_RUNTIME=native` or pass `runtime: 'native'` to `runSyndicateTurn`.
420
+ `adk` stays the default (ADR 0099). The `@google/adk` peer dependency is
421
+ unchanged.
422
+
423
+ ### Breaking — read before upgrading
424
+
425
+ - **Breaking: a skill script no longer inherits the server's environment
426
+ (ADR 0086).** An approved `run_skill_script` starts from PATH,
427
+ HOME/USERPROFILE, TMPDIR/TEMP/TMP, LANG, LC_*, TZ, the user's name and
428
+ the Windows essentials, and nothing else: provider keys, `DATABASE_URL`
429
+ and the server's bearer secrets no longer reach it. A script that relied
430
+ on an inherited variable must now name it in the agent's YAML, under the
431
+ new `skills.env` (names only), or under `skills.secret_env` when the
432
+ name looks like a secret (KEY, TOKEN, SECRET, PASSWORD, AUTH, DATABASE,
433
+ …), which `skills.env` refuses. Both need `scripts: local`. A script's
434
+ stdout and stderr are each cut at 20,000 characters, ending with
435
+ `[stdout truncated: N more characters not shown (the limit is 20000)]`.
436
+ The same on both runtimes. `LocalScriptExecutor` takes `envNames`,
437
+ `sourceEnv` and `maxOutputChars`; `lib/tools/skills/env.ts` is new. The
438
+ `exports` map is unchanged.
439
+ - **Breaking for subclasses of `OpenAiCompatibleLlm`: the chat-completions
440
+ adapters move onto the model contract (ADR 0057).** New modules under
441
+ `melchizedek-agents/models/`:
442
+ - `chatCompletionsAdapter`: `ChatCompletionsAdapter`, the base that turns a
443
+ `ModelRequest` into a chat-completions body and a completion (JSON or
444
+ SSE) into contract responses; `ChatCompletionsRequest` and
445
+ `OlderSpelling`; `chatUsage` and `sumUsage` (usage in the contract's
446
+ meaning); `splitThinkBlocks`, `ThinkStreamSplitter`,
447
+ `REASONING_CONTENT_KIND` and `ENGINE_CALL_ID_PREFIX`.
448
+ - `ollamaAdapter` (`OllamaAdapter`), `kimiAdapter` (`KimiAdapter`, and
449
+ `isKimiK3`, `wantsReasoningReplay`, `MOONSHOT_BASE_URL`, which
450
+ `models/kimiLlm` still exports) and `gatewayAdapter` (`GatewayAdapter`).
451
+
452
+ `OpenAiCompatibleLlm` is now an `AdkShim` whose constructor takes the
453
+ adapter, and its protected hooks (`endpointUrl`, `headers`,
454
+ `wireModelName`, `extraBodyFields`, `httpError`, `noAnswerError` and the
455
+ rest) move to `ChatCompletionsAdapter`, on contract types. A provider of
456
+ your own subclasses `ChatCompletionsAdapter` and runs under ADK as
457
+ `adkShim(adapter)` or as an `OpenAiCompatibleLlm` subclass. `OllamaLlm`,
458
+ `KimiLlm` and `GatewayLlm` keep their constructors, ids, error codes and
459
+ wording, and the shape of what they yield: usage counts the reasoning in
460
+ `candidatesTokenCount` as before, so the ledger's counts are unchanged.
461
+ `models/openAiCompatibleLlm` adds `olderSpellingOf` and
462
+ `chatUsageMetadata`. `AdkShim` gains a protected `toModelRequest` seam
463
+ beside `toLlmResponse` (ADR 0056); the chat shims override both.
464
+
465
+ What reaches the provider changes only where the contract maps a field
466
+ the old classes ignored or spelled as written:
467
+ - `stopSequences` are sent as `stop`.
468
+ - A function-calling mode is honoured: `NONE` sends no tools; the gateway
469
+ sends `ANY` as `tool_choice: required` or the named tool, and Kimi and
470
+ Ollama weaken it to auto (`llm.tool_choice.weakened` on the span).
471
+ - The older spelling's reasoning follows ADR 0047's mapping, as
472
+ `reasoning:` already did: `thinkingConfig.thinkingBudget` alone now
473
+ travels as its level (`0` is `none`), `reasoningEffort: medium` on
474
+ `kimi-k3` is sent as `high`, and `minimal` as each model's `none`.
475
+ A word that is no level (`max`, `xhigh`) is still sent as written.
476
+ - A tool call stored without an id is sent with one, matched to its
477
+ result, where the result's `tool_call_id` was empty.
478
+ - The no-answer hints name `reasoning: none` (the older spelling too).
479
+ - Every error a chat shim yields carries its retry verdict
480
+ (`customMetadata['error.retryable']`, `false` where there was none) and
481
+ `turnComplete`. A call cut off by a cancelled turn is never retryable,
482
+ even when its last status was a 503, so no fallback answers a
483
+ cancellation.
484
+ - **Breaking for subclasses of `GptLlm`: the vendor hooks move to
485
+ `GptAdapter` (ADR 0056).** `providerId()`, `baseURL()`, `apiKeyFromEnv()`,
486
+ `missingKeyMessage()`, `clientOptions()`, `reasoningParam()`,
487
+ `replaysReasoning()` and `endpoint()` are overridden on a `GptAdapter`
488
+ subclass now, as `GrokAdapter` does, and a `GptLlm` subclass returns it
489
+ from `protected static createAdapter(options)`. Code that only constructs
490
+ or registers `GptLlm` and `GrokLlm`, or imports their exported functions,
491
+ is unaffected.
492
+ - **Breaking for one import path: `toFunctionTool` moves to
493
+ `melchizedek-agents/tools/adkTool` (ADR 0051).**
494
+ `melchizedek-agents/tools/toolContract` no longer exports it, so that
495
+ module loads nothing from `@google/adk`. Import it from
496
+ `melchizedek-agents`, which still exports it, or from the new subpath.
497
+ The `exports` map is unchanged.
498
+
499
+ ### Changes
500
+
9
501
  - **Workflow syndicates run on the native runtime (WS4-6, ADR 0095).**
10
502
  A `workflow:` syndicate no longer throws `UnsupportedOnRuntimeError` on
11
503
  `runtime: 'native'` (or `MELCHIZEDEK_RUNTIME=native`): the engine's own
@@ -52,7 +544,6 @@ the starter pack and the templates), not the repo's full history.
52
544
  `pendingQuestion` ignores an `ask_user` call in an event the user
53
545
  authored. A message that forges one no longer turns the next message
54
546
  into its answer, on either runtime.
55
-
56
547
  - **The native runtime sends a request, and reads a thrown failure, as
57
548
  ADK does (WS2-12, ADR 0084).** On `runtime: 'native'` (or
58
549
  `MELCHIZEDEK_RUNTIME=native`) a request goes out under the resolved
@@ -65,20 +556,6 @@ the starter pack and the templates), not the repo's full history.
65
556
  turn-level test suites run on both runtimes. `npm run parity` now runs
66
557
  its turns on the runtime `MELCHIZEDEK_RUNTIME` names. The `exports` map
67
558
  is unchanged.
68
- - **Breaking: a skill script no longer inherits the server's environment
69
- (ADR 0086).** An approved `run_skill_script` starts from PATH,
70
- HOME/USERPROFILE, TMPDIR/TEMP/TMP, LANG, LC_*, TZ, the user's name and
71
- the Windows essentials, and nothing else: provider keys, `DATABASE_URL`
72
- and the server's bearer secrets no longer reach it. A script that relied
73
- on an inherited variable must now name it in the agent's YAML, under the
74
- new `skills.env` (names only), or under `skills.secret_env` when the
75
- name looks like a secret (KEY, TOKEN, SECRET, PASSWORD, AUTH, DATABASE,
76
- …), which `skills.env` refuses. Both need `scripts: local`. A script's
77
- stdout and stderr are each cut at 20,000 characters, ending with
78
- `[stdout truncated: N more characters not shown (the limit is 20000)]`.
79
- The same on both runtimes. `LocalScriptExecutor` takes `envNames`,
80
- `sourceEnv` and `maxOutputChars`; `lib/tools/skills/env.ts` is new. The
81
- `exports` map is unchanged.
82
559
  - **The skills harness no longer builds on ADK (ADR 0083).** An agent's
83
560
  `skills:` block loads, reads and runs skills through the engine's own
84
561
  modules (`lib/tools/skills/`), the same on `runtime: 'adk'` and
@@ -210,7 +687,6 @@ the starter pack and the templates), not the repo's full history.
210
687
  - The audit trail gains `credential.put`, `credential.refresh`,
211
688
  `credential.revoke` and `credential.erase` (`AuditEventName`), with the
212
689
  provider and app and never a token.
213
-
214
690
  - **The ledger reads the native loop's spans (ADR 0076).** The native loop
215
691
  (not yet selectable, WS2-10) opens `agent.invoke <name>`, `model.call` and
216
692
  `tool.execute <name>` spans in scope `melchizedek.runtime`, and a native
@@ -344,7 +820,6 @@ the starter pack and the templates), not the repo's full history.
344
820
  server-side name is no longer treated as that tool. An MCP tool's nested
345
821
  schemas no longer carry `default`, `propertyNames`, `$schema` or a boolean
346
822
  `additionalProperties`. `propertyNames` was refused by the Gemini API.
347
-
348
823
  - **The engine parses OpenAPI specs itself (ADR 0063).** A new module,
349
824
  `melchizedek-agents/tools/openapi/parse` (through the existing
350
825
  `./tools/*` pattern), exports `parseOpenApiSpec` and
@@ -386,59 +861,6 @@ the starter pack and the templates), not the repo's full history.
386
861
  quadratically on a long run of slashes (CodeQL js/polynomial-redos).
387
862
  They now share `trimTrailingSlashes` (new module
388
863
  `melchizedek-agents/models/urls`). Results are unchanged.
389
- - **Breaking for subclasses of `OpenAiCompatibleLlm`: the chat-completions
390
- adapters move onto the model contract (ADR 0057).** New modules under
391
- `melchizedek-agents/models/`:
392
- - `chatCompletionsAdapter`: `ChatCompletionsAdapter`, the base that turns a
393
- `ModelRequest` into a chat-completions body and a completion (JSON or
394
- SSE) into contract responses; `ChatCompletionsRequest` and
395
- `OlderSpelling`; `chatUsage` and `sumUsage` (usage in the contract's
396
- meaning); `splitThinkBlocks`, `ThinkStreamSplitter`,
397
- `REASONING_CONTENT_KIND` and `ENGINE_CALL_ID_PREFIX`.
398
- - `ollamaAdapter` (`OllamaAdapter`), `kimiAdapter` (`KimiAdapter`, and
399
- `isKimiK3`, `wantsReasoningReplay`, `MOONSHOT_BASE_URL`, which
400
- `models/kimiLlm` still exports) and `gatewayAdapter` (`GatewayAdapter`).
401
-
402
- `OpenAiCompatibleLlm` is now an `AdkShim` whose constructor takes the
403
- adapter, and its protected hooks (`endpointUrl`, `headers`,
404
- `wireModelName`, `extraBodyFields`, `httpError`, `noAnswerError` and the
405
- rest) move to `ChatCompletionsAdapter`, on contract types. A provider of
406
- your own subclasses `ChatCompletionsAdapter` and runs under ADK as
407
- `adkShim(adapter)` or as an `OpenAiCompatibleLlm` subclass. `OllamaLlm`,
408
- `KimiLlm` and `GatewayLlm` keep their constructors, ids, error codes and
409
- wording, and the shape of what they yield: usage counts the reasoning in
410
- `candidatesTokenCount` as before, so the ledger's counts are unchanged.
411
- `models/openAiCompatibleLlm` adds `olderSpellingOf` and
412
- `chatUsageMetadata`. `AdkShim` gains a protected `toModelRequest` seam
413
- beside `toLlmResponse` (ADR 0056); the chat shims override both.
414
-
415
- What reaches the provider changes only where the contract maps a field
416
- the old classes ignored or spelled as written:
417
- - `stopSequences` are sent as `stop`.
418
- - A function-calling mode is honoured: `NONE` sends no tools; the gateway
419
- sends `ANY` as `tool_choice: required` or the named tool, and Kimi and
420
- Ollama weaken it to auto (`llm.tool_choice.weakened` on the span).
421
- - The older spelling's reasoning follows ADR 0047's mapping, as
422
- `reasoning:` already did: `thinkingConfig.thinkingBudget` alone now
423
- travels as its level (`0` is `none`), `reasoningEffort: medium` on
424
- `kimi-k3` is sent as `high`, and `minimal` as each model's `none`.
425
- A word that is no level (`max`, `xhigh`) is still sent as written.
426
- - A tool call stored without an id is sent with one, matched to its
427
- result, where the result's `tool_call_id` was empty.
428
- - The no-answer hints name `reasoning: none` (the older spelling too).
429
- - Every error a chat shim yields carries its retry verdict
430
- (`customMetadata['error.retryable']`, `false` where there was none) and
431
- `turnComplete`. A call cut off by a cancelled turn is never retryable,
432
- even when its last status was a 503, so no fallback answers a
433
- cancellation.
434
- - **Breaking for subclasses of `GptLlm`: the vendor hooks move to
435
- `GptAdapter` (ADR 0056).** `providerId()`, `baseURL()`, `apiKeyFromEnv()`,
436
- `missingKeyMessage()`, `clientOptions()`, `reasoningParam()`,
437
- `replaysReasoning()` and `endpoint()` are overridden on a `GptAdapter`
438
- subclass now, as `GrokAdapter` does, and a `GptLlm` subclass returns it
439
- from `protected static createAdapter(options)`. Code that only constructs
440
- or registers `GptLlm` and `GrokLlm`, or imports their exported functions,
441
- is unaffected.
442
864
  - **Fix: a message could stall the server in the memory search.**
443
865
  `stripHarnessBlocks` (run on every memory query and extraction
444
866
  transcript) matched an unclosed `[System Context:` marker with a pattern
@@ -490,12 +912,6 @@ the starter pack and the templates), not the repo's full history.
490
912
  `melchizedek-agents/models/claudeModels` adds `ClaudeReasoning`,
491
913
  `claudeReasoningOf`, `claudeReasoningFromConfig` and
492
914
  `adaptiveThinkingFor`. The `exports` map is unchanged.
493
- - **Breaking for one import path: `toFunctionTool` moves to
494
- `melchizedek-agents/tools/adkTool` (ADR 0051).**
495
- `melchizedek-agents/tools/toolContract` no longer exports it, so that
496
- module loads nothing from `@google/adk`. Import it from
497
- `melchizedek-agents`, which still exports it, or from the new subpath.
498
- The `exports` map is unchanged.
499
915
  - **The session services serve both runtimes from the same rows, and
500
916
  change behaviour in five places (ADR 0058).** `SupabaseSessionService`,
501
917
  `PostgresSessionService` and `ProjectedSessionService` also implement