@mcoda/codali 0.1.133 → 0.1.135-codali.10

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 (256) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/ORCHESTRATION.md +462 -0
  3. package/README.md +112 -1
  4. package/config/alternate-local.example.json +49 -0
  5. package/config/docdex-runtime.json +21 -0
  6. package/config/orchestration.schema.json +548 -0
  7. package/config/raijin-suku.example.json +172 -0
  8. package/config/terminal-long-scenarios.v1.json +71 -0
  9. package/dist/agents/RoleResolution.d.ts.map +1 -1
  10. package/dist/agents/RoleResolution.js +4 -4
  11. package/dist/api/CodaliApi.d.ts +16 -0
  12. package/dist/api/CodaliApi.d.ts.map +1 -1
  13. package/dist/api/CodaliApi.js +39 -10
  14. package/dist/cli/AskCommand.d.ts +3 -0
  15. package/dist/cli/AskCommand.d.ts.map +1 -1
  16. package/dist/cli/AskCommand.js +76 -13
  17. package/dist/cli/RunCommand.d.ts +4 -0
  18. package/dist/cli/RunCommand.d.ts.map +1 -1
  19. package/dist/cli/RunCommand.js +110 -24
  20. package/dist/cli/TerminalCommand.d.ts +35 -0
  21. package/dist/cli/TerminalCommand.d.ts.map +1 -0
  22. package/dist/cli/TerminalCommand.js +618 -0
  23. package/dist/cli/TerminalCredentials.d.ts +3 -0
  24. package/dist/cli/TerminalCredentials.d.ts.map +1 -0
  25. package/dist/cli/TerminalCredentials.js +89 -0
  26. package/dist/cli/TerminalInput.d.ts +24 -0
  27. package/dist/cli/TerminalInput.d.ts.map +1 -0
  28. package/dist/cli/TerminalInput.js +98 -0
  29. package/dist/cli/TerminalText.d.ts +10 -0
  30. package/dist/cli/TerminalText.d.ts.map +1 -0
  31. package/dist/cli/TerminalText.js +53 -0
  32. package/dist/cli.d.ts.map +1 -1
  33. package/dist/cli.js +33 -4
  34. package/dist/cognitive/ConfiguredPipeline.d.ts +34 -0
  35. package/dist/cognitive/ConfiguredPipeline.d.ts.map +1 -0
  36. package/dist/cognitive/ConfiguredPipeline.js +50 -0
  37. package/dist/cognitive/ValidationRunner.d.ts +4 -0
  38. package/dist/cognitive/ValidationRunner.d.ts.map +1 -1
  39. package/dist/cognitive/ValidationRunner.js +18 -41
  40. package/dist/config/NodeOrchestration.d.ts +21 -0
  41. package/dist/config/NodeOrchestration.d.ts.map +1 -0
  42. package/dist/config/NodeOrchestration.js +54 -0
  43. package/dist/config/OrchestrationConfig.d.ts +100 -0
  44. package/dist/config/OrchestrationConfig.d.ts.map +1 -0
  45. package/dist/config/OrchestrationConfig.js +245 -0
  46. package/dist/connectors/mcp/McpClient.d.ts +3 -1
  47. package/dist/connectors/mcp/McpClient.d.ts.map +1 -1
  48. package/dist/connectors/mcp/McpClient.js +3 -2
  49. package/dist/connectors/mcp/McpServerRegistry.d.ts +2 -2
  50. package/dist/connectors/mcp/McpServerRegistry.d.ts.map +1 -1
  51. package/dist/connectors/mcp/McpServerRegistry.js +39 -16
  52. package/dist/connectors/mcp/McpToolAdapter.js +2 -2
  53. package/dist/connectors/media/ConfiguredMediaTools.d.ts +6 -0
  54. package/dist/connectors/media/ConfiguredMediaTools.d.ts.map +1 -0
  55. package/dist/connectors/media/ConfiguredMediaTools.js +41 -0
  56. package/dist/connectors/media/ImageGenerationTool.js +3 -3
  57. package/dist/connectors/media/MediaArtifactReceipt.d.ts +5 -0
  58. package/dist/connectors/media/MediaArtifactReceipt.d.ts.map +1 -0
  59. package/dist/connectors/media/MediaArtifactReceipt.js +65 -0
  60. package/dist/connectors/media/MediaJobStore.d.ts +68 -0
  61. package/dist/connectors/media/MediaJobStore.d.ts.map +1 -0
  62. package/dist/connectors/media/MediaJobStore.js +199 -0
  63. package/dist/connectors/media/MediaJobWorker.d.ts +2 -0
  64. package/dist/connectors/media/MediaJobWorker.d.ts.map +1 -0
  65. package/dist/connectors/media/MediaJobWorker.js +65 -0
  66. package/dist/connectors/media/RemoteMediaJob.d.ts +6 -0
  67. package/dist/connectors/media/RemoteMediaJob.d.ts.map +1 -0
  68. package/dist/connectors/media/RemoteMediaJob.js +80 -0
  69. package/dist/docdex/DocdexClient.d.ts +18 -1
  70. package/dist/docdex/DocdexClient.d.ts.map +1 -1
  71. package/dist/docdex/DocdexClient.js +135 -19
  72. package/dist/docdex/ManagedDocdex.d.ts +29 -0
  73. package/dist/docdex/ManagedDocdex.d.ts.map +1 -0
  74. package/dist/docdex/ManagedDocdex.js +215 -0
  75. package/dist/docdex/ManagedRuntime.d.ts +28 -0
  76. package/dist/docdex/ManagedRuntime.d.ts.map +1 -0
  77. package/dist/docdex/ManagedRuntime.js +212 -0
  78. package/dist/eval/EvaluationProcess.d.ts +13 -0
  79. package/dist/eval/EvaluationProcess.d.ts.map +1 -0
  80. package/dist/eval/EvaluationProcess.js +76 -0
  81. package/dist/eval/LongWorkflowJourney.d.ts +34 -0
  82. package/dist/eval/LongWorkflowJourney.d.ts.map +1 -0
  83. package/dist/eval/LongWorkflowJourney.js +243 -0
  84. package/dist/eval/PlanningCorpus.d.ts +45 -0
  85. package/dist/eval/PlanningCorpus.d.ts.map +1 -0
  86. package/dist/eval/PlanningCorpus.js +189 -0
  87. package/dist/eval/PlanningCorpusRunner.d.ts +13 -0
  88. package/dist/eval/PlanningCorpusRunner.d.ts.map +1 -0
  89. package/dist/eval/PlanningCorpusRunner.js +89 -0
  90. package/dist/eval/TerminalCorpusRunner.d.ts +36 -0
  91. package/dist/eval/TerminalCorpusRunner.d.ts.map +1 -0
  92. package/dist/eval/TerminalCorpusRunner.js +222 -0
  93. package/dist/eval/TerminalTaskCorpus.d.ts +26 -0
  94. package/dist/eval/TerminalTaskCorpus.d.ts.map +1 -0
  95. package/dist/eval/TerminalTaskCorpus.js +105 -0
  96. package/dist/eval/TerminalWorkflowCorpus.d.ts +11 -0
  97. package/dist/eval/TerminalWorkflowCorpus.d.ts.map +1 -0
  98. package/dist/eval/TerminalWorkflowCorpus.js +119 -0
  99. package/dist/eval/fixtures/ContractReviewProvider.d.ts +4 -0
  100. package/dist/eval/fixtures/ContractReviewProvider.d.ts.map +1 -0
  101. package/dist/eval/fixtures/ContractReviewProvider.js +10 -0
  102. package/dist/eval/fixtures/MixedMediaRecoveryJourney.d.ts +6 -0
  103. package/dist/eval/fixtures/MixedMediaRecoveryJourney.d.ts.map +1 -0
  104. package/dist/eval/fixtures/MixedMediaRecoveryJourney.js +145 -0
  105. package/dist/eval/fixtures/TerminalRecoveryJourney.d.ts +4 -0
  106. package/dist/eval/fixtures/TerminalRecoveryJourney.d.ts.map +1 -0
  107. package/dist/eval/fixtures/TerminalRecoveryJourney.js +136 -0
  108. package/dist/gateway/CodaliGateway.d.ts +2 -0
  109. package/dist/gateway/CodaliGateway.d.ts.map +1 -1
  110. package/dist/gateway/CodaliGateway.js +16 -4
  111. package/dist/gateway/ConfiguredGateway.d.ts +23 -0
  112. package/dist/gateway/ConfiguredGateway.d.ts.map +1 -0
  113. package/dist/gateway/ConfiguredGateway.js +44 -0
  114. package/dist/gateway/GatewayTracer.d.ts +1 -1
  115. package/dist/gateway/GatewayTracer.d.ts.map +1 -1
  116. package/dist/gateway/GatewayTracer.js +2 -27
  117. package/dist/gateway/LocalGatewayTaskRunner.d.ts.map +1 -1
  118. package/dist/gateway/LocalGatewayTaskRunner.js +13 -1
  119. package/dist/index.d.ts +24 -0
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +13 -0
  122. package/dist/permissions/PermissionGate.d.ts +44 -0
  123. package/dist/permissions/PermissionGate.d.ts.map +1 -0
  124. package/dist/permissions/PermissionGate.js +97 -0
  125. package/dist/providers/ConfiguredEmbeddings.d.ts +43 -0
  126. package/dist/providers/ConfiguredEmbeddings.d.ts.map +1 -0
  127. package/dist/providers/ConfiguredEmbeddings.js +87 -0
  128. package/dist/providers/ConfiguredModelScope.d.ts +70 -0
  129. package/dist/providers/ConfiguredModelScope.d.ts.map +1 -0
  130. package/dist/providers/ConfiguredModelScope.js +117 -0
  131. package/dist/providers/ConfiguredProvider.d.ts +84 -0
  132. package/dist/providers/ConfiguredProvider.d.ts.map +1 -0
  133. package/dist/providers/ConfiguredProvider.js +271 -0
  134. package/dist/providers/ModelServiceError.d.ts +14 -0
  135. package/dist/providers/ModelServiceError.d.ts.map +1 -0
  136. package/dist/providers/ModelServiceError.js +67 -0
  137. package/dist/providers/MswarmWorkerProvider.d.ts.map +1 -1
  138. package/dist/providers/MswarmWorkerProvider.js +4 -0
  139. package/dist/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
  140. package/dist/providers/OpenAiCompatibleProvider.js +140 -52
  141. package/dist/providers/ProviderTypes.d.ts +16 -0
  142. package/dist/providers/ProviderTypes.d.ts.map +1 -1
  143. package/dist/providers/RequestUsage.d.ts +11 -0
  144. package/dist/providers/RequestUsage.d.ts.map +1 -0
  145. package/dist/providers/RequestUsage.js +33 -0
  146. package/dist/runtime/CodaliJobRuntime.d.ts +6 -0
  147. package/dist/runtime/CodaliJobRuntime.d.ts.map +1 -1
  148. package/dist/runtime/CodaliJobRuntime.js +36 -1
  149. package/dist/runtime/CodaliRuntime.d.ts +31 -0
  150. package/dist/runtime/CodaliRuntime.d.ts.map +1 -1
  151. package/dist/runtime/CodaliRuntime.js +72 -1
  152. package/dist/runtime/CompletionReport.d.ts +5 -0
  153. package/dist/runtime/CompletionReport.d.ts.map +1 -0
  154. package/dist/runtime/CompletionReport.js +12 -0
  155. package/dist/runtime/ProgressTracker.d.ts +17 -0
  156. package/dist/runtime/ProgressTracker.d.ts.map +1 -0
  157. package/dist/runtime/ProgressTracker.js +27 -0
  158. package/dist/runtime/RequestedTestEvidence.d.ts +12 -0
  159. package/dist/runtime/RequestedTestEvidence.d.ts.map +1 -0
  160. package/dist/runtime/RequestedTestEvidence.js +16 -0
  161. package/dist/runtime/RequiredRetrieval.d.ts +13 -0
  162. package/dist/runtime/RequiredRetrieval.d.ts.map +1 -0
  163. package/dist/runtime/RequiredRetrieval.js +25 -0
  164. package/dist/runtime/ReviewContract.d.ts +35 -0
  165. package/dist/runtime/ReviewContract.d.ts.map +1 -0
  166. package/dist/runtime/ReviewContract.js +131 -0
  167. package/dist/runtime/ReviewCoordinator.d.ts +41 -0
  168. package/dist/runtime/ReviewCoordinator.d.ts.map +1 -0
  169. package/dist/runtime/ReviewCoordinator.js +81 -0
  170. package/dist/runtime/ReviewSource.d.ts +9 -0
  171. package/dist/runtime/ReviewSource.d.ts.map +1 -0
  172. package/dist/runtime/ReviewSource.js +54 -0
  173. package/dist/runtime/Runner.d.ts +13 -0
  174. package/dist/runtime/Runner.d.ts.map +1 -1
  175. package/dist/runtime/Runner.js +225 -158
  176. package/dist/runtime/SecretRedaction.d.ts +11 -0
  177. package/dist/runtime/SecretRedaction.d.ts.map +1 -0
  178. package/dist/runtime/SecretRedaction.js +85 -0
  179. package/dist/runtime/SessionController.d.ts +150 -0
  180. package/dist/runtime/SessionController.d.ts.map +1 -0
  181. package/dist/runtime/SessionController.js +1487 -0
  182. package/dist/runtime/StructuralEvidence.d.ts +22 -0
  183. package/dist/runtime/StructuralEvidence.d.ts.map +1 -0
  184. package/dist/runtime/StructuralEvidence.js +87 -0
  185. package/dist/runtime/TaskReview.d.ts +25 -0
  186. package/dist/runtime/TaskReview.d.ts.map +1 -0
  187. package/dist/runtime/TaskReview.js +84 -0
  188. package/dist/runtime/TaskReviewContext.d.ts +71 -0
  189. package/dist/runtime/TaskReviewContext.d.ts.map +1 -0
  190. package/dist/runtime/TaskReviewContext.js +50 -0
  191. package/dist/runtime/UsageReconciliation.d.ts +28 -0
  192. package/dist/runtime/UsageReconciliation.d.ts.map +1 -0
  193. package/dist/runtime/UsageReconciliation.js +68 -0
  194. package/dist/runtime/ValidationOutput.d.ts +5 -0
  195. package/dist/runtime/ValidationOutput.d.ts.map +1 -0
  196. package/dist/runtime/ValidationOutput.js +32 -0
  197. package/dist/runtime/VerificationCommand.d.ts +5 -0
  198. package/dist/runtime/VerificationCommand.d.ts.map +1 -0
  199. package/dist/runtime/VerificationCommand.js +76 -0
  200. package/dist/runtime/VerificationReceiptSelection.d.ts +15 -0
  201. package/dist/runtime/VerificationReceiptSelection.d.ts.map +1 -0
  202. package/dist/runtime/VerificationReceiptSelection.js +30 -0
  203. package/dist/runtime/WorkStatusPage.d.ts +15 -0
  204. package/dist/runtime/WorkStatusPage.d.ts.map +1 -0
  205. package/dist/runtime/WorkStatusPage.js +58 -0
  206. package/dist/runtime/WorkspaceLedger.d.ts +13 -0
  207. package/dist/runtime/WorkspaceLedger.d.ts.map +1 -0
  208. package/dist/runtime/WorkspaceLedger.js +145 -0
  209. package/dist/runtime/WorkspaceLock.d.ts.map +1 -1
  210. package/dist/runtime/WorkspaceLock.js +20 -17
  211. package/dist/runtime/WorkspaceSnapshot.d.ts +13 -0
  212. package/dist/runtime/WorkspaceSnapshot.d.ts.map +1 -0
  213. package/dist/runtime/WorkspaceSnapshot.js +88 -0
  214. package/dist/session/AtomicState.d.ts +13 -0
  215. package/dist/session/AtomicState.d.ts.map +1 -0
  216. package/dist/session/AtomicState.js +123 -0
  217. package/dist/session/SessionStoragePath.d.ts +15 -0
  218. package/dist/session/SessionStoragePath.d.ts.map +1 -0
  219. package/dist/session/SessionStoragePath.js +101 -0
  220. package/dist/session/SessionStore.d.ts +9 -0
  221. package/dist/session/SessionStore.d.ts.map +1 -1
  222. package/dist/session/SessionStore.js +181 -47
  223. package/dist/session/WorkState.d.ts +32 -0
  224. package/dist/session/WorkState.d.ts.map +1 -0
  225. package/dist/session/WorkState.js +399 -0
  226. package/dist/session/WorkTypes.d.ts +102 -0
  227. package/dist/session/WorkTypes.d.ts.map +1 -0
  228. package/dist/session/WorkTypes.js +1 -0
  229. package/dist/tools/ToolRegistry.d.ts +2 -0
  230. package/dist/tools/ToolRegistry.d.ts.map +1 -1
  231. package/dist/tools/ToolRegistry.js +12 -2
  232. package/dist/tools/ToolTypes.d.ts +16 -0
  233. package/dist/tools/ToolTypes.d.ts.map +1 -1
  234. package/dist/tools/docdex/DocdexTools.d.ts +2 -0
  235. package/dist/tools/docdex/DocdexTools.d.ts.map +1 -1
  236. package/dist/tools/docdex/DocdexTools.js +17 -2
  237. package/dist/tools/filesystem/FileTools.d.ts.map +1 -1
  238. package/dist/tools/filesystem/FileTools.js +30 -10
  239. package/dist/tools/shell/AsyncProcess.d.ts +19 -0
  240. package/dist/tools/shell/AsyncProcess.d.ts.map +1 -0
  241. package/dist/tools/shell/AsyncProcess.js +94 -0
  242. package/dist/tools/shell/DarwinRuntimeLibraries.d.ts +13 -0
  243. package/dist/tools/shell/DarwinRuntimeLibraries.d.ts.map +1 -0
  244. package/dist/tools/shell/DarwinRuntimeLibraries.js +130 -0
  245. package/dist/tools/shell/HostToolchain.d.ts +19 -0
  246. package/dist/tools/shell/HostToolchain.d.ts.map +1 -0
  247. package/dist/tools/shell/HostToolchain.js +266 -0
  248. package/dist/tools/shell/IsolatedExecutor.d.ts +15 -0
  249. package/dist/tools/shell/IsolatedExecutor.d.ts.map +1 -0
  250. package/dist/tools/shell/IsolatedExecutor.js +138 -0
  251. package/dist/tools/shell/ShellTool.d.ts.map +1 -1
  252. package/dist/tools/shell/ShellTool.js +9 -29
  253. package/dist/tools/shell/ShellWorkingDirectory.d.ts +3 -0
  254. package/dist/tools/shell/ShellWorkingDirectory.d.ts.map +1 -0
  255. package/dist/tools/shell/ShellWorkingDirectory.js +30 -0
  256. package/package.json +27 -24
package/CHANGELOG.md CHANGED
@@ -2,6 +2,59 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Retry transient Windows state-file replacement conflicts without deleting the
6
+ previous state or suppressing permanent errors. Retain file durability checks.
7
+ - Resolve native macOS Git within the selected developer installation so sandboxed
8
+ repository inspection works without launching the Xcode wrapper.
9
+
10
+ ## 0.1.135-codali.3 - 2026-10-26
11
+
12
+ - Allow bounded Git diff/status inspection within the final validation budget;
13
+ keep edits blocked and require actual test evidence before verifying code.
14
+ - Disable terminal echo before displaying the API-key prompt, preventing fast
15
+ input from being echoed. Verify masked entry, backspace, cancellation, key
16
+ rotation, logout, credential-cache refresh and bounded piped input.
17
+
18
+ - Tagged candidate; publication was cancelled after Windows CI exposed a
19
+ transient state-file replacement failure addressed above.
20
+
21
+ ## 0.1.135-codali.2 - 2026-10-26
22
+
23
+ - Keep core tool definitions available across task handoffs, while requiring a
24
+ fresh task claim before execution. Record advertised tools for diagnosis.
25
+ - Explain stale verification with affected tasks and changed inputs so agents
26
+ can revalidate existing work without replacing the plan.
27
+ - Preserve Windows workspace identity across short-path aliases and repair
28
+ interrupted transcript tails. Retain mandatory file flushes on every platform.
29
+ - Resolve macOS Python native library dependencies within the shell sandbox,
30
+ including Homebrew SSL libraries, without mounting broad installation roots.
31
+ - Internal validation prerelease for the `next` channel. Quality evaluation,
32
+ consumer rollout and the 24-hour canary remain open promotion gates.
33
+
34
+ ## 0.1.135-codali.1 - 2026-10-26
35
+
36
+ - Internal terminal CLI prerelease with mSwarm authentication, configuration-driven
37
+ model roles and effort, durable goals and tasks, scoped permissions, asynchronous
38
+ shell execution, session recovery, and interactive or JSONL operation.
39
+ - Add managed Docdex with verified runtime artifacts, pinned embedding identity,
40
+ public embedding transport, memory persistence, and success/failure usage receipts.
41
+ - Add durable image, audio, and video jobs with artifact checksums and recovery.
42
+ - Preserve native Strata reasoning metadata and shared orchestration budgets;
43
+ correct false worker-substitution diagnostics for embedded consumers.
44
+ - This tagged candidate was not published: platform qualification exposed
45
+ macOS runtime and Windows persistence issues addressed in codali.2.
46
+
47
+ ## 0.1.134 - 2026-10-25
48
+
49
+ - Forward final synthesis schemas and preserve OpenAI tool-call history.
50
+ - Merge prompt-only format constraints into the initial system message.
51
+ - Surface JSON error envelopes after HTTP 200 keepalives with bounded,
52
+ credential-redacted diagnostics.
53
+ - Bound combined local worker tool results by UTF-8 bytes while preserving
54
+ their audit records and truncation notices.
55
+
56
+ ## Earlier changes
57
+
5
58
  - Report the run's grounding mode on `CodaliResult`. An `open` run answers from
6
59
  the model and deliberately carries no sources, which a host could not tell
7
60
  apart from a search that found nothing: okacam's chat suppresses any answer
@@ -0,0 +1,462 @@
1
+ # Orchestration configuration
2
+
3
+ The JSON file declares providers, model identities, role bindings, effort limits
4
+ and task-control policy. It contains credential references, never secret values.
5
+ The loader rejects unknown fields, undeclared models, alias cycles, unsafe URLs,
6
+ unsupported operations and policies that allow more than one workspace writer.
7
+ The packaged `config/orchestration.schema.json` describes the structural contract;
8
+ the runtime additionally validates references, backend intersections and URL trust.
9
+
10
+ Providers use `mswarm` or `openai-compatible`, with `baseUrl` and optional
11
+ `credentialRef: "env:VARIABLE"`. mSwarm requires a credential reference. Catalog
12
+ and usage URLs must share the provider origin. HTTPS is required except for local
13
+ loopback development. Redirects do not receive credentials.
14
+
15
+ Every model declares `provider`, `catalogId`, `revision`, `operations`,
16
+ `contextWindow` and `maxOutputTokens`. Optional properties identify `backend`,
17
+ `host`, `resourcePool`, tool/streaming support and embedding dimensions. A catalog
18
+ that does not expose an artifact revision must be labeled `catalog-unversioned`;
19
+ that label is not a verified weight checksum. Configuration hashes identify the
20
+ effective routing policy, not a physical model artifact.
21
+
22
+ Operations are `chat.completions`, `embeddings`, `images.generations`,
23
+ `audio.generations` and `videos.generations`. A binding declares ordered
24
+ `candidates`, aliases another binding using `useBinding`, or is explicitly
25
+ disabled. Aliases inherit all backend restrictions along their chain. Discovery
26
+ only filters declared candidates; it never adds unconfigured routes. If no
27
+ candidate is eligible, execution fails before dispatch. A submitted request is
28
+ not automatically replayed against another host.
29
+
30
+ The lead owns task progression. `reviewer` independently evaluates evidence;
31
+ `helper` accepts a bounded capsule and returns a draft with source references.
32
+ Helpers cannot execute tools or grant permissions. `image`, `audio` and `video`
33
+ bind generation operations. Media parameters are checked against advertised
34
+ formats and limits, and every artifact records its model, config hash and SHA-256.
35
+ Roles such as `planner`, `architect`, `worker`, `router`, `repair`, `compactor`,
36
+ `adjudicator`, `synthesizer` and `verifier` can explicitly alias the lead. Disabled
37
+ optional capabilities do not silently invoke a model from daemon defaults.
38
+
39
+ Effort controls shared limits, not a claim about hidden model reasoning:
40
+
41
+ | Effort | Steps | Model calls | Tool calls | Total tokens | Time |
42
+ | --- | ---: | ---: | ---: | ---: | ---: |
43
+ | low | 12 | 12 | 12 | 32,000 | 5 min |
44
+ | medium | 32 | 36 | 48 | 128,000 | 15 min |
45
+ | high | 64 | 72 | 128 | 320,000 | 30 min |
46
+ | max | 128 | 144 | 256 | 640,000 | 60 min |
47
+
48
+ An `effort` object may override positive integer limits by level. Provider output
49
+ and context limits remain enforced. Native `reasoning_effort`, `reasoning_budget`,
50
+ `reasoning_budget_tokens` or `enable_thinking` settings belong in that model's `reasoning` mapping only after
51
+ the adapter has been tested with them. Unreported usage is estimated and shown as
52
+ such; an unknown server balance is not treated as a known zero balance.
53
+
54
+ The Raijin/Suku example maps low to native `none`, medium to `low` with a
55
+ 512-token thinking cap, and high/max to `high` with a 1,024-token cap. These are
56
+ request settings; `/status` and model-route events expose them without claiming
57
+ that an older server applied them. Both the mSwarm proxy and node must contain
58
+ the native-reasoning transport update before enabling this profile in service.
59
+ The CLI checks the proxy's authenticated model catalog before dispatching inference.
60
+ Discovery, authentication, capability and context refusals release provisional
61
+ token reservations and persist a `not_dispatched` receipt across resume. Failures
62
+ after the transport handoff retain provisional usage until server reconciliation.
63
+ Read-only model and native-capability discovery may retry an explicit temporary
64
+ service failure twice, with bounded backoff. Authentication, entitlement, quota
65
+ and malformed-response failures are not retried. Server backoff longer than five
66
+ seconds is returned to the caller; inference submissions are never replayed by
67
+ this discovery policy.
68
+ The selected model must advertise `native_reasoning.transport_version: 1`
69
+ and every requested parameter. The proxy publishes this contract for pinned nodes
70
+ advertising `native_reasoning_transport_version: 1`, and rejects native requests to older
71
+ nodes before dispatch. A generic `supports_reasoning` flag is insufficient.
72
+ Load-balanced aliases do not yet advertise this contract; configure explicit
73
+ candidate models on each host for native-reasoning failover. Direct compatible
74
+ providers retain their explicitly configured native parameter contract.
75
+ Node requests retain the approved model and endpoint, preserve the source
76
+ profile hash, and record a distinct effective hash when a request overrides
77
+ native reasoning. The shared output/token/deadline limits still apply. A native
78
+ thinking cap of zero means no separate thinking cap, not zero thinking tokens;
79
+ use `reasoning_effort: "none"` to disable it on Strata.
80
+
81
+ Configuration changes apply between turns using `/config reload`. Saved grants
82
+ are revoked when reloading. Jobs already submitted retain their pinned provider,
83
+ model and request. Switching a retrieval embedding space requires explicit index
84
+ migration; changing a role alias does not make incompatible vectors compatible.
85
+
86
+ The Raijin/Suku example deliberately leaves unqualified specialist and embedding
87
+ routes disabled. Use `setup` to generate identifiers authorized for your account,
88
+ then qualify and enable optional bindings. GPU free space alone is insufficient
89
+ to admit another resident model or a concurrent media workload.
90
+
91
+ An enabled `embedding` binding requires a pinned artifact revision, explicit
92
+ `embeddingDimensions`, and an `embedding` object declaring `queryPrefix`,
93
+ `documentPrefix`, `normalization` (`none` or `l2`) and `pooling`. All fallback
94
+ candidates must share that exact embedding contract. For example, a qualified
95
+ Nomic service may use `search_query: `, `search_document: `, `l2`, `mean` and 768
96
+ dimensions; confirm these against the deployed artifact before configuring it.
97
+ Use `mcoda agent add/update --config-model-digest sha256:<artifact checksum>`
98
+ and an `embeddings` operation with `limits.embeddingDimensions` to expose a
99
+ qualified runner. Declare its preprocessing with `--config-embedding-json`
100
+ using the four explicit fields above; `none` removes that metadata. Setup selects
101
+ healthy catalog entries only when digest, dimensions and preprocessing are all
102
+ present, and groups identical contracts as replicas. The mSwarm catalog and
103
+ response must attest the pinned digest.
104
+
105
+ With this binding enabled, the terminal controller owns a private Docdex process.
106
+ Repository embeddings pass through the configured provider and shared session
107
+ budget. Docdex text inference uses the configured helper, or the lead when no
108
+ helper is enabled. Private indexes live outside the repository, are separated by
109
+ embedding-space identity, and are reused on restart. The session also pins its
110
+ space; an incompatible upgrade requires a separate index and session. Query and
111
+ document receipts retain purpose, model, configuration hash and reported usage.
112
+
113
+ The managed daemon must advertise workspace-metadata control, query/document
114
+ embedding input types, strict repository embeddings and deterministic profile
115
+ embeddings. An older daemon fails startup with an explicit compatibility error.
116
+ `docdex.binary` selects an installed qualified binary; `binarySha256` pins its
117
+ bytes and is checked before every managed launch. `startupTimeoutMs` bounds
118
+ startup. Setup uses the packaged release artifact manifest for a private install,
119
+ or validates the explicit `--docdex-binary` path through `runtime-info`. It does
120
+ not rewrite Git ignore files or create repository-local metadata.
121
+ Global profile preferences use separate persistent deterministic hash storage,
122
+ which makes no LLM call and survives repository embedding upgrades. Failed remote
123
+ repository embeddings never substitute vectors from this hash space.
124
+
125
+ Large plans remain complete in durable storage. The model context reserves the
126
+ original goal, constraints, active task criteria and applicable architecture
127
+ decisions, while paging unrelated work out of the prompt. `work_status` supports
128
+ `offset`/`limit`, `taskIds` and `requirementIds`. Every required criterion remains
129
+ subject to the final completion gate. A changed prerequisite or superseded
130
+ decision invalidates dependent attempts before another write can proceed.
131
+
132
+ Before editing existing source, the controller requires a current file read and
133
+ successful symbols/AST plus impact-graph receipts for that content hash. Parser
134
+ skips and failed requests do not satisfy the gate. Index ingestion uses the bound
135
+ repository's absolute paths, independent of the daemon's working directory.
136
+ An empty dependency graph is still incomplete dependency evidence: review imports
137
+ and relevant callers, and verify behavior with tests.
138
+
139
+ Direct English instructions to add/write/extend tests have an additional
140
+ evidence check: the session must have changed a surviving test source relative
141
+ to its original workspace baseline. An unchanged passing suite, deleted test,
142
+ symlink or JSON fixture alone does not satisfy that check. This recognizes a
143
+ bounded set of direct instruction forms; it is not a general requirement
144
+ parser. Independent review still evaluates meaningful coverage and the full
145
+ request, including instructions outside those forms.
146
+
147
+ Review receives the actual changed-file list and scoped test source, including
148
+ unchanged tests. Source hashes must match the checked inputs. Review text is
149
+ bounded; large/truncated inputs are explicit and binary artifacts are represented
150
+ by checksums and tool receipts. Review must reject unavailable evidence needed
151
+ to decide correctness. Passing a test or obtaining reviewer approval alone does
152
+ not establish a universal correctness guarantee; observed false completions
153
+ remain release blockers and become regression fixtures.
154
+ If a provider returns an explicit rejection with one finding as a string, the
155
+ controller retains that finding as a one-item list so the agent can repair the
156
+ defect. This normalization cannot turn a malformed approval into acceptance.
157
+
158
+ Review begins with separate specification-only calls, before implementation,
159
+ tests, diffs or claimed results are supplied. Each source is presented as a
160
+ lossless array of excerpts. The model selects a source ID and zero-based excerpt
161
+ index; the controller supplies the exact quotation, preserving whitespace and
162
+ Unicode boundaries. Invalid indexes, conflicting quotations and omitted sources
163
+ cannot establish acceptance. Legacy quoted responses remain valid only when
164
+ their text occurs verbatim in the identified source. Large
165
+ contracts use at most sixteen bounded source groups, with every original source
166
+ retained as context in every call. Text already contained verbatim in the current
167
+ goal is supplied once; all canonical criterion IDs remain in the actual review.
168
+ The review checklist stores repeated quotations once per source and retains each
169
+ check with a reference to that exact quotation; no expected behavior is dropped.
170
+ One format repair per group is permitted; invalid source attribution or missing coverage
171
+ cannot establish acceptance. The checklist supplements the full original
172
+ contract and does not prove correctness. Both preparation and source review use
173
+ the smaller of the configured effort output limit and reviewer model limits,
174
+ reserving that output space in the smallest compatible context window. Native
175
+ reasoning settings remain in the model configuration; no host defaults change.
176
+ Terminal review requests plain model output and strictly parses the JSON protocol
177
+ locally. This preserves the received response and usage when a model emits invalid
178
+ JSON; a native structured-output validator would otherwise reject it before the
179
+ controller can inspect it. Source review permits one format-only repair with the
180
+ complete original authority retained, at most six calls including four source
181
+ rounds and a verdict. This does not retry unknown transport failures or turn an
182
+ invalid or contradictory approval into accepted evidence. Explicit native
183
+ `structured_output_failed` errors elsewhere are classified as `invalid_response`
184
+ without exposing upstream response content.
185
+
186
+ The reviewer can request additional source pages before deciding. Requests are
187
+ read-only and restricted to the current review paths; each page rechecks the
188
+ validated file hash. Four request rounds, eight pages per round and the smallest
189
+ configured reviewer context bound the process. Every model call shares the
190
+ session's usage and effort budget. Repeated requests, exhausted context, missing
191
+ evidence or edits during review cannot establish acceptance. Secrets are redacted
192
+ before paging, including credentials that cross page boundaries.
193
+ Omitting a source-request offset continues at the controller's exact unread
194
+ cursor, including an initial page shorter than 8,000 characters. Whole-goal
195
+ reviews reference repeated requirement text by its exact position in the intact
196
+ goal and identify the checked snapshot with one digest. Full per-file hashes
197
+ remain in controller validation and durable evidence; this saves prompt space
198
+ without summarizing the contract or relaxing freshness checks.
199
+
200
+ Ordinary task review includes its assigned requirements, owned changes and diff,
201
+ plus relevant read-only dependencies. Other tasks' pending deliverables remain
202
+ in the canonical backlog. A task assigned the original whole-objective criterion
203
+ receives the complete current goal and all changes for integration review.
204
+ Both review scopes retain the same global validation and source-freshness checks.
205
+ Whole-goal integration also reviews every canonical refined criterion. When all
206
+ other active tasks are already verified, the controller first reassesses each
207
+ owner's criteria and read dependencies against the final files. It then supplies
208
+ those successful assessments, bound to one full-workspace digest, to the final
209
+ integration review and to later scoped reassessments, such as delivery inventories.
210
+ Assessed module source remains available for hash-checked
211
+ paging; only remaining source and diff are loaded initially. Initial source
212
+ allocation reserves context space for later pages. Original requirements,
213
+ constraints, architecture decisions and cross-task interactions still govern
214
+ integration acceptance. A failed scoped assessment stops the sequence without
215
+ renewing any proof. Only an accepted final-tree integration review records
216
+ new full-snapshot proofs for those owners, linked to the shared integration
217
+ assessment and their prior evidence. Original proofs remain in the audit trail.
218
+ An assigned-task review cannot renew siblings; partial coverage, unfinished or
219
+ reopened work, stale revisions, and omitted tracked inputs cannot use this path.
220
+ Any later change to the assessed files still invalidates completion.
221
+
222
+ Terminal `model_receipt` events link usage to `model_intent` by ID and identify
223
+ the role binding. Completed receipts include the reported route and usage;
224
+ missing usage is explicitly estimated. An unknown transport outcome retains its
225
+ reservation, while a native-capability preflight refusal records zero usage and
226
+ `not_dispatched`. Usage received during cancellation is settled before the
227
+ answer is discarded. These receipts allow helper/lead usage to be compared
228
+ without attributing another role's tokens to the helper.
229
+
230
+ Terminal shell commands default to a read-only workspace. `command` contains a
231
+ single executable and `args` contains its arguments. Optional `writePaths` names
232
+ existing files/directories inside the claimed task scope; existing source below
233
+ them needs the same read/analysis preconditions, including Git-ignored source.
234
+ Narrow writable paths avoid inspecting unrelated build and dependency trees.
235
+
236
+ Use `work_release` with the current task/attempt IDs and a reason before replanning
237
+ a claimed task. It preserves the goal, criteria and historical receipts while
238
+ invalidating the old attempt. A checkpoint saves context without releasing the
239
+ claim. Rejected tool attempts are recorded and consume the shared tool budget.
240
+
241
+ Resolved credentials are registered for exact-value redaction as well as common
242
+ token-pattern detection. Stream processing buffers incomplete words so credentials
243
+ split across chunks cannot expose their prefix or tail. Human-facing output also
244
+ removes terminal control sequences; approvals retain complete operation arguments
245
+ with credential fields redacted.
246
+
247
+ ## Shared embedded model scope
248
+
249
+ `ConfiguredModelScope` pins a validated configuration and effort at invocation start. Every role provider shares call/token reservations, a deadline and cancellation. Missing or failed usage retains a conservative token reservation; `pendingCalls` counts unresolved accounting, not a claim that remote inference is still running. The caller persists `onEvent` intents/receipts when recovery is required.
250
+
251
+ Legacy automation can opt into the same configuration with `codali run --orchestration-config /path/models.json --effort high ...` or `codali ask --orchestration-config /path/models.json --effort low ...`. `CODALI_ORCHESTRATION_CONFIG` supplies the deployment default. For `run`, the old `--config` still selects workflow/validation settings. Explicit legacy model/provider/agent overrides are rejected when orchestration configuration is selected. Old commands without an orchestration file retain their compatibility behavior.
252
+
253
+ The configured entry points use these bindings:
254
+
255
+ | Entry point | Model bindings | Shared boundary |
256
+ | --- | --- | --- |
257
+ | Terminal `chat`/`exec` | Lead, configured helpers/reviewer, embedding and media | Durable session controller |
258
+ | Legacy `run` direct | `lead` | One scope for the command |
259
+ | Legacy `run` smart | `router`, `architect`, `worker`, optional `summarizer` and `repair` | One scope across retrieval, summarization and retries |
260
+ | Legacy `ask` and public `runCodali` API | `planner`, `worker`, `synthesizer` | One scope across classifier, planner, workers and final answer |
261
+ | `runCodaliTask` | Explicit binding or `lead` | Owned scope or validated parent scope |
262
+ | `runCodaliJob` | Each stage's explicit role or kind, including repair | One scope shared by parallel stages |
263
+
264
+ The public API accepts `{ orchestration: { resolved, effort, caller }, signal }` in its trusted dependency argument. `caller` contains the authenticated `clientIdentity` and `clientProduct`; it is pinned and accompanies both mSwarm catalog and inference calls. Do not copy model configuration or caller identity from an untrusted tenant request. Pass each tenant's approved credential reference in its resolved host configuration. Tenant tool context remains mandatory; configuring a model does not authorize operator credential fallback. Request-level media overrides are refused in configured API mode; a host can register approved media tools and explicitly authorize them through its tool context.
265
+
266
+ Runtime/job result accounting includes the configuration hash, actual selected catalog routes and cumulative shared usage. Borrowed scopes must match configuration, effort and any explicit caller identity; children never close their parent's scope. Nested tool hooks reserve from the shared tool budget. Configured CLI retrieval also meters every underlying Docdex HTTP attempt, including negotiation/retries, so a logical Docdex tool can consume more than one operation reservation. This conservative accounting is explicit rather than unmetered background work. Syntax validation uses cancellable processes.
267
+
268
+ These library and CLI paths are implemented. Production applications must still pass their trusted configuration/caller context and be deployed and tested.
269
+
270
+ The mSwarm node executor reads an operator-selected profile from the admitted
271
+ agent's registry `codaliOrchestrationPath`. Set it with
272
+ `mcoda agent update AGENT --config-orchestration-path /absolute/models.json`;
273
+ `none` restores legacy execution for rollback. This setting is never accepted
274
+ from a tenant invocation. Every declared provider must match the admitted
275
+ loopback runner and its catalog endpoint; every model must match the admitted
276
+ model, artifact when pinned, operations and capability/size limits. Calling the
277
+ public mSwarm gateway from this path is rejected. A node profile uses the same
278
+ schema and explicit role aliases as a terminal profile.
279
+
280
+ The executor resolves runner credentials from the trusted registry/auth store
281
+ into an invocation-local scope. It never sets process-global credential variables.
282
+ Direct calls, gateway planning/synthesis and job stages share that scope's model,
283
+ token, tool and cancellation limits. Required Docdex retrieval runs through the
284
+ ordinary authorized protocol/tool path without a synthetic model override or an
285
+ invented model-call receipt. A failed job propagates as a server error. The new
286
+ node path has regression coverage; production activation and live qualification
287
+ remain release requirements.
288
+
289
+ `runConfiguredGateway` uses that scope for planner and synthesizer calls; host workers obtain their role providers from the same scope. The host still owns tool policy, tool budgets and cancellation of external operations. Legacy provider/planner overrides are rejected. If the gateway requires a final large model, every configured synthesizer candidate must have an eligible assignment in the host inventory/policy before any model dispatch. Traces identify the selected catalog route; configuration host labels are not physical execution attestations.
290
+
291
+ ## Existing mcoda project tasks
292
+
293
+ Use `mcoda codali chat --project-task TASK_KEY --workspace-root /path/to/repo`, or `mcoda codali exec "Complete the existing task" --project-task TASK_KEY` with the desired permission profile. This opens an existing workspace task database; it does not initialize a project in an ordinary repository. Resume attached sessions through `mcoda codali resume SESSION_ID`. The standalone library accepts the small `ProjectTaskAuthority` contract for embedded hosts.
294
+
295
+ The project task title/description remains part of the original objective. Terminal phases/subtasks describe execution of that one parent task. `McodaProjectTaskAuthority` uses the existing `WorkspaceRepository` transaction and `TaskStateService` status-event path. Canonical task revision and predecessor status fence claims; lease renewal and checks before model/tool execution stop stale owners. A running legacy task without a Codali lease cannot be taken over. Planning permissions read project state without claiming or submitting it.
296
+
297
+ Verified local completion writes a durable submission intent, hands the task to `ready_to_code_review`, then acknowledges local completion. mcoda review and QA remain required. Replaying a lost response checks the operation ID, evidence digest, original revision and accepted revision. Recovery refuses changed inputs or a changed project review state. Session evidence cannot be deleted until the project task is completed or cancelled. A local project execution fork is refused because it would introduce another status owner.
298
+
299
+ `runConfiguredPipeline` adapts the existing cognitive pipeline to the same model scope. Its retrieval-query, architect, builder and optional interpreter use the `router`, `architect`, `worker` and `repair` bindings. Builder tool calls share a counter across retries. The embedded host remains responsible for retrieval-tool metering, a configured Docdex client, policy checks/patch permissions, memory persistence and a validator using the scope signal. Legacy callbacks that silently swap providers are rejected. These adapters are available for migration; older application call sites still require rollout and qualification before the configuration migration is complete.
300
+
301
+ `ValidationRunner` executes checks asynchronously, accepts the host cancellation signal and an optional shell executor, and preserves timeout/failure outcomes. The terminal's executor remains the isolation boundary; using an allowlisted command alone is not isolation.
302
+
303
+ Media workers persist an artifact receipt before atomically publishing the complete, synced output file. A restarted client can validate the receipt's session/job/model/configuration identity, file format, byte count and checksum, then acknowledge success without another render. An incomplete or corrupt receipt leaves the job uncertain. Reconciliation probes the SQLite execution lock rather than trusting a PID that may have been reused. This closes the local receipt crash window; remote jobs whose responses never reached the client still require backend reconciliation support or an explicitly confirmed outcome.
304
+ Durable media providers can declare `mediaJobsUrl` on the same origin as
305
+ `baseUrl`. The `mswarm-media-jobs-v1` transport persists a client UUID before
306
+ submission and reconciles by that UUID after a disconnect. Reusing a UUID with
307
+ different input is rejected. Recovery reads the original job; it does not
308
+ resubmit an uncertain render. Job summaries include the server invocation and
309
+ node IDs, cancellation acknowledgement, expiry and available usage.
310
+
311
+ The server retains a completed artifact for one hour, or until the client
312
+ acknowledges its response checksum after persisting a verified local artifact.
313
+ Expired server artifacts cannot be recovered by regenerating them silently.
314
+ Cancellation that wins before the node start acknowledgement prevents
315
+ inference. Cancellation after that boundary remains requested and unconfirmed;
316
+ disconnecting an HTTP request does not prove that a native render stopped.
317
+ Synchronous providers remain supported with explicitly limited remote recovery.
318
+ `codali setup` negotiates this API; `codali doctor` reports the selected protocol.
319
+
320
+ The isolated executor discovers host Node/npm/pnpm/yarn/bun installations outside
321
+ the workspace. On Linux it mounts only the executable or a matching package root
322
+ read-only and installs sandbox PATH aliases. It does not mount the user's home,
323
+ adjacent packages, credentials or package-manager caches. Other tools already
324
+ under system runtime paths keep working; additional private toolchains are not
325
+ implicitly exposed. The installed Raijin pnpm has passed an isolated fixture
326
+ test. Linux and macOS Node 20/22 platform CI passes the isolation/toolchain suite;
327
+ this does not replace clean-package and production qualification. The macOS adapter creates a private
328
+ temporary directory for each command, points HOME/TMPDIR there, and removes it
329
+ after process cleanup. It grants no general read/write access to other users'
330
+ temporary files. Linux uses a private temporary filesystem and pins TMPDIR to
331
+ that filesystem.
332
+
333
+ Release qualification uses `scripts/verify-codali-package-install.mjs` after
334
+ the package build. It packs twice, compares archive hashes, installs the
335
+ Codali/shared/database tarballs into an empty project, and exercises the
336
+ installed executable, public API, native SQLite and session persistence.
337
+ Configuration failures must emit valid JSON without modifying user files;
338
+ local uninstall must preserve workspace data. The platform workflow covers
339
+ Linux x64 and macOS Intel/ARM on Node 20/22. Its recorded results, rather than
340
+ the matrix definition, determine which builds are qualified. The Intel runner
341
+ uses GitHub's explicit `macos-15-intel` label; see the
342
+ [runner architecture table](https://docs.github.com/en/actions/reference/runners/github-hosted-runners).
343
+
344
+ The packer canonicalizes the packed JSON manifest because pnpm can insert
345
+ rewritten workspace dependencies in a different order between packs. Other
346
+ archive entries remain unchanged. The publisher checks all manifests and
347
+ versions before registry writes, publishes those exact tarballs, and explicitly
348
+ uses `next` for prereleases and `latest` for stable versions. An existing
349
+ version must have identical registry integrity; rerunning a release does not
350
+ move its dist-tags. Registry errors other than an explicit missing version
351
+ stop publication.
352
+
353
+ CI now builds the Linux publication tarballs once and supplies those same bytes
354
+ to every terminal installation job. `package-artifacts.json` records package
355
+ identities, SHA256 values and the CI source revision. Consumers validate those
356
+ records before installation; the release publisher consumes the qualified
357
+ bundle through `MCODA_PUBLISH_ARTIFACTS_DIR` without repacking it. Release
358
+ publication waits for the six Node/platform installation jobs. Local checks can
359
+ use `--artifacts-dir PATH`; their report leaves source revision unknown when
360
+ they were not run with a CI revision.
361
+
362
+ Codali publication also requires checksum-pinned Docdex archives for Linux
363
+ x64 GNU, macOS Intel and macOS ARM. An empty development runtime manifest is
364
+ valid for local work with an explicit qualified binary, but cannot be
365
+ published through the release script. Clean installation does not substitute
366
+ for the live routing, media, long-session and canary gates in the build plan.
367
+
368
+ ### Session storage
369
+
370
+ Session storage rejects redirected directories beneath its configured boundary,
371
+ symlink or hard-linked state files, unsafe summary references and unknown
372
+ metadata/transcript/summary versions. Host-selected external storage remains
373
+ supported; repository configuration cannot enable it. Atomic replacement syncs
374
+ the file and directory. An I/O error after rename can leave the new complete
375
+ state visible while the caller receives an error: recovery must reread the
376
+ durable revision instead of assuming rollback. These checks do not isolate the
377
+ CLI from a hostile process running as the same OS user.
378
+
379
+ ### Planning evaluation
380
+
381
+ Planning mode uses a separate planning instruction set and refuses task claims,
382
+ execution verification and goal completion at the permission gate, even if a
383
+ model fabricates a call to an unadvertised tool. It records plans and decisions
384
+ while leaving the future implementation goal open.
385
+
386
+ `eval/PlanningCorpusRunner.runPlanningCorpus` runs six bounded planning probes
387
+ through the real session controller, configured provider and `plan` permission
388
+ profile. It accepts `configPath`, a new `outputRoot`, optional `caseIds`, `effort`
389
+ and cancellation `signal`. Use a frozen package installation and retain its
390
+ manifest; the runner refuses configuration or compiled-client changes between
391
+ cases. It does not publish, execute a planned task or modify the supplied
392
+ production repositories.
393
+
394
+ The probes cover additive migration, artifact recovery, embedding-space changes,
395
+ worker fencing, connector authorization and usage accounting. Grading checks
396
+ durable requirement IDs/text, ownership, dependency reachability, narrow paths,
397
+ phases, constrained architecture choices, original intent, workspace preservation
398
+ and compaction/resume. Invented criteria and premature completion fail. The
399
+ grader's reference plans and dependency answers stay outside model workspaces;
400
+ mutation tests deliberately break each major contract.
401
+
402
+ These are closed-world planning probes with explicit criterion labels and
403
+ architecture options. Rationale grading checks presence, not its semantic
404
+ quality. Docdex is disabled because the probes contain no code; retrieval,
405
+ implementation, multi-hour retention, helper benefit and unrestricted architecture
406
+ quality require separate evidence. Reports retain failures, routes, usage and
407
+ the actual work record. A rerun used to debug a failure is diagnostic evidence,
408
+ not a fresh held-out result.
409
+
410
+ ### Workflow evaluation
411
+
412
+ Pass `terminalWorkflowCorpusDefinition()` from `eval/TerminalWorkflowCorpus`
413
+ as the `corpus` option to `runTerminalCorpus` to run twelve separate workflow
414
+ fixtures. Eight require coordinated changes in two modules and public regression
415
+ tests. Three require source-backed repository reports, and one researches pinned
416
+ fictional vendor documents. Report tasks permit only the report file to change;
417
+ their tests and source files remain immutable. This research fixture does not
418
+ measure live web retrieval.
419
+
420
+ Each corpus owns its version, content hash, task list and stated limitations.
421
+ Reference implementations and hidden assertions stay outside the agent's
422
+ workspace. The isolated grader checks behavior, public test outcomes, required
423
+ test extensions, protected files and exact change scope. Reference/starter checks
424
+ and deliberately wrong reports, test weakening and unauthorized edits validate
425
+ the grader before live runs. Retain the frozen installed client and configuration
426
+ with every result. First attempts are qualification observations; corrective
427
+ reruns must be labeled diagnostic, with the original failures preserved.
428
+
429
+ Workflow corpus v5 additionally checks immediate dispatch stopping on synchronous
430
+ worker throws, waiting for already-started workers, and preserving falsy thrown
431
+ values. This closes a gap found by live review: public async-only coverage had
432
+ accepted a faulty pool. Earlier frozen runs retain their original version, hash
433
+ and outcomes; regrading known artifacts is diagnostic evidence.
434
+
435
+ `eval/LongWorkflowJourney.runLongWorkflowJourney` composes four module contracts
436
+ into one durable goal. Select `data-delivery`, `service-adapters`, `billing-audit`
437
+ or `localized-export`, and supply `configPath` and a new `outputRoot`. Four child
438
+ processes perform planning, execution to a verified-task checkpoint, resumed
439
+ execution with an additional delivery requirement and concurrent user notes,
440
+ then final recovery. Five explicit compactions are required. Each boundary
441
+ compares the exact durable state; final grading checks the original requirements,
442
+ architecture history, dependency ordering, protected notes and module artifacts.
443
+
444
+ These journeys reuse coding contracts and measure continuity separately from
445
+ fresh coding accuracy. They retain failed stages instead of automatically
446
+ retrying them. `multiHourDurationReached` reports whether actual elapsed work
447
+ reached two hours; the runner never inserts idle time. Clean checkpoint recovery
448
+ does not replace crash/uncertain-side-effect fixtures or mixed-media tests. The
449
+ host-owned child launcher passes declared provider credentials to the CLI process
450
+ only; model-requested shell tools retain their separate restricted environment.
451
+
452
+ Focused replanning can use `work_plan` with `mode: "update"`: only the named
453
+ contracts change, and omitted tasks and phases remain canonical. The default
454
+ `replace` mode still requires the full plan. Both modes enforce required
455
+ coverage, verified task/phase immutability, dependency validity and the single
456
+ active writer rule.
457
+
458
+ Host-issued tool receipt references survive model-context truncation. Shell
459
+ receipts and independent-review excerpts preserve the beginning, a detected
460
+ failure region, and the end of bounded output; omission markers never imply
461
+ that an unretained full log is available. Successful test exit status remains
462
+ separate from whether the tests prove the requested behavior.
package/README.md CHANGED
@@ -1,6 +1,117 @@
1
1
  # @mcoda/codali
2
2
 
3
- Standalone tool-runner adapter for mcoda. codali runs a tool loop that can edit the repo directly via built-in tools, with optional streaming output and pre-flight cost estimates.
3
+ Codali is mcoda's terminal coding agent and embeddable tool runtime.
4
+
5
+ ## Terminal quick start
6
+
7
+ ```sh
8
+ codali login # masked mSwarm API-key entry
9
+ codali setup # discover authorized model routes and prepare private Docdex
10
+ codali doctor
11
+ codali chat --permissions ask --effort medium
12
+ ```
13
+
14
+ For automation, inject `MCODA_MSWARM_API_KEY` through your secret manager, or pipe
15
+ the key to `codali login --stdin`. Keys are never command-line arguments. Existing
16
+ encrypted mcoda credentials are reused when their service origin matches.
17
+ `codali logout` removes the terminal credential and disables that fallback;
18
+ an explicitly supplied environment credential still takes precedence.
19
+
20
+ ```sh
21
+ codali exec 'Fix the failing parser test and verify the fix' \
22
+ --permissions workspace --effort high --json
23
+ codali sessions
24
+ codali resume SESSION_ID --permissions workspace --effort high --json
25
+ codali inspect SESSION_ID
26
+ ```
27
+
28
+ The terminal uses a versioned orchestration file: `--config PATH`, then
29
+ `CODALI_ORCHESTRATION_CONFIG`, then `~/.codali/orchestration.json`. Repository files
30
+ cannot silently select credential destinations or change terminal permissions.
31
+ See [the configuration reference](ORCHESTRATION.md) and the packaged `config/`
32
+ examples. `setup` never overwrites an existing profile. `/config reload` applies
33
+ an edited, validated profile between turns; submitted media jobs keep their
34
+ original configuration. All optional model roles must be explicitly bound or
35
+ disabled. Setup selects only catalog routes that identify their backend as Strata
36
+ for large-model work; it does not choose a paid fallback.
37
+
38
+ Setup enables embeddings only when the catalog declares a pinned model digest,
39
+ dimensions, query/document prefixes, normalization and pooling. Replicas must
40
+ match that entire contract. When embeddings are available, setup installs the
41
+ release-pinned Docdex binary in `~/.local/state/codali/runtimes/docdex/`, verifies
42
+ archive and binary checksums, and checks managed-client capabilities. It records
43
+ the binary path and checksum in the profile; sessions verify the checksum before
44
+ launching a private daemon. `doctor` checks this configured runtime.
45
+
46
+ For a locally built qualified binary, use `codali setup --docdex-binary /absolute/path/docdexd`.
47
+ Development builds without pinned release artifacts require this option. Setup
48
+ does not initialize the global daemon or overwrite its configuration. A failed
49
+ runtime qualification leaves the new profile unwritten; previous installed
50
+ runtime versions remain available for existing profiles.
51
+
52
+ | Command | Purpose |
53
+ | --- | --- |
54
+ | `/status`, `/usage` | Current execution state, reconciled accounting and server limits |
55
+ | `/permissions [plan\|ask\|workspace\|clear]` | Inspect/change policy or revoke exact session grants |
56
+ | `/effort [low\|medium\|high\|max]` | Change the shared model, tool, token and time budget between turns |
57
+ | `/goal`, `/plan`, `/tasks`, `/decisions` | Read the durable objective, criteria, dependencies and architecture decisions |
58
+ | `/models`, `/config [reload]` | Inspect configured routes and the effective configuration hash |
59
+ | `/context`, `/diff`, `/review` | Inspect retained context/changes or request a new review task |
60
+ | `/checkpoint`, `/compact` | Save progress or reduce conversation context while preserving canonical work state |
61
+ | `/cancel`, `/continue`, `/steer TEXT` | Interrupt, continue, or apply an explicit goal amendment |
62
+ | `/sessions`, `/resume ID`, `/fork`, `/new TEXT` | Manage sessions; forks require fresh verification and reset grants |
63
+ | `/artifacts` | Inspect durable image, audio and video jobs and artifact checksums |
64
+ | `/reconcile ID success\|failed NOTE` | Record an observed outcome for an interrupted tool invocation |
65
+ | `/export`, `/retention DAYS`, `/delete-session ID` | Export redacted events, preview retention candidates, or delete an inactive session |
66
+
67
+ Between turns, `/usage` reconciles up to 16 model requests with authenticated
68
+ mSwarm receipts. Repeat it if `remaining` is nonzero. Durable request IDs join
69
+ local calls to server attempts; successful reconciliation is replay-safe across
70
+ restarts. Missing, active, truncated or unreported receipts remain unresolved,
71
+ and an incomplete legacy ledger cannot reduce the shared budget. Reconciliation
72
+ requires the receipt endpoint and the original configured provider/key; older
73
+ servers return an explicit unavailable result. During a turn it is deferred.
74
+ Accounting settlement does not mark the coding task complete or replay inference.
75
+
76
+ `plan` permits reads; `ask` asks before side effects; `workspace` permits scoped
77
+ file edits and isolated shell commands. Web research, memory writes and media
78
+ generation have separate approval categories. Automation can explicitly enable
79
+ them with `--allow-web`, `--allow-memory` and `--allow-media`. Shell networking is
80
+ disabled unless `--allow-network` is supplied. Noninteractive requests for approval
81
+ are denied. Session grants match the exact tool arguments and remain subordinate
82
+ to the current policy. Linux execution requires bubblewrap; run `doctor` to check
83
+ the available platform executor.
84
+
85
+ The executor discovers installed Node/package-manager, Python and Rust tools from
86
+ the host's trusted PATH. Private Python standard libraries and the selected Rust
87
+ toolchain libraries are exposed read-only; Cargo and Python caches use a temporary
88
+ private home. Rustup proxies resolve to an already-installed host toolchain (the
89
+ host's `RUSTUP_TOOLCHAIN` or default), without repository-triggered downloads.
90
+ On macOS, the selected installed Xcode developer tools and SDK are also read-only.
91
+ Use `doctor` to inspect selected executable paths. Dependency installation still
92
+ requires network permission, and build outputs must fit the task's write scope.
93
+
94
+ Each task is tied to the original goal and a bounded path scope. A successful tool
95
+ call is not task completion: changed code needs recorded validation and separate
96
+ review, and the goal gate checks requirement coverage, current file hashes and
97
+ unresolved operations. Interruptions preserve checkpoints and uncertain outcomes;
98
+ they do not trigger an automatic retry of a side effect. Session data lives under
99
+ `~/.local/state/codali/workspaces/`, outside the editable repository. Media workers
100
+ survive terminal disconnects and keep binary artifacts out of model transcripts.
101
+
102
+ `--json` emits JSONL events. Stable fields are `schemaVersion`, `type` and `data`;
103
+ session events also carry `id`, `sessionId`, `sequence` and `at`. `turn_result`
104
+ contains `completed`; consumers must check it. `command_failed` covers command
105
+ failures. Exit codes are 0 for verified completion (or a requested planning turn),
106
+ 1 for errors, 2 for open/blocked work, and 130 for cancellation. `--plain` disables
107
+ terminal editing escapes and token streaming. Ctrl-C requests cancellation;
108
+ a second Ctrl-C closes the terminal after cleanup.
109
+
110
+ ## Legacy runtime commands
111
+
112
+ The following commands preserve the previous provider/configuration contract.
113
+ They do not automatically inherit the terminal orchestration profile. Embedded
114
+ hosts opt in with the trusted `orchestration.resolved` runtime input.
4
115
 
5
116
  ## Usage
6
117