@testmuai/kane-cli 0.10.0 → 0.10.3

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 (405) hide show
  1. package/dist/ChatSurface-Z26BOE5U.js +2 -0
  2. package/dist/{ChromeProfilePicker-FWPUDKD6.js → ChromeProfilePicker-ODRIAXL3.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-D5L2DO6A.js → CliFeedbackPrompt-JWCTMIGI.js} +1 -1
  4. package/dist/{CliUploadProgress-HQX57WE6.js → CliUploadProgress-XFRRFRL4.js} +1 -1
  5. package/dist/{ConfigView-DGQXKEON.js → ConfigView-6JF4DOJN.js} +1 -1
  6. package/dist/EvidenceViewOffer-6344EX74.js +2 -0
  7. package/dist/FolderPicker-4PCYHE75.js +2 -0
  8. package/dist/InfoBox-NJ2DL7YC.js +2 -0
  9. package/dist/{LinksBox-WZ4RAMSH.js → LinksBox-HNDNFVUT.js} +1 -1
  10. package/dist/{ProfilesView-AGRNPGSW.js → ProfilesView-DEJKJOHY.js} +1 -1
  11. package/dist/ProjectPicker-DTWMWOH7.js +2 -0
  12. package/dist/SaveSessionPrompt-3GCLB3ZT.js +2 -0
  13. package/dist/SingleShotApp-HMOXO5DW.js +2 -0
  14. package/dist/{SummaryBox-XQJUZBAN.js → SummaryBox-7PPDMSSM.js} +1 -1
  15. package/dist/TestMdRunView-QLKRUU4V.js +2 -0
  16. package/dist/TestrunEvidenceTable-T2JUB4TE.js +2 -0
  17. package/dist/{WhoamiView-JQCURK2M.js → WhoamiView-H7JNLLCY.js} +1 -1
  18. package/dist/{app-download-OU6AGH2X.js → app-download-GKRF2EIM.js} +1 -1
  19. package/dist/{assurance-job-ZI3L6I4F.js → assurance-job-F4L3T4VJ.js} +1 -1
  20. package/dist/{auth-7Z54TMQQ.js → auth-WBIEHHDS.js} +1 -1
  21. package/dist/{binary-S5YL5GJD.js → binary-K3XMILST.js} +1 -1
  22. package/dist/{bind-LIV72SEZ.js → bind-SSHAZAB3.js} +1 -1
  23. package/dist/{bootstrap-3V6TOO6I.js → bootstrap-XGKU4WXB.js} +1 -1
  24. package/dist/bridge-2UHJOVLX.js +2 -0
  25. package/dist/{catalog-I3PC6LT6.js → catalog-YCU6OHNV.js} +1 -1
  26. package/dist/{catalog-client-WKYG3JN6.js → catalog-client-MVEEHTG2.js} +1 -1
  27. package/dist/{changelog-IHNWFYWY.js → changelog-5UB3AQT6.js} +1 -1
  28. package/dist/chat-committer-ZKEKJA2R.js +2 -0
  29. package/dist/chat-controller-FXRJXUG3.js +2 -0
  30. package/dist/child-JHYENXE7.js +2 -0
  31. package/dist/{chunk-ZTAZ2R5Z.js → chunk-23DKB2MT.js} +1 -1
  32. package/dist/{chunk-UX2CDUPE.js → chunk-2JFRN62I.js} +2 -2
  33. package/dist/chunk-2RBMQTYS.js +26 -0
  34. package/dist/{chunk-VVCZRCRD.js → chunk-2TK4MDF2.js} +1 -1
  35. package/dist/{chunk-G3J4XY3Z.js → chunk-32HED7X2.js} +1 -1
  36. package/dist/{chunk-GRURFGBP.js → chunk-32MFECUA.js} +1 -1
  37. package/dist/{chunk-N3KTLWJL.js → chunk-35BG2EMW.js} +1 -1
  38. package/dist/{chunk-4523YDTG.js → chunk-35WUYKGO.js} +1 -1
  39. package/dist/{chunk-KDR662D2.js → chunk-3KY7HHQU.js} +1 -1
  40. package/dist/{chunk-UNWPBMVM.js → chunk-3MD2XLE7.js} +2 -2
  41. package/dist/{chunk-YKL5H4K6.js → chunk-3NWUXRSI.js} +1 -1
  42. package/dist/{chunk-QQI6N3FO.js → chunk-3RO2YGKH.js} +1 -1
  43. package/dist/{chunk-AGXAJ2II.js → chunk-3ZC7GSMM.js} +1 -1
  44. package/dist/{chunk-I2MC6VVX.js → chunk-4C7WVQOD.js} +1 -1
  45. package/dist/{chunk-VQZOKTJ2.js → chunk-4CJQ7XZP.js} +1 -1
  46. package/dist/{chunk-7KX2BHKG.js → chunk-4KCYNP2K.js} +1 -1
  47. package/dist/{chunk-AUBSLPJZ.js → chunk-4KL3TSTT.js} +5 -5
  48. package/dist/{chunk-AG5XJWEV.js → chunk-4UX5N7YI.js} +1 -1
  49. package/dist/{chunk-WERIGVOH.js → chunk-5F5IVART.js} +1 -1
  50. package/dist/{chunk-RFEON5GN.js → chunk-5XVWT6UK.js} +1 -1
  51. package/dist/{chunk-FBQ7PQJV.js → chunk-5YYCCM6K.js} +1 -1
  52. package/dist/{chunk-SBR6D6GS.js → chunk-6FFX4S7N.js} +1 -1
  53. package/dist/{chunk-DHYGCHKB.js → chunk-6HRNG4CK.js} +1 -1
  54. package/dist/{chunk-HBVHIEPB.js → chunk-6QCCTZO3.js} +1 -1
  55. package/dist/{chunk-GI2JPIX5.js → chunk-6QH75BPJ.js} +1 -1
  56. package/dist/{chunk-5R3ODQHH.js → chunk-6SD4XTYC.js} +1 -1
  57. package/dist/{chunk-J4LQAT5P.js → chunk-7LYLJ75Z.js} +1 -1
  58. package/dist/{chunk-Y3YULFCK.js → chunk-7RELCXRW.js} +1 -1
  59. package/dist/{chunk-GXMD23XB.js → chunk-7SU53QGU.js} +1 -1
  60. package/dist/{chunk-DTYT6KBO.js → chunk-7Y55CO42.js} +1 -1
  61. package/dist/{chunk-2L3A5NKZ.js → chunk-7YV2FCN4.js} +1 -1
  62. package/dist/{chunk-ULGBK4NS.js → chunk-A2DODRHG.js} +1 -1
  63. package/dist/{chunk-EVZLINBN.js → chunk-AHT2ORJT.js} +1 -1
  64. package/dist/{chunk-RDH3E25Q.js → chunk-AT7AT3AR.js} +2 -2
  65. package/dist/{chunk-ZI3X7DI2.js → chunk-AVLYSNEG.js} +1 -1
  66. package/dist/{chunk-GET4DINR.js → chunk-BBJAKSA7.js} +1 -1
  67. package/dist/{chunk-CBVHP7JB.js → chunk-BJO6J5X2.js} +1 -1
  68. package/dist/{chunk-G3CYFCSR.js → chunk-BLVDV3QQ.js} +1 -1
  69. package/dist/{chunk-2N75WO7Y.js → chunk-C4KAPGBS.js} +1 -1
  70. package/dist/{chunk-XLQ4F6BI.js → chunk-CB2BWDHG.js} +2 -2
  71. package/dist/chunk-CB344EDO.js +2 -0
  72. package/dist/chunk-CCOD4GQJ.js +2 -0
  73. package/dist/{chunk-JSLKCCD2.js → chunk-CNHKZE4F.js} +1 -1
  74. package/dist/{chunk-CJE7PKRV.js → chunk-CQDCNP7V.js} +1 -1
  75. package/dist/{chunk-3OVFKUXV.js → chunk-CTHUX7O4.js} +1 -1
  76. package/dist/{chunk-4JWJH6TB.js → chunk-DC5F2ADJ.js} +1 -1
  77. package/dist/chunk-DIOK3SER.js +34 -0
  78. package/dist/{chunk-EQWMOGLO.js → chunk-DQXQJJOP.js} +2 -2
  79. package/dist/{chunk-EH43VWVR.js → chunk-DXIQVBMI.js} +1 -1
  80. package/dist/{chunk-WZLDFEWR.js → chunk-E4GIGM5V.js} +1 -1
  81. package/dist/{chunk-K3OSK6PB.js → chunk-EBJW6POT.js} +1 -1
  82. package/dist/{chunk-MYZHOBS4.js → chunk-EHB55V23.js} +1 -1
  83. package/dist/{chunk-RARD6TC6.js → chunk-EJGCIGQY.js} +1 -1
  84. package/dist/{chunk-OR2B6T3B.js → chunk-ENRFXGID.js} +1 -1
  85. package/dist/{chunk-3ZPEQDXZ.js → chunk-ERRIDBE7.js} +1 -1
  86. package/dist/{chunk-HGVM2OZU.js → chunk-EZMRWXRT.js} +1 -1
  87. package/dist/chunk-F2F257PU.js +6 -0
  88. package/dist/{chunk-AUJSC7PU.js → chunk-FNUGDPTS.js} +1 -1
  89. package/dist/{chunk-MPEIMWQI.js → chunk-FOLUB336.js} +1 -1
  90. package/dist/{chunk-HHW6MRU3.js → chunk-G4K3TP2I.js} +1 -1
  91. package/dist/{chunk-P2ZQDQDB.js → chunk-GAKBHNC4.js} +1 -1
  92. package/dist/{chunk-DPGOAFKF.js → chunk-GBQ4K25P.js} +1 -1
  93. package/dist/{chunk-PCDIEYV6.js → chunk-GEZVC4S3.js} +1 -1
  94. package/dist/{chunk-PL3SG3M2.js → chunk-GJXO6FF7.js} +1 -1
  95. package/dist/{chunk-252GEI3H.js → chunk-GLM5UGTF.js} +1 -1
  96. package/dist/{chunk-JOCEZK2M.js → chunk-GQAWZEA4.js} +1 -1
  97. package/dist/{chunk-45URQUAK.js → chunk-GXQYFOBD.js} +1 -1
  98. package/dist/{chunk-PBWYQR5I.js → chunk-HBLHKQR7.js} +1 -1
  99. package/dist/chunk-HC6VLPUB.js +5 -0
  100. package/dist/{chunk-K2PLULJD.js → chunk-HRIDAK6Y.js} +1 -1
  101. package/dist/{chunk-D6CS62O7.js → chunk-HV2CDY4K.js} +1 -1
  102. package/dist/{chunk-P2LDAW3C.js → chunk-HVOXMCKE.js} +1 -1
  103. package/dist/{chunk-4I7YN6YY.js → chunk-HYJVYYAZ.js} +2 -2
  104. package/dist/{chunk-GYDJO32R.js → chunk-IEHJG6J4.js} +1 -1
  105. package/dist/{chunk-GGS3ATPB.js → chunk-IZ66FKPC.js} +1 -1
  106. package/dist/{chunk-QMOGBKJM.js → chunk-J4FIESTB.js} +1 -1
  107. package/dist/{chunk-436FZ4KG.js → chunk-JBKHX5ES.js} +1 -1
  108. package/dist/{chunk-EX6ORR7P.js → chunk-JNPFEBUR.js} +1 -1
  109. package/dist/{chunk-AU26ZZTX.js → chunk-JTNEF5ZP.js} +1 -1
  110. package/dist/{chunk-5IO5ZC4S.js → chunk-KBGMQYMD.js} +1 -1
  111. package/dist/{chunk-WX4VGH5Q.js → chunk-KCXLRR3Q.js} +1 -1
  112. package/dist/{chunk-4R4YUOVY.js → chunk-KKLCXRW6.js} +1 -1
  113. package/dist/{chunk-YGMQXS2J.js → chunk-KL7XFNSD.js} +1 -1
  114. package/dist/{chunk-MJKRJGER.js → chunk-KQ4XKTIZ.js} +1 -1
  115. package/dist/{chunk-I2VU2DTS.js → chunk-L3BUPFAQ.js} +4 -4
  116. package/dist/{chunk-ZZNQIFFI.js → chunk-LHJSIHLC.js} +1 -1
  117. package/dist/{chunk-2GE5X2A5.js → chunk-LLQWEGXD.js} +1 -1
  118. package/dist/{chunk-PQXYHI5W.js → chunk-LPJKNX6D.js} +1 -1
  119. package/dist/{chunk-ZGQM6KWN.js → chunk-LRNUGKYH.js} +1 -1
  120. package/dist/chunk-LTPOMMAB.js +2 -0
  121. package/dist/{chunk-MHB6DMKZ.js → chunk-LUA25RYS.js} +1 -1
  122. package/dist/{chunk-2PZKMT3I.js → chunk-LV7224DG.js} +1 -1
  123. package/dist/{chunk-X3J4CC27.js → chunk-LXK4B2FE.js} +1 -1
  124. package/dist/{chunk-YH4VZVHJ.js → chunk-LZGAFKYH.js} +1 -1
  125. package/dist/{chunk-3QICDXY5.js → chunk-LZPYIFHZ.js} +1 -1
  126. package/dist/{chunk-4BUEOKFV.js → chunk-M2E5CPPV.js} +1 -1
  127. package/dist/{chunk-65BG6GAE.js → chunk-M7A66MSK.js} +1 -1
  128. package/dist/{chunk-JX5NVKTV.js → chunk-MD3RABID.js} +1 -1
  129. package/dist/{chunk-QECTIQAC.js → chunk-MEBEVHGP.js} +1 -1
  130. package/dist/{chunk-52VCA4K2.js → chunk-MEMXFTLD.js} +1 -1
  131. package/dist/{chunk-U7NRZBB5.js → chunk-MINDIQET.js} +1 -1
  132. package/dist/{chunk-HJLMH7ZM.js → chunk-MUX2A37P.js} +1 -1
  133. package/dist/{chunk-YKOEABP2.js → chunk-N7IWR45S.js} +1 -1
  134. package/dist/{chunk-WQR2GYP7.js → chunk-ND6OP3O2.js} +1 -1
  135. package/dist/{chunk-URAYFJGM.js → chunk-NHGPMYM3.js} +1 -1
  136. package/dist/{chunk-ZKPY3AXW.js → chunk-NI3TIAD7.js} +1 -1
  137. package/dist/{chunk-JCSVBD4F.js → chunk-NPAUSUNM.js} +1 -1
  138. package/dist/{chunk-XMALVGH7.js → chunk-NRAPCFI2.js} +2 -2
  139. package/dist/{chunk-567D5ZTO.js → chunk-NZJSGINB.js} +16 -16
  140. package/dist/{chunk-A4BB6GLN.js → chunk-OBNVGD5H.js} +1 -1
  141. package/dist/{chunk-BRVIK3BU.js → chunk-OCMPWCKQ.js} +1 -1
  142. package/dist/{chunk-4SJAOAYY.js → chunk-OCVDMZWB.js} +1 -1
  143. package/dist/{chunk-JRSEAXFE.js → chunk-OHGL4GEJ.js} +1 -1
  144. package/dist/{chunk-YYVBE6W2.js → chunk-OOGKX4Y6.js} +1 -1
  145. package/dist/{chunk-QWZJ5QDO.js → chunk-OTMHCHH6.js} +2 -2
  146. package/dist/{chunk-Z5BFCTHI.js → chunk-OZNYQONA.js} +2 -2
  147. package/dist/{chunk-EPJ5SJL2.js → chunk-PB6RXDWQ.js} +2 -2
  148. package/dist/{chunk-TZVPDGJD.js → chunk-PCQK62MP.js} +1 -1
  149. package/dist/{chunk-Z777GGHB.js → chunk-PI7OXS62.js} +1 -1
  150. package/dist/{chunk-MW2WNYJO.js → chunk-PRBWZXFA.js} +2 -2
  151. package/dist/{chunk-2SY2NCOP.js → chunk-PTLOOVV4.js} +1 -1
  152. package/dist/{chunk-EC5IP5HZ.js → chunk-Q4ALB7SH.js} +1 -1
  153. package/dist/{chunk-FYCD765R.js → chunk-Q4JV4U65.js} +58 -58
  154. package/dist/{chunk-CJQUVHHS.js → chunk-Q4SMITTV.js} +1 -1
  155. package/dist/{chunk-NJCN6LP5.js → chunk-QE4AWNOV.js} +6 -6
  156. package/dist/{chunk-BY2B4YJN.js → chunk-QEM5ZRDN.js} +1 -1
  157. package/dist/{chunk-VA3BSIUQ.js → chunk-QHH42RH5.js} +1 -1
  158. package/dist/{chunk-FPPVNF53.js → chunk-R6TFRAMZ.js} +1 -1
  159. package/dist/{chunk-3T2TYDPT.js → chunk-RNHSULQM.js} +1 -1
  160. package/dist/{chunk-32Y6QVFG.js → chunk-SALZ6WSF.js} +1 -1
  161. package/dist/chunk-SB26HQO7.js +2 -0
  162. package/dist/{chunk-4NUSW4A2.js → chunk-SIHX5FW5.js} +1 -1
  163. package/dist/{chunk-LHQUCRCH.js → chunk-SJQTTEXQ.js} +1 -1
  164. package/dist/{chunk-W3NWHWK2.js → chunk-SMGRXKXX.js} +1 -1
  165. package/dist/{chunk-USJ3LUAL.js → chunk-SSOUYKVG.js} +1 -1
  166. package/dist/{chunk-2B75UL7Y.js → chunk-SVIIUKJ2.js} +1 -1
  167. package/dist/{chunk-7ZJWUWSN.js → chunk-SXBPUUQ5.js} +1 -1
  168. package/dist/{chunk-QVP4FSKT.js → chunk-T77LTLAD.js} +1 -1
  169. package/dist/{chunk-KRRZCY7U.js → chunk-TAY7J5VS.js} +1 -1
  170. package/dist/chunk-TD6GCEIK.js +2 -0
  171. package/dist/{chunk-VZA7BPCK.js → chunk-TM45NPWL.js} +1 -1
  172. package/dist/{chunk-ZY65IZJR.js → chunk-TM6VLC6V.js} +1 -1
  173. package/dist/{chunk-COJINPOK.js → chunk-TU2KPOW2.js} +2 -2
  174. package/dist/{chunk-JTJ7IPNI.js → chunk-TUSG7DIL.js} +1 -1
  175. package/dist/{chunk-3BSYOCSW.js → chunk-U2VYTVKV.js} +1 -1
  176. package/dist/{chunk-JQ7ZZQXC.js → chunk-UJ37XGSP.js} +3 -3
  177. package/dist/chunk-ULIIYKZB.js +7 -0
  178. package/dist/{chunk-LNHBZEDC.js → chunk-UWPG5MWM.js} +1 -1
  179. package/dist/{chunk-UUWSULIM.js → chunk-UXGMKRS4.js} +61 -60
  180. package/dist/{chunk-6DZ7LVOG.js → chunk-VCVEZEVS.js} +1 -1
  181. package/dist/{chunk-ZRDX2ARO.js → chunk-VKVYT6KZ.js} +2 -2
  182. package/dist/{chunk-B2WFW74J.js → chunk-VO2NNXKR.js} +1 -1
  183. package/dist/{chunk-B7JLM3IX.js → chunk-W54BX6HC.js} +1 -1
  184. package/dist/{chunk-IZ65ZPWY.js → chunk-W5HFUBXD.js} +1 -1
  185. package/dist/{chunk-TLOYTGVT.js → chunk-WE7HRAGO.js} +1 -1
  186. package/dist/{chunk-GRO6DLN3.js → chunk-WEJR2V7R.js} +1 -1
  187. package/dist/{chunk-YI4ESDAX.js → chunk-WIVKLNIO.js} +1 -1
  188. package/dist/chunk-WLEWXE6L.js +2 -0
  189. package/dist/{chunk-DBTMKBHU.js → chunk-X2MDL6S4.js} +1 -1
  190. package/dist/{chunk-MKPDF26Q.js → chunk-X45RZIAJ.js} +1 -1
  191. package/dist/{chunk-G2KTWFMU.js → chunk-X52YIWGG.js} +1 -1
  192. package/dist/{chunk-UEPJ26X2.js → chunk-X6FCXBXU.js} +1 -1
  193. package/dist/{chunk-LXM7VHYN.js → chunk-X7S7IGCV.js} +1 -1
  194. package/dist/{chunk-FVYIV36L.js → chunk-XKOVEMVZ.js} +1 -1
  195. package/dist/{chunk-3UHPVQLU.js → chunk-Y2HQMJGS.js} +1 -1
  196. package/dist/{chunk-4MNSP4EO.js → chunk-Y3RJHWNK.js} +1 -1
  197. package/dist/{chunk-A3TCFSCK.js → chunk-YCVEI7BT.js} +1 -1
  198. package/dist/{chunk-JGRXMTME.js → chunk-YDB72F4K.js} +1 -1
  199. package/dist/{chunk-7C4IEL5V.js → chunk-YILRYMMG.js} +1 -1
  200. package/dist/{chunk-7DFBOVUB.js → chunk-YJAQZMJT.js} +1 -1
  201. package/dist/{chunk-JGLADDRH.js → chunk-YNDELIXL.js} +1 -1
  202. package/dist/{chunk-WKZLK57W.js → chunk-YPGZ5E4I.js} +1 -1
  203. package/dist/{chunk-NTXFPNAP.js → chunk-YQZ736IQ.js} +1 -1
  204. package/dist/{chunk-FPVGA6XT.js → chunk-YVVFXBT5.js} +1 -1
  205. package/dist/{chunk-JT6WLJSV.js → chunk-YWWVF5OU.js} +1 -1
  206. package/dist/{chunk-RLOJH5O6.js → chunk-Z24SD2EJ.js} +1 -1
  207. package/dist/{chunk-ENG2UTMX.js → chunk-Z36KVIRR.js} +1 -1
  208. package/dist/{chunk-JFBEHCJN.js → chunk-Z47ZEFH7.js} +1 -1
  209. package/dist/{chunk-6NFOH4AC.js → chunk-ZAQGIC33.js} +1 -1
  210. package/dist/{chunk-GGV336P5.js → chunk-ZCBOHWN3.js} +1 -1
  211. package/dist/{chunk-AIGQCMGY.js → chunk-ZCL7XIVS.js} +1 -1
  212. package/dist/{chunk-ORNVIEUA.js → chunk-ZDCXWEQG.js} +1 -1
  213. package/dist/{chunk-6TNLITJO.js → chunk-ZHAMVLQZ.js} +1 -1
  214. package/dist/{chunk-FLOQ5NZL.js → chunk-ZIHQ5JGB.js} +4 -4
  215. package/dist/{chunk-PTISAIZW.js → chunk-ZMIKNNO6.js} +1 -1
  216. package/dist/{chunk-H4KPNGY4.js → chunk-ZMWTRXFH.js} +1 -1
  217. package/dist/{chunk-ONZ2CSTZ.js → chunk-ZPU3WAC4.js} +1 -1
  218. package/dist/commands-JBFLLT7A.js +2 -0
  219. package/dist/{committer-26UZDYSA.js → committer-UO3B3S5Y.js} +1 -1
  220. package/dist/{config-B472DZSR.js → config-7WTZPMAH.js} +1 -1
  221. package/dist/cover-cmd-DU6ZYJFL.js +2 -0
  222. package/dist/{credentials-TLT3RQOO.js → credentials-5WIFF5DG.js} +1 -1
  223. package/dist/{deps-bundle-CMTIWBS5.js → deps-bundle-BLLJ2BQ4.js} +1 -1
  224. package/dist/{deps-resolve-XLFZK74A.js → deps-resolve-WQ6J6RLI.js} +1 -1
  225. package/dist/{design-chat-I7X3QDDY.js → design-chat-ZICGVYIH.js} +1 -1
  226. package/dist/design-committer-7YIPFKMO.js +2 -0
  227. package/dist/design-headless-HYWZIIDS.js +2 -0
  228. package/dist/{design-remote-UDC5FP45.js → design-remote-HPX4VZ63.js} +2 -2
  229. package/dist/device-env-4P4GUVBW.js +2 -0
  230. package/dist/dispatch-BV6XMCN3.js +2 -0
  231. package/dist/{doctor-UHFCIM4B.js → doctor-Z2YQ2DBX.js} +1 -1
  232. package/dist/{docx-convert-N4KMLLKO.js → docx-convert-DO5AQYD3.js} +1 -1
  233. package/dist/{dossier-6KMKEIXV.js → dossier-5XKNAK6Q.js} +1 -1
  234. package/dist/evidence-BJIID6VT.js +2 -0
  235. package/dist/evidence-presentation-LSFOZGLH.js +2 -0
  236. package/dist/evolve-cmd-GZCUSCEK.js +2 -0
  237. package/dist/evolve-remote-LILOAHYH.js +2 -0
  238. package/dist/{explain-cmd-R67B4YR3.js → explain-cmd-KNDORU2D.js} +1 -1
  239. package/dist/{explain-cmd-235TY7QX.js → explain-cmd-LXIVHGN7.js} +1 -1
  240. package/dist/explore-SA2P3SGX.js +2 -0
  241. package/dist/{explore-context-tty-YXEFT32U.js → explore-context-tty-PERKIWXD.js} +1 -1
  242. package/dist/{explore-entry-V6L5FSP4.js → explore-entry-E6EY3VV3.js} +4 -4
  243. package/dist/{explore-live-N5VBLBUI.js → explore-live-XIWWUV52.js} +1 -1
  244. package/dist/{explore-run-tty-ZZQ33GNA.js → explore-run-tty-M56I23IF.js} +2 -2
  245. package/dist/{extract-bind-BTINHHE5.js → extract-bind-LZ22VFKB.js} +3 -3
  246. package/dist/extract-chat-Z64LEAJ5.js +2 -0
  247. package/dist/{extract-cmd-45OZETCM.js → extract-cmd-46E2XDWZ.js} +2 -2
  248. package/dist/extract-headless-XLS56LMN.js +2 -0
  249. package/dist/{feeder-L55TH2NC.js → feeder-NGWIPZ26.js} +1 -1
  250. package/dist/folder-flags-ZIDJVDKX.js +2 -0
  251. package/dist/gaps-cmd-XYOBJVTO.js +3 -0
  252. package/dist/gate-AK44VDHC.js +2 -0
  253. package/dist/gate-NB5CJMTN.js +2 -0
  254. package/dist/{generate-headless-DAH3HHRQ.js → generate-headless-HXAVEAEZ.js} +2 -2
  255. package/dist/hold-passthrough-JGHWMYDM.js +2 -0
  256. package/dist/{impact-cmd-3VFJAKYK.js → impact-cmd-TJTUFAFO.js} +2 -2
  257. package/dist/index.js +4159 -190
  258. package/dist/ingest-ZHHHBUXR.js +2 -0
  259. package/dist/{ingest-cmd-YSEH5EPU.js → ingest-cmd-OJSKTSQK.js} +3 -3
  260. package/dist/ingest-remote-2WM6PYUW.js +2 -0
  261. package/dist/install-JBWBF3WX.js +2 -0
  262. package/dist/{interactive-bind-P3GTFIZM.js → interactive-bind-SOD7VTAY.js} +4 -4
  263. package/dist/{interactive-remote-PBRQHTAF.js → interactive-remote-7ZSTI66T.js} +1 -1
  264. package/dist/lane-CNGO7LH5.js +2 -0
  265. package/dist/lattice-auth-UQPFQSG7.js +2 -0
  266. package/dist/{lifecycle-cmd-PUNFWKV5.js → lifecycle-cmd-DGIO3VAO.js} +1 -1
  267. package/dist/{list-cmd-RD7YBF4S.js → list-cmd-HQIN3HX4.js} +1 -1
  268. package/dist/{list-commands-UZELZAB3.js → list-commands-OFRRBU3D.js} +1 -1
  269. package/dist/{list-remote-KGKXPCQA.js → list-remote-EFCET42K.js} +1 -1
  270. package/dist/{locks-cmd-LXZ6I4QG.js → locks-cmd-AZKCSGHI.js} +1 -1
  271. package/dist/{logical-ids-D5PFYY4C.js → logical-ids-74PLU3VR.js} +1 -1
  272. package/dist/login-flow-SYKXXDLH.js +2 -0
  273. package/dist/{maintenance-cmd-WRWBCP3R.js → maintenance-cmd-X5247RSJ.js} +1 -1
  274. package/dist/{mobile-prompts-Z7NQHRGP.js → mobile-prompts-I66ENBDW.js} +1 -1
  275. package/dist/{objective-variable-gate-3Z7DNVVC.js → objective-variable-gate-V5HHFOUS.js} +1 -1
  276. package/dist/{onboarding-ZP4XDYEO.js → onboarding-6HIP3KW6.js} +1 -1
  277. package/dist/open-provider-XDJKT3W3.js +2 -0
  278. package/dist/pdf-convert-YB6PJFMI.js +2 -0
  279. package/dist/persist-recorded-session-RSSMTVF3.js +3 -0
  280. package/dist/phase-seed-ZZSJME7M.js +2 -0
  281. package/dist/pipeline-NTJDH5TC.js +2 -0
  282. package/dist/{policy-commands-TY6WOR73.js → policy-commands-4PUGESCW.js} +1 -1
  283. package/dist/{prepare-target-EVL2QSXA.js → prepare-target-AI3GGZF6.js} +1 -1
  284. package/dist/{pull-cmd-QJQANBAW.js → pull-cmd-NRVB5ZN7.js} +1 -1
  285. package/dist/{pull-route-AIOTLA3D.js → pull-route-FWCZW76M.js} +1 -1
  286. package/dist/readmodel-TRV4E3MW.js +2 -0
  287. package/dist/real-device-run-NQ7RNH7C.js +2 -0
  288. package/dist/{reconcile-cmd-IJTQAJZX.js → reconcile-cmd-7B7THAFJ.js} +4 -4
  289. package/dist/reconcile-deps-UDQBWSLE.js +2 -0
  290. package/dist/{reconcile-remote-23D6SXXT.js → reconcile-remote-3W6ZTO3G.js} +2 -2
  291. package/dist/{recording-banner-MNRMMEX4.js → recording-banner-WVDTWTSE.js} +1 -1
  292. package/dist/registry-PFOSXOIH.js +2 -0
  293. package/dist/remote-entry-BZU4NFNS.js +2 -0
  294. package/dist/{remote-mode-AFNCN6EE.js → remote-mode-NXUKDUXG.js} +1 -1
  295. package/dist/{remote-words-RCNFI2TQ.js → remote-words-JRDDNOZ6.js} +1 -1
  296. package/dist/{require-project-folder-7UH43GHI.js → require-project-folder-3DTI2CVB.js} +1 -1
  297. package/dist/{resolve-run-intent-XEWFYMGN.js → resolve-run-intent-QCL7QXIB.js} +1 -1
  298. package/dist/{resolver-QMPX6RBR.js → resolver-CDF7QKVD.js} +1 -1
  299. package/dist/revert-QKHPCRT6.js +2 -0
  300. package/dist/{review-cmd-2OECKNL5.js → review-cmd-XBK3TGRE.js} +1 -1
  301. package/dist/run-CSYGVV3D.js +2 -0
  302. package/dist/run-YUHHD54J.js +2 -0
  303. package/dist/{run-channel-63SVP5OI.js → run-channel-IIIYXOIW.js} +1 -1
  304. package/dist/run-remote-SFR3F2T5.js +2 -0
  305. package/dist/{run-startup-gate-USQFSW47.js → run-startup-gate-QSFJRYUY.js} +1 -1
  306. package/dist/run-test-md-ZSREINDQ.js +20 -0
  307. package/dist/session-worker.js +2 -2
  308. package/dist/{sessions-CFV7FOIT.js → sessions-NH2EG7BP.js} +1 -1
  309. package/dist/{sessions-cmd-LQ2LZQOC.js → sessions-cmd-TLUITRG5.js} +2 -2
  310. package/dist/{sessions-remote-H7CQST42.js → sessions-remote-INO7AWKB.js} +1 -1
  311. package/dist/{skill-installer-LKYY6XFJ.js → skill-installer-7JH5QCJF.js} +1 -1
  312. package/dist/spawner-MQ4XEHIX.js +2 -0
  313. package/dist/{store-KM5MG3XB.js → store-X4UK4AP7.js} +1 -1
  314. package/dist/store-choice-27HDIFTU.js +2 -0
  315. package/dist/{store-guard-34GG2TW2.js → store-guard-ZXKB5DQH.js} +1 -1
  316. package/dist/{store-site-ZSFINU6C.js → store-site-K5NHLI7D.js} +1 -1
  317. package/dist/stream-warnings-GM7YEOVG.js +2 -0
  318. package/dist/sync-cmd-2PCO7LZA.js +2 -0
  319. package/dist/{sync-setup-QQXYO6R4.js → sync-setup-5WQO73Y5.js} +1 -1
  320. package/dist/tcg-generate-DGJD5KSM.js +2 -0
  321. package/dist/testmd-actions-XE2JPQHB.js +2 -0
  322. package/dist/{testmd-sync-PQ4GFKHB.js → testmd-sync-LYHEXWCT.js} +1 -1
  323. package/dist/{tms-client-XWCR7O7J.js → tms-client-J4OCD3EP.js} +1 -1
  324. package/dist/token-refresh-E4FTJVHY.js +2 -0
  325. package/dist/{trust-gate-AT2XBWN4.js → trust-gate-674C2NZS.js} +1 -1
  326. package/dist/{turn-preflight-LHYLRL7G.js → turn-preflight-R4PU6NYY.js} +1 -1
  327. package/dist/{use-case-ref-NA3IXGQW.js → use-case-ref-44BPIP4N.js} +1 -1
  328. package/dist/{validate-basic-3DX3MMC7.js → validate-basic-66XDPA3S.js} +1 -1
  329. package/dist/{variable-receipt-BXSZO36E.js → variable-receipt-7PRKDTRJ.js} +1 -1
  330. package/dist/verdicts-PVB7TV5S.js +2 -0
  331. package/dist/{version-check-OV6AOVED.js → version-check-SHNVYTMU.js} +1 -1
  332. package/dist/{view-cmd-QDKBBNIU.js → view-cmd-QOB3O6YW.js} +1 -1
  333. package/dist/{walk-session-BAYYPIKN.js → walk-session-WIEROYOT.js} +1 -1
  334. package/dist/with-telemetry-T2PWI5CY.js +2 -0
  335. package/package.json +16 -16
  336. package/dist/ChatSurface-XUV3EQPZ.js +0 -2
  337. package/dist/EvidenceViewOffer-EIANIYN7.js +0 -2
  338. package/dist/FolderPicker-XOA7FTHF.js +0 -2
  339. package/dist/InfoBox-OBH7SUGC.js +0 -2
  340. package/dist/ProjectPicker-6KRLKV4U.js +0 -2
  341. package/dist/SaveSessionPrompt-J2OPDEOO.js +0 -2
  342. package/dist/SingleShotApp-QI4B2TSL.js +0 -2
  343. package/dist/TestMdRunView-I4MV54FB.js +0 -2
  344. package/dist/TestrunEvidenceTable-WEIUSW3E.js +0 -2
  345. package/dist/bridge-SDEP7Y33.js +0 -2
  346. package/dist/chat-committer-FM5NG46O.js +0 -2
  347. package/dist/chat-controller-FWFQVZTB.js +0 -2
  348. package/dist/child-H2YSDFCG.js +0 -2
  349. package/dist/chunk-2EVP636F.js +0 -26
  350. package/dist/chunk-34R7BNZ2.js +0 -2
  351. package/dist/chunk-5T6II7VN.js +0 -7
  352. package/dist/chunk-6K5BEEAJ.js +0 -2
  353. package/dist/chunk-HMQ5M4JJ.js +0 -34
  354. package/dist/chunk-KF4DKXSS.js +0 -2
  355. package/dist/chunk-NOFJXCYP.js +0 -5
  356. package/dist/chunk-SB6P5EQH.js +0 -2
  357. package/dist/chunk-Y6Y6RAY4.js +0 -2
  358. package/dist/commands-QOORPTSI.js +0 -2
  359. package/dist/cover-cmd-3VO6QC5Y.js +0 -2
  360. package/dist/design-committer-Y7R56RFZ.js +0 -2
  361. package/dist/design-headless-HUQOXLZB.js +0 -2
  362. package/dist/device-env-MMGISNHN.js +0 -2
  363. package/dist/dispatch-P2445PUU.js +0 -2
  364. package/dist/evidence-M3JTOJNL.js +0 -2
  365. package/dist/evidence-presentation-DV3DRB4S.js +0 -2
  366. package/dist/evolve-cmd-K3JXACMN.js +0 -2
  367. package/dist/evolve-remote-CUDVV2O2.js +0 -2
  368. package/dist/explore-UDD5FHXW.js +0 -2
  369. package/dist/extract-chat-ABZ5S7UU.js +0 -2
  370. package/dist/extract-headless-ALEFAMVS.js +0 -2
  371. package/dist/folder-flags-HTKJCXKB.js +0 -2
  372. package/dist/gaps-cmd-ROGQWK5X.js +0 -3
  373. package/dist/gate-QA5J7UZA.js +0 -2
  374. package/dist/gate-XFFFX5ZF.js +0 -2
  375. package/dist/hold-passthrough-K5PP26CP.js +0 -2
  376. package/dist/ingest-S5R736ZV.js +0 -2
  377. package/dist/ingest-remote-C6AP2Q7E.js +0 -2
  378. package/dist/install-B26Y2NU4.js +0 -2
  379. package/dist/lane-7IEAE6AC.js +0 -2
  380. package/dist/lattice-auth-7EL4ET3P.js +0 -2
  381. package/dist/login-flow-CHLGQGHK.js +0 -2
  382. package/dist/open-provider-U26BBVUE.js +0 -2
  383. package/dist/pdf-convert-LMKOKLXT.js +0 -2
  384. package/dist/persist-recorded-session-4IRYG5CJ.js +0 -3
  385. package/dist/phase-seed-2H6OXZXT.js +0 -2
  386. package/dist/pipeline-U7D25NST.js +0 -2
  387. package/dist/readmodel-KXCFPL2M.js +0 -2
  388. package/dist/real-device-run-QODMDUXF.js +0 -2
  389. package/dist/reconcile-deps-2CTIFXDR.js +0 -2
  390. package/dist/registry-MZYBLEW2.js +0 -2
  391. package/dist/remote-entry-DW2J56N4.js +0 -2
  392. package/dist/revert-37346WLE.js +0 -2
  393. package/dist/run-JWOHNWA3.js +0 -2
  394. package/dist/run-QFJ6ZRVD.js +0 -2
  395. package/dist/run-remote-66QTUQ2M.js +0 -2
  396. package/dist/run-test-md-7DRWCSQE.js +0 -19
  397. package/dist/spawner-C7NLLM4F.js +0 -2
  398. package/dist/store-choice-4J2NN6OQ.js +0 -2
  399. package/dist/stream-warnings-N4KVVWXV.js +0 -2
  400. package/dist/sync-cmd-3CHSWWWW.js +0 -2
  401. package/dist/tcg-generate-IPD5FQUW.js +0 -2
  402. package/dist/testmd-actions-V7P7BMKE.js +0 -2
  403. package/dist/token-refresh-LR33BKAB.js +0 -2
  404. package/dist/verdicts-7GKZEDHV.js +0 -2
  405. package/dist/with-telemetry-62LW4VFI.js +0 -2
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{f as y,h as z,j as U}from"./chunk-JGRXMTME.js";import{b as N,c as O,e as S,f as D,j as T}from"./chunk-77ZZQJLX.js";import{a as Y}from"./chunk-JIRNI5TB.js";import{a as M}from"./chunk-UTM7D4PI.js";import{a as R}from"./chunk-FCD3NYOM.js";import{a as F}from"./chunk-B7ZX5HEN.js";import{a as A}from"./chunk-QMOGBKJM.js";import{e as $}from"./chunk-UR6MHSHU.js";var C=$(Y(),1);import{existsSync as k,readFileSync as I,readdirSync as J,statSync as K}from"fs";import{dirname as H,isAbsolute as V,join as h,relative as P,resolve as Z,sep as _}from"path";import{createHash as q}from"crypto";var b="testmd-bundle.json",u=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},B=e=>e.split(_).join("/");function v(e){if(!k(e))return[];let t=[];for(let s of J(e).sort()){let r=h(e,s);K(r).isDirectory()?t.push(...v(r)):t.push(r)}return t}function G(e){let t=e.map(r=>H(r).split(_)),s=t[0];for(let r of t.slice(1)){let i=0;for(;i<s.length&&i<r.length&&s[i]===r[i];)i++;s=s.slice(0,i)}return s.join(_)||_}function Q(e){for(let t of e){let s=F(t,I(t,"utf8"));for(let r of s.steps)if(r.body.kind==="import_ref"&&V(r.body.path))throw new u(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function j(e,t={}){let s=Z(e),r=S(s),i=y(s);if(!i?.commit_id||!i?.test_id)throw new u(`bundle sync: ${s} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let l;try{l=U(s)}catch(n){throw n instanceof z?new u(`bundle sync: ${n.message}`):n}let a=[s];for(let n of l.steps)for(let c of n.trace.slice(1))a.includes(c.file)||a.push(c.file);Q(a);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let c=N(n.file);o.includes(c)||o.push(c),n.kind==="module"&&d.push(S(n.file))}let m=[...a],p=n=>{k(n)&&m.push(n)};p(O(s)),m.push(r),p(D(s)),m.push(...v(T(s)));for(let n of o)p(h(n,"Result.md")),m.push(...v(h(n,".internal","steps")));for(let n of d)p(n);let f=G(m);if(k(h(f,b)))throw new u(`bundle sync: a real file named ${b} exists at the zip root (${f}) \u2014 it would collide with the generated manifest`);let x=m.map(n=>{let c=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
2
+ import{f as y,h as z,j as U}from"./chunk-YDB72F4K.js";import{b as N,c as O,e as S,f as D,j as T}from"./chunk-77ZZQJLX.js";import{a as Y}from"./chunk-JIRNI5TB.js";import{a as M}from"./chunk-UTM7D4PI.js";import{a as R}from"./chunk-FCD3NYOM.js";import{a as F}from"./chunk-B7ZX5HEN.js";import{a as A}from"./chunk-J4FIESTB.js";import{e as $}from"./chunk-UR6MHSHU.js";var C=$(Y(),1);import{existsSync as k,readFileSync as I,readdirSync as J,statSync as K}from"fs";import{dirname as H,isAbsolute as V,join as h,relative as P,resolve as Z,sep as _}from"path";import{createHash as q}from"crypto";var b="testmd-bundle.json",u=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},B=e=>e.split(_).join("/");function v(e){if(!k(e))return[];let t=[];for(let s of J(e).sort()){let r=h(e,s);K(r).isDirectory()?t.push(...v(r)):t.push(r)}return t}function G(e){let t=e.map(r=>H(r).split(_)),s=t[0];for(let r of t.slice(1)){let i=0;for(;i<s.length&&i<r.length&&s[i]===r[i];)i++;s=s.slice(0,i)}return s.join(_)||_}function Q(e){for(let t of e){let s=F(t,I(t,"utf8"));for(let r of s.steps)if(r.body.kind==="import_ref"&&V(r.body.path))throw new u(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function j(e,t={}){let s=Z(e),r=S(s),i=y(s);if(!i?.commit_id||!i?.test_id)throw new u(`bundle sync: ${s} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let l;try{l=U(s)}catch(n){throw n instanceof z?new u(`bundle sync: ${n.message}`):n}let a=[s];for(let n of l.steps)for(let c of n.trace.slice(1))a.includes(c.file)||a.push(c.file);Q(a);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let c=N(n.file);o.includes(c)||o.push(c),n.kind==="module"&&d.push(S(n.file))}let m=[...a],p=n=>{k(n)&&m.push(n)};p(O(s)),m.push(r),p(D(s)),m.push(...v(T(s)));for(let n of o)p(h(n,"Result.md")),m.push(...v(h(n,".internal","steps")));for(let n of d)p(n);let f=G(m);if(k(h(f,b)))throw new u(`bundle sync: a real file named ${b} exists at the zip root (${f}) \u2014 it would collide with the generated manifest`);let x=m.map(n=>{let c=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
3
3
  `):void 0,E=c??I(n);return{abs:n,rel:B(P(f,n)),sha256:q("sha256").update(E).digest("hex"),bytes:E.length,...c?{contents:c}:{}}}).sort((n,c)=>n.rel<c.rel?-1:1),w=B(P(f,s)),L={schema_version:2,entry:w,commit_id:t.identityOverride?.commit_id??i.commit_id,test_id:i.test_id,testcase_id:i.testcase_id??null,project_id:i.project_id??null,folder_id:i.folder_id??null,org_id:i.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:A},files:x.map(n=>({path:n.rel,sha256:n.sha256,bytes:n.bytes})),units:l.unitFiles.filter(n=>n.file!==s).map(n=>({path:B(P(f,n.file)),kind:n.kind}))};return{zipRoot:f,entry:w,files:x,manifest:L}}var g=e=>e instanceof Error?e.message:String(e);function W(e){return new Promise((t,s)=>{let r=(0,C.default)("zip",{zlib:{level:6}}),i=[];r.on("data",l=>i.push(l)),r.on("error",s),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
4
4
  `,{name:b});for(let l of e.files)l.contents?r.append(l.contents,{name:l.rel}):r.file(l.abs,{name:l.rel});r.finalize()})}async function X(e){let{plan:t,controller:s,testId:r,sessionId:i,commitId:l}=e,a;try{a=await W(t)}catch(d){return{ok:!1,stage:"zip",error:g(d)}}let o;try{let d={key:"testmd",content_type:"application/zip",filename:`${l}-testmd.zip`},p=(await s.getPresignedUrls(r,i,[d])).urls?.testmd?.upload_url;if(!p)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};o=p}catch(d){return{ok:!1,stage:"presign",error:g(d)}}try{await M(o,a,"application/zip")}catch(d){return{ok:!1,stage:"upload",error:g(d)}}return{ok:!0,bytes:a.length}}async function ee(e){let t;try{t=j(e.sourcePath,{identityOverride:e.identityOverride})}catch(s){return s instanceof u?{ok:!1,stage:"collect",error:s.message}:{ok:!1,stage:"collect",error:g(s)}}return X({...e,plan:t})}function ge(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}function te(e){return e.persisted?e.uploadSucceeded?e.local?"local":e.hasBasicAuth?!e.metaCommitId||!e.metaTestId?"not_authored":null:"no_auth":"upload_failed":"not_persisted"}async function ye(e){let t=e.recordedTestPath??null,s=t?y(t):null,r=te({persisted:!!t,uploadSucceeded:e.uploadSucceeded,local:e.local,hasBasicAuth:!!e.basicAuth,metaCommitId:s?.commit_id,metaTestId:s?.test_id});if(r)return e.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:r,...t?{path:t}:{}}),{skipped:r};let i=s.commit_id,l=s.test_id,a=o=>{try{e.onAgentEvent?.(o)}catch{}};try{let o=await(e.syncFn??ee)({sourcePath:t,testId:l,sessionId:e.sessionId,commitId:i,controller:new R(e.controllerBaseUrl,{username:e.basicAuth.username,accessKey:e.basicAuth.access_key})});return o.ok?(e.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:i,path:t,bytes:o.bytes}),a({type:"test_md_bundle_sync",status:"ok",commit_id:i,path:t,bytes:o.bytes})):(e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:i,path:t,stage:o.stage,error:o.error}),a({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:o.stage})),o}catch(o){let d=g(o);return e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{commit_id:i,path:t,error:d}),a({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:"upload"}),{ok:!1,stage:"upload",error:d}}}export{j as a,W as b,X as c,ee as d,ge as e,te as f,ye as g};
@@ -0,0 +1,34 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{c as C,d as P}from"./chunk-OCVDMZWB.js";import{d as I}from"./chunk-F2F257PU.js";import{e as x}from"./chunk-5D7ENQTQ.js";import{b,e as R}from"./chunk-KL7XFNSD.js";import{f as D,h as S,l as E}from"./chunk-KQ4XKTIZ.js";import{b as _,c as N,g as k,h as A}from"./chunk-WLEWXE6L.js";import{b as h}from"./chunk-LPJKNX6D.js";import{a as v}from"./chunk-ZCBOHWN3.js";import{h as w}from"./chunk-A7RJQJNT.js";import{mkdirSync as q,writeFileSync as z}from"fs";import{join as J}from"path";function $(e,t=process.env){return t.KANE_MOBILE_APP_BASE_URL||v(e).mobileAppBaseUrl}var G="device-config.json",T=new WeakMap;function X(e,t){let r=T.get(e)??new Map;T.set(e,r);let n=JSON.stringify([t.path,t.type,t.env,t.orgId]),o=r.get(n);if(o)return o;let i=e(t).finally(()=>r.delete(n));return r.set(n,i),i}function U(e){return e.startsWith("lt://")?e:`lt://${e}`}async function Y(e,t){let r=await E(e.env,e.platform,{...e.selection.deviceName?{deviceName:e.selection.deviceName.value}:{},...e.selection.osVersion?{osVersion:e.selection.osVersion.value}:{}},t);if(r.kind==="unchecked"&&e.onWarning?.(`${r.reason} \u2014 the run continues, but the device and OS version are not checked before the session is requested.`),r.kind==="refused")throw new Error(r.detail)}async function Q(e,t){let r=e.selection.app.value.trim();if(h(r))return U(r);let n=e.credentials;if(!n?.orgId)throw new Error(`${r} has to be uploaded before it can run on a real device, but your account's org id was not found. Run kane-cli login, or set app: to an app ID from \`kane-cli apps list --target ${e.platform}\`.`);let o=await X(t,{path:r,type:e.platform,env:e.env,orgId:n.orgId,userId:n.userId??"",auth:{username:n.username,accessKey:n.accessKey,orgId:n.orgId},baseUrl:$(e.env),...e.onProgress?{onProgress:e.onProgress}:{}});if(b(o))throw new Error(`could not upload ${r} for this real-device run: ${o.reason}`);return U(o.appUrl??o.appId)}async function V(e,t={}){if(!e.credentials)throw new Error("a real-device run needs your TestMu AI username and access key, and none were found. Run kane-cli login, or pass --username and --access-key.");await Y(e,t.fetchCatalog??S);let r=await Q(e,t.upload??R),{deviceName:n,osVersion:o}=e.selection,i={platform_name:e.platform,device_name:n?.value??D,...o?{platform_version:o.value}:{},app:r,...e.testName?{test_name:e.testName}:{},...e.tcId?{"tms.tc_id":e.tcId}:{},...e.capabilities},a=J(e.outDir,G);return q(e.outDir,{recursive:!0}),z(a,`${JSON.stringify(i,null,2)}
3
+ `),{device:{platform:e.platform,target:e.platform,device_config_path:a},...n?{deviceName:n.value}:{},...o?{osVersion:o.value}:{},app:r}}import{createServer as Z}from"http";import{randomBytes as ee}from"crypto";import{spawn as re}from"child_process";import{mkdtempSync as te,readdirSync as ne,readFileSync as oe,rmSync as ie,writeFileSync as se}from"fs";import{tmpdir as M}from"os";import{join as y}from"path";function O(e,t,r,n){let o=Buffer.from(`${n.username}:${n.accessKey}`).toString("base64"),i=new URLSearchParams({session:r,auth:o});return t==="ios"&&i.set("mode","webrtc"),`${e.replace(/\/+$/,"")}/?${i.toString()}`}function W(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function ae(e){return`<!doctype html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <title>${W(e.title)}</title>
9
+ <style>
10
+ html, body { margin: 0; height: 100%; background: #111; font-family: system-ui, sans-serif; }
11
+ iframe { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; }
12
+ #guard { position: fixed; inset: 0; cursor: not-allowed; background: transparent; }
13
+ #badge, #ended { position: fixed; left: 50%; transform: translateX(-50%); padding: 6px 12px;
14
+ border-radius: 999px; font-size: 13px; color: #fff; background: rgba(0, 0, 0, 0.7); }
15
+ #badge { bottom: 16px; }
16
+ #ended { top: 16px; display: none; background: #b42318; }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <iframe src="${W(e.streamUrl)}" allow="autoplay; fullscreen"></iframe>
21
+ ${e.viewOnly?'<div id="guard"></div>':""}
22
+ <div id="badge">View only \u2014 the test is driving this device</div>
23
+ <div id="ended">The session ended</div>
24
+ <script>
25
+ // kane-cli answers while the run lives; once it stops, say so.
26
+ setInterval(() => {
27
+ fetch(location.pathname + "/alive", { cache: "no-store" })
28
+ .then((r) => { if (!r.ok) throw new Error(); })
29
+ .catch(() => { document.getElementById("ended").style.display = "block"; });
30
+ }, 3000);
31
+ </script>
32
+ </body>
33
+ </html>
34
+ `}async function B(e){let t=`/${ee(16).toString("hex")}`,r=ae(e),n=Z((a,s)=>{if(a.url===t){s.writeHead(200,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),s.end(r);return}if(a.url===`${t}/alive`){s.writeHead(204),s.end();return}s.writeHead(404),s.end()});await new Promise((a,s)=>{n.once("error",s),n.listen(0,"127.0.0.1",()=>a())}),n.unref();let o=n.address();return{url:`http://127.0.0.1:${typeof o=="object"&&o?o.port:0}${t}`,close:()=>n.close()}}function j(e){let r=e?.width,n=e?.height;return!r||!n?{width:400,height:820}:{width:Math.min(1200,Math.max(320,Math.round(820*r/n))),height:820}}function ce(e,t,r){return[`--app=${e}`,`--user-data-dir=${t}`,`--window-size=${r.width},${r.height}`,"--no-first-run","--no-default-browser-check","--autoplay-policy=no-user-gesture-required"]}var le=3e3;async function L(e,t,r=le){if(!P())throw new Error("Google Chrome is not installed (or set KANE_CLI_CHROME_PATH).");me();let n=te(y(M(),K));se(y(n,F),String(process.pid));let o=re(C(),ce(e,n,t),{stdio:"ignore",detached:process.platform!=="win32"});o.unref();let i=()=>H(n);await new Promise((u,g)=>{let c=setTimeout(()=>{o.off("error",l),o.off("exit",p),u()},r);c.unref();function l(d){clearTimeout(c),i(),g(new Error(`Chrome did not start: ${d.message}`))}function p(d,m){clearTimeout(c),i(),g(new Error(`Chrome quit as it opened (${m??`exit code ${d}`}).`))}o.once("error",l),o.once("exit",p)}),o.on("error",()=>{}),o.once("exit",i);let a=()=>f();process.once("exit",a);let s=!1;function f(){if(!s){s=!0,process.off("exit",a);try{o.pid&&process.platform!=="win32"?process.kill(-o.pid):o.kill()}catch{}i()}}return f}var K="kane-device-view-",F="kane-cli.pid";function H(e){try{ie(e,{recursive:!0,force:!0,maxRetries:3,retryDelay:100})}catch{}}function de(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function me(e=M()){let t;try{t=ne(e).filter(r=>r.startsWith(K))}catch{return}for(let r of t){let n=y(e,r),o=NaN;try{o=Number(oe(y(n,F),"utf8"))}catch{}Number.isInteger(o)&&o>0&&de(o)||H(n)}}function Oe(e){return e.flag===!1||e.mobile?.device_stream===!1?"off":e.interactive?"open":"off"}function fe(e){let t=e.basicAuth;if(!t)return;let r=e.resolvedCreds;return{username:t.username,accessKey:t.access_key,...r?.org_id?{orgId:String(r.org_id)}:{},...r?.user_id?{userId:String(r.user_id)}:{}}}async function Be(e){let t=fe(e.auth),r=e.selection?await V({platform:e.target,selection:e.selection,env:e.env,outDir:e.sessionDir,...t?{credentials:t}:{},testName:e.testName,...e.tcId?{tcId:e.tcId}:{},capabilities:{...x(e.mobile,e.target),...I(e.tunnel)},onProgress:e.write,onWarning:c=>e.write(`warning: ${c}`)}):_({platform:e.target,hasCredentials:!!t});!e.selection&&e.tunnel&&e.write("warning: --tunnel is ignored: this run's device config names its own tunnel"),e.write(N(e.target,e.selection?e.tunnel:null));let n=r.app?.replace(/^lt:\/\//,""),o=A(e.target,r.app,e.write),i,a,s=!1,f=!1,u=()=>{f=!0,a?.(),i?.close()},g=c=>{let l=c.type==="run_start"&&!c.child_id?c.environment?.device:void 0,p=l?.session_id;if(s||!p||!t||(e.stream??"off")==="off")return;s=!0;let d=k(l);B({streamUrl:O(v(e.env).deviceStreamUrl,w(e.target),p,t),title:d?`${d} \u2014 live`:"Real device \u2014 live",viewOnly:e.target==="android"}).then(async m=>{i=m,a=await(e.openWindow??L)(m.url,j(l)),f?u():e.write("Showing the device in its own window.")}).catch(m=>{i?.close(),e.write(`note: no live view of the device \u2014 ${m.message}`)})};return{device:r.device,...r.deviceName?{deviceName:r.deviceName}:{},...r.osVersion?{osVersion:r.osVersion}:{},...r.app?{app:r.app}:{},...h(n)?{appId:n}:{},announce:c=>{o(c),g(c)},stopStream:u}}var pe="infra_error.device_lost";function je(e){return e?.reason_code===pe}export{$ as a,Oe as b,fe as c,Be as d,je as e};
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as j}from"./chunk-MKPDF26Q.js";import{e as d}from"./chunk-6K5BEEAJ.js";import{r as a}from"./chunk-UJLULWSR.js";import{a as y}from"./chunk-GGV336P5.js";import{a as h}from"./chunk-VZA7BPCK.js";var $=10,u=200,C=1e4,N=1e6;function k(t,e,r="streaming"){let n=r==="full-fetch"?N:C,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function S(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function b(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
2
+ import{a as j}from"./chunk-X45RZIAJ.js";import{e as d}from"./chunk-SB26HQO7.js";import{r as a}from"./chunk-UJLULWSR.js";import{a as y}from"./chunk-ZCBOHWN3.js";import{a as h}from"./chunk-TM45NPWL.js";var $=10,u=200,C=1e4,N=1e6;function k(t,e,r="streaming"){let n=r==="full-fetch"?N:C,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function S(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function b(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
3
3
  `)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function T(t,e,r=n=>process.stdout.write(`${n}
4
- `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:m}=await import("./token-refresh-LR33BKAB.js"),w=await m({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(m){return{ok:!1,reason:"refresh_failed",detail:m instanceof Error?m.message:String(m)}}let c=y(e),f=await new j(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
4
+ `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:m}=await import("./token-refresh-E4FTJVHY.js"),w=await m({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(m){return{ok:!1,reason:"refresh_failed",detail:m instanceof Error?m.message:String(m)}}let c=y(e),f=await new j(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
5
5
  `,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
6
6
  `,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
7
7
  `,exitCode:2}}}function M(t){return{id:t.project_id,name:t.name}}function O(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function x(t,e=r=>process.stdout.write(`${r}
@@ -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-2GE5X2A5.js";import{Ea as $,M as y}from"./chunk-Z777GGHB.js";import{d as N}from"./chunk-KU3YHPWZ.js";import{d as h,m as S}from"./chunk-4I7YN6YY.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-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};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Re}from"./chunk-LD5B3QFW.js";import{a as K,f as Se}from"./chunk-6TNLITJO.js";import{c as Ie}from"./chunk-ZCIWQHCO.js";import{D as ue,H as ge,I as fe,J as he,L as me,M as ve,N as Ee,W as ye,a as M,b as T,ca as U,f as ae,g as pe,pa as $e,r as le,zb as te}from"./chunk-Z777GGHB.js";import{g as y,h as G,i as Z,j as ee}from"./chunk-KU3YHPWZ.js";var be=["definitionId"],B=g=>be.find(m=>g[m]!==void 0)??null;function P(g,m,n,R,f){let $={...n};for(let[w,C]of Object.entries(R))C!==void 0&&!be.includes(w)&&($[w]=C);if(m==="test"&&typeof R.test_md_blob=="string"){if(f===void 0)throw new Error("a test's steps were edited without the rule for its definition id: pass definitionOf (design/test-definition.ts)");$.definitionId=f(g,R.test_md_blob)}return $}var Ne=new Set([y.EXERCISES,y.VERIFIES,y.SCOPED_TO]),ke=new Set(["approve","edit","reject"]);function ze(g){let{store:m,graph:n,ops:R,by:f}=g,$=g.mintable??Re(),w=m.head(),C=m.serialize(w);if(!m.sameToken(m.parse(n.latestHash),w))return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(C)} \u2014 re-open and retry`}]};let W=[],D=[],ne=new Set;for(let e of R){if(n.appliedEvents.has(e.eventId)||ne.has(e.eventId)){W.push(e.eventId);continue}ne.add(e.eventId),D.push(e)}if(D.length===0)return{record:null,errors:null,applied:[],skipped:W,minted:[],staleDelta:[]};let d=[],q=[],I=[],Oe=pe(ae(m,n)),N=[],S=[],H=[],F=[...g.judgements??[]],Y=[],J=new Map,ie=new Set,se=[],j=new Set,Te=new Set($),de=new Set;for(let e of D){if(!ke.has(e.kind))continue;let i=e.target,o=n.resolve(i),t=o?n.tipOf(o.cid):i;de.has(t)&&d.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${i} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),de.add(t)}let b={targets:{},enhance:{},redirectTo:{},retract:{},conv:{}},k=(e,i)=>{let{target:o,expectedCid:t}=i,r=n.resolve(o);if(!r)return d.push({code:"UNKNOWN_NODE",detail:`${e}: ${o} names nothing in the graph`}),null;let s=n.tipOf(r.cid);if(s!==t||n.superseded.has(t)){let c=te(n,s).includes(t);return d.push({code:"EXPECTED_CID_MOVED",detail:c?`${e}: ${o} moved or was archived since it was displayed`:`${e}: ${o}: the cid given names no version of it, so the edit didn't match it as it is now`,data:{tip:s,target:o,moved:c}}),null}return b.targets[i.eventId]=t,t},z=e=>new Set(te(n,n.tipOf(e))),_=[],O=new Set,oe=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of D){if(e.kind!=="retract"){_.push(e);continue}let i=k("retract",e);if(!i)continue;let o=new Map;for(let s of z(i))for(let c of[...n.edgesFrom(s),...n.edgesInto(s)])o.set(c.ecid,c);let t,r={};if(e.edgeEcid!==void 0){if(n.superseded.has(e.edgeEcid)){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(t=o.get(e.edgeEcid),!t){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let s=e.edgeRef;if(s.type===y.DERIVES){d.push(oe(e.target));continue}let c=(a,u)=>{let x=U(n,u);if(x)return x;let A=n.resolve(u)!==null;return d.push(A?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${s.type} ${a} '${u}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${s.type} ${a} got (unknown) for '${u}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},v=c("dst",s.dst);if(!v)continue;r.dst=v.cid;let h=z(v.cid),l=null;if(s.src!==void 0){let a=c("src",s.src);if(!a)continue;r.src=a.cid,l=z(a.cid)}let E=[...o.values()].filter(a=>a.type===s.type&&h.has(a.dst)&&(l===null||l.has(a.src)));if(E.length===0){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${s.type} edge onto ${s.dst}${s.src!==void 0?` from ${s.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(E.length>1){let a=E.map(u=>`${u.type} ${n.displayNameOf(u.src)??u.src} \u2192 ${n.displayNameOf(u.dst)??u.dst} (${u.ecid})`).join("; ");d.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${E.length} live ${s.type} edges match \u2014 ${a} \u2014 add src to disambiguate`});continue}t=E[0]}else{d.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(t.type===y.DERIVES){d.push(oe(e.target));continue}if(O.has(t.ecid)){d.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${t.ecid} was retracted earlier in this turn`});continue}O.add(t.ecid),b.retract[e.eventId]={ecid:t.ecid,...r},_.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:t.ecid,reason:e.reason,eventId:e.eventId})}let L=new Map;for(let e of _){if(e.kind!=="edit")continue;let i=n.resolve(e.target);if(!i||n.tipOf(i.cid)!==e.expectedCid||n.superseded.has(e.expectedCid))continue;let o=n.getNode(e.expectedCid);if(!o||B(e.edit)!==null)continue;let t=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof t.title=="string"&&!t.title.trim()||G(o.label,t).length>0)continue;let r=M(o.label,t);r!==e.expectedCid&&L.set(e.expectedCid,r)}for(let e of _)if(e.kind==="approve"){let i=k("approve",e);i&&N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let i=k("reject",e);if(!i)continue;if(N.push({id:i,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let o=Ee(n,e.redirectTo);if(!o){d.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}if(o===i){d.push({code:"SELF_SUPERSEDE",detail:`reject.redirectTo: the live version of ${e.redirectTo} is the node being rejected`});continue}b.redirectTo[e.eventId]=o,S.push({kind:"node",old:i,new:o,reason:e.reason,by:f});for(let t of n.edgesInto(i)){if(Z(t.type)?.pin?.comparesTo!=="dst_tip"||n.superseded.has(t.ecid)||n.superseded.has(t.src))continue;let r=`${e.reason} \u2014 ${e.target} merged into ${e.redirectTo}`,s=n.edgesFrom(t.src).some(c=>c.type===t.type&&c.dst===o&&!n.superseded.has(c.ecid));!s&&!Ne.has(t.type)||(S.push({kind:"edge",ecid:t.ecid,reason:r,by:f}),s||I.push({ecid:T(t.type,t.src,o,t.props),type:t.type,src:t.src,dst:o,props:t.props}))}}}else if(e.kind==="edit"){let i=k("edit",e);if(!i)continue;let o=n.getNode(i);if(!o){d.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let t=B(e.edit);if(t!==null){d.push({code:"DERIVED_FIELD",detail:`edit ${e.target}: ${t} is derived from the test's steps, never set by an edit; edit test_md_blob instead`});continue}let r=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof r.title=="string"&&!r.title.trim()){d.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let s=G(o.label,r);if(s.length>0){for(let h of s)d.push({code:h.code,detail:`edit ${e.target}: ${h.detail}`});continue}let c=M(o.label,r);if(c===i){N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(fe(n,i,c)){d.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let v=he({graph:n,oldTip:i,newCid:c,newLabel:o.label,by:f,reason:`re-blessed onto ${c} (edited in chat)`,skipEcids:O,dstRedirect:L});if(v.errors.length>0){for(let h of v.errors)d.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${h}`});continue}q.push({cid:c,label:o.label,content:r}),I.push(...v.edges),S.push({kind:"node",old:i,new:c,reason:e.reason??"edited in chat",by:f}),S.push(...v.supersessions),N.push({id:c,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!k("enhance",e))continue;for(let o of e.edges){let t=o,r=U(n,t.src),s=U(n,t.dst);if(!r||!s){let[p,Q]=r?["dst",t.dst]:["src",t.src],De=n.resolve(Q)!==null;d.push(De?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${p} '${Q}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${p} got (unknown) for '${Q}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}if((b.enhance[e.eventId]??=[]).push({src:r.cid,dst:s.cid}),t.type===y.DERIVES){let p=Oe.one(L.get(s.cid)??s.cid,t.props,I);if("fault"in p){d.push({code:p.fault.code,detail:`enhance ${e.target}: ${p.fault.detail}`});continue}p.props!==t.props&&(t={...t,props:p.props})}let c=n.nodeLabel.get(r.cid)??"(unknown)",v=n.nodeLabel.get(s.cid)??"(unknown)";for(let p of ee(t.type,c,v,t.props))d.push({code:p.code,detail:`enhance ${e.target}: ${p.detail}`});let h=T(t.type,r.cid,s.cid,t.props),l=L.get(r.cid)??r.cid,E=L.get(s.cid)??s.cid,a=T(t.type,l,E,t.props);if(n.superseded.has(h)||O.has(h)||n.superseded.has(a)){let p=n.superseded.has(h)||O.has(h)?h:a;d.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${p}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(n.edgesFrom(r.cid).some(p=>p.ecid===h)||I.some(p=>p.ecid===a))continue;let u=ye(n,t.type,r.cid,s.cid,se);u&&d.push(u);let x=ge(n,{type:t.type,src:r.cid,dst:s.cid},{pending:[],retracted:O},`enhance ${e.target}`);x&&d.push(x);let A=Z(t.type)?.cardinality;if(A==="one-live-per-src"||A==="one-live-per-src-and-dst"){let p=`${t.type}|${r.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${r.cid}: two one-live edges in one turn`}),j.add(p)}if(A==="one-live-per-src-and-dst"){let p=`${t.type}|dst|${s.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${s.cid}: two one-live edges in one turn (strict 1:1)`}),j.add(p)}I.push({ecid:a,type:t.type,src:l,dst:E,props:t.props}),se.push({src:r.cid,dst:s.cid,type:t.type})}}else if(e.kind==="retract")S.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!Te.has(e.label)){d.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${$.join("|")})`,data:{gate:[...$]}});continue}let i=n.heads.get(e.convSourceId),o=n.convChains.get(e.convSourceId);if(typeof i!="string"||!o){d.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}b.conv[e.eventId]=i;let t=n.getNode(i)?.content?.blob,r=typeof t=="string"?m.getBlob(t)?.toString("utf8")??"":"",s=Se(r,e.cite.turn);if(s===null){d.push({code:"BAD_ANCHOR",detail:`add: ${K(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!ue(e.cite.quote,s)){d.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${K(e.cite.turn)}`});continue}let c=B(e.content);if(c!==null){d.push({code:"DERIVED_FIELD",detail:`add: ${c} is derived from the test's steps, never set by an add; send test_md_blob only`});continue}let v={...P(n,e.label,{},e.content,g.definitionOf),derived:!0},h=G(e.label,v);if(h.length>0){for(let u of h)d.push({code:u.code,detail:`add: ${u.detail}`});continue}let l=M(e.label,v),E={source_id:e.convSourceId,source_cid:i,anchor:K(e.cite.turn),quote:e.cite.quote};for(let u of ee(y.DERIVES,"source",e.label,E))d.push({code:u.code,detail:`add: ${u.detail}`});if(n.hasNode(l)){if(n.superseded.has(l)){d.push({code:"NODE_TOMBSTONED",detail:`add: ${n.nameOf.get(l)??l} already exists and was retired \u2014 restore it deliberately or add it under new content`});continue}I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f}),J.set(e.eventId,l);continue}q.push({cid:l,label:e.label,content:v}),I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f});let a=$e(e.label,u=>ie.has(u),n.names.keys());a!==null&&(ie.add(a),H.push({cid:l,slug:a,by:f})),Y.push({cid:l,...a!==null?{slug:a}:{}}),J.set(e.eventId,l)}if(d.length)return{record:null,errors:d};let re=new Date().toISOString();for(let e of g.learn===!1?[]:_){if(e.kind==="add"){let i=J.get(e.eventId);i&&m.signals().append({ts:re,command:"extract-chat",id:i,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:i});continue}for(let i of Ie(e,{ts:re,command:"extract-chat",by:f}))m.signals().append(i)}let ce=D.map(e=>e.eventId).sort(),we=me(m,{ts:new Date().toISOString(),proposal_id:null,nodes:q,edges:I,review:N,supersessions:S,...H.length>0?{names:H}:{},...F.length>0?{judgements:F}:{},event_ids:ce,...g.sid?{sid:g.sid}:{},source_head_moves:{}},{graph:n,scope:g.scope,expectPrev:C,intent:{v:1,verb:"chat",args:le({ops:R,judgements:g.judgements??null,by:f,mintable:[...$],sid:g.sid??null,...g.learn===!1?{learn:!1}:{}}),pins:b},provenance:g.provenance}),X=ve(m),V=new Set;for(let e of S)if(e.kind==="node"){V.add(e.old);for(let i of X.edgesInto(e.old))V.add(i.src)}for(let e of Y)V.add(e.cid);let Ce=[...V].map(e=>({cid:e,state:X.stale(X.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:we.record,errors:null,applied:ce,skipped:W,minted:Y,staleDelta:Ce}}export{be as a,P as b,ze as c};
2
+ import{a as Re}from"./chunk-LD5B3QFW.js";import{a as K,f as Se}from"./chunk-ZHAMVLQZ.js";import{c as Ie}from"./chunk-ZCIWQHCO.js";import{D as ue,H as ge,I as fe,J as he,L as me,M as ve,N as Ee,W as ye,a as M,b as T,ca as U,f as ae,g as pe,pa as $e,r as le,zb as te}from"./chunk-PI7OXS62.js";import{g as y,h as G,i as Z,j as ee}from"./chunk-KU3YHPWZ.js";var be=["definitionId"],B=g=>be.find(m=>g[m]!==void 0)??null;function P(g,m,n,R,f){let $={...n};for(let[w,C]of Object.entries(R))C!==void 0&&!be.includes(w)&&($[w]=C);if(m==="test"&&typeof R.test_md_blob=="string"){if(f===void 0)throw new Error("a test's steps were edited without the rule for its definition id: pass definitionOf (design/test-definition.ts)");$.definitionId=f(g,R.test_md_blob)}return $}var Ne=new Set([y.EXERCISES,y.VERIFIES,y.SCOPED_TO]),ke=new Set(["approve","edit","reject"]);function ze(g){let{store:m,graph:n,ops:R,by:f}=g,$=g.mintable??Re(),w=m.head(),C=m.serialize(w);if(!m.sameToken(m.parse(n.latestHash),w))return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(C)} \u2014 re-open and retry`}]};let W=[],D=[],ne=new Set;for(let e of R){if(n.appliedEvents.has(e.eventId)||ne.has(e.eventId)){W.push(e.eventId);continue}ne.add(e.eventId),D.push(e)}if(D.length===0)return{record:null,errors:null,applied:[],skipped:W,minted:[],staleDelta:[]};let d=[],q=[],I=[],Oe=pe(ae(m,n)),N=[],S=[],H=[],F=[...g.judgements??[]],Y=[],J=new Map,ie=new Set,se=[],j=new Set,Te=new Set($),de=new Set;for(let e of D){if(!ke.has(e.kind))continue;let i=e.target,o=n.resolve(i),t=o?n.tipOf(o.cid):i;de.has(t)&&d.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${i} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),de.add(t)}let b={targets:{},enhance:{},redirectTo:{},retract:{},conv:{}},k=(e,i)=>{let{target:o,expectedCid:t}=i,r=n.resolve(o);if(!r)return d.push({code:"UNKNOWN_NODE",detail:`${e}: ${o} names nothing in the graph`}),null;let s=n.tipOf(r.cid);if(s!==t||n.superseded.has(t)){let c=te(n,s).includes(t);return d.push({code:"EXPECTED_CID_MOVED",detail:c?`${e}: ${o} moved or was archived since it was displayed`:`${e}: ${o}: the cid given names no version of it, so the edit didn't match it as it is now`,data:{tip:s,target:o,moved:c}}),null}return b.targets[i.eventId]=t,t},z=e=>new Set(te(n,n.tipOf(e))),_=[],O=new Set,oe=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of D){if(e.kind!=="retract"){_.push(e);continue}let i=k("retract",e);if(!i)continue;let o=new Map;for(let s of z(i))for(let c of[...n.edgesFrom(s),...n.edgesInto(s)])o.set(c.ecid,c);let t,r={};if(e.edgeEcid!==void 0){if(n.superseded.has(e.edgeEcid)){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(t=o.get(e.edgeEcid),!t){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let s=e.edgeRef;if(s.type===y.DERIVES){d.push(oe(e.target));continue}let c=(a,u)=>{let x=U(n,u);if(x)return x;let A=n.resolve(u)!==null;return d.push(A?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${s.type} ${a} '${u}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${s.type} ${a} got (unknown) for '${u}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},v=c("dst",s.dst);if(!v)continue;r.dst=v.cid;let h=z(v.cid),l=null;if(s.src!==void 0){let a=c("src",s.src);if(!a)continue;r.src=a.cid,l=z(a.cid)}let E=[...o.values()].filter(a=>a.type===s.type&&h.has(a.dst)&&(l===null||l.has(a.src)));if(E.length===0){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${s.type} edge onto ${s.dst}${s.src!==void 0?` from ${s.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(E.length>1){let a=E.map(u=>`${u.type} ${n.displayNameOf(u.src)??u.src} \u2192 ${n.displayNameOf(u.dst)??u.dst} (${u.ecid})`).join("; ");d.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${E.length} live ${s.type} edges match \u2014 ${a} \u2014 add src to disambiguate`});continue}t=E[0]}else{d.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(t.type===y.DERIVES){d.push(oe(e.target));continue}if(O.has(t.ecid)){d.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${t.ecid} was retracted earlier in this turn`});continue}O.add(t.ecid),b.retract[e.eventId]={ecid:t.ecid,...r},_.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:t.ecid,reason:e.reason,eventId:e.eventId})}let L=new Map;for(let e of _){if(e.kind!=="edit")continue;let i=n.resolve(e.target);if(!i||n.tipOf(i.cid)!==e.expectedCid||n.superseded.has(e.expectedCid))continue;let o=n.getNode(e.expectedCid);if(!o||B(e.edit)!==null)continue;let t=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof t.title=="string"&&!t.title.trim()||G(o.label,t).length>0)continue;let r=M(o.label,t);r!==e.expectedCid&&L.set(e.expectedCid,r)}for(let e of _)if(e.kind==="approve"){let i=k("approve",e);i&&N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let i=k("reject",e);if(!i)continue;if(N.push({id:i,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let o=Ee(n,e.redirectTo);if(!o){d.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}if(o===i){d.push({code:"SELF_SUPERSEDE",detail:`reject.redirectTo: the live version of ${e.redirectTo} is the node being rejected`});continue}b.redirectTo[e.eventId]=o,S.push({kind:"node",old:i,new:o,reason:e.reason,by:f});for(let t of n.edgesInto(i)){if(Z(t.type)?.pin?.comparesTo!=="dst_tip"||n.superseded.has(t.ecid)||n.superseded.has(t.src))continue;let r=`${e.reason} \u2014 ${e.target} merged into ${e.redirectTo}`,s=n.edgesFrom(t.src).some(c=>c.type===t.type&&c.dst===o&&!n.superseded.has(c.ecid));!s&&!Ne.has(t.type)||(S.push({kind:"edge",ecid:t.ecid,reason:r,by:f}),s||I.push({ecid:T(t.type,t.src,o,t.props),type:t.type,src:t.src,dst:o,props:t.props}))}}}else if(e.kind==="edit"){let i=k("edit",e);if(!i)continue;let o=n.getNode(i);if(!o){d.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let t=B(e.edit);if(t!==null){d.push({code:"DERIVED_FIELD",detail:`edit ${e.target}: ${t} is derived from the test's steps, never set by an edit; edit test_md_blob instead`});continue}let r=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof r.title=="string"&&!r.title.trim()){d.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let s=G(o.label,r);if(s.length>0){for(let h of s)d.push({code:h.code,detail:`edit ${e.target}: ${h.detail}`});continue}let c=M(o.label,r);if(c===i){N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(fe(n,i,c)){d.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let v=he({graph:n,oldTip:i,newCid:c,newLabel:o.label,by:f,reason:`re-blessed onto ${c} (edited in chat)`,skipEcids:O,dstRedirect:L});if(v.errors.length>0){for(let h of v.errors)d.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${h}`});continue}q.push({cid:c,label:o.label,content:r}),I.push(...v.edges),S.push({kind:"node",old:i,new:c,reason:e.reason??"edited in chat",by:f}),S.push(...v.supersessions),N.push({id:c,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!k("enhance",e))continue;for(let o of e.edges){let t=o,r=U(n,t.src),s=U(n,t.dst);if(!r||!s){let[p,Q]=r?["dst",t.dst]:["src",t.src],De=n.resolve(Q)!==null;d.push(De?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${p} '${Q}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${p} got (unknown) for '${Q}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}if((b.enhance[e.eventId]??=[]).push({src:r.cid,dst:s.cid}),t.type===y.DERIVES){let p=Oe.one(L.get(s.cid)??s.cid,t.props,I);if("fault"in p){d.push({code:p.fault.code,detail:`enhance ${e.target}: ${p.fault.detail}`});continue}p.props!==t.props&&(t={...t,props:p.props})}let c=n.nodeLabel.get(r.cid)??"(unknown)",v=n.nodeLabel.get(s.cid)??"(unknown)";for(let p of ee(t.type,c,v,t.props))d.push({code:p.code,detail:`enhance ${e.target}: ${p.detail}`});let h=T(t.type,r.cid,s.cid,t.props),l=L.get(r.cid)??r.cid,E=L.get(s.cid)??s.cid,a=T(t.type,l,E,t.props);if(n.superseded.has(h)||O.has(h)||n.superseded.has(a)){let p=n.superseded.has(h)||O.has(h)?h:a;d.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${p}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(n.edgesFrom(r.cid).some(p=>p.ecid===h)||I.some(p=>p.ecid===a))continue;let u=ye(n,t.type,r.cid,s.cid,se);u&&d.push(u);let x=ge(n,{type:t.type,src:r.cid,dst:s.cid},{pending:[],retracted:O},`enhance ${e.target}`);x&&d.push(x);let A=Z(t.type)?.cardinality;if(A==="one-live-per-src"||A==="one-live-per-src-and-dst"){let p=`${t.type}|${r.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${r.cid}: two one-live edges in one turn`}),j.add(p)}if(A==="one-live-per-src-and-dst"){let p=`${t.type}|dst|${s.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${s.cid}: two one-live edges in one turn (strict 1:1)`}),j.add(p)}I.push({ecid:a,type:t.type,src:l,dst:E,props:t.props}),se.push({src:r.cid,dst:s.cid,type:t.type})}}else if(e.kind==="retract")S.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!Te.has(e.label)){d.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${$.join("|")})`,data:{gate:[...$]}});continue}let i=n.heads.get(e.convSourceId),o=n.convChains.get(e.convSourceId);if(typeof i!="string"||!o){d.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}b.conv[e.eventId]=i;let t=n.getNode(i)?.content?.blob,r=typeof t=="string"?m.getBlob(t)?.toString("utf8")??"":"",s=Se(r,e.cite.turn);if(s===null){d.push({code:"BAD_ANCHOR",detail:`add: ${K(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!ue(e.cite.quote,s)){d.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${K(e.cite.turn)}`});continue}let c=B(e.content);if(c!==null){d.push({code:"DERIVED_FIELD",detail:`add: ${c} is derived from the test's steps, never set by an add; send test_md_blob only`});continue}let v={...P(n,e.label,{},e.content,g.definitionOf),derived:!0},h=G(e.label,v);if(h.length>0){for(let u of h)d.push({code:u.code,detail:`add: ${u.detail}`});continue}let l=M(e.label,v),E={source_id:e.convSourceId,source_cid:i,anchor:K(e.cite.turn),quote:e.cite.quote};for(let u of ee(y.DERIVES,"source",e.label,E))d.push({code:u.code,detail:`add: ${u.detail}`});if(n.hasNode(l)){if(n.superseded.has(l)){d.push({code:"NODE_TOMBSTONED",detail:`add: ${n.nameOf.get(l)??l} already exists and was retired \u2014 restore it deliberately or add it under new content`});continue}I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f}),J.set(e.eventId,l);continue}q.push({cid:l,label:e.label,content:v}),I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f});let a=$e(e.label,u=>ie.has(u),n.names.keys());a!==null&&(ie.add(a),H.push({cid:l,slug:a,by:f})),Y.push({cid:l,...a!==null?{slug:a}:{}}),J.set(e.eventId,l)}if(d.length)return{record:null,errors:d};let re=new Date().toISOString();for(let e of g.learn===!1?[]:_){if(e.kind==="add"){let i=J.get(e.eventId);i&&m.signals().append({ts:re,command:"extract-chat",id:i,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:i});continue}for(let i of Ie(e,{ts:re,command:"extract-chat",by:f}))m.signals().append(i)}let ce=D.map(e=>e.eventId).sort(),we=me(m,{ts:new Date().toISOString(),proposal_id:null,nodes:q,edges:I,review:N,supersessions:S,...H.length>0?{names:H}:{},...F.length>0?{judgements:F}:{},event_ids:ce,...g.sid?{sid:g.sid}:{},source_head_moves:{}},{graph:n,scope:g.scope,expectPrev:C,intent:{v:1,verb:"chat",args:le({ops:R,judgements:g.judgements??null,by:f,mintable:[...$],sid:g.sid??null,...g.learn===!1?{learn:!1}:{}}),pins:b},provenance:g.provenance}),X=ve(m),V=new Set;for(let e of S)if(e.kind==="node"){V.add(e.old);for(let i of X.edgesInto(e.old))V.add(i.src)}for(let e of Y)V.add(e.cid);let Ce=[...V].map(e=>({cid:e,state:X.stale(X.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:we.record,errors:null,applied:ce,skipped:W,minted:Y,staleDelta:Ce}}export{be as a,P as b,ze as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-PVN64537.js";import{e as y}from"./chunk-6NFOH4AC.js";import{b as d}from"./chunk-GGV336P5.js";function g(t={}){let a=t.readStore??C,s=t.readLis??w;return{async controller(){let e=await a();return{token:e.token,...e.basic?{basic:e.basic}:{}}},async lis(){return s()}}}var A=()=>C(!0),_=g(),P=8e3;function f(){return y("warn: session auth may expire during long runs \u2014 if that happens, run `kane-cli login` and retry","AUTH_EXCHANGE_FAILED"),null}async function h(t,a,s=!1){try{let[{getEnvironment:e},{ControllerClient:r}]=await Promise.all([import("./config-B472DZSR.js"),import("./controller-client-PB3AZAGG.js")]),o=new r(e(t).controllerBaseUrl,a),i;try{let n=await Promise.race([o.getTmsCredentials().catch(()=>null),new Promise(c=>{i=setTimeout(()=>c(null),P)})]);if(typeof n?.username!="string"||!n.username||typeof n.access_key!="string"||!n.access_key)return s?null:f();try{let[{refreshIdentitySnapshot:c},{telemetryEnvName:u}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-3V6TOO6I.js")]);await c(u(),n)}catch{}return{username:n.username,accessKey:n.access_key}}finally{clearTimeout(i)}}catch{return s?null:f()}}var l=null;function E(t){l=t===null?null:{username:t.username,accessKey:t.accessKey}}async function C(t=!1){if(l!==null)return{token:null,basic:{...l}};let[{CredentialsManager:a},{refreshOAuthToken:s}]=await Promise.all([import("./credentials-TLT3RQOO.js"),import("./token-refresh-LR33BKAB.js")]),e=new a,r=d(),o=e.getActiveProfile()??"default",i=e.loadBasicAuth(o,r);if(i)return{token:null,basic:{username:i.username,accessKey:i.access_key}};let n=e.loadCredentials(o,r);if(!n)throw new m("Not authenticated \u2014 no credentials found","not_authenticated");try{await s({creds:e,profile:o,env:r,credentials:n})}catch{}let c=e.loadCredentials(o,r)??n;if(typeof c.access_token!="string")throw new m("Not authenticated \u2014 no credentials found","not_authenticated");let u=c.access_token,p=await h(r,u,t);return{token:u,...p?{basic:p}:{}}}async function w(){if(l!==null)return{basic:Buffer.from(`${l.username}:${l.accessKey}`,"utf8").toString("base64")};let{CredentialsManager:t}=await import("./credentials-TLT3RQOO.js"),a=new t,s=d(),e=a.loadCredentials(a.getActiveProfile()??"default",s);if(typeof e?.access_token!="string")return{};let r=await h(s,e.access_token,!0);return r?{basic:Buffer.from(`${r.username}:${r.accessKey}`,"utf8").toString("base64")}:{}}export{A as a,_ as b,E as c};
2
+ import{a as m}from"./chunk-PVN64537.js";import{e as y}from"./chunk-ZAQGIC33.js";import{b as d}from"./chunk-ZCBOHWN3.js";function g(t={}){let a=t.readStore??C,s=t.readLis??w;return{async controller(){let e=await a();return{token:e.token,...e.basic?{basic:e.basic}:{}}},async lis(){return s()}}}var A=()=>C(!0),_=g(),P=8e3;function f(){return y("warn: session auth may expire during long runs \u2014 if that happens, run `kane-cli login` and retry","AUTH_EXCHANGE_FAILED"),null}async function h(t,a,s=!1){try{let[{getEnvironment:e},{ControllerClient:r}]=await Promise.all([import("./config-7WTZPMAH.js"),import("./controller-client-PB3AZAGG.js")]),o=new r(e(t).controllerBaseUrl,a),i;try{let n=await Promise.race([o.getTmsCredentials().catch(()=>null),new Promise(c=>{i=setTimeout(()=>c(null),P)})]);if(typeof n?.username!="string"||!n.username||typeof n.access_key!="string"||!n.access_key)return s?null:f();try{let[{refreshIdentitySnapshot:c},{telemetryEnvName:u}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-XGKU4WXB.js")]);await c(u(),n)}catch{}return{username:n.username,accessKey:n.access_key}}finally{clearTimeout(i)}}catch{return s?null:f()}}var l=null;function E(t){l=t===null?null:{username:t.username,accessKey:t.accessKey}}async function C(t=!1){if(l!==null)return{token:null,basic:{...l}};let[{CredentialsManager:a},{refreshOAuthToken:s}]=await Promise.all([import("./credentials-5WIFF5DG.js"),import("./token-refresh-E4FTJVHY.js")]),e=new a,r=d(),o=e.getActiveProfile()??"default",i=e.loadBasicAuth(o,r);if(i)return{token:null,basic:{username:i.username,accessKey:i.access_key}};let n=e.loadCredentials(o,r);if(!n)throw new m("Not authenticated \u2014 no credentials found","not_authenticated");try{await s({creds:e,profile:o,env:r,credentials:n})}catch{}let c=e.loadCredentials(o,r)??n;if(typeof c.access_token!="string")throw new m("Not authenticated \u2014 no credentials found","not_authenticated");let u=c.access_token,p=await h(r,u,t);return{token:u,...p?{basic:p}:{}}}async function w(){if(l!==null)return{basic:Buffer.from(`${l.username}:${l.accessKey}`,"utf8").toString("base64")};let{CredentialsManager:t}=await import("./credentials-5WIFF5DG.js"),a=new t,s=d(),e=a.loadCredentials(a.getActiveProfile()??"default",s);if(typeof e?.access_token!="string")return{};let r=await h(s,e.access_token,!0);return r?{basic:Buffer.from(`${r.username}:${r.accessKey}`,"utf8").toString("base64")}:{}}export{A as a,_ as b,E as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as l}from"./chunk-4I7YN6YY.js";import{existsSync as u,readdirSync as d,readFileSync as f}from"fs";import{join as o}from"path";var m="--variables",g=["global","smart","environment","secrets","totp"],p=/^[a-z][a-z0-9_]*$/;function x(r){return typeof r=="string"?r.trim().length>0:typeof r=="number"&&Number.isFinite(r)}function a(r,e,n){let t=JSON.parse(r);if(!(!t||typeof t!="object")){for(let[i,s]of Object.entries(t))if(s&&typeof s=="object"&&"value"in s){let b={has_value:x(s.value),source:e};n.set(y(i),b)}}}function c(r,e){if(!u(r))return;let n;try{n=d(r).filter(t=>t.endsWith(".json")).sort()}catch{return}for(let t of n){let i=o(r,t);try{a(f(i,"utf-8"),i,e)}catch{}}}function w(r){return{globalDir:o(l().baseDir,"variables"),localDir:o(r,".testmuai","variables")}}function I(r){let e=new Map;if(c(r.globalDir,e),c(r.localDir,e),r.file&&u(r.file))try{a(f(r.file,"utf-8"),r.file,e)}catch{}if(r.inline)try{a(r.inline,m,e)}catch{}return e}function N(r){let e=r.trim();if(!e)return null;let n=e.split(/[.[]/).map(t=>t.trim()).filter(Boolean);return n.length===0||g.includes(n[0])?null:n[0]}function y(r){let e=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(r);return e?e[1]:r}function V(r){if(!r||!r.trim())return"variable name is empty";let e=r.split(".")[0];return g.includes(e)?`'${r}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:p.test(r)?null:`'${r}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}export{m as a,w as b,I as c,N as d,y as e,V as f};
2
+ import{g as l}from"./chunk-HYJVYYAZ.js";import{existsSync as u,readdirSync as d,readFileSync as f}from"fs";import{join as o}from"path";var m="--variables",g=["global","smart","environment","secrets","totp"],p=/^[a-z][a-z0-9_]*$/;function x(r){return typeof r=="string"?r.trim().length>0:typeof r=="number"&&Number.isFinite(r)}function a(r,e,n){let t=JSON.parse(r);if(!(!t||typeof t!="object")){for(let[i,s]of Object.entries(t))if(s&&typeof s=="object"&&"value"in s){let b={has_value:x(s.value),source:e};n.set(y(i),b)}}}function c(r,e){if(!u(r))return;let n;try{n=d(r).filter(t=>t.endsWith(".json")).sort()}catch{return}for(let t of n){let i=o(r,t);try{a(f(i,"utf-8"),i,e)}catch{}}}function w(r){return{globalDir:o(l().baseDir,"variables"),localDir:o(r,".testmuai","variables")}}function I(r){let e=new Map;if(c(r.globalDir,e),c(r.localDir,e),r.file&&u(r.file))try{a(f(r.file,"utf-8"),r.file,e)}catch{}if(r.inline)try{a(r.inline,m,e)}catch{}return e}function N(r){let e=r.trim();if(!e)return null;let n=e.split(/[.[]/).map(t=>t.trim()).filter(Boolean);return n.length===0||g.includes(n[0])?null:n[0]}function y(r){let e=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(r);return e?e[1]:r}function V(r){if(!r||!r.trim())return"variable name is empty";let e=r.split(".")[0];return g.includes(e)?`'${r}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:p.test(r)?null:`'${r}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}export{m as a,w as b,I as c,N as d,y as e,V as f};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as B}from"./chunk-5Y2G4NC7.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as S,b as l,k as w}from"./chunk-33DWJV67.js";import{a as J}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-QMOGBKJM.js";import{e as k}from"./chunk-UR6MHSHU.js";var y=k(J(),1);var r=k(T(),1),v=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function H(e){let n=e.replace(/…$/,"");return n&&n.charAt(0).toLowerCase()+n.slice(1)}function j(e,n){if(e.length<=n)return e;if(n<=1)return"\u2026";let p=Math.ceil((n-1)/2),b=Math.floor((n-1)/2);return`${e.slice(0,p)}\u2026${b>0?e.slice(-b):""}`}function K({status:e,meta:n,tallies:p,keys:b,child:d,cols:C,remote:A=!1,gapAbove:M=!1,accent:u=o.assuranceAccent}){let{stdout:R}=w(),m=C??R?.columns??80,L=e.kind==="working"||e.kind==="child-working",[E,O]=(0,y.useState)(0);B(()=>O(a=>a+1),L?120:null);let $=v[E%v.length],i,s;switch(e.kind){case"working":i=`${$} ${e.step}${e.elapsedS!==void 0?` \xB7 ${e.elapsedS}s`:""}`,s=u;break;case"waiting":i=`\u25CF waiting on you${e.pending?` \u2014 ${e.pending} question${e.pending===1?"":"s"}`:e.label?` \u2014 ${e.label}`:""}`,s=o.amber;break;case"retrying":i=`\u25CF ${e.text}`,s=o.amber;break;case"idle":i="\u25CF idle",s=u;break;case"card":i=`\u25CF card ${e.n} of ${e.m}`,s=o.amber;break;case"child-working":i=`${$} child: ${e.step}`,s=u;break;case"child-waiting":i="\u25CF child waiting on you",s=o.amber;break}let f=d?`${n.verb} \u25B8 ${d.verb}`:n.verb,F=d?.sid?n.sid?`${j(n.sid,14)} \u25B8 ${d.sid}`:d.sid:n.sid,h=n.env==="prod"?"":n.env,t=" \xB7 ",P=16,x=a=>i.length+t.length+[f,a,h].filter(Boolean).join(t).length,c=F,I=m-x(c)-t.length;A&&c&&(n.subject?I<Math.min(n.subject.length,P):x(c)>m)&&(c="");let N=[f,c,h].filter(Boolean),q=i.length+t.length+N.join(t).length,g=n.subject;if(g){let a=m-q-t.length;g=a>=8?j(g,a):void 0}let D=[f,...g?[g]:[],c,h].filter(Boolean).join(t);return(0,r.jsxs)(S,{flexDirection:"column",marginTop:M?1:0,children:[(0,r.jsx)(l,{color:o.muted,children:"\u2500".repeat(Math.max(1,m))}),(0,r.jsxs)(l,{children:[(0,r.jsx)(l,{color:s,children:i}),(0,r.jsx)(l,{color:o.dim,children:`${t}${D}`})]}),(0,r.jsx)(l,{color:o.dim,children:p.items.length>0?p.items.join(t):" "}),(0,r.jsx)(l,{color:o.muted,children:b.join(t)})]})}export{H as a,K as b};
2
+ import{a as B}from"./chunk-5Y2G4NC7.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as S,b as l,k as w}from"./chunk-33DWJV67.js";import{a as J}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-J4FIESTB.js";import{e as k}from"./chunk-UR6MHSHU.js";var y=k(J(),1);var r=k(T(),1),v=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function H(e){let n=e.replace(/…$/,"");return n&&n.charAt(0).toLowerCase()+n.slice(1)}function j(e,n){if(e.length<=n)return e;if(n<=1)return"\u2026";let p=Math.ceil((n-1)/2),b=Math.floor((n-1)/2);return`${e.slice(0,p)}\u2026${b>0?e.slice(-b):""}`}function K({status:e,meta:n,tallies:p,keys:b,child:d,cols:C,remote:A=!1,gapAbove:M=!1,accent:u=o.assuranceAccent}){let{stdout:R}=w(),m=C??R?.columns??80,L=e.kind==="working"||e.kind==="child-working",[E,O]=(0,y.useState)(0);B(()=>O(a=>a+1),L?120:null);let $=v[E%v.length],i,s;switch(e.kind){case"working":i=`${$} ${e.step}${e.elapsedS!==void 0?` \xB7 ${e.elapsedS}s`:""}`,s=u;break;case"waiting":i=`\u25CF waiting on you${e.pending?` \u2014 ${e.pending} question${e.pending===1?"":"s"}`:e.label?` \u2014 ${e.label}`:""}`,s=o.amber;break;case"retrying":i=`\u25CF ${e.text}`,s=o.amber;break;case"idle":i="\u25CF idle",s=u;break;case"card":i=`\u25CF card ${e.n} of ${e.m}`,s=o.amber;break;case"child-working":i=`${$} child: ${e.step}`,s=u;break;case"child-waiting":i="\u25CF child waiting on you",s=o.amber;break}let f=d?`${n.verb} \u25B8 ${d.verb}`:n.verb,F=d?.sid?n.sid?`${j(n.sid,14)} \u25B8 ${d.sid}`:d.sid:n.sid,h=n.env==="prod"?"":n.env,t=" \xB7 ",P=16,x=a=>i.length+t.length+[f,a,h].filter(Boolean).join(t).length,c=F,I=m-x(c)-t.length;A&&c&&(n.subject?I<Math.min(n.subject.length,P):x(c)>m)&&(c="");let N=[f,c,h].filter(Boolean),q=i.length+t.length+N.join(t).length,g=n.subject;if(g){let a=m-q-t.length;g=a>=8?j(g,a):void 0}let D=[f,...g?[g]:[],c,h].filter(Boolean).join(t);return(0,r.jsxs)(S,{flexDirection:"column",marginTop:M?1:0,children:[(0,r.jsx)(l,{color:o.muted,children:"\u2500".repeat(Math.max(1,m))}),(0,r.jsxs)(l,{children:[(0,r.jsx)(l,{color:s,children:i}),(0,r.jsx)(l,{color:o.dim,children:`${t}${D}`})]}),(0,r.jsx)(l,{color:o.dim,children:p.items.length>0?p.items.join(t):" "}),(0,r.jsx)(l,{color:o.muted,children:b.join(t)})]})}export{H as a,K as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{L as c,r as d}from"./chunk-Z777GGHB.js";function u(a,e,t){let{ref:r,reason:o,by:s}=t;if(!o||o.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let i=e.resolve(r);if(!i)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${r}' in the graph`}]};let n=e.tipOf(i.cid);return e.superseded.has(n)?{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${r} is already superseded at its tip (${n.slice(0,19)}\u2026)`}]}:{record:c(a,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:n,new:null,reason:o,by:s}],source_head_moves:{}},{graph:e,expectPrev:e.latestHash,intent:{v:1,verb:"archive",args:d({ref:r,reason:o,by:s}),pins:{ref:n}},provenance:t.provenance}).record,errors:null}}export{u as a};
2
+ import{L as c,r as d}from"./chunk-PI7OXS62.js";function u(a,e,t){let{ref:r,reason:o,by:s}=t;if(!o||o.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let i=e.resolve(r);if(!i)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${r}' in the graph`}]};let n=e.tipOf(i.cid);return e.superseded.has(n)?{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${r} is already superseded at its tip (${n.slice(0,19)}\u2026)`}]}:{record:c(a,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:n,new:null,reason:o,by:s}],source_head_moves:{}},{graph:e,expectPrev:e.latestHash,intent:{v:1,verb:"archive",args:d({ref:r,reason:o,by:s}),pins:{ref:n}},provenance:t.provenance}).record,errors:null}}export{u as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as D}from"./chunk-KGNE5CIM.js";import{a as ue,b as te,d as ce,e as R,k as de}from"./chunk-JCSVBD4F.js";import{mkdirSync as Be,writeFileSync as Ae}from"fs";import{join as X}from"path";var ve="start LT with --env ht-stage|ht-prod --tunnelName <name>; see kane-cli explore run --help";function me(t){if(/either tunnel is not running or disconnected/i.test(t))return`remote browser: no running LT tunnel found for this run (HPS: either tunnel is not running or disconnected)
2
+ import{a as D}from"./chunk-KGNE5CIM.js";import{a as ue,b as te,d as ce,e as R,k as de}from"./chunk-NPAUSUNM.js";import{mkdirSync as Be,writeFileSync as Ae}from"fs";import{join as X}from"path";var ve="start LT with --env ht-stage|ht-prod --tunnelName <name>; see kane-cli explore run --help";function me(t){if(/either tunnel is not running or disconnected/i.test(t))return`remote browser: no running LT tunnel found for this run (HPS: either tunnel is not running or disconnected)
3
3
  next: ${ve}`;let e=/WebSocket error: \S*\/kane-cli\S* (5\d\d)\b/.exec(t)?.[1];if(e){let r=Ee(t);return`remote browser: HPS answered HTTP ${e} to the connect${r?` (HPS: ${r})`:""} (on a tunnel run: the tunnel service failed); run again, and report it to the platform team if it persists`}return null}function Ee(t){let e=t.split(`
4
4
  `).slice(1).find(i=>i.trim()&&!/^Call log:/.test(i.trim())&&!/^\s*-\s*</.test(i));if(!e)return null;let r=e.trim();try{let i=JSON.parse(r),s=i?.value?.message??i?.message;typeof s=="string"&&s.trim()&&(r=s.trim())}catch{}return r=r.replace(/\b(?:wss?|https?):\/\/\S+/g,"<url>"),r.length>300?r.slice(0,300)+"\u2026":r}var Se={baseMs:500,maxMs:3e4},W=class{o;backoff;sleep;nextSeq;draining=null;stopDeadline=null;wake=null;_state="open";_refusal=null;_fatal=null;_committedThisRun=0;constructor(e){this.o=e,this.backoff=e.backoff??Se,this.sleep=e.sleep??(r=>new Promise(i=>setTimeout(i,r))),this.nextSeq=Math.max(e.firstSeq,e.queue.lastParked+1)}get state(){return this._state}get refusal(){return this._refusal}get fatal(){return this._fatal}get pendingCount(){return this.o.queue.pendingCount}get committedThisRun(){return this._committedThisRun}get lastCommitted(){return this.o.queue.lastCommitted}enqueue(e){return e.run_id!==this.o.runId?{ok:!1,code:"RUN_MISMATCH",reason:`delta ${e.seq} names run ${e.run_id}, this run is ${this.o.runId}`}:!Number.isInteger(e.seq)||e.seq!==this.nextSeq?{ok:!1,code:"SEQUENCE_LOCAL",reason:`expected seq ${this.nextSeq} for run ${this.o.runId}, received ${String(e.seq)}`}:(this.o.queue.append(e),this.nextSeq=e.seq+1,this.kick(),{ok:!0})}kick(){this._state==="open"&&(this.draining||(this.draining=this.drainLoop().catch(e=>(this.markFatal(this.o.queue.pending()[0]?.seq??-1,"LOCAL_IO",e instanceof Error?e.message:String(e)),"stopped")).then(e=>{this.draining=null,e==="empty"&&this._state==="open"&&this.o.queue.pendingCount>0&&this.kick()})))}async flush(e){if(this.stopDeadline=Date.now()+e,this.kick(),this.wake){let r=this.wake;this.wake=null,r()}for(;this.draining;)await this.draining;return this.o.queue.pendingCount}async drainLoop(){let e=0;for(;this._state==="open";){let r=this.o.queue.pending()[0];if(!r)return"empty";let i=this.o.queue.refused(r.seq);if(i)return this.refuse(r.seq,i.code,`previously refused: ${i.reason}`,!1),"stopped";let s=await this.o.client.commitDelta(this.o.explorationId,this.o.runId,r);switch(s.kind){case"committed":e=0,this.o.queue.markCommitted(r.seq),this._committedThisRun++,this.o.onAck?.(r.seq);break;case"refused":return this.refuse(r.seq,s.code,s.reason,!0),"stopped";case"fatal":return this.markFatal(r.seq,s.code,s.reason),"stopped";case"transient":{e++;let a=Math.min(this.backoff.maxMs,this.backoff.baseMs*2**(e-1));if(this.stopDeadline!==null&&Date.now()+a>this.stopDeadline)return"deadline";this.o.onRetry?.(r.seq,e,s.reason,a),await this.interruptibleSleep(a);break}}}return"stopped"}markFatal(e,r,i){this._state="fatal",this._fatal={seq:e,code:r,reason:i},this.o.onFatal?.(e,r,i)}refuse(e,r,i,s){s&&this.o.queue.markRefused(e,r,i,{controller_wire:this.o.controllerWire,client_wire:ue}),this._state="refused",this._refusal={seq:e,code:r,reason:i},this.o.onRefused?.(e,r,i)}async interruptibleSleep(e){await Promise.race([this.sleep(e),new Promise(r=>{this.wake=r})]),this.wake=null}};import{appendFileSync as Ce,closeSync as $e,existsSync as Pe,fsyncSync as Te,mkdirSync as Ie,openSync as De,readFileSync as Me}from"fs";import{dirname as Oe,join as Le}from"path";var Fe="pending-deltas.ndjson",Q=class{path;deltas=new Map;committed=new Set;refusedBySeq=new Map;tornTail=!1;constructor(e){this.path=Le(e,Fe),this.load()}append(e){let r=this.deltas.get(e.seq);if(r){if(JSON.stringify(r)===JSON.stringify(e))return;throw new Error(`pending queue already holds a different delta for seq ${e.seq}`)}this.write({op:"delta",seq:e.seq,delta:e}),this.deltas.set(e.seq,e)}markCommitted(e){this.committed.has(e)||(this.write({op:"committed",seq:e}),this.committed.add(e))}markRefused(e,r,i,s={}){let a={...s.controller_wire?{controller_wire:s.controller_wire}:{},...s.client_wire?{client_wire:s.client_wire}:{}};this.write({op:"refused",seq:e,code:r,reason:i,...a}),this.refusedBySeq.set(e,{seq:e,code:r,reason:i,...a})}pending(){return[...this.deltas.entries()].filter(([e])=>!this.committed.has(e)).sort(([e],[r])=>e-r).map(([,e])=>e)}get pendingCount(){return this.pending().length}get lastCommitted(){let e=0;for(let r of this.committed)e=Math.max(e,r);return e}get lastParked(){let e=0;for(let r of this.deltas.keys())e=Math.max(e,r);return e}refused(e){return this.refusedBySeq.get(e)}load(){if(!Pe(this.path))return;let e=Me(this.path,"utf8");this.tornTail=e.length>0&&!e.endsWith(`
5
5
  `);let r=e.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as F}from"./chunk-KDR662D2.js";import{Aa as P,Ca as L,K as $,M as k,Na as V,aa as B,ba as G,ca as I,wa as K}from"./chunk-Z777GGHB.js";var z=3,X=1e4,q=()=>new Promise(o=>setTimeout(o,25+Math.floor(Math.random()*50))),U=o=>o==="design"||o==="maintain"?"session":o==="revert"||o==="shape-op"?"exclusive":"commit";function Q(o,e,p){for(let i of o){for(let c of i.supersessions)if(c.kind==="node"&&(p.has(c.old)||c.new!==null&&p.has(c.new)))return!0;for(let c of i.nodes)if(c.label==="usecase"&&e.newBuCandidates.length>0||p.has(c.cid))return!0;if(i.design_generation&&e.generationTicket&&i.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let c of e.sourcePins)if(Object.prototype.hasOwnProperty.call(i.source_head_moves,c.source_id))return!0}return!1}async function se(o,e,p){let{store:i,locks:c,probe:H}=o,J=o.sid??o.rootSid,v=e.newBuCandidates.map(l=>({tempRef:l.tempRef,probeText:l.probeText})),x=0,w=!0,m={hits:[],degraded:!1,probeBasis:null};for(;;){w&&(v.length>0&&(m=await H.batchSimilar(k(i),v)),w=!1);let l=k(i);i.prefetch($(e,null,l),{token:null});let D={seq:l.lastSeq,hash:l.latestHash},S=new Map,b=[],u=[],C=new Set;for(let n of e.ucTargets){let s=I(l,n.ref);if(s===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${n.ref}: names no living node (unknown or tombstoned chain)`}]};n.expectedTip!==void 0&&n.expectedTip!==s.cid&&S.set(n.expectedTip,s.cid),C.add(s.cid),u.push(L(l,n.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(u.length=0,u.push({kind:"context",mode:"exclusive"}));let g;try{g=c.acquire(P(u),{hold:U(e.verb),verb:e.verb})}catch(n){if(n instanceof K&&(n.code==="UC_HELD"||n.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:n};throw n}let R=!1,N=!1;try{let n=await c.withKeySerialized(u,async()=>{let s=k(i),O=D.hash===s.latestHash?[]:i.recordsSince(i.parse(D.hash));for(let r of e.ucTargets){let t=I(s,r.ref);if(t===null){b.push({kind:"supersession",ref:r.ref,detail:`${r.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let a of C)s.superseded.has(a)&&s.tipOf(a)===t.cid&&S.set(a,t.cid)}for(let r of e.sourcePins){let t=s.heads.get(r.source_id);t!=null&&t!==r.source_cid&&b.push({kind:"pin",ref:r.source_id,detail:`source '${r.source_id}' moved (pinned ${r.source_cid.slice(0,19)}, head ${t.slice(0,19)}) \u2014 re-ground or abandon`})}if(b.length>0)return{ok:!1,kind:"drifted",asks:b};if(e.generationTicket){let r=F(s,e.generationTicket);if(r!==null)return{ok:!1,kind:"validation",errors:[r]}}if(v.length>0&&O.length>0){let r=new Set(m.hits.map(d=>d.candidateCid)),t=H.recheckLocal(s,v,m.probeBasis,O);if(t.hits.some(d=>!r.has(d.candidateCid))||t.uncachedNewNodes.length>0)return N=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let r=P(e.ucTargets.map(d=>L(s,d.ref).key)),t=P(u);if(!(r.length===t.length&&r.every((d,f)=>JSON.stringify(d)===JSON.stringify(t[f]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(r=>s.appliedEvents.has(r)))return{ok:!0,skipped:"already-applied"};let W=Date.now()+X,A=s.latestHash,T=s;for(;;){let r={graph:T,scope:{ucTargets:e.ucTargets,sourcePins:e.sourcePins,...e.generationTicket?{generationTicket:e.generationTicket}:{}},expectPrev:A,redirects:S,probeHits:m.hits,degradedProbe:m.degraded,sid:J,eventIds:(a,d)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,d);let f=G(T,o.rootSid,a,d),j=o.reservedEventIds??[];if(j.length===0)return f;let E=`${o.rootSid}:${a}:`,h=0;for(let _ of j){if(!_.startsWith(E))continue;let y=_.slice(E.length);/^\d+$/.test(y)&&(h=Math.max(h,Number.parseInt(y,10)))}if(h===0)return f;let M=Number.parseInt(f[0].slice(E.length),10);return!Number.isInteger(M)||M>h?f:Array.from({length:d},(_,y)=>B(o.rootSid,a,h+1+y))},assertLocks:()=>g.assertHeld()};if(o.revalidate){let a=o.revalidate(r);if(a.length>0)return{ok:!1,kind:"validation",errors:a}}g.assertHeld();let t;try{t=p(r)}catch(a){if(a instanceof V){let d=k(i),f=i.recordsSince(i.parse(T.latestHash));if(!Q(f,e,C)&&Date.now()<W){await q(),T=d,A=d.latestHash;continue}return"restart"}throw a}return"errors"in t?{ok:!1,kind:"validation",errors:t.errors}:(U(e.verb)==="session"&&g.touch(),{ok:!0,result:t.result,record:t.record})}});if(n==="restart")R=!0;else return n}finally{g.release()}if(R){if(x+=1,x>=z)return{ok:!1,kind:"unsettled",attempts:x};N&&(w=!0),await q();continue}}}export{se as a};
2
+ import{d as F}from"./chunk-3KY7HHQU.js";import{Aa as P,Ca as L,K as $,M as k,Na as V,aa as B,ba as G,ca as I,wa as K}from"./chunk-PI7OXS62.js";var z=3,X=1e4,q=()=>new Promise(o=>setTimeout(o,25+Math.floor(Math.random()*50))),U=o=>o==="design"||o==="maintain"?"session":o==="revert"||o==="shape-op"?"exclusive":"commit";function Q(o,e,p){for(let i of o){for(let c of i.supersessions)if(c.kind==="node"&&(p.has(c.old)||c.new!==null&&p.has(c.new)))return!0;for(let c of i.nodes)if(c.label==="usecase"&&e.newBuCandidates.length>0||p.has(c.cid))return!0;if(i.design_generation&&e.generationTicket&&i.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let c of e.sourcePins)if(Object.prototype.hasOwnProperty.call(i.source_head_moves,c.source_id))return!0}return!1}async function se(o,e,p){let{store:i,locks:c,probe:H}=o,J=o.sid??o.rootSid,v=e.newBuCandidates.map(l=>({tempRef:l.tempRef,probeText:l.probeText})),x=0,w=!0,m={hits:[],degraded:!1,probeBasis:null};for(;;){w&&(v.length>0&&(m=await H.batchSimilar(k(i),v)),w=!1);let l=k(i);i.prefetch($(e,null,l),{token:null});let D={seq:l.lastSeq,hash:l.latestHash},S=new Map,b=[],u=[],C=new Set;for(let n of e.ucTargets){let s=I(l,n.ref);if(s===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${n.ref}: names no living node (unknown or tombstoned chain)`}]};n.expectedTip!==void 0&&n.expectedTip!==s.cid&&S.set(n.expectedTip,s.cid),C.add(s.cid),u.push(L(l,n.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(u.length=0,u.push({kind:"context",mode:"exclusive"}));let g;try{g=c.acquire(P(u),{hold:U(e.verb),verb:e.verb})}catch(n){if(n instanceof K&&(n.code==="UC_HELD"||n.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:n};throw n}let R=!1,N=!1;try{let n=await c.withKeySerialized(u,async()=>{let s=k(i),O=D.hash===s.latestHash?[]:i.recordsSince(i.parse(D.hash));for(let r of e.ucTargets){let t=I(s,r.ref);if(t===null){b.push({kind:"supersession",ref:r.ref,detail:`${r.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let a of C)s.superseded.has(a)&&s.tipOf(a)===t.cid&&S.set(a,t.cid)}for(let r of e.sourcePins){let t=s.heads.get(r.source_id);t!=null&&t!==r.source_cid&&b.push({kind:"pin",ref:r.source_id,detail:`source '${r.source_id}' moved (pinned ${r.source_cid.slice(0,19)}, head ${t.slice(0,19)}) \u2014 re-ground or abandon`})}if(b.length>0)return{ok:!1,kind:"drifted",asks:b};if(e.generationTicket){let r=F(s,e.generationTicket);if(r!==null)return{ok:!1,kind:"validation",errors:[r]}}if(v.length>0&&O.length>0){let r=new Set(m.hits.map(d=>d.candidateCid)),t=H.recheckLocal(s,v,m.probeBasis,O);if(t.hits.some(d=>!r.has(d.candidateCid))||t.uncachedNewNodes.length>0)return N=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let r=P(e.ucTargets.map(d=>L(s,d.ref).key)),t=P(u);if(!(r.length===t.length&&r.every((d,f)=>JSON.stringify(d)===JSON.stringify(t[f]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(r=>s.appliedEvents.has(r)))return{ok:!0,skipped:"already-applied"};let W=Date.now()+X,A=s.latestHash,T=s;for(;;){let r={graph:T,scope:{ucTargets:e.ucTargets,sourcePins:e.sourcePins,...e.generationTicket?{generationTicket:e.generationTicket}:{}},expectPrev:A,redirects:S,probeHits:m.hits,degradedProbe:m.degraded,sid:J,eventIds:(a,d)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,d);let f=G(T,o.rootSid,a,d),j=o.reservedEventIds??[];if(j.length===0)return f;let E=`${o.rootSid}:${a}:`,h=0;for(let _ of j){if(!_.startsWith(E))continue;let y=_.slice(E.length);/^\d+$/.test(y)&&(h=Math.max(h,Number.parseInt(y,10)))}if(h===0)return f;let M=Number.parseInt(f[0].slice(E.length),10);return!Number.isInteger(M)||M>h?f:Array.from({length:d},(_,y)=>B(o.rootSid,a,h+1+y))},assertLocks:()=>g.assertHeld()};if(o.revalidate){let a=o.revalidate(r);if(a.length>0)return{ok:!1,kind:"validation",errors:a}}g.assertHeld();let t;try{t=p(r)}catch(a){if(a instanceof V){let d=k(i),f=i.recordsSince(i.parse(T.latestHash));if(!Q(f,e,C)&&Date.now()<W){await q(),T=d,A=d.latestHash;continue}return"restart"}throw a}return"errors"in t?{ok:!1,kind:"validation",errors:t.errors}:(U(e.verb)==="session"&&g.touch(),{ok:!0,result:t.result,record:t.record})}});if(n==="restart")R=!0;else return n}finally{g.release()}if(R){if(x+=1,x>=z)return{ok:!1,kind:"unsettled",attempts:x};N&&(w=!0),await q();continue}}}export{se as a};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{readFileSync as u,readdirSync as i}from"fs";import{join as l}from"path";var m={tunnel:"On a real device: route the device's traffic through your running LT tunnel, to reach a private or local app backend. Start LT first under the same account (no --env for a run from this machine, --env ht-prod with --remote) and keep it up until the run ends",tunnelName:"On a real device: the LT tunnel to use, by its --tunnelName (implies --tunnel; default: your one running tunnel)"};function o(n){let e=n.tunnelName;if(e!==void 0){let t=String(e).trim();return!t||/[\u0000-\u001f\u007f]/.test(t)?{error:"--tunnel-name: the name the LT tunnel was started with (--tunnelName)"}:{tunnel:{name:t}}}return{tunnel:n.tunnel===!0?{name:null}:null}}function s(n){let e=o(n);return"error"in e?null:e.tunnel}function h(n){return n?{tunnel:!0,...n.name?{tunnel_name:n.name}:{}}:{}}function g(n){let e=s(n);return e?e.name?["--tunnel","--tunnel-name",e.name]:["--tunnel"]:[]}function p(n){return n?.name?`tunnelNames:
3
+ - ${JSON.stringify(n.name)}
4
+ `:""}var a=/either tunnel is not running or disconnected/i;function c(n){return!n||!a.test(n)?null:["failed to start: the mobile hub refused the tunnel (hub: either tunnel is not running or disconnected)","next: check that"," - an LT tunnel is running under this account"," - only one is running, or pass --tunnel-name <name>"," - it was started with no --env for a run from this machine, or --env ht-prod for --remote (ht-stage on stage)"].join(`
5
+ `)}function T(n){let e;try{e=i(n)}catch{return null}for(let t of e)try{let r=c(u(l(n,t,"runner-stderr.log"),"utf8"));if(r)return r}catch{}return null}function y(n){let e=/ERR::TUN::\w+\s+(.+?)(?:\s{2,}|$)/.exec(n)?.[1];return e?`${e}
6
+ next: start LT with --env ht-prod (ht-stage on stage) --tunnelName <name>, under the same account`:null}export{m as a,o as b,s as c,h as d,g as e,p as f,c as g,T as h,y as i};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as r}from"./chunk-4I7YN6YY.js";import{createHash as a}from"crypto";import{existsSync as c,readFileSync as _}from"fs";import{join as u}from"path";var f=2;function g(t,e){let n=a("sha256");return n.update(`kane-assurance-contract
2
+ import{g as r}from"./chunk-HYJVYYAZ.js";import{createHash as a}from"crypto";import{existsSync as c,readFileSync as _}from"fs";import{join as u}from"path";var f=2;function g(t,e){let n=a("sha256");return n.update(`kane-assurance-contract
3
3
  `),n.update(t),n.update(`
4
4
  agent_state_schema=${e}`),"sha256:"+n.digest("hex")}function T(){let t=r().packageRoot;return t===null?[]:[t]}function o(){return"sha256:cab026e32fe3172059e3abaf947cb161a4d0a36a82a084f017fa34ba8d562d8e"}var s=class extends Error{constructor(n,i){super(`agent/cli contract mismatch (cli ${n||"<unset>"}, agent ${i||"<unset>"}) \u2014 rebuild or reinstall the stale half`);this.expected=n;this.actual=i;this.name="PairMismatchError"}};function S(){return{TESTMUAI_CONTRACT_DIGEST:o(),TESTMUAI_CLIENT_VERSION:process.env.KANE_DEV_FORCE_CLIENT_RELEASE??`kane-cli/${r().version}`}}export{s as a,S as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{N as y}from"./chunk-Z777GGHB.js";import{f as d,g as m}from"./chunk-KU3YHPWZ.js";var b={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},E=.75;function u(e,s){return!e.superseded.has(s)&&e.trust.get(s)!=="archived"}function S(e,s){return e.edgesInto(s).some(n=>n.type===m.VERIFIES&&u(e,n.src))}function p(e,s="med"){let n=e.risk;return n==="high"||n==="med"||n==="low"?n:s}function l(e,s){return e.displayNameOf(s)??s}function g(e,s){return`kane-cli design tests --use-case ${l(e,s)}`}function _(e,s){let n=(r,o)=>{for(let c of e.edgesFrom(o)){let f=c.type===r?y(e,c.dst):null;if(f!==null&&u(e,f))return f}return null},t=n(m.SCOPED_TO,s);if(!t)return null;let i=e.nodeLabel.get(t);return i===d.USECASE?t:i===d.SCENARIO?n(m.BELONGS_TO,t):null}function w(e,s){let n=_(e,s);return n?g(e,n):G(e,s)}function G(e,s){return`kane-cli design explain ${l(e,s)}`}function h(e,s){let n=e.edgesFrom(s).find(i=>i.type===m.AUTOMATES&&u(e,i.dst));if(!n)return null;let t=e.edgesFrom(n.dst).find(i=>i.type===m.BELONGS_TO&&u(e,i.dst));return t?t.dst:null}function x(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC))u(e,n)&&(S(e,n)||s.push({ref:l(e,n),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:p(t),stage:"design",tag:"create",ready_command:w(e,n)}));return s}function L(e){let s=[],n=new Map;for(let{cid:t}of e.byLabel(d.SCENARIO))if(u(e,t))for(let i of e.edgesFrom(t)){if(i.type!==m.BELONGS_TO)continue;let r=e.tipOf(i.dst);(n.get(r)??n.set(r,new Set).get(r)).add(t)}for(let{cid:t,content:i}of e.byLabel(d.USECASE)){if(!u(e,t))continue;let r=[...n.get(t)??[]];if(r.length===0){s.push({ref:l(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)});continue}r.every(c=>e.getNode(c)?.content.case_type==="happy")&&s.push({ref:l(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)})}return s}function C(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.GAP)){if(!u(e,n))continue;let i=t.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&u(e,r.tip)?r.tip:null,c=o?e.nodeLabel.get(o):null,f=t.kind==="reconcile_deferred"?"kane-cli maintain reconcile":c===d.USECASE?g(e,o):c===d.AC?w(e,o):G(e,n),a=t.question&&typeof t.question=="object"?t.question:void 0,v=typeof t.text=="string"&&t.text||(a&&typeof a.header=="string"?a.header:"")||"design gap";s.push({ref:l(e,n),kind:String(t.kind),why:v,risk:p(t),stage:"design",tag:"create",ready_command:f,...typeof t.risk_rationale=="string"?{risk_rationale:t.risk_rationale}:{},...a?{question:a}:{}})}return s}function O(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC)){if(!u(e,n))continue;let i=e.stale(n);i==="fresh"||i==="superseded"||s.push({ref:l(e,n),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${l(e,n)}`,risk:p(t),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:n,content:t}of e.byLabel(d.TEST)){if(!u(e,n))continue;let i=e.stale(n);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(n).filter(k=>k.type===m.VERIFIES&&u(e,k.dst)),o=r.map(k=>p(e.getNode(k.dst)?.content??{})),c=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",f=r[0]?.dst??null,a=f?null:h(e,n),v=f?w(e,f):a?g(e,a):G(e,n);s.push({ref:l(e,n),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:c,stage:"design",tag:"evolve",ready_command:v})}return s}async function A(e,s,n){for(let t of e)if(t.tag==="create"){if(!n){t.meta={embed_arm:"skipped"};continue}try{let i=s.resolve(t.ref),r=i?s.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||t.why,c=r?.label===d.USECASE?"scenario":"test",a=(await n.searchSimilar(o,{label:c,k:1}))[0];a&&a.score>=E?(t.tag="reuse-candidate",t.meta={embed_arm:"used",near_hit:{ref:l(s,a.cid),score:a.score}}):t.meta={embed_arm:"used",near_hit:null}}catch{t.meta={embed_arm:"skipped"}}}}function T(e,s){let n=b[s.risk]-b[e.risk];if(n!==0)return n;let t=R[e.tag]-R[s.tag];return t!==0?t:e.ref<s.ref?-1:e.ref>s.ref?1:0}function N(e,s){let n=[],t=r=>{let o=y(e,r);return o?p(e.getNode(o)?.content??{}):"med"},i=r=>{let o=y(e,r),c=o?_(e,o):null;return c?l(e,c):r};for(let r of s.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?n.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:t(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?n.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&n.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return n}async function U(e,s,n,t){if(s!=="design"&&!t)throw new Error(`gaps-engine: stage "${s}" requires a pack's usecases doc`);let i=[];return(s==="design"||s==="all")&&i.push(...x(e),...L(e),...C(e),...O(e)),(s==="cover"||s==="all")&&i.push(...N(e,t)),await A(i,e,n),i.sort(T),i}export{u as a,S as b,_ as c,U as d};
2
+ import{N as y}from"./chunk-PI7OXS62.js";import{f as d,g as m}from"./chunk-KU3YHPWZ.js";var b={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},E=.75;function u(e,s){return!e.superseded.has(s)&&e.trust.get(s)!=="archived"}function S(e,s){return e.edgesInto(s).some(n=>n.type===m.VERIFIES&&u(e,n.src))}function p(e,s="med"){let n=e.risk;return n==="high"||n==="med"||n==="low"?n:s}function l(e,s){return e.displayNameOf(s)??s}function g(e,s){return`kane-cli design tests --use-case ${l(e,s)}`}function _(e,s){let n=(r,o)=>{for(let c of e.edgesFrom(o)){let f=c.type===r?y(e,c.dst):null;if(f!==null&&u(e,f))return f}return null},t=n(m.SCOPED_TO,s);if(!t)return null;let i=e.nodeLabel.get(t);return i===d.USECASE?t:i===d.SCENARIO?n(m.BELONGS_TO,t):null}function w(e,s){let n=_(e,s);return n?g(e,n):G(e,s)}function G(e,s){return`kane-cli design explain ${l(e,s)}`}function h(e,s){let n=e.edgesFrom(s).find(i=>i.type===m.AUTOMATES&&u(e,i.dst));if(!n)return null;let t=e.edgesFrom(n.dst).find(i=>i.type===m.BELONGS_TO&&u(e,i.dst));return t?t.dst:null}function x(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC))u(e,n)&&(S(e,n)||s.push({ref:l(e,n),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:p(t),stage:"design",tag:"create",ready_command:w(e,n)}));return s}function L(e){let s=[],n=new Map;for(let{cid:t}of e.byLabel(d.SCENARIO))if(u(e,t))for(let i of e.edgesFrom(t)){if(i.type!==m.BELONGS_TO)continue;let r=e.tipOf(i.dst);(n.get(r)??n.set(r,new Set).get(r)).add(t)}for(let{cid:t,content:i}of e.byLabel(d.USECASE)){if(!u(e,t))continue;let r=[...n.get(t)??[]];if(r.length===0){s.push({ref:l(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)});continue}r.every(c=>e.getNode(c)?.content.case_type==="happy")&&s.push({ref:l(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)})}return s}function C(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.GAP)){if(!u(e,n))continue;let i=t.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&u(e,r.tip)?r.tip:null,c=o?e.nodeLabel.get(o):null,f=t.kind==="reconcile_deferred"?"kane-cli maintain reconcile":c===d.USECASE?g(e,o):c===d.AC?w(e,o):G(e,n),a=t.question&&typeof t.question=="object"?t.question:void 0,v=typeof t.text=="string"&&t.text||(a&&typeof a.header=="string"?a.header:"")||"design gap";s.push({ref:l(e,n),kind:String(t.kind),why:v,risk:p(t),stage:"design",tag:"create",ready_command:f,...typeof t.risk_rationale=="string"?{risk_rationale:t.risk_rationale}:{},...a?{question:a}:{}})}return s}function O(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC)){if(!u(e,n))continue;let i=e.stale(n);i==="fresh"||i==="superseded"||s.push({ref:l(e,n),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${l(e,n)}`,risk:p(t),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:n,content:t}of e.byLabel(d.TEST)){if(!u(e,n))continue;let i=e.stale(n);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(n).filter(k=>k.type===m.VERIFIES&&u(e,k.dst)),o=r.map(k=>p(e.getNode(k.dst)?.content??{})),c=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",f=r[0]?.dst??null,a=f?null:h(e,n),v=f?w(e,f):a?g(e,a):G(e,n);s.push({ref:l(e,n),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:c,stage:"design",tag:"evolve",ready_command:v})}return s}async function A(e,s,n){for(let t of e)if(t.tag==="create"){if(!n){t.meta={embed_arm:"skipped"};continue}try{let i=s.resolve(t.ref),r=i?s.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||t.why,c=r?.label===d.USECASE?"scenario":"test",a=(await n.searchSimilar(o,{label:c,k:1}))[0];a&&a.score>=E?(t.tag="reuse-candidate",t.meta={embed_arm:"used",near_hit:{ref:l(s,a.cid),score:a.score}}):t.meta={embed_arm:"used",near_hit:null}}catch{t.meta={embed_arm:"skipped"}}}}function T(e,s){let n=b[s.risk]-b[e.risk];if(n!==0)return n;let t=R[e.tag]-R[s.tag];return t!==0?t:e.ref<s.ref?-1:e.ref>s.ref?1:0}function N(e,s){let n=[],t=r=>{let o=y(e,r);return o?p(e.getNode(o)?.content??{}):"med"},i=r=>{let o=y(e,r),c=o?_(e,o):null;return c?l(e,c):r};for(let r of s.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?n.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:t(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?n.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&n.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return n}async function U(e,s,n,t){if(s!=="design"&&!t)throw new Error(`gaps-engine: stage "${s}" requires a pack's usecases doc`);let i=[];return(s==="design"||s==="all")&&i.push(...x(e),...L(e),...C(e),...O(e)),(s==="cover"||s==="all")&&i.push(...N(e,t)),await A(i,e,n),i.sort(T),i}export{u as a,S as b,_ as c,U as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as k}from"./chunk-7DFBOVUB.js";import{existsSync as l,mkdirSync as H,readFileSync as S,readdirSync as I,renameSync as E,rmSync as f,writeFileSync as R,openSync as $,closeSync as D}from"fs";import{randomBytes as F}from"crypto";import{join as y}from"path";var M=["agent_state","pending","assumed","read_basis","corpus_cursor","expires_at","force","conv_source","held_receipts","force_scope","user_session_id","checkpoint","target_pins","ingest_registry","ingest_schedule","reconcile"],c=class extends Error{constructor(t,r){super(`${t}: ${r}`);this.code=t}},A=1440*60*1e3;function B(n,e){return n.expires===!1?null:e.expires_at}function T(n,e){return new Date(n.expires_at).getTime()<=e.getTime()}function K(n){return new Date(n.getTime()+A).toISOString()}var O=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function U(n,e,t){if(t!==void 0)return"a resumed run keeps the session it resumes";if(!O.test(e))return`${JSON.stringify(e)} is not a session id`;let r;try{r=n.peek(e)!==null}catch{r=!0}return r?`a session named ${e} exists already; resume it, or name a new session`:null}var v=n=>y(n,"sessions"),h=(n,e)=>y(v(n),e),p=(n,e)=>y(h(n,e),"state.json"),w=(n,e)=>y(h(n,e),".lock"),N=n=>(n?.now??(()=>new Date))();function L(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function x(n,e){let t=`${n}.tmp-${process.pid}`,r=$(t,"w");try{R(r,e,{mode:384}),k(r)}finally{D(r)}E(t,n)}function b(n,e,t,r=0){if(r>20)throw new c("SESSION_LOCKED",`${e}: lock contention did not settle`);let s=w(n,e),i=F(8).toString("hex"),o=JSON.stringify({pid:process.pid,ts:t.toISOString(),nonce:i})+`
2
+ import{a as k}from"./chunk-YJAQZMJT.js";import{existsSync as l,mkdirSync as H,readFileSync as S,readdirSync as I,renameSync as E,rmSync as f,writeFileSync as R,openSync as $,closeSync as D}from"fs";import{randomBytes as F}from"crypto";import{join as y}from"path";var M=["agent_state","pending","assumed","read_basis","corpus_cursor","expires_at","force","conv_source","held_receipts","force_scope","user_session_id","checkpoint","target_pins","ingest_registry","ingest_schedule","reconcile"],c=class extends Error{constructor(t,r){super(`${t}: ${r}`);this.code=t}},A=1440*60*1e3;function B(n,e){return n.expires===!1?null:e.expires_at}function T(n,e){return new Date(n.expires_at).getTime()<=e.getTime()}function K(n){return new Date(n.getTime()+A).toISOString()}var O=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function U(n,e,t){if(t!==void 0)return"a resumed run keeps the session it resumes";if(!O.test(e))return`${JSON.stringify(e)} is not a session id`;let r;try{r=n.peek(e)!==null}catch{r=!0}return r?`a session named ${e} exists already; resume it, or name a new session`:null}var v=n=>y(n,"sessions"),h=(n,e)=>y(v(n),e),p=(n,e)=>y(h(n,e),"state.json"),w=(n,e)=>y(h(n,e),".lock"),N=n=>(n?.now??(()=>new Date))();function L(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function x(n,e){let t=`${n}.tmp-${process.pid}`,r=$(t,"w");try{R(r,e,{mode:384}),k(r)}finally{D(r)}E(t,n)}function b(n,e,t,r=0){if(r>20)throw new c("SESSION_LOCKED",`${e}: lock contention did not settle`);let s=w(n,e),i=F(8).toString("hex"),o=JSON.stringify({pid:process.pid,ts:t.toISOString(),nonce:i})+`
3
3
  `;try{let a=$(s,"wx",384);return R(a,o),D(a),i}catch(a){if(a.code!=="EEXIST")throw a;let g=!1,u;try{let d=JSON.parse(S(s,"utf8")),C=t.getTime()-new Date(d.ts).getTime();g=!L(d.pid)||C>=A,u=d.nonce}catch{g=!0}if(!g)throw new c("SESSION_LOCKED",`${e} is held by another live process`);let _=`${s}.break-${i}`;try{E(s,_);let d;try{d=JSON.parse(S(_,"utf8"))}catch{d=null}if(d===null||d.nonce===u)f(_,{force:!0});else try{E(_,s)}catch{f(_,{force:!0})}}catch(d){if(d.code!=="ENOENT")throw d}return b(n,e,t,r+1)}}function J(n,e){let t=n,r=()=>e.owned?.(),s=(i,o)=>{let a={...i,engine_forms:1};e.write(a,o),t=a};return{get state(){return t},isApplied:i=>t.applied_events.includes(i),markApplied(i){r(),s({...t,applied_events:[...new Set([...t.applied_events,...i])].sort()},"state")},reconcileSave(i){r(),s({...t,applied_events:[...new Set([...t.applied_events,...i.appliedEvents])].sort(),held_receipts:i.heldReceipts,pending:i.pending},"state")},save(i){r();let o={...t};for(let a of M)i[a]!==void 0&&(o[a]=i[a]);s(o,i.checkpoint!==void 0?"pointer":"state")},complete(i){r(),e.complete(i)},release(){e.release()}}}function G(n){return{...{schema:1,applied_events:[],...n},schema:1,applied_events:[],engine_forms:1}}function j(n,e,t={}){if(t.expires!==!1&&T(n,e))throw new c("SESSION_EXPIRED",`${n.sid} expired at ${n.expires_at}`);if((n.engine_forms??0)>1)throw new c("SESSION_FORMS_NEWER",`${n.sid} was saved by an engine whose forms are version ${n.engine_forms}; this one reads version ${1} \u2014 resume it with a newer one`);return{...n,expires_at:K(e),engine_forms:1}}function P(n,e,t){let r=()=>{try{if(JSON.parse(S(w(n,e),"utf8")).nonce!==t)throw new c("SESSION_LOCK_LOST",`${e} lock was taken over`)}catch(s){throw s instanceof c?s:new c("SESSION_LOCK_LOST",`${e} lock file unreadable/gone`)}};return{write:s=>x(p(n,e),JSON.stringify(s)+`
4
4
  `),owned:r,complete:()=>f(h(n,e),{recursive:!0,force:!0}),release:()=>{try{r(),f(w(n,e),{force:!0})}catch(s){if(s instanceof c||s.code==="ENOENT")return;throw s}}}}function V(n,e,t){if(!O.test(e.sid))throw new c("SESSION_MISSING",`bad sid ${JSON.stringify(e.sid)}`);let r=N(t);if(l(p(n,e.sid)))throw new c("SESSION_LOCKED",`${e.sid} already exists \u2014 resume it`);H(h(n,e.sid),{recursive:!0,mode:448});let s=b(n,e.sid,r),i=G(e);return x(p(n,e.sid),JSON.stringify(i)+`
5
5
  `),J(i,P(n,e.sid,s))}function ee(n,e,t){if(!O.test(e)||!l(p(n,e)))throw new c("SESSION_MISSING",`no session ${e}`);let r=N(t),s=b(n,e,r),i=JSON.parse(S(p(n,e),"utf8")),o;try{o=j(i,r)}catch(a){throw f(w(n,e),{force:!0}),a}return x(p(n,e),JSON.stringify(o)+`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as k,b as y}from"./chunk-3BSYOCSW.js";import{b as N,d as h,e as S,f as w}from"./chunk-GRURFGBP.js";import{b as f,c as p,f as m}from"./chunk-MYZHOBS4.js";import{a as b}from"./chunk-B7ZX5HEN.js";import{existsSync as R,readFileSync as T}from"fs";var x=`kane-cli couldn't tell if this is a secret, so it's marked as one; set "secret": false if it isn't`;function O(e){let t=k(e.cwd),i=p(f(e.cwd)),n=j(t),o=[],c=new Set,u=[];for(let r of e.tests){let s=q(r);if(s===null)continue;let l=new Set;s.forEach((d,v)=>{let P=d===null?[]:N(d).filter(a=>!l.has(a));if(v===0&&d!==null)for(let a of h(d))c.add(a);for(let a of P)o.includes(a)||o.push(a);if(d!==null)for(let a of w(d))l.add(a)}),S({surfaceRequired:r.surfaceRequired===!0,firstStep:s[0],...r.target!==void 0?{target:r.target}:{}})&&u.push({test:r.test,title:r.title,...r.file?{file:r.file}:{}})}let g=o.filter(r=>i.get(r)?.has_value!==!0),_=[...g.filter(r=>c.has(r)),...g.filter(r=>!c.has(r))];return{file:t,variables:_.map(r=>{let s=E(n[r]),l=s!==void 0&&typeof s.secret=="boolean";return{name:r,...l?{secret:s.secret}:{secret:!0},...l?s.description!==void 0?{description:s.description}:{}:{description:s?.description?`${s.description}; ${x}`:x},...c.has(r)?{start_page:!0}:{}}}),noStartPage:u}}function J(e){let t=[];for(let i of e.ids){let n=e.graph.resolve(i),o=n?e.graph.getNode(n.tip):null;o?.label==="test"&&t.push(V(i,o.content))}return O({tests:t,cwd:e.cwd})}function V(e,t,i){let{title:n,test_md_blob:o,target:c}=t,u=t.check;return{test:e,title:typeof n=="string"?n:e,blob:typeof o=="string"?o:"",...i?{file:i}:{},...t.surface_required===!0||u?.surface_required===!0?{surfaceRequired:!0}:{},...typeof c=="string"?{target:c}:{}}}function D(e,t){let i=e.variables.filter(n=>m(n.name)===null);i.length!==0&&y({file:e.file,declarations:i.map(n=>({name:n.name,description:n.description??"",secret:n.secret===!0})),known:p(f(t))})}function q(e){try{return b(`${e.test}_test.md`,e.blob).steps.map(t=>t.body.kind==="objective"?t.body.text:null)}catch{return null}}function I(e){return e instanceof SyntaxError?"a variables file here isn't valid JSON":e instanceof Error?e.message:String(e)}function E(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function j(e){if(!R(e))return{};try{let t=JSON.parse(T(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}export{O as a,J as b,V as c,D as d,I as e};
2
+ import{a as k,b as y}from"./chunk-U2VYTVKV.js";import{b as N,d as h,e as S,f as w}from"./chunk-32MFECUA.js";import{b as f,c as p,f as m}from"./chunk-EHB55V23.js";import{a as b}from"./chunk-B7ZX5HEN.js";import{existsSync as R,readFileSync as T}from"fs";var x=`kane-cli couldn't tell if this is a secret, so it's marked as one; set "secret": false if it isn't`;function O(e){let t=k(e.cwd),i=p(f(e.cwd)),n=j(t),o=[],c=new Set,u=[];for(let r of e.tests){let s=q(r);if(s===null)continue;let l=new Set;s.forEach((d,v)=>{let P=d===null?[]:N(d).filter(a=>!l.has(a));if(v===0&&d!==null)for(let a of h(d))c.add(a);for(let a of P)o.includes(a)||o.push(a);if(d!==null)for(let a of w(d))l.add(a)}),S({surfaceRequired:r.surfaceRequired===!0,firstStep:s[0],...r.target!==void 0?{target:r.target}:{}})&&u.push({test:r.test,title:r.title,...r.file?{file:r.file}:{}})}let g=o.filter(r=>i.get(r)?.has_value!==!0),_=[...g.filter(r=>c.has(r)),...g.filter(r=>!c.has(r))];return{file:t,variables:_.map(r=>{let s=E(n[r]),l=s!==void 0&&typeof s.secret=="boolean";return{name:r,...l?{secret:s.secret}:{secret:!0},...l?s.description!==void 0?{description:s.description}:{}:{description:s?.description?`${s.description}; ${x}`:x},...c.has(r)?{start_page:!0}:{}}}),noStartPage:u}}function J(e){let t=[];for(let i of e.ids){let n=e.graph.resolve(i),o=n?e.graph.getNode(n.tip):null;o?.label==="test"&&t.push(V(i,o.content))}return O({tests:t,cwd:e.cwd})}function V(e,t,i){let{title:n,test_md_blob:o,target:c}=t,u=t.check;return{test:e,title:typeof n=="string"?n:e,blob:typeof o=="string"?o:"",...i?{file:i}:{},...t.surface_required===!0||u?.surface_required===!0?{surfaceRequired:!0}:{},...typeof c=="string"?{target:c}:{}}}function D(e,t){let i=e.variables.filter(n=>m(n.name)===null);i.length!==0&&y({file:e.file,declarations:i.map(n=>({name:n.name,description:n.description??"",secret:n.secret===!0})),known:p(f(t))})}function q(e){try{return b(`${e.test}_test.md`,e.blob).steps.map(t=>t.body.kind==="objective"?t.body.text:null)}catch{return null}}function I(e){return e instanceof SyntaxError?"a variables file here isn't valid JSON":e instanceof Error?e.message:String(e)}function E(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function j(e){if(!R(e))return{};try{let t=JSON.parse(T(e,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}export{O as a,J as b,V as c,D as d,I as e};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{m as n}from"./chunk-4I7YN6YY.js";var g={prod:"https://kaneai-api.lambdatest.com/v16-controller/v1",stage:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1"};function d(e=process.env){return e.TESTMUAI_BASE_URL||g[e.TESTMUAI_ENV==="stage"?"stage":"prod"]}function h(e=process.env){return e.TESTMUAI_BASE_URL&&e.TESTMUAI_ENV!=="stage"?"note: TESTMUAI_BASE_URL applies to context/design commands only \u2014 run/testmd use your configured environment":null}async function _(e,s=process.env,l=fetch){let o=d(s),f=`${o}/assurance/turn`,a={"Content-Type":"application/json"},c=e.TESTMUAI_BASIC_AUTH??s.TESTMUAI_BASIC_AUTH,i=e.TESTMUAI_API_KEY??s.TESTMUAI_API_KEY;c?a.Authorization=`Basic ${c}`:i&&(a.Authorization=`Bearer ${i}`);let t,u="";try{let r=await l(f,{method:"POST",headers:a,body:"{}",signal:AbortSignal.timeout(8e3)});t=r.status,t===401&&(u=await r.text().catch(()=>""))}catch(r){return{ok:!1,final:!1,cause:"unreachable",message:n().text("note.controller_unreachable",{base:o,error:r instanceof Error?r.message:String(r)})}}return t===404?{ok:!1,final:!0,cause:"unsupported",message:n().text("note.assurance_unsupported",{})}:t>=500?{ok:!1,final:!1,cause:"unreachable",message:n().text("note.controller_unreachable",{base:o,error:`HTTP ${t}`})}:t===401&&p(u)?{ok:!1,final:!1,cause:"login_unchecked",message:n().text("note.controller_unreachable",{base:o,error:"HTTP 401: it could not check the credentials"})}:t===401?{ok:!1,final:!0,cause:"rejected",message:n().text("note.credentials_rejected",{env:s.TESTMUAI_ENV??"prod"})}:{ok:!0}}function p(e){try{return JSON.parse(e).error==="authentication failed"}catch{return!1}}export{d as a,h as b,_ as c};
2
+ import{o as n}from"./chunk-HYJVYYAZ.js";var g={prod:"https://kaneai-api.lambdatest.com/v16-controller/v1",stage:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1"};function d(e=process.env){return e.TESTMUAI_BASE_URL||g[e.TESTMUAI_ENV==="stage"?"stage":"prod"]}function h(e=process.env){return e.TESTMUAI_BASE_URL&&e.TESTMUAI_ENV!=="stage"?"note: TESTMUAI_BASE_URL applies to context/design commands only \u2014 run/testmd use your configured environment":null}async function _(e,s=process.env,l=fetch){let o=d(s),f=`${o}/assurance/turn`,a={"Content-Type":"application/json"},c=e.TESTMUAI_BASIC_AUTH??s.TESTMUAI_BASIC_AUTH,i=e.TESTMUAI_API_KEY??s.TESTMUAI_API_KEY;c?a.Authorization=`Basic ${c}`:i&&(a.Authorization=`Bearer ${i}`);let t,u="";try{let r=await l(f,{method:"POST",headers:a,body:"{}",signal:AbortSignal.timeout(8e3)});t=r.status,t===401&&(u=await r.text().catch(()=>""))}catch(r){return{ok:!1,final:!1,cause:"unreachable",message:n().text("note.controller_unreachable",{base:o,error:r instanceof Error?r.message:String(r)})}}return t===404?{ok:!1,final:!0,cause:"unsupported",message:n().text("note.assurance_unsupported",{})}:t>=500?{ok:!1,final:!1,cause:"unreachable",message:n().text("note.controller_unreachable",{base:o,error:`HTTP ${t}`})}:t===401&&p(u)?{ok:!1,final:!1,cause:"login_unchecked",message:n().text("note.controller_unreachable",{base:o,error:"HTTP 401: it could not check the credentials"})}:t===401?{ok:!1,final:!0,cause:"rejected",message:n().text("note.credentials_rejected",{env:s.TESTMUAI_ENV??"prod"})}:{ok:!0}}function p(e){try{return JSON.parse(e).error==="authentication failed"}catch{return!1}}export{d as a,h as b,_ as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{C,D as L,E as b,e as S}from"./chunk-Z777GGHB.js";import{m as c}from"./chunk-4I7YN6YY.js";function x(o){return o.replace(/\n$/,"").split(`
2
+ import{C,D as L,E as b,e as S}from"./chunk-PI7OXS62.js";import{o as c}from"./chunk-HYJVYYAZ.js";function x(o){return o.replace(/\n$/,"").split(`
3
3
  `).map((l,i)=>`${String(i+1).padStart(4,"0")}| ${l}`).join(`
4
4
  `)}function T(o,d,l){if(!o.quote)return o;let i=C(l,o.anchor);if(i!==null&&L(o.quote,i))return o;let s=b(d,o.quote);if(s.length!==1)return"gone-or-ambiguous";let[{index:t,length:r}]=s,h=d.slice(0,t).split(`
5
5
  `).length,e=d.slice(0,t+r).replace(/\n$/,"").split(`
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as I,c as L,e as _,f as B,g as V,h as P,i as $,k as H}from"./chunk-2GE5X2A5.js";import{Ua as M,qa as R,ra as k,ta as E,ua as F,va as N,xa as j}from"./chunk-Z777GGHB.js";import{i as w}from"./chunk-DBMW3VUN.js";import{l as y,m as v,n as C,o as b}from"./chunk-HHW6MRU3.js";function me(e){return{index:e,reverse:null,memo:new Map,nameOfMap:null,predecessors:null,fresh:null}}function he(e){e.reverse=null,e.nameOfMap=null,e.predecessors=null,e.fresh=null,e.memo.clear()}function Se(e,s){(s.edges??[]).length>0&&(e.reverse=null),e.nameOfMap=null,e.predecessors=null,e.fresh=null;for(let t of s.nodes??[])e.memo.delete(t.cid)}var Z=(e,s)=>{for(let t of s){let o=e.get(t.dst);o?o.push(t):e.set(t.dst,[t])}},Q=e=>{if(e.reverse===null){let s=new Map;for(let t of Object.values(e.index.forward))Z(s,t);e.reverse=s}return e.reverse},q=e=>{if(e.nameOfMap===null){e.nameOfMap=new Map;for(let[s,t]of Object.entries(e.index.names))e.nameOfMap.set(t,s)}return e.nameOfMap},m=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),a=(e,s)=>e!==void 0&&m(e,s)?e[s]:void 0;function Oe(e,s){let t=(n,r)=>{if(n.memo.has(r))return n.memo.get(r);let i=m(n.index.nodeLabel,r)?s(r):null;return n.memo.set(r,i),i},o=n=>r=>m(n.index.superseded,r)?n.index.superseded[r]:void 0,d=(n,r)=>R(r,o(n)),p=(n,r)=>F(r,i=>q(n).get(i),i=>(n.predecessors??=E(Object.entries(n.index.superseded),l=>m(n.index.nodeLabel,l)?n.index.nodeLabel[l]:void 0)).get(i)),g=(n,r)=>{let i=k(r,{hasNode:l=>m(n.index.nodeLabel,l),cidOfName:l=>a(n.index.names,l),headOf:l=>a(n.index.heads,l)});return i===null?null:{cid:i,tip:d(n,i)}},c=(n,r)=>(r??[]).filter(i=>!m(n.index.superseded,i.ecid)),u=(n,r)=>c(n,a(n.index.forward,r)),x=(n,r)=>c(n,Q(n).get(r)),J=(n,r)=>(n.fresh??=w({supersededBy:o(n),edgesInto:i=>x(n,i),edgesFrom:i=>u(n,i),headOf:i=>a(n.index.heads,i),convChain:i=>a(n.index.conv,i)?.chain,pluginOf:i=>a(n.index.media,i)?.plugin}))(r),T=(n,r)=>N(r,o(n),()=>Object.entries(n.index.superseded),i=>a(n.index.nodeLabel,i));return{getNode:(n,r)=>t(e(r),n),labelOf:(n,r)=>a(e(r).index.nodeLabel,n)??null,trustOf:(n,r)=>a(e(r).index.trust,n)??null,supersededBy:(n,r)=>o(e(r))(n),tipOf:(n,r)=>d(e(r),n),headOf:(n,r)=>a(e(r).index.heads,n),mediaOf:(n,r)=>a(e(r).index.media,n)??null,nameOf:(n,r)=>p(e(r),n),assignedName:(n,r)=>q(e(r)).get(n)??null,cidOfName:(n,r)=>a(e(r).index.names,n)??null,edgesFrom:(n,r)=>u(e(r),n),edgesInto:(n,r)=>x(e(r),n),execHistory:(n,r)=>{let i=e(r),l=g(i,n);if(!l)return[];let h=T(i,l.cid),S=[];for(let[f,O]of Object.entries(i.index.exec??{}))h.has(f)&&S.push(...O);return S.sort((f,O)=>f.started_at<O.started_at?-1:f.started_at>O.started_at?1:0)},archivedReason:(n,r)=>a(e(r).index.archivedReason,n)??null,designFacts:(n,r)=>({generation:a(e(r).index.design_generation,n)??null}),completenessOf:(n,r)=>{let i=a(e(r).index.completeness,n);if(!i)return null;let{seq:l,...h}=i;return h},convChain:(n,r)=>a(e(r).index.conv,n)??null,byLabel:(n,r)=>Object.entries(e(r).index.nodeLabel).filter(([,i])=>i===n).map(([i])=>i),staleList:n=>{let r=e(n);return Object.keys(r.index.nodeLabel).map(i=>({cid:i,state:J(r,i)})).filter(i=>i.state!=="fresh")},allNames:n=>Object.entries(e(n).index.names).map(([r,i])=>({slug:r,cid:i})),extractedSources:n=>[...e(n).index.extracted],designOf:(n,r)=>a(e(r).index.design_of,n)??null,appliedEvent:(n,r)=>{let i=a(e(r).index.eventDigests,n);return i===void 0?null:{digest:i}},nodeIds:n=>Object.entries(e(n).index.nodeLabel).map(([r,i])=>({cid:r,label:i})),sourceIds:n=>Object.entries(e(n).index.heads).map(([r,i])=>({sourceId:r,head:i})),supersessions:n=>Object.entries(e(n).index.superseded).map(([r,i])=>({id:r,next:i})),retractedEdges:n=>{let r=e(n),i=r.index.edgeRetractions??{},l=[];for(let h of Object.values(r.index.forward))for(let S of h){let f=i[S.ecid];f&&l.push({edge:S,retraction:f})}return l},appliedEventsAt:n=>[...e(n).index.appliedEvents],factIds:(n,r)=>{let i=e(n).index,l=r==="trust"?i.trust:r==="archivedReason"?i.archivedReason:r==="designOf"?i.design_of??{}:r==="designGeneration"?i.design_generation??{}:r==="completeness"?i.completeness??{}:i.conv;return Object.keys(l)}}}import{readFileSync as U,rmdirSync as X}from"fs";import{join as D}from"path";function Y(e,s){return{persistCheckpoint:(t,o,d,p)=>V(e(t.state.sid),t,o,d,p),loadCheckpoint:t=>P(e(t),t,()=>s(t)),initCheckpoints:(t,o)=>_(e(t),o),hasBase:t=>e(t).read(I)!==null,gcOrphans:(t,o)=>H(e(t),o)}}function Fe(e){return{create:(s,t)=>y(e,s,t),resume:(s,t)=>v(e,s,t),peek:s=>C(e,s),list:()=>b(e),...Y(s=>L(e,s),s=>B(e,s)),appliedEvents:s=>$(e,s),recordCount:(s,t)=>M(e).records.filter(o=>o.sid===s&&o.seq<=t).length,isLive:s=>{try{let t=JSON.parse(U(D(e,"sessions",s,".lock"),"utf8"));return typeof t.pid=="number"&&j(t.pid)}catch{return!1}},tidy:()=>{try{X(D(e,"sessions"))}catch{}}}}import{existsSync as G,mkdirSync as A,readdirSync as ee,readFileSync as ne,writeFileSync as re}from"fs";import{dirname as te,join as K}from"path";var W=e=>`rationale/${e.startsWith("sha256:")?e.slice(7):e}.yaml`;function ie(e){let s=t=>{let o=e.read(t);return o===null?null:{text:o,where:e.where(t)}};return{override:t=>s(t),profiles:()=>e.list("profiles").filter(t=>t.endsWith(".yaml")||t.endsWith(".yml")).sort().map(t=>{let o=s(`profiles/${t}`);if(o===null)throw new Error(`the design profile ${e.where(`profiles/${t}`)} is listed but cannot be read`);return o}),writeRationale:(t,o)=>{let d=W(t);return e.write(d,o),e.where(d)},readRationale:t=>e.read(W(t))}}function se(e){let s=K(e,"design"),t=o=>K(s,...o.split("/"));return{read:o=>G(t(o))?ne(t(o),"utf8"):null,list:o=>G(t(o))?ee(t(o)):[],write:(o,d)=>{A(te(t(o)),{recursive:!0}),re(t(o),d)},where:t}}function Ie(e){return ie(se(e))}import{mkdirSync as oe,readFileSync as de,renameSync as ae,writeFileSync as le}from"fs";import{dirname as pe,join as ce}from"path";var ge=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function z(e,s,t,o){if(!ge.test(t))throw new Error(`the purpose ${JSON.stringify(t)} is not a plain name`);let d=o.slice(o.indexOf(":")+1);return ce(e,"embeddings",s,t,d.slice(0,2),`${d.slice(2)}.f32`)}function Ve(e){return{read(s,t,o){let d=z(e,s,t,o),p;try{p=de(d)}catch{return null}let g=new Float32Array(Math.floor(p.length/4));for(let c=0;c<g.length;c++)g[c]=p.readFloatLE(c*4);return g},write(s,t,o,d){let p=z(e,s,t,o);oe(pe(p),{recursive:!0});let g=Buffer.alloc(d.length*4);for(let u=0;u<d.length;u++)g.writeFloatLE(d[u],u*4);let c=`${p}.tmp`;le(c,g),ae(c,p)},prefetch:()=>{}}}function Pe(){let e=new Map,s=(t,o,d)=>`${t}
2
+ import{b as I,c as L,e as _,f as B,g as V,h as P,i as $,k as H}from"./chunk-LLQWEGXD.js";import{Ua as M,qa as R,ra as k,ta as E,ua as F,va as N,xa as j}from"./chunk-PI7OXS62.js";import{i as w}from"./chunk-DBMW3VUN.js";import{l as y,m as v,n as C,o as b}from"./chunk-G4K3TP2I.js";function me(e){return{index:e,reverse:null,memo:new Map,nameOfMap:null,predecessors:null,fresh:null}}function he(e){e.reverse=null,e.nameOfMap=null,e.predecessors=null,e.fresh=null,e.memo.clear()}function Se(e,s){(s.edges??[]).length>0&&(e.reverse=null),e.nameOfMap=null,e.predecessors=null,e.fresh=null;for(let t of s.nodes??[])e.memo.delete(t.cid)}var Z=(e,s)=>{for(let t of s){let o=e.get(t.dst);o?o.push(t):e.set(t.dst,[t])}},Q=e=>{if(e.reverse===null){let s=new Map;for(let t of Object.values(e.index.forward))Z(s,t);e.reverse=s}return e.reverse},q=e=>{if(e.nameOfMap===null){e.nameOfMap=new Map;for(let[s,t]of Object.entries(e.index.names))e.nameOfMap.set(t,s)}return e.nameOfMap},m=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),a=(e,s)=>e!==void 0&&m(e,s)?e[s]:void 0;function Oe(e,s){let t=(n,r)=>{if(n.memo.has(r))return n.memo.get(r);let i=m(n.index.nodeLabel,r)?s(r):null;return n.memo.set(r,i),i},o=n=>r=>m(n.index.superseded,r)?n.index.superseded[r]:void 0,d=(n,r)=>R(r,o(n)),p=(n,r)=>F(r,i=>q(n).get(i),i=>(n.predecessors??=E(Object.entries(n.index.superseded),l=>m(n.index.nodeLabel,l)?n.index.nodeLabel[l]:void 0)).get(i)),g=(n,r)=>{let i=k(r,{hasNode:l=>m(n.index.nodeLabel,l),cidOfName:l=>a(n.index.names,l),headOf:l=>a(n.index.heads,l)});return i===null?null:{cid:i,tip:d(n,i)}},c=(n,r)=>(r??[]).filter(i=>!m(n.index.superseded,i.ecid)),u=(n,r)=>c(n,a(n.index.forward,r)),x=(n,r)=>c(n,Q(n).get(r)),J=(n,r)=>(n.fresh??=w({supersededBy:o(n),edgesInto:i=>x(n,i),edgesFrom:i=>u(n,i),headOf:i=>a(n.index.heads,i),convChain:i=>a(n.index.conv,i)?.chain,pluginOf:i=>a(n.index.media,i)?.plugin}))(r),T=(n,r)=>N(r,o(n),()=>Object.entries(n.index.superseded),i=>a(n.index.nodeLabel,i));return{getNode:(n,r)=>t(e(r),n),labelOf:(n,r)=>a(e(r).index.nodeLabel,n)??null,trustOf:(n,r)=>a(e(r).index.trust,n)??null,supersededBy:(n,r)=>o(e(r))(n),tipOf:(n,r)=>d(e(r),n),headOf:(n,r)=>a(e(r).index.heads,n),mediaOf:(n,r)=>a(e(r).index.media,n)??null,nameOf:(n,r)=>p(e(r),n),assignedName:(n,r)=>q(e(r)).get(n)??null,cidOfName:(n,r)=>a(e(r).index.names,n)??null,edgesFrom:(n,r)=>u(e(r),n),edgesInto:(n,r)=>x(e(r),n),execHistory:(n,r)=>{let i=e(r),l=g(i,n);if(!l)return[];let h=T(i,l.cid),S=[];for(let[f,O]of Object.entries(i.index.exec??{}))h.has(f)&&S.push(...O);return S.sort((f,O)=>f.started_at<O.started_at?-1:f.started_at>O.started_at?1:0)},archivedReason:(n,r)=>a(e(r).index.archivedReason,n)??null,designFacts:(n,r)=>({generation:a(e(r).index.design_generation,n)??null}),completenessOf:(n,r)=>{let i=a(e(r).index.completeness,n);if(!i)return null;let{seq:l,...h}=i;return h},convChain:(n,r)=>a(e(r).index.conv,n)??null,byLabel:(n,r)=>Object.entries(e(r).index.nodeLabel).filter(([,i])=>i===n).map(([i])=>i),staleList:n=>{let r=e(n);return Object.keys(r.index.nodeLabel).map(i=>({cid:i,state:J(r,i)})).filter(i=>i.state!=="fresh")},allNames:n=>Object.entries(e(n).index.names).map(([r,i])=>({slug:r,cid:i})),extractedSources:n=>[...e(n).index.extracted],designOf:(n,r)=>a(e(r).index.design_of,n)??null,appliedEvent:(n,r)=>{let i=a(e(r).index.eventDigests,n);return i===void 0?null:{digest:i}},nodeIds:n=>Object.entries(e(n).index.nodeLabel).map(([r,i])=>({cid:r,label:i})),sourceIds:n=>Object.entries(e(n).index.heads).map(([r,i])=>({sourceId:r,head:i})),supersessions:n=>Object.entries(e(n).index.superseded).map(([r,i])=>({id:r,next:i})),retractedEdges:n=>{let r=e(n),i=r.index.edgeRetractions??{},l=[];for(let h of Object.values(r.index.forward))for(let S of h){let f=i[S.ecid];f&&l.push({edge:S,retraction:f})}return l},appliedEventsAt:n=>[...e(n).index.appliedEvents],factIds:(n,r)=>{let i=e(n).index,l=r==="trust"?i.trust:r==="archivedReason"?i.archivedReason:r==="designOf"?i.design_of??{}:r==="designGeneration"?i.design_generation??{}:r==="completeness"?i.completeness??{}:i.conv;return Object.keys(l)}}}import{readFileSync as U,rmdirSync as X}from"fs";import{join as D}from"path";function Y(e,s){return{persistCheckpoint:(t,o,d,p)=>V(e(t.state.sid),t,o,d,p),loadCheckpoint:t=>P(e(t),t,()=>s(t)),initCheckpoints:(t,o)=>_(e(t),o),hasBase:t=>e(t).read(I)!==null,gcOrphans:(t,o)=>H(e(t),o)}}function Fe(e){return{create:(s,t)=>y(e,s,t),resume:(s,t)=>v(e,s,t),peek:s=>C(e,s),list:()=>b(e),...Y(s=>L(e,s),s=>B(e,s)),appliedEvents:s=>$(e,s),recordCount:(s,t)=>M(e).records.filter(o=>o.sid===s&&o.seq<=t).length,isLive:s=>{try{let t=JSON.parse(U(D(e,"sessions",s,".lock"),"utf8"));return typeof t.pid=="number"&&j(t.pid)}catch{return!1}},tidy:()=>{try{X(D(e,"sessions"))}catch{}}}}import{existsSync as G,mkdirSync as A,readdirSync as ee,readFileSync as ne,writeFileSync as re}from"fs";import{dirname as te,join as K}from"path";var W=e=>`rationale/${e.startsWith("sha256:")?e.slice(7):e}.yaml`;function ie(e){let s=t=>{let o=e.read(t);return o===null?null:{text:o,where:e.where(t)}};return{override:t=>s(t),profiles:()=>e.list("profiles").filter(t=>t.endsWith(".yaml")||t.endsWith(".yml")).sort().map(t=>{let o=s(`profiles/${t}`);if(o===null)throw new Error(`the design profile ${e.where(`profiles/${t}`)} is listed but cannot be read`);return o}),writeRationale:(t,o)=>{let d=W(t);return e.write(d,o),e.where(d)},readRationale:t=>e.read(W(t))}}function se(e){let s=K(e,"design"),t=o=>K(s,...o.split("/"));return{read:o=>G(t(o))?ne(t(o),"utf8"):null,list:o=>G(t(o))?ee(t(o)):[],write:(o,d)=>{A(te(t(o)),{recursive:!0}),re(t(o),d)},where:t}}function Ie(e){return ie(se(e))}import{mkdirSync as oe,readFileSync as de,renameSync as ae,writeFileSync as le}from"fs";import{dirname as pe,join as ce}from"path";var ge=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function z(e,s,t,o){if(!ge.test(t))throw new Error(`the purpose ${JSON.stringify(t)} is not a plain name`);let d=o.slice(o.indexOf(":")+1);return ce(e,"embeddings",s,t,d.slice(0,2),`${d.slice(2)}.f32`)}function Ve(e){return{read(s,t,o){let d=z(e,s,t,o),p;try{p=de(d)}catch{return null}let g=new Float32Array(Math.floor(p.length/4));for(let c=0;c<g.length;c++)g[c]=p.readFloatLE(c*4);return g},write(s,t,o,d){let p=z(e,s,t,o);oe(pe(p),{recursive:!0});let g=Buffer.alloc(d.length*4);for(let u=0;u<d.length;u++)g.writeFloatLE(d[u],u*4);let c=`${p}.tmp`;le(c,g),ae(c,p)},prefetch:()=>{}}}function Pe(){let e=new Map,s=(t,o,d)=>`${t}
3
3
  ${o}
4
4
  ${d}`;return{read:(t,o,d)=>e.get(s(t,o,d))??null,write:(t,o,d,p)=>{e.set(s(t,o,d),p)},prefetch:()=>{}}}export{me as a,he as b,Se as c,Oe as d,Y as e,Fe as f,ie as g,Ie as h,Ve as i,Pe as j};
@@ -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-G3J4XY3Z.js";import{h as P,i as k}from"./chunk-ORNVIEUA.js";import{h as R,i as b,j as h,k as S}from"./chunk-I2VU2DTS.js";import{n as w,o as I,p as x}from"./chunk-RLOJH5O6.js";import{Ia as _,M as f}from"./chunk-Z777GGHB.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-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:
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,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{i as d}from"./chunk-XMPTFXPW.js";import{c as a}from"./chunk-6K5BEEAJ.js";import{Ha as o}from"./chunk-TLOYTGVT.js";async function p(e,l,s){let n=l.project,i=l.local===!0;if(n===void 0&&!i)return{kind:"none"};if(n!==void 0&&i)return r(o.folderFlagsBoth());if(l.resume!==void 0)return r(o.folderFlagWithResume(n!==void 0?"--project":"--local"));if(e.kind==="refuse")return r(e.refusal);if(e.kind==="local")return i?{kind:"none"}:r(o.folderWorksLocally());if(e.kind==="remote")return i?r(o.folderLinkedNotLocal(e.projectName)):n===e.projectId?{kind:"none"}:r(o.folderLinkedElsewhere(e.projectName));if(i)return{kind:"local"};let c;try{c=await s.getProject(n)}catch(t){if(t instanceof d)return r({code:t.code,message:t.message,...t.remedy?{remedy:t.remedy}:{}});if(t instanceof a)return r(o.noConnection());throw t}return c===null?r(o.projectIdUnknown(n,l.agent===!0)):{kind:"link",projectId:c.id,projectName:c.name}}var r=e=>({kind:"refuse",refusal:e}),g=e=>({...e.project!==void 0?{project:e.project}:{},...e.local===!0?{local:!0}:{}});export{p as a,g as b};
2
+ import{i as d}from"./chunk-XMPTFXPW.js";import{c as a}from"./chunk-SB26HQO7.js";import{Ha as o}from"./chunk-WE7HRAGO.js";async function p(e,l,s){let n=l.project,i=l.local===!0;if(n===void 0&&!i)return{kind:"none"};if(n!==void 0&&i)return r(o.folderFlagsBoth());if(l.resume!==void 0)return r(o.folderFlagWithResume(n!==void 0?"--project":"--local"));if(e.kind==="refuse")return r(e.refusal);if(e.kind==="local")return i?{kind:"none"}:r(o.folderWorksLocally());if(e.kind==="remote")return i?r(o.folderLinkedNotLocal(e.projectName)):n===e.projectId?{kind:"none"}:r(o.folderLinkedElsewhere(e.projectName));if(i)return{kind:"local"};let c;try{c=await s.getProject(n)}catch(t){if(t instanceof d)return r({code:t.code,message:t.message,...t.remedy?{remedy:t.remedy}:{}});if(t instanceof a)return r(o.noConnection());throw t}return c===null?r(o.projectIdUnknown(n,l.agent===!0)):{kind:"link",projectId:c.id,projectName:c.name}}var r=e=>({kind:"refuse",refusal:e}),g=e=>({...e.project!==void 0?{project:e.project}:{},...e.local===!0?{local:!0}:{}});export{p as a,g as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-A3TCFSCK.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as d,b as c,i as A}from"./chunk-33DWJV67.js";import{a as D}from"./chunk-6YGTRKDT.js";import{m as u,z as o}from"./chunk-QMOGBKJM.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(u).map(i=>{let e=P(u,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(u,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(u,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(d,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(d,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
2
+ import{a as b}from"./chunk-YCVEI7BT.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as d,b as c,i as A}from"./chunk-33DWJV67.js";import{a as D}from"./chunk-6YGTRKDT.js";import{m as u,z as o}from"./chunk-J4FIESTB.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(u).map(i=>{let e=P(u,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(u,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(u,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(d,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(d,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as o,e as p}from"./chunk-XMPTFXPW.js";import{a as m}from"./chunk-RQKMSNEU.js";import{d,f as c}from"./chunk-2L3A5NKZ.js";import{Ia as a}from"./chunk-Z777GGHB.js";import{resolve as l}from"path";async function g(s,w,t={}){let r=c({verb:s,mode:"cli",contextRoot:l(process.cwd(),".context"),env:d(),write:t.write,sessionId:m()}),n=()=>{o(t.mode??"")!=="ndjson"&&process.stderr.write(r.supportFooter()+`
2
+ import{b as o,e as p}from"./chunk-XMPTFXPW.js";import{a as m}from"./chunk-RQKMSNEU.js";import{d,f as c}from"./chunk-7YV2FCN4.js";import{Ia as a}from"./chunk-PI7OXS62.js";import{resolve as l}from"path";async function g(s,w,t={}){let r=c({verb:s,mode:"cli",contextRoot:l(process.cwd(),".context"),env:d(),write:t.write,sessionId:m()}),n=()=>{o(t.mode??"")!=="ndjson"&&process.stderr.write(r.supportFooter()+`
3
3
  `)};try{let e=await w(r);return t.write&&e===0&&await r.lateBindContext(l(process.cwd(),".context")),e===1&&n(),await r.end({exit_code:e}),e}catch(e){if(e instanceof a){if(o(t.mode??"")==="ndjson"){let i=p("ndjson",t.streamVerb??s,{stdout:y=>process.stdout.write(y),stderr:()=>{}});i.event({type:"sync_error",code:e.code,detail:e.message,remedy:e.remedy}),i.done(2,"refused")}else process.stderr.write(`error: ${e.message}
4
4
  next: ${e.remedy}
5
5
  `);return r.error("rebase_open"),await r.end({exit_code:2}),2}throw r.error("cli_crash"),n(),await r.end({exit_code:1}),e}}export{g as a};