@testmuai/kane-cli 0.8.20 → 0.8.22

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 (233) hide show
  1. package/dist/{ChatSurface-757LHEYF.js → ChatSurface-PA73V3NT.js} +1 -1
  2. package/dist/{ChromeProfilePicker-UAMRJG2H.js → ChromeProfilePicker-XX223SYB.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-NAPKBEOP.js → CliFeedbackPrompt-J6DW6TZL.js} +1 -1
  4. package/dist/{CliUploadProgress-R6FHYXP5.js → CliUploadProgress-TWEL7NWG.js} +1 -1
  5. package/dist/{ConfigView-CKYIRJBS.js → ConfigView-ROFNVFDQ.js} +1 -1
  6. package/dist/EvidenceViewOffer-XUP44BGJ.js +2 -0
  7. package/dist/FolderPicker-XLAK7324.js +2 -0
  8. package/dist/{InfoBox-WKFPWFII.js → InfoBox-ELZ5Q65V.js} +1 -1
  9. package/dist/{LinksBox-MQOD3X3E.js → LinksBox-2V26KLTJ.js} +1 -1
  10. package/dist/{ProfilesView-PLO2SBGI.js → ProfilesView-P4Z42LSX.js} +1 -1
  11. package/dist/{ProjectPicker-QT2IENIZ.js → ProjectPicker-2QNFNN7T.js} +1 -1
  12. package/dist/{SaveSessionPrompt-BRNUVO5J.js → SaveSessionPrompt-XMWL3P6G.js} +1 -1
  13. package/dist/SingleShotApp-3YZSE3AA.js +2 -0
  14. package/dist/{SummaryBox-7OBZAVJU.js → SummaryBox-RWO4BYYD.js} +1 -1
  15. package/dist/TestMdRunView-QHPMG46M.js +2 -0
  16. package/dist/{TestrunEvidenceTable-PKFPTUZX.js → TestrunEvidenceTable-MUOGF6CZ.js} +1 -1
  17. package/dist/{WhoamiView-CINKGNTV.js → WhoamiView-4EYWZR4N.js} +1 -1
  18. package/dist/agent-parse-2MLJOJTH.js +2 -0
  19. package/dist/{app-download-KLCWIQWJ.js → app-download-KUJVMZ7L.js} +1 -1
  20. package/dist/{auth-L7PFZJBY.js → auth-5HAY24TN.js} +1 -1
  21. package/dist/{binary-25KA3XAX.js → binary-6UEOI7PT.js} +1 -1
  22. package/dist/bind-3C2IIPML.js +15 -0
  23. package/dist/{bootstrap-545GY5CC.js → bootstrap-DBAQWVNA.js} +1 -1
  24. package/dist/bridge-NHXCRSIU.js +2 -0
  25. package/dist/{changelog-ABQ5HREB.js → changelog-QAGRYBEZ.js} +1 -1
  26. package/dist/chunk-26HZJJN6.js +5 -0
  27. package/dist/{chunk-CXXTQ4C5.js → chunk-2G5CJQOR.js} +1 -1
  28. package/dist/{chunk-G5Q4EJAT.js → chunk-2HFNP2LM.js} +1 -1
  29. package/dist/chunk-2KVECC36.js +2 -0
  30. package/dist/{chunk-PY4BWRR6.js → chunk-2OIIXLXW.js} +1 -1
  31. package/dist/{chunk-LJ5O7DZ7.js → chunk-3BUYTNAV.js} +2 -2
  32. package/dist/{chunk-TFGGJSTI.js → chunk-3H3KTCL7.js} +2 -2
  33. package/dist/{chunk-UUT7EHLT.js → chunk-3M6OM3T4.js} +1 -1
  34. package/dist/{chunk-FD5TFGJX.js → chunk-3MWLFHPO.js} +1 -1
  35. package/dist/{chunk-FYW7USQY.js → chunk-3NMXXTHE.js} +1 -1
  36. package/dist/chunk-44NNFVCJ.js +7 -0
  37. package/dist/chunk-46U7TRPE.js +98 -0
  38. package/dist/{chunk-PP4I2Z6M.js → chunk-4VW3B7SE.js} +1 -1
  39. package/dist/{chunk-OGWYTILK.js → chunk-4ZBI54KE.js} +4 -4
  40. package/dist/{chunk-4L45IQNU.js → chunk-5BHB5D2C.js} +1 -1
  41. package/dist/{chunk-SBSANJ2T.js → chunk-5D6YMG63.js} +2 -2
  42. package/dist/chunk-5E4JLXR5.js +2 -0
  43. package/dist/{chunk-BNWU7JOW.js → chunk-5FQYB5SM.js} +1 -1
  44. package/dist/{chunk-JKQX7DUC.js → chunk-5ILTSBWT.js} +1 -1
  45. package/dist/{chunk-E6MW25UV.js → chunk-5TQIKRKP.js} +1 -1
  46. package/dist/{chunk-7BKOTLIL.js → chunk-5XAX4C5N.js} +13 -11
  47. package/dist/chunk-5ZFOKYFB.js +5 -0
  48. package/dist/{chunk-K4D5BB63.js → chunk-6C35NKQ7.js} +1 -1
  49. package/dist/{chunk-CVXVFF2G.js → chunk-6MCQ2UKE.js} +1 -1
  50. package/dist/chunk-ADBOWRMW.js +2 -0
  51. package/dist/chunk-BL5QHONU.js +2 -0
  52. package/dist/chunk-BNC4DJCC.js +7 -0
  53. package/dist/chunk-BPDFI2DC.js +27 -0
  54. package/dist/{chunk-T27HVHZA.js → chunk-BPYRVV7O.js} +1 -1
  55. package/dist/chunk-CBUSNWHA.js +2 -0
  56. package/dist/{chunk-ISBISZUE.js → chunk-CE23VDW5.js} +1 -1
  57. package/dist/chunk-DF4EBXGN.js +8 -0
  58. package/dist/{chunk-R6RK32R2.js → chunk-DZCJE77P.js} +1 -1
  59. package/dist/{chunk-PCBCEXYO.js → chunk-E2KV4BQB.js} +1 -1
  60. package/dist/{chunk-LPVAOUAC.js → chunk-EVBCKI7D.js} +1 -1
  61. package/dist/chunk-FBRTUEAL.js +26 -0
  62. package/dist/{chunk-YL5J3SNK.js → chunk-FDXDFZ7J.js} +1 -1
  63. package/dist/{chunk-PN4EL4JN.js → chunk-FR3LVUAB.js} +1 -1
  64. package/dist/chunk-GF32QBCM.js +9 -0
  65. package/dist/{chunk-AXJ47YFH.js → chunk-GVE5GEW2.js} +1 -1
  66. package/dist/{chunk-SA7ORQHP.js → chunk-GYLMH2EX.js} +1 -1
  67. package/dist/{chunk-7SV2NQZV.js → chunk-HKIBJDKE.js} +1 -1
  68. package/dist/{chunk-RV3KMXUX.js → chunk-I4SO2FQV.js} +1 -1
  69. package/dist/{chunk-TEJG5H2O.js → chunk-JHBNXTG6.js} +1 -1
  70. package/dist/{chunk-IHVIIRW5.js → chunk-JHYWNWS5.js} +2 -2
  71. package/dist/{chunk-Y67FYNLP.js → chunk-JPOFRYTX.js} +1 -1
  72. package/dist/{chunk-CLLLLX4F.js → chunk-JQ3JB5CO.js} +1 -1
  73. package/dist/{chunk-XSZH2K3E.js → chunk-L35DJDX7.js} +1 -1
  74. package/dist/chunk-LDPLJFCV.js +2 -0
  75. package/dist/chunk-LKPOOZYN.js +8 -0
  76. package/dist/{chunk-N3MZALFQ.js → chunk-LSRNUBIV.js} +1 -1
  77. package/dist/{chunk-5WZ2WOOM.js → chunk-MHMEEA4S.js} +1 -1
  78. package/dist/{chunk-6MTKXDTH.js → chunk-MXI5P373.js} +1 -1
  79. package/dist/chunk-NAWGHDA3.js +15 -0
  80. package/dist/{chunk-Q5PQ7U3W.js → chunk-NMAPNJRY.js} +1 -1
  81. package/dist/chunk-NUYGWRB2.js +11 -0
  82. package/dist/{chunk-UYTBGBT4.js → chunk-O4LJWUSJ.js} +1 -1
  83. package/dist/{chunk-6V4ANMW4.js → chunk-OBB57E2L.js} +1 -1
  84. package/dist/chunk-ODU2JSMA.js +8 -0
  85. package/dist/{chunk-RMLC3QWX.js → chunk-OT3VKXJX.js} +1 -1
  86. package/dist/{chunk-EPVK2NMQ.js → chunk-P37ALET7.js} +1 -1
  87. package/dist/{chunk-56UYK35Z.js → chunk-PLIQ72LH.js} +1 -1
  88. package/dist/chunk-PUFZTE6L.js +2 -0
  89. package/dist/chunk-Q6AHSGOE.js +5 -0
  90. package/dist/{chunk-I3NUTW6U.js → chunk-QV445GUU.js} +1 -1
  91. package/dist/{chunk-M5V464PU.js → chunk-R43ELADV.js} +2 -2
  92. package/dist/{chunk-5FCXFSAO.js → chunk-R7ZDLGMU.js} +1 -1
  93. package/dist/{chunk-IYOL2FUH.js → chunk-REPKBN7I.js} +1 -1
  94. package/dist/{chunk-X77AR3IL.js → chunk-RFDL7MHI.js} +1 -1
  95. package/dist/{chunk-IPQAKIJO.js → chunk-RGRFL7XG.js} +1 -1
  96. package/dist/{chunk-4ZVGZF2L.js → chunk-RUSRN7YE.js} +1 -1
  97. package/dist/{chunk-R54VY272.js → chunk-SB5XM4YV.js} +5 -5
  98. package/dist/{chunk-RPJUE54T.js → chunk-SIXPXYCH.js} +1 -1
  99. package/dist/{chunk-OWPQZP4C.js → chunk-SJZJ7ASF.js} +1 -1
  100. package/dist/{chunk-VKFLER7N.js → chunk-SREUA7YQ.js} +1 -1
  101. package/dist/{chunk-T7UACVWW.js → chunk-SVJBOVI4.js} +1 -1
  102. package/dist/{chunk-DVYQVSNS.js → chunk-SW54RAAT.js} +1 -1
  103. package/dist/{chunk-H6TNBKGR.js → chunk-T2ONUKTL.js} +1 -1
  104. package/dist/{chunk-ZXP2TJEJ.js → chunk-T6MGCP57.js} +4 -4
  105. package/dist/{chunk-47ZPSTT6.js → chunk-UXR57BCE.js} +1 -1
  106. package/dist/{chunk-QBU5B4GH.js → chunk-VCY7UNEL.js} +1 -1
  107. package/dist/{chunk-SHXJQ73O.js → chunk-VW3PFRCO.js} +1 -1
  108. package/dist/{chunk-R5UVQMMP.js → chunk-WBH5GYFM.js} +1 -1
  109. package/dist/{chunk-FNJJGQUI.js → chunk-WGIZQGR5.js} +1 -1
  110. package/dist/chunk-WHNF5SWS.js +9 -0
  111. package/dist/{chunk-U2LDPUDZ.js → chunk-WJR2FU7S.js} +1 -1
  112. package/dist/{chunk-NFQ67CQO.js → chunk-WPBETG6U.js} +3 -3
  113. package/dist/{chunk-UFWG6VMI.js → chunk-WRGPMDDE.js} +1 -1
  114. package/dist/{chunk-2TNMV4BX.js → chunk-XFQLR6MF.js} +1 -1
  115. package/dist/chunk-XKYL4K4A.js +2 -0
  116. package/dist/{chunk-ARCYAF37.js → chunk-XQNJSM5C.js} +1 -1
  117. package/dist/{chunk-YV6CSSWA.js → chunk-YFBJWIBU.js} +1 -1
  118. package/dist/chunk-YFQGOOF7.js +2 -0
  119. package/dist/{chunk-DCLMFWCF.js → chunk-Z2XKFYMH.js} +1 -1
  120. package/dist/{chunk-U7WMRB5V.js → chunk-ZUJGYHZ2.js} +1 -1
  121. package/dist/{config-A6MBUY54.js → config-HVSKN6L4.js} +1 -1
  122. package/dist/{cover-cmd-TIY53OMC.js → cover-cmd-ZZJA5C6H.js} +1 -1
  123. package/dist/{credentials-GXICFDVV.js → credentials-FH6VZPJS.js} +1 -1
  124. package/dist/{deps-bundle-RDGQAIGD.js → deps-bundle-QUROUKJI.js} +1 -1
  125. package/dist/{deps-resolve-52BOL7G6.js → deps-resolve-N2KKJ37Q.js} +1 -1
  126. package/dist/device-env-ID7EDDOD.js +2 -0
  127. package/dist/{dispatch-GJ7RVYPK.js → dispatch-BYA5Q2SD.js} +1 -1
  128. package/dist/{doctor-XNI2NZZJ.js → doctor-MGHY2M36.js} +1 -1
  129. package/dist/evidence-XYKLWPPY.js +2 -0
  130. package/dist/evolve-cmd-BURJDLVF.js +2 -0
  131. package/dist/{explain-cmd-LQ5CHHNY.js → explain-cmd-53EO2IMN.js} +1 -1
  132. package/dist/{explain-cmd-ENSJNQK7.js → explain-cmd-JAOHSI4F.js} +1 -1
  133. package/dist/{extract-bind-NWA4PSTU.js → extract-bind-T7GKUEJ6.js} +3 -3
  134. package/dist/{extract-cmd-Q5PZS626.js → extract-cmd-WXG34RMY.js} +3 -3
  135. package/dist/{gaps-cmd-UKMO7KYX.js → gaps-cmd-T55FFFVB.js} +1 -1
  136. package/dist/{generate-headless-CLKY4IAU.js → generate-headless-BSBY47K2.js} +2 -2
  137. package/dist/{headless-io-3A3BZVQ5.js → headless-io-75HUMWZB.js} +1 -1
  138. package/dist/index.js +141 -139
  139. package/dist/{ingest-cmd-JZNVRFFS.js → ingest-cmd-BYOZCTVG.js} +1 -1
  140. package/dist/install-OABVIXAE.js +2 -0
  141. package/dist/{interactive-bind-7JMBM3OK.js → interactive-bind-JAB6XUPX.js} +3 -3
  142. package/dist/{lifecycle-cmd-VMZKHC2Y.js → lifecycle-cmd-QVGYYJSG.js} +1 -1
  143. package/dist/{list-cmd-3XDCASJH.js → list-cmd-RQYRC345.js} +1 -1
  144. package/dist/{list-commands-QURMKZZH.js → list-commands-VTWPMFG3.js} +1 -1
  145. package/dist/login-flow-HUORIV6P.js +2 -0
  146. package/dist/{maintenance-cmd-MQ4GCVDU.js → maintenance-cmd-NC2VI5G7.js} +1 -1
  147. package/dist/{mobile-prompts-VXNHSCAH.js → mobile-prompts-VCA73IYP.js} +1 -1
  148. package/dist/{next-TRSKMBO5.js → next-KZXH4UA4.js} +1 -1
  149. package/dist/objective-variable-gate-WZFN5I7Y.js +2 -0
  150. package/dist/{open-provider-ZYBUD6JW.js → open-provider-YXHFPVDE.js} +1 -1
  151. package/dist/persist-recorded-session-SZDBBSNH.js +3 -0
  152. package/dist/{phase-seed-H7KXNQO6.js → phase-seed-MKHEWUN6.js} +1 -1
  153. package/dist/pipeline-FAU3PBDH.js +2 -0
  154. package/dist/prepare-target-XYOTVK2I.js +2 -0
  155. package/dist/reconcile-cmd-2BFK7RFL.js +2 -0
  156. package/dist/reconcile-deps-CYWH6GM4.js +4 -0
  157. package/dist/reconcile-engine-ZWIJFYBP.js +2 -0
  158. package/dist/{recording-banner-WZECSZJM.js → recording-banner-FRH2EJBM.js} +1 -1
  159. package/dist/registry-QR3BDI5F.js +2 -0
  160. package/dist/{require-project-folder-OFA4F2T5.js → require-project-folder-A6YTVLAK.js} +1 -1
  161. package/dist/{resolve-run-intent-M7EXFU7E.js → resolve-run-intent-PHAXPW6C.js} +1 -1
  162. package/dist/{resolver-TZAQGCFJ.js → resolver-U55SNASN.js} +1 -1
  163. package/dist/{review-cmd-RXD2RWKN.js → review-cmd-ZKCXBMFP.js} +1 -1
  164. package/dist/{run-DVBOAY7S.js → run-76I4OYXD.js} +1 -1
  165. package/dist/run-XJK3YOW2.js +2 -0
  166. package/dist/{run-test-md-Z75BGXRK.js → run-test-md-A3QRWLCW.js} +2 -2
  167. package/dist/{skill-installer-FEOJ4KX3.js → skill-installer-LSDCMJ6P.js} +1 -1
  168. package/dist/{spawner-XHE7OXNW.js → spawner-HZXP66DS.js} +1 -1
  169. package/dist/{store-guard-HIBKFC2T.js → store-guard-27XJZ7WF.js} +1 -1
  170. package/dist/structured-answers-ZI2B6JJE.js +2 -0
  171. package/dist/sync-cmd-JZ3MXGEU.js +2 -0
  172. package/dist/{sync-setup-WGYN6ZTI.js → sync-setup-HGG7ALGA.js} +1 -1
  173. package/dist/tcg-generate-S77VVSVU.js +2 -0
  174. package/dist/testmd-actions-VQJ22WZZ.js +2 -0
  175. package/dist/testmd-sync-RKSGTCZA.js +2 -0
  176. package/dist/{tms-client-V3TR4QW3.js → tms-client-KU6HCA23.js} +1 -1
  177. package/dist/token-refresh-AOCGYGEC.js +2 -0
  178. package/dist/{validate-basic-GBA5PHIK.js → validate-basic-5NYH5WYI.js} +1 -1
  179. package/dist/variable-receipt-C3US6X4M.js +2 -0
  180. package/dist/{verdicts-34ZGB67K.js → verdicts-VPTU4YAS.js} +1 -1
  181. package/dist/{version-check-BHRM4PN4.js → version-check-YY57B2A4.js} +1 -1
  182. package/dist/{view-cmd-FJGT5KZO.js → view-cmd-KWIBYZ5S.js} +1 -1
  183. package/dist/walk-session-YSKEJM2F.js +2 -0
  184. package/dist/{with-telemetry-AIPWSH4P.js → with-telemetry-2NY4CPL5.js} +1 -1
  185. package/package.json +11 -11
  186. package/dist/EvidenceViewOffer-M3DAU4YU.js +0 -2
  187. package/dist/FolderPicker-I2E2EJON.js +0 -2
  188. package/dist/SingleShotApp-CQWGPSLT.js +0 -2
  189. package/dist/TestMdRunView-GIOPBTA6.js +0 -2
  190. package/dist/agent-parse-XMWVKCRD.js +0 -2
  191. package/dist/bind-N5QZUUUU.js +0 -15
  192. package/dist/bridge-VNFL4T6K.js +0 -2
  193. package/dist/chunk-3Q5IQXOI.js +0 -11
  194. package/dist/chunk-4K44ZIC4.js +0 -2
  195. package/dist/chunk-5UCXN56I.js +0 -2
  196. package/dist/chunk-7XC5IQN6.js +0 -95
  197. package/dist/chunk-A55WPXDZ.js +0 -2
  198. package/dist/chunk-ALK3OUGN.js +0 -27
  199. package/dist/chunk-BPMSNGXQ.js +0 -2
  200. package/dist/chunk-CAOZKSQ3.js +0 -8
  201. package/dist/chunk-DFHVZZI3.js +0 -7
  202. package/dist/chunk-DYW5C6II.js +0 -2
  203. package/dist/chunk-EV3EU2MT.js +0 -9
  204. package/dist/chunk-HS7OIRGU.js +0 -5
  205. package/dist/chunk-K3EN7O5N.js +0 -26
  206. package/dist/chunk-L45HDSJ7.js +0 -15
  207. package/dist/chunk-P6HK7GSS.js +0 -9
  208. package/dist/chunk-P7YZ3PU3.js +0 -2
  209. package/dist/chunk-RTD27WRG.js +0 -7
  210. package/dist/chunk-UVR7MESH.js +0 -2
  211. package/dist/chunk-VL7LPZVI.js +0 -8
  212. package/dist/chunk-YKYHVRM2.js +0 -5
  213. package/dist/evidence-QYJ7SQR6.js +0 -2
  214. package/dist/evolve-cmd-2LM6NKMY.js +0 -2
  215. package/dist/install-FLC6WLPZ.js +0 -2
  216. package/dist/login-flow-BPT46DCE.js +0 -2
  217. package/dist/objective-variable-gate-BDSG2BEA.js +0 -2
  218. package/dist/persist-recorded-session-NV2ULVPH.js +0 -3
  219. package/dist/pipeline-STTNBJC4.js +0 -2
  220. package/dist/prepare-target-CRO3BGAP.js +0 -2
  221. package/dist/reconcile-cmd-VQTFUGEJ.js +0 -2
  222. package/dist/reconcile-deps-SE6COSXQ.js +0 -4
  223. package/dist/reconcile-engine-GLKGQEVR.js +0 -2
  224. package/dist/registry-GQEYUEQJ.js +0 -2
  225. package/dist/run-VF2MBI6M.js +0 -2
  226. package/dist/structured-answers-3C2DCFFF.js +0 -5
  227. package/dist/sync-cmd-MZYM5IE6.js +0 -2
  228. package/dist/tcg-generate-Y2UMDGPL.js +0 -2
  229. package/dist/testmd-actions-UDNH6W2Z.js +0 -2
  230. package/dist/testmd-sync-4BXMEIJ3.js +0 -2
  231. package/dist/token-refresh-KYIQ7LZL.js +0 -2
  232. package/dist/variable-receipt-WMV33LAD.js +0 -2
  233. package/dist/walk-session-CTZ5475S.js +0 -2
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as he}from"./chunk-WVHMPIDQ.js";import{a as pe}from"./chunk-OGWYTILK.js";import{b as ue,c as de,d as q,e as Y}from"./chunk-PCBCEXYO.js";import{d as ge,e as me}from"./chunk-AXTPNZPX.js";import{d as fe}from"./chunk-BZAGVBCX.js";import{a as L}from"./chunk-KDNNMU7Q.js";import{a as le}from"./chunk-CXXTQ4C5.js";import{z as I}from"./chunk-IICT4VOU.js";import{F as ce,X as ae}from"./chunk-RDHWNSDP.js";function mt(t){let e=process.env.HOME??"";return e&&t.startsWith(e)?`~${t.slice(e.length)}`:t}import{randomBytes as lt}from"crypto";function J(t,e){let r=Math.min(t.length,e.length),o=0,n=0,c=0;for(let s=0;s<r;s++)o+=t[s]*e[s],n+=t[s]*t[s],c+=e[s]*e[s];return n===0||c===0?0:o/(Math.sqrt(n)*Math.sqrt(c))}function Z(t,e,r){return r*t+(1-r)*e}var ee=.7;var je=["get_node","get_edges","find_by_provenance","match_by_type","stale_nodes","search_similar","search_similar_batch","history"],Pe=["source_read","source_grep","source_list"],Ue=[...je,...Pe],ke=50,be=200,te=10,xe=50,_e=20,Ve=200,He=50;function P(t,e,r){let o=typeof t=="number"&&Number.isFinite(t)?Math.floor(t):e;return Math.max(1,Math.min(o,r))}function M(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new k(`param "${e}" must be a non-empty string`);return r}function $(t,e){let r=t[e];if(r==null)return null;if(typeof r!="string")throw new k(`param "${e}" must be a string when present`);return r}var k=class extends Error{},ye=24,Qe=10,ze=10;function Ke(t){let e=t.cursor;if(e==null)return 0;if(typeof e=="string"&&/^\d+$/.test(e))return Number.parseInt(e,10);throw new k(`BAD_CURSOR: cursor ${JSON.stringify(e)} is not a cursor this store minted`)}function ve(t,e){let r=e.fields;if(!Array.isArray(r)||r.length===0)return t;let o=new Set(r.filter(n=>typeof n=="string"));return t.map(n=>Object.fromEntries(Object.entries(n).filter(([c])=>o.has(c))))}function ne(t,e,r=ke,o=be){let n=Ke(e),c=P(e.limit,r,o),s=t.slice(n,n+c),u=n+s.length<t.length;return{rows:ve(s,e),truncated:u,next_cursor:u?String(n+s.length):null}}var We=t=>t.cursor!=null||t.fields!=null;function U(t,e,r=ke){let o=ne(t,e,r);return We(e)||o.truncated?{rows:o.rows,truncated:o.truncated,next_cursor:o.next_cursor}:o.rows}function re(t,e){let r=t.getNode(e);return r?{cid:e,label:r.label,content:r.content,trust:t.trust.get(e)??null,freshness:t.stale(e)}:null}function we(t){return new Set(t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").split(" ").filter(Boolean))}function V(t,...e){let r=we(t);if(r.size===0)return 0;let o=t.trim().toLowerCase(),n=0;for(let c of e){let s=we(c);if(s.size===0)continue;let u=0;for(let l of r)s.has(l)&&u++;let f=r.size+s.size-u,d=f===0?0:u/f;o&&c.toLowerCase().includes(o)&&(d=Math.max(d,.9)),n=Math.max(n,d)}return n}function Xe(t,e){let r=M(e,"cid"),o=$(e,"type"),n=$(e,"direction")??"both";if(!["out","in","both"].includes(n))throw new k('param "direction" must be out|in|both');let c=[];(n==="out"||n==="both")&&c.push(...t.edgesFrom(r)),(n==="in"||n==="both")&&c.push(...t.edgesInto(r));let s=c.filter(u=>o==null||u.type===o);return U(s,e)}function qe(t,e){let r=M(e,"source_id"),o=t.heads.get(r)??null,n=[];for(let c of t.nodeLabel.keys()){let s=t.derivesInto(c).filter(f=>f.props.source_id===r).map(f=>({source_cid:f.props.source_cid,anchor:f.props.anchor??null}));if(s.length===0)continue;let u=re(t,c);u&&n.push({...u,pins:s,pinned_to_head:o!=null&&s.some(f=>f.source_cid===o)})}return U(n,e,be)}function Ye(t,e){let r=M(e,"label"),o=$(e,"trust"),n=$(e,"freshness"),c=[];for(let{cid:s}of t.byLabel(r)){let u=re(t,s);u&&(o!=null&&u.trust!==o||n!=null&&u.freshness!==n||c.push(u))}return U(c,e)}function Je(t,e={}){let r=$(e,"label"),o=t.staleList().map(({cid:n,state:c})=>{let s=t.getNode(n);return{cid:n,state:c,label:s?.label??null,title:s?.content.title??null}}).filter(n=>r==null||n.label===r);return U(o,e)}function Ze(t,e,r){let o=e.extracted,n=$(e,"kind"),c=[];for(let d of[...t.heads.keys()].sort()){let l=t.heads.get(d);if(typeof l!="string")continue;let h=t.mediaOf(l).format;if(n!=null&&h!==n)continue;let p=t.extractedSourceCids.has(l);if(typeof o=="boolean"&&p!==o)continue;let S=0;if(h!=="image"){let b=L(r,t,l);b&&(S=b.toString("utf8").replace(/\n$/,"").split(`
3
- `).length)}let _=t.extractionCompleteness.get(d);c.push({source_id:d,kind:h,lines:S,head_cid:l,extracted:p,last_extract_at:_?.at??null,extractor_version:_?.extractor_version??null})}let{rows:s,truncated:u,next_cursor:f}=ne(c,e);return{sources:s,truncated:u,next_cursor:f}}function et(t,e,r){let o=M(e,"ref"),n=t.resolve(o);if(!n)throw new k(`UNKNOWN_REF: ${o} names nothing in the graph`);let c=n.tip,s=new Map;for(let[m,w]of t.superseded)typeof w=="string"&&w!==m&&s.set(w,[...s.get(w)??[],m]);let u=[],f=[c],d=new Set;for(;f.length>0;){let m=f.pop();d.has(m)||(d.add(m),u.push(m),f.push(...s.get(m)??[]))}let{records:l}=ce(r),g=new Map,h=new Map;for(let m of l){for(let w of m.nodes)g.has(w.cid)||g.set(w.cid,m.ts);for(let w of m.supersessions)w.kind==="node"&&h.set(w.old,{by_cid:w.new,reason:w.reason})}let p=u.map(m=>({cid:m,minted_at:g.get(m)??null,superseded_by:h.get(m)?.by_cid??null,reason:h.get(m)?.reason??null,change_note:null})),{rows:S,truncated:_,next_cursor:b}=ne(p,e,ze);return{root_logical_id:t.displayNameOf(c),live_tip:t.superseded.has(c)?null:c,truncated:_,next_cursor:b,chain:S}}function Se(t){let e=t.queries;if(!Array.isArray(e)||e.length<1||e.length>ye)throw new k(`param "queries" must be 1..${ye} entries`);return e.map((r,o)=>{if(typeof r!="object"||r===null)throw new k(`queries[${o}] must be an object`);let n=r;if(typeof n.qid!="string"||n.qid.length===0)throw new k(`queries[${o}].qid must be a non-empty string`);if(typeof n.text!="string"||n.text.length===0)throw new k(`queries[${o}].text must be a non-empty string`);return{qid:n.qid,text:n.text,topK:P(n.top_k,te,Qe)}})}function Ae(t){let e=[];for(let{cid:r,content:o}of t.byLabel("usecase"))t.superseded.has(r)||e.push({cid:r,title:String(o.title??""),summary:String(o.summary??""),description:String(o.description??"")});return e}function Re(t,e,r){let o=Ae(t);return e.map(n=>{let c=[];for(let s of o){let u=r(n,s);u<=0||c.push({cid:s.cid,logical_id:t.displayNameOf(s.cid),title:s.title,score:Math.round(u*1e3)/1e3,trust:t.trust.get(s.cid)??null,superseded:!1})}return c.sort((s,u)=>u.score-s.score||s.cid.localeCompare(u.cid)),{qid:n.qid,truncated:c.length>n.topK,matches:c.slice(0,n.topK)}})}function Ee(t,e){let r=Se(e);return{results:Re(t,r,(o,n)=>V(o.text,n.title,n.summary,n.description)),scorer:"lexical_fallback"}}function tt(t,e){let r=M(e,"text"),o=$(e,"label")??"usecase",n=P(e.k,te,xe),c=[];for(let{cid:s,content:u}of t.byLabel(o)){let f=String(u.title??""),d=String(u.summary??""),l=V(r,f,d);l<=0||c.push({cid:s,title:f,summary:d,score:Math.round(l*1e3)/1e3,trust:t.trust.get(s)??null,freshness:t.stale(s)})}return c.sort((s,u)=>u.score-s.score||s.cid.localeCompare(u.cid)),c.slice(0,n)}function De(t,e,r){let o=t.heads.get(r);if(typeof o!="string"){let c=[...t.heads.keys()].sort().join(", ");throw new k(`unknown source_id "${r}" \u2014 known: ${c||"(none)"}`)}if(t.mediaOf(o).format==="image")throw new k(`source "${r}" is an image \u2014 no line window (cite img#whole)`);let n=L(e,t,o);if(n==null)throw new k(`source "${r}" blob is missing from the store`);return{head:o,lines:n.toString("utf8").replace(/\n$/,"").split(`
4
- `)}}function nt(t,e,r){return t.slice(e-1,r).map((o,n)=>`${String(e+n).padStart(4,"0")}| ${o}`).join(`
5
- `)}function rt(t,e,r){let o=M(e,"source_id"),n=$(e,"anchor"),c=e.line_range;if(n!=null&&c!=null)throw new k("give anchor OR line_range, not both");let{head:s,lines:u}=De(t,r,o),f=u.length,d,l;if(n!=null){let g=/^L(\d+)-L(\d+)$/.exec(n);if(!g)throw new k(`anchor "${n}" is not L<a>-L<b>`);let h=Number(g[1]),p=Number(g[2]);if(h<1||p<h||p>f)throw new k(`anchor "${n}" does not resolve (source has ${f} lines)`);d=Math.max(1,h-_e),l=Math.min(f,p+_e)}else if(c!=null){if(!Array.isArray(c)||c.length!==2||!c.every(p=>Number.isInteger(p)))throw new k('param "line_range" must be [from_line, to_line]');let[g,h]=c;if(g<1||h<g)throw new k('param "line_range" must be 1-based with from \u2264 to');if(g>f)throw new k(`line_range starts past the end (source has ${f} lines)`);d=g,l=Math.min(h,f)}else d=1,l=f;return l=Math.min(l,d+Ve-1),{window:nt(u,d,l),from_line:d,to_line:l,source_cid:s,total_lines:f}}function st(t,e,r){let o=M(e,"pattern"),n=$(e,"source_id"),c;try{c=new RegExp(o,"u")}catch(d){throw new k(`invalid pattern: ${d instanceof Error?d.message:String(d)}`)}let s=n!=null?[n]:[...t.heads.keys()].sort(),u=[],f=!1;e:for(let d of s){if(n==null){let g=t.heads.get(d);if(typeof g!="string"||t.mediaOf(g).format==="image")continue}let{lines:l}=De(t,r,d);for(let g=0;g<l.length;g++)if(c.test(l[g])){if(u.length>=He){f=!0;break e}u.push({source_id:d,line:g+1,text:l[g]})}}return{matches:u,truncated:f}}function ot(t,e,r,o){try{switch(e){case"get_node":{let n=re(t,M(r,"cid"));return n==null?{ok:!0,result:null}:{ok:!0,result:ve([n],r)[0]}}case"get_edges":return{ok:!0,result:Xe(t,r)};case"find_by_provenance":return{ok:!0,result:qe(t,r)};case"match_by_type":return{ok:!0,result:Ye(t,r)};case"stale_nodes":return{ok:!0,result:Je(t,r)};case"search_similar":return{ok:!0,result:tt(t,r)};case"search_similar_batch":return{ok:!0,result:Ee(t,r)};case"history":{if(o==null)throw new k("history unavailable (no context store)");return{ok:!0,result:et(t,r,o)}}case"source_list":{if(o==null)throw new k("source roster unavailable (no context store)");return{ok:!0,result:Ze(t,r,o)}}case"source_read":case"source_grep":{if(o==null)throw new k("source text unavailable (no context store)");return{ok:!0,result:(e==="source_read"?rt:st)(t,r,o)}}default:return{ok:!1,error:`unknown method: ${e} \u2014 available: ${Ue.join(", ")}`}}}catch(n){return n instanceof k?{ok:!1,error:`${e}: ${n.message}`}:{ok:!1,error:`${e}: graph read failed: ${n instanceof Error?n.message:String(n)}`}}}var j="assurance.sim";function it(t){return[t.title,t.summary,t.description].filter(Boolean).join(`
6
- `)}async function ct(t,e,r){let o=M(e,"text"),n=$(e,"label")??"usecase",c=P(e.k,te,xe),s=[];for(let{cid:f,content:d}of t.byLabel(n)){if(t.superseded.has(f))continue;let l=String(d.title??""),g=String(d.summary??""),h=String(d.description??"");s.push({cid:f,title:l,summary:g,description:h,lex:V(o,l,g,h)})}let u=f=>{let d=[];for(let l of s){let g=f(l);g.score<=0||d.push({cid:l.cid,title:l.title,summary:l.summary,score:Math.round(g.score*1e3)/1e3,trust:t.trust.get(l.cid)??null,freshness:t.stale(l.cid),...g.dense!==void 0?{dense_score:Math.round(g.dense*1e3)/1e3,lexical_score:Math.round(l.lex*1e3)/1e3}:{}})}return d.sort((l,g)=>g.score-l.score||l.cid.localeCompare(g.cid)),d.slice(0,c)};try{let f=r.readVector??q,d=r.writeVector??Y,l=r.alpha??ee,{alias:g}=await r.resolveAlias(j),h=new Map,p=[],S=[];for(let m of s){let w=f(r.contextDir,g,m.cid);w?h.set(m.cid,w):(p.push(m.cid),S.push(it(m)))}let{vectors:_}=await r.embed(j,[o,...S]),b=Float32Array.from(_[0]);for(let m=0;m<p.length;m++){let w=Float32Array.from(_[m+1]);h.set(p[m],w),d(r.contextDir,g,p[m],w)}return u(m=>{let w=h.get(m.cid),C=w?J(b,w):0;return{score:Z(C,m.lex,l),dense:C}})}catch{return r.onDegraded?.(),u(f=>({score:f.lex}))}}async function at(t,e,r){let o=Se(e),n=Ae(t);try{let c=r.readVector??q,s=r.writeVector??Y,u=r.alpha??ee,{alias:f}=await r.resolveAlias(j),d=new Map,l=[],g=[];for(let _ of n){let b=c(r.contextDir,f,_.cid);b?d.set(_.cid,b):(l.push(_.cid),g.push([_.title,_.summary,_.description].filter(Boolean).join(`
7
- `)))}let{vectors:h}=await r.embed(j,[...o.map(_=>_.text),...g]),p=o.map((_,b)=>Float32Array.from(h[b]));for(let _=0;_<l.length;_++){let b=Float32Array.from(h[o.length+_]);d.set(l[_],b),s(r.contextDir,f,l[_],b)}let S=new Map(o.map((_,b)=>[_.qid,b]));return{results:Re(t,o,(_,b)=>{let m=d.get(b.cid),w=m?J(p[S.get(_.qid)],m):0;return Z(w,V(_.text,b.title,b.summary,b.description),u)}),scorer:"embedding"}}catch{return r.onDegraded?.(),Ee(t,e)}}async function $e(t,e,r,o){if((e==="search_similar"||e==="search_similar_batch")&&o)try{return{ok:!0,result:e==="search_similar"?await ct(t,r,o):await at(t,r,o)}}catch(n){return n instanceof k?{ok:!1,error:`${e}: ${n.message}`}:{ok:!1,error:`${e}: graph read failed: ${n instanceof Error?n.message:String(n)}`}}return ot(t,e,r,o?.contextDir)}var ut=2,Me=10,dt=2;function Ce(t,e,r){return t.map(o=>{let n=e.find(c=>c.id===o.id);if(n&&n.selected_index!=null&&n.selected_index>=0&&n.selected_index<o.options.length){let s=(o.allow_free_text||o.options[n.selected_index]?.input===!0)&&n.free_text!=null?n.free_text:null;return{id:o.id,resolution:"answered",selected_index:n.selected_index,free_text:s}}return n&&n.free_text!=null&&o.allow_free_text?{id:o.id,resolution:"answered",selected_index:-1,free_text:n.free_text}:r.explicitAcceptDefaults?{id:o.id,resolution:"assumed-default",selected_index:o.recommended_index,flagged:!0}:{id:o.id,resolution:"deferred",selected_index:null}})}async function Et(t,e,r,o,n=()=>{},c){let s=(i,a)=>n(i,a,t.session_id),u=(process.env.ASSURANCE_LOG_LEVEL??"info").toLowerCase()==="debug",f={contextDir:e.contextDir,resolveAlias:i=>ue(i,{env:process.env,auth:e.auth}),embed:(i,a)=>de(i,a,{env:process.env,auth:e.auth}),...e.onEmbedDegraded?{onDegraded:e.onEmbedDegraded}:{}},d=0,l=e.agent(t,{auth:e.auth,onWarn:i=>{s("warn",i),e.out(i)},onStderr:i=>s("agent_stderr",i)}),g=null,h=null,p,S,_=l.send.bind(l),b=new Set(["user_response","user_message","session_complete"]),m=null,w=!1,C=[],A=i=>{if(i.type==="session_complete"&&(w=!0),m!==null&&b.has(i.type)){C.push(i),s("belt_withheld",{type:i.type,unacked_seq:m});return}_(i)};if(t.checkpoints&&!e.checkpoint)throw l.kill(),new Error("run_config.checkpoints is on but DriverDeps.checkpoint sink is absent (programming error)");let se=!1,Q=e.pendingDeferral??null,O=!1,Ne=e.chat?.attachSender?.(i=>A(i));e.initialMessage&&(A({type:"user_message",message_id:`msg-${t.session_id}-${lt(3).toString("hex")}`,text:e.initialMessage}),s("user_message_sent",{chars:e.initialMessage.length,...u?{text:e.initialMessage}:{}}),e.emit?.({type:"message_sent",sid:t.session_id,chars:e.initialMessage.length}),e.chat?.note("\u21B3 delivered to the agent"));let z,F=0,K=0,B=0,W,R=ge(),G=e.progress??e.out;try{for await(let i of l.events){try{e.chat?.onAgentEvent(i)}catch(a){s("chat_mirror_error",{event_type:i.type,message:a instanceof Error?a.message:String(a)})}if(i.type==="reasoning_delta"?(d+=i.text.length,process.env.KANE_TRACE_REASONING&&s("reasoning_delta",i.text)):i.type==="state_checkpoint"&&!process.env.KANE_TRACE_REASONING?s("state_checkpoint",{seq:i.seq,items:i.delta_items.length,bytes:JSON.stringify(i.delta_items).length}):s(i.type,i),i.type==="reasoning_done"&&s("reasoning_chars",d),i.type==="progress")G(`\u2026 ${i.stage}${i.n?` #${i.n}`:""}`),e.emit?.({type:"agent_activity",kind:"progress",label:`${i.stage}${i.n?` #${i.n}`:""}`});else if(i.type==="reasoning_delta"||i.type==="reasoning_done"||i.type==="tool_activity"||i.type==="decision_activity"){e.onStreamEvent?.(i);let a=R;if(R=me(R,i),R===a)continue;i.type==="reasoning_delta"?R.liveThinking===i.text&&G("\u2237 thinking\u2026"):i.type==="reasoning_done"?i.present&&(G(`thought for ${(i.took_ms/1e3).toFixed(1)}s`),e.emit?.({type:"agent_activity",kind:"thinking_done",label:`thought for ${(i.took_ms/1e3).toFixed(1)}s`})):i.type==="tool_activity"?i.status!=="done"&&(G(R.activity[R.activity.length-1].label),e.emit?.({type:"agent_activity",kind:"tool",label:R.activity[R.activity.length-1].label})):(G(`\xB7 ${R.activity[R.activity.length-1].label}`),e.emit?.({type:"agent_activity",kind:"decision",label:R.activity[R.activity.length-1].label}))}else if(i.type==="usage"){W=i.total_credits;let a=x=>Math.round(x*100)/100;e.emit?.({type:"usage",credits:a(i.credits),total_credits:a(i.total_credits)})}else if(i.type==="graph_query"){let a=await $e(e.graphSlot?.current??o,i.method,i.params??{},f),x=a.ok?{type:"graph_result",id:i.id,ok:!0,result:a.result}:{type:"graph_result",id:i.id,ok:!1,error:a.error};s("graph_result",u?{id:i.id,method:i.method,ok:a.ok,result:a.ok?a.result:a.error}:{id:i.id,method:i.method,ok:a.ok}),A(x)}else if(i.type==="ingest_request")if(e.ingest){let a;try{a=await e.ingest({id:i.id,ref:i.ref,purpose:i.purpose??null})}catch(T){s("ingest_executor_threw",{id:i.id,error:T instanceof Error?T.message:String(T)}),a={ok:!1,error:{code:"INGEST_FAILED",message:"the landing failed \u2014 see the trace for detail"}}}let x=a.ok?{type:"ingest_result",id:i.id,ok:!0,result:a.result}:{type:"ingest_result",id:i.id,ok:!1,error:a.error};s("ingest_result",a.ok?{id:i.id,ok:!0,source_id:a.result.source_id}:{id:i.id,ok:!1,code:a.error.code}),A(x)}else{let a={type:"ingest_result",id:i.id,ok:!1,error:{code:"INGEST_UNAVAILABLE",message:"this session has no ingest executor"}};s("ingest_result",{id:i.id,ok:!1,code:a.error.code}),A(a)}else if(i.type==="state_checkpoint"){if(!e.checkpoint)throw new Error("state_checkpoint arrived with no checkpoint sink (programming error)");m=i.seq;try{for(e.checkpoint.persist(i),m=null,_({type:"checkpoint_ack",seq:i.seq}),s("checkpoint_acked",{seq:i.seq,at:i.at});C.length>0&&m===null;)A(C.shift())}catch(a){let x=a instanceof Error?a.message:String(a);se||(se=!0,e.out("warning: couldn't save the session checkpoint \u2014 pausing so no work is lost")),s("checkpoint_persist_failed",{seq:i.seq,message:x}),_({type:"pause"})}}else if(i.type==="session_paused")O=!0,S=i;else if(i.type==="done")O=!0;else if(i.type==="ask_user"){i.text&&(e.chat?e.chat.ledger({kind:"agent",text:i.text}):e.out(i.text),e.emit?.({type:"agent_message",text:i.text}));let a=t.mode;if(Q){let y=Q;Q=null,e.emit?.({type:"ask_deferred",source_id:y.ingested.source_id,cid:y.ingested.cid,questions:i.questions.length}),s("ask_deferred",{source_id:y.ingested.source_id,questions:i.questions.length}),A({type:"user_response",answers:[],deferral:{deferred:!0,ingested:y.ingested}});continue}if(a!=="interactive"){if(a==="agent"){s("pause_requested",{questions:i.questions.map(v=>v.id)}),A({type:"pause"});continue}if(a==="ci"){let v=i.questions.filter(E=>E.risk==="high");if(v.length>0){z=v,l.kill();break}}let y=Ce(i.questions,[],{explicitAcceptDefaults:!0});F+=y.length;for(let v of y)s("assumed_default",{id:v.id,resolution:v.resolution}),e.emit?.({type:"assumed_default",id:v.id,selected_index:v.selected_index,risk:i.questions.find(E=>E.id===v.id)?.risk});let D={type:"user_response",answers:y.map(v=>({id:v.id,selected_index:v.resolution==="deferred"?null:v.selected_index,free_text:null}))};A(D);continue}let x=await e.ask(i.questions);if(!Array.isArray(x)){A({type:"user_response",answers:[],deferral:x});continue}let T=x,Oe=Ce(i.questions,T,{explicitAcceptDefaults:!1}),Fe={type:"user_response",answers:i.questions.map(y=>{let D=T.find(E=>E.id===y.id);if(D?.free_text!=null){let E=D.selected_index!=null&&D.selected_index>=0&&D.selected_index<y.options.length?D.selected_index:null;if(E!=null){let N=y.allow_free_text||y.options[E]?.input===!0;return N&&D.free_text!=null&&r.set(y.id,(r.get(y.id)??0)+1),{id:y.id,selected_index:E,free_text:N?D.free_text:null}}let ie=r.get(y.id)??0;if(!y.allow_free_text||ie>=ut){let N=y.options[y.recommended_index]?.label??"recommended option";if(F+=1,e.emit?.({type:"assumed_default",id:y.id,selected_index:y.recommended_index,risk:y.risk}),e.chat?.noteCoercion)e.chat.noteCoercion(y,N);else{let X=y.text.replace(/\?+\s*$/,""),Be=X.length<=36?X:`${X.slice(0,33)}\u2026`;e.out(`note: couldn't use a typed answer for "${Be}" \u2014 kept the recommended option (${N})`)}return{id:y.id,selected_index:y.recommended_index,free_text:null}}return r.set(y.id,ie+1),{id:y.id,selected_index:null,free_text:D.free_text}}let v=Oe.find(E=>E.id===y.id);return v.resolution==="deferred"?{id:y.id,selected_index:null,free_text:null}:{id:y.id,selected_index:v.selected_index,free_text:null}})};A(Fe)}else if(i.type==="chat_ops"&&!e.chat){let a=i.chat_ops??i,x=Array.isArray(a.ops)?a.ops.length:0;if(x===0)a.text&&(e.out(a.text),e.emit?.({type:"agent_message",text:a.text})),A({type:"session_complete"}),s("headless_zero_op_chat_turn_complete",{chars:a.text?.length??0});else if(B<dt)B+=1,A({type:"user_message",message_id:`nochat-${t.session_id}-${B}`,text:"[auto-repair] chat ops are unavailable in this mode \u2014 commit through finalize_design, or finish if nothing remains."}),s("headless_chat_ops_nudge",{n:B,ops:x});else{h="the agent kept trying to hold a conversation in a non-interactive run",e.out("error: the agent kept trying to hold a conversation in a non-interactive run \u2014 session closed; re-run interactively, or retry"),s("headless_chat_ops_terminal",{ops:x}),l.kill();break}}else if(i.type===(c.terminalEventType??"proposal")){let a=await c.onProposalEvent(i[i.type]);if(g=a.proposal,a.error&&(h=a.error),a.receipt)e.emit?.(a.receipt.event),t.mode!=="interactive"?(K+=1,a.sessionComplete||K>=Me?(a.sessionComplete||(e.out(`warning: ${Me} commits without completion \u2014 closing the session (runaway guard)`),s("receipt_runaway_cap",{commits:K})),A({type:"session_complete"}),s("session_complete_sent",{commit_n:a.receipt.event.commit_n,runaway:!a.sessionComplete})):(A({type:"user_message",message_id:`receipt-${t.session_id}-${String(a.receipt.event.commit_n??0)}`,text:a.receipt.text}),s("receipt_sent",{commit_n:a.receipt.event.commit_n,chars:a.receipt.text.length}))):e.chat?.holdReceipt&&(e.chat.holdReceipt(a.receipt.text),s("receipt_held",{commit_n:a.receipt.event.commit_n}));else if(a.error&&t.mode!=="interactive"){e.out("error: saving the agent's work failed and can't be retried in this mode \u2014 session closed; re-run to retry"),e.emit?.({type:"warning",code:"SAVE_FAILED",message:"saving the agent's work failed and can't be retried in this mode \u2014 session closed; re-run to retry"}),s("headless_commit_error_terminal",{error:a.error}),l.kill();break}}else if(i.type==="error"){O=!0;let a=i;if(a.code==="PAIR_MISMATCH")throw new le(a.expected??"",a.actual??"");h=i.message,typeof a.code=="string"&&(p=a.code);let x=i.failed_proposal;x&&s("failed_proposal",x)}}}finally{l.kill(),Ne?.()}let Le=t.chat===!0&&t.mode==="interactive",oe=!!e.checkpoint&&!O&&!w&&!S&&!z&&h===null&&g===null&&!Le;return{proposal:g,error:h,...p!==void 0?{errorCode:p}:{},paused:S,highRisk:z,...F>0?{assumedDefaults:F}:{},...W!==void 0?{creditsTotal:W}:{},...oe?{crashed:oe}:{}}}function Te(t,e){let r=e.trim(),o=null;for(let n of t??[])if(n.ref===r){if(!n.consumed)return{kind:"unconsumed"};o={kind:"consumed",identity:n.consumed}}return o??{kind:"unauthorized"}}function $t(t,e,r){let o=e.trim(),n=[...t??[]];return n.find(s=>s.ref===o&&!s.consumed)||n.push({ref:o,entered_at:r.toISOString()}),n}function Ie(t,e,r){let o=e.trim(),n=[...t??[]],c=n.findIndex(s=>s.ref===o&&!s.consumed);return c<0||(n[c]={...n[c],consumed:r}),n}import{basename as H}from"path";function Ge(t,e,r,o,n){let c=e.mediaOf(o),s=0;if(c.format!=="image"){let u=L(t,e,o);u&&(s=u.toString("utf8").replace(/\n$/,"").split(`
8
- `).length)}return{source_id:r,cid:o,total_lines:s,media_type:c.format,status:n}}function Lt(t){return async e=>{let r=Te(t.handle.state.ingest_registry,e.ref);if(r.kind==="unauthorized")return{ok:!1,error:{code:"INGEST_UNAUTHORIZED_REF",message:"that ref was not provided by the owner this session \u2014 only owner-provided refs may land"}};if(r.kind==="consumed"){let p=t.graphSlot?.current??I(t.contextDir);return{ok:!0,result:Ge(t.contextDir,p,r.identity.source_id,r.identity.cid,"unchanged")}}let o=[],n={out:p=>o.push(p),err:p=>o.push(p),confirm:async()=>!1,isTTY:!1},c;try{c=await pe([e.ref],{},n,t.cwd,t.remoteDeps)}catch(p){return{ok:!1,error:{code:"INGEST_FAILED",message:p instanceof Error?p.message:String(p)}}}if(c.code!==0||c.results.length===0)return{ok:!1,error:{code:"INGEST_FAILED",message:o.find(S=>S.startsWith("error:"))??o.at(-1)??"the landing failed"}};let s=c.results[0],u={source_id:s.source_id,cid:s.source_cid},f=Ie(t.handle.state.ingest_registry,e.ref,u),d=s.status==="versioned"&&t.schedule,l=t.schedule?[...t.handle.state.ingest_schedule??[],d?{source_id:s.source_id,cid:s.source_cid,status:"skipped",note:"new version of a known source \u2014 its changes await your review (reconcile), never a blind re-extraction"}:{source_id:s.source_id,cid:s.source_cid,status:"pending"}]:void 0;t.handle.save({ingest_registry:f,...l!==void 0?{ingest_schedule:l}:{}}),t.graphSlot&&(t.graphSlot.current=I(t.contextDir));let g=t.graphSlot?.current??I(t.contextDir),h=Ge(t.contextDir,g,s.source_id,s.source_cid,s.status==="unchanged"?"unchanged":"landed");return t.note(d?`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; a NEW VERSION of a known source \u2014 its changes await your review (the check-in offers it), not a blind re-extraction`:t.schedule?`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; scheduled for extraction in this run`:t.scheduleRefused?`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; ${t.scheduleRefused}`:`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; it guides this design only (not extracted \u2014 its own extraction pass adds its use-cases)`),{ok:!0,result:h}}}var ft={kind:"system",id:"distiller"};function Ut(t,e=r=>process.stderr.write(r+`
9
- `)){try{let r=I(t),{watermark:o}=fe(t),n=he({contextDir:t,graph:r,watermark:o,by:ft});if(n.errors){let c=n.errors.map(s=>`${s.code}: ${s.detail}`).join("; ");return e(`warning: style-note distill skipped \u2014 ${c}`),{minted:0,error:c}}if(n.minted>0)try{ae(t)}catch{}return{minted:n.minted,error:null}}catch(r){let o=r instanceof Error?r.message:String(r);return e(`warning: style-note distill skipped \u2014 ${o}`),{minted:0,error:o}}}export{mt as a,$e as b,ut as c,Ce as d,Et as e,$t as f,Lt as g,Ut as h};
@@ -1,5 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as k}from"./chunk-KDNNMU7Q.js";import{b as w}from"./chunk-3UI5VTQS.js";import{f as E,g as h}from"./chunk-XLSOQLVT.js";var g=(e,t,r=new Set)=>{let s=e.nameOf.get(t);if(s!==void 0)return s;if(r.has(t))return t;r.add(t);for(let[o,n]of e.superseded){if(n!==t)continue;let d=g(e,o,r);if(d!==o)return d}return t};function b(e,t){let r=e.stale(t);if(r==="fresh")return;if(r==="orphaned")return"orphaned \u2014 no live source evidences this item";let s=[],o=new Map;for(let n of e.derivesInto(t))o.set(String(n.props.source_id),n);for(let[n,d]of o){let i=e.heads.get(n);if(i==null||i===d.props.source_cid)continue;let a=e.convChains.get(n)?.chain;a&&a.includes(String(d.props.source_cid))||s.push(`DERIVES pin ${n}@${String(d.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let n of e.edgesFrom(t)){if(n.type===h.DERIVES||!e.superseded.has(n.dst))continue;let d=e.tipOf(n.dst);if(e.superseded.has(d)){s.push(`${n.type} pin \u2192 ${g(e,n.dst)} \u2014 target retired`);continue}let i=C(e,n.dst,d);s.push(i.length>0?`${g(e,n.dst)} updated: ${i.map(a=>a.field).join(", ")}`:`${n.type} pin \u2192 ${g(e,n.dst)} \u2014 target superseded`)}return s.length>0?s.join("; "):"stale \u2014 a pinned dependency moved"}function C(e,t,r){let s=e.getNode(t)?.content??{},o=e.getNode(r)?.content??{},n=i=>i===void 0?"":Array.isArray(i)?i.map(String).join(" \xB7 "):typeof i=="object"?JSON.stringify(i):String(i),d=[];for(let i of[...new Set([...Object.keys(s),...Object.keys(o)])].sort())JSON.stringify(s[i])!==JSON.stringify(o[i])&&d.push({field:i,old:n(s[i]),new:n(o[i])});return d}function P(e,t){let r=[];for(let{cid:s}of e.byLabel(E.SCENARIO))e.superseded.has(s)||e.edgesFrom(s).some(o=>o.type===h.BELONGS_TO&&e.tipOf(o.dst)===t)&&r.push(s);return r}function O(e,t){let r=[],s=[],o=[],n=[],d=[],i=[],a=P(e,t),y=new Set(a),l=(c,f)=>{let u=b(e,f);return u===void 0?c:{...c,stale:!0,stale_reason:u}};for(let c of a){let f=e.getNode(c)?.content??{};r.push(l({ref:g(e,c),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},c));for(let u of e.edgesInto(c)){if(u.type!==h.AUTOMATES||e.superseded.has(u.src))continue;let p=e.getNode(u.src)?.content??{},S=e.edgesFrom(u.src).filter(x=>x.type===h.VERIFIES&&!e.superseded.has(x.dst)).map(x=>g(e,x.dst));s.push(l({ref:g(e,u.src),title:String(p.title??""),automates:g(e,c),check:p.check,verifies:S,...typeof p.target=="string"?{target:p.target}:{},...typeof p.app=="string"?{app:p.app}:{}},u.src)),d.push(u.src)}for(let u of e.edgesFrom(c))u.type!==h.EXERCISES||e.superseded.has(u.dst)||n.push({scenario:g(e,c),ac:g(e,u.dst)})}for(let{cid:c}of e.byLabel(E.AC)){if(e.superseded.has(c))continue;let f=e.edgesFrom(c).find(x=>x.type===h.SCOPED_TO);if(!f)continue;let u=e.tipOf(f.dst);if(!(u===t||y.has(u)))continue;let S=e.getNode(c)?.content??{};o.push(l({ref:g(e,c),text:String(S.text??""),kind:String(S.kind??""),scope:u===t?"use-case":g(e,u)},c)),i.push(c)}let _=[],m=new Set;for(let c of[t,...a,...d,...i])for(let f of e.retractedEdgesTouching(c))m.has(f.ecid)||(m.add(f.ecid),_.push({type:f.type,src:g(e,f.src),dst:g(e,f.dst),at:f.retraction.at,...f.retraction.reason?{reason:f.retraction.reason}:{}}));return{scenarios:r,tests:s,acs:o,exercises:n,retracted_edges:_}}function D(e,t,r){let s=k(e,t,r);return s===null?null:s.toString("utf8")}function v(e,t){let r=t.split(`
3
- `).map(o=>o.replace(/^\d+\| /,"")),s=[];for(let o of e.split(`
4
- `)){let n=o.trim();if(n.length===0)continue;let d=r.find(i=>i.includes(n));d!==void 0&&!s.includes(d.trim())&&s.push(d.trim())}return s.length>0?s.join(`
5
- `):{removed:!0}}function G(e,t,r,s){if(s!==void 0&&s.trim().length>0)return{kind:"user-directive",text:s.trim()};let o=[r,...O(t,r).acs.map(a=>t.resolve(a.ref)?.cid??"")].filter(Boolean),n=[],d=new Set;for(let a of o){let y=new Map;for(let l of t.derivesInto(a))y.set(String(l.props.source_id),l);for(let[l,_]of y){let m=t.heads.get(l);if(m==null||m===_.props.source_cid)continue;let c=String(_.props.anchor),f=`${l}\0${c}`;if(d.has(f)||c==="img#whole")continue;d.add(f);let u=D(e,t,String(_.props.source_cid)),p=u===null?null:w(u,c);if(p===null)continue;let S=D(e,t,m);n.push({source_id:l,anchor:c,old_anchor_text:p,new_anchor_text:S===null?{removed:!0}:v(p,S)})}}let i;for(let[a,y]of t.superseded){if(y!==r||t.nodeLabel.get(a)!==E.USECASE)continue;let l=C(t,a,r);l.length>0&&(i=l);break}return{kind:"source-change",changes:n,...i?{uc_updated:i}:{}}}function $(e,t,r,s){let o=O(t,r);if(o.scenarios.length===0&&o.tests.length===0&&o.acs.length===0)return;let n=G(e,t,r,s);if(!(n.kind==="source-change"&&n.changes.length===0&&!n.uc_updated))return{prior_design:o,change_delta:n}}export{O as a,$ as b};