open-multi-agent-kit 0.98.3 → 0.98.4

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 (262) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +11 -2
  3. package/dist/cli/args.d.ts +1 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +14 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/help.d.ts.map +1 -1
  8. package/dist/cli/help.js +3 -0
  9. package/dist/cli/help.js.map +1 -1
  10. package/dist/cli/mcp-attach.d.ts +3 -3
  11. package/dist/cli/mcp-attach.d.ts.map +1 -1
  12. package/dist/cli/mcp-attach.js +5 -4
  13. package/dist/cli/mcp-attach.js.map +1 -1
  14. package/dist/cli/model-contract.d.ts +5 -0
  15. package/dist/cli/model-contract.d.ts.map +1 -0
  16. package/dist/cli/model-contract.js +45 -0
  17. package/dist/cli/model-contract.js.map +1 -0
  18. package/dist/commands/adaptorch-doctor-cli.d.ts.map +1 -1
  19. package/dist/commands/adaptorch-doctor-cli.js +32 -10
  20. package/dist/commands/adaptorch-doctor-cli.js.map +1 -1
  21. package/dist/commands/init-cli.d.ts +12 -0
  22. package/dist/commands/init-cli.d.ts.map +1 -0
  23. package/dist/commands/init-cli.js +76 -0
  24. package/dist/commands/init-cli.js.map +1 -0
  25. package/dist/commands/provider-sync-cli.d.ts +27 -0
  26. package/dist/commands/provider-sync-cli.d.ts.map +1 -0
  27. package/dist/commands/provider-sync-cli.js +177 -0
  28. package/dist/commands/provider-sync-cli.js.map +1 -0
  29. package/dist/commands/run-command.d.ts +8 -0
  30. package/dist/commands/run-command.d.ts.map +1 -0
  31. package/dist/commands/run-command.js +26 -0
  32. package/dist/commands/run-command.js.map +1 -0
  33. package/dist/core/active-skill-state.d.ts +7 -0
  34. package/dist/core/active-skill-state.d.ts.map +1 -0
  35. package/dist/core/active-skill-state.js +25 -0
  36. package/dist/core/active-skill-state.js.map +1 -0
  37. package/dist/core/agent-session-services.d.ts +2 -0
  38. package/dist/core/agent-session-services.d.ts.map +1 -1
  39. package/dist/core/agent-session-services.js +2 -0
  40. package/dist/core/agent-session-services.js.map +1 -1
  41. package/dist/core/agent-session.d.ts +0 -1
  42. package/dist/core/agent-session.d.ts.map +1 -1
  43. package/dist/core/agent-session.js +30 -85
  44. package/dist/core/agent-session.js.map +1 -1
  45. package/dist/core/codex-chatgpt-web-bridge.d.ts +99 -0
  46. package/dist/core/codex-chatgpt-web-bridge.d.ts.map +1 -0
  47. package/dist/core/codex-chatgpt-web-bridge.js +192 -0
  48. package/dist/core/codex-chatgpt-web-bridge.js.map +1 -0
  49. package/dist/core/codex-chatgpt-web-sync.d.ts +50 -0
  50. package/dist/core/codex-chatgpt-web-sync.d.ts.map +1 -0
  51. package/dist/core/codex-chatgpt-web-sync.js +119 -0
  52. package/dist/core/codex-chatgpt-web-sync.js.map +1 -0
  53. package/dist/core/compaction/compaction-headroom.d.ts +30 -0
  54. package/dist/core/compaction/compaction-headroom.d.ts.map +1 -0
  55. package/dist/core/compaction/compaction-headroom.js +48 -0
  56. package/dist/core/compaction/compaction-headroom.js.map +1 -0
  57. package/dist/core/compaction/compaction.d.ts +2 -29
  58. package/dist/core/compaction/compaction.d.ts.map +1 -1
  59. package/dist/core/compaction/compaction.js +19 -47
  60. package/dist/core/compaction/compaction.js.map +1 -1
  61. package/dist/core/compaction/overflow-retry-guard.d.ts +20 -0
  62. package/dist/core/compaction/overflow-retry-guard.d.ts.map +1 -0
  63. package/dist/core/compaction/overflow-retry-guard.js +38 -0
  64. package/dist/core/compaction/overflow-retry-guard.js.map +1 -0
  65. package/dist/core/context-budget-headroom-types.d.ts.map +1 -1
  66. package/dist/core/context-budget-headroom-types.js +1 -1
  67. package/dist/core/context-budget-headroom-types.js.map +1 -1
  68. package/dist/core/context-budget-token-counter-types.d.ts +27 -0
  69. package/dist/core/context-budget-token-counter-types.d.ts.map +1 -0
  70. package/dist/core/context-budget-token-counter-types.js +2 -0
  71. package/dist/core/context-budget-token-counter-types.js.map +1 -0
  72. package/dist/core/context-budget-token-counter.d.ts +2 -26
  73. package/dist/core/context-budget-token-counter.d.ts.map +1 -1
  74. package/dist/core/context-budget-token-counter.js +2 -0
  75. package/dist/core/context-budget-token-counter.js.map +1 -1
  76. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
  77. package/dist/core/context-budget-v2-scoring.js +14 -10
  78. package/dist/core/context-budget-v2-scoring.js.map +1 -1
  79. package/dist/core/domain-router.d.ts.map +1 -1
  80. package/dist/core/domain-router.js +1 -1
  81. package/dist/core/domain-router.js.map +1 -1
  82. package/dist/core/grok-harness-dispatch.d.ts +4 -0
  83. package/dist/core/grok-harness-dispatch.d.ts.map +1 -1
  84. package/dist/core/grok-harness-dispatch.js +20 -3
  85. package/dist/core/grok-harness-dispatch.js.map +1 -1
  86. package/dist/core/grok-harness.d.ts +15 -9
  87. package/dist/core/grok-harness.d.ts.map +1 -1
  88. package/dist/core/grok-harness.js +34 -8
  89. package/dist/core/grok-harness.js.map +1 -1
  90. package/dist/core/mcp/tools.d.ts +2 -2
  91. package/dist/core/mcp/tools.d.ts.map +1 -1
  92. package/dist/core/mcp/tools.js +29 -3
  93. package/dist/core/mcp/tools.js.map +1 -1
  94. package/dist/core/model-registry-schema.d.ts +1081 -0
  95. package/dist/core/model-registry-schema.d.ts.map +1 -0
  96. package/dist/core/model-registry-schema.js +148 -0
  97. package/dist/core/model-registry-schema.js.map +1 -0
  98. package/dist/core/model-registry.d.ts.map +1 -1
  99. package/dist/core/model-registry.js +1 -146
  100. package/dist/core/model-registry.js.map +1 -1
  101. package/dist/core/model-resolver.d.ts +2 -1
  102. package/dist/core/model-resolver.d.ts.map +1 -1
  103. package/dist/core/model-resolver.js +2 -1
  104. package/dist/core/model-resolver.js.map +1 -1
  105. package/dist/core/prompt-preset.d.ts +1 -1
  106. package/dist/core/prompt-preset.d.ts.map +1 -1
  107. package/dist/core/prompt-preset.js +16 -1
  108. package/dist/core/prompt-preset.js.map +1 -1
  109. package/dist/core/provider-display-names.d.ts.map +1 -1
  110. package/dist/core/provider-display-names.js +1 -0
  111. package/dist/core/provider-display-names.js.map +1 -1
  112. package/dist/core/provider-resilience.d.ts +8 -0
  113. package/dist/core/provider-resilience.d.ts.map +1 -1
  114. package/dist/core/provider-resilience.js +20 -3
  115. package/dist/core/provider-resilience.js.map +1 -1
  116. package/dist/core/provider-usage-types.d.ts +42 -0
  117. package/dist/core/provider-usage-types.d.ts.map +1 -0
  118. package/dist/core/provider-usage-types.js +2 -0
  119. package/dist/core/provider-usage-types.js.map +1 -0
  120. package/dist/core/provider-usage.d.ts +2 -31
  121. package/dist/core/provider-usage.d.ts.map +1 -1
  122. package/dist/core/provider-usage.js +4 -0
  123. package/dist/core/provider-usage.js.map +1 -1
  124. package/dist/core/redaction.d.ts.map +1 -1
  125. package/dist/core/redaction.js +18 -2
  126. package/dist/core/redaction.js.map +1 -1
  127. package/dist/core/sandbox/policy-merge.d.ts +6 -0
  128. package/dist/core/sandbox/policy-merge.d.ts.map +1 -0
  129. package/dist/core/sandbox/policy-merge.js +74 -0
  130. package/dist/core/sandbox/policy-merge.js.map +1 -0
  131. package/dist/core/sandbox/policy-paths.d.ts +4 -0
  132. package/dist/core/sandbox/policy-paths.d.ts.map +1 -0
  133. package/dist/core/sandbox/policy-paths.js +21 -0
  134. package/dist/core/sandbox/policy-paths.js.map +1 -0
  135. package/dist/core/sandbox/policy-types.d.ts +75 -0
  136. package/dist/core/sandbox/policy-types.d.ts.map +1 -0
  137. package/dist/core/sandbox/policy-types.js +2 -0
  138. package/dist/core/sandbox/policy-types.js.map +1 -0
  139. package/dist/core/sandbox/policy.d.ts +3 -77
  140. package/dist/core/sandbox/policy.d.ts.map +1 -1
  141. package/dist/core/sandbox/policy.js +3 -98
  142. package/dist/core/sandbox/policy.js.map +1 -1
  143. package/dist/core/sdk-provider-stream.d.ts +14 -0
  144. package/dist/core/sdk-provider-stream.d.ts.map +1 -0
  145. package/dist/core/sdk-provider-stream.js +38 -0
  146. package/dist/core/sdk-provider-stream.js.map +1 -0
  147. package/dist/core/sdk.d.ts +5 -1
  148. package/dist/core/sdk.d.ts.map +1 -1
  149. package/dist/core/sdk.js +17 -33
  150. package/dist/core/sdk.js.map +1 -1
  151. package/dist/core/session-failure-cause.d.ts.map +1 -1
  152. package/dist/core/session-failure-cause.js +10 -3
  153. package/dist/core/session-failure-cause.js.map +1 -1
  154. package/dist/core/session-run-termination.d.ts +18 -0
  155. package/dist/core/session-run-termination.d.ts.map +1 -0
  156. package/dist/core/session-run-termination.js +61 -0
  157. package/dist/core/session-run-termination.js.map +1 -0
  158. package/dist/core/session-termination.d.ts.map +1 -1
  159. package/dist/core/session-termination.js +1 -1
  160. package/dist/core/session-termination.js.map +1 -1
  161. package/dist/core/skill-selector.d.ts +40 -0
  162. package/dist/core/skill-selector.d.ts.map +1 -0
  163. package/dist/core/skill-selector.js +102 -0
  164. package/dist/core/skill-selector.js.map +1 -0
  165. package/dist/core/tools/render-utils.d.ts.map +1 -1
  166. package/dist/core/tools/render-utils.js +2 -4
  167. package/dist/core/tools/render-utils.js.map +1 -1
  168. package/dist/core/turn-metrics-record.d.ts +55 -0
  169. package/dist/core/turn-metrics-record.d.ts.map +1 -0
  170. package/dist/core/turn-metrics-record.js +149 -0
  171. package/dist/core/turn-metrics-record.js.map +1 -0
  172. package/dist/core/turn-metrics.d.ts +4 -56
  173. package/dist/core/turn-metrics.d.ts.map +1 -1
  174. package/dist/core/turn-metrics.js +12 -60
  175. package/dist/core/turn-metrics.js.map +1 -1
  176. package/dist/guardrails/evidence-system.d.ts +1 -1
  177. package/dist/guardrails/evidence-system.d.ts.map +1 -1
  178. package/dist/guardrails/evidence-system.js +18 -29
  179. package/dist/guardrails/evidence-system.js.map +1 -1
  180. package/dist/guardrails/merge-gate-result.d.ts +4 -0
  181. package/dist/guardrails/merge-gate-result.d.ts.map +1 -0
  182. package/dist/guardrails/merge-gate-result.js +32 -0
  183. package/dist/guardrails/merge-gate-result.js.map +1 -0
  184. package/dist/main.d.ts.map +1 -1
  185. package/dist/main.js +22 -22
  186. package/dist/main.js.map +1 -1
  187. package/dist/modes/interactive/interactive-login-options.d.ts +27 -0
  188. package/dist/modes/interactive/interactive-login-options.d.ts.map +1 -0
  189. package/dist/modes/interactive/interactive-login-options.js +54 -0
  190. package/dist/modes/interactive/interactive-login-options.js.map +1 -0
  191. package/dist/modes/interactive/interactive-mode.d.ts +7 -4
  192. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  193. package/dist/modes/interactive/interactive-mode.js +138 -140
  194. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  195. package/dist/modes/interactive/interactive-resume-command.d.ts +3 -0
  196. package/dist/modes/interactive/interactive-resume-command.d.ts.map +1 -0
  197. package/dist/modes/interactive/interactive-resume-command.js +24 -0
  198. package/dist/modes/interactive/interactive-resume-command.js.map +1 -0
  199. package/dist/modes/interactive/interactive-tool-result.d.ts +32 -0
  200. package/dist/modes/interactive/interactive-tool-result.d.ts.map +1 -0
  201. package/dist/modes/interactive/interactive-tool-result.js +59 -0
  202. package/dist/modes/interactive/interactive-tool-result.js.map +1 -0
  203. package/dist/modes/print-mode.d.ts.map +1 -1
  204. package/dist/modes/print-mode.js +22 -0
  205. package/dist/modes/print-mode.js.map +1 -1
  206. package/dist/utils/clipboard-image.d.ts.map +1 -1
  207. package/dist/utils/clipboard-image.js +10 -60
  208. package/dist/utils/clipboard-image.js.map +1 -1
  209. package/dist/utils/terminal-links.d.ts +13 -0
  210. package/dist/utils/terminal-links.d.ts.map +1 -0
  211. package/dist/utils/terminal-links.js +68 -0
  212. package/dist/utils/terminal-links.js.map +1 -0
  213. package/dist/utils/windows-clipboard-image.d.ts +16 -0
  214. package/dist/utils/windows-clipboard-image.d.ts.map +1 -0
  215. package/dist/utils/windows-clipboard-image.js +87 -0
  216. package/dist/utils/windows-clipboard-image.js.map +1 -0
  217. package/docs/adaptorch-onboarding.md +80 -0
  218. package/docs/containerization.md +12 -0
  219. package/docs/context-files.md +97 -0
  220. package/docs/correctness-wall.md +8 -0
  221. package/docs/custom-provider.md +35 -0
  222. package/docs/development.md +18 -3
  223. package/docs/environment-variables.md +2 -0
  224. package/docs/grok-harness.md +4 -0
  225. package/docs/harness-boundaries.md +154 -0
  226. package/docs/harness-improvements.md +90 -0
  227. package/docs/json.md +19 -0
  228. package/docs/keybindings.md +1 -1
  229. package/docs/mcp.md +22 -2
  230. package/docs/metrics.md +66 -16
  231. package/docs/model-catalog-refresh.md +190 -0
  232. package/docs/model-contract.md +168 -0
  233. package/docs/models.md +21 -4
  234. package/docs/provider-resilience.md +5 -3
  235. package/docs/providers.md +68 -1
  236. package/docs/quickstart.md +4 -0
  237. package/docs/release-audit-0.98.4.md +112 -0
  238. package/docs/review-bundle-followup.md +195 -0
  239. package/docs/runtime-algorithms.md +19 -0
  240. package/docs/sdk.md +11 -2
  241. package/docs/sessions.md +1 -1
  242. package/docs/settings.md +17 -1
  243. package/docs/skills.md +2 -0
  244. package/docs/tb21-audit.md +131 -0
  245. package/docs/terminal-setup.md +20 -0
  246. package/docs/usage.md +23 -1
  247. package/docs/windows.md +48 -0
  248. package/examples/README.md +4 -0
  249. package/examples/context/AGENTS.md +64 -0
  250. package/examples/context/CLAUDE.md +17 -0
  251. package/examples/context/INTERNET.md +42 -0
  252. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  253. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  254. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  255. package/examples/extensions/gondolin/package-lock.json +2 -2
  256. package/examples/extensions/gondolin/package.json +1 -1
  257. package/examples/extensions/sandbox/package-lock.json +2 -2
  258. package/examples/extensions/sandbox/package.json +1 -1
  259. package/examples/extensions/with-deps/package-lock.json +2 -2
  260. package/examples/extensions/with-deps/package.json +1 -1
  261. package/npm-shrinkwrap.json +18 -18
  262. package/package.json +6 -6
@@ -0,0 +1,168 @@
1
+ # Model dispatch contracts
2
+
3
+ This opt-in working-tree feature implements the first execution-contract slice of
4
+ [the harness roadmap](../../../ROADMAP.md). It restricts **logical stream dispatch**
5
+ and checks the final **Chat Completions model ID and output-limit parameter**.
6
+ Other APIs, network destinations, and billable attempts are not fully covered.
7
+ It is not a sandbox or a benchmark-integrity attestation.
8
+
9
+ ## CLI
10
+
11
+ Create a UTF-8 JSON policy, replacing the example identities with the exact
12
+ provider and model you intend to use:
13
+
14
+ ```json
15
+ {
16
+ "allowedModels": [{ "provider": "your-provider", "id": "exact-model-id" }],
17
+ "allowedProviders": ["your-provider"],
18
+ "allowedAuthOrigins": ["your-provider"],
19
+ "thinking": false,
20
+ "thinkingLevel": "off",
21
+ "maxOutputTokens": 4096
22
+ }
23
+ ```
24
+
25
+ ```bash
26
+ omk --provider your-provider --model exact-model-id --thinking off \
27
+ --model-contract ./policy.json -p "Run the requested checks"
28
+ ```
29
+
30
+ The flag does not start an extra model call. A normal prompt still calls the
31
+ configured provider and may incur cost. `--offline` suppresses startup network
32
+ work; it does not prevent prompt inference.
33
+
34
+ The CLI reads the policy once, before migrations and session creation, and keeps
35
+ that snapshot when replacing or resuming sessions within the process. A later
36
+ process must supply the flag again. It does not alter settings, credentials,
37
+ model selection, or a saved transcript. `--help` does not read the policy.
38
+
39
+ Missing, unreadable, malformed, non-regular, or oversized files exit with code 1.
40
+ Reads are bounded to 64 KiB; invalid UTF-8 and unknown top-level fields are
41
+ rejected. Missing flag values and duplicate flags are errors. Both
42
+ `--model-contract policy.json` and `--model-contract=policy.json` are accepted.
43
+
44
+ ## SDK
45
+
46
+ `createAgentSession()` and `createAgentSessionFromServices()` accept an optional
47
+ `modelContract` and main-loop `maxTokens`. `Agent` accepts the same options.
48
+
49
+ ```typescript
50
+ const { session } = await createAgentSession({
51
+ model,
52
+ thinkingLevel: "off",
53
+ modelContract: {
54
+ allowedModels: [{ provider: model.provider, id: model.id }],
55
+ allowedProviders: [model.provider],
56
+ allowedAuthOrigins: [model.provider],
57
+ thinking: false,
58
+ thinkingLevel: "off",
59
+ maxOutputTokens: 4096,
60
+ },
61
+ });
62
+ ```
63
+
64
+ `ModelContract`, `RouteRequest`, `ModelContractViolation`,
65
+ `snapshotModelContract()`, and `assertModelContract()` are exported by
66
+ `omk-agent-core`. No global setting enables this policy implicitly.
67
+
68
+ The policy is copied and frozen. Each allowlist has 1–64 entries; identities are
69
+ exact, bounded strings, not wildcards. Allowed models are provider/ID pairs.
70
+ `allowedAuthOrigins` names logical credential resolvers, normally the provider;
71
+ it does not authenticate an account or HTTPS origin.
72
+
73
+ `thinking: false` forbids a requested reasoning level. `thinking: true` permits
74
+ reasoning, while optional `thinkingLevel` pins the effective logical level.
75
+ An absent level is `off` in the compatibility validator. The runtime supplies
76
+ an explicit effective level when checking a request.
77
+
78
+ Contract and explicit request limits must be positive safe integers. A larger
79
+ explicit limit is rejected rather than silently clamped. When a runtime request
80
+ omits `maxTokens`, the dispatch boundary supplies the smaller of the contract
81
+ cap and model metadata cap. `assertModelContract()` alone retains compatibility
82
+ with an omitted limit and does not fill it in.
83
+
84
+ ## Covered paths
85
+
86
+ - In contract mode, tool-generated images do not trigger automatic vision routing.
87
+ For a text-only selected model, the provider view replaces those image blocks
88
+ with explicit uninspected-image notices and retains the existing text/tool IDs.
89
+ Original session attachments are unchanged. This is not OCR or visual analysis.
90
+ User-provided images still require a permitted vision route; they are not silently
91
+ discarded. A vision-capable selected model and non-contract routing retain their
92
+ existing behavior. The SDK summary stream uses the same projection.
93
+ - Core prompt and continuation loops check the automatically selected route
94
+ before resolving its credentials. Policy remains fixed across lifecycle,
95
+ context, auth, and next-turn callbacks.
96
+ - The SDK stream checks again before authentication, covering first-party
97
+ compaction and branch-summary calls that use `session.agent.streamFn`.
98
+ An explicitly requested summary cap above the policy is rejected, not reduced.
99
+ - For `openai-completions`, the payload hook checks the serialized model ID and
100
+ exactly one defined `max_tokens` or `max_completion_tokens` before HTTP dispatch.
101
+ The cap must be a positive safe integer no larger than the effective logical
102
+ request cap. Missing, ambiguous, enlarged, or invalid limits are refused, even
103
+ without a user hook. Model identity is pinned before asynchronous callbacks.
104
+ - Contracted payload hooks may observe detached immutable payload/model data or
105
+ return an equivalent payload. In-place changes and replacements are refused.
106
+ Optional `undefined` payload fields are accepted. Hook-return equivalence is
107
+ conservative JSON serialization equality, not arbitrary semantic equivalence.
108
+ Without a user observer, validation does not clone the conversation; nested
109
+ core/SDK enforcement shares the existing observation boundary.
110
+ - Automatic cross-provider vision routing never forwards the source provider's
111
+ static API key, request headers, or model headers. This isolation also applies
112
+ when no contract is configured. Destination credentials must come from the
113
+ destination resolver or the provider's normal credential path.
114
+
115
+ ## Dispatch events
116
+
117
+ Contracted **core-loop** calls emit:
118
+
119
+ | Event | Meaning |
120
+ | --- | --- |
121
+ | `provider_denied` | A logical contract violation or observed cancellation prevented dispatch |
122
+ | `provider_request` | The harness entered its stream-function dispatch boundary |
123
+ | `provider_request_end` | That dispatch finished, errored, or aborted |
124
+
125
+ `provider_request.omittedToolImages`, when present, counts tool attachments replaced
126
+ in this request's provider view. It does not count visual interpretations or saved
127
+ bytes in the session. A core contract denial becomes a non-retryable `configuration`
128
+ termination rather than a provider-protocol diagnosis.
129
+
130
+ `requestId` joins the events. Request and end events identify their boundary as
131
+ `stream-dispatch`. Metadata excludes prompts, output, headers, keys, and raw
132
+ errors. The end outcome is a transport/lifecycle result, not task correctness;
133
+ `completed` does not mean an answer passed a verifier.
134
+
135
+ A start event can be followed by an error before network transmission, including
136
+ an observer or custom-stream error. An abort event does not prove that a remote
137
+ request or custom stream has stopped. Auth/context failures before dispatch are
138
+ not a complete attempted-request ledger. Summaries using the SDK wrapper are
139
+ checked but do not yet emit these core-loop events. Persistence, run/attempt
140
+ correlation, HTTP retry accounting, usage and billing joins remain follow-up work.
141
+
142
+ ## Limits and next steps
143
+
144
+ The Chat Completions check validates the parameter sent by the first-party
145
+ adapter, not the provider's interpretation or enforcement of it. Reasoning-token
146
+ budgets, remote routing, response model identity, and actual charges still need
147
+ separate evidence. Adapters that rewrite model names (for example, adding a
148
+ namespace) are rejected by this exact-identity check unless the selected model ID
149
+ already equals the transmitted ID.
150
+
151
+ Other APIs still have only logical checks. For example,
152
+ `adjustMaxTokensForThinking()` can add thinking tokens, and the inspected Codex
153
+ request builder does not serialize `maxTokens`. Thus this contract is **not a
154
+ universal output or billing cap**. A strict single-model benchmark still needs
155
+ adapter-specific request provenance. For Model Studio's thinking fields and
156
+ separate billing endpoints, see [the provider guide](providers.md#model-studio-deepseek-v4).
157
+
158
+ Direct `omk-ai` calls, the separate `AgentHarness` family, advisory judges, child
159
+ processes, custom streams that replace the SDK wrapper, and arbitrary extension
160
+ code do not acquire this policy automatically. Extensions execute with their
161
+ existing host permissions; freezing hook arguments does not isolate their code.
162
+ Tool permissions, endpoint trust, effect idempotency, deadlines, and semantic
163
+ completion still belong to their existing owners.
164
+
165
+ A fresh build/restart is required to use source changes in an installed CLI.
166
+ This implementation work did not build, install, deploy, change active settings,
167
+ or run a paid benchmark. See [the boundary redesign](harness-boundaries.md) and
168
+ ROADMAP §15 for dated evidence, limitations, and the remaining architecture work.
package/docs/models.md CHANGED
@@ -4,7 +4,7 @@ Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.omk/a
4
4
 
5
5
  ## Table of Contents
6
6
 
7
- - [Built-in NVIDIA GLM-5.2](#built-in-nvidia-glm-52)
7
+ - [Catalog availability](#catalog-availability)
8
8
  - [Minimal Example](#minimal-example)
9
9
  - [Full Example](#full-example)
10
10
  - [Supported APIs](#supported-apis)
@@ -16,9 +16,15 @@ Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.omk/a
16
16
  - [Anthropic Messages Compatibility](#anthropic-messages-compatibility)
17
17
  - [OpenAI Compatibility](#openai-compatibility)
18
18
 
19
- ## Built-in NVIDIA GLM-5.2
19
+ ## Catalog availability
20
20
 
21
- With `NVIDIA_API_KEY` configured, `nvidia/z-ai/glm-5.2` supports OMK thinking levels through NVIDIA NIM. Its generated metadata explicitly enables `reasoning_effort`, so `/think max` is sent as `reasoning_effort: "max"`. Other NVIDIA models do not inherit that capability automatically.
21
+ The NVIDIA catalog is filtered against NIM's live model IDs and known compatibility
22
+ limits. A historical GLM route is not evidence that NIM still lists it. Use the
23
+ current model selector rather than copying a removed ID from older examples.
24
+
25
+ The [2026-09-09 catalog refresh](model-catalog-refresh.md) records new models,
26
+ provider-specific thinking ladders, and verification limits. Model discovery does
27
+ not prove that an account can invoke that model.
22
28
 
23
29
  ## Minimal Example
24
30
 
@@ -420,7 +426,18 @@ For providers with partial OpenAI compatibility, use the `compat` field.
420
426
  | `openRouterRouting` | OpenRouter provider routing preferences. This object is sent as-is in the `provider` field of the [OpenRouter API request](https://openrouter.ai/docs/guides/routing/provider-selection). |
421
427
  | `vercelGatewayRouting` | Vercel AI Gateway routing config for provider selection (`only`, `order`) |
422
428
 
423
- `openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking`.
429
+ `openrouter` uses `reasoning: { effort }` for enabled thinking and
430
+ `reasoning: { enabled: false }` for its supported off toggle. Mandatory-thinking
431
+ models do not offer off. Declared per-route efforts override model-family guesses.
432
+ `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking`.
433
+
434
+ On official HTTPS Model Studio hosts, automatic defaults use `max_tokens`, the
435
+ `system` role, and `enable_thinking`; OpenAI store and long-cache fields are omitted.
436
+ The legacy `thinkingFormat: "deepseek"` override is translated to `qwen` on those
437
+ hosts only. DeepSeek V4 also sends `reasoning_effort` when enabled; an explicit
438
+ `supportsReasoningEffort: false` remains an opt-out. A custom proxy hostname needs
439
+ explicit compatibility settings because its upstream protocol cannot be inferred.
440
+ See [Model Studio endpoint and plan guidance](providers.md#model-studio-deepseek-v4).
424
441
 
425
442
  `cacheControlFormat: "anthropic"` is for OpenAI-compatible providers that expose Anthropic-style prompt caching through `cache_control` markers on text content and tool definitions.
426
443
 
@@ -21,7 +21,7 @@ Configure resilience in `~/.omk/agent/settings.json` or `.omk/settings.json`:
21
21
  "autoFailoverOnSafetyStop": true,
22
22
  "failoverCandidates": [
23
23
  { "provider": "kimi-coding", "id": "k3" },
24
- { "provider": "modelstudio-maas", "id": "qwen3.8-max-preview" }
24
+ { "provider": "modelstudio-maas", "id": "qwen3.8-max" }
25
25
  ]
26
26
  }
27
27
  }
@@ -52,14 +52,16 @@ For a safety stop or recognized quota/billing error, OMK:
52
52
 
53
53
  A content/safety stop gets at most one automatic retry, including a retry that switches model, regardless of the larger transport retry budget. Other transient failures keep the configured retry policy and backoff. Plain authentication errors remain non-retryable and do not trigger failover.
54
54
 
55
- Recognized quota shapes include billing-cycle usage limits, `insufficient_quota`, exhausted balances, `GoUsageLimitError`, `FreeUsageLimitError`, and out-of-budget responses. These are classified as `provider.rate_limit`, even when a provider wraps them in HTTP 403.
55
+ Recognized quota shapes include billing-cycle usage limits, `insufficient_quota`, exhausted balances, `GoUsageLimitError`, `FreeUsageLimitError`, and out-of-budget responses. These are classified as `provider.rate_limit`, even when a provider wraps them in HTTP 403. Provider-capacity bodies that omit a status or limit token are classified the same way: xAI `currently at capacity` / `high demand` (HTTP 429) and Anthropic `overloaded_error` / `Overloaded` (HTTP 529). Left unmatched they fall through to `provider.protocol` and advertise orphan-`tool_call_id` sanitize.
56
+
57
+ Two HTTP 400s are permanent `configuration.invalid`, not retryable protocol faults: Anthropic `claude_code_version_too_old`, and Codex ChatGPT-account `The '<slug>' model is not supported when using Codex with a ChatGPT account.` Same-model retry, transcript sanitize, and `/new session` re-send the same client version or slug. Switch with `/model`, or for Codex use an API-key route that has the model.
56
58
 
57
59
  Gateway/upstream availability failures — "503 Upstream request failed", "Endpoint is unavailable", or a stream that ended without a finish reason — are classified as `provider.network`: transport problems that heal by retry or model switch, never by transcript sanitization.
58
60
 
59
61
  The default candidate order is:
60
62
 
61
63
  1. `kimi-coding/k3`
62
- 2. `modelstudio-maas/qwen3.8-max-preview`
64
+ 2. `modelstudio-maas/qwen3.8-max`
63
65
  3. `xai/grok-4.5`
64
66
  4. `deepseek/deepseek-v4-pro`
65
67
  5. `deepseek/deepseek-v4-flash`
package/docs/providers.md CHANGED
@@ -32,6 +32,41 @@ Alibaba Model Studio Token Plan is recognized as **QWEN TOKEN PLAN** and reads i
32
32
 
33
33
  With a stored native `xai` OAuth credential, OMK reads `GET https://cli-chat-proxy.grok.com/v1/billing?format=credits` and shows the weekly SuperGrok pool from `config.creditUsagePercent` plus its reset from `config.currentPeriod.end`. `XAI_API_KEY` is a separate API-billing credential and does not authorize this subscription endpoint.
34
34
 
35
+ ### Model Studio DeepSeek V4
36
+
37
+ Model Studio uses `enable_thinking`, including for DeepSeek. OMK's Chat Completions
38
+ adapter recognizes official HTTPS DashScope and `*.maas.aliyuncs.com` hosts, defaults
39
+ to `max_tokens` and the `system` role, and omits unsupported OpenAI store/long-cache
40
+ fields. Legacy `thinkingFormat: "deepseek"` on these hosts is translated to the
41
+ `enable_thinking` format. Native DeepSeek endpoints keep their native format.
42
+
43
+ DeepSeek V4 sends the selected `reasoning_effort` when compatibility settings permit
44
+ it. Without a model-specific mapping, `minimal` maps to the supported `low` value.
45
+ An explicit `supportsReasoningEffort: false` still suppresses that field; remove
46
+ that override or enable it for the model if you intend to send `high`, `xhigh`, or
47
+ `max`. With thinking off, OMK sends `enable_thinking: false` rather than relying on
48
+ the server default. See [custom model configuration](models.md#openai-compatibility).
49
+
50
+ Keep the key paired with its purchased product and region. These are distinct
51
+ billing paths, not interchangeable aliases:
52
+
53
+ | Product | Example OpenAI-compatible base URL |
54
+ | --- | --- |
55
+ | Token Plan, Singapore | `https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1` |
56
+ | Coding Plan, China | `https://coding.dashscope.aliyuncs.com/v1` |
57
+ | Pay-as-you-go | `https://dashscope.aliyuncs.com/compatible-mode/v1` |
58
+
59
+ Protocol detection never changes the URL, credentials, model ID, or subscription.
60
+ For a comparison run, pin the exact Flash snapshot offered by that endpoint in
61
+ both arms; `deepseek-v4-flash-0731` and an unversioned alias are not automatically
62
+ the same experimental condition. Apply a [model contract](model-contract.md), and
63
+ verify the installed adapter and final request before starting a benchmark.
64
+
65
+ Sources: Alibaba's [DeepSeek API](https://www.alibabacloud.com/help/en/model-studio/deepseek-api)
66
+ and [plan endpoint separation](https://www.alibabacloud.com/help/en/model-studio/token-plan-team-quickstart),
67
+ consulted 2026-09-08. The local tests exercise serialization, not account availability,
68
+ provider compliance, billing, or benchmark performance.
69
+
35
70
  ### OpenAI Codex
36
71
 
37
72
  - Requires ChatGPT Plus or Pro subscription
@@ -94,6 +129,7 @@ omk
94
129
  | Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
95
130
  | Together AI | `TOGETHER_API_KEY` | `together` |
96
131
  | Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
132
+ | Meta Model API | `META_API_KEY` (or `META_MODEL_API_KEY`, `MODEL_API_KEY`) | `meta` |
97
133
  | MiniMax | `MINIMAX_API_KEY` | `minimax` |
98
134
  | MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
99
135
  | Xiaomi MiMo | `XIAOMI_API_KEY` | `xiaomi` |
@@ -106,7 +142,38 @@ Reference for environment variables and `auth.json` keys: [`const envMap`](https
106
142
 
107
143
  #### NVIDIA NIM
108
144
 
109
- Set `NVIDIA_API_KEY` and select an NVIDIA model with `/model`. The built-in `nvidia/z-ai/glm-5.2` entry sends `reasoning_effort`, including the `max` level. Other NVIDIA models keep conservative compatibility defaults unless their model metadata explicitly enables reasoning effort.
145
+ Set `NVIDIA_API_KEY` and select a currently listed NVIDIA model with `/model`.
146
+ NIM entries are filtered against its live `/v1/models` list; historical GLM examples
147
+ may no longer be listed. Thinking capabilities stay model-specific. See the
148
+ [latest catalog audit](model-catalog-refresh.md) for source coverage and limits.
149
+
150
+ #### Meta Model API
151
+
152
+ Meta's first-party [Muse Spark](https://dev.meta.ai/docs/overview) endpoint, served over the OpenAI
153
+ Responses API at `https://api.meta.ai/v1`:
154
+
155
+ ```bash
156
+ export META_API_KEY=...
157
+ omk --provider meta --model muse-spark-1.3
158
+ ```
159
+
160
+ Two auth paths:
161
+
162
+ - **Subscription:** `/login` → Use a subscription → Muse Code. Device-code sign-in at
163
+ `auth.meta.com`, then a mint at `https://api.meta.ai/muse-code/key`. Honors `HTTP_PROXY` /
164
+ `HTTPS_PROXY`. The minted key is what inference uses.
165
+ - **Pay-as-you-go:** `META_API_KEY` (then `META_MODEL_API_KEY`, then `MODEL_API_KEY`), or paste a
166
+ Model API key under `/login` → Use an API key → Meta Model API. Extra keys you create on the
167
+ dashboard are billed [per token](https://dev.meta.ai/docs/muse-code/subscriptions), even with an
168
+ active Muse Code subscription.
169
+
170
+ Standard tier: `muse-spark-1.3`, `muse-spark-1.2`, `muse-spark-1.1`. Contributor tier:
171
+ `muse-spark-1.3-contributor`, `muse-spark-1.2-contributor`. All carry a 1M-token context window.
172
+
173
+ Thinking levels run `minimal` → `max`. Muse Spark's own effort ceiling is `xhigh`, which its docs
174
+ call "maximum reasoning depth", so omk's `max` level maps onto `xhigh` rather than sending an enum
175
+ the API would reject. Thinking cannot be switched off: Muse Spark rejects `reasoning_effort: "none"`
176
+ with HTTP 400, so omk never sends it.
110
177
 
111
178
  #### Zyloo
112
179
 
@@ -85,6 +85,10 @@ Additional built-in read-only tools (`grep`, `find`, `ls`) are available through
85
85
 
86
86
  ## Give omk project instructions
87
87
 
88
+ For optional, portable user defaults, preview `omk init --global --dry-run`, then
89
+ run `omk init --global`. Existing instructions and settings are preserved.
90
+ See [User context setup](context-files.md) for migration, loading, and interoperability.
91
+
88
92
  OMK loads context files at startup. Add an `AGENTS.md` file to tell it how to work in a project:
89
93
 
90
94
  ```markdown
@@ -0,0 +1,112 @@
1
+ # Release audit: v0.98.4
2
+
3
+ Date: 2026-09-10. This records pre-publication checks and approved history cleanup,
4
+ not a semantic-correctness/performance claim. The tag workflow and registry versions
5
+ remain the evidence for completed publication.
6
+
7
+ ## Scope and history
8
+
9
+ The candidate retains the public v0.98.3 ancestry and the reviewed local implementation
10
+ commits. Preparation uses only committed implementation files plus explicit release
11
+ metadata. Twelve existing modified files and two untracked test files were snapshotted
12
+ and isolated before preparing the candidate; they are not part of this candidate.
13
+ Credentials, the active model, private agent-home settings and stopped benchmarks are
14
+ not modified. Catalogs are reused from the reviewed commit, not regenerated.
15
+
16
+ The deletion commit alone did not remove the internal research document from history.
17
+ After explicit approval, only the unpublished range of `main` was filtered in a separate
18
+ bare repository. The cleaned branch has no path history or reachable blob for that
19
+ document. The resulting candidate tree is byte-identical to the previously checked tree;
20
+ the public main ancestor, other local refs and existing tags are unchanged. A scoped
21
+ compare-and-swap updated local main without resetting working files. Private recovery
22
+ material remains outside the repository and is not published.
23
+
24
+ The cleaned unpublished history also passed gitleaks with no findings. Publication uses
25
+ only the explicit main and v0.98.4 refs, without force-pushing or sending other local refs.
26
+
27
+ ## Changelog audit
28
+
29
+ The audit compares committed changes since v0.98.3. New entries cover model contracts,
30
+ DeepSeek V4.1 routes and provider thinking, metrics v2, gate/sandbox narrowing, shared-DAG
31
+ repairs and witness policy, CLI/skill/provider changes, clipboard/Markdown links, and WPL
32
+ submission checks. User-visible lower-level changes are also summarized in the CLI
33
+ changelog. Already released lifecycle/advisory changes are not advertised as new.
34
+ Unrelated pending retry/timeout/TB changes are not included. Published changelog sections
35
+ at v0.98.3 and earlier must remain byte-identical after the version bump.
36
+
37
+ ## Package/version contract
38
+
39
+ The seven public packages are `open-multi-agent-kit`, `omk-ai`, `omk-agent-core`, `omk-tui`,
40
+ `omk-protocol`, `omk-adaptorch-wpl`, and `omk-book-to-skill`, all at candidate version
41
+ 0.98.4. Root/example manifests and locks, internal dependency ranges, the book compiler's
42
+ version constant, CLI shrinkwrap and README pointers are synchronized in the same unit.
43
+
44
+ The checks below ran on the isolated 0.98.4 candidate. Tests and pack/build commands
45
+ used no real provider credentials. Catalogs remained byte-identical to the reviewed
46
+ committed snapshot.
47
+
48
+ ## Verification status
49
+
50
+ | Gate | Observed status |
51
+ | --- | --- |
52
+ | Workspace version bump | `npm run version:patch` exited 0; seven public versions are 0.98.4 |
53
+ | Published changelog preservation | Seven histories at v0.98.3 and earlier byte-preserved |
54
+ | Workspace build/typecheck | Build exited 0; six changed runtime files and the version constant confirmed clean by primary LSP |
55
+ | Full offline tests | Second run exited 0: 7,859 passed, 837 skipped, no failed tests or collection failures |
56
+ | `npm run check` | Candidate-index check exited 0; module-size and import-cycle gates passed without broader baselines |
57
+ | Release consistency | `check-release-consistency.mjs --release` exited 0 for version/ancestry/README consistency; history cleanup is checked separately below |
58
+ | npm package inspection | Seven local packs declared 0.98.4 and contained manifests/changelogs; restricted path matches 0; local seven-package install exited 0 |
59
+ | Standalone binary smoke | Linux x64 archive built; clean-environment Node CLI and standalone binary both reported 0.98.4 |
60
+ | Native initcheck | Go vet, race/shuffle tests and debug-symbol validation exited 0 |
61
+ | Candidate secret scan | gitleaks on the candidate source snapshot exited 0, findings 0; not a history-clearance claim |
62
+ | Dependency audit | Production dependencies: 0 vulnerabilities. Including development dependencies: 3 existing moderate Vitest-family advisories; suggested fix is a major upgrade, not applied implicitly |
63
+ | Public Git history | Scoped cleanup verified: forbidden path/blob reachability 0, candidate tree unchanged, public ancestor and other refs/tags preserved; unpublished-history gitleaks exited 0 |
64
+
65
+ Package test counts were WPL 149, agent 868, AI 631, book compiler 22,
66
+ coding-agent 5,425, protocol 34, and TUI 730. AI skipped 786 and coding-agent
67
+ skipped 51 live/environment-gated tests. These counts are verification coverage,
68
+ not measured harness quality.
69
+
70
+ ### Failures found and repaired during preparation
71
+
72
+ The first full run exposed 31 failed tests and five collection failures; those results
73
+ were not counted as a pass. Narrow reruns separated stale fixtures from runtime defects:
74
+
75
+ - Pre-aborted requests already stopped before authentication/provider dispatch. The old
76
+ test expected the provider to run after abort. It now checks zero auth/provider calls,
77
+ preserved cancellation reason and coherent stream termination. Queued steering input
78
+ remains in the transcript without starting another provider after cancellation.
79
+ - The native legacy Flash alias now serves a vision model. Vision-routing tests use an
80
+ explicit text-only fixture instead of asserting a volatile catalog alias is text-only.
81
+ - Four hoisted mocks used a not-yet-initialized namespace import; they now load the real
82
+ source through `vi.importActual`. The provider-doctor wiring check exercises the actual
83
+ source CLI rather than an obsolete import string in `main.ts`.
84
+ - Invalid tokenizer results now fail at their boundary and trigger the existing noted
85
+ fallback. Non-finite estimates fall back to the heuristic; optional-context sorting
86
+ remains antisymmetric/transitive instead of returning NaN.
87
+ - Domain matching normalizes whitespace without changing its deliberate repeated-keyword
88
+ scoring policy. Metamorphic regressions cover spaces, tabs and line breaks.
89
+ - Redaction preserves narrowly recognized non-secret references, placeholders and nearby
90
+ type annotations. Known credential patterns and literal values still mask; adversarial
91
+ suffix/literal cases are tested. The documented global persistence opt-out was incorrect:
92
+ the existing alias affects input only, and forced persistence/report masking remains on.
93
+ No global safety setting was enabled or weakened.
94
+
95
+ The corrective changes were committed separately. After scoped history cleanup their
96
+ IDs are `ec6db009df` (token counts/order), `f88b791a53` (whitespace routing),
97
+ `23e4b75d14` (redaction and its actual contract), and `779447c883` (current-runtime
98
+ test fixtures). Their source content and the recorded test results are unchanged.
99
+ Release metadata is a separate unit.
100
+
101
+ Full tests use the repository's `test.sh` with an isolated HOME, a credential-free
102
+ allowlisted environment and bounded Vitest workers. Toolchain locations may be passed
103
+ without credentials. Live provider tests, paid inference, benchmark execution and TUI
104
+ session restarts are excluded. A Linux smoke does not validate all target platforms.
105
+
106
+ ## Publication procedure
107
+
108
+ Review the final source tree, check the approved history, and tag the
109
+ exact main commit. The existing `build-binaries.yml` CI path owns npm publication and
110
+ GitHub Release creation; local pack/build commands are not publication. CI authentication
111
+ is unchanged and does not claim OIDC/Sigstore provenance. Completion requires the main tag,
112
+ GitHub Release and npm latest for all seven packages to agree.