@mcoda/codali 0.1.135-codali.2 → 0.1.135-codali.32

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 (335) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/ORCHESTRATION.md +356 -21
  3. package/README.md +234 -22
  4. package/config/AGENTS.md +17 -0
  5. package/config/browser-desktop/Dockerfile +7 -0
  6. package/config/browser-desktop/preview.py +15 -0
  7. package/config/browser-desktop/start.sh +12 -0
  8. package/config/deterministic/install-python.mjs +16 -0
  9. package/config/deterministic/node-worker.mjs +77 -0
  10. package/config/deterministic/python-worker.py +237 -0
  11. package/config/deterministic/requirements.txt +6 -0
  12. package/config/docdex-tools-0.2.99.json +3977 -0
  13. package/config/documents/install-python.mjs +16 -0
  14. package/config/documents/requirements.txt +10 -0
  15. package/config/documents/worker.py +267 -0
  16. package/config/orchestration.schema.json +131 -0
  17. package/config/skills/architecture-design/SKILL.md +14 -0
  18. package/config/skills/browser-session/SKILL.md +16 -0
  19. package/config/skills/browser-use/SKILL.md +14 -0
  20. package/config/skills/code-implementation/SKILL.md +18 -0
  21. package/config/skills/code-review/SKILL.md +14 -0
  22. package/config/skills/docdex-research/SKILL.md +18 -0
  23. package/config/skills/docdex-research/references/catalog.md +111 -0
  24. package/config/skills/docdex-research/references/memory.md +22 -0
  25. package/config/skills/docdex-research/references/operations.md +19 -0
  26. package/config/skills/docdex-research/references/retrieval.md +13 -0
  27. package/config/skills/planning/SKILL.md +14 -0
  28. package/config/skills/system-diagnostics/SKILL.md +14 -0
  29. package/config/skills/system-services/SKILL.md +17 -0
  30. package/config/skills/system-services/references/docker.md +11 -0
  31. package/config/skills/system-services/references/linux.md +9 -0
  32. package/config/skills/system-services/references/macos.md +9 -0
  33. package/config/skills/systematic-debugging/SKILL.md +14 -0
  34. package/config/skills/testing-and-verification/SKILL.md +16 -0
  35. package/config/skills/tool-selection/SKILL.md +16 -0
  36. package/config/skills/ui-ux-design/SKILL.md +16 -0
  37. package/config/skills/ui-ux-design/references/validation.md +13 -0
  38. package/config/skills/webapp-testing/SKILL.md +12 -0
  39. package/config/terminal-long-scenarios.v1.json +3 -2
  40. package/dist/cli/TerminalArtifacts.d.ts +5 -0
  41. package/dist/cli/TerminalArtifacts.d.ts.map +1 -0
  42. package/dist/cli/TerminalArtifacts.js +26 -0
  43. package/dist/cli/TerminalCommand.d.ts +2 -1
  44. package/dist/cli/TerminalCommand.d.ts.map +1 -1
  45. package/dist/cli/TerminalCommand.js +436 -100
  46. package/dist/cli/TerminalCredentials.js +2 -2
  47. package/dist/cli/TerminalInput.d.ts +13 -0
  48. package/dist/cli/TerminalInput.d.ts.map +1 -1
  49. package/dist/cli/TerminalInput.js +55 -7
  50. package/dist/cli/TerminalModels.d.ts +6 -0
  51. package/dist/cli/TerminalModels.d.ts.map +1 -0
  52. package/dist/cli/TerminalModels.js +45 -0
  53. package/dist/cli/TerminalPlan.d.ts +40 -0
  54. package/dist/cli/TerminalPlan.d.ts.map +1 -0
  55. package/dist/cli/TerminalPlan.js +37 -0
  56. package/dist/cli/ToolsCommand.d.ts.map +1 -1
  57. package/dist/cli/ToolsCommand.js +8 -1
  58. package/dist/cli/tui/TerminalCells.d.ts +6 -0
  59. package/dist/cli/tui/TerminalCells.d.ts.map +1 -0
  60. package/dist/cli/tui/TerminalCells.js +47 -0
  61. package/dist/cli/tui/TerminalEditor.d.ts +22 -0
  62. package/dist/cli/tui/TerminalEditor.d.ts.map +1 -0
  63. package/dist/cli/tui/TerminalEditor.js +88 -0
  64. package/dist/cli/tui/TerminalLogo.d.ts +6 -0
  65. package/dist/cli/tui/TerminalLogo.d.ts.map +1 -0
  66. package/dist/cli/tui/TerminalLogo.js +26 -0
  67. package/dist/cli/tui/TerminalMarkdown.d.ts +5 -0
  68. package/dist/cli/tui/TerminalMarkdown.d.ts.map +1 -0
  69. package/dist/cli/tui/TerminalMarkdown.js +118 -0
  70. package/dist/cli/tui/TerminalPresentation.d.ts +6 -0
  71. package/dist/cli/tui/TerminalPresentation.d.ts.map +1 -0
  72. package/dist/cli/tui/TerminalPresentation.js +152 -0
  73. package/dist/cli/tui/TerminalScreen.d.ts +50 -0
  74. package/dist/cli/tui/TerminalScreen.d.ts.map +1 -0
  75. package/dist/cli/tui/TerminalScreen.js +137 -0
  76. package/dist/cli/tui/TerminalSelection.d.ts +15 -0
  77. package/dist/cli/tui/TerminalSelection.d.ts.map +1 -0
  78. package/dist/cli/tui/TerminalSelection.js +38 -0
  79. package/dist/cli/tui/TerminalTui.d.ts +82 -0
  80. package/dist/cli/tui/TerminalTui.d.ts.map +1 -0
  81. package/dist/cli/tui/TerminalTui.js +564 -0
  82. package/dist/cli.d.ts.map +1 -1
  83. package/dist/cli.js +5 -3
  84. package/dist/config/OrchestrationConfig.d.ts +40 -0
  85. package/dist/config/OrchestrationConfig.d.ts.map +1 -1
  86. package/dist/config/OrchestrationConfig.js +74 -3
  87. package/dist/connectors/media/MediaJobStore.d.ts +2 -1
  88. package/dist/connectors/media/MediaJobStore.d.ts.map +1 -1
  89. package/dist/connectors/media/MediaJobStore.js +11 -3
  90. package/dist/docdex/DocdexCatalog.d.ts +12 -0
  91. package/dist/docdex/DocdexCatalog.d.ts.map +1 -0
  92. package/dist/docdex/DocdexCatalog.js +30 -0
  93. package/dist/docdex/DocdexClient.d.ts +9 -2
  94. package/dist/docdex/DocdexClient.d.ts.map +1 -1
  95. package/dist/docdex/DocdexClient.js +86 -11
  96. package/dist/docdex/ManagedDocdex.d.ts +4 -0
  97. package/dist/docdex/ManagedDocdex.d.ts.map +1 -1
  98. package/dist/docdex/ManagedDocdex.js +42 -5
  99. package/dist/eval/TerminalWorkflowCorpus.d.ts +1 -1
  100. package/dist/eval/TerminalWorkflowCorpus.d.ts.map +1 -1
  101. package/dist/eval/TerminalWorkflowCorpus.js +9 -6
  102. package/dist/eval/TrustBenchmark.d.ts +94 -0
  103. package/dist/eval/TrustBenchmark.d.ts.map +1 -0
  104. package/dist/eval/TrustBenchmark.js +199 -0
  105. package/dist/eval/fixtures/ContractReviewProvider.d.ts +4 -0
  106. package/dist/eval/fixtures/ContractReviewProvider.d.ts.map +1 -0
  107. package/dist/eval/fixtures/ContractReviewProvider.js +10 -0
  108. package/dist/eval/fixtures/MixedMediaRecoveryJourney.d.ts +6 -0
  109. package/dist/eval/fixtures/MixedMediaRecoveryJourney.d.ts.map +1 -0
  110. package/dist/eval/fixtures/MixedMediaRecoveryJourney.js +145 -0
  111. package/dist/eval/fixtures/TerminalRecoveryJourney.d.ts.map +1 -1
  112. package/dist/eval/fixtures/TerminalRecoveryJourney.js +14 -1
  113. package/dist/gateway/GroundingMode.d.ts.map +1 -1
  114. package/dist/gateway/GroundingMode.js +23 -3
  115. package/dist/index.d.ts +1 -0
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +1 -0
  118. package/dist/permissions/PermissionGate.d.ts +1 -1
  119. package/dist/permissions/PermissionGate.d.ts.map +1 -1
  120. package/dist/permissions/PermissionGate.js +45 -5
  121. package/dist/permissions/WorkspacePermissions.d.ts +11 -0
  122. package/dist/permissions/WorkspacePermissions.d.ts.map +1 -0
  123. package/dist/permissions/WorkspacePermissions.js +42 -0
  124. package/dist/providers/ConfiguredModelScope.d.ts +1 -0
  125. package/dist/providers/ConfiguredModelScope.d.ts.map +1 -1
  126. package/dist/providers/ConfiguredModelScope.js +19 -2
  127. package/dist/providers/ConfiguredProvider.d.ts +6 -0
  128. package/dist/providers/ConfiguredProvider.d.ts.map +1 -1
  129. package/dist/providers/ConfiguredProvider.js +88 -34
  130. package/dist/providers/ModelCapacityWait.d.ts +21 -0
  131. package/dist/providers/ModelCapacityWait.d.ts.map +1 -0
  132. package/dist/providers/ModelCapacityWait.js +40 -0
  133. package/dist/providers/ModelServiceError.d.ts +16 -2
  134. package/dist/providers/ModelServiceError.d.ts.map +1 -1
  135. package/dist/providers/ModelServiceError.js +37 -5
  136. package/dist/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
  137. package/dist/providers/OpenAiCompatibleProvider.js +26 -3
  138. package/dist/providers/ProviderTypes.d.ts +6 -0
  139. package/dist/providers/ProviderTypes.d.ts.map +1 -1
  140. package/dist/providers/RequestSize.d.ts +5 -0
  141. package/dist/providers/RequestSize.d.ts.map +1 -0
  142. package/dist/providers/RequestSize.js +10 -0
  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/AnswerVerification.d.ts +17 -0
  147. package/dist/runtime/AnswerVerification.d.ts.map +1 -0
  148. package/dist/runtime/AnswerVerification.js +39 -0
  149. package/dist/runtime/CodaliRuntime.d.ts +1 -0
  150. package/dist/runtime/CodaliRuntime.d.ts.map +1 -1
  151. package/dist/runtime/CodaliRuntime.js +1 -0
  152. package/dist/runtime/CompletionReport.d.ts +2 -0
  153. package/dist/runtime/CompletionReport.d.ts.map +1 -1
  154. package/dist/runtime/CompletionReport.js +17 -0
  155. package/dist/runtime/ComputedAnswer.d.ts +13 -0
  156. package/dist/runtime/ComputedAnswer.d.ts.map +1 -0
  157. package/dist/runtime/ComputedAnswer.js +75 -0
  158. package/dist/runtime/ContextCompression.d.ts +38 -0
  159. package/dist/runtime/ContextCompression.d.ts.map +1 -0
  160. package/dist/runtime/ContextCompression.js +263 -0
  161. package/dist/runtime/GatewayRequest.d.ts +5 -0
  162. package/dist/runtime/GatewayRequest.d.ts.map +1 -0
  163. package/dist/runtime/GatewayRequest.js +19 -0
  164. package/dist/runtime/InspectionBudget.d.ts +11 -0
  165. package/dist/runtime/InspectionBudget.d.ts.map +1 -0
  166. package/dist/runtime/InspectionBudget.js +23 -0
  167. package/dist/runtime/InspectionConvergence.d.ts +24 -0
  168. package/dist/runtime/InspectionConvergence.d.ts.map +1 -0
  169. package/dist/runtime/InspectionConvergence.js +67 -0
  170. package/dist/runtime/InteractionContract.d.ts +44 -0
  171. package/dist/runtime/InteractionContract.d.ts.map +1 -0
  172. package/dist/runtime/InteractionContract.js +64 -0
  173. package/dist/runtime/InteractionRouter.d.ts +73 -0
  174. package/dist/runtime/InteractionRouter.d.ts.map +1 -0
  175. package/dist/runtime/InteractionRouter.js +138 -0
  176. package/dist/runtime/PlanCoverage.d.ts +9 -0
  177. package/dist/runtime/PlanCoverage.d.ts.map +1 -0
  178. package/dist/runtime/PlanCoverage.js +12 -0
  179. package/dist/runtime/PreparedDocdex.d.ts +4 -0
  180. package/dist/runtime/PreparedDocdex.d.ts.map +1 -0
  181. package/dist/runtime/PreparedDocdex.js +55 -0
  182. package/dist/runtime/PreparedMemory.d.ts +3 -0
  183. package/dist/runtime/PreparedMemory.d.ts.map +1 -0
  184. package/dist/runtime/PreparedMemory.js +30 -0
  185. package/dist/runtime/ProgressTracker.d.ts +1 -0
  186. package/dist/runtime/ProgressTracker.d.ts.map +1 -1
  187. package/dist/runtime/ProgressTracker.js +25 -5
  188. package/dist/runtime/ResearchEvidence.d.ts +19 -0
  189. package/dist/runtime/ResearchEvidence.d.ts.map +1 -0
  190. package/dist/runtime/ResearchEvidence.js +55 -0
  191. package/dist/runtime/ReviewContract.d.ts +35 -0
  192. package/dist/runtime/ReviewContract.d.ts.map +1 -0
  193. package/dist/runtime/ReviewContract.js +132 -0
  194. package/dist/runtime/ReviewCoordinator.d.ts +43 -0
  195. package/dist/runtime/ReviewCoordinator.d.ts.map +1 -0
  196. package/dist/runtime/ReviewCoordinator.js +134 -0
  197. package/dist/runtime/ReviewSource.d.ts +3 -0
  198. package/dist/runtime/ReviewSource.d.ts.map +1 -1
  199. package/dist/runtime/ReviewSource.js +17 -1
  200. package/dist/runtime/Runner.d.ts.map +1 -1
  201. package/dist/runtime/Runner.js +6 -1
  202. package/dist/runtime/SessionController.d.ts +71 -5
  203. package/dist/runtime/SessionController.d.ts.map +1 -1
  204. package/dist/runtime/SessionController.js +1913 -223
  205. package/dist/runtime/SpecialistTools.d.ts +6 -0
  206. package/dist/runtime/SpecialistTools.d.ts.map +1 -0
  207. package/dist/runtime/SpecialistTools.js +69 -0
  208. package/dist/runtime/StructuralEvidence.d.ts +4 -2
  209. package/dist/runtime/StructuralEvidence.d.ts.map +1 -1
  210. package/dist/runtime/StructuralEvidence.js +22 -5
  211. package/dist/runtime/TaskReview.d.ts +25 -0
  212. package/dist/runtime/TaskReview.d.ts.map +1 -0
  213. package/dist/runtime/TaskReview.js +109 -0
  214. package/dist/runtime/TaskReviewContext.d.ts +37 -0
  215. package/dist/runtime/TaskReviewContext.d.ts.map +1 -1
  216. package/dist/runtime/TaskReviewContext.js +18 -2
  217. package/dist/runtime/UsageReconciliation.d.ts +28 -0
  218. package/dist/runtime/UsageReconciliation.d.ts.map +1 -0
  219. package/dist/runtime/UsageReconciliation.js +68 -0
  220. package/dist/runtime/VerificationCommand.d.ts +2 -0
  221. package/dist/runtime/VerificationCommand.d.ts.map +1 -1
  222. package/dist/runtime/VerificationCommand.js +28 -0
  223. package/dist/runtime/VerificationReceiptSelection.d.ts +15 -0
  224. package/dist/runtime/VerificationReceiptSelection.d.ts.map +1 -0
  225. package/dist/runtime/VerificationReceiptSelection.js +30 -0
  226. package/dist/runtime/WorkspaceLedger.d.ts +2 -0
  227. package/dist/runtime/WorkspaceLedger.d.ts.map +1 -1
  228. package/dist/runtime/WorkspaceLedger.js +44 -20
  229. package/dist/runtime/WorkspaceLock.d.ts.map +1 -1
  230. package/dist/runtime/WorkspaceLock.js +9 -1
  231. package/dist/runtime/WorkspaceSnapshot.d.ts.map +1 -1
  232. package/dist/runtime/WorkspaceSnapshot.js +3 -2
  233. package/dist/runtime/WriteSyntaxCheck.d.ts +10 -0
  234. package/dist/runtime/WriteSyntaxCheck.d.ts.map +1 -0
  235. package/dist/runtime/WriteSyntaxCheck.js +34 -0
  236. package/dist/session/AtomicState.d.ts.map +1 -1
  237. package/dist/session/AtomicState.js +15 -1
  238. package/dist/session/InstructionLoader.d.ts +5 -1
  239. package/dist/session/InstructionLoader.d.ts.map +1 -1
  240. package/dist/session/InstructionLoader.js +65 -19
  241. package/dist/session/SessionStoragePath.d.ts.map +1 -1
  242. package/dist/session/SessionStoragePath.js +34 -17
  243. package/dist/session/SessionStore.d.ts +5 -1
  244. package/dist/session/SessionStore.d.ts.map +1 -1
  245. package/dist/session/SessionStore.js +11 -2
  246. package/dist/session/SkillCatalog.d.ts +33 -0
  247. package/dist/session/SkillCatalog.d.ts.map +1 -0
  248. package/dist/session/SkillCatalog.js +197 -0
  249. package/dist/session/WorkState.d.ts +11 -0
  250. package/dist/session/WorkState.d.ts.map +1 -1
  251. package/dist/session/WorkState.js +46 -2
  252. package/dist/session/WorkTypes.d.ts +8 -0
  253. package/dist/session/WorkTypes.d.ts.map +1 -1
  254. package/dist/session/WorkspaceScope.d.ts +3 -0
  255. package/dist/session/WorkspaceScope.d.ts.map +1 -0
  256. package/dist/session/WorkspaceScope.js +19 -0
  257. package/dist/tools/SemanticToolRetrieval.d.ts +19 -0
  258. package/dist/tools/SemanticToolRetrieval.d.ts.map +1 -0
  259. package/dist/tools/SemanticToolRetrieval.js +52 -0
  260. package/dist/tools/ToolRetrieval.d.ts +7 -0
  261. package/dist/tools/ToolRetrieval.d.ts.map +1 -0
  262. package/dist/tools/ToolRetrieval.js +25 -0
  263. package/dist/tools/ToolTypes.d.ts +2 -0
  264. package/dist/tools/ToolTypes.d.ts.map +1 -1
  265. package/dist/tools/browser/BrowserSessionTool.d.ts +16 -0
  266. package/dist/tools/browser/BrowserSessionTool.d.ts.map +1 -0
  267. package/dist/tools/browser/BrowserSessionTool.js +326 -0
  268. package/dist/tools/browser/BrowserTool.d.ts +17 -0
  269. package/dist/tools/browser/BrowserTool.d.ts.map +1 -0
  270. package/dist/tools/browser/BrowserTool.js +291 -0
  271. package/dist/tools/browser/BrowserWorker.d.ts +2 -0
  272. package/dist/tools/browser/BrowserWorker.d.ts.map +1 -0
  273. package/dist/tools/browser/BrowserWorker.js +121 -0
  274. package/dist/tools/calculation/CalculatorTool.d.ts +5 -0
  275. package/dist/tools/calculation/CalculatorTool.d.ts.map +1 -0
  276. package/dist/tools/calculation/CalculatorTool.js +163 -0
  277. package/dist/tools/deterministic/DeterministicRuntime.d.ts +39 -0
  278. package/dist/tools/deterministic/DeterministicRuntime.d.ts.map +1 -0
  279. package/dist/tools/deterministic/DeterministicRuntime.js +98 -0
  280. package/dist/tools/deterministic/DeterministicTools.d.ts +8 -0
  281. package/dist/tools/deterministic/DeterministicTools.d.ts.map +1 -0
  282. package/dist/tools/deterministic/DeterministicTools.js +100 -0
  283. package/dist/tools/deterministic/node-worker.cjs +38 -0
  284. package/dist/tools/deterministic/python-worker.py +237 -0
  285. package/dist/tools/docdex/DocdexCatalogTools.d.ts +4 -0
  286. package/dist/tools/docdex/DocdexCatalogTools.d.ts.map +1 -0
  287. package/dist/tools/docdex/DocdexCatalogTools.js +59 -0
  288. package/dist/tools/docdex/DocdexTools.d.ts +2 -0
  289. package/dist/tools/docdex/DocdexTools.d.ts.map +1 -1
  290. package/dist/tools/docdex/DocdexTools.js +81 -106
  291. package/dist/tools/documents/DocumentRuntime.d.ts +12 -0
  292. package/dist/tools/documents/DocumentRuntime.d.ts.map +1 -0
  293. package/dist/tools/documents/DocumentRuntime.js +59 -0
  294. package/dist/tools/documents/DocumentTools.d.ts +19 -0
  295. package/dist/tools/documents/DocumentTools.d.ts.map +1 -0
  296. package/dist/tools/documents/DocumentTools.js +150 -0
  297. package/dist/tools/documents/worker.py +267 -0
  298. package/dist/tools/entities/AdesTool.d.ts +7 -0
  299. package/dist/tools/entities/AdesTool.d.ts.map +1 -0
  300. package/dist/tools/entities/AdesTool.js +59 -0
  301. package/dist/tools/filesystem/FileTools.d.ts.map +1 -1
  302. package/dist/tools/filesystem/FileTools.js +58 -11
  303. package/dist/tools/research/TnlTool.d.ts +22 -0
  304. package/dist/tools/research/TnlTool.d.ts.map +1 -0
  305. package/dist/tools/research/TnlTool.js +246 -0
  306. package/dist/tools/shell/AsyncProcess.d.ts +7 -0
  307. package/dist/tools/shell/AsyncProcess.d.ts.map +1 -1
  308. package/dist/tools/shell/AsyncProcess.js +9 -3
  309. package/dist/tools/shell/HostToolchain.d.ts.map +1 -1
  310. package/dist/tools/shell/HostToolchain.js +37 -5
  311. package/dist/tools/shell/IsolatedExecutor.d.ts +4 -2
  312. package/dist/tools/shell/IsolatedExecutor.d.ts.map +1 -1
  313. package/dist/tools/shell/IsolatedExecutor.js +126 -27
  314. package/dist/tools/shell/ShellTool.d.ts +2 -0
  315. package/dist/tools/shell/ShellTool.d.ts.map +1 -1
  316. package/dist/tools/shell/ShellTool.js +18 -4
  317. package/dist/tools/system/CalendarTool.d.ts +15 -0
  318. package/dist/tools/system/CalendarTool.d.ts.map +1 -0
  319. package/dist/tools/system/CalendarTool.js +44 -0
  320. package/dist/tools/system/TextTool.d.ts +4 -0
  321. package/dist/tools/system/TextTool.d.ts.map +1 -0
  322. package/dist/tools/system/TextTool.js +39 -0
  323. package/dist/tools/system/TimeTool.d.ts +4 -0
  324. package/dist/tools/system/TimeTool.d.ts.map +1 -0
  325. package/dist/tools/system/TimeTool.js +22 -0
  326. package/dist/tools/verification/JavaScriptVerificationTool.d.ts +47 -0
  327. package/dist/tools/verification/JavaScriptVerificationTool.d.ts.map +1 -0
  328. package/dist/tools/verification/JavaScriptVerificationTool.js +71 -0
  329. package/dist/tools/verification/JavaScriptVerificationWorker.d.ts +2 -0
  330. package/dist/tools/verification/JavaScriptVerificationWorker.d.ts.map +1 -0
  331. package/dist/tools/verification/JavaScriptVerificationWorker.js +91 -0
  332. package/dist/tools/verification/VitestTool.d.ts +6 -0
  333. package/dist/tools/verification/VitestTool.d.ts.map +1 -0
  334. package/dist/tools/verification/VitestTool.js +184 -0
  335. package/package.json +17 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,94 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Reserve output for history sizing the same way as provider compression, so a
6
+ large output ceiling no longer leaves a few thousand tokens of history and
7
+ each file read evicts the last. Re-reading an evicted result is no longer a
8
+ stall; a 5x backstop still ends a read loop.
9
+ - Consistency audit for long reasoned answers. Research audit prefers vendor
10
+ release notes over stale aggregators, checks unexecuted code and fills every
11
+ requested section. Turkish grounding rules.
12
+ - Pin playwright/playwright-core 1.64.1 workspace-wide; a fresh resolution
13
+ pulled 1.65.0 through browser-use and broke the browser worker types.
14
+ - Windows: non-Git workspace inventories use POSIX-relative keys, so nested
15
+ writes inside a claimed directory are no longer reported as out-of-scope
16
+ changes; session state validation waits out files another process is deleting.
17
+ - Tests that need the isolated executor skip where it is unavailable, and the
18
+ screenshot escape test no longer depends on /etc/hosts.
19
+
20
+ - Size retained execution history by the configured lead context rather than a
21
+ fixed message count; resolve localhost in offline Linux tool sandboxes.
22
+ - Preserve original task inputs and recoverable execution history across trimming,
23
+ compaction and resume; provide a truthful stopped-run handoff in the TUI.
24
+ - Select compatible model pools across shared aliases, refresh temporary health
25
+ failures once, and send inference to the validated pool. Record its resolved ID.
26
+ - Detect repeated unchanged reads despite unrelated file discovery. Use the
27
+ configured repair binding for bounded, metered diagnosis of repeated failures.
28
+ - Return actionable task-scope recovery instructions. Keep unprepared source
29
+ read-only during broad shell setup while allowing scoped data/build outputs.
30
+ - Add isolated syntax-only feedback after JavaScript writes, private persistent
31
+ package caches, exact calendar/text helpers and lossless JSON presentation repair.
32
+ - Preserve large file preimages and permit safe in-scope dependency hard links;
33
+ protect original requirements from direct and shell writes.
34
+ - Explain per-call shell scratch lifetime and available commands on rejection.
35
+ Include inspected implementation sources in recovery diagnoses.
36
+ - Bound shared Docdex diagnostic subprocesses so failed health discovery can return.
37
+ - Retain failed app-build diagnostics separately from later assisted continuations.
38
+ These changes do not establish superiority over raw Qwen or complete-app readiness.
39
+
40
+ - Unify dispatch/tool/output contracts and validate final replies across modes.
41
+ Add one budgeted, tool-free presentation repair, preserve execution evidence,
42
+ and share the versioned dispatcher prompt with live evaluations. Legacy router
43
+ prompts now supply semantic policy without replacing the response schema.
44
+ - Guide word-bound repairs toward an interior target while retaining exact user
45
+ limits and the single-repair budget; keep failed drafts when validation fails.
46
+ - Add a structured, history-aware tool-scope decision and withhold optional
47
+ calculation when the dispatcher does not explicitly allow tools. Preserve
48
+ host restrictions and record scope conflicts. Fix local skill discovery when
49
+ a workspace path resolves through platform aliases or symlinks.
50
+ - Record the separate 32-question regression and its prompt-template erratum;
51
+ it does not demonstrate better intelligence than raw Qwen.
52
+
53
+ - Add native Docdex repository/web investigation, bounded browser snapshots,
54
+ server time, progressive local skills with a bundled planning workflow, and
55
+ readable TUI tables with narrow-screen layouts.
56
+ - Preserve user constraints through automatic context compression; keep archived
57
+ content recoverable after resume/fork. Reserve final-answer capacity when
58
+ Docdex performs nested inference, and retain plan-writing tools under budget pressure.
59
+ - Label web summaries and unvisited discovery links separately from fetched
60
+ evidence. Preserve failed benchmark attempts; the original and R1 studies did
61
+ not establish the required quality improvement over raw Qwen.
62
+
63
+ - Honor `interaction.answerBinding` for read-only inspections as well as explanations.
64
+
65
+ - Prepare codali.17 with history-aware interaction dispatch before repository
66
+ execution. Greetings and questions no longer create coding tasks or reviewer
67
+ loops; configured small-model prompts prepare bounded stronger-model requests.
68
+ - Record private redacted request/model-response/final-outcome audit events,
69
+ preserve cumulative usage with bounded turn budgets, and remove transport
70
+ metadata from repeated model context. Conversation metadata v2 prevents older
71
+ clients from reinterpreting these sessions as coding jobs; v1 work sessions
72
+ remain readable.
73
+ - Add mouse-wheel scrollback that stays anchored during streaming, readable tool
74
+ activity and errors, and dedicated help/usage views. Preserve keyboard access,
75
+ approval controls and terminal restoration.
76
+
77
+ - Retry transient Windows state-file replacement conflicts without deleting the
78
+ previous state or suppressing permanent errors. Retain file durability checks.
79
+ - Resolve native macOS Git within the selected developer installation so sandboxed
80
+ repository inspection works without launching the Xcode wrapper.
81
+
82
+ ## 0.1.135-codali.3 - 2026-10-26
83
+
84
+ - Allow bounded Git diff/status inspection within the final validation budget;
85
+ keep edits blocked and require actual test evidence before verifying code.
86
+ - Disable terminal echo before displaying the API-key prompt, preventing fast
87
+ input from being echoed. Verify masked entry, backspace, cancellation, key
88
+ rotation, logout, credential-cache refresh and bounded piped input.
89
+
90
+ - Tagged candidate; publication was cancelled after Windows CI exposed a
91
+ transient state-file replacement failure addressed above.
92
+
5
93
  ## 0.1.135-codali.2 - 2026-10-26
6
94
 
7
95
  - Keep core tool definitions available across task handoffs, while requiring a
package/ORCHESTRATION.md CHANGED
@@ -1,5 +1,98 @@
1
1
  # Orchestration configuration
2
2
 
3
+ ## Native tools, skills and bounded context
4
+
5
+ The terminal controller exposes native function calls to capable configured models.
6
+ Read-only inspection uses Docdex for repository search, source reads and structural
7
+ analysis, and `docdex_web_research` for external research. Local searches use the
8
+ index-only batch endpoint; they cannot silently trigger web or model fallback.
9
+ Web calls pass the permission gate before connecting to the system Docdex service.
10
+ The system service owns web-provider credentials and inference routing. Codali
11
+ binds an MCP session to the repository even when local authentication is disabled.
12
+ An empty result does not automatically replay a metered web request. Discovery
13
+ links remain separate from fetched evidence, and generated summaries are labeled.
14
+ Service inference costs are reported by Docdex, not counted in Codali model totals.
15
+ After the first native tool choice, inspection keeps related capability schemas
16
+ in context; other read tools remain available through discovery and explicit
17
+ enabling. This reduces repeated context without classifying prompts by keywords.
18
+
19
+ `server_time` reads the execution host clock, with UTC, Unix milliseconds and an
20
+ optional IANA timezone. `calculate` evaluates bounded numeric expressions without
21
+ running code. `browser_open` reads a rendered accessibility snapshot in an isolated
22
+ Chrome/Chromium process; `browser_read` pages through that captured snapshot without
23
+ another network request. The default snapshot covers the page's main landmark
24
+ when available; `scope: "page"` requests the whole page. Results retain valid bounded JSON and pagination
25
+ handles within the inspection loop's output limit.
26
+ Set `CODALI_BROWSER_PATH` to an absolute executable path
27
+ if automatic discovery cannot find Chrome. Browser navigation requires web
28
+ permission (`--allow-web` or an interactive approval); the planning permission
29
+ profile continues to allow read operations only. Browser contexts have no login
30
+ profile, block POST/form submissions, downloads, service workers and WebSockets,
31
+ and close after each navigation. Page content is untrusted evidence. This browser
32
+ surface supports reading and following URLs. Separate browser_session and
33
+ browser_interact tools provide a persistent isolated noVNC desktop and official
34
+ Browser Use actions; their external-operation permissions still apply.
35
+
36
+ Use `/skills` to inspect available `SKILL.md` packages. Codali discovers its bundled
37
+ skills for planning, architecture, implementation, code review, UI/UX design, testing, tool
38
+ selection, system services, system diagnostics, debugging, Docdex research and
39
+ browser workflows; workspace `.codali/skills` and `.agents/skills`; and user
40
+ `~/.codali/skills`, `~/.agents/skills`, `~/.codex/skills` and `~/.claude/skills`.
41
+ Additional roots are configurable:
42
+
43
+ ```json
44
+ "skills": {
45
+ "enabled": true,
46
+ "directories": ["~/shared-agent-skills", ".team/skills"]
47
+ }
48
+ ```
49
+
50
+ Discovery is bounded to 128 skills, 256 directories and three directory levels.
51
+ Each text resource is limited to 64 KiB. Standard YAML `name` and `description`
52
+ metadata are required; optional `compatibility` is shown with the actual host
53
+ platform. Up to24 workspace/builtin entries, bounded to3200characters of serialized
54
+ metadata, enter tool-capable prompts; bodies remain lazy.
55
+ `skill_list` discovers omitted and imported packages, `skill_load` reads instructions, and
56
+ `skill_read` retrieves referenced text in pages. Exact IDs disambiguate duplicate
57
+ names. Resources cannot escape their skill directory through traversal or
58
+ symlinks. Scripts and hooks never run automatically, and `allowed-tools` metadata
59
+ does not grant permission. A Mac-specific skill still needs its declared platform
60
+ and tools; loading its text does not provide those dependencies. Configuration
61
+ reload refreshes the skill roots.
62
+
63
+ The service and diagnostic skills distinguish host access from sandbox observations.
64
+ Default run_shell does not expose host service management, even under full
65
+ permission. General systemd/launchd/Docker administration requires an advertised,
66
+ authorized host connector; browser_session only manages its owned desktop and
67
+ static preview. Platform references are read on demand and do not execute.
68
+
69
+ The bundled planning skill uses durable goals, task dependencies, allowed paths,
70
+ decisions and verification receipts. Planning mode records future work and leaves
71
+ the implementation goal open. If inference budget runs out after a plan was
72
+ saved, the controller shows that record with an explicit partial-work notice;
73
+ it does not mark implementation complete. Markdown tables render as aligned boxes in the TUI,
74
+ or labeled fields on narrow screens, including in command overlays.
75
+
76
+ All model routes account for message content, tool schemas, response format,
77
+ reserved output and a context margin before dispatch. Near the configured model
78
+ window, deterministic compression shortens earlier assistant/tool content while
79
+ preserving user/system messages and native call/result identities. Conversation
80
+ history uses the same extractive approach instead of silently discarding older
81
+ user constraints. Abbreviated content identifies a saved source; `context_read`
82
+ recovers it in bounded pages or exact `offset`/`maxChars` spans, including after resume or conversation fork. Full
83
+ originals remain in the redacted private event transcript. The canonical work
84
+ record retains goals, requirements, decisions, pending tasks and verification
85
+ evidence. Compression makes no additional model calls and is not a semantic
86
+ summary. If immutable instructions and schemas cannot fit, the request fails
87
+ before dispatch with an actionable error rather than dropping constraints.
88
+
89
+ Design references: [Agent Skills specification](https://agentskills.io/specification),
90
+ [Playwright browser contexts](https://playwright.dev/docs/api/class-browsercontext),
91
+ [Playwright accessibility snapshots](https://playwright.dev/docs/api/class-page#page-aria-snapshot),
92
+ and [Browser Use browser configuration](https://docs.browser-use.com/open-source/customize/browser/basics).
93
+ These additions require separate installed/live qualification; the completed
94
+ original and R1 benchmark results remain frozen and did not pass quality promotion.
95
+
3
96
  The JSON file declares providers, model identities, role bindings, effort limits
4
97
  and task-control policy. It contains credential references, never secret values.
5
98
  The loader rejects unknown fields, undeclared models, alias cycles, unsafe URLs,
@@ -36,6 +129,34 @@ Roles such as `planner`, `architect`, `worker`, `router`, `repair`, `compactor`,
36
129
  `adjudicator`, `synthesizer` and `verifier` can explicitly alias the lead. Disabled
37
130
  optional capabilities do not silently invoke a model from daemon defaults.
38
131
 
132
+ When an enabled `repair` binding is explicitly configured, repeated admitted shell
133
+ execution failures trigger a read-only diagnosis after
134
+ `taskControl.repairAttemptsBeforeReplan` failures (default two). Each diagnosis
135
+ receives the task, actual error and bounded excerpts of already observed source.
136
+ At most two diagnoses are requested per command/task attempt in a loaded turn;
137
+ these calls count toward the shared model budget. Advice cannot execute tools,
138
+ change permissions or verify completion. Permission denials do not trigger this
139
+ repair path. A successful command resets the failure streak.
140
+
141
+ Successful JavaScript writes receive an isolated `node --check` where available.
142
+ A parse failure leaves the saved file intact and shows “syntax needs fixing” in
143
+ the TUI. Parsing is feedback, not behavioral verification. Interrupted runs retain
144
+ a deterministic handoff listing unfinished tasks and the resume command.
145
+
146
+ Execution history retains complete recent tool-call/result groups within a token
147
+ reserve: one quarter of the smallest configured lead context after its output
148
+ allowance. This replaces the fixed twelve-message cutoff. Older findings remain
149
+ retrievable by hash, all user constraints survive, and the provider context guard
150
+ still accounts for instructions, schemas and output before dispatch.
151
+
152
+ On Linux, offline shell execution provides a synthetic localhost-only hosts file.
153
+ It resolves loopback names without sharing the host network or its hostname map.
154
+
155
+ Isolated shell scratch files and environment changes last for one call. Use
156
+ `$TMPDIR` for temporary work and claimed workspace paths for required artifacts.
157
+ Package-manager cache environment variables identify persistent private caches;
158
+ do not hardcode Linux cache paths in portable tasks.
159
+
39
160
  Effort controls shared limits, not a claim about hidden model reasoning:
40
161
 
41
162
  | Effort | Steps | Model calls | Tool calls | Total tokens | Time |
@@ -56,8 +177,16 @@ The Raijin/Suku example maps low to native `none`, medium to `low` with a
56
177
  request settings; `/status` and model-route events expose them without claiming
57
178
  that an older server applied them. Both the mSwarm proxy and node must contain
58
179
  the native-reasoning transport update before enabling this profile in service.
59
- The CLI checks the proxy's authenticated model catalog before reserving inference
60
- tokens. The selected model must advertise `native_reasoning.transport_version: 1`
180
+ The CLI checks the proxy's authenticated model catalog before dispatching inference.
181
+ Discovery, authentication, capability and context refusals release provisional
182
+ token reservations and persist a `not_dispatched` receipt across resume. Failures
183
+ after the transport handoff retain provisional usage until server reconciliation.
184
+ Read-only model and native-capability discovery may retry an explicit temporary
185
+ service failure twice, with bounded backoff. Authentication, entitlement, quota
186
+ and malformed-response failures are not retried. Server backoff longer than five
187
+ seconds is returned to the caller; inference submissions are never replayed by
188
+ this discovery policy.
189
+ The selected model must advertise `native_reasoning.transport_version: 1`
61
190
  and every requested parameter. The proxy publishes this contract for pinned nodes
62
191
  advertising `native_reasoning_transport_version: 1`, and rejects native requests to older
63
192
  nodes before dispatch. A generic `supports_reasoning` flag is insufficient.
@@ -94,25 +223,43 @@ healthy catalog entries only when digest, dimensions and preprocessing are all
94
223
  present, and groups identical contracts as replicas. The mSwarm catalog and
95
224
  response must attest the pinned digest.
96
225
 
97
- With this binding enabled, the terminal controller owns a private Docdex process.
98
- Repository embeddings pass through the configured provider and shared session
99
- budget. Docdex text inference uses the configured helper, or the lead when no
100
- helper is enabled. Private indexes live outside the repository, are separated by
101
- embedding-space identity, and are reused on restart. The session also pins its
102
- space; an incompatible upgrade requires a separate index and session. Query and
103
- document receipts retain purpose, model, configuration hash and reported usage.
104
-
105
- The managed daemon must advertise workspace-metadata control, query/document
106
- embedding input types, strict repository embeddings and deterministic profile
107
- embeddings. An older daemon fails startup with an explicit compatibility error.
108
- `docdex.binary` selects an installed qualified binary; `binarySha256` pins its
109
- bytes and is checked before every managed launch. `startupTimeoutMs` bounds
110
- startup. Setup uses the packaged release artifact manifest for a private install,
111
- or validates the explicit `--docdex-binary` path through `runtime-info`. It does
112
- not rewrite Git ignore files or create repository-local metadata.
113
- Global profile preferences use separate persistent deterministic hash storage,
114
- which makes no LLM call and survives repository embedding upgrades. Failed remote
115
- repository embeddings never substitute vectors from this hash space.
226
+ Codali always uses the system-wide Docdex service for repository indexing,
227
+ memory and web tools. Embedding bindings in Codali do not start a private daemon
228
+ or override the service's model configuration. The service owns its index and
229
+ embedding-space lifecycle; Codali explicitly initializes the current repository
230
+ and scopes subsequent requests to the returned repository ID. Docdex inference
231
+ is accounted by that service, separately from Codali's model totals.
232
+
233
+ The terminal loads its packaged `config/AGENTS.md` guide, optional
234
+ `~/.codali/AGENTS.md` user instructions, `.codali/instructions.md`, workspace
235
+ `AGENTS.md` files from the root through focused directories, then
236
+ `.codali/local.md`. More specific instructions take precedence within their
237
+ scope; none can widen host permissions or authorize unrelated actions. These
238
+ instructions also apply to ordinary conversation and explanations. The
239
+ dispatcher receives the short general part of the packaged guide; investigation
240
+ and execution receive its Docdex recipes. User/workspace instructions remain
241
+ intact. Sources, scopes and content hashes are recorded in `instructions_loaded`
242
+ events and shown in session status. Instructions reload at turn boundaries and
243
+ when execution changes its focused paths.
244
+
245
+ Instruction files must stay within their source directory boundary, be regular
246
+ files of at most 64 KiB, and fit a combined 24,000-character prompt budget.
247
+ Oversized bundles fail explicitly before inference; move supporting material
248
+ into linked documents instead of relying on silent truncation. Repository
249
+ instruction symlinks cannot disclose files outside the workspace.
250
+
251
+ Read-only investigations use permitted Docdex search, source, structural and
252
+ continuity tools. Connection happens when a permitted tool needs it; greetings
253
+ do not initialize a repository. Host-denied calls cannot initialize a connection.
254
+ Inspection never exposes indexing mutations, memory writes, shell execution or
255
+ work mutations. External research requires the existing web permission.
256
+
257
+ Set `docdex.baseUrl` (or `DOCDEX_HTTP_BASE_URL`) to the system service; the default
258
+ is `http://127.0.0.1:28491`. Setup does not install a private runtime, and doctor
259
+ probes the shared service. Legacy private-binary settings are ignored by session
260
+ execution. Session shutdown never stops the shared service. On connection or
261
+ index failure, Codali reports degraded capabilities and continues using local
262
+ file/search tools with permissions, task claims and fresh-read checks intact.
116
263
 
117
264
  Large plans remain complete in durable storage. The model context reserves the
118
265
  original goal, constraints, active task criteria and applicable architecture
@@ -143,12 +290,73 @@ by checksums and tool receipts. Review must reject unavailable evidence needed
143
290
  to decide correctness. Passing a test or obtaining reviewer approval alone does
144
291
  not establish a universal correctness guarantee; observed false completions
145
292
  remain release blockers and become regression fixtures.
293
+ If a provider returns an explicit rejection with one finding as a string, the
294
+ controller retains that finding as a one-item list so the agent can repair the
295
+ defect. This normalization cannot turn a malformed approval into acceptance.
296
+
297
+ Review begins with separate specification-only calls, before implementation,
298
+ tests, diffs or claimed results are supplied. Each source is presented as a
299
+ lossless array of excerpts. The model selects a source ID and zero-based excerpt
300
+ index; the controller supplies the exact quotation, preserving whitespace and
301
+ Unicode boundaries. Invalid indexes, conflicting quotations and omitted sources
302
+ cannot establish acceptance. Legacy quoted responses remain valid only when
303
+ their text occurs verbatim in the identified source. Large
304
+ contracts use at most sixteen bounded source groups, with every original source
305
+ retained as context in every call. Text already contained verbatim in the current
306
+ goal is supplied once; all canonical criterion IDs remain in the actual review.
307
+ The review checklist stores repeated quotations once per source and retains each
308
+ check with a reference to that exact quotation; no expected behavior is dropped.
309
+ One format repair per group is permitted; invalid source attribution or missing coverage
310
+ cannot establish acceptance. The checklist supplements the full original
311
+ contract and does not prove correctness. Both preparation and source review use
312
+ the smaller of the configured effort output limit and reviewer model limits,
313
+ reserving that output space in the smallest compatible context window. Native
314
+ reasoning settings remain in the model configuration; no host defaults change.
315
+ Terminal review requests plain model output and strictly parses the JSON protocol
316
+ locally. This preserves the received response and usage when a model emits invalid
317
+ JSON; a native structured-output validator would otherwise reject it before the
318
+ controller can inspect it. Source review permits one format-only repair with the
319
+ complete original authority retained, at most six calls including four source
320
+ rounds and a verdict. This does not retry unknown transport failures or turn an
321
+ invalid or contradictory approval into accepted evidence. Explicit native
322
+ `structured_output_failed` errors elsewhere are classified as `invalid_response`
323
+ without exposing upstream response content.
324
+
325
+ The reviewer can request additional source pages before deciding. Requests are
326
+ read-only and restricted to the current review paths; each page rechecks the
327
+ validated file hash. Four request rounds, eight pages per round and the smallest
328
+ configured reviewer context bound the process. Every model call shares the
329
+ session's usage and effort budget. Repeated requests, exhausted context, missing
330
+ evidence or edits during review cannot establish acceptance. Secrets are redacted
331
+ before paging, including credentials that cross page boundaries.
332
+ Omitting a source-request offset continues at the controller's exact unread
333
+ cursor, including an initial page shorter than 8,000 characters. Whole-goal
334
+ reviews reference repeated requirement text by its exact position in the intact
335
+ goal and identify the checked snapshot with one digest. Full per-file hashes
336
+ remain in controller validation and durable evidence; this saves prompt space
337
+ without summarizing the contract or relaxing freshness checks.
146
338
 
147
339
  Ordinary task review includes its assigned requirements, owned changes and diff,
148
340
  plus relevant read-only dependencies. Other tasks' pending deliverables remain
149
341
  in the canonical backlog. A task assigned the original whole-objective criterion
150
342
  receives the complete current goal and all changes for integration review.
151
343
  Both review scopes retain the same global validation and source-freshness checks.
344
+ Whole-goal integration also reviews every canonical refined criterion. When all
345
+ other active tasks are already verified, the controller first reassesses each
346
+ owner's criteria and read dependencies against the final files. It then supplies
347
+ those successful assessments, bound to one full-workspace digest, to the final
348
+ integration review and to later scoped reassessments, such as delivery inventories.
349
+ Assessed module source remains available for hash-checked
350
+ paging; only remaining source and diff are loaded initially. Initial source
351
+ allocation reserves context space for later pages. Original requirements,
352
+ constraints, architecture decisions and cross-task interactions still govern
353
+ integration acceptance. A failed scoped assessment stops the sequence without
354
+ renewing any proof. Only an accepted final-tree integration review records
355
+ new full-snapshot proofs for those owners, linked to the shared integration
356
+ assessment and their prior evidence. Original proofs remain in the audit trail.
357
+ An assigned-task review cannot renew siblings; partial coverage, unfinished or
358
+ reopened work, stale revisions, and omitted tracked inputs cannot use this path.
359
+ Any later change to the assessed files still invalidates completion.
152
360
 
153
361
  Terminal `model_receipt` events link usage to `model_intent` by ID and identify
154
362
  the role binding. Completed receipts include the reported route and usage;
@@ -357,6 +565,12 @@ the grader before live runs. Retain the frozen installed client and configuratio
357
565
  with every result. First attempts are qualification observations; corrective
358
566
  reruns must be labeled diagnostic, with the original failures preserved.
359
567
 
568
+ Workflow corpus v5 additionally checks immediate dispatch stopping on synchronous
569
+ worker throws, waiting for already-started workers, and preserving falsy thrown
570
+ values. This closes a gap found by live review: public async-only coverage had
571
+ accepted a faulty pool. Earlier frozen runs retain their original version, hash
572
+ and outcomes; regrading known artifacts is diagnostic evidence.
573
+
360
574
  `eval/LongWorkflowJourney.runLongWorkflowJourney` composes four module contracts
361
575
  into one durable goal. Select `data-delivery`, `service-adapters`, `billing-audit`
362
576
  or `localized-export`, and supply `configPath` and a new `outputRoot`. Four child
@@ -385,3 +599,124 @@ receipts and independent-review excerpts preserve the beginning, a detected
385
599
  failure region, and the end of bounded output; omission markers never imply
386
600
  that an unretained full log is available. Successful test exit status remains
387
601
  separate from whether the tests prove the requested behavior.
602
+
603
+ ## Terminal interaction dispatch and audit
604
+
605
+ Natural-language terminal messages first pass through a bounded semantic
606
+ dispatcher. It uses recent conversation and the active goal to choose a direct
607
+ answer, stronger no-tool answer, read-only investigation, action, or clarification.
608
+ It does not match a list of phrases. Conversation does not initialize a work
609
+ record, repository index or verification loop. Side questions preserve active
610
+ work. Action requests retain the original text and relevant conversation beside
611
+ the prepared brief; the brief cannot grant permissions or replace constraints.
612
+
613
+ `codali setup` initially aliases `intent` to `lead`. The smaller resident models
614
+ have not qualified for the current contract; health and availability alone do not
615
+ select them. Operators can bind a smaller model after a measured comparison.
616
+ The older `router` binding used by automation is unchanged. Existing profiles
617
+ without an `intent` binding use a bounded lead call until the operator configures
618
+ one. No model is downloaded automatically.
619
+
620
+ The optional `interaction` object accepts:
621
+
622
+ ```json
623
+ {
624
+ "routerBinding": "intent",
625
+ "answerBinding": "lead",
626
+ "promptVersion": "my-interaction-v1",
627
+ "maxInputChars": 24000,
628
+ "historyChars": 6000,
629
+ "maxOutputTokens": 768,
630
+ "maxTotalTokens": 16000,
631
+ "maxModelCalls": 8,
632
+ "maxInspectionSteps": 6,
633
+ "timeoutMs": 90000
634
+ }
635
+ ```
636
+
637
+ `answerPrompt` replaces the answering instructions. `routerPrompt` is a legacy
638
+ semantic policy carried as data beside the original request. It can guide route
639
+ selection but cannot replace the versioned dispatcher schema or widen scope.
640
+ Live dispatch returns exactly `mode`, `text`, `tools` (`none` or `available`), and
641
+ `output` (`format`, `requiredKeys`, `minWords`, `maxWords`). Unspecified word bounds
642
+ are null. Archived two-/three-field decisions remain readable; live requests
643
+ require all four fields. Runtime and dispatcher evaluations share the same prompt
644
+ builder and record `interaction-v11` separately from the operator's policy version.
645
+ `routerResponseFormat: "json_schema"` optionally sends a native schema for the
646
+ five decision modes, bounded brief, tool scope and output contract. The default remains JSON-object
647
+ mode for adapter compatibility. The selected endpoint must support the schema;
648
+ there is no automatic downgrade or replay after a rejected request. Output is
649
+ still parsed and validated because a schema does not establish correct intent,
650
+ and a response can be truncated or an endpoint can ignore the constraint.
651
+
652
+ Every final interaction reply is checked for nonempty content, extracted JSON-only
653
+ syntax/top-level required keys, and explicit whitespace-separated word bounds.
654
+ These checks do not prove factual correctness, validate an entire JSON Schema,
655
+ compile code or establish work completion. Original user instructions remain
656
+ authoritative when extraction omits a requirement. A failed conversational check
657
+ gets at most one tool-free repair within the same call/token/deadline budget.
658
+ Both drafts and the violations are logged. A failed repair is reported as failure;
659
+ it does not silently publish an invalid final answer. Invalid execution reports
660
+ retain their work checkpoints and cannot use presentation repair to invent action
661
+ claims or change completion evidence. Ordinary valid greetings still take one call.
662
+
663
+ `answerReview: { "enabled": true, "binding": "reviewer", "maxOutputTokens": 2048 }`
664
+ adds one revision pass to `reason` answers. It sees the original request,
665
+ conversation, applicable instructions and untrusted draft, and has no tools.
666
+ The pass shares the existing call/token/deadline limits; it is skipped when
667
+ there is insufficient budget. A failed optional check records its failure and
668
+ returns the original draft unless the user cancelled. It never changes a
669
+ greeting, claims independent verification, or runs automatically by default.
670
+ Use measured quality and latency results before enabling it.
671
+
672
+ `calculator: true` experimentally exposes the pure `calculate` tool only during
673
+ `reason` turns whose dispatcher returns `tools: "available"`. It is off by default. The model chooses whether to use it; the
674
+ dispatcher does not match arithmetic keywords or a list of request types.
675
+ It receives a capability note so requests requiring calculator verification
676
+ reach reasoning mode; the recorded router-prompt hash includes that note.
677
+ The tool accepts numeric expressions, parentheses, powers, signed remainder
678
+ and a small set of arithmetic functions. It cannot execute code, access files
679
+ or use the network. Expressions are limited to 4,096 characters, 1,024 tokens,
680
+ 32 levels of nesting and 128 function arguments. Nonfinite results and unsafe
681
+ integers are rejected. Floating-point results are not exact decimal arithmetic.
682
+
683
+ Calculator calls honor host/repository tool restrictions, consume the shared
684
+ tool budget and create ordinary invocation receipts. The loop reserves capacity
685
+ for a final answer; greetings still use no tools. When answer review is also
686
+ enabled, it receives the actual calculation requests and results. A calculator
687
+ can verify an expression, but it cannot establish that the model chose the
688
+ correct formula, units or interpretation. Enable it only after evaluating that
689
+ tradeoff with the intended model and workload.
690
+
691
+ The router returns `{"mode":"answer","text":"Hello!","tools":"none"}` with mode
692
+ one of `answer`, `reason`, `inspect`, `execute`, `clarify`. For delegated modes,
693
+ text is a task brief of at most 500 characters, not a proposed solution. Invalid
694
+ output gets one bounded repair attempt; it cannot start execution. Model bindings
695
+ still enforce catalog entitlement, backend identity and context capacity.
696
+
697
+ The dispatcher interprets `tools` from the original request and conversation;
698
+ it is `none` or `available`. The host withholds tools for `none`, converting an
699
+ inconsistent inspection/execution decision into a tool-free answer. `available`
700
+ does not override host or repository permissions. Older two-field decisions
701
+ remain readable, but cannot enable the optional calculator. The runtime appends
702
+ this contract to custom router prompts and records the effective prompt hash.
703
+ This model-derived restriction still needs semantic evaluation; it is not proof
704
+ that every natural-language prohibition was understood correctly.
705
+
706
+ Session totals accumulate, while turn budgets restart per message. Unknown
707
+ remote outcomes retain their token reservations until reconciled. Execution
708
+ continues to use the selected effort budget and existing completion gate.
709
+
710
+ Private session `transcript.jsonl` records `interaction_request`, `model_request`,
711
+ `model_response`, and `interaction_result` or `interaction_failed`. Correlation
712
+ IDs, actual message/tool payloads, configuration and prompt hashes, model routes,
713
+ token receipts and final outcomes support later investigation. Registered
714
+ credentials and recognizable token formats are redacted; files have private
715
+ permissions and stay outside the repository. No training or log upload is enabled.
716
+ Cancellation may leave a remote model outcome unknown; the log preserves that
717
+ reservation rather than inventing a response or zero usage.
718
+
719
+ The reproducible conversation, code-answer and repository-inspection study is
720
+ documented in [`docs/benchmarks/codali-1000/README.md`](../../docs/benchmarks/codali-1000/README.md).
721
+ Its independent code checks and rubric reviews supplement the existing terminal
722
+ editing and long-workflow suites; they do not replace those release gates.