@testmuai/kane-cli 0.10.3 → 0.10.5

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 (425) hide show
  1. package/dist/ChatSurface-WKYH5MYP.js +2 -0
  2. package/dist/ChromeProfilePicker-ROQIRMWR.js +2 -0
  3. package/dist/{CliFeedbackPrompt-JWCTMIGI.js → CliFeedbackPrompt-55OKAT4W.js} +1 -1
  4. package/dist/{CliUploadProgress-XFRRFRL4.js → CliUploadProgress-NK2U3CKQ.js} +1 -1
  5. package/dist/{ConfigView-6JF4DOJN.js → ConfigView-7A5JTKLF.js} +1 -1
  6. package/dist/EvidenceViewOffer-U7J5ZRVK.js +2 -0
  7. package/dist/FolderPicker-R4QDIFTW.js +2 -0
  8. package/dist/InfoBox-SRQ4TSUT.js +2 -0
  9. package/dist/LinksBox-7BWLLQVR.js +2 -0
  10. package/dist/ProfilesView-TQTJR4WQ.js +2 -0
  11. package/dist/ProjectPicker-A5SXNDUL.js +2 -0
  12. package/dist/SaveSessionPrompt-IECYZMXW.js +2 -0
  13. package/dist/SingleShotApp-MN5IE6EU.js +2 -0
  14. package/dist/SummaryBox-WFOS6GON.js +2 -0
  15. package/dist/TestMdRunView-URNSXIVC.js +2 -0
  16. package/dist/TestrunEvidenceTable-SZPZMW3J.js +2 -0
  17. package/dist/{WhoamiView-H7JNLLCY.js → WhoamiView-G6QP4SID.js} +1 -1
  18. package/dist/{app-client-U2YYF65L.js → app-client-2RR5ATI6.js} +1 -1
  19. package/dist/app-download-UGLDWWTX.js +2 -0
  20. package/dist/{assurance-job-F4L3T4VJ.js → assurance-job-V5QB36WJ.js} +1 -1
  21. package/dist/{binary-K3XMILST.js → binary-32FXH6PQ.js} +1 -1
  22. package/dist/bind-3PB77PWJ.js +2 -0
  23. package/dist/bootstrap-A2O4UZUJ.js +2 -0
  24. package/dist/{bridge-2UHJOVLX.js → bridge-SPGIYAAG.js} +1 -1
  25. package/dist/{catalog-YCU6OHNV.js → catalog-P5IOIVYP.js} +1 -1
  26. package/dist/{catalog-client-MVEEHTG2.js → catalog-client-LR2KPSU7.js} +1 -1
  27. package/dist/{changelog-5UB3AQT6.js → changelog-GKIKDJ32.js} +1 -1
  28. package/dist/chat-committer-7E3TRZ6P.js +2 -0
  29. package/dist/chat-controller-5ZBG23L6.js +2 -0
  30. package/dist/child-MNLSG77W.js +2 -0
  31. package/dist/{chunk-5YYCCM6K.js → chunk-2AHQ3D3D.js} +1 -1
  32. package/dist/{chunk-UWPG5MWM.js → chunk-2EKLTUY2.js} +1 -1
  33. package/dist/{chunk-KL7XFNSD.js → chunk-2G7UYQOW.js} +1 -1
  34. package/dist/{chunk-GXQYFOBD.js → chunk-2MBNAW2G.js} +1 -1
  35. package/dist/{chunk-Y2HQMJGS.js → chunk-2NP3THOE.js} +1 -1
  36. package/dist/chunk-37KFCYHG.js +18 -0
  37. package/dist/{chunk-ZHAMVLQZ.js → chunk-3A4KK22B.js} +1 -1
  38. package/dist/{chunk-L3BUPFAQ.js → chunk-3CFAE36M.js} +1 -1
  39. package/dist/{chunk-TU2KPOW2.js → chunk-3DFBFYTD.js} +2 -2
  40. package/dist/{chunk-QE4AWNOV.js → chunk-3RJRCAUX.js} +6 -6
  41. package/dist/chunk-3UY4WPMQ.js +8 -0
  42. package/dist/{chunk-3NWUXRSI.js → chunk-4DM5EWEV.js} +1 -1
  43. package/dist/{chunk-ZMWTRXFH.js → chunk-4DRFMDAW.js} +1 -1
  44. package/dist/{chunk-PI7OXS62.js → chunk-5EAJO372.js} +1 -1
  45. package/dist/{chunk-4KL3TSTT.js → chunk-5K7PCSTP.js} +4 -4
  46. package/dist/{chunk-HV2CDY4K.js → chunk-5LKDOE3P.js} +1 -1
  47. package/dist/{chunk-AT7AT3AR.js → chunk-5OFHMBZC.js} +5 -5
  48. package/dist/{chunk-CQDCNP7V.js → chunk-5ORBAYTU.js} +1 -1
  49. package/dist/{chunk-2TK4MDF2.js → chunk-63BFLTJI.js} +1 -1
  50. package/dist/{chunk-BBJAKSA7.js → chunk-642GD7E6.js} +2 -2
  51. package/dist/{chunk-KKLCXRW6.js → chunk-642LB5R2.js} +1 -1
  52. package/dist/{chunk-Q4SMITTV.js → chunk-66C5A2F5.js} +1 -1
  53. package/dist/{chunk-X6FCXBXU.js → chunk-6FVGPKVX.js} +1 -1
  54. package/dist/{chunk-32HED7X2.js → chunk-6KUUSONE.js} +1 -1
  55. package/dist/{chunk-6FFX4S7N.js → chunk-6OL5EVRC.js} +1 -1
  56. package/dist/{chunk-SXBPUUQ5.js → chunk-6PZ3SVWE.js} +1 -1
  57. package/dist/{chunk-SJQTTEXQ.js → chunk-6VG2FG67.js} +1 -1
  58. package/dist/chunk-6WN4WSXR.js +2 -0
  59. package/dist/{chunk-CB2BWDHG.js → chunk-76MKY7FG.js} +4 -4
  60. package/dist/{chunk-LRNUGKYH.js → chunk-77BZTEHJ.js} +1 -1
  61. package/dist/chunk-7TSM2FCL.js +5 -0
  62. package/dist/{chunk-KQ4XKTIZ.js → chunk-A5C7HIAH.js} +1 -1
  63. package/dist/{chunk-ENRFXGID.js → chunk-ABAUIIPD.js} +1 -1
  64. package/dist/{chunk-JTNEF5ZP.js → chunk-AL6IAMYV.js} +1 -1
  65. package/dist/{chunk-4CJQ7XZP.js → chunk-AXOSLGQ4.js} +1 -1
  66. package/dist/{chunk-CNHKZE4F.js → chunk-BDZWRJAL.js} +1 -1
  67. package/dist/{chunk-VCVEZEVS.js → chunk-BFRWZPIK.js} +1 -1
  68. package/dist/{chunk-IZ66FKPC.js → chunk-BIGOLVK6.js} +1 -1
  69. package/dist/{chunk-Q4ALB7SH.js → chunk-BLHFNL5K.js} +1 -1
  70. package/dist/chunk-BRWCWZE3.js +2 -0
  71. package/dist/{chunk-X7S7IGCV.js → chunk-BXJNL22L.js} +1 -1
  72. package/dist/chunk-BZEW7CSM.js +3 -0
  73. package/dist/{chunk-Z24SD2EJ.js → chunk-C3DMMAFP.js} +1 -1
  74. package/dist/{chunk-DQXQJJOP.js → chunk-C466XER3.js} +2 -2
  75. package/dist/{chunk-BLVDV3QQ.js → chunk-C4UME2PA.js} +1 -1
  76. package/dist/chunk-CBEMXSWF.js +2 -0
  77. package/dist/{chunk-6QCCTZO3.js → chunk-CBPACEYQ.js} +1 -1
  78. package/dist/{chunk-MD3RABID.js → chunk-CJGQFKLJ.js} +1 -1
  79. package/dist/{chunk-YVVFXBT5.js → chunk-CQBLJTDU.js} +1 -1
  80. package/dist/{chunk-X2MDL6S4.js → chunk-CVVUBCB7.js} +1 -1
  81. package/dist/{chunk-35BG2EMW.js → chunk-E3C4OWSD.js} +1 -1
  82. package/dist/{chunk-ERRIDBE7.js → chunk-EIQSXD7B.js} +1 -1
  83. package/dist/{chunk-YPGZ5E4I.js → chunk-EP4WGGMY.js} +1 -1
  84. package/dist/{chunk-GAKBHNC4.js → chunk-EUGFABAS.js} +1 -1
  85. package/dist/{chunk-HBLHKQR7.js → chunk-F4GWIX66.js} +1 -1
  86. package/dist/{chunk-SALZ6WSF.js → chunk-F4XCCOWC.js} +1 -1
  87. package/dist/{chunk-NHGPMYM3.js → chunk-FHULYIG3.js} +1 -1
  88. package/dist/{chunk-7RELCXRW.js → chunk-FKA5SWWF.js} +1 -1
  89. package/dist/{chunk-OCVDMZWB.js → chunk-FLGOQ6Q6.js} +1 -1
  90. package/dist/{chunk-YILRYMMG.js → chunk-FNBHP75S.js} +1 -1
  91. package/dist/{chunk-JBKHX5ES.js → chunk-FOURJ24E.js} +1 -1
  92. package/dist/{chunk-DC5F2ADJ.js → chunk-FOUUD3LI.js} +1 -1
  93. package/dist/{chunk-IEHJG6J4.js → chunk-FP6JCXOS.js} +1 -1
  94. package/dist/{chunk-ZDCXWEQG.js → chunk-GRQKMOKE.js} +1 -1
  95. package/dist/{chunk-XKOVEMVZ.js → chunk-H23ZMHHC.js} +1 -1
  96. package/dist/{chunk-E4GIGM5V.js → chunk-H6IPGZTP.js} +1 -1
  97. package/dist/{chunk-MINDIQET.js → chunk-HBGYEA3O.js} +1 -1
  98. package/dist/{chunk-KBGMQYMD.js → chunk-HHF7AM3D.js} +1 -1
  99. package/dist/{chunk-PCQK62MP.js → chunk-HTJDMLZS.js} +1 -1
  100. package/dist/{chunk-ZPU3WAC4.js → chunk-HY5BBSYX.js} +1 -1
  101. package/dist/{chunk-TM6VLC6V.js → chunk-IPIARGHE.js} +1 -1
  102. package/dist/{chunk-M2E5CPPV.js → chunk-IPXITNFD.js} +1 -1
  103. package/dist/{chunk-NI3TIAD7.js → chunk-IT6M7OMG.js} +1 -1
  104. package/dist/{chunk-Y3RJHWNK.js → chunk-ITG5WMQG.js} +1 -1
  105. package/dist/{chunk-WEJR2V7R.js → chunk-J3XOEMKO.js} +1 -1
  106. package/dist/{chunk-OHGL4GEJ.js → chunk-J3YID4A5.js} +1 -1
  107. package/dist/{chunk-OCMPWCKQ.js → chunk-J44FV6CH.js} +1 -1
  108. package/dist/{chunk-3MD2XLE7.js → chunk-J5D4IGAM.js} +9 -8
  109. package/dist/{chunk-6QH75BPJ.js → chunk-J5QFO7LW.js} +1 -1
  110. package/dist/{chunk-GJXO6FF7.js → chunk-JBUKEIYL.js} +1 -1
  111. package/dist/{chunk-EJGCIGQY.js → chunk-JGQ3VB44.js} +1 -1
  112. package/dist/{chunk-GEZVC4S3.js → chunk-JM6AKCN4.js} +1 -1
  113. package/dist/{chunk-3KY7HHQU.js → chunk-JSSM2TWY.js} +1 -1
  114. package/dist/{chunk-3ZC7GSMM.js → chunk-JVXEAO62.js} +1 -1
  115. package/dist/{chunk-TM45NPWL.js → chunk-JYH7CTF7.js} +1 -1
  116. package/dist/{chunk-YNDELIXL.js → chunk-JZ7GFPKZ.js} +1 -1
  117. package/dist/{chunk-CTHUX7O4.js → chunk-KUSHV5SR.js} +1 -1
  118. package/dist/{chunk-LTPOMMAB.js → chunk-LB5NIDW6.js} +1 -1
  119. package/dist/{chunk-SIHX5FW5.js → chunk-LJKTIKZY.js} +1 -1
  120. package/dist/{chunk-LPJKNX6D.js → chunk-LMOW4NM5.js} +1 -1
  121. package/dist/{chunk-WIVKLNIO.js → chunk-LPJX5L3F.js} +1 -1
  122. package/dist/{chunk-HRIDAK6Y.js → chunk-LWP7E5FU.js} +1 -1
  123. package/dist/{chunk-YWWVF5OU.js → chunk-LXYXCANZ.js} +1 -1
  124. package/dist/{chunk-35WUYKGO.js → chunk-MAQVRBUQ.js} +1 -1
  125. package/dist/{chunk-NPAUSUNM.js → chunk-MBNSCXVK.js} +1 -1
  126. package/dist/{chunk-ZMIKNNO6.js → chunk-MIQ6J5YG.js} +1 -1
  127. package/dist/chunk-MTMHB5LF.js +2 -0
  128. package/dist/{chunk-RNHSULQM.js → chunk-MUL2QFG2.js} +1 -1
  129. package/dist/{chunk-MEBEVHGP.js → chunk-N4XUGIAK.js} +1 -1
  130. package/dist/{chunk-GQAWZEA4.js → chunk-NAUIJF72.js} +1 -1
  131. package/dist/{chunk-PB6RXDWQ.js → chunk-NFDVDEOH.js} +2 -2
  132. package/dist/{chunk-LHJSIHLC.js → chunk-NGBXXBHP.js} +1 -1
  133. package/dist/{chunk-YCVEI7BT.js → chunk-NIBNVPAE.js} +1 -1
  134. package/dist/chunk-NKJRAQ6L.js +6 -0
  135. package/dist/{chunk-OZNYQONA.js → chunk-NNVHWFLI.js} +3 -3
  136. package/dist/{chunk-7SU53QGU.js → chunk-NZ7UCAN6.js} +1 -1
  137. package/dist/{chunk-7V34ZMMS.js → chunk-OKCVG7AG.js} +1 -1
  138. package/dist/{chunk-LZGAFKYH.js → chunk-OMCJD4LH.js} +1 -1
  139. package/dist/{chunk-VO2NNXKR.js → chunk-OPR5XIPT.js} +1 -1
  140. package/dist/{chunk-EZMRWXRT.js → chunk-OVB5GVRB.js} +1 -1
  141. package/dist/{chunk-LV7224DG.js → chunk-PCL2FYPE.js} +1 -1
  142. package/dist/{chunk-AVLYSNEG.js → chunk-PE3CEG6E.js} +1 -1
  143. package/dist/{chunk-MEMXFTLD.js → chunk-PEHVBCXM.js} +1 -1
  144. package/dist/{chunk-6HRNG4CK.js → chunk-PKXWYYVK.js} +1 -1
  145. package/dist/{chunk-YQZ736IQ.js → chunk-PSBR2LVL.js} +1 -1
  146. package/dist/{chunk-R6TFRAMZ.js → chunk-PUNFWBRW.js} +1 -1
  147. package/dist/{chunk-7Y55CO42.js → chunk-PZOQ2IQK.js} +1 -1
  148. package/dist/{chunk-SMGRXKXX.js → chunk-Q4QCSO6Y.js} +1 -1
  149. package/dist/{chunk-TUSG7DIL.js → chunk-QJ5XHVS5.js} +1 -1
  150. package/dist/{chunk-TAY7J5VS.js → chunk-QLGQDNA3.js} +1 -1
  151. package/dist/{chunk-QEM5ZRDN.js → chunk-QRUAI2ST.js} +1 -1
  152. package/dist/{chunk-C4KAPGBS.js → chunk-QWEQ742S.js} +3 -3
  153. package/dist/{chunk-Z47ZEFH7.js → chunk-R6S4EJ5R.js} +1 -1
  154. package/dist/{chunk-WE7HRAGO.js → chunk-RHQLDNZL.js} +1 -1
  155. package/dist/{chunk-3RO2YGKH.js → chunk-RM5ZVDVR.js} +1 -1
  156. package/dist/{chunk-N7IWR45S.js → chunk-RU3SWHRE.js} +1 -1
  157. package/dist/{chunk-OBNVGD5H.js → chunk-S5UITUBB.js} +1 -1
  158. package/dist/chunk-SACFQNUH.js +47 -0
  159. package/dist/{chunk-X45RZIAJ.js → chunk-SDIHDYWT.js} +1 -1
  160. package/dist/{chunk-AHT2ORJT.js → chunk-SFHDRKUX.js} +1 -1
  161. package/dist/{chunk-OTMHCHH6.js → chunk-SLISNOG6.js} +1 -1
  162. package/dist/{chunk-T77LTLAD.js → chunk-SULRMI2J.js} +1 -1
  163. package/dist/{chunk-OOGKX4Y6.js → chunk-TC2PHBPH.js} +1 -1
  164. package/dist/{chunk-HVOXMCKE.js → chunk-TCK7WR3M.js} +1 -1
  165. package/dist/{chunk-FOLUB336.js → chunk-TFSWG7AS.js} +1 -1
  166. package/dist/{chunk-PRBWZXFA.js → chunk-TOOJTCON.js} +6 -6
  167. package/dist/chunk-TPCW5OU5.js +3 -0
  168. package/dist/chunk-U5V3L5QH.js +2 -0
  169. package/dist/{chunk-LXK4B2FE.js → chunk-UJYC2XDD.js} +1 -1
  170. package/dist/chunk-UV7FPIBL.js +2 -0
  171. package/dist/{chunk-23DKB2MT.js → chunk-UVL6XQHU.js} +1 -1
  172. package/dist/{chunk-M7A66MSK.js → chunk-UWEBI76C.js} +1 -1
  173. package/dist/{chunk-PTLOOVV4.js → chunk-UWQ4KXLB.js} +1 -1
  174. package/dist/{chunk-ZCBOHWN3.js → chunk-V24LUINK.js} +1 -1
  175. package/dist/{chunk-ND6OP3O2.js → chunk-V3IWCGZT.js} +1 -1
  176. package/dist/{chunk-YDB72F4K.js → chunk-V4SL74TK.js} +1 -1
  177. package/dist/chunk-VEE2O524.js +34 -0
  178. package/dist/{chunk-VKVYT6KZ.js → chunk-VJRXJJML.js} +2 -2
  179. package/dist/{chunk-NRAPCFI2.js → chunk-VKIUHHNT.js} +2 -2
  180. package/dist/{chunk-QHH42RH5.js → chunk-W3PQMIXE.js} +1 -1
  181. package/dist/{chunk-LLQWEGXD.js → chunk-W5EDS4DF.js} +1 -1
  182. package/dist/{chunk-LUA25RYS.js → chunk-WAC5WISH.js} +1 -1
  183. package/dist/{chunk-W54BX6HC.js → chunk-WCIRLITM.js} +1 -1
  184. package/dist/chunk-WMXBRC4B.js +21 -0
  185. package/dist/{chunk-RQKMSNEU.js → chunk-WTMCDYR3.js} +1 -1
  186. package/dist/{chunk-DXIQVBMI.js → chunk-WZ3FE5MT.js} +1 -1
  187. package/dist/{chunk-GLM5UGTF.js → chunk-X66NIHT4.js} +1 -1
  188. package/dist/{chunk-B7ZX5HEN.js → chunk-XDAFRUAJ.js} +1 -1
  189. package/dist/{chunk-JNPFEBUR.js → chunk-XDAHKZ4J.js} +1 -1
  190. package/dist/chunk-XJV5SF3X.js +26 -0
  191. package/dist/{chunk-ZCL7XIVS.js → chunk-XKJZG4GR.js} +1 -1
  192. package/dist/{chunk-EBJW6POT.js → chunk-XRJH4UF3.js} +1 -1
  193. package/dist/chunk-XTQUCCJH.js +2 -0
  194. package/dist/chunk-Y3RDLUH5.js +7 -0
  195. package/dist/{chunk-SVIIUKJ2.js → chunk-Y7GSOKXS.js} +1 -1
  196. package/dist/{chunk-UJ37XGSP.js → chunk-YF22VTR5.js} +3 -3
  197. package/dist/chunk-YIBLZIXF.js +13 -0
  198. package/dist/{chunk-2JFRN62I.js → chunk-YLI7DQMJ.js} +2 -2
  199. package/dist/chunk-YQXOD7SV.js +102 -0
  200. package/dist/{chunk-4UX5N7YI.js → chunk-YTWBNACA.js} +1 -1
  201. package/dist/{chunk-KCXLRR3Q.js → chunk-YUFXE6WU.js} +1 -1
  202. package/dist/{chunk-SSOUYKVG.js → chunk-ZIRSTOEV.js} +1 -1
  203. package/dist/command-span-HZSKIZH7.js +2 -0
  204. package/dist/commands-TRAUFCRZ.js +2 -0
  205. package/dist/{committer-UO3B3S5Y.js → committer-L2HXEODA.js} +1 -1
  206. package/dist/{config-7WTZPMAH.js → config-O3BWQUP4.js} +1 -1
  207. package/dist/cover-cmd-SAWVP7TL.js +2 -0
  208. package/dist/{credentials-5WIFF5DG.js → credentials-NNNODDXF.js} +1 -1
  209. package/dist/{deps-bundle-BLLJ2BQ4.js → deps-bundle-CXKBCA7W.js} +1 -1
  210. package/dist/{deps-resolve-WQ6J6RLI.js → deps-resolve-K7XNTRZX.js} +1 -1
  211. package/dist/design-chat-S4KYE6PP.js +2 -0
  212. package/dist/{design-committer-7YIPFKMO.js → design-committer-ZKNW5LUS.js} +1 -1
  213. package/dist/design-headless-DDAFAJNR.js +2 -0
  214. package/dist/design-remote-UITWJ72Q.js +3 -0
  215. package/dist/device-env-SBTHFSVK.js +2 -0
  216. package/dist/dispatch-BGH5PVZ4.js +2 -0
  217. package/dist/doctor-SRMLENYN.js +2 -0
  218. package/dist/{docx-convert-DO5AQYD3.js → docx-convert-PA5S2S7P.js} +1 -1
  219. package/dist/{dossier-5XKNAK6Q.js → dossier-B6KBSRJY.js} +1 -1
  220. package/dist/evidence-FOWW3MOS.js +2 -0
  221. package/dist/evolve-cmd-MDK2H4JY.js +2 -0
  222. package/dist/evolve-remote-4G7YFC5H.js +2 -0
  223. package/dist/exit-manager-UZ7DGXS4.js +2 -0
  224. package/dist/{explain-cmd-KNDORU2D.js → explain-cmd-A5YMPXAJ.js} +1 -1
  225. package/dist/explain-cmd-Q4NLNJFB.js +12 -0
  226. package/dist/explore-MWUMVGRM.js +2 -0
  227. package/dist/explore-context-tty-QLMZGYBX.js +2 -0
  228. package/dist/explore-entry-QMCVGRP4.js +6 -0
  229. package/dist/{explore-live-XIWWUV52.js → explore-live-QIET6WO4.js} +1 -1
  230. package/dist/{explore-run-tty-M56I23IF.js → explore-run-tty-6UTBRCEF.js} +2 -2
  231. package/dist/{extract-bind-LZ22VFKB.js → extract-bind-UTERWZMW.js} +3 -3
  232. package/dist/extract-chat-4WBNRVPG.js +2 -0
  233. package/dist/{extract-cmd-46E2XDWZ.js → extract-cmd-SYZX6CML.js} +2 -2
  234. package/dist/extract-headless-QBF77JWP.js +2 -0
  235. package/dist/{feeder-NGWIPZ26.js → feeder-VAY4NYBX.js} +1 -1
  236. package/dist/folder-flags-IJ556UET.js +2 -0
  237. package/dist/gaps-cmd-E55OGZ7P.js +3 -0
  238. package/dist/gate-5UIJVMHL.js +2 -0
  239. package/dist/gate-VJ7W5QIH.js +2 -0
  240. package/dist/{generate-headless-HXAVEAEZ.js → generate-headless-VYD2QIUO.js} +3 -3
  241. package/dist/hold-passthrough-ZHOC2Q26.js +2 -0
  242. package/dist/identity-66TGWITQ.js +2 -0
  243. package/dist/{impact-cmd-TJTUFAFO.js → impact-cmd-3P6SKFJC.js} +2 -2
  244. package/dist/index.js +185 -184
  245. package/dist/ingest-6UQGSQYU.js +2 -0
  246. package/dist/ingest-cmd-HMTLO5MB.js +8 -0
  247. package/dist/ingest-remote-NIW5VAGW.js +2 -0
  248. package/dist/install-KJDAGU2R.js +2 -0
  249. package/dist/{interactive-bind-SOD7VTAY.js → interactive-bind-K3ZQFHLH.js} +4 -4
  250. package/dist/{interactive-remote-7ZSTI66T.js → interactive-remote-SGM76D6M.js} +2 -2
  251. package/dist/lane-EHU4JRRU.js +2 -0
  252. package/dist/lattice-auth-DCAVEQKY.js +2 -0
  253. package/dist/lifecycle-cmd-Y5DH2PL5.js +2 -0
  254. package/dist/list-cmd-RYHICCUV.js +3 -0
  255. package/dist/list-commands-QFTIQE6Q.js +2 -0
  256. package/dist/{list-remote-EFCET42K.js → list-remote-PWAQBF57.js} +1 -1
  257. package/dist/{locks-cmd-AZKCSGHI.js → locks-cmd-76IU4JB7.js} +1 -1
  258. package/dist/{logical-ids-74PLU3VR.js → logical-ids-YMNV2MDB.js} +1 -1
  259. package/dist/login-flow-W7RAVXSD.js +2 -0
  260. package/dist/maintenance-cmd-JNP2KCSI.js +2 -0
  261. package/dist/mobile-prompts-SP2RULD7.js +2 -0
  262. package/dist/onboarding-YPIKXNYA.js +5 -0
  263. package/dist/open-provider-LXCPVNUU.js +2 -0
  264. package/dist/{pdf-convert-YB6PJFMI.js → pdf-convert-N2C3KB4Q.js} +1 -1
  265. package/dist/persist-recorded-session-BWGA7WXR.js +3 -0
  266. package/dist/phase-seed-G5JSYKSL.js +2 -0
  267. package/dist/pipeline-YE4IRKQX.js +2 -0
  268. package/dist/{policy-commands-4PUGESCW.js → policy-commands-MSJIPHDB.js} +1 -1
  269. package/dist/prepare-target-G7LU4LYX.js +2 -0
  270. package/dist/pull-cmd-G3PVSSFP.js +2 -0
  271. package/dist/pull-route-5JQUUSU7.js +2 -0
  272. package/dist/readmodel-FARAAPUU.js +2 -0
  273. package/dist/real-device-run-425XK527.js +2 -0
  274. package/dist/reconcile-cmd-QJBYZVUB.js +5 -0
  275. package/dist/reconcile-deps-TILDRCHG.js +2 -0
  276. package/dist/{reconcile-remote-3W6ZTO3G.js → reconcile-remote-JMV26DLX.js} +2 -2
  277. package/dist/recording-banner-VZ67EWWQ.js +2 -0
  278. package/dist/registry-3YMKU5GC.js +2 -0
  279. package/dist/remote-entry-6LQRYR5F.js +2 -0
  280. package/dist/remote-mode-35BQUMEL.js +4 -0
  281. package/dist/remote-words-QXVFVHOB.js +2 -0
  282. package/dist/{require-project-folder-3DTI2CVB.js → require-project-folder-O2XCXDRE.js} +1 -1
  283. package/dist/resolve-run-intent-QCRZPYXM.js +2 -0
  284. package/dist/{resolver-CDF7QKVD.js → resolver-LWXOB7PH.js} +1 -1
  285. package/dist/revert-F6MKJ73M.js +2 -0
  286. package/dist/review-cmd-PYU7YCAC.js +5 -0
  287. package/dist/run-EABFRFOF.js +2 -0
  288. package/dist/run-LX3ARF53.js +2 -0
  289. package/dist/run-remote-PS45MTHW.js +2 -0
  290. package/dist/run-startup-gate-YBQB2JLF.js +2 -0
  291. package/dist/run-test-md-XYOCVA6F.js +20 -0
  292. package/dist/session-worker.js +2 -2
  293. package/dist/{sessions-cmd-TLUITRG5.js → sessions-cmd-WUWZYZJW.js} +2 -2
  294. package/dist/{sessions-remote-INO7AWKB.js → sessions-remote-4J7ITZB4.js} +1 -1
  295. package/dist/{skill-installer-7JH5QCJF.js → skill-installer-54ZAFNOB.js} +1 -1
  296. package/dist/store-2F26FIUS.js +2 -0
  297. package/dist/store-choice-ZE7AZMRC.js +2 -0
  298. package/dist/store-guard-X5FIEZWZ.js +2 -0
  299. package/dist/{store-site-K5NHLI7D.js → store-site-AFXB6SBW.js} +1 -1
  300. package/dist/{stream-warnings-GM7YEOVG.js → stream-warnings-I5LUWVFU.js} +1 -1
  301. package/dist/support-id-RISKXA53.js +2 -0
  302. package/dist/sync-cmd-TAVE44DU.js +2 -0
  303. package/dist/sync-setup-M65RX34Y.js +2 -0
  304. package/dist/tcg-generate-OXZF7TNQ.js +2 -0
  305. package/dist/{test-definition-53XNBEDE.js → test-definition-GXEKFRRB.js} +1 -1
  306. package/dist/testmd-actions-4OHRME2Z.js +2 -0
  307. package/dist/{testmd-sync-LYHEXWCT.js → testmd-sync-HM24JCS7.js} +1 -1
  308. package/dist/token-refresh-3SEDPIXO.js +2 -0
  309. package/dist/{use-case-ref-44BPIP4N.js → use-case-ref-E3PJDHQB.js} +1 -1
  310. package/dist/{validate-basic-66XDPA3S.js → validate-basic-HWDR665U.js} +1 -1
  311. package/dist/verdicts-KB6YTIY6.js +2 -0
  312. package/dist/{version-check-SHNVYTMU.js → version-check-DRE5KT7F.js} +1 -1
  313. package/dist/{view-cmd-QOB3O6YW.js → view-cmd-3UKV3YEX.js} +1 -1
  314. package/dist/walk-session-W6OLG5NT.js +2 -0
  315. package/dist/with-telemetry-BF4BGK5S.js +2 -0
  316. package/package.json +11 -11
  317. package/dist/ChatSurface-Z26BOE5U.js +0 -2
  318. package/dist/ChromeProfilePicker-ODRIAXL3.js +0 -2
  319. package/dist/EvidenceViewOffer-6344EX74.js +0 -2
  320. package/dist/FolderPicker-4PCYHE75.js +0 -2
  321. package/dist/InfoBox-NJ2DL7YC.js +0 -2
  322. package/dist/LinksBox-HNDNFVUT.js +0 -2
  323. package/dist/ProfilesView-DEJKJOHY.js +0 -2
  324. package/dist/ProjectPicker-DTWMWOH7.js +0 -2
  325. package/dist/SaveSessionPrompt-3GCLB3ZT.js +0 -2
  326. package/dist/SingleShotApp-HMOXO5DW.js +0 -2
  327. package/dist/SummaryBox-7PPDMSSM.js +0 -2
  328. package/dist/TestMdRunView-QLKRUU4V.js +0 -2
  329. package/dist/TestrunEvidenceTable-T2JUB4TE.js +0 -2
  330. package/dist/app-download-GKRF2EIM.js +0 -2
  331. package/dist/bind-SSHAZAB3.js +0 -2
  332. package/dist/bootstrap-XGKU4WXB.js +0 -2
  333. package/dist/chat-committer-ZKEKJA2R.js +0 -2
  334. package/dist/chat-controller-FXRJXUG3.js +0 -2
  335. package/dist/child-JHYENXE7.js +0 -2
  336. package/dist/chunk-2RBMQTYS.js +0 -26
  337. package/dist/chunk-5F5IVART.js +0 -8
  338. package/dist/chunk-6SD4XTYC.js +0 -6
  339. package/dist/chunk-7YV2FCN4.js +0 -3
  340. package/dist/chunk-A2DODRHG.js +0 -2
  341. package/dist/chunk-BJO6J5X2.js +0 -3
  342. package/dist/chunk-DIOK3SER.js +0 -34
  343. package/dist/chunk-DREQ3RAA.js +0 -2
  344. package/dist/chunk-HC6VLPUB.js +0 -5
  345. package/dist/chunk-J4FIESTB.js +0 -2
  346. package/dist/chunk-NZJSGINB.js +0 -47
  347. package/dist/chunk-SXRHKXSE.js +0 -2
  348. package/dist/chunk-UJLULWSR.js +0 -21
  349. package/dist/chunk-ULIIYKZB.js +0 -7
  350. package/dist/chunk-UXGMKRS4.js +0 -102
  351. package/dist/chunk-VO66KP2W.js +0 -2
  352. package/dist/chunk-X52YIWGG.js +0 -13
  353. package/dist/chunk-ZIHQ5JGB.js +0 -18
  354. package/dist/commands-JBFLLT7A.js +0 -2
  355. package/dist/cover-cmd-DU6ZYJFL.js +0 -2
  356. package/dist/design-chat-ZICGVYIH.js +0 -2
  357. package/dist/design-headless-HYWZIIDS.js +0 -2
  358. package/dist/design-remote-HPX4VZ63.js +0 -3
  359. package/dist/device-env-4P4GUVBW.js +0 -2
  360. package/dist/dispatch-BV6XMCN3.js +0 -2
  361. package/dist/doctor-Z2YQ2DBX.js +0 -2
  362. package/dist/evidence-BJIID6VT.js +0 -2
  363. package/dist/evolve-cmd-GZCUSCEK.js +0 -2
  364. package/dist/evolve-remote-LILOAHYH.js +0 -2
  365. package/dist/exit-manager-EGWAZHCR.js +0 -2
  366. package/dist/explain-cmd-LXIVHGN7.js +0 -12
  367. package/dist/explore-SA2P3SGX.js +0 -2
  368. package/dist/explore-context-tty-PERKIWXD.js +0 -2
  369. package/dist/explore-entry-E6EY3VV3.js +0 -6
  370. package/dist/extract-chat-Z64LEAJ5.js +0 -2
  371. package/dist/extract-headless-XLS56LMN.js +0 -2
  372. package/dist/folder-flags-ZIDJVDKX.js +0 -2
  373. package/dist/gaps-cmd-XYOBJVTO.js +0 -3
  374. package/dist/gate-AK44VDHC.js +0 -2
  375. package/dist/gate-NB5CJMTN.js +0 -2
  376. package/dist/hold-passthrough-JGHWMYDM.js +0 -2
  377. package/dist/identity-HL5CJJXR.js +0 -2
  378. package/dist/ingest-ZHHHBUXR.js +0 -2
  379. package/dist/ingest-cmd-OJSKTSQK.js +0 -8
  380. package/dist/ingest-remote-2WM6PYUW.js +0 -2
  381. package/dist/install-JBWBF3WX.js +0 -2
  382. package/dist/lane-CNGO7LH5.js +0 -2
  383. package/dist/lattice-auth-UQPFQSG7.js +0 -2
  384. package/dist/lifecycle-cmd-DGIO3VAO.js +0 -2
  385. package/dist/list-cmd-HQIN3HX4.js +0 -3
  386. package/dist/list-commands-OFRRBU3D.js +0 -2
  387. package/dist/login-flow-SYKXXDLH.js +0 -2
  388. package/dist/maintenance-cmd-X5247RSJ.js +0 -2
  389. package/dist/mobile-prompts-I66ENBDW.js +0 -2
  390. package/dist/onboarding-6HIP3KW6.js +0 -5
  391. package/dist/open-provider-XDJKT3W3.js +0 -2
  392. package/dist/persist-recorded-session-RSSMTVF3.js +0 -3
  393. package/dist/phase-seed-ZZSJME7M.js +0 -2
  394. package/dist/pipeline-NTJDH5TC.js +0 -2
  395. package/dist/prepare-target-AI3GGZF6.js +0 -2
  396. package/dist/pull-cmd-NRVB5ZN7.js +0 -2
  397. package/dist/pull-route-FWCZW76M.js +0 -2
  398. package/dist/readmodel-TRV4E3MW.js +0 -2
  399. package/dist/real-device-run-NQ7RNH7C.js +0 -2
  400. package/dist/reconcile-cmd-7B7THAFJ.js +0 -5
  401. package/dist/reconcile-deps-UDQBWSLE.js +0 -2
  402. package/dist/recording-banner-WVDTWTSE.js +0 -2
  403. package/dist/registry-PFOSXOIH.js +0 -2
  404. package/dist/remote-entry-BZU4NFNS.js +0 -2
  405. package/dist/remote-mode-NXUKDUXG.js +0 -4
  406. package/dist/remote-words-JRDDNOZ6.js +0 -2
  407. package/dist/resolve-run-intent-QCL7QXIB.js +0 -2
  408. package/dist/revert-QKHPCRT6.js +0 -2
  409. package/dist/review-cmd-XBK3TGRE.js +0 -5
  410. package/dist/run-CSYGVV3D.js +0 -2
  411. package/dist/run-YUHHD54J.js +0 -2
  412. package/dist/run-remote-SFR3F2T5.js +0 -2
  413. package/dist/run-startup-gate-QSFJRYUY.js +0 -2
  414. package/dist/run-test-md-ZSREINDQ.js +0 -20
  415. package/dist/store-X4UK4AP7.js +0 -2
  416. package/dist/store-choice-27HDIFTU.js +0 -2
  417. package/dist/store-guard-ZXKB5DQH.js +0 -2
  418. package/dist/sync-cmd-2PCO7LZA.js +0 -2
  419. package/dist/sync-setup-5WQO73Y5.js +0 -2
  420. package/dist/tcg-generate-DGJD5KSM.js +0 -2
  421. package/dist/testmd-actions-XE2JPQHB.js +0 -2
  422. package/dist/token-refresh-E4FTJVHY.js +0 -2
  423. package/dist/verdicts-PVB7TV5S.js +0 -2
  424. package/dist/walk-session-WIEROYOT.js +0 -2
  425. package/dist/with-telemetry-T2PWI5CY.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as qr}from"./chunk-SALZ6WSF.js";import{a as Pr}from"./chunk-ENRFXGID.js";import{e as dt,f as jt,g as Bt,h as qe}from"./chunk-X6FCXBXU.js";import{A as st,B as ve,C as yr,D as oe,E as $e,F as ot,G as br,H as K,I as it,J as Tt,K as at,L as ke,M as wr,N as vr,Q as Te,a as tr,b as nr,c as Se,d as Ee,e as de,f as tt,g as sr,h as or,i as ce,j as cr,k as Ce,l as Ae,m as lr,n as fr,o as hr,p as At,q as Nt,r as Q,s as Ne,t as gr,u as Pt,v as Pe,w as mr,x as qt,y as te,z as rt}from"./chunk-OZNYQONA.js";import{a as R,b as rr,d as X,e as Oe,h as ir,i as ar,k as dr}from"./chunk-CB4ARIHR.js";import{a as Un,b as Vn,e as Wn}from"./chunk-SSOUYKVG.js";import{a as Zn}from"./chunk-HVOXMCKE.js";import{a as Yn,b as zn}from"./chunk-WMGKUERB.js";import{a as Qn}from"./chunk-UWPG5MWM.js";import{a as Jn}from"./chunk-73Y6T2UK.js";import{b as Xn,e as er,h as Ct,i as J}from"./chunk-XMPTFXPW.js";import{e as Ar,f as Nr}from"./chunk-MINDIQET.js";import{a as Er}from"./chunk-IZ66FKPC.js";import{a as Or,b as Lt,c as Cr}from"./chunk-E4GIGM5V.js";import{a as Ir,d as Sr}from"./chunk-3KY7HHQU.js";import{h as _r,i as Rr}from"./chunk-ZHAMVLQZ.js";import{g as Ft,h as $r,q as kr}from"./chunk-Z24SD2EJ.js";import{a as nt,b as le,c as pr,d as ur}from"./chunk-23DKB2MT.js";import{b as Ot,d as Kn}from"./chunk-CQDCNP7V.js";import{b as dn,f as cn,h as ln,k as pn,l as un,q as et}from"./chunk-7V34ZMMS.js";import{b as we}from"./chunk-6PIIUAZF.js";import{Ea as C,Fa as On,Ia as Cn,Ka as An,M as wn,Na as Nn,Oa as Pn,Pa as qn,Qa as ee,Ra as Tn,Sa as jn,Ua as Bn,Va as Qe,Ya as Fn,Za as Ln,a as ae,d as Et,da as vn,ea as $n,eb as xn,fa as kn,fb as Ze,ga as _n,ha as Rn,ia as In,ja as Sn,kb as Mn,mb as Hn,na as Ye,oa as En,ob as Xe,pa as ze,q as mn,r as yn,t as bn,vb as Dn,wb as Gn}from"./chunk-PI7OXS62.js";import{c as hn,n as gn}from"./chunk-DBMW3VUN.js";import{d as fn,f as Je,g as Ke}from"./chunk-KU3YHPWZ.js";import{b as an}from"./chunk-7V4BQSSV.js";import{g as We}from"./chunk-ZCRZFAOT.js";import{existsSync as De,readdirSync as ws,readFileSync as vs,realpathSync as oi,statSync as ii,writeFileSync as ai}from"fs";import{basename as Rt,join as Ge,relative as di,resolve as sn}from"path";import{randomBytes as Fs}from"crypto";var Tr=8,je=()=>dr(Fs(8).toString("hex")),jr=(e,t)=>e!==null&&Buffer.from(e).equals(Buffer.from(t)),Ls=[["P1 exclusive create",async e=>{for(let t=1;t<=2;t++){let n=je(),r=Buffer.from(`probe ${t} first`);if(await e.putIfAbsent(n,r)!=="created")return"a fresh key was reported as existing";if(await e.putIfAbsent(n,Buffer.from(`probe ${t} second`))!=="exists")return"the second write to one key was not refused";if(!jr(await e.get(n),r))return"the second write replaced the first"}return null}],["P2 contention",async e=>{let t=je(),r=(await Promise.all(Array.from({length:Tr},(o,i)=>e.putIfAbsent(t,Buffer.from(`contender ${i}`))))).filter(o=>o==="created").length;return r===1?null:`${r} of ${Tr} concurrent writers were told "created"`}],["P3 read-after-write",async e=>{let t=je(),n=Buffer.from("visible");return await e.putIfAbsent(t,n),await e.head(t)?jr(await e.get(t),n)?(await e.list(t)).includes(t)?null:"list does not show a key just created":"get does not return the bytes just created":"head does not see a key just created"}],["P4 definitive absence",async e=>await e.head(je())?"a never-written key was reported present":null]];async function ct(e){if(e.probe){let r=await e.probe();return{tier:Math.max(r.tier,e.ceilingTier),detail:r.detail}}let t=1,n="all probes passed";for(let[r,o]of Ls){let i;try{i=await o(e)}catch(s){if(s instanceof R){if(!(s.code==="SYNC_LOCATION_REFUSED_WRITE"&&r.startsWith("P1")&&await Br(e)))throw s;n=`${r}: ${s.message}`,t=3;break}n=`${r}: ${s instanceof Error?s.message:String(s)}`,t=r.startsWith("P1")&&await Br(e)?3:2;break}if(i!==null){n=`${r}: ${i}`,t=2;break}}return{tier:Math.max(t,e.ceilingTier),detail:n}}async function Br(e){try{return!await e.head(je())}catch(t){if(t instanceof R)throw t;return!1}}import{existsSync as xs,readFileSync as xr}from"fs";import{join as Ms}from"path";async function xt(e,t,n,r){let i=de(e).entries[n];if(!i)throw new Error(`no sync state for ${n} \u2014 run kane-cli context sync add ${n} <descriptor> first`);if(i.tier!==1)throw new R("SYNC_READ_ONLY",`${n} is a tier ${i.tier} location: it can be cloned and pulled, never pushed`,"push to a location whose probe reached tier 1, or pull from this one");let s=await Ce(e,t,i.witness);switch(s.kind){case"empty-storage":case"ahead":case"up-to-date":break;case"behind":case"empty-local":throw new R("SYNC_BEHIND",`${n} holds ${s.storage.seq} records, this store ${s.local?.seq??0}: it has records this store has not seen`,`kane-cli context pull ${n}`);case"diverged":throw new R("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pushed`,`run kane-cli context pull ${n} --rebase to save your local work, take the team version from ${n}, and then reapply yours`);case"foreign-lineage":throw new R("SYNC_FOREIGN_LINEAGE",`${n} holds a different history (its first record is not this store's)`,`to work on it, clone it: kane-cli context clone <descriptor of ${n}> <dir>; to share this store, add an empty location`)}let a=s.storage,c=qn(e),d;try{An(e),d=Hs(e,a)}catch(M){throw M instanceof Cn?new R("SYNC_REBASE_PENDING",`${M.message.split(";")[0]}; nothing was pushed`,M.remedy):M}finally{c()}let l=d.map(M=>Ds(e,M)),f=0,p=0,g=0,u=0,m=a,y=null,w=null,h=t.beginTransaction?await t.beginTransaction():void 0,b=h?{...t,head:h.head,get:h.get,list:t.list.bind(t),putIfAbsent:t.putIfAbsent.bind(t)}:t,v=h?h.stageIfAbsent.bind(h):t.putIfAbsent.bind(t),q=[],re=M=>h?q.push(M):r(M);try{let M=new Set;for(let S of l){for(let D of S.blobs)if(await v(D.key,D.bytes)!=="exists")p++,M.add(D.key);else if(!M.has(D.key)){let $=await b.get(D.key);if($===null||Ot(Buffer.from($))!==D.fp){w=new R("SYNC_OBJECT_CORRUPT",`the blob ${D.fp} ${n} already holds does not hash to its name (named by record ${S.seq}); the record was not pushed`,"the storage object needs a human look before anything more is pushed to it");break}M.add(D.key)}if(w)break;S.proposal&&await v(S.proposal.key,S.proposal.bytes)!=="exists"&&g++;let Z=Oe(S.seq);if(await v(Z,S.raw)!=="exists")f++;else if((await ce(b,S.seq)).hash===S.hash)re(`position ${S.seq} is already on ${n}`),u++;else{y=S.seq;break}m={seq:S.seq,hash:S.hash}}if(h||await Lr(t,m,a,n),m&&!await b.head(X)){let S=await ce(b,1),Z={layout:1,canonicalizer:"v1",genesis_hash:S.hash};await v(X,Buffer.from(JSON.stringify(Z)+`
2
+ import{a as qr}from"./chunk-F4XCCOWC.js";import{a as Pr}from"./chunk-ABAUIIPD.js";import{e as dt,f as jt,g as Bt,h as qe}from"./chunk-6FVGPKVX.js";import{A as st,B as ve,C as yr,D as oe,E as $e,F as ot,G as br,H as K,I as it,J as Tt,K as at,L as ke,M as wr,N as vr,Q as Te,a as tr,b as nr,c as Se,d as Ee,e as de,f as tt,g as sr,h as or,i as ce,j as cr,k as Ce,l as Ae,m as lr,n as fr,o as hr,p as At,q as Nt,r as Q,s as Ne,t as gr,u as Pt,v as Pe,w as mr,x as qt,y as te,z as rt}from"./chunk-NNVHWFLI.js";import{a as R,b as rr,d as X,e as Oe,h as ir,i as ar,k as dr}from"./chunk-CB4ARIHR.js";import{a as Un,b as Vn,e as Wn}from"./chunk-ZIRSTOEV.js";import{a as Zn}from"./chunk-TCK7WR3M.js";import{a as Yn,b as zn}from"./chunk-WMGKUERB.js";import{a as Qn}from"./chunk-2EKLTUY2.js";import{a as Jn}from"./chunk-73Y6T2UK.js";import{b as Xn,e as er,h as Ct,i as J}from"./chunk-XMPTFXPW.js";import{e as Ar,f as Nr}from"./chunk-HBGYEA3O.js";import{a as Er}from"./chunk-BIGOLVK6.js";import{a as Ir,d as Sr}from"./chunk-JSSM2TWY.js";import{a as Or,b as Lt,c as Cr}from"./chunk-H6IPGZTP.js";import{h as _r,i as Rr}from"./chunk-3A4KK22B.js";import{g as Ft,h as $r,q as kr}from"./chunk-C3DMMAFP.js";import{a as nt,b as le,c as pr,d as ur}from"./chunk-UVL6XQHU.js";import{b as Ot,d as Kn}from"./chunk-5ORBAYTU.js";import{Ea as C,Fa as On,Ia as Cn,Ka as An,M as wn,Na as Nn,Oa as Pn,Pa as qn,Qa as ee,Ra as Tn,Sa as jn,Ua as Bn,Va as Qe,Ya as Fn,Za as Ln,a as ae,d as Et,da as vn,ea as $n,eb as xn,fa as kn,fb as Ze,ga as _n,ha as Rn,ia as In,ja as Sn,kb as Mn,mb as Hn,na as Ye,oa as En,ob as Xe,pa as ze,q as mn,r as yn,t as bn,vb as Dn,wb as Gn}from"./chunk-5EAJO372.js";import{c as hn,n as gn}from"./chunk-DBMW3VUN.js";import{d as fn,f as Je,g as Ke}from"./chunk-KU3YHPWZ.js";import{b as dn,f as cn,h as ln,k as pn,l as un,q as et}from"./chunk-OKCVG7AG.js";import{b as an}from"./chunk-7V4BQSSV.js";import{b as we}from"./chunk-6PIIUAZF.js";import{g as We}from"./chunk-ZCRZFAOT.js";import{existsSync as De,readdirSync as ws,readFileSync as vs,realpathSync as oi,statSync as ii,writeFileSync as ai}from"fs";import{basename as Rt,join as Ge,relative as di,resolve as sn}from"path";import{randomBytes as Fs}from"crypto";var Tr=8,je=()=>dr(Fs(8).toString("hex")),jr=(e,t)=>e!==null&&Buffer.from(e).equals(Buffer.from(t)),Ls=[["P1 exclusive create",async e=>{for(let t=1;t<=2;t++){let n=je(),r=Buffer.from(`probe ${t} first`);if(await e.putIfAbsent(n,r)!=="created")return"a fresh key was reported as existing";if(await e.putIfAbsent(n,Buffer.from(`probe ${t} second`))!=="exists")return"the second write to one key was not refused";if(!jr(await e.get(n),r))return"the second write replaced the first"}return null}],["P2 contention",async e=>{let t=je(),r=(await Promise.all(Array.from({length:Tr},(o,i)=>e.putIfAbsent(t,Buffer.from(`contender ${i}`))))).filter(o=>o==="created").length;return r===1?null:`${r} of ${Tr} concurrent writers were told "created"`}],["P3 read-after-write",async e=>{let t=je(),n=Buffer.from("visible");return await e.putIfAbsent(t,n),await e.head(t)?jr(await e.get(t),n)?(await e.list(t)).includes(t)?null:"list does not show a key just created":"get does not return the bytes just created":"head does not see a key just created"}],["P4 definitive absence",async e=>await e.head(je())?"a never-written key was reported present":null]];async function ct(e){if(e.probe){let r=await e.probe();return{tier:Math.max(r.tier,e.ceilingTier),detail:r.detail}}let t=1,n="all probes passed";for(let[r,o]of Ls){let i;try{i=await o(e)}catch(s){if(s instanceof R){if(!(s.code==="SYNC_LOCATION_REFUSED_WRITE"&&r.startsWith("P1")&&await Br(e)))throw s;n=`${r}: ${s.message}`,t=3;break}n=`${r}: ${s instanceof Error?s.message:String(s)}`,t=r.startsWith("P1")&&await Br(e)?3:2;break}if(i!==null){n=`${r}: ${i}`,t=2;break}}return{tier:Math.max(t,e.ceilingTier),detail:n}}async function Br(e){try{return!await e.head(je())}catch(t){if(t instanceof R)throw t;return!1}}import{existsSync as xs,readFileSync as xr}from"fs";import{join as Ms}from"path";async function xt(e,t,n,r){let i=de(e).entries[n];if(!i)throw new Error(`no sync state for ${n} \u2014 run kane-cli context sync add ${n} <descriptor> first`);if(i.tier!==1)throw new R("SYNC_READ_ONLY",`${n} is a tier ${i.tier} location: it can be cloned and pulled, never pushed`,"push to a location whose probe reached tier 1, or pull from this one");let s=await Ce(e,t,i.witness);switch(s.kind){case"empty-storage":case"ahead":case"up-to-date":break;case"behind":case"empty-local":throw new R("SYNC_BEHIND",`${n} holds ${s.storage.seq} records, this store ${s.local?.seq??0}: it has records this store has not seen`,`kane-cli context pull ${n}`);case"diverged":throw new R("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pushed`,`run kane-cli context pull ${n} --rebase to save your local work, take the team version from ${n}, and then reapply yours`);case"foreign-lineage":throw new R("SYNC_FOREIGN_LINEAGE",`${n} holds a different history (its first record is not this store's)`,`to work on it, clone it: kane-cli context clone <descriptor of ${n}> <dir>; to share this store, add an empty location`)}let a=s.storage,c=qn(e),d;try{An(e),d=Hs(e,a)}catch(M){throw M instanceof Cn?new R("SYNC_REBASE_PENDING",`${M.message.split(";")[0]}; nothing was pushed`,M.remedy):M}finally{c()}let l=d.map(M=>Ds(e,M)),f=0,p=0,g=0,u=0,m=a,y=null,w=null,h=t.beginTransaction?await t.beginTransaction():void 0,b=h?{...t,head:h.head,get:h.get,list:t.list.bind(t),putIfAbsent:t.putIfAbsent.bind(t)}:t,v=h?h.stageIfAbsent.bind(h):t.putIfAbsent.bind(t),q=[],re=M=>h?q.push(M):r(M);try{let M=new Set;for(let S of l){for(let D of S.blobs)if(await v(D.key,D.bytes)!=="exists")p++,M.add(D.key);else if(!M.has(D.key)){let $=await b.get(D.key);if($===null||Ot(Buffer.from($))!==D.fp){w=new R("SYNC_OBJECT_CORRUPT",`the blob ${D.fp} ${n} already holds does not hash to its name (named by record ${S.seq}); the record was not pushed`,"the storage object needs a human look before anything more is pushed to it");break}M.add(D.key)}if(w)break;S.proposal&&await v(S.proposal.key,S.proposal.bytes)!=="exists"&&g++;let Z=Oe(S.seq);if(await v(Z,S.raw)!=="exists")f++;else if((await ce(b,S.seq)).hash===S.hash)re(`position ${S.seq} is already on ${n}`),u++;else{y=S.seq;break}m={seq:S.seq,hash:S.hash}}if(h||await Lr(t,m,a,n),m&&!await b.head(X)){let S=await ce(b,1),Z={layout:1,canonicalizer:"v1",genesis_hash:S.hash};await v(X,Buffer.from(JSON.stringify(Z)+`
3
3
  `,"utf8"))!=="exists"&&re(`wrote ${X} on ${n}`)}if(h){if(m){let $=await b.get(X),ge=await ce(b,1),T={};try{let me=JSON.parse(Buffer.from($??[]).toString("utf8"));me&&typeof me=="object"&&!Array.isArray(me)&&(T=me)}catch{}if(T.layout!==1||T.canonicalizer!=="v1"||T.genesis_hash!==ge.hash)throw new R("SYNC_OBJECT_CORRUPT",`${X} does not describe this context's verified genesis and format.`,"Ask the location owner to inspect the metadata before publishing.")}if(w)throw w;if(y!==null)throw new R("SYNC_POSITION_TAKEN",`position ${y} on ${n} was taken by another writer; this batch was not published`,Fr(n,y));let S=await h.commit(),Z=new Set(S.created),D=l.filter($=>Z.has(Oe($.seq))).length;u+=f-D,f=D,p=new Set(l.flatMap($=>$.blobs.map(ge=>ge.key)).filter($=>Z.has($))).size,g=new Set(l.flatMap($=>$.proposal?[$.proposal.key]:[]).filter($=>Z.has($))).size}h&&await Lr(t,m,a,n);for(let S of q)r(S);let se="";if(m)try{lr(e,n,m,{forwardOnly:!0})}catch(S){if(y===null||!(S instanceof C))throw S;se=" (the witness was not saved; the next pull records it)"}if(w)throw w;if(y!==null)throw new R("SYNC_POSITION_TAKEN",`position ${y} on ${n} was taken by another writer while this push ran; this store's history through position ${m?.seq??0} is confirmed on ${n}${se}`,Fr(n,y))}finally{await h?.abort()}return{pushed:f,from:a?.seq??0,to:m?.seq??0,blobs:p,proposals:g,alreadyThere:u}}function Fr(e,t){return t===1?`${e} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${e}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${e} --rebase`}async function Lr(e,t,n,r){if(!t||t.seq<=(n?.seq??0))return;let o=await ce(e,t.seq);if(o.hash!==t.hash)throw new R("SYNC_OBJECT_CORRUPT",`${r} answered "created" for position ${t.seq} but serves a record hashing ${o.hash}, not ${t.hash}`,"The location needs inspection before publishing more context.")}function Hs(e,t){let{records:n,hashes:r}=Ln(e,t?.seq??0,t?.hash??null);return n.map((o,i)=>{let s=r[i],a=xr(Ms(e,"commits",`${String(o.seq).padStart(6,"0")}-${s.slice(7,19)}.json`));if(ee(JSON.parse(a.toString("utf8")))!==s)throw new Error(`record ${o.seq} changed on disk while it was being read \u2014 run kane-cli context fsck`);return{rec:o,hash:s,raw:a}})}function Ds(e,{rec:t,hash:n,raw:r}){{let o=tr(t),i=o.blobs.map(s=>{let a=Kn(e,s);if(a===null)throw new R("SYNC_CLOSURE_MISSING",`record ${t.seq} names blob ${s}, which this store does not hold`,"restore the blob from a copy of this store, or run kane-cli context fsck");if(Ot(a)!==s)throw new R("SYNC_LOCAL_BLOB_CORRUPT",`record ${t.seq} names blob ${s}, but the local file does not hash to that: it is torn`,"restore the blob from a copy of this store, or run kane-cli context fsck");return{key:ir(s),fp:s,bytes:a}});return{seq:t.seq,hash:n,raw:new Uint8Array(r),blobs:i,proposal:Gs(e,o.proposalId)}}}function Gs(e,t){if(t===null)return null;let n=Qn(e,t);if(!xs(n))return null;let r=xr(n);return{key:ar(t,nr(r.toString("utf8"))),bytes:r}}import{existsSync as Us,readdirSync as Vs,readFileSync as Mr}from"fs";import{basename as Ws,join as Mt}from"path";function lt(e){return{id:Ws(e),witness:()=>JSON.parse(Mr(Mt(e,"base-witness.json"),"utf8")),records:t=>Ht(e,t),readIntent:t=>bn(e,t)}}var Js=/^\d{6}-[0-9a-f]{12}\.json$/;function Ht(e,t){let n=Mt(e,"commits"),r=Us(n)?Vs(n).filter(s=>Js.test(s)).sort():[],o=t.hash,i=t.seq;return r.map(s=>{let a;try{a=JSON.parse(Mr(Mt(n,s),"utf8"))}catch(d){throw new C(`backup record ${s} is not JSON: ${String(d)}`)}if(i+=1,a.seq!==i||a.prev_hash!==o)throw new C(`backup record ${s} does not continue the chain at ${i} from ${String(o)}`);let c=ee(a);if(!c.slice(7).startsWith(s.slice(7,19)))throw new C(`backup record ${s} does not match its name`);return o=c,{seq:i,hash:c,body:a}})}function pt(e,t){let n=t.witness(),r=e.recordsSince(null).slice(0,n.base.seq),o=t.records(n.base),i=[...r,...o.map(p=>p.body)],s=[...r.map(ee),...o.map(p=>p.hash)],a=new Map;for(let p of i)for(let g of p.nodes)a.set(g.cid,{label:g.label,content:g.content});let c=Mn();Hn(null,c,i,s,{writeNodeFiles:!1});let d=Gn(null,c,a),l=new Map(o.map(p=>[p.seq,p])),f=p=>d.displayNameOf(p)??p.slice(0,19);return{backup:t,backupId:t.id,from:n.from,base:n.base,index:c,graph:d,records:o,chain:i,recordAt:p=>l.get(p),resolveName:p=>d.resolve(p)?.cid,nameOf:p=>d.displayNameOf(p)??void 0,displayNameFor:p=>{let g=Dt(t,p),u=Object.keys(p.source_head_moves),m=g==="revert"?String(Ks(t,p)??""):g==="names"?(p.names??[]).map(y=>y.slug).join(", "):u.length>0?u.join(", "):p.nodes.length>0?[...new Set(p.nodes.map(y=>f(y.cid)))].join(", "):(p.executions?.length??0)>0?[...new Set(p.executions.map(y=>f(y.about)))].join(", "):p.review.length>0?[...new Set(p.review.map(y=>f(y.id)))].join(", "):p.supersessions.length>0?[...new Set(p.supersessions.map(y=>y.kind==="node"?f(y.old):y.ecid.slice(0,19)))].join(", "):u.join(", ");return m?`${g} ${m}`:g}}}function Ks(e,t){try{let r=e.readIntent(ee(t))?.args?.seq;return typeof r=="number"?r:void 0}catch{return}}function Dt(e,t){let n=null;try{n=e.readIntent(ee(t))}catch{n=null}if(n)return n.verb;if(t.intent_verb)return t.intent_verb;let r=Object.entries(t.source_head_moves);return(t.executions?.length??0)>0?"execution":t.design_of?"design":t.proposal_id!=null?"extract":t.conv?t.conv.turn===0?"conv-mint":"conv-turn":r.length===1&&r[0][1]===null&&t.supersessions.some(o=>o.kind==="node"&&o.new===null)?"retire":r.length===1&&typeof r[0][1]=="string"&&t.nodes.some(o=>o.label==="source")?"ingest":t.review.some(o=>o.resolution==="reset")||t.supersessions.some(o=>o.kind==="node"&&o.new===o.old||o.kind==="edge"&&o.revoke)?"revert":t.nodes.length===0&&t.edges.length===0&&t.supersessions.length===1&&t.supersessions[0].kind==="node"&&t.supersessions[0].new===null?"archive":t.nodes.length===0&&t.edges.length===0&&t.review.length===0&&(t.names?.length??0)>0?"names":t.nodes.length===0&&t.edges.length===0&&t.supersessions.length===0&&t.review.length>0?"review":"unknown"}import{existsSync as Hr,readdirSync as Ys,readFileSync as Gt}from"fs";import{isAbsolute as zs,join as ut,normalize as Qs,relative as Zs,sep as Xs}from"path";var eo=e=>e===""||zs(e)||e.includes("\\")||Qs(e).split(Xs).some(t=>t==="..")||e.startsWith("./")||e.includes("\0");function Fe(e){let t=ut(e,"manifest.json");if(!Hr(t))throw new C(`backup ${e} has no manifest.json \u2014 it was never completed; kane-cli context sync doctor`);let n;try{n=JSON.parse(Gt(t,"utf8"))}catch(s){throw new C(`backup manifest ${t} is not JSON: ${s instanceof Error?s.message:String(s)}`)}if(!Array.isArray(n))throw new C(`backup manifest ${t} is not a list`);let r=new Set,o=[];for(let s of n){let a=typeof s?.name=="string"?s.name:"";if(eo(a))throw new C(`backup manifest names an unsafe path ${JSON.stringify(s?.name)} \u2014 the backup is not trusted`);let c=ut(e,a);if(!Hr(c))throw new C(`backup file ${a} is missing from ${e}`);let d=Gt(c);if("sha256:"+an(d)!==s.hash)throw new C(`backup file ${a} does not match its manifest hash \u2014 the backup was changed after it was written`);if(a.startsWith("commits/"))try{r.add(ee(JSON.parse(d.toString("utf8"))))}catch(l){throw new C(`backup record ${a} is not a record: ${l instanceof Error?l.message:String(l)}`)}a.startsWith("intents/")&&o.push(a)}let i=new Set(n.map(s=>s.name));for(let s of Dr(e)){let a=Zs(e,s);if(a!=="manifest.json"&&!i.has(a))throw new C(`backup ${e} holds ${a}, which its manifest does not name \u2014 the backup was changed after it was written`)}for(let s of o){let a;try{a=JSON.parse(Gt(ut(e,s),"utf8"))}catch(d){throw new C(`backup envelope ${s} is not JSON: ${d instanceof Error?d.message:String(d)}`)}let c=mn(a);if(c!==null)throw new C(`backup envelope ${s} is not a valid intent: ${c}`);if(typeof a.born?.hash!="string"||!r.has(a.born.hash))throw new C(`backup envelope ${s} was born from a record the backup does not hold`)}}function Dr(e){let t=[];for(let n of Ys(e,{withFileTypes:!0})){let r=ut(e,n.name);n.isDirectory()?t.push(...Dr(r)):t.push(r)}return t}import{basename as Oo,join as Co}from"path";import{existsSync as Ao,readFileSync as No}from"fs";var G=class extends Error{},L=(e,t)=>({kind:"apply",inputs:e,...t&&t.length>0?{aliases:t}:{}}),V=e=>({kind:"noop",reason:e}),Vt=e=>({kind:"dedupe",as:e}),k=(e,t,n,r,o={})=>({kind:"hold",hold:{kind:e,mine:t,theirs:n,answers:r,detail:o}}),Gr=(e,t)=>{let n=ft(t.label,t.content);return e.graph.byLabel(t.label).filter(r=>!e.graph.superseded.has(r.cid)&&ft(t.label,r.content)===n).map(r=>r.cid)},z=e=>e?e.slice(0,19):"none",H=(e,t)=>e.maps.cid.rewrite(t);function I(e,t,n){if(typeof t!="string")throw new G(`${n} was not pinned`);let r=H(e,t);if(!e.graph.hasNode(r))throw new G(`${n} ${_(e,t)} has no counterpart on ${e.location}`);return r}var j=(e,t)=>e.graph.tipOf(t),Wt=(e,t)=>e.graph.superseded.has(e.graph.tipOf(t)),_=(e,t)=>e.fold.nameOf(t)??z(t),E=(e,t)=>e.graph.displayNameOf(t)??z(t);function Jt(e,t,n,r){let o=r==="fold"?e.fold.graph:e.graph,i=o.displayNameOf(t);if(i!==null&&i!==n)return i;let s=o.tipOf(t);for(let[d,l]of o.heads)if(l===t||l===s)return d;let a=o.getNode(t);if(a?.label==="source"&&typeof a.content.source_id=="string")return a.content.source_id;let c=a?.content.title??a?.content.text??a?.content.statement;return a&&typeof c=="string"&&c!==""?`${a.label} "${Y(c,32)}"`:z(t)}var F=e=>e.created_by?.by?.id??e.review[0]?.by.id??e.supersessions[0]?.by.id??e.names?.[0]?.by.id??"someone",N=e=>e.ts;function Y(e,t=48){let n=typeof e=="string"?e:JSON.stringify(e);return n.length>t?`${n.slice(0,t-1)}\u2026`:n}var Ut={test_md_blob:"steps",objectives_blob:"checks"},to=/^sha256:[0-9a-f]{64}$/,no=(e,t)=>e==="derived"||Or.includes(e)||/_blob$/.test(e)||/(^|_)id$|Id$/.test(e)||t.some(n=>typeof n=="string"&&to.test(n));function pe(e,t,n,r){let o=[...new Set([...Object.keys(e),...Object.keys(t)])].filter(c=>JSON.stringify(e[c])!==JSON.stringify(t[c])),i=o.filter(c=>Ut[c]===void 0&&!no(c,[e[c],t[c]])).map(c=>`${c} "${Y(e[c]??"")}" \u2192 "${Y(t[c]??"")}"`),s=Object.keys(Ut).filter(c=>o.includes(c)).map(c=>Ut[c]);return`${[...i,...s.length>0?[`${s.join(" and ")} changed`]:[]].join(", ")||"no field changed"} by ${n} ${r===null?"since your last pull":`at ${r}`}`}var ro={usecase:"use case",scenario:"scenario",test:"test",ac:"acceptance criterion",source:"document"};function Ur(e,t){let n=e.graph.getNode(t),r=n?ro[n.label]??n.label:"item",o=n?.label!=="ac"?n?.content.title:void 0;if(typeof o=="string"&&o.trim()!=="")return`the ${r} "${o}"`;let i=e.fold.nameOf(t)??e.graph.displayNameOf(t);return i?`the ${r} ${En(i)}`:`the ${r}`}function ie(e,t){for(let n of e.theirs)for(let r of n.supersessions)if(r.kind==="node"&&r.old===t)return{rec:n,next:r.new}}function Kt(e,t){let n=new Set([t]);for(let o=!0;o;){o=!1;for(let[i,s]of e.graph.superseded)typeof s=="string"&&n.has(s)&&!n.has(i)&&(n.add(i),o=!0)}let r=[];for(let o of e.theirs)for(let i of o.review)n.has(i.id)&&i.resolution!=="pending"&&r.push({rec:o,resolution:i.resolution});return r}var so=new Set(Object.values(Ke).filter(e=>e!==Ke.DERIVES&&e!==Ke.ANNOTATES));function Yt(e,t){let n=new Set,r=[],o=[t,e.graph.tipOf(t)];for(;o.length>0;){let i=o.pop();if(!n.has(i)){n.add(i);for(let s of e.graph.edgesInto(i))!so.has(s.type)||e.graph.superseded.has(s.src)||(!(s.src in e.fold.index.nodeLabel)&&!r.some(a=>a.cid===s.src)&&r.push({cid:s.src,label:e.graph.nodeLabel.get(s.src)??"node"}),o.push(s.src))}}return r}function zt(e){let t=new Map;for(let n of e)t.set(n.label,(t.get(n.label)??0)+1);return[...t].map(([n,r])=>`${r} ${n}${r===1?"":"s"}`).join(", ")}function ht(e,t,n){if(!e.theirs.some(o=>o.edges.some(i=>i.type===t&&i.src===n)))return;let r=e.graph.edgesFrom(n).find(o=>o.type===t);return r?{live:r.dst}:void 0}function _e(e,t){let n=t.event_ids??[],r={token:e.store.parse(e.graph.latestHash)},o=new Map(n.map(a=>[a,e.store.appliedEvent(a,r)?.digest])),i=n.filter(a=>o.get(a)!==void 0);return n.length===0||i.length===0?void 0:i.every(a=>{let c=n.indexOf(a),d=t.event_digests?.[c];return d!==void 0&&d!==""&&o.get(a)===d})&&i.length===n.length?V("already applied: every event id is in the chain with the same intent"):k("ambiguous",`committed ${n.length} event id${n.length===1?"":"s"}`,`${i.length} of them already in the shared chain under another intent`,["keep-theirs"],{event_ids:n})}function oo(e){return String(e??"").toLowerCase().trim().replace(/\s+/g," ")}function ft(e,t){let n=t.question;return`${e}\0${oo(t.title??t.text??t.statement??n?.header??t.source_id??"")}`}function Vr(e,t){let n=[],r=new Set;for(let o of e.nodes){let i=ft(o.label,o.content),s=t.nodes.find(a=>!r.has(a.cid)&&ft(a.label,a.content)===i);s&&(r.add(s.cid),n.push([o.cid,s.cid]))}for(let o of e.nodes){if(n.some(([s])=>s===o.cid))continue;let i=t.nodes.find(s=>!r.has(s.cid)&&s.label===o.label);i&&(r.add(i.cid),n.push([o.cid,i.cid]))}return n}function Wr(e,t){let n=[],r=new Set;for(let o of t.names??[]){if(!Ye.test(o.slug))continue;let i=t.nodes.find(a=>a.cid===o.cid);if(!i||e.graph.nameOf.has(H(e,o.cid)))continue;let s=ze(i.label,a=>r.has(a),e.graph.names.keys());s!==null&&(r.add(s),s!==o.slug&&n.push({from:o.slug,to:s}))}return n}function Jr(e,t,n){let r=[];for(let o of e.names??[]){let i=n.find(([a])=>a===o.cid)?.[1],s=t.names?.find(a=>a.cid===i);s&&s.slug!==o.slug&&r.push({from:o.slug,to:s.slug})}return r}function Kr(e,t,n){let r=e===void 0?void 0:e.split(`
4
4
  `).map(s=>{let a=/^(##\s.*?)\s@verifies\s+(.+?)\s*$/.exec(s);if(a)return`${a[1]} @verifies ${a[2].split(",").map(l=>l.trim()).filter(Boolean).map(n).join(", ")}`;let c=/^(\s*)@import\s+(\S+)\s*$/.exec(s);if(c)return`${c[1]}@import ${n(c[2])}`;let d=/^## Import: (\S+)\s*$/.exec(s);return d?`## Import: ${n(d[1])}`:s}).join(`
5
5
  `),o=null,i=t===void 0?void 0:t.split(`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Ea as L,Ua as U}from"./chunk-PI7OXS62.js";import{a as E}from"./chunk-YJAQZMJT.js";var x="ckpt/1";var B="checkpoints",m="base.json",y=t=>`delta-${t}.json`,w=t=>`full-${t}.json`,re=["turn","ask","final"],se=["extract","design","walk"];function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return Array.isArray(t)&&t.every(r=>typeof r=="string")}function K(t){let r=[],e=(n,i)=>{n||r.push(i)};if(!d(t))return{ok:!1,errors:["record: not an object"]};e(t.schema===x,`schema: expected "${x}"`);let s=t.kind;if(s==="base")e(typeof t.sid=="string"&&t.sid.length>0,"base.sid: non-empty string"),e(typeof t.verb=="string"&&se.includes(t.verb),"base.verb: extract|design|walk"),e(typeof t.mode=="string","base.mode: string"),e(typeof t.created_at=="string","base.created_at: string"),e(d(t.run_config),"base.run_config: object"),d(t.run_config)&&e(!("resume"in t.run_config),"base.run_config: must not carry `resume`"),e(typeof t.conv_source=="string",'base.conv_source: string ("" when absent)'),e(typeof t.store_watermark=="string"||t.store_watermark===null,"base.store_watermark: string | null (null = genesis)");else if(s==="delta"||s==="full"){e(typeof t.sid=="string"&&t.sid.length>0,"delta.sid: non-empty string"),e(Number.isInteger(t.seq)&&t.seq>=1,"delta.seq: integer \u2265 1"),e(Number.isInteger(t.turn_id),"delta.turn_id: integer"),e(typeof t.at=="string"&&re.includes(t.at),"delta.at: turn|ask|final"),e(typeof t.ts=="string","delta.ts: string");let n=t.agent;if(d(n)){e(Number.isInteger(n.agent_state_schema),"agent.agent_state_schema: integer"),e(Array.isArray(n.delta_items),"agent.delta_items: array"),e(d(n.binding),"agent.binding: object");let o=n.usage_total;e(d(o)&&typeof o.input_tokens=="number"&&typeof o.output_tokens=="number"&&typeof o.credits=="number","agent.usage_total: {input_tokens, output_tokens, credits} numbers"),n.base_fingerprint!==void 0&&e(typeof n.base_fingerprint=="string","agent.base_fingerprint: string when present"),s==="full"&&e(typeof n.base_fingerprint=="string","full: agent.base_fingerprint required")}else r.push("delta.agent: object");let i=t.kane;if(d(i)){e(D(i.applied_events),"kane.applied_events: string[]"),e(D(i.held_receipts),"kane.held_receipts: string[]");let o=i.pending;e(d(o)&&Array.isArray(o.questions)&&Array.isArray(o.proposals),"kane.pending: {questions[], proposals[]}"),e(Array.isArray(i.parent_asks),"kane.parent_asks: array"),e(d(i.read_basis),"kane.read_basis: object");let p=i.corpus_cursor;if(e(d(p)&&D(p.remaining),"kane.corpus_cursor: {remaining: string[]}"),e(typeof i.store_watermark=="string"||i.store_watermark===null,"kane.store_watermark: string | null (null = genesis)"),i.awaits!==void 0){let a=i.awaits;e(d(i.awaits)&&typeof a.call=="string"&&(typeof a.event_id=="string"||typeof a.event_prefix=="string"),"kane.awaits: {call, event_id | event_prefix}")}i.ingest_registry!==void 0&&e(Array.isArray(i.ingest_registry)&&i.ingest_registry.every(a=>d(a)&&typeof a.ref=="string"&&typeof a.entered_at=="string"),"kane.ingest_registry: [{ref, entered_at, consumed?}]"),i.sent_unread!==void 0&&e(D(i.sent_unread),"kane.sent_unread: string[]"),i.ingest_schedule!==void 0&&e(Array.isArray(i.ingest_schedule)&&i.ingest_schedule.every(a=>d(a)&&typeof a.source_id=="string"&&typeof a.cid=="string"&&["pending","done","skipped"].includes(String(a.status))),"kane.ingest_schedule: [{source_id, cid, status}]")}else r.push("delta.kane: object")}else r.push('kind: expected "base" | "delta" | "full"');return{ok:r.length===0,errors:r}}import{readFileSync as ke}from"fs";import{join as _e}from"path";import{closeSync as N,linkSync as ie,mkdirSync as G,openSync as I,readFileSync as oe,readdirSync as Y,renameSync as ae,rmSync as F,statSync as ce,writeFileSync as M}from"fs";import{join as j}from"path";function pe(t,r){let e=j(t,"sessions",r,B),s=n=>j(e,n);return{read:n=>{try{return oe(s(n),"utf8")}catch(i){if(i.code==="ENOENT")return null;throw i}},list:()=>{try{return Y(e)}catch{return[]}},write:(n,i)=>{G(e,{recursive:!0}),le(s(n),i,e)},writeIfAbsent:(n,i)=>(G(e,{recursive:!0}),de(s(n),i,e)),remove:n=>F(s(n),{force:!0}),bytes:()=>fe(e)}}function le(t,r,e){let s=`${t}.tmp-${process.pid}`,n=I(s,"w");try{M(n,r,{mode:384}),E(n)}finally{N(n)}ae(s,t);try{let i=I(e,"r");E(i),N(i)}catch{}}var ue=new Set(["EPERM","ENOTSUP","EXDEV"]);function de(t,r,e){let s=`${t}.tmp-${process.pid}`,n=I(s,"w");try{M(n,r,{mode:384}),E(n)}finally{N(n)}try{ie(s,t)}catch(i){let o=i.code??"";if(o==="EEXIST")return!1;if(!ue.has(o))throw i;if(!ge(t,r))return!1}finally{F(s,{force:!0})}try{let i=I(e,"r");E(i),N(i)}catch{}return!0}function ge(t,r){let e;try{e=I(t,"wx")}catch(n){if(n.code==="EEXIST")return!1;throw n}let s=!1;try{M(e,r),E(e),s=!0}finally{N(e),s||F(t,{force:!0})}return!0}function fe(t){let r=0;try{for(let e of Y(t))try{r+=ce(j(t,e)).size}catch{}}catch{return 0}return r}var me=3,$e=600*1e3,h=class extends Error{constructor(e,s){super(`${e}: ${s}`);this.code=e}},S=class extends Error{constructor(r){super(`CHECKPOINT_WRITE: ${r}`)}},V=class extends S{},he=(t,r)=>_e(t,"sessions",r,"state.json"),Ce=new Set,J=new Set;function W(t,r,e){for(let s of Ce)try{s(t,r,e)}catch{}}var be=new Set;function De(t,r=new Date){for(let e of be)try{e(t,r)}catch{}}function He(t,r){let e=JSON.stringify(r)+`
2
+ import{Ea as L,Ua as U}from"./chunk-5EAJO372.js";import{a as E}from"./chunk-YJAQZMJT.js";var x="ckpt/1";var B="checkpoints",m="base.json",y=t=>`delta-${t}.json`,w=t=>`full-${t}.json`,re=["turn","ask","final"],se=["extract","design","walk"];function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return Array.isArray(t)&&t.every(r=>typeof r=="string")}function K(t){let r=[],e=(n,i)=>{n||r.push(i)};if(!d(t))return{ok:!1,errors:["record: not an object"]};e(t.schema===x,`schema: expected "${x}"`);let s=t.kind;if(s==="base")e(typeof t.sid=="string"&&t.sid.length>0,"base.sid: non-empty string"),e(typeof t.verb=="string"&&se.includes(t.verb),"base.verb: extract|design|walk"),e(typeof t.mode=="string","base.mode: string"),e(typeof t.created_at=="string","base.created_at: string"),e(d(t.run_config),"base.run_config: object"),d(t.run_config)&&e(!("resume"in t.run_config),"base.run_config: must not carry `resume`"),e(typeof t.conv_source=="string",'base.conv_source: string ("" when absent)'),e(typeof t.store_watermark=="string"||t.store_watermark===null,"base.store_watermark: string | null (null = genesis)");else if(s==="delta"||s==="full"){e(typeof t.sid=="string"&&t.sid.length>0,"delta.sid: non-empty string"),e(Number.isInteger(t.seq)&&t.seq>=1,"delta.seq: integer \u2265 1"),e(Number.isInteger(t.turn_id),"delta.turn_id: integer"),e(typeof t.at=="string"&&re.includes(t.at),"delta.at: turn|ask|final"),e(typeof t.ts=="string","delta.ts: string");let n=t.agent;if(d(n)){e(Number.isInteger(n.agent_state_schema),"agent.agent_state_schema: integer"),e(Array.isArray(n.delta_items),"agent.delta_items: array"),e(d(n.binding),"agent.binding: object");let o=n.usage_total;e(d(o)&&typeof o.input_tokens=="number"&&typeof o.output_tokens=="number"&&typeof o.credits=="number","agent.usage_total: {input_tokens, output_tokens, credits} numbers"),n.base_fingerprint!==void 0&&e(typeof n.base_fingerprint=="string","agent.base_fingerprint: string when present"),s==="full"&&e(typeof n.base_fingerprint=="string","full: agent.base_fingerprint required")}else r.push("delta.agent: object");let i=t.kane;if(d(i)){e(D(i.applied_events),"kane.applied_events: string[]"),e(D(i.held_receipts),"kane.held_receipts: string[]");let o=i.pending;e(d(o)&&Array.isArray(o.questions)&&Array.isArray(o.proposals),"kane.pending: {questions[], proposals[]}"),e(Array.isArray(i.parent_asks),"kane.parent_asks: array"),e(d(i.read_basis),"kane.read_basis: object");let p=i.corpus_cursor;if(e(d(p)&&D(p.remaining),"kane.corpus_cursor: {remaining: string[]}"),e(typeof i.store_watermark=="string"||i.store_watermark===null,"kane.store_watermark: string | null (null = genesis)"),i.awaits!==void 0){let a=i.awaits;e(d(i.awaits)&&typeof a.call=="string"&&(typeof a.event_id=="string"||typeof a.event_prefix=="string"),"kane.awaits: {call, event_id | event_prefix}")}i.ingest_registry!==void 0&&e(Array.isArray(i.ingest_registry)&&i.ingest_registry.every(a=>d(a)&&typeof a.ref=="string"&&typeof a.entered_at=="string"),"kane.ingest_registry: [{ref, entered_at, consumed?}]"),i.sent_unread!==void 0&&e(D(i.sent_unread),"kane.sent_unread: string[]"),i.ingest_schedule!==void 0&&e(Array.isArray(i.ingest_schedule)&&i.ingest_schedule.every(a=>d(a)&&typeof a.source_id=="string"&&typeof a.cid=="string"&&["pending","done","skipped"].includes(String(a.status))),"kane.ingest_schedule: [{source_id, cid, status}]")}else r.push("delta.kane: object")}else r.push('kind: expected "base" | "delta" | "full"');return{ok:r.length===0,errors:r}}import{readFileSync as ke}from"fs";import{join as _e}from"path";import{closeSync as N,linkSync as ie,mkdirSync as G,openSync as I,readFileSync as oe,readdirSync as Y,renameSync as ae,rmSync as F,statSync as ce,writeFileSync as M}from"fs";import{join as j}from"path";function pe(t,r){let e=j(t,"sessions",r,B),s=n=>j(e,n);return{read:n=>{try{return oe(s(n),"utf8")}catch(i){if(i.code==="ENOENT")return null;throw i}},list:()=>{try{return Y(e)}catch{return[]}},write:(n,i)=>{G(e,{recursive:!0}),le(s(n),i,e)},writeIfAbsent:(n,i)=>(G(e,{recursive:!0}),de(s(n),i,e)),remove:n=>F(s(n),{force:!0}),bytes:()=>fe(e)}}function le(t,r,e){let s=`${t}.tmp-${process.pid}`,n=I(s,"w");try{M(n,r,{mode:384}),E(n)}finally{N(n)}ae(s,t);try{let i=I(e,"r");E(i),N(i)}catch{}}var ue=new Set(["EPERM","ENOTSUP","EXDEV"]);function de(t,r,e){let s=`${t}.tmp-${process.pid}`,n=I(s,"w");try{M(n,r,{mode:384}),E(n)}finally{N(n)}try{ie(s,t)}catch(i){let o=i.code??"";if(o==="EEXIST")return!1;if(!ue.has(o))throw i;if(!ge(t,r))return!1}finally{F(s,{force:!0})}try{let i=I(e,"r");E(i),N(i)}catch{}return!0}function ge(t,r){let e;try{e=I(t,"wx")}catch(n){if(n.code==="EEXIST")return!1;throw n}let s=!1;try{M(e,r),E(e),s=!0}finally{N(e),s||F(t,{force:!0})}return!0}function fe(t){let r=0;try{for(let e of Y(t))try{r+=ce(j(t,e)).size}catch{}}catch{return 0}return r}var me=3,$e=600*1e3,h=class extends Error{constructor(e,s){super(`${e}: ${s}`);this.code=e}},S=class extends Error{constructor(r){super(`CHECKPOINT_WRITE: ${r}`)}},V=class extends S{},he=(t,r)=>_e(t,"sessions",r,"state.json"),Ce=new Set,J=new Set;function W(t,r,e){for(let s of Ce)try{s(t,r,e)}catch{}}var be=new Set;function De(t,r=new Date){for(let e of be)try{e(t,r)}catch{}}function He(t,r){let e=JSON.stringify(r)+`
3
3
  `;t.writeIfAbsent(m,e)||ye(t.read(m))||(t.remove(m),t.writeIfAbsent(m,e))}function ye(t){if(t===null)return!1;try{return JSON.parse(t),!0}catch{return!1}}function Z(t,r){let e;try{e=JSON.parse(r)}catch(n){throw new h("CHECKPOINT_CORRUPT",`${t}: ${n.message}`)}let s=K(e);if(!s.ok)throw new h("CHECKPOINT_CORRUPT",`${t}: ${s.errors.join("; ")}`);return e}function X(t,r){let e=t.read(r);if(e===null)throw new h("CHECKPOINT_MISSING",`${r} is not in the chain`);return Z(r,e)}function ee(t){let r=[],e=[];for(let s of t.list()){let n=/^delta-(\d+)\.json$/.exec(s);n&&r.push(Number(n[1]));let i=/^full-(\d+)\.json$/.exec(s);i&&e.push(Number(i[1]))}return r.sort((s,n)=>s-n),e.sort((s,n)=>s-n),{deltas:r,fulls:e}}function Be(t,r){try{return JSON.parse(ke(he(t,r),"utf8")).checkpoint??null}catch{return null}}function te(t,r,e){let s=[],n,i=0;if(e.full_seq!==null){let a=X(t,w(e.full_seq));s.push(a),n=a.agent.base_fingerprint,i=e.full_seq}let o;for(let a=i+1;a<=e.seq;a++)try{let u=X(t,y(a));s.push(u),!n&&u.agent.base_fingerprint&&(n=u.agent.base_fingerprint)}catch(u){if(u instanceof h&&u.code==="CHECKPOINT_CORRUPT"){o={resumableAt:a-1,turnsLost:e.seq-(a-1)};break}throw u}if(s.length===0)throw new h("CHECKPOINT_CORRUPT",`${r}: pointer names seq ${e.seq} but no chain records exist`);return{items:s.flatMap(a=>a.agent.delta_items),last:s[s.length-1],base_fingerprint:n,fallback:o}}function Ke(t,r,e,s,n){let i=performance.now(),o=r.state.sid,p=r.state.checkpoint;if(p){if(e.seq<p.seq)throw new S(`seq regression: got ${e.seq}, pointer at ${p.seq} (${o})`);if(e.seq===p.seq){if(e.turn_id===p.turn_id&&e.at===p.at)return p;throw new S(`seq regression: seq ${e.seq} re-used with different metadata (turn ${e.turn_id}/${p.turn_id}, at ${e.at}/${p.at}) (${o})`)}}let a=(n?.now??(()=>new Date))(),u=a.toISOString(),l={schema:x,kind:"delta",sid:o,seq:e.seq,turn_id:e.turn_id,at:e.at,ts:u,agent:{agent_state_schema:e.agent_state_schema,delta_items:e.delta_items,binding:e.binding,usage_total:e.usage_total,...e.base_fingerprint!==void 0?{base_fingerprint:e.base_fingerprint}:{}},kane:s},A=Math.max(1,n?.retries??me),g=JSON.stringify(l)+`
4
4
  `,C=!1;Buffer.byteLength(g)>524288&&!J.has(o)&&(J.add(o),C=!0,n?.onSoftCap?.("note: this session's checkpoints are getting large \u2014 long pasted inputs are kept verbatim; consider ingesting big documents as sources instead"));let v=!1,q;for(let f=0;f<A&&!v;f++)try{t.write(y(e.seq),g),v=!0}catch(k){q=k}if(!v)throw new S(`delta-${e.seq} write failed after ${A} attempts: ${q?.message??"unknown"} (${o})`);let _=p?.full_seq??null,P=t.bytes()>67108864;if(e.seq%25===0||P){let f=[],k=e.base_fingerprint;if(p){let R=te(t,o,p);f=R.items,k=k??R.base_fingerprint}if(f=[...f,...e.delta_items],!k)throw new S(`compaction at seq ${e.seq}: no base_fingerprint anywhere in the chain (${o})`);let c={...l,kind:"full",agent:{...l.agent,delta_items:f,base_fingerprint:k}};t.write(w(e.seq),JSON.stringify(c)+`
5
5
  `),_=e.seq}let b={seq:e.seq,turn_id:e.turn_id,at:e.at,ts:u,full_seq:_};if(r.save({checkpoint:b}),_===e.seq){let{deltas:f,fulls:k}=ee(t);for(let c of f)c<=_&&t.remove(y(c));for(let c of k)c<_&&t.remove(w(c))}let T=t.bytes();if(P&&T>67108864)throw W(o,b,a),new V(`session ${o} checkpoint dir is ${Math.round(T/(1024*1024))}MB (cap ${Math.round(67108864/(1024*1024))}MB) even after compaction \u2014 pausing; resume in a fresh session or trim the conversation`);return W(o,b,a),n?.onStat?.({sid:o,seq:e.seq,persist_ms:performance.now()-i,bytes:Buffer.byteLength(g),dir_bytes:T,compacted:_===e.seq,soft_warned:C}),b}function je(t,r,e){let s=t.read(m);if(s===null)throw new h("CHECKPOINT_MISSING",`${r}: no ${m} \u2014 not a checkpoint session`);let n=Z(m,s),i=p=>{let{deltas:a,fulls:u}=ee(t);if(!p){let g=[...a.map(y),...u.map(w)];return{base:n,agent:null,kane:null,pointer:null,orphans:g}}let l=te(t,r,p),A=[...a.filter(g=>g>p.seq).map(y),...u.filter(g=>g>p.seq).map(w)];return{base:n,agent:{delta_items:l.items,binding:l.last.agent.binding,base_fingerprint:l.base_fingerprint,agent_state_schema:l.last.agent.agent_state_schema,...l.last.agent.usage_total?{usage_total:l.last.agent.usage_total}:{}},kane:l.last.kane,pointer:p,orphans:A,...l.fallback?{fallback:l.fallback}:{}}},o=e();try{return i(o)}catch(p){if(!(p instanceof h&&p.code==="CHECKPOINT_MISSING"))throw p;return i(e())}}function Fe(t,r){let e=[];for(let s of U(t).records)if(s.sid===r)for(let n of s.event_ids??[])e.push(n);return e}function Me(t,r,e,s,n){let i=n.verb??"extract",o=t.parse(e.store_watermark),p=o===null?null:t.resolveToken(o);if(o!==null&&p===null)throw new L(`watermark not in chain: ${e.store_watermark} names no record in this store (rebuilt or foreign?) \u2014 re-ground the session or abandon it`);let a=t.recordsSince(o),u=p===null?0:t.sessions().recordCount(r,p.seq),l=new Map;for(let c of a)c.sid===r&&l.set(c.seq,++u);let A=c=>l.get(c.seq)??0,g=new Set(e.applied_events),C=0,v=[];for(let c of a){if(typeof c.sid!="string"){C+=1;continue}if(c.sid===r){if((c.event_ids??[]).length===0){C+=1;continue}v.push(c)}}C>0&&n.onNote?.(`reconcile: skipped ${C} store record(s) not attributable to this session (pre-sid grace)`);let q=n.ownActors??["extract-agent","design-agent","owner"],_=[],P=[];for(let c of v){if(n.resent!==void 0&&(c.event_ids??[]).includes(n.resent))continue;let R=(c.event_ids??[]).filter(ne=>!g.has(ne));if(R.length===0)continue;P.push(...R);let O;try{O=n.composeReceipt(c,s,{verb:i,commitN:A(c),...n.ucRef?{ucRef:n.ucRef}:{},...n.typedBlockers?{typedBlockers:!0}:{},...n.ignoreGaps?.size?{ignoreGaps:n.ignoreGaps}:{}}).text}catch{O=`commit ${R[0]} at ${c.ts} \u2014 details unavailable (graph moved since)`}let $=c.review?.[0]?.by;$?.id&&!q.includes($.id)&&(O+=`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-LZPYIFHZ.js";import{a as p}from"./chunk-RQKMSNEU.js";import{f as e}from"./chunk-HYJVYYAZ.js";import{a as t,b as i,y as n}from"./chunk-J4FIESTB.js";import{dirname as d}from"path";import{fileURLToPath as l}from"url";import{existsSync as a}from"fs";import{join as c,resolve as f}from"path";function g(r){for(let o of[f(r,".."),f(r,"../..")])if(a(c(o,"package.json")))return o;return null}function u(r=m,o,s=p){e({version:t,baseDir:i,authEnvironments:n,packageRoot:g(d(l(import.meta.url))),wording:r,...o?{warn:o}:{},userSessionId:s})}u();export{g as a,u as b};
2
+ import{a as m}from"./chunk-LZPYIFHZ.js";import{f as e}from"./chunk-HYJVYYAZ.js";import{a as t,b as i,z as n}from"./chunk-BRWCWZE3.js";import{a as p}from"./chunk-WTMCDYR3.js";import{dirname as d}from"path";import{fileURLToPath as l}from"url";import{existsSync as a}from"fs";import{join as c,resolve as f}from"path";function g(r){for(let o of[f(r,".."),f(r,"../..")])if(a(c(o,"package.json")))return o;return null}function u(r=m,o,s=p){e({version:t,baseDir:i,authEnvironments:n,packageRoot:g(d(l(import.meta.url))),wording:r,...o?{warn:o}:{},userSessionId:s})}u();export{g as a,u as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{oa as f}from"./chunk-PI7OXS62.js";import{f as p,g}from"./chunk-KU3YHPWZ.js";import{o as l}from"./chunk-HYJVYYAZ.js";function m(t){let e=(n,r)=>n===null?`"${t.ids.title(r)}"`:f(n);return[...t.awaiting.map(n=>`${e(t.ids.test(n.test),n.test)} checks ${e(t.ids.criterion(n.criterion),n.criterion)}, a criterion not approved yet`),...t.unchanged?[l().text("note.phase_unchanged",{})]:[]]}function y(t,e){return m({awaiting:t.awaitingApproval??[],unchanged:t.unchanged===!0,ids:e})}function O(t,e){return t.map(n=>({test:e.test(n.test)??e.title(n.test),criterion:e.criterion(n.criterion)??e.title(n.criterion)}))}function x(t,e,n={}){if(t.length===0)return null;let r=[...new Set(t.map(c=>c.criterion))],o=r.length===1?e.criterion(r[0]):null,a={tests:new Set(t.map(c=>c.test)).size,criteria:r.length};return n.command===!0?l().text("note.tests_await_approval_command",{...a,criterion:o}):l().text("note.tests_await_approval",{...a,criterion:o===null?null:f(o)})}function A(t,e){let n=new Map,r=t.resolve(e);if(!r)return n;let o=i=>!t.superseded.has(i)&&t.trust.get(i)!=="archived",a=new Set([r.cid,r.tip,t.tipOf(r.cid)]),c=new Set(t.byLabel(p.SCENARIO).filter(({cid:i})=>o(i)&&t.edgesFrom(i).some(s=>s.type===g.BELONGS_TO&&(a.has(s.dst)||a.has(t.tipOf(s.dst))))).map(({cid:i})=>i));for(let{cid:i}of t.byLabel(p.TEST)){if(!o(i))continue;let s=t.edgesFrom(i);if(s.some(d=>d.type===g.AUTOMATES&&c.has(t.tipOf(d.dst))))for(let d of s){if(d.type!==g.VERIFIES)continue;let u=t.tipOf(d.dst);(t.trust.get(u)??"derived")==="derived"&&n.set(u,(n.get(u)??new Set).add(i))}}return n}export{m as a,y as b,O as c,x as d,A as e};
2
+ import{oa as f}from"./chunk-5EAJO372.js";import{f as p,g}from"./chunk-KU3YHPWZ.js";import{o as l}from"./chunk-HYJVYYAZ.js";function m(t){let e=(n,r)=>n===null?`"${t.ids.title(r)}"`:f(n);return[...t.awaiting.map(n=>`${e(t.ids.test(n.test),n.test)} checks ${e(t.ids.criterion(n.criterion),n.criterion)}, a criterion not approved yet`),...t.unchanged?[l().text("note.phase_unchanged",{})]:[]]}function y(t,e){return m({awaiting:t.awaitingApproval??[],unchanged:t.unchanged===!0,ids:e})}function O(t,e){return t.map(n=>({test:e.test(n.test)??e.title(n.test),criterion:e.criterion(n.criterion)??e.title(n.criterion)}))}function x(t,e,n={}){if(t.length===0)return null;let r=[...new Set(t.map(c=>c.criterion))],o=r.length===1?e.criterion(r[0]):null,a={tests:new Set(t.map(c=>c.test)).size,criteria:r.length};return n.command===!0?l().text("note.tests_await_approval_command",{...a,criterion:o}):l().text("note.tests_await_approval",{...a,criterion:o===null?null:f(o)})}function A(t,e){let n=new Map,r=t.resolve(e);if(!r)return n;let o=i=>!t.superseded.has(i)&&t.trust.get(i)!=="archived",a=new Set([r.cid,r.tip,t.tipOf(r.cid)]),c=new Set(t.byLabel(p.SCENARIO).filter(({cid:i})=>o(i)&&t.edgesFrom(i).some(s=>s.type===g.BELONGS_TO&&(a.has(s.dst)||a.has(t.tipOf(s.dst))))).map(({cid:i})=>i));for(let{cid:i}of t.byLabel(p.TEST)){if(!o(i))continue;let s=t.edgesFrom(i);if(s.some(d=>d.type===g.AUTOMATES&&c.has(t.tipOf(d.dst))))for(let d of s){if(d.type!==g.VERIFIES)continue;let u=t.tipOf(d.dst);(t.trust.get(u)??"derived")==="derived"&&n.set(u,(n.get(u)??new Set).add(i))}}return n}export{m as a,y as b,O as c,x as d,A as e};
@@ -0,0 +1,21 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{e as g}from"./chunk-ZCRZFAOT.js";import{a as C}from"./chunk-RZ4F3BHX.js";import{a as D}from"./chunk-U5V3L5QH.js";var P={ASR_CMD_START:"info",ASR_CMD_END:"info",ASR_AGENT_SPAWN:"info",ASR_WORK_ITEM_START:"info",ASR_WORK_ITEM_END:"info",ASR_PROPOSAL:"info",ASR_VALIDATE_FAILED:"warn",ASR_COMMIT:"info",ASR_SESSION_PAUSED:"info",ASR_SESSION_RESUMED:"info",ASR_SESSION_COMPLETE:"info",ASR_AGENT_EXIT:"warn",ASR_RECONCILE_PLAN:"info",ASR_RECONCILE_ROW_END:"info",ASR_HIGH_RISK_CI:"warn",ASR_INGEST:"info",ASR_EMBED_DEGRADED:"warn",ASR_CONTEXT_CLONED:"warn",ASR_ERROR:"error",ASR_CRASH:"error",ASR_FSCK_REPORT:"warn",ASR_IMPACT_TIMING:"info",EXPLORE_START:"info",EXPLORE_END:"info",EXPLORE_ERROR:"error",PLUGIN_INSTALL:"info",PLUGIN_BINARY_DOWNLOAD:"info",PLUGIN_REMOVE:"info",PLUGIN_DOCTOR:"info"},M={ASR_CMD_START:["source_count","resumed","applied_plan"],ASR_CMD_END:["exit_code","duration_ms","credits_total","work_items_total","work_items_failed","outcome"],ASR_AGENT_SPAWN:["tier","duration_ms"],ASR_WORK_ITEM_START:["work_item_index","work_item_count","source_kind"],ASR_WORK_ITEM_END:["work_item_index","work_item_count","outcome","duration_ms","error_domain","error_code"],ASR_PROPOSAL:["item_count","turn_index"],ASR_VALIDATE_FAILED:["error_code","count","turn_index"],ASR_COMMIT:["trusted","derived","archived","items","items_dropped","record_seq","phase","duration_ms"],ASR_SESSION_PAUSED:["pending_questions","pending_proposals"],ASR_SESSION_RESUMED:["resume_count","expired_session_id"],ASR_SESSION_COMPLETE:["duration_ms","credits_total"],ASR_AGENT_EXIT:["exit_code","signal"],ASR_RECONCILE_PLAN:["row_count","add_count","modify_count","archive_count"],ASR_RECONCILE_ROW_END:["row_index","kind","outcome","duration_ms"],ASR_HIGH_RISK_CI:["count"],ASR_INGEST:["work_item_index","work_item_count","format","bytes","media_facts"],ASR_EMBED_DEGRADED:["held"],ASR_CONTEXT_CLONED:[],ASR_ERROR:["error_domain","error_code","exit_code","turn_index","request_id"],ASR_CRASH:["error_domain","error_code","error_name"],ASR_FSCK_REPORT:["issue_count","records","pending","codes","issues","issues_truncated"],EXPLORE_START:["exploration_id","run_id","remote","on_vm","hx_job_id","policy","max_parallel","max_leases"],EXPLORE_END:["exploration_id","run_id","remote","on_vm","hx_job_id","outcome","stop_reason","exit_code","duration_ms","leases","findings","committed","pending","complete","credits_total","peak_parallel"],EXPLORE_ERROR:["error_domain","error_code","exit_code","exploration_id","run_id","stage","error"],PLUGIN_INSTALL:["name","version","status","error_code","error_domain","error"],PLUGIN_BINARY_DOWNLOAD:["status","platform","duration_ms","error"],PLUGIN_REMOVE:["name","removed"],PLUGIN_DOCTOR:["name","checks","failed_checks","failed"],ASR_IMPACT_TIMING:["read_change_ms","read_project_ms","reads","agent_start_ms","turns","turn_ms_total","turn_ms_max","tool_calls","tool_ms_total","tool_bytes_total","review_ms","print_ms","total_ms","parts","use_cases","tests","use_cases_opened","tests_opened","cases_ms","cases_found","outcome"]},K=[[/^lattice_/,"lattice"],[/^refused_/,"refused"],[/^(auth_expired|401|preflight_auth|AUTH)/i,"auth"],[/^(credit_denied|402|CREDIT)/i,"credit"],[/^(stream_drop|read_timeout|connect_failed|dns|E(CONN|AI_AGAIN|TIMEDOUT)|network)/i,"network"],[/^(frame_parse|post_terminal_data|eof_without_terminal|turn_id_mismatch|binding_mismatch|schema_invalid|frame_too_large|protocol)/i,"protocol"],[/^(provider_error|http_5\d\d|turn_exhausted|adapter_integrity)/i,"provider"],[/^(STALE_BASIS|R\d+|validation|criteria)/i,"validation"],[/^(CHAIN_ERROR|DERIVED_(MISSING|DRIFT)|NODE_FILE_(MISSING|MISMATCH|CORRUPT)|CARDINALITY_VIOLATION|SUPERSEDE_(UNKNOWN_(OLD|NEW|ECID)|CYCLE)|DOUBLE_SUPERSEDE|NAME_UNKNOWN_TARGET|EDGE_CYCLE|UNKNOWN_(LABEL|FIELD|EDGE_TYPE|EDGE_PROP)|BAD_(CHECK|ENUM)|MISSING_(FIELD|SALIENT)|ILLEGAL_EDGE)$/,"graph"],[/^(BLOB_MISSING|SOURCE_UNKNOWN|SESSION_(LOCKED|EXPIRED|MISSING|LOCK_LOST)|NO_STORE|fsck|store)/i,"store"],[/^(usage|EX2|SOURCE_WITH_RESUME|HIGH_RISK_CI|bad_flag|no_tty)/i,"usage"],[/^exit_\d+_unattributed$/,"unattributed"],[/^agent_(crash|exit)/i,"agent_crash"],[/^(failed:|explore_)/,"explore"]];function v(e){let t=(e||"unknown").slice(0,64);for(let[n,r]of K)if(n.test(t))return{error_domain:r,error_code:t};return{error_domain:"cli_crash",error_code:t}}var W=64,G=128,k=/^[A-Za-z0-9._:@\/-]+$/,X={codes:512},$={ASR_FSCK_REPORT:["issues"],EXPLORE_ERROR:["error"],PLUGIN_INSTALL:["error"],PLUGIN_BINARY_DOWNLOAD:["error"]},B=20480,j=0;function H(e,t){if(typeof t=="number"&&Number.isFinite(t)||typeof t=="boolean")return t;if(typeof t!="string")return;let n=e.endsWith("_id")||e==="signal"?G:X[e]??W;if(!(t.length===0||t.length>n)&&k.test(t))return t}var w=e=>e!==void 0&&e.length>0&&e.length<=G&&k.test(e);function b(e,t,n={}){let r=M[t],i={};for(let s of r){let o=n[s];if(o==null)continue;if($[t]?.includes(s)){if(typeof o!="string"||o.length===0)continue;let a=o.replace(/[\u0000-\u001F\u007F]/g,"");if(Buffer.byteLength(a,"utf8")>B)continue;i[s]=a;continue}if(s==="items"){let a=Array.isArray(o)?o.filter(f=>typeof f=="string"):[],E=a.filter(f=>D.test(f));E.length>0&&(i.items=E.slice(0,50).join(","));let p=a.length-E.length;p>0&&(i.items_dropped=p);continue}let d=H(s,o);d!==void 0&&(i[s]=d)}if(typeof n.error_code=="string"&&r.includes("error_code")){let{error_domain:s,error_code:o}=v(n.error_code);i.error_code=o,r.includes("error_domain")&&(i.error_domain=s)}return{level:P[t],event:t,message:t,session_id:e.session_id,operation_id:e.operation_id,...e.parent_operation_id?{parent_operation_id:e.parent_operation_id}:{},...e.agent_session_id?{agent_session_id:e.agent_session_id}:{},context_lineage_id:e.context_lineage_id??null,context_instance_id:e.context_instance_id??null,...w(e.lattice_session_id)?{lattice_session_id:e.lattice_session_id}:{},...w(e.project_id)?{project_id:e.project_id}:{},verb:e.verb,mode:e.mode,component:"kane-cli",seq:j++,event_time:new Date().toISOString(),context:i}}import _ from"fs";import A from"path";var V=500,Y=7,q=512*1024,z=15*6e4;function I(e){if(e.length!==0)try{let t=g();_.mkdirSync(A.dirname(t),{recursive:!0});let n=e.map(i=>JSON.stringify(i)).join(`
3
+ `)+`
4
+ `;_.appendFileSync(t,n,{flag:"a",mode:384});let r=0;try{r=_.statSync(t).size}catch{r=0}r>q&&te()}catch{}}function J(e){try{let t=A.dirname(e),n=A.basename(e);for(let r of _.readdirSync(t)){if(!r.startsWith(`${n}.claim-`)&&!r.startsWith(`${n}.prune-`))continue;let i=A.join(t,r),s=Number(r.slice(r.lastIndexOf("-")+1));if(s===process.pid)continue;let o=!1;if(Number.isFinite(s)&&s>0)try{process.kill(s,0),o=!0}catch{o=!1}let d=!o;if(o)try{d=Date.now()-_.statSync(i).mtimeMs>z}catch{d=!1}if(d)try{let a=_.readFileSync(i,"utf8");a.trim()&&_.appendFileSync(e,a.endsWith(`
5
+ `)?a:a+`
6
+ `,{flag:"a",mode:384}),_.unlinkSync(i)}catch{}}}catch{}}function le(e){Z(e).catch(()=>{})}function Z(e){return Q(async t=>{try{return(await C(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok}catch{return!1}})}var U=Promise.resolve();function Q(e){let t=U.then(()=>ee(e));return U=t.catch(()=>{}),t}async function ee(e){let t=g();J(t);let n=`${t}.claim-${process.pid}`,r;try{_.renameSync(t,n),r=_.readFileSync(n,"utf8")}catch{return}let i=[];for(let s of r.split(`
7
+ `))if(s.trim())try{i.push(JSON.parse(s))}catch{}try{(i.length===0?!0:await e(i))?_.unlinkSync(n):(_.appendFileSync(t,r,{flag:"a",mode:384}),_.unlinkSync(n))}catch{try{_.appendFileSync(t,r,{flag:"a",mode:384}),_.unlinkSync(n)}catch{}}}function te(e=V,t=Y){try{let n=g(),r=`${n}.prune-${process.pid}`;_.renameSync(n,r);let s=_.readFileSync(r,"utf8").split(`
8
+ `).filter(E=>E.trim()),o=Date.now()-t*24*3600*1e3,a=s.filter(E=>{try{let p=JSON.parse(E),f=Date.parse(p.event_time??p.timestamp??"");return Number.isNaN(f)||f>=o}catch{return!1}}).slice(-e);a.length>0&&_.appendFileSync(n,a.join(`
9
+ `)+`
10
+ `,{flag:"a",mode:384}),_.unlinkSync(r)}catch{}}var S=new Set;function ne(e){return S.add(e),()=>{S.delete(e)}}function N(e){let t=[...S];S=new Set;for(let n of t)try{n(e)}catch{}}function F(){S=new Set}var u=null;function Re(e){u=e}function me(){return u}var x=()=>!!process.env.KANE_DEV_MODE,l=[],O=!1,L=null,m=null,y=null,c=null,R=[];function ge(e){if(c=e,e&&R.length>0){let t=R;R=[];for(let n of t)try{e.log(n.level,n.event,n.message,n.context)}catch{}}}function Ae(e,t,n,r){if(c){try{c.log(e,t,n,r)}catch{}return}R.push({level:e,event:t,message:n,context:r})}function Ie(){return c}function Ne(){return O}function Te(e,t){l=l.filter(n=>n.name!==e),l.push({name:e,fn:t})}function Oe(e){l=l.filter(t=>t.name!==e)}function ye(e,t){let n=l.find(i=>i.name===e);if(!n)return;l=l.filter(i=>i.name!==e);let r=!0;try{n.fn()}catch(i){r=!1,process.stderr.write(`[exit-manager] cleanup(${e}) failed: ${i instanceof Error?i.message:String(i)}
11
+ `)}t&&r&&x()&&process.stderr.write(`[exit-manager] cleanup(${e}): ${t}
12
+ `)}async function xe(e=1e3){let t=c;if(!(!t?.stopAndFlushOnce||!t.drainBuffer))try{let n=await t.stopAndFlushOnce(e);if(n!=="sent"&&n!=="empty"){let r=t.drainBuffer();r.length>0&&I(r)}}catch{}}function T(e,t,n=!1,r){if(O){process.exit(L??e);return}if(O=!0,L=e,n&&c)try{e===130||e===143?c.log("warn","SIGNAL_EXIT",t,{signal:e===130?"SIGINT":"SIGTERM",exit_code:e}):c.log("error","CRASH",t,{error_code:"cli_crash",error:t,...r?{stack:r}:{},exit_code:e}),N(e===130||e===143?{kind:"signal",signal:e===130?"SIGINT":"SIGTERM"}:{kind:"crash"});let o=c.drainBuffer?.()??[];o.length>0&&I(o),c.shutdownSync()}catch{}if(n?N(e===130||e===143?{kind:"signal",signal:e===130?"SIGINT":"SIGTERM"}:{kind:"crash"}):N({kind:"exit",code:e}),!n&&c)try{c.shutdownSync()}catch{}if(n&&u&&e!==130&&e!==143)try{let o=/Uncaught exception:\s*([A-Za-z0-9_$]+)/.exec(t)?.[1]??"crash";I([b(u,"ASR_CRASH",{error_code:"cli_crash",error_name:o})])}catch{}let i=[...l].reverse(),s=[];for(let o of i)try{o.fn(),s.push(o.name)}catch(d){process.stderr.write(`[exit-manager] cleanup(${o.name}) failed: ${d instanceof Error?d.message:String(d)}
13
+ `)}if(l=[],x()&&(process.stderr.write(`[exit-manager] shutdown(${e}): ${t}
14
+ `),s.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${s.join(", ")}
15
+ `)),n){if(y)try{y()}catch{}e===130||e===143||(process.stderr.write(`
16
+ kane-cli crashed: ${t}
17
+ `+(s.length>0?`Resources cleaned up (${s.join(", ")}).
18
+ `:"")),u&&process.stderr.write(`session: ${u.session_id} \u2014 share this id with support
19
+ `),r&&x()?process.stderr.write(`${r}
20
+ `):process.stderr.write(`(re-run with KANE_DEV_MODE=1 for the full stack)
21
+ `)),process.exit(e);return}if(m&&!n){m();return}process.exit(e)}function Le(e){m=e}function he(){m=null}function De(e){y=e}var h=!1;function Ce(){h||(h=!0,process.on("SIGINT",()=>{T(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{T(143,"Received SIGTERM",!0)}),process.on("uncaughtException",e=>{T(1,`Uncaught exception: ${e.name}: ${e.message}`,!0,e.stack)}),process.on("unhandledRejection",e=>{T(1,`Unhandled rejection: ${String(e)}`,!0,e instanceof Error?e.stack:void 0)}))}function Pe(){l=[],O=!1,L=null,m=null,y=null,c=null,R=[],h=!1,u=null,F()}export{P as a,b,I as c,le as d,Z as e,ne as f,Re as g,me as h,ge as i,Ae as j,Ie as k,Ne as l,Te as m,Oe as n,ye as o,xe as p,T as q,Le as r,he as s,De as t,Ce as u,Pe as v};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as t}from"./chunk-UJLULWSR.js";var n=null;function o(){return n??=t()}function e(r){n=r}export{o as a,e as b};
2
+ import{b as t}from"./chunk-U5V3L5QH.js";var n=null;function o(){return n??=t()}function e(r){n=r}export{o as a,e as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as V,e as W,f as Q}from"./chunk-3JLEDSG5.js";import{d as I,j as T}from"./chunk-LLQWEGXD.js";import{Ea as $,M as y}from"./chunk-PI7OXS62.js";import{d as N}from"./chunk-KU3YHPWZ.js";import{d as h,o as S}from"./chunk-HYJVYYAZ.js";function B(e,n,t){let i=S();return e===void 0||e===n?null:e==="extract"||e==="design"?{code:"WRONG_VERB",message:i.text("WRONG_VERB",{sid:t,verb:e}),next:[h(i,"next.resume_session",{verb:e,sid:t},{why:`this session belongs to a ${e} run`})]}:{code:"WRONG_VERB",message:`error: session ${t} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}function X(e){return P(e)!==null}function P(e){let n=e,t=K(n);if(t<0)return null;let i=n[t].data?.tool_calls??[],r=i.map(o=>o.id),a=n.slice(t+1);if(r.length===0||a.some(o=>o?.kind!=="tool_result"))return null;let s=new Set(a.map(o=>o.data?.tool_call_id));if(!r.every(o=>s.has(o)))return null;let c=a.find(o=>o.data?.status==="ok"&&o.data?.payload?.accepted===!0);if(!c)return null;let _=i.find(o=>o.id===c.data?.tool_call_id),w=_?.arguments;return{name:typeof _?.name=="string"?_.name:"",arguments:w!==null&&typeof w=="object"?w:{}}}function Y(e){let n=e,t=K(n);if(t<0)return!1;let i=n.slice(t+1);if(i.some(s=>s?.kind!=="tool_result"))return!1;let r=new Set(i.map(s=>s.data?.tool_call_id)),a=(n[t].data?.tool_calls??[]).filter(s=>!r.has(s.id));return a.length===1&&a[0].name==="ask_user"}function K(e){for(let n=e.length-1;n>=0;n--)if(e[n]?.kind==="assistant_turn")return n;return-1}function ce(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function G(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,t)=>({id:`o${t}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function de(e,n,t){let i=n.pending.questions.map(G),r=W(e.state.pending.answers).filter(a=>n.pending.questions.some(s=>s.id===a.id&&Q(a,s)));e.save({agent_state:n.agent_state,pending:{questions:i,proposals:n.pending.proposals??[],...r.length>0?{answers:r}:{}},assumed:n.assumed.map(a=>({questionId:a.question_id,optionId:a.option_id,flagged:!0,eventId:`assumed:${n.sid}:${a.question_id}`}))}),t?.(),e.release(),I(e.state.sid)}function pe(e,n,t,i){if(t.name.startsWith("finalize"))return{call:t.name,event_id:`${e}:ckpt:${i}`};let r=t.arguments.ops;return Array.isArray(r)&&r.length>0&&n?{call:t.name,event_prefix:`chatop:${n}:s${i}:`}:null}function ge(e,n,t){if(!t)return!0;let i=y(e).appliedEvents;if(t.event_id!==void 0)return i.has(t.event_id)||n.includes(t.event_id);let r=t.event_prefix??"";for(let a of i)if(a.startsWith(r))return!0;return n.some(a=>a.startsWith(r))}function fe(e){return`the agent's last ${e==="finalize_design"?"design phase was":e.startsWith("finalize")?"proposal was":"changes were"} not saved before the session stopped \u2014 it is sent again`}function me(e){return e===1?"your last message was sent again":`your last ${e} messages were sent again`}function U(e,n,t){return t?.call!=="finalize_design"||t.event_id===void 0?!1:y(e).appliedEvents.has(t.event_id)&&!n.includes(t.event_id)}function _e(){return"the agent's last design phase was saved before the session stopped, but not all of its files \u2014 it is sent again to write them"}function he(e){return{persist(n,t){let i=e.seqBase(),r={seq:n.seq+i,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},a={applied_events:[...new Set([...e.handle.state.applied_events,...e.store.sessions().appliedEvents(e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(G):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:e.store.serialize(e.store.head()),...(()=>{let s=n.at==="turn"&&e.awaits?P(n.delta_items):null,c=s?e.awaits(s,r.seq):null;return c?{awaits:c}:{}})(),...t?.sentUnread?.length?{sent_unread:[...t.sentUnread]}:{},...(()=>{let s=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],c=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...s.length?{ingest_registry:s}:{},...c.length?{ingest_schedule:c}:{}}})()};return e.store.sessions().persistCheckpoint(e.handle,r,a,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}function D(e,n){return!e.checkpoint&&!n&&e.agent_state.items.length===0}var m=class extends Error{constructor(t,i,r=[]){super(`${t}: ${i}`);this.code=t;this.next=r}};function we(e){return[...new Set(["extract-agent","design-agent","owner",...e?[e.id]:[]])]}async function ke(e,n,t,i={}){let r=i.deps??{},a=S(),s=e.sessions().resume(n);try{let c=s.state.checkpoint??null,_=e.sessions().hasBase(n),w=!c&&s.state.agent_state.items.length>0;if(D(s.state,_))throw new m("SESSION_KEPT_NOTHING",`session ${n} kept nothing to resume \u2014 no checkpoint, no base and no agent snapshot; start the run again`);if(!c&&!_||w)throw new m("SESSION_V1",a.text("SESSION_V1",{sid:n}),[h(a,"next.abandon_session",{sid:n},{why:"abandon the pre-checkpoint session, then start a fresh run"})]);!c&&_&&r.onWarn?.(a.text("note.chain_recovered",{sid:n}));let o=e.sessions().loadCheckpoint(n);o.orphans.length>0&&e.sessions().gcOrphans(n,o.orphans),o.fallback&&r.onWarn?.(a.text("note.chain_truncated",{sid:n,at:o.fallback.resumableAt,lost:o.fallback.turnsLost}));let u=o.base;if(i.verb){let l=B(u.verb,i.verb,n);if(l)throw new m("WRONG_VERB",l.message,l.next)}if(i.useCase!==void 0&&i.useCase!==u.use_case&&!await(r.confirmRetarget?.(u.use_case,i.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",u.use_case?`session ${n} was designing ${u.use_case}; resuming onto ${i.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${i.useCase} needs an explicit retarget`,u.use_case?[h(a,"next.resume_session",{verb:"design",sid:n},{why:`continue on ${u.use_case} (the session's own subject)`})]:[]);let g=o.kane,R=[],j=g?.read_basis??Object.fromEntries(Object.entries(s.state.read_basis));for(let[l,d]of Object.entries(j)){let p=t.heads.get(l)??null;p!==d&&R.push({subject:l,pinned:d,live:p})}u.uc_tip!==void 0&&r.liveUcTip!==void 0&&r.liveUcTip!==u.uc_tip&&R.push({subject:u.use_case??"use-case",pinned:u.uc_tip,live:r.liveUcTip}),r.locks?.reacquire?.(n);let v={...u.run_config,checkpoints:!0};delete v.resume;let x;if(o.pointer===null||o.agent===null)x=v;else{if(!o.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);x={...v,resend_open_ask:!0,resume:{schema:2,binding:o.agent.binding,base_fingerprint:o.agent.base_fingerprint,delta_items:o.agent.delta_items,last_seq:o.pointer.seq}}}let C=g?.pending.questions??[],E=l=>{let d=`resolveq:${n}:${l}`,p=`assumed:${n}:${l}`;return t.appliedEvents.has(d)||t.appliedEvents.has(p)||s.isApplied(d)||s.isApplied(p)},H=g&&C.length>0?C.filter(l=>!E(l.id)):s.state.pending.questions.filter(l=>!E(l.id)),A={redeliverReceipts:[],recommit:[]},k,b;if(g){let l={...g,applied_events:[...new Set([...g.applied_events,...s.state.applied_events])].sort()},d=u.verb==="design"&&U(e,l.applied_events,g.awaits)?g.awaits?.event_id:void 0,p;try{p=T(e,n,l,t,{...d?{resent:d}:{},verb:u.verb==="design"?"design":"extract",...u.use_case?{ucRef:u.use_case}:{},...N(String(o.agent?.binding?.template_version??""))>=8?{typedBlockers:!0}:{},...s.state.force_scope?.length?{ignoreGaps:new Set(s.state.force_scope)}:{},composeReceipt:(f,q,L)=>V(f,q,L),onNote:r.onWarn,...r.ownActors?{ownActors:r.ownActors}:{}})}catch(f){throw f instanceof $?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${f.message}`,[h(a,"next.abandon_session",{sid:n},{why:"abandon the session if the store was rebuilt"})]):f}A={redeliverReceipts:p.redeliverReceipts,recommit:p.recommit},b=p.prunedPending;let O=g.pending.proposals??[];k=(O.length>0?O:s.state.pending.proposals).filter(f=>!(typeof f.event_id=="string"&&t.appliedEvents.has(f.event_id))),(p.newlyApplied.length>0||p.prunedPending.length>0)&&s.reconcileSave({appliedEvents:p.newlyApplied,heldReceipts:[...s.state.held_receipts??[],...p.redeliverReceipts],pending:{questions:s.state.pending.questions,proposals:k,...s.state.pending.answers?.length?{answers:s.state.pending.answers}:{}}})}else{let l=s.state.pending.proposals;b=l.filter(d=>typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)),k=l.filter(d=>!(typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)))}return{kind:"v2",handle:s,base:u,view:o,kane:g,spawnConfig:x,drift:R,reconcile:A,questions:H,represent:k,prunedPending:b}}catch(c){throw s.release(),c}}export{B as a,X as b,P as c,Y as d,ce as e,de as f,pe as g,ge as h,fe as i,me as j,U as k,_e as l,he as m,D as n,m as o,we as p,ke as q};
2
+ import{b as V,e as W,f as Q}from"./chunk-3JLEDSG5.js";import{d as I,j as T}from"./chunk-W5EDS4DF.js";import{Ea as $,M as y}from"./chunk-5EAJO372.js";import{d as N}from"./chunk-KU3YHPWZ.js";import{d as h,o as S}from"./chunk-HYJVYYAZ.js";function B(e,n,t){let i=S();return e===void 0||e===n?null:e==="extract"||e==="design"?{code:"WRONG_VERB",message:i.text("WRONG_VERB",{sid:t,verb:e}),next:[h(i,"next.resume_session",{verb:e,sid:t},{why:`this session belongs to a ${e} run`})]}:{code:"WRONG_VERB",message:`error: session ${t} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}function X(e){return P(e)!==null}function P(e){let n=e,t=K(n);if(t<0)return null;let i=n[t].data?.tool_calls??[],r=i.map(o=>o.id),a=n.slice(t+1);if(r.length===0||a.some(o=>o?.kind!=="tool_result"))return null;let s=new Set(a.map(o=>o.data?.tool_call_id));if(!r.every(o=>s.has(o)))return null;let c=a.find(o=>o.data?.status==="ok"&&o.data?.payload?.accepted===!0);if(!c)return null;let _=i.find(o=>o.id===c.data?.tool_call_id),w=_?.arguments;return{name:typeof _?.name=="string"?_.name:"",arguments:w!==null&&typeof w=="object"?w:{}}}function Y(e){let n=e,t=K(n);if(t<0)return!1;let i=n.slice(t+1);if(i.some(s=>s?.kind!=="tool_result"))return!1;let r=new Set(i.map(s=>s.data?.tool_call_id)),a=(n[t].data?.tool_calls??[]).filter(s=>!r.has(s.id));return a.length===1&&a[0].name==="ask_user"}function K(e){for(let n=e.length-1;n>=0;n--)if(e[n]?.kind==="assistant_turn")return n;return-1}function ce(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function G(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,t)=>({id:`o${t}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function de(e,n,t){let i=n.pending.questions.map(G),r=W(e.state.pending.answers).filter(a=>n.pending.questions.some(s=>s.id===a.id&&Q(a,s)));e.save({agent_state:n.agent_state,pending:{questions:i,proposals:n.pending.proposals??[],...r.length>0?{answers:r}:{}},assumed:n.assumed.map(a=>({questionId:a.question_id,optionId:a.option_id,flagged:!0,eventId:`assumed:${n.sid}:${a.question_id}`}))}),t?.(),e.release(),I(e.state.sid)}function pe(e,n,t,i){if(t.name.startsWith("finalize"))return{call:t.name,event_id:`${e}:ckpt:${i}`};let r=t.arguments.ops;return Array.isArray(r)&&r.length>0&&n?{call:t.name,event_prefix:`chatop:${n}:s${i}:`}:null}function ge(e,n,t){if(!t)return!0;let i=y(e).appliedEvents;if(t.event_id!==void 0)return i.has(t.event_id)||n.includes(t.event_id);let r=t.event_prefix??"";for(let a of i)if(a.startsWith(r))return!0;return n.some(a=>a.startsWith(r))}function fe(e){return`the agent's last ${e==="finalize_design"?"design phase was":e.startsWith("finalize")?"proposal was":"changes were"} not saved before the session stopped \u2014 it is sent again`}function me(e){return e===1?"your last message was sent again":`your last ${e} messages were sent again`}function U(e,n,t){return t?.call!=="finalize_design"||t.event_id===void 0?!1:y(e).appliedEvents.has(t.event_id)&&!n.includes(t.event_id)}function _e(){return"the agent's last design phase was saved before the session stopped, but not all of its files \u2014 it is sent again to write them"}function he(e){return{persist(n,t){let i=e.seqBase(),r={seq:n.seq+i,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},a={applied_events:[...new Set([...e.handle.state.applied_events,...e.store.sessions().appliedEvents(e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(G):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:e.store.serialize(e.store.head()),...(()=>{let s=n.at==="turn"&&e.awaits?P(n.delta_items):null,c=s?e.awaits(s,r.seq):null;return c?{awaits:c}:{}})(),...t?.sentUnread?.length?{sent_unread:[...t.sentUnread]}:{},...(()=>{let s=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],c=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...s.length?{ingest_registry:s}:{},...c.length?{ingest_schedule:c}:{}}})()};return e.store.sessions().persistCheckpoint(e.handle,r,a,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}function D(e,n){return!e.checkpoint&&!n&&e.agent_state.items.length===0}var m=class extends Error{constructor(t,i,r=[]){super(`${t}: ${i}`);this.code=t;this.next=r}};function we(e){return[...new Set(["extract-agent","design-agent","owner",...e?[e.id]:[]])]}async function ke(e,n,t,i={}){let r=i.deps??{},a=S(),s=e.sessions().resume(n);try{let c=s.state.checkpoint??null,_=e.sessions().hasBase(n),w=!c&&s.state.agent_state.items.length>0;if(D(s.state,_))throw new m("SESSION_KEPT_NOTHING",`session ${n} kept nothing to resume \u2014 no checkpoint, no base and no agent snapshot; start the run again`);if(!c&&!_||w)throw new m("SESSION_V1",a.text("SESSION_V1",{sid:n}),[h(a,"next.abandon_session",{sid:n},{why:"abandon the pre-checkpoint session, then start a fresh run"})]);!c&&_&&r.onWarn?.(a.text("note.chain_recovered",{sid:n}));let o=e.sessions().loadCheckpoint(n);o.orphans.length>0&&e.sessions().gcOrphans(n,o.orphans),o.fallback&&r.onWarn?.(a.text("note.chain_truncated",{sid:n,at:o.fallback.resumableAt,lost:o.fallback.turnsLost}));let u=o.base;if(i.verb){let l=B(u.verb,i.verb,n);if(l)throw new m("WRONG_VERB",l.message,l.next)}if(i.useCase!==void 0&&i.useCase!==u.use_case&&!await(r.confirmRetarget?.(u.use_case,i.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",u.use_case?`session ${n} was designing ${u.use_case}; resuming onto ${i.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${i.useCase} needs an explicit retarget`,u.use_case?[h(a,"next.resume_session",{verb:"design",sid:n},{why:`continue on ${u.use_case} (the session's own subject)`})]:[]);let g=o.kane,R=[],j=g?.read_basis??Object.fromEntries(Object.entries(s.state.read_basis));for(let[l,d]of Object.entries(j)){let p=t.heads.get(l)??null;p!==d&&R.push({subject:l,pinned:d,live:p})}u.uc_tip!==void 0&&r.liveUcTip!==void 0&&r.liveUcTip!==u.uc_tip&&R.push({subject:u.use_case??"use-case",pinned:u.uc_tip,live:r.liveUcTip}),r.locks?.reacquire?.(n);let v={...u.run_config,checkpoints:!0};delete v.resume;let x;if(o.pointer===null||o.agent===null)x=v;else{if(!o.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);x={...v,resend_open_ask:!0,resume:{schema:2,binding:o.agent.binding,base_fingerprint:o.agent.base_fingerprint,delta_items:o.agent.delta_items,last_seq:o.pointer.seq}}}let C=g?.pending.questions??[],E=l=>{let d=`resolveq:${n}:${l}`,p=`assumed:${n}:${l}`;return t.appliedEvents.has(d)||t.appliedEvents.has(p)||s.isApplied(d)||s.isApplied(p)},H=g&&C.length>0?C.filter(l=>!E(l.id)):s.state.pending.questions.filter(l=>!E(l.id)),A={redeliverReceipts:[],recommit:[]},k,b;if(g){let l={...g,applied_events:[...new Set([...g.applied_events,...s.state.applied_events])].sort()},d=u.verb==="design"&&U(e,l.applied_events,g.awaits)?g.awaits?.event_id:void 0,p;try{p=T(e,n,l,t,{...d?{resent:d}:{},verb:u.verb==="design"?"design":"extract",...u.use_case?{ucRef:u.use_case}:{},...N(String(o.agent?.binding?.template_version??""))>=8?{typedBlockers:!0}:{},...s.state.force_scope?.length?{ignoreGaps:new Set(s.state.force_scope)}:{},composeReceipt:(f,q,L)=>V(f,q,L),onNote:r.onWarn,...r.ownActors?{ownActors:r.ownActors}:{}})}catch(f){throw f instanceof $?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${f.message}`,[h(a,"next.abandon_session",{sid:n},{why:"abandon the session if the store was rebuilt"})]):f}A={redeliverReceipts:p.redeliverReceipts,recommit:p.recommit},b=p.prunedPending;let O=g.pending.proposals??[];k=(O.length>0?O:s.state.pending.proposals).filter(f=>!(typeof f.event_id=="string"&&t.appliedEvents.has(f.event_id))),(p.newlyApplied.length>0||p.prunedPending.length>0)&&s.reconcileSave({appliedEvents:p.newlyApplied,heldReceipts:[...s.state.held_receipts??[],...p.redeliverReceipts],pending:{questions:s.state.pending.questions,proposals:k,...s.state.pending.answers?.length?{answers:s.state.pending.answers}:{}}})}else{let l=s.state.pending.proposals;b=l.filter(d=>typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)),k=l.filter(d=>!(typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)))}return{kind:"v2",handle:s,base:u,view:o,kane:g,spawnConfig:x,drift:R,reconcile:A,questions:H,represent:k,prunedPending:b}}catch(c){throw s.release(),c}}export{B as a,X as b,P as c,Y as d,ce as e,de as f,pe as g,ge as h,fe as i,me as j,U as k,_e as l,he as m,D as n,m as o,we as p,ke as q};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as y,d as C}from"./chunk-32HED7X2.js";import{h as P,i as k}from"./chunk-ZDCXWEQG.js";import{h as R,i as b,j as h,k as S}from"./chunk-L3BUPFAQ.js";import{n as w,o as I,p as x}from"./chunk-Z24SD2EJ.js";import{Ia as _,M as f}from"./chunk-PI7OXS62.js";import{basename as U}from"path";function E(n){return n?.outcome==="added"?"added .context/ to .gitignore":n?.outcome==="failed"?`warning: could not add .context/ to .gitignore: ${n.reason}`:null}var L=/^[a-z][a-z0-9+.-]*:\/\//i;function j(n){let c=`${n} isn't a file or a web address, so nothing was added`,e=n.slice(n.indexOf(":")+1),g=n.slice(0,n.indexOf(":")).toLowerCase();return g==="jira"?{message:c,remedy:`for a Jira issue, add its address, for example:
2
+ import{a as y,d as C}from"./chunk-6KUUSONE.js";import{h as P,i as k}from"./chunk-GRQKMOKE.js";import{h as R,i as b,j as h,k as S}from"./chunk-3CFAE36M.js";import{n as w,o as I,p as x}from"./chunk-C3DMMAFP.js";import{Ia as _,M as f}from"./chunk-5EAJO372.js";import{basename as U}from"path";function E(n){return n?.outcome==="added"?"added .context/ to .gitignore":n?.outcome==="failed"?`warning: could not add .context/ to .gitignore: ${n.reason}`:null}var L=/^[a-z][a-z0-9+.-]*:\/\//i;function j(n){let c=`${n} isn't a file or a web address, so nothing was added`,e=n.slice(n.indexOf(":")+1),g=n.slice(0,n.indexOf(":")).toLowerCase();return g==="jira"?{message:c,remedy:`for a Jira issue, add its address, for example:
3
3
  kane-cli context ingest https://<your site>/browse/${e}`}:g==="confluence"?{message:c,remedy:`for a Confluence page, add its address, for example:
4
4
  kane-cli context ingest https://<your site>/wiki/spaces/<space>/pages/${e}`}:g==="linear"?{message:c,remedy:`for a Linear issue, add its address, for example:
5
5
  kane-cli context ingest https://linear.app/<workspace>/issue/${e}`}:{message:c,remedy:"add a file, or the item's full web address, then run the command again"}}async function z(n){let{refs:c,io:e,converters:g}=n,l=n.opts??{},d=[];if(l.as!==void 0&&c.length>1)return(e.err??e.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${c.length})`,"AS_SINGLE_SOURCE"),{code:2,results:d};let $=n.plugins??P(),v=n.connections??k();for(let r of c){let a=$.route(r,y);if(a===null&&!h(r)&&L.test(r)&&!y(r)){let o=j(r);return(e.err??e.out)(`error: ${o.message} \u2014 ${o.remedy}`,"UNSUPPORTED_URL"),{code:2,results:d}}if(a===null&&h(r)){let o=S(r);if(o===null)return(e.err??e.out)(`error: ${r}: unsupported remote URL \u2014 supported: ${b.map(s=>s.hint).join("; ")}`,"UNSUPPORTED_URL"),{code:1,results:d};let i=await o.ingest(r,l.as,e,n.store,{credentials:n.credentials,...n.remoteDeps});if(i.code!==0)return{code:i.code,results:d};if(i.result){let s=E(i.result.gitignore);s&&e.out(s),d.push({status:i.result.status==="versioned"?"versioned":i.result.status==="unchanged"?"unchanged":"created",source_id:i.result.source_id,source_cid:i.result.source_cid,...i.result.gitignore?{gitignore:i.result.gitignore}:{}})}continue}let u=l.as,m;if(a===null&&u===void 0&&n.store.exists()){let o=w(r),i=I(o);if(i){let s=f(n.store);if(s.heads.get(i)!=null&&s.heads.get(o)==null){m=i;let T=`${o} looks like a new version of existing source '${i}' \u2014 ingest as '${i}' (replaces the current version; items built on it go stale)?`;e.isTTY&&await e.confirm(T)&&(u=i)}}}let t;try{let o=e.isTTY?i=>e.confirm(`identical bytes already ingested as ${i} \u2014 treat as the same source?`):void 0;t=a!==null?await C({store:n.store,plugin:a.plugin,ref:a.ref,named:a.named,registry:$,...u!==void 0?{asId:u}:{},...o?{confirmSameSource:o}:{},...v?{connect:v}:{}}):await x({store:n.store,filePath:r,asId:u,confirmSameSource:o,converters:g})}catch(o){let i=o instanceof Error?o.message:String(o);return o instanceof _?((e.err??e.out)(`error: ${i}`,o.code),(e.err??e.out)(`next: ${o.remedy}`,o.code),{code:2,results:d}):(n.onRefusal?.(r,i),(e.err??e.out)(`error: ${r}: ${i}`,"INGEST_FAILED"),{code:1,results:d})}e.out(R(e.isTTY,t,U(r)));for(let o of t.warnings??[])e.out(`warning: ${o}`);let O=E(t.gitignore);if(O&&e.out(O),t.composite&&(t.composite.delivered>0||t.composite.omitted>0)){let o=t.composite.pages!==void 0?` ${t.composite.pages} pages,`:"";e.out(`${t.source_id}: ${t.composite.kind},${o} ${t.composite.delivered} images delivered (${t.composite.omitted} omitted)`)}let p;if(!e.isTTY&&t.status==="created"){let o=f(n.store);for(let[i,s]of o.heads.entries())if(!(i===t.source_id||s==null)&&o.getNode(s)?.content.blob===t.blob){p=i,e.out(`hint: identical bytes already ingested as ${i} \u2014 merged later via review`);break}}d.push({status:t.status,source_id:t.source_id,source_cid:t.cid,...t.warnings?.length?{warnings:t.warnings}:{},...t.composite?{media:{kind:t.composite.kind,...t.composite.pages!==void 0?{pages:t.composite.pages}:{},delivered:t.composite.delivered,omitted:t.composite.omitted}}:{},...p?{duplicate_of:p}:{},...m&&u===void 0?{lineage_candidate:m}:{},...t.gitignore?{gitignore:t.gitignore}:{}})}return{code:0,results:d}}export{z as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as k}from"./chunk-VZ7KXRXB.js";import{d as R,f as b,g as $,h as y,r as O,s as S,u as v,v as x}from"./chunk-A7RJQJNT.js";import{dirname as B,isAbsolute as D,resolve as G}from"path";var L=["db","api","js","smartui","network_query","network_assertion","gps","accessibility","media_injection","network_throttle","deeplink"];var a=class extends Error{constructor(r,o,e){super(`[${o}${e!=null?`:${e}`:""}] ${r}`);this.file=o;this.line=e;this.name="TestMdParseError"}};var E=["if","elif","else","end-if","while","end-while"];var M={"end-if":"if","end-while":"while"};function A(n,t){let r=[],o=()=>r[r.length-1];for(let i of t){let s=i.controlFlow;if(s==="if"||s==="while"){r.push({kind:s,id:i.index,branch:0,elseSeen:!1}),i.block={id:i.index,branch:0,depth:r.length};continue}if(s==="elif"||s==="else"){let l=o();if(!l||l.kind!=="if")throw new a(`@${s} outside an open @if`,n,i.headingLine);if(l.elseSeen)throw new a(`@${s} after @else`,n,i.headingLine);l.branch+=1,l.elseSeen=s==="else",i.block={id:l.id,branch:l.branch,depth:r.length};continue}if(s==="end-if"||s==="end-while"){let l=o(),d=M[s];if(!l||l.kind!==d)throw new a(`@${s} without an open @${d}`,n,i.headingLine);i.block={id:l.id,branch:-1,depth:r.length},r.pop();continue}let c=o();c&&(i.block={id:c.id,branch:c.branch,depth:r.length})}let e=o();if(e){let i=t.find(s=>s.index===e.id);throw new a(`unclosed @${e.kind} block`,n,i?.headingLine)}}var I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),T=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name","on_lock_conflict","tags","assurance","dataset"]),C=new Set(["optional"]),V=new Set(["optional","variables"]),W=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),H=new Set(["app","no_reset","os_version","device_name"]),q=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function xe(n,t){let r=t.split(`
2
+ import{b as k}from"./chunk-VZ7KXRXB.js";import{d as R,f as b,g as $,h as y,r as O,s as S,u as v,v as x}from"./chunk-A7RJQJNT.js";import{dirname as B,isAbsolute as D,resolve as G}from"path";var L=["db","api","js","smartui","network_query","network_assertion","gps","accessibility","media_injection","network_throttle","deeplink","manual"];var a=class extends Error{constructor(r,o,e){super(`[${o}${e!=null?`:${e}`:""}] ${r}`);this.file=o;this.line=e;this.name="TestMdParseError"}};var E=["if","elif","else","end-if","while","end-while"];var M={"end-if":"if","end-while":"while"};function A(n,t){let r=[],o=()=>r[r.length-1];for(let i of t){let s=i.controlFlow;if(s==="if"||s==="while"){r.push({kind:s,id:i.index,branch:0,elseSeen:!1}),i.block={id:i.index,branch:0,depth:r.length};continue}if(s==="elif"||s==="else"){let l=o();if(!l||l.kind!=="if")throw new a(`@${s} outside an open @if`,n,i.headingLine);if(l.elseSeen)throw new a(`@${s} after @else`,n,i.headingLine);l.branch+=1,l.elseSeen=s==="else",i.block={id:l.id,branch:l.branch,depth:r.length};continue}if(s==="end-if"||s==="end-while"){let l=o(),d=M[s];if(!l||l.kind!==d)throw new a(`@${s} without an open @${d}`,n,i.headingLine);i.block={id:l.id,branch:-1,depth:r.length},r.pop();continue}let c=o();c&&(i.block={id:c.id,branch:c.branch,depth:r.length})}let e=o();if(e){let i=t.find(s=>s.index===e.id);throw new a(`unclosed @${e.kind} block`,n,i?.headingLine)}}var I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),T=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name","on_lock_conflict","tags","assurance","dataset"]),C=new Set(["optional"]),V=new Set(["optional","variables"]),W=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),H=new Set(["app","no_reset","os_version","device_name"]),q=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function xe(n,t){let r=t.split(`
3
3
  `),{global:o,bodyStartLine:e}=z(n,r),{title:i,steps:s}=ce(n,r,e);return{path:n,title:i,global:o,steps:s}}function z(n,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let r=-1;for(let l=1;l<t.length;l++)if(t[l].trim()==="---"){r=l;break}if(r===-1)throw new a("frontmatter is missing closing '---'",n,1);let o=t.slice(1,r).join(`
4
4
  `),e;try{e=k(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(P(n,e,"frontmatter",1),e.on_lock_conflict!==void 0){let l=e.on_lock_conflict;if(l!=="readonly"&&l!=="fail"&&l!=="wait")throw new a(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(l)}`,n,1)}if(j(n,e,1),pe(n,e,1),e.assurance!==void 0){let l=e.assurance;if(l===null||typeof l!="object"||Array.isArray(l))throw new a("assurance must be a mapping with sub-keys {id, base}",n,1);let d=l;for(let u of Object.keys(d))if(u!=="id"&&u!=="base")throw new a(`unknown assurance sub-key '${u}' \u2014 the engine block allows only {id, base}`,n,1);if(typeof d.id!="string"||d.id.length===0)throw new a("assurance.id must be a non-empty string (logical id)",n,1);if(d.base!==void 0&&!(typeof d.base=="string"&&/^sha256:[0-9a-f]+$/.test(d.base)))throw new a("assurance.base must be a 'sha256:<hex>' string",n,1)}if(e.tags!==void 0){let l=e.tags,d=Array.isArray(l)?l.map(u=>String(u)).join(","):String(l);e.tags=J(d,n,1)}if(e.target!==void 0&&(e.target=Q(e.target,n,1)),e.app!==void 0&&(e.app=X(e.app,n,1,e.target)),e.no_reset!==void 0&&typeof e.no_reset!="boolean")throw new a(`no_reset must be boolean: got ${typeof e.no_reset}`,n,1);if(e.os_version!==void 0&&typeof e.os_version!="string")if(typeof e.os_version=="number")e.os_version=String(e.os_version);else throw new a(`os_version must be a string: got ${typeof e.os_version}`,n,1);let i=e.target,s=b(i),c=R(i);if(s&&e.no_reset!==void 0)throw new a(`no_reset is not supported with target: ${i} \u2014 a real-device session always starts with a fresh install of the app. Remove no_reset from the file.`,n,1);if(!c&&e.app!==void 0)throw new a("app is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove app from this web test",n,1);if(!c&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!c&&e.os_version!==void 0)throw new a("os_version is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove os_version from this web test",n,1);if(e.device_name!==void 0&&typeof e.device_name!="string")throw new a(`device_name must be a string: got ${typeof e.device_name}`,n,1);if(!c&&e.device_name!==void 0)throw new a("device_name is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove device_name from this web test",n,1);return{global:e,bodyStartLine:r+1}}function J(n,t,r){let e=n.trim().replace(/^\[/,"").replace(/\]$/,"").split(",").map(i=>i.trim().toLowerCase());if(e.length===0||e.some(i=>i.length===0))throw new a("tags must be a non-empty list of non-empty strings",t,r);return[...new Set(e)]}var U=new Set(["chrome","cdp","ws","emulator","simulator","android","ios"]),Z="target must be one of 'chrome' | 'cdp' | 'ws' (web), 'emulator' | 'simulator' (mobile; the app in a root `app:` key, or given to the run) or 'android' | 'ios' (a real device)";function Q(n,t,r){if(typeof n=="string"&&U.has(n))return n;throw n!==null&&typeof n=="object"&&!Array.isArray(n)?new a(`the mapping form of target is no longer accepted \u2014 write flat keys:
5
5
  target: emulator | simulator
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as g}from"./chunk-ZMWTRXFH.js";import{g as d}from"./chunk-MINDIQET.js";import{a as c}from"./chunk-3KY7HHQU.js";var p=["grounding","acs","scenarios","wiring","tests"];function P(i){let t=p.filter(e=>e!=="grounding"),n=0;for(let e of i)n=Math.max(n,t.indexOf(e)+1);return n}var x={acs:"acceptance criteria",scenarios:"scenarios",wiring:"acceptance criteria + exercises",tests:"tests + gaps"};function l(i,t,n){let e=t.resolve(n);if(e===null)return[];let s=c(t,e.cid),a=d(i.recordsSince(null),s),r=a.reduce((o,m)=>Math.max(o,m.generation),0);return a.filter(o=>o.generation===r)}function S(i,t,n,e){let s=p;if(!s.includes(e))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${s.join(" | ")}, got '${e}'`,valid:[...s]};let a=new Set(l(i,t,n).map(o=>o.phase)),r=s.slice(0,s.indexOf(e)).filter(o=>o!=="grounding"&&!a.has(o));return r.length===0?{ok:!0,phase:e}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${e} needs ${r.join(" + ")} committed first (nothing recorded for ${r.join(", ")})`,missing:r,earliest:r[0]}}function E(i,t,n,e){let s=l(i,t,n),a=t.resolve(n);if(a===null)return{priorDesign:void 0,phaseLadder:s};let r=g(t,a.tip);return{priorDesign:r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0?void 0:r,phaseLadder:s}}export{p as a,P as b,x as c,l as d,S as e,E as f};
2
+ import{b as g}from"./chunk-4DRFMDAW.js";import{g as d}from"./chunk-HBGYEA3O.js";import{a as c}from"./chunk-JSSM2TWY.js";var p=["grounding","acs","scenarios","wiring","tests"];function P(i){let t=p.filter(e=>e!=="grounding"),n=0;for(let e of i)n=Math.max(n,t.indexOf(e)+1);return n}var x={acs:"acceptance criteria",scenarios:"scenarios",wiring:"acceptance criteria + exercises",tests:"tests + gaps"};function l(i,t,n){let e=t.resolve(n);if(e===null)return[];let s=c(t,e.cid),a=d(i.recordsSince(null),s),r=a.reduce((o,m)=>Math.max(o,m.generation),0);return a.filter(o=>o.generation===r)}function S(i,t,n,e){let s=p;if(!s.includes(e))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${s.join(" | ")}, got '${e}'`,valid:[...s]};let a=new Set(l(i,t,n).map(o=>o.phase)),r=s.slice(0,s.indexOf(e)).filter(o=>o!=="grounding"&&!a.has(o));return r.length===0?{ok:!0,phase:e}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${e} needs ${r.join(" + ")} committed first (nothing recorded for ${r.join(", ")})`,missing:r,earliest:r[0]}}function E(i,t,n,e){let s=l(i,t,n),a=t.resolve(n);if(a===null)return{priorDesign:void 0,phaseLadder:s};let r=g(t,a.tip);return{priorDesign:r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0?void 0:r,phaseLadder:s}}export{p as a,P as b,x as c,l as d,S as e,E as f};