@iowarp/clio-coder 0.3.3 → 0.3.6

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 (370) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/CONTRIBUTING.md +7 -7
  3. package/README.md +3 -3
  4. package/dist/{acp-P2AQILE2.js → acp-2BEHC4DL.js} +9 -8
  5. package/dist/{agents-72W3BI7I.js → agents-LNNFTM53.js} +29 -24
  6. package/dist/assets/codewiki.json +1 -1
  7. package/dist/{auth-5TWEIYDN.js → auth-KXXFI2VS.js} +14 -10
  8. package/dist/{chunk-GGXXDWE4.js → chunk-22NAGB7X.js} +2 -2
  9. package/dist/{chunk-YCWGATWI.js → chunk-24I7BN55.js} +2 -2
  10. package/dist/{chunk-EKMEHE4H.js → chunk-33YXPOE3.js} +2 -3
  11. package/dist/chunk-3BPUFZDL.js +37 -0
  12. package/dist/chunk-43AOLP7E.js +375 -0
  13. package/dist/{chunk-ZDOOVTXZ.js → chunk-4OC57DA6.js} +27 -4
  14. package/dist/{chunk-6SGHMWE3.js → chunk-5JGRAMKL.js} +5 -5
  15. package/dist/{chunk-V6RTAOC2.js → chunk-6US73PDB.js} +572 -51
  16. package/dist/{chunk-5UFT4SUX.js → chunk-6XXKFVSN.js} +3 -3
  17. package/dist/{chunk-A3CYT5EX.js → chunk-AD2SYQYC.js} +55 -2
  18. package/dist/chunk-AOCYTWAV.js +449 -0
  19. package/dist/chunk-CFGTUFWB.js +67 -0
  20. package/dist/chunk-CJUB2JJ2.js +1478 -0
  21. package/dist/{chunk-FNTMWMX5.js → chunk-CKXWIANG.js} +14 -12
  22. package/dist/{chunk-PIWWS5BL.js → chunk-CYQKWTG3.js} +63 -78
  23. package/dist/{chunk-LZSJBIVT.js → chunk-DJVECN66.js} +271 -762
  24. package/dist/{chunk-CBCAPZAA.js → chunk-E25LMLRW.js} +2 -2
  25. package/dist/{chunk-ZWMF7253.js → chunk-E2ER4LJF.js} +304 -9
  26. package/dist/{chunk-STBPMHSX.js → chunk-EKY57CSP.js} +51 -84
  27. package/dist/{chunk-DUYJ5IO6.js → chunk-EYPA3EGJ.js} +12 -4
  28. package/dist/{chunk-M6SHUN7Q.js → chunk-FO5ZOVUY.js} +2 -2
  29. package/dist/chunk-FYYLNIL5.js +313 -0
  30. package/dist/{chunk-OQ33BKR3.js → chunk-G7MUEIGA.js} +3 -60
  31. package/dist/chunk-GEYXPTRF.js +613 -0
  32. package/dist/chunk-GOXNB3AO.js +261 -0
  33. package/dist/{chunk-G4BMMOKF.js → chunk-HVDIIIQW.js} +2 -2
  34. package/dist/chunk-HWUFFB6L.js +83 -0
  35. package/dist/{chunk-4XUGQOHA.js → chunk-K7T3E2SR.js} +15 -8
  36. package/dist/chunk-K7VKOLQQ.js +15 -0
  37. package/dist/{chunk-UFIIWP2H.js → chunk-KHSFENX2.js} +8 -8
  38. package/dist/{chunk-BMEMKKIT.js → chunk-KOHPCX4K.js} +2 -2
  39. package/dist/chunk-LCGCVYZ4.js +57 -0
  40. package/dist/chunk-LL4KHSZI.js +22 -0
  41. package/dist/{chunk-PAJK6MAQ.js → chunk-LYF7OHWH.js} +42 -15
  42. package/dist/{chunk-POHLU5DW.js → chunk-M6L6IDJG.js} +3 -3
  43. package/dist/{chunk-5UUP6MWO.js → chunk-MV3K5QF2.js} +5 -436
  44. package/dist/{chunk-X4RCMKVQ.js → chunk-NDINPTJ4.js} +2 -2
  45. package/dist/{chunk-TZK7PACC.js → chunk-NILBFAPG.js} +14 -8
  46. package/dist/chunk-ODFEOB4F.js +1082 -0
  47. package/dist/{chunk-AGYYIBLL.js → chunk-OH3TOQTB.js} +6 -2
  48. package/dist/chunk-OZNBF4L3.js +23 -0
  49. package/dist/{chunk-DSELYM6W.js → chunk-PBTHKCPN.js} +30 -10
  50. package/dist/{verify-375KUB3Y.js → chunk-PCZJO5TI.js} +127 -42
  51. package/dist/{chunk-ED4KHGC3.js → chunk-PPAMZ32Z.js} +9 -2
  52. package/dist/{chunk-SRDMMSEP.js → chunk-QM3F2GKX.js} +1063 -1645
  53. package/dist/{chunk-X6IAEBZR.js → chunk-QNQHSOLF.js} +7 -7
  54. package/dist/{chunk-OC7FIQPC.js → chunk-R46L2BIR.js} +10 -7
  55. package/dist/{chunk-2TLUCQVG.js → chunk-RD5U66HV.js} +3 -3
  56. package/dist/{chunk-6N5PTWMY.js → chunk-RY3LY4J5.js} +50 -13
  57. package/dist/{chunk-OKGUZO2U.js → chunk-SPULKLCF.js} +4 -3
  58. package/dist/{chunk-OOJYHWRB.js → chunk-TSHXZTOQ.js} +6 -5
  59. package/dist/chunk-TZSKNMZG.js +434 -0
  60. package/dist/{chunk-7MNJORFF.js → chunk-UL3WSD3F.js} +6 -1
  61. package/dist/{chunk-VJWL6YS5.js → chunk-UUVG37B4.js} +2 -2
  62. package/dist/{chunk-COU2UHX6.js → chunk-VEZEGCGW.js} +170 -2
  63. package/dist/chunk-W6GROXXM.js +69 -0
  64. package/dist/{chunk-OAO4GE4M.js → chunk-WHGPSPT5.js} +2 -2
  65. package/dist/chunk-WHJYKASB.js +677 -0
  66. package/dist/{chunk-ORBHGJC5.js → chunk-WR67VIZY.js} +3 -3
  67. package/dist/{chunk-YHZX5GEU.js → chunk-XAKHZX5N.js} +2 -2
  68. package/dist/{chunk-TZTZS7QK.js → chunk-XE2VEJHX.js} +5 -3
  69. package/dist/{chunk-LM5TQCJZ.js → chunk-XF5N4U5A.js} +8 -7
  70. package/dist/{chunk-LWLEKMDQ.js → chunk-XXQNGV4M.js} +1073 -552
  71. package/dist/{chunk-KZWTDYJF.js → chunk-XYDYPRZI.js} +7 -7
  72. package/dist/chunk-ZGVHUX3M.js +66 -0
  73. package/dist/{chunk-LW6DSM3M.js → chunk-ZRGEBJ4T.js} +1192 -1119
  74. package/dist/{chunk-2DJ2KNFG.js → chunk-ZXF4XRKW.js} +202 -40
  75. package/dist/chunk-ZZMN5OM4.js +122 -0
  76. package/dist/cli/index.js +34 -30
  77. package/dist/{clio-JOU4FXVA.js → clio-M2KGYUFZ.js} +7 -6
  78. package/dist/{code-nav-7AX6FYE6.js → code-nav-GQNL7XA6.js} +8 -6
  79. package/dist/codewiki/build-worker.js +4 -4
  80. package/dist/{components-KELWS457.js → components-5TTYYX6G.js} +3 -3
  81. package/dist/{config-XCDVKR23.js → config-XUUYQIWO.js} +47 -35
  82. package/dist/{configure-4GAP54ZW.js → configure-IHJ7YOMV.js} +18 -15
  83. package/dist/{context-77FM5DV5.js → context-74JLXAWD.js} +18 -10
  84. package/dist/{context-4UOGGLQ5.js → context-75MIWW3U.js} +41 -29
  85. package/dist/{context-5VKGUVJJ.js → context-ZQ7SIFJV.js} +85 -9
  86. package/dist/{context-clear-XXJRLCJJ.js → context-clear-GYKWNUML.js} +41 -29
  87. package/dist/{context-index-BZ4UYMTC.js → context-index-SSR5ECNE.js} +3 -3
  88. package/dist/context-working-set-UX5KEP4J.js +1553 -0
  89. package/dist/{dispatch-runner-QPRDDBDX.js → dispatch-runner-GIJBHNFL.js} +47 -32
  90. package/dist/{docs-2C2LTVT2.js → docs-6FZSCG5B.js} +3 -3
  91. package/dist/{doctor-HR46URBJ.js → doctor-SVJ5BZCW.js} +12 -12
  92. package/dist/{eval-XSSNATB4.js → eval-CG6LLBLD.js} +54 -238
  93. package/dist/{evidence-6HG2PY2B.js → evidence-ZYFIEN42.js} +57 -28
  94. package/dist/{evolve-K7YU3NCY.js → evolve-QGEXEMDW.js} +36 -25
  95. package/dist/{extensions-QVDOHDGJ.js → extensions-ADGNCJJD.js} +3 -3
  96. package/dist/{fleet-VY3HHKN6.js → fleet-S5R4ZOQY.js} +73 -44
  97. package/dist/{fleet-preflight-DDN536IT.js → fleet-preflight-BHSNPBMH.js} +3 -3
  98. package/dist/{init-JYGXI3FK.js → init-5DRU55YR.js} +49 -37
  99. package/dist/memory-7YKKR6UC.js +467 -0
  100. package/dist/{models-I5QWSEOM.js → models-ZPOLRU2C.js} +24 -21
  101. package/dist/{monitor-GE4ID3IA.js → monitor-US5F5YGZ.js} +73 -46
  102. package/dist/{orchestrator-EM5MC3HM.js → orchestrator-E2AL4T5N.js} +1624 -1007
  103. package/dist/{paths-UXLN5YYZ.js → paths-E7KYAQWE.js} +3 -3
  104. package/dist/{reset-L2FQEE3E.js → reset-KZ652EK6.js} +6 -5
  105. package/dist/{run-ZU3QMZPZ.js → run-SRNBKDWD.js} +76 -54
  106. package/dist/{share-S5BZQC5I.js → share-CGZE33UP.js} +7 -6
  107. package/dist/{skills-X5VXCRNQ.js → skills-S2X4DLY5.js} +4 -4
  108. package/dist/{skills-eval-WKIHWTHR.js → skills-eval-W2GGIC4R.js} +40 -29
  109. package/dist/{targets-SNCPI2NR.js → targets-54SWINWB.js} +28 -23
  110. package/dist/{terminal-lease-BNAHVHBS.js → terminal-lease-SAIF2OGY.js} +6 -4
  111. package/dist/{uninstall-FZCQCDKC.js → uninstall-BVLWXKBT.js} +3 -3
  112. package/dist/{upgrade-JQHHPQ4K.js → upgrade-JKAR27XC.js} +20 -19
  113. package/dist/{usage-OR4O5SMZ.js → usage-MSAWCLX4.js} +79 -36
  114. package/dist/verifiers-NCBTHHN2.js +1220 -0
  115. package/dist/verify-X5HDROLA.js +25 -0
  116. package/dist/{wiki-generate-UEXP2ARI.js → wiki-generate-GUSOQ6ZP.js} +50 -37
  117. package/dist/worker/entry.js +90 -70
  118. package/dist/{workspace-G4ZWUIPR.js → workspace-ZJ6BFM3Q.js} +4 -4
  119. package/docs/README.md +8 -7
  120. package/docs/acp.md +1 -1
  121. package/docs/alcf-provider.md +1 -1
  122. package/docs/architecture.md +2 -2
  123. package/docs/artifact-placement.md +1 -2
  124. package/docs/artifact-versions.md +1 -1
  125. package/docs/built-in-agents.md +1 -1
  126. package/docs/capacity-and-scheduling.md +1 -1
  127. package/docs/commands-and-modes.md +60 -26
  128. package/docs/config-knobs-audit.md +1 -2
  129. package/docs/configuration-and-targets.md +26 -1
  130. package/docs/context-engine.md +67 -13
  131. package/docs/context-working-set.md +194 -0
  132. package/docs/development-pipeline.md +1 -1
  133. package/docs/documentation-coverage.md +6 -6
  134. package/docs/documentation-guide.md +7 -6
  135. package/docs/environment-variables.md +2 -1
  136. package/docs/eval-runner.md +1 -1
  137. package/docs/evals-internal.md +4 -32
  138. package/docs/evidence-and-memory.md +139 -7
  139. package/docs/evolution.md +1 -1
  140. package/docs/exit-codes-and-output.md +1 -1
  141. package/docs/extensions-and-sharing.md +2 -2
  142. package/docs/fleet-dispatch.md +49 -8
  143. package/docs/glossary.md +21 -1
  144. package/docs/installation-and-lifecycle.md +2 -2
  145. package/docs/middleware-and-components.md +19 -2
  146. package/docs/model-catalog.md +7 -9
  147. package/docs/observability.md +4 -4
  148. package/docs/proactive-memory.md +26 -16
  149. package/docs/prompt-envelope-and-tools.md +7 -5
  150. package/docs/provider-adapter-cookbook.md +1 -1
  151. package/docs/release-cut-checklist.md +43 -40
  152. package/docs/safety-model.md +49 -8
  153. package/docs/scientific-validation.md +21 -3
  154. package/docs/session-lifecycle.md +3 -3
  155. package/docs/skills-marketplace.md +1 -1
  156. package/docs/tool-usage.md +79 -12
  157. package/docs/trace-store.md +1 -1
  158. package/docs/troubleshooting.md +1 -1
  159. package/docs/tui-design.md +38 -4
  160. package/docs/worker-dispatch-mechanics.md +11 -1
  161. package/package.json +13 -13
  162. package/skills/meta/clio-test/SKILL.md +20 -17
  163. package/skills/meta/clio-test/evals.md +3 -3
  164. package/skills/meta/clio-test/references/harness.md +35 -6
  165. package/skills/meta/clio-test/references/test-map.md +20 -10
  166. package/skills/registry.yaml +2 -2
  167. package/skills/skill-marketplace.json +1 -1
  168. package/src/cli/agents.ts +2 -3
  169. package/src/cli/argv.ts +14 -1
  170. package/src/cli/context-working-set.ts +513 -0
  171. package/src/cli/context.ts +8 -0
  172. package/src/cli/evidence.ts +20 -2
  173. package/src/cli/fleet.ts +15 -0
  174. package/src/cli/index.ts +5 -1
  175. package/src/cli/memory.ts +272 -10
  176. package/src/cli/modes/json-stream.ts +2 -2
  177. package/src/cli/modes/print.ts +12 -1
  178. package/src/cli/run.ts +22 -2
  179. package/src/cli/targets.ts +12 -3
  180. package/src/cli/usage.ts +55 -7
  181. package/src/cli/verifiers.ts +325 -0
  182. package/src/core/bash-exec.ts +39 -14
  183. package/src/core/bus-events.ts +22 -4
  184. package/src/core/config.ts +54 -0
  185. package/src/core/defaults.ts +50 -3
  186. package/src/core/response-model-id.ts +134 -0
  187. package/src/core/toml.ts +62 -0
  188. package/src/core/verification-scripts.ts +6 -0
  189. package/src/core/workspace-files.ts +0 -1
  190. package/src/domains/agents/builtins/architect.md +1 -1
  191. package/src/domains/agents/builtins/verifier.md +3 -0
  192. package/src/domains/agents/catalog.ts +5 -4
  193. package/src/domains/agents/recipe.ts +54 -14
  194. package/src/domains/agents/result-contract.ts +7 -4
  195. package/src/domains/config/classify.ts +1 -0
  196. package/src/domains/context/bootstrap.ts +36 -27
  197. package/src/domains/context/project-metadata.ts +19 -63
  198. package/src/domains/context/prompt-context.ts +8 -0
  199. package/src/domains/context/working-set/contract.ts +161 -0
  200. package/src/domains/context/working-set/defaults.ts +28 -0
  201. package/src/domains/context/working-set/engine.ts +203 -0
  202. package/src/domains/context/working-set/fold.ts +62 -0
  203. package/src/domains/context/working-set/horizon.ts +38 -0
  204. package/src/domains/context/working-set/marker.ts +103 -0
  205. package/src/domains/context/working-set/path-index.ts +436 -0
  206. package/src/domains/context/working-set/payload.ts +152 -0
  207. package/src/domains/context/working-set/policies/age-horizon.ts +55 -0
  208. package/src/domains/context/working-set/policies/index.ts +20 -0
  209. package/src/domains/context/working-set/policies/structural.ts +160 -0
  210. package/src/domains/context/working-set/project.ts +132 -0
  211. package/src/domains/context/working-set/protect.ts +109 -0
  212. package/src/domains/context/working-set/recall.ts +177 -0
  213. package/src/domains/context/working-set/replay/controls.ts +112 -0
  214. package/src/domains/context/working-set/replay/load-clio.ts +199 -0
  215. package/src/domains/context/working-set/replay/metrics.ts +185 -0
  216. package/src/domains/context/working-set/replay/reference-graph.ts +79 -0
  217. package/src/domains/context/working-set/replay/report.ts +139 -0
  218. package/src/domains/context/working-set/replay/runner.ts +325 -0
  219. package/src/domains/context/working-set/replay/synthetic.ts +422 -0
  220. package/src/domains/context/working-set/replay/trace.ts +21 -0
  221. package/src/domains/context/working-set/visible.ts +54 -0
  222. package/src/domains/dispatch/budget-envelope.ts +396 -0
  223. package/src/domains/dispatch/contract.ts +2 -0
  224. package/src/domains/dispatch/extension.ts +81 -27
  225. package/src/domains/dispatch/orphan-recovery.ts +1 -0
  226. package/src/domains/dispatch/receipt-integrity.ts +4 -0
  227. package/src/domains/dispatch/state.ts +1 -0
  228. package/src/domains/dispatch/types.ts +10 -3
  229. package/src/domains/dispatch/validation.ts +14 -0
  230. package/src/domains/dispatch/worker-spawn.ts +14 -3
  231. package/src/domains/eval/metrics/evidence.ts +0 -116
  232. package/src/domains/eval/metrics/invariants.ts +1 -1
  233. package/src/domains/eval/runners/clio-run.ts +1 -10
  234. package/src/domains/eval/runners/external-command.ts +2 -29
  235. package/src/domains/eval/schema/suite.ts +0 -7
  236. package/src/domains/eval/suites/run.ts +1 -7
  237. package/src/domains/evidence/build.ts +112 -45
  238. package/src/domains/evidence/eval.ts +24 -7
  239. package/src/domains/evidence/index.ts +53 -0
  240. package/src/domains/evidence/ordering.ts +12 -0
  241. package/src/domains/evidence/run-trust.ts +221 -0
  242. package/src/domains/evidence/store.ts +46 -6
  243. package/src/domains/evidence/trust-status.ts +854 -0
  244. package/src/domains/evidence/types.ts +26 -0
  245. package/src/domains/memory/index.ts +22 -0
  246. package/src/domains/memory/operations.ts +58 -1
  247. package/src/domains/memory/promotion.ts +281 -0
  248. package/src/domains/memory/prompt-section.ts +25 -5
  249. package/src/domains/memory/proposal.ts +51 -7
  250. package/src/domains/memory/task-bank.ts +3 -2
  251. package/src/domains/memory/task-memory-handoff.ts +181 -24
  252. package/src/domains/memory/task-memory-policy.ts +3 -1
  253. package/src/domains/memory/types.ts +37 -0
  254. package/src/domains/memory/validate.ts +178 -0
  255. package/src/domains/middleware/memory-intervention.ts +38 -25
  256. package/src/domains/middleware/runtime.ts +6 -0
  257. package/src/domains/middleware/skills-reminder.ts +19 -4
  258. package/src/domains/middleware/stalled-turn.ts +208 -5
  259. package/src/domains/middleware/types.ts +10 -0
  260. package/src/domains/observability/contract.ts +6 -1
  261. package/src/domains/observability/cost.ts +20 -4
  262. package/src/domains/observability/extension.ts +2 -2
  263. package/src/domains/providers/index.ts +3 -0
  264. package/src/domains/providers/model-discovery.ts +9 -0
  265. package/src/domains/providers/runtime-resolution.ts +38 -1
  266. package/src/domains/providers/runtimes/common/probe-helpers.ts +97 -16
  267. package/src/domains/providers/types/context-window-slots.ts +18 -0
  268. package/src/domains/providers/types/runtime-descriptor.ts +3 -1
  269. package/src/domains/safety/autonomy.ts +1 -1
  270. package/src/domains/safety/call-target.ts +211 -14
  271. package/src/domains/safety/decision-presentation.ts +268 -0
  272. package/src/domains/safety/default-path-policy.ts +8 -0
  273. package/src/domains/safety/finish-contract.ts +4 -3
  274. package/src/domains/safety/policy-engine.ts +48 -6
  275. package/src/domains/safety/redaction.ts +73 -0
  276. package/src/domains/session/compaction/compact.ts +23 -1
  277. package/src/domains/session/compaction/cut-point.ts +2 -0
  278. package/src/domains/session/compaction/tokens.ts +16 -1
  279. package/src/domains/session/context-ledger.ts +12 -1
  280. package/src/domains/session/decision-board.ts +4 -0
  281. package/src/domains/session/entries.ts +110 -1
  282. package/src/domains/session/history.ts +68 -19
  283. package/src/domains/session/manager.ts +9 -2
  284. package/src/domains/session/migrations/index.ts +22 -3
  285. package/src/domains/session/usage.ts +24 -7
  286. package/src/engine/acp/event-mapper.ts +7 -0
  287. package/src/engine/acp/server.ts +32 -2
  288. package/src/engine/agent.ts +18 -1
  289. package/src/engine/apis/lmstudio.ts +25 -4
  290. package/src/engine/apis/openai-completions.ts +147 -22
  291. package/src/engine/claude/sdk-runtime.ts +8 -2
  292. package/src/engine/claude/tool-safety.ts +13 -0
  293. package/src/engine/loop-guard.ts +27 -3
  294. package/src/engine/session.ts +9 -3
  295. package/src/engine/worker-events.ts +4 -3
  296. package/src/engine/worker-runtime.ts +59 -54
  297. package/src/entry/orchestrator.ts +34 -5
  298. package/src/interactive/chat-loop-messages.ts +40 -6
  299. package/src/interactive/chat-loop.ts +13 -0
  300. package/src/interactive/chat-panel.ts +17 -1
  301. package/src/interactive/chat-renderer.ts +49 -24
  302. package/src/interactive/clio-editor.ts +44 -7
  303. package/src/interactive/context-meter.ts +10 -0
  304. package/src/interactive/context-overlay.ts +120 -7
  305. package/src/interactive/context-recall-command.ts +110 -0
  306. package/src/interactive/cost-overlay.ts +39 -8
  307. package/src/interactive/dispatch-board.ts +212 -35
  308. package/src/interactive/footer/widgets.ts +13 -0
  309. package/src/interactive/interactive-application.ts +6 -1
  310. package/src/interactive/interactive-input-runtime.ts +11 -1
  311. package/src/interactive/interactive-presentation.ts +11 -1
  312. package/src/interactive/interactive-slash-runtime.ts +37 -1
  313. package/src/interactive/memory-overlay.ts +89 -4
  314. package/src/interactive/model-session-replay.ts +21 -0
  315. package/src/interactive/overlay-ask-user-lifecycle.ts +1 -1
  316. package/src/interactive/overlay-frame.ts +5 -2
  317. package/src/interactive/overlay-general-openers.ts +46 -1
  318. package/src/interactive/overlay-key-routing.ts +41 -1
  319. package/src/interactive/overlay-lifecycle.ts +11 -4
  320. package/src/interactive/overlay-permission-lifecycle.ts +23 -8
  321. package/src/interactive/overlay-session-lifecycle.ts +8 -4
  322. package/src/interactive/overlay-transitions.ts +11 -0
  323. package/src/interactive/overlays/ask-user.ts +74 -30
  324. package/src/interactive/overlays/decisions.ts +3 -1
  325. package/src/interactive/permission-hint.ts +35 -0
  326. package/src/interactive/permission-overlay.ts +95 -45
  327. package/src/interactive/renderers/tool-execution.ts +37 -51
  328. package/src/interactive/session-last-turn.ts +8 -1
  329. package/src/interactive/session-transcript.ts +2 -2
  330. package/src/interactive/session-usage-reseed.ts +36 -10
  331. package/src/interactive/slash-commands.ts +31 -4
  332. package/src/interactive/status/summary.ts +5 -0
  333. package/src/interactive/status/types.ts +5 -0
  334. package/src/interactive/terminal-lease.ts +1 -0
  335. package/src/interactive/turn-context.ts +333 -110
  336. package/src/interactive/turn-middleware.ts +7 -6
  337. package/src/interactive/turn-runtime.ts +37 -8
  338. package/src/interactive/turn-state.ts +3 -0
  339. package/src/interactive/worker-progress.ts +440 -0
  340. package/src/interactive/worker-stream.ts +51 -110
  341. package/src/tools/agent-tools.ts +39 -7
  342. package/src/tools/ask-user.ts +21 -1
  343. package/src/tools/bash.ts +144 -82
  344. package/src/tools/builtin-tool-catalog.ts +11 -5
  345. package/src/tools/context/index.ts +107 -5
  346. package/src/tools/context/surface.ts +3 -2
  347. package/src/tools/core-bootstrap.ts +21 -0
  348. package/src/tools/dispatch-arguments.ts +8 -0
  349. package/src/tools/dispatch-event-text.ts +19 -0
  350. package/src/tools/dispatch-runner.ts +9 -7
  351. package/src/tools/dispatch.ts +24 -1
  352. package/src/tools/monitor.ts +43 -20
  353. package/src/tools/registry.ts +72 -10
  354. package/src/tools/result-disposition.ts +706 -0
  355. package/src/tools/result-shaping.ts +321 -20
  356. package/src/tools/safe-exec.ts +2 -0
  357. package/src/tools/verify/authoring.ts +1120 -0
  358. package/src/tools/verify/catalog.ts +346 -0
  359. package/src/tools/verify/index.ts +13 -3
  360. package/src/tools/verify/scripts.ts +135 -37
  361. package/src/tools/verify/surface.ts +9 -5
  362. package/src/tools/worker-evidence.ts +54 -12
  363. package/src/worker/spec-contract.ts +43 -3
  364. package/dist/chunk-J7CWMCQD.js +0 -255
  365. package/dist/chunk-T6YILFSB.js +0 -80
  366. package/dist/chunk-VAKQQHWR.js +0 -434
  367. package/dist/chunk-VPAYEGVX.js +0 -184
  368. package/dist/chunk-XBXAASKX.js +0 -18
  369. package/dist/memory-WFZMGYHX.js +0 -236
  370. package/src/domains/eval/metrics/chaos-stream.ts +0 -93
@@ -5,7 +5,7 @@ import {
5
5
  settingsPath,
6
6
  updateSavedSettingsDocument,
7
7
  validateSettings
8
- } from "./chunk-A3CYT5EX.js";
8
+ } from "./chunk-AD2SYQYC.js";
9
9
  import {
10
10
  require_dist
11
11
  } from "./chunk-APJ265NV.js";
@@ -226,4 +226,4 @@ export {
226
226
  updateLayeredSettings,
227
227
  settingsSourceFor
228
228
  };
229
- //# sourceMappingURL=chunk-CBCAPZAA.js.map
229
+ //# sourceMappingURL=chunk-E25LMLRW.js.map
@@ -549,8 +549,277 @@ function clioTheme() {
549
549
 
550
550
  // src/interactive/clio-editor.ts
551
551
  init_esm_shims();
552
+
553
+ // src/interactive/overlay-frame.ts
554
+ init_esm_shims();
555
+ var DEFAULT_SELECT_THEME = selectListTheme(clioTheme());
556
+ var DEFAULT_SETTINGS_THEME = settingsListTheme(clioTheme());
557
+ var FocusBox = class extends Box {
558
+ inputTarget;
559
+ onInput;
560
+ constructor(children, options) {
561
+ super(options?.x ?? 1, options?.y ?? 0);
562
+ const childList = Array.isArray(children) ? children : [children];
563
+ for (const child of childList) this.addChild(child);
564
+ this.inputTarget = options?.inputTarget === void 0 ? childList[0] ?? null : options.inputTarget;
565
+ this.onInput = options?.onInput;
566
+ }
567
+ handleInput(data) {
568
+ if (this.onInput) {
569
+ this.onInput(data);
570
+ return;
571
+ }
572
+ this.inputTarget?.handleInput?.(data);
573
+ }
574
+ };
575
+ function resolveTone(tone) {
576
+ return typeof tone === "function" ? tone() : tone;
577
+ }
578
+ function clioFrame(text, token = "frame") {
579
+ return clioTheme().fg(token, text);
580
+ }
581
+ function clioTitle(text, token) {
582
+ return token === void 0 ? screenTitle(clioTheme(), text) : clioTheme().style(token, text, { bold: true });
583
+ }
584
+ function clioError(text) {
585
+ return clioTheme().fg("error", text);
586
+ }
587
+ function brandedTopBorder(label, innerWidth, tone) {
588
+ const frame2 = (text) => clioFrame(text, tone ?? "frame");
589
+ const clean = label.replace(/^[┌┐└┘├┤─│\s]+/, "").replace(/[┌┐└┘├┤─│\s]+$/, "");
590
+ const formatted = clean.length > 0 ? `\u2500 ${clean} ` : "\u2500";
591
+ const clipped = visibleWidth(formatted) > innerWidth ? truncateToWidth(formatted, innerWidth, "\u2026", true) : formatted;
592
+ const fill = "\u2500".repeat(Math.max(0, innerWidth - visibleWidth(clipped)));
593
+ const cleanIndex = clipped.indexOf(clean);
594
+ if (cleanIndex !== -1) {
595
+ const prefix = clipped.slice(0, cleanIndex);
596
+ const suffix = clipped.slice(cleanIndex + clean.length);
597
+ return `${frame2("\u250C")}${frame2(prefix)}${clioTitle(clean, tone)}${frame2(suffix)}${frame2(fill)}${frame2("\u2510")}`;
598
+ }
599
+ return `${frame2("\u250C")}${frame2(clipped)}${frame2(fill)}${frame2("\u2510")}`;
600
+ }
601
+ function isCriticalHintKey(key) {
602
+ const canonical = canonicalizeKey(key);
603
+ return canonical === "Esc" || canonical === "Enter" || canonical === "Enter/Space" || canonical === "type";
604
+ }
605
+ function isCriticalEntry(entry) {
606
+ return entry.critical ?? isCriticalHintKey(entry.key);
607
+ }
608
+ function renderHintEntries(entries, short) {
609
+ return entries.map((entry) => `[${canonicalizeKey(entry.key)}] ${short ? entry.short ?? entry.verb : entry.verb}`).join(" \xB7 ");
610
+ }
611
+ function fitHintEntries(entries, maxWidth) {
612
+ if (entries.length === 0) return "";
613
+ for (const short of [false, true]) {
614
+ const rendered = renderHintEntries(entries, short);
615
+ if (visibleWidth(rendered) <= maxWidth) return rendered;
616
+ }
617
+ const kept = [...entries];
618
+ for (const criticalPass of [false, true]) {
619
+ while (kept.length > 1) {
620
+ const index = kept.findIndex((entry) => criticalPass || !isCriticalEntry(entry));
621
+ if (index === -1) break;
622
+ kept.splice(index, 1);
623
+ const rendered = renderHintEntries(kept, true);
624
+ if (visibleWidth(rendered) <= maxWidth) return rendered;
625
+ }
626
+ }
627
+ return renderHintEntries(kept, true);
628
+ }
629
+ var FILTER_HINT = { key: "type", verb: "filter" };
630
+ function canonicalizeKey(key) {
631
+ const trimmed = key.trim();
632
+ if (trimmed === "R") return "R";
633
+ const lower = trimmed.toLowerCase();
634
+ if (lower === "up/down" || lower === "updown" || lower === "\u2191/\u2193" || lower === "up/down/j/k" || lower === "\u2191\u2193")
635
+ return "\u2191\u2193";
636
+ if (lower === "enter/space") return "Enter/Space";
637
+ if (lower === "enter") return "Enter";
638
+ if (lower === "esc" || lower === "escape") return "Esc";
639
+ if (lower === "space") return "Space";
640
+ if (lower === "tab") return "Tab";
641
+ if (lower === "r") return "r";
642
+ if (lower === "type") return "type";
643
+ return trimmed;
644
+ }
645
+ function buildHint(entries, esc = "close") {
646
+ const finalEntries = [
647
+ ...entries.map((e) => ({ key: canonicalizeKey(e.key), verb: e.verb })),
648
+ { key: "Esc", verb: esc }
649
+ ];
650
+ return finalEntries.map((e) => `[${e.key}] ${e.verb}`).join(" \xB7 ");
651
+ }
652
+ function elideHint(hint, maxCleanWidth) {
653
+ const parts = hint.split(" \xB7 ");
654
+ if (parts.length <= 2) return hint;
655
+ const entries = parts.map((part) => {
656
+ const match = /^\[([^\]]+)\] ([\s\S]+)$/u.exec(part);
657
+ if (!match) return { key: "", verb: part, critical: false };
658
+ return { key: match[1] ?? "", verb: match[2] ?? "" };
659
+ });
660
+ const rendered = fitHintEntries(entries, maxCleanWidth);
661
+ return rendered.replace(/\[\] /gu, "");
662
+ }
663
+ function brandedBottomBorder(innerWidth, hint, tone) {
664
+ const frame2 = (text) => clioFrame(text, tone ?? "frame");
665
+ if (!hint || hint.trim().length === 0) {
666
+ return `${frame2("\u2514")}${frame2("\u2500".repeat(innerWidth))}${frame2("\u2518")}`;
667
+ }
668
+ let clean = hint.trim();
669
+ const maxCleanWidth = innerWidth - 3;
670
+ if (clean.includes(" \xB7 ") && visibleWidth(`\u2500 ${clean} `) > innerWidth) {
671
+ clean = elideHint(clean, maxCleanWidth);
672
+ }
673
+ const formatted = `\u2500 ${clean} `;
674
+ const clipped = visibleWidth(formatted) > innerWidth ? truncateToWidth(formatted, innerWidth, "\u2026", true) : formatted;
675
+ const fill = "\u2500".repeat(Math.max(0, innerWidth - visibleWidth(clipped)));
676
+ const cleanIndex = clipped.indexOf(clean);
677
+ if (cleanIndex !== -1) {
678
+ const prefix = clipped.slice(0, cleanIndex);
679
+ const suffix = clipped.slice(cleanIndex + clean.length);
680
+ return `${frame2("\u2514")}${frame2(prefix)}${clioTheme().fg("dim", clean)}${frame2(suffix)}${frame2(fill)}${frame2("\u2518")}`;
681
+ }
682
+ return `${frame2("\u2514")}${frame2(clipped)}${frame2(fill)}${frame2("\u2518")}`;
683
+ }
684
+ function formatRuntimeResolutionDiagnostic(diagnostic) {
685
+ return `${diagnostic.severity}: ${diagnostic.code}: ${diagnostic.message}`;
686
+ }
687
+ function diagnosticSeverityToken(severity) {
688
+ return severity === "error" ? "error" : severity === "warning" ? "warning" : "muted";
689
+ }
690
+ function runtimeResolutionDiagnosticLine(diagnostic, width) {
691
+ return clioTheme().fg(diagnosticSeverityToken(diagnostic.severity), fitDiagnosticLine(diagnostic, width));
692
+ }
693
+ function fitDiagnosticLine(diagnostic, width) {
694
+ return padAnsi(formatRuntimeResolutionDiagnostic(diagnostic), Math.max(1, width));
695
+ }
696
+ function frameAlignForAnchor(anchor) {
697
+ if (anchor === void 0) return "center";
698
+ if (anchor === "left-center" || anchor.endsWith("-left")) return "left";
699
+ if (anchor === "right-center" || anchor.endsWith("-right")) return "right";
700
+ return "center";
701
+ }
702
+ function fitBody(lines, rowBudget, contentWidth) {
703
+ if (rowBudget <= 0) return lines;
704
+ const bodyBudget = Math.max(1, rowBudget - 2);
705
+ if (lines.length <= bodyBudget) return lines;
706
+ const kept = lines.slice(0, bodyBudget - 1);
707
+ const hidden = lines.length - kept.length;
708
+ return [...kept, clioTheme().fg("dim", truncateToWidth(`\u2026 ${hidden} more rows`, contentWidth, "", true))];
709
+ }
710
+ var ClioOverlayFrame = class {
711
+ constructor(child, title, footerHint, boxWidth = 0, align = "center", tone) {
712
+ this.child = child;
713
+ this.title = title;
714
+ this.footerHint = footerHint;
715
+ this.boxWidth = boxWidth;
716
+ this.align = align;
717
+ this.tone = tone;
718
+ }
719
+ child;
720
+ title;
721
+ footerHint;
722
+ boxWidth;
723
+ align;
724
+ tone;
725
+ /**
726
+ * Rows the box may occupy, or zero while unknown.
727
+ *
728
+ * `Component.render` is handed a width and nothing else, so the frame learns
729
+ * its height budget from the engine's `visible` predicate, which is called
730
+ * with the live terminal size immediately before the render pass that
731
+ * composites this overlay.
732
+ */
733
+ rowBudget = 0;
734
+ /**
735
+ * Last rendered box, keyed by everything that shapes it. `childLines` is
736
+ * compared by array identity: a child that rebuilds its rows returns a fresh
737
+ * array and correctly misses, and one that serves a cache returns the same
738
+ * array and correctly hits.
739
+ */
740
+ cachedRender;
741
+ setRowBudget(rows) {
742
+ this.rowBudget = Math.max(0, Math.floor(rows));
743
+ }
744
+ render(width) {
745
+ const boxWidth = Math.max(5, Math.min(this.boxWidth > 0 ? this.boxWidth : width, width));
746
+ const contentWidth = Math.max(1, boxWidth - 4);
747
+ const childLines = this.child.render(contentWidth);
748
+ const titleText = typeof this.title === "function" ? this.title() : this.title;
749
+ const hint = typeof this.footerHint === "function" ? this.footerHint(contentWidth + 2) : this.footerHint;
750
+ const tone = resolveTone(this.tone);
751
+ const cached = this.cachedRender;
752
+ if (cached !== void 0 && cached.width === width && cached.rowBudget === this.rowBudget && cached.childLines === childLines && cached.title === titleText && cached.hint === hint && cached.tone === tone) {
753
+ return cached.lines;
754
+ }
755
+ const label = titleText.length > 0 ? `\u2500 ${titleText} ` : "\u2500 ";
756
+ const side = clioFrame("\u2502", tone ?? "frame");
757
+ const boxLines = [
758
+ brandedTopBorder(label, contentWidth + 2, tone),
759
+ ...fitBody(childLines, this.rowBudget, contentWidth).map((line) => `${side} ${padAnsi(line, contentWidth)} ${side}`),
760
+ brandedBottomBorder(contentWidth + 2, hint, tone)
761
+ ];
762
+ const slack = Math.max(0, width - boxWidth);
763
+ const lines = (() => {
764
+ if (slack === 0) return boxLines;
765
+ const leading = this.align === "left" ? 0 : this.align === "right" ? slack : Math.floor(slack / 2);
766
+ const lead = " ".repeat(leading);
767
+ const trail = " ".repeat(slack - leading);
768
+ return boxLines.map((line) => `${lead}${line}${trail}`);
769
+ })();
770
+ this.cachedRender = { width, rowBudget: this.rowBudget, childLines, title: titleText, hint, tone, lines };
771
+ return lines;
772
+ }
773
+ handleInput(data) {
774
+ this.child.handleInput?.(data);
775
+ }
776
+ invalidate() {
777
+ this.cachedRender = void 0;
778
+ this.child.invalidate?.();
779
+ }
780
+ };
781
+ function showClioOverlayFrame(tui, child, options) {
782
+ const { title, footerHint, tone, width, visible, maxHeight, margin, ...overlayOptions } = options;
783
+ const boxWidth = typeof width === "number" ? width : 0;
784
+ const frame2 = new ClioOverlayFrame(child, title, footerHint, boxWidth, frameAlignForAnchor(options.anchor), tone);
785
+ return tui.showOverlay(frame2, {
786
+ ...overlayOptions,
787
+ ...margin !== void 0 ? { margin } : {},
788
+ width: "100%",
789
+ visible: (termWidth, termHeight) => {
790
+ const shown = visible ? visible(termWidth, termHeight) : true;
791
+ const marginRows = typeof margin === "number" ? margin * 2 : (margin?.top ?? 0) + (margin?.bottom ?? 0);
792
+ const available = Math.max(1, termHeight - marginRows);
793
+ const requested = resolveRowSize(maxHeight, termHeight);
794
+ frame2.setRowBudget(requested === null ? available : Math.min(requested, available));
795
+ return shown;
796
+ }
797
+ });
798
+ }
799
+ function resolveRowSize(value, termHeight) {
800
+ if (typeof value === "number") return Math.max(1, Math.floor(value));
801
+ if (typeof value !== "string") return null;
802
+ const percent = /^(\d+(?:\.\d+)?)%$/u.exec(value.trim());
803
+ if (!percent?.[1]) return null;
804
+ return Math.max(1, Math.floor(termHeight * Number.parseFloat(percent[1]) / 100));
805
+ }
806
+
807
+ // src/interactive/permission-hint.ts
808
+ init_esm_shims();
809
+ function permissionHintEntries(composerHasDraft = false) {
810
+ return [
811
+ composerHasDraft ? { key: "Backspace", verb: "clear the draft to allow", short: "clear draft", critical: true } : { key: "Enter", verb: "allow once", short: "allow", critical: true },
812
+ { key: "s", verb: "stop turn", short: "stop", critical: true },
813
+ // With a draft, deny and stop are the only immediate answers, so Esc
814
+ // outranks the narrowing that would otherwise drop it first.
815
+ { key: "Esc", verb: "deny", critical: composerHasDraft }
816
+ ];
817
+ }
818
+
819
+ // src/interactive/clio-editor.ts
552
820
  var REVERSE_VIDEO_BLANK = `${String.fromCharCode(27)}[7m ${String.fromCharCode(27)}[0m`;
553
821
  var EMPTY_PROMPT = "Ask Clio\u2026 / for commands";
822
+ var CONFIRM_PROMPT = "A parked call is waiting for your decision";
554
823
  var MIN_HINT_WIDTH = 60;
555
824
  function hasScrollIndicator(line) {
556
825
  const stripped = stripTerminalSequences(line);
@@ -579,6 +848,7 @@ function styledRailLabel(theme, chrome) {
579
848
  return `${theme.fg("dim", chrome.getModelLabel())} ${theme.fg("dim", "\xB7")} ${styledThinkingHint(theme, chrome.getThinkingLabel())}`;
580
849
  }
581
850
  function composerMode(chrome, text) {
851
+ if (chrome.isAwaitingApproval?.() ?? false) return "CONFIRM";
582
852
  if (!(chrome.isStreaming?.() ?? false)) return "MESSAGE";
583
853
  const willSteer = chrome.willEnterSteer?.(text) ?? text.trim().length > 0;
584
854
  return willSteer ? "STEER" : "FOLLOW-UP";
@@ -589,12 +859,20 @@ function lowerRailHint(theme, chrome) {
589
859
  `${chrome.getSubmitKeyLabel?.() ?? "Enter"} send \xB7 ${chrome.getNewlineKeyLabel?.() ?? "Shift+Enter"} newline`
590
860
  );
591
861
  }
592
- function renderEmptyPrompt(line, width, theme) {
862
+ function confirmRailHint(theme, width, hasDraft) {
863
+ return theme.fg("warning", fitHintEntries(permissionHintEntries(hasDraft), Math.max(1, width - 3)));
864
+ }
865
+ function modeToken(mode) {
866
+ if (mode === "STEER") return "action";
867
+ if (mode === "CONFIRM") return "warning";
868
+ return "accentDeep";
869
+ }
870
+ function renderEmptyPrompt(line, width, theme, text = EMPTY_PROMPT) {
593
871
  const cursorAt = line.indexOf(REVERSE_VIDEO_BLANK);
594
872
  if (cursorAt < 0) return line;
595
873
  const afterCursorAt = cursorAt + REVERSE_VIDEO_BLANK.length;
596
874
  const available = Math.max(0, width - 1);
597
- const prompt = truncateToWidth(theme.fg("dim", EMPTY_PROMPT), available, "\u2026", false);
875
+ const prompt = truncateToWidth(theme.fg("dim", text), available, "\u2026", false);
598
876
  const consumed = visibleWidth(prompt);
599
877
  return `${line.slice(0, afterCursorAt)}${prompt}${line.slice(afterCursorAt + consumed)}`;
600
878
  }
@@ -619,21 +897,30 @@ var ClioEditor = class extends Editor {
619
897
  const text = this.getText();
620
898
  const mode = composerMode(this.chrome, text);
621
899
  if (hasScrollIndicator(lines[0] ?? "")) {
622
- const modeLabel = theme.style(mode === "STEER" ? "action" : "accentDeep", mode, { bold: true });
900
+ const modeLabel = theme.style(modeToken(mode), mode, { bold: true });
623
901
  lines[0] = truncateToWidth(`${modeLabel} ${lines[0] ?? ""}`, safeWidth, "", true);
624
902
  } else {
625
903
  lines[0] = rule(theme, safeWidth, {
626
904
  left: mode,
627
- leftToken: mode === "STEER" ? "action" : "accentDeep",
905
+ leftToken: modeToken(mode),
628
906
  right: styledRailLabel(theme, this.chrome),
629
907
  fillToken: "frameStrong",
630
908
  rightRaw: true,
631
909
  rightTail: theme.style("frameStrong", "\u2500", { bold: true })
632
910
  });
633
911
  }
634
- if (text.length === 0 && lines[1]) lines[1] = renderEmptyPrompt(lines[1], safeWidth, theme);
912
+ if (text.length === 0 && lines[1]) {
913
+ lines[1] = renderEmptyPrompt(lines[1], safeWidth, theme, mode === "CONFIRM" ? CONFIRM_PROMPT : EMPTY_PROMPT);
914
+ }
635
915
  const bottomRail = findBottomRail(lines, safeWidth);
636
- if (bottomRail >= 0 && safeWidth >= MIN_HINT_WIDTH) {
916
+ if (bottomRail >= 0 && mode === "CONFIRM") {
917
+ lines[bottomRail] = rule(theme, safeWidth, {
918
+ right: confirmRailHint(theme, safeWidth, text.length > 0),
919
+ fillToken: "frameStrong",
920
+ rightRaw: true,
921
+ rightTail: theme.style("frameStrong", "\u2500", { bold: true })
922
+ });
923
+ } else if (bottomRail >= 0 && safeWidth >= MIN_HINT_WIDTH) {
637
924
  lines[bottomRail] = rule(theme, safeWidth, {
638
925
  right: lowerRailHint(theme, this.chrome),
639
926
  fillToken: "frameStrong",
@@ -1825,7 +2112,6 @@ function createKeybindingManager(settings, env = process.env) {
1825
2112
  export {
1826
2113
  SelectList,
1827
2114
  createAgentProgress,
1828
- Box,
1829
2115
  CombinedAutocompleteProvider,
1830
2116
  Container,
1831
2117
  fuzzyFilter,
@@ -1857,7 +2143,6 @@ export {
1857
2143
  joinSections,
1858
2144
  markdownTheme,
1859
2145
  selectListTheme,
1860
- settingsListTheme,
1861
2146
  abbreviateModelId,
1862
2147
  formatTargetLabel,
1863
2148
  formatCompactMs,
@@ -1869,6 +2154,16 @@ export {
1869
2154
  frame,
1870
2155
  innerDivider,
1871
2156
  clioTheme,
2157
+ DEFAULT_SELECT_THEME,
2158
+ FocusBox,
2159
+ clioError,
2160
+ fitHintEntries,
2161
+ FILTER_HINT,
2162
+ buildHint,
2163
+ formatRuntimeResolutionDiagnostic,
2164
+ runtimeResolutionDiagnosticLine,
2165
+ showClioOverlayFrame,
2166
+ permissionHintEntries,
1872
2167
  ClioEditor,
1873
2168
  getActiveRenderTrace,
1874
2169
  createProcessInteractiveShell,
@@ -1879,4 +2174,4 @@ export {
1879
2174
  formatPlatformKeybindingNotice,
1880
2175
  createKeybindingManager
1881
2176
  };
1882
- //# sourceMappingURL=chunk-ZWMF7253.js.map
2177
+ //# sourceMappingURL=chunk-E2ER4LJF.js.map
@@ -1,18 +1,24 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
2
  import {
3
3
  AGENT_AUTOMATION_AUTHORITIES,
4
+ classify
5
+ } from "./chunk-AOCYTWAV.js";
6
+ import {
4
7
  artifactDefaultPath,
5
- classify,
6
8
  detectValidationCommand,
7
9
  extractCommandDeleteTargets,
8
10
  extractCommandWriteTargets,
9
11
  inlineShellScript,
10
12
  tokenizeShellLike,
11
13
  toolMutationPaths
12
- } from "./chunk-5UUP6MWO.js";
14
+ } from "./chunk-MV3K5QF2.js";
15
+ import {
16
+ loadProjectVerifierCatalog
17
+ } from "./chunk-FYYLNIL5.js";
13
18
  import {
19
+ isProjectVerifierCheckId,
14
20
  isVerificationScriptName
15
- } from "./chunk-7MNJORFF.js";
21
+ } from "./chunk-UL3WSD3F.js";
16
22
  import {
17
23
  canonicalizeExistingPath
18
24
  } from "./chunk-ECH6PKUQ.js";
@@ -654,7 +660,7 @@ function resultContractRepairMessage(input) {
654
660
  const lines = [
655
661
  last ? "FINAL RESULT REQUIRED IN THIS RESPONSE. Your previous response still did not satisfy this run's result contract." : "Your previous response did not satisfy this run's result contract.",
656
662
  `Validator reason: ${input.reason}`,
657
- "Tool use is over. Answer from the evidence you already gathered.",
663
+ input.toolsAvailable === true ? "You may use the admitted tools to repair this validator failure, then emit the required terminal result." : "Tool use is over. Answer from the evidence you already gathered.",
658
664
  `Emit exactly this shape and nothing else: ${resultContractShape(input.contract)}`,
659
665
  "Do not add prose, code fences, or commentary around it. Do not describe work you intend to do next."
660
666
  ];
@@ -974,8 +980,9 @@ function typedValidationSummary(toolName, payload) {
974
980
  const path5 = typeof args?.path === "string" && args.path.trim().length > 0 ? args.path.trim() : "artifact";
975
981
  return `verify frontend ${path5}`;
976
982
  }
977
- if (!isVerificationScriptName(check)) return null;
978
- return `npm run ${check}`;
983
+ if (isVerificationScriptName(check)) return `npm run ${check}`;
984
+ if (isProjectVerifierCheckId(check)) return `verify ${check}`;
985
+ return null;
979
986
  }
980
987
  return null;
981
988
  }
@@ -1097,72 +1104,6 @@ function asRecord(value) {
1097
1104
  return value !== null && typeof value === "object" ? value : null;
1098
1105
  }
1099
1106
 
1100
- // src/domains/safety/autonomy.ts
1101
- init_esm_shims();
1102
- var AUTONOMY_LEVELS = ["read-only", "suggest", "auto-edit", "full-auto"];
1103
- var DEFAULT_AUTONOMY_LEVEL = "auto-edit";
1104
- function isAutonomyLevel(value) {
1105
- return typeof value === "string" && AUTONOMY_LEVELS.includes(value);
1106
- }
1107
- var DEFAULT_AUTONOMY_EXPOSURE = "local";
1108
- function mapAutonomy(level, actionClass, options = {}) {
1109
- if (actionClass === "git_destructive") return "deny";
1110
- if ((level === "auto-edit" || level === "suggest") && options.exposure === "outward") return "ask";
1111
- if (actionClass === "read") return "allow";
1112
- if (level === "read-only") return "deny";
1113
- if (level === "suggest") return "ask";
1114
- switch (actionClass) {
1115
- case "write":
1116
- return "allow";
1117
- case "dispatch":
1118
- if (options.dispatchPlanScale === true && level !== "full-auto") return "ask";
1119
- return "allow";
1120
- case "execute": {
1121
- if (options.executeRecognized !== false) return "allow";
1122
- return level === "full-auto" ? "allow" : "ask";
1123
- }
1124
- case "unknown":
1125
- return "ask";
1126
- default:
1127
- return "ask";
1128
- }
1129
- }
1130
- function autonomyDenyRejection(level, tool, actionClass) {
1131
- return {
1132
- short: `${tool} denied: autonomy level is ${level}`,
1133
- detail: `Clio is at autonomy ${level}: ${actionClass} actions are denied without prompting. Describe the change you would make instead, so the operator can apply it or raise the autonomy level.`,
1134
- hints: ["Propose the exact edit or command as text.", "The operator can change the level in /settings."]
1135
- };
1136
- }
1137
- function autonomyAskRejection(level, tool, actionClass, exposure = DEFAULT_AUTONOMY_EXPOSURE) {
1138
- if (exposure === "outward") {
1139
- return {
1140
- short: `${tool} needs approval: outward-facing gate at autonomy ${level}`,
1141
- detail: `The call declared exposure=outward, so answering it publishes or sends something outside the workspace. Autonomy ${level} auto-answers local gates and parks outward-facing ones for the operator.`,
1142
- hints: [
1143
- "Approving resumes only this call.",
1144
- "Autonomy full-auto answers outward gates too; the safety net still applies there."
1145
- ]
1146
- };
1147
- }
1148
- return {
1149
- short: `${tool} needs approval (${actionClass}) at autonomy ${level}`,
1150
- detail: `Autonomy ${level} routes ${actionClass} actions through operator approval. The call is parked until the operator approves it once or cancels it.`,
1151
- hints: [
1152
- "Approving resumes only this call.",
1153
- "Recognized commands can be added to .clio-coder/safety.yaml.",
1154
- // The sanctioned pivots for a gated shell command: typed verification
1155
- // and read-class observe tools run without approval at this level,
1156
- // and models otherwise stall retrying denied bash for checks or
1157
- // directory listings.
1158
- ...actionClass === "execute" ? [
1159
- 'A declared package.json check runs without approval through the verify tool: verify(check="<script>").',
1160
- "Read-only inspection runs without approval through the ls, read, grep, and find tools."
1161
- ] : []
1162
- ]
1163
- };
1164
- }
1165
-
1166
1107
  // src/domains/safety/path-policy.ts
1167
1108
  init_esm_shims();
1168
1109
  import { homedir } from "node:os";
@@ -1326,6 +1267,14 @@ var DEFAULT_DAMAGE_CONTROL_PATH_POLICY = {
1326
1267
  "*.dump"
1327
1268
  ],
1328
1269
  readOnlyPaths: [
1270
+ // Clio's own operator-authority files in the project. `safety.yaml` is the
1271
+ // policy that gates the model's tools, and `verifiers.yaml` is an argv
1272
+ // catalog that verify() executes; a model that can author either one can
1273
+ // widen its own permissions in two tool calls. Both are authored by the
1274
+ // operator through the CLI (`clio-coder verifiers author` lands nothing
1275
+ // before `--yes`), so model-side writes and deletes are refused.
1276
+ ".clio-coder/safety.yaml",
1277
+ ".clio-coder/verifiers.yaml",
1329
1278
  "/etc/",
1330
1279
  "/usr/",
1331
1280
  "/bin/",
@@ -1914,7 +1863,9 @@ function createSafetyPolicyEngine(options = {}) {
1914
1863
  const rawClassification = classify(call);
1915
1864
  const command = commandArg(call.args);
1916
1865
  const callCwd = cwdArg(call.args, cwd);
1917
- const scan = damageControlScan(call);
1866
+ const catalogCheck = resolveVerifyCatalogCheck(call, cwd);
1867
+ const catalogCommand = catalogCheck === null ? null : catalogCheck.command.join(" ");
1868
+ const scan = catalogCommand ?? damageControlScan(call);
1918
1869
  const hit = scan ? matchSourcedRule(scan, sourcedRules) : null;
1919
1870
  const classification = effectiveClassification(rawClassification, hit?.match);
1920
1871
  const base = baseDecision(call, classification, callCwd, posture, command);
@@ -1971,8 +1922,9 @@ function createSafetyPolicyEngine(options = {}) {
1971
1922
  if (projectPolicy.path !== null) blockInput.projectPolicyPath = projectPolicy.path;
1972
1923
  return blockDecision(base, blockInput);
1973
1924
  }
1974
- if (call.tool === ToolNames.Bash && command !== null) {
1975
- const secretRead = evaluateBashZeroAccessRead(zeroAccessPolicy, command, callCwd);
1925
+ const scannedCommand = call.tool === ToolNames.Bash ? command : catalogCommand;
1926
+ if (scannedCommand !== null) {
1927
+ const secretRead = evaluateBashZeroAccessRead(zeroAccessPolicy, scannedCommand, callCwd);
1976
1928
  if (secretRead !== null) {
1977
1929
  const blockInput = {
1978
1930
  ruleId: "secret_path_bash",
@@ -2027,7 +1979,15 @@ function createSafetyPolicyEngine(options = {}) {
2027
1979
  };
2028
1980
  if (hit?.match.ruleId !== void 0) allowInput.ruleId = hit.match.ruleId;
2029
1981
  if (hit?.match !== void 0) allowInput.match = hit.match;
2030
- if (classification.actionClass === "execute") allowInput.execRecognition = "recognized";
1982
+ if (classification.actionClass === "execute") {
1983
+ allowInput.execRecognition = catalogCheck === null ? "recognized" : "unrecognized";
1984
+ if (catalogCheck !== null) {
1985
+ allowInput.reasons = [
1986
+ ...allowInput.reasons,
1987
+ `project verifier '${catalogCheck.id}' runs declared argv: ${catalogCommand ?? ""}`
1988
+ ];
1989
+ }
1990
+ }
2031
1991
  return allowDecision(base, allowInput);
2032
1992
  },
2033
1993
  metadata() {
@@ -2396,6 +2356,20 @@ function damageControlScan(call) {
2396
2356
  const pathArg2 = call.args?.path;
2397
2357
  return typeof pathArg2 === "string" ? pathArg2 : "";
2398
2358
  }
2359
+ function resolveVerifyCatalogCheck(call, workspaceRoot) {
2360
+ if (call.tool !== ToolNames.Verify) return null;
2361
+ const check = call.args?.check;
2362
+ if (typeof check !== "string") return null;
2363
+ const id = check.trim();
2364
+ if (id.length === 0 || id === "frontend") return null;
2365
+ try {
2366
+ const catalog = loadProjectVerifierCatalog(workspaceRoot);
2367
+ if (!catalog.ok || catalog.source === null) return null;
2368
+ return catalog.source.checks.find((candidate) => candidate.id === id) ?? null;
2369
+ } catch {
2370
+ return null;
2371
+ }
2372
+ }
2399
2373
  function serializeArgs(args) {
2400
2374
  if (!args) return "";
2401
2375
  const parts = [];
@@ -2439,13 +2413,6 @@ export {
2439
2413
  RESULT_CONTRACT_REPAIR_LIMIT,
2440
2414
  resultContractRepairMessages,
2441
2415
  parseResultContract,
2442
- AUTONOMY_LEVELS,
2443
- DEFAULT_AUTONOMY_LEVEL,
2444
- isAutonomyLevel,
2445
- DEFAULT_AUTONOMY_EXPOSURE,
2446
- mapAutonomy,
2447
- autonomyDenyRejection,
2448
- autonomyAskRejection,
2449
2416
  DEFAULT_RECENT_ENTRY_LIMIT,
2450
2417
  assessFinishContract,
2451
2418
  typedValidationSummary,
@@ -2453,4 +2420,4 @@ export {
2453
2420
  WRITE_ROOT_REFUSED_TOOLS,
2454
2421
  createSafetyPolicyEngine
2455
2422
  };
2456
- //# sourceMappingURL=chunk-STBPMHSX.js.map
2423
+ //# sourceMappingURL=chunk-EKY57CSP.js.map
@@ -4,9 +4,10 @@ import {
4
4
  TOOL_PROFILE_NAMES,
5
5
  classifyAgentTask,
6
6
  cloneApprovedAssignmentRoute,
7
+ cloneDispatchBudgetRequest,
7
8
  isApprovedAssignmentRoute,
8
9
  isToolProfileName
9
- } from "./chunk-LWLEKMDQ.js";
10
+ } from "./chunk-XXQNGV4M.js";
10
11
  import {
11
12
  ROUTE_POLICY_VERSION,
12
13
  isExecutionRole,
@@ -14,10 +15,10 @@ import {
14
15
  isRoutingIntent,
15
16
  parseRoutingIntent,
16
17
  requestExecutionRole
17
- } from "./chunk-GGXXDWE4.js";
18
+ } from "./chunk-22NAGB7X.js";
18
19
  import {
19
20
  AGENT_AUTOMATION_AUTHORITIES
20
- } from "./chunk-5UUP6MWO.js";
21
+ } from "./chunk-AOCYTWAV.js";
21
22
  import {
22
23
  init_esm_shims
23
24
  } from "./chunk-3R73A4XB.js";
@@ -147,6 +148,13 @@ function dispatchRequestFromArgs(args, options) {
147
148
  }
148
149
  request.thinkingLevel = thinkingLevel;
149
150
  }
151
+ if (args.budget !== void 0) {
152
+ try {
153
+ request.budget = cloneDispatchBudgetRequest(args.budget);
154
+ } catch (error) {
155
+ return { ok: false, message: error instanceof Error ? error.message : String(error) };
156
+ }
157
+ }
150
158
  return { ok: true, request };
151
159
  }
152
160
  function dispatchRequestsFromArgs(args, options) {
@@ -641,4 +649,4 @@ export {
641
649
  withResolvedDispatchPlan,
642
650
  describeDispatchPlan
643
651
  };
644
- //# sourceMappingURL=chunk-DUYJ5IO6.js.map
652
+ //# sourceMappingURL=chunk-EYPA3EGJ.js.map
@@ -38,7 +38,7 @@ import {
38
38
  } from "node:fs";
39
39
  import { dirname, join, resolve } from "node:path";
40
40
  import { StringDecoder } from "node:string_decoder";
41
- var CURRENT_SESSION_FORMAT_VERSION = 3;
41
+ var CURRENT_SESSION_FORMAT_VERSION = 4;
42
42
  function cwdHash(cwd) {
43
43
  const normalized = resolve(cwd);
44
44
  return createHash("sha256").update(normalized).digest("hex").slice(0, 16);
@@ -567,4 +567,4 @@ export {
567
567
  openSession,
568
568
  resumeSession
569
569
  };
570
- //# sourceMappingURL=chunk-M6SHUN7Q.js.map
570
+ //# sourceMappingURL=chunk-FO5ZOVUY.js.map