@iowarp/clio-coder 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +1 -1
  3. package/dist/{acp-H2NGRPWO.js → acp-WNAYYF4F.js} +4 -5
  4. package/dist/{agents-TL5LLUQP.js → agents-3OKXHLOI.js} +33 -31
  5. package/dist/assets/codewiki.json +1 -1
  6. package/dist/{auth-E5SW4HMS.js → auth-VKNNMGPU.js} +10 -11
  7. package/dist/{builtins-IA7V7FUC.js → builtins-WGALA46I.js} +4 -4
  8. package/dist/{chunk-F5JHEYZM.js → chunk-23L32XTI.js} +10 -7
  9. package/dist/{chunk-DWUOQKRU.js → chunk-25QBEXRS.js} +2 -2
  10. package/dist/{chunk-LLDJM5XK.js → chunk-26QSH3EJ.js} +2 -2
  11. package/dist/{chunk-N2Z7HLVY.js → chunk-2ASED4PZ.js} +10 -10
  12. package/dist/{chunk-MCEPRMZW.js → chunk-2CU2H6KE.js} +2 -2
  13. package/dist/chunk-2DSOYNFC.js +108 -0
  14. package/dist/{chunk-LDJG7DW3.js → chunk-2ZSONWVL.js} +4 -4
  15. package/dist/{chunk-GI7YYQ3F.js → chunk-36CT5VVL.js} +324 -41
  16. package/dist/{chunk-4UVU7BJ5.js → chunk-3GY4F45V.js} +2 -2
  17. package/dist/{chunk-PUVDKJ2Y.js → chunk-3ODX73FK.js} +3 -5
  18. package/dist/{chunk-IUE3Y34X.js → chunk-3UNOLWNZ.js} +2 -2
  19. package/dist/{chunk-6PTFB5VS.js → chunk-3UUXNFEX.js} +8 -4
  20. package/dist/{chunk-2APPQIER.js → chunk-4M6Z5QVF.js} +4 -4
  21. package/dist/{chunk-K6BSR66V.js → chunk-4NSRCOYP.js} +4 -1
  22. package/dist/{chunk-JGRC33J2.js → chunk-54X7T7DK.js} +12 -3
  23. package/dist/{chunk-YQWYVTMC.js → chunk-5636DCO5.js} +4 -4
  24. package/dist/{chunk-7E7I3WLS.js → chunk-57XXR6DR.js} +23 -22
  25. package/dist/{chunk-7ZYNNDKC.js → chunk-5TUB6SLS.js} +2 -2
  26. package/dist/{chunk-VW6DOEDG.js → chunk-6OSVSQL5.js} +11 -2
  27. package/dist/{chunk-L47TF46W.js → chunk-6PAZTBPA.js} +14 -2
  28. package/dist/{chunk-XIVNBFZS.js → chunk-6Q3CYFD3.js} +34 -16
  29. package/dist/{chunk-RSJ25QSL.js → chunk-6QOTUPRG.js} +155 -36
  30. package/dist/{chunk-JKKCYP3C.js → chunk-6UINWWS6.js} +10 -4
  31. package/dist/{chunk-WBKFA554.js → chunk-72YIHOZQ.js} +2 -2
  32. package/dist/{chunk-PAJQJ7BS.js → chunk-75W7L2E2.js} +246 -697
  33. package/dist/{chunk-RRNP2ANY.js → chunk-7UGL4MB5.js} +4 -4
  34. package/dist/{chunk-EKCHAPYA.js → chunk-AUPNRN7C.js} +2 -2
  35. package/dist/{chunk-ZDN3Y73Y.js → chunk-BJVFZO5U.js} +6 -48
  36. package/dist/{chunk-IWT4SF4R.js → chunk-CUSRQKPU.js} +64 -2
  37. package/dist/{chunk-SKHCAU7K.js → chunk-DQOVN6KV.js} +3 -2
  38. package/dist/{chunk-ZWPRK62N.js → chunk-DT3LWJOB.js} +4 -4
  39. package/dist/chunk-DXKJURES.js +671 -0
  40. package/dist/{chunk-BEPZRGGU.js → chunk-EL24TAU4.js} +2 -2
  41. package/dist/{chunk-OML5D5V5.js → chunk-ELWDPP3Y.js} +5 -5
  42. package/dist/{chunk-NDINPTJ4.js → chunk-ELZVTCGV.js} +5 -4
  43. package/dist/chunk-EXLD33WO.js +381 -0
  44. package/dist/{chunk-IJNZMHLA.js → chunk-FEAXX7B6.js} +2 -2
  45. package/dist/{chunk-TM6LQDI3.js → chunk-FFUPXJC4.js} +74 -323
  46. package/dist/chunk-GX5WYQO4.js +59 -0
  47. package/dist/chunk-I2DWJ4GM.js +390 -0
  48. package/dist/{chunk-TXOTCRLG.js → chunk-I5FWO7L5.js} +5 -5
  49. package/dist/chunk-IRXAATOX.js +539 -0
  50. package/dist/chunk-IXIY2H4R.js +44 -0
  51. package/dist/{chunk-KK4JZPBQ.js → chunk-IZXGRF7P.js} +76 -10
  52. package/dist/{chunk-5TSRNF4G.js → chunk-JCI2ROMZ.js} +164 -6
  53. package/dist/{chunk-INY6HTFL.js → chunk-JEIYHLOR.js} +2 -2
  54. package/dist/{chunk-MUW2BDDH.js → chunk-JQLNNIKT.js} +2 -2
  55. package/dist/{chunk-XPWWI35G.js → chunk-JSD46VO2.js} +19 -8
  56. package/dist/{chunk-VA5FNYMT.js → chunk-JT2RFCC5.js} +39 -2
  57. package/dist/{chunk-V2ANDPVT.js → chunk-K6T2ZAMZ.js} +168 -6
  58. package/dist/{chunk-B4OAX3SI.js → chunk-KFV5L5SK.js} +13 -6
  59. package/dist/{chunk-JEQ3XTHC.js → chunk-LLXSDWXS.js} +2 -2
  60. package/dist/{chunk-E3TPLWFX.js → chunk-LTIKRKFL.js} +3 -3
  61. package/dist/{chunk-NIQJ66N4.js → chunk-N56KALIC.js} +17 -17
  62. package/dist/{chunk-JDAY6FIL.js → chunk-NAI6ZFCY.js} +13 -9
  63. package/dist/{chunk-AF4YM7Z4.js → chunk-NRO2BJRH.js} +2490 -2182
  64. package/dist/{chunk-WRBAGUNF.js → chunk-NXIMQY5W.js} +2 -2
  65. package/dist/{chunk-I7ZPNEJM.js → chunk-NXYCB2VD.js} +5 -5
  66. package/dist/chunk-ODGTEFFI.js +50 -0
  67. package/dist/{chunk-2VIKGWFZ.js → chunk-OEJSLEPW.js} +2 -2
  68. package/dist/{chunk-KKOJXO6R.js → chunk-OMQNJVKW.js} +4 -2
  69. package/dist/{chunk-54CBCGIR.js → chunk-Q4WO54TA.js} +132 -77
  70. package/dist/{chunk-B4VEBZKF.js → chunk-QUFRYSWI.js} +12 -6
  71. package/dist/{chunk-42FMPA75.js → chunk-QZWQA4DE.js} +2 -2
  72. package/dist/{chunk-HEQY7ZFI.js → chunk-RAY4OVGZ.js} +2 -2
  73. package/dist/{chunk-G76U63X4.js → chunk-RQCKCSRL.js} +7 -7
  74. package/dist/{chunk-64I3JVYM.js → chunk-RXTN6AKH.js} +2 -2
  75. package/dist/{chunk-UPZU6GE4.js → chunk-RZDWV63N.js} +3 -3
  76. package/dist/{chunk-2UH2KFUP.js → chunk-S6PYF2XF.js} +2 -2
  77. package/dist/{chunk-JSC3U7TI.js → chunk-TOIVGRUX.js} +2 -2
  78. package/dist/{chunk-7DRAWPTZ.js → chunk-TQAHXW6Y.js} +1 -1
  79. package/dist/{chunk-JIEGK6UF.js → chunk-U6TMQNSI.js} +48 -4
  80. package/dist/{chunk-AX2THNSA.js → chunk-UEPWCCTY.js} +4 -4
  81. package/dist/{chunk-QWGDJJYJ.js → chunk-USR47QNF.js} +4 -4
  82. package/dist/{chunk-Y3CBHOR6.js → chunk-V6HJFQZE.js} +2 -2
  83. package/dist/chunk-V76WTFTW.js +318 -0
  84. package/dist/{chunk-NMJXSHBJ.js → chunk-W54I7H25.js} +2 -2
  85. package/dist/{chunk-2UG5F4C5.js → chunk-XULDXHTN.js} +24 -12
  86. package/dist/chunk-XXYSBZIQ.js +283 -0
  87. package/dist/{chunk-MWUZBSAQ.js → chunk-Y55JBDO5.js} +331 -51
  88. package/dist/{chunk-W6RRQCPQ.js → chunk-YD5GIKET.js} +4 -4
  89. package/dist/{chunk-CE5AX47J.js → chunk-YECAMM3D.js} +2 -2
  90. package/dist/{chunk-WCXUNS7U.js → chunk-YNFKXPEC.js} +6 -6
  91. package/dist/cli/index.js +36 -35
  92. package/dist/{clio-CMMK4KRR.js → clio-QLICPCF5.js} +2 -2
  93. package/dist/{code-nav-MDZNQS33.js → code-nav-IJR2DBPR.js} +6 -6
  94. package/dist/{components-UCUQ4QXW.js → components-2TGAI2RC.js} +3 -4
  95. package/dist/{config-SVM5P5YI.js → config-IUA6OYNS.js} +52 -47
  96. package/dist/{configure-LE3IK2TJ.js → configure-VEPX4NMX.js} +14 -15
  97. package/dist/{context-VNCR7KAG.js → context-2DKHWH2T.js} +23 -23
  98. package/dist/{context-2OHRKS42.js → context-4MPR7WKB.js} +48 -42
  99. package/dist/{context-E3VC7RX5.js → context-BOYF5EJM.js} +11 -11
  100. package/dist/{context-clear-BW4O37TG.js → context-clear-S4ZJCQUX.js} +48 -42
  101. package/dist/{context-working-set-VDS25HXZ.js → context-working-set-3I3FYX6Y.js} +8 -8
  102. package/dist/detail-A7JAVSIG.js +98 -0
  103. package/dist/{dispatch-runner-5AHT53RF.js → dispatch-runner-RJ5I2F2O.js} +71 -58
  104. package/dist/{docs-PD3EXDKU.js → docs-SPOV3BAN.js} +3 -5
  105. package/dist/{doctor-WNNVO6FY.js → doctor-DKICC2SN.js} +54 -31
  106. package/dist/{eval-7G7SGAYO.js → eval-OQOQUDHK.js} +47 -56
  107. package/dist/{evidence-VD6736FQ.js → evidence-4DQ25GUQ.js} +53 -150
  108. package/dist/evidence-4F5USFKH.js +208 -0
  109. package/dist/{evolve-AL3NGVRL.js → evolve-GSS52E5J.js} +44 -41
  110. package/dist/{extensions-MOVJ32NM.js → extensions-G7MFLYHT.js} +4 -5
  111. package/dist/{fleet-QZHUMAGI.js → fleet-Q37YHHAQ.js} +74 -68
  112. package/dist/{fleet-commands-BAYT5FJZ.js → fleet-commands-G7E4N7SM.js} +14 -11
  113. package/dist/{fleet-decisions-IREVMRU4.js → fleet-decisions-O7M6QBA2.js} +6 -6
  114. package/dist/{fleet-graph-YCTT3HTI.js → fleet-graph-TOUBW6OW.js} +13 -13
  115. package/dist/{fleet-inspect-QVJTDAVB.js → fleet-inspect-SW33JJNI.js} +43 -39
  116. package/dist/{fleet-preflight-25QAFPK4.js → fleet-preflight-CV2655TW.js} +2 -3
  117. package/dist/{fleet-validate-5O57AAJ7.js → fleet-validate-KESZX2YH.js} +16 -16
  118. package/dist/{fleet-verify-CPH2W2T6.js → fleet-verify-UQPMTVE3.js} +42 -38
  119. package/dist/{fleet-view-SWBR3VGQ.js → fleet-view-MN2VG4MR.js} +43 -39
  120. package/dist/{init-J477LKZH.js → init-PXEXQSBF.js} +60 -54
  121. package/dist/{interop-3FCM6XLG.js → interop-ZG5T62U3.js} +6 -7
  122. package/dist/inventory-C26CFDRR.js +101 -0
  123. package/dist/{library-QUQEIUG6.js → library-B2W4N74O.js} +16 -17
  124. package/dist/{memory-SGGSEP65.js → memory-YCANYS5A.js} +45 -42
  125. package/dist/{models-HEKUAXXK.js → models-GERTU3YI.js} +20 -22
  126. package/dist/{monitor-HKU57TYQ.js → monitor-CPNIUULB.js} +50 -44
  127. package/dist/{orchestrator-VDFAEFAI.js → orchestrator-J4BSH4WQ.js} +491 -1182
  128. package/dist/{panes-DN2SSFOH.js → panes-BOHAEGYC.js} +3 -3
  129. package/dist/{panes-TALGNPZT.js → panes-NXSLDQZ2.js} +5 -6
  130. package/dist/{paths-NBMFAIEZ.js → paths-VSUWNC22.js} +3 -4
  131. package/dist/{reset-EAJFFJVB.js → reset-TNWTB5LU.js} +5 -6
  132. package/dist/{resources-OVKSEFVE.js → resources-4PXNMD5G.js} +14 -14
  133. package/dist/{run-7DP7ZF2J.js → run-D6XJ34CN.js} +79 -83
  134. package/dist/{share-WML67FT3.js → share-2NWMJJEE.js} +14 -15
  135. package/dist/{skills-SG662R2K.js → skills-KR7WON5G.js} +18 -19
  136. package/dist/{skills-eval-VVZEUU46.js → skills-eval-O2ZNOLDS.js} +49 -46
  137. package/dist/{skills-inventory-I2E23GET.js → skills-inventory-ZZOUBK7O.js} +14 -14
  138. package/dist/{slash-commands-S7MBJDQK.js → slash-commands-ZXPJD64J.js} +32 -23
  139. package/dist/{steer-2LQOMCPB.js → steer-XA25PSCS.js} +3 -3
  140. package/dist/{support-CC2UJBJ6.js → support-7EMVWYG2.js} +2 -2
  141. package/dist/{targets-4QC3HIEW.js → targets-OMH2XCSN.js} +25 -27
  142. package/dist/tasks-IPAGMEIX.js +36 -0
  143. package/dist/{terminal-lease-TUHIJ6Y2.js → terminal-lease-C2J3JYRE.js} +4 -4
  144. package/dist/{tools-TFGJICCU.js → tools-EFFEAIDP.js} +5 -6
  145. package/dist/{uninstall-5PEVOE5B.js → uninstall-HALS6BLF.js} +7 -8
  146. package/dist/{upgrade-M4WXY6KN.js → upgrade-MS72RJEP.js} +14 -11
  147. package/dist/{usage-N7ZNVLEM.js → usage-NHG6MCJM.js} +60 -51
  148. package/dist/{verifiers-DJTP4XX6.js → verifiers-7AUNVXDY.js} +150 -17
  149. package/dist/{verify-RWE4PPEK.js → verify-FWYGPKMR.js} +12 -10
  150. package/dist/{web-fetch-MPARV2K7.js → web-fetch-V4FKSDAV.js} +4 -4
  151. package/dist/{wiki-generate-C7IQOXSP.js → wiki-generate-743CIGJW.js} +63 -56
  152. package/dist/{with-panes-4GCGSL7J.js → with-panes-BDQEWBRT.js} +2 -2
  153. package/dist/worker/entry.js +36 -33
  154. package/docs/README.md +3 -2
  155. package/docs/architecture/acp.md +17 -0
  156. package/docs/architecture/artifact-versions.md +1 -1
  157. package/docs/architecture/dispatch-typed-intent.md +1 -1
  158. package/docs/architecture/evidence-and-memory.md +1 -1
  159. package/docs/architecture/observability.md +7 -1
  160. package/docs/architecture/prompt-envelope-and-tools.md +15 -5
  161. package/docs/architecture/safety-model.md +10 -17
  162. package/docs/architecture/tui-design.md +1 -1
  163. package/docs/guide/built-in-agents.md +8 -8
  164. package/docs/guide/commands-and-modes.md +17 -2
  165. package/docs/guide/configuration-and-targets.md +3 -1
  166. package/docs/guide/configuration-reference.md +10 -5
  167. package/docs/guide/environment-variables.md +2 -2
  168. package/docs/guide/tool-usage.md +78 -3
  169. package/docs/history/config-knobs-audit.md +2 -2
  170. package/docs/process/development-pipeline.md +6 -1
  171. package/docs/process/git-commit-provenance.md +15 -0
  172. package/docs/process/release-cut-checklist.md +207 -0
  173. package/docs/process/scientific-validation.md +18 -17
  174. package/evals/behavioral-machinery-support.ts +1 -0
  175. package/evals/behavioral-machinery.yaml +1 -1
  176. package/package.json +1 -1
  177. package/skills/coding/coding-standards/SKILL.md +14 -4
  178. package/skills/context/context-handoff/SKILL.md +3 -3
  179. package/skills/context/context-prime/SKILL.md +3 -3
  180. package/skills/planning/architecture/SKILL.md +5 -5
  181. package/skills/planning/backlog/SKILL.md +4 -4
  182. package/skills/planning/prd/SKILL.md +4 -3
  183. package/skills/planning/product-intent/SKILL.md +8 -8
  184. package/skills/planning/tech-spec/SKILL.md +4 -4
  185. package/skills/registry.yaml +32 -32
  186. package/skills/research/arxiv-literature/SKILL.md +3 -3
  187. package/skills/research/experiment-protocol/SKILL.md +3 -3
  188. package/skills/research/scientific-debugging/SKILL.md +3 -2
  189. package/skills/research/scientific-modernization/SKILL.md +3 -3
  190. package/skills/skill-marketplace.json +16 -16
  191. package/skills/workflow/cut-it/SKILL.md +3 -4
  192. package/skills/workflow/design-council/SKILL.md +5 -10
  193. package/skills/workflow/grill-me/SKILL.md +14 -15
  194. package/skills/workflow/workflow-distiller/SKILL.md +4 -4
  195. package/src/cli/args.ts +0 -8
  196. package/src/cli/configure.ts +2 -1
  197. package/src/cli/doctor-state-size.ts +1 -12
  198. package/src/cli/doctor-validation-contract.ts +28 -0
  199. package/src/cli/doctor.ts +5 -0
  200. package/src/cli/evidence-detail.ts +1 -75
  201. package/src/cli/evidence-inventory.ts +1 -167
  202. package/src/cli/index.ts +2 -0
  203. package/src/cli/run.ts +0 -2
  204. package/src/cli/targets.ts +1 -1
  205. package/src/cli/tasks.ts +84 -0
  206. package/src/cli/upgrade.ts +10 -5
  207. package/src/cli/usage.ts +6 -0
  208. package/src/cli/verifiers.ts +147 -1
  209. package/src/cli/wiki-generate.ts +1 -0
  210. package/src/core/commit-attribution.ts +41 -1
  211. package/src/core/git-commit-attribution.ts +46 -3
  212. package/src/core/run-overrides.ts +0 -5
  213. package/src/core/skill-activation.ts +3 -0
  214. package/src/core/tool-names.ts +5 -2
  215. package/src/domains/agents/builtins/architect.md +1 -1
  216. package/src/domains/agents/builtins/coder.md +1 -1
  217. package/src/domains/agents/builtins/documenter.md +1 -1
  218. package/src/domains/agents/builtins/git-master.md +1 -1
  219. package/src/domains/agents/builtins/provenance.md +7 -7
  220. package/src/domains/agents/builtins/tester.md +1 -1
  221. package/src/domains/agents/builtins/verifier.md +2 -2
  222. package/src/domains/agents/builtins/wiki-writer.md +4 -3
  223. package/src/domains/context/extension.ts +31 -7
  224. package/src/domains/context/refresh.ts +3 -0
  225. package/src/domains/context/wiki/frontmatter.ts +5 -2
  226. package/src/domains/context/wiki/generate.ts +6 -0
  227. package/src/domains/context/wiki/prompts.ts +43 -0
  228. package/src/domains/dispatch/active-route-planner.ts +4 -0
  229. package/src/domains/dispatch/code-step.ts +11 -4
  230. package/src/domains/dispatch/contract.ts +31 -7
  231. package/src/domains/dispatch/execution-scheduler.ts +2 -0
  232. package/src/domains/dispatch/extension.ts +50 -27
  233. package/src/domains/dispatch/fleet-commit-attribution.ts +5 -0
  234. package/src/domains/dispatch/fleet-run.ts +1 -0
  235. package/src/domains/dispatch/host-verification.ts +114 -13
  236. package/src/domains/dispatch/intent.ts +28 -18
  237. package/src/domains/dispatch/orphan-recovery.ts +2 -0
  238. package/src/domains/dispatch/receipt-integrity.ts +4 -0
  239. package/src/domains/dispatch/reservation-store.ts +5 -3
  240. package/src/domains/dispatch/state.ts +15 -2
  241. package/src/domains/dispatch/types.ts +17 -2
  242. package/src/domains/eval/runners/clio-run.ts +12 -9
  243. package/src/domains/eval/runners/context-index.ts +2 -7
  244. package/src/domains/eval/runners/context-init.ts +3 -6
  245. package/src/domains/eval/runners/external-command.ts +29 -11
  246. package/src/domains/evidence/build.ts +102 -15
  247. package/src/domains/evidence/detail.ts +69 -0
  248. package/src/domains/evidence/eval.ts +13 -1
  249. package/src/domains/evidence/finish-contract-map.ts +5 -1
  250. package/src/domains/evidence/inventory.ts +167 -0
  251. package/src/domains/evidence/store.ts +16 -0
  252. package/src/domains/evidence/types.ts +12 -0
  253. package/src/domains/extensions/resources.ts +7 -0
  254. package/src/domains/middleware/marketplace-offer.ts +20 -1
  255. package/src/domains/middleware/runtime.ts +7 -3
  256. package/src/domains/mux/detect.ts +3 -6
  257. package/src/domains/observability/accountability.ts +15 -1
  258. package/src/domains/observability/contract.ts +52 -7
  259. package/src/domains/observability/evidence-index.ts +10 -0
  260. package/src/domains/observability/extension.ts +9 -5
  261. package/src/domains/observability/projection.ts +394 -45
  262. package/src/{interactive → domains/observability}/worker-progress.ts +3 -3
  263. package/src/domains/prompts/fragments/operating/contract.md +2 -0
  264. package/src/domains/prompts/fragments/wiki/page.md +8 -0
  265. package/src/domains/providers/model-discovery.ts +1 -4
  266. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +16 -14
  267. package/src/domains/providers/runtimes/claude/claude-code.ts +9 -0
  268. package/src/domains/providers/support.ts +1 -1
  269. package/src/domains/providers/types/runtime-descriptor.ts +1 -1
  270. package/src/domains/safety/action-classifier.ts +7 -0
  271. package/src/domains/safety/default-path-policy.ts +2 -0
  272. package/src/domains/safety/finish-contract-registration.ts +29 -14
  273. package/src/domains/safety/finish-contract.ts +252 -40
  274. package/src/domains/safety/index.ts +20 -1
  275. package/src/domains/safety/policy-engine.ts +26 -6
  276. package/src/domains/safety/rigor.ts +53 -39
  277. package/src/domains/safety/validation-contract.ts +388 -0
  278. package/src/domains/session/archive-readers.ts +10 -1
  279. package/src/domains/session/decision-board.ts +101 -2
  280. package/src/domains/session/entries.ts +44 -7
  281. package/src/domains/session/extension.ts +4 -4
  282. package/src/domains/session/handoff.ts +2 -1
  283. package/src/domains/session/manager.ts +2 -3
  284. package/src/domains/session/task-board.ts +14 -1
  285. package/src/domains/session/tree/fork.ts +1 -2
  286. package/src/domains/session/tree/navigator.ts +1 -1
  287. package/src/domains/user-tasks/acceptance.ts +56 -0
  288. package/src/domains/user-tasks/active-acceptance.ts +40 -0
  289. package/src/domains/user-tasks/store.ts +34 -3
  290. package/src/engine/acp/adapter.ts +24 -6
  291. package/src/engine/acp/server.ts +21 -4
  292. package/src/engine/acp/transport.ts +53 -8
  293. package/src/engine/acp/types.ts +4 -0
  294. package/src/engine/apis/ollama-native.ts +15 -0
  295. package/src/engine/claude/subprocess-runtime.ts +107 -60
  296. package/src/engine/external-subprocess.ts +12 -4
  297. package/src/entry/orchestrator.ts +11 -2
  298. package/src/interactive/dispatch-board.ts +46 -717
  299. package/src/interactive/fleet-run-preview.ts +2 -1
  300. package/src/interactive/interactive-application.ts +3 -2
  301. package/src/interactive/interactive-presentation.ts +55 -12
  302. package/src/interactive/interactive-slash-runtime.ts +2 -1
  303. package/src/interactive/oracle.ts +5 -2
  304. package/src/interactive/overlays/fleet-run-approval.ts +3 -2
  305. package/src/interactive/overlays/message-picker.ts +2 -2
  306. package/src/interactive/overlays/settings.ts +2 -2
  307. package/src/interactive/overlays/tree-selector.ts +2 -2
  308. package/src/interactive/renderers/branch-summary.ts +1 -1
  309. package/src/interactive/slash-autocomplete.ts +4 -6
  310. package/src/interactive/slash-commands.ts +25 -39
  311. package/src/interactive/slash-spec.ts +28 -0
  312. package/src/interactive/view/artifacts.ts +2 -0
  313. package/src/interactive/worker-stream.ts +7 -3
  314. package/src/tools/bootstrap.ts +4 -0
  315. package/src/tools/builtin-tool-catalog.ts +31 -0
  316. package/src/tools/compete-worktrees.ts +7 -1
  317. package/src/tools/core-bootstrap.ts +16 -0
  318. package/src/tools/decide.ts +136 -0
  319. package/src/tools/dispatch-admission.ts +21 -0
  320. package/src/tools/dispatch-plan.ts +5 -2
  321. package/src/tools/dispatch-runner.ts +15 -1
  322. package/src/tools/dispatch-types.ts +6 -0
  323. package/src/tools/evidence.ts +96 -0
  324. package/src/tools/limitation.ts +76 -0
  325. package/src/tools/policy.ts +9 -0
  326. package/src/tools/presentation.ts +3 -0
  327. package/src/tools/registry.ts +1 -1
  328. package/src/tools/result-shaping.ts +17 -5
  329. package/src/tools/task-worktree.ts +13 -3
  330. package/src/tools/tasks.ts +10 -1
  331. package/src/tools/verify/authoring.ts +170 -83
  332. package/src/tools/verify/catalog.ts +122 -5
  333. package/src/tools/verify/index.ts +2 -1
  334. package/src/tools/verify/numeric.ts +298 -0
  335. package/src/tools/verify/perf.ts +143 -0
  336. package/src/tools/verify/scripts.ts +229 -2
  337. package/dist/chunk-7DICMOS6.js +0 -313
  338. package/dist/chunk-RVG5JXAL.js +0 -41
  339. package/dist/chunk-T56WDKA5.js +0 -183
  340. package/dist/chunk-VPKWYKEY.js +0 -169
@@ -1,18 +1,4 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
- import {
3
- DEFAULT_KEEP_RECENT_TOKENS,
4
- DEFAULT_RESERVE_TOKENS,
5
- buildEvictionFields,
6
- calculateContextTokens,
7
- compactionCut,
8
- estimateTokens,
9
- findCutPoint,
10
- getLastAssistantUsage,
11
- planEviction,
12
- projectWorkingSet,
13
- resolveWorkingSetPolicy,
14
- selectVisibleEntries
15
- } from "./chunk-ZA4VCIGV.js";
16
2
  import {
17
3
  assistantSessionPayload,
18
4
  attachedToolSchemasFromState,
@@ -47,76 +33,103 @@ import {
47
33
  toolNamesFromAgentState,
48
34
  toolResultSummary,
49
35
  toolSignatureFromState
50
- } from "./chunk-W6RRQCPQ.js";
36
+ } from "./chunk-YD5GIKET.js";
51
37
  import {
52
38
  ShareDomainModule
53
- } from "./chunk-QWGDJJYJ.js";
39
+ } from "./chunk-USR47QNF.js";
54
40
  import {
55
41
  bootstrapInputFromInitOptions,
56
42
  modelBootstrapGenerate,
57
43
  resolveBootstrapRoute
58
- } from "./chunk-NIQJ66N4.js";
44
+ } from "./chunk-N56KALIC.js";
59
45
  import "./chunk-MNJGS2IN.js";
46
+ import {
47
+ DEFAULT_KEEP_RECENT_TOKENS,
48
+ DEFAULT_RESERVE_TOKENS,
49
+ buildEvictionFields,
50
+ calculateContextTokens,
51
+ compactionCut,
52
+ estimateTokens,
53
+ findCutPoint,
54
+ getLastAssistantUsage,
55
+ planEviction,
56
+ projectWorkingSet,
57
+ resolveWorkingSetPolicy,
58
+ selectVisibleEntries
59
+ } from "./chunk-ZA4VCIGV.js";
60
60
  import {
61
61
  SchedulingDomainModule,
62
62
  createPromptsDomainModule,
63
63
  renderAgentCatalogSectionsFromSpecs
64
- } from "./chunk-WCXUNS7U.js";
64
+ } from "./chunk-YNFKXPEC.js";
65
65
  import {
66
66
  recordFailedCompactionCalls
67
- } from "./chunk-IJNZMHLA.js";
67
+ } from "./chunk-FEAXX7B6.js";
68
+ import {
69
+ describePanesLeftBehind,
70
+ paneWatchDecision
71
+ } from "./chunk-3EBYEESD.js";
72
+ import {
73
+ flushRawStdout,
74
+ writeRawStdout
75
+ } from "./chunk-2VTFPG5O.js";
68
76
  import {
69
77
  capturedHookSourcesFor
70
78
  } from "./chunk-SZAA6XDG.js";
71
- import {
72
- SafetyDomainModule
73
- } from "./chunk-YQWYVTMC.js";
74
79
  import {
75
80
  LifecycleDomainModule,
76
81
  describeUpgradeNotice
77
- } from "./chunk-MUW2BDDH.js";
82
+ } from "./chunk-JQLNNIKT.js";
78
83
  import "./chunk-GWZNEVM2.js";
79
84
  import "./chunk-5ICU3EUH.js";
80
85
  import {
81
86
  ConfigDomainModule,
82
87
  createConfigDomainModule,
83
88
  loadDomains
84
- } from "./chunk-WBKFA554.js";
89
+ } from "./chunk-72YIHOZQ.js";
90
+ import "./chunk-4WR7VSYB.js";
91
+ import {
92
+ buildRecallFields,
93
+ recallErrorMessage,
94
+ recallParentTurnId,
95
+ recallableRefListing,
96
+ resolveRecall
97
+ } from "./chunk-O5CVSAG5.js";
98
+ import {
99
+ foldWorkingSet,
100
+ isTurnStart
101
+ } from "./chunk-GTUD2WMY.js";
102
+ import {
103
+ compileScoutTransition
104
+ } from "./chunk-S6PYF2XF.js";
85
105
  import {
86
106
  monitorToolSurface
87
- } from "./chunk-JEQ3XTHC.js";
107
+ } from "./chunk-LLXSDWXS.js";
88
108
  import {
89
109
  ObservabilityDomainModule,
90
- readAccountabilitySummary,
91
- recordBackgroundMemoryStep,
92
- resolveDispatchFailureStatus
93
- } from "./chunk-MWUZBSAQ.js";
110
+ recordBackgroundMemoryStep
111
+ } from "./chunk-Y55JBDO5.js";
94
112
  import {
95
- appendOutOfTurnUsageRow
96
- } from "./chunk-VA5FNYMT.js";
113
+ appendOutOfTurnUsageRow,
114
+ readAccountabilitySummary
115
+ } from "./chunk-JT2RFCC5.js";
97
116
  import {
98
117
  steerToolSurface
99
- } from "./chunk-HEQY7ZFI.js";
118
+ } from "./chunk-RAY4OVGZ.js";
100
119
  import {
101
120
  panesToolSurface
102
- } from "./chunk-4UVU7BJ5.js";
103
- import {
104
- describePanesLeftBehind,
105
- paneWatchDecision
106
- } from "./chunk-3EBYEESD.js";
107
- import {
108
- flushRawStdout,
109
- writeRawStdout
110
- } from "./chunk-2VTFPG5O.js";
111
- import "./chunk-4WR7VSYB.js";
121
+ } from "./chunk-3GY4F45V.js";
112
122
  import {
113
123
  createContextDomainModule,
114
124
  loadProjectClioMd
115
- } from "./chunk-KK4JZPBQ.js";
125
+ } from "./chunk-IZXGRF7P.js";
116
126
  import "./chunk-R6Q67RJH.js";
127
+ import {
128
+ SafetyDomainModule
129
+ } from "./chunk-5636DCO5.js";
117
130
  import {
118
131
  renderCodewikiDigest
119
- } from "./chunk-Y3CBHOR6.js";
132
+ } from "./chunk-V6HJFQZE.js";
120
133
  import {
121
134
  buildMemoryPromptSection,
122
135
  canonicalMemoryRepositoryIdentity,
@@ -132,7 +145,14 @@ import {
132
145
  taskMemoryBankSize,
133
146
  taskMemoryHandoffSeedOffer,
134
147
  taskMemoryTracePath
135
- } from "./chunk-BEPZRGGU.js";
148
+ } from "./chunk-EL24TAU4.js";
149
+ import {
150
+ listWikiPages,
151
+ wikiCompleteness,
152
+ wikiStaleness,
153
+ wikiStalenessAsync
154
+ } from "./chunk-ELZVTCGV.js";
155
+ import "./chunk-MXHC5QYU.js";
136
156
  import {
137
157
  BUILTIN_SLASH_COMMANDS,
138
158
  COMPLETION_SLOT_NAMES,
@@ -140,10 +160,8 @@ import {
140
160
  LIBRARY_TABS,
141
161
  SETTINGS_AREA_IDS,
142
162
  SLASH_COMMAND_GROUPS,
143
- boundSettledText,
144
163
  commandReference,
145
164
  completeArgs,
146
- createWorkerProgressFold,
147
165
  createWorkerStream,
148
166
  dispatchSlashCommand,
149
167
  formatUserTaskHandoff,
@@ -153,29 +171,11 @@ import {
153
171
  workerAskedByModel,
154
172
  workerReceiptSummary,
155
173
  workerTargetLabel
156
- } from "./chunk-TM6LQDI3.js";
157
- import "./chunk-35MSIRKH.js";
174
+ } from "./chunk-FFUPXJC4.js";
158
175
  import {
159
- discoverDeclaredChecks
160
- } from "./chunk-V2ANDPVT.js";
161
- import {
162
- listWikiPages,
163
- wikiCompleteness,
164
- wikiStaleness,
165
- wikiStalenessAsync
166
- } from "./chunk-NDINPTJ4.js";
167
- import "./chunk-MXHC5QYU.js";
168
- import {
169
- buildRecallFields,
170
- recallErrorMessage,
171
- recallParentTurnId,
172
- recallableRefListing,
173
- resolveRecall
174
- } from "./chunk-O5CVSAG5.js";
175
- import {
176
- foldWorkingSet,
177
- isTurnStart
178
- } from "./chunk-GTUD2WMY.js";
176
+ boundSettledText
177
+ } from "./chunk-XXYSBZIQ.js";
178
+ import "./chunk-35MSIRKH.js";
179
179
  import {
180
180
  classifyLibraryRequirements,
181
181
  createResourcesDomainModule,
@@ -186,15 +186,16 @@ import {
186
186
  libraryEntryRef,
187
187
  libraryInstallPath,
188
188
  planLibraryInstall
189
- } from "./chunk-G76U63X4.js";
189
+ } from "./chunk-RQCKCSRL.js";
190
190
  import {
191
191
  AgentsDomainModule
192
- } from "./chunk-UPZU6GE4.js";
193
- import "./chunk-RRNP2ANY.js";
192
+ } from "./chunk-RZDWV63N.js";
193
+ import "./chunk-7UGL4MB5.js";
194
194
  import "./chunk-DR52UMZW.js";
195
195
  import {
196
- compileScoutTransition
197
- } from "./chunk-2UH2KFUP.js";
196
+ createUserTasksStore
197
+ } from "./chunk-EXLD33WO.js";
198
+ import "./chunk-YAKGTXEV.js";
198
199
  import {
199
200
  ACP_AGENT_META_KEY,
200
201
  ACP_MAX_CHUNK_BYTES,
@@ -225,23 +226,28 @@ import {
225
226
  protectedResidencyModels,
226
227
  renderCostAggregate,
227
228
  renderDispatchReviewerTask
228
- } from "./chunk-AF4YM7Z4.js";
229
+ } from "./chunk-NRO2BJRH.js";
230
+ import {
231
+ readGateDecisionArtifacts,
232
+ readPendingGateDecisions
233
+ } from "./chunk-NXIMQY5W.js";
234
+ import "./chunk-XRZT5WY5.js";
229
235
  import {
230
236
  describeWriteBoundaryAttributionDowngrade,
231
237
  gitCheckoutRoot,
232
238
  isGitRepository,
233
239
  preflightWriteBoundaries,
234
240
  recoverCleanupReadyCompeteGroups
235
- } from "./chunk-B4VEBZKF.js";
241
+ } from "./chunk-QUFRYSWI.js";
236
242
  import {
237
243
  bindExecutionPlanEndpoints,
238
244
  compileFleetExecutionPlan,
239
245
  requireAgentSteps
240
- } from "./chunk-E3TPLWFX.js";
246
+ } from "./chunk-LTIKRKFL.js";
241
247
  import {
242
- readGateDecisionArtifacts,
243
- readPendingGateDecisions
244
- } from "./chunk-WRBAGUNF.js";
248
+ parseRigorOverride,
249
+ resolveRigor
250
+ } from "./chunk-ODGTEFFI.js";
245
251
  import {
246
252
  TRUST_STATUS_AXES,
247
253
  formatTrustSummaryLine,
@@ -249,10 +255,9 @@ import {
249
255
  isReceiptIntegrity,
250
256
  retiredReceiptIntegrity,
251
257
  retiredReceiptIntegrityReason,
252
- summarizeTrustStatus,
253
258
  trustStateWord,
254
259
  verifyReceiptIntegrity
255
- } from "./chunk-IWT4SF4R.js";
260
+ } from "./chunk-CUSRQKPU.js";
256
261
  import {
257
262
  SessionDomainModule,
258
263
  addResponseModelIdObservationCount,
@@ -266,20 +271,20 @@ import {
266
271
  readAuditRows,
267
272
  responseModelIdObservationCountsLabel,
268
273
  responseModelIdObservationFromRecord
269
- } from "./chunk-JKKCYP3C.js";
274
+ } from "./chunk-6UINWWS6.js";
270
275
  import "./chunk-FTMGRKEF.js";
271
- import "./chunk-XRZT5WY5.js";
272
- import {
273
- parseRigorOverride,
274
- resolveRigor
275
- } from "./chunk-RVG5JXAL.js";
276
276
  import {
277
277
  configureRunEventJournal
278
278
  } from "./chunk-VIA6RFQZ.js";
279
- import "./chunk-T56WDKA5.js";
280
279
  import {
281
280
  filterEntriesToActivePath
282
281
  } from "./chunk-W6GROXXM.js";
282
+ import {
283
+ activeDecisionRefs,
284
+ createDecisionBoardStore,
285
+ decisionRationale,
286
+ foldDecisionBoard
287
+ } from "./chunk-I2DWJ4GM.js";
283
288
  import {
284
289
  FLEET_COMMANDS_REMEDY,
285
290
  FleetCommandRegistryMissingError,
@@ -289,32 +294,34 @@ import {
289
294
  renderFleetPrompt,
290
295
  validateFleetCommands,
291
296
  validateFleetGraph
292
- } from "./chunk-2VIKGWFZ.js";
297
+ } from "./chunk-OEJSLEPW.js";
293
298
  import "./chunk-RKKLTLYB.js";
294
- import "./chunk-6PTFB5VS.js";
299
+ import {
300
+ discoverDeclaredChecks
301
+ } from "./chunk-K6T2ZAMZ.js";
295
302
  import {
296
303
  shellQuote
297
- } from "./chunk-TXOTCRLG.js";
304
+ } from "./chunk-3UUXNFEX.js";
298
305
  import {
299
306
  ToolchainDomainModule
300
307
  } from "./chunk-HRQMFLJP.js";
301
- import "./chunk-N2Z7HLVY.js";
308
+ import "./chunk-2ASED4PZ.js";
302
309
  import {
303
310
  ensureClioState,
304
311
  takeUpgradeNotice
305
312
  } from "./chunk-IGLP3ODT.js";
306
- import "./chunk-VKPAQYEB.js";
307
313
  import "./chunk-3M6DQK6S.js";
314
+ import "./chunk-VKPAQYEB.js";
308
315
  import "./chunk-LCGCVYZ4.js";
309
316
  import {
310
317
  MARKETPLACE_UNCONFIGURED,
311
318
  discoverMarketplaceSkills,
312
- getMarketplaceSkills,
313
319
  installSkill,
314
320
  modelVisibleSkills
315
- } from "./chunk-LDJG7DW3.js";
321
+ } from "./chunk-2ZSONWVL.js";
316
322
  import "./chunk-NDDGJUXD.js";
317
- import "./chunk-CE5AX47J.js";
323
+ import "./chunk-YECAMM3D.js";
324
+ import "./chunk-V76WTFTW.js";
318
325
  import {
319
326
  foldPromptCacheTelemetry,
320
327
  hasPromptCacheTelemetry,
@@ -323,7 +330,7 @@ import {
323
330
  import {
324
331
  EXTENSION_SNAPSHOT_DIAGNOSTIC_MESSAGE_CAP,
325
332
  ExtensionsDomainModule
326
- } from "./chunk-7DRAWPTZ.js";
333
+ } from "./chunk-TQAHXW6Y.js";
327
334
  import "./chunk-5MEZN6CB.js";
328
335
  import "./chunk-D4CJV46V.js";
329
336
  import "./chunk-NEKRRTYW.js";
@@ -332,7 +339,7 @@ import {
332
339
  InteropDomainModule,
333
340
  delegationEntryForKind,
334
341
  renderProposalEntry
335
- } from "./chunk-INY6HTFL.js";
342
+ } from "./chunk-JEIYHLOR.js";
336
343
  import "./chunk-I7XBWTYH.js";
337
344
  import {
338
345
  ClioEditor,
@@ -406,7 +413,7 @@ import {
406
413
  visibleWidth,
407
414
  wrapTextWithAnsi,
408
415
  writeInputWedgeDump
409
- } from "./chunk-DWUOQKRU.js";
416
+ } from "./chunk-25QBEXRS.js";
410
417
  import {
411
418
  getTerminationCoordinator
412
419
  } from "./chunk-4O6MANBS.js";
@@ -422,7 +429,7 @@ import {
422
429
  } from "./chunk-ZTJUVLTU.js";
423
430
  import {
424
431
  source_default
425
- } from "./chunk-5TSRNF4G.js";
432
+ } from "./chunk-JCI2ROMZ.js";
426
433
  import {
427
434
  INTERACTIVE_LOOP_BLOCK_BUDGET,
428
435
  applyEditsToNormalizedContent,
@@ -443,7 +450,10 @@ import {
443
450
  resolveSessionTools,
444
451
  sanitizeLockedSynthesisMessage,
445
452
  stripBom
446
- } from "./chunk-GI7YYQ3F.js";
453
+ } from "./chunk-36CT5VVL.js";
454
+ import {
455
+ resolveFdBinary
456
+ } from "./chunk-BMS5RKQY.js";
447
457
  import {
448
458
  MIDDLEWARE_HOOK_TEXT_MAX_CHARS,
449
459
  MiddlewareDomainModule,
@@ -465,23 +475,20 @@ import {
465
475
  openDetachedBatchViews,
466
476
  watchdogBriefing,
467
477
  writeMiddlewareDiagnosticToStderr
468
- } from "./chunk-2UG5F4C5.js";
478
+ } from "./chunk-XULDXHTN.js";
479
+ import "./chunk-2CU2H6KE.js";
480
+ import "./chunk-GX5WYQO4.js";
481
+ import "./chunk-RXTN6AKH.js";
482
+ import "./chunk-3UNOLWNZ.js";
469
483
  import "./chunk-5PSMVOLM.js";
470
- import {
471
- resolveFdBinary
472
- } from "./chunk-BMS5RKQY.js";
473
484
  import {
474
485
  TaskMemoryBank,
475
486
  TaskMemoryEndpointBusyError,
476
487
  createTaskMemoryTelemetrySink
477
488
  } from "./chunk-2WZ546HR.js";
478
- import "./chunk-MCEPRMZW.js";
479
- import "./chunk-ZDN3Y73Y.js";
480
- import "./chunk-64I3JVYM.js";
481
489
  import {
482
490
  escapeRegExp
483
491
  } from "./chunk-VG7TBQIY.js";
484
- import "./chunk-IUE3Y34X.js";
485
492
  import {
486
493
  ASK_USER_OTHER_LABEL,
487
494
  COUNCIL_JUDGE_PROMPT,
@@ -500,7 +507,6 @@ import {
500
507
  cancelledAskUserResult,
501
508
  classifyDecisionPresentation,
502
509
  classifyResourceRead,
503
- cloneRunToolBudgetEnvelope,
504
510
  createRegistry,
505
511
  decisionActionClass,
506
512
  decisionFactsForAnswer,
@@ -514,8 +520,6 @@ import {
514
520
  formatEffectiveBudget,
515
521
  isResponseSchemaRejection,
516
522
  maxOutputBytesArg,
517
- narrowDispatchIntentToReadOnly,
518
- normalizeDispatchIntent,
519
523
  prepareDispatchArguments,
520
524
  renderCouncilVoteMemberTask,
521
525
  resolveToolPromptHint,
@@ -526,22 +530,23 @@ import {
526
530
  timeoutMsArg,
527
531
  toolPresentationPolicy,
528
532
  withResolvedDispatchPlan
529
- } from "./chunk-PAJQJ7BS.js";
533
+ } from "./chunk-75W7L2E2.js";
534
+ import {
535
+ DEFAULT_RECENT_ENTRY_LIMIT,
536
+ assessFinishContract,
537
+ recentEntries
538
+ } from "./chunk-6QOTUPRG.js";
530
539
  import {
531
540
  defaultRoutingIntent,
532
541
  sameRouteIdentity
533
- } from "./chunk-EKCHAPYA.js";
542
+ } from "./chunk-AUPNRN7C.js";
534
543
  import {
535
544
  createTaskBoardStore,
536
545
  foldSessionTaskHistory,
537
546
  foldTaskBoard,
538
547
  taskBoardCounts
539
- } from "./chunk-L47TF46W.js";
540
- import {
541
- DEFAULT_RECENT_ENTRY_LIMIT,
542
- assessFinishContract
543
- } from "./chunk-RSJ25QSL.js";
544
- import "./chunk-XIVNBFZS.js";
548
+ } from "./chunk-6PAZTBPA.js";
549
+ import "./chunk-6Q3CYFD3.js";
545
550
  import {
546
551
  describeCallTarget,
547
552
  redactSecretString,
@@ -549,65 +554,71 @@ import {
549
554
  sanitizeCallTargetText,
550
555
  sanitizeMultilineDisplayText
551
556
  } from "./chunk-NEDJ26B5.js";
557
+ import {
558
+ resolveToCwd
559
+ } from "./chunk-OQE5J4C6.js";
560
+ import {
561
+ sweepExpiredToolOffloads,
562
+ toolResultPresentationPolicy,
563
+ toolResultPresentationText
564
+ } from "./chunk-NAI6ZFCY.js";
565
+ import {
566
+ formatSize
567
+ } from "./chunk-OZNBF4L3.js";
552
568
  import {
553
569
  TOOL_PROFILE_NAMES
554
- } from "./chunk-42FMPA75.js";
570
+ } from "./chunk-QZWQA4DE.js";
555
571
  import {
556
572
  agentRoleFactsResolver,
557
573
  gateDeciderAgentId,
558
574
  requestExecutionRole,
559
575
  withAttemptRole
560
576
  } from "./chunk-H7IXIC72.js";
561
- import "./chunk-7DICMOS6.js";
562
- import {
563
- resolveToCwd
564
- } from "./chunk-OQE5J4C6.js";
565
- import "./chunk-HHV2GANA.js";
566
577
  import {
578
+ isUserVisibleAgent,
567
579
  parseJsonObjectPayload,
568
580
  parseScoutResult,
569
581
  parseVerifierResult,
570
582
  resultContractSourceId
571
- } from "./chunk-B4OAX3SI.js";
583
+ } from "./chunk-KFV5L5SK.js";
572
584
  import {
573
585
  toolMutationPaths
574
- } from "./chunk-I7ZPNEJM.js";
586
+ } from "./chunk-NXYCB2VD.js";
587
+ import "./chunk-ECH6PKUQ.js";
575
588
  import {
576
- CLIO_PROJECT_DIR
577
- } from "./chunk-GYV6VZOC.js";
589
+ narrowDispatchIntentToReadOnly,
590
+ normalizeDispatchIntent
591
+ } from "./chunk-IRXAATOX.js";
592
+ import "./chunk-BJVFZO5U.js";
593
+ import "./chunk-DXKJURES.js";
594
+ import "./chunk-HHV2GANA.js";
595
+ import "./chunk-GYV6VZOC.js";
578
596
  import {
579
597
  VERIFICATION_SCRIPT_FAMILY_HINT
580
598
  } from "./chunk-UL3WSD3F.js";
581
- import {
582
- sweepExpiredToolOffloads,
583
- toolResultPresentationPolicy,
584
- toolResultPresentationText
585
- } from "./chunk-JDAY6FIL.js";
586
- import {
587
- formatSize
588
- } from "./chunk-OZNBF4L3.js";
589
- import "./chunk-ECH6PKUQ.js";
590
- import "./chunk-6XLNIQDB.js";
591
599
  import {
592
600
  typebox_exports
593
601
  } from "./chunk-5B2AEOW5.js";
594
602
  import "./chunk-VAVR4IJY.js";
595
603
  import "./chunk-QSNYB6ZV.js";
604
+ import "./chunk-4BJ5BYCE.js";
596
605
  import {
597
606
  DEFAULT_AUTONOMY_LEVEL,
598
607
  SKILL_SUGGESTION_PREFIX,
599
608
  armedSkillSurface,
609
+ isSessionEntry,
600
610
  isSkillActivation,
601
611
  modelMayActivateSkills,
602
612
  skillActivationFromToolDetails,
603
613
  skillSurfaceLabels,
604
614
  skillSurfaceNames,
605
615
  withModelSkillActivation
606
- } from "./chunk-JGRC33J2.js";
607
- import "./chunk-4BJ5BYCE.js";
616
+ } from "./chunk-54X7T7DK.js";
617
+ import "./chunk-I5FWO7L5.js";
618
+ import "./chunk-6XLNIQDB.js";
608
619
  import {
609
620
  ToolNames
610
- } from "./chunk-K6BSR66V.js";
621
+ } from "./chunk-4NSRCOYP.js";
611
622
  import "./chunk-QDC3K2U3.js";
612
623
  import {
613
624
  ProvidersDomainModule,
@@ -630,7 +641,6 @@ import {
630
641
  refineRuntimeTargetWithModelHints,
631
642
  registerForegroundStream,
632
643
  residencyTargetKey,
633
- resolveCostProvenance,
634
644
  resolveEndpointCapacities,
635
645
  resolveModelCapabilities,
636
646
  resolveModelReference,
@@ -643,7 +653,7 @@ import {
643
653
  thinkingLevelChoiceLabel,
644
654
  thinkingLevelFromChoiceLabel,
645
655
  withRunOverrides
646
- } from "./chunk-XPWWI35G.js";
656
+ } from "./chunk-JSD46VO2.js";
647
657
  import "./chunk-CFGTUFWB.js";
648
658
  import {
649
659
  AutoCompactionTrigger,
@@ -666,15 +676,6 @@ import {
666
676
  snapshotInputTokens
667
677
  } from "./chunk-NZMNUPZZ.js";
668
678
  import "./chunk-2JH2WHGE.js";
669
- import {
670
- atomicWrite,
671
- cwdHash,
672
- openSession,
673
- readSessionTailTurns,
674
- sessionCurrentPath,
675
- sessionPaths
676
- } from "./chunk-HAXOFFRH.js";
677
- import "./chunk-R346GLFC.js";
678
679
  import {
679
680
  interopAgentKind
680
681
  } from "./chunk-KXDSS5WJ.js";
@@ -689,11 +690,20 @@ import {
689
690
  useTargetInSettings
690
691
  } from "./chunk-GHS5EBTQ.js";
691
692
  import "./chunk-D7E7WCDF.js";
693
+ import {
694
+ atomicWrite,
695
+ cwdHash,
696
+ openSession,
697
+ readSessionTailTurns,
698
+ sessionCurrentPath,
699
+ sessionPaths
700
+ } from "./chunk-HAXOFFRH.js";
701
+ import "./chunk-R346GLFC.js";
692
702
  import "./chunk-BTK3SSSK.js";
693
703
  import {
694
704
  combineBashOutput,
695
705
  runBashCommand
696
- } from "./chunk-NMJXSHBJ.js";
706
+ } from "./chunk-W54I7H25.js";
697
707
  import {
698
708
  getSharedBus
699
709
  } from "./chunk-PMZVFWSR.js";
@@ -726,7 +736,7 @@ import {
726
736
  VALID_THINKING_LEVELS,
727
737
  formatContextWindowSlots,
728
738
  registerBuiltinRuntimes
729
- } from "./chunk-VW6DOEDG.js";
739
+ } from "./chunk-6OSVSQL5.js";
730
740
  import {
731
741
  ACTIVE_ROUTING_POSTURES,
732
742
  ACTIVE_ROUTING_ROLES,
@@ -735,14 +745,15 @@ import {
735
745
  THINKING_LEVELS
736
746
  } from "./chunk-UXCU4E3T.js";
737
747
  import "./chunk-LL4KHSZI.js";
738
- import "./chunk-JSC3U7TI.js";
739
748
  import {
740
749
  configureGuardrails,
741
750
  guardrailValuesFromSettings
742
751
  } from "./chunk-S66XZJOF.js";
752
+ import "./chunk-TOIVGRUX.js";
743
753
  import {
754
+ setCommitDecisionRefsProvider,
744
755
  setGitCommitAttributionEnabled
745
- } from "./chunk-JIEGK6UF.js";
756
+ } from "./chunk-U6TMQNSI.js";
746
757
  import {
747
758
  MAX_TIMER_DELAY_MS,
748
759
  rawDurationMs
@@ -750,7 +761,7 @@ import {
750
761
  import "./chunk-6EJMN2Y3.js";
751
762
  import {
752
763
  resolveProviderReference
753
- } from "./chunk-LLDJM5XK.js";
764
+ } from "./chunk-26QSH3EJ.js";
754
765
  import {
755
766
  targetRequiresAuth
756
767
  } from "./chunk-ID64D7PE.js";
@@ -791,8 +802,8 @@ import {
791
802
  // src/entry/orchestrator.ts
792
803
  init_esm_shims();
793
804
  import { randomUUID as randomUUID3 } from "node:crypto";
794
- import { readFileSync as readFileSync10 } from "node:fs";
795
- import { join as join12 } from "node:path";
805
+ import { readFileSync as readFileSync9 } from "node:fs";
806
+ import { join as join11 } from "node:path";
796
807
 
797
808
  // src/cli/modes/print.ts
798
809
  init_esm_shims();
@@ -1614,19 +1625,18 @@ function stableJson(value) {
1614
1625
  // src/domains/safety/finish-contract-registration.ts
1615
1626
  init_esm_shims();
1616
1627
  var FINISH_CONTRACT_REGISTRATION_ID = "assessor.finish-contract";
1617
- var HIGH_RIGOR_REVALIDATION_MESSAGE = `[Clio Coder] high-rigor finish gate: this completion claim has no validation evidence. Before claiming done, run a verification command (the ${VERIFICATION_SCRIPT_FAMILY_HINT} family, e.g. "npm run test", "npm run lint", "npm run build") or explicitly state what could not be verified and why. Do not end the turn until you have validated or recorded the limitation.`;
1628
+ var HIGH_RIGOR_REVALIDATION_MESSAGE = `[Clio Coder] high-rigor finish gate: this completion claim has no validation evidence. Before claiming done, run a verification command (the ${VERIFICATION_SCRIPT_FAMILY_HINT} family, e.g. "npm run test", "npm run lint", "npm run build") or call the limitation tool with the scope and reason of what could not be verified. Do not end the turn until you have validated or recorded the limitation.`;
1618
1629
  function createFinishContractRegistration(options) {
1619
1630
  return {
1620
1631
  id: FINISH_CONTRACT_REGISTRATION_ID,
1621
- description: "advise when a turn mutated files without validation evidence or an explicit limitation",
1632
+ description: "advise when a turn mutated files without validation evidence or a limitation receipt",
1622
1633
  hooks: ["turn_end"],
1623
1634
  evaluate(input, context) {
1624
1635
  if (input.hook !== "turn_end") return [];
1625
1636
  if (context?.priorEffects.some(isHardBlockEffect) === true) return [];
1626
1637
  const stopReason = input.metadata?.stopReason;
1627
1638
  if (stopReason !== void 0 && stopReason !== "stop") return [];
1628
- const assistantText3 = input.text?.trim() ?? "";
1629
- if (assistantText3.length === 0) return [];
1639
+ if ((input.text?.trim() ?? "").length === 0) return [];
1630
1640
  let entries;
1631
1641
  try {
1632
1642
  entries = options.readSessionEntries();
@@ -1634,18 +1644,22 @@ function createFinishContractRegistration(options) {
1634
1644
  return [];
1635
1645
  }
1636
1646
  if (entries === null) return [];
1647
+ const rigor = options.resolveRigor?.() ?? "normal";
1648
+ const activeAcceptance = rigor === "high" ? options.readActiveAcceptance?.(recentEntries(entries, input.turnId ?? null, DEFAULT_RECENT_ENTRY_LIMIT)) : void 0;
1637
1649
  const assessment = assessFinishContract({
1638
- assistantText: assistantText3,
1639
1650
  sessionEntries: entries,
1651
+ workspaceRoot: process.cwd(),
1652
+ rigor,
1653
+ ...activeAcceptance ? { activeAcceptance } : {},
1640
1654
  assistantTurnId: input.turnId ?? null
1641
1655
  });
1642
- const rigor = options.resolveRigor?.() ?? "normal";
1643
1656
  recordDecision(options, input.turnId ?? null, assessment, rigor);
1644
1657
  if (assessment.kind !== "engage") return [];
1645
1658
  if (rigor === "high") {
1659
+ const message = activeAcceptance?.verification.length ? assessment.message : HIGH_RIGOR_REVALIDATION_MESSAGE;
1646
1660
  return [
1647
- { kind: "request_continuation", message: HIGH_RIGOR_REVALIDATION_MESSAGE },
1648
- { kind: "inject_reminder", message: HIGH_RIGOR_REVALIDATION_MESSAGE, severity: "warn" }
1661
+ { kind: "request_continuation", message },
1662
+ { kind: "inject_reminder", message, severity: "warn" }
1649
1663
  ];
1650
1664
  }
1651
1665
  return [{ kind: "inject_reminder", message: assessment.message, severity: "warn" }];
@@ -2204,142 +2218,6 @@ function textFromAssistant(message) {
2204
2218
  ).map((c) => c.text).join("\n");
2205
2219
  }
2206
2220
 
2207
- // src/domains/session/decision-board.ts
2208
- init_esm_shims();
2209
- function answeredAtForDecision(policy, sourceQuestion) {
2210
- for (let index = policy.rounds.length - 1; index >= 0; index -= 1) {
2211
- const round = policy.rounds[index];
2212
- if (!round?.answeredAt) continue;
2213
- if (round.answers.some((answer) => answer.question === sourceQuestion)) return round.answeredAt;
2214
- if (round.questions.some((question) => question.question === sourceQuestion)) return round.answeredAt;
2215
- }
2216
- return void 0;
2217
- }
2218
- function finalizedInterviewEntryFields(policy) {
2219
- if (policy.rounds.length === 0 && policy.decisions.length === 0) return null;
2220
- if (!policy.turnId) throw new Error(`decision board: interview ${policy.id} has no originating user turn`);
2221
- if (policy.status !== "complete" && policy.status !== "cancelled") {
2222
- throw new Error(`decision board: interview ${policy.id} finalized with status ${policy.status}`);
2223
- }
2224
- const endedAt = policy.endedAt ?? policy.updatedAt;
2225
- const decisionsByKey = /* @__PURE__ */ new Map();
2226
- for (const decision of policy.decisions) {
2227
- const decidedAt = decision.source_question ? answeredAtForDecision(policy, decision.source_question) ?? endedAt : endedAt;
2228
- decisionsByKey.set(decision.key, {
2229
- key: decision.key,
2230
- value: decision.value,
2231
- ...decision.label ? { label: decision.label } : {},
2232
- ...decision.source_question ? { source_question: decision.source_question } : {},
2233
- status: "active",
2234
- decidedAt
2235
- });
2236
- }
2237
- return {
2238
- kind: "decisionLedger",
2239
- parentTurnId: policy.turnId,
2240
- interviewId: policy.id,
2241
- interviewStatus: policy.status,
2242
- startedAt: policy.startedAt,
2243
- endedAt,
2244
- roundCount: policy.rounds.length,
2245
- ...policy.summary ? { summary: policy.summary } : {},
2246
- ...policy.transcriptPath ? { transcriptPath: policy.transcriptPath } : {},
2247
- exposure: policy.exposure ?? "local",
2248
- decisions: [...decisionsByKey.values()]
2249
- };
2250
- }
2251
- function isDecisionLedgerEntry(value) {
2252
- return !!value && typeof value === "object" && value.kind === "decisionLedger";
2253
- }
2254
- function foldDecisionBoard(entries) {
2255
- const lastByInterview = /* @__PURE__ */ new Map();
2256
- for (let index = 0; index < entries.length; index += 1) {
2257
- const raw = entries[index];
2258
- if (!isDecisionLedgerEntry(raw)) continue;
2259
- lastByInterview.set(raw.interviewId, { entry: raw, index });
2260
- }
2261
- return [...lastByInterview.values()].sort((left, right) => {
2262
- const byEndedAt = right.entry.endedAt.localeCompare(left.entry.endedAt);
2263
- return byEndedAt !== 0 ? byEndedAt : right.index - left.index;
2264
- }).map(({ entry }) => entry);
2265
- }
2266
- function activeLeafFromEntries(entries) {
2267
- for (let index = entries.length - 1; index >= 0; index -= 1) {
2268
- const entry = entries[index];
2269
- if (entry && typeof entry === "object" && entry.kind === "message") {
2270
- const turnId = entry.turnId;
2271
- if (typeof turnId === "string" && turnId.length > 0) return turnId;
2272
- }
2273
- }
2274
- return null;
2275
- }
2276
- function createDecisionBoardStore(deps = {}) {
2277
- let cachedSessionId;
2278
- let dirty = true;
2279
- let interviews = [];
2280
- const syncToSession = () => {
2281
- const sessionId = deps.getSessionId?.() ?? null;
2282
- if (!dirty && sessionId === cachedSessionId) return;
2283
- const entries = deps.readEntries?.() ?? [];
2284
- interviews = foldDecisionBoard(entries);
2285
- cachedSessionId = sessionId;
2286
- dirty = false;
2287
- };
2288
- const append = (entry) => {
2289
- if (!deps.appendEntry) throw new Error("decision board: no session ledger is available");
2290
- deps.appendEntry(entry);
2291
- dirty = true;
2292
- };
2293
- return {
2294
- snapshot() {
2295
- syncToSession();
2296
- return interviews;
2297
- },
2298
- recordFinalizedInterview(policy) {
2299
- const entry = finalizedInterviewEntryFields(policy);
2300
- if (entry === null) return false;
2301
- append(entry);
2302
- return true;
2303
- },
2304
- supersede(interviewId, key, correction) {
2305
- syncToSession();
2306
- const interview = interviews.find((candidate) => candidate.interviewId === interviewId);
2307
- if (!interview) throw new Error(`decision board: interview ${interviewId} was not found on the active branch`);
2308
- const selected = interview.decisions.find((decision) => decision.key === key);
2309
- if (!selected) throw new Error(`decision board: decision ${key} was not found in interview ${interviewId}`);
2310
- const revisedAt = (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
2311
- const normalizedCorrection = correction?.trim();
2312
- const entries = deps.readEntries?.() ?? [];
2313
- const parentTurnId = deps.getActiveLeafTurnId?.() ?? activeLeafFromEntries(entries);
2314
- if (!parentTurnId) throw new Error("decision board: no active branch leaf is available for the revision");
2315
- const revision = {
2316
- kind: "decisionLedger",
2317
- parentTurnId,
2318
- interviewId: interview.interviewId,
2319
- interviewStatus: interview.interviewStatus,
2320
- startedAt: interview.startedAt,
2321
- endedAt: interview.endedAt,
2322
- roundCount: interview.roundCount,
2323
- ...interview.summary ? { summary: interview.summary } : {},
2324
- ...interview.transcriptPath ? { transcriptPath: interview.transcriptPath } : {},
2325
- ...interview.exposure ? { exposure: interview.exposure } : {},
2326
- decisions: interview.decisions.map((decision) => {
2327
- if (decision.key !== selected.key) return { ...decision };
2328
- const next = { ...decision, status: "superseded", revisedAt };
2329
- if (normalizedCorrection) next.correction = normalizedCorrection;
2330
- else delete next.correction;
2331
- return next;
2332
- })
2333
- };
2334
- append(revision);
2335
- return revision;
2336
- },
2337
- invalidate() {
2338
- dirty = true;
2339
- }
2340
- };
2341
- }
2342
-
2343
2221
  // src/domains/session/protected-artifact-journal.ts
2344
2222
  init_esm_shims();
2345
2223
  import { createHash, randomBytes } from "node:crypto";
@@ -2504,211 +2382,26 @@ function reconcilePendingProtectedArtifacts(session) {
2504
2382
  return pending.records.length;
2505
2383
  }
2506
2384
 
2507
- // src/domains/user-tasks/store.ts
2385
+ // src/domains/user-tasks/active-acceptance.ts
2508
2386
  init_esm_shims();
2509
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
2510
- import { join as join3 } from "node:path";
2511
- var USER_TASKS_FILE_VERSION = 1;
2512
- var USER_TASKS_RELATIVE_PATH = `${CLIO_PROJECT_DIR}/user-tasks.json`;
2513
- var UserTasksStoreError = class extends Error {
2514
- constructor(message, options) {
2515
- super(message, options);
2516
- this.name = "UserTasksStoreError";
2517
- }
2518
- };
2519
- var USER_TASK_STATUSES = ["open", "handed", "picked", "done", "dropped"];
2520
- var FILE_KEYS = /* @__PURE__ */ new Set(["version", "nextId", "tasks"]);
2521
- var TASK_KEYS = /* @__PURE__ */ new Set([
2522
- "id",
2523
- "title",
2524
- "note",
2525
- "status",
2526
- "createdAt",
2527
- "updatedAt",
2528
- "handedSessionId",
2529
- "boardTaskId"
2530
- ]);
2531
- function isRecord2(value) {
2532
- return typeof value === "object" && value !== null && !Array.isArray(value);
2533
- }
2534
- function hasOnlyKeys(value, allowed) {
2535
- return Object.keys(value).every((key) => allowed.has(key));
2536
- }
2537
- function isOptionalString(value) {
2538
- return value === void 0 || typeof value === "string";
2539
- }
2540
- function isUserTask(value) {
2541
- if (!isRecord2(value) || !hasOnlyKeys(value, TASK_KEYS)) return false;
2542
- return typeof value.id === "string" && /^u[1-9]\d*$/.test(value.id) && typeof value.title === "string" && value.title.trim().length > 0 && typeof value.status === "string" && USER_TASK_STATUSES.includes(value.status) && typeof value.createdAt === "string" && typeof value.updatedAt === "string" && isOptionalString(value.note) && isOptionalString(value.handedSessionId) && isOptionalString(value.boardTaskId);
2543
- }
2544
- function parseFile(body, path2) {
2545
- let parsed;
2546
- try {
2547
- parsed = JSON.parse(body);
2548
- } catch (error) {
2549
- throw new UserTasksStoreError(`user tasks file is corrupt JSON: ${path2}`, { cause: error });
2550
- }
2551
- if (!isRecord2(parsed) || !hasOnlyKeys(parsed, FILE_KEYS)) {
2552
- throw new UserTasksStoreError(`user tasks file has an invalid top-level shape: ${path2}`);
2553
- }
2554
- if (parsed.version !== USER_TASKS_FILE_VERSION || !Number.isSafeInteger(parsed.nextId) || parsed.nextId < 1 || !Array.isArray(parsed.tasks) || !parsed.tasks.every(isUserTask)) {
2555
- throw new UserTasksStoreError(`user tasks file failed schema validation: ${path2}`);
2556
- }
2557
- const ids = /* @__PURE__ */ new Set();
2558
- let maxId = 0;
2559
- for (const task of parsed.tasks) {
2560
- if (ids.has(task.id)) throw new UserTasksStoreError(`user tasks file contains duplicate id ${task.id}: ${path2}`);
2561
- ids.add(task.id);
2562
- maxId = Math.max(maxId, Number(task.id.slice(1)));
2563
- }
2564
- if (parsed.nextId <= maxId) {
2565
- throw new UserTasksStoreError(`user tasks file nextId would reuse an existing id: ${path2}`);
2566
- }
2567
- return {
2568
- version: USER_TASKS_FILE_VERSION,
2569
- nextId: parsed.nextId,
2570
- tasks: parsed.tasks.map(copyTask)
2571
- };
2572
- }
2573
- function copyTask(task) {
2574
- return { ...task };
2575
- }
2576
- function initialFile() {
2577
- return { version: USER_TASKS_FILE_VERSION, nextId: 1, tasks: [] };
2578
- }
2579
- function createUserTasksStore(deps) {
2580
- const path2 = join3(deps.cwd, USER_TASKS_RELATIVE_PATH);
2581
- const exists = deps.exists ?? existsSync3;
2582
- const read = deps.read ?? ((target) => readFileSync3(target, "utf8"));
2583
- const write = deps.write ?? ((target, body) => atomicWrite(target, body));
2584
- const now = () => (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
2585
- const load = () => {
2586
- if (!exists(path2)) return initialFile();
2587
- try {
2588
- return parseFile(read(path2), path2);
2589
- } catch (error) {
2590
- if (error instanceof UserTasksStoreError) throw error;
2591
- throw new UserTasksStoreError(`could not read user tasks file: ${path2}`, { cause: error });
2592
- }
2593
- };
2594
- const save = (file) => {
2595
- try {
2596
- write(path2, `${JSON.stringify(file, null, 2)}
2597
- `);
2598
- } catch (error) {
2599
- throw new UserTasksStoreError(`could not write user tasks file: ${path2}`, { cause: error });
2600
- }
2601
- };
2602
- const mutate = (id, allowed, status, sessionId) => {
2603
- const file = load();
2604
- const index = file.tasks.findIndex((task) => task.id === id);
2605
- const current = file.tasks[index];
2606
- if (!current) throw new UserTasksStoreError(`operator task ${id} was not found`);
2607
- if (!allowed.includes(current.status)) {
2608
- throw new UserTasksStoreError(`operator task ${id} is ${current.status}; it cannot move to ${status}`);
2609
- }
2610
- const updated = { ...current, status, updatedAt: now() };
2611
- if (status === "handed" && sessionId) updated.handedSessionId = sessionId;
2612
- file.tasks[index] = updated;
2613
- save(file);
2614
- return copyTask(updated);
2615
- };
2616
- const recordLink = (id, status, sessionId, boardTaskId) => {
2617
- const file = load();
2618
- const index = file.tasks.findIndex((task) => task.id === id);
2619
- const current = file.tasks[index];
2620
- if (!current) throw new UserTasksStoreError(`operator task ${id} was not found`);
2621
- if (current.status === "done" || current.status === "dropped") {
2622
- throw new UserTasksStoreError(`operator task ${id} is ${current.status}; it cannot move to ${status}`);
2623
- }
2624
- const updated = {
2625
- ...current,
2626
- status,
2627
- updatedAt: now(),
2628
- handedSessionId: sessionId,
2629
- boardTaskId
2630
- };
2631
- file.tasks[index] = updated;
2632
- save(file);
2633
- return copyTask(updated);
2634
- };
2635
- return {
2636
- path: path2,
2637
- snapshot() {
2638
- return load().tasks.map(copyTask);
2639
- },
2640
- get(id) {
2641
- const task = load().tasks.find((candidate) => candidate.id === id);
2642
- return task ? copyTask(task) : null;
2643
- },
2644
- add(title, note) {
2645
- const normalizedTitle = title.trim();
2646
- if (normalizedTitle.length === 0) throw new UserTasksStoreError("operator task title cannot be empty");
2647
- const normalizedNote = note?.trim();
2648
- const file = load();
2649
- const timestamp = now();
2650
- const task = {
2651
- id: `u${file.nextId}`,
2652
- title: normalizedTitle,
2653
- ...normalizedNote ? { note: normalizedNote } : {},
2654
- status: "open",
2655
- createdAt: timestamp,
2656
- updatedAt: timestamp
2657
- };
2658
- file.nextId += 1;
2659
- file.tasks.push(task);
2660
- save(file);
2661
- return copyTask(task);
2662
- },
2663
- hand(id, sessionId) {
2664
- return mutate(id, ["open"], "handed", sessionId);
2665
- },
2666
- done(id) {
2667
- return mutate(id, ["open", "handed", "picked"], "done");
2668
- },
2669
- drop(id) {
2670
- return mutate(id, ["open", "handed", "picked"], "dropped");
2671
- },
2672
- recordPicked(id, sessionId, boardTaskId) {
2673
- return recordLink(id, "picked", sessionId, boardTaskId);
2674
- },
2675
- recordDone(id, sessionId, boardTaskId) {
2676
- return recordLink(id, "done", sessionId, boardTaskId);
2677
- },
2678
- reconcile(links, sessionId) {
2679
- const file = load();
2680
- let changed = false;
2681
- for (const [index, current] of file.tasks.entries()) {
2682
- if (current.status === "done" || current.status === "dropped") continue;
2683
- const candidates = links.filter((link2) => link2.userTaskId === current.id);
2684
- const completed = candidates.find((link2) => link2.status === "completed");
2685
- const open3 = candidates.find((link2) => link2.status === "active" || link2.status === "pending");
2686
- const link = completed ?? open3;
2687
- if (link) {
2688
- const status = completed ? "done" : "picked";
2689
- if (current.status !== status || current.boardTaskId !== link.boardTaskId || current.handedSessionId !== sessionId) {
2690
- file.tasks[index] = {
2691
- ...current,
2692
- status,
2693
- boardTaskId: link.boardTaskId,
2694
- handedSessionId: sessionId,
2695
- updatedAt: now()
2696
- };
2697
- changed = true;
2698
- }
2699
- continue;
2700
- }
2701
- if (current.status === "picked" && current.handedSessionId === sessionId) {
2702
- const repaired = { ...current, status: "handed", updatedAt: now() };
2703
- delete repaired.boardTaskId;
2704
- file.tasks[index] = repaired;
2705
- changed = true;
2706
- }
2707
- }
2708
- if (changed) save(file);
2709
- return file.tasks.map(copyTask);
2710
- }
2711
- };
2387
+ function activeUserTaskAcceptance(tasks, board, sessionId, window) {
2388
+ if (!board || !sessionId) return void 0;
2389
+ const touched = /* @__PURE__ */ new Set();
2390
+ for (const entry of window) {
2391
+ if (!isSessionEntry(entry) || entry.kind !== "message" || entry.role !== "tool_call") continue;
2392
+ if (!entry.payload || typeof entry.payload !== "object") continue;
2393
+ const payload = entry.payload;
2394
+ if ((payload.name ?? payload.toolName) === "tasks" && payload.args?.id && ["done", "block", "drop"].includes(payload.args.action ?? ""))
2395
+ touched.add(payload.args.id);
2396
+ }
2397
+ const linked = new Set(
2398
+ board.tasks.filter((task) => task.status === "pending" || task.status === "active" || touched.has(task.id)).map((task) => task.userTaskId)
2399
+ );
2400
+ const acceptance = tasks.filter((task) => task.handedSessionId === sessionId && linked.has(task.id)).flatMap((task) => task.acceptance ? [task.acceptance] : []);
2401
+ return acceptance.length > 0 ? {
2402
+ expectedOutputs: [...new Set(acceptance.flatMap((item) => item.expectedOutputs))],
2403
+ verification: acceptance.flatMap((item) => item.verification)
2404
+ } : void 0;
2712
2405
  }
2713
2406
 
2714
2407
  // src/engine/acp/server.ts
@@ -2716,11 +2409,11 @@ init_esm_shims();
2716
2409
  import { randomUUID } from "node:crypto";
2717
2410
  import { realpathSync } from "node:fs";
2718
2411
  import { isAbsolute, resolve as resolvePath } from "node:path";
2719
- function isRecord3(value) {
2412
+ function isRecord2(value) {
2720
2413
  return typeof value === "object" && value !== null && !Array.isArray(value);
2721
2414
  }
2722
2415
  function eventRecord(value) {
2723
- return isRecord3(value) ? value : {};
2416
+ return isRecord2(value) ? value : {};
2724
2417
  }
2725
2418
  function textContent(text) {
2726
2419
  return { type: "text", text };
@@ -2768,17 +2461,17 @@ function toolCallContent(text) {
2768
2461
  function contentText(value) {
2769
2462
  if (typeof value === "string") return value;
2770
2463
  if (Array.isArray(value)) return value.map(contentText).filter(Boolean).join("\n");
2771
- if (!isRecord3(value)) return "";
2464
+ if (!isRecord2(value)) return "";
2772
2465
  if (value.type === "text" && typeof value.text === "string") return value.text;
2773
2466
  if (Array.isArray(value.content)) return contentText(value.content);
2774
2467
  if (typeof value.content === "string") return value.content;
2775
2468
  return "";
2776
2469
  }
2777
2470
  function promptText(params) {
2778
- if (!isRecord3(params) || !Array.isArray(params.prompt)) return "";
2471
+ if (!isRecord2(params) || !Array.isArray(params.prompt)) return "";
2779
2472
  const parts = [];
2780
2473
  for (const block of params.prompt) {
2781
- if (!isRecord3(block) || block.type !== "text" || typeof block.text !== "string") continue;
2474
+ if (!isRecord2(block) || block.type !== "text" || typeof block.text !== "string") continue;
2782
2475
  parts.push(block.text);
2783
2476
  }
2784
2477
  return parts.join("\n").trim();
@@ -2853,7 +2546,7 @@ function boundRawValue(value, depth) {
2853
2546
  if (depth >= ACP_MAX_RAW_RECORD_DEPTH) return "[depth]";
2854
2547
  return value.map((entry) => boundRawValue(entry, depth + 1));
2855
2548
  }
2856
- if (isRecord3(value)) {
2549
+ if (isRecord2(value)) {
2857
2550
  if (depth >= ACP_MAX_RAW_RECORD_DEPTH) return "[depth]";
2858
2551
  const bounded = {};
2859
2552
  for (const [key, entry] of Object.entries(value)) bounded[key] = boundRawValue(entry, depth + 1);
@@ -2870,7 +2563,7 @@ function originalRawRecordBytes(value) {
2870
2563
  }
2871
2564
  }
2872
2565
  function boundRawRecord(value) {
2873
- const bounded = isRecord3(value) ? boundRawValue(value, 0) : {};
2566
+ const bounded = isRecord2(value) ? boundRawValue(value, 0) : {};
2874
2567
  let serialized;
2875
2568
  try {
2876
2569
  serialized = JSON.stringify(bounded);
@@ -2885,7 +2578,7 @@ function boundRawRecord(value) {
2885
2578
  var PATH_BEARING_TOOLS = /* @__PURE__ */ new Set(["read", "write", "edit", "ls", "grep", "find"]);
2886
2579
  function toolLocations(toolName, args, cwd) {
2887
2580
  if (toolName === void 0 || !PATH_BEARING_TOOLS.has(toolName)) return null;
2888
- if (!isRecord3(args)) return null;
2581
+ if (!isRecord2(args)) return null;
2889
2582
  const path2 = args.path;
2890
2583
  if (typeof path2 !== "string" || path2.length === 0) return null;
2891
2584
  return [{ path: boundString(resolvePath(cwd, path2), ACP_MAX_LOCATION_PATH_BYTES) }];
@@ -2923,10 +2616,10 @@ function finite(value) {
2923
2616
  }
2924
2617
  function costTotal(usage) {
2925
2618
  const cost = usage.cost;
2926
- return isRecord3(cost) ? finite(cost.total) : 0;
2619
+ return isRecord2(cost) ? finite(cost.total) : 0;
2927
2620
  }
2928
2621
  function mergeUsage(into, usage) {
2929
- if (!isRecord3(usage)) return;
2622
+ if (!isRecord2(usage)) return;
2930
2623
  const input = finite(usage.input) + finite(usage.inputTokens) + finite(usage.input_tokens) + finite(usage.prompt_tokens);
2931
2624
  const output = finite(usage.output) + finite(usage.outputTokens) + finite(usage.output_tokens) + finite(usage.completion_tokens);
2932
2625
  const cacheRead = finite(usage.cacheRead) + finite(usage.cacheReadTokens) + finite(usage.cache_read_tokens);
@@ -2942,7 +2635,7 @@ function mergeUsage(into, usage) {
2942
2635
  into.costUsd += costTotal(usage);
2943
2636
  }
2944
2637
  function mergeMessageUsage(into, message, seen) {
2945
- if (!isRecord3(message)) return;
2638
+ if (!isRecord2(message)) return;
2946
2639
  if (seen) {
2947
2640
  if (seen.has(message)) return;
2948
2641
  seen.add(message);
@@ -2954,13 +2647,13 @@ function mergeMessagesUsage(into, messages, seen) {
2954
2647
  for (const message of messages) mergeMessageUsage(into, message, seen);
2955
2648
  }
2956
2649
  function assistantText2(message) {
2957
- if (!isRecord3(message) || message.role !== "assistant") return "";
2650
+ if (!isRecord2(message) || message.role !== "assistant") return "";
2958
2651
  return contentText(message.content);
2959
2652
  }
2960
2653
  function assistantThinking(message) {
2961
- if (!isRecord3(message) || message.role !== "assistant" || !Array.isArray(message.content)) return "";
2654
+ if (!isRecord2(message) || message.role !== "assistant" || !Array.isArray(message.content)) return "";
2962
2655
  return message.content.map((block) => {
2963
- if (!isRecord3(block)) return "";
2656
+ if (!isRecord2(block)) return "";
2964
2657
  if (block.type === "thinking" && typeof block.thinking === "string") return block.thinking;
2965
2658
  if (block.type === "thinking" && typeof block.text === "string") return block.text;
2966
2659
  return "";
@@ -2987,10 +2680,10 @@ function mapAcpStopReason(raw) {
2987
2680
  }
2988
2681
  }
2989
2682
  function applyStopReason(active, message) {
2990
- const mapped = mapAcpStopReason(isRecord3(message) ? message.stopReason : void 0);
2683
+ const mapped = mapAcpStopReason(isRecord2(message) ? message.stopReason : void 0);
2991
2684
  if (mapped === "error") {
2992
2685
  active.errored = true;
2993
- const explicit = isRecord3(message) && typeof message.errorMessage === "string" ? message.errorMessage : "";
2686
+ const explicit = isRecord2(message) && typeof message.errorMessage === "string" ? message.errorMessage : "";
2994
2687
  const text = explicit.length > 0 ? explicit : assistantText2(message);
2995
2688
  if (text.length > 0) active.errorMessage = text;
2996
2689
  return;
@@ -3000,7 +2693,7 @@ function applyStopReason(active, message) {
3000
2693
  }
3001
2694
  function outputText(value) {
3002
2695
  if (typeof value === "string") return value;
3003
- if (!isRecord3(value)) return "";
2696
+ if (!isRecord2(value)) return "";
3004
2697
  const presentationText = toolResultPresentationText(value);
3005
2698
  if (presentationText !== null) return presentationText;
3006
2699
  if (Array.isArray(value.content)) return contentText(value.content);
@@ -3025,7 +2718,7 @@ function eventString(event, ...keys) {
3025
2718
  function eventTextDelta(event) {
3026
2719
  const direct = eventString(event, "delta", "text");
3027
2720
  if (direct !== void 0) return direct;
3028
- const assistantEvent = isRecord3(event.assistantMessageEvent) ? event.assistantMessageEvent : null;
2721
+ const assistantEvent = isRecord2(event.assistantMessageEvent) ? event.assistantMessageEvent : null;
3029
2722
  if (assistantEvent) {
3030
2723
  const nested = assistantEvent.delta;
3031
2724
  if (typeof nested === "string") return nested;
@@ -3132,7 +2825,7 @@ function handleChatEvent(rawEvent, transport, sessionId, active, cwd, diagnostic
3132
2825
  return;
3133
2826
  }
3134
2827
  if (event.type === "notice") {
3135
- const admission = isRecord3(event.admission) ? event.admission : null;
2828
+ const admission = isRecord2(event.admission) ? event.admission : null;
3136
2829
  const reason = admission !== null && typeof admission.reason === "string" ? admission.reason : "";
3137
2830
  if (reason.length > 0 && active.admissionReason === void 0) active.admissionReason = admissionReason(reason);
3138
2831
  return;
@@ -3220,7 +2913,7 @@ function handleChatEvent(rawEvent, transport, sessionId, active, cwd, diagnostic
3220
2913
  active.sawTurnEnd = true;
3221
2914
  mergeMessagesUsage(active.usage, event.messages, active.usageMessages);
3222
2915
  const messages = Array.isArray(event.messages) ? event.messages : [];
3223
- const last = [...messages].reverse().find((message) => isRecord3(message) && message.role === "assistant");
2916
+ const last = [...messages].reverse().find((message) => isRecord2(message) && message.role === "assistant");
3224
2917
  if (last !== void 0) applyStopReason(active, last);
3225
2918
  return;
3226
2919
  }
@@ -3280,7 +2973,7 @@ function safeIso(value) {
3280
2973
  return (/* @__PURE__ */ new Date(0)).toISOString();
3281
2974
  }
3282
2975
  function payloadRecord(payload) {
3283
- return isRecord3(payload) ? payload : null;
2976
+ return isRecord2(payload) ? payload : null;
3284
2977
  }
3285
2978
  function replayTextBlocks(entry) {
3286
2979
  const text = [];
@@ -3292,7 +2985,7 @@ function replayTextBlocks(entry) {
3292
2985
  if (!Array.isArray(payload.content)) return { text, thinking };
3293
2986
  if (payload.content.length > 0) text.length = 0;
3294
2987
  for (const block of payload.content) {
3295
- if (!isRecord3(block)) continue;
2988
+ if (!isRecord2(block)) continue;
3296
2989
  if (block.type === "text" && typeof block.text === "string") text.push(block.text);
3297
2990
  if (block.type === "thinking") {
3298
2991
  if (typeof block.thinking === "string") thinking.push(block.thinking);
@@ -3634,6 +3327,15 @@ function installPermissionBridge(input) {
3634
3327
  }
3635
3328
  if (outcome.kind === "response") {
3636
3329
  const answer = outcome.response.outcome;
3330
+ if (answer.outcome === "cancelled") {
3331
+ const reason = "ACP client cancelled permission";
3332
+ input.cancelActivePrompt(reason);
3333
+ emitResolution({ status: "denied", decidedBy: "cancelled", reason });
3334
+ queuedRequestIds.clear();
3335
+ queuedRequestDetails.clear();
3336
+ input.toolRegistry?.cancelParkedCalls(reason);
3337
+ return;
3338
+ }
3637
3339
  if (answer.outcome === "selected" && answer.optionId === "allow-once") {
3638
3340
  emitResolution({ status: "granted", decidedBy: "acp-client" });
3639
3341
  await input.toolRegistry?.resumeParkedCalls({
@@ -3726,6 +3428,10 @@ async function serveClioAcpAgent(options) {
3726
3428
  if (activePromptState === null) return;
3727
3429
  activePromptState.permissionExpired = true;
3728
3430
  options.chat.cancel();
3431
+ },
3432
+ cancelActivePrompt: (reason) => {
3433
+ const session = activeSessionId === null ? void 0 : sessions.get(activeSessionId);
3434
+ if (session) cancelSession(session, reason);
3729
3435
  }
3730
3436
  });
3731
3437
  const forwardEvent = (kind, turnId, terminal, payload) => {
@@ -3924,14 +3630,14 @@ async function serveClioAcpAgent(options) {
3924
3630
  };
3925
3631
  const sessionIdOf = (params) => {
3926
3632
  return requireBoundedClientString(
3927
- isRecord3(params) ? params.sessionId : void 0,
3633
+ isRecord2(params) ? params.sessionId : void 0,
3928
3634
  "sessionId",
3929
3635
  ACP_MAX_SESSION_ID_BYTES
3930
3636
  );
3931
3637
  };
3932
3638
  const assertParamKeys = (params, allowed) => {
3933
3639
  if (params === void 0) return {};
3934
- if (!isRecord3(params) || Object.keys(params).some((key) => !allowed.has(key))) {
3640
+ if (!isRecord2(params) || Object.keys(params).some((key) => !allowed.has(key))) {
3935
3641
  throw new AcpRequestError(-32602, "invalid method parameters", { code: "invalid_params" });
3936
3642
  }
3937
3643
  return params;
@@ -3981,16 +3687,16 @@ async function serveClioAcpAgent(options) {
3981
3687
  };
3982
3688
  options.transport.onRequest("initialize", (params) => {
3983
3689
  if (initialized) throw new AcpRequestError(-32e3, "already initialized", { code: "already_initialized" });
3984
- const version = isRecord3(params) ? params.protocolVersion : void 0;
3690
+ const version = isRecord2(params) ? params.protocolVersion : void 0;
3985
3691
  if (version !== 1) {
3986
3692
  throw new AcpRequestError(-32602, "unsupported ACP protocol version", {
3987
3693
  code: "protocol_version_unsupported",
3988
3694
  supported: [1]
3989
3695
  });
3990
3696
  }
3991
- const clientCapabilities = isRecord3(params) && isRecord3(params.clientCapabilities) ? params.clientCapabilities : null;
3992
- const clientMeta = clientCapabilities !== null && isRecord3(clientCapabilities._meta) ? clientCapabilities._meta : null;
3993
- const eventRequest = clientMeta !== null && isRecord3(clientMeta["clio-coder/events"]) ? clientMeta["clio-coder/events"] : null;
3697
+ const clientCapabilities = isRecord2(params) && isRecord2(params.clientCapabilities) ? params.clientCapabilities : null;
3698
+ const clientMeta = clientCapabilities !== null && isRecord2(clientCapabilities._meta) ? clientCapabilities._meta : null;
3699
+ const eventRequest = clientMeta !== null && isRecord2(clientMeta["clio-coder/events"]) ? clientMeta["clio-coder/events"] : null;
3994
3700
  const requestedEventKinds = eventRequest !== null ? eventRequest.kinds : null;
3995
3701
  enabledEventKinds.clear();
3996
3702
  if (eventRequest !== null && eventRequest.version === 1 && Array.isArray(requestedEventKinds) && requestedEventKinds.length <= ACP_MAX_REQUESTED_EVENT_KINDS && requestedEventKinds.every((kind) => typeof kind === "string" && utf8Bytes(kind) <= 64 && !hasControlCharacters(kind))) {
@@ -4062,7 +3768,7 @@ async function serveClioAcpAgent(options) {
4062
3768
  if (sessionCreated) {
4063
3769
  throw new AcpRequestError(-32e3, "this server hosts one session per process", { code: "session_limit" });
4064
3770
  }
4065
- const sessionCwd = canonicalSessionCwd(isRecord3(params) ? params.cwd : void 0);
3771
+ const sessionCwd = canonicalSessionCwd(isRecord2(params) ? params.cwd : void 0);
4066
3772
  const route = routingSnapshot();
4067
3773
  const createInput = { cwd: sessionCwd };
4068
3774
  if (route.target !== null) createInput.target = route.target;
@@ -4072,6 +3778,7 @@ async function serveClioAcpAgent(options) {
4072
3778
  if (safeStoredIdentifier(id, ACP_MAX_SESSION_ID_BYTES) === null) {
4073
3779
  throw new AcpRequestError(-32e3, "session creation failed", { code: "internal_error" });
4074
3780
  }
3781
+ options.chat.resetForSession?.(null);
4075
3782
  const autonomy = options.autonomy?.() ?? DEFAULT_AUTONOMY_LEVEL;
4076
3783
  const boundTarget = safeConfiguredIdentifier(meta?.target ?? route.target, ACP_MAX_TARGET_ID_BYTES);
4077
3784
  const boundModel = safeConfiguredIdentifier(meta?.model ?? route.model, ACP_MAX_MODEL_ID_BYTES);
@@ -4261,7 +3968,7 @@ async function serveClioAcpAgent(options) {
4261
3968
  options.transport.onRequest("clio-coder/settings/patch_safe", (params) => {
4262
3969
  requireInitialized();
4263
3970
  const request = assertParamKeys(params, /* @__PURE__ */ new Set(["patch"]));
4264
- if (!isRecord3(request.patch)) {
3971
+ if (!isRecord2(request.patch)) {
4265
3972
  throw new AcpRequestError(-32602, "patch must be an object", { code: "invalid_params" });
4266
3973
  }
4267
3974
  if (activePromptState !== null) {
@@ -4395,7 +4102,7 @@ async function serveClioAcpAgent(options) {
4395
4102
  options.transport.onRequest("session/cancel", cancel);
4396
4103
  options.transport.onNotification("session/cancel", (params) => {
4397
4104
  if (!initialized) return;
4398
- const id = isRecord3(params) && typeof params.sessionId === "string" ? params.sessionId : null;
4105
+ const id = isRecord2(params) && typeof params.sessionId === "string" ? params.sessionId : null;
4399
4106
  const session = id === null ? void 0 : sessions.get(id);
4400
4107
  if (session) cancelSession(session, "prompt cancelled");
4401
4108
  });
@@ -4412,6 +4119,7 @@ async function serveClioAcpAgent(options) {
4412
4119
  if (options.session?.current()?.id === session.id) await options.session.close();
4413
4120
  sessions.delete(session.id);
4414
4121
  if (boundSessionId === session.id) boundSessionId = null;
4122
+ sessionCreated = false;
4415
4123
  closedSessionIds.add(session.id);
4416
4124
  return {};
4417
4125
  });
@@ -4696,7 +4404,7 @@ var HANDOFF_RESPONSE_SCHEMA = {
4696
4404
  openQuestions: { type: "array", items: { type: "string" } }
4697
4405
  }
4698
4406
  };
4699
- function isRecord4(value) {
4407
+ function isRecord3(value) {
4700
4408
  return typeof value === "object" && value !== null && !Array.isArray(value);
4701
4409
  }
4702
4410
  function boundHandoffString(value) {
@@ -4719,7 +4427,7 @@ function stringsFrom(value) {
4719
4427
  }
4720
4428
  function recordsFrom(value) {
4721
4429
  if (!Array.isArray(value)) return [];
4722
- return value.filter(isRecord4);
4430
+ return value.filter(isRecord3);
4723
4431
  }
4724
4432
  function requiredField(record2, key) {
4725
4433
  const value = record2[key];
@@ -4761,7 +4469,7 @@ function parseHandoffExtraction(text) {
4761
4469
  } catch (error) {
4762
4470
  return { ok: false, reason: `the extraction round returned invalid JSON: ${error.message}` };
4763
4471
  }
4764
- if (!isRecord4(parsed)) return { ok: false, reason: "the extraction round returned a non-object" };
4472
+ if (!isRecord3(parsed)) return { ok: false, reason: "the extraction round returned a non-object" };
4765
4473
  const truncations = [];
4766
4474
  let stringsCut = 0;
4767
4475
  const bound = (value) => {
@@ -4836,7 +4544,7 @@ function stringField(record2, ...keys) {
4836
4544
  }
4837
4545
  function pathFromCall(toolName, args, cwd, into) {
4838
4546
  if (!READ_LEDGER_TOOLS.has(toolName)) return;
4839
- const record2 = isRecord4(args) ? args : null;
4547
+ const record2 = isRecord3(args) ? args : null;
4840
4548
  const named = stringField(record2, "path", "file_path", "filePath");
4841
4549
  const raw = named ?? (toolName === "grep" || toolName === "find" || toolName === "ls" ? "." : null);
4842
4550
  if (raw === null) return;
@@ -4854,7 +4562,7 @@ function buildHandoffReadLedger(entries, options = {}) {
4854
4562
  continue;
4855
4563
  }
4856
4564
  if (entry.kind !== "message") continue;
4857
- const payload = isRecord4(entry.payload) ? entry.payload : null;
4565
+ const payload = isRecord3(entry.payload) ? entry.payload : null;
4858
4566
  if (payload === null) continue;
4859
4567
  if (entry.role === "tool_call") {
4860
4568
  const name = stringField(payload, "name", "toolName", "tool");
@@ -4863,7 +4571,7 @@ function buildHandoffReadLedger(entries, options = {}) {
4863
4571
  }
4864
4572
  if (entry.role !== "assistant" || !Array.isArray(payload.content)) continue;
4865
4573
  for (const block of payload.content) {
4866
- if (!isRecord4(block) || block.type !== "toolCall") continue;
4574
+ if (!isRecord3(block) || block.type !== "toolCall") continue;
4867
4575
  const name = stringField(block, "name", "toolName");
4868
4576
  if (name !== null) pathFromCall(name, block.arguments ?? block.args ?? block.input, cwd, paths);
4869
4577
  }
@@ -4891,7 +4599,7 @@ function mergeHandoffDecisions(extracted, board) {
4891
4599
  if (decision.status !== "active") continue;
4892
4600
  const name = decision.label ?? decision.key;
4893
4601
  const summary = boundHandoffString(`${name}: ${decision.value}`).text;
4894
- const rationale = decision.source_question ?? decision.correction;
4602
+ const rationale = decisionRationale(decision);
4895
4603
  settled.push({
4896
4604
  summary,
4897
4605
  ...rationale ? { rationale: boundHandoffString(rationale).text } : {},
@@ -4979,10 +4687,10 @@ function handoffSeedContextText(data) {
4979
4687
  ].join("\n");
4980
4688
  }
4981
4689
  function isHandoffSeedData(value) {
4982
- return isRecord4(value) && typeof value.fromSessionId === "string" && typeof value.goal === "string" && typeof value.document === "string";
4690
+ return isRecord3(value) && typeof value.fromSessionId === "string" && typeof value.goal === "string" && typeof value.document === "string";
4983
4691
  }
4984
4692
  function isHandoffNoteData(value) {
4985
- return isRecord4(value) && typeof value.toSessionId === "string" && typeof value.goal === "string";
4693
+ return isRecord3(value) && typeof value.toSessionId === "string" && typeof value.goal === "string";
4986
4694
  }
4987
4695
 
4988
4696
  // src/interactive/side-question.ts
@@ -5135,7 +4843,7 @@ init_esm_shims();
5135
4843
 
5136
4844
  // src/domains/session/compaction/mask-observations.ts
5137
4845
  init_esm_shims();
5138
- function isRecord5(value) {
4846
+ function isRecord4(value) {
5139
4847
  return !!value && typeof value === "object" && !Array.isArray(value);
5140
4848
  }
5141
4849
  function cloneEntry(entry) {
@@ -5145,7 +4853,7 @@ function textFromContent(content) {
5145
4853
  if (!Array.isArray(content)) return "";
5146
4854
  const parts = [];
5147
4855
  for (const block of content) {
5148
- if (!isRecord5(block)) continue;
4856
+ if (!isRecord4(block)) continue;
5149
4857
  if (block.type === "text" && typeof block.text === "string") parts.push(block.text);
5150
4858
  }
5151
4859
  return parts.join("");
@@ -5164,7 +4872,7 @@ function stringifyPreview2(value, limit = 1e4) {
5164
4872
  }
5165
4873
  function resultText(result) {
5166
4874
  if (typeof result === "string") return result;
5167
- if (!isRecord5(result)) return stringifyPreview2(result);
4875
+ if (!isRecord4(result)) return stringifyPreview2(result);
5168
4876
  const contentText2 = textFromContent(result.content);
5169
4877
  if (contentText2.length > 0) return contentText2;
5170
4878
  if (typeof result.text === "string") return result.text;
@@ -5173,7 +4881,7 @@ function resultText(result) {
5173
4881
  return stringifyPreview2(result);
5174
4882
  }
5175
4883
  function extractToolResultPayload(payload) {
5176
- const obj = isRecord5(payload) ? payload : { result: payload };
4884
+ const obj = isRecord4(payload) ? payload : { result: payload };
5177
4885
  const result = obj.result ?? obj.output ?? obj.out ?? obj.content ?? payload;
5178
4886
  const toolName = typeof obj.toolName === "string" && obj.toolName || typeof obj.name === "string" && obj.name || typeof obj.tool === "string" && obj.tool || "tool";
5179
4887
  return { obj, result, toolName };
@@ -5188,7 +4896,7 @@ function observationMarker(toolName, text) {
5188
4896
  return `[Observation masked: ${toolName} output was ${lineCount(text)} lines, ${text.length} chars - contents masked to save context. Re-run the tool for current content.]${suffix}`;
5189
4897
  }
5190
4898
  function maskedToolResult(original, marker) {
5191
- const details = isRecord5(original) && isRecord5(original.details) ? { ...original.details } : {};
4899
+ const details = isRecord4(original) && isRecord4(original.details) ? { ...original.details } : {};
5192
4900
  return {
5193
4901
  content: [{ type: "text", text: marker }],
5194
4902
  details: {
@@ -5198,12 +4906,12 @@ function maskedToolResult(original, marker) {
5198
4906
  };
5199
4907
  }
5200
4908
  function alreadyCompacted(payload) {
5201
- if (!isRecord5(payload)) return false;
5202
- if (isRecord5(payload.contextCompaction)) return true;
4909
+ if (!isRecord4(payload)) return false;
4910
+ if (isRecord4(payload.contextCompaction)) return true;
5203
4911
  const summary = payload.resultSummary;
5204
- if (isRecord5(summary) && isRecord5(summary.contextCompaction)) return true;
4912
+ if (isRecord4(summary) && isRecord4(summary.contextCompaction)) return true;
5205
4913
  const result = payload.result ?? payload.output ?? payload.out;
5206
- if (isRecord5(result) && isRecord5(result.details) && isRecord5(result.details.contextCompaction)) return true;
4914
+ if (isRecord4(result) && isRecord4(result.details) && isRecord4(result.details.contextCompaction)) return true;
5207
4915
  return false;
5208
4916
  }
5209
4917
  function maskObservation(entry) {
@@ -5218,7 +4926,7 @@ function maskObservation(entry) {
5218
4926
  out: void 0,
5219
4927
  content: void 0,
5220
4928
  resultSummary: {
5221
- ...isRecord5(obj.resultSummary) ? obj.resultSummary : {},
4929
+ ...isRecord4(obj.resultSummary) ? obj.resultSummary : {},
5222
4930
  bytes: 0,
5223
4931
  truncated: true,
5224
4932
  contextCompaction: {
@@ -5232,14 +4940,14 @@ function maskObservation(entry) {
5232
4940
  return next;
5233
4941
  }
5234
4942
  function maskThinking(entry) {
5235
- const obj = isRecord5(entry.payload) ? entry.payload : null;
4943
+ const obj = isRecord4(entry.payload) ? entry.payload : null;
5236
4944
  if (!obj) return null;
5237
4945
  let blocks = 0;
5238
4946
  let chars = 0;
5239
4947
  let content;
5240
4948
  if (Array.isArray(obj.content)) {
5241
4949
  content = obj.content.filter((block) => {
5242
- if (!isRecord5(block) || block.type !== "thinking") return true;
4950
+ if (!isRecord4(block) || block.type !== "thinking") return true;
5243
4951
  blocks += 1;
5244
4952
  if (typeof block.thinking === "string") chars += block.thinking.length;
5245
4953
  return false;
@@ -5256,7 +4964,7 @@ function maskThinking(entry) {
5256
4964
  ...content !== void 0 ? { content } : {},
5257
4965
  thinking: void 0,
5258
4966
  contextCompaction: {
5259
- ...isRecord5(obj.contextCompaction) ? obj.contextCompaction : {},
4967
+ ...isRecord4(obj.contextCompaction) ? obj.contextCompaction : {},
5260
4968
  stage: "mask_thinking",
5261
4969
  maskedThinkingChars: chars,
5262
4970
  at: (/* @__PURE__ */ new Date()).toISOString()
@@ -5281,7 +4989,7 @@ function recentTurnCutoff(entries, excludeLastTurns) {
5281
4989
  }
5282
4990
  function invalidateUsage(entry) {
5283
4991
  if (entry.kind !== "message" || entry.role !== "assistant") return entry;
5284
- const obj = isRecord5(entry.payload) ? entry.payload : null;
4992
+ const obj = isRecord4(entry.payload) ? entry.payload : null;
5285
4993
  if (!obj || obj.contextUsageInvalidated === true) return entry;
5286
4994
  const next = cloneEntry(entry);
5287
4995
  next.payload = {
@@ -5329,8 +5037,8 @@ function maskStaleObservations(entries, excludeLastTurns) {
5329
5037
 
5330
5038
  // src/domains/session/prompt-manifest.ts
5331
5039
  init_esm_shims();
5332
- import { appendFileSync, existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
5333
- import { dirname, join as join4 } from "node:path";
5040
+ import { appendFileSync, existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
5041
+ import { dirname, join as join3 } from "node:path";
5334
5042
  var PROMPT_MANIFEST_VERSION = 2;
5335
5043
  var SHA256_HEX = /^[a-f0-9]{64}$/;
5336
5044
  function isCanonicalUtcTimestamp(value) {
@@ -5338,7 +5046,7 @@ function isCanonicalUtcTimestamp(value) {
5338
5046
  const timestamp = Date.parse(value);
5339
5047
  return Number.isFinite(timestamp) && new Date(timestamp).toISOString() === value;
5340
5048
  }
5341
- function isRecord6(value) {
5049
+ function isRecord5(value) {
5342
5050
  return value !== null && typeof value === "object" && !Array.isArray(value);
5343
5051
  }
5344
5052
  function isNonNegativeInteger(value) {
@@ -5348,20 +5056,20 @@ function isSha256(value) {
5348
5056
  return typeof value === "string" && SHA256_HEX.test(value);
5349
5057
  }
5350
5058
  function isPromptManifestSection(value) {
5351
- return isRecord6(value) && typeof value.id === "string" && isNonNegativeInteger(value.tokenEstimate);
5059
+ return isRecord5(value) && typeof value.id === "string" && isNonNegativeInteger(value.tokenEstimate);
5352
5060
  }
5353
5061
  function isPromptManifestFragment(value) {
5354
- return isRecord6(value) && typeof value.id === "string" && typeof value.relPath === "string" && isSha256(value.contentHash) && typeof value.dynamic === "boolean";
5062
+ return isRecord5(value) && typeof value.id === "string" && typeof value.relPath === "string" && isSha256(value.contentHash) && typeof value.dynamic === "boolean";
5355
5063
  }
5356
5064
  function isProjectPreloadClass(value) {
5357
- if (!isRecord6(value)) return false;
5065
+ if (!isRecord5(value)) return false;
5358
5066
  return (value.mode === "full" || value.mode === "synopsis" || value.mode === "none") && isNonNegativeInteger(value.chars) && isNonNegativeInteger(value.lines) && (value.reason === null || value.reason === "size" || value.reason === "lines" || value.reason === "no-clio-md") && typeof value.nearLimit === "boolean" && typeof value.label === "string";
5359
5067
  }
5360
5068
  function isOptional(value, guard) {
5361
5069
  return value === void 0 || guard(value);
5362
5070
  }
5363
5071
  function isSessionPromptCompileRecord(value) {
5364
- if (!isRecord6(value)) return false;
5072
+ if (!isRecord5(value)) return false;
5365
5073
  return isOptional(value.version, isNonNegativeInteger) && isOptional(
5366
5074
  value.contextWindow,
5367
5075
  (candidate) => candidate === null ? true : isNonNegativeInteger(candidate)
@@ -5376,10 +5084,10 @@ function getPromptManifestFilePath(meta, stateDir) {
5376
5084
  cwdHash: meta.cwdHash || cwdHash(meta.cwd || process.cwd())
5377
5085
  };
5378
5086
  if (stateDir !== void 0) {
5379
- return join4(stateDir, "sessions", safeMeta.cwdHash, safeMeta.id, "prompt-manifest.jsonl");
5087
+ return join3(stateDir, "sessions", safeMeta.cwdHash, safeMeta.id, "prompt-manifest.jsonl");
5380
5088
  }
5381
5089
  const paths = sessionPaths(safeMeta);
5382
- return join4(dirname(paths.current), "prompt-manifest.jsonl");
5090
+ return join3(dirname(paths.current), "prompt-manifest.jsonl");
5383
5091
  }
5384
5092
  function appendPromptCompileRecord(meta, record2) {
5385
5093
  try {
@@ -5392,10 +5100,10 @@ function appendPromptCompileRecord(meta, record2) {
5392
5100
  function readPromptCompileManifest(meta, stateDir) {
5393
5101
  const file = getPromptManifestFilePath(meta, stateDir);
5394
5102
  try {
5395
- if (!existsSync4(file)) return { records: [], errors: [] };
5103
+ if (!existsSync3(file)) return { records: [], errors: [] };
5396
5104
  const records = [];
5397
5105
  const errors = [];
5398
- for (const [index, line] of readFileSync4(file, "utf8").split("\n").entries()) {
5106
+ for (const [index, line] of readFileSync3(file, "utf8").split("\n").entries()) {
5399
5107
  if (line.trim().length === 0) continue;
5400
5108
  try {
5401
5109
  const parsed = JSON.parse(line);
@@ -5425,7 +5133,7 @@ init_esm_shims();
5425
5133
 
5426
5134
  // src/interactive/chat-renderer.ts
5427
5135
  init_esm_shims();
5428
- import { existsSync as existsSync6 } from "node:fs";
5136
+ import { existsSync as existsSync5 } from "node:fs";
5429
5137
 
5430
5138
  // src/engine/messages.ts
5431
5139
  init_esm_shims();
@@ -5550,7 +5258,7 @@ init_esm_shims();
5550
5258
  // src/interactive/mutation-preview.ts
5551
5259
  init_esm_shims();
5552
5260
  import { createHash as createHash2 } from "node:crypto";
5553
- import { readFileSync as readFileSync5 } from "node:fs";
5261
+ import { readFileSync as readFileSync4 } from "node:fs";
5554
5262
  var MUTATION_PREVIEW_VISIBLE_ROWS = 16;
5555
5263
  var MUTATION_PREVIEW_MAX_CHARS = 262144;
5556
5264
  function canonicalJson(value) {
@@ -5665,7 +5373,7 @@ function editPreview(facts, path2, edits, read) {
5665
5373
  }
5666
5374
  }
5667
5375
  function createMutationInspector(tool, args, facts, options = {}) {
5668
- const read = options.readFile ?? ((path2) => readFileSync5(path2, "utf8"));
5376
+ const read = options.readFile ?? ((path2) => readFileSync4(path2, "utf8"));
5669
5377
  return () => {
5670
5378
  const current = mutationFacts(tool, args);
5671
5379
  if (current === null || current.digest !== facts.digest) {
@@ -7214,19 +6922,19 @@ function toggledFold(effective) {
7214
6922
 
7215
6923
  // src/interactive/worker-receipts.ts
7216
6924
  init_esm_shims();
7217
- import { existsSync as existsSync5, readFileSync as readFileSync7 } from "node:fs";
7218
- import { join as join6 } from "node:path";
6925
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
6926
+ import { join as join5 } from "node:path";
7219
6927
 
7220
6928
  // src/interactive/view/artifacts.ts
7221
6929
  init_esm_shims();
7222
- import { createReadStream, readFileSync as readFileSync6, statSync } from "node:fs";
6930
+ import { createReadStream, readFileSync as readFileSync5, statSync } from "node:fs";
7223
6931
  import { readFile, realpath, stat } from "node:fs/promises";
7224
- import { basename, isAbsolute as isAbsolute4, join as join5, relative as relative4, resolve as resolve3, sep } from "node:path";
6932
+ import { basename, isAbsolute as isAbsolute4, join as join4, relative as relative4, resolve as resolve3, sep } from "node:path";
7225
6933
 
7226
6934
  // src/domains/session/session-artifacts.ts
7227
6935
  init_esm_shims();
7228
6936
  import { isAbsolute as isAbsolute3, relative as relative2, resolve as resolve2 } from "node:path";
7229
- function isRecord7(value) {
6937
+ function isRecord6(value) {
7230
6938
  return !!value && typeof value === "object" && !Array.isArray(value);
7231
6939
  }
7232
6940
  function isSessionArtifactTool(value) {
@@ -7248,15 +6956,15 @@ function foldSessionArtifacts(entries, options = {}) {
7248
6956
  const writeCounts = /* @__PURE__ */ new Map();
7249
6957
  let writeIndex = 0;
7250
6958
  for (const raw of entries) {
7251
- if (!isRecord7(raw) || raw.kind !== "message" || raw.role !== "tool_result") continue;
6959
+ if (!isRecord6(raw) || raw.kind !== "message" || raw.role !== "tool_result") continue;
7252
6960
  if (typeof raw.turnId !== "string" || typeof raw.timestamp !== "string") continue;
7253
6961
  const payload = raw.payload;
7254
- if (!isRecord7(payload) || !isSessionArtifactTool(payload.toolName)) continue;
6962
+ if (!isRecord6(payload) || !isSessionArtifactTool(payload.toolName)) continue;
7255
6963
  if (payload.isError === true || payload.outcome === "error" || payload.outcome === "blocked" || payload.outcome === "aborted" || payload.outcome === "orphaned") {
7256
6964
  continue;
7257
6965
  }
7258
6966
  const result = payload.result;
7259
- if (!isRecord7(result) || !isRecord7(result.details) || !Array.isArray(result.details.paths)) continue;
6967
+ if (!isRecord6(result) || !isRecord6(result.details) || !Array.isArray(result.details.paths)) continue;
7260
6968
  const artifactKind = payload.toolName === "artifact" && isSessionArtifactKind(result.details.kind) ? result.details.kind : void 0;
7261
6969
  const pathsSeenInResult = /* @__PURE__ */ new Set();
7262
6970
  for (const recordedPath of result.details.paths) {
@@ -7420,7 +7128,6 @@ function formatWorkerContextMeter(usedTokens, contextWindow, theme6 = clioTheme(
7420
7128
 
7421
7129
  // src/interactive/dispatch-board.ts
7422
7130
  init_esm_shims();
7423
- import { performance as performance3 } from "node:perf_hooks";
7424
7131
 
7425
7132
  // src/interactive/council-grid.ts
7426
7133
  init_esm_shims();
@@ -7719,7 +7426,6 @@ function isDispatchBoardRowSteerable(row2) {
7719
7426
  function isDispatchBoardRowCancellable(row2) {
7720
7427
  return row2.status === "running" || row2.status === "stale" || row2.status === "enqueued" || row2.status === "retrying";
7721
7428
  }
7722
- var TASK_SUMMARY_MAX_WIDTH = 240;
7723
7429
  var WORKER_PROGRESS_CARD_ROWS = 6;
7724
7430
  var TASK_ISLAND_WIDTH = 44;
7725
7431
  var STATUS_ORDER = {
@@ -7733,7 +7439,6 @@ var STATUS_ORDER = {
7733
7439
  aborted: 7,
7734
7440
  completed: 8
7735
7441
  };
7736
- var MAX_DISPATCH_BOARD_ROWS = 50;
7737
7442
  function agentDisplayLabel(row2) {
7738
7443
  return row2.agentId;
7739
7444
  }
@@ -7843,12 +7548,6 @@ function evidenceCardLine(theme6, evidence, contentWidth) {
7843
7548
  units.push(theme6.fg("dim", evidence.viewFilter));
7844
7549
  return cardUnitsLine(theme6, "proof", units, contentWidth);
7845
7550
  }
7846
- function sanitizeDispatchTaskSummary(value) {
7847
- if (typeof value !== "string") return void 0;
7848
- const sanitized = sanitizeCallTargetText(value);
7849
- if (sanitized.length === 0) return void 0;
7850
- return sanitizeCallTargetText(truncateToWidth(sanitized, TASK_SUMMARY_MAX_WIDTH, "\u2026", false));
7851
- }
7852
7551
  function retryCountdown(retry, now = Date.now()) {
7853
7552
  const remainingMs = Math.max(0, retry.dueAtMs - now);
7854
7553
  return remainingMs === 0 ? "now" : `in ${formatCompactMs(remainingMs)}`;
@@ -8281,68 +7980,6 @@ function formatTaskIslandLines(rows, maxRows = 4) {
8281
7980
  }
8282
7981
  return frame(clioTheme(), "Fleet runs", body, TASK_ISLAND_WIDTH + 4);
8283
7982
  }
8284
- function parseRunId(value) {
8285
- return typeof value === "string" && value.length > 0 ? value : null;
8286
- }
8287
- function parseText(value, fallback) {
8288
- return typeof value === "string" && value.length > 0 ? value : fallback;
8289
- }
8290
- function parseRuntimeKind(value) {
8291
- if (value === "sdk" || value === "subprocess" || value === "acp-delegation") return value;
8292
- return "http";
8293
- }
8294
- function parseAgentAudience(value, fallback) {
8295
- if (value === "base" || value === "shadow" || value === "custom" || value === "internal") return value;
8296
- return fallback;
8297
- }
8298
- function parseRequestOrigin(value, fallback) {
8299
- if (value === "user" || value === "agent" || value === "internal") return value;
8300
- return fallback;
8301
- }
8302
- function parseFiniteNumber(value, fallback) {
8303
- return typeof value === "number" && Number.isFinite(value) ? value : fallback;
8304
- }
8305
- function parseNonEmptyString(value) {
8306
- return typeof value === "string" && value.length > 0 ? value : void 0;
8307
- }
8308
- function parseTaskSummary(raw, fallback) {
8309
- return sanitizeDispatchTaskSummary(raw.task) ?? sanitizeDispatchTaskSummary(raw.taskSummary) ?? fallback;
8310
- }
8311
- function parsePositiveInt(value) {
8312
- return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
8313
- }
8314
- function parseGateBadge(value) {
8315
- if (typeof value !== "object" || value === null) return void 0;
8316
- const record2 = value;
8317
- if (typeof record2.role !== "string" || record2.role.length === 0) return void 0;
8318
- const cycle = parsePositiveInt(record2.cycle) ?? 1;
8319
- return { role: record2.role, cycle };
8320
- }
8321
- function parseEndpointCapacity(value) {
8322
- if (typeof value !== "object" || value === null) return void 0;
8323
- const record2 = value;
8324
- const key = parseNonEmptyString(record2.key);
8325
- const label = parseNonEmptyString(record2.label);
8326
- const limit = parsePositiveInt(record2.limit);
8327
- return key === void 0 || label === void 0 || limit === void 0 ? void 0 : { key, label, limit };
8328
- }
8329
- function parseCouncilBadge(value) {
8330
- if (typeof value !== "object" || value === null) return void 0;
8331
- const record2 = value;
8332
- const group = parseNonEmptyString(record2.group);
8333
- const label = parseNonEmptyString(record2.label);
8334
- const round = parsePositiveInt(record2.round);
8335
- if (group === void 0 || label === void 0 || round === void 0) return void 0;
8336
- return {
8337
- group,
8338
- label,
8339
- ...typeof record2.color === "string" && record2.color.length > 0 ? { color: record2.color } : {},
8340
- round
8341
- };
8342
- }
8343
- function parseFiniteNumberOrZero(value) {
8344
- return typeof value === "number" && Number.isFinite(value) ? value : 0;
8345
- }
8346
7983
  function parseOptionalDetail(value) {
8347
7984
  if (typeof value !== "string") return null;
8348
7985
  const detail = value.replace(/\s+/g, " ").trim();
@@ -8376,113 +8013,33 @@ function terminalDetail(row2) {
8376
8013
  if (row2.status !== "failed" && row2.status !== "dead" && row2.status !== "aborted") return null;
8377
8014
  return parseOptionalDetail(row2.outcomeDetail);
8378
8015
  }
8379
- function resolveAgentEndStatus(rawMessages) {
8380
- if (!Array.isArray(rawMessages)) return null;
8381
- for (let index = rawMessages.length - 1; index >= 0; index -= 1) {
8382
- const message = rawMessages[index] ?? {};
8383
- if (message.role !== "assistant") continue;
8384
- if (message.stopReason === "stop") return "completed";
8385
- if (message.stopReason === "error") return "failed";
8386
- if (message.stopReason === "aborted") return "aborted";
8387
- return null;
8388
- }
8389
- return null;
8390
- }
8391
- function resolveFailureDetail(payload, fallback) {
8392
- const detail = parseOptionalDetail(payload.outcomeDetail);
8393
- if (detail !== null) return detail;
8394
- if (payload.reason === "timed_out") return "turn timeout exceeded";
8395
- return fallback ?? null;
8396
- }
8397
- function resolveHeartbeatStatus(status) {
8398
- if (status === "alive") return "running";
8399
- if (status === "stale" || status === "dead") return status;
8400
- return null;
8401
- }
8402
8016
  function isTerminalStatus(status) {
8403
8017
  return status === "completed" || status === "failed" || status === "aborted" || status === "dead";
8404
8018
  }
8405
- function parseRetrySnapshot(value) {
8406
- const attempt = parsePositiveInt(value.attempt);
8407
- const dueAtMs = Date.parse(value.dueAt);
8408
- if (attempt === void 0 || !Number.isFinite(dueAtMs)) return null;
8409
- return {
8410
- attempt,
8411
- dueAtMs,
8412
- reason: sanitizeCallTargetText(value.reason)
8413
- };
8414
- }
8415
- function readRetrySnapshot(snapshot) {
8416
- const retrying = /* @__PURE__ */ new Map();
8417
- try {
8418
- for (const value of snapshot.retrying) {
8419
- const runId = parseRunId(value.runId);
8420
- const agentId = parseNonEmptyString(value.agentId);
8421
- const retry = parseRetrySnapshot(value);
8422
- const taskSummary = sanitizeDispatchTaskSummary(value.task);
8423
- if (runId && agentId && retry) {
8424
- retrying.set(runId, {
8425
- agentId,
8426
- ...taskSummary !== void 0 ? { taskSummary } : {},
8427
- retry
8428
- });
8429
- }
8430
- }
8431
- } catch {
8432
- }
8433
- return retrying;
8434
- }
8435
- function readRunningSnapshot(snapshot) {
8436
- const running = /* @__PURE__ */ new Map();
8437
- try {
8438
- for (const value of snapshot.running) {
8439
- const runId = parseRunId(value.runId);
8440
- if (!runId) continue;
8441
- const budget = cloneRunToolBudgetEnvelope(value.budget);
8442
- running.set(runId, {
8443
- inputTokens: parseFiniteNumberOrZero(value.tokens.input),
8444
- outputTokens: parseFiniteNumberOrZero(value.tokens.output),
8445
- tokenCount: parseFiniteNumberOrZero(value.tokens.total),
8446
- costUsd: parseFiniteNumberOrZero(value.costUsd),
8447
- costProvenance: value.costProvenance ?? "unknown",
8448
- outcomePhase: value.outcomePhase,
8449
- ...budget !== void 0 ? { budget } : {}
8450
- });
8451
- }
8452
- } catch {
8453
- }
8454
- return running;
8455
- }
8456
- function resolveElapsedMs(entry, now) {
8457
- const startedAtMs = entry.startedAtMs ?? entry.enqueuedAtMs;
8458
- if (entry.durationMs !== null) return entry.durationMs;
8459
- const endMs = entry.finishedAtMs ?? now;
8460
- return Math.max(0, rawDurationMs(startedAtMs, endMs));
8461
- }
8462
8019
  function toRow(entry, now) {
8463
8020
  const retry = entry.retry;
8464
- const progress = entry.progress.snapshot();
8021
+ const progress = entry.progress;
8465
8022
  return {
8466
- progress,
8023
+ ...progress !== void 0 ? { progress } : {},
8467
8024
  runId: entry.runId,
8468
8025
  agentId: entry.agentId,
8469
8026
  ...entry.agentAudience !== void 0 ? { agentAudience: entry.agentAudience } : {},
8470
8027
  ...entry.requestOrigin !== void 0 ? { requestOrigin: entry.requestOrigin } : {},
8471
- runtimeKind: entry.runtimeKind,
8472
- runtimeId: entry.runtimeId,
8473
- targetId: entry.targetId,
8474
- wireModelId: entry.wireModelId,
8028
+ runtimeKind: entry.runtimeKind ?? "http",
8029
+ runtimeId: entry.runtimeId ?? "-",
8030
+ targetId: entry.targetId ?? "-",
8031
+ wireModelId: entry.modelId ?? "-",
8475
8032
  ...entry.endpoint !== void 0 ? { endpoint: { ...entry.endpoint } } : {},
8476
8033
  ...entry.taskSummary !== void 0 ? { taskSummary: entry.taskSummary } : {},
8477
8034
  ...entry.budget !== void 0 ? { budget: entry.budget } : {},
8478
- status: retry ? "retrying" : entry.status,
8479
- elapsedMs: resolveElapsedMs(entry, now),
8480
- tokenCount: entry.tokenCount,
8035
+ status: entry.status,
8036
+ elapsedMs: entry.durationMs ?? Math.max(0, (entry.finishedAtMs ?? now) - entry.startedAtMs),
8037
+ tokenCount: entry.tokens.total,
8481
8038
  costUsd: entry.costUsd,
8482
8039
  ...entry.costProvenance !== void 0 ? { costProvenance: entry.costProvenance } : {},
8483
- inputTokens: entry.inputTokens,
8484
- outputTokens: entry.outputTokens,
8485
- ttftMs: entry.ttftMs,
8040
+ inputTokens: entry.tokens.input,
8041
+ outputTokens: entry.tokens.output,
8042
+ ttftMs: entry.ttftMs ?? null,
8486
8043
  ...entry.outcomeDetail !== void 0 ? { outcomeDetail: entry.outcomeDetail } : {},
8487
8044
  ...entry.node !== void 0 ? { node: entry.node } : {},
8488
8045
  ...entry.gate !== void 0 ? { gate: { ...entry.gate } } : {},
@@ -8492,352 +8049,40 @@ function toRow(entry, now) {
8492
8049
  ...entry.rerouteCount !== void 0 ? { rerouteCount: entry.rerouteCount } : {},
8493
8050
  ...entry.failoverHops !== void 0 ? { failoverHops: entry.failoverHops } : {},
8494
8051
  ...entry.contextWindow !== void 0 ? { contextWindow: entry.contextWindow } : {},
8495
- lastContextTokens: entry.lastContextTokens,
8052
+ lastContextTokens: entry.lastContextTokens ?? 0,
8496
8053
  ...entry.receiptId !== void 0 ? { receiptId: entry.receiptId } : {},
8497
8054
  ...entry.phase !== void 0 ? { phase: { ...entry.phase } } : {},
8498
8055
  // Both tool fields are views of the one projection, so the compact card and
8499
8056
  // the expanded detail can never disagree about what is running.
8500
- currentTool: retry ? null : progress.currentAction?.tool ?? null,
8501
- recentTools: progress.recentActions.map((action) => action.tool),
8057
+ currentTool: retry ? null : progress?.currentAction?.tool ?? null,
8058
+ recentTools: progress?.recentActions.map((action) => action.tool) ?? [],
8502
8059
  ...retry ? { retry: { ...retry } } : {},
8503
8060
  ...entry.steerAcknowledgement ? { steerAcknowledgement: { ...entry.steerAcknowledgement } } : {},
8504
8061
  ...entry.writeRecordDowngrade ? { writeRecordDowngrade: { ...entry.writeRecordDowngrade } } : {}
8505
8062
  };
8506
8063
  }
8507
- function sortEntries(a, b) {
8508
- const aStatus = a.retry ? "retrying" : a.status;
8509
- const bStatus = b.retry ? "retrying" : b.status;
8510
- const rank = STATUS_ORDER[aStatus] - STATUS_ORDER[bStatus];
8511
- if (rank !== 0) return rank;
8512
- const aTime = a.finishedAtMs ?? a.startedAtMs ?? a.enqueuedAtMs;
8513
- const bTime = b.finishedAtMs ?? b.startedAtMs ?? b.enqueuedAtMs;
8514
- if (aTime !== bTime) return bTime - aTime;
8515
- return a.sequence - b.sequence;
8516
- }
8517
- function pruneEntries(entries, onEvict) {
8518
- if (entries.size <= MAX_DISPATCH_BOARD_ROWS) return;
8519
- const terminalEntries = [...entries.values()].filter((entry) => !entry.retry && isTerminalStatus(entry.status)).sort((a, b) => a.sequence - b.sequence);
8520
- const evictionQueue = terminalEntries.length > 0 ? terminalEntries : [...entries.values()].sort((a, b) => a.sequence - b.sequence);
8521
- for (const entry of evictionQueue) {
8522
- if (entries.size <= MAX_DISPATCH_BOARD_ROWS) break;
8523
- entries.delete(entry.runId);
8524
- onEvict?.(entry.runId);
8525
- }
8526
- }
8527
- function createDispatchBoardStore(bus, snapshot, readReceipt) {
8528
- const entries = /* @__PURE__ */ new Map();
8529
- const fleetPhases = /* @__PURE__ */ new Map();
8530
- let nextSequence = 0;
8531
- let reconciledAtMs = Date.now();
8532
- const settleFromReceipt = (entry) => {
8533
- const facts = readReceipt?.(entry.runId);
8534
- const text = facts?.text;
8535
- entry.progress.settle(typeof text === "string" && text.trim().length > 0 ? text : void 0);
8536
- if (facts?.trust !== void 0) entry.trust = summarizeTrustStatus(facts.trust);
8537
- };
8538
- const upsertBase = (raw, status, now) => {
8539
- const runId = parseRunId(raw.runId);
8540
- if (!runId) return null;
8541
- const previous = entries.get(runId);
8542
- const agentAudience = parseAgentAudience(raw.agentAudience, previous?.agentAudience);
8543
- const requestOrigin = parseRequestOrigin(raw.requestOrigin, previous?.requestOrigin);
8544
- const node = parseNonEmptyString(raw.node) ?? previous?.node;
8545
- const endpoint = parseEndpointCapacity(raw.endpoint) ?? previous?.endpoint;
8546
- const gate = parseGateBadge(raw.gate) ?? previous?.gate;
8547
- const council = parseCouncilBadge(raw.council) ?? previous?.council;
8548
- const rerouteCount = parsePositiveInt(raw.rerouteCount) ?? previous?.rerouteCount;
8549
- const contextWindow = parsePositiveInt(raw.contextWindow) ?? previous?.contextWindow;
8550
- const taskSummary = parseTaskSummary(raw, previous?.taskSummary);
8551
- const budget = cloneRunToolBudgetEnvelope(raw.budget) ?? previous?.budget;
8552
- const phase = fleetPhases.get(runId) ?? previous?.phase;
8553
- const entry = {
8554
- runId,
8555
- agentId: parseText(raw.agentId, previous?.agentId ?? "-"),
8556
- ...agentAudience !== void 0 ? { agentAudience } : {},
8557
- ...requestOrigin !== void 0 ? { requestOrigin } : {},
8558
- runtimeKind: parseRuntimeKind(raw.runtimeKind ?? previous?.runtimeKind),
8559
- runtimeId: parseText(raw.runtimeId, previous?.runtimeId ?? "-"),
8560
- targetId: parseText(raw.targetId, previous?.targetId ?? "-"),
8561
- wireModelId: parseText(raw.wireModelId, previous?.wireModelId ?? "-"),
8562
- ...endpoint !== void 0 ? { endpoint } : {},
8563
- ...taskSummary !== void 0 ? { taskSummary } : {},
8564
- ...budget !== void 0 ? { budget } : {},
8565
- status,
8566
- tokenCount: previous?.tokenCount ?? 0,
8567
- costUsd: previous?.costUsd ?? 0,
8568
- costProvenance: previous?.costProvenance ?? "unknown",
8569
- sequence: previous?.sequence ?? nextSequence++,
8570
- enqueuedAtMs: previous?.enqueuedAtMs ?? now,
8571
- startedAtMs: previous?.startedAtMs ?? null,
8572
- startedAtClockMs: previous?.startedAtClockMs ?? null,
8573
- finishedAtMs: previous?.finishedAtMs ?? null,
8574
- durationMs: previous?.durationMs ?? null,
8575
- inputTokens: previous?.inputTokens ?? 0,
8576
- outputTokens: previous?.outputTokens ?? 0,
8577
- ttftMs: previous?.ttftMs ?? null,
8578
- outcomeDetail: previous?.outcomeDetail ?? null,
8579
- ...node !== void 0 ? { node } : {},
8580
- ...gate !== void 0 ? { gate } : {},
8581
- ...council !== void 0 ? { council } : {},
8582
- ...previous?.hostVerification !== void 0 ? { hostVerification: previous.hostVerification } : {},
8583
- ...rerouteCount !== void 0 ? { rerouteCount } : {},
8584
- ...contextWindow !== void 0 ? { contextWindow } : {},
8585
- lastContextTokens: previous?.lastContextTokens ?? 0,
8586
- ...previous?.receiptId !== void 0 ? { receiptId: previous.receiptId } : {},
8587
- ...phase !== void 0 ? { phase } : {},
8588
- progress: previous?.progress ?? createWorkerProgressFold(),
8589
- ...previous?.retry ? { retry: { ...previous.retry } } : {},
8590
- ...previous?.steerAcknowledgement ? { steerAcknowledgement: { ...previous.steerAcknowledgement } } : {},
8591
- ...previous?.writeRecordDowngrade ? { writeRecordDowngrade: { ...previous.writeRecordDowngrade } } : {}
8592
- };
8593
- entries.set(runId, entry);
8594
- pruneEntries(entries, (evicted) => fleetPhases.delete(evicted));
8595
- return entry;
8596
- };
8597
- const unsubscribers = [
8598
- bus.on(BusChannels.DispatchEnqueued, (raw) => {
8599
- const entry = upsertBase(raw ?? {}, "enqueued", Date.now());
8600
- if (entry) delete entry.retry;
8601
- }),
8602
- bus.on(BusChannels.DispatchStarted, (raw) => {
8603
- const now = Date.now();
8604
- const entry = upsertBase(raw ?? {}, "running", now);
8605
- if (!entry) return;
8606
- entry.startedAtMs ??= now;
8607
- entry.startedAtClockMs ??= performance3.now();
8608
- entry.finishedAtMs = null;
8609
- entry.durationMs = null;
8610
- delete entry.retry;
8611
- }),
8612
- bus.on(BusChannels.DispatchCompleted, (raw) => {
8613
- const now = Date.now();
8614
- const payload = raw ?? {};
8615
- const entry = upsertBase(payload, "completed", now);
8616
- if (!entry) return;
8617
- entry.startedAtMs ??= entry.enqueuedAtMs;
8618
- entry.finishedAtMs = now;
8619
- entry.durationMs = parseFiniteNumber(payload.durationMs, Math.max(0, rawDurationMs(entry.startedAtMs, now)));
8620
- entry.tokenCount = parseFiniteNumber(payload.tokenCount, entry.tokenCount);
8621
- entry.costUsd = parseFiniteNumber(payload.costUsd, entry.costUsd);
8622
- entry.costProvenance = resolveCostProvenance(payload.costProvenance, entry.costProvenance ?? "unknown");
8623
- entry.outcomeDetail = null;
8624
- if (payload.hostVerification !== void 0) entry.hostVerification = payload.hostVerification;
8625
- settleFromReceipt(entry);
8626
- entry.receiptId = entry.runId;
8627
- delete entry.retry;
8628
- if (typeof payload.inputTokenCount === "number") {
8629
- entry.inputTokens = payload.inputTokenCount + parseFiniteNumberOrZero(payload.cacheReadTokenCount);
8630
- }
8631
- if (typeof payload.outputTokenCount === "number") {
8632
- entry.outputTokens = payload.outputTokenCount;
8633
- }
8634
- }),
8635
- bus.on(BusChannels.DispatchFailed, (raw) => {
8636
- const now = Date.now();
8637
- const payload = raw ?? {};
8638
- const runId = parseRunId(payload.runId);
8639
- const previousStatus = runId !== null ? entries.get(runId)?.status : void 0;
8640
- const resolvedStatus = resolveDispatchFailureStatus(payload.reason);
8641
- const status = previousStatus === "dead" && resolvedStatus === "failed" ? "dead" : resolvedStatus;
8642
- const entry = upsertBase(payload, status, now);
8643
- if (!entry) return;
8644
- entry.startedAtMs ??= entry.enqueuedAtMs;
8645
- entry.finishedAtMs = now;
8646
- entry.durationMs = parseFiniteNumber(payload.durationMs, Math.max(0, rawDurationMs(entry.startedAtMs, now)));
8647
- entry.tokenCount = parseFiniteNumber(payload.tokenCount, entry.tokenCount);
8648
- entry.costUsd = parseFiniteNumber(payload.costUsd, entry.costUsd);
8649
- entry.costProvenance = resolveCostProvenance(payload.costProvenance, entry.costProvenance ?? "unknown");
8650
- entry.outcomeDetail = resolveFailureDetail(payload, entry.outcomeDetail);
8651
- if (payload.hostVerification !== void 0) entry.hostVerification = payload.hostVerification;
8652
- settleFromReceipt(entry);
8653
- if (payload.reason !== "retry_denied") entry.receiptId = entry.runId;
8654
- delete entry.retry;
8655
- if (typeof payload.inputTokenCount === "number") {
8656
- entry.inputTokens = payload.inputTokenCount + parseFiniteNumberOrZero(payload.cacheReadTokenCount);
8657
- }
8658
- if (typeof payload.outputTokenCount === "number") {
8659
- entry.outputTokens = payload.outputTokenCount;
8660
- }
8661
- }),
8662
- bus.on(BusChannels.RunAborted, (raw) => {
8663
- const runId = parseRunId(raw?.runId);
8664
- if (!runId) return;
8665
- const entry = entries.get(runId);
8666
- if (!entry) return;
8667
- const wasRetrying = entry.retry !== void 0;
8668
- delete entry.retry;
8669
- if (wasRetrying && raw?.startedAt === null) {
8670
- entry.status = "aborted";
8671
- entry.finishedAtMs = Date.now();
8672
- entry.progress.settle();
8673
- } else {
8674
- if (isTerminalStatus(entry.status) && !wasRetrying) return;
8675
- entry.status = "cancelling";
8676
- }
8677
- entry.outcomeDetail = parseOptionalDetail(raw?.reason) ?? entry.outcomeDetail ?? null;
8678
- }),
8679
- bus.on(BusChannels.DispatchProgress, (raw) => {
8680
- const payload = raw ?? {};
8681
- const runId = parseRunId(payload.runId);
8682
- if (!runId) return;
8683
- const entry = entries.get(runId);
8684
- if (!entry) return;
8685
- const workerEvent = payload.event ?? {};
8686
- const type = typeof workerEvent.type === "string" ? workerEvent.type : "";
8687
- if (type === "heartbeat_status") {
8688
- if (isTerminalStatus(entry.status) || entry.status === "cancelling") return;
8689
- const status = resolveHeartbeatStatus(workerEvent.status);
8690
- if (!status) return;
8691
- entry.status = status;
8692
- if (status === "dead") {
8693
- entry.finishedAtMs ??= Date.now();
8694
- entry.progress.settle();
8695
- delete entry.retry;
8696
- }
8697
- return;
8698
- }
8699
- if (type === "attempt_start") {
8700
- entry.failoverHops = (entry.failoverHops ?? 0) + 1;
8701
- entry.status = "running";
8702
- entry.finishedAtMs = null;
8703
- entry.progress.restart();
8704
- delete entry.retry;
8705
- return;
8706
- }
8707
- if (type === "agent_start") {
8708
- entry.startedAtMs = Date.now();
8709
- entry.startedAtClockMs = performance3.now();
8710
- }
8711
- if (type === "message_update") {
8712
- const assistantEvent = "assistantMessageEvent" in workerEvent && typeof workerEvent.assistantMessageEvent === "object" && workerEvent.assistantMessageEvent !== null ? workerEvent.assistantMessageEvent : {};
8713
- const hasDelta = assistantEvent.type === "text_delta" || assistantEvent.type === "thinking_delta" || assistantEvent.type === "toolcall_start" || assistantEvent.type === "toolcall_delta";
8714
- if (hasDelta && entry.ttftMs === null && entry.startedAtClockMs !== null) {
8715
- entry.ttftMs = Math.round(performance3.now() - entry.startedAtClockMs);
8716
- }
8717
- }
8718
- if (type === "clio_coder_write_record_downgraded") {
8719
- const rawPayload = workerEvent.payload;
8720
- const payload2 = typeof rawPayload === "object" && rawPayload !== null ? rawPayload : null;
8721
- const tool = payload2 === null ? void 0 : parseNonEmptyString(payload2.tool);
8722
- const toolCallId = payload2 === null ? void 0 : parseNonEmptyString(payload2.toolCallId);
8723
- if (payload2?.reason === "opaque_tool_succeeded" && tool !== void 0 && toolCallId !== void 0) {
8724
- entry.writeRecordDowngrade = {
8725
- reason: "opaque_tool_succeeded",
8726
- tool: sanitizeCallTargetText(tool),
8727
- toolCallId: sanitizeCallTargetText(toolCallId)
8728
- };
8729
- }
8730
- }
8731
- entry.progress.observe(payload.event);
8732
- if (type === "clio_coder_steer_received") {
8733
- const steerPayload = workerEvent.payload;
8734
- entry.steerAcknowledgement = {
8735
- receivedAtMs: Date.now(),
8736
- chars: Math.max(0, Math.floor(parseFiniteNumberOrZero(steerPayload?.chars)))
8737
- };
8738
- }
8739
- if (isTerminalStatus(entry.status)) return;
8740
- if (type === "message_end" && workerEvent.message?.role === "assistant") {
8741
- const usage = workerEvent.message.usage;
8742
- const input = parseFiniteNumberOrZero(usage?.input) + parseFiniteNumberOrZero(usage?.cacheRead);
8743
- const output = parseFiniteNumberOrZero(usage?.output);
8744
- entry.inputTokens += input;
8745
- entry.outputTokens += output;
8746
- entry.tokenCount += input + output + parseFiniteNumberOrZero(usage?.cacheWrite);
8747
- entry.lastContextTokens = input + output;
8748
- }
8749
- if (type === "agent_end") {
8750
- const status = resolveAgentEndStatus(workerEvent.messages);
8751
- if (!status) return;
8752
- entry.status = status;
8753
- entry.finishedAtMs ??= Date.now();
8754
- entry.progress.settle();
8755
- delete entry.retry;
8756
- }
8757
- })
8758
- ];
8759
- let closed = false;
8760
- const reconcile = () => {
8761
- const now = Date.now();
8762
- if (!snapshot) {
8763
- reconciledAtMs = now;
8764
- return;
8765
- }
8766
- let currentSnapshot;
8767
- try {
8768
- currentSnapshot = snapshot();
8769
- } catch {
8770
- return;
8771
- }
8772
- if (!Array.isArray(currentSnapshot?.retrying) || !Array.isArray(currentSnapshot?.running)) return;
8773
- reconciledAtMs = now;
8774
- const retrying = readRetrySnapshot(currentSnapshot);
8775
- const running = readRunningSnapshot(currentSnapshot);
8776
- for (const entry of entries.values()) {
8777
- if (entry.retry && !retrying.has(entry.runId)) {
8778
- delete entry.retry;
8779
- }
8780
- }
8781
- for (const [runId, projection] of retrying) {
8782
- const existing = entries.get(runId);
8783
- if (existing && existing.status !== "failed" && existing.status !== "dead") {
8784
- continue;
8785
- }
8786
- const entry = existing ?? upsertBase(
8787
- {
8788
- runId,
8789
- agentId: projection.agentId,
8790
- ...projection.taskSummary !== void 0 ? { task: projection.taskSummary } : {}
8791
- },
8792
- "failed",
8793
- now
8794
- );
8795
- if (entry) {
8796
- entry.retry = { ...projection.retry };
8797
- if (entry.taskSummary === void 0 && projection.taskSummary !== void 0) {
8798
- entry.taskSummary = projection.taskSummary;
8799
- }
8800
- }
8801
- }
8802
- for (const [runId, live] of running) {
8803
- const entry = entries.get(runId);
8804
- if (!entry) continue;
8805
- if (isTerminalStatus(entry.status) && live.outcomePhase !== "aborting") continue;
8806
- entry.inputTokens = live.inputTokens;
8807
- entry.outputTokens = live.outputTokens;
8808
- entry.tokenCount = live.tokenCount;
8809
- entry.costUsd = live.costUsd;
8810
- entry.costProvenance = live.costProvenance;
8811
- if (live.budget !== void 0) entry.budget = live.budget;
8812
- if (live.outcomePhase === "aborting") {
8813
- if (entry.status !== "completed" && entry.status !== "aborted") {
8814
- entry.status = "cancelling";
8815
- delete entry.retry;
8816
- }
8817
- }
8818
- }
8819
- };
8064
+ function createDispatchBoardStore(projection) {
8065
+ let current = projection.snapshot();
8066
+ const unsubscribe = projection.subscribe((snapshot) => {
8067
+ current = snapshot;
8068
+ });
8820
8069
  const projectRows = (activeOnly) => {
8821
- return [...entries.values()].sort(sortEntries).map((entry) => toRow(entry, reconciledAtMs)).filter((row2) => !activeOnly || !isTerminalStatus(row2.status));
8070
+ return [...current.runs].reverse().sort(
8071
+ (a, b) => STATUS_ORDER[a.status] - STATUS_ORDER[b.status] || (b.finishedAtMs ?? b.startedAtMs) - (a.finishedAtMs ?? a.startedAtMs)
8072
+ ).map((run) => toRow(run, current.generatedAt)).filter((row2) => !activeOnly || !isTerminalStatus(row2.status));
8822
8073
  };
8823
8074
  return {
8824
- rows() {
8825
- return projectRows(false);
8826
- },
8827
- activeRows() {
8828
- return projectRows(true);
8075
+ rows: () => projectRows(false),
8076
+ activeRows: () => projectRows(true),
8077
+ reconcile() {
8078
+ projection.reconcileRuns();
8079
+ current = projection.snapshot();
8829
8080
  },
8830
- reconcile,
8831
8081
  setFleetPhase(runId, phase) {
8832
- fleetPhases.set(runId, phase);
8833
- const entry = entries.get(runId);
8834
- if (entry) entry.phase = { ...phase };
8082
+ projection.setFleetPhase(runId, phase);
8083
+ current = projection.snapshot();
8835
8084
  },
8836
- unsubscribe() {
8837
- if (closed) return;
8838
- closed = true;
8839
- for (const unsubscribe of unsubscribers) unsubscribe();
8840
- }
8085
+ unsubscribe
8841
8086
  };
8842
8087
  }
8843
8088
 
@@ -10556,7 +9801,7 @@ var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{
10556
9801
  function isIso8601(value) {
10557
9802
  return typeof value === "string" && ISO_8601_REGEX.test(value) && !Number.isNaN(Date.parse(value));
10558
9803
  }
10559
- function isRecord8(value) {
9804
+ function isRecord7(value) {
10560
9805
  return !!value && typeof value === "object" && !Array.isArray(value);
10561
9806
  }
10562
9807
  function isNonEmptyString(value) {
@@ -10619,23 +9864,23 @@ function maybeSizeBytes(path2) {
10619
9864
  }
10620
9865
  function sessionCurrentPath2(stateDir, meta) {
10621
9866
  if (!meta) return void 0;
10622
- return join5(stateDir, "sessions", meta.cwdHash, meta.id, "current.jsonl");
9867
+ return join4(stateDir, "sessions", meta.cwdHash, meta.id, "current.jsonl");
10623
9868
  }
10624
9869
  function protectedArtifactPath(path2) {
10625
9870
  return isAbsolute4(path2) ? path2 : void 0;
10626
9871
  }
10627
9872
  function receiptFilePath(stateDir, runId) {
10628
- return join5(stateDir, "receipts", `${runId}.json`);
9873
+ return join4(stateDir, "receipts", `${runId}.json`);
10629
9874
  }
10630
9875
  function runLedgerPath(stateDir) {
10631
- return join5(stateDir, "runs.json");
9876
+ return join4(stateDir, "runs.json");
10632
9877
  }
10633
9878
  function readRunLedger(stateDir) {
10634
9879
  try {
10635
- const raw = readFileSync6(runLedgerPath(stateDir), "utf8").trim();
9880
+ const raw = readFileSync5(runLedgerPath(stateDir), "utf8").trim();
10636
9881
  if (raw.length === 0) return [];
10637
9882
  const parsed = JSON.parse(raw);
10638
- return Array.isArray(parsed) ? parsed.filter(isRecord8) : [];
9883
+ return Array.isArray(parsed) ? parsed.filter(isRecord7) : [];
10639
9884
  } catch {
10640
9885
  return [];
10641
9886
  }
@@ -10657,7 +9902,7 @@ function validateToolStats(value) {
10657
9902
  }
10658
9903
  for (let i = 0; i < value.length; i++) {
10659
9904
  const entry = value[i];
10660
- if (!isRecord8(entry)) {
9905
+ if (!isRecord7(entry)) {
10661
9906
  return { ok: false, reason: `toolStats[${i}] not an object` };
10662
9907
  }
10663
9908
  if (!isNonEmptyString(entry.tool)) {
@@ -10676,7 +9921,7 @@ function validateToolStats(value) {
10676
9921
  }
10677
9922
  function receiptTrustDetail(stateDir, runId) {
10678
9923
  try {
10679
- const receipt = JSON.parse(readFileSync6(receiptFilePath(stateDir, runId), "utf8"));
9924
+ const receipt = JSON.parse(readFileSync5(receiptFilePath(stateDir, runId), "utf8"));
10680
9925
  const ledger = readRunEnvelope(stateDir, runId);
10681
9926
  return formatTrustSummaryLine(inspectRunReceiptTrustStatus(receipt, ledger.ok ? ledger.envelope : null).status);
10682
9927
  } catch {
@@ -10694,7 +9939,7 @@ function verifyReceiptFile(stateDir, runId) {
10694
9939
  const target = receiptFilePath(stateDir, runId);
10695
9940
  let raw;
10696
9941
  try {
10697
- raw = readFileSync6(target, "utf8");
9942
+ raw = readFileSync5(target, "utf8");
10698
9943
  } catch (err) {
10699
9944
  const e = err;
10700
9945
  if (e.code === "ENOENT") return { ok: false, reason: "receipt file not found" };
@@ -10706,7 +9951,7 @@ function verifyReceiptFile(stateDir, runId) {
10706
9951
  } catch (err) {
10707
9952
  return { ok: false, reason: `invalid json: ${err.message}` };
10708
9953
  }
10709
- if (!isRecord8(parsed)) {
9954
+ if (!isRecord7(parsed)) {
10710
9955
  return { ok: false, reason: "receipt is not an object" };
10711
9956
  }
10712
9957
  const r = parsed;
@@ -10806,7 +10051,7 @@ var RECEIPT_FILE_FAILURE = /^(?:receipt file not found|read error:)/u;
10806
10051
  var RECEIPT_CONTRACT_FAILURE = /^(?:invalid json:|receipt is not an object|missing field:|runId invalid:|runId mismatch:|agentId invalid:|task invalid:|targetId invalid:|wireModelId invalid:|runtimeId invalid:|runtimeKind invalid:|exitCode out of range:|tokenCount out of range:|inputTokenCount out of range:|outputTokenCount out of range:|cacheReadTokenCount out of range:|cacheWriteTokenCount out of range:|costUsd out of range:|reasoningTokenCount out of range:|startedAt not ISO-8601:|endedAt not ISO-8601:|clioCoderVersion empty|piMonoVersion invalid:|platform invalid:|nodeVersion invalid:|toolCalls out of range:|toolStats\[|compiledPromptHash invalid:|staticCompositionHash invalid:|sessionId invalid:|integrity invalid|execution role invalid|routing intent invalid|route decision invalid)/u;
10807
10052
  var LEDGER_FAILURE = /^(?:run ledger not found|run not found in ledger|ledger mismatch:)/u;
10808
10053
  function receiptIntegrityDigest(value) {
10809
- if (!isRecord8(value) || value.algorithm !== "sha256" || !isNonEmptyString(value.digest)) return null;
10054
+ if (!isRecord7(value) || value.algorithm !== "sha256" || !isNonEmptyString(value.digest)) return null;
10810
10055
  return `sha256:${value.digest}`;
10811
10056
  }
10812
10057
  function trustCheckEvidence(status, axis) {
@@ -10832,7 +10077,7 @@ function verifyReceiptFileReport(stateDir, runId) {
10832
10077
  const result = verifyReceiptFile(stateDir, runId);
10833
10078
  let receipt = null;
10834
10079
  try {
10835
- receipt = JSON.parse(readFileSync6(receiptPath, "utf8"));
10080
+ receipt = JSON.parse(readFileSync5(receiptPath, "utf8"));
10836
10081
  } catch {
10837
10082
  }
10838
10083
  const sealedDigest = receiptIntegrityDigest(receipt?.integrity);
@@ -11141,17 +10386,17 @@ var ReceiptArtifactProvider = class {
11141
10386
  }
11142
10387
  };
11143
10388
  function resultText3(result) {
11144
- if (!isRecord8(result)) return "";
10389
+ if (!isRecord7(result)) return "";
11145
10390
  if (result.kind === "ok" && typeof result.output === "string") return result.output;
11146
10391
  if (result.kind === "error" && typeof result.message === "string") return result.message;
11147
10392
  return "";
11148
10393
  }
11149
10394
  function resultDetails(result) {
11150
- return isRecord8(result) && isRecord8(result.details) ? result.details : null;
10395
+ return isRecord7(result) && isRecord7(result.details) ? result.details : null;
11151
10396
  }
11152
10397
  function messagePayload(entry) {
11153
10398
  if (entry.kind !== "message") return null;
11154
- return isRecord8(entry.payload) ? entry.payload : null;
10399
+ return isRecord7(entry.payload) ? entry.payload : null;
11155
10400
  }
11156
10401
  function toolNameFor(entry) {
11157
10402
  const payload = messagePayload(entry);
@@ -11177,7 +10422,7 @@ function dispatchResultForRun(entries, runId) {
11177
10422
  const details = resultDetails(payload.result);
11178
10423
  const detailRunId = details?.runId;
11179
10424
  const runIds = details?.runIds;
11180
- const matches = detailRunId === runId || Array.isArray(runIds) && runIds.some((item) => item === runId) || Array.isArray(details?.runs) && details.runs.some((item) => isRecord8(item) && item.runId === runId);
10425
+ const matches = detailRunId === runId || Array.isArray(runIds) && runIds.some((item) => item === runId) || Array.isArray(details?.runs) && details.runs.some((item) => isRecord7(item) && item.runId === runId);
11181
10426
  if (!matches) continue;
11182
10427
  const text = resultText3(payload.result);
11183
10428
  if (text.length > 0) return text;
@@ -11659,6 +10904,8 @@ function renderAccountabilitySummary(summary) {
11659
10904
  "# Accountability",
11660
10905
  "",
11661
10906
  `first-pass success: ${summary.firstPassRuns}/${summary.totalRuns} (${pct}%)`,
10907
+ `unverified successes: ${summary.unverifiedSuccesses}`,
10908
+ `ungrounded claims: ${summary.ungroundedClaims}`,
11662
10909
  "",
11663
10910
  "## Top failure causes",
11664
10911
  ""
@@ -11742,7 +10989,7 @@ function auditRowPayload(row2) {
11742
10989
  }
11743
10990
  function auditReadErrorsArtifact(stateDir, errors) {
11744
10991
  if (errors.length === 0) return null;
11745
- const path2 = join5(stateDir, "audit");
10992
+ const path2 = join4(stateDir, "audit");
11746
10993
  return {
11747
10994
  id: "audit:read-errors",
11748
10995
  category: "audit",
@@ -11770,7 +11017,7 @@ var SafetyAuditArtifactProvider = class {
11770
11017
  }
11771
11018
  const selected = [...currentSessionAuditRows(read.rows, this.deps.sessionMeta?.id)].sort(compareAuditRowsNewestFirst).slice(0, SAFETY_AUDIT_ARTIFACT_LIMIT);
11772
11019
  const artifacts = selected.map((row2) => {
11773
- const path2 = join5(this.deps.stateDir, "audit", row2.file);
11020
+ const path2 = join4(this.deps.stateDir, "audit", row2.file);
11774
11021
  const runId = readStringField2(row2.row, "runId");
11775
11022
  const sessionId = readStringField2(row2.row, "sessionId");
11776
11023
  const correlationId = readStringField2(row2.row, "correlationId") ?? row2.correlationId;
@@ -11854,7 +11101,7 @@ async function listViewArtifacts(providers) {
11854
11101
  }
11855
11102
 
11856
11103
  // src/interactive/worker-receipts.ts
11857
- function isRecord9(value) {
11104
+ function isRecord8(value) {
11858
11105
  return typeof value === "object" && value !== null && !Array.isArray(value);
11859
11106
  }
11860
11107
  function optionalString(value) {
@@ -11870,12 +11117,12 @@ function elapsedMsFrom(receipt) {
11870
11117
  return Math.max(0, endedAt - startedAt);
11871
11118
  }
11872
11119
  function contractFrom(receipt) {
11873
- const quality = isRecord9(receipt.quality) ? receipt.quality : null;
11120
+ const quality = isRecord8(receipt.quality) ? receipt.quality : null;
11874
11121
  if (quality === null) return void 0;
11875
11122
  if (!Object.hasOwn(quality, "resultContract")) return void 0;
11876
11123
  const fact = quality.resultContract;
11877
11124
  if (fact === null) return "unmeasured";
11878
- if (!isRecord9(fact)) return void 0;
11125
+ if (!isRecord8(fact)) return void 0;
11879
11126
  const conformance = fact.conformance;
11880
11127
  return conformance === "pass" || conformance === "fail" || conformance === "not-reached" ? conformance : void 0;
11881
11128
  }
@@ -11887,8 +11134,8 @@ var PRESENTED_RESULT_CONTRACTS = [
11887
11134
  "scout-report"
11888
11135
  ];
11889
11136
  function contractKindFrom(receipt) {
11890
- const quality = isRecord9(receipt.quality) ? receipt.quality : null;
11891
- const fact = quality !== null && isRecord9(quality.resultContract) ? quality.resultContract : null;
11137
+ const quality = isRecord8(receipt.quality) ? receipt.quality : null;
11138
+ const fact = quality !== null && isRecord8(quality.resultContract) ? quality.resultContract : null;
11892
11139
  const sourceId = optionalString(fact?.sourceId);
11893
11140
  if (sourceId === void 0) return void 0;
11894
11141
  return PRESENTED_RESULT_CONTRACTS.find((kind) => sourceId.startsWith(`agent-result-contract:${kind}:`));
@@ -11896,7 +11143,7 @@ function contractKindFrom(receipt) {
11896
11143
  function workerReceiptFacts(receipt) {
11897
11144
  const outcome = optionalString(receipt.outcome);
11898
11145
  if (outcome === void 0) return null;
11899
- const output = isRecord9(receipt.output) ? receipt.output : null;
11146
+ const output = isRecord8(receipt.output) ? receipt.output : null;
11900
11147
  const contract = contractFrom(receipt);
11901
11148
  const contractKind = contractKindFrom(receipt);
11902
11149
  const text = optionalString(output?.text);
@@ -11922,11 +11169,11 @@ function workerReceiptFacts(receipt) {
11922
11169
  function readReceiptFileFacts(runId, stateDir) {
11923
11170
  let parsed;
11924
11171
  try {
11925
- parsed = JSON.parse(readFileSync7(receiptFilePath(stateDir, runId), "utf8"));
11172
+ parsed = JSON.parse(readFileSync6(receiptFilePath(stateDir, runId), "utf8"));
11926
11173
  } catch {
11927
11174
  return null;
11928
11175
  }
11929
- if (!isRecord9(parsed)) return null;
11176
+ if (!isRecord8(parsed)) return null;
11930
11177
  const facts = workerReceiptFacts(parsed);
11931
11178
  if (facts === null) return null;
11932
11179
  const row2 = findRunRow(runId, stateDir);
@@ -11938,13 +11185,13 @@ function readWorkerReceiptFacts(runId, stateDir = clioStateDir()) {
11938
11185
  return readReceiptFileFacts(runId, stateDir);
11939
11186
  }
11940
11187
  function findRunRow(runId, stateDir) {
11941
- const path2 = join6(stateDir, "runs.json");
11942
- if (!existsSync5(path2)) return null;
11188
+ const path2 = join5(stateDir, "runs.json");
11189
+ if (!existsSync4(path2)) return null;
11943
11190
  try {
11944
- const parsed = JSON.parse(readFileSync7(path2, "utf8"));
11191
+ const parsed = JSON.parse(readFileSync6(path2, "utf8"));
11945
11192
  if (!Array.isArray(parsed)) return null;
11946
11193
  for (const entry of parsed) {
11947
- if (isRecord9(entry) && entry.id === runId) return entry;
11194
+ if (isRecord8(entry) && entry.id === runId) return entry;
11948
11195
  }
11949
11196
  return null;
11950
11197
  } catch {
@@ -12480,7 +11727,7 @@ function replayResultSummary(result) {
12480
11727
  const summary = result.resultSummary ?? toolResultSummary(result.result);
12481
11728
  const offloadPath = typeof summary.offloadPath === "string" && summary.offloadPath.length > 0 ? summary.offloadPath : null;
12482
11729
  if (offloadPath === null) return result.resultSummary;
12483
- return { ...summary, offloadFileMissing: !existsSync6(offloadPath) };
11730
+ return { ...summary, offloadFileMissing: !existsSync5(offloadPath) };
12484
11731
  }
12485
11732
  function extractToolResult(entry) {
12486
11733
  const payload = entry.payload;
@@ -14890,7 +14137,7 @@ function createTurnRecovery(deps) {
14890
14137
 
14891
14138
  // src/interactive/turn-runtime.ts
14892
14139
  init_esm_shims();
14893
- import { performance as performance4 } from "node:perf_hooks";
14140
+ import { performance as performance3 } from "node:perf_hooks";
14894
14141
 
14895
14142
  // src/interactive/tool-prose-loop.ts
14896
14143
  init_esm_shims();
@@ -15202,7 +14449,7 @@ function createTurnRuntime(deps) {
15202
14449
  maxRetryDelayMs: deps.retrySettings().maxDelayMs,
15203
14450
  ...gatewaySessionId ? { sessionId: gatewaySessionId } : {},
15204
14451
  onStreamInvocation: () => {
15205
- apiCallStartedAt = performance4.now();
14452
+ apiCallStartedAt = performance3.now();
15206
14453
  apiCallFirstDeltaAt = null;
15207
14454
  },
15208
14455
  onPayload: async (payload, currentModel) => {
@@ -15242,7 +14489,7 @@ function createTurnRuntime(deps) {
15242
14489
  runtimeResolution: target.runtimeResolution
15243
14490
  };
15244
14491
  emitThinkingClampNotice(target.runtimeResolution);
15245
- let lastActivityAt = performance4.now();
14492
+ let lastActivityAt = performance3.now();
15246
14493
  let toolsInFlight = 0;
15247
14494
  let stallSuspendDepth = 0;
15248
14495
  let stallTimer = null;
@@ -15261,7 +14508,7 @@ function createTurnRuntime(deps) {
15261
14508
  armStallTimer(stallMs);
15262
14509
  return;
15263
14510
  }
15264
- const idleMs = performance4.now() - lastActivityAt;
14511
+ const idleMs = performance3.now() - lastActivityAt;
15265
14512
  if (idleMs < stallMs) {
15266
14513
  armStallTimer(stallMs - idleMs);
15267
14514
  return;
@@ -15279,7 +14526,7 @@ function createTurnRuntime(deps) {
15279
14526
  return await context.postToolContinuationGuard(localRuntime, signal);
15280
14527
  } finally {
15281
14528
  stallSuspendDepth -= 1;
15282
- lastActivityAt = performance4.now();
14529
+ lastActivityAt = performance3.now();
15283
14530
  }
15284
14531
  };
15285
14532
  let streamStartedAt = null;
@@ -15290,7 +14537,7 @@ function createTurnRuntime(deps) {
15290
14537
  const interruptedUsageByMessage = /* @__PURE__ */ new WeakMap();
15291
14538
  handle.agent.subscribe(async (event) => {
15292
14539
  const eventAt = Date.now();
15293
- const eventClock = performance4.now();
14540
+ const eventClock = performance3.now();
15294
14541
  lastActivityAt = eventClock;
15295
14542
  let enrichedEvent = event;
15296
14543
  if (event.type === "tool_execution_start") {
@@ -19115,7 +18362,7 @@ function compileFleetRunPreview(input) {
19115
18362
  };
19116
18363
  if (input.budget) {
19117
18364
  if (input.budget.verdict === "over" || input.budget.verdict === "at") {
19118
- diagnostics.push(`budget ceiling crossed: $${budget.currentUsd.toFixed(4)} / $${budget.ceilingUsd.toFixed(4)}`);
18365
+ diagnostics.push(`budget ceiling crossed: ${formatUsd(budget.currentUsd)} / ${formatUsd(budget.ceilingUsd)}`);
19119
18366
  } else if (contract.budgetUsd !== null) {
19120
18367
  const remaining = budget.ceilingUsd - budget.currentUsd;
19121
18368
  if (contract.budgetUsd > remaining) {
@@ -20385,7 +19632,7 @@ function formatFleetRunPreviewStep(step) {
20385
19632
  }
20386
19633
  function formatBudgetLine(preview) {
20387
19634
  const contract = preview.budget.contractUsd === null ? "contract declares no ceiling" : `contract ceiling $${preview.budget.contractUsd.toFixed(2)}`;
20388
- return `budget: admitted under $${preview.budget.ceilingUsd.toFixed(2)} session ceiling, $${preview.budget.currentUsd.toFixed(4)} spent, ${contract}`;
19635
+ return `budget: admitted under $${preview.budget.ceilingUsd.toFixed(2)} session ceiling, ${formatUsd(preview.budget.currentUsd)} spent, ${contract}`;
20389
19636
  }
20390
19637
  function formatFleetRunApprovalBody(subject, width, scroll) {
20391
19638
  const theme6 = clioTheme();
@@ -22632,10 +21879,10 @@ var SETTINGS_VALUE_HELP_BY_ID = {
22632
21879
  false: "context is only compacted when you run /context compact"
22633
21880
  },
22634
21881
  // `embedded` is a declared rung with no implementation behind it yet; it
22635
- // runs as `auto` until Clio can own a pane host, and the hint says so.
21882
+ // refuses until Clio can own a pane host, and the hint says so.
22636
21883
  "panes.enabled": {
22637
21884
  auto: "detect a herdr session and join it as a guest; no pane host, no panes",
22638
- embedded: "not implemented yet; behaves as auto (guest mode inside herdr) until Clio can own a pane host",
21885
+ embedded: "not implemented yet; use auto or guest",
22639
21886
  off: "never detect or open a pane"
22640
21887
  },
22641
21888
  "retry.enabled": {
@@ -23123,12 +22370,12 @@ function scopedModelsSubmenu(selectedRefs, providers) {
23123
22370
  "Target entries cycle by target, using its default model when switching targets. Model entries pin one exact target/model reference."
23124
22371
  );
23125
22372
  }
23126
- function chainSubmenus(first, second, join13) {
22373
+ function chainSubmenus(first, second, join12) {
23127
22374
  return (_currentValue, done) => {
23128
22375
  let active = first("", (head) => {
23129
22376
  const trimmed = head?.trim() ?? "";
23130
22377
  if (!trimmed) return done();
23131
- active = second(trimmed)("", (tail) => done(tail?.trim() ? join13(trimmed, tail.trim()) : void 0));
22378
+ active = second(trimmed)("", (tail) => done(tail?.trim() ? join12(trimmed, tail.trim()) : void 0));
23132
22379
  });
23133
22380
  return {
23134
22381
  render: (width) => active.render(width),
@@ -24439,11 +23686,11 @@ function applyEntrySettingChange(settings, id, value) {
24439
23686
  }
24440
23687
  function changedLeafPaths(before, after) {
24441
23688
  const out = [];
24442
- const isRecord11 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
23689
+ const isRecord10 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
24443
23690
  const visit = (a, b, path2) => {
24444
23691
  if (a === b) return;
24445
23692
  const profileLeaf = path2.startsWith("fleet.profiles.") && path2.split(".").length === 3;
24446
- if (!isRecord11(a) || !isRecord11(b) || profileLeaf) {
23693
+ if (!isRecord10(a) || !isRecord10(b) || profileLeaf) {
24447
23694
  if (JSON.stringify(a) !== JSON.stringify(b)) out.push(path2);
24448
23695
  return;
24449
23696
  }
@@ -27413,9 +26660,9 @@ init_esm_shims();
27413
26660
 
27414
26661
  // src/domains/session/cwd-fallback.ts
27415
26662
  init_esm_shims();
27416
- import { existsSync as existsSync7, statSync as statSync2 } from "node:fs";
26663
+ import { existsSync as existsSync6, statSync as statSync2 } from "node:fs";
27417
26664
  var defaultFsProbe = {
27418
- exists: (p) => existsSync7(p),
26665
+ exists: (p) => existsSync6(p),
27419
26666
  isDirectory: (p) => {
27420
26667
  try {
27421
26668
  return statSync2(p).isDirectory();
@@ -27453,9 +26700,9 @@ function runCompactWithNotice(onCompact, notice, instructions) {
27453
26700
  init_esm_shims();
27454
26701
  import { spawnSync } from "node:child_process";
27455
26702
  import { randomUUID as randomUUID2 } from "node:crypto";
27456
- import { readFileSync as readFileSync8, unlinkSync, writeFileSync } from "node:fs";
26703
+ import { readFileSync as readFileSync7, unlinkSync, writeFileSync } from "node:fs";
27457
26704
  import { tmpdir } from "node:os";
27458
- import { join as join7 } from "node:path";
26705
+ import { join as join6 } from "node:path";
27459
26706
  function defaultProbe(candidates) {
27460
26707
  for (const candidate of candidates) {
27461
26708
  const result = spawnSync("sh", ["-lc", `command -v ${candidate}`], {
@@ -27487,13 +26734,13 @@ function resolveExternalEditor(env = process.env, probe = defaultProbe) {
27487
26734
  }
27488
26735
  function editTextExternally(initialText, command) {
27489
26736
  if (!command) return { ok: false, error: "no external editor configured; set VISUAL or EDITOR" };
27490
- const tmpFile = join7(tmpdir(), `clio-coder-editor-${process.pid}-${randomUUID2()}.md`);
26737
+ const tmpFile = join6(tmpdir(), `clio-coder-editor-${process.pid}-${randomUUID2()}.md`);
27491
26738
  try {
27492
26739
  writeFileSync(tmpFile, initialText, "utf8");
27493
26740
  const result = runEditor(command, tmpFile);
27494
26741
  if (result.error) return { ok: false, error: result.error.message };
27495
26742
  if (result.status !== 0) return { ok: false, error: `external editor exited with code ${result.status ?? "?"}` };
27496
- return { ok: true, text: readFileSync8(tmpFile, "utf8").replace(/\n$/, "") };
26743
+ return { ok: true, text: readFileSync7(tmpFile, "utf8").replace(/\n$/, "") };
27497
26744
  } finally {
27498
26745
  try {
27499
26746
  unlinkSync(tmpFile);
@@ -31095,11 +30342,11 @@ function classifyInputAction(data, deps) {
31095
30342
 
31096
30343
  // src/interactive/interactive-presentation.ts
31097
30344
  init_esm_shims();
31098
- import { performance as performance6 } from "node:perf_hooks";
30345
+ import { performance as performance5 } from "node:perf_hooks";
31099
30346
 
31100
30347
  // src/interactive/chat-panel.ts
31101
30348
  init_esm_shims();
31102
- import { performance as performance5 } from "node:perf_hooks";
30349
+ import { performance as performance4 } from "node:perf_hooks";
31103
30350
 
31104
30351
  // src/interactive/renderers/code-ink.ts
31105
30352
  init_esm_shims();
@@ -32436,7 +31683,7 @@ function createChatPanel(options = {}) {
32436
31683
  ) || entry.pending && openThinkingSegment(entry)?.startedAtMs !== void 0) || entry.role === "replayBlock" && entry.isLive?.() === true || entry.role === "user" && (entry.status?.() ?? "committed") !== "committed";
32437
31684
  const entryIsStable = (entry) => entry.role === "user" && (entry.status?.() ?? "committed") === "committed" || entry.role === "replayBlock" && entry.isLive?.() !== true || entry.role === "worker" && !entry.state.pending || entry.role === "assistant" && !entry.pending && !entry.segments.some((segment) => segment.kind === "tool" && !segment.finished);
32438
31685
  const render2 = (width) => {
32439
- const startedAt = performance5.now();
31686
+ const startedAt = performance4.now();
32440
31687
  const expandKey = resolveExpandKey();
32441
31688
  const verbosity = options.getOutputVerbosity?.();
32442
31689
  if (lastVerbosity !== null && verbosity !== lastVerbosity) dropFoldOverrides();
@@ -32445,7 +31692,7 @@ function createChatPanel(options = {}) {
32445
31692
  const nowMs = now();
32446
31693
  const tick = renderedRunningTool ? Math.floor(nowMs / 100) : 0;
32447
31694
  if (!dirty && cachedWidth === width && cachedExpandKey === expandKey && cachedDetail === detail && cachedLiveToolOutput === liveToolOutput && cachedTick === tick) {
32448
- options.onRenderMetrics?.({ durationMs: performance5.now() - startedAt, cacheHit: true, entriesRendered: 0 });
31695
+ options.onRenderMetrics?.({ durationMs: performance4.now() - startedAt, cacheHit: true, entriesRendered: 0 });
32449
31696
  return cachedLines;
32450
31697
  }
32451
31698
  const { toolId: latestHintToolId, workerId: latestFoldedWorkerId } = expandHintOwner(detail);
@@ -32512,7 +31759,7 @@ function createChatPanel(options = {}) {
32512
31759
  cachedTick = tick;
32513
31760
  renderedRunningTool = sawRunningTool;
32514
31761
  dirty = false;
32515
- options.onRenderMetrics?.({ durationMs: performance5.now() - startedAt, cacheHit: false, entriesRendered });
31762
+ options.onRenderMetrics?.({ durationMs: performance4.now() - startedAt, cacheHit: false, entriesRendered });
32516
31763
  return out;
32517
31764
  };
32518
31765
  return {
@@ -33547,7 +32794,7 @@ init_esm_shims();
33547
32794
  import { execFile as execFile2 } from "node:child_process";
33548
32795
  import { open, readdir, stat as stat2 } from "node:fs/promises";
33549
32796
  import { homedir as homedir2 } from "node:os";
33550
- import { basename as basename3, dirname as dirname2, join as join8, relative as relative7, resolve as resolve5, sep as sep2 } from "node:path";
32797
+ import { basename as basename3, dirname as dirname2, join as join7, relative as relative7, resolve as resolve5, sep as sep2 } from "node:path";
33551
32798
  var MAX_COMPLETION_ROWS = 40;
33552
32799
  var PREVIEW_BYTES = 2048;
33553
32800
  var PREVIEW_CHARS = 120;
@@ -33595,7 +32842,7 @@ function buildWorkspaceSnapshot(basePath, visibleFiles, trackedFiles) {
33595
32842
  const tracked = trackedFiles.has(path2);
33596
32843
  files.push({
33597
32844
  path: path2,
33598
- absolutePath: join8(basePath, path2),
32845
+ absolutePath: join7(basePath, path2),
33599
32846
  isDirectory: false,
33600
32847
  tracked,
33601
32848
  descendantFiles: 0,
@@ -33613,7 +32860,7 @@ function buildWorkspaceSnapshot(basePath, visibleFiles, trackedFiles) {
33613
32860
  const directories = [...directoryFacts].map(
33614
32861
  ([path2, facts]) => ({
33615
32862
  path: path2,
33616
- absolutePath: join8(basePath, path2),
32863
+ absolutePath: join7(basePath, path2),
33617
32864
  isDirectory: true,
33618
32865
  tracked: facts.tracked,
33619
32866
  descendantFiles: facts.descendantFiles,
@@ -33688,7 +32935,7 @@ async function explicitCandidates(basePath, query, trackedFiles) {
33688
32935
  const candidates = [];
33689
32936
  for (const entry of await readdir(directory, { withFileTypes: true })) {
33690
32937
  if (entry.name === ".git" || /[\r\n\0]/u.test(entry.name)) continue;
33691
- const absolutePath = join8(directory, entry.name);
32938
+ const absolutePath = join7(directory, entry.name);
33692
32939
  let isDirectory = entry.isDirectory();
33693
32940
  let isFile = entry.isFile();
33694
32941
  if (!isDirectory && !isFile && entry.isSymbolicLink()) {
@@ -33811,7 +33058,7 @@ function createFileReferenceCompletionSource(options) {
33811
33058
  // src/interactive/slash-autocomplete.ts
33812
33059
  var ARGUMENT_HINT_BUDGET = 44;
33813
33060
  var COMPLETION_DESCRIPTION_BUDGET = 80;
33814
- function stubCompletionSources() {
33061
+ function emptyCompletionSources() {
33815
33062
  const sources = {};
33816
33063
  for (const slot of COMPLETION_SLOT_NAMES) sources[slot] = async () => [];
33817
33064
  return sources;
@@ -33997,7 +33244,7 @@ var ClioAutocompleteProvider = class {
33997
33244
  constructor(basePath, fdPath, sources, fileReferenceSource) {
33998
33245
  this.files = new CombinedAutocompleteProvider([], basePath, fdPath);
33999
33246
  this.fileReferences = fileReferenceSource ?? createFileReferenceCompletionSource({ basePath });
34000
- this.sourceBySlot = { ...stubCompletionSources(), ...sources };
33247
+ this.sourceBySlot = { ...emptyCompletionSources(), ...sources };
34001
33248
  }
34002
33249
  async getSuggestions(lines, cursorLine, cursorCol, options) {
34003
33250
  const generation = ++this.generation;
@@ -34234,8 +33481,8 @@ function processAutoPacingAllowed(backpressureObserved, env = process.env) {
34234
33481
 
34235
33482
  // src/interactive/welcome-dashboard.ts
34236
33483
  init_esm_shims();
34237
- import { existsSync as existsSync8, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
34238
- import { basename as basename4, join as join9 } from "node:path";
33484
+ import { existsSync as existsSync7, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
33485
+ import { basename as basename4, join as join8 } from "node:path";
34239
33486
  function activeStatus(status) {
34240
33487
  return status.available && status.health.status !== "down";
34241
33488
  }
@@ -34301,14 +33548,14 @@ function wikiFactsFrom(cwd, staleness) {
34301
33548
  };
34302
33549
  }
34303
33550
  function handoffFacts(cwd) {
34304
- const handoffsDir = join9(cwd, ".clio-coder", "handoffs");
34305
- if (!existsSync8(handoffsDir)) return { handoffCount: 0, handoffFreshness: "none" };
33551
+ const handoffsDir = join8(cwd, ".clio-coder", "handoffs");
33552
+ if (!existsSync7(handoffsDir)) return { handoffCount: 0, handoffFreshness: "none" };
34306
33553
  try {
34307
33554
  const files = readdirSync2(handoffsDir).filter((f) => f.startsWith("handoff-") && f.endsWith(".md"));
34308
33555
  if (files.length === 0) return { handoffCount: 0, handoffFreshness: "none" };
34309
33556
  let newestMtime = 0;
34310
33557
  for (const file of files) {
34311
- const mtime = statSync3(join9(handoffsDir, file)).mtimeMs;
33558
+ const mtime = statSync3(join8(handoffsDir, file)).mtimeMs;
34312
33559
  if (mtime > newestMtime) newestMtime = mtime;
34313
33560
  }
34314
33561
  return {
@@ -34346,7 +33593,7 @@ async function readWelcomeRepositoryFactsAsync(cwd) {
34346
33593
  function placeholderRepositoryFacts(cwd) {
34347
33594
  return {
34348
33595
  clioMdStatus: clioMdStatusFor(cwd),
34349
- hasCodewiki: existsSync8(join9(cwd, ".clio-coder", "codewiki.json")),
33596
+ hasCodewiki: existsSync7(join8(cwd, ".clio-coder", "codewiki.json")),
34350
33597
  codewikiCount: 0,
34351
33598
  wikiPageCount: 0,
34352
33599
  wikiStatus: NO_WIKI_STATUS,
@@ -34598,7 +33845,7 @@ function willEnterSteerActiveWork(deps, text) {
34598
33845
  function createInteractivePresentation(deps) {
34599
33846
  const factories = { ...DEFAULT_FACTORIES, ...deps.factories };
34600
33847
  const getCwd = deps.getCwd ?? (() => process.cwd());
34601
- const now = deps.now ?? performance6.now.bind(performance6);
33848
+ const now = deps.now ?? performance5.now.bind(performance5);
34602
33849
  const requestRender = () => deps.tui.requestRender();
34603
33850
  const settings = deps.getSettings?.() ?? structuredClone(DEFAULT_SETTINGS);
34604
33851
  const keybindings = deps.keybindings ?? factories.createKeybindings(settings);
@@ -34636,11 +33883,11 @@ function createInteractivePresentation(deps) {
34636
33883
  bus: deps.bus,
34637
33884
  ...deps.getSettings ? { getSettings: deps.getSettings } : {}
34638
33885
  });
34639
- const dispatchBoardStore = factories.createDispatchBoardStore(
34640
- deps.bus,
34641
- () => deps.dispatch.snapshot(),
34642
- (runId) => readWorkerReceiptFacts(runId)
34643
- );
33886
+ const unbindRunReaders = deps.observability.bindRunReaders({
33887
+ dispatchSnapshot: () => deps.dispatch.snapshot(),
33888
+ readReceipt: (runId) => readWorkerReceiptFacts(runId)
33889
+ });
33890
+ const dispatchBoardStore = factories.createDispatchBoardStore(deps.observability);
34644
33891
  const contextActivityStore = factories.createContextActivityStore(deps.bus);
34645
33892
  const footerToolCounts = /* @__PURE__ */ new Map();
34646
33893
  const footerActiveTools = /* @__PURE__ */ new Set();
@@ -34797,10 +34044,47 @@ function createInteractivePresentation(deps) {
34797
34044
  const editor = deps.editor ?? factories.createEditor(deps.tui, editorChrome);
34798
34045
  editor.focused = true;
34799
34046
  const autocomplete = factories.createAutocomplete({
34800
- listSkills: () => ({
34801
- installed: deps.resources?.skills(getCwd()).items ?? [],
34802
- marketplace: getMarketplaceSkills()
34803
- })
34047
+ completionSources: {
34048
+ agents: async () => (deps.agents?.listSpecs() ?? []).filter(isUserVisibleAgent).map((agent) => ({
34049
+ id: agent.id,
34050
+ value: agent.id,
34051
+ label: agent.id,
34052
+ description: agent.description
34053
+ })),
34054
+ targets: async () => deps.providers.list().map(({ target, reason }) => ({
34055
+ id: target.id,
34056
+ value: target.id,
34057
+ label: target.id,
34058
+ description: reason
34059
+ })),
34060
+ models: async () => deps.providers.list().flatMap(
34061
+ ({ target, discoveredModels, discoveredModelLabels }) => [
34062
+ .../* @__PURE__ */ new Set([
34063
+ ...target.defaultModel ? [target.defaultModel] : [],
34064
+ ...target.wireModels ?? [],
34065
+ ...discoveredModels
34066
+ ])
34067
+ ].map((model) => ({
34068
+ id: `${target.id}/${model}`,
34069
+ value: model,
34070
+ label: discoveredModelLabels?.[model] ?? model,
34071
+ description: target.id
34072
+ }))
34073
+ ),
34074
+ skills: async () => (deps.resources?.skills(getCwd()).items ?? []).map((skill) => ({
34075
+ id: skill.name,
34076
+ value: skill.name,
34077
+ label: skill.name,
34078
+ description: skill.description
34079
+ })),
34080
+ tasks: async () => (deps.getTaskBoard?.()?.tasks ?? []).map((task) => ({
34081
+ id: task.id,
34082
+ value: task.id,
34083
+ label: task.title,
34084
+ description: task.status
34085
+ }))
34086
+ // Other slots remain empty when this presentation has no read-only catalog for them.
34087
+ }
34804
34088
  });
34805
34089
  editor.setAutocompleteProvider(autocomplete);
34806
34090
  const dispatchBoard = factories.createDispatchBoardView(
@@ -34891,6 +34175,7 @@ function createInteractivePresentation(deps) {
34891
34175
  unsubscribeObservability();
34892
34176
  contextActivityStore.unsubscribe();
34893
34177
  dispatchBoardStore.unsubscribe();
34178
+ unbindRunReaders();
34894
34179
  };
34895
34180
  const disposeStatus = () => {
34896
34181
  if (statusDisposed) return;
@@ -34957,7 +34242,7 @@ function createInteractivePresentation(deps) {
34957
34242
  // src/interactive/interactive-slash-runtime.ts
34958
34243
  init_esm_shims();
34959
34244
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
34960
- import { join as join10, resolve as resolve6 } from "node:path";
34245
+ import { join as join9, resolve as resolve6 } from "node:path";
34961
34246
 
34962
34247
  // src/interactive/context-recall-command.ts
34963
34248
  init_esm_shims();
@@ -35466,7 +34751,7 @@ function createInteractiveSlashRuntime(deps) {
35466
34751
  openDecisions: deps.openDecisions,
35467
34752
  ...userTasks ? {
35468
34753
  userTasks: {
35469
- add: (title) => userTasks.add(title),
34754
+ add: (title, acceptance) => userTasks.add(title, void 0, acceptance),
35470
34755
  hand: (id) => userTasks.hand(id, deps.chat.getSessionId() ?? void 0),
35471
34756
  done: (id) => userTasks.done(id),
35472
34757
  drop: (id) => userTasks.drop(id)
@@ -35609,7 +34894,7 @@ function createInteractiveSlashRuntime(deps) {
35609
34894
  const requestedPath = pathArg?.trim() ?? "";
35610
34895
  const markdown = requestedPath.toLowerCase().endsWith(".md");
35611
34896
  const target = resolve6(
35612
- requestedPath.length > 0 ? requestedPath : join10(".clio-coder", "exports", `${sessionId}-${date}.html`)
34897
+ requestedPath.length > 0 ? requestedPath : join9(".clio-coder", "exports", `${sessionId}-${date}.html`)
35613
34898
  );
35614
34899
  mkdirSync2(resolve6(target, ".."), { recursive: true });
35615
34900
  if (markdown) {
@@ -36235,6 +35520,7 @@ async function createInteractiveApplication(deps) {
36235
35520
  } : {},
36236
35521
  ...deps.getSettings ? { getSettings: deps.getSettings } : {},
36237
35522
  ...deps.resources ? { resources: deps.resources } : {},
35523
+ ...deps.agents ? { agents: deps.agents } : {},
36238
35524
  ...deps.session ? { session: deps.session } : {},
36239
35525
  ...deps.getSessionId ? { getSessionId: deps.getSessionId } : {},
36240
35526
  ...deps.getTaskBoard ? { getTaskBoard: deps.getTaskBoard } : {},
@@ -37160,8 +36446,8 @@ import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve8 }
37160
36446
 
37161
36447
  // src/tools/dispatch-scout-admission.ts
37162
36448
  init_esm_shims();
37163
- import { existsSync as existsSync9, readFileSync as readFileSync9 } from "node:fs";
37164
- import { join as join11 } from "node:path";
36449
+ import { existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs";
36450
+ import { join as join10 } from "node:path";
37165
36451
  var MAX_SCOUT_PLAN_DEADLINE_MS = 36e5;
37166
36452
  function record(value) {
37167
36453
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -37208,11 +36494,11 @@ function validateScoutSource(receipt, envelope, agentSpecs) {
37208
36494
  function loadVerifiedScoutSource(input) {
37209
36495
  const envelope = input.dispatch.getRun(input.ref.runId);
37210
36496
  if (envelope === null) throw new Error(`dispatch: Scout source run '${input.ref.runId}' is unavailable`);
37211
- const receiptPath = envelope.receiptPath ?? join11(clioStateDir(), "receipts", `${input.ref.runId}.json`);
37212
- if (!existsSync9(receiptPath)) throw new Error(`dispatch: Scout source receipt '${input.ref.runId}' is unavailable`);
36497
+ const receiptPath = envelope.receiptPath ?? join10(clioStateDir(), "receipts", `${input.ref.runId}.json`);
36498
+ if (!existsSync8(receiptPath)) throw new Error(`dispatch: Scout source receipt '${input.ref.runId}' is unavailable`);
37213
36499
  let receipt;
37214
36500
  try {
37215
- receipt = JSON.parse(readFileSync9(receiptPath, "utf8"));
36501
+ receipt = JSON.parse(readFileSync8(receiptPath, "utf8"));
37216
36502
  } catch (error) {
37217
36503
  throw new Error(
37218
36504
  `dispatch: Scout source receipt is unreadable: ${error instanceof Error ? error.message : String(error)}`
@@ -37410,7 +36696,7 @@ function councilSettingsFromArgs(args, deps) {
37410
36696
  if (!Array.isArray(args.members)) return { ok: false, message: "council_members_out_of_range" };
37411
36697
  members = [];
37412
36698
  for (const raw of args.members) {
37413
- if (!isRecord10(raw)) return { ok: false, message: "council_members_out_of_range" };
36699
+ if (!isRecord9(raw)) return { ok: false, message: "council_members_out_of_range" };
37414
36700
  const label = stringArg(raw, "label");
37415
36701
  const target = stringArg(raw, "target");
37416
36702
  if (label === void 0 || target === void 0 || !COUNCIL_LABEL.test(label)) {
@@ -37440,7 +36726,7 @@ function councilSettingsFromArgs(args, deps) {
37440
36726
  if (!Number.isInteger(rounds) || Number(rounds) < 1 || Number(rounds) > 3) {
37441
36727
  return { ok: false, message: "dispatch: rounds must be an integer 1..3" };
37442
36728
  }
37443
- const judge = isRecord10(args.judge) ? Object.fromEntries(
36729
+ const judge = isRecord9(args.judge) ? Object.fromEntries(
37444
36730
  ["agent", "model", "target", "node"].flatMap((key) => {
37445
36731
  const value = stringArg(args.judge, key);
37446
36732
  return value === void 0 ? [] : [[key, value]];
@@ -37448,13 +36734,13 @@ function councilSettingsFromArgs(args, deps) {
37448
36734
  ) : void 0;
37449
36735
  return { ok: true, council: { members, synthesis, rounds: Number(rounds), ...judge ? { judge } : {} } };
37450
36736
  }
37451
- function isRecord10(value) {
36737
+ function isRecord9(value) {
37452
36738
  return typeof value === "object" && value !== null && !Array.isArray(value);
37453
36739
  }
37454
36740
  function reviewSettingsFromArgs(args) {
37455
36741
  const raw = args.review;
37456
36742
  if (raw === void 0 || raw === false) return { ok: true, review: void 0 };
37457
- const record2 = raw === true ? {} : isRecord10(raw) ? raw : null;
36743
+ const record2 = raw === true ? {} : isRecord9(raw) ? raw : null;
37458
36744
  if (record2 === null) return { ok: false, message: "dispatch: review must be true or an options object" };
37459
36745
  const review = { maxCycles: REVIEW_MAX_CYCLES_DEFAULT };
37460
36746
  const reviewer = stringArg(record2, "reviewer", "agent");
@@ -37485,10 +36771,10 @@ function competeSettingsFromArgs(args) {
37485
36771
  }
37486
36772
  candidates = args.candidates;
37487
36773
  }
37488
- if (args.judge !== void 0 && !isRecord10(args.judge)) {
36774
+ if (args.judge !== void 0 && !isRecord9(args.judge)) {
37489
36775
  return { ok: false, message: "dispatch: judge must be an options object" };
37490
36776
  }
37491
- if (!isRecord10(args.judge)) return { ok: true, compete: { candidates } };
36777
+ if (!isRecord9(args.judge)) return { ok: true, compete: { candidates } };
37492
36778
  const judge = {};
37493
36779
  for (const key of ["agent", "model", "target", "node"]) {
37494
36780
  const value = stringArg(args.judge, key);
@@ -37534,7 +36820,24 @@ function createDispatchAdmissionController(deps) {
37534
36820
  check: entry.check,
37535
36821
  argv: [...check.command],
37536
36822
  cwd: resolve8(process.cwd(), check.cwd),
37537
- timeoutMs: entry.timeoutMs
36823
+ timeoutMs: entry.timeoutMs,
36824
+ // A judged check seals its kind and absolute file paths here, so
36825
+ // host verification judges against what the catalog declared at
36826
+ // admission rather than whatever the file says at run time.
36827
+ ...check.kind !== "command" ? { kind: check.kind } : {},
36828
+ ...check.numeric !== void 0 ? {
36829
+ numeric: {
36830
+ reference: resolve8(process.cwd(), check.numeric.reference),
36831
+ tolerance: { ...check.numeric.tolerance }
36832
+ }
36833
+ } : {},
36834
+ ...check.perf !== void 0 ? {
36835
+ perf: {
36836
+ ...check.perf.budget !== void 0 ? { budget: structuredClone(check.perf.budget) } : {},
36837
+ ...check.perf.baseline !== void 0 ? { baseline: resolve8(process.cwd(), check.perf.baseline) } : {},
36838
+ ...check.perf.tolerance !== void 0 ? { tolerance: { ...check.perf.tolerance } } : {}
36839
+ }
36840
+ } : {}
37538
36841
  };
37539
36842
  })
37540
36843
  };
@@ -37713,7 +37016,7 @@ function createDispatchAdmissionController(deps) {
37713
37016
  }
37714
37017
  }
37715
37018
  if (args.apply_winner !== void 0) {
37716
- if (!isRecord10(args.apply_winner)) {
37019
+ if (!isRecord9(args.apply_winner)) {
37717
37020
  return shapeRejection(args, "dispatch: apply_winner must be an options object");
37718
37021
  }
37719
37022
  const branch = stringArg(args.apply_winner, "branch");
@@ -38285,7 +37588,7 @@ function createDispatchTool(inputDeps, surfaceOptions = {}) {
38285
37588
  const admission = createDispatchAdmissionController(deps);
38286
37589
  let runnerPromise = null;
38287
37590
  const loadRunner = () => {
38288
- runnerPromise ??= (surfaceOptions.loadRunner ?? (() => import("./dispatch-runner-5AHT53RF.js")))();
37591
+ runnerPromise ??= (surfaceOptions.loadRunner ?? (() => import("./dispatch-runner-RJ5I2F2O.js")))();
38289
37592
  return runnerPromise;
38290
37593
  };
38291
37594
  return {
@@ -38340,6 +37643,7 @@ function registerAllTools(registry, deps = {}) {
38340
37643
  ...deps.getWorkerRosters ? { getWorkerRosters: deps.getWorkerRosters } : {},
38341
37644
  ...deps.getDispatchSchemaComposition ? { getSchemaComposition: deps.getDispatchSchemaComposition } : {},
38342
37645
  ...deps.dispatchBackground ? { background: deps.dispatchBackground } : {},
37646
+ ...deps.getDecisionBoard ? { getDecisionBoard: deps.getDecisionBoard } : {},
38343
37647
  ...deps.competeMuxWorktrees ? { competeWorktrees: { mux: deps.competeMuxWorktrees } } : {}
38344
37648
  };
38345
37649
  registry.register({
@@ -38352,7 +37656,7 @@ function registerAllTools(registry, deps = {}) {
38352
37656
  ...builtin(
38353
37657
  lazyTool(
38354
37658
  monitorToolSurface,
38355
- async () => (await import("./monitor-HKU57TYQ.js")).createMonitorTool({ dispatch, runEvents: dispatchRunEvents })
37659
+ async () => (await import("./monitor-CPNIUULB.js")).createMonitorTool({ dispatch, runEvents: dispatchRunEvents })
38356
37660
  ),
38357
37661
  {
38358
37662
  path: "src/tools/monitor.ts",
@@ -38362,7 +37666,7 @@ function registerAllTools(registry, deps = {}) {
38362
37666
  });
38363
37667
  registry.register({
38364
37668
  ...builtin(
38365
- lazyTool(steerToolSurface, async () => (await import("./steer-2LQOMCPB.js")).createSteerTool({ dispatch })),
37669
+ lazyTool(steerToolSurface, async () => (await import("./steer-XA25PSCS.js")).createSteerTool({ dispatch })),
38366
37670
  {
38367
37671
  path: "src/tools/steer.ts",
38368
37672
  scope: "core"
@@ -38374,7 +37678,7 @@ function registerAllTools(registry, deps = {}) {
38374
37678
  const panes = deps.panes;
38375
37679
  registry.register({
38376
37680
  ...builtin(
38377
- lazyTool(panesToolSurface, async () => (await import("./panes-DN2SSFOH.js")).createPanesTool({ panes })),
37681
+ lazyTool(panesToolSurface, async () => (await import("./panes-BOHAEGYC.js")).createPanesTool({ panes })),
38378
37682
  { path: "src/tools/panes.ts", scope: "core" }
38379
37683
  )
38380
37684
  });
@@ -38939,7 +38243,7 @@ async function runCompactionFlow(session, settings, providers, instructions, tri
38939
38243
  }
38940
38244
  function compactionCheckpointWasWritten(path2, turnId) {
38941
38245
  let malformed = false;
38942
- for (const line of readFileSync10(path2, "utf8").split("\n")) {
38246
+ for (const line of readFileSync9(path2, "utf8").split("\n")) {
38943
38247
  if (line.trim().length === 0) continue;
38944
38248
  try {
38945
38249
  const entry = JSON.parse(line);
@@ -39056,7 +38360,7 @@ async function bootOrchestrator(options = {}) {
39056
38360
  let protectedArtifactStateForDispatch = null;
39057
38361
  const muxInteractive = !options.headless && options.acp === void 0 && process.env.CLIO_CODER_INTERACTIVE === "1";
39058
38362
  const muxEnablement = resolvePanesEnablement(options.panes, options.startupSettings?.interface.panes.enabled);
39059
- const withPanes = muxInteractive && muxEnablement !== "off" ? await import("./with-panes-4GCGSL7J.js") : null;
38363
+ const withPanes = muxInteractive && muxEnablement !== "off" ? await import("./with-panes-BDQEWBRT.js") : null;
39060
38364
  const result = await loadDomains(
39061
38365
  [
39062
38366
  options.startupSettings ? createConfigDomainModule(options.startupSettings) : ConfigDomainModule,
@@ -39370,7 +38674,7 @@ async function bootOrchestrator(options = {}) {
39370
38674
  if (contextDomain) {
39371
38675
  middleware.registerHook(createFileMutationObserver(({ paths }) => contextDomain.noteFileChanges(paths)));
39372
38676
  }
39373
- const hookReceiptLog = createHookReceiptLog({ persistPath: join12(clioStateDir(), "hook-receipts.json") });
38677
+ const hookReceiptLog = createHookReceiptLog({ persistPath: join11(clioStateDir(), "hook-receipts.json") });
39374
38678
  const extensionReload = createExtensionReloadCoordinator({
39375
38679
  extensions,
39376
38680
  middleware,
@@ -39405,6 +38709,7 @@ async function bootOrchestrator(options = {}) {
39405
38709
  if (resources) {
39406
38710
  middleware.registerHook(
39407
38711
  createMarketplaceOfferRegistration({
38712
+ interactive,
39408
38713
  listInstalledSkillNames: () => resources.skills(process.cwd()).items.map((skill) => skill.name),
39409
38714
  listMarketplaceEntries: () => discoverMarketplaceSkills({ cwd: process.cwd() }).skills,
39410
38715
  installEntry: (entry, scope) => {
@@ -39468,6 +38773,7 @@ async function bootOrchestrator(options = {}) {
39468
38773
  session.appendEntry(entry);
39469
38774
  }
39470
38775
  });
38776
+ setCommitDecisionRefsProvider(() => activeDecisionRefs(decisionBoard.snapshot()));
39471
38777
  bus.on(BusChannels.SessionTurnSwitched, () => {
39472
38778
  taskBoard.invalidate();
39473
38779
  taskBoard.snapshot();
@@ -39503,6 +38809,8 @@ async function bootOrchestrator(options = {}) {
39503
38809
  onContextRecalled: (payload) => bus.emit(BusChannels.ContextRecalled, payload)
39504
38810
  } : {},
39505
38811
  taskBoard,
38812
+ decisionBoard,
38813
+ getDecisionBoard: () => decisionBoard.snapshot(),
39506
38814
  userTasks,
39507
38815
  dispatch,
39508
38816
  bus,
@@ -39725,6 +39033,7 @@ async function bootOrchestrator(options = {}) {
39725
39033
  return meta ? readRecentSessionEntriesForContract(meta.id) : null;
39726
39034
  },
39727
39035
  resolveRigor: () => resolveRigor({ cwd: process.cwd(), override: parseRigorOverride(process.env.CLIO_CODER_RIGOR) }),
39036
+ readActiveAcceptance: (window) => activeUserTaskAcceptance(userTasks.snapshot(), taskBoard.snapshot(), session.current()?.id ?? null, window),
39728
39037
  recordDecision: (record2) => safety.audit.recordCompletionContract?.(record2)
39729
39038
  })
39730
39039
  );
@@ -40178,4 +39487,4 @@ export {
40178
39487
  createBackgroundMemoryRouting,
40179
39488
  createProductionAutoCompact
40180
39489
  };
40181
- //# sourceMappingURL=orchestrator-VDFAEFAI.js.map
39490
+ //# sourceMappingURL=orchestrator-J4BSH4WQ.js.map