@iowarp/clio-coder 0.5.0 → 0.5.2

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 (312) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/CHANGELOG.md +35 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/README.md +12 -9
  5. package/ROADMAP.md +30 -5
  6. package/dist/{acp-KS7ARGV6.js → acp-F6PGOFZ4.js} +2 -2
  7. package/dist/{agents-YOGJ2YEJ.js → agents-ZHP4R6EX.js} +22 -21
  8. package/dist/assets/codewiki.json +1 -1
  9. package/dist/{auth-CEDCO6O6.js → auth-N75U2H3Z.js} +4 -4
  10. package/dist/{chunk-D3KWFOUT.js → chunk-23UIXH6Z.js} +3 -3
  11. package/dist/{chunk-ZR5YA6ZF.js → chunk-36XVK5P5.js} +5 -5
  12. package/dist/{chunk-AVSR2HKI.js → chunk-3DZ4LPLS.js} +6 -6
  13. package/dist/{chunk-LYJJ6546.js → chunk-3GSPCWFX.js} +12 -12
  14. package/dist/{chunk-CRHPCPZP.js → chunk-4KC4CHKJ.js} +2 -2
  15. package/dist/{chunk-4VDHLCF5.js → chunk-4WJBWKMI.js} +2 -2
  16. package/dist/{chunk-KBUTSJSR.js → chunk-4XBYHXGK.js} +2 -2
  17. package/dist/{chunk-6W75D37F.js → chunk-53P775GE.js} +6 -3
  18. package/dist/{chunk-XZWSP67B.js → chunk-5APYAXCB.js} +2 -2
  19. package/dist/{chunk-D65E25JG.js → chunk-67HPYNTJ.js} +2 -2
  20. package/dist/{chunk-5JQR5B4D.js → chunk-6KV4KCQZ.js} +4 -4
  21. package/dist/{chunk-V4XJWDHR.js → chunk-6UKFRTXI.js} +2 -1
  22. package/dist/{chunk-NDPF2N2L.js → chunk-7DW7CJW2.js} +2 -2
  23. package/dist/{chunk-5KQEUIWM.js → chunk-7LUEQODV.js} +4 -4
  24. package/dist/{chunk-LNOXCGN2.js → chunk-7UFDIOBT.js} +3 -3
  25. package/dist/{chunk-DXSETN72.js → chunk-7WUGNN43.js} +2 -2
  26. package/dist/{chunk-V35KZDUZ.js → chunk-AA3GRZWS.js} +2 -2
  27. package/dist/{chunk-X4CEFOSG.js → chunk-ADO3OQIC.js} +4 -4
  28. package/dist/{chunk-UX2L5CUD.js → chunk-AI36V3ON.js} +3 -3
  29. package/dist/{chunk-B7GY6QER.js → chunk-B26OUMJW.js} +2 -2
  30. package/dist/{chunk-LAR7DX5E.js → chunk-B5TASTCK.js} +153 -62
  31. package/dist/{chunk-TGWZXJ7L.js → chunk-BEMQK5Q7.js} +92 -84
  32. package/dist/{chunk-RNDCROSG.js → chunk-CNXU7TR2.js} +3 -3
  33. package/dist/{chunk-3JLTRPN7.js → chunk-CVMUXT64.js} +35 -66
  34. package/dist/{chunk-733ZBT5P.js → chunk-E74MJF6G.js} +4 -4
  35. package/dist/{chunk-T2MDZES3.js → chunk-EBMTBE76.js} +3 -3
  36. package/dist/{chunk-OZ76TLGU.js → chunk-EEITU7S6.js} +2 -2
  37. package/dist/{chunk-GRHOXDKB.js → chunk-ELDJWJKM.js} +97 -14
  38. package/dist/{chunk-GCQFN7YI.js → chunk-EMYEQLWO.js} +2 -2
  39. package/dist/{chunk-LTWH2ACR.js → chunk-EQPFEDFV.js} +222 -127
  40. package/dist/{chunk-TDGYTWM6.js → chunk-F4I3H56H.js} +2 -2
  41. package/dist/chunk-F6KCJO3U.js +523 -0
  42. package/dist/{chunk-FGSQHUCK.js → chunk-F6VKWTTY.js} +5 -5
  43. package/dist/{chunk-UJD5MPP6.js → chunk-FLNXQQ5B.js} +2 -2
  44. package/dist/{chunk-EX57VVWW.js → chunk-FOSRJ2VZ.js} +4 -4
  45. package/dist/{chunk-ZARZ4POR.js → chunk-G5ZDQQE3.js} +3 -3
  46. package/dist/{chunk-HQVN7G4F.js → chunk-G62JBPXN.js} +7 -7
  47. package/dist/{chunk-ZJPORZTC.js → chunk-GIAI7A2K.js} +2 -2
  48. package/dist/chunk-GPTR6OTU.js +2551 -0
  49. package/dist/{chunk-EZD2BXGP.js → chunk-GUFQPTQK.js} +2 -2
  50. package/dist/{chunk-OPD7GL6F.js → chunk-H6FQVNZC.js} +8 -7
  51. package/dist/chunk-H7REJ7L5.js +80 -0
  52. package/dist/{chunk-EYTLV3W3.js → chunk-HTWTORF7.js} +2 -2
  53. package/dist/{chunk-DF6PI6GN.js → chunk-I6UKQPGS.js} +3 -3
  54. package/dist/{chunk-ISHUS7HC.js → chunk-JRW236JT.js} +3 -3
  55. package/dist/{chunk-DE2LU267.js → chunk-KKAJGT3B.js} +3 -2
  56. package/dist/{chunk-OV62D6KO.js → chunk-KQMYL5GR.js} +3 -3
  57. package/dist/{chunk-QDUUOZ3S.js → chunk-KWMFC7FN.js} +3 -3
  58. package/dist/{chunk-R7FGRZNF.js → chunk-LXYHCCIZ.js} +9 -9
  59. package/dist/{chunk-NFSK2VNU.js → chunk-LZMTVVN4.js} +2 -2
  60. package/dist/{chunk-62UK7AGW.js → chunk-M5PMRZSR.js} +397 -44
  61. package/dist/chunk-MMZMM6SW.js +131 -0
  62. package/dist/{chunk-FFYTC2KQ.js → chunk-MNABNEBX.js} +2 -2
  63. package/dist/{chunk-XMDBTYCH.js → chunk-N3CWOGVF.js} +3 -3
  64. package/dist/{chunk-VYRQHORQ.js → chunk-NMQSO6Z6.js} +4 -3
  65. package/dist/{chunk-R2UUNSNQ.js → chunk-O3ZAF7UY.js} +18 -5
  66. package/dist/{chunk-4SYHGVDE.js → chunk-OQNCLZI4.js} +4 -4
  67. package/dist/{chunk-EG4ARXPC.js → chunk-OX6QTA4N.js} +3 -3
  68. package/dist/{chunk-P4GNZPXO.js → chunk-OYUS3UZP.js} +2 -2
  69. package/dist/{chunk-OQ2EOAHA.js → chunk-PF36KOGI.js} +291 -112
  70. package/dist/{chunk-55RMDDFM.js → chunk-PGQG7ZMW.js} +2 -2
  71. package/dist/{chunk-CBAQPTDU.js → chunk-PIU6BXXW.js} +2 -2
  72. package/dist/{chunk-EKV4UBCM.js → chunk-PZBQUJ2F.js} +2 -2
  73. package/dist/{chunk-7RET77VB.js → chunk-Q2HKY32Y.js} +2 -2
  74. package/dist/{chunk-U6YTUVOX.js → chunk-Q4RMNWMZ.js} +4 -4
  75. package/dist/chunk-Q6FRR3AQ.js +48 -0
  76. package/dist/{chunk-6RJMYYIE.js → chunk-QJSIAJBY.js} +3 -3
  77. package/dist/{chunk-DOUISWEE.js → chunk-QOJ4ERMU.js} +5 -5
  78. package/dist/{chunk-IFPDAD7R.js → chunk-RWSRKXLT.js} +3 -3
  79. package/dist/{chunk-T33IYTZM.js → chunk-SAASVMIY.js} +3 -3
  80. package/dist/{chunk-2DTIWSAW.js → chunk-SEQDH6JC.js} +3 -3
  81. package/dist/{chunk-BRCOSE7O.js → chunk-SZUO5BSE.js} +2 -2
  82. package/dist/{chunk-HOEDA42N.js → chunk-T7HZ7KJF.js} +2 -2
  83. package/dist/{chunk-OJXOA6YU.js → chunk-TL6LNERH.js} +2 -2
  84. package/dist/{chunk-UCINIRHW.js → chunk-TPCZXWLT.js} +3 -3
  85. package/dist/{chunk-ZUKUCZYZ.js → chunk-TQ2KTH4A.js} +2 -2
  86. package/dist/{chunk-4WOOTKFD.js → chunk-U3FETNQB.js} +341 -20
  87. package/dist/{chunk-5B3RTYAK.js → chunk-UGDSB4AN.js} +2 -2
  88. package/dist/{chunk-VKHLUZNO.js → chunk-UZ7YBL43.js} +3 -3
  89. package/dist/{chunk-QNUQ7K7D.js → chunk-VKMSEO7Y.js} +4 -4
  90. package/dist/{chunk-IN7DGBVS.js → chunk-VLX5VZ35.js} +5 -5
  91. package/dist/{chunk-SJGS3GDI.js → chunk-WAGBMMNX.js} +5 -5
  92. package/dist/{chunk-BFOSV5EZ.js → chunk-WX2YCH7F.js} +2 -2
  93. package/dist/{chunk-3LT34CAM.js → chunk-XBIGUILU.js} +32 -17
  94. package/dist/{chunk-XDHUDE5K.js → chunk-XKYBFRWR.js} +5 -5
  95. package/dist/{chunk-U5QU5ZOD.js → chunk-XYPWFSU5.js} +3 -3
  96. package/dist/{chunk-YBUECLAF.js → chunk-YEJQDODA.js} +2 -2
  97. package/dist/{chunk-YQ6XEFVK.js → chunk-Z74OGONW.js} +39 -7
  98. package/dist/{chunk-I4ELN5BX.js → chunk-ZTNOEJRI.js} +2 -2
  99. package/dist/cli/index.js +26 -26
  100. package/dist/{clio-K2PBVCEM.js → clio-4IKFE25F.js} +2 -2
  101. package/dist/{clio-context-tools-GR4OHFSO.js → clio-context-tools-OHJXYX4R.js} +25 -23
  102. package/dist/{code-nav-4X3OI6DK.js → code-nav-XPM3MY5I.js} +7 -7
  103. package/dist/{config-Q5J7UBAB.js → config-343YS25T.js} +43 -41
  104. package/dist/{config-graph-P3555574.js → config-graph-WI263KDX.js} +43 -41
  105. package/dist/{configure-KIJ32ZO6.js → configure-GZDG4HER.js} +21 -21
  106. package/dist/{context-LFBQOSXT.js → context-4OFO7N7Y.js} +12 -12
  107. package/dist/{context-WBH3KSVR.js → context-JLK2RLOG.js} +42 -40
  108. package/dist/{context-NNLBES2Y.js → context-O6DIWCF6.js} +23 -21
  109. package/dist/{context-clear-YOHMQ6SQ.js → context-clear-MR7KOGQI.js} +42 -40
  110. package/dist/{context-working-set-MRAEVDNV.js → context-working-set-YZAD3KWO.js} +14 -13
  111. package/dist/{data-tool-JJPBGMQJ.js → data-tool-EKD7DFHG.js} +7 -7
  112. package/dist/{detail-RHJOTGN4.js → detail-YZPHFEVJ.js} +43 -41
  113. package/dist/{dispatch-runner-NC7PYNIO.js → dispatch-runner-VKVXVTWJ.js} +44 -42
  114. package/dist/{doctor-S5KZ2GTN.js → doctor-53AVQXAO.js} +17 -16
  115. package/dist/{doctor-deep-2EJQSHIZ.js → doctor-deep-BLRB2NCG.js} +5 -5
  116. package/dist/{eval-3D6M36N7.js → eval-P3BQSLQE.js} +21 -20
  117. package/dist/{evidence-XNVPPLVK.js → evidence-6LLI6SZH.js} +44 -42
  118. package/dist/{evidence-6IYN52ET.js → evidence-HTN3JLUO.js} +42 -40
  119. package/dist/{evidence-JVECPI3F.js → evidence-NJRE3R5H.js} +42 -40
  120. package/dist/{evolve-TLPUDJDM.js → evolve-WWZHJVJP.js} +42 -40
  121. package/dist/{fleet-WKVBF5SZ.js → fleet-GGZ4BVJE.js} +64 -62
  122. package/dist/{fleet-6RJWIOEO.js → fleet-QG3IIWWM.js} +44 -42
  123. package/dist/{fleet-commands-L6WFT7KZ.js → fleet-commands-J2ZIKISQ.js} +7 -7
  124. package/dist/{fleet-decisions-BTQMWU5A.js → fleet-decisions-Y2Q7375Q.js} +8 -8
  125. package/dist/{fleet-graph-553DZ67Q.js → fleet-graph-TCBCCCBP.js} +11 -11
  126. package/dist/{fleet-inspect-236FZPRB.js → fleet-inspect-KOLKBC56.js} +44 -42
  127. package/dist/{fleet-preflight-NZQHABWO.js → fleet-preflight-44UNCC4Y.js} +27 -25
  128. package/dist/{fleet-validate-7NLAE26R.js → fleet-validate-K2FXRZVA.js} +13 -13
  129. package/dist/{fleet-verify-E3RO6A5W.js → fleet-verify-AS444WDW.js} +42 -40
  130. package/dist/{fleet-view-KMZQY7YJ.js → fleet-view-X4JU4J6O.js} +43 -41
  131. package/dist/gui/ops-worker.js +9 -9
  132. package/dist/gui/reads-worker.js +9 -8
  133. package/dist/{init-DV5B6HQG.js → init-VSOWFHVL.js} +54 -52
  134. package/dist/{interactive-OXGYZYAS.js → interactive-JRCBENLZ.js} +1733 -577
  135. package/dist/{interop-J7UOBOSF.js → interop-JR6BCY7R.js} +10 -10
  136. package/dist/{inventory-OEGIL6PY.js → inventory-3JUGLVJI.js} +43 -41
  137. package/dist/{library-ROZAMUIL.js → library-7BOH3Y7N.js} +15 -15
  138. package/dist/{library-B3UPGY4V.js → library-7PFONXUI.js} +9 -9
  139. package/dist/{library-MXQA5DLT.js → library-TUYZMFIA.js} +7 -7
  140. package/dist/{library-import-2LTWOVBD.js → library-import-TJVXKLDK.js} +10 -10
  141. package/dist/{library-inventory-LJ3XHLWO.js → library-inventory-MD3AYTP4.js} +9 -9
  142. package/dist/{library-validation-DARHHUNW.js → library-validation-ZDLITEA3.js} +7 -7
  143. package/dist/{mcp-2GSPYQ54.js → mcp-EFCWUPUR.js} +3 -3
  144. package/dist/{memory-J3STUUIK.js → memory-Q2YVOKK5.js} +42 -40
  145. package/dist/{models-Y3GMFJ2V.js → models-M7BOCW7F.js} +17 -16
  146. package/dist/{monitor-LHNH577J.js → monitor-2HD3MC67.js} +47 -45
  147. package/dist/{orchestrator-DTAPXULA.js → orchestrator-OUW3ZN6Y.js} +1894 -226
  148. package/dist/{panes-A743ONZ5.js → panes-TTPPSYCL.js} +3 -3
  149. package/dist/{preload-OJBMAIXF.js → preload-A47C2NUF.js} +42 -40
  150. package/dist/{providers-CMETPZNS.js → providers-T43W7EL4.js} +4 -4
  151. package/dist/{resources-FY6XYFN2.js → resources-TP6X2V6W.js} +20 -11
  152. package/dist/{run-H64MEVTA.js → run-LDSBPMCS.js} +61 -59
  153. package/dist/{share-CAFMMQLM.js → share-URHKKMHR.js} +9 -9
  154. package/dist/{skills-ERKQUC7L.js → skills-E477MOOO.js} +13 -11
  155. package/dist/{skills-eval-CQ23MYQK.js → skills-eval-AIBR2L7H.js} +583 -93
  156. package/dist/{skills-inventory-TVUYJDVN.js → skills-inventory-HLMKY3R5.js} +13 -11
  157. package/dist/{slash-commands-ROG3KIFJ.js → slash-commands-LIIZKA5Y.js} +28 -26
  158. package/dist/{startup-background-KDWCQMWT.js → startup-background-JR2KDK6R.js} +43 -41
  159. package/dist/{steer-KKYXJSH4.js → steer-D7RTAPCM.js} +3 -3
  160. package/dist/{system-ZDW44ZGX.js → system-X2P5N4IY.js} +14 -13
  161. package/dist/{targets-AJWA6E7Z.js → targets-VFFAKUFM.js} +25 -24
  162. package/dist/{tasks-6L2JJRC5.js → tasks-ERAWZA22.js} +6 -6
  163. package/dist/{terminal-lease-YFUSDPAD.js → terminal-lease-V2N2BIKQ.js} +2 -2
  164. package/dist/{trace-LA5MVR4Y.js → trace-MA5BT7XY.js} +3 -3
  165. package/dist/{usage-XSILDHKF.js → usage-WYFY2L6M.js} +50 -48
  166. package/dist/{verifiers-ECA5GIHL.js → verifiers-TYIW2XKF.js} +7 -7
  167. package/dist/{verify-R6QQCCEB.js → verify-242UFYTP.js} +6 -6
  168. package/dist/{web-fetch-PVZNMBOB.js → web-fetch-LRAGYU6Y.js} +3 -3
  169. package/dist/{wiki-generate-RP22WP5K.js → wiki-generate-OFKOX2T6.js} +53 -51
  170. package/dist/worker/entry.js +31 -29
  171. package/docs/architecture/architecture.md +1 -0
  172. package/docs/architecture/context-engine.md +4 -2
  173. package/docs/architecture/observability.md +6 -4
  174. package/docs/architecture/prompt-envelope-and-tools.md +1 -1
  175. package/docs/architecture/session-lifecycle.md +1 -1
  176. package/docs/architecture/tui-design.md +12 -9
  177. package/docs/gui/parity/02-slash-and-surfaces.md +1 -1
  178. package/docs/guide/commands-and-modes.md +91 -5
  179. package/docs/guide/configuration-and-targets.md +2 -2
  180. package/docs/guide/context-continuity.md +49 -0
  181. package/docs/guide/proactive-memory.md +6 -3
  182. package/library/registry.yaml +292 -32
  183. package/library/skills/README.md +27 -2
  184. package/library/skills/context/context-handoff/SKILL.md +10 -4
  185. package/library/skills/meta/clio-coder-dev/SKILL.md +92 -88
  186. package/library/skills/meta/clio-coder-dev/evals.md +51 -46
  187. package/library/skills/meta/clio-coder-dev/plugin.json +2 -2
  188. package/library/skills/meta/clio-coder-dev/references/change-map.md +49 -0
  189. package/library/skills/meta/clio-coder-test/SKILL.md +89 -142
  190. package/library/skills/meta/clio-coder-test/evals.md +58 -62
  191. package/library/skills/meta/clio-coder-test/plugin.json +2 -2
  192. package/library/skills/meta/clio-coder-test/references/harness.md +3 -3
  193. package/library/skills/meta/clio-coder-test/references/lifecycle-validation.md +30 -0
  194. package/library/skills/meta/clio-coder-test/references/test-map.md +60 -89
  195. package/library/skills/registry.yaml +5 -5
  196. package/library/skills/skill-marketplace.json +12 -14
  197. package/package.json +1 -1
  198. package/src/cli/skills-eval.ts +1064 -54
  199. package/src/cli/usage.ts +2 -2
  200. package/src/core/clio-repo.ts +3 -0
  201. package/src/core/tool-names.ts +1 -0
  202. package/src/domains/context/budget/inspection.ts +9 -0
  203. package/src/domains/context/budget/live-view.ts +418 -0
  204. package/src/domains/context/budget/pressure.ts +393 -0
  205. package/src/domains/context/budget/request-fit.ts +15 -0
  206. package/src/domains/evidence/build.ts +24 -0
  207. package/src/domains/gateway/mcp/client.ts +1 -1
  208. package/src/domains/memory/commit-state.ts +160 -0
  209. package/src/domains/memory/operations.ts +18 -10
  210. package/src/domains/memory/prompt-cache.ts +95 -0
  211. package/src/domains/memory/prompt-section.ts +50 -7
  212. package/src/domains/memory/relevance.ts +93 -0
  213. package/src/domains/memory/restoration.ts +78 -0
  214. package/src/domains/memory/store.ts +39 -1
  215. package/src/domains/middleware/memory-intervention.ts +116 -24
  216. package/src/domains/observability/background-memory-usage.ts +1 -1
  217. package/src/domains/observability/cost.ts +3 -3
  218. package/src/domains/observability/extension.ts +1 -1
  219. package/src/domains/observability/metrics.ts +1 -1
  220. package/src/domains/prompts/compiler.ts +1 -1
  221. package/src/domains/prompts/extension.ts +38 -1
  222. package/src/domains/quota/anthropic-max-provider.ts +134 -0
  223. package/src/domains/quota/anthropic-usage.ts +220 -0
  224. package/src/domains/quota/antigravity-provider.ts +339 -0
  225. package/src/domains/quota/cache.ts +87 -0
  226. package/src/domains/quota/claude-code-provider.ts +169 -0
  227. package/src/domains/quota/codex-provider.ts +237 -0
  228. package/src/domains/quota/presentation.ts +240 -0
  229. package/src/domains/quota/registry.ts +23 -0
  230. package/src/domains/quota/service.ts +93 -0
  231. package/src/domains/quota/summary-feed.ts +86 -0
  232. package/src/domains/quota/types.ts +84 -0
  233. package/src/domains/resources/index.ts +11 -0
  234. package/src/domains/resources/skills/catalog-view.ts +571 -0
  235. package/src/domains/resources/skills/lexical-match.ts +136 -0
  236. package/src/domains/resources/skills/loader.ts +38 -0
  237. package/src/domains/resources/skills/promotion.ts +1 -55
  238. package/src/domains/resources/skills/provenance-pin.ts +50 -20
  239. package/src/domains/safety/action-classifier.ts +1 -0
  240. package/src/domains/session/compaction/branch-summary.ts +4 -1
  241. package/src/domains/session/compaction/compact.ts +18 -2
  242. package/src/domains/session/compaction/cut-point.ts +20 -1
  243. package/src/domains/session/compaction/tokens.ts +48 -3
  244. package/src/domains/session/context-accounting.ts +8 -1
  245. package/src/domains/session/continuity/carry.ts +59 -0
  246. package/src/domains/session/continuity/contract.ts +592 -0
  247. package/src/domains/session/continuity/evidence.ts +290 -0
  248. package/src/domains/session/continuity/fold.ts +1075 -0
  249. package/src/domains/session/continuity/note.ts +79 -0
  250. package/src/domains/session/continuity/operator-request.ts +104 -0
  251. package/src/domains/session/continuity/persistence.ts +408 -0
  252. package/src/domains/session/continuity/ports.ts +231 -0
  253. package/src/domains/session/continuity/projection.ts +538 -0
  254. package/src/domains/session/continuity/validate.ts +352 -0
  255. package/src/domains/session/entries.ts +50 -3
  256. package/src/domains/session/index.ts +48 -0
  257. package/src/domains/session/migrations/index.ts +7 -3
  258. package/src/domains/session/tree/fork.ts +15 -1
  259. package/src/domains/session/usage.ts +2 -2
  260. package/src/engine/acp/commands.ts +1 -1
  261. package/src/engine/agent.ts +133 -9
  262. package/src/engine/session.ts +13 -6
  263. package/src/entry/orchestrator.ts +116 -33
  264. package/src/interactive/chat-loop-messages.ts +2 -2
  265. package/src/interactive/chat-loop.ts +219 -63
  266. package/src/interactive/chat-renderer.ts +99 -8
  267. package/src/interactive/context-overlay.ts +24 -3
  268. package/src/interactive/continuity-controller.ts +526 -0
  269. package/src/interactive/dispatch-board.ts +21 -3
  270. package/src/interactive/footer/dashboard.ts +25 -1
  271. package/src/interactive/footer/key-hints.ts +2 -2
  272. package/src/interactive/footer/pages.ts +70 -27
  273. package/src/interactive/footer/widgets.ts +32 -7
  274. package/src/interactive/footer-panel.ts +1 -1
  275. package/src/interactive/interactive-application.ts +7 -2
  276. package/src/interactive/interactive-input-runtime.ts +2 -2
  277. package/src/interactive/interactive-presentation.ts +15 -0
  278. package/src/interactive/interactive-slash-runtime.ts +45 -8
  279. package/src/interactive/interactive-tickers.ts +7 -1
  280. package/src/interactive/model-session-replay.ts +130 -3
  281. package/src/interactive/output-reserve.ts +35 -0
  282. package/src/interactive/overlay-general-openers.ts +12 -8
  283. package/src/interactive/overlay-key-routing.ts +6 -9
  284. package/src/interactive/overlay-lifecycle.ts +10 -6
  285. package/src/interactive/overlay-session-lifecycle.ts +21 -14
  286. package/src/interactive/quota-view.ts +229 -0
  287. package/src/interactive/session-last-turn.ts +1 -1
  288. package/src/interactive/session-transcript.ts +2 -1
  289. package/src/interactive/session-usage-reseed.ts +2 -2
  290. package/src/interactive/side-question.ts +2 -2
  291. package/src/interactive/slash-commands.ts +28 -9
  292. package/src/interactive/turn-context.ts +686 -63
  293. package/src/interactive/turn-middleware.ts +39 -6
  294. package/src/interactive/turn-persistence.ts +15 -2
  295. package/src/interactive/turn-prewarm.ts +1 -1
  296. package/src/interactive/turn-runtime.ts +48 -5
  297. package/src/interactive/{cost-overlay.ts → usage-overlay.ts} +121 -33
  298. package/src/interactive/welcome-dashboard.ts +26 -3
  299. package/src/tools/agent-tools.ts +3 -1
  300. package/src/tools/bootstrap.ts +6 -0
  301. package/src/tools/builtin-tool-catalog.ts +9 -0
  302. package/src/tools/context/index.ts +148 -113
  303. package/src/tools/context/surface.ts +11 -7
  304. package/src/tools/core-bootstrap.ts +4 -0
  305. package/src/tools/observation.ts +8 -2
  306. package/src/tools/policy.ts +3 -0
  307. package/src/tools/self-compact.ts +31 -0
  308. package/src/tools/surface.ts +1 -0
  309. package/src/tools/tasks.ts +1 -1
  310. package/dist/chunk-CTFPFW3H.js +0 -44
  311. package/dist/chunk-EOJPDNUP.js +0 -1325
  312. package/dist/chunk-I4Y4WKZR.js +0 -386
@@ -9,21 +9,21 @@ import {
9
9
  readGateDecisionArtifactsForRunIds,
10
10
  stagePendingGateDecision,
11
11
  verifyGateDecisionArtifact
12
- } from "./chunk-OV62D6KO.js";
12
+ } from "./chunk-KQMYL5GR.js";
13
13
  import {
14
14
  codeStepDir,
15
15
  writeCodeStepRecord
16
- } from "./chunk-I4ELN5BX.js";
16
+ } from "./chunk-ZTNOEJRI.js";
17
17
  import {
18
18
  captureWorkspaceCheckpoint,
19
19
  captureWorkspaceSnapshot,
20
20
  createWriteBoundaryEnforcer,
21
21
  workspaceCheckpointRef
22
- } from "./chunk-DXSETN72.js";
22
+ } from "./chunk-7WUGNN43.js";
23
23
  import {
24
24
  executionPlanAncestors,
25
25
  spliceExecutionPlan
26
- } from "./chunk-NFSK2VNU.js";
26
+ } from "./chunk-LZMTVVN4.js";
27
27
  import {
28
28
  formatTrustAxes,
29
29
  formatTrustSummary,
@@ -31,14 +31,14 @@ import {
31
31
  renderCodewikiDigest,
32
32
  sha256,
33
33
  trustVerdict
34
- } from "./chunk-OZ76TLGU.js";
34
+ } from "./chunk-EEITU7S6.js";
35
35
  import {
36
36
  protectedArtifactFromSessionEntry,
37
37
  protectedArtifactStateFromSessionEntries,
38
38
  readAuditRows,
39
39
  readSessionEntriesForId,
40
40
  responseModelIdObservationFromRecord
41
- } from "./chunk-EOJPDNUP.js";
41
+ } from "./chunk-GPTR6OTU.js";
42
42
  import {
43
43
  loadEvalArtifact,
44
44
  parseEvalArtifactV4,
@@ -51,7 +51,7 @@ import {
51
51
  import {
52
52
  parseRigorOverride,
53
53
  resolveRigor
54
- } from "./chunk-XMDBTYCH.js";
54
+ } from "./chunk-N3CWOGVF.js";
55
55
  import {
56
56
  defaultRunEventJournal,
57
57
  removeRunEventJournals
@@ -83,7 +83,7 @@ import {
83
83
  foldDecisionBoard,
84
84
  startDispatchEventPump,
85
85
  workerOutputCaptureBytes
86
- } from "./chunk-U5QU5ZOD.js";
86
+ } from "./chunk-XYPWFSU5.js";
87
87
  import {
88
88
  filterEntriesToActivePath
89
89
  } from "./chunk-O5F25NIE.js";
@@ -97,12 +97,12 @@ import {
97
97
  receiptAttestationFields,
98
98
  routeFactVerdict,
99
99
  spawnNativeWorker
100
- } from "./chunk-U6YTUVOX.js";
100
+ } from "./chunk-Q4RMNWMZ.js";
101
101
  import {
102
102
  JUDGED_CHECK_MAX_OUTPUT_BYTES,
103
103
  judgeNumericTexts,
104
104
  judgePerfTexts
105
- } from "./chunk-7RET77VB.js";
105
+ } from "./chunk-Q2HKY32Y.js";
106
106
  import {
107
107
  changedPathsSince,
108
108
  computeWikiContentHash,
@@ -165,10 +165,10 @@ import {
165
165
  isClaudeCanonicalTool,
166
166
  nodeResultContractFilesystem,
167
167
  serializeWorkerRuntimeDescriptor
168
- } from "./chunk-R7FGRZNF.js";
168
+ } from "./chunk-LXYHCCIZ.js";
169
169
  import {
170
170
  assessFinishContract
171
- } from "./chunk-DOUISWEE.js";
171
+ } from "./chunk-QOJ4ERMU.js";
172
172
  import {
173
173
  RUN_RECEIPT_INTEGRITY_ALGORITHM,
174
174
  RUN_RECEIPT_INTEGRITY_VERSION,
@@ -182,7 +182,7 @@ import {
182
182
  retiredIntegrityVersionOf,
183
183
  verifyReceiptIntegrity,
184
184
  withReceiptIntegrity
185
- } from "./chunk-VKHLUZNO.js";
185
+ } from "./chunk-UZ7YBL43.js";
186
186
  import {
187
187
  AGENT_LEDGER_PROMPT_MAX_CHARS,
188
188
  COUNCIL_MIN_MEMBERS,
@@ -217,7 +217,7 @@ import {
217
217
  toolPromptHintsForNames,
218
218
  turnAllowsTool,
219
219
  validateJobSpec
220
- } from "./chunk-OQ2EOAHA.js";
220
+ } from "./chunk-PF36KOGI.js";
221
221
  import {
222
222
  WORKER_CONTEXT_MAX_BYTES,
223
223
  completeHistoryLength,
@@ -240,7 +240,7 @@ import {
240
240
  routingIntentRejection,
241
241
  sameRouteIdentity,
242
242
  toRouteCandidate
243
- } from "./chunk-T33IYTZM.js";
243
+ } from "./chunk-SAASVMIY.js";
244
244
  import {
245
245
  isLoadableExtension
246
246
  } from "./chunk-OH3YYA3B.js";
@@ -254,7 +254,7 @@ import {
254
254
  import {
255
255
  applyToolProfile,
256
256
  assertToolProfileEnforceable
257
- } from "./chunk-XZWSP67B.js";
257
+ } from "./chunk-5APYAXCB.js";
258
258
  import {
259
259
  dispatchResultContract,
260
260
  gateRouteCorrelation,
@@ -262,7 +262,7 @@ import {
262
262
  requestExecutionRole,
263
263
  routeCorrelationFactsForRun,
264
264
  withAttemptRole
265
- } from "./chunk-BRCOSE7O.js";
265
+ } from "./chunk-SZUO5BSE.js";
266
266
  import {
267
267
  declaredScopeIntent,
268
268
  declaredScopeReplacementDiagnostic,
@@ -275,17 +275,17 @@ import {
275
275
  directSurfaceNames,
276
276
  effectiveToolCall,
277
277
  withGatewayForCapabilities
278
- } from "./chunk-DE2LU267.js";
278
+ } from "./chunk-KKAJGT3B.js";
279
279
  import {
280
280
  networkToolsDisabled
281
- } from "./chunk-KBUTSJSR.js";
281
+ } from "./chunk-4XBYHXGK.js";
282
282
  import {
283
283
  compileGlobRegex,
284
284
  normalizeGlobInput
285
285
  } from "./chunk-DZLR4UEH.js";
286
286
  import {
287
287
  WRITE_ROOT_REFUSED_TOOLS
288
- } from "./chunk-733ZBT5P.js";
288
+ } from "./chunk-E74MJF6G.js";
289
289
  import {
290
290
  TOOL_RESULT_TRUST_CONTRACT
291
291
  } from "./chunk-WXA2CFJO.js";
@@ -307,7 +307,7 @@ import {
307
307
  resolveRuntimeTarget,
308
308
  runtimeResolutionWarnings,
309
309
  runtimeTargetSnapshot
310
- } from "./chunk-EYTLV3W3.js";
310
+ } from "./chunk-HTWTORF7.js";
311
311
  import {
312
312
  isDispatchEligibleRuntime
313
313
  } from "./chunk-6EJYVCTN.js";
@@ -322,7 +322,7 @@ import {
322
322
  import {
323
323
  ceilChars,
324
324
  estimateAgentMessageTokens
325
- } from "./chunk-6W75D37F.js";
325
+ } from "./chunk-53P775GE.js";
326
326
  import {
327
327
  targetRequiresAuth
328
328
  } from "./chunk-Z4GLJ6J4.js";
@@ -334,9 +334,8 @@ import {
334
334
  } from "./chunk-L7G7K4I2.js";
335
335
  import {
336
336
  decisionRef,
337
- isDecisionRecord,
338
- isSkillActivation
339
- } from "./chunk-I4Y4WKZR.js";
337
+ isDecisionRecord
338
+ } from "./chunk-F6KCJO3U.js";
340
339
  import {
341
340
  DEFAULT_AUTONOMY_LEVEL,
342
341
  autonomyDenyRejection,
@@ -344,6 +343,9 @@ import {
344
343
  mapAutonomy,
345
344
  modelMayActivateSkills
346
345
  } from "./chunk-UZVYEF57.js";
346
+ import {
347
+ isSkillActivation
348
+ } from "./chunk-MMZMM6SW.js";
347
349
  import {
348
350
  createRedactionTally,
349
351
  redactSecretsDeep,
@@ -351,7 +353,7 @@ import {
351
353
  } from "./chunk-O3VV6IVK.js";
352
354
  import {
353
355
  atomicWrite
354
- } from "./chunk-EKV4UBCM.js";
356
+ } from "./chunk-PZBQUJ2F.js";
355
357
  import {
356
358
  assertSafeId
357
359
  } from "./chunk-UHW5V7HC.js";
@@ -370,16 +372,16 @@ import {
370
372
  resultContractAuthorship,
371
373
  validateRecipeResult,
372
374
  validateStructuredHelperResult
373
- } from "./chunk-LNOXCGN2.js";
375
+ } from "./chunk-7UFDIOBT.js";
374
376
  import {
375
377
  INTEROP_AGENT_KINDS
376
378
  } from "./chunk-5EQO5NWP.js";
377
379
  import {
378
380
  classify
379
- } from "./chunk-VYRQHORQ.js";
381
+ } from "./chunk-NMQSO6Z6.js";
380
382
  import {
381
383
  detectValidationCommand
382
- } from "./chunk-P4GNZPXO.js";
384
+ } from "./chunk-OYUS3UZP.js";
383
385
  import {
384
386
  PATH_BOUNDARY_MAX_ENTRIES,
385
387
  pathBoundaryCovers,
@@ -396,7 +398,7 @@ import {
396
398
  ToolNames,
397
399
  isBuiltinToolName,
398
400
  isHarnessExtensionToolName
399
- } from "./chunk-V4XJWDHR.js";
401
+ } from "./chunk-6UKFRTXI.js";
400
402
  import {
401
403
  DEFAULT_DELEGATION_CONNECT_TIMEOUT_MS,
402
404
  DEFAULT_DELEGATION_TURN_TIMEOUT_MS,
@@ -797,13 +799,13 @@ function normalizeRuleKey(text) {
797
799
  return text.toLowerCase().replace(/`([^`]+)`/g, "$1").replace(/[^a-z0-9.+:#/-]+/g, " ").replace(/\s+/g, " ").trim().replace(/[.!?]+$/, "");
798
800
  }
799
801
  function classifyConflict(text) {
800
- const normalized = text.toLowerCase().replace(/`/g, "");
802
+ const normalized2 = text.toLowerCase().replace(/`/g, "");
801
803
  const packageManager2 = /\b(?:always\s+|must\s+|should\s+|prefer\s+|use\s+|run\s+)*(?:use|prefer|run)\s+(pnpm|npm|yarn|bun)\b/.exec(
802
- normalized
804
+ normalized2
803
805
  );
804
806
  if (packageManager2?.[1]) return { key: "package-manager", value: packageManager2[1] };
805
807
  const testRunner = /\b(?:always\s+|must\s+|should\s+|prefer\s+|use\s+|run\s+)*(?:use|prefer|run)\s+(node:test|vitest|jest|pytest|cargo test|go test)\b/.exec(
806
- normalized
808
+ normalized2
807
809
  );
808
810
  if (testRunner?.[1]) return { key: "test-runner", value: testRunner[1] };
809
811
  return void 0;
@@ -841,8 +843,8 @@ function buildImportPlan(sources) {
841
843
  const byConflictKey = /* @__PURE__ */ new Map();
842
844
  const conflicts = /* @__PURE__ */ new Map();
843
845
  for (const candidate of candidates) {
844
- const normalized = normalizeRuleKey(candidate.text);
845
- const existing = byNormalizedText.get(normalized);
846
+ const normalized2 = normalizeRuleKey(candidate.text);
847
+ const existing = byNormalizedText.get(normalized2);
846
848
  if (existing) {
847
849
  if (!existing.sources.includes(candidate.source.displayPath)) existing.sources.push(candidate.source.displayPath);
848
850
  if (!existing.providers.includes(candidate.source.providerLabel))
@@ -884,7 +886,7 @@ function buildImportPlan(sources) {
884
886
  ...candidate.conflict ? { conflictKey: candidate.conflict.key } : {}
885
887
  };
886
888
  accepted.push(rule);
887
- byNormalizedText.set(normalized, rule);
889
+ byNormalizedText.set(normalized2, rule);
888
890
  if (candidate.conflict) byConflictKey.set(candidate.conflict.key, { value: candidate.conflict.value, rule });
889
891
  if (accepted.length >= MAX_IMPORTED_RULES) break;
890
892
  }
@@ -1306,9 +1308,9 @@ function parseNumbered(section) {
1306
1308
  return section.split("\n").map((line) => /^\d+\.\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((line) => Boolean(line));
1307
1309
  }
1308
1310
  function parseClioMd(source) {
1309
- const normalized = normalizeSource(source);
1311
+ const normalized2 = normalizeSource(source);
1310
1312
  const warnings = [];
1311
- const footerResult = parseFooter(normalized);
1313
+ const footerResult = parseFooter(normalized2);
1312
1314
  warnings.push(...footerResult.warnings);
1313
1315
  if (footerResult.errors.length > 0) return { ok: false, errors: footerResult.errors, warnings };
1314
1316
  const h1Matches = [...maskNonHeadingRegions(footerResult.body).matchAll(H1_RE)];
@@ -3215,25 +3217,25 @@ function ruleMatchesAnyPath(rule, workingPaths) {
3215
3217
  continue;
3216
3218
  }
3217
3219
  for (const path2 of workingPaths) {
3218
- const normalized = normalizeGlobInput(path2);
3219
- if (regex.test(normalized)) return true;
3220
- if (normalized.endsWith("/") && globMatchesInsideDirectory(regex, pattern, normalized)) return true;
3220
+ const normalized2 = normalizeGlobInput(path2);
3221
+ if (regex.test(normalized2)) return true;
3222
+ if (normalized2.endsWith("/") && globMatchesInsideDirectory(regex, pattern, normalized2)) return true;
3221
3223
  }
3222
3224
  }
3223
3225
  return false;
3224
3226
  }
3225
3227
  function materializedGlobVariants(pattern) {
3226
3228
  let variants = [""];
3227
- const normalized = normalizeGlobInput(pattern);
3228
- for (let index = 0; index < normalized.length; index += 1) {
3229
- const character = normalized[index];
3229
+ const normalized2 = normalizeGlobInput(pattern);
3230
+ for (let index = 0; index < normalized2.length; index += 1) {
3231
+ const character = normalized2[index];
3230
3232
  if (character === void 0) break;
3231
- if (character === "*" && normalized[index + 1] === "*" && normalized[index + 2] === "/") {
3233
+ if (character === "*" && normalized2[index + 1] === "*" && normalized2[index + 2] === "/") {
3232
3234
  variants = variants.flatMap((prefix) => [prefix, `${prefix}x/`]).slice(0, 64);
3233
3235
  index += 2;
3234
3236
  continue;
3235
3237
  }
3236
- if (character === "*" && normalized[index + 1] === "*") {
3238
+ if (character === "*" && normalized2[index + 1] === "*") {
3237
3239
  variants = variants.map((prefix) => `${prefix}x`);
3238
3240
  index += 1;
3239
3241
  continue;
@@ -3243,8 +3245,8 @@ function materializedGlobVariants(pattern) {
3243
3245
  continue;
3244
3246
  }
3245
3247
  if (character === "[") {
3246
- const end = normalized.indexOf("]", index + 1);
3247
- const selected = end === -1 ? "x" : normalized[index + 1] ?? "x";
3248
+ const end = normalized2.indexOf("]", index + 1);
3249
+ const selected = end === -1 ? "x" : normalized2[index + 1] ?? "x";
3248
3250
  variants = variants.map((prefix) => `${prefix}${selected}`);
3249
3251
  index = end === -1 ? index : end;
3250
3252
  continue;
@@ -4224,7 +4226,8 @@ import { isAbsolute as isAbsolute3 } from "node:path";
4224
4226
 
4225
4227
  // src/domains/memory/store.ts
4226
4228
  init_esm_shims();
4227
- import { readFileSync as readFileSync10 } from "node:fs";
4229
+ import { createHash as createHash5 } from "node:crypto";
4230
+ import { closeSync as closeSync2, openSync as openSync2, readFileSync as readFileSync10, readSync } from "node:fs";
4228
4231
  import { readFile } from "node:fs/promises";
4229
4232
  import { join as join10 } from "node:path";
4230
4233
 
@@ -4626,6 +4629,35 @@ function compareStrings(a, b) {
4626
4629
  var MEMORY_STORE_MAX_RECORDS = 500;
4627
4630
  var MEMORY_STALE_APPROVED_DAYS = 180;
4628
4631
  var MEMORY_STALE_UNAPPROVED_DAYS = 30;
4632
+ var MEMORY_PROMPT_STORE_MAX_BYTES = 16 * 1024 * 1024;
4633
+ function readMemoryStoreSnapshot(dataDir) {
4634
+ const path2 = memoryStorePath(dataDir);
4635
+ let fd;
4636
+ try {
4637
+ fd = openSync2(path2, "r");
4638
+ } catch (error) {
4639
+ if (isErrorWithCode(error) && error.code === "ENOENT") return { revision: "missing", records: [] };
4640
+ throw error;
4641
+ }
4642
+ const chunks = [];
4643
+ let total = 0;
4644
+ try {
4645
+ while (true) {
4646
+ const chunk = Buffer.allocUnsafe(Math.min(64 * 1024, MEMORY_PROMPT_STORE_MAX_BYTES + 1 - total));
4647
+ const count = readSync(fd, chunk);
4648
+ if (count === 0) break;
4649
+ total += count;
4650
+ if (total > MEMORY_PROMPT_STORE_MAX_BYTES) throw new Error("memory prompt store exceeds read ceiling");
4651
+ chunks.push(chunk.subarray(0, count));
4652
+ }
4653
+ } finally {
4654
+ closeSync2(fd);
4655
+ }
4656
+ const raw = Buffer.concat(chunks);
4657
+ const records = parseAndValidate(raw.toString("utf8"), path2);
4658
+ if (records.length > MEMORY_STORE_MAX_RECORDS) throw new Error("memory prompt store exceeds record limit");
4659
+ return { revision: createHash5("sha256").update(raw).digest("hex"), records };
4660
+ }
4629
4661
  function memoryRoot(dataDir) {
4630
4662
  return join10(dataDir, "memory");
4631
4663
  }
@@ -4764,37 +4796,12 @@ async function rejectMemoryRecord(dataDir, memoryId, now = /* @__PURE__ */ new D
4764
4796
  async function pruneStaleMemory(dataDir, now = /* @__PURE__ */ new Date()) {
4765
4797
  return pruneStaleMemoryRecords(dataDir, now);
4766
4798
  }
4767
- function selectApprovedMemory(records, options) {
4768
- if (options.tokenBudget <= 0) return [];
4799
+ function eligibleMemoryRecords(records, options) {
4769
4800
  const allowedScopes = options.scopes === void 0 ? null : new Set(options.scopes);
4770
4801
  const activeRepository = canonicalActiveRepository(options.activeRepository);
4771
4802
  const activeRuntime = validActiveNamedIdentity(options.activeRuntime, "runtime");
4772
4803
  const activeAgent = validActiveNamedIdentity(options.activeAgent, "agent");
4773
- const candidates = sortMemoryRecords(records).filter((record) => record.approved).filter((record) => record.evidenceRefs.length > 0).filter((record) => record.regressions === void 0 || record.regressions.length === 0).filter((record) => allowedScopes === null || allowedScopes.has(record.scope)).filter((record) => repositoryApplies(record, activeRepository)).filter((record) => runtimeApplies(record, activeRuntime)).filter((record) => agentApplies(record, activeAgent)).sort(compareRetrievalPriority);
4774
- const selected = [];
4775
- let spent = 0;
4776
- for (const record of candidates) {
4777
- const cost = estimateMemoryTokens(record);
4778
- if (spent + cost > options.tokenBudget) continue;
4779
- selected.push(record);
4780
- spent += cost;
4781
- }
4782
- return selected;
4783
- }
4784
- function estimateMemoryTokens(record) {
4785
- const text = [
4786
- record.scope,
4787
- record.key,
4788
- record.lesson,
4789
- ...record.repository === void 0 ? [] : [record.repository.kind, record.repository.key],
4790
- ...record.runtime === void 0 ? [] : [record.runtime.kind, record.runtime.key],
4791
- ...record.agent === void 0 ? [] : [record.agent.kind, record.agent.key],
4792
- ...record.evidenceRefs,
4793
- ...record.appliesWhen,
4794
- ...record.avoidWhen,
4795
- ...record.regressions ?? []
4796
- ].join("\n");
4797
- return Math.max(1, ceilChars(text.length));
4804
+ return sortMemoryRecords(records).filter((record) => record.approved).filter((record) => record.evidenceRefs.length > 0).filter((record) => record.regressions === void 0 || record.regressions.length === 0).filter((record) => allowedScopes === null || allowedScopes.has(record.scope)).filter((record) => repositoryApplies(record, activeRepository)).filter((record) => runtimeApplies(record, activeRuntime)).filter((record) => agentApplies(record, activeAgent)).sort(compareRetrievalPriority);
4798
4805
  }
4799
4806
  function cloneRecord(record) {
4800
4807
  const next = {
@@ -4888,7 +4895,7 @@ function compareRetrievalPriority(left, right) {
4888
4895
 
4889
4896
  // src/domains/memory/promotion.ts
4890
4897
  init_esm_shims();
4891
- import { createHash as createHash5 } from "node:crypto";
4898
+ import { createHash as createHash6 } from "node:crypto";
4892
4899
  function validateMemoryScopeSelection(selection, source) {
4893
4900
  switch (selection.scope) {
4894
4901
  case "repo": {
@@ -5058,7 +5065,7 @@ function scopeApplicability(selection) {
5058
5065
  }
5059
5066
  }
5060
5067
  function promotedMemoryId(value) {
5061
- const digest = createHash5("sha256").update(JSON.stringify(value), "utf8").digest("hex").slice(0, 16);
5068
+ const digest = createHash6("sha256").update(JSON.stringify(value), "utf8").digest("hex").slice(0, 16);
5062
5069
  return `mem-${digest}`;
5063
5070
  }
5064
5071
  function uniqueStrings(values) {
@@ -5083,22 +5090,88 @@ function compareStrings2(left, right) {
5083
5090
 
5084
5091
  // src/domains/memory/prompt-section.ts
5085
5092
  init_esm_shims();
5093
+
5094
+ // src/domains/memory/relevance.ts
5095
+ init_esm_shims();
5096
+ var MEMORY_RELEVANCE_VERSION = "lexical-v1";
5097
+ var MEMORY_RELEVANCE_WEIGHTS = { taskTerm: 1, path: 8, symbol: 4 };
5098
+ var STOP_WORDS = /* @__PURE__ */ new Set(["and", "are", "for", "from", "into", "the", "this", "that", "with", "use", "when"]);
5099
+ function normalized(value) {
5100
+ return value.normalize("NFKC").toLowerCase();
5101
+ }
5102
+ function terms(value) {
5103
+ return [...new Set(normalized(value.replace(/([a-z])([A-Z])/g, "$1 $2")).match(/[\p{L}\p{N}]+/gu) ?? [])].filter(
5104
+ (term) => term.length >= 2 && !STOP_WORDS.has(term)
5105
+ );
5106
+ }
5107
+ function pathKey(value) {
5108
+ return normalized(value).replaceAll("\\", "/").replace(/^\.\//, "");
5109
+ }
5110
+ function rankMemoryByRelevance(records, options, input) {
5111
+ const taskTerms = terms(input.taskText).slice(0, 64);
5112
+ const paths = [...new Set((input.activePaths ?? []).map(pathKey).filter(Boolean))].slice(0, 32);
5113
+ const symbols = [...new Set((input.activeSymbols ?? []).map(normalized).filter(Boolean))].slice(0, 32);
5114
+ const candidates = eligibleMemoryRecords(records, options).map((record) => {
5115
+ const text = [record.key, record.lesson, ...record.appliesWhen].join("\n");
5116
+ const textTerms = new Set(terms(text));
5117
+ const textPaths = new Set(
5118
+ (text.match(/[\p{L}\p{N}_./\\:-]+/gu) ?? []).map((path2) => pathKey(path2.replace(/[.:]+$/, "")))
5119
+ );
5120
+ const textSymbols = new Set(normalized(text).match(/[\p{L}\p{N}_$]+/gu) ?? []);
5121
+ const matches = {
5122
+ taskTerms: taskTerms.filter((term) => textTerms.has(term)),
5123
+ paths: paths.filter((path2) => textPaths.has(path2)),
5124
+ symbols: symbols.filter((symbol) => textSymbols.has(symbol))
5125
+ };
5126
+ return {
5127
+ record,
5128
+ matches,
5129
+ fallback: false,
5130
+ score: matches.taskTerms.length * MEMORY_RELEVANCE_WEIGHTS.taskTerm + matches.paths.length * MEMORY_RELEVANCE_WEIGHTS.path + matches.symbols.length * MEMORY_RELEVANCE_WEIGHTS.symbol
5131
+ };
5132
+ });
5133
+ candidates.sort((a, b) => b.score - a.score);
5134
+ if ((candidates[0]?.score ?? 0) > 0) {
5135
+ const fallbackIndex = candidates.findIndex((candidate) => candidate.score === 0);
5136
+ if (fallbackIndex >= 0) {
5137
+ const [fallback] = candidates.splice(fallbackIndex, 1);
5138
+ if (fallback !== void 0) candidates.splice(1, 0, { ...fallback, fallback: true });
5139
+ }
5140
+ }
5141
+ return candidates;
5142
+ }
5143
+
5144
+ // src/domains/memory/prompt-section.ts
5086
5145
  var MEMORY_PROMPT_DEFAULT_TOKEN_BUDGET = 400;
5087
5146
  var MEMORY_PROMPT_DEFAULT_MAX_ITEMS = 5;
5088
5147
  var MEMORY_PROMPT_DEFAULT_SCOPES = ["global", "repo"];
5089
5148
  function selectMemoryForPrompt(records, options = {}) {
5149
+ return inspectMemoryPromptSelection(records, options).records;
5150
+ }
5151
+ function inspectMemoryPromptSelection(records, options = {}) {
5090
5152
  const scopes = options.scopes ?? MEMORY_PROMPT_DEFAULT_SCOPES;
5091
5153
  const tokenBudget = options.tokenBudget ?? MEMORY_PROMPT_DEFAULT_TOKEN_BUDGET;
5092
5154
  const maxItems = options.maxItems ?? MEMORY_PROMPT_DEFAULT_MAX_ITEMS;
5093
- if (tokenBudget <= 0 || maxItems <= 0) return [];
5094
- const selected = selectApprovedMemory(records, {
5155
+ if (!Number.isFinite(tokenBudget) || !Number.isFinite(maxItems) || tokenBudget <= 0 || maxItems < 1)
5156
+ return { records: [], decisions: [] };
5157
+ const eligibility = {
5095
5158
  scopes,
5096
- tokenBudget,
5097
5159
  activeRepository: options.activeRepository ?? null,
5098
5160
  activeRuntime: options.activeRuntime ?? null,
5099
5161
  activeAgent: options.activeAgent ?? null
5100
- });
5101
- return selected.slice(0, maxItems);
5162
+ };
5163
+ const candidates = options.relevance === void 0 ? eligibleMemoryRecords(records, eligibility).map((record) => ({ record, relevance: void 0 })) : rankMemoryByRelevance(records, eligibility, options.relevance).map(({ record, ...relevance }) => ({
5164
+ record,
5165
+ relevance
5166
+ }));
5167
+ const selected = [];
5168
+ const decisions = [];
5169
+ for (const { record, relevance } of candidates) {
5170
+ const reason = selected.length >= Math.floor(maxItems) ? "item-limit" : ceilChars(renderMemoryPromptSection([...selected, record]).length) > tokenBudget ? "token-budget" : "selected";
5171
+ decisions.push({ id: record.id, reason, ...relevance === void 0 ? {} : { relevance } });
5172
+ if (reason === "selected") selected.push(record);
5173
+ }
5174
+ return { records: selected, decisions };
5102
5175
  }
5103
5176
  function renderMemoryPromptSection(records) {
5104
5177
  if (records.length === 0) return "";
@@ -5112,9 +5185,14 @@ function renderMemoryPromptSection(records) {
5112
5185
  const lesson = record.lesson.replace(/\s+/g, " ").trim();
5113
5186
  const evidence = record.evidenceRefs.join(", ");
5114
5187
  lines.push(`- [${record.id}] (${renderApplicability(record)}) ${lesson} Evidence: ${evidence}.`);
5188
+ if (record.appliesWhen.length > 0) lines.push(` Applies when: ${record.appliesWhen.map(compactText).join("; ")}.`);
5189
+ if (record.avoidWhen.length > 0) lines.push(` Avoid when: ${record.avoidWhen.map(compactText).join("; ")}.`);
5115
5190
  }
5116
5191
  return lines.join("\n");
5117
5192
  }
5193
+ function compactText(value) {
5194
+ return value.replace(/\s+/g, " ").trim();
5195
+ }
5118
5196
  function renderApplicability(record) {
5119
5197
  if (record.scope === "repo") {
5120
5198
  if (record.repository !== void 0) {
@@ -5133,13 +5211,13 @@ function renderApplicability(record) {
5133
5211
  function buildMemoryPromptSection(records, options = {}) {
5134
5212
  const selected = selectMemoryForPrompt(records, options);
5135
5213
  const section = renderMemoryPromptSection(selected);
5136
- const tokens2 = selected.reduce((acc, record) => acc + estimateMemoryTokens(record), 0);
5214
+ const tokens2 = ceilChars(section.length);
5137
5215
  return { section, records: selected, tokens: tokens2 };
5138
5216
  }
5139
5217
 
5140
5218
  // src/domains/memory/proposal.ts
5141
5219
  init_esm_shims();
5142
- import { createHash as createHash16 } from "node:crypto";
5220
+ import { createHash as createHash17 } from "node:crypto";
5143
5221
 
5144
5222
  // src/domains/evidence/index.ts
5145
5223
  init_esm_shims();
@@ -5308,7 +5386,7 @@ function persistWorkerContextSeed(input) {
5308
5386
  }
5309
5387
 
5310
5388
  // src/domains/dispatch/extension.ts
5311
- import { createHash as createHash13, randomBytes as randomBytes5 } from "node:crypto";
5389
+ import { createHash as createHash14, randomBytes as randomBytes5 } from "node:crypto";
5312
5390
  import { readdirSync as readdirSync8, readFileSync as readFileSync22 } from "node:fs";
5313
5391
  import { isAbsolute as isAbsolute6, relative as relative6, resolve as resolvePath, sep as sep3 } from "node:path";
5314
5392
  import { performance as performance4 } from "node:perf_hooks";
@@ -6481,7 +6559,7 @@ function toolSurfaceHasTool(toolNames, tool) {
6481
6559
  return names.has(tool);
6482
6560
  }
6483
6561
  function canonicalToolPromptHints(entries, admitted) {
6484
- const normalized = entries.map((entry) => ({
6562
+ const normalized2 = entries.map((entry) => ({
6485
6563
  tool: entry.tool.trim(),
6486
6564
  hint: normalizePromptHint(entry.hint) ?? ""
6487
6565
  })).filter((entry) => admitted.has(entry.tool) && entry.hint.length > 0).sort((a, b) => {
@@ -6490,7 +6568,7 @@ function canonicalToolPromptHints(entries, admitted) {
6490
6568
  });
6491
6569
  const seenTools = /* @__PURE__ */ new Set();
6492
6570
  const seenHints = /* @__PURE__ */ new Set();
6493
- return normalized.filter((entry) => {
6571
+ return normalized2.filter((entry) => {
6494
6572
  if (seenTools.has(entry.tool) || seenHints.has(entry.hint)) return false;
6495
6573
  seenTools.add(entry.tool);
6496
6574
  seenHints.add(entry.hint);
@@ -8317,7 +8395,7 @@ init_esm_shims();
8317
8395
 
8318
8396
  // src/domains/dispatch/agent-ledger-store.ts
8319
8397
  init_esm_shims();
8320
- import { createHash as createHash6 } from "node:crypto";
8398
+ import { createHash as createHash7 } from "node:crypto";
8321
8399
  import { existsSync as existsSync9, readFileSync as readFileSync13 } from "node:fs";
8322
8400
  import { join as join14 } from "node:path";
8323
8401
  var MAX_AGENT_LEDGER_RECORDS = 50;
@@ -8456,7 +8534,7 @@ function agentLedgerContribution(id, runId) {
8456
8534
  if (record === null) return null;
8457
8535
  const contribution = contributionFor(record, runId);
8458
8536
  const mine = record.entries.filter((entry) => entry.runId === runId).sort((left, right) => left.sequence - right.sequence);
8459
- const digest = createHash6("sha256").update(`clio-coder.agentLedger:${canonicalJson(mine)}`, "utf8").digest("hex");
8537
+ const digest = createHash7("sha256").update(`clio-coder.agentLedger:${canonicalJson(mine)}`, "utf8").digest("hex");
8460
8538
  return { posted: contribution.posted, refused: contribution.refused, digest };
8461
8539
  }
8462
8540
 
@@ -8951,7 +9029,7 @@ function assessCapabilityMismatch(input) {
8951
9029
 
8952
9030
  // src/domains/dispatch/checkout-writer-lease.ts
8953
9031
  init_esm_shims();
8954
- import { createHash as createHash7 } from "node:crypto";
9032
+ import { createHash as createHash8 } from "node:crypto";
8955
9033
  import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync16, realpathSync as realpathSync2, unlinkSync } from "node:fs";
8956
9034
  import { dirname as dirname6, join as join17 } from "node:path";
8957
9035
  var held = /* @__PURE__ */ new Map();
@@ -8961,7 +9039,7 @@ function canonicalCheckout(checkout) {
8961
9039
  }
8962
9040
  function checkoutWriterLeasePath(checkout) {
8963
9041
  const canonical = canonicalCheckout(checkout);
8964
- const key = createHash7("sha256").update(canonical, "utf8").digest("hex");
9042
+ const key = createHash8("sha256").update(canonical, "utf8").digest("hex");
8965
9043
  return join17(clioStateDir(), "checkout-writer-leases", `${key}.json`);
8966
9044
  }
8967
9045
  function validRecord3(value) {
@@ -9183,14 +9261,14 @@ function classifyHeartbeat(heartbeatMonotonicAt2, monotonicNow, spec) {
9183
9261
  // src/domains/dispatch/host-verification.ts
9184
9262
  init_esm_shims();
9185
9263
  import { execFileSync as execFileSync3 } from "node:child_process";
9186
- import { createHash as createHash9, randomUUID as randomUUID2 } from "node:crypto";
9264
+ import { createHash as createHash10, randomUUID as randomUUID2 } from "node:crypto";
9187
9265
  import { existsSync as existsSync13, mkdirSync as mkdirSync6, readFileSync as readFileSync17, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
9188
9266
  import { dirname as dirname7, join as join19, resolve as resolve9 } from "node:path";
9189
9267
 
9190
9268
  // src/domains/dispatch/code-step.ts
9191
9269
  init_esm_shims();
9192
9270
  import { execFileSync as execFileSync2, spawn } from "node:child_process";
9193
- import { createHash as createHash8 } from "node:crypto";
9271
+ import { createHash as createHash9 } from "node:crypto";
9194
9272
  import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync3 } from "node:fs";
9195
9273
  import { isAbsolute as isAbsolute5, join as join18, resolve as resolve8 } from "node:path";
9196
9274
  var CODE_STEP_CAPTURE_MAX_BYTES = 1048576;
@@ -9210,10 +9288,10 @@ function canonicalCodeReport(report) {
9210
9288
  });
9211
9289
  }
9212
9290
  function codeReportDigest(report) {
9213
- return createHash8("sha256").update(canonicalCodeReport(report), "utf8").digest("hex");
9291
+ return createHash9("sha256").update(canonicalCodeReport(report), "utf8").digest("hex");
9214
9292
  }
9215
9293
  function sha2563(value) {
9216
- return createHash8("sha256").update(value, "utf8").digest("hex");
9294
+ return createHash9("sha256").update(value, "utf8").digest("hex");
9217
9295
  }
9218
9296
  function tailUtf8(value, limit, marker) {
9219
9297
  if (value.length <= limit) return { text: value.toString("utf8"), truncated: false };
@@ -9263,7 +9341,7 @@ function workspaceHasChanges(root) {
9263
9341
  return status.trim().length > 0;
9264
9342
  }
9265
9343
  function newCodeRunId() {
9266
- return `code-${createHash8("sha256").update(`${process.pid}:${Date.now()}:${Math.random()}`).digest("hex").slice(0, 12)}`;
9344
+ return `code-${createHash9("sha256").update(`${process.pid}:${Date.now()}:${Math.random()}`).digest("hex").slice(0, 12)}`;
9267
9345
  }
9268
9346
  async function spawnCommand(input, cwd, argv) {
9269
9347
  const command = input.command;
@@ -9442,7 +9520,7 @@ var HTTP_URL_RE = /\bhttps?:\/\/\S+/gu;
9442
9520
  var CHECK_OUTPUT_PATH_RE = /\/?(?:[A-Za-z0-9_.@+-]+\/)+[A-Za-z0-9_.@+-]*\.(?:[cm]?[jt]sx?|json|ya?ml|md|txt|py|go|rs|c|h|cc|cpp|hpp|java|rb|sh|toml|css|html|sql)\b/gu;
9443
9521
  var IMPLICATED_PATH_CAP = PATH_BOUNDARY_MAX_ENTRIES;
9444
9522
  function sha2564(value) {
9445
- return createHash9("sha256").update(value, "utf8").digest("hex");
9523
+ return createHash10("sha256").update(value, "utf8").digest("hex");
9446
9524
  }
9447
9525
  function outputTail(value) {
9448
9526
  const bytes = Buffer.from(value, "utf8");
@@ -10487,7 +10565,7 @@ function createFleetPlacementPreviewResolver(deps) {
10487
10565
 
10488
10566
  // src/domains/dispatch/receipt-findings.ts
10489
10567
  init_esm_shims();
10490
- import { createHash as createHash10 } from "node:crypto";
10568
+ import { createHash as createHash11 } from "node:crypto";
10491
10569
  function lower(value) {
10492
10570
  return (value ?? "").toLowerCase();
10493
10571
  }
@@ -10509,12 +10587,12 @@ function canonicalJson2(value) {
10509
10587
  throw new Error(`response schema digest cannot represent ${typeof value}`);
10510
10588
  }
10511
10589
  function canonicalResponseSchemaDigest(schema) {
10512
- return createHash10("sha256").update(canonicalJson2(schema), "utf8").digest("hex");
10590
+ return createHash11("sha256").update(canonicalJson2(schema), "utf8").digest("hex");
10513
10591
  }
10514
10592
  function typedValidationFactsFromToolStats(toolStats) {
10515
10593
  return toolStats.filter((stat) => stat.tool === "verify" && stat.count > 0).map((stat) => ({
10516
10594
  sourceId: "tool:verify",
10517
- validatorDigest: createHash10("sha256").update(canonicalJson2(stat), "utf8").digest("hex"),
10595
+ validatorDigest: createHash11("sha256").update(canonicalJson2(stat), "utf8").digest("hex"),
10518
10596
  passed: stat.ok === stat.count && stat.errors === 0 && stat.blocked === 0
10519
10597
  }));
10520
10598
  }
@@ -10678,7 +10756,7 @@ function selectApprovedRecoveryCandidates(input) {
10678
10756
  // src/domains/dispatch/reproducibility.ts
10679
10757
  init_esm_shims();
10680
10758
  import { spawnSync } from "node:child_process";
10681
- import { createHash as createHash11 } from "node:crypto";
10759
+ import { createHash as createHash12 } from "node:crypto";
10682
10760
  function collectReproducibilityMetadata(cwd, safety) {
10683
10761
  const branch = git(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
10684
10762
  const commit = git(cwd, ["rev-parse", "HEAD"]);
@@ -10715,7 +10793,7 @@ function git(cwd, args) {
10715
10793
  return trimmed.length > 0 ? trimmed : null;
10716
10794
  }
10717
10795
  function sha2565(input) {
10718
- return createHash11("sha256").update(input, "utf8").digest("hex");
10796
+ return createHash12("sha256").update(input, "utf8").digest("hex");
10719
10797
  }
10720
10798
 
10721
10799
  // src/domains/dispatch/route-observer.ts
@@ -10891,7 +10969,7 @@ function isPhaseTiming(value) {
10891
10969
 
10892
10970
  // src/domains/dispatch/route-quality.ts
10893
10971
  init_esm_shims();
10894
- import { createHash as createHash12 } from "node:crypto";
10972
+ import { createHash as createHash13 } from "node:crypto";
10895
10973
  function compareStrings3(left, right) {
10896
10974
  return left < right ? -1 : left > right ? 1 : 0;
10897
10975
  }
@@ -11006,7 +11084,7 @@ function reduceRouteQuality(input) {
11006
11084
  return { label, checks, correlatedGates, sourceDigests: [...sourceDigests].sort(compareStrings3) };
11007
11085
  }
11008
11086
  function routeQualityEvalDigest(artifact) {
11009
- return createHash12("sha256").update(canonicalJson3(artifact), "utf8").digest("hex");
11087
+ return createHash13("sha256").update(canonicalJson3(artifact), "utf8").digest("hex");
11010
11088
  }
11011
11089
  function canonicalJson3(value) {
11012
11090
  if (value === null) return "null";
@@ -11356,19 +11434,19 @@ function isRecord9(value) {
11356
11434
  return typeof value === "object" && value !== null && !Array.isArray(value);
11357
11435
  }
11358
11436
  function eventDetail(event) {
11359
- const normalized = isRecord9(event) ? normalizeClioCoderEventRecord(event) : event;
11360
- const text = assistantTextFromEvent(normalized);
11437
+ const normalized2 = isRecord9(event) ? normalizeClioCoderEventRecord(event) : event;
11438
+ const text = assistantTextFromEvent(normalized2);
11361
11439
  if (text.length > 0) return truncateUtf8(text, RUN_TAIL_TEXT_LIMIT, "...");
11362
- if (!isRecord9(normalized)) return void 0;
11363
- if (normalized.type === "clio_coder_tool_finish" && isRecord9(normalized.payload)) {
11364
- const tool = typeof normalized.payload.tool === "string" ? normalized.payload.tool : "tool";
11365
- const outcome = typeof normalized.payload.outcome === "string" ? normalized.payload.outcome : "";
11440
+ if (!isRecord9(normalized2)) return void 0;
11441
+ if (normalized2.type === "clio_coder_tool_finish" && isRecord9(normalized2.payload)) {
11442
+ const tool = typeof normalized2.payload.tool === "string" ? normalized2.payload.tool : "tool";
11443
+ const outcome = typeof normalized2.payload.outcome === "string" ? normalized2.payload.outcome : "";
11366
11444
  return `${tool} ${outcome}`.trim();
11367
11445
  }
11368
- if (normalized.type === "attempt_start") {
11369
- const attempt = typeof normalized.attempt === "number" ? normalized.attempt : "?";
11370
- const runId = typeof normalized.runId === "string" ? normalized.runId : "?";
11371
- const reason = typeof normalized.reason === "string" ? normalized.reason : "retry";
11446
+ if (normalized2.type === "attempt_start") {
11447
+ const attempt = typeof normalized2.attempt === "number" ? normalized2.attempt : "?";
11448
+ const runId = typeof normalized2.runId === "string" ? normalized2.runId : "?";
11449
+ const reason = typeof normalized2.reason === "string" ? normalized2.reason : "retry";
11372
11450
  return truncateUtf8(`attempt ${attempt} -> ${runId}: ${reason}`, RUN_TAIL_TEXT_LIMIT, "...");
11373
11451
  }
11374
11452
  return void 0;
@@ -12254,7 +12332,7 @@ function requestOriginFor(req) {
12254
12332
  return req.requestOrigin ?? "agent";
12255
12333
  }
12256
12334
  function sha2566(input) {
12257
- return createHash13("sha256").update(input, "utf8").digest("hex");
12335
+ return createHash14("sha256").update(input, "utf8").digest("hex");
12258
12336
  }
12259
12337
  function promptHash(systemPrompt) {
12260
12338
  return systemPrompt.length > 0 ? sha2566(systemPrompt) : null;
@@ -16073,9 +16151,9 @@ function createDispatchBundle(context, options) {
16073
16151
  if (req.fleetGateReceipt === void 0) return null;
16074
16152
  try {
16075
16153
  const content = readFileSync22(resolvePath(lifecycle.cwd, req.fleetGateReceipt.path));
16076
- return { path: req.fleetGateReceipt.path, pathHash: createHash13("sha256").update(content).digest("hex") };
16154
+ return { path: req.fleetGateReceipt.path, pathHash: createHash14("sha256").update(content).digest("hex") };
16077
16155
  } catch {
16078
- return { path: req.fleetGateReceipt.path, pathHash: createHash13("sha256").update("").digest("hex") };
16156
+ return { path: req.fleetGateReceipt.path, pathHash: createHash14("sha256").update("").digest("hex") };
16079
16157
  }
16080
16158
  })();
16081
16159
  const ledgerContribution = (() => {
@@ -17536,7 +17614,7 @@ var DispatchManifest = {
17536
17614
 
17537
17615
  // src/domains/dispatch/delegation-plan.ts
17538
17616
  init_esm_shims();
17539
- import { createHash as createHash14 } from "node:crypto";
17617
+ import { createHash as createHash15 } from "node:crypto";
17540
17618
  var DELEGATION_PROPOSAL_BRIEFING_MAX_BYTES = 12e3;
17541
17619
  function buildDelegationProposalBriefing(proposals) {
17542
17620
  const value = proposals.map((proposal) => `PROPOSAL ${proposal.agent}
@@ -17644,7 +17722,7 @@ function validateDelegationPlan(input) {
17644
17722
  }
17645
17723
  }
17646
17724
  const plan = { tasks };
17647
- return { ok: true, plan, hash: createHash14("sha256").update(JSON.stringify(plan)).digest("hex") };
17725
+ return { ok: true, plan, hash: createHash15("sha256").update(JSON.stringify(plan)).digest("hex") };
17648
17726
  }
17649
17727
 
17650
17728
  // src/domains/dispatch/execution-scheduler.ts
@@ -18178,7 +18256,7 @@ function gateFailureLines(output) {
18178
18256
 
18179
18257
  // src/domains/dispatch/fleet-run.ts
18180
18258
  init_esm_shims();
18181
- import { createHash as createHash15 } from "node:crypto";
18259
+ import { createHash as createHash16 } from "node:crypto";
18182
18260
  import { readFileSync as readFileSync23 } from "node:fs";
18183
18261
  import { join as join24 } from "node:path";
18184
18262
 
@@ -18666,7 +18744,7 @@ async function executeFleetRun(input) {
18666
18744
  } catch {
18667
18745
  gateBytes = "";
18668
18746
  }
18669
- gatePathHash = createHash15("sha256").update(gateBytes).digest("hex");
18747
+ gatePathHash = createHash16("sha256").update(gateBytes).digest("hex");
18670
18748
  const command = input.commands?.commands.get(step.gate.commandId);
18671
18749
  if (gateBytes.length === 0 || command === void 0) {
18672
18750
  stepSucceeded = false;
@@ -20667,6 +20745,20 @@ function renderSessionTranscriptEntry(linked, calls) {
20667
20745
  if (entry.kind === "contextRecall") {
20668
20746
  return [`${prefix} contextRecall ref=${entry.ref.entry} trigger=${entry.trigger} tokens=${entry.tokensReadmitted}`];
20669
20747
  }
20748
+ if (entry.kind === "handoffTransaction") {
20749
+ const link = entry.transition;
20750
+ const detail = entry.event.phase === "failed" || entry.event.phase === "paused" ? ` reason=${entry.event.reason}` : entry.event.phase === "resumed" ? ` action=${entry.event.authority.action} answers=${entry.event.authority.pausedOrFailedEntryId}` : "";
20751
+ return [
20752
+ `${prefix} handoffTransaction handoff=${entry.identity.handoffId} phase=${entry.event.phase} seq=${link.sequence} attempt=${link.attempt} prev=${link.prevEntryId ?? "none"}${detail}`
20753
+ ];
20754
+ }
20755
+ if (entry.kind === "continuityCommit") {
20756
+ const commit = entry.continuity.commit;
20757
+ const ref = commit.summaryRef ?? commit.evictionRef ?? "none";
20758
+ return [
20759
+ `${prefix} continuityCommit handoff=${entry.continuity.identity.handoffId} commit=${entry.continuity.identity.commitId} outcome=${commit.outcome} ref=${ref} tokens=${commit.tokensBefore}->${commit.tokensAfter} state=${entry.continuity.state.event.phase}`
20760
+ ];
20761
+ }
20670
20762
  const _exhaustive = entry;
20671
20763
  return [`${prefix} ${String(_exhaustive)}`];
20672
20764
  }
@@ -21607,7 +21699,7 @@ async function proposeMemoryFromEvidence(dataDir, evidenceId, selection) {
21607
21699
  return { record, created: true };
21608
21700
  }
21609
21701
  function memoryIdFromEvidence(evidenceId) {
21610
- const digest = createHash16("sha256").update(evidenceId, "utf8").digest("hex").slice(0, 16);
21702
+ const digest = createHash17("sha256").update(evidenceId, "utf8").digest("hex").slice(0, 16);
21611
21703
  return `mem-${digest}`;
21612
21704
  }
21613
21705
  function memoryRecordFromEvidence(overview, findings, selection) {
@@ -21652,7 +21744,7 @@ function memoryRecordFromEvidence(overview, findings, selection) {
21652
21744
  return validated.record;
21653
21745
  }
21654
21746
  function memoryIdFromEvidenceScope(evidenceId, scopeKey) {
21655
- const digest = createHash16("sha256").update(`${evidenceId}
21747
+ const digest = createHash17("sha256").update(`${evidenceId}
21656
21748
  ${scopeKey}`, "utf8").digest("hex").slice(0, 16);
21657
21749
  return `mem-${digest}`;
21658
21750
  }
@@ -22119,7 +22211,7 @@ function taskMemoryBankSize(snapshot) {
22119
22211
 
22120
22212
  // src/domains/memory/task-memory-trace.ts
22121
22213
  init_esm_shims();
22122
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync8, openSync as openSync2, writeSync as writeSync2 } from "node:fs";
22214
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync8, openSync as openSync3, writeSync as writeSync2 } from "node:fs";
22123
22215
  import { dirname as dirname8 } from "node:path";
22124
22216
  var TRACE_TEXT_MAX_CHARS = 8e3;
22125
22217
  function taskMemoryTracePath(env = process.env) {
@@ -22133,7 +22225,7 @@ function createTaskMemoryTrace(path2, now = () => /* @__PURE__ */ new Date()) {
22133
22225
  try {
22134
22226
  if (!opened) {
22135
22227
  mkdirSync8(dirname8(path2), { recursive: true });
22136
- writeSync2(openSync2(path2, "w"), "");
22228
+ writeSync2(openSync3(path2, "w"), "");
22137
22229
  opened = true;
22138
22230
  }
22139
22231
  const row = {
@@ -22895,6 +22987,7 @@ export {
22895
22987
  inspectWikiPageEvidence,
22896
22988
  runWikiGenerate,
22897
22989
  runContextRefresh,
22990
+ readMemoryStoreSnapshot,
22898
22991
  memoryStorePath,
22899
22992
  loadMemoryRecords,
22900
22993
  loadMemoryRecordsSync,
@@ -22906,6 +22999,7 @@ export {
22906
22999
  memoryRuntimeIdentity,
22907
23000
  memoryAgentIdentity,
22908
23001
  proposeMemoryPromotion,
23002
+ MEMORY_RELEVANCE_VERSION,
22909
23003
  buildMemoryPromptSection,
22910
23004
  selectWorkerContext,
22911
23005
  protectedResidencyModels,
@@ -22924,6 +23018,7 @@ export {
22924
23018
  ACP_MAX_TOOL_PROGRESS_FRAMES_PER_CALL,
22925
23019
  ACP_MIN_TOOL_PROGRESS_INTERVAL_MS,
22926
23020
  ACP_MAX_TOOL_CALL_ID_BYTES,
23021
+ sessionCanUseSkills,
22927
23022
  compile,
22928
23023
  compileWorker,
22929
23024
  setCapacityDraining,
@@ -22999,4 +23094,4 @@ export {
22999
23094
  buildWikiPlanPrompt,
23000
23095
  buildWikiPagePrompt
23001
23096
  };
23002
- //# sourceMappingURL=chunk-LTWH2ACR.js.map
23097
+ //# sourceMappingURL=chunk-EQPFEDFV.js.map