@iowarp/clio-coder 0.4.7 → 0.4.9

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 (675) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +111 -0
  3. package/CONTRIBUTING.md +83 -74
  4. package/README.md +69 -47
  5. package/dist/{acp-W3Y3TRHD.js → acp-ZWZCPS2A.js} +15 -15
  6. package/dist/{agents-J4ICNLQ3.js → agents-LYSOWZUE.js} +61 -59
  7. package/dist/assets/codewiki.json +1 -1
  8. package/dist/assets/web-notices/@hono__node-server-LICENSE +21 -0
  9. package/dist/assets/web-notices/hono-LICENSE +21 -0
  10. package/dist/{auth-X2UJUMOC.js → auth-WBQGKWQ5.js} +27 -27
  11. package/dist/background-BUMOBAQN.js +37 -0
  12. package/dist/{builtins-XLXWWSRF.js → builtins-ODRJOEDI.js} +7 -7
  13. package/dist/{chunk-C3G5PNUO.js → chunk-2DRRZ57Q.js} +36 -27
  14. package/dist/chunk-2JBZYUPY.js +105 -0
  15. package/dist/chunk-2KUBKL63.js +336 -0
  16. package/dist/chunk-2VBWFXYE.js +198 -0
  17. package/dist/{chunk-XZ6UFQ52.js → chunk-2X2R3UTH.js} +25 -15
  18. package/dist/{chunk-M6Z2V6YU.js → chunk-37LW32LZ.js} +5 -5
  19. package/dist/{chunk-6LRLOJHQ.js → chunk-3AND2EFU.js} +11 -62
  20. package/dist/{chunk-FQOOGXBH.js → chunk-3RDHGNU7.js} +101 -33
  21. package/dist/{chunk-D2T66PDV.js → chunk-3SUDBGEI.js} +41 -208
  22. package/dist/{chunk-5AJPUR72.js → chunk-3TQN67I2.js} +9 -9
  23. package/dist/{chunk-LBFQMYS3.js → chunk-3U4BL2EV.js} +5 -3
  24. package/dist/{chunk-UFYNOQK4.js → chunk-3UQADNG2.js} +7 -7
  25. package/dist/{chunk-V4ZKOKRB.js → chunk-434LRQ6Z.js} +61 -53
  26. package/dist/{chunk-NO7J45X6.js → chunk-4ATBOFRP.js} +713 -218
  27. package/dist/{chunk-ECOMVOHP.js → chunk-4DNL43EZ.js} +3 -3
  28. package/dist/{chunk-WT5TRMO4.js → chunk-4HFJKRGZ.js} +255 -82
  29. package/dist/{chunk-5A6XR3RJ.js → chunk-555E2WVV.js} +16 -2
  30. package/dist/{chunk-WURGVOZJ.js → chunk-5RTEFNBP.js} +18 -14
  31. package/dist/{config-YXARKGTX.js → chunk-64XJW7NT.js} +24 -268
  32. package/dist/{chunk-24S3DN22.js → chunk-6TKOFFGE.js} +4 -4
  33. package/dist/{chunk-YKRJTYNP.js → chunk-6UJ7RDI7.js} +4 -4
  34. package/dist/{chunk-MZNWZUJM.js → chunk-7FBCRWVT.js} +288 -288
  35. package/dist/{chunk-UA6W4XFJ.js → chunk-7JSOSVLP.js} +2 -2
  36. package/dist/chunk-7N3OLLSL.js +637 -0
  37. package/dist/{chunk-KKEYGFX4.js → chunk-7QQRPB2E.js} +11 -11
  38. package/dist/{chunk-N37QC5FV.js → chunk-A6DULIMH.js} +21 -9
  39. package/dist/{fleet-decisions-S3PTZV2D.js → chunk-AB3QXXBC.js} +5 -41
  40. package/dist/chunk-ACCECAH4.js +49 -0
  41. package/dist/{chunk-CP3HIR5H.js → chunk-AM6CEP2K.js} +20 -19
  42. package/dist/chunk-AUHVBIDW.js +19 -0
  43. package/dist/{chunk-BQQ5MXUC.js → chunk-AY4XE6GN.js} +19 -13
  44. package/dist/{chunk-ISNCCX42.js → chunk-BBA2TAWV.js} +10 -9
  45. package/dist/chunk-BFPHMSK7.js +169 -0
  46. package/dist/{chunk-LVFANMOH.js → chunk-BHJMMCXS.js} +4 -4
  47. package/dist/{chunk-DO7M3LSX.js → chunk-BMNVVKEW.js} +40 -93
  48. package/dist/{chunk-VTYHHQ57.js → chunk-CTGZCEI6.js} +2 -2
  49. package/dist/{chunk-RTLNFZMD.js → chunk-DIAJYJYG.js} +3 -3
  50. package/dist/chunk-EHZRAB4U.js +63 -0
  51. package/dist/{chunk-KS7ETA3P.js → chunk-EM2DIQAJ.js} +3 -3
  52. package/dist/{chunk-MNQN3X6Y.js → chunk-ETF4ROKH.js} +5 -5
  53. package/dist/{chunk-WN552PKN.js → chunk-F2YM3JY4.js} +744 -1134
  54. package/dist/{chunk-7EEGBKV4.js → chunk-FEBQWHJT.js} +24 -19
  55. package/dist/{chunk-4QKAITQT.js → chunk-FPS4R2RN.js} +74 -10
  56. package/dist/chunk-G5R53COU.js +68 -0
  57. package/dist/chunk-GHXGMFQ5.js +40 -0
  58. package/dist/{chunk-GFQ7P2UF.js → chunk-GJDRMBDI.js} +10 -10
  59. package/dist/{chunk-LZBMXNLP.js → chunk-GM4TY6VN.js} +43 -6
  60. package/dist/{chunk-NCCQ6DVS.js → chunk-GREYLTZ5.js} +8 -8
  61. package/dist/{chunk-HOX4YZ2K.js → chunk-H2WSCZZT.js} +19 -3
  62. package/dist/{chunk-3LXJOICS.js → chunk-H6IUCY6Q.js} +2 -2
  63. package/dist/{chunk-BO4XV5VX.js → chunk-H72DCH3E.js} +95 -206
  64. package/dist/{chunk-SEDI5K5B.js → chunk-H7TXJR23.js} +20 -20
  65. package/dist/chunk-HBJQQTKM.js +40 -0
  66. package/dist/chunk-HCVKSGNZ.js +990 -0
  67. package/dist/chunk-HVCAY2FH.js +67 -0
  68. package/dist/{chunk-34XHRVKG.js → chunk-I47EJPYL.js} +3 -3
  69. package/dist/{chunk-4N2RZ4TO.js → chunk-IALGWTLO.js} +3 -3
  70. package/dist/{chunk-IQCNVLO6.js → chunk-IALZJE37.js} +10 -7
  71. package/dist/{chunk-DLIYANB7.js → chunk-IC7JXLOM.js} +16 -11
  72. package/dist/{chunk-G4LGUTOE.js → chunk-IOSVTTCD.js} +5 -5
  73. package/dist/{chunk-DBREN25X.js → chunk-IPTPMLA6.js} +8 -3
  74. package/dist/{chunk-V552WL53.js → chunk-IZZI3SKQ.js} +3 -67
  75. package/dist/{chunk-TN5FW4XY.js → chunk-JIYWMQZ5.js} +12 -9
  76. package/dist/{chunk-T7QQBNLH.js → chunk-JKU34ACI.js} +10 -8
  77. package/dist/chunk-JOBN2YQQ.js +176 -0
  78. package/dist/chunk-JOL2QRLE.js +152 -0
  79. package/dist/{chunk-GXIWHXDB.js → chunk-JTR3VSV3.js} +3 -3
  80. package/dist/{chunk-T334FW2H.js → chunk-JU6MAMRJ.js} +7 -7
  81. package/dist/chunk-JURMQWVJ.js +15 -0
  82. package/dist/{chunk-CULVKYTK.js → chunk-K3XN4LZ4.js} +5 -5
  83. package/dist/{chunk-3T4DXWP6.js → chunk-KIVFXGBM.js} +27 -7
  84. package/dist/chunk-KKRXONXG.js +43 -0
  85. package/dist/{chunk-YPRSNUTC.js → chunk-KOAHT3N2.js} +2 -2
  86. package/dist/chunk-KP5BPXR3.js +73 -0
  87. package/dist/{chunk-UA3W4FGC.js → chunk-KRJQG47M.js} +6 -6
  88. package/dist/{chunk-GI5RRMAH.js → chunk-KW6OJ7IY.js} +19 -21
  89. package/dist/{chunk-A46ILRS2.js → chunk-L3NBWLSN.js} +4 -4
  90. package/dist/{chunk-MZHXENL7.js → chunk-L4RUTLRL.js} +8 -8
  91. package/dist/{chunk-P5SC4DLJ.js → chunk-LGTVWPRN.js} +2 -2
  92. package/dist/{chunk-65BGHOUR.js → chunk-LSQW6KZO.js} +5 -5
  93. package/dist/{chunk-TZHN5ITX.js → chunk-LWJYOHT3.js} +8 -8
  94. package/dist/{chunk-U3TPUXOQ.js → chunk-M6YLF66Z.js} +74 -40
  95. package/dist/chunk-MJ4QEJVT.js +185 -0
  96. package/dist/{chunk-T4TY5GG3.js → chunk-MO65K5CH.js} +5 -5
  97. package/dist/{chunk-TZ6UVP2H.js → chunk-MTOZEQHL.js} +8 -8
  98. package/dist/chunk-MZDPF35R.js +45 -0
  99. package/dist/{chunk-P4DL2LM5.js → chunk-MZKYVIWW.js} +8 -119
  100. package/dist/{chunk-KAFMW7WM.js → chunk-NBPA5QM6.js} +2 -2
  101. package/dist/{chunk-EUEXGXXR.js → chunk-NMBEW4PP.js} +5 -5
  102. package/dist/{chunk-SELG4SUR.js → chunk-NPLLK3HO.js} +72 -89
  103. package/dist/{chunk-VCRVEDUC.js → chunk-NSYGPIVW.js} +5 -5
  104. package/dist/{context-7HJEWTTP.js → chunk-NXTV5OI5.js} +36 -90
  105. package/dist/{chunk-IMOD2YPV.js → chunk-NYDG4QP4.js} +9 -19
  106. package/dist/{chunk-6CA2BHOR.js → chunk-OA2GDACN.js} +5 -5
  107. package/dist/{chunk-A67NR5AT.js → chunk-PJI57EC6.js} +14 -11
  108. package/dist/{chunk-IJMW64DX.js → chunk-PJJBUGMR.js} +50 -50
  109. package/dist/{chunk-CPXGJI2A.js → chunk-PNJE7JPS.js} +20 -5
  110. package/dist/chunk-PP23PZEV.js +1347 -0
  111. package/dist/chunk-PPIFDSBK.js +409 -0
  112. package/dist/{chunk-T52TPHYC.js → chunk-PTFISXQO.js} +8 -7
  113. package/dist/{chunk-C6GEXX4L.js → chunk-QB33Z5S7.js} +5 -5
  114. package/dist/{chunk-VMATUZB6.js → chunk-QGNII5VC.js} +10 -10
  115. package/dist/{chunk-TLTGZTXI.js → chunk-QI72X67S.js} +104 -27
  116. package/dist/chunk-QKHZZFKH.js +98 -0
  117. package/dist/{chunk-PFLOULP3.js → chunk-RDKX2PME.js} +4 -4
  118. package/dist/{chunk-B5ZTR6KZ.js → chunk-RL7LJYN4.js} +1 -1
  119. package/dist/chunk-RPMNIFRY.js +65 -0
  120. package/dist/{chunk-L3Z5ANCV.js → chunk-RQROVOV3.js} +13 -11
  121. package/dist/{chunk-6YHPAAZR.js → chunk-S34A7BSP.js} +3 -3
  122. package/dist/{chunk-5ZSZEYJK.js → chunk-SJETVJHX.js} +2 -2
  123. package/dist/{chunk-77CZRFTE.js → chunk-SJMNU4ZS.js} +2 -2
  124. package/dist/chunk-SLLG2G44.js +85 -0
  125. package/dist/{chunk-GVZFCJHE.js → chunk-SQAZN2V3.js} +48 -22
  126. package/dist/{chunk-2O2LVQQK.js → chunk-SQBT46OF.js} +2 -2
  127. package/dist/{chunk-ZGIGW4ZG.js → chunk-TCUOGIL2.js} +5 -5
  128. package/dist/{chunk-DACXIVVF.js → chunk-TIWPKCVO.js} +5 -5
  129. package/dist/{chunk-5CMARGPF.js → chunk-UIU7MGZ3.js} +11 -2
  130. package/dist/chunk-USBBEKHW.js +177 -0
  131. package/dist/{chunk-WLHX3MM5.js → chunk-V4XJWDHR.js} +21 -11
  132. package/dist/{chunk-MBJO5VNZ.js → chunk-VPWGADBG.js} +33 -33
  133. package/dist/{chunk-UUQ5G6EZ.js → chunk-VWFCAK34.js} +6 -6
  134. package/dist/{chunk-6CB2IL4N.js → chunk-W5RM7YAH.js} +1 -1
  135. package/dist/{chunk-4MFBBY2Z.js → chunk-W72LLZAV.js} +3 -3
  136. package/dist/{chunk-4UHVS5T7.js → chunk-WGRDABW7.js} +8 -8
  137. package/dist/{chunk-XR3XJN2M.js → chunk-WWRV5RJI.js} +4 -4
  138. package/dist/{chunk-24TOGHPO.js → chunk-X6FLVUM5.js} +4 -4
  139. package/dist/{chunk-6YA46L5A.js → chunk-XFLSL7BT.js} +2 -2
  140. package/dist/{chunk-QKWL7SYE.js → chunk-XJZEDCNT.js} +50 -39
  141. package/dist/{chunk-UWD3JD5X.js → chunk-XLLEL3K7.js} +10 -10
  142. package/dist/{chunk-2GPGAE5W.js → chunk-XNIZBOFV.js} +15 -1
  143. package/dist/chunk-XNZWWDC3.js +686 -0
  144. package/dist/{chunk-WBVKKTUT.js → chunk-XRECG65F.js} +2 -2
  145. package/dist/chunk-XTQ7MEJG.js +457 -0
  146. package/dist/{chunk-GEVQNST4.js → chunk-XZWSP67B.js} +2 -2
  147. package/dist/{chunk-WB7POC6M.js → chunk-Y3M2T5RO.js} +6 -6
  148. package/dist/{chunk-RXFPB32E.js → chunk-YJCCMYYT.js} +2 -2
  149. package/dist/{chunk-EUZRMP4Y.js → chunk-YPQOPFP7.js} +20 -20
  150. package/dist/{chunk-USZA7GWL.js → chunk-YQ3GFEUY.js} +2 -2
  151. package/dist/{chunk-BAU36233.js → chunk-YQYINEJI.js} +9 -9
  152. package/dist/{chunk-CE64C5K5.js → chunk-ZF6CV4WZ.js} +1356 -235
  153. package/dist/{chunk-3XE4NRLF.js → chunk-ZKJU55MX.js} +4 -2
  154. package/dist/{chunk-IZYTT3CD.js → chunk-ZKQ63XZ5.js} +16 -39
  155. package/dist/{chunk-6TAATXXH.js → chunk-ZKVMDNAN.js} +7 -7
  156. package/dist/chunk-ZST3FRCV.js +132 -0
  157. package/dist/cli/index.js +50 -38
  158. package/dist/{clio-L2P7S2R2.js → clio-JUDCLNHC.js} +11 -11
  159. package/dist/clio-context-tools-FT672MNZ.js +136 -0
  160. package/dist/{code-nav-B5LNX4KU.js → code-nav-7OVCTP2Z.js} +39 -37
  161. package/dist/{components-63MMQKUT.js → components-OZXZMDWU.js} +11 -11
  162. package/dist/config-P3ZQVF63.js +275 -0
  163. package/dist/config-graph-GKAOBAS5.js +160 -0
  164. package/dist/{configure-LMVQJ46J.js → configure-25LRYZJG.js} +56 -55
  165. package/dist/context-72VQV7JX.js +73 -0
  166. package/dist/{context-YG2LZDYZ.js → context-COWRWXP3.js} +89 -83
  167. package/dist/{context-XSZKKFBW.js → context-WB3D474G.js} +16 -16
  168. package/dist/{context-clear-AC5NXHM2.js → context-clear-Y4LYMWC6.js} +88 -82
  169. package/dist/{context-index-KKTPRV5G.js → context-index-W6A4V7OC.js} +4 -4
  170. package/dist/{context-map-T7ROR5D5.js → context-map-DKL3QT6D.js} +3 -3
  171. package/dist/{context-working-set-F4Q4J3NS.js → context-working-set-TMZYVC7A.js} +27 -25
  172. package/dist/data-tool-KMBWKKWR.js +2987 -0
  173. package/dist/{detail-H73BEF2N.js → detail-4GLROGY5.js} +89 -83
  174. package/dist/{dispatch-runner-3RY5FSJC.js → dispatch-runner-TR3LBP5P.js} +113 -107
  175. package/dist/docs-ZK777W2G.js +101 -0
  176. package/dist/{doctor-EQYJOGUG.js → doctor-WC4OV2OB.js} +76 -73
  177. package/dist/{eval-4P7O6CCE.js → eval-FUNWJNUJ.js} +88 -73
  178. package/dist/{eval-inventory-QOYZERXJ.js → eval-inventory-CX24K2JT.js} +5 -60
  179. package/dist/evals-L73EBHSU.js +104 -0
  180. package/dist/{evidence-O76QF7TZ.js → evidence-AVJ2RTHX.js} +99 -93
  181. package/dist/{evidence-D6GUSYJW.js → evidence-P4NZOAK7.js} +88 -82
  182. package/dist/evidence-Y55WKYHH.js +246 -0
  183. package/dist/{evolve-H47BCETS.js → evolve-MAWKRYWF.js} +93 -87
  184. package/dist/{extensions-NNL3ZOCU.js → extensions-PYQH3H47.js} +14 -13
  185. package/dist/fleet-M4H2QBWT.js +268 -0
  186. package/dist/{fleet-KMNS6NOM.js → fleet-ULBXXRDR.js} +146 -138
  187. package/dist/{fleet-commands-DOWSYCBX.js → fleet-commands-7NNC4JZU.js} +18 -17
  188. package/dist/fleet-decisions-EHEY7KPU.js +52 -0
  189. package/dist/{fleet-graph-F2DE2TME.js → fleet-graph-LQ2AHZT3.js} +24 -24
  190. package/dist/{fleet-inspect-EN2Q6IVB.js → fleet-inspect-5IGBIIYZ.js} +98 -258
  191. package/dist/{fleet-preflight-FRLETDD3.js → fleet-preflight-UTTNOKMG.js} +9 -4
  192. package/dist/{fleet-validate-B2XDLS57.js → fleet-validate-YGILJKA6.js} +29 -29
  193. package/dist/{fleet-verify-4JKUWGJ7.js → fleet-verify-AUWTCDKR.js} +88 -82
  194. package/dist/{fleet-view-BHJFW26B.js → fleet-view-TGUFCY5A.js} +90 -84
  195. package/dist/{init-XAT5N5YM.js → init-GFN2Z7NF.js} +111 -104
  196. package/dist/install-6PIF6F6W.js +19 -0
  197. package/dist/{interop-FVECHFKG.js → interop-EF5JUWWK.js} +29 -29
  198. package/dist/{inventory-7KFQGLCV.js → inventory-I6VJDDYF.js} +90 -84
  199. package/dist/library-3J5IO2OJ.js +75 -0
  200. package/dist/{library-QAPAO23R.js → library-IJTOFTDS.js} +20 -19
  201. package/dist/{library-NY2XOT75.js → library-Z3KZSHPE.js} +35 -35
  202. package/dist/{library-import-5Y6MAS3R.js → library-import-IMKFLDHX.js} +29 -29
  203. package/dist/{library-inventory-JT6HWITQ.js → library-inventory-CQP5D6GU.js} +21 -21
  204. package/dist/{library-validation-EQUH25DC.js → library-validation-33UTX7AI.js} +19 -19
  205. package/dist/mcp-5FWZKUS6.js +26 -0
  206. package/dist/{memory-DYVTTCP6.js → memory-36CWN67Y.js} +93 -87
  207. package/dist/{models-MASFJ6Y2.js → models-KQ6PQJJQ.js} +57 -56
  208. package/dist/{monitor-YMP4NXJJ.js → monitor-XX6ZD6KC.js} +98 -91
  209. package/dist/{orchestrator-AFQRRTEI.js → orchestrator-SK6HDAOP.js} +1537 -832
  210. package/dist/{panes-NICTHQCV.js → panes-L27QRXUH.js} +14 -14
  211. package/dist/{panes-D3Y2KFG5.js → panes-LXZIWNOZ.js} +4 -4
  212. package/dist/{paths-PSFAUIGO.js → paths-7DJDU4P4.js} +6 -6
  213. package/dist/{preload-5Q7VXRFJ.js → preload-K2TDYI4Y.js} +88 -82
  214. package/dist/{reset-7NKZK7JN.js → reset-73VU3XNT.js} +13 -13
  215. package/dist/{resources-NILSIZAT.js → resources-3BYJYVYL.js} +24 -24
  216. package/dist/{run-BPZGEBZV.js → run-AR7PY6GW.js} +144 -136
  217. package/dist/run-script-H2KUDIII.js +41 -0
  218. package/dist/settings-3VMBMWID.js +72 -0
  219. package/dist/{share-EZ6ERBMH.js → share-HVWH4FPF.js} +30 -30
  220. package/dist/{skills-BTVVNYVM.js → skills-5TYEY75Q.js} +30 -30
  221. package/dist/{skills-eval-UY34MNK7.js → skills-eval-CK3MD63Z.js} +114 -103
  222. package/dist/{skills-inventory-JDHSIA7I.js → skills-inventory-KSFYG3I6.js} +24 -24
  223. package/dist/{slash-commands-K4FNQ2AT.js → slash-commands-DMVHML7P.js} +60 -57
  224. package/dist/{steer-2B3EQGFH.js → steer-XCD6V3EW.js} +4 -4
  225. package/dist/{support-L2SOL3IE.js → support-JAZL6VBR.js} +7 -7
  226. package/dist/system-3TDQRMZZ.js +116 -0
  227. package/dist/{targets-44VKGFLN.js → targets-EZKHAYRN.js} +74 -72
  228. package/dist/{tasks-3KODKFU7.js → tasks-SNEFHWYW.js} +18 -18
  229. package/dist/{terminal-lease-LXA7MMPO.js → terminal-lease-BNLFA4OF.js} +8 -7
  230. package/dist/{tools-3UB7TEVR.js → tools-7IM6BDCE.js} +12 -12
  231. package/dist/{trace-TAMIU4OJ.js → trace-C3MBGD4S.js} +16 -65
  232. package/dist/{tui-primitives-A6MUW32V.js → tui-primitives-36BY2774.js} +2 -2
  233. package/dist/{uninstall-QYVRPEM4.js → uninstall-WWLOSZ42.js} +35 -10
  234. package/dist/{upgrade-7PMKM2JH.js → upgrade-ETK2JNSJ.js} +42 -51
  235. package/dist/{usage-6EQV7EQK.js → usage-S2HOB7BZ.js} +112 -102
  236. package/dist/{verifiers-JLITWSHU.js → verifiers-QDTEVH7R.js} +26 -24
  237. package/dist/{verify-T7NAEVIG.js → verify-SUKUK6XM.js} +16 -15
  238. package/dist/web/client/THIRD_PARTY_LICENSES.md +1809 -0
  239. package/dist/web/client/assets/abnfDiagram-VCTEODGH-BznNOe_I.js +1 -0
  240. package/dist/web/client/assets/arc-Pry-7G1_.js +1 -0
  241. package/dist/web/client/assets/architecture-7GRP2DOG-BQO9DL_y.js +1 -0
  242. package/dist/web/client/assets/architectureDiagram-5GKGNRK7-CKPbdvyx.js +36 -0
  243. package/dist/web/client/assets/array-BifhSqXX.js +1 -0
  244. package/dist/web/client/assets/atkinson-hyperlegible-next-latin-ext-wght-normal-C6vrW8VD.woff2 +0 -0
  245. package/dist/web/client/assets/atkinson-hyperlegible-next-latin-wght-normal-BcXVPD7q.woff2 +0 -0
  246. package/dist/web/client/assets/blockDiagram-I7D4REHJ-prINbpbM.js +129 -0
  247. package/dist/web/client/assets/c4Diagram-7LVT6UL2-DkVRKtyU.js +38 -0
  248. package/dist/web/client/assets/channel-c4EeUUqA.js +1 -0
  249. package/dist/web/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  250. package/dist/web/client/assets/chunk-4HAMMTFA-CV0Z1ApC.js +62 -0
  251. package/dist/web/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  252. package/dist/web/client/assets/chunk-75Z2AOVW-D34Nohxq.js +2 -0
  253. package/dist/web/client/assets/chunk-DU6HZSFF-Das_cS-O.js +125 -0
  254. package/dist/web/client/assets/chunk-F27PBJKO-CmRojxkG.js +1 -0
  255. package/dist/web/client/assets/chunk-FOHPRMQF-CoA4358r.js +161 -0
  256. package/dist/web/client/assets/chunk-GMAD6QVW-ClYZmc73.js +72 -0
  257. package/dist/web/client/assets/chunk-GVQU2GXP-B2BiHFt-.js +1 -0
  258. package/dist/web/client/assets/chunk-IMKFNOWR-BGApZ8nP.js +231 -0
  259. package/dist/web/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  260. package/dist/web/client/assets/chunk-L3NEJ4N5-DIzCgpkY.js +1 -0
  261. package/dist/web/client/assets/chunk-OSK3NFVY-BPT-yePv.js +10 -0
  262. package/dist/web/client/assets/chunk-P2QGCYS3-BC1WTc2t.js +1 -0
  263. package/dist/web/client/assets/chunk-POPQ4Y6H-BSjzBmZU.js +1 -0
  264. package/dist/web/client/assets/chunk-PWAF6VOD-BIjLs86Z.js +1 -0
  265. package/dist/web/client/assets/chunk-SHT3W25Y-CduDz2cm.js +168 -0
  266. package/dist/web/client/assets/chunk-SVP7TREG-XUn4pPAP.js +88 -0
  267. package/dist/web/client/assets/chunk-TICWLB2K-DcBy2DKy.js +206 -0
  268. package/dist/web/client/assets/chunk-XXDRQBXY-DqAYeljN.js +1 -0
  269. package/dist/web/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  270. package/dist/web/client/assets/classDiagram-ZZMXUADV-C0HR7YKN.js +1 -0
  271. package/dist/web/client/assets/classDiagram-v2-VYDZK3BY-C0HR7YKN.js +1 -0
  272. package/dist/web/client/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
  273. package/dist/web/client/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
  274. package/dist/web/client/assets/cose-bilkent-JH36ORCC-CVh1icwb.js +1 -0
  275. package/dist/web/client/assets/cynefin-OW5HDTMX-BecPbyM6.js +1 -0
  276. package/dist/web/client/assets/cynefinDiagram-5FMLGOSQ-BzMzFwyT.js +62 -0
  277. package/dist/web/client/assets/cytoscape.esm-c2aL46s-.js +321 -0
  278. package/dist/web/client/assets/dagre-C-rnJpZF.js +1 -0
  279. package/dist/web/client/assets/dagre-GXQ25YYZ-CAWJmRMG.js +4 -0
  280. package/dist/web/client/assets/defaultLocale-BFoDCU3G.js +1 -0
  281. package/dist/web/client/assets/diagram-S7CK7UJ4--lp0ALmn.js +30 -0
  282. package/dist/web/client/assets/diagram-UQ7AKVKN-gKUnsjcj.js +41 -0
  283. package/dist/web/client/assets/diagram-VSXAHHWV-BoN5D1Gh.js +3 -0
  284. package/dist/web/client/assets/diagram-VX7I27RA-BMtuswQ6.js +24 -0
  285. package/dist/web/client/assets/diagram-Z3DM3KII-DtU8LXrA.js +24 -0
  286. package/dist/web/client/assets/dist-v5Q1xZ2K.js +1 -0
  287. package/dist/web/client/assets/ebnfDiagram-PWID7BFC-DDcnv9BH.js +1 -0
  288. package/dist/web/client/assets/erDiagram-RLTQ6QDP-DvRb4iDL.js +99 -0
  289. package/dist/web/client/assets/eventmodeling-NTZA5JFV-01h4SbTc.js +1 -0
  290. package/dist/web/client/assets/flowDiagram-HODETNUW-Bll_YZ6T.js +1 -0
  291. package/dist/web/client/assets/framework-YGoR34M4.js +9 -0
  292. package/dist/web/client/assets/ganttDiagram-EL5Y4UJY-DdFZ9hvH.js +292 -0
  293. package/dist/web/client/assets/gitGraph-4MIJSDKK-DjD_AAMj.js +1 -0
  294. package/dist/web/client/assets/gitGraphDiagram-WWUBYQGX-CDyN9n2u.js +106 -0
  295. package/dist/web/client/assets/graphlib-DS17s2tU.js +1 -0
  296. package/dist/web/client/assets/index-CVcy0FAn.js +75 -0
  297. package/dist/web/client/assets/index-Dsi52apB.css +1 -0
  298. package/dist/web/client/assets/info-A6RAGUB7-C_XK8Hq0.js +1 -0
  299. package/dist/web/client/assets/infoDiagram-27XIBGKW-DIe4tJ1i.js +2 -0
  300. package/dist/web/client/assets/init-C-OQMol4.js +1 -0
  301. package/dist/web/client/assets/ishikawaDiagram-5VMMS53U-CVl5unKI.js +70 -0
  302. package/dist/web/client/assets/journeyDiagram-3NMN7TZE-CPEB1Vt8.js +139 -0
  303. package/dist/web/client/assets/kanban-definition-UXKFOSKX-j-9WXjYQ.js +89 -0
  304. package/dist/web/client/assets/katex-ZlcWpGUi.js +257 -0
  305. package/dist/web/client/assets/line-BIDAcEtX.js +1 -0
  306. package/dist/web/client/assets/linear-SzVmGSw4.js +1 -0
  307. package/dist/web/client/assets/mermaid-parser.core-Ux4vssh0.js +7 -0
  308. package/dist/web/client/assets/mermaid.core-CDuwVKeh.js +44 -0
  309. package/dist/web/client/assets/mindmap-definition-YA3MSWOX-5MlQEeQ6.js +96 -0
  310. package/dist/web/client/assets/newsreader-latin-ext-wght-normal-C-3rgBeH.woff2 +0 -0
  311. package/dist/web/client/assets/newsreader-latin-wght-normal-CCVVNp6i.woff2 +0 -0
  312. package/dist/web/client/assets/newsreader-vietnamese-wght-normal-Czsa-EzN.woff2 +0 -0
  313. package/dist/web/client/assets/ordinal-BDEzSJ7C.js +1 -0
  314. package/dist/web/client/assets/packet-AYTQ26CC-DRO66c9Q.js +1 -0
  315. package/dist/web/client/assets/path-fybaL0A-.js +1 -0
  316. package/dist/web/client/assets/pegDiagram-XKGWAZYB-BakZnSjM.js +1 -0
  317. package/dist/web/client/assets/pie-WAS4IAKB-BEzcmhz8.js +1 -0
  318. package/dist/web/client/assets/pieDiagram-E7YTZNPT-DpmqgoPt.js +39 -0
  319. package/dist/web/client/assets/prism-bash-D6zCJ74D.js +1 -0
  320. package/dist/web/client/assets/prism-c-04YixN25.js +1 -0
  321. package/dist/web/client/assets/prism-clike-DapgWyxx.js +1 -0
  322. package/dist/web/client/assets/prism-core-BtsZdCS6.js +1 -0
  323. package/dist/web/client/assets/prism-cpp-C-lJbC-6.js +1 -0
  324. package/dist/web/client/assets/prism-css-CPgOzxXp.js +1 -0
  325. package/dist/web/client/assets/prism-diff-BF8m0_mq.js +3 -0
  326. package/dist/web/client/assets/prism-docker-DkT6yOFj.js +1 -0
  327. package/dist/web/client/assets/prism-fortran-Be5x3y1V.js +1 -0
  328. package/dist/web/client/assets/prism-go-C_8qAH5n.js +1 -0
  329. package/dist/web/client/assets/prism-ini-BESK3y0r.js +1 -0
  330. package/dist/web/client/assets/prism-javascript-BnO-swvr.js +1 -0
  331. package/dist/web/client/assets/prism-json-Dp_-W-Hv.js +1 -0
  332. package/dist/web/client/assets/prism-jsx-D-D0NWtC.js +1 -0
  333. package/dist/web/client/assets/prism-julia-DIjOgiAV.js +1 -0
  334. package/dist/web/client/assets/prism-latex-DNMbqcH_.js +1 -0
  335. package/dist/web/client/assets/prism-makefile-CRKWLQ8l.js +1 -0
  336. package/dist/web/client/assets/prism-markdown-C0FPJ1Iz.js +1 -0
  337. package/dist/web/client/assets/prism-markup-Cp04rIa1.js +1 -0
  338. package/dist/web/client/assets/prism-matlab-D-nk08al.js +1 -0
  339. package/dist/web/client/assets/prism-python-CfiSVtM6.js +1 -0
  340. package/dist/web/client/assets/prism-r-QmNGR8LX.js +1 -0
  341. package/dist/web/client/assets/prism-rust-Bu9N8X3N.js +1 -0
  342. package/dist/web/client/assets/prism-shell-session-Be4UuYoM.js +1 -0
  343. package/dist/web/client/assets/prism-sql-CYhVDMEE.js +1 -0
  344. package/dist/web/client/assets/prism-toml-DKb54GAT.js +1 -0
  345. package/dist/web/client/assets/prism-tsx-p6J2Kc_4.js +1 -0
  346. package/dist/web/client/assets/prism-typescript-BMqONzxf.js +1 -0
  347. package/dist/web/client/assets/prism-yaml-C0JHu8gr.js +1 -0
  348. package/dist/web/client/assets/purify.es-ChwZkWde.js +3 -0
  349. package/dist/web/client/assets/quadrantDiagram-AXDQQJYC-DuMPwwV2.js +7 -0
  350. package/dist/web/client/assets/radar-RG4KPBEZ-Djm3oXl5.js +1 -0
  351. package/dist/web/client/assets/railroad-74A4TZTK-Cpvkwsao.js +1 -0
  352. package/dist/web/client/assets/railroad-abnf-HS5TGJTU-CpRQ3ruG.js +1 -0
  353. package/dist/web/client/assets/railroad-ebnf-LZEXJU2U-1Rm5a5eJ.js +1 -0
  354. package/dist/web/client/assets/railroad-peg-WCYAUIDC-C8344cTh.js +1 -0
  355. package/dist/web/client/assets/railroadDiagram-O6MQD6OU-CgMS4B6R.js +1 -0
  356. package/dist/web/client/assets/requirementDiagram-BXWQKSXE-CX5eoNdN.js +84 -0
  357. package/dist/web/client/assets/rolldown-runtime-hePW80VL.js +1 -0
  358. package/dist/web/client/assets/rough.esm-Dy-Kn_BL.js +1 -0
  359. package/dist/web/client/assets/sankeyDiagram-P5KCCOFB-CODBX2N3.js +40 -0
  360. package/dist/web/client/assets/sequenceDiagram-WJ2MYXX4-eUhhF8OR.js +162 -0
  361. package/dist/web/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  362. package/dist/web/client/assets/src-B6xuSHsQ.js +1 -0
  363. package/dist/web/client/assets/stateDiagram-D77RDMKH-vR6l0NC2.js +1 -0
  364. package/dist/web/client/assets/stateDiagram-v2-MP3YSRHH-BYUm8jLY.js +1 -0
  365. package/dist/web/client/assets/swimlanes-42K2YHIH-v9Tw_zX7.js +1 -0
  366. package/dist/web/client/assets/swimlanesDiagram-VR7AAH4N-B2jdCvhD.js +8 -0
  367. package/dist/web/client/assets/timeline-definition-24CTP7MA-DxianbhU.js +120 -0
  368. package/dist/web/client/assets/treeView-Q6P3EWNA-DLxnZb9R.js +1 -0
  369. package/dist/web/client/assets/treemap-WGGIJYW6-I7UnZ6xJ.js +1 -0
  370. package/dist/web/client/assets/vennDiagram-4TSXK5OY-Ar7M8Mrj.js +34 -0
  371. package/dist/web/client/assets/wardley-WFR3VGLG-B8ZSHeDu.js +1 -0
  372. package/dist/web/client/assets/wardleyDiagram-VM6X3IG4-Qks2FmIn.js +78 -0
  373. package/dist/web/client/assets/xychartDiagram-S5SC5T6Z-BBBjRtiE.js +7 -0
  374. package/dist/web/client/clio-coder-logo.webp +0 -0
  375. package/dist/web/client/icon-192.png +0 -0
  376. package/dist/web/client/icon-512.png +0 -0
  377. package/dist/web/client/index.html +6 -0
  378. package/dist/web/client/manifest.webmanifest +15 -0
  379. package/dist/web/client/offline.css +55 -0
  380. package/dist/web/client/offline.html +5 -0
  381. package/dist/web/client/offline.js +27 -0
  382. package/dist/web/client/sw.js +34 -0
  383. package/dist/web/ops-worker.js +37 -0
  384. package/dist/web/reads-worker.js +1726 -0
  385. package/dist/web/server.js +8499 -0
  386. package/dist/web-EMGUGGEI.js +13 -0
  387. package/dist/{web-fetch-W4TNW4Q7.js → web-fetch-6BRRVQON.js} +22 -5
  388. package/dist/{wiki-generate-T2TJQJUA.js → wiki-generate-XHSJTDOP.js} +120 -113
  389. package/dist/{with-panes-CHFC7HGI.js → with-panes-Z6BTEHMZ.js} +12 -12
  390. package/dist/worker/entry.js +113 -99
  391. package/docs/README.md +28 -27
  392. package/docs/architecture/acp.md +5 -9
  393. package/docs/architecture/alcf-provider.md +0 -3
  394. package/docs/architecture/architecture.md +0 -3
  395. package/docs/architecture/artifact-placement.md +12 -4
  396. package/docs/architecture/artifact-versions.md +0 -3
  397. package/docs/architecture/capacity-and-scheduling.md +0 -3
  398. package/docs/architecture/context-engine.md +0 -3
  399. package/docs/architecture/context-working-set.md +0 -3
  400. package/docs/architecture/dispatch-architecture-rationale.md +0 -3
  401. package/docs/architecture/dispatch-typed-intent.md +0 -3
  402. package/docs/architecture/evidence-and-memory.md +0 -3
  403. package/docs/architecture/library.md +1 -3
  404. package/docs/architecture/middleware-and-components.md +0 -3
  405. package/docs/architecture/model-catalog.md +1 -4
  406. package/docs/architecture/observability.md +0 -3
  407. package/docs/architecture/pi-boundary.md +6 -9
  408. package/docs/architecture/prompt-envelope-and-tools.md +37 -30
  409. package/docs/architecture/provider-adapter-cookbook.md +1 -4
  410. package/docs/architecture/safety-model.md +19 -9
  411. package/docs/architecture/session-lifecycle.md +10 -7
  412. package/docs/architecture/time-conventions.md +0 -3
  413. package/docs/architecture/trace-store.md +28 -20
  414. package/docs/architecture/tui-design.md +38 -18
  415. package/docs/architecture/worker-context.md +1 -3
  416. package/docs/architecture/worker-dispatch-mechanics.md +1 -4
  417. package/docs/guide/authoring-plugins.md +1 -3
  418. package/docs/guide/built-in-agents.md +0 -3
  419. package/docs/guide/commands-and-modes.md +41 -25
  420. package/docs/guide/configuration-and-targets.md +204 -9
  421. package/docs/guide/configuration-reference.md +125 -17
  422. package/docs/guide/environment-variables.md +2 -8
  423. package/docs/guide/exit-codes-and-output.md +0 -3
  424. package/docs/guide/extensions-and-sharing.md +0 -3
  425. package/docs/guide/fleet-dispatch.md +3 -5
  426. package/docs/guide/glossary.md +1 -4
  427. package/docs/guide/harness-extensions.md +0 -2
  428. package/docs/guide/installation-and-lifecycle.md +3 -6
  429. package/docs/guide/interop.md +0 -2
  430. package/docs/guide/panes-and-files.md +0 -3
  431. package/docs/guide/plugins.md +0 -3
  432. package/docs/guide/proactive-memory.md +0 -3
  433. package/docs/guide/resource-library.md +1 -3
  434. package/docs/guide/skills-marketplace.md +0 -2
  435. package/docs/guide/tool-usage.md +166 -67
  436. package/docs/guide/troubleshooting.md +1 -4
  437. package/docs/history/config-knobs-audit.md +0 -3
  438. package/docs/history/release-cut-checklist.md +0 -3
  439. package/docs/process/development-pipeline.md +0 -3
  440. package/docs/process/documentation-coverage.md +3 -3
  441. package/docs/process/documentation-guide.md +16 -22
  442. package/docs/process/eval-runner.md +0 -3
  443. package/docs/process/evals-internal.md +0 -3
  444. package/docs/process/evolution.md +0 -3
  445. package/docs/process/fleet-demo-runbook.md +6 -9
  446. package/docs/process/git-commit-provenance.md +0 -3
  447. package/docs/process/performance-methodology.md +1 -4
  448. package/docs/process/release-cut-checklist.md +114 -221
  449. package/docs/process/scientific-validation.md +23 -6
  450. package/docs/process/tool-audit-v0.4.9.md +357 -0
  451. package/library/registry.yaml +2 -2
  452. package/library/skills/meta/clio-coder-test/SKILL.md +25 -15
  453. package/library/skills/meta/clio-coder-test/evals.md +16 -2
  454. package/library/skills/meta/clio-coder-test/plugin.json +1 -1
  455. package/library/skills/meta/clio-coder-test/references/test-map.md +19 -18
  456. package/library/skills/registry.yaml +2 -2
  457. package/library/skills/skill-marketplace.json +1 -1
  458. package/package.json +13 -11
  459. package/src/cli/argv.ts +31 -0
  460. package/src/cli/clio.ts +17 -13
  461. package/src/cli/config.ts +4 -0
  462. package/src/cli/docs.ts +65 -328
  463. package/src/cli/doctor-panes.ts +1 -1
  464. package/src/cli/doctor.ts +3 -1
  465. package/src/cli/index.ts +17 -2
  466. package/src/cli/mcp.ts +106 -0
  467. package/src/cli/skills-eval.ts +8 -2
  468. package/src/cli/trace.ts +4 -65
  469. package/src/cli/uninstall.ts +26 -0
  470. package/src/cli/upgrade.ts +34 -38
  471. package/src/cli/usage.ts +3 -0
  472. package/src/cli/verifiers.ts +1 -1
  473. package/src/cli/web.ts +79 -0
  474. package/src/core/bash-exec.ts +27 -4
  475. package/src/core/bus-events.ts +3 -4
  476. package/src/core/config.ts +73 -1
  477. package/src/core/defaults.ts +10 -1
  478. package/src/core/domain-loader.ts +37 -28
  479. package/src/core/event-bus.ts +1 -1
  480. package/src/core/run-records.ts +438 -0
  481. package/src/core/safe-exec.ts +506 -56
  482. package/src/core/skill-activation.ts +5 -3
  483. package/src/core/termination.ts +16 -12
  484. package/src/core/tool-names.ts +33 -12
  485. package/src/domains/agents/contract.ts +1 -1
  486. package/src/domains/agents/extension.ts +18 -10
  487. package/src/domains/config/extension.ts +5 -4
  488. package/src/domains/context/clio-md.ts +1 -1
  489. package/src/domains/context/worker/pressure.ts +6 -2
  490. package/src/domains/context/working-set/path-index.ts +7 -2
  491. package/src/domains/dispatch/code-step.ts +7 -2
  492. package/src/domains/dispatch/contract.ts +7 -0
  493. package/src/domains/dispatch/execution-role.ts +3 -3
  494. package/src/domains/dispatch/execution-scheduler.ts +204 -79
  495. package/src/domains/dispatch/extension.ts +206 -26
  496. package/src/domains/dispatch/fleet-preflight.ts +18 -3
  497. package/src/domains/dispatch/fleet-run.ts +1 -0
  498. package/src/domains/dispatch/gate-decisions.ts +3 -3
  499. package/src/domains/dispatch/heartbeat.ts +1 -1
  500. package/src/domains/dispatch/host-verification.ts +16 -14
  501. package/src/domains/dispatch/index.ts +1 -0
  502. package/src/domains/dispatch/orphan-recovery.ts +1 -0
  503. package/src/domains/dispatch/receipt-findings.ts +3 -4
  504. package/src/domains/dispatch/receipt-integrity.ts +3 -0
  505. package/src/domains/dispatch/reservation-store.ts +7 -9
  506. package/src/domains/dispatch/route-facts.ts +1 -1
  507. package/src/domains/dispatch/state.ts +4 -5
  508. package/src/domains/dispatch/types.ts +3 -1
  509. package/src/domains/eval/metrics/tracked.ts +22 -2
  510. package/src/domains/evidence/build.ts +35 -7
  511. package/src/domains/extensions/operator-runtime.ts +3 -1
  512. package/src/domains/gateway/mcp/client.ts +923 -0
  513. package/src/domains/gateway/mcp/config.ts +456 -0
  514. package/src/domains/gateway/mcp/index.ts +88 -0
  515. package/src/domains/gateway/mcp/protocol.ts +273 -0
  516. package/src/domains/gateway/mcp/trust.ts +263 -0
  517. package/src/domains/lifecycle/doctor.ts +17 -3
  518. package/src/domains/middleware/hooks.ts +2 -2
  519. package/src/domains/mux/contract.ts +5 -9
  520. package/src/domains/mux/detect.ts +1 -1
  521. package/src/domains/mux/extension.ts +1 -1
  522. package/src/domains/mux/protocol.ts +5 -7
  523. package/src/domains/mux/socket-client.ts +3 -3
  524. package/src/domains/observability/accountability.ts +2 -2
  525. package/src/domains/observability/background-memory-usage.ts +3 -0
  526. package/src/domains/observability/compaction-usage.ts +2 -0
  527. package/src/domains/observability/contract.ts +7 -3
  528. package/src/domains/observability/cost.ts +5 -0
  529. package/src/domains/observability/evidence-index.ts +2 -2
  530. package/src/domains/observability/extension.ts +1 -0
  531. package/src/domains/observability/out-of-turn-usage.ts +2 -0
  532. package/src/domains/observability/projection.ts +10 -0
  533. package/src/domains/observability/trace-store.ts +65 -5
  534. package/src/domains/prompts/compiler.ts +41 -23
  535. package/src/domains/prompts/extension.ts +4 -17
  536. package/src/domains/prompts/fragments/identity/docs-routing.md +2 -2
  537. package/src/domains/prompts/fragments/operating/skills.md +12 -10
  538. package/src/domains/providers/cache-deployment.ts +147 -0
  539. package/src/domains/providers/catalog.ts +12 -7
  540. package/src/domains/providers/extension.ts +27 -5
  541. package/src/domains/providers/index.ts +6 -1
  542. package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +42 -10
  543. package/src/domains/providers/plugins.ts +3 -13
  544. package/src/domains/providers/probe/http.ts +44 -59
  545. package/src/domains/providers/probe/reasoning.ts +2 -0
  546. package/src/domains/providers/runtimes/common/local-synth.ts +4 -0
  547. package/src/domains/providers/runtimes/local-native/llamacpp-embed.ts +20 -31
  548. package/src/domains/providers/runtimes/local-native/llamacpp-rerank.ts +9 -4
  549. package/src/domains/providers/types/target-descriptor.ts +17 -0
  550. package/src/domains/safety/action-classifier.ts +17 -1
  551. package/src/domains/safety/call-target.ts +14 -0
  552. package/src/domains/safety/contract.ts +1 -1
  553. package/src/domains/safety/finish-contract.ts +9 -3
  554. package/src/domains/safety/loop-detector.ts +1 -1
  555. package/src/domains/safety/policy-engine.ts +7 -0
  556. package/src/domains/safety/protected-artifacts.ts +3 -4
  557. package/src/domains/safety/rejection-feedback.ts +1 -1
  558. package/src/domains/safety/scope.ts +2 -3
  559. package/src/domains/safety/validation-contract.ts +3 -2
  560. package/src/domains/scheduling/budget.ts +5 -3
  561. package/src/domains/scheduling/contract.ts +2 -1
  562. package/src/domains/scheduling/extension.ts +3 -3
  563. package/src/domains/session/compaction/branch-summary.ts +1 -1
  564. package/src/domains/session/compaction/compact.ts +29 -3
  565. package/src/domains/session/compaction/cut-point.ts +1 -1
  566. package/src/domains/session/compaction/tokens.ts +5 -10
  567. package/src/domains/session/contract.ts +1 -1
  568. package/src/domains/session/cwd-fallback.ts +2 -2
  569. package/src/domains/session/entries.ts +1 -0
  570. package/src/domains/session/handoff.ts +5 -1
  571. package/src/domains/session/history.ts +6 -0
  572. package/src/domains/session/manager.ts +14 -7
  573. package/src/domains/session/retry.ts +2 -1
  574. package/src/domains/session/session-artifacts.ts +12 -7
  575. package/src/domains/session/task-board.ts +2 -3
  576. package/src/domains/session/usage.ts +6 -7
  577. package/src/engine/acp/server.ts +11 -0
  578. package/src/engine/ai.ts +2 -0
  579. package/src/engine/apis/openai-completions.ts +17 -4
  580. package/src/engine/loop-guard.ts +7 -0
  581. package/src/engine/prewarm.ts +232 -0
  582. package/src/engine/provider-diagnostics.ts +6 -1
  583. package/src/engine/provider-error-body.ts +65 -0
  584. package/src/engine/session.ts +118 -29
  585. package/src/engine/worker-runtime.ts +3 -0
  586. package/src/entry/boot-options.ts +2 -0
  587. package/src/entry/orchestrator.ts +38 -18
  588. package/src/interactive/chat-loop-messages.ts +3 -0
  589. package/src/interactive/chat-loop-policy.ts +1 -0
  590. package/src/interactive/chat-loop.ts +10 -12
  591. package/src/interactive/chat-panel.ts +23 -9
  592. package/src/interactive/chat-renderer.ts +33 -11
  593. package/src/interactive/clio-editor.ts +13 -5
  594. package/src/interactive/dispatch-board.ts +70 -30
  595. package/src/interactive/editor-submit.ts +30 -25
  596. package/src/interactive/footer/widgets.ts +12 -9
  597. package/src/interactive/interactive-presentation.ts +2 -3
  598. package/src/interactive/mux-bridge.ts +3 -7
  599. package/src/interactive/overlay-general-openers.ts +14 -7
  600. package/src/interactive/overlays/cwd-fallback.ts +1 -1
  601. package/src/interactive/overlays/library-model.ts +114 -35
  602. package/src/interactive/overlays/library.ts +52 -5
  603. package/src/interactive/overlays/list-overlay.ts +4 -1
  604. package/src/interactive/overlays/session-selector.ts +28 -23
  605. package/src/interactive/overlays/settings.ts +20 -1
  606. package/src/interactive/overlays/tree-selector.ts +47 -10
  607. package/src/interactive/panes-runtime.ts +1 -1
  608. package/src/interactive/prewarm.ts +11 -197
  609. package/src/interactive/renderers/compaction-summary.ts +1 -1
  610. package/src/interactive/renderers/provider-error.ts +118 -0
  611. package/src/interactive/renderers/retry-status.ts +59 -23
  612. package/src/interactive/renderers/tool-execution.ts +67 -7
  613. package/src/interactive/renderers/worker-answer.ts +198 -0
  614. package/src/interactive/renderers/worker-entry.ts +57 -163
  615. package/src/interactive/session-usage-reseed.ts +2 -0
  616. package/src/interactive/side-question.ts +2 -0
  617. package/src/interactive/slash-commands.ts +26 -1
  618. package/src/interactive/slash-spec.ts +2 -2
  619. package/src/interactive/theme/labels.ts +66 -30
  620. package/src/interactive/turn-context.ts +1 -0
  621. package/src/interactive/turn-persistence.ts +9 -1
  622. package/src/interactive/turn-prewarm.ts +126 -19
  623. package/src/interactive/turn-recovery.ts +2 -1
  624. package/src/interactive/turn-runtime.ts +36 -5
  625. package/src/interactive/view/artifacts.ts +3 -2
  626. package/src/interactive/view/view-overlay.ts +96 -20
  627. package/src/tools/agent-tools.ts +21 -7
  628. package/src/tools/artifact.ts +16 -8
  629. package/src/tools/bash.ts +90 -11
  630. package/src/tools/bootstrap.ts +42 -4
  631. package/src/tools/builtin-tool-catalog.ts +80 -11
  632. package/src/tools/context/index.ts +27 -31
  633. package/src/tools/context/library.ts +3 -1
  634. package/src/tools/context/surface.ts +12 -26
  635. package/src/tools/core-bootstrap.ts +72 -1
  636. package/src/tools/data/csv.ts +1189 -0
  637. package/src/tools/data/index.ts +308 -0
  638. package/src/tools/data/json.ts +1799 -0
  639. package/src/tools/data/jsonl.ts +561 -0
  640. package/src/tools/data/shared.ts +452 -0
  641. package/src/tools/edit-diff.ts +0 -7
  642. package/src/tools/edit.ts +115 -18
  643. package/src/tools/file-mutation-queue.ts +114 -4
  644. package/src/tools/find.ts +108 -29
  645. package/src/tools/gateway/caps.ts +11 -0
  646. package/src/tools/gateway/clio-context-surface.ts +41 -0
  647. package/src/tools/gateway/clio-context-tools.ts +77 -0
  648. package/src/tools/gateway/data-surface.ts +138 -0
  649. package/src/tools/gateway/data-tool.ts +201 -0
  650. package/src/tools/gateway/index.ts +342 -0
  651. package/src/tools/gateway/mcp-capabilities.ts +469 -0
  652. package/src/tools/grep.ts +88 -33
  653. package/src/tools/harness-extensions.ts +3 -0
  654. package/src/tools/ignore-policy.ts +7 -5
  655. package/src/tools/ls.ts +111 -20
  656. package/src/tools/policy.ts +35 -13
  657. package/src/tools/presentation.ts +6 -0
  658. package/src/tools/read.ts +634 -156
  659. package/src/tools/registry.ts +106 -8
  660. package/src/tools/run-script.ts +997 -0
  661. package/src/tools/spawn-hygiene.ts +157 -5
  662. package/src/tools/surface.ts +163 -0
  663. package/src/tools/verify/authoring.ts +8 -3
  664. package/src/tools/verify/catalog.ts +14 -1
  665. package/src/tools/verify/numeric.ts +367 -59
  666. package/src/tools/verify/perf.ts +171 -9
  667. package/src/tools/verify/scripts.ts +178 -26
  668. package/src/tools/web-fetch-surface.ts +22 -0
  669. package/src/tools/web-fetch.ts +26 -1
  670. package/src/tools/write.ts +45 -19
  671. package/src/worker/spec-contract.ts +27 -0
  672. package/dist/chunk-B6UM3OZC.js +0 -15
  673. package/dist/chunk-GJ24ODAX.js +0 -196
  674. package/dist/chunk-HRAKUPIH.js +0 -57
  675. package/dist/docs-BL7ROUFN.js +0 -292
@@ -10,7 +10,7 @@ import {
10
10
  planEviction,
11
11
  projectWorkingSet,
12
12
  resolveWorkingSetPolicy
13
- } from "./chunk-UUQ5G6EZ.js";
13
+ } from "./chunk-VWFCAK34.js";
14
14
  import {
15
15
  assistantSessionPayload,
16
16
  attachedToolSchemasFromState,
@@ -45,146 +45,50 @@ import {
45
45
  toolNamesFromAgentState,
46
46
  toolResultSummary,
47
47
  toolSignatureFromState
48
- } from "./chunk-ISNCCX42.js";
48
+ } from "./chunk-BBA2TAWV.js";
49
49
  import {
50
50
  ShareDomainModule
51
- } from "./chunk-EUZRMP4Y.js";
51
+ } from "./chunk-YPQOPFP7.js";
52
52
  import {
53
53
  bootstrapInputFromInitOptions,
54
54
  modelBootstrapGenerate,
55
55
  resolveBootstrapRoute
56
- } from "./chunk-SEDI5K5B.js";
56
+ } from "./chunk-H7TXJR23.js";
57
57
  import {
58
58
  SchedulingDomainModule,
59
59
  createPromptsDomainModule,
60
60
  renderAgentCatalogSectionsFromSpecs
61
- } from "./chunk-IMOD2YPV.js";
61
+ } from "./chunk-NYDG4QP4.js";
62
62
  import {
63
63
  PROMPT_MANIFEST_VERSION,
64
64
  appendPromptCompileRecord,
65
65
  getPromptManifestFilePath,
66
66
  readPromptCompileManifest,
67
67
  readPromptCompileRecords
68
- } from "./chunk-5ZSZEYJK.js";
68
+ } from "./chunk-SJETVJHX.js";
69
69
  import {
70
70
  recordFailedCompactionCalls
71
- } from "./chunk-LBFQMYS3.js";
71
+ } from "./chunk-3U4BL2EV.js";
72
72
  import {
73
73
  capturedHookSourcesFor
74
74
  } from "./chunk-IFDRAD6F.js";
75
75
  import {
76
76
  LifecycleDomainModule,
77
77
  describeUpgradeNotice
78
- } from "./chunk-PFLOULP3.js";
79
- import "./chunk-TZHN5ITX.js";
80
- import "./chunk-WBVKKTUT.js";
78
+ } from "./chunk-RDKX2PME.js";
79
+ import "./chunk-LWJYOHT3.js";
80
+ import "./chunk-XRECG65F.js";
81
81
  import {
82
82
  ConfigDomainModule,
83
83
  createConfigDomainModule,
84
84
  loadDomains
85
- } from "./chunk-QKWL7SYE.js";
86
- import {
87
- monitorToolSurface
88
- } from "./chunk-DACXIVVF.js";
89
- import {
90
- ObservabilityDomainModule,
91
- recordBackgroundMemoryStep
92
- } from "./chunk-XZ6UFQ52.js";
93
- import {
94
- appendOutOfTurnUsageRow,
95
- readAccountabilitySummary
96
- } from "./chunk-6LRLOJHQ.js";
97
- import {
98
- steerToolSurface
99
- } from "./chunk-M6Z2V6YU.js";
100
- import {
101
- panesToolSurface
102
- } from "./chunk-VCRVEDUC.js";
103
- import {
104
- describePanesLeftBehind,
105
- paneWatchDecision
106
- } from "./chunk-A46ILRS2.js";
107
- import {
108
- OperatorExtensionRuntime
109
- } from "./chunk-T7QQBNLH.js";
110
- import {
111
- EXTENSION_SNAPSHOT_DIAGNOSTIC_MESSAGE_CAP,
112
- ExtensionsDomainModule
113
- } from "./chunk-P4DL2LM5.js";
114
- import {
115
- flushRawStdout,
116
- writeRawStdout
117
- } from "./chunk-7WLRF2U5.js";
118
- import {
119
- buildRecallFields,
120
- recallErrorMessage,
121
- recallParentTurnId,
122
- recallableRefListing,
123
- resolveRecall
124
- } from "./chunk-ECOMVOHP.js";
125
- import {
126
- compactionCut,
127
- foldWorkingSet,
128
- isTurnStart,
129
- selectVisibleEntries
130
- } from "./chunk-DBREN25X.js";
131
- import {
132
- compileScoutTransition
133
- } from "./chunk-6YHPAAZR.js";
134
- import "./chunk-Y3JU5RPK.js";
135
- import {
136
- BUILTIN_SLASH_COMMANDS,
137
- COMPLETION_SLOT_NAMES,
138
- COUNCIL_SYNTHESIS_LABEL,
139
- SETTINGS_AREA_IDS,
140
- SLASH_COMMAND_GROUPS,
141
- commandReference,
142
- completeArgs,
143
- createWorkerStream,
144
- dispatchSlashCommand,
145
- isWorkerShareNote,
146
- parseSlashCommand,
147
- renderArgsSpec,
148
- workerAskedByModel,
149
- workerReceiptSummary,
150
- workerTargetLabel
151
- } from "./chunk-GVZFCJHE.js";
152
- import {
153
- boundSettledText
154
- } from "./chunk-UA6W4XFJ.js";
155
- import "./chunk-QUIJZSDW.js";
156
- import {
157
- resolveExtensionCommands
158
- } from "./chunk-RFCKPS2V.js";
159
- import {
160
- createResourcesDomainModule
161
- } from "./chunk-TZ6UVP2H.js";
162
- import {
163
- applyLibraryLifecycle,
164
- libraryImportOutcome,
165
- planLibraryLifecycle,
166
- releaseLibraryLifecycle,
167
- retryLibraryRefresh
168
- } from "./chunk-MNQN3X6Y.js";
169
- import {
170
- inspectLibraryCopy,
171
- readLibraryInventory
172
- } from "./chunk-UWD3JD5X.js";
173
- import {
174
- createUserTasksStore,
175
- formatUserTaskHandoff
176
- } from "./chunk-5AJPUR72.js";
177
- import {
178
- ToolchainDomainModule
179
- } from "./chunk-32KJPXAM.js";
180
- import "./chunk-C3G5PNUO.js";
85
+ } from "./chunk-XJZEDCNT.js";
86
+ import "./chunk-BMNVVKEW.js";
87
+ import "./chunk-2DRRZ57Q.js";
181
88
  import {
182
89
  ensureClioState,
183
90
  takeUpgradeNotice
184
- } from "./chunk-DO7M3LSX.js";
185
- import "./chunk-LZBMXNLP.js";
186
- import "./chunk-T334FW2H.js";
187
- import "./chunk-5GZICIYO.js";
91
+ } from "./chunk-EHZRAB4U.js";
188
92
  import {
189
93
  editTextExternally,
190
94
  resolveExternalEditor
@@ -201,12 +105,7 @@ import {
201
105
  planLibraryImport,
202
106
  releaseLibraryImport,
203
107
  renderProposalEntry
204
- } from "./chunk-CP3HIR5H.js";
205
- import "./chunk-6CA2BHOR.js";
206
- import {
207
- AgentsDomainModule
208
- } from "./chunk-WURGVOZJ.js";
209
- import "./chunk-4UHVS5T7.js";
108
+ } from "./chunk-AM6CEP2K.js";
210
109
  import {
211
110
  CLIO_APP_KEYBINDING_IDS,
212
111
  ClioEditor,
@@ -238,6 +137,7 @@ import {
238
137
  editorTheme,
239
138
  fgSequence,
240
139
  fitHintEntries,
140
+ fitIdentityLabel,
241
141
  fitUnits,
242
142
  focusedComponent,
243
143
  formatCompactMs,
@@ -269,10 +169,91 @@ import {
269
169
  unguardPastedEditorOperator,
270
170
  validateKeybindings,
271
171
  writeInputWedgeDump
272
- } from "./chunk-U3TPUXOQ.js";
172
+ } from "./chunk-M6YLF66Z.js";
173
+ import {
174
+ getTerminationCoordinator,
175
+ resolveShutdownHookBudgetMs
176
+ } from "./chunk-PJI57EC6.js";
177
+ import {
178
+ OperatorExtensionRuntime
179
+ } from "./chunk-JKU34ACI.js";
180
+ import {
181
+ ExtensionsDomainModule
182
+ } from "./chunk-ZST3FRCV.js";
183
+ import {
184
+ EXTENSION_SNAPSHOT_DIAGNOSTIC_MESSAGE_CAP
185
+ } from "./chunk-MZKYVIWW.js";
186
+ import {
187
+ flushRawStdout,
188
+ writeRawStdout
189
+ } from "./chunk-7WLRF2U5.js";
190
+ import "./chunk-OA2GDACN.js";
191
+ import {
192
+ buildRecallFields,
193
+ recallErrorMessage,
194
+ recallParentTurnId,
195
+ recallableRefListing,
196
+ resolveRecall
197
+ } from "./chunk-4DNL43EZ.js";
198
+ import {
199
+ compactionCut,
200
+ foldWorkingSet,
201
+ isTurnStart,
202
+ selectVisibleEntries
203
+ } from "./chunk-IPTPMLA6.js";
204
+ import {
205
+ compileScoutTransition
206
+ } from "./chunk-S34A7BSP.js";
207
+ import {
208
+ monitorToolSurface
209
+ } from "./chunk-TIWPKCVO.js";
210
+ import {
211
+ ObservabilityDomainModule,
212
+ recordBackgroundMemoryStep
213
+ } from "./chunk-2X2R3UTH.js";
214
+ import {
215
+ appendOutOfTurnUsageRow,
216
+ readAccountabilitySummary
217
+ } from "./chunk-3AND2EFU.js";
218
+ import {
219
+ steerToolSurface
220
+ } from "./chunk-37LW32LZ.js";
273
221
  import {
274
- getTerminationCoordinator
275
- } from "./chunk-A67NR5AT.js";
222
+ panesToolSurface
223
+ } from "./chunk-NSYGPIVW.js";
224
+ import {
225
+ describePanesLeftBehind,
226
+ paneWatchDecision
227
+ } from "./chunk-L3NBWLSN.js";
228
+ import "./chunk-JU6MAMRJ.js";
229
+ import {
230
+ BUILTIN_SLASH_COMMANDS,
231
+ COMPLETION_SLOT_NAMES,
232
+ COUNCIL_SYNTHESIS_LABEL,
233
+ SETTINGS_AREA_IDS,
234
+ SLASH_COMMAND_GROUPS,
235
+ commandReference,
236
+ completeArgs,
237
+ createWorkerStream,
238
+ dispatchSlashCommand,
239
+ isWorkerShareNote,
240
+ parseSlashCommand,
241
+ renderArgsSpec,
242
+ workerAskedByModel,
243
+ workerReceiptSummary,
244
+ workerTargetLabel
245
+ } from "./chunk-SQAZN2V3.js";
246
+ import {
247
+ AgentsDomainModule
248
+ } from "./chunk-5RTEFNBP.js";
249
+ import {
250
+ resolveExtensionCommands
251
+ } from "./chunk-RFCKPS2V.js";
252
+ import {
253
+ boundSettledText
254
+ } from "./chunk-7JSOSVLP.js";
255
+ import "./chunk-QUIJZSDW.js";
256
+ import "./chunk-Y3JU5RPK.js";
276
257
  import {
277
258
  CombinedAutocompleteProvider,
278
259
  Container,
@@ -294,7 +275,114 @@ import {
294
275
  truncateToWidth,
295
276
  visibleWidth,
296
277
  wrapTextWithAnsi
297
- } from "./chunk-V4ZKOKRB.js";
278
+ } from "./chunk-434LRQ6Z.js";
279
+ import {
280
+ createResourcesDomainModule
281
+ } from "./chunk-MTOZEQHL.js";
282
+ import {
283
+ applyLibraryLifecycle,
284
+ libraryImportOutcome,
285
+ planLibraryLifecycle,
286
+ releaseLibraryLifecycle,
287
+ retryLibraryRefresh
288
+ } from "./chunk-ETF4ROKH.js";
289
+ import {
290
+ inspectLibraryCopy,
291
+ readLibraryInventory
292
+ } from "./chunk-XLLEL3K7.js";
293
+ import "./chunk-WGRDABW7.js";
294
+ import "./chunk-Y3M2T5RO.js";
295
+ import {
296
+ discoverMarketplaceSkills,
297
+ installSkill,
298
+ modelVisibleSkills
299
+ } from "./chunk-7FBCRWVT.js";
300
+ import "./chunk-DNCE23JJ.js";
301
+ import "./chunk-YJCCMYYT.js";
302
+ import "./chunk-QKHZZFKH.js";
303
+ import "./chunk-IALGWTLO.js";
304
+ import {
305
+ createUserTasksStore,
306
+ formatUserTaskHandoff
307
+ } from "./chunk-3TQN67I2.js";
308
+ import {
309
+ formatBootTrace,
310
+ traceBoot
311
+ } from "./chunk-FXFVDPWY.js";
312
+ import {
313
+ source_default
314
+ } from "./chunk-KIVFXGBM.js";
315
+ import "./chunk-G5R53COU.js";
316
+ import "./chunk-GM4TY6VN.js";
317
+ import {
318
+ ToolchainDomainModule
319
+ } from "./chunk-32KJPXAM.js";
320
+ import "./chunk-5GZICIYO.js";
321
+ import {
322
+ INTERACTIVE_LOOP_BLOCK_BUDGET,
323
+ applyEditsToNormalizedContent,
324
+ assertRegisteredBuiltinTools,
325
+ createEngineAgent,
326
+ createLoopGuardRegistration,
327
+ createMcpCapabilitySource,
328
+ createProtectedArtifactsRegistration,
329
+ diffWords,
330
+ generateDiffString,
331
+ lazyTool,
332
+ normalizeToLF,
333
+ patchProviderThinkingPayload,
334
+ patchResponseSchemaPayloadForDialect,
335
+ patchToolChoiceNamedPayload,
336
+ patchToolChoiceNonePayload,
337
+ readOrchTurnToolCallBudget,
338
+ registerCoreTools,
339
+ registerHarnessExtensionTools,
340
+ resolveSessionTools,
341
+ sanitizeLockedSynthesisMessage,
342
+ stripBom
343
+ } from "./chunk-ZF6CV4WZ.js";
344
+ import {
345
+ MIDDLEWARE_HOOK_TEXT_MAX_CHARS,
346
+ MiddlewareDomainModule,
347
+ WATCHDOG_TASK,
348
+ announceMemoryStepEndpoint,
349
+ buildUserHookRegistrations,
350
+ createDetachedDispatchNudgeRegistration,
351
+ createHookReceiptLog,
352
+ createMarketplaceOfferRegistration,
353
+ createMemoryInterventionRegistration,
354
+ createMiddlewareToolChoiceControl,
355
+ createReadOnlyExplorationNudgeRegistration,
356
+ createSkillsReminderRegistration,
357
+ createTaskBoardReminderRegistration,
358
+ createTaskNudgeRegistration,
359
+ createUnbackedWorkerClaimRegistration,
360
+ createWatchdogRegistration,
361
+ formatRegistrationConflict,
362
+ openDetachedBatchViews,
363
+ watchdogBriefing,
364
+ writeMiddlewareDiagnosticToStderr
365
+ } from "./chunk-VPWGADBG.js";
366
+ import "./chunk-W72LLZAV.js";
367
+ import "./chunk-ACCECAH4.js";
368
+ import "./chunk-HBJQQTKM.js";
369
+ import {
370
+ resolveFdBinary
371
+ } from "./chunk-JABWPKFY.js";
372
+ import "./chunk-HCVKSGNZ.js";
373
+ import "./chunk-PNJE7JPS.js";
374
+ import "./chunk-L4RUTLRL.js";
375
+ import "./chunk-PPIFDSBK.js";
376
+ import "./chunk-TCUOGIL2.js";
377
+ import {
378
+ DEFAULT_KILL_GRACE_MS,
379
+ DEFAULT_TEARDOWN_BOUND_MS
380
+ } from "./chunk-PP23PZEV.js";
381
+ import {
382
+ incompleteInstallationAdvice
383
+ } from "./chunk-3A3CUMKA.js";
384
+ import "./chunk-XCUDZQLX.js";
385
+ import "./chunk-K2BLQC5E.js";
298
386
  import {
299
387
  ACP_AGENT_META_KEY,
300
388
  ACP_MAX_CHUNK_BYTES,
@@ -302,12 +390,8 @@ import {
302
390
  ACP_MAX_STRING_BYTES,
303
391
  ACP_MAX_TOOL_CALL_ID_BYTES,
304
392
  ACP_SESSION_META_KEY,
305
- ACP_TURN_FAILED_MESSAGE,
306
393
  ACP_USAGE_META_KEY,
307
- AcpRequestError,
308
- AcpTimeoutError,
309
394
  COST_NOT_MEASURED,
310
- acpErrorMessage,
311
395
  aggregateCostAmounts,
312
396
  buildMemoryPromptSection,
313
397
  canonicalMemoryRepositoryIdentity,
@@ -317,7 +401,6 @@ import {
317
401
  createDispatchDomainModule,
318
402
  createDispatchRunEventRegistry,
319
403
  createRunReceiptQuality,
320
- createStdioServerTransport,
321
404
  createTaskMemoryTrace,
322
405
  describeTaskMemoryActivity,
323
406
  endpointCapacityUsage,
@@ -342,40 +425,28 @@ import {
342
425
  taskMemoryBankSize,
343
426
  taskMemoryHandoffSeedOffer,
344
427
  taskMemoryTracePath
345
- } from "./chunk-WN552PKN.js";
428
+ } from "./chunk-F2YM3JY4.js";
346
429
  import "./chunk-PECBKCDK.js";
347
- import {
348
- describeWriteBoundaryAttributionDowngrade,
349
- gitCheckoutRoot,
350
- isGitRepository,
351
- preflightWriteBoundaries,
352
- recoverCleanupReadyCompeteGroups
353
- } from "./chunk-UA3W4FGC.js";
354
- import {
355
- bindExecutionPlanEndpoints,
356
- compileFleetExecutionPlan,
357
- requireAgentSteps
358
- } from "./chunk-RTLNFZMD.js";
359
430
  import {
360
431
  readGateDecisionArtifacts,
361
432
  readPendingGateDecisions
362
- } from "./chunk-EUEXGXXR.js";
433
+ } from "./chunk-NMBEW4PP.js";
363
434
  import {
364
435
  TRUST_STATUS_AXES,
365
436
  formatTrustSummaryLine,
366
437
  inspectRunReceiptTrustStatus,
367
438
  isReceiptIntegrity,
439
+ retiredIntegrityVersionOf,
368
440
  retiredReceiptIntegrity,
369
441
  retiredReceiptIntegrityReason,
370
442
  trustStateWord,
371
443
  verifyReceiptIntegrity
372
- } from "./chunk-IQCNVLO6.js";
444
+ } from "./chunk-IALZJE37.js";
373
445
  import {
374
446
  SessionDomainModule,
375
447
  addResponseModelIdObservationCount,
376
448
  addResponseModelIdObservationCounts,
377
449
  attributedModelId,
378
- collectSessionEntries,
379
450
  emptyResponseModelIdObservationCounts,
380
451
  ledgerUsageCalls,
381
452
  protectedArtifactEntryFromArtifact,
@@ -383,108 +454,84 @@ import {
383
454
  readAuditRows,
384
455
  responseModelIdObservationCountsLabel,
385
456
  responseModelIdObservationFromRecord
386
- } from "./chunk-D2T66PDV.js";
457
+ } from "./chunk-3SUDBGEI.js";
458
+ import "./chunk-LGTVWPRN.js";
459
+ import {
460
+ describeWriteBoundaryAttributionDowngrade,
461
+ gitCheckoutRoot,
462
+ isGitRepository,
463
+ preflightWriteBoundaries,
464
+ recoverCleanupReadyCompeteGroups
465
+ } from "./chunk-KRJQG47M.js";
466
+ import {
467
+ bindExecutionPlanEndpoints,
468
+ compileFleetExecutionPlan,
469
+ requireAgentSteps
470
+ } from "./chunk-DIAJYJYG.js";
387
471
  import "./chunk-U44YYLVV.js";
388
- import "./chunk-P5SC4DLJ.js";
389
472
  import {
390
- configureRunEventJournal
391
- } from "./chunk-UQIVHSE4.js";
392
- import "./chunk-USZA7GWL.js";
393
- import "./chunk-WTQGRBHV.js";
394
- import "./chunk-XR3XJN2M.js";
395
- import "./chunk-LVFANMOH.js";
473
+ foldPromptCacheTelemetry,
474
+ hasPromptCacheTelemetry,
475
+ uncachedPrefillTokens
476
+ } from "./chunk-QH3ZTUOA.js";
477
+ import {
478
+ SafetyDomainModule,
479
+ parseRigorOverride,
480
+ resolveRigor
481
+ } from "./chunk-GREYLTZ5.js";
482
+ import "./chunk-PTFISXQO.js";
396
483
  import {
397
484
  filterEntriesToActivePath
398
485
  } from "./chunk-O5F25NIE.js";
399
486
  import {
400
- emptyWorkspaceSnapshot,
401
- probeGitStatusAsync,
402
- probeWorkspaceAsync
403
- } from "./chunk-DNHVRBH4.js";
487
+ configureRunEventJournal
488
+ } from "./chunk-UQIVHSE4.js";
489
+ import "./chunk-LQTKDAUO.js";
404
490
  import {
405
491
  activeDecisionRefs,
406
492
  createDecisionBoardStore,
407
493
  decisionRationale,
408
494
  foldDecisionBoard
409
- } from "./chunk-CULVKYTK.js";
495
+ } from "./chunk-K3XN4LZ4.js";
496
+ import "./chunk-YQ3GFEUY.js";
497
+ import "./chunk-WTQGRBHV.js";
498
+ import "./chunk-WWRV5RJI.js";
499
+ import "./chunk-BHJMMCXS.js";
410
500
  import {
411
- discoverDeclaredChecks
412
- } from "./chunk-TLTGZTXI.js";
413
- import "./chunk-N37QC5FV.js";
501
+ FLEET_COMMANDS_REMEDY,
502
+ FleetCommandRegistryMissingError,
503
+ fleetStepBoundaries,
504
+ loadFleetCommands,
505
+ loadFleetContract,
506
+ renderFleetPrompt,
507
+ validateFleetCommands,
508
+ validateFleetGraph
509
+ } from "./chunk-7QQRPB2E.js";
414
510
  import {
415
- foldPromptCacheTelemetry,
416
- hasPromptCacheTelemetry,
417
- uncachedPrefillTokens
418
- } from "./chunk-QH3ZTUOA.js";
419
- import "./chunk-LQTKDAUO.js";
511
+ PluginsDomainModule,
512
+ pluginSnapshotFor,
513
+ reloadPluginResources
514
+ } from "./chunk-6UJ7RDI7.js";
420
515
  import {
421
- SafetyDomainModule,
422
- parseRigorOverride,
423
- resolveRigor
424
- } from "./chunk-NCCQ6DVS.js";
516
+ discoverDeclaredChecks
517
+ } from "./chunk-QI72X67S.js";
518
+ import "./chunk-A6DULIMH.js";
425
519
  import "./chunk-SD7SHNDW.js";
426
- import "./chunk-T52TPHYC.js";
427
- import {
428
- formatBootTrace,
429
- traceBoot
430
- } from "./chunk-FXFVDPWY.js";
431
- import {
432
- source_default
433
- } from "./chunk-3T4DXWP6.js";
434
520
  import {
435
- INTERACTIVE_LOOP_BLOCK_BUDGET,
436
- applyEditsToNormalizedContent,
437
- assertRegisteredBuiltinTools,
438
- createEngineAgent,
439
- createLoopGuardRegistration,
440
- createProtectedArtifactsRegistration,
441
- diffWords,
442
- generateDiffString,
443
- lazyTool,
444
- normalizeToLF,
445
- patchProviderThinkingPayload,
446
- patchResponseSchemaPayloadForDialect,
447
- patchToolChoiceNamedPayload,
448
- patchToolChoiceNonePayload,
449
- readOrchTurnToolCallBudget,
450
- registerCoreTools,
451
- registerHarnessExtensionTools,
452
- resolveSessionTools,
453
- sanitizeLockedSynthesisMessage,
454
- stripBom
455
- } from "./chunk-CE64C5K5.js";
521
+ emptyWorkspaceSnapshot,
522
+ probeGitStatusAsync,
523
+ probeWorkspaceAsync
524
+ } from "./chunk-DNHVRBH4.js";
456
525
  import {
457
- MIDDLEWARE_HOOK_TEXT_MAX_CHARS,
458
- MiddlewareDomainModule,
459
- WATCHDOG_TASK,
460
- announceMemoryStepEndpoint,
461
- buildUserHookRegistrations,
462
- createDetachedDispatchNudgeRegistration,
463
- createHookReceiptLog,
464
- createMarketplaceOfferRegistration,
465
- createMemoryInterventionRegistration,
466
- createMiddlewareToolChoiceControl,
467
- createReadOnlyExplorationNudgeRegistration,
468
- createSkillsReminderRegistration,
469
- createTaskBoardReminderRegistration,
470
- createTaskNudgeRegistration,
471
- createUnbackedWorkerClaimRegistration,
472
- createWatchdogRegistration,
473
- formatRegistrationConflict,
474
- openDetachedBatchViews,
475
- watchdogBriefing,
476
- writeMiddlewareDiagnosticToStderr
477
- } from "./chunk-MBJO5VNZ.js";
526
+ ACP_TURN_FAILED_MESSAGE,
527
+ AcpRequestError,
528
+ AcpTimeoutError,
529
+ acpErrorMessage,
530
+ createStdioServerTransport
531
+ } from "./chunk-XNZWWDC3.js";
478
532
  import {
479
- resolveFdBinary
480
- } from "./chunk-JABWPKFY.js";
481
- import "./chunk-4MFBBY2Z.js";
482
- import "./chunk-CPXGJI2A.js";
483
- import "./chunk-MZHXENL7.js";
484
- import "./chunk-ZGIGW4ZG.js";
485
- import "./chunk-HRAKUPIH.js";
486
- import "./chunk-XCUDZQLX.js";
487
- import "./chunk-K2BLQC5E.js";
533
+ collectSessionEntries
534
+ } from "./chunk-2VBWFXYE.js";
488
535
  import {
489
536
  COUNCIL_JUDGE_PROMPT,
490
537
  COUNCIL_MAX_MEMBERS,
@@ -531,90 +578,53 @@ import {
531
578
  timeoutMsArg,
532
579
  toolPresentationPolicy,
533
580
  withResolvedDispatchPlan
534
- } from "./chunk-NO7J45X6.js";
581
+ } from "./chunk-4ATBOFRP.js";
535
582
  import {
536
583
  defaultRoutingIntent
537
- } from "./chunk-T4TY5GG3.js";
584
+ } from "./chunk-MO65K5CH.js";
538
585
  import {
539
586
  createTaskBoardStore,
540
587
  foldSessionTaskHistory,
541
588
  foldTaskBoard,
542
589
  taskBoardCounts
543
- } from "./chunk-YPRSNUTC.js";
590
+ } from "./chunk-KOAHT3N2.js";
544
591
  import {
545
- describeCallTarget,
546
- sanitizeCallTargetText,
547
- sanitizeMultilineDisplayText
548
- } from "./chunk-2GPGAE5W.js";
592
+ DEFAULT_RECENT_ENTRY_LIMIT,
593
+ assessFinishContract,
594
+ recentEntries
595
+ } from "./chunk-AY4XE6GN.js";
596
+ import {
597
+ combineBashOutput,
598
+ runBashCommand
599
+ } from "./chunk-555E2WVV.js";
549
600
  import "./chunk-OH3YYA3B.js";
550
601
  import {
551
602
  extensionPanelText
552
- } from "./chunk-24S3DN22.js";
553
- import "./chunk-SL2RDHKO.js";
603
+ } from "./chunk-6TKOFFGE.js";
554
604
  import {
555
- expandInlineFileReferencesAsync
556
- } from "./chunk-YGDMBK7O.js";
605
+ effectiveToolCall
606
+ } from "./chunk-2JBZYUPY.js";
557
607
  import {
558
- escapeRegExp,
559
- resolveToCwd
560
- } from "./chunk-V552WL53.js";
561
- import {
562
- sweepExpiredToolOffloads,
563
- toolResultPresentationPolicy,
564
- toolResultPresentationText
565
- } from "./chunk-IZYTT3CD.js";
566
- import {
567
- formatSize
568
- } from "./chunk-KECNXMDE.js";
569
- import "./chunk-WXA2CFJO.js";
608
+ describeCallTarget,
609
+ sanitizeCallTargetText,
610
+ sanitizeMultilineDisplayText
611
+ } from "./chunk-XNIZBOFV.js";
570
612
  import {
571
613
  TOOL_PROFILE_NAMES
572
- } from "./chunk-GEVQNST4.js";
614
+ } from "./chunk-XZWSP67B.js";
573
615
  import {
574
616
  agentRoleFactsResolver,
575
617
  gateDeciderAgentId,
576
618
  requestExecutionRole,
577
619
  withAttemptRole
578
- } from "./chunk-3LXJOICS.js";
579
- import {
580
- narrowDispatchIntentToReadOnly,
581
- normalizeDispatchIntent
582
- } from "./chunk-L4N3DWNW.js";
583
- import "./chunk-BAU36233.js";
584
- import "./chunk-VQD7NH7Z.js";
585
- import "./chunk-CKK25WN3.js";
586
- import "./chunk-O3VV6IVK.js";
587
- import {
588
- SKILL_CONTEXT_STATE,
589
- SKILL_SUGGESTION_PREFIX,
590
- armedSkillSurface,
591
- isSessionEntry,
592
- isSkillActivation,
593
- latestSkillContextState,
594
- mainSkillContextState,
595
- skillActivationFromToolDetails,
596
- skillContextContentHash,
597
- skillSurfaceLabels,
598
- skillSurfaceNames,
599
- verifiedSkillContextCheckpoint,
600
- withModelSkillActivation
601
- } from "./chunk-KAFMW7WM.js";
602
- import {
603
- DEFAULT_RECENT_ENTRY_LIMIT,
604
- assessFinishContract,
605
- recentEntries
606
- } from "./chunk-BQQ5MXUC.js";
607
- import "./chunk-DLIYANB7.js";
608
- import {
609
- captureProjectSurface,
610
- projectSurfaceTrustNotice
611
- } from "./chunk-24TOGHPO.js";
620
+ } from "./chunk-H6IUCY6Q.js";
612
621
  import {
613
622
  ProvidersDomainModule,
614
623
  applyModelCapabilityPatch,
615
624
  canonicalEndpointKey,
616
625
  endpointCapacitiesForStatuses,
617
626
  endpointCapacityForStatus,
627
+ estimateInputTokensFromContext,
618
628
  firstRuntimeResolutionError,
619
629
  foregroundStreamUsage,
620
630
  gatewayRoutingObservationFromRecord,
@@ -627,6 +637,8 @@ import {
627
637
  modelIdsForStatus,
628
638
  modelResidencyForStatus,
629
639
  normalizeCostProvenance,
640
+ observeCacheDeployment,
641
+ probeCapabilitiesForModel,
630
642
  refineRuntimeTargetWithModelHints,
631
643
  registerForegroundStream,
632
644
  residencyTargetKey,
@@ -638,12 +650,17 @@ import {
638
650
  resolveRuntimeTarget,
639
651
  runtimeResolutionWarningsBesideThinkingNotice,
640
652
  runtimeTargetSnapshot,
653
+ setGlobalDefaultMaxOutputTokens,
641
654
  setProtectedModelsProvider,
642
655
  thinkingLevelChoiceLabel,
643
656
  thinkingLevelFromChoiceLabel,
644
657
  withRunOverrides
645
- } from "./chunk-WT5TRMO4.js";
658
+ } from "./chunk-4HFJKRGZ.js";
646
659
  import "./chunk-MCJKEGHO.js";
660
+ import "./chunk-CTGZCEI6.js";
661
+ import {
662
+ getSharedBus
663
+ } from "./chunk-RL7LJYN4.js";
647
664
  import {
648
665
  AutoCompactionTrigger,
649
666
  DEFAULT_COMPACTION_THRESHOLD,
@@ -663,111 +680,48 @@ import {
663
680
  reconcileSnapshot,
664
681
  shouldCompact,
665
682
  snapshotInputTokens
666
- } from "./chunk-77CZRFTE.js";
667
- import "./chunk-BO4XV5VX.js";
668
- import "./chunk-VTYHHQ57.js";
669
- import {
670
- DEFAULT_AUTONOMY_LEVEL,
671
- modelMayActivateSkills
672
- } from "./chunk-EM2WNQS2.js";
673
- import {
674
- atomicWrite,
675
- cwdHash,
676
- openSession,
677
- readSessionTailTurns,
678
- sessionCurrentPath,
679
- sessionPaths
680
- } from "./chunk-FQOOGXBH.js";
681
- import "./chunk-UHW5V7HC.js";
682
- import "./chunk-B6UM3OZC.js";
683
- import "./chunk-MYI32N4R.js";
684
- import "./chunk-KMF54VH3.js";
683
+ } from "./chunk-SJMNU4ZS.js";
685
684
  import {
686
- combineBashOutput,
687
- runBashCommand
688
- } from "./chunk-5A6XR3RJ.js";
685
+ BusChannels,
686
+ isRunAbortedPayload
687
+ } from "./chunk-W5RM7YAH.js";
689
688
  import {
690
689
  redactSecretString,
691
690
  redactToolArgs
692
691
  } from "./chunk-EFSEIZE6.js";
692
+ import "./chunk-SL2RDHKO.js";
693
693
  import {
694
- getSharedBus
695
- } from "./chunk-B5ZTR6KZ.js";
696
- import {
697
- BusChannels,
698
- isRunAbortedPayload
699
- } from "./chunk-6CB2IL4N.js";
700
- import {
701
- incompleteInstallationAdvice
702
- } from "./chunk-3A3CUMKA.js";
703
- import "./chunk-VHKTOLEW.js";
704
- import "./chunk-KPRLAMP4.js";
705
- import "./chunk-W2RJEH6Q.js";
706
- import "./chunk-CVDAFGPW.js";
707
- import {
708
- enumerateWorkspaceFilesAsync
709
- } from "./chunk-PPEZJWUG.js";
710
- import "./chunk-WDV62RKY.js";
711
- import {
712
- VALID_THINKING_LEVELS,
713
- formatContextWindowSlots,
714
- registerBuiltinRuntimes
715
- } from "./chunk-SELG4SUR.js";
716
- import {
717
- resolveProviderReference
718
- } from "./chunk-KS7ETA3P.js";
719
- import {
720
- targetRequiresAuth
721
- } from "./chunk-6TAATXXH.js";
722
- import "./chunk-VNBICSS2.js";
723
- import {
724
- getRuntimeRegistry
725
- } from "./chunk-SRCEQKQS.js";
694
+ expandInlineFileReferencesAsync
695
+ } from "./chunk-YGDMBK7O.js";
696
+ import "./chunk-JURMQWVJ.js";
726
697
  import {
727
- AGENT_ROLE_TOOLS_REQUIRED_REASON,
728
- supportsAgentRoleTools
729
- } from "./chunk-TN5FW4XY.js";
698
+ escapeRegExp
699
+ } from "./chunk-IZZI3SKQ.js";
730
700
  import {
731
- StringEnum,
732
- cleanupEngineSessionResources,
733
- completeEngineText,
734
- isEngineRetryableAssistantError,
735
- stream,
736
- streamSimple
737
- } from "./chunk-5CMARGPF.js";
738
- import "./chunk-DXVMLM3Z.js";
739
- import "./chunk-WB7POC6M.js";
701
+ sweepExpiredToolOffloads,
702
+ toolResultPresentationPolicy,
703
+ toolResultPresentationText
704
+ } from "./chunk-ZKQ63XZ5.js";
705
+ import "./chunk-IC7JXLOM.js";
740
706
  import {
741
- discoverMarketplaceSkills,
742
- installSkill,
743
- modelVisibleSkills
744
- } from "./chunk-MZNWZUJM.js";
745
- import "./chunk-DNCE23JJ.js";
746
- import "./chunk-RXFPB32E.js";
707
+ captureProjectSurface,
708
+ projectSurfaceTrustNotice
709
+ } from "./chunk-X6FLVUM5.js";
710
+ import "./chunk-GHXGMFQ5.js";
747
711
  import {
748
- FLEET_COMMANDS_REMEDY,
749
- FleetCommandRegistryMissingError,
750
- fleetStepBoundaries,
751
- loadFleetCommands,
752
- loadFleetContract,
753
- renderFleetPrompt,
754
- validateFleetCommands,
755
- validateFleetGraph
756
- } from "./chunk-KKEYGFX4.js";
712
+ formatSize
713
+ } from "./chunk-KECNXMDE.js";
714
+ import "./chunk-WXA2CFJO.js";
757
715
  import {
758
- PluginsDomainModule,
759
- pluginSnapshotFor,
760
- reloadPluginResources
761
- } from "./chunk-YKRJTYNP.js";
762
- import "./chunk-SER7RRAE.js";
716
+ resolveToCwd
717
+ } from "./chunk-KP5BPXR3.js";
763
718
  import {
764
719
  RESULT_SUMMARY_MAX_BYTES_CEILING,
765
720
  isUserVisibleAgent,
766
- parseJsonObjectPayload,
767
721
  parseScoutResult,
768
722
  parseVerifierResult,
769
723
  resultContractSourceId
770
- } from "./chunk-34XHRVKG.js";
724
+ } from "./chunk-I47EJPYL.js";
771
725
  import "./chunk-XW2UZICE.js";
772
726
  import {
773
727
  SETTINGS_V1_PATH_MOVES,
@@ -778,21 +732,26 @@ import {
778
732
  setFleetProfileInSettings,
779
733
  updateSettings,
780
734
  useTargetInSettings
781
- } from "./chunk-4QKAITQT.js";
735
+ } from "./chunk-FPS4R2RN.js";
782
736
  import "./chunk-DVNAPPXU.js";
783
737
  import {
784
738
  interopAgentKind
785
739
  } from "./chunk-5EQO5NWP.js";
786
- import "./chunk-HOX4YZ2K.js";
740
+ import "./chunk-H2WSCZZT.js";
787
741
  import {
788
742
  toolMutationPaths
789
- } from "./chunk-2O2LVQQK.js";
743
+ } from "./chunk-SQBT46OF.js";
790
744
  import {
791
745
  canonicalizeExistingPath
792
746
  } from "./chunk-KQ6IDQIB.js";
793
747
  import {
794
- typebox_exports
795
- } from "./chunk-GH5ZR6JP.js";
748
+ narrowDispatchIntentToReadOnly,
749
+ normalizeDispatchIntent
750
+ } from "./chunk-L4N3DWNW.js";
751
+ import "./chunk-YQYINEJI.js";
752
+ import "./chunk-H72DCH3E.js";
753
+ import "./chunk-2KUBKL63.js";
754
+ import "./chunk-MYI32N4R.js";
796
755
  import "./chunk-R2P2U3ZS.js";
797
756
  import "./chunk-NTTS3O53.js";
798
757
  import {
@@ -800,14 +759,12 @@ import {
800
759
  } from "./chunk-M4KFUXS7.js";
801
760
  import {
802
761
  ToolNames
803
- } from "./chunk-WLHX3MM5.js";
762
+ } from "./chunk-V4XJWDHR.js";
804
763
  import {
805
- getVersionInfo
806
- } from "./chunk-GD55RTIW.js";
807
- import {
808
- readClioVersion,
809
- readPiMonoVersion
810
- } from "./chunk-E3LEPLQ2.js";
764
+ VALID_THINKING_LEVELS,
765
+ formatContextWindowSlots,
766
+ registerBuiltinRuntimes
767
+ } from "./chunk-NPLLK3HO.js";
811
768
  import {
812
769
  ACTIVE_ROUTING_POSTURES,
813
770
  ACTIVE_ROUTING_ROLES,
@@ -815,13 +772,39 @@ import {
815
772
  DEFAULT_SETTINGS,
816
773
  THINKING_LEVELS,
817
774
  nextOutputStyle
818
- } from "./chunk-3XE4NRLF.js";
775
+ } from "./chunk-ZKJU55MX.js";
819
776
  import "./chunk-U2MSJ57E.js";
820
777
  import {
821
778
  configureGuardrails,
822
779
  guardrailValuesFromSettings
823
780
  } from "./chunk-C27U2TYG.js";
824
- import "./chunk-GJ24ODAX.js";
781
+ import {
782
+ resolveProviderReference
783
+ } from "./chunk-EM2DIQAJ.js";
784
+ import {
785
+ targetRequiresAuth
786
+ } from "./chunk-ZKVMDNAN.js";
787
+ import "./chunk-VNBICSS2.js";
788
+ import "./chunk-B5GGDIHT.js";
789
+ import {
790
+ getRuntimeRegistry
791
+ } from "./chunk-SRCEQKQS.js";
792
+ import {
793
+ AGENT_ROLE_TOOLS_REQUIRED_REASON,
794
+ supportsAgentRoleTools
795
+ } from "./chunk-JIYWMQZ5.js";
796
+ import {
797
+ StringEnum,
798
+ cleanupEngineSessionResources,
799
+ completeEngineText,
800
+ isEngineRetryableAssistantError,
801
+ stream,
802
+ streamSimple
803
+ } from "./chunk-UIU7MGZ3.js";
804
+ import "./chunk-DXVMLM3Z.js";
805
+ import "./chunk-VQD7NH7Z.js";
806
+ import "./chunk-CKK25WN3.js";
807
+ import "./chunk-XTQ7MEJG.js";
825
808
  import {
826
809
  setCommitDecisionRefsProvider,
827
810
  setGitCommitAttributionEnabled
@@ -831,18 +814,68 @@ import {
831
814
  rawDurationMs
832
815
  } from "./chunk-6EXUUOSN.js";
833
816
  import "./chunk-ZTNFYMIO.js";
817
+ import {
818
+ SKILL_CONTEXT_STATE,
819
+ SKILL_SUGGESTION_PREFIX,
820
+ armedSkillSurface,
821
+ isSessionEntry,
822
+ isSkillActivation,
823
+ latestSkillContextState,
824
+ mainSkillContextState,
825
+ skillActivationFromToolDetails,
826
+ skillContextContentHash,
827
+ skillSurfaceLabels,
828
+ skillSurfaceNames,
829
+ verifiedSkillContextCheckpoint,
830
+ withModelSkillActivation
831
+ } from "./chunk-NBPA5QM6.js";
832
+ import {
833
+ DEFAULT_AUTONOMY_LEVEL,
834
+ modelMayActivateSkills
835
+ } from "./chunk-EM2WNQS2.js";
836
+ import {
837
+ redactSecretsText
838
+ } from "./chunk-O3VV6IVK.js";
834
839
  import "./chunk-DVJL77SO.js";
835
- import "./chunk-TK2BMCBZ.js";
836
- import "./chunk-B5GGDIHT.js";
837
840
  import {
838
- safeResourceWrite
839
- } from "./chunk-ZZFWWYLX.js";
841
+ atomicWrite,
842
+ cwdHash,
843
+ openSession,
844
+ readSessionTailTurns,
845
+ sessionCurrentPath,
846
+ sessionPaths
847
+ } from "./chunk-3RDHGNU7.js";
848
+ import "./chunk-UHW5V7HC.js";
849
+ import "./chunk-KMF54VH3.js";
850
+ import "./chunk-SER7RRAE.js";
851
+ import {
852
+ typebox_exports
853
+ } from "./chunk-GH5ZR6JP.js";
854
+ import "./chunk-TK2BMCBZ.js";
840
855
  import {
841
856
  clioConfigDir,
842
857
  clioDataDir,
843
858
  clioStateDir,
844
859
  stateRootRemoved
845
860
  } from "./chunk-CTTI7G3T.js";
861
+ import "./chunk-VHKTOLEW.js";
862
+ import "./chunk-KPRLAMP4.js";
863
+ import "./chunk-W2RJEH6Q.js";
864
+ import "./chunk-CVDAFGPW.js";
865
+ import {
866
+ enumerateWorkspaceFilesAsync
867
+ } from "./chunk-PPEZJWUG.js";
868
+ import "./chunk-WDV62RKY.js";
869
+ import {
870
+ safeResourceWrite
871
+ } from "./chunk-ZZFWWYLX.js";
872
+ import {
873
+ getVersionInfo
874
+ } from "./chunk-GD55RTIW.js";
875
+ import {
876
+ readClioVersion,
877
+ readPiMonoVersion
878
+ } from "./chunk-E3LEPLQ2.js";
846
879
  import {
847
880
  init_esm_shims
848
881
  } from "./chunk-ECBHH7LU.js";
@@ -2002,6 +2035,17 @@ function findTurnStartForProtection(entries, entryIndex, startIndex) {
2002
2035
  }
2003
2036
  return -1;
2004
2037
  }
2038
+ function resultFollowsCallInBatch(turn, resultEntry, call) {
2039
+ let parent = resultEntry.parentTurnId;
2040
+ for (let hops = 0; hops < turn.length && parent; hops++) {
2041
+ if (parent === call.turnId) return true;
2042
+ const link = turn.find((candidate) => candidate.turnId === parent);
2043
+ if (!link) return false;
2044
+ if (link.kind === "message" && link.role !== "tool_call" && link.role !== "tool_result") return false;
2045
+ parent = link.parentTurnId;
2046
+ }
2047
+ return false;
2048
+ }
2005
2049
  function captureSkillContext(entries, selection) {
2006
2050
  if (!selection || selection.unknown) return void 0;
2007
2051
  const newestSelected = Math.max(
@@ -2050,7 +2094,7 @@ function captureSkillContext(entries, selection) {
2050
2094
  (candidate) => candidate.kind === "message" && candidate.role === "tool_result" && payloadObject2(candidate.payload)?.toolCallId === callId
2051
2095
  );
2052
2096
  const resultEntry = results[0];
2053
- if (results.length !== 1 || resultEntry?.kind !== "message" || !turn.includes(resultEntry) || resultEntry.parentTurnId !== call.turnId || entry.parentTurnId !== request.turnId)
2097
+ if (results.length !== 1 || resultEntry?.kind !== "message" || !turn.includes(resultEntry) || !resultFollowsCallInBatch(turn, resultEntry, call) || entry.parentTurnId !== request.turnId)
2054
2098
  return void 0;
2055
2099
  const payload = payloadObject2(resultEntry.payload);
2056
2100
  const result = payloadObject2(payload?.result);
@@ -2262,6 +2306,7 @@ function addCompactionUsage(total, raw) {
2262
2306
  output: base.output + output,
2263
2307
  cacheRead: base.cacheRead + cacheRead,
2264
2308
  cacheWrite: base.cacheWrite + cacheWrite,
2309
+ ...base.cacheWrite1h === void 0 && usage.cacheWrite1h === void 0 ? {} : { cacheWrite1h: (base.cacheWrite1h ?? 0) + numberOrZero(usage.cacheWrite1h) },
2265
2310
  reasoning: base.reasoning + numberOrZero(usage.reasoning),
2266
2311
  totalTokens: base.totalTokens + totalTokens,
2267
2312
  cost: { total: base.cost.total + numberOrZero(usage.cost?.total) },
@@ -2272,7 +2317,7 @@ function retainReportedUsage(previous, raw) {
2272
2317
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return previous;
2273
2318
  const usage = raw;
2274
2319
  const known = { ...previous };
2275
- for (const field2 of ["input", "output", "cacheRead", "cacheWrite", "totalTokens"]) {
2320
+ for (const field2 of ["input", "output", "cacheRead", "cacheWrite", "cacheWrite1h", "totalTokens"]) {
2276
2321
  const value = numberOrZero(usage[field2]);
2277
2322
  if (value > 0) known[field2] = value;
2278
2323
  }
@@ -4405,6 +4450,15 @@ async function serveClioAcpAgent(options) {
4405
4450
  }
4406
4451
  const text = promptText(params);
4407
4452
  if (text.length === 0) throw new AcpRequestError(-32602, "prompt text is required", { code: "invalid_params" });
4453
+ const targetId = routingSnapshot().target;
4454
+ const target = targetId ? options.providers?.getTarget(targetId) : void 0;
4455
+ const runtime = target ? options.providers?.getRuntime(target.runtime) : void 0;
4456
+ if (target && runtime && options.providers && !options.providers.auth.statusForTarget(target, runtime).available) {
4457
+ throw new AcpRequestError(-32e3, "credentials for the selected target are unavailable", {
4458
+ code: "prompt_not_admitted",
4459
+ reason: "authentication-required"
4460
+ });
4461
+ }
4408
4462
  if (options.session?.current()?.id !== session.id && options.session) options.session.resume(session.id);
4409
4463
  const active = createActivePromptState();
4410
4464
  session.activePrompt = active;
@@ -4466,7 +4520,7 @@ async function serveClioAcpAgent(options) {
4466
4520
  }
4467
4521
  return promptResponse(active.stopReason, active);
4468
4522
  });
4469
- return await new Promise((resolve10) => {
4523
+ return await new Promise((resolve11) => {
4470
4524
  options.transport.onClose(() => {
4471
4525
  permission.unregister();
4472
4526
  unsubscribeEventStream();
@@ -4474,14 +4528,14 @@ async function serveClioAcpAgent(options) {
4474
4528
  for (const session of sessions.values()) cancelSession(session, "ACP transport closed");
4475
4529
  const inFlight = promptSettled;
4476
4530
  if (inFlight === null) {
4477
- resolve10(0);
4531
+ resolve11(0);
4478
4532
  return;
4479
4533
  }
4480
- const timer = setTimeout(() => resolve10(0), ACP_PROMPT_SETTLE_BOUND_MS);
4534
+ const timer = setTimeout(() => resolve11(0), ACP_PROMPT_SETTLE_BOUND_MS);
4481
4535
  timer.unref?.();
4482
4536
  void inFlight.then(() => {
4483
4537
  clearTimeout(timer);
4484
- resolve10(0);
4538
+ resolve11(0);
4485
4539
  });
4486
4540
  });
4487
4541
  });
@@ -4515,7 +4569,8 @@ var DEFAULT_RETRY_SETTINGS = {
4515
4569
  maxRetries: 3,
4516
4570
  baseDelayMs: 2e3,
4517
4571
  maxDelayMs: 6e4,
4518
- streamStallMs: 18e4
4572
+ streamStallMs: 18e4,
4573
+ firstTokenStallMs: 6e5
4519
4574
  };
4520
4575
  var MODEL_LOADING_PATTERN = /model is unloaded|model is (?:still )?loading|model not loaded|no model (?:is )?loaded|loading model|model_?load(?:ing)?_?in_?progress|is not loaded/i;
4521
4576
  var MODEL_LOADING_MIN_DELAY_MS = 15e3;
@@ -4598,7 +4653,8 @@ function normalizeRetrySettings(raw) {
4598
4653
  maxRetries: normalizeNonNegativeInteger(raw?.maxRetries, DEFAULT_RETRY_SETTINGS.maxRetries),
4599
4654
  baseDelayMs: normalizeNonNegativeInteger(raw?.baseDelayMs, DEFAULT_RETRY_SETTINGS.baseDelayMs),
4600
4655
  maxDelayMs: normalizeNonNegativeInteger(raw?.maxDelayMs, DEFAULT_RETRY_SETTINGS.maxDelayMs),
4601
- streamStallMs: normalizeNonNegativeInteger(raw?.streamStallMs, DEFAULT_RETRY_SETTINGS.streamStallMs)
4656
+ streamStallMs: normalizeNonNegativeInteger(raw?.streamStallMs, DEFAULT_RETRY_SETTINGS.streamStallMs),
4657
+ firstTokenStallMs: normalizeNonNegativeInteger(raw?.firstTokenStallMs, DEFAULT_RETRY_SETTINGS.firstTokenStallMs)
4602
4658
  };
4603
4659
  }
4604
4660
 
@@ -4817,7 +4873,8 @@ function stringField(record2, ...keys) {
4817
4873
  }
4818
4874
  return null;
4819
4875
  }
4820
- function pathFromCall(toolName, args, cwd, into) {
4876
+ function pathFromCall(recordedTool, recordedArgs, cwd, into) {
4877
+ const { toolName, args } = effectiveToolCall(recordedTool, recordedArgs);
4821
4878
  if (!READ_LEDGER_TOOLS.has(toolName)) return;
4822
4879
  const record2 = isRecord3(args) ? args : null;
4823
4880
  const named = stringField(record2, "path", "file_path", "filePath");
@@ -4993,6 +5050,7 @@ function sideQuestionUsage(raw) {
4993
5050
  output,
4994
5051
  cacheRead,
4995
5052
  cacheWrite,
5053
+ ...usage.cacheWrite1h === void 0 ? {} : { cacheWrite1h: positive(usage.cacheWrite1h) },
4996
5054
  reasoning: positive(usage.reasoning),
4997
5055
  totalTokens,
4998
5056
  costUsd: positive(usage.cost?.total)
@@ -5410,29 +5468,166 @@ function styleTaggedNotice(line) {
5410
5468
 
5411
5469
  // src/interactive/renderers/retry-status.ts
5412
5470
  init_esm_shims();
5413
- var RETRY_ERROR_MAX_CHARS = 2e3;
5414
- var RETRY_ERROR_TRUNCATION_MARKER = "\u2026 [retry error truncated]";
5415
- function boundedRetryError(value) {
5416
- const characters = Array.from(value);
5417
- if (characters.length <= RETRY_ERROR_MAX_CHARS) return value;
5418
- return `${characters.slice(0, RETRY_ERROR_MAX_CHARS).join("").trimEnd()}${RETRY_ERROR_TRUNCATION_MARKER}`;
5419
- }
5420
- function rawRetryStatus(status) {
5421
- const suffix = status.errorMessage ? `: ${boundedRetryError(status.errorMessage)}` : "";
5471
+
5472
+ // src/interactive/renderers/preview.ts
5473
+ init_esm_shims();
5474
+ function previewRows(rows, limit, width, tail = false) {
5475
+ if (rows.length <= limit) return [...rows];
5476
+ if (limit <= 0) return [];
5477
+ const count2 = Math.max(0, limit - 1);
5478
+ const hint = clioTheme().fg("dim", truncateToWidth(`\u2026 ${rows.length - count2} rows \xB7 /view`, Math.max(1, width)));
5479
+ return tail ? [hint, ...rows.slice(rows.length - count2)] : [...rows.slice(0, count2), hint];
5480
+ }
5481
+ function previewBudget(limit, terminalRows = 40) {
5482
+ return Math.min(limit, Math.max(2, Math.floor((terminalRows - 8) / 2)));
5483
+ }
5484
+
5485
+ // src/interactive/renderers/provider-error.ts
5486
+ init_esm_shims();
5487
+ import { stripVTControlCharacters } from "node:util";
5488
+ var SCAN_LIMIT = 8192;
5489
+ var DISPLAY_LIMIT = 600;
5490
+ var ROUTE_ADVICE_TAIL = 1024;
5491
+ function terminalSafePrefix(value, limit) {
5492
+ const end = Math.min(value.length, limit);
5493
+ const parts = [];
5494
+ let start = 0;
5495
+ let i = 0;
5496
+ while (i < end) {
5497
+ const code = value.charCodeAt(i);
5498
+ if (code !== 27 && !(code >= 128 && code <= 159)) {
5499
+ i++;
5500
+ continue;
5501
+ }
5502
+ parts.push(value.slice(start, i));
5503
+ const introducer = code === 27 ? value.charCodeAt(++i) : code;
5504
+ i++;
5505
+ if (introducer === 91 || introducer === 155) {
5506
+ while (i < end) {
5507
+ const next = value.charCodeAt(i++);
5508
+ if (next >= 64 && next <= 126) break;
5509
+ }
5510
+ } else if ([93, 80, 88, 94, 95, 157, 144, 152, 158, 159].includes(introducer)) {
5511
+ while (i < end) {
5512
+ const next = value.charCodeAt(i++);
5513
+ if (next === 7 || next === 156) break;
5514
+ if (next === 27 && i < end && value.charCodeAt(i) === 92) {
5515
+ i++;
5516
+ break;
5517
+ }
5518
+ }
5519
+ }
5520
+ start = i;
5521
+ }
5522
+ parts.push(value.slice(start, end));
5523
+ return stripVTControlCharacters(parts.join(""));
5524
+ }
5525
+ function providerErrorEvidence(value, scanLimit = value.length) {
5526
+ return redactSecretsText(
5527
+ redactSecretString(terminalSafePrefix(value, scanLimit)).replace(
5528
+ /(\b(?:authorization["']?\s*[:=]\s*["']?\s*)?(?:Bearer|Basic)\s+)[^\s"'<>]+/gi,
5529
+ "$1[redacted]"
5530
+ ),
5531
+ { count: 0 }
5532
+ ).replace(/[\p{Cc}\p{Cf}]/gu, (char) => char === "\n" || char === " " ? char : " ");
5533
+ }
5534
+ function presentProviderError(value) {
5535
+ const available = providerErrorEvidence(value, SCAN_LIMIT);
5536
+ const beyondScan = value.length > SCAN_LIMIT;
5537
+ const routeParts = (beyondScan ? providerErrorEvidence(value.slice(-ROUTE_ADVICE_TAIL)) : available).match(
5538
+ /\n\n((LiteLLM route [^\n]+ failed\.) (Clio did not retry or substitute another model); (select a different route with \/model, then resend\.))$/
5539
+ );
5540
+ const routeAdvice = routeParts?.[1];
5541
+ const sample = routeAdvice && !beyondScan ? available.slice(0, available.length - routeAdvice.length).trimEnd() : available;
5542
+ let summary = sample;
5543
+ const jsonStart = sample.indexOf("{");
5544
+ const html = /<!doctype\s+html|<html\b/i.test(sample);
5545
+ if (html) {
5546
+ const title = sample.match(/<title[^>]*>([^<]*)<\/title>/i)?.[1];
5547
+ const prefix = sample.slice(0, sample.indexOf("<")).trim();
5548
+ summary = [
5549
+ prefix,
5550
+ title,
5551
+ routeAdvice ? "" : "Provider returned an HTML error page. Check the provider or gateway endpoint."
5552
+ ].filter(Boolean).join("; ");
5553
+ } else if (jsonStart >= 0) {
5554
+ const fields = [...sample.matchAll(/"(?:message|detail|type|code)"\s*:\s*"((?:[^"\\]|\\.)*)/g)].map((match) => {
5555
+ const quoted = match[1];
5556
+ if (quoted === void 0) return "";
5557
+ try {
5558
+ const decoded = JSON.parse(`"${quoted}"`);
5559
+ return typeof decoded === "string" ? providerErrorEvidence(decoded) : "";
5560
+ } catch {
5561
+ return "";
5562
+ }
5563
+ });
5564
+ if (fields.some(Boolean))
5565
+ summary = [sample.slice(0, jsonStart).trim(), ...new Set(fields)].filter(Boolean).join("; ");
5566
+ }
5567
+ const status = sample.match(/\b(?:HTTP(?:\/\d(?:\.\d)?)?\s*|status(?:_code)?["']?\s*[:=]\s*)([45]\d\d)\b/i)?.[1] ?? sample.match(/"(?:status|status_?code)"\s*:\s*([45]\d{2})(?=\s*[,}])/i)?.[1] ?? sample.match(/"error"\s*:\s*\{[^{}]*?"code"\s*:\s*([45]\d{2})(?=\s*[,}])/i)?.[1];
5568
+ if (status && !summary.includes(status)) summary = `HTTP ${status}; ${summary}`;
5569
+ summary = summary.replace(/\s+/g, " ").trim();
5570
+ if (routeAdvice) {
5571
+ const prefix = summary.slice(0, 60);
5572
+ const identity = routeParts?.[2];
5573
+ const policy = routeParts?.[3];
5574
+ const remedy = routeParts?.[4];
5575
+ const advice = identity && policy && remedy ? `${remedy} ${policy}. ${identity}` : routeAdvice;
5576
+ summary = `${prefix}${summary.length > 60 ? " ..." : ""}; ${advice}`;
5577
+ }
5578
+ const shortened = summary.length > DISPLAY_LIMIT || value.length > SCAN_LIMIT || summary !== sample.trim();
5579
+ return `${summary.slice(0, DISPLAY_LIMIT)}${shortened ? " ... [available diagnostic: /view transcript]" : ""}`;
5580
+ }
5581
+
5582
+ // src/interactive/renderers/retry-status.ts
5583
+ function rawRetryStatus(status, unbounded) {
5584
+ const showError = unbounded || status.phase !== "waiting" && status.phase !== "retrying";
5585
+ const suffix = showError && status.errorMessage ? `: ${unbounded ? providerErrorEvidence(status.errorMessage) : presentProviderError(status.errorMessage)}` : "";
5422
5586
  if (status.phase === "waiting") {
5423
- return `[retry] attempt ${status.attempt}/${status.maxAttempts} in ${status.seconds ?? 0}s${suffix}`;
5587
+ return `[retry] provider retry ${status.attempt}/${status.maxAttempts} in ${status.seconds ?? 0}s${suffix}`;
5424
5588
  }
5425
5589
  if (status.phase === "scheduled") {
5426
5590
  const seconds = Math.ceil((status.delayMs ?? 0) / 1e3);
5427
- return `[retry] attempt ${status.attempt}/${status.maxAttempts} scheduled in ${seconds}s${suffix}`;
5591
+ return `[retry] provider retry ${status.attempt}/${status.maxAttempts} scheduled in ${seconds}s${suffix}`;
5592
+ }
5593
+ if (status.phase === "retrying")
5594
+ return `[retry] provider retry ${status.attempt}/${status.maxAttempts} running${suffix}`;
5595
+ if (status.phase === "cancelled")
5596
+ return `[retry] provider retry cancelled (${status.attempt}/${status.maxAttempts})${suffix}`;
5597
+ if (status.phase === "exhausted") return `[retry] provider retry exhausted (${status.attempt})${suffix}`;
5598
+ return `[retry] provider retry recovered after ${status.attempt} attempt(s)`;
5599
+ }
5600
+ function formatRetryStatus(status, unbounded = false) {
5601
+ return styleTaggedNotice(rawRetryStatus(status, unbounded));
5602
+ }
5603
+ function renderRetryStatus(status, width, detail, unbounded = false, terminalRows = 40) {
5604
+ if (unbounded) return wrapTextWithAnsi(formatRetryStatus(status, true), width);
5605
+ const limit = previewBudget(detail.errorRows, terminalRows);
5606
+ const { errorMessage, ...heading } = status;
5607
+ if (!errorMessage || status.phase === "waiting" || status.phase === "retrying" || status.phase === "recovered") {
5608
+ return previewRows(wrapTextWithAnsi(formatRetryStatus(heading), width), limit, width);
5609
+ }
5610
+ const headingRow = truncateToWidth(formatRetryStatus(heading), width);
5611
+ const diagnosis = presentProviderError(errorMessage);
5612
+ const rows = wrapTextWithAnsi(diagnosis, width);
5613
+ if (limit === 2 && rows.length > 1) {
5614
+ const hint = " /view";
5615
+ return [
5616
+ headingRow,
5617
+ clioTheme().fg(
5618
+ "muted",
5619
+ truncateToWidth(`${truncateToWidth(diagnosis, Math.max(1, width - hint.length))}${hint}`, width)
5620
+ )
5621
+ ];
5428
5622
  }
5429
- if (status.phase === "retrying") return `[retry] attempt ${status.attempt}/${status.maxAttempts} running${suffix}`;
5430
- if (status.phase === "cancelled") return `[retry] cancelled attempt ${status.attempt}/${status.maxAttempts}${suffix}`;
5431
- if (status.phase === "exhausted") return `[retry] exhausted after ${status.attempt} attempt(s)${suffix}`;
5432
- return `[retry] recovered after ${status.attempt} attempt(s)`;
5433
- }
5434
- function formatRetryStatus(status) {
5435
- return styleTaggedNotice(rawRetryStatus(status));
5623
+ return [
5624
+ headingRow,
5625
+ ...previewRows(
5626
+ rows.map((row2) => clioTheme().fg("muted", row2)),
5627
+ limit - 1,
5628
+ width
5629
+ )
5630
+ ];
5436
5631
  }
5437
5632
 
5438
5633
  // src/interactive/renderers/tool-execution.ts
@@ -5482,19 +5677,6 @@ function transcriptDetail(style = "standard") {
5482
5677
  return POLICIES[style];
5483
5678
  }
5484
5679
 
5485
- // src/interactive/renderers/preview.ts
5486
- init_esm_shims();
5487
- function previewRows(rows, limit, width, tail = false) {
5488
- if (rows.length <= limit) return [...rows];
5489
- if (limit <= 0) return [];
5490
- const count2 = Math.max(0, limit - 1);
5491
- const hint = clioTheme().fg("dim", truncateToWidth(`\u2026 ${rows.length - count2} rows \xB7 /view`, Math.max(1, width)));
5492
- return tail ? [hint, ...rows.slice(rows.length - count2)] : [...rows.slice(0, count2), hint];
5493
- }
5494
- function previewBudget(limit, terminalRows = 40) {
5495
- return Math.min(limit, Math.max(2, Math.floor((terminalRows - 8) / 2)));
5496
- }
5497
-
5498
5680
  // src/interactive/mutation-preview.ts
5499
5681
  init_esm_shims();
5500
5682
  import { createHash as createHash2 } from "node:crypto";
@@ -5916,11 +6098,16 @@ var PRIMARY_ARG_FIELD = {
5916
6098
  bash: "command",
5917
6099
  grep: "pattern",
5918
6100
  find: "pattern",
6101
+ web_read: "url",
5919
6102
  web_fetch: "url",
5920
6103
  git: "op",
5921
6104
  verify: "check",
6105
+ run_script: "script",
5922
6106
  code_nav: "query",
5923
6107
  context: "scope",
6108
+ clio_docs: "query",
6109
+ clio_library: "query",
6110
+ data: "path",
5924
6111
  artifact: "kind",
5925
6112
  monitor: "run_id",
5926
6113
  steer: "run_id",
@@ -5939,10 +6126,25 @@ function summarizeWebFetchArgs(args) {
5939
6126
  }
5940
6127
  return truncate2(jsonStringifySafe(Object.keys(compact2).length > 0 ? compact2 : args), WEB_FETCH_ARG_PREVIEW_LIMIT);
5941
6128
  }
6129
+ function summarizeGatewayArgs(args) {
6130
+ if (!isPlainObject(args)) return truncate2(jsonStringifySafe(redactToolArgs(args)), ARG_PREVIEW_LIMIT);
6131
+ const op = typeof args.op === "string" ? args.op : "";
6132
+ if (op === "find") {
6133
+ const query = readStringField(args, "query");
6134
+ return truncate2(query === null || query.length === 0 ? "find" : `find ${query}`, ARG_PREVIEW_LIMIT);
6135
+ }
6136
+ const capability = readStringField(args, "capability") ?? "";
6137
+ if (op === "describe") return truncate2(`describe ${capability}`.trim(), ARG_PREVIEW_LIMIT);
6138
+ const effective = effectiveToolCall("gateway", args);
6139
+ if (!effective.viaGateway) return truncate2(jsonStringifySafe(redactToolArgs(args)), ARG_PREVIEW_LIMIT);
6140
+ const inner = summarizeArgs(effective.toolName, effective.args);
6141
+ return truncate2(inner.length > 0 ? `${effective.toolName} ${inner}` : effective.toolName, ARG_PREVIEW_LIMIT);
6142
+ }
5942
6143
  function summarizeArgs(toolName, args) {
5943
6144
  if (isEmptyArgs(args)) return "";
5944
6145
  const safeArgs = redactToolArgs(args);
5945
- if (toolName === "web_fetch") return summarizeWebFetchArgs(safeArgs);
6146
+ if (toolName === "web_fetch" || toolName === "web_read") return summarizeWebFetchArgs(safeArgs);
6147
+ if (toolName === "gateway") return summarizeGatewayArgs(args);
5946
6148
  const primary = capturedPrimaryArg(toolName, args);
5947
6149
  if (primary !== null) return truncate2(displayArg(toolName, primary), ARG_PREVIEW_LIMIT);
5948
6150
  return truncate2(jsonStringifySafe(safeArgs), ARG_PREVIEW_LIMIT);
@@ -6184,7 +6386,10 @@ function buildGenericToolBody(toolName, args) {
6184
6386
  function buildFieldSublineBody(args, key, lead, options = {}) {
6185
6387
  const value = readStringField(args, key);
6186
6388
  if (value === null) return null;
6187
- const preview = truncate2(key === "command" ? stripShellWrapperForDisplay(value) : value, ARG_PREVIEW_LIMIT);
6389
+ const preview = truncate2(
6390
+ sanitizeCallTargetText(key === "command" ? stripShellWrapperForDisplay(value) : value),
6391
+ ARG_PREVIEW_LIMIT
6392
+ );
6188
6393
  if (options.wrapInBackticks) return `${lead}\`${preview}\``;
6189
6394
  return `${lead}${preview}`;
6190
6395
  }
@@ -6221,9 +6426,32 @@ var SUBLINE_BODY_BUILDERS = {
6221
6426
  bash: (args) => buildFieldSublineBody(args, "command", "running ", { wrapInBackticks: true }),
6222
6427
  grep: (args) => buildFieldSublineBody(args, "pattern", "searching for ", { wrapInBackticks: true }),
6223
6428
  find: (args) => buildFieldSublineBody(args, "pattern", "finding ", { wrapInBackticks: true }),
6429
+ web_read: (args) => buildFieldSublineBody(args, "url", "reading "),
6224
6430
  web_fetch: (args) => buildFieldSublineBody(args, "url", "fetching "),
6225
6431
  git: (args) => buildFieldSublineBody(args, "op", "git "),
6226
6432
  verify: (args) => buildFieldSublineBody(args, "check", "verifying "),
6433
+ run_script: (args) => buildFieldSublineBody(args, "script", "running ", { wrapInBackticks: true }),
6434
+ data: (args) => {
6435
+ const op = readStringField(args, "op") ?? "inspecting";
6436
+ const path2 = readStringField(args, "path");
6437
+ return path2 === null ? op : `${op} ${path2}`;
6438
+ },
6439
+ gateway: (args) => {
6440
+ if (!isPlainObject(args)) return null;
6441
+ const op = typeof args.op === "string" ? args.op : "";
6442
+ if (op === "find") {
6443
+ const query = readStringField(args, "query");
6444
+ return query === null || query.length === 0 ? "finding capabilities" : `finding capabilities \`${query}\``;
6445
+ }
6446
+ if (op === "describe") {
6447
+ const capability = readStringField(args, "capability");
6448
+ return capability === null ? "describing a capability" : `describing ${capability}`;
6449
+ }
6450
+ const effective = effectiveToolCall("gateway", args);
6451
+ if (!effective.viaGateway) return null;
6452
+ const inner = SUBLINE_BODY_BUILDERS[effective.toolName]?.(effective.args);
6453
+ return inner !== null && inner !== void 0 ? `${inner} (via gateway)` : `calling ${effective.toolName}`;
6454
+ },
6227
6455
  code_nav: (args) => {
6228
6456
  const mode = readStringField(args, "mode");
6229
6457
  const query = readStringField(args, "query")?.trim() ?? "";
@@ -6277,9 +6505,9 @@ function buildSublineBody(toolName, args, status, result, outcome) {
6277
6505
  }
6278
6506
  return SUBLINE_BODY_BUILDERS[toolName]?.(args) ?? buildGenericToolBody(toolName, args);
6279
6507
  }
6280
- if (toolName === "web_fetch") {
6508
+ if (toolName === "web_fetch" || toolName === "web_read") {
6281
6509
  const meta = status === void 0 ? null : webFetchMeta(result);
6282
- const body2 = SUBLINE_BODY_BUILDERS.web_fetch?.(args) ?? buildGenericToolBody(toolName, args);
6510
+ const body2 = SUBLINE_BODY_BUILDERS[toolName]?.(args) ?? buildGenericToolBody(toolName, args);
6283
6511
  return `${body2}${meta ? dim(` \xB7 ${meta}`) : ""}`;
6284
6512
  }
6285
6513
  if (toolName === "bash") {
@@ -6407,8 +6635,8 @@ function isEmptyResult(result) {
6407
6635
  return false;
6408
6636
  }
6409
6637
  function resultText2(result, limit = FULL_RESULT_PREVIEW_LIMIT) {
6410
- if (typeof result === "string") return truncate2(result, limit);
6411
- return truncate2(jsonStringifySafe(result), limit);
6638
+ const text = typeof result === "string" ? result : jsonStringifySafe(result);
6639
+ return truncate2(sanitizeMultilineDisplayText(text).text, limit);
6412
6640
  }
6413
6641
  function truncateRowsMiddle(rows, rowLimit, isError) {
6414
6642
  if (rows.length <= rowLimit) return [...rows];
@@ -7105,15 +7333,18 @@ function foldSessionArtifacts(entries, options = {}) {
7105
7333
  if (!isRecord5(raw) || raw.kind !== "message" || raw.role !== "tool_result") continue;
7106
7334
  if (typeof raw.turnId !== "string" || typeof raw.timestamp !== "string") continue;
7107
7335
  const payload = raw.payload;
7108
- if (!isRecord5(payload) || !isSessionArtifactTool(payload.toolName)) continue;
7336
+ if (!isRecord5(payload) || typeof payload.toolName !== "string") continue;
7337
+ const result = payload.result;
7338
+ const details = isRecord5(result) && isRecord5(result.details) ? result.details : null;
7339
+ const toolName = effectiveToolCall(payload.toolName, void 0, details ?? void 0).toolName;
7340
+ if (!isSessionArtifactTool(toolName)) continue;
7109
7341
  if (payload.isError === true || payload.outcome === "error" || payload.outcome === "blocked" || payload.outcome === "aborted" || payload.outcome === "orphaned") {
7110
7342
  continue;
7111
7343
  }
7112
- const result = payload.result;
7113
- if (!isRecord5(result) || !isRecord5(result.details) || !Array.isArray(result.details.paths)) continue;
7114
- const artifactKind = payload.toolName === "artifact" && isSessionArtifactKind(result.details.kind) ? result.details.kind : void 0;
7344
+ if (!isRecord5(result) || details === null || !Array.isArray(details.paths)) continue;
7345
+ const artifactKind = toolName === "artifact" && isSessionArtifactKind(details.kind) ? details.kind : void 0;
7115
7346
  const pathsSeenInResult = /* @__PURE__ */ new Set();
7116
- for (const recordedPath of result.details.paths) {
7347
+ for (const recordedPath of details.paths) {
7117
7348
  if (typeof recordedPath !== "string" || recordedPath.trim().length === 0) continue;
7118
7349
  const normalized = normalizedWorkspacePath(recordedPath, workspace);
7119
7350
  if (normalized === null || pathsSeenInResult.has(normalized)) continue;
@@ -7123,7 +7354,7 @@ function foldSessionArtifacts(entries, options = {}) {
7123
7354
  writeIndex += 1;
7124
7355
  lastByPath.set(normalized, {
7125
7356
  path: recordedPath,
7126
- tool: payload.toolName,
7357
+ tool: toolName,
7127
7358
  ...artifactKind ? { artifactKind } : {},
7128
7359
  turnId: raw.turnId,
7129
7360
  timestamp: raw.timestamp,
@@ -7559,6 +7790,161 @@ function buildSegmentedContextBar(theme6, barWidth, contextWindow, breakdown) {
7559
7790
  return `${systemPart}${toolPart}${conversationPart}${freePart}${contextPercentLabel(percent)}`;
7560
7791
  }
7561
7792
 
7793
+ // src/interactive/renderers/worker-answer.ts
7794
+ init_esm_shims();
7795
+ function safeWorkerAnswerText(text) {
7796
+ const normalized = text.replaceAll(String.fromCharCode(157), "\x1B]").replaceAll(String.fromCharCode(155), "\x1B[").replaceAll(String.fromCharCode(156), "\x1B\\");
7797
+ return redactSecretString(sanitizeMultilineDisplayText(normalized).text).replace(/[\p{Cf}\u0080-\u009f]/gu, "");
7798
+ }
7799
+ var isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
7800
+ function reportString(value) {
7801
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
7802
+ }
7803
+ function debuggerReport(value) {
7804
+ const diagnosis = reportString(value.diagnosis);
7805
+ const reproduction = value.reproduction;
7806
+ if (diagnosis === null || reproduction !== "reproduced" && reproduction !== "not-reproduced" && reproduction !== "unknown" || !isStringArray(value.evidence)) {
7807
+ return null;
7808
+ }
7809
+ return {
7810
+ lines: [
7811
+ diagnosis,
7812
+ ...value.evidence.length === 0 ? ["Evidence: none"] : ["Evidence:", ...value.evidence.map((item) => `- ${item}`)]
7813
+ ],
7814
+ footer: `reproduction ${reproduction}`
7815
+ };
7816
+ }
7817
+ function verifierReport(value) {
7818
+ if (value.verdict !== "pass" && value.verdict !== "fail" || !Array.isArray(value.checks)) return null;
7819
+ const lines = [];
7820
+ for (const raw of value.checks) {
7821
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
7822
+ const check = raw;
7823
+ const name = reportString(check.name);
7824
+ const evidence = reportString(check.evidence);
7825
+ if (name === null || evidence === null || typeof check.passed !== "boolean") return null;
7826
+ lines.push(`${check.passed ? GLYPH.ok : GLYPH.error} ${name}: ${evidence}`);
7827
+ }
7828
+ return { lines: lines.length === 0 ? ["No checks reported."] : lines, footer: `verdict ${value.verdict}` };
7829
+ }
7830
+ function researchReport(value) {
7831
+ if (value.source !== "local" && value.source !== "external" || !Array.isArray(value.findings)) return null;
7832
+ const lines = [];
7833
+ for (const raw of value.findings) {
7834
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
7835
+ const finding = raw;
7836
+ const claim = reportString(finding.claim);
7837
+ const evidence = reportString(finding.evidence);
7838
+ if (claim === null || evidence === null) return null;
7839
+ lines.push(`- ${claim}`, ` citation: ${evidence}`);
7840
+ }
7841
+ return { lines: lines.length === 0 ? ["No findings reported."] : lines, footer: `source ${value.source}` };
7842
+ }
7843
+ function worldKnowledgeReport(value) {
7844
+ if (value.discovery !== "performed" && value.discovery !== "caller-supplied-only" && value.discovery !== "unavailable" || !Array.isArray(value.facts) || !isStringArray(value.synthesis) || !isStringArray(value.uncertainties) || !isStringArray(value.followUpVerification)) {
7845
+ return null;
7846
+ }
7847
+ const lines = [];
7848
+ for (const raw of value.facts) {
7849
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
7850
+ const fact = raw;
7851
+ const claim = reportString(fact.claim);
7852
+ const evidence = reportString(fact.evidence);
7853
+ if (claim === null || evidence === null || !isStringArray(fact.sources)) return null;
7854
+ lines.push(`- ${claim}`, ` support: ${evidence}`);
7855
+ if (fact.sources.length > 0) lines.push(` sources: ${fact.sources.join(", ")}`);
7856
+ }
7857
+ if (value.synthesis.length > 0) lines.push("Synthesis:", ...value.synthesis.map((item) => `- ${item}`));
7858
+ if (value.uncertainties.length > 0) lines.push("Uncertainties:", ...value.uncertainties.map((item) => `- ${item}`));
7859
+ if (value.followUpVerification.length > 0) {
7860
+ lines.push("Verify next:", ...value.followUpVerification.map((item) => `- ${item}`));
7861
+ }
7862
+ return {
7863
+ lines: lines.length === 0 ? ["No findings reported."] : lines,
7864
+ footer: `discovery ${value.discovery}; uncertainties ${value.uncertainties.length}; follow-up ${value.followUpVerification.length}`
7865
+ };
7866
+ }
7867
+ function scoutReport(value) {
7868
+ if (!Array.isArray(value.findings) || typeof value.needsSplit !== "boolean") return null;
7869
+ const lines = [];
7870
+ for (const raw of value.findings) {
7871
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
7872
+ const finding = raw;
7873
+ const claim = reportString(finding.claim);
7874
+ if (claim === null) return null;
7875
+ const path2 = reportString(finding.path);
7876
+ const line = typeof finding.line === "number" && Number.isSafeInteger(finding.line) ? finding.line : null;
7877
+ lines.push(path2 !== null && line !== null ? `- ${claim} \u2014 ${path2}:${line}` : `- ${claim} (ungrounded lead)`);
7878
+ }
7879
+ if (value.needsSplit) {
7880
+ if (!Array.isArray(value.proposedSubtasks)) return null;
7881
+ lines.push("Split recommended:");
7882
+ for (const raw of value.proposedSubtasks) {
7883
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
7884
+ const subtask = raw;
7885
+ const task = reportString(subtask.task);
7886
+ const id = reportString(subtask.id);
7887
+ if (task === null || id === null) return null;
7888
+ lines.push(`- ${id}: ${task}`);
7889
+ }
7890
+ }
7891
+ return {
7892
+ lines: lines.length === 0 ? ["No findings reported."] : lines,
7893
+ footer: value.needsSplit ? "split needed" : "no split needed"
7894
+ };
7895
+ }
7896
+ function isObject(value) {
7897
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7898
+ }
7899
+ function exactWorkerAnswerObject(text) {
7900
+ const trimmed = text.trim();
7901
+ const fenced = /^```[A-Za-z0-9_-]*[^\S\r\n]*\r?\n([\s\S]*?)\r?\n```$/u.exec(trimmed);
7902
+ const source = fenced?.[1] ?? trimmed;
7903
+ try {
7904
+ const value = JSON.parse(source);
7905
+ return isObject(value) ? value : null;
7906
+ } catch {
7907
+ return null;
7908
+ }
7909
+ }
7910
+ function presentWorkerContractAnswer(text, contract, complete, settled) {
7911
+ if (!settled || !complete || contract?.conformance !== "pass") return null;
7912
+ const value = exactWorkerAnswerObject(text);
7913
+ if (value === null) return null;
7914
+ if (contract.kind === "scout-report") {
7915
+ for (const match of text.matchAll(/"(?:[^"\\]|\\[\s\S])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/gu)) {
7916
+ const token = match[0];
7917
+ if (token.startsWith('"')) continue;
7918
+ if (!Number.isSafeInteger(Number(token)) || String(Number(token)) !== token) return null;
7919
+ }
7920
+ }
7921
+ let answer;
7922
+ switch (contract.kind) {
7923
+ case "debugger-report":
7924
+ answer = debuggerReport(value);
7925
+ break;
7926
+ case "verifier-report":
7927
+ answer = verifierReport(value);
7928
+ break;
7929
+ case "research-report":
7930
+ answer = researchReport(value);
7931
+ break;
7932
+ case "world-knowledge-report":
7933
+ answer = worldKnowledgeReport(value);
7934
+ break;
7935
+ case "scout-report":
7936
+ answer = scoutReport(value);
7937
+ break;
7938
+ default:
7939
+ return null;
7940
+ }
7941
+ if (answer === null) return null;
7942
+ return {
7943
+ lines: answer.lines.map(safeWorkerAnswerText),
7944
+ ...answer.footer ? { footer: safeWorkerAnswerText(answer.footer) } : {}
7945
+ };
7946
+ }
7947
+
7562
7948
  // src/interactive/dispatch-board.ts
7563
7949
  function formatDispatchPhaseCell(phase, width = PHASE_COLUMN_WIDTH) {
7564
7950
  if (phase === void 0) return null;
@@ -7724,41 +8110,50 @@ function progressActionLine(theme6, progress, contentWidth) {
7724
8110
  const current = progress.currentAction;
7725
8111
  const recent = progress.recentActions[0];
7726
8112
  const units = [];
7727
- if (phase !== null) units.push(phase);
7728
- if (current !== null) units.push(theme6.fg("muted", actionPhrase(current)));
8113
+ if (phase !== null && current === null) units.push(phase);
8114
+ if (current !== null) units.push(theme6.fg("muted", `now ${actionPhrase(current)}`));
7729
8115
  else if (recent !== void 0) units.push(theme6.fg("dim", `last ${actionPhrase(recent)}`));
7730
8116
  if (units.length === 0) return null;
7731
8117
  return cardUnitsLine(theme6, "doing", units, contentWidth);
7732
8118
  }
7733
- function progressAnswerLines(theme6, progress, runId, contentWidth) {
8119
+ function progressAnswerLines(theme6, progress, runId, contentWidth, contract) {
7734
8120
  if (progress.tailText.length === 0) return [];
7735
8121
  const gutter = CARD_KV_KEY_WIDTH + 1;
7736
8122
  const railWidth = Math.max(1, contentWidth - gutter - 2);
8123
+ const presented = presentWorkerContractAnswer(
8124
+ progress.tailText,
8125
+ contract,
8126
+ progress.droppedLines === 0 && progress.droppedBytes === 0,
8127
+ progress.settled
8128
+ );
8129
+ const source = presented ? [...presented.footer ? [presented.footer] : [], ...presented.lines] : safeWorkerAnswerText(progress.tailText).split("\n");
7737
8130
  const wrapped = [];
7738
- for (const line of progress.tailText.split("\n")) {
8131
+ for (const line of source) {
7739
8132
  for (const row2 of wrapTextWithAnsi(sanitizeCallTargetText(line), railWidth)) wrapped.push(row2);
7740
8133
  }
7741
- const shown = wrapped.slice(Math.max(0, wrapped.length - WORKER_PROGRESS_CARD_ROWS));
8134
+ const shown = progress.settled ? wrapped.slice(0, WORKER_PROGRESS_CARD_ROWS) : wrapped.slice(Math.max(0, wrapped.length - WORKER_PROGRESS_CARD_ROWS));
7742
8135
  const hiddenRows = wrapped.length - shown.length;
7743
8136
  const rail = theme6.fg("dim", `${GLYPH.rail} `);
7744
8137
  const body = shown.map((row2) => `${rail}${theme6.fg("muted", row2)}`);
7745
8138
  const hiddenLines = progress.droppedLines + hiddenRows;
7746
8139
  if (hiddenLines > 0 || progress.droppedBytes > 0) {
7747
8140
  const facts = [
8141
+ `/view dispatch:${runId}`,
7748
8142
  ...hiddenLines > 0 ? [`${hiddenLines} more line${hiddenLines === 1 ? "" : "s"}`] : [],
7749
- ...progress.droppedBytes > 0 ? [`${progress.droppedBytes} bytes outran the view`] : [],
7750
- `/view dispatch:${runId}`
8143
+ ...progress.droppedBytes > 0 ? [`${progress.droppedBytes} bytes outran the view`] : []
7751
8144
  ];
7752
8145
  body.push(`${rail}${theme6.fg("dim", truncateToWidth(facts.join(" \xB7 "), railWidth, "\u2026", false))}`);
7753
8146
  }
7754
8147
  return body.map((row2, index) => `${index === 0 ? cardKvKey(theme6, "answer") : " ".repeat(gutter)}${row2}`);
7755
8148
  }
7756
- function trustCardLines(theme6, row2, contentWidth) {
8149
+ function trustCardLines(theme6, row2, contentWidth, expanded) {
7757
8150
  const gutter = CARD_KV_KEY_WIDTH + 1;
7758
8151
  const valueWidth = Math.max(1, contentWidth - gutter);
8152
+ const axes = row2.trust?.axes;
8153
+ const compact2 = !expanded && row2.status === "completed" && row2.trust?.verdict === "unverified" && axes?.artifactIntegrity === "verified" && axes.validationGrounding === "absent" && axes.independentReview === "absent" && axes.autonomyEnforcement === "enforced" && axes.contextProvenance === "recorded" && axes.completionEvidence === "absent";
7759
8154
  const trust = row2.trust === void 0 ? theme6.fg("dim", isTerminalStatus(row2.status) ? "receipt not read back" : "not sealed yet") : theme6.fg(
7760
8155
  trustVerdictToken(row2.trust.verdict),
7761
- `${trustVerdictGlyph(row2.trust.verdict)} ${row2.trust.verdict}; ${row2.trust.text}`
8156
+ `${trustVerdictGlyph(row2.trust.verdict)} ${row2.trust.verdict}; ${compact2 ? trustStateWord("validationGrounding", "absent") : row2.trust.text}`
7762
8157
  );
7763
8158
  const host = row2.hostVerification === void 0 ? "" : ` \xB7 ${theme6.fg("muted", `host checks ${row2.hostVerification}`)}`;
7764
8159
  return wrapTextWithAnsi(`${trust}${host}`, valueWidth).map(
@@ -7777,7 +8172,6 @@ function renderDispatchCard(row2, width, evidence, options = {}) {
7777
8172
  });
7778
8173
  const statusStr = theme6.fg(presentation.token, `${presentation.glyph} ${presentation.label}`);
7779
8174
  const ttft = row2.ttftMs !== null ? `${row2.ttftMs}ms` : row2.status === "running" ? `waiting${GLYPH.ellipsis}` : "n/a";
7780
- const target = `${theme6.fg("muted", `${row2.runtimeKind}:${row2.targetId}`)} ${theme6.fg("dim", "\u25B8")} ${theme6.fg("muted", row2.wireModelId)}`;
7781
8175
  const selectionWidth = options.selected === true ? visibleWidth(GLYPH.cursor) + 1 : 0;
7782
8176
  const rowPrefix = dispatchRowPrefix(theme6, row2);
7783
8177
  const labelBudget = Math.max(1, width - visibleWidth(elapsed) - 10 - selectionWidth - rowPrefix.width);
@@ -7792,7 +8186,8 @@ function renderDispatchCard(row2, width, evidence, options = {}) {
7792
8186
  `${GLYPH.down} ${formatFooterTokens(row2.outputTokens)}${showRate ? ` (${tokensPerSec}/s)` : ""}`
7793
8187
  );
7794
8188
  const total = theme6.fg("muted", `total ${formatFooterTokens(row2.tokenCount)}`);
7795
- const targetLine = truncateToWidth(`${cardKvKey(theme6, "target")}${target}`, contentWidth, "\u2026", false);
8189
+ const targetKey = cardKvKey(theme6, "target");
8190
+ const targetLine = `${targetKey}${theme6.fg("muted", fitIdentityLabel(sanitizeCallTargetText(`${row2.runtimeKind}:${row2.targetId} \u25B8 ${row2.wireModelId}`), Math.max(1, contentWidth - visibleWidth(targetKey))))}`;
7796
8191
  const statusUnits = [
7797
8192
  statusStr,
7798
8193
  theme6.fg("muted", `node ${row2.node ?? "local"}`),
@@ -7810,19 +8205,21 @@ function renderDispatchCard(row2, width, evidence, options = {}) {
7810
8205
  ];
7811
8206
  const contextUnit = formatWorkerContextMeter(row2.lastContextTokens ?? 0, row2.contextWindow, theme6);
7812
8207
  const phaseCell = formatDispatchPhaseCell(row2.phase, contentWidth);
8208
+ const fullTask = row2.taskSummary ? cardWrappedValueLines(theme6, "task", theme6.fg("muted", row2.taskSummary), contentWidth) : [];
8209
+ const taskLines = options.expanded === true || fullTask.length <= 3 ? fullTask : [...fullTask.slice(0, 2), theme6.fg("dim", "\u2026 Enter detail for full task")];
7813
8210
  const bodyLines2 = [
7814
8211
  cardUnitsLine(theme6, "run", [theme6.fg("dim", row2.runId)], contentWidth),
7815
- cardUnitsLine(
8212
+ ...phaseCell === null ? [] : [cardUnitsLine(theme6, "phase", [theme6.fg("info", phaseCell)], contentWidth)],
8213
+ ...options.expanded === true ? cardWrappedValueLines(
7816
8214
  theme6,
7817
- "phase",
7818
- [phaseCell === null ? theme6.fg("dim", "\u2014") : theme6.fg("info", phaseCell)],
8215
+ "target",
8216
+ theme6.fg("muted", sanitizeCallTargetText(`${row2.runtimeKind}:${row2.targetId} \u25B8 ${row2.wireModelId}`)),
7819
8217
  contentWidth
7820
- ),
7821
- targetLine,
7822
- ...row2.taskSummary ? cardWrappedValueLines(theme6, "task", theme6.fg("muted", row2.taskSummary), contentWidth) : [],
8218
+ ) : [targetLine],
8219
+ ...taskLines,
7823
8220
  cardUnitsLine(theme6, "status", statusUnits, contentWidth),
7824
- ...trustCardLines(theme6, row2, contentWidth),
7825
- ...row2.budget !== void 0 ? [
8221
+ ...trustCardLines(theme6, row2, contentWidth, options.expanded === true),
8222
+ ...options.expanded === true && row2.budget !== void 0 ? [
7826
8223
  ...cardWrappedValueLines(
7827
8224
  theme6,
7828
8225
  "policy",
@@ -7854,17 +8251,18 @@ function renderDispatchCard(row2, width, evidence, options = {}) {
7854
8251
  }
7855
8252
  const currentTool = row2.currentTool ?? null;
7856
8253
  const recentTools = row2.recentTools ?? [];
7857
- if (currentTool !== null || recentTools.length > 0) {
8254
+ if (!row2.progress && (currentTool !== null || recentTools.length > 0)) {
7858
8255
  const toolUnits = [
7859
8256
  currentTool !== null ? theme6.fg("action", `${currentTool} running`) : theme6.fg("dim", "idle"),
7860
8257
  ...recentTools.length > 0 ? [theme6.fg("muted", `recent ${recentTools.join(" ")}`)] : []
7861
8258
  ];
7862
8259
  bodyLines2.push(cardUnitsLine(theme6, "tools", toolUnits, contentWidth));
7863
8260
  }
7864
- if (options.expanded === true && row2.progress) {
8261
+ if (row2.progress) {
7865
8262
  const doing = progressActionLine(theme6, row2.progress, contentWidth);
7866
8263
  if (doing !== null) bodyLines2.push(doing);
7867
- bodyLines2.push(...progressAnswerLines(theme6, row2.progress, row2.runId, contentWidth));
8264
+ if (options.expanded === true)
8265
+ bodyLines2.push(...progressAnswerLines(theme6, row2.progress, row2.runId, contentWidth, row2.resultContract));
7868
8266
  }
7869
8267
  if (row2.steerAcknowledgement) {
7870
8268
  bodyLines2.push(
@@ -8027,8 +8425,8 @@ function renderCouncilCard(group, width) {
8027
8425
  function formatDispatchBoardLines(rows, width = 76, observability, selectedRunId, detailExpanded = false) {
8028
8426
  if (rows.length === 0) {
8029
8427
  const theme6 = clioTheme();
8030
- const lines = ["", "No fleet runs yet", "Delegated runs appear here with task, status, and telemetry.", ""];
8031
- return lines.map((line) => {
8428
+ const lines = ["", "No fleet runs yet", "Use /run or /delegate to start a run.", ""];
8429
+ return lines.flatMap((line) => wrapTextWithAnsi(line, Math.max(1, width))).map((line) => {
8032
8430
  const padding = Math.max(0, Math.floor((width - visibleWidth(line)) / 2));
8033
8431
  return theme6.fg("dim", " ".repeat(padding) + line);
8034
8432
  });
@@ -8176,6 +8574,7 @@ function toRow(entry, now) {
8176
8574
  const progress = entry.progress;
8177
8575
  return {
8178
8576
  ...progress !== void 0 ? { progress } : {},
8577
+ ...entry.resultContract !== void 0 ? { resultContract: entry.resultContract } : {},
8179
8578
  runId: entry.runId,
8180
8579
  agentId: entry.agentId,
8181
8580
  ...entry.agentAudience !== void 0 ? { agentAudience: entry.agentAudience } : {},
@@ -9173,17 +9572,18 @@ function compactPrimaryLine(workspace, _session, width, theme6 = clioTheme(), st
9173
9572
  const safeWidth = Math.max(1, Math.floor(width));
9174
9573
  let git = safeWidth >= COMPACT_GIT_MIN_WIDTH ? gitChip(theme6, workspace.branch, workspace.dirty) : null;
9175
9574
  let right = buildHarnessStatePill(theme6, status, toolCounts, dispatchRows, tick, now, safeWidth, true);
9176
- let left = joinSections(theme6, [theme6.fg("muted", workspace.cwd), git]);
9177
- if (visibleWidth(left) + 1 + visibleWidth(right) > safeWidth) {
9178
- right = buildHarnessStatePill(theme6, status, toolCounts, dispatchRows, tick, now, safeWidth, false);
9179
- }
9575
+ const cwd = fitIdentityLabel(workspace.cwd, Math.max(8, safeWidth - visibleWidth(right) - 1));
9576
+ let left = joinSections(theme6, [theme6.fg("muted", cwd), git]);
9180
9577
  if (git && visibleWidth(left) + 1 + visibleWidth(right) > safeWidth) {
9181
9578
  git = null;
9182
- left = theme6.fg("muted", workspace.cwd);
9579
+ left = theme6.fg("muted", cwd);
9580
+ }
9581
+ if (visibleWidth(left) + 1 + visibleWidth(right) > safeWidth) {
9582
+ right = buildHarnessStatePill(theme6, status, toolCounts, dispatchRows, tick, now, safeWidth, false);
9183
9583
  }
9184
9584
  if (visibleWidth(left) + 1 + visibleWidth(right) > safeWidth) {
9185
9585
  const maxCwdWidth = Math.max(1, safeWidth - visibleWidth(right) - 1);
9186
- left = theme6.fg("muted", truncateToWidth(workspace.cwd, maxCwdWidth, "\u2026", true));
9586
+ left = theme6.fg("muted", fitIdentityLabel(workspace.cwd, maxCwdWidth));
9187
9587
  }
9188
9588
  return joinColumns(left, right, safeWidth);
9189
9589
  }
@@ -9767,7 +10167,7 @@ function outputStyleLabel(verbosity) {
9767
10167
  }
9768
10168
  function buildHarnessStatePill(theme6, status, toolCounts, dispatchRows, tick, now, width, showBadge = true, fleetSummaryIsAction = false) {
9769
10169
  const safeWidth = Math.max(1, Math.floor(width));
9770
- const badge = showBadge && safeWidth >= 48 ? harnessBadge(theme6, status, toolCounts, dispatchRows, fleetSummaryIsAction) : "";
10170
+ const badge = showBadge ? harnessBadge(theme6, status, toolCounts, dispatchRows, fleetSummaryIsAction) : "";
9771
10171
  if (status.phase === "idle") return badge;
9772
10172
  const phase = harnessPhasePresentation(status, safeWidth, now);
9773
10173
  const lead = phase.live ? spinnerFrame2(tick) : phase.glyph;
@@ -10776,11 +11176,12 @@ var WorkspaceArtifactProvider = class {
10776
11176
  {
10777
11177
  id: `workspace:${path2}`,
10778
11178
  category: this.category,
10779
- title: safeTitle(`${artifact.path} \xB7 ${artifact.tool}${kind}`, artifact.path),
11179
+ title: safeTitle(`${basename(path2)} \xB7 ${relative4(workspace, path2)} \xB7 ${artifact.tool}${kind}`, basename(path2)),
10780
11180
  timestamp: parseTime(artifact.timestamp),
10781
11181
  sizeBytes: maybeSizeBytes(path2),
10782
11182
  path: path2,
10783
- description: `${artifact.tool}${kind} \xB7 ${overwriteLabel}`,
11183
+ description: `${artifact.tool}${kind} \xB7 ${overwriteLabel} \xB7 Workspace: ${workspace} \xB7 Turn: ${artifact.turnId}`,
11184
+ ...this.deps.sessionMeta ? { sessionId: this.deps.sessionMeta.id } : {},
10784
11185
  toolName: artifact.tool,
10785
11186
  searchText: [
10786
11187
  artifact.path,
@@ -11795,6 +12196,7 @@ function chatMessageText(entry) {
11795
12196
  var LEADING_SYSTEM_REMINDER = /^\s*<system-reminder>[\s\S]*?<\/system-reminder>\s*/u;
11796
12197
  function replayedUserText(entry) {
11797
12198
  const obj = payloadObject3(entry.payload);
12199
+ if (typeof obj?.displayText === "string" && obj.displayText.length > 0) return obj.displayText;
11798
12200
  if (typeof obj?.operatorText === "string") return obj.operatorText;
11799
12201
  let text = extractTurnText(entry.payload);
11800
12202
  for (; ; ) {
@@ -11899,7 +12301,7 @@ function renderBashExecutionEntry(entry, width, detail, unbounded) {
11899
12301
  { unbounded, diffStyle: "plain", detail }
11900
12302
  );
11901
12303
  }
11902
- function renderRetryStatusEntry(entry, width) {
12304
+ function renderRetryStatusEntry(entry, width, detail, unbounded, terminalRows) {
11903
12305
  const data = payloadObject3(entry.data);
11904
12306
  if (!data) return wrapTextWithAnsi(styleTaggedNotice("[retry] status"), width);
11905
12307
  const rawPhase = data.phase;
@@ -11917,7 +12319,7 @@ function renderRetryStatusEntry(entry, width) {
11917
12319
  ...typeof data.delayMs === "number" ? { delayMs: data.delayMs } : {},
11918
12320
  ...typeof data.seconds === "number" ? { seconds: data.seconds } : {}
11919
12321
  };
11920
- return wrapTextWithAnsi(formatRetryStatus(status), width);
12322
+ return renderRetryStatus(status, width, detail, unbounded, terminalRows);
11921
12323
  }
11922
12324
  function rendersCustomEntry(entry) {
11923
12325
  if (entry.display === false) return false;
@@ -11926,8 +12328,8 @@ function rendersCustomEntry(entry) {
11926
12328
  if (entry.customType === HANDOFF_SEED_CUSTOM_TYPE || entry.customType === HANDOFF_NOTE_CUSTOM_TYPE) return true;
11927
12329
  return entry.display === true;
11928
12330
  }
11929
- function renderCustomEntry(entry, width) {
11930
- if (entry.customType === "retryStatus") return renderRetryStatusEntry(entry, width);
12331
+ function renderCustomEntry(entry, width, detail, unbounded, terminalRows) {
12332
+ if (entry.customType === "retryStatus") return renderRetryStatusEntry(entry, width, detail, unbounded, terminalRows);
11931
12333
  if (entry.customType === HANDOFF_SEED_CUSTOM_TYPE && isHandoffSeedData(entry.data)) {
11932
12334
  return wrapTextWithAnsi(styleTaggedNotice(`[handoff] carried from session ${entry.data.fromSessionId}`), width);
11933
12335
  }
@@ -12220,9 +12622,13 @@ function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
12220
12622
  message.stopReason = failure2.stopReason;
12221
12623
  message.errorMessage = failure2.errorMessage;
12222
12624
  }
12625
+ const stopReason = message.stopReason;
12626
+ const terminalFailure = stopReason === "error" || stopReason === "aborted" || stopReason === "length";
12627
+ const continues = !terminalFailure && (stopReason === "toolUse" || hasStructuredToolCall(message));
12628
+ if (continues) chatPanel.applyEvent({ type: "message_start", message });
12223
12629
  chatPanel.applyEvent({ type: "message_end", message });
12224
12630
  runAssistantMessages.push(message);
12225
- chatPanel.applyEvent({ type: "agent_end", messages: runAssistantMessages });
12631
+ if (!continues) chatPanel.applyEvent({ type: "agent_end", messages: runAssistantMessages });
12226
12632
  }
12227
12633
  break;
12228
12634
  }
@@ -12298,7 +12704,10 @@ function rehydrateChatPanelFromTurns(chatPanel, turns, options = {}) {
12298
12704
  break;
12299
12705
  }
12300
12706
  case "custom":
12301
- if (rendersCustomEntry(entry)) chatPanel.appendReplayBlock((width) => renderCustomEntry(entry, width));
12707
+ if (rendersCustomEntry(entry))
12708
+ chatPanel.appendReplayBlock(
12709
+ (width, detail, unbounded, terminalRows = 40) => renderCustomEntry(entry, width, detail, unbounded === true || options.unboundedToolBodies === true, terminalRows)
12710
+ );
12302
12711
  break;
12303
12712
  case "modelChange":
12304
12713
  chatPanel.appendReplayBlock((width) => renderModelChangeEntry(entry, width));
@@ -12640,6 +13049,7 @@ function createTurnContext(deps) {
12640
13049
  output: usage.output,
12641
13050
  cacheRead: usage.cacheRead,
12642
13051
  cacheWrite: usage.cacheWrite,
13052
+ ...usage.cacheWrite1h === void 0 ? {} : { cacheWrite1h: usage.cacheWrite1h },
12643
13053
  reasoningTokens: usage.reasoning,
12644
13054
  totalTokens: usage.totalTokens,
12645
13055
  apiCalls: Math.max(1, Math.round(usage.apiCalls))
@@ -13615,6 +14025,7 @@ function createTurnPersistence(deps) {
13615
14025
  outputTokens: total.outputTokens + summary.output,
13616
14026
  cacheReadTokens: total.cacheReadTokens + summary.cacheRead,
13617
14027
  cacheWriteTokens: total.cacheWriteTokens + summary.cacheWrite,
14028
+ ...total.cacheWrite1hTokens === void 0 && summary.cacheWrite1h === void 0 ? {} : { cacheWrite1hTokens: (total.cacheWrite1hTokens ?? 0) + (summary.cacheWrite1h ?? 0) },
13618
14029
  reasoningTokens: total.reasoningTokens + summary.reasoning,
13619
14030
  totalTokens: total.totalTokens + summary.tokens,
13620
14031
  costUsd: (total.costUsd ?? 0) + summary.costUsd
@@ -13772,7 +14183,7 @@ function createTurnPersistence(deps) {
13772
14183
  });
13773
14184
  finishTracedTurn("success", null);
13774
14185
  },
13775
- appendSubmittedUserTurn(agentRuntime, text, images, synthetic, operatorText) {
14186
+ appendSubmittedUserTurn(agentRuntime, text, images, synthetic, operatorText, displayText) {
13776
14187
  if (!deps.session) return null;
13777
14188
  if (!deps.session.current()) {
13778
14189
  deps.session.create({
@@ -13783,6 +14194,7 @@ function createTurnPersistence(deps) {
13783
14194
  }
13784
14195
  const payload = images ? { content: [{ type: "text", text }, ...images] } : { text };
13785
14196
  if (operatorText !== void 0 && operatorText !== text) payload.operatorText = operatorText;
14197
+ if (displayText !== void 0 && displayText !== (operatorText ?? text)) payload.displayText = displayText;
13786
14198
  if (synthetic) {
13787
14199
  payload.synthetic = true;
13788
14200
  payload.source = "middleware_request_continuation";
@@ -13836,23 +14248,24 @@ function createTurnPersistence(deps) {
13836
14248
 
13837
14249
  // src/interactive/turn-prewarm.ts
13838
14250
  init_esm_shims();
14251
+ import { createHash as createHash4 } from "node:crypto";
13839
14252
 
13840
14253
  // src/interactive/prewarm.ts
13841
14254
  init_esm_shims();
14255
+
14256
+ // src/engine/prewarm.ts
14257
+ init_esm_shims();
13842
14258
  var PREWARM_USER_TEXT = ".";
13843
14259
  var PREWARM_MAX_TOKENS = 1;
13844
14260
  var LLM_MESSAGE_ROLES = /* @__PURE__ */ new Set(["user", "assistant", "toolResult"]);
13845
- function prewarmPrefix(state) {
13846
- return {
13847
- systemPrompt: state.systemPrompt,
13848
- messages: state.messages.filter((message) => LLM_MESSAGE_ROLES.has(message.role ?? "")),
13849
- tools: [...state.tools]
13850
- };
13851
- }
13852
14261
  function usageOf(message) {
13853
14262
  if (message === null || typeof message !== "object") return null;
13854
14263
  const usage = message.usage;
13855
- return usage !== null && typeof usage === "object" ? usage : null;
14264
+ if (usage === null || typeof usage !== "object") return null;
14265
+ const record2 = usage;
14266
+ return [record2.input, record2.output, record2.cacheRead, record2.cacheWrite, record2.cost?.total].some(
14267
+ (value) => typeof value === "number" && Number.isFinite(value) && value > 0
14268
+ ) ? record2 : null;
13856
14269
  }
13857
14270
  function backendOf(message) {
13858
14271
  if (message === null || typeof message !== "object") return null;
@@ -13867,32 +14280,61 @@ function prewarmPromptTokens(result) {
13867
14280
  return total > 0 ? total : null;
13868
14281
  }
13869
14282
  async function runPrewarmRound(input) {
13870
- const prefix = prewarmPrefix(input.state);
13871
- const context = {
13872
- systemPrompt: prefix.systemPrompt,
13873
- messages: [
13874
- ...prefix.messages,
13875
- { role: "user", content: [{ type: "text", text: PREWARM_USER_TEXT }], timestamp: Date.now() }
13876
- ],
13877
- tools: prefix.tools
13878
- };
13879
14283
  const options = { maxTokens: PREWARM_MAX_TOKENS };
14284
+ const metadata = input.model.clioCoder;
14285
+ const model = metadata ? { ...input.model, clioCoder: { ...metadata, lifecycle: "user-managed" } } : input.model;
14286
+ if (metadata?.runtimeId === "llamacpp") {
14287
+ options.fetch = (request, init) => {
14288
+ const url = new URL(request instanceof Request ? request.url : request);
14289
+ url.searchParams.set("autoload", "false");
14290
+ return fetch(request instanceof Request ? new Request(url, request) : url, init);
14291
+ };
14292
+ }
13880
14293
  if (input.state.thinkingLevel !== "off") options.reasoning = input.state.thinkingLevel;
13881
14294
  if (input.apiKey !== void 0) options.apiKey = input.apiKey;
13882
14295
  if (input.signal !== void 0) options.signal = input.signal;
13883
- const send = input.streamFn ?? streamSimple;
14296
+ if (input.agent) {
14297
+ for (const key of [
14298
+ "onPayload",
14299
+ "onResponse",
14300
+ "sessionId",
14301
+ "thinkingBudgets",
14302
+ "transport",
14303
+ "maxRetryDelayMs"
14304
+ ]) {
14305
+ if (input.agent[key] !== void 0) options[key] = input.agent[key];
14306
+ }
14307
+ }
14308
+ const send = input.streamFn ?? input.agent?.streamFunction ?? streamSimple;
13884
14309
  const startedAt = performance.now();
13885
14310
  let firstDeltaAt = null;
13886
14311
  const elapsed = () => Math.round(Math.max(0, performance.now() - startedAt));
13887
14312
  const ttft = () => firstDeltaAt === null ? null : Math.round(Math.max(0, firstDeltaAt - startedAt));
13888
14313
  try {
13889
- const events = send(
13890
- input.model,
14314
+ input.signal?.throwIfAborted();
14315
+ let messages = [
14316
+ ...structuredClone([...input.state.messages]),
14317
+ { role: "user", content: [{ type: "text", text: PREWARM_USER_TEXT }], timestamp: Date.now() }
14318
+ ];
14319
+ if (input.agent?.transformContext) messages = await input.agent.transformContext(messages, input.signal);
14320
+ const converted = input.agent ? await input.agent.convertToLlm(messages) : messages.filter((message) => LLM_MESSAGE_ROLES.has(message.role));
14321
+ input.signal?.throwIfAborted();
14322
+ const context = {
14323
+ systemPrompt: input.state.systemPrompt,
14324
+ messages: converted,
14325
+ tools: [...input.state.tools]
14326
+ };
14327
+ if (input.maxInputTokens !== void 0 && estimateInputTokensFromContext(context) > input.maxInputTokens) {
14328
+ throw new Error("pre-warm input estimate exceeds its token budget");
14329
+ }
14330
+ const events = await send(
14331
+ model,
13891
14332
  context,
13892
14333
  options
13893
14334
  );
13894
14335
  for await (const event of events) {
13895
- if (firstDeltaAt === null && event.type !== "start") firstDeltaAt = performance.now();
14336
+ const hasDelta = event.type === "toolcall_start" || (event.type === "text_delta" || event.type === "thinking_delta" || event.type === "toolcall_delta") && event.delta.length > 0;
14337
+ if (firstDeltaAt === null && hasDelta) firstDeltaAt = performance.now();
13896
14338
  if (event.type === "done") {
13897
14339
  return {
13898
14340
  aborted: false,
@@ -13940,6 +14382,12 @@ function createTurnPrewarm(deps) {
13940
14382
  let pendingTrigger = null;
13941
14383
  let timer = null;
13942
14384
  let active = null;
14385
+ let running = null;
14386
+ let disposed = false;
14387
+ let pendingSince = 0;
14388
+ let lastFinished = 0;
14389
+ let lastPrefix = null;
14390
+ let lastSkip = null;
13943
14391
  const detached = /* @__PURE__ */ new WeakSet();
13944
14392
  let inFlight = Promise.resolve(null);
13945
14393
  let dispatchesInFlight = 0;
@@ -13961,12 +14409,28 @@ function createTurnPrewarm(deps) {
13961
14409
  if (dispatchActive()) return "dispatch-active";
13962
14410
  const targetId = deps.getSettings().chat?.target?.trim();
13963
14411
  const runtimeId = targetId ? deps.providers.getTarget(targetId)?.runtime : void 0;
13964
- if (runtimeId === void 0 || deps.providers.getRuntime(runtimeId)?.tier !== "local-native") return "tier";
14412
+ if (runtimeId === void 0 || deps.providers.getRuntime(runtimeId)?.tier !== "local-native" && !(runtimeId === "litellm" && targetId && deps.providers.getTarget(targetId)?.cache?.deployment))
14413
+ return "tier";
13965
14414
  return null;
13966
14415
  };
13967
14416
  const runOnce = async (trigger, controller) => {
13968
14417
  const refusal2 = admissionRefusal();
13969
14418
  if (refusal2) return { ran: false, reason: refusal2 };
14419
+ const targetId = deps.getSettings().chat.target;
14420
+ const target = targetId ? deps.providers.getTarget(targetId) : null;
14421
+ if (!target) return { ran: false, reason: "unresolved" };
14422
+ const targetSettings = JSON.stringify(target);
14423
+ const started = Date.now();
14424
+ if (target.cache?.retention === "none") return { ran: false, reason: "disabled" };
14425
+ if (target.pricing && Object.values(target.pricing).some((rate) => rate > 0))
14426
+ return { ran: false, reason: "deployment", detail: "paid-warming-disabled" };
14427
+ const cooldown = Math.max(1e3, target.cache?.warm?.cooldownMs ?? 6e4);
14428
+ if (Date.now() - lastFinished < cooldown) return { ran: false, reason: "cooldown" };
14429
+ const observe = deps.observeDeployment ?? observeCacheDeployment;
14430
+ let deployment = await observe(target, deps.getSettings().chat.model ?? "", {
14431
+ signal: controller.signal
14432
+ });
14433
+ if (deployment.warm !== "bounded") return { ran: false, reason: "deployment", detail: deployment.reason };
13970
14434
  const prepared = await deps.prepareRuntime(controller.signal);
13971
14435
  if (!prepared.ok) return { ran: false, reason: "unresolved" };
13972
14436
  const runtime = prepared.runtime;
@@ -13978,11 +14442,33 @@ function createTurnPrewarm(deps) {
13978
14442
  const lateRefusal = admissionRefusal();
13979
14443
  if (lateRefusal) return { ran: false, reason: lateRefusal };
13980
14444
  if (detached.has(controller) || controller.signal.aborted) return { ran: false, reason: "superseded" };
14445
+ deployment = await observe(target, runtime.wireModelId, { signal: controller.signal });
14446
+ if (deployment.warm !== "bounded") return { ran: false, reason: "deployment", detail: deployment.reason };
14447
+ const finalRefusal = admissionRefusal();
14448
+ if (finalRefusal) return { ran: false, reason: finalRefusal };
14449
+ if (detached.has(controller) || controller.signal.aborted || JSON.stringify(deps.providers.getTarget(target.id)) !== targetSettings)
14450
+ return { ran: false, reason: "superseded" };
14451
+ if (Date.now() - started > 3e4) return { ran: false, reason: "expired" };
14452
+ if (deployment.endpoint && (endpointCapacityUsage()[deployment.endpoint] ?? 0) > 0)
14453
+ return { ran: false, reason: "dispatch-active" };
14454
+ const prefix = createHash4("sha256").update(
14455
+ JSON.stringify({
14456
+ model: runtime.agent.state.model,
14457
+ system: runtime.agent.state.systemPrompt,
14458
+ messages: runtime.agent.state.messages,
14459
+ tools: runtime.agent.state.tools,
14460
+ thinking: runtime.agent.state.thinkingLevel
14461
+ })
14462
+ ).digest("hex");
14463
+ if (prefix === lastPrefix && Date.now() - lastFinished < Math.max(cooldown, 6e4))
14464
+ return { ran: false, reason: "cooldown" };
13981
14465
  const releaseEndpointSlot = deps.registerEndpointSlot?.(runtime) ?? null;
13982
14466
  let result;
14467
+ const deadline = setTimeout(() => controller.abort(), Math.min(target.cache?.warm?.maxDurationMs ?? 3e4, 12e4));
13983
14468
  try {
13984
14469
  result = await round({
13985
14470
  model: runtime.agent.state.model,
14471
+ agent: runtime.agent,
13986
14472
  state: {
13987
14473
  systemPrompt: runtime.agent.state.systemPrompt,
13988
14474
  messages: runtime.agent.state.messages,
@@ -13990,14 +14476,18 @@ function createTurnPrewarm(deps) {
13990
14476
  thinkingLevel: runtime.agent.state.thinkingLevel ?? "off"
13991
14477
  },
13992
14478
  ...prepared.apiKey !== void 0 ? { apiKey: prepared.apiKey } : {},
13993
- signal: controller.signal
14479
+ signal: controller.signal,
14480
+ maxInputTokens: target.cache?.warm?.maxInputTokens ?? 8192
13994
14481
  });
13995
14482
  } finally {
14483
+ clearTimeout(deadline);
14484
+ lastFinished = Date.now();
13996
14485
  releaseEndpointSlot?.();
13997
14486
  }
14487
+ lastPrefix = result.aborted || result.errorMessage ? null : prefix;
13998
14488
  const wasDetached = detached.has(controller) || controller.signal.aborted;
13999
14489
  const promptTokens = prewarmPromptTokens(result);
14000
- if (!wasDetached) {
14490
+ if (!wasDetached && !result.errorMessage) {
14001
14491
  deps.context.notePrewarm({
14002
14492
  tokens: promptTokens,
14003
14493
  ms: result.timing.apiMs,
@@ -14015,6 +14505,7 @@ function createTurnPrewarm(deps) {
14015
14505
  parentTurnId: deps.state.lastTurnId,
14016
14506
  data: {
14017
14507
  trigger,
14508
+ deployment,
14018
14509
  target: runtime.targetId,
14019
14510
  model: runtime.wireModelId,
14020
14511
  promptTokens,
@@ -14022,9 +14513,10 @@ function createTurnPrewarm(deps) {
14022
14513
  detached: wasDetached,
14023
14514
  timing: result.timing,
14024
14515
  promptCache: {
14025
- input: result.usage?.input ?? 0,
14026
- cacheRead: result.usage?.cacheRead ?? 0,
14027
- cacheWrite: result.usage?.cacheWrite ?? 0,
14516
+ input: result.usage?.input ?? null,
14517
+ cacheRead: result.usage?.cacheRead ?? null,
14518
+ cacheWrite: result.usage?.cacheWrite ?? null,
14519
+ ...result.usage?.cacheWrite1h === void 0 ? {} : { cacheWrite1h: result.usage.cacheWrite1h },
14028
14520
  ...result.backend ? { backend: { ...result.backend } } : {}
14029
14521
  },
14030
14522
  ...result.errorMessage ? { error: result.errorMessage } : {}
@@ -14043,21 +14535,44 @@ function createTurnPrewarm(deps) {
14043
14535
  };
14044
14536
  const fire = () => {
14045
14537
  timer = null;
14538
+ if (disposed || running !== null) return;
14046
14539
  const trigger = pendingTrigger;
14047
14540
  pendingTrigger = null;
14048
14541
  if (trigger === null) return;
14049
14542
  const controller = new AbortController();
14050
14543
  active = controller;
14051
- const previous = inFlight;
14052
- inFlight = previous.catch(() => null).then(() => runOnce(trigger, controller)).catch(() => null).finally(() => {
14544
+ running = controller;
14545
+ inFlight = (Date.now() - pendingSince > 3e4 ? Promise.resolve({ ran: false, reason: "expired" }) : runOnce(trigger, controller)).then((outcome) => {
14546
+ if (!outcome.ran && deps.getSettings().chat.prewarm && outcome.reason !== "surface") {
14547
+ const key = `${outcome.reason}:${outcome.detail ?? ""}`;
14548
+ if (lastSkip !== key) {
14549
+ lastSkip = key;
14550
+ try {
14551
+ deps.session?.appendEntry({
14552
+ kind: "custom",
14553
+ customType: "prewarmSkipped",
14554
+ display: false,
14555
+ parentTurnId: deps.state.lastTurnId,
14556
+ data: { trigger, ...outcome }
14557
+ });
14558
+ } catch {
14559
+ }
14560
+ }
14561
+ } else if (outcome.ran) lastSkip = null;
14562
+ return outcome;
14563
+ }).catch(() => null).finally(() => {
14053
14564
  if (active === controller) active = null;
14565
+ running = null;
14566
+ if (!disposed && pendingTrigger !== null && timer === null) timer = setTimeout(fire, 0);
14054
14567
  });
14055
14568
  };
14056
14569
  return {
14057
14570
  schedule(trigger) {
14571
+ if (disposed) return;
14058
14572
  releaseActiveRound();
14059
14573
  pendingTrigger = trigger;
14060
- if (timer !== null) return;
14574
+ pendingSince = Date.now();
14575
+ if (timer !== null || running !== null) return;
14061
14576
  timer = setTimeout(fire, 0);
14062
14577
  },
14063
14578
  cancel() {
@@ -14068,21 +14583,23 @@ function createTurnPrewarm(deps) {
14068
14583
  }
14069
14584
  releaseActiveRound();
14070
14585
  },
14071
- settled() {
14072
- return new Promise((resolve10) => {
14073
- setTimeout(() => {
14074
- resolve10(inFlight.catch(() => null));
14075
- }, 0);
14076
- });
14586
+ async settled() {
14587
+ let outcome;
14588
+ do {
14589
+ await new Promise((resolve11) => setTimeout(resolve11, 0));
14590
+ outcome = await inFlight;
14591
+ } while (timer !== null || running !== null || pendingTrigger !== null);
14592
+ return outcome;
14077
14593
  },
14078
14594
  dispose() {
14595
+ disposed = true;
14079
14596
  for (const unsubscribe of unsubscribeDispatch) unsubscribe?.();
14080
14597
  pendingTrigger = null;
14081
14598
  if (timer !== null) {
14082
14599
  clearTimeout(timer);
14083
14600
  timer = null;
14084
14601
  }
14085
- active?.abort();
14602
+ running?.abort();
14086
14603
  active = null;
14087
14604
  }
14088
14605
  };
@@ -14232,7 +14749,7 @@ function createTurnRecovery(deps) {
14232
14749
  deps.emitFailureMessage(message);
14233
14750
  };
14234
14751
  const waitForRetryCountdown = async (status) => {
14235
- return new Promise((resolve10) => {
14752
+ return new Promise((resolve11) => {
14236
14753
  let settled = false;
14237
14754
  let currentHandle = null;
14238
14755
  const handle = createRetryCountdown({
@@ -14249,12 +14766,12 @@ function createTurnRecovery(deps) {
14249
14766
  onDone: () => {
14250
14767
  settled = true;
14251
14768
  if (retryCountdown2 === currentHandle) retryCountdown2 = null;
14252
- resolve10("done");
14769
+ resolve11("done");
14253
14770
  },
14254
14771
  onCancel: () => {
14255
14772
  settled = true;
14256
14773
  if (retryCountdown2 === currentHandle) retryCountdown2 = null;
14257
- resolve10("cancelled");
14774
+ resolve11("cancelled");
14258
14775
  }
14259
14776
  });
14260
14777
  currentHandle = handle;
@@ -14340,7 +14857,6 @@ function createTurnRecovery(deps) {
14340
14857
  maxAttempts: settings.maxRetries,
14341
14858
  errorMessage: message
14342
14859
  });
14343
- deps.emitNotice(message);
14344
14860
  pruneFailedAssistantFromContext(agentRuntime.agent);
14345
14861
  return true;
14346
14862
  }
@@ -14644,9 +15160,13 @@ function createTurnRuntime(deps) {
14644
15160
  `[Clio Coder] thinking ${resolution.requestedThinkingLevel} -> ${thinking.display}: ${notice} (${resolution.wireModelId})`
14645
15161
  );
14646
15162
  };
15163
+ let runtimeTargetSettings = null;
14647
15164
  const ensureRuntime = () => {
14648
15165
  const target = readTarget();
14649
15166
  if (!target) return null;
15167
+ const targetSettings = JSON.stringify(target.target);
15168
+ const sameTargetSettings = runtimeTargetSettings === targetSettings;
15169
+ setGlobalDefaultMaxOutputTokens(deps.getSettings().chat.maxOutputTokens);
14650
15170
  context.emitContextWindowWarningTransition(target.runtimeResolution?.contextWindowDetails?.warning ?? null);
14651
15171
  if (!deps.knownTargets().has(target.target.id)) {
14652
15172
  throw new TurnAdmissionError(
@@ -14654,7 +15174,7 @@ function createTurnRuntime(deps) {
14654
15174
  "target-unknown"
14655
15175
  );
14656
15176
  }
14657
- if (state.runtime && state.runtime.targetId === target.target.id && state.runtime.runtimeId === target.runtime.id && state.runtime.wireModelId === target.wireModelId) {
15177
+ if (state.runtime && state.runtime.targetId === target.target.id && state.runtime.runtimeId === target.runtime.id && sameTargetSettings && state.runtime.wireModelId === target.wireModelId) {
14658
15178
  ensureReasoningProbe(target);
14659
15179
  const runtimeResolution = refineRuntimeTargetWithModelHints(
14660
15180
  target.runtimeResolution,
@@ -14669,7 +15189,7 @@ function createTurnRuntime(deps) {
14669
15189
  emitThinkingClampNotice(runtimeResolution);
14670
15190
  return state.runtime;
14671
15191
  }
14672
- if (state.runtime && state.runtime.targetId === target.target.id && state.runtime.runtimeId === target.runtime.id && state.runtime.wireModelId !== target.wireModelId) {
15192
+ if (state.runtime && state.runtime.targetId === target.target.id && state.runtime.runtimeId === target.runtime.id && sameTargetSettings && state.runtime.wireModelId !== target.wireModelId) {
14673
15193
  const nextModel = synthesizeModel(target);
14674
15194
  state.runtime.agent.state.model = nextModel;
14675
15195
  state.runtime.wireModelId = target.wireModelId;
@@ -14705,6 +15225,7 @@ function createTurnRuntime(deps) {
14705
15225
  maxRetryDelayMs: deps.retrySettings().maxDelayMs,
14706
15226
  ...gatewaySessionId ? { sessionId: gatewaySessionId } : {},
14707
15227
  onStreamInvocation: () => {
15228
+ setGlobalDefaultMaxOutputTokens(deps.getSettings().chat.maxOutputTokens);
14708
15229
  apiCallStartedAt = performance3.now();
14709
15230
  apiCallFirstDeltaAt = null;
14710
15231
  },
@@ -14758,18 +15279,24 @@ function createTurnRuntime(deps) {
14758
15279
  stallTimer = setTimeout(
14759
15280
  () => {
14760
15281
  stallTimer = null;
14761
- const stallMs = deps.retrySettings().streamStallMs;
14762
- if (stallMs <= 0) return;
15282
+ const retry = deps.retrySettings();
15283
+ if (retry.streamStallMs <= 0) return;
14763
15284
  if (stallSuspendDepth > 0 || toolsInFlight > 0) {
14764
- armStallTimer(stallMs);
15285
+ armStallTimer(retry.streamStallMs);
15286
+ return;
15287
+ }
15288
+ const awaitingFirstToken = apiCallStartedAt !== null && apiCallFirstDeltaAt === null;
15289
+ if (awaitingFirstToken && retry.firstTokenStallMs <= 0) {
15290
+ armStallTimer(retry.streamStallMs);
14765
15291
  return;
14766
15292
  }
15293
+ const stallMs = awaitingFirstToken ? Math.max(retry.firstTokenStallMs, retry.streamStallMs) : retry.streamStallMs;
14767
15294
  const idleMs = performance3.now() - lastActivityAt;
14768
15295
  if (idleMs < stallMs) {
14769
15296
  armStallTimer(stallMs - idleMs);
14770
15297
  return;
14771
15298
  }
14772
- state.streamStallReason = `stream stalled: no output from ${localRuntime.targetId} for ${Math.round(idleMs / 1e3)}s, aborting (stream timeout)`;
15299
+ state.streamStallReason = `stream stalled: no ${awaitingFirstToken ? "first token" : "output"} from ${localRuntime.targetId} for ${Math.round(idleMs / 1e3)}s, aborting (stream timeout)`;
14773
15300
  localRuntime.agent.abort();
14774
15301
  },
14775
15302
  Math.max(1, delayMs)
@@ -14878,7 +15405,12 @@ function createTurnRuntime(deps) {
14878
15405
  const assistantEvent = publicEvent.assistantMessageEvent;
14879
15406
  const hasDelta = assistantEvent.type === "toolcall_start" || (assistantEvent.type === "text_delta" || assistantEvent.type === "thinking_delta" || assistantEvent.type === "toolcall_delta") && typeof assistantEvent.delta === "string" && assistantEvent.delta.length > 0;
14880
15407
  if (hasDelta && firstAssistantDeltaAt === null) firstAssistantDeltaAt = eventClock;
14881
- if (hasDelta && apiCallFirstDeltaAt === null) apiCallFirstDeltaAt = eventClock;
15408
+ if (hasDelta && apiCallFirstDeltaAt === null) {
15409
+ apiCallFirstDeltaAt = eventClock;
15410
+ const stallMs = deps.retrySettings().streamStallMs;
15411
+ clearStallTimer();
15412
+ if (stallMs > 0) armStallTimer(stallMs);
15413
+ }
14882
15414
  }
14883
15415
  if (enrichedEvent.type === "agent_end") {
14884
15416
  context.noteRunCacheSummary(enrichedEvent.messages, runFirstCallVerdict);
@@ -14900,6 +15432,7 @@ function createTurnRuntime(deps) {
14900
15432
  output: summary.output,
14901
15433
  cacheRead: summary.cacheRead,
14902
15434
  cacheWrite: summary.cacheWrite,
15435
+ ...summary.cacheWrite1h === void 0 ? {} : { cacheWrite1h: summary.cacheWrite1h },
14903
15436
  reasoningTokens: summary.reasoning,
14904
15437
  totalTokens: summary.tokens,
14905
15438
  apiCalls: summary.apiCalls
@@ -15005,6 +15538,7 @@ function createTurnRuntime(deps) {
15005
15538
  }
15006
15539
  });
15007
15540
  state.runtime = localRuntime;
15541
+ runtimeTargetSettings = targetSettings;
15008
15542
  if (hadPriorRuntime) persistence.appendModelChangeEntry(target);
15009
15543
  ensureReasoningProbe(target);
15010
15544
  return state.runtime;
@@ -15116,7 +15650,7 @@ function createChatLoop(deps) {
15116
15650
  const current = skillSurfaceNames(next).join(", ");
15117
15651
  if (deps.session?.current() && (explicitOff || previous.length > 0 || (policy?.loadedSkillNames.size ?? 0) > 0 || (policy?.requests.length ?? 0) > 0)) {
15118
15652
  const entries = filterEntriesToActivePath(deps.readSessionEntries?.() ?? [], state.lastTurnId ?? void 0);
15119
- const selection = next ? mainSkillContextState(entries, next) : (policy?.loadedSkillNames.size ?? 0) > 0 ? null : { version: 1, activationRefs: [] };
15653
+ const selection = next ? mainSkillContextState(entries, next) : policy !== void 0 && policy.loadedSkillNames.size > 0 ? mainSkillContextState(entries, policy) : { version: 1, activationRefs: [] };
15120
15654
  const data = selection ?? { version: 1, activationRefs: [], unknown: true };
15121
15655
  if (JSON.stringify(data) !== JSON.stringify(latestSkillContextState(entries))) {
15122
15656
  deps.session.appendEntry({ kind: "custom", customType: SKILL_CONTEXT_STATE, parentTurnId: state.lastTurnId, data });
@@ -15246,9 +15780,6 @@ function createChatLoop(deps) {
15246
15780
  const unsubscribeConfigReload = deps.bus?.on(BusChannels.ConfigHotReload, () => {
15247
15781
  context.invalidateSessionPromptCache();
15248
15782
  }) ?? null;
15249
- const unsubscribeExtensionsReload = deps.bus?.on(BusChannels.ExtensionsReloaded, (payload) => {
15250
- if (payload.changed) context.invalidateSessionPromptCache();
15251
- }) ?? null;
15252
15783
  const unsubscribePluginsReload = deps.bus?.on(BusChannels.PluginsReloaded, () => {
15253
15784
  context.invalidateSessionPromptCache();
15254
15785
  }) ?? null;
@@ -15308,6 +15839,7 @@ function createChatLoop(deps) {
15308
15839
  output: usage.output,
15309
15840
  cacheRead: usage.cacheRead,
15310
15841
  cacheWrite: usage.cacheWrite,
15842
+ ...usage.cacheWrite1h === void 0 ? {} : { cacheWrite1h: usage.cacheWrite1h },
15311
15843
  reasoningTokens: usage.reasoning,
15312
15844
  totalTokens: usage.totalTokens,
15313
15845
  apiCalls: 1
@@ -15331,6 +15863,7 @@ function createChatLoop(deps) {
15331
15863
  output: usage.output,
15332
15864
  cacheRead: usage.cacheRead,
15333
15865
  cacheWrite: usage.cacheWrite,
15866
+ ...usage.cacheWrite1h === void 0 ? {} : { cacheWrite1h: usage.cacheWrite1h },
15334
15867
  reasoning: usage.reasoning,
15335
15868
  totalTokens: usage.totalTokens,
15336
15869
  costUsd: usage.costUsd,
@@ -15541,7 +16074,8 @@ function createChatLoop(deps) {
15541
16074
  submittedText,
15542
16075
  images,
15543
16076
  options.requestContinuation === true,
15544
- text
16077
+ text,
16078
+ options.display?.text
15545
16079
  );
15546
16080
  if (interrupted)
15547
16081
  emit({
@@ -15762,7 +16296,6 @@ function createChatLoop(deps) {
15762
16296
  },
15763
16297
  dispose() {
15764
16298
  unsubscribeConfigReload?.();
15765
- unsubscribeExtensionsReload?.();
15766
16299
  unsubscribePluginsReload?.();
15767
16300
  unsubscribeSynthesisLock?.();
15768
16301
  unsubscribePrewarmCompaction();
@@ -15893,8 +16426,8 @@ function createChatLoop(deps) {
15893
16426
  const previous = admissionTail;
15894
16427
  let release = () => {
15895
16428
  };
15896
- const ticket = new Promise((resolve10) => {
15897
- release = resolve10;
16429
+ const ticket = new Promise((resolve11) => {
16430
+ release = resolve11;
15898
16431
  });
15899
16432
  admissionTail = ticket;
15900
16433
  const releaseTicket = () => {
@@ -16145,9 +16678,6 @@ function parseViewFilterQuery(query) {
16145
16678
  function isNonEmptySearchValue(value) {
16146
16679
  return typeof value === "string" && value.trim().length > 0;
16147
16680
  }
16148
- function broadFilterText(artifact) {
16149
- return `${artifact.id} ${artifact.category} ${artifact.title}`;
16150
- }
16151
16681
  function artifactSearchValues(artifact) {
16152
16682
  return [
16153
16683
  artifact.id,
@@ -16163,8 +16693,9 @@ function artifactSearchValues(artifact) {
16163
16693
  ...artifact.searchText ?? []
16164
16694
  ].filter(isNonEmptySearchValue);
16165
16695
  }
16166
- function categoryFilterText(artifact) {
16167
- return artifactSearchValues(artifact).join(" ");
16696
+ function matchesFilterText(artifact, query) {
16697
+ const values = artifactSearchValues(artifact).map((value) => value.toLocaleLowerCase());
16698
+ return query.toLocaleLowerCase().split(/\s+/u).every((token) => values.some((value) => value.includes(token)));
16168
16699
  }
16169
16700
  function matchesExactArtifactValue(artifact, value) {
16170
16701
  const exact = value.trim();
@@ -16195,10 +16726,10 @@ function filterViewArtifacts(artifacts, query) {
16195
16726
  if (parsed.kind === "category") {
16196
16727
  const categoryArtifacts = artifacts.filter((artifact) => artifact.category === parsed.category);
16197
16728
  if (parsed.value.length === 0) return categoryArtifacts;
16198
- return fuzzyFilter(categoryArtifacts, parsed.value, categoryFilterText);
16729
+ return categoryArtifacts.filter((artifact) => matchesFilterText(artifact, parsed.value));
16199
16730
  }
16200
16731
  if (parsed.text.length === 0) return [...artifacts];
16201
- return fuzzyFilter([...artifacts], parsed.text, broadFilterText);
16732
+ return artifacts.filter((artifact) => matchesFilterText(artifact, parsed.text));
16202
16733
  }
16203
16734
  function artifactsInCategoryOrder(artifacts) {
16204
16735
  return VIEW_ARTIFACT_CATEGORIES.flatMap((category) => artifacts.filter((artifact) => artifact.category === category));
@@ -16340,6 +16871,7 @@ function viewFooterHint(focus, canVerify, innerWidth) {
16340
16871
  { key: "PgUp/PgDn", verb: "page" },
16341
16872
  { key: "g/G", verb: "top/bottom" },
16342
16873
  ...canVerify ? [{ key: "v", verb: "verify" }] : [],
16874
+ { key: "i", verb: "info" },
16343
16875
  { key: "o", verb: "path" }
16344
16876
  ],
16345
16877
  "back"
@@ -16349,7 +16881,7 @@ var ViewOverlayView = class {
16349
16881
  constructor(options) {
16350
16882
  this.options = options;
16351
16883
  this.filterText = options.initialFilter ?? "";
16352
- this.filterInput.setValue(this.filterText);
16884
+ this.filterInput.handleInput(`\x1B[200~${this.filterText}\x1B[201~`);
16353
16885
  }
16354
16886
  options;
16355
16887
  artifacts = [];
@@ -16373,25 +16905,36 @@ var ViewOverlayView = class {
16373
16905
  artifactError = null;
16374
16906
  content = null;
16375
16907
  loadToken = 0;
16908
+ refreshToken = 0;
16909
+ showProvenance = false;
16376
16910
  lastContentWidth = 80;
16377
16911
  lastContentBodyHeight = 1;
16378
16912
  verifications = /* @__PURE__ */ new Map();
16379
16913
  refresh() {
16914
+ const refreshToken = ++this.refreshToken;
16915
+ const selected = this.selectedArtifact();
16916
+ this.loadToken += 1;
16380
16917
  this.loadingArtifacts = true;
16381
16918
  this.artifactError = null;
16382
16919
  this.options.requestRender?.();
16383
16920
  void (async () => {
16384
16921
  try {
16385
- this.artifacts = await listViewArtifacts(this.options.providers);
16386
- this.selectedIndex = initialViewSelection(this.artifacts, this.filterText);
16922
+ const artifacts = await listViewArtifacts(this.options.providers);
16923
+ if (refreshToken !== this.refreshToken) return;
16924
+ this.artifacts = artifacts;
16925
+ const retainedIndex = selected ? this.filteredArtifacts().findIndex((artifact) => artifactKey(artifact) === artifactKey(selected)) : -1;
16926
+ this.selectedIndex = retainedIndex >= 0 ? retainedIndex : initialViewSelection(this.artifacts, this.filterText);
16387
16927
  this.contentScrollOffset = 0;
16388
16928
  this.content = null;
16389
16929
  } catch (err) {
16930
+ if (refreshToken !== this.refreshToken) return;
16390
16931
  this.artifactError = err instanceof Error ? err.message : String(err);
16391
16932
  this.artifacts = [];
16392
16933
  } finally {
16393
- this.loadingArtifacts = false;
16394
- this.options.requestRender?.();
16934
+ if (refreshToken === this.refreshToken) {
16935
+ this.loadingArtifacts = false;
16936
+ this.options.requestRender?.();
16937
+ }
16395
16938
  }
16396
16939
  })();
16397
16940
  }
@@ -16407,6 +16950,8 @@ var ViewOverlayView = class {
16407
16950
  return filtered[this.selectedIndex];
16408
16951
  }
16409
16952
  selectIndex(next) {
16953
+ this.loadToken += 1;
16954
+ this.showProvenance = false;
16410
16955
  const filtered = this.filteredArtifacts();
16411
16956
  if (filtered.length === 0) {
16412
16957
  this.selectedIndex = 0;
@@ -16427,14 +16972,17 @@ var ViewOverlayView = class {
16427
16972
  this.selectIndex(initialViewSelection(this.artifacts, this.filterText));
16428
16973
  }
16429
16974
  ensureContentLoaded(artifact) {
16430
- if (!artifact) return;
16975
+ if (!artifact) {
16976
+ this.content = null;
16977
+ return;
16978
+ }
16431
16979
  const key = artifactKey(artifact);
16432
16980
  if (this.content?.key === key) return;
16433
16981
  const token = ++this.loadToken;
16434
16982
  this.content = { key, status: "loading", lines: [clioTheme().fg("dim", "loading artifact\u2026")], format: "text" };
16435
16983
  void (async () => {
16436
16984
  try {
16437
- const loaded = await artifact.load();
16985
+ const loaded = await Promise.resolve().then(() => artifact.load());
16438
16986
  if (token !== this.loadToken) return;
16439
16987
  this.content = { key, status: "loaded", lines: loaded.lines, format: loaded.format };
16440
16988
  } catch (err) {
@@ -16453,6 +17001,20 @@ var ViewOverlayView = class {
16453
17001
  })();
16454
17002
  }
16455
17003
  renderedContentLines(width) {
17004
+ if (this.showProvenance) {
17005
+ const artifact = this.selectedArtifact();
17006
+ if (!artifact) return [];
17007
+ return [
17008
+ `Title: ${artifact.title}`,
17009
+ `Category: ${artifact.category}`,
17010
+ `ID: ${artifact.id}`,
17011
+ `Path: ${artifact.path ?? "No backing path"}`,
17012
+ ...artifact.sessionId ? [`Session: ${artifact.sessionId}`] : [],
17013
+ ...artifact.runId ? [`Run: ${artifact.runId}`] : [],
17014
+ ...artifact.correlationId ? [`Correlation: ${artifact.correlationId}`] : [],
17015
+ ...artifact.description ? [`Details: ${artifact.description}`] : []
17016
+ ].flatMap((line) => wrapTextWithAnsi(sanitizeCallTargetText(line), Math.max(1, width)));
17017
+ }
16456
17018
  const content = this.content;
16457
17019
  if (!content) return [];
16458
17020
  if (content.status === "error") return content.lines.flatMap((line) => wrapTextWithAnsi(line, Math.max(1, width)));
@@ -16479,10 +17041,30 @@ var ViewOverlayView = class {
16479
17041
  return this.fixedLines(lines, width, height);
16480
17042
  }
16481
17043
  const filtered = this.filteredArtifacts();
16482
- if (filtered.length === 0) return this.fixedLines([...lines, theme6.fg("dim", "No matching details.")], width, height);
17044
+ lines.push(
17045
+ padAnsi(
17046
+ theme6.fg(
17047
+ this.focus === "list" ? "accent" : "dim",
17048
+ `List \xB7 ${filtered.length}/${this.artifacts.length} \xB7 \u2190\u2192 category`
17049
+ ),
17050
+ width,
17051
+ ELLIPSIS
17052
+ )
17053
+ );
17054
+ if (filtered.length === 0)
17055
+ return this.fixedLines(
17056
+ [
17057
+ ...lines,
17058
+ theme6.fg("dim", "No matching details."),
17059
+ theme6.fg("muted", "Ctrl+U clears the filter."),
17060
+ theme6.fg("dim", "Try workspace: or receipt:")
17061
+ ],
17062
+ width,
17063
+ height
17064
+ );
16483
17065
  const rows = groupedViewRows(filtered);
16484
17066
  const selectedRow = rows.findIndex((row2) => row2.type === "item" && row2.itemIndex === this.selectedIndex);
16485
- const rowHeight = Math.max(1, height - 1);
17067
+ const rowHeight = Math.max(1, height - lines.length);
16486
17068
  if (selectedRow >= 0) {
16487
17069
  if (selectedRow < this.listScrollOffset) this.listScrollOffset = selectedRow;
16488
17070
  if (selectedRow >= this.listScrollOffset + rowHeight) this.listScrollOffset = selectedRow - rowHeight + 1;
@@ -16518,7 +17100,17 @@ var ViewOverlayView = class {
16518
17100
  this.ensureContentLoaded(artifact);
16519
17101
  this.lastContentWidth = width;
16520
17102
  const verification = artifact ? this.verifications.get(artifactKey(artifact)) : void 0;
16521
- const header = buildArtifactHeaderLines(artifact, verification, width);
17103
+ const header = [
17104
+ padAnsi(
17105
+ clioTheme().fg(
17106
+ this.focus === "content" ? "accent" : "dim",
17107
+ this.showProvenance ? "Provenance \xB7 i preview \xB7 Esc list" : this.focus === "content" ? "Preview \xB7 i info \xB7 Esc list" : "Preview \xB7 Enter/Tab focus"
17108
+ ),
17109
+ width,
17110
+ ELLIPSIS
17111
+ ),
17112
+ ...buildArtifactHeaderLines(artifact, verification, width)
17113
+ ];
16522
17114
  const bodyHeight = Math.max(0, height - header.length);
16523
17115
  this.lastContentBodyHeight = Math.max(1, bodyHeight);
16524
17116
  const body = this.renderedContentLines(width);
@@ -16552,6 +17144,7 @@ var ViewOverlayView = class {
16552
17144
  handleInput(data) {
16553
17145
  data = localKey(data);
16554
17146
  if (matchesKey(data, "tab") || matchesKey(data, "shift+tab") || this.focus === "list" && matchesKey(data, "enter")) {
17147
+ if (this.focus === "list" && !this.selectedArtifact()) return;
16555
17148
  this.focus = this.focus === "list" ? "content" : "list";
16556
17149
  this.options.requestRender?.();
16557
17150
  return;
@@ -16564,6 +17157,12 @@ var ViewOverlayView = class {
16564
17157
  this.selectCategory(1);
16565
17158
  return;
16566
17159
  }
17160
+ if (this.focus === "content" && data === "i") {
17161
+ this.showProvenance = !this.showProvenance;
17162
+ this.contentScrollOffset = 0;
17163
+ this.options.requestRender?.();
17164
+ return;
17165
+ }
16567
17166
  if (this.focus === "content" && data === "v") {
16568
17167
  this.verifySelected();
16569
17168
  return;
@@ -16598,7 +17197,9 @@ var ViewOverlayView = class {
16598
17197
  return true;
16599
17198
  }
16600
17199
  const previous = this.filterText;
16601
- this.filterInput.handleInput(data);
17200
+ if (matchesKey(data, "ctrl+u")) {
17201
+ this.filterInput.applyEdit("clear");
17202
+ } else this.filterInput.handleInput(data);
16602
17203
  this.filterText = this.filterInput.getValue();
16603
17204
  if (previous !== this.filterText) {
16604
17205
  this.selectInitialFilterMatch();
@@ -16983,8 +17584,8 @@ var AskUserOverlayView = class {
16983
17584
  this.resetQuestionScroll();
16984
17585
  this.rebuildControl();
16985
17586
  this.deps.requestRender();
16986
- return new Promise((resolve10) => {
16987
- this.resolveCurrent = resolve10;
17587
+ return new Promise((resolve11) => {
17588
+ this.resolveCurrent = resolve11;
16988
17589
  });
16989
17590
  }
16990
17591
  cancel() {
@@ -17192,7 +17793,7 @@ var AskUserOverlayView = class {
17192
17793
  return lines;
17193
17794
  }
17194
17795
  finish(result) {
17195
- const resolve10 = this.resolveCurrent;
17796
+ const resolve11 = this.resolveCurrent;
17196
17797
  this.resolveCurrent = null;
17197
17798
  this.list = null;
17198
17799
  this.text = null;
@@ -17203,7 +17804,7 @@ var AskUserOverlayView = class {
17203
17804
  }
17204
17805
  if (this.phase !== "closed") this.phase = "waiting";
17205
17806
  this.deps.requestRender();
17206
- resolve10?.(result);
17807
+ resolve11?.(result);
17207
17808
  }
17208
17809
  renderWaiting(width, maxRows) {
17209
17810
  const theme6 = clioTheme();
@@ -17869,14 +18470,14 @@ function createAuthDialogController(title, onCancel) {
17869
18470
  });
17870
18471
  input.onSubmit = () => {
17871
18472
  if (!resolver) return;
17872
- const resolve10 = resolver;
18473
+ const resolve11 = resolver;
17873
18474
  resolver = void 0;
17874
18475
  rejecter = void 0;
17875
18476
  const value = input.getValue();
17876
18477
  promptLabel = null;
17877
18478
  input.setValue("");
17878
18479
  rebuild();
17879
- resolve10(value);
18480
+ resolve11(value);
17880
18481
  };
17881
18482
  input.onEscape = () => {
17882
18483
  cancel();
@@ -17930,8 +18531,8 @@ function createAuthDialogController(title, onCancel) {
17930
18531
  promptLabel = label;
17931
18532
  input.setValue("");
17932
18533
  rebuild();
17933
- return new Promise((resolve10, reject) => {
17934
- resolver = resolve10;
18534
+ return new Promise((resolve11, reject) => {
18535
+ resolver = resolve11;
17935
18536
  rejecter = reject;
17936
18537
  });
17937
18538
  }
@@ -18155,10 +18756,10 @@ function createOverlayAuthLifecycle(deps) {
18155
18756
  },
18156
18757
  onPrompt: async (prompt) => (await dialog.controller.prompt(prompt.message)).trim(),
18157
18758
  onSelect: (prompt) => selectOAuthOption(prompt, [`Target: ${targetId}`, `Runtime: ${runtime.id}`]),
18158
- onManualCodeInput: async () => await new Promise((resolve10, reject) => {
18759
+ onManualCodeInput: async () => await new Promise((resolve11, reject) => {
18159
18760
  manualCodeTimer = setTimeout(() => {
18160
18761
  manualCodeTimer = null;
18161
- dialog.controller.prompt("Verification code").then((value) => resolve10(value.trim())).catch(reject);
18762
+ dialog.controller.prompt("Verification code").then((value) => resolve11(value.trim())).catch(reject);
18162
18763
  }, 1e4);
18163
18764
  manualCodeTimer.unref?.();
18164
18765
  }),
@@ -19146,7 +19747,8 @@ var ListOverlayView = class {
19146
19747
  const tab = this.activeTab();
19147
19748
  if (tab === void 0) return null;
19148
19749
  const count2 = this.tabCounts.get(tab.id) ?? this.items.length;
19149
- return { key: "\u2190\u2192", verb: `tab \xB7 ${count2} ${tab.label.toLowerCase()}`, short: "tab", critical: true };
19750
+ const countLabel = tab.countLabel?.(count2) ?? `${count2} ${tab.label.toLowerCase()}`;
19751
+ return { key: "\u2190\u2192", verb: `tab \xB7 ${countLabel}`, short: "tab", critical: true };
19150
19752
  }
19151
19753
  getHint() {
19152
19754
  if (this.options.explicitSearch && this.isFilterFocused) {
@@ -21023,13 +21625,20 @@ function createOverlayGeneralOpeners(deps) {
21023
21625
  deps.startDispatchBoardTicker();
21024
21626
  deps.requestRender();
21025
21627
  };
21026
- const dispatchBoardHint = () => {
21628
+ const dispatchBoardHint = (innerWidth) => {
21027
21629
  const row2 = deps.dispatchBoard.selectedRow();
21028
- const entries = [{ key: "\u2191\u2193", verb: "select" }];
21029
- if (row2) entries.push({ key: "Enter", verb: deps.dispatchBoard.detailExpanded() ? "hide detail" : "detail" });
21030
- if (row2 && isDispatchBoardRowSteerable(row2)) entries.push({ key: "s", verb: "steer" });
21031
- if (row2 && isDispatchBoardRowCancellable(row2)) entries.push({ key: "x", verb: "cancel" });
21032
- return buildHint(entries);
21630
+ const entries = [];
21631
+ if (row2) {
21632
+ entries.push({ key: "\u2191\u2193", verb: "select" });
21633
+ entries.push({
21634
+ key: "Enter",
21635
+ verb: deps.dispatchBoard.detailExpanded() ? "hide detail" : "detail",
21636
+ critical: false
21637
+ });
21638
+ }
21639
+ if (row2 && isDispatchBoardRowSteerable(row2)) entries.push({ key: "s", verb: "steer", critical: true });
21640
+ if (row2 && isDispatchBoardRowCancellable(row2)) entries.push({ key: "x", verb: "cancel", critical: true });
21641
+ return buildResponsiveHint(entries)(innerWidth);
21033
21642
  };
21034
21643
  const openSideQuestion = (question) => {
21035
21644
  if (deps.transitions.state !== "closed") return;
@@ -22180,6 +22789,7 @@ var SETTINGS_LABELS_BY_ID = {
22180
22789
  "retry.baseDelayMs": "Base delay (ms)",
22181
22790
  "retry.maxDelayMs": "Max delay (ms)",
22182
22791
  "retry.streamStallMs": "Stream stall timeout (ms)",
22792
+ "retry.firstTokenStallMs": "First token timeout (ms)",
22183
22793
  "terminal.showTerminalProgress": "Terminal progress badges",
22184
22794
  "terminal.outputVerbosity": "Output style",
22185
22795
  "terminal.tuiMode": "TUI mode",
@@ -22270,7 +22880,14 @@ var SETTINGS_SECTION_ROWS = {
22270
22880
  "context.workingSet.protectLastTurns",
22271
22881
  "context.workingSet.minEvictableTokens"
22272
22882
  ],
22273
- retry: ["retry.enabled", "retry.maxRetries", "retry.baseDelayMs", "retry.maxDelayMs", "retry.streamStallMs"],
22883
+ retry: [
22884
+ "retry.enabled",
22885
+ "retry.maxRetries",
22886
+ "retry.baseDelayMs",
22887
+ "retry.maxDelayMs",
22888
+ "retry.streamStallMs",
22889
+ "retry.firstTokenStallMs"
22890
+ ],
22274
22891
  terminal: [
22275
22892
  "terminal.showTerminalProgress",
22276
22893
  "terminal.outputVerbosity",
@@ -22367,6 +22984,7 @@ var SETTINGS_DESCRIPTIONS_BY_ID = {
22367
22984
  "retry.baseDelayMs": "Initial retry delay in milliseconds.",
22368
22985
  "retry.maxDelayMs": "Maximum retry delay in milliseconds.",
22369
22986
  "retry.streamStallMs": "Silence on an in-flight stream past this long is treated as a wedged backend.",
22987
+ "retry.firstTokenStallMs": "Silence allowed before a call's first token, for backends that load the model on demand.",
22370
22988
  "terminal.showTerminalProgress": "Emit OSC 9;4 progress badges during agent turns.",
22371
22989
  "terminal.outputVerbosity": "How much reasoning, tool input, and live tool output appears in the transcript.",
22372
22990
  "terminal.tuiMode": "Use regular terminal scrollback or a fullscreen transcript with a sticky composer and footer.",
@@ -22407,6 +23025,7 @@ var SETTINGS_HELP_BY_ID = {
22407
23025
  "guardrails.observationTurnBudgetBytes": "One pool shared by every observation-producing tool in a turn, so a single verbose tool cannot starve the rest. Whole number of bytes, at least 1 \xB7 default: 196608 (192KB).",
22408
23026
  "guardrails.internalDispatchTimeoutMs": "Covers the wiki documenter and the bootstrap scout. Continuous output satisfies the heartbeat watchdog and a run mid-generation spends no tool calls, so this is the only guard that ends a degenerate generator. Healthy runs finish in minutes. Whole milliseconds of at least 1 \xB7 default: 900000 (15 minutes).",
22409
23027
  "retry.streamStallMs": "Measured from the last token received, not from the request, so a slow-but-alive stream is never aborted. The retry then follows the same enabled/maxRetries/delay settings above. Whole milliseconds \xB7 default: 180000 (three minutes).",
23028
+ "retry.firstTokenStallMs": "Measured from the request until the first token. A local server that slept reloads the model and prefills cold first, so this window is longer than the stream stall timeout; the larger of the two applies. 0 never aborts a call that has not started streaming. Whole milliseconds \xB7 default: 600000 (ten minutes).",
22410
23029
  "library.catalog": "Absolute path, or blank for the catalog in your config directory. The catalog is the index `clio-coder library` reads; installed resources land in the usual skill and resource roots either way. Default: blank.",
22411
23030
  "library.remote": "A Git remote URL, or blank to keep the library local. Setting it is not enough to sync: the remote must also be confirmed, and library.sync must be true. Default: blank.",
22412
23031
  "library.confirmedRemote": "Written by the confirm flow, not by hand, because confirming a remote here would be the record confirming itself. Sync refuses with library_remote_unconfirmed until this equals library.remote. Default: blank.",
@@ -23472,6 +24091,9 @@ function buildSettingItems(settings, options) {
23472
24091
  settingItem("retry.streamStallMs", String(retry.streamStallMs), {
23473
24092
  values: ["60000", "120000", "180000", "300000", "600000"]
23474
24093
  }),
24094
+ settingItem("retry.firstTokenStallMs", String(retry.firstTokenStallMs), {
24095
+ values: ["180000", "300000", "600000", "900000", "1800000"]
24096
+ }),
23475
24097
  settingItem("terminal.showTerminalProgress", String(terminal.terminalProgress), {
23476
24098
  values: ["false", "true"]
23477
24099
  }),
@@ -24222,6 +24844,11 @@ function applySettingChange(settings, id, value) {
24222
24844
  settings.chat.retry.streamStallMs = next;
24223
24845
  });
24224
24846
  return;
24847
+ case "retry.firstTokenStallMs":
24848
+ applyNonNegativeInteger(value, (next) => {
24849
+ settings.chat.retry.firstTokenStallMs = next;
24850
+ });
24851
+ return;
24225
24852
  case "library.catalog":
24226
24853
  case "library.remote": {
24227
24854
  const key = id.slice("library.".length);
@@ -26865,13 +27492,16 @@ function libraryStatusLine(view, counts, width) {
26865
27492
  const theme6 = clioTheme();
26866
27493
  const mode = view.mode === "browse" ? "Browse" : "Installed";
26867
27494
  const scope = view.scope === "user" ? "User" : "Project";
26868
- const core = `${mode} \xB7 ${scope}`;
26869
- if (width < 34) return theme6.fg("accent", `${mode}\xB7${scope}`);
26870
- const parts = [theme6.fg("accent", core)];
26871
- if (view.member) parts.push(theme6.fg("dim", `members of ${view.member.ref}`));
26872
- if (width >= 56) parts.push(theme6.fg("dim", `${counts.rows} row${counts.rows === 1 ? "" : "s"}`));
26873
- if (counts.notices > 0) parts.push(theme6.fg("warning", `${counts.notices} notice${counts.notices === 1 ? "" : "s"}`));
27495
+ const unit = view.member ? "member" : view.mode === "browse" ? "package" : "entry";
27496
+ const plural = unit === "entry" ? "entries" : `${unit}s`;
27497
+ const total = `${counts.rows} ${counts.rows === 1 ? unit : plural}`;
27498
+ if (width < 34) return theme6.fg("accent", `${mode}\xB7Actions:${scope}`);
27499
+ const parts = width < 72 ? [theme6.fg("accent", width >= 48 ? `${mode} ${total}` : total), theme6.fg("dim", `s:${scope}`)] : [theme6.fg("accent", `${mode} \xB7 Actions: ${scope}`), theme6.fg("dim", total)];
27500
+ if (counts.notices > 0)
27501
+ parts.push(theme6.fg("warning", `n:${counts.notices} ${counts.notices === 1 ? "notice" : "notices"}`));
27502
+ else if (width < 72) parts.push(theme6.fg("dim", "n notices"));
26874
27503
  if (counts.truncated) parts.push(theme6.fg("warning", "incomplete results"));
27504
+ if (view.member && width >= 72) parts.push(theme6.fg("dim", `members of ${sanitizeCallTargetText(view.member.ref)}`));
26875
27505
  return parts.join(theme6.fg("frame", " \u2502 "));
26876
27506
  }
26877
27507
  function libraryUseInvocation(kind, name) {
@@ -26905,7 +27535,7 @@ function libraryRowActions(subject, view) {
26905
27535
  enable: !!here,
26906
27536
  update: !!here,
26907
27537
  use: false,
26908
- open: true,
27538
+ open: subject.record.copies.length > 0,
26909
27539
  reasons: reasons2
26910
27540
  };
26911
27541
  }
@@ -26971,7 +27601,7 @@ function libraryRowActions(subject, view) {
26971
27601
  enable: !!owner && selected,
26972
27602
  update: !!owner && selected,
26973
27603
  use: usable,
26974
- open: !!owner,
27604
+ open: false,
26975
27605
  reasons
26976
27606
  };
26977
27607
  }
@@ -26980,20 +27610,32 @@ function copyStateWord(copy) {
26980
27610
  if (copy.state === "loadable") return theme6.fg("success", "loadable");
26981
27611
  if (copy.state === "disabled") return theme6.fg("warning", "disabled");
26982
27612
  if (copy.state === "shadowed") return theme6.fg("dim", "shadowed");
26983
- return theme6.fg("error", copy.state);
27613
+ return theme6.fg("error", sanitizeCallTargetText(copy.state));
26984
27614
  }
26985
27615
  function availabilityWord(resource) {
26986
27616
  const theme6 = clioTheme();
26987
27617
  if (resource.availability === "available") return theme6.fg("success", "available");
26988
27618
  if (resource.availability === "untrusted") return theme6.fg("warning", "untrusted");
26989
27619
  if (resource.availability === "shadowed") return theme6.fg("dim", "shadowed");
26990
- return theme6.fg("error", resource.availability);
27620
+ return theme6.fg("error", sanitizeCallTargetText(resource.availability));
26991
27621
  }
26992
27622
  function metaOf(parts) {
26993
- return parts.filter((part) => !!part && part.length > 0).join(" \xB7 ");
27623
+ return parts.map((part) => typeof part === "function" ? part() : part === void 0 ? "" : sanitizeCallTargetText(part)).filter(Boolean).join(" \xB7 ");
26994
27624
  }
26995
27625
  function packageDetail(record2, view, actions) {
26996
- const lines = [`# ${record2.name}`, `**Kind:** ${record2.kind}`, `**Origin:** ${libraryOriginLabel(record2.origin)}`];
27626
+ const provider = record2.kind !== view.category;
27627
+ const hints = (record2.provides ?? []).filter((hint) => view.category === "plugin" || hint.kind === view.category);
27628
+ const lines = [
27629
+ `# ${record2.name}`,
27630
+ `**Kind:** ${record2.kind}${provider ? ` provider package for ${view.category} recipes` : " package"}`,
27631
+ `**Actions (${view.scope}):** ${libraryActionSummary(actions)}`,
27632
+ "b shows loaded recipes in Installed. Tab toggles detail; PgUp/PgDn scroll.",
27633
+ ...provider ? ["Catalog hints describe potential recipes, not loaded resources."] : [],
27634
+ ...hints.length ? [
27635
+ `**Catalog hints (${view.category === "plugin" ? "all kinds" : view.category}):** ${hints.map((hint) => `${hint.kind}:${hint.name}`).join(", ")}`
27636
+ ] : [],
27637
+ `**Origin:** ${libraryOriginLabel(record2.origin)}`
27638
+ ];
26997
27639
  const detail = libraryOriginDetail(record2.origin);
26998
27640
  if (detail) lines.push(`**Source:** \`${detail}\``);
26999
27641
  lines.push(`**Format:** ${libraryFormatLabel(record2.format)}`);
@@ -27004,8 +27646,8 @@ function packageDetail(record2, view, actions) {
27004
27646
  );
27005
27647
  lines.push(`**Selected scope:** ${view.scope}`);
27006
27648
  if (record2.requires?.length) lines.push(`**Requires:** ${record2.requires.join(", ")}`);
27007
- if (record2.provides?.length)
27008
- lines.push(`**Catalog hints:** ${record2.provides.map((hint) => `${hint.kind}:${hint.name}`).join(", ")}`);
27649
+ if (view.category !== "plugin" && (record2.provides?.length ?? 0) > hints.length)
27650
+ lines.push("Other recipe kinds are listed in the Plugins category.");
27009
27651
  if (record2.provides === void 0 && record2.copies.length === 0)
27010
27652
  lines.push("**Contents:** unknown until this package is inspected or installed.");
27011
27653
  for (const reason of actions.reasons) lines.push(`**Note:** ${reason}`);
@@ -27078,9 +27720,37 @@ function memberDetail(subject, actions) {
27078
27720
  if (subject.member.description) lines.push("", "---", "", subject.member.description);
27079
27721
  return lines;
27080
27722
  }
27081
- function push(set, id, subject, item) {
27723
+ function libraryActionSummary(actions) {
27724
+ return [
27725
+ actions.use ? "v use" : void 0,
27726
+ actions.open ? "Enter members" : "Enter detail",
27727
+ actions.install ? "i review install" : void 0,
27728
+ actions.enable ? "e review enable/disable" : void 0,
27729
+ actions.update ? "u review update" : void 0,
27730
+ actions.remove ? "r review remove" : void 0
27731
+ ].filter(Boolean).join(" \xB7 ");
27732
+ }
27733
+ function push(set, view, id, subject, item) {
27082
27734
  set.subjects.set(id, subject);
27083
- set.items.push({ id, ...item });
27735
+ const detail = item.detail;
27736
+ set.items.push({
27737
+ id,
27738
+ ...item,
27739
+ label: subject.kind === "notice" ? clioTheme().fg("warning", sanitizeCallTargetText(item.label)) : sanitizeCallTargetText(item.label),
27740
+ ...detail ? {
27741
+ detail: (width) => {
27742
+ const lines = detail(width).map((line) => sanitizeMultilineDisplayText(line).text);
27743
+ if (subject.kind !== "package" && subject.kind !== "notice")
27744
+ lines.splice(
27745
+ 1,
27746
+ 0,
27747
+ `**Actions:** ${libraryActionSummary(libraryRowActions(subject, view))}`,
27748
+ "Tab toggles detail. PgUp/PgDn scroll."
27749
+ );
27750
+ return lines;
27751
+ }
27752
+ } : {}
27753
+ });
27084
27754
  }
27085
27755
  function libraryTruncationNotice(inventory) {
27086
27756
  const capped = [
@@ -27126,11 +27796,11 @@ function buildLibraryRows(options) {
27126
27796
  for (const member of options.inspection.resources) {
27127
27797
  const subject = { kind: "member", owner, member };
27128
27798
  const actions = libraryRowActions(subject, view);
27129
- push(set, `mem:${owner.ref}@${owner.scope}#${member.kind}:${member.name}`, subject, {
27799
+ push(set, view, `mem:${owner.ref}@${owner.scope}#${member.kind}:${member.name}`, subject, {
27130
27800
  label: member.name,
27131
27801
  meta: metaOf([
27132
27802
  member.kind,
27133
- member.valid ? theme6.fg("success", "valid") : theme6.fg("error", "invalid"),
27803
+ () => member.valid ? theme6.fg("success", "valid") : theme6.fg("error", "invalid"),
27134
27804
  member.componentId ? `component ${member.componentId}` : void 0
27135
27805
  ]),
27136
27806
  group: LIBRARY_GROUP_MEMBERS,
@@ -27142,7 +27812,7 @@ function buildLibraryRows(options) {
27142
27812
  kind: "notice",
27143
27813
  message: `${item.kind} ${item.id} is declared package metadata, not a recipe. It runs only on an explicit request.`
27144
27814
  };
27145
- push(set, `note:ancillary:${item.kind}:${item.id}`, subject, {
27815
+ push(set, view, `note:ancillary:${item.kind}:${item.id}`, subject, {
27146
27816
  label: `${item.kind}: ${item.id}`,
27147
27817
  meta: theme6.fg("dim", "companion file"),
27148
27818
  group: LIBRARY_GROUP_NOTICES,
@@ -27152,7 +27822,7 @@ function buildLibraryRows(options) {
27152
27822
  }
27153
27823
  for (const diagnostic of options.inspection.diagnostics) {
27154
27824
  const subject = { kind: "notice", message: diagnostic };
27155
- push(set, `note:member-diag:${set.notices}`, subject, {
27825
+ push(set, view, `note:member-diag:${set.notices}`, subject, {
27156
27826
  label: `${theme6.fg("warning", GLYPH.warnInline)} ${diagnostic}`,
27157
27827
  meta: theme6.fg("dim", "inspection"),
27158
27828
  group: LIBRARY_GROUP_NOTICES,
@@ -27166,15 +27836,15 @@ function buildLibraryRows(options) {
27166
27836
  const actions = libraryRowActions(subject, view);
27167
27837
  const here = record2.copies.find((copy) => copy.scope === view.scope);
27168
27838
  const hints = (record2.provides ?? []).filter((hint) => view.category === "plugin" || hint.kind === view.category);
27169
- push(set, `pkg:${record2.ref}`, subject, {
27170
- label: record2.name,
27839
+ push(set, view, `pkg:${record2.ref}`, subject, {
27840
+ label: record2.kind !== view.category ? `${record2.name} [${record2.kind}]` : record2.name,
27171
27841
  meta: metaOf([
27842
+ here ? `${here.scope} ${here.state}` : `not installed (${view.scope})`,
27843
+ hints.length > 0 ? `${hints.length} ${view.category === "plugin" ? "recipe" : view.category} hints` : void 0,
27172
27844
  libraryOriginLabel(record2.origin),
27173
- record2.version ? `v${record2.version}` : void 0,
27174
- here ? theme6.fg("success", `${here.scope} ${here.state}`) : theme6.fg("dim", "not in this scope"),
27175
- hints.length > 0 ? `${hints.length} hinted` : void 0
27845
+ record2.version ? `v${record2.version}` : void 0
27176
27846
  ]),
27177
- group: record2.copies.length > 0 ? LIBRARY_GROUP_INSTALLED : LIBRARY_GROUP_AVAILABLE,
27847
+ group: record2.kind !== view.category ? "Provider packages" : record2.copies.length > 0 ? LIBRARY_GROUP_INSTALLED : LIBRARY_GROUP_AVAILABLE,
27178
27848
  detail: () => packageDetail(record2, view, actions)
27179
27849
  });
27180
27850
  }
@@ -27182,13 +27852,13 @@ function buildLibraryRows(options) {
27182
27852
  for (const copy of inventory.copies) {
27183
27853
  const subject = { kind: "copy", copy };
27184
27854
  const actions = libraryRowActions(subject, view);
27185
- push(set, `copy:${copy.ref}@${copy.scope}`, subject, {
27855
+ push(set, view, `copy:${copy.ref}@${copy.scope}`, subject, {
27186
27856
  label: copy.name,
27187
27857
  meta: metaOf([
27188
- libraryOriginLabel(copy.origin),
27189
27858
  copy.scope,
27190
- copyStateWord(copy),
27191
- copy.trust === "foreign" ? theme6.fg("warning", "foreign") : void 0
27859
+ () => copyStateWord(copy),
27860
+ libraryOriginLabel(copy.origin),
27861
+ copy.trust === "foreign" ? () => theme6.fg("warning", "foreign") : void 0
27192
27862
  ]),
27193
27863
  group: LIBRARY_GROUP_INSTALLED,
27194
27864
  detail: () => copyDetail(copy, view, actions)
@@ -27197,12 +27867,12 @@ function buildLibraryRows(options) {
27197
27867
  for (const resource of inventory.resources) {
27198
27868
  const subject = { kind: "recipe", resource };
27199
27869
  const actions = libraryRowActions(subject, view);
27200
- push(set, `res:${resource.key}`, subject, {
27870
+ push(set, view, `res:${resource.key}`, subject, {
27201
27871
  label: resource.name,
27202
27872
  meta: metaOf([
27203
- libraryOriginLabel(resource.origin),
27873
+ () => availabilityWord(resource),
27204
27874
  resource.owner ? resource.owner.ref : resource.source.class,
27205
- availabilityWord(resource)
27875
+ libraryOriginLabel(resource.origin)
27206
27876
  ]),
27207
27877
  group: resource.owner ? LIBRARY_GROUP_INSTALLED : LIBRARY_GROUP_UNMANAGED,
27208
27878
  detail: () => resourceDetail(resource, actions)
@@ -27215,11 +27885,18 @@ function buildLibraryRows(options) {
27215
27885
  (entry) => entry !== void 0
27216
27886
  )) {
27217
27887
  const subject = { kind: "notice", message };
27218
- push(set, `note:${set.notices}`, subject, {
27888
+ push(set, view, `note:${set.notices}`, subject, {
27219
27889
  label: `${theme6.fg("warning", GLYPH.warnInline)} ${message}`,
27220
27890
  meta: theme6.fg("dim", "library"),
27221
27891
  group: LIBRARY_GROUP_NOTICES,
27222
- detail: () => ["# Library notice", "", message]
27892
+ detail: () => [
27893
+ "# Library notice",
27894
+ "",
27895
+ "Discovery notices cover all categories.",
27896
+ "From browse focus, n returns to resources. Esc clears a filter or leaves search focus before returning to the parent browser.",
27897
+ "",
27898
+ message
27899
+ ]
27223
27900
  });
27224
27901
  set.notices += 1;
27225
27902
  }
@@ -27636,8 +28313,8 @@ function isLibraryTab(value) {
27636
28313
 
27637
28314
  // src/interactive/overlays/library.ts
27638
28315
  var LIBRARY_TITLE = "Library";
27639
- var LIBRARY_EMPTY_BROWSE = "No packages of this kind in the index. Register one with clio-coder library register <path>, or press o to import from another local agent.";
27640
- var LIBRARY_EMPTY_INSTALLED = "Nothing of this kind is installed or loaded here. Press b for Browse to see what can be installed.";
28316
+ var LIBRARY_EMPTY_BROWSE = "No packages of this kind in the index. Browse counts packages, not runnable recipes. Press b for loaded recipes in Installed. Register one with clio-coder library register <path>, or press o to import from another local agent.";
28317
+ var LIBRARY_EMPTY_INSTALLED = "No entries of this kind are listed by the Library inventory. Action scope selects a package destination, not which recipes can run. Press b for installable packages.";
27641
28318
  function requestRefFor(subject) {
27642
28319
  if (subject.kind === "package" || subject.kind === "hint") return { ref: subject.record.ref };
27643
28320
  if (subject.kind === "copy") return { ref: subject.copy.ref };
@@ -27717,12 +28394,16 @@ function openLibraryOverlay(tui, deps) {
27717
28394
  ...failure2 ? { failure: failure2 } : {}
27718
28395
  });
27719
28396
  if (category === view.category) rowSet = set;
27720
- return set.items;
28397
+ return set.items.filter((item) => set.subjects.get(item.id)?.kind !== "notice");
27721
28398
  };
27722
28399
  const tabs = LIBRARY_TABS.map((tab) => ({
27723
28400
  id: tab.id,
27724
28401
  label: tab.label,
27725
- items: () => rowsFor(tab.id)
28402
+ items: () => rowsFor(tab.id),
28403
+ countLabel: (count2) => {
28404
+ const unit = view.member && tab.id === view.category ? "member" : view.mode === "browse" ? "package" : "entry";
28405
+ return `${count2} ${count2 === 1 ? unit : unit === "entry" ? "entries" : `${unit}s`}`;
28406
+ }
27726
28407
  }));
27727
28408
  let handle;
27728
28409
  const selected = (item) => item ? rowSet.subjects.get(item.id) : void 0;
@@ -27908,14 +28589,49 @@ function openLibraryOverlay(tui, deps) {
27908
28589
  inspectionCache = null;
27909
28590
  handle.refreshTabs();
27910
28591
  };
27911
- const status = (width) => libraryStatusLine(view, { rows: rowSet.items.length, notices: rowSet.notices, truncated: rowSet.truncated }, width);
28592
+ const openNotices = () => {
28593
+ if (busy) return;
28594
+ busy = true;
28595
+ const items = rowSet.items.filter((item) => rowSet.subjects.get(item.id)?.kind === "notice");
28596
+ const close = () => {
28597
+ child = null;
28598
+ busy = false;
28599
+ notices.hide();
28600
+ if (closed) return;
28601
+ handle.setHidden(false);
28602
+ handle.focus();
28603
+ };
28604
+ handle.setHidden(true);
28605
+ const notices = (deps.openList ?? openListOverlay)(tui, {
28606
+ markerId: "library",
28607
+ title: "Library notices",
28608
+ items,
28609
+ filterable: true,
28610
+ explicitSearch: true,
28611
+ fullScreen: true,
28612
+ layout: "split",
28613
+ status: () => `${items.length} ${items.length === 1 ? "notice" : "notices"} \xB7 browse focus: n back`,
28614
+ emptyMessage: "No notices in this view. From browse focus, n returns to resources. Esc clears a filter or leaves search focus before returning to the parent browser.",
28615
+ globalHints: [{ key: "n", verb: "resources", critical: true }],
28616
+ globalActions: { n: close },
28617
+ onClose: close
28618
+ });
28619
+ child = { hide: () => notices.hide(), release: () => {
28620
+ } };
28621
+ notices.toggleDetail();
28622
+ };
28623
+ const status = (width) => libraryStatusLine(
28624
+ view,
28625
+ { rows: rowSet.items.length - rowSet.notices, notices: rowSet.notices, truncated: rowSet.truncated },
28626
+ width
28627
+ );
27912
28628
  const hints = (selected2) => {
27913
28629
  const subject = selected2 ? rowSet.subjects.get(selected2.id) : void 0;
27914
28630
  if (!subject || subject.kind === "notice") return [];
27915
28631
  const actions = libraryRowActions(subject, view);
27916
28632
  const entries = [];
27917
28633
  if (actions.use) entries.push({ key: "v", verb: "use" });
27918
- if (actions.open) entries.push({ key: "Enter", verb: "members" });
28634
+ entries.push({ key: "Enter", verb: actions.open ? "members" : "detail" });
27919
28635
  if (actions.install) entries.push({ key: "i", verb: "install" });
27920
28636
  if (actions.enable)
27921
28637
  entries.push({
@@ -27959,10 +28675,12 @@ function openLibraryOverlay(tui, deps) {
27959
28675
  globalHints: [
27960
28676
  { key: "b", verb: "browse/installed", short: "view", critical: true },
27961
28677
  { key: "s", verb: "user/project", short: "scope", critical: true },
28678
+ { key: "n", verb: "notices", critical: true },
27962
28679
  { key: "o", verb: "import" },
27963
28680
  { key: "R", verb: "refresh" }
27964
28681
  ],
27965
28682
  globalActions: {
28683
+ n: openNotices,
27966
28684
  b: () => {
27967
28685
  view.mode = view.mode === "browse" ? "installed" : "browse";
27968
28686
  view.member = void 0;
@@ -28001,6 +28719,7 @@ function openLibraryOverlay(tui, deps) {
28001
28719
  },
28002
28720
  onClose: deps.onClose
28003
28721
  });
28722
+ handle.toggleDetail();
28004
28723
  const start = () => {
28005
28724
  if (closed) return;
28006
28725
  if (deps.importSource) {
@@ -28547,26 +29266,27 @@ var VISIBLE_ROWS3 = 12;
28547
29266
  var SESSION_ESCAPE_GRACE_MS = 75;
28548
29267
  var ESC2 = String.fromCharCode(27);
28549
29268
  var SESSION_LAYOUT = {
28550
- minPrimaryColumnWidth: 52,
28551
- maxPrimaryColumnWidth: 60
29269
+ minPrimaryColumnWidth: 32,
29270
+ maxPrimaryColumnWidth: 52
28552
29271
  };
28553
29272
  function formatRelativeTime2(iso, now = Date.now()) {
28554
29273
  return iso ? relative3(iso, now) : "\u2014";
28555
29274
  }
28556
29275
  function shortTarget(meta) {
28557
- const target = meta.target?.trim();
28558
- const model = meta.model?.trim();
29276
+ const target = sanitizeCallTargetText(meta.target ?? "");
29277
+ const model = sanitizeCallTargetText(meta.model ?? "");
28559
29278
  if (!target && !model) return "no target";
28560
29279
  if (target && model) return `${target}/${model}`;
28561
- return target ?? model ?? "no target";
29280
+ return target || model || "no target";
28562
29281
  }
28563
29282
  function previewLine(meta) {
28564
- const explicit = meta.firstMessagePreview?.trim();
29283
+ const explicit = sanitizeCallTargetText(meta.firstMessagePreview ?? "");
28565
29284
  if (explicit) return explicit;
28566
- const name = meta.name?.trim();
29285
+ const name = sanitizeCallTargetText(meta.name ?? "");
28567
29286
  if (name) return `(${name})`;
28568
- const cwdLeaf = meta.cwd ? basename2(meta.cwd) : "";
28569
- return cwdLeaf ? `(no preview \xB7 ${cwdLeaf})` : "(no preview)";
29287
+ const cwdLeaf = sanitizeCallTargetText(meta.cwd ? basename2(meta.cwd) : "");
29288
+ const id = sanitizeCallTargetText(meta.id) || "Unnamed session";
29289
+ return `${id} \xB7 ${cwdLeaf || "no preview"}`;
28570
29290
  }
28571
29291
  function metaStrip(meta, now) {
28572
29292
  const status = meta.endedAt ? GLYPH.ok : GLYPH.running;
@@ -28577,11 +29297,12 @@ function metaStrip(meta, now) {
28577
29297
  }
28578
29298
  function buildSessionItems(sessions, now = Date.now()) {
28579
29299
  return sessions.map((meta) => {
28580
- const labels = meta.labels && meta.labels.length > 0 ? ` labels: ${meta.labels.join(", ")}` : "";
29300
+ const labels = meta.labels?.map(sanitizeCallTargetText).filter(Boolean).join(", ");
29301
+ const details = [metaStrip(meta, now), labels ? `labels: ${labels}` : ""].filter(Boolean);
28581
29302
  return {
28582
29303
  value: meta.id,
28583
- label: metaStrip(meta, now),
28584
- description: `${previewLine(meta)}${labels}`
29304
+ label: previewLine(meta),
29305
+ description: details.join(" \xB7 ")
28585
29306
  };
28586
29307
  });
28587
29308
  }
@@ -28608,6 +29329,7 @@ function createSessionOverlayBox(sessions, onSelect, onClose, options = {}) {
28608
29329
  const allSessions = [...sessions];
28609
29330
  let filtered = [...sessions];
28610
29331
  let lastQuery = "";
29332
+ let selectedSessionId;
28611
29333
  let list = buildList(filtered);
28612
29334
  let pendingEscape = "";
28613
29335
  let pendingEscapeTimer = null;
@@ -28650,14 +29372,18 @@ function createSessionOverlayBox(sessions, onSelect, onClose, options = {}) {
28650
29372
  box.invalidate();
28651
29373
  }
28652
29374
  function applyFilter() {
29375
+ selectedSessionId = list.getSelectedItem()?.value ?? selectedSessionId;
28653
29376
  filtered = filterSessions(allSessions, lastQuery);
28654
29377
  list = buildList(filtered);
29378
+ const selectedIndex = filtered.findIndex((session) => session.id === selectedSessionId);
29379
+ if (selectedIndex >= 0) list.setSelectedIndex(selectedIndex);
29380
+ selectedSessionId = list.getSelectedItem()?.value ?? selectedSessionId;
28655
29381
  rebuildChildren();
28656
29382
  }
28657
29383
  function commitSelection() {
28658
- const first = filtered[0];
28659
- if (!first) return;
28660
- onSelect(first.id);
29384
+ const selected = list.getSelectedItem();
29385
+ if (!selected) return;
29386
+ onSelect(selected.value);
28661
29387
  closeOverlay();
28662
29388
  }
28663
29389
  function moveSelectionByPage(direction) {
@@ -28761,6 +29487,7 @@ function openSessionOverlay(tui, deps) {
28761
29487
 
28762
29488
  // src/interactive/overlays/tree-selector.ts
28763
29489
  init_esm_shims();
29490
+ import { resolve as resolve5 } from "node:path";
28764
29491
  var TREE_OVERLAY_WIDTH = 88;
28765
29492
  var VISIBLE_ROWS4 = 16;
28766
29493
  function shortTurnId2(id) {
@@ -28860,7 +29587,8 @@ var TreeOverlayView = class {
28860
29587
  constructor(deps, initial) {
28861
29588
  this.deps = deps;
28862
29589
  this.snapshot = initial;
28863
- this.rows = initial ? flattenTreeSnapshot(initial) : [];
29590
+ this.rows = [];
29591
+ this.rebuildRows();
28864
29592
  }
28865
29593
  deps;
28866
29594
  snapshot;
@@ -28868,6 +29596,8 @@ var TreeOverlayView = class {
28868
29596
  highlight = 0;
28869
29597
  scrollTop = 0;
28870
29598
  showTimestamps = false;
29599
+ currentCwdOnly = false;
29600
+ sortOrder = "tree";
28871
29601
  submode = "browse";
28872
29602
  labelBuffer = "";
28873
29603
  labelInput = new Input();
@@ -28895,15 +29625,26 @@ var TreeOverlayView = class {
28895
29625
  currentRow() {
28896
29626
  return this.rows[this.highlight] ?? null;
28897
29627
  }
29628
+ rebuildRows() {
29629
+ const selectedId = this.currentRow()?.node.id;
29630
+ const snapshot = this.snapshot;
29631
+ const matchesCwd = snapshot?.meta.cwd && resolve5(snapshot.meta.cwd) === resolve5(this.deps.cwd ?? process.cwd());
29632
+ this.rows = snapshot && (!this.currentCwdOnly || matchesCwd) ? flattenTreeSnapshot(snapshot) : [];
29633
+ if (this.sortOrder === "recent") {
29634
+ this.rows.sort((a, b) => Date.parse(b.node.at) - Date.parse(a.node.at));
29635
+ this.rows = this.rows.map((row2) => ({ ...row2, depth: 0 }));
29636
+ }
29637
+ const selectedIndex = this.rows.findIndex((row2) => row2.node.id === selectedId);
29638
+ this.highlight = selectedIndex < 0 ? 0 : selectedIndex;
29639
+ this.invalidateLayout();
29640
+ }
28898
29641
  refresh() {
28899
29642
  try {
28900
29643
  this.snapshot = this.deps.session.tree();
28901
- this.rows = flattenTreeSnapshot(this.snapshot);
28902
29644
  } catch {
28903
29645
  this.snapshot = null;
28904
- this.rows = [];
28905
29646
  }
28906
- this.invalidateLayout();
29647
+ this.rebuildRows();
28907
29648
  }
28908
29649
  render(width) {
28909
29650
  const contentWidth = Math.max(1, width);
@@ -28912,7 +29653,12 @@ var TreeOverlayView = class {
28912
29653
  const lineage = this.snapshot ? forkParentLine(this.snapshot, theme6) : null;
28913
29654
  if (lineage !== null) lines.push(truncateToWidth(lineage, contentWidth, "", true));
28914
29655
  if (this.rows.length === 0) {
28915
- lines.push(theme6.fg("muted", "(no turns in this session yet)"));
29656
+ lines.push(
29657
+ theme6.fg(
29658
+ "muted",
29659
+ this.currentCwdOnly && this.snapshot && Object.keys(this.snapshot.nodesById).length > 0 ? "(no turns match the current cwd; press p to show all)" : "(no turns in this session yet)"
29660
+ )
29661
+ );
28916
29662
  } else {
28917
29663
  const end = Math.min(this.rows.length, this.scrollTop + VISIBLE_ROWS4);
28918
29664
  for (let i = this.scrollTop; i < end; i++) {
@@ -28949,6 +29695,8 @@ var TreeOverlayView = class {
28949
29695
  { key: "\u2191\u2193", verb: "move" },
28950
29696
  { key: "Enter", verb: "switch" },
28951
29697
  { key: "e", verb: "label" },
29698
+ { key: "p", verb: `cwd:${this.currentCwdOnly ? "current" : "all"}` },
29699
+ { key: "s", verb: this.sortOrder },
28952
29700
  { key: "Shift+T", verb: `ts:${tsLabel}` }
28953
29701
  ]);
28954
29702
  }
@@ -28970,6 +29718,16 @@ var TreeOverlayView = class {
28970
29718
  this.deps.onClose();
28971
29719
  return;
28972
29720
  }
29721
+ if (data === "p") {
29722
+ this.currentCwdOnly = !this.currentCwdOnly;
29723
+ this.rebuildRows();
29724
+ return;
29725
+ }
29726
+ if (data === "s") {
29727
+ this.sortOrder = this.sortOrder === "tree" ? "recent" : "tree";
29728
+ this.rebuildRows();
29729
+ return;
29730
+ }
28973
29731
  if (this.rows.length === 0) return;
28974
29732
  if (matchesKey(data, "up")) {
28975
29733
  this.moveHighlight(-1);
@@ -29223,6 +29981,7 @@ function reseedSessionUsageFromLedger(sink, entries, defaults = {}, activeLeafTu
29223
29981
  output: call.output,
29224
29982
  cacheRead: call.cacheRead,
29225
29983
  cacheWrite: call.cacheWrite,
29984
+ ...call.cacheWrite1h === void 0 ? {} : { cacheWrite1h: call.cacheWrite1h },
29226
29985
  reasoningTokens: call.reasoningTokens,
29227
29986
  totalTokens: call.totalTokens,
29228
29987
  apiCalls: call.apiCalls ?? 1
@@ -29555,9 +30314,9 @@ function createOverlaySessionLifecycle(deps) {
29555
30314
  openHandoffReview(session, fromSessionId, goal, document);
29556
30315
  }
29557
30316
  function editHandoffDocument(current) {
29558
- const resolve10 = deps.resolveEditor ?? resolveExternalEditor;
30317
+ const resolve11 = deps.resolveEditor ?? resolveExternalEditor;
29559
30318
  const edit = deps.editExternally ?? editTextExternally;
29560
- const command = resolve10();
30319
+ const command = resolve11();
29561
30320
  if (!command) {
29562
30321
  deps.notify("warning", "handoff: no external editor configured; set VISUAL or EDITOR", "handoff:no-editor");
29563
30322
  return null;
@@ -30260,8 +31019,8 @@ function resolveApplicationCtrlCAction(state) {
30260
31019
  function createApplicationController(deps) {
30261
31020
  let resolveRun = () => {
30262
31021
  };
30263
- const run = new Promise((resolve10) => {
30264
- resolveRun = resolve10;
31022
+ const run = new Promise((resolve11) => {
31023
+ resolveRun = resolve11;
30265
31024
  });
30266
31025
  const keepAlive = deps.intervals.setInterval(() => {
30267
31026
  }, 1 << 30);
@@ -30719,10 +31478,15 @@ function createEditorSubmitController(deps) {
30719
31478
  let running = [];
30720
31479
  try {
30721
31480
  running = deps.dispatch.snapshot().running.map((run) => ({ runId: run.runId, agentId: run.agentId }));
30722
- } catch {
30723
- running = [];
31481
+ } catch (err) {
31482
+ const msg = err instanceof Error ? err.message : String(err);
31483
+ deps.notify(
31484
+ "error",
31485
+ `cannot resolve steer to @${mention.target}: ${msg}; retry when Fleet Runs is available`,
31486
+ `steer:${mention.target}`
31487
+ );
31488
+ return "rejected";
30724
31489
  }
30725
- if (running.length === 0) return "unhandled";
30726
31490
  const resolution = resolveSteerTarget(mention.target, running);
30727
31491
  if (resolution.kind === "match") {
30728
31492
  try {
@@ -30749,12 +31513,15 @@ function createEditorSubmitController(deps) {
30749
31513
  }
30750
31514
  deps.notify(
30751
31515
  "warning",
30752
- `no running dispatch matches @${mention.target}; running: ${formatSteerCandidates(running)}`,
31516
+ `no running dispatch matches @${mention.target}; running: ${formatSteerCandidates(running) || "none"}; choose an active target in Fleet Runs or remove the @target to send to the main agent`,
30753
31517
  `steer:${mention.target}`
30754
31518
  );
30755
31519
  return "rejected";
30756
31520
  };
30757
- const handleEditorSteerMention = (mention) => submitEditorSteerMention(mention) !== "unhandled";
31521
+ const handleEditorSteerMention = (mention) => {
31522
+ submitEditorSteerMention(mention);
31523
+ return true;
31524
+ };
30758
31525
  const submitEditorText = (text) => {
30759
31526
  const literalText = unguardPastedEditorOperator(text);
30760
31527
  const trimmed = literalText.trim();
@@ -30773,16 +31540,14 @@ function createEditorSubmitController(deps) {
30773
31540
  const steerMention = parseEditorSteerMention(trimmed);
30774
31541
  if (steerMention) {
30775
31542
  const submission = submitEditorSteerMention(steerMention);
30776
- if (submission !== "unhandled") {
30777
- if (submission === "accepted") {
30778
- deps.editor.addToHistory(literalText);
30779
- deps.editor.setText("");
30780
- } else {
30781
- deps.editor.setText(literalText);
30782
- }
30783
- deps.ui.requestRender();
30784
- return;
31543
+ if (submission === "accepted") {
31544
+ deps.editor.addToHistory(literalText);
31545
+ deps.editor.setText("");
31546
+ } else {
31547
+ deps.editor.setText(literalText);
30785
31548
  }
31549
+ deps.ui.requestRender();
31550
+ return;
30786
31551
  }
30787
31552
  const command = parseSlashCommand(trimmed);
30788
31553
  if (command.kind === "editor" || command.kind === "interrupt") {
@@ -30843,14 +31608,12 @@ function createEditorSubmitController(deps) {
30843
31608
  const steerMention = parseEditorSteerMention(trimmed);
30844
31609
  if (steerMention) {
30845
31610
  const submission = submitEditorSteerMention(steerMention);
30846
- if (submission !== "unhandled") {
30847
- if (submission === "rejected") {
30848
- throw new Error("queued boot steer was not admitted; preserving it for recovery");
30849
- }
30850
- deps.editor.addToHistory(literalText);
30851
- deps.ui.requestRender();
30852
- return;
31611
+ if (submission === "rejected") {
31612
+ throw new Error("queued boot steer was not admitted; preserving it for recovery");
30853
31613
  }
31614
+ deps.editor.addToHistory(literalText);
31615
+ deps.ui.requestRender();
31616
+ return;
30854
31617
  }
30855
31618
  const command = parseSlashCommand(trimmed);
30856
31619
  if (isRejectedCommand(command)) {
@@ -32435,7 +33198,7 @@ function outcomeUnit(receipt, word) {
32435
33198
  var CHECKPOINT_PREFIX = /^\s*(?:needs_input\b|task_blocked\b|##\s*CHECKPOINT REACHED\b|##\s*BLOCKED\b)/iu;
32436
33199
  var CHECKPOINT_PREVIEW_ROWS = 16;
32437
33200
  function workerNeedsInput(entry) {
32438
- return entry.receipt !== void 0 && entry.receipt.stillRunning !== true && CHECKPOINT_PREFIX.test(entry.text);
33201
+ return entry.receipt !== void 0 && entry.receipt.stillRunning !== true && CHECKPOINT_PREFIX.test(entry.text.trim().replace(/^```[A-Za-z0-9_-]*[^\S\r\n]*\r?\n/u, ""));
32439
33202
  }
32440
33203
  function needsInputUnit() {
32441
33204
  return theme5.fg("warning", `${GLYPH.phaseBlocked} needs input`);
@@ -32472,126 +33235,20 @@ function railLines(text, token, width) {
32472
33235
  const contentWidth = Math.max(1, width - RAIL_WIDTH);
32473
33236
  return wrapTextWithAnsi(text, contentWidth).map((row2) => `${dim3(RAIL)}${theme5.fg(token, row2)}`);
32474
33237
  }
32475
- function structuredAnswer(text) {
32476
- const parsed = parseJsonObjectPayload(text);
32477
- return parsed.ok ? parsed.value : null;
32478
- }
32479
- var isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
32480
- function reportString(value) {
32481
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
32482
- }
32483
- function debuggerReport(value) {
32484
- const diagnosis = reportString(value.diagnosis);
32485
- const reproduction = value.reproduction;
32486
- if (diagnosis === null || reproduction !== "reproduced" && reproduction !== "not-reproduced" && reproduction !== "unknown" || !isStringArray(value.evidence)) {
32487
- return null;
32488
- }
32489
- return {
32490
- lines: [
32491
- diagnosis,
32492
- ...value.evidence.length === 0 ? ["Evidence: none"] : ["Evidence:", ...value.evidence.map((item) => `- ${item}`)]
32493
- ],
32494
- footer: `reproduction ${reproduction}`
32495
- };
32496
- }
32497
- function verifierReport(value) {
32498
- if (value.verdict !== "pass" && value.verdict !== "fail" || !Array.isArray(value.checks)) return null;
32499
- const lines = [];
32500
- for (const raw of value.checks) {
32501
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
32502
- const check = raw;
32503
- const name = reportString(check.name);
32504
- const evidence = reportString(check.evidence);
32505
- if (name === null || evidence === null || typeof check.passed !== "boolean") return null;
32506
- lines.push(`${check.passed ? GLYPH.ok : GLYPH.error} ${name}: ${evidence}`);
32507
- }
32508
- return { lines: lines.length === 0 ? ["No checks reported."] : lines, footer: `verdict ${value.verdict}` };
32509
- }
32510
- function researchReport(value) {
32511
- if (value.source !== "local" && value.source !== "external" || !Array.isArray(value.findings)) return null;
32512
- const lines = [];
32513
- for (const raw of value.findings) {
32514
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
32515
- const finding = raw;
32516
- const claim = reportString(finding.claim);
32517
- const evidence = reportString(finding.evidence);
32518
- if (claim === null || evidence === null) return null;
32519
- lines.push(`- ${claim}`, ` citation: ${evidence}`);
32520
- }
32521
- return { lines: lines.length === 0 ? ["No findings reported."] : lines, footer: `source ${value.source}` };
32522
- }
32523
- function worldKnowledgeReport(value) {
32524
- if (value.discovery !== "performed" && value.discovery !== "caller-supplied-only" && value.discovery !== "unavailable" || !Array.isArray(value.facts) || !isStringArray(value.synthesis) || !isStringArray(value.uncertainties) || !isStringArray(value.followUpVerification)) {
32525
- return null;
32526
- }
32527
- const lines = [];
32528
- for (const raw of value.facts) {
32529
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
32530
- const fact = raw;
32531
- const claim = reportString(fact.claim);
32532
- const evidence = reportString(fact.evidence);
32533
- if (claim === null || evidence === null || !isStringArray(fact.sources)) return null;
32534
- lines.push(`- ${claim}`, ` support: ${evidence}`);
32535
- if (fact.sources.length > 0) lines.push(` sources: ${fact.sources.join(", ")}`);
32536
- }
32537
- if (value.synthesis.length > 0) lines.push("Synthesis:", ...value.synthesis.map((item) => `- ${item}`));
32538
- if (value.uncertainties.length > 0) lines.push("Uncertainties:", ...value.uncertainties.map((item) => `- ${item}`));
32539
- if (value.followUpVerification.length > 0) {
32540
- lines.push("Verify next:", ...value.followUpVerification.map((item) => `- ${item}`));
32541
- }
32542
- return { lines: lines.length === 0 ? ["No findings reported."] : lines, footer: `discovery ${value.discovery}` };
32543
- }
32544
- function scoutReport(value) {
32545
- if (!Array.isArray(value.findings) || typeof value.needsSplit !== "boolean") return null;
32546
- const lines = [];
32547
- for (const raw of value.findings) {
32548
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
32549
- const finding = raw;
32550
- const claim = reportString(finding.claim);
32551
- if (claim === null) return null;
32552
- const path2 = reportString(finding.path);
32553
- const line = typeof finding.line === "number" && Number.isSafeInteger(finding.line) ? finding.line : null;
32554
- lines.push(path2 !== null && line !== null ? `- ${claim} \u2014 ${path2}:${line}` : `- ${claim} (ungrounded lead)`);
32555
- }
32556
- if (value.needsSplit) {
32557
- if (!Array.isArray(value.proposedSubtasks)) return null;
32558
- lines.push("Split recommended:");
32559
- for (const raw of value.proposedSubtasks) {
32560
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
32561
- const subtask = raw;
32562
- const task = reportString(subtask.task);
32563
- const id = reportString(subtask.id);
32564
- if (task === null || id === null) return null;
32565
- lines.push(`- ${id}: ${task}`);
32566
- }
32567
- }
32568
- return {
32569
- lines: lines.length === 0 ? ["No findings reported."] : lines,
32570
- footer: value.needsSplit ? "split needed" : "no split needed"
32571
- };
32572
- }
32573
33238
  function presentedContractAnswer(entry) {
32574
- if (entry.receipt?.contract !== "pass" || entry.receipt.contractKind === void 0 || entry.droppedLines !== 0) {
32575
- return null;
32576
- }
32577
- const value = structuredAnswer(entry.text);
32578
- if (value === null) return null;
32579
- const kind = entry.receipt.contractKind;
32580
- switch (kind) {
32581
- case "debugger-report":
32582
- return debuggerReport(value);
32583
- case "verifier-report":
32584
- return verifierReport(value);
32585
- case "research-report":
32586
- return researchReport(value);
32587
- case "world-knowledge-report":
32588
- return worldKnowledgeReport(value);
32589
- case "scout-report":
32590
- return scoutReport(value);
32591
- }
33239
+ if (entry.receipt?.trust?.artifactIntegrity.state !== "verified") return null;
33240
+ const kind = entry.receipt?.contractKind;
33241
+ const conformance = entry.receipt?.contract;
33242
+ return presentWorkerContractAnswer(
33243
+ entry.text,
33244
+ kind && conformance ? { kind, conformance } : void 0,
33245
+ entry.droppedLines === 0 && (entry.progress?.droppedBytes ?? 0) === 0,
33246
+ !entry.pending && !isPending(entry)
33247
+ );
32592
33248
  }
33249
+ var isStringArray2 = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
32593
33250
  function mutationReportLines(value) {
32594
- if (!isStringArray(value.mutatedPaths) || !Array.isArray(value.validations)) return null;
33251
+ if (!isStringArray2(value.mutatedPaths) || !Array.isArray(value.validations)) return null;
32595
33252
  const lines = [];
32596
33253
  lines.push(value.mutatedPaths.length === 0 ? "changed nothing" : `changed ${value.mutatedPaths.join(", ")}`);
32597
33254
  for (const validation of value.validations) {
@@ -32609,16 +33266,18 @@ function mutationReportLines(value) {
32609
33266
  return lines;
32610
33267
  }
32611
33268
  function bodySourceLines(entry) {
32612
- const structured = entry.droppedLines === 0 ? structuredAnswer(entry.text) : null;
32613
- if (structured === null) return entry.text.split("\n");
33269
+ if (entry.pending || entry.receipt?.trust?.artifactIntegrity.state !== "verified" || entry.droppedLines !== 0 || (entry.progress?.droppedBytes ?? 0) !== 0)
33270
+ return safeWorkerAnswerText(entry.text).split("\n");
33271
+ const structured = entry.droppedLines === 0 ? exactWorkerAnswerObject(entry.text) : null;
33272
+ if (structured === null) return safeWorkerAnswerText(entry.text).split("\n");
32614
33273
  const presented = presentedContractAnswer(entry);
32615
33274
  if (presented !== null) return presented.lines;
32616
- return mutationReportLines(structured) ?? JSON.stringify(structured, null, 2).split("\n");
33275
+ return mutationReportLines(structured)?.map(safeWorkerAnswerText) ?? safeWorkerAnswerText(entry.text).split("\n");
32617
33276
  }
32618
33277
  function bodyLines(entry, width, unbounded) {
32619
33278
  if (entry.text.length === 0) return [];
32620
33279
  const contentWidth = Math.max(1, width - RAIL_WIDTH);
32621
- const source = bodySourceLines(entry);
33280
+ const source = unbounded ? safeWorkerAnswerText(entry.text).split("\n") : bodySourceLines(entry);
32622
33281
  const capped = unbounded || source.length <= BODY_LINE_LIMIT ? source : source.slice(0, BODY_LINE_LIMIT);
32623
33282
  const hiddenLines = entry.droppedLines + (source.length - capped.length);
32624
33283
  const out = [];
@@ -32663,6 +33322,12 @@ function actionLine(entry, width) {
32663
33322
  }
32664
33323
  function renderWorkerEntryLines(entry, width, options) {
32665
33324
  const safeWidth = Math.max(1, Math.floor(width));
33325
+ const integrity = entry.receipt?.trust;
33326
+ const provenance = isPending(entry) || integrity?.artifactIntegrity.state === "verified" ? [] : railLines(
33327
+ `receipt: ${integrity ? retiredIntegrityVersionOf(integrity.artifactIntegrity) !== null ? "seal retired" : trustStateWord("artifactIntegrity", integrity.artifactIntegrity.state) : "integrity unavailable"}; raw output, not admitted as evidence`,
33328
+ "warning",
33329
+ safeWidth
33330
+ );
32666
33331
  const quality = isPending(entry) ? [] : railLines(
32667
33332
  `quality: ${trustStateWord("validationGrounding", entry.receipt?.trust?.validationGrounding.state ?? "unknown")}`,
32668
33333
  "muted",
@@ -32678,6 +33343,7 @@ function renderWorkerEntryLines(entry, width, options) {
32678
33343
  ...tools2 ? [tools2] : [],
32679
33344
  ...failureLines(entry, safeWidth),
32680
33345
  footerLine(entry, safeWidth),
33346
+ ...provenance,
32681
33347
  ...quality
32682
33348
  ].map(redactSecretString);
32683
33349
  }
@@ -32687,10 +33353,14 @@ function renderWorkerEntryLines(entry, width, options) {
32687
33353
  const summary = bodySourceLines(entry).flatMap(
32688
33354
  (line) => railLines(redactSecretString(line), needsInput ? "warning" : "muted", safeWidth)
32689
33355
  );
32690
- const actions = entry.progress ? [...entry.progress.recentActions].reverse().concat(entry.progress.currentAction ? [entry.progress.currentAction] : []) : [];
33356
+ const current = isPending(entry) ? entry.progress?.currentAction : null;
33357
+ const actions = [
33358
+ ...current ? [{ action: current, label: "now" }] : [],
33359
+ ...(entry.progress?.recentActions ?? []).map((action) => ({ action, label: "last" }))
33360
+ ];
32691
33361
  const trail = actions.flatMap(
32692
- (action) => railLines(
32693
- `${GLYPH.phaseTool} ${action.descriptor ? `${action.descriptor.verb} ${action.descriptor.object}` : action.tool}`,
33362
+ ({ action, label }) => railLines(
33363
+ `${GLYPH.phaseTool} ${label}: ${action.descriptor ? `${action.descriptor.verb} ${action.descriptor.object}` : action.tool}`,
32694
33364
  "muted",
32695
33365
  safeWidth
32696
33366
  )
@@ -32703,7 +33373,7 @@ function renderWorkerEntryLines(entry, width, options) {
32703
33373
  ...detail.workerRows > 0 || needsInput ? previewRows(summary, summaryRows, safeWidth, entry.pending) : [],
32704
33374
  ...previewRows(attemptLines(entry, safeWidth), budget(detail.errorRows), safeWidth, true),
32705
33375
  ...tools ? [tools] : [],
32706
- ...detail.workerActivity ? previewRows(trail, budget(4), safeWidth, true) : [],
33376
+ ...detail.workerActivity ? previewRows(trail, budget(4), safeWidth) : [],
32707
33377
  ...failure2,
32708
33378
  ...presented ? railLines(presented, "muted", safeWidth) : [],
32709
33379
  ...entry.receipt?.abandonedDetail ? railLines(entry.receipt.abandonedDetail, "warning", safeWidth) : [],
@@ -32713,6 +33383,7 @@ function renderWorkerEntryLines(entry, width, options) {
32713
33383
  "muted",
32714
33384
  safeWidth
32715
33385
  ) : [],
33386
+ ...provenance,
32716
33387
  ...quality
32717
33388
  ].map(redactSecretString);
32718
33389
  }
@@ -32820,7 +33491,7 @@ function scopeTerminalErrorAfterSuccessfulTool(entry, terminalError) {
32820
33491
  if (successfulTools.length === 0) return terminalError;
32821
33492
  const reason = terminalError.slice("[error] ".length);
32822
33493
  const timedOut = /\b(?:timed?\s*out|timeout)\b/i.test(reason);
32823
- const modelFailure = timedOut ? "main model response timed out after successful tool result" : `main model response failed after successful tool result: ${reason}`;
33494
+ const modelFailure = timedOut ? `main model response timed out after successful tool result: ${reason}` : `main model response failed after successful tool result: ${reason}`;
32824
33495
  const detachedDispatchSucceeded = successfulTools.some(
32825
33496
  (segment) => segment.name === "dispatch" && segment.args !== null && typeof segment.args === "object" && segment.args.detach === true
32826
33497
  );
@@ -32906,9 +33577,9 @@ function renderTextSegmentLines(seg, width) {
32906
33577
  }
32907
33578
  return seg.md.render(width).map((line) => line.replace(/ +$/, ""));
32908
33579
  }
32909
- function renderErrorSegmentLines(seg, width) {
33580
+ function renderErrorSegmentLines(seg, width, unbounded) {
32910
33581
  const out = [];
32911
- for (const line of seg.text.split("\n")) {
33582
+ for (const line of (unbounded ? providerErrorEvidence(seg.text) : presentProviderError(seg.text)).split("\n")) {
32912
33583
  for (const wrapped of wrapTextWithAnsi(line, width)) {
32913
33584
  out.push(`${RED_CRIT}${wrapped}${RESET}`);
32914
33585
  }
@@ -33015,7 +33686,7 @@ function observation(seg) {
33015
33686
  }
33016
33687
  function renderEntryLines(entry, width, nowMs, unboundedToolBodies, detail, terminalRows) {
33017
33688
  if (entry.role === "replayBlock") {
33018
- return entry.renderBlock(width, detail);
33689
+ return entry.renderBlock(width, detail, unboundedToolBodies, terminalRows);
33019
33690
  }
33020
33691
  if (entry.role === "user") {
33021
33692
  const contentWidth = Math.max(1, width - PROSE_GUTTER_WIDTH);
@@ -33029,7 +33700,7 @@ function renderEntryLines(entry, width, nowMs, unboundedToolBodies, detail, term
33029
33700
  return rendered;
33030
33701
  }
33031
33702
  if (entry.role === "retryStatus") {
33032
- return wrapTextWithAnsi(formatRetryStatus(entry.status), width);
33703
+ return renderRetryStatus(entry.status, width, detail, unboundedToolBodies, terminalRows);
33033
33704
  }
33034
33705
  if (entry.role === "worker") {
33035
33706
  return renderWorkerEntryLines(entry.state, width, { detail, terminalRows, unbounded: unboundedToolBodies });
@@ -33079,7 +33750,10 @@ function renderEntryLines(entry, width, nowMs, unboundedToolBodies, detail, term
33079
33750
  labeled = true;
33080
33751
  continue;
33081
33752
  }
33082
- const rendered = seg.kind === "text" ? renderTextSegmentLines(seg, proseWidth) : renderErrorSegmentLines(seg, proseWidth);
33753
+ let rendered = seg.kind === "text" ? renderTextSegmentLines(seg, proseWidth) : renderErrorSegmentLines(seg, proseWidth, unboundedToolBodies);
33754
+ if (seg.kind === "error" && !unboundedToolBodies) {
33755
+ rendered = previewRows(rendered, previewBudget(detail.errorRows, terminalRows), proseWidth);
33756
+ }
33083
33757
  if (rendered.length === 0) continue;
33084
33758
  const isSkillSuggestion = seg.kind === "text" && findSkillSuggestionLine(seg) !== null;
33085
33759
  if (!labeled && !isSkillSuggestion) {
@@ -33360,6 +34034,7 @@ function createChatPanel(options = {}) {
33360
34034
  for (const entry of transcript) {
33361
34035
  if (entry.role === "assistant") {
33362
34036
  for (const seg of entry.segments) {
34037
+ if (seg.kind === "error") add("Provider or terminal error", () => providerErrorEvidence(seg.text).split("\n"));
33363
34038
  if (seg.kind === "thinking" && seg.text) add("Thinking \xB7 supplied reasoning", () => seg.text.split("\n"));
33364
34039
  if (seg.kind === "tool")
33365
34040
  add(
@@ -33380,6 +34055,8 @@ function createChatPanel(options = {}) {
33380
34055
  )
33381
34056
  );
33382
34057
  }
34058
+ } else if (entry.role === "retryStatus" && entry.status.errorMessage) {
34059
+ add("Provider retry diagnostic", () => providerErrorEvidence(entry.status.errorMessage ?? "").split("\n"));
33383
34060
  } else if (entry.role === "worker") {
33384
34061
  add(
33385
34062
  `${entry.state.agentId} \xB7 worker ${entry.state.runId}`,
@@ -34304,7 +34981,7 @@ init_esm_shims();
34304
34981
  import { execFile as execFile2 } from "node:child_process";
34305
34982
  import { open, readdir, stat as stat2 } from "node:fs/promises";
34306
34983
  import { homedir as homedir2 } from "node:os";
34307
- import { basename as basename3, dirname, join as join5, relative as relative7, resolve as resolve5, sep as sep2 } from "node:path";
34984
+ import { basename as basename3, dirname, join as join5, relative as relative7, resolve as resolve6, sep as sep2 } from "node:path";
34308
34985
  var MAX_COMPLETION_ROWS = 40;
34309
34986
  var PREVIEW_BYTES = 2048;
34310
34987
  var PREVIEW_CHARS = 120;
@@ -34427,9 +35104,9 @@ function explicitPathQuery(query) {
34427
35104
  return query.startsWith("../") || query.startsWith("~/") || query.startsWith("/");
34428
35105
  }
34429
35106
  function resolveDisplayBase(basePath, displayBase) {
34430
- if (displayBase.startsWith("~/")) return resolve5(homedir2(), displayBase.slice(2));
34431
- if (displayBase.startsWith("/")) return resolve5(displayBase);
34432
- return resolve5(basePath, displayBase);
35107
+ if (displayBase.startsWith("~/")) return resolve6(homedir2(), displayBase.slice(2));
35108
+ if (displayBase.startsWith("/")) return resolve6(displayBase);
35109
+ return resolve6(basePath, displayBase);
34433
35110
  }
34434
35111
  function workspaceRelative(basePath, absolutePath) {
34435
35112
  const candidate = posixPath(relative7(basePath, absolutePath));
@@ -34520,7 +35197,7 @@ function completionId(candidate) {
34520
35197
  return `file-reference:${candidate.isDirectory ? "directory" : "file"}:${candidate.absolutePath}`;
34521
35198
  }
34522
35199
  function createFileReferenceCompletionSource(options) {
34523
- const basePath = resolve5(options.basePath);
35200
+ const basePath = resolve6(options.basePath);
34524
35201
  const listWorkspaceFiles = options.listWorkspaceFiles ?? ((cwd) => enumerateWorkspaceFilesAsync(cwd));
34525
35202
  const listTrackedFiles = options.listTrackedFiles ?? gitTrackedFiles;
34526
35203
  const cacheTtlMs = options.cacheTtlMs ?? SNAPSHOT_TTL_MS;
@@ -35644,7 +36321,7 @@ function createInteractivePresentation(deps) {
35644
36321
  const editorChrome = {
35645
36322
  getModelLabel: () => {
35646
36323
  const current = deps.getSettings?.();
35647
- return formatTargetLabel(current?.chat?.target, current?.chat?.model, { separator: "\xB7" });
36324
+ return { targetId: current?.chat?.target, modelId: current?.chat?.model };
35648
36325
  },
35649
36326
  getThinkingLabel: () => {
35650
36327
  const current = deps.getSettings?.();
@@ -35879,7 +36556,7 @@ function createInteractivePresentation(deps) {
35879
36556
  // src/interactive/interactive-slash-runtime.ts
35880
36557
  init_esm_shims();
35881
36558
  import { mkdirSync as mkdirSync2, writeFileSync } from "node:fs";
35882
- import { join as join6, resolve as resolve6 } from "node:path";
36559
+ import { join as join6, resolve as resolve7 } from "node:path";
35883
36560
 
35884
36561
  // src/interactive/context-recall-command.ts
35885
36562
  init_esm_shims();
@@ -36234,8 +36911,8 @@ function createInteractiveSlashRuntime(deps) {
36234
36911
  deps.requestRender();
36235
36912
  let acknowledgeAdmission = () => {
36236
36913
  };
36237
- const admitted = new Promise((resolve10) => {
36238
- acknowledgeAdmission = resolve10;
36914
+ const admitted = new Promise((resolve11) => {
36915
+ acknowledgeAdmission = resolve11;
36239
36916
  });
36240
36917
  const turn = deps.chat.submit(sub.text, {
36241
36918
  ...sub.display ? { display: sub.display } : {},
@@ -36378,7 +37055,7 @@ function createInteractiveSlashRuntime(deps) {
36378
37055
  listDelegationAgents: () => deps.getSettings?.().integrations.externalAgents.entries ?? [],
36379
37056
  exportShareArchive: (outPath) => {
36380
37057
  if (!deps.share) throw new Error("share domain is not loaded");
36381
- const path2 = resolve6(outPath);
37058
+ const path2 = resolve7(outPath);
36382
37059
  const archive = deps.share.writeArchive(path2, { scope: "project" });
36383
37060
  return { fileCount: archive.files.length, path: path2 };
36384
37061
  },
@@ -36394,7 +37071,7 @@ function createInteractiveSlashRuntime(deps) {
36394
37071
  ...options.dryRun ? { dryRun: true } : {},
36395
37072
  ...options.force ? { force: true } : {}
36396
37073
  };
36397
- return options.dryRun ? deps.share.planImport(resolve6(archivePath), importOptions) : deps.share.importArchive(resolve6(archivePath), importOptions);
37074
+ return options.dryRun ? deps.share.planImport(resolve7(archivePath), importOptions) : deps.share.importArchive(resolve7(archivePath), importOptions);
36398
37075
  },
36399
37076
  openCost: deps.openCost,
36400
37077
  openSideQuestion: deps.openSideQuestion,
@@ -36524,10 +37201,10 @@ function createInteractiveSlashRuntime(deps) {
36524
37201
  const date = dateLocal(exportedAt);
36525
37202
  const requestedPath = pathArg?.trim() ?? "";
36526
37203
  const markdown = requestedPath.toLowerCase().endsWith(".md");
36527
- const target = resolve6(
37204
+ const target = resolve7(
36528
37205
  requestedPath.length > 0 ? requestedPath : join6(".clio-coder", "exports", `${sessionId}-${date}.html`)
36529
37206
  );
36530
- mkdirSync2(resolve6(target, ".."), { recursive: true });
37207
+ mkdirSync2(resolve7(target, ".."), { recursive: true });
36531
37208
  if (markdown) {
36532
37209
  const lines = ansiLines.map(stripTerminalSequences);
36533
37210
  const header = [`# Clio session ${sessionId}`, "", `Exported ${exportedAt.toISOString()}`, "", "```text"];
@@ -37828,7 +38505,7 @@ async function prepareBackgroundModelMetadata(providers, targetId, signal) {
37828
38505
  init_esm_shims();
37829
38506
  import { constants } from "node:fs";
37830
38507
  import { open as open2 } from "node:fs/promises";
37831
- import { resolve as resolve7 } from "node:path";
38508
+ import { resolve as resolve8 } from "node:path";
37832
38509
  var MAX_PROMPT_BYTES = 64 * 1024;
37833
38510
  async function readCompactionSystemPrompt(path2, workspace) {
37834
38511
  if (path2 === void 0 || path2 === null) return void 0;
@@ -37843,7 +38520,7 @@ async function readCompactionSystemPrompt(path2, workspace) {
37843
38520
  if (!path2.trim()) throw failure2("path is empty");
37844
38521
  let file;
37845
38522
  try {
37846
- file = await open2(resolve7(workspace, path2), constants.O_RDONLY | constants.O_NONBLOCK);
38523
+ file = await open2(resolve8(workspace, path2), constants.O_RDONLY | constants.O_NONBLOCK);
37847
38524
  } catch {
37848
38525
  throw failure2("cannot be opened");
37849
38526
  }
@@ -38196,11 +38873,11 @@ init_esm_shims();
38196
38873
 
38197
38874
  // src/tools/dispatch-admission.ts
38198
38875
  init_esm_shims();
38199
- import { isAbsolute as isAbsolute7, relative as relative9, resolve as resolve9 } from "node:path";
38876
+ import { isAbsolute as isAbsolute7, relative as relative9, resolve as resolve10 } from "node:path";
38200
38877
 
38201
38878
  // src/domains/dispatch/parallel-writers.ts
38202
38879
  init_esm_shims();
38203
- import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve8, sep as sep3 } from "node:path";
38880
+ import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve9, sep as sep3 } from "node:path";
38204
38881
  function parallelWriterConflict(requests, specs) {
38205
38882
  const classes = new Map(specs.map((spec) => [spec.id, spec.capabilityClass]));
38206
38883
  const writers = requests.filter(
@@ -38208,7 +38885,7 @@ function parallelWriterConflict(requests, specs) {
38208
38885
  );
38209
38886
  const roots = writers.map(
38210
38887
  (request) => (request.writeRoots ?? request.intent?.writeRoots ?? []).map(
38211
- (root) => canonicalizeExistingPath(resolve8(request.cwd ?? process.cwd(), root))
38888
+ (root) => canonicalizeExistingPath(resolve9(request.cwd ?? process.cwd(), root))
38212
38889
  )
38213
38890
  );
38214
38891
  const contains = (parent, child) => {
@@ -38574,7 +39251,7 @@ function createDispatchAdmissionController(deps) {
38574
39251
  return {
38575
39252
  check: entry.check,
38576
39253
  argv: [...check.command],
38577
- cwd: resolve9(process.cwd(), check.cwd),
39254
+ cwd: resolve10(process.cwd(), check.cwd),
38578
39255
  timeoutMs: entry.timeoutMs,
38579
39256
  // A judged check seals its kind and absolute file paths here, so
38580
39257
  // host verification judges against what the catalog declared at
@@ -38582,14 +39259,14 @@ function createDispatchAdmissionController(deps) {
38582
39259
  ...check.kind !== "command" ? { kind: check.kind } : {},
38583
39260
  ...check.numeric !== void 0 ? {
38584
39261
  numeric: {
38585
- reference: resolve9(process.cwd(), check.numeric.reference),
39262
+ reference: resolve10(process.cwd(), check.numeric.reference),
38586
39263
  tolerance: { ...check.numeric.tolerance }
38587
39264
  }
38588
39265
  } : {},
38589
39266
  ...check.perf !== void 0 ? {
38590
39267
  perf: {
38591
39268
  ...check.perf.budget !== void 0 ? { budget: structuredClone(check.perf.budget) } : {},
38592
- ...check.perf.baseline !== void 0 ? { baseline: resolve9(process.cwd(), check.perf.baseline) } : {},
39269
+ ...check.perf.baseline !== void 0 ? { baseline: resolve10(process.cwd(), check.perf.baseline) } : {},
38593
39270
  ...check.perf.tolerance !== void 0 ? { tolerance: { ...check.perf.tolerance } } : {}
38594
39271
  }
38595
39272
  } : {}
@@ -38656,7 +39333,7 @@ function createDispatchAdmissionController(deps) {
38656
39333
  ...request.worktree === true ? {
38657
39334
  worktree: true,
38658
39335
  apply: request.apply ?? "merge",
38659
- ...gitCheckoutRoot(resolve9(request.cwd ?? process.cwd())) === null ? {} : { worktreeDestination: gitCheckoutRoot(resolve9(request.cwd ?? process.cwd())) }
39336
+ ...gitCheckoutRoot(resolve10(request.cwd ?? process.cwd())) === null ? {} : { worktreeDestination: gitCheckoutRoot(resolve10(request.cwd ?? process.cwd())) }
38660
39337
  } : {},
38661
39338
  target: resolution.targetId,
38662
39339
  model: resolution.wireModelId,
@@ -38783,7 +39460,7 @@ function createDispatchAdmissionController(deps) {
38783
39460
  return shapeRejection(args, "dispatch: apply_winner.branch must be a clio-coder/compete/<group>/<n> branch");
38784
39461
  }
38785
39462
  try {
38786
- const cwd = resolve9(stringArg(args.apply_winner, "cwd") ?? process.cwd());
39463
+ const cwd = resolve10(stringArg(args.apply_winner, "cwd") ?? process.cwd());
38787
39464
  return trustExecution(
38788
39465
  markPrepared(
38789
39466
  withResolvedDispatchPlan(args, {
@@ -38849,7 +39526,7 @@ function createDispatchAdmissionController(deps) {
38849
39526
  const spec = deps.getAgentSpecs().find((candidate) => candidate.id === request.agentId);
38850
39527
  if (spec?.capabilityClass === "read-only") return shapeRejection(args, "worktree_read_only_agent");
38851
39528
  if (request.cwd !== void 0) {
38852
- const requested = resolve9(request.cwd);
39529
+ const requested = resolve10(request.cwd);
38853
39530
  const rel = relative9(parentCheckout, requested);
38854
39531
  if (rel === ".." || rel.startsWith("../") || isAbsolute7(rel)) {
38855
39532
  return shapeRejection(args, "worktree_cwd_outside_checkout");
@@ -39405,7 +40082,7 @@ function createDispatchTool(inputDeps, surfaceOptions = {}) {
39405
40082
  const admission = createDispatchAdmissionController(deps);
39406
40083
  let runnerPromise = null;
39407
40084
  const loadRunner = () => {
39408
- runnerPromise ??= (surfaceOptions.loadRunner ?? (() => import("./dispatch-runner-3RY5FSJC.js")))();
40085
+ runnerPromise ??= (surfaceOptions.loadRunner ?? (() => import("./dispatch-runner-TR3LBP5P.js")))();
39409
40086
  return runnerPromise;
39410
40087
  };
39411
40088
  return {
@@ -39444,7 +40121,13 @@ function createDispatchTool(inputDeps, surfaceOptions = {}) {
39444
40121
 
39445
40122
  // src/tools/bootstrap.ts
39446
40123
  function registerAllTools(registry, deps = {}) {
39447
- const registration = registerCoreTools(registry, deps);
40124
+ const cwd = deps.session?.current()?.cwd ?? process.cwd();
40125
+ const { mcpCapabilities: requestedMcp, ...coreDeps } = deps;
40126
+ const mcpCapabilities = requestedMcp === false ? null : requestedMcp ?? createMcpCapabilitySource({ cwd, registry });
40127
+ const registration = registerCoreTools(registry, {
40128
+ ...coreDeps,
40129
+ ...mcpCapabilities ? { mcpCapabilities } : {}
40130
+ });
39448
40131
  if (deps.dispatch) {
39449
40132
  const dispatch = deps.dispatch;
39450
40133
  const dispatchRunEvents = createDispatchRunEventRegistry({ journal: null });
@@ -39474,7 +40157,7 @@ function registerAllTools(registry, deps = {}) {
39474
40157
  ...builtin(
39475
40158
  lazyTool(
39476
40159
  monitorToolSurface,
39477
- async () => (await import("./monitor-YMP4NXJJ.js")).createMonitorTool({ dispatch, runEvents: dispatchRunEvents })
40160
+ async () => (await import("./monitor-XX6ZD6KC.js")).createMonitorTool({ dispatch, runEvents: dispatchRunEvents })
39478
40161
  ),
39479
40162
  {
39480
40163
  path: "src/tools/monitor.ts",
@@ -39484,7 +40167,7 @@ function registerAllTools(registry, deps = {}) {
39484
40167
  });
39485
40168
  registry.register({
39486
40169
  ...builtin(
39487
- lazyTool(steerToolSurface, async () => (await import("./steer-2B3EQGFH.js")).createSteerTool({ dispatch })),
40170
+ lazyTool(steerToolSurface, async () => (await import("./steer-XCD6V3EW.js")).createSteerTool({ dispatch })),
39488
40171
  {
39489
40172
  path: "src/tools/steer.ts",
39490
40173
  scope: "core"
@@ -39496,15 +40179,28 @@ function registerAllTools(registry, deps = {}) {
39496
40179
  const panes = deps.panes;
39497
40180
  registry.register({
39498
40181
  ...builtin(
39499
- lazyTool(panesToolSurface, async () => (await import("./panes-D3Y2KFG5.js")).createPanesTool({ panes })),
40182
+ lazyTool(panesToolSurface, async () => (await import("./panes-LXZIWNOZ.js")).createPanesTool({ panes })),
39500
40183
  { path: "src/tools/panes.ts", scope: "core" }
39501
40184
  )
39502
40185
  });
39503
40186
  }
39504
40187
  assertRegisteredBuiltinTools(registry, registration, Boolean(deps.dispatch), Boolean(deps.panes));
39505
- for (const diagnostic of registerHarnessExtensionTools(registry, deps.session?.current()?.cwd ?? process.cwd())) {
40188
+ for (const diagnostic of registerHarnessExtensionTools(registry, cwd)) {
39506
40189
  deps.bus?.emit(BusChannels.ExtensionsLoadIssue, { message: diagnostic.message });
39507
40190
  }
40191
+ let closePromise;
40192
+ const close = () => {
40193
+ closePromise ??= Promise.resolve(mcpCapabilities?.close()).then(() => void 0);
40194
+ return closePromise;
40195
+ };
40196
+ if (mcpCapabilities) {
40197
+ deps.termination?.onTerminate(close, { timeoutMs: DEFAULT_KILL_GRACE_MS + DEFAULT_TEARDOWN_BOUND_MS + 1e3 });
40198
+ }
40199
+ if (mcpCapabilities && deps.bus) {
40200
+ deps.bus.on(BusChannels.SessionEnd, () => void close());
40201
+ deps.bus.on(BusChannels.ShutdownRequested, () => void close());
40202
+ }
40203
+ return { mcpCapabilities, close };
39508
40204
  }
39509
40205
 
39510
40206
  // src/tools/dispatch-background.ts
@@ -39830,6 +40526,9 @@ function agentRoleToolWarnings(providers, settings) {
39830
40526
  if (!status) continue;
39831
40527
  const capabilities = resolveModelCapabilities(status, wireModelId, providers.knowledgeBase);
39832
40528
  if (supportsAgentRoleTools(capabilities)) continue;
40529
+ const declared = status.target.capabilities?.tools ?? providers.knowledgeBase?.lookup(wireModelId)?.entry.capabilities?.tools;
40530
+ if (declared === void 0 && status.health.lastCheckAt === null && probeCapabilitiesForModel(status, wireModelId) === null)
40531
+ continue;
39833
40532
  warnings.push(
39834
40533
  `${role.label} model '${wireModelId}' on target '${targetId}' ${AGENT_ROLE_TOOLS_REQUIRED_REASON}. Pick another model, or state the correction in a model-catalog.d entry if the provider's flag is wrong.`
39835
40534
  );
@@ -40212,7 +40911,7 @@ async function bootOrchestrator(options = {}) {
40212
40911
  let protectedArtifactStateForDispatch = null;
40213
40912
  const muxInteractive = !options.headless && options.acp === void 0 && process.env.CLIO_CODER_INTERACTIVE === "1";
40214
40913
  const muxEnablement = resolvePanesEnablement(options.panes, options.startupSettings?.interface.panes.enabled);
40215
- const withPanes = muxInteractive && muxEnablement !== "off" ? await import("./with-panes-CHFC7HGI.js") : null;
40914
+ const withPanes = muxInteractive && muxEnablement !== "off" ? await import("./with-panes-Z6BTEHMZ.js") : null;
40216
40915
  const result = await loadDomains(
40217
40916
  [
40218
40917
  options.startupSettings ? createConfigDomainModule(options.startupSettings) : ConfigDomainModule,
@@ -40254,7 +40953,7 @@ async function bootOrchestrator(options = {}) {
40254
40953
  createDispatchDomainModule({
40255
40954
  getSettings: () => effectiveSettingsForDispatch?.(),
40256
40955
  getProtectedArtifactState: () => protectedArtifactStateForDispatch?.() ?? { artifacts: [] },
40257
- autonomyOverride: options.headless?.autonomy !== void 0,
40956
+ autonomyOverride: (options.headless?.autonomy ?? options.autonomy) !== void 0,
40258
40957
  // The domain owns the durable journal here, not the dispatch
40259
40958
  // tool's event registry: `/run`, a watchdog run, and a model
40260
40959
  // dispatch all have to leave the same transcript behind, and only
@@ -40272,8 +40971,8 @@ async function bootOrchestrator(options = {}) {
40272
40971
  await dispatch.drain();
40273
40972
  });
40274
40973
  }
40275
- termination.onPersist(async () => {
40276
- await result.stop();
40974
+ termination.onPersist(() => result.stop(), {
40975
+ timeoutMs: Math.min(2 ** 31 - 1, (result.loaded.length + 1) * resolveShutdownHookBudgetMs())
40277
40976
  });
40278
40977
  bus.emit(BusChannels.SessionStart, { at: Date.now() });
40279
40978
  timer.mark("session_start fired");
@@ -40456,7 +41155,6 @@ async function bootOrchestrator(options = {}) {
40456
41155
  }
40457
41156
  return protectedArtifactsGuard.state();
40458
41157
  };
40459
- middleware.registerHook(protectedArtifactsGuard);
40460
41158
  middleware.registerHook(createDispatchDedupRegistration());
40461
41159
  middleware.registerHook(
40462
41160
  createSkillActivationObserver((activation) => appendSkillActivationRegistryEvent(session, activation))
@@ -40547,10 +41245,11 @@ async function bootOrchestrator(options = {}) {
40547
41245
  }
40548
41246
  });
40549
41247
  extensionReload.applyBoot();
41248
+ middleware.registerHook(protectedArtifactsGuard);
40550
41249
  bootHookNotices = false;
40551
41250
  termination.onDrain(() => hookReceiptLog.flush());
40552
41251
  let activeAcpSessionAutonomy = null;
40553
- const resolveBaselineAutonomy = () => effectiveSettingsForDispatch?.().safety.autonomy ?? options.headless?.autonomy ?? (config?.get() ?? readSettings()).safety.autonomy ?? "auto-edit";
41252
+ const resolveBaselineAutonomy = () => effectiveSettingsForDispatch?.().safety.autonomy ?? options.headless?.autonomy ?? options.autonomy ?? (config?.get() ?? readSettings()).safety.autonomy ?? "auto-edit";
40554
41253
  const resolveEffectiveAutonomy = () => activeAcpSessionAutonomy ?? resolveBaselineAutonomy();
40555
41254
  if (resources) {
40556
41255
  middleware.registerHook(
@@ -40661,6 +41360,7 @@ async function bootOrchestrator(options = {}) {
40661
41360
  getCwd: () => process.cwd()
40662
41361
  }) : null;
40663
41362
  registerAllTools(toolRegistry, {
41363
+ termination,
40664
41364
  captureWorkerContext: () => chat.captureWorkerContext?.() ?? null,
40665
41365
  ...session ? {
40666
41366
  session,
@@ -40701,8 +41401,9 @@ async function bootOrchestrator(options = {}) {
40701
41401
  const sessionRouting = seedSessionRouting(
40702
41402
  applyHeadlessSettingsOverlay(config?.get() ?? readSettings(), options.headless)
40703
41403
  );
41404
+ const startupAutonomy = options.headless?.autonomy ?? options.autonomy;
40704
41405
  const sessionOverrides = new Map(
40705
- options.headless?.autonomy === void 0 ? [] : [["safety.autonomy", options.headless.autonomy]]
41406
+ startupAutonomy === void 0 ? [] : [["safety.autonomy", startupAutonomy]]
40706
41407
  );
40707
41408
  let sessionStateGeneration = 0;
40708
41409
  let cachedSettingsBase = null;
@@ -40729,8 +41430,12 @@ async function bootOrchestrator(options = {}) {
40729
41430
  };
40730
41431
  effectiveSettingsForDispatch = getCurrentSettings;
40731
41432
  bumpSessionState();
40732
- const unsubscribeSettingsProjectionSync = bus.on(BusChannels.ConfigHotReload, () => bumpSessionState());
40733
- termination.onDrain(() => unsubscribeSettingsProjectionSync());
41433
+ const unsubscribeSettingsProjectionSync = [BusChannels.ConfigHotReload, BusChannels.ConfigNextTurn].map(
41434
+ (channel) => bus.on(channel, () => bumpSessionState())
41435
+ );
41436
+ termination.onDrain(() => {
41437
+ for (const unsubscribe of unsubscribeSettingsProjectionSync) unsubscribe();
41438
+ });
40734
41439
  const getTaskMemorySeedOffer = () => {
40735
41440
  return taskMemoryHandoffSeedOffer(process.cwd(), getCurrentSettings().context.memory.enabled);
40736
41441
  };
@@ -41359,4 +42064,4 @@ export {
41359
42064
  createBackgroundMemoryRouting,
41360
42065
  createProductionAutoCompact
41361
42066
  };
41362
- //# sourceMappingURL=orchestrator-AFQRRTEI.js.map
42067
+ //# sourceMappingURL=orchestrator-SK6HDAOP.js.map