@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,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as X,c as oe}from"./chunk-H4KPNGY4.js";import{b as ae}from"./chunk-I6S6DZ2E.js";import{a as ie,b as W,c as B,d as F,e as V,f as M,g as J,h as S}from"./chunk-SB6P5EQH.js";import{a as re}from"./chunk-HD6NR44L.js";import{M as L,R as ne,S as se,xb as P}from"./chunk-Z777GGHB.js";import{f as k,g as q}from"./chunk-KU3YHPWZ.js";import{d as Q,m as $}from"./chunk-4I7YN6YY.js";function I(e,t){(e.err??e.out)(`error: ${t}`)}function Y(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[i,r]of e.names)if(e.tipOf(r)===t)return i;return t}function fe(e,t){return{ucTip:t,display:Y(e,t),seamRef:e.nameOf.get(t)??t}}function ye(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let i=n.tip,r=e.nodeLabel.get(i);if(!r||!W.has(r))return{ok:!1,message:`'${t}' is a ${r??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let o=F(e,i,r);return!o||e.nodeLabel.get(o)!==k.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${r} chain is broken`}:e.superseded.has(o)?{ok:!1,message:`use-case ${Y(e,o)} was removed \u2014 nothing to evolve`}:e.trust.get(o)==="archived"?{ok:!1,message:`use-case ${Y(e,o)} was archived \u2014 nothing to evolve`}:{ok:!0,target:fe(e,o)}}function We(e,t){return j(e,t)}function j(e,t){let n=[];for(let{cid:r}of e.byLabel(k.SCENARIO)){if(!B(e,r)||!e.edgesFrom(r).some(s=>s.type===q.BELONGS_TO&&e.tipOf(s.dst)===t))continue;let o=e.edgesInto(r).filter(s=>s.type===q.AUTOMATES&&B(e,s.src));if(o.length===0)n.push({scenario:r,test:null});else for(let s of o)n.push({scenario:r,test:s.src})}let i=new Map;for(let{cid:r}of e.byLabel(k.AC)){if(!B(e,r)||F(e,r,k.AC)!==t)continue;let o=e.edgesInto(r).filter(s=>s.type===q.VERIFIES&&B(e,s.src)).map(s=>s.src).sort();i.set(r,o)}return{pairs:n,verifies:i}}function be(e,t){let n=s=>`${s.scenario}\0${s.test??""}`,i=new Set(e.pairs.map(n)),r=new Set(t.pairs.map(n)),o=[];for(let[s,a]of e.verifies){let l=t.verifies.get(s);l&&(a.length===l.length&&a.every((d,_)=>d===l[_])||o.push({ac:s,before:a,after:l}))}return{superseded:e.pairs.filter(s=>!r.has(n(s))),minted:t.pairs.filter(s=>!i.has(n(s))),retained:t.pairs.filter(s=>i.has(n(s))),moves:o}}function we(e,t,n,i,r){let o=a=>t.nameOf.get(a)??a,s=a=>` - ${o(a.scenario)} \xB7 ${a.test?o(a.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${i.before} \u2192 ${i.after}`),e.out(` superseded ${r.superseded.length} pair(s)`);for(let a of r.superseded)e.out(s(a));e.out(` minted ${r.minted.length} pair(s)`);for(let a of r.minted)e.out(s(a));e.out(` retained ${r.retained.length} pair(s)`);for(let a of r.retained)e.out(s(a));if(r.moves.length===0)e.out(" verifies none moved");else{e.out(" verifies moved:");for(let a of r.moves){let l=d=>d.length>0?d.map(o).join(" + "):"(none)";e.out(` - ${o(a.ac)}: ${l(a.before)} \u2192 ${l(a.after)}`)}}}async function ge(e,t,n,i,r,o,s,a){let l=L(e),d=S(l,t.ucTip);if(!d)return o==="batch"?(i.out($().text("note.no_design_skipped",{use_case:t.display})),a?.({type:"evolve_skipped",use_case:t.display,reason:"no-design"}),{code:0,outcome:"no-design"}):(I(i,$().text("note.no_design",{use_case:t.display})),{code:2,outcome:"no-design"});let _=j(l,t.ucTip),v=[`evolve ${t.display}`,` re-designs use-case ${t.display}`,` affects ${_.pairs.length} pair(s)`,...n.because?[` because ${n.because}`]:[]];if(n.yes)for(let p of v)i.out(p);else{for(let c of v)i.out(c);let p=n.confirm?await n.confirm():await i.confirm(`proceed with the re-design of ${t.display}?`)?"proceed":"decline";if(p==="defer")return i.out(`deferred: the re-design of ${t.display} waits for an answer \u2014 nothing evolved`),{code:3,outcome:"deferred"};if(p==="decline")return i.out(o==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"}}let E=t.named?Ce(t.named):void 0,x=oe(e,l,t.ucTip,n.because,E),R=t.named?Re(l,t.named,t.display,n.because,t.ucTip):void 0,D=!1,O,h=p=>{p.type==="nothing_to_change"&&(D=!0,typeof p.note=="string"&&(O=p.note)),a?.(p)},y=await re(s,{verb:"evolve",subject:t.display},()=>r(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...x!==void 0?{changeDelta:x.change_delta,priorDesign:x.prior_design}:{},onChildEvent:h,...R?{statement:R}:{},...n.repin?{repinsKept:!0}:{}}),p=>({ok:p===0,exitCode:p}));if(y===3)return i.out($().text("note.design_paused",{use_case:t.display})),{code:y,outcome:"paused"};if(y!==0)return I(i,`design run for ${t.display} ended with exit code ${y} \u2014 no diff to report`),{code:y,outcome:"failed"};let u=L(e),b=u.tipOf(t.ucTip),w=S(u,b)?.seq,T={before:d.seq,after:w??"?"},A=be(_,j(u,b)),C=n.sourceChanged?{source_changed:n.sourceChanged}:{};if(D&&w===d.seq){let p=n.repin?_e(e,b,n.repin.by,i,t.display):void 0;return i.out(`unchanged: use-case ${t.display} \u2014 the design agent found nothing to change`),a?.({...ue(u,t.display,T,A),nothing_to_change:!0,...O?{note:O}:{},...p?{repinned:p}:{},...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"unchanged"}}return we(i,u,t.display,T,A),a?.({...ue(u,t.display,T,A),...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"evolved"}}function _e(e,t,n,i,r){let o=ie({store:e,graph:L(e),ucTip:t,by:n});if(o.errors){i.err?.(`the tests of ${r} couldn't be marked up to date: ${o.errors.map(a=>a.detail).join("; ")}`);return}let s=L(e);if(!(o.moved===0||V(s,t)))return{tests:H(s,t).total}}function ce(e,t,n){n&&e.out($().text("note.source_changed_after",{use_case:t,review:z(n)}))}var z=e=>e.next&&e.next.length>0?e.next.map(t=>t.cmd).join(" and "):null;function Ee(e,t){return n=>{let r=L(e).heads.get(n),o=r?[...e.recordsSince(null)].reverse().find(l=>l.source_head_moves?.[n]===r):void 0,s=o?e.tokenAt(o.seq):null,a=s?e.intentOf(s)?.args?.label:void 0;return{cmd:$().command("next.review_source",{source_id:n,from:typeof a=="string"?a:null,agent_mode:t})}}}function $e(e){let t=new Map,n=0;for(let{cid:r,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(r);if(!s||!W.has(s)||!B(e,r)||!P(e,r))continue;let a=F(e,r,s);!a||e.nodeLabel.get(a)!==k.USECASE||!B(e,a)||(n++,t.has(a)||t.set(a,fe(e,a)))}return{targets:[...t.values()].sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),staleCount:n}}function xe(e,t,n){let i=e.map(s=>t(s,n)),r=i.flatMap(s=>s.cmd?[{cmd:s.cmd,why:"review its source's change"}]:[]),o=i.flatMap(s=>s.remedy?[s.remedy]:[]).join(`
2
+ import{a as X,c as oe}from"./chunk-ZMWTRXFH.js";import{b as ae}from"./chunk-I6S6DZ2E.js";import{a as ie,b as W,c as B,d as F,e as V,f as M,g as J,h as S}from"./chunk-LTPOMMAB.js";import{a as re}from"./chunk-HD6NR44L.js";import{M as L,R as ne,S as se,xb as P}from"./chunk-PI7OXS62.js";import{f as k,g as q}from"./chunk-KU3YHPWZ.js";import{d as Q,o as $}from"./chunk-HYJVYYAZ.js";function I(e,t){(e.err??e.out)(`error: ${t}`)}function Y(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[i,r]of e.names)if(e.tipOf(r)===t)return i;return t}function fe(e,t){return{ucTip:t,display:Y(e,t),seamRef:e.nameOf.get(t)??t}}function ye(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let i=n.tip,r=e.nodeLabel.get(i);if(!r||!W.has(r))return{ok:!1,message:`'${t}' is a ${r??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let o=F(e,i,r);return!o||e.nodeLabel.get(o)!==k.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${r} chain is broken`}:e.superseded.has(o)?{ok:!1,message:`use-case ${Y(e,o)} was removed \u2014 nothing to evolve`}:e.trust.get(o)==="archived"?{ok:!1,message:`use-case ${Y(e,o)} was archived \u2014 nothing to evolve`}:{ok:!0,target:fe(e,o)}}function We(e,t){return j(e,t)}function j(e,t){let n=[];for(let{cid:r}of e.byLabel(k.SCENARIO)){if(!B(e,r)||!e.edgesFrom(r).some(s=>s.type===q.BELONGS_TO&&e.tipOf(s.dst)===t))continue;let o=e.edgesInto(r).filter(s=>s.type===q.AUTOMATES&&B(e,s.src));if(o.length===0)n.push({scenario:r,test:null});else for(let s of o)n.push({scenario:r,test:s.src})}let i=new Map;for(let{cid:r}of e.byLabel(k.AC)){if(!B(e,r)||F(e,r,k.AC)!==t)continue;let o=e.edgesInto(r).filter(s=>s.type===q.VERIFIES&&B(e,s.src)).map(s=>s.src).sort();i.set(r,o)}return{pairs:n,verifies:i}}function be(e,t){let n=s=>`${s.scenario}\0${s.test??""}`,i=new Set(e.pairs.map(n)),r=new Set(t.pairs.map(n)),o=[];for(let[s,a]of e.verifies){let l=t.verifies.get(s);l&&(a.length===l.length&&a.every((d,_)=>d===l[_])||o.push({ac:s,before:a,after:l}))}return{superseded:e.pairs.filter(s=>!r.has(n(s))),minted:t.pairs.filter(s=>!i.has(n(s))),retained:t.pairs.filter(s=>i.has(n(s))),moves:o}}function we(e,t,n,i,r){let o=a=>t.nameOf.get(a)??a,s=a=>` - ${o(a.scenario)} \xB7 ${a.test?o(a.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${i.before} \u2192 ${i.after}`),e.out(` superseded ${r.superseded.length} pair(s)`);for(let a of r.superseded)e.out(s(a));e.out(` minted ${r.minted.length} pair(s)`);for(let a of r.minted)e.out(s(a));e.out(` retained ${r.retained.length} pair(s)`);for(let a of r.retained)e.out(s(a));if(r.moves.length===0)e.out(" verifies none moved");else{e.out(" verifies moved:");for(let a of r.moves){let l=d=>d.length>0?d.map(o).join(" + "):"(none)";e.out(` - ${o(a.ac)}: ${l(a.before)} \u2192 ${l(a.after)}`)}}}async function ge(e,t,n,i,r,o,s,a){let l=L(e),d=S(l,t.ucTip);if(!d)return o==="batch"?(i.out($().text("note.no_design_skipped",{use_case:t.display})),a?.({type:"evolve_skipped",use_case:t.display,reason:"no-design"}),{code:0,outcome:"no-design"}):(I(i,$().text("note.no_design",{use_case:t.display})),{code:2,outcome:"no-design"});let _=j(l,t.ucTip),v=[`evolve ${t.display}`,` re-designs use-case ${t.display}`,` affects ${_.pairs.length} pair(s)`,...n.because?[` because ${n.because}`]:[]];if(n.yes)for(let p of v)i.out(p);else{for(let c of v)i.out(c);let p=n.confirm?await n.confirm():await i.confirm(`proceed with the re-design of ${t.display}?`)?"proceed":"decline";if(p==="defer")return i.out(`deferred: the re-design of ${t.display} waits for an answer \u2014 nothing evolved`),{code:3,outcome:"deferred"};if(p==="decline")return i.out(o==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"}}let E=t.named?Ce(t.named):void 0,x=oe(e,l,t.ucTip,n.because,E),R=t.named?Re(l,t.named,t.display,n.because,t.ucTip):void 0,D=!1,O,h=p=>{p.type==="nothing_to_change"&&(D=!0,typeof p.note=="string"&&(O=p.note)),a?.(p)},y=await re(s,{verb:"evolve",subject:t.display},()=>r(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...x!==void 0?{changeDelta:x.change_delta,priorDesign:x.prior_design}:{},onChildEvent:h,...R?{statement:R}:{},...n.repin?{repinsKept:!0}:{}}),p=>({ok:p===0,exitCode:p}));if(y===3)return i.out($().text("note.design_paused",{use_case:t.display})),{code:y,outcome:"paused"};if(y!==0)return I(i,`design run for ${t.display} ended with exit code ${y} \u2014 no diff to report`),{code:y,outcome:"failed"};let u=L(e),b=u.tipOf(t.ucTip),w=S(u,b)?.seq,T={before:d.seq,after:w??"?"},A=be(_,j(u,b)),C=n.sourceChanged?{source_changed:n.sourceChanged}:{};if(D&&w===d.seq){let p=n.repin?_e(e,b,n.repin.by,i,t.display):void 0;return i.out(`unchanged: use-case ${t.display} \u2014 the design agent found nothing to change`),a?.({...ue(u,t.display,T,A),nothing_to_change:!0,...O?{note:O}:{},...p?{repinned:p}:{},...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"unchanged"}}return we(i,u,t.display,T,A),a?.({...ue(u,t.display,T,A),...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"evolved"}}function _e(e,t,n,i,r){let o=ie({store:e,graph:L(e),ucTip:t,by:n});if(o.errors){i.err?.(`the tests of ${r} couldn't be marked up to date: ${o.errors.map(a=>a.detail).join("; ")}`);return}let s=L(e);if(!(o.moved===0||V(s,t)))return{tests:H(s,t).total}}function ce(e,t,n){n&&e.out($().text("note.source_changed_after",{use_case:t,review:z(n)}))}var z=e=>e.next&&e.next.length>0?e.next.map(t=>t.cmd).join(" and "):null;function Ee(e,t){return n=>{let r=L(e).heads.get(n),o=r?[...e.recordsSince(null)].reverse().find(l=>l.source_head_moves?.[n]===r):void 0,s=o?e.tokenAt(o.seq):null,a=s?e.intentOf(s)?.args?.label:void 0;return{cmd:$().command("next.review_source",{source_id:n,from:typeof a=="string"?a:null,agent_mode:t})}}}function $e(e){let t=new Map,n=0;for(let{cid:r,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(r);if(!s||!W.has(s)||!B(e,r)||!P(e,r))continue;let a=F(e,r,s);!a||e.nodeLabel.get(a)!==k.USECASE||!B(e,a)||(n++,t.has(a)||t.set(a,fe(e,a)))}return{targets:[...t.values()].sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),staleCount:n}}function xe(e,t,n){let i=e.map(s=>t(s,n)),r=i.flatMap(s=>s.cmd?[{cmd:s.cmd,why:"review its source's change"}]:[]),o=i.flatMap(s=>s.remedy?[s.remedy]:[]).join(`
3
3
  `);return{...r.length>0?{next:r}:{},...o?{remedy:o}:{}}}var pe={[k.TEST]:"test",[k.SCENARIO]:"scenario",[k.AC]:"ac",[k.USECASE]:"usecase"},ve={test:"test",scenario:"scenario",ac:"acceptance criterion",usecase:"use-case"},de=120;function Oe(e,t){let n=e.resolve(t);if(!n)return null;let i=pe[e.nodeLabel.get(n.tip)??""];if(!i)return null;let r=e.getNode(n.tip)?.content??{},o=i==="ac"?r.text:r.title,s=typeof o=="string"?o.replace(/[\u0000-\u001f\u007f]+/g," ").trim():"",a=Array.from(s),l=a.length===0?void 0:a.length>de?`${a.slice(0,de-1).join("")}\u2026`:s,d=e.superseded.has(n.tip)?"removed":e.trust.get(n.tip)==="archived"?"archived":void 0;return{ref:e.nameOf.get(n.tip)??e.displayNameOf(n.tip)??t,label:i,...l?{title:l}:{},cid:n.tip,...d?{dead:d}:{}}}function Ce(e){if(!e.dead)return{ref:e.ref,label:e.label,...e.title?{title:e.title}:{}}}function ke(e,t,n){let i=[];for(let{cid:r,state:o}of e.staleList()){if(o==="superseded"||r===n)continue;let s=e.nodeLabel.get(r),a=pe[s??""];if(!s||!a||!B(e,r)||!P(e,r)||F(e,r,s)!==t)continue;let l=X(e,r);if(!l)continue;let d=e.nameOf.get(r)??e.displayNameOf(r)??r;i.push({display:d,text:`${ve[a]} ${d} \u2014 ${l}`})}return i.sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),i[0]?.text??null}var Se=`Judge the scope yourself: change what this genuinely affects and leave the rest as designed.
4
4
  If it is ambiguous what should change, ask before changing anything.`;function Re(e,t,n,i,r){let o=t.label==="usecase"?"":` in use-case ${n}`,s=[t.title?`"${t.title}"`:"",t.dead?`${t.dead} earlier`:""].filter(Boolean).join(", "),a=`[kane] evolve started on ${ve[t.label]} ${t.ref}${s?` (${s})`:""}${o}.`,l=i?.trim(),d=l||t.dead?void 0:X(e,t.cid),_=l?void 0:d??(r?ke(e,r,t.cid):null),v=l?`Because: ${l}`:_?`Stale: ${_}`:null;return[a,v,Se].filter(E=>E!==null).join(`
5
5
  `)}function ue(e,t,n,i){let r=s=>e.nameOf.get(s)??s,o=s=>({scenario:r(s.scenario),test:s.test?r(s.test):null});return{type:"evolve_diff",use_case:t,generation:n,superseded:i.superseded.map(o),minted:i.minted.map(o),retained:i.retained.map(o),moves:i.moves.map(s=>({ac:r(s.ac),before:s.before.map(r),after:s.after.map(r)}))}}function H(e,t){let n=j(e,t).pairs.flatMap(r=>r.test!==null?[{test:r.test,scenario:r.scenario}]:[]);return{touched:n.filter(({test:r,scenario:o})=>P(e,r)||P(e,o)||e.edgesFrom(r).some(s=>s.type===q.VERIFIES&&P(e,s.dst))).length,total:n.length}}async function Ve(e,t,n){let{io:i,asks:r,runDesign:o,emit:s}=n,a=t.because,l=n.onChild??(s?De(s):void 0);i.out(`evolving ${t.ref??"stale use-cases"}: reading the graph\u2026`);let d=L(e),_=t.ref!==void 0?se(d,t.ref):null;if(_!==null)return I(i,_),2;let v=t.ref!==void 0?ne(d,t.ref):void 0,E="given"in r.blast?r.blast:null,x=n.words?.review??Ee(e,t.mode==="agent"),R=(c,f)=>xe(c,x,f),D=c=>{let{sources:f}=M(d,c.ucTip);return f.length>0?R(f,c.ucTip):void 0},O=(c,f)=>n.words?n.words.question(c,H(d,c.ucTip),a,v===void 0):le(c,f,a),h,y,u=[],b=()=>{for(let{target:c,review:f}of u)i.out($().text("note.source_changed_skipped",{use_case:c.display,review:z(f)})),s?.({type:"evolve_skipped",use_case:c.display,reason:"source_changed",...f})};if(v){let c=ye(d,v);if(!c.ok)return I(i,c.message),2;let f=M(d,c.target.ucTip);if(!a&&S(d,c.target.ucTip)&&J(f)){let m=R(f.sources,c.target.ucTip);return I(i,$().text("note.source_changed",{use_case:c.target.display,review:z(m)})),s?.({type:"evolve_skipped",use_case:c.target.display,reason:"source_changed",...m}),2}if(!a&&S(d,c.target.ucTip)&&!V(d,c.target.ucTip)){let m=r.because?await r.because(c.target.display):void 0;if(m!==null&&typeof m=="object")return i.out(`deferred: the reason to re-design ${c.target.display} waits for an answer \u2014 nothing evolved`),s?.({type:"evolve_paused",pending_because:c.target.display}),3;let N=m?.trim();if(!N)return I(i,$().text("note.nothing_changed",{ref:v})),2;a=N}let g=Oe(d,v);h=[{...c.target,ref:v,...g?{named:g}:{}}]}else{let{targets:c,staleCount:f}=$e(d);if(c.length===0){let g=E?Z(E,[]):null;return g?te(i,g):(s?.({type:"evolve_batch",stale_nodes:f,use_cases:0}),i.out("nothing stale \u2014 nothing to evolve"),0)}if(i.out(`from-stale: ${f} stale node(s) \u2192 ${c.length} use-case(s)`),u=c.flatMap(g=>{let m=M(d,g.ucTip);return S(d,g.ucTip)&&J(m)?[{target:g,review:R(m.sources,g.ucTip)}]:[]}),h=c.filter(g=>!u.some(m=>m.target.ucTip===g.ucTip)),y={stale_nodes:f,use_cases:h.length},h.length===0){let g=E?Z(E,[]):null;return g?te(i,g):(b(),s?.({type:"evolve_batch",...y}),0)}}let w={...a?{because:a}:{},...t.mode?{mode:t.mode}:{},...t.yes?{yes:!0}:{},repin:{by:n.by??{kind:"human",id:"operator"}}},T=c=>{a&&e.signals().append({ts:new Date().toISOString(),command:"evolve",id:c,verdict:"gap-resolved-evolve",polarity:"preference",by:n.by??{kind:"human",id:"operator"},target:c,reason:a})};if(E)return Te({store:e,graph:d,ref:v,targets:h,batch:y,opts:w,answered:E,io:i,runDesign:o,onChild:l,emit:s,signal:T,sayLeftOut:b,reviewFor:D,question:(c,f)=>n.words?n.words.question(c,H(d,c.ucTip),w.because,v===void 0):le(c,f,w.because),...n.words?{why:n.words.answerWhy}:{}});let A=r.blast.ask,C=c=>S(d,c.ucTip)?j(d,c.ucTip).pairs.length:0;y&&(b(),s?.({type:"evolve_batch",...y}));let p=[];for(let[c,f]of h.entries()){let g=C(f);S(d,f.ucTip)&&s?.(me(f,g,a));let m=()=>A(O(f,g),f.display),N=D(f),U=await ge(e,f,{...w,confirm:m,...N?{sourceChanged:N}:{}},i,o,v?"single":"batch",l,s);if(U.outcome==="evolved"&&T(v??f.display),U.outcome==="declined"&&s?.({type:"evolve_skipped",use_case:f.display,reason:"declined"}),U.outcome==="deferred"){let he=h.slice(c).filter(K=>S(d,K.ucTip));return s?.({type:"evolve_paused",pending_questions:he.map(K=>O(K,C(K))),deferred:f.display}),ee([...p,3])}if(v)return U.code;p.push(U.code)}return ee(p)}function Z(e,t){if(e.unreadable!==void 0)return e.unreadable;for(let[n,i]of e.given){if(!t.includes(n))return`${n} is not a question this run asks \u2014 addressable: ${t.length>0?t.join(", "):"(none)"}`;if(typeof i=="object")return`'${i.invalid}' is not a choice for ${n} \u2014 use 1 or proceed, 2 or decline`}return null}async function Te(e){let{store:t,graph:n,ref:i,targets:r,batch:o,opts:s,answered:a,io:l,runDesign:d,onChild:_,emit:v,signal:E}=e,x=[],R=[];for(let u of r){if(!S(n,u.ucTip)){if(i)return I(l,$().text("note.no_design",{use_case:u.display})),2;R.push(u);continue}x.push({target:u,pairs:j(n,u.ucTip).pairs.length})}let D=Z(a,x.map(u=>G(u.target)));if(D)return te(l,D);let O=a.given;o&&(e.sayLeftOut(),v?.({type:"evolve_batch",...o}));for(let u of R)l.out($().text("note.no_design_skipped",{use_case:u.display})),v?.({type:"evolve_skipped",use_case:u.display,reason:"no-design"});for(let u of x)v?.(me(u.target,u.pairs,s.because));let h=x.filter(u=>!O.has(G(u.target)));if(h.length>0){let u=$(),b=[...O.entries()].map(([g,m])=>({id:g,choice:m})),w={...i!==void 0?{ref:i}:{},...s.because?{because:s.because}:{}},T=u.command("next.answer_evolve",{...w,answers:b}),A=g=>({...w,answers:[...b,...h.map(m=>({id:G(m.target),choice:g}))]}),C=h.length===1?`use-case ${h[0].target.display}`:`${h.length} use-cases`,p=[...O.values()].filter(g=>g==="proceed").length,c=p>0?`; the ${p} use-case(s) already answered proceed still re-design`:"",f=[Q(u,"next.answer_evolve",A("proceed"),{why:e.why?e.why("proceed",C):`re-design ${C} now \u2014 supersedes what the change touches, spends design credits${c}`,...e.why?{}:{title:p>0?"Proceed with the remaining re-design":"Proceed with the re-design"}}),Q(u,"next.answer_evolve",A("decline"),{why:e.why?e.why("decline",C):`leave ${C} as designed${c}`,...e.why?{}:{title:p>0?"Decline the remaining question(s)":"Decline"}})].filter(g=>!("cmd"in g)||ae(g.cmd));return v?.({type:"evolve_paused",pending_questions:h.map(g=>e.question(g.target,g.pairs)),...T!==null?{resume:T}:{},next:f}),3}let y=[];for(let{target:u}of x){if(O.get(G(u))==="decline"){l.out(i?"declined \u2014 nothing evolved":`skipped ${u.display}`),v?.({type:"evolve_skipped",use_case:u.display,reason:"declined"});continue}let b=e.reviewFor(u),w=await ge(t,u,{...s,yes:!0,...b?{sourceChanged:b}:{}},l,d,i?"single":"batch",_,v);w.outcome==="evolved"&&E(i??u.display),y.push(w.code)}return ee(y)}function ee(e){let t=e.find(n=>n!==0&&n!==3);return t!==void 0?t:e.includes(3)?3:0}function te(e,t){return e.err?e.err(`error: ${t}`,"ANSWER_USAGE"):e.out(`error: ${t}`),2}function G(e){return`evolve:${e.display}`}function me(e,t,n){return{type:"evolve_target",...e.ref!==void 0?{ref:e.ref}:{},use_case:e.display,pairs:t,...n?{because:n}:{}}}function le(e,t,n){return{id:G(e),header:"Re-design?",text:`Re-design use-case ${e.display}? ${t} scenario/test pair(s) are affected${n?` \u2014 because: ${n}`:""}.`,risk:"med",rationale:"evolve re-designs the whole parent use-case: what the change touches is superseded, the rest is re-emitted verbatim; the run spends design credits",options:[{label:"proceed",detail:`re-design use-case ${e.display} now (${t} pair(s) affected)`},{label:"decline",detail:"leave the current design as it is"}],recommended_index:0,allow_free_text:!1}}function De(e){return t=>{t.kind==="start"?e({type:"child_start",child:"design",subject:t.subject}):t.kind==="end"&&e({type:"child_end",ok:t.ok,dur_s:t.durS,...t.exitCode!==void 0?{exit_code:t.exitCode}:{}})}}export{ye as a,We as b,ge as c,$e as d,xe as e,Oe as f,Se as g,Re as h,Ve as i,G as j};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as we}from"./chunk-ZY65IZJR.js";import{a as he,b as ve,c as _e}from"./chunk-PCDIEYV6.js";import{a as ye}from"./chunk-2B75UL7Y.js";import{a as V,b as G,e as U}from"./chunk-GRO6DLN3.js";import{a as $,b as ge}from"./chunk-73ZFOJOK.js";import{a as me}from"./chunk-HGVM2OZU.js";import{d as pe}from"./chunk-MPEIMWQI.js";import{e as fe}from"./chunk-XB6BJPDL.js";import{$ as ie,C as te,D as ne,G as re,M as E,Na as le,Y as oe,da as P,e as F,ea as se,ia as ce,ja as I,sa as de,sb as j,tb as ue,xa as ae}from"./chunk-Z777GGHB.js";import{f as w,g as C,i as ee}from"./chunk-KU3YHPWZ.js";import{e as Z}from"./chunk-HHW6MRU3.js";import{h as X,m as D}from"./chunk-4I7YN6YY.js";import{randomUUID as Ge}from"crypto";function De(t,e,n,o,i){let d=n.rows.filter(g=>{let u=o.get(g.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let r={version:1,read_basis:e.latestHash,source:{source_id:n.source_id,source_cid:e.heads.get(n.source_id)??""},use_cases:d.map(g=>g.uc)},s=new Map;for(let g of d){let u=o.get(g.temp_ref);typeof u=="object"?s.set(g.temp_ref,{resolution:"edited",edit:u.edited}):s.set(g.temp_ref,{resolution:g.uc.matches_existing&&g.uc.changed?"edited":"approved"})}let a=_e(r,e,n.staged_source_cid);if(a.errors!==null)return{record:null,errors:a.errors};let l=a.proposal,p=r.source.source_cid?V(t,e,r.source.source_cid):null;if(p!==null){l=ve(l,p);let g=ie(l,he(p),e);if(g.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:D().text("HELD_CITES_STALE.moved",{})},...g]}}let m=`held-${(e.latestHash??"root").slice(-12)}-${d.length}`;return P({store:t,graph:e,proposal:l,proposalId:m,verdicts:s,by:i,autoName:!0})}function Re(t,e,n=[]){let o=we(t,e),i=new Set,d=[],r=p=>{!p||i.has(p)||(i.add(p),d.push(k(t,p)))};for(let p of o.pairs)r(p.scenario),r(p.test);for(let[p,m]of o.verifies){r(p);for(let g of m)r(g)}if(n.length===0)return{stale_refs:d};let s=p=>`${String(p.props.source_id)}\0${String(p.props.anchor)}`,a=new Set;for(let{cid:p}of t.byLabel(w.USECASE))if(t.tipOf(p)===e)for(let m of t.edgesInto(p)){if(m.type!==C.DERIVES)continue;let g=m.props.claim;typeof g=="string"&&n.includes(g)&&a.add(s(m))}if(a.size===0)return{stale_refs:d};let l=new Set;for(let[p,m]of o.verifies)if(t.edgesInto(p).some(u=>u.type===C.DERIVES&&a.has(s(u)))){l.add(k(t,p));for(let u of m)l.add(k(t,u))}return{stale_refs:d,...l.size>0?{direct_refs:[...l]}:{}}}var ke="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",Le="suite untouched; graph updated";function N(t,e){return!t.superseded.has(e)&&t.trust.get(e)!=="archived"}function k(t,e,n=new Set){let o=t.nameOf.get(e);if(o!==void 0)return o;if(n.has(e))return e;n.add(e);for(let[i,d]of t.superseded){if(d!==e||de(i,e,s=>t.nodeLabel.get(s)))continue;let r=k(t,i,n);if(r!==i)return r}return e}function b(t){return String(t).slice(0,19)}function A(t,e,n){let o=t.edgesFrom(e).find(i=>i.type===n);return o?t.tipOf(o.dst):null}function M(t,e){let n=t.nodeLabel.get(e);if(n===w.USECASE)return e;if(n===w.SCENARIO)return A(t,e,C.BELONGS_TO);if(n===w.AC){let o=A(t,e,C.SCOPED_TO);return o?t.nodeLabel.get(o)===w.USECASE?o:A(t,o,C.BELONGS_TO):null}if(n===w.TEST){let o=A(t,e,C.AUTOMATES);return o?A(t,o,C.BELONGS_TO):null}return null}function Se(t,e){let n=[],o=new Map;for(let i of t.derivesInto(e))o.set(String(i.props.source_id),i);for(let[i,d]of o){let r=t.heads.get(i);if(r==null){n.push(`DERIVES pin ${i} @ ${b(d.props.source_cid)} \u2014 source retired`);continue}let s=j(t,e,i);if(s!==null){s.stale&&n.push(`DERIVES pin ${i} \u2014 ${ue(i,s)}`);continue}if(r!==d.props.source_cid){let a=t.convChains.get(i)?.chain;if(a&&a.includes(String(d.props.source_cid)))continue;n.push(`DERIVES pin ${i} @ ${b(d.props.source_cid)} \u2014 source head moved to ${b(r)}`)}}for(let i of t.edgesFrom(e))ee(i.type)?.pin?.comparesTo==="dst_tip"&&t.superseded.has(i.dst)&&n.push(`${i.type} pin \u2192 ${k(t,i.dst)} \u2014 target superseded`);return n.join("; ")||"structural pin broken"}var xe=new Set([w.USECASE,w.SCENARIO,w.AC,w.TEST]);function L(t,e){return t.ref<e.ref?-1:t.ref>e.ref?1:0}function Ie(t,e,n,o,i){let d=n.props.quote;if(typeof d=="string"&&d.length>0)return ne(d,o);let r=String(n.props.source_cid);i.has(r)||i.set(r,V(t,e,r));let s=i.get(r);if(s===null)return!1;let a=te(s,String(n.props.anchor));return a===null?!1:a.split(`
3
- `).some(l=>l.trim().length>0&&o.includes(l.trim()))}function Ae(t,e,n){let o=F(String(e.props.anchor));if(o?.kind!=="img-part")return!1;let d=(t.mediaOf(String(e.props.source_cid)).images??[]).find(l=>l.ref===o.ref),r=d?.blob;if(r===void 0)return!1;let s=t.mediaOf(n).images??[];if(s.some(l=>l.blob===r))return!0;let a=d?.appearance;return a!==void 0&&s.filter(l=>l.appearance===a).length===1}function Pe(t,e,n={}){let o=n.now??new Date,i=t.sessions(),d=[],r=0;for(let s of i.list())if(s.sid!==n.except){if(s.corrupt){r+=1;continue}try{let a=i.peek(s.sid);if(!a||Z(a,o))continue;let l=a.pending.proposals.some(m=>(m.content?._held?.source_id??null)===e),p=a.reconcile!=null&&e in a.read_basis&&B(t,a.reconcile.proposal_id).resolved!==!0;(l||p)&&d.push(a.sid)}catch{r+=1}}return{holders:d,corrupt:r}}async function at(t,e){let{holders:n,corrupt:o}=Pe(t,e.sourceId,{...e.now?{now:e.now}:{},...e.sessionId?{except:e.sessionId}:{}});if(o>0)return{kind:"unverifiable",corrupt:o};if(n.length>0)return{kind:"held",holders:n};if((await e.reingest(e.sourceId)).status==="unchanged")return{kind:"unchanged"};let d=G(t,e.sourceId);return d.kind==="ok"?{kind:"landed",changeContext:d.changeContext}:d}function $e(t,e,n){let o=t.getNode(e)?.content??{},i=t.getNode(n)?.content??{},r=[...new Set([...Object.keys(o),...Object.keys(i)])].sort().filter(s=>JSON.stringify(o[s])!==JSON.stringify(i[s]));return r.length>0?`updated: ${r.join(", ")}`:"updated"}function Ve(t,e,n,o,i,d,r){let s=new Set((r?.rows??[]).map(f=>f.matched_cid).filter(f=>!!f)),a=[];for(let[f,h]of n.superseded)h===null||f===h||e.superseded.has(f)||n.nodeLabel.get(f)===w.USECASE&&a.push({kind:"MODIFY",ref:k(n,f),old_cid:f,new_cid:h,summary:$e(n,f,h)});let l=d.map(f=>({kind:"ADD",ref:k(n,f),cid:f}));for(let f of r?.rows??[])f.kind==="MODIFY"&&f.matched_cid?a.push({kind:"MODIFY",ref:k(n,f.matched_cid),old_cid:f.matched_cid,new_cid:null,summary:`${f.why} (staged)`}):f.kind==="ADD"&&l.push({kind:"ADD",ref:f.title,cid:null});let p=[],m=V(t,n,i),g=new Map;for(let{cid:f}of n.byLabel(w.USECASE)){if(!N(n,f)||s.has(f))continue;let h=n.derivesInto(f),y=h.filter(c=>String(c.props.source_id)===o);if(y.length===0)continue;let S=j(n,f,o);S!==null&&!S.stale||y.some(c=>c.props.source_cid===i)||y.some(c=>{let _=String(c.props.anchor),x=F(_);return x?.kind==="img-whole"?!1:x?.kind==="img-part"?Ae(n,c,i):m!==null&&Ie(t,n,c,m,g)})||h.some(c=>{let _=String(c.props.source_id);if(_===o)return!1;let x=n.heads.get(_);return x!=null})||p.push({kind:"ARCHIVE",ref:k(n,f),cid:f,why:`evidence decayed: no quote from ${o} relocates into @${b(i)}, no other live source, no fresh evidence this run`,impact:Re(n,n.tipOf(f))})}let u=(f,h)=>f.ref<h.ref?-1:f.ref>h.ref?1:0;return[...a.sort(u),...l.sort(u),...p.sort(u)]}function lt(t,e,n,o,i){let d=e.rows.find(u=>u.temp_ref===n);if(!d)return{ok:!1,message:`held item ${n} missing from the plan artifact`};let r=d,s=E(t);if(r.matched_cid){let u=s.tipOf(r.matched_cid);if(s.superseded.get(u)===null)return{ok:!1,message:`use-case for "${r.title}" was retired meanwhile \u2014 nothing to update`};u!==r.matched_cid&&(r={...r,matched_cid:u,uc:{...r.uc,matches_existing:{cid:u}}})}let a=i?{edited:i}:"approve",l=De(t,s,{source_id:e.source_id,...e.staged_source_cid!==void 0?{staged_source_cid:e.staged_source_cid}:{},rows:[r]},new Map([[r.temp_ref,a]]),o);if(l.errors)return{ok:!1,message:l.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let p=E(t),m=r.matched_cid?p.tipOf(r.matched_cid):l.record?.nodes.find(u=>u.label==="usecase")?.cid??l.record?.review[0]?.id;return{ok:!0,ref:m?k(p,m):r.title,kind:r.kind}}async function ut(t,e,n,o={}){let i=E(t);t.prefetch(fe(i,e),{token:null});let d=i.heads.get(e)??null,r=new Set(i.staleList().filter(c=>c.state==="stale").map(c=>c.cid)),s=await n.reingest(e);if(s.status==="unchanged"&&!o.resumeHeld&&!o.reextractUnchanged)return{source_id:e,changed:!1,head:{status:s.status,before:d,after:s.cid},note:`nothing to reconcile \u2014 ${e} is unchanged`,skipped_arms:ke,changeset:[],rows:[]};let a=o.resumeHeld?{minted:[],matched:[],held:o.resumeHeld}:await n.reextract(e),l=E(t),p=a.minted.map(c=>{let _=k(l,c);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${e}`,provenance:`extraction commit \u2014 DERIVES ${e} @ ${b(s.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=l.staleList().filter(c=>c.state==="stale"&&!r.has(c.cid)&&N(l,c.cid)).map(c=>c.cid),g=m.map(c=>{let _=k(l,c),x=xe.has(l.nodeLabel.get(c)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:Se(l,c),action:x?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],f=[];for(let c of a.held?.rows??[])if(c.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:c.title,held_ref:c.temp_ref,reason:`${c.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${e} @ ${b(s.cid)}`,action:"approve to commit + design"});else{let _=c.matched_cid?l.tipOf(c.matched_cid):null,x=_?l.getNode(_)?.content.criteria??[]:[],J=(c.uc.updated?.criteria??[]).map(O=>typeof O=="string"?O:O.text),be=[...J.filter(O=>!x.includes(O)),...c.uc.updated?.criteria!==void 0?x.filter(O=>!J.includes(O)):[]],Q=_?Re(l,_,be):void 0;f.push({kind:"MODIFY",origin:"content-change",ref:c.matched_cid?k(l,c.matched_cid):c.title,held_ref:c.temp_ref,reason:`${c.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${e} @ ${b(s.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...Q?{impact:Q}:{}})}let h=new Set;for(let c of[...a.minted,...a.matched])h.add(l.tipOf(c));for(let c of a.held?.rows??[])c.matched_cid&&h.add(l.tipOf(c.matched_cid));for(let c of m){let _=M(l,l.tipOf(c));_&&l.nodeLabel.get(_)===w.USECASE&&h.add(l.tipOf(_))}let y=[];for(let c of await pe(l,"design")){if(c.kind!=="no-verifies")continue;let _=l.resolve(c.ref);if(!_)continue;let x=M(l,_.tip);!x||!h.has(l.tipOf(x))||y.push({kind:"ADD",origin:"content-change",ref:c.ref,reason:c.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${k(l,x)}`,action:c.ready_command})}let S=[];for(let{cid:c}of l.byLabel(w.USECASE))N(l,c)&&l.stale(c)==="orphaned"&&S.push({kind:"REMOVE",ref:k(l,c),reason:"orphaned \u2014 no live source evidences this use-case",provenance:Se(l,c),action:"plan-only \u2014 REMOVE is not executed in this release"});let v=new Set,R=[...p.sort(L),...u.sort(L),...y.sort(L),...f.sort(L),...g.sort(L),...S.sort(L)].filter(c=>{let _=`${c.kind}\0${c.ref}`;return v.has(_)?!1:(v.add(_),!0)});return{source_id:e,changed:!0,head:{status:s.status,before:d,after:s.cid},note:Le,skipped_arms:ke,changeset:Ve(t,i,l,e,s.cid,a.minted,a.held),rows:R,...a.held?{held:a.held}:{}}}function ft(t,e){return async n=>{let{ingestFile:o}=await import("./ingest-S5R736ZV.js"),{convertPdf:i}=await import("./pdf-convert-LMKOKLXT.js"),{convertDocx:d}=await import("./docx-convert-N4KMLLKO.js"),r=await o({store:t,filePath:e,asId:n,converters:{pdf:i,docx:d}});return{status:r.status,cid:r.cid}}}function pt(t,e,n,o={}){return async i=>{let{ingestThroughPlugin:d}=await import("./lane-7IEAE6AC.js"),r=await d({store:t,plugin:e,ref:n,named:o.named??!1,asId:i,...o.connect?{connect:o.connect}:{},...o.registry?{registry:o.registry}:{}});return{status:r.status,cid:r.cid}}}function gt(t,e,n,o,i){return async()=>{let r=(i??(await import("./dispatch-P2445PUU.js")).findProvider)(e);if(!r)throw new Error(`the remote re-ingest failed \u2014 no provider matches '${e}'`);let s=await r.ingest(e,void 0,{out:n.out,err:n.err,confirm:async()=>!0,isTTY:!1},t,{credentials:o});if(s.code!==0||!s.result)throw new Error("the remote re-ingest failed \u2014 fix the reported problem and re-run");return{status:s.result.status,cid:s.result.source_cid}}}function mt(t,e){return async n=>{let o=[],[{runExtract:i},{resolveAgentAuthEnv:d},{runAgent:r},{preflightTurn:s}]=await Promise.all([import("./run-QFJ6ZRVD.js"),import("./spawner-C7NLLM4F.js"),import("./bridge-SDEP7Y33.js"),import("./turn-preflight-LHYLRL7G.js")]),a=await d(e.credentials),l=new Set(E(t).byLabel(w.USECASE).map(v=>v.cid)),p=U(t,n)??void 0,m=0,g=await i({mode:"override",source:n,...p?{changeContext:p}:{}},{agent:r,store:t,credentials:e.credentials,onIngestRefusal:e.onIngestRefusal,preflightTurn:()=>s(a),ask:async()=>[],review:async v=>{if(!e.stage)return new Map(v.map(c=>[c.temp_ref,{resolution:c.matches_existing&&c.changed?"edited":"skipped"}]));let R=new Map;for(let c of v){if(c.matches_existing&&!c.changed){R.set(c.temp_ref,{resolution:"skipped"});continue}o.push({kind:c.matches_existing?"MODIFY":"ADD",temp_ref:c.temp_ref,title:c.title,why:c.matches_existing?`updated: ${Object.keys(c.updated??{}).join(", ")||"content"}`:`newly extracted from ${n}`,...c.matches_existing?{matched_cid:c.matches_existing.cid,updated:c.updated}:{},uc:c}),R.set(c.temp_ref,{resolution:"rejected"})}return R},confirmStale:async()=>!1,out:v=>e.hostOut?.(v),progress:v=>e.hostProgress?.(v),emit:v=>{v.type==="commit"&&typeof v.assumed=="number"&&(m+=v.assumed),e.hostEmit?.(v)},isTTY:!1,auth:a});if(g!==0)throw new Error(`reconcile: re-extract of ${n} failed (exit ${g})`);let u=E(t),f=u.heads.get(n),h=[],y=[];if(typeof f=="string"){let v=new Set;for(let R of u.edgesFrom(f))R.type!==C.DERIVES||u.nodeLabel.get(R.dst)!==w.USECASE||v.has(R.dst)||(v.add(R.dst),!(e.stage&&u.trust.get(R.dst)==="archived")&&(l.has(R.dst)?y:h).push(R.dst))}let S=E(t).heads.get(n);return{minted:h,matched:y,defaultsTaken:m,...e.stage?{held:{source_id:n,...S!=null?{staged_source_cid:S}:{},rows:o}}:{}}}}var Ne=["title","description","summary","value"];function Ce(t,e){let n=[],o=e.updated;if(!o)return n;for(let r of Ne){let s=o[r];if(typeof s!="string"||s===t[r])continue;let a=t[r];typeof a=="string"&&a.length>0&&n.push({op:"-",field:r,text:a}),n.push({op:"+",field:r,text:s})}let i=(t.criteria??[]).map(String),d=o.criteria??[];if(d.length>0)if(d.some(r=>"op"in r))for(let r of d)r.op==="set"&&n.push({op:"+",field:"criteria",text:r.text}),r.op==="remove"&&n.push({op:"-",field:"criteria",text:r.text});else{let r=d.map(s=>s.text);for(let s of i)r.includes(s)||n.push({op:"-",field:"criteria",text:s});for(let s of r)i.includes(s)||n.push({op:"+",field:"criteria",text:s})}return n}function H(t){let e=t.filter(r=>r.field==="criteria"),n=e.filter(r=>r.op==="+").length,o=e.filter(r=>r.op==="-").length,i=[...new Set(t.filter(r=>r.field!=="criteria").map(r=>r.field))],d=[];return e.length>0&&d.push(`${e.length} criteria changed \xB7 +${n} \u2212${o}`),i.length>0&&d.push(`${i.join("/")} reworded`),d.join(" \xB7 ")||"no field changes"}var Ee={high:0,med:1,low:2};function Y(t,e){return e?t.displayNameOf(e)??`${e.slice(0,19)}\u2026`:"(new)"}function T(t,e){if(!e)return;let n=t.edgesInto(e).filter(o=>o.type===C.BELONGS_TO||o.type===C.SCOPED_TO);if(n.length!==0)return{stale:n.length,direct:n.slice(0,3).map(o=>Y(t,o.src))}}function Oe(t){return oe(t).map(e=>({...e.source_id!==void 0?{source_id:e.source_id}:{},anchor:e.anchor,quote:e.quote??""}))}function K(t,e){let n=ge(t),o=[];for(let i of n.updates){let d=e.resolve(i.matches_existing.cid),r=d?e.tipOf(d.cid):null,s=(r?e.getNode(r)?.content:void 0)??{},a=Ce(s,i);o.push({key:$("MODIFY",i.matches_existing.cid),kind:"MODIFY",...r?{ref:r}:{},display:Y(e,r),title:typeof s.title=="string"?s.title:i.title,changeLine:i.change_note??H(a),diff:a,diffSummary:a.length>4?H(a):null,...i.risk!==void 0?{risk:i.risk}:{},cites:Oe(i),...i.matches_existing?.reason!==void 0?{tier:i.matches_existing.reason}:{},...T(e,r)!==void 0?{impact:T(e,r)}:{},payload:i})}for(let i of n.adds)o.push({key:$("ADD",i.temp_ref),kind:"ADD",display:"(new)",title:i.title,changeLine:i.summary??i.title,diff:[],diffSummary:null,...i.risk!==void 0?{risk:i.risk}:{},cites:Oe(i),payload:i});for(let i of n.archives){let d=e.resolve(i.target),r=d?e.tipOf(d.cid):null,s=(r?e.getNode(r)?.content:void 0)??{};o.push({key:$("ARCHIVE",i.target),kind:"ARCHIVE",...r?{ref:r}:{},display:Y(e,r),title:typeof s.title=="string"?s.title:i.target,changeLine:i.reason,diff:[],diffSummary:null,...typeof s.risk=="string"?{risk:s.risk}:{},cites:[],reason:i.reason,basis:i.basis,...T(e,r)!==void 0?{impact:T(e,r)}:{}})}return o.sort((i,d)=>(Ee[i.risk??"low"]??2)-(Ee[d.risk??"low"]??2))}function q(t,e){return t.filter(n=>!(n.key in e)||e[n.key]?.pending!==void 0)}function Fe(t,e){if(e.kind==="ADD")return null;let n=e.ref?t.resolve(e.ref):null;return n?t.tipOf(n.cid):null}async function Lt(t){let{store:e,graph:n,card:o,verdict:i,by:d}=t,r=Fe(n,o);if(o.kind!=="ADD"&&(!r||(n.trust.get(r)??null)==="archived"))return{ok:!1,refusal:`its target ${o.display} was retired while the review was open \u2014 nothing landed`,code:"TARGET_RETIRED"};if(i==="reject")return t.signals?.({ref:o.display,verdict:"reject",...t.note?{reason:t.note}:{}}),{ok:!0,landed:"none",note:"nothing saved \u2014 rejections aren't remembered yet; it may be re-proposed"};if(i==="defer"){let u=je({store:e,card:o,note:t.note,changeBasis:t.changeBasis,tip:r,proposalId:t.proposalId,by:d});return u.ok?(t.signals?.({ref:o.display,verdict:"defer",...t.note?{reason:t.note}:{}}),{ok:!0,landed:"none",note:"gap recorded \u2014 visible in cover gaps until a later verdict resolves it"}):{ok:!1,refusal:u.refusal,code:"DEFER_GAP_INVALID"}}if(t.changeBasis?.to_cid){let u=n.resolve(t.changeBasis.source_id);if(!u)return{ok:!1,refusal:D().text("SOURCE_UNRESOLVED",{source_id:t.changeBasis.source_id}),code:"SOURCE_UNRESOLVED"};if(u.cid!==t.changeBasis.to_cid)return{ok:!1,refusal:D().text("SOURCE_MOVED",{source_id:t.changeBasis.source_id}),code:"SOURCE_MOVED"}}if(o.kind==="ARCHIVE"){let u=(t.proposal.archived??[]).filter(y=>{let S=n.resolve(y.target);return S!=null&&n.tipOf(S.cid)===r}),f=re({...t.proposal,archived:u},n);if(u.length===0||f.errors.length>0)return{ok:!1,refusal:f.errors.length>0?`${f.errors.map(y=>y.detail).join("; ")} \u2014 nothing landed; the card re-presents`:D().text("ARCHIVE_UNRESOLVED",{use_case:o.display}),code:f.errors[0]?.code??"ARCHIVE_UNRESOLVED"};let h;try{h=se({store:e,graph:n,verdicts:new Map([[r,{resolution:"rejected",...o.reason??t.note?{reason:o.reason??t.note}:{}}]]),by:d})}catch(y){if(y instanceof le)return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again",code:"CONCURRENT_APPEND"};throw y}return h.errors?{ok:!1,refusal:h.errors.map(y=>y.detail).join("; "),code:h.errors[0]?.code??"VALIDATION"}:(t.signals?.({ref:o.display,verdict:"archive"}),I({store:e,graph:n,targetTip:r,resolvedBy:r,...t.changeBasis?{sourceId:t.changeBasis.source_id}:{},by:d}),{ok:!0,landed:"archived"})}let s=o.payload,a=o.kind==="MODIFY"&&r&&s.matches_existing&&r!==s.matches_existing.cid?{...s,matches_existing:{...s.matches_existing,cid:r}}:s,l={version:1,read_basis:n.latestHash,source:t.proposal.source,...t.proposal.sources?{sources:t.proposal.sources}:{},use_cases:[a]},p=await me(ye(e,t.sid??`card-${process.pid}`,t.probe),{verb:"maintain",ucTargets:r?[{ref:r}]:[],newBuCandidates:o.kind==="ADD"?[{tempRef:a.temp_ref,title:a.title,probeText:`${a.title} ${a.summary??""}`.trim()}]:[],sourcePins:[],readBasis:n.latestHash},u=>{let f=P({store:e,graph:u.graph,scope:u.scope,proposal:l,proposalId:`${t.proposalId}:${o.key}`,verdicts:new Map([[a.temp_ref,{resolution:"approved"}]]),by:d,autoName:!0,allowStaleBasis:!0,eventIds:u.eventIds("maintain",1),...t.sid?{sid:u.sid}:{},probeHits:u.probeHits,...t.matchUnreviewed?{matchUnreviewed:!0}:{}});return f.errors!==null?{errors:f.errors}:{result:f,record:f.record}});if(!p.ok||!("result"in p)){let u=!p.ok&&p.kind==="validation"?p.errors:null;return{ok:!1,refusal:u?u.map(h=>h.detail).join("; "):"concurrent activity kept moving the store \u2014 try the card again",code:u?u[0]?.code??"VALIDATION":"CONCURRENT_APPEND"}}t.signals?.({ref:o.display,verdict:"approve"});let m=p.result.record?.nodes.find(u=>u.label==="usecase")?.cid,g=o.kind==="MODIFY"?m??r??void 0:m;return o.kind==="MODIFY"&&r&&I({store:e,graph:n,targetTip:r,resolvedBy:m??r,...t.changeBasis?{sourceId:t.changeBasis.source_id}:{},by:d}),{ok:!0,landed:o.kind==="MODIFY"?"successor":"minted",...g?{offer:{kind:o.kind==="MODIFY"?"evolve":"design",target:g}}:{}}}function je(t){let{card:e,changeBasis:n}=t,o={kind:"reconcile_deferred",derived:!0,text:e.changeLine||e.title,...e.risk?{risk:e.risk}:{},...t.note?{risk_rationale:t.note}:{},...t.tip?{ref:e.display,uc:t.tip}:{},...n?{basis:{source_id:n.source_id,from_cid:n.from_cid??"",to_cid:n.to_cid??""}}:{},...t.proposalId?{proposal_id:t.proposalId}:{},...e.payload?.temp_ref?{temp_ref:e.payload.temp_ref}:{}};return ce({store:t.store,content:o,...t.tip?{annotates:t.tip}:{},by:t.by})}var z=Ge(),Ue=12e4,W=new Set;function Ft(t,e){let n=`${t}:${e}`;return W.add(n),{process:z,pid:process.pid,done:()=>W.delete(n)}}function Me(t,e,n,o,i){return o.process===z?W.has(`${t}:${e}`):X()||o.pid!==void 0&&!ae(o.pid)?!1:i-Date.parse(n.at)<Ue}function jt(t){return t?.pending?t.pending.process===z?"this session":"another session":null}function Be(t,e){for(let n of t.recordsSince(t.parse(e.after)))if(e.kind==="record"&&n.proposal_id===e.proposal_id||e.kind==="archive"&&n.review.some(o=>o.id===e.target&&o.resolution==="rejected")||e.kind==="gap"&&n.nodes.some(o=>{let i=o.content;return o.label==="gap"&&i.kind==="reconcile_deferred"&&i.proposal_id===e.proposal_id&&i.text===e.text}))return n;return null}function He(t,e){if(e.kind==="gap"||!e.closes)return;let n=E(t),o=n.tipOf(e.closes.target);I({store:t,graph:n,targetTip:o,resolvedBy:o,by:e.closes.by,...e.closes.source?{sourceId:e.closes.source}:{}})}function Ye(t,e,n){let{pending:o,...i}=t;if(e.kind!=="record")return i;let d=n.nodes.find(r=>r.label==="usecase")?.cid??e.offer.fallback;return d?{...i,offer:{kind:e.offer.kind,key:d,title:e.offer.title}}:i}function Gt(t,e){let n=e.replaces;if(!n)return;let o=t.proposals(),i=o.verdicts(e.proposal_id);if(i.seeded_from===n)return;let d=B(t,n),r=E(t),s=g=>{let u=o.read(g);return u?K(u,r):[]},a=s(e.proposal_id),l=new Map(s(n).map(g=>[g.key,g]));for(let[g,u]of Object.entries(d.verdicts)){if(u.pending)continue;let f=l.get(g),h=f?.kind==="ADD"?f.title.toLowerCase():null,S=(h!==null?a.find(v=>v.kind==="ADD"&&v.title.toLowerCase()===h):a.find(v=>v.key===g&&v.kind!=="ADD"))?.key??(a.some(v=>v.key===g)?`${g}@${n}`:g);S in i.verdicts||(i.verdicts[S]=u)}i.seeded_from=n;let p=q(a,i.verdicts).length;a.length>0&&p===0&&!Object.values(i.verdicts).some(g=>g.pending)&&(i.resolved=!0),o.saveVerdicts(e.proposal_id,i);let m=o.verdicts(n);m.steer&&(delete m.steer,o.saveVerdicts(n,m))}function B(t,e){let n=t.proposals(),o=n.verdicts(e),i=Date.now(),d=!1;for(let[r,s]of Object.entries(o.verdicts)){if(!s.pending)continue;let a=Be(t,s.pending);if(a)He(t,s.pending),o.verdicts[r]=Ye(s,s.pending,a);else{if(Me(e,r,s,s.pending,i))continue;delete o.verdicts[r]}d=!0}if(d){let r=n.read(e);(r?q(K(r,E(t)),o.verdicts).length:1)===0&&!Object.values(o.verdicts).some(a=>a.pending)&&(o.resolved=!0),n.saveVerdicts(e,o)}return o}export{Ft as a,jt as b,Gt as c,B as d,Pe as e,at as f,lt as g,ut as h,ft as i,pt as j,gt as k,mt as l,K as m,q as n,Fe as o,Lt as p};
2
+ import{b as we}from"./chunk-TM6VLC6V.js";import{a as he,b as ve,c as _e}from"./chunk-GEZVC4S3.js";import{a as ye}from"./chunk-SVIIUKJ2.js";import{a as V,b as G,e as U}from"./chunk-WEJR2V7R.js";import{a as $,b as ge}from"./chunk-73ZFOJOK.js";import{a as me}from"./chunk-EZMRWXRT.js";import{d as pe}from"./chunk-FOLUB336.js";import{e as fe}from"./chunk-XB6BJPDL.js";import{$ as ie,C as te,D as ne,G as re,M as E,Na as le,Y as oe,da as P,e as F,ea as se,ia as ce,ja as I,sa as de,sb as j,tb as ue,xa as ae}from"./chunk-PI7OXS62.js";import{f as w,g as C,i as ee}from"./chunk-KU3YHPWZ.js";import{e as Z}from"./chunk-G4K3TP2I.js";import{h as X,o as D}from"./chunk-HYJVYYAZ.js";import{randomUUID as Ge}from"crypto";function De(t,e,n,o,i){let d=n.rows.filter(g=>{let u=o.get(g.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let r={version:1,read_basis:e.latestHash,source:{source_id:n.source_id,source_cid:e.heads.get(n.source_id)??""},use_cases:d.map(g=>g.uc)},s=new Map;for(let g of d){let u=o.get(g.temp_ref);typeof u=="object"?s.set(g.temp_ref,{resolution:"edited",edit:u.edited}):s.set(g.temp_ref,{resolution:g.uc.matches_existing&&g.uc.changed?"edited":"approved"})}let a=_e(r,e,n.staged_source_cid);if(a.errors!==null)return{record:null,errors:a.errors};let l=a.proposal,p=r.source.source_cid?V(t,e,r.source.source_cid):null;if(p!==null){l=ve(l,p);let g=ie(l,he(p),e);if(g.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:D().text("HELD_CITES_STALE.moved",{})},...g]}}let m=`held-${(e.latestHash??"root").slice(-12)}-${d.length}`;return P({store:t,graph:e,proposal:l,proposalId:m,verdicts:s,by:i,autoName:!0})}function Re(t,e,n=[]){let o=we(t,e),i=new Set,d=[],r=p=>{!p||i.has(p)||(i.add(p),d.push(k(t,p)))};for(let p of o.pairs)r(p.scenario),r(p.test);for(let[p,m]of o.verifies){r(p);for(let g of m)r(g)}if(n.length===0)return{stale_refs:d};let s=p=>`${String(p.props.source_id)}\0${String(p.props.anchor)}`,a=new Set;for(let{cid:p}of t.byLabel(w.USECASE))if(t.tipOf(p)===e)for(let m of t.edgesInto(p)){if(m.type!==C.DERIVES)continue;let g=m.props.claim;typeof g=="string"&&n.includes(g)&&a.add(s(m))}if(a.size===0)return{stale_refs:d};let l=new Set;for(let[p,m]of o.verifies)if(t.edgesInto(p).some(u=>u.type===C.DERIVES&&a.has(s(u)))){l.add(k(t,p));for(let u of m)l.add(k(t,u))}return{stale_refs:d,...l.size>0?{direct_refs:[...l]}:{}}}var ke="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",Le="suite untouched; graph updated";function N(t,e){return!t.superseded.has(e)&&t.trust.get(e)!=="archived"}function k(t,e,n=new Set){let o=t.nameOf.get(e);if(o!==void 0)return o;if(n.has(e))return e;n.add(e);for(let[i,d]of t.superseded){if(d!==e||de(i,e,s=>t.nodeLabel.get(s)))continue;let r=k(t,i,n);if(r!==i)return r}return e}function b(t){return String(t).slice(0,19)}function A(t,e,n){let o=t.edgesFrom(e).find(i=>i.type===n);return o?t.tipOf(o.dst):null}function M(t,e){let n=t.nodeLabel.get(e);if(n===w.USECASE)return e;if(n===w.SCENARIO)return A(t,e,C.BELONGS_TO);if(n===w.AC){let o=A(t,e,C.SCOPED_TO);return o?t.nodeLabel.get(o)===w.USECASE?o:A(t,o,C.BELONGS_TO):null}if(n===w.TEST){let o=A(t,e,C.AUTOMATES);return o?A(t,o,C.BELONGS_TO):null}return null}function Se(t,e){let n=[],o=new Map;for(let i of t.derivesInto(e))o.set(String(i.props.source_id),i);for(let[i,d]of o){let r=t.heads.get(i);if(r==null){n.push(`DERIVES pin ${i} @ ${b(d.props.source_cid)} \u2014 source retired`);continue}let s=j(t,e,i);if(s!==null){s.stale&&n.push(`DERIVES pin ${i} \u2014 ${ue(i,s)}`);continue}if(r!==d.props.source_cid){let a=t.convChains.get(i)?.chain;if(a&&a.includes(String(d.props.source_cid)))continue;n.push(`DERIVES pin ${i} @ ${b(d.props.source_cid)} \u2014 source head moved to ${b(r)}`)}}for(let i of t.edgesFrom(e))ee(i.type)?.pin?.comparesTo==="dst_tip"&&t.superseded.has(i.dst)&&n.push(`${i.type} pin \u2192 ${k(t,i.dst)} \u2014 target superseded`);return n.join("; ")||"structural pin broken"}var xe=new Set([w.USECASE,w.SCENARIO,w.AC,w.TEST]);function L(t,e){return t.ref<e.ref?-1:t.ref>e.ref?1:0}function Ie(t,e,n,o,i){let d=n.props.quote;if(typeof d=="string"&&d.length>0)return ne(d,o);let r=String(n.props.source_cid);i.has(r)||i.set(r,V(t,e,r));let s=i.get(r);if(s===null)return!1;let a=te(s,String(n.props.anchor));return a===null?!1:a.split(`
3
+ `).some(l=>l.trim().length>0&&o.includes(l.trim()))}function Ae(t,e,n){let o=F(String(e.props.anchor));if(o?.kind!=="img-part")return!1;let d=(t.mediaOf(String(e.props.source_cid)).images??[]).find(l=>l.ref===o.ref),r=d?.blob;if(r===void 0)return!1;let s=t.mediaOf(n).images??[];if(s.some(l=>l.blob===r))return!0;let a=d?.appearance;return a!==void 0&&s.filter(l=>l.appearance===a).length===1}function Pe(t,e,n={}){let o=n.now??new Date,i=t.sessions(),d=[],r=0;for(let s of i.list())if(s.sid!==n.except){if(s.corrupt){r+=1;continue}try{let a=i.peek(s.sid);if(!a||Z(a,o))continue;let l=a.pending.proposals.some(m=>(m.content?._held?.source_id??null)===e),p=a.reconcile!=null&&e in a.read_basis&&B(t,a.reconcile.proposal_id).resolved!==!0;(l||p)&&d.push(a.sid)}catch{r+=1}}return{holders:d,corrupt:r}}async function at(t,e){let{holders:n,corrupt:o}=Pe(t,e.sourceId,{...e.now?{now:e.now}:{},...e.sessionId?{except:e.sessionId}:{}});if(o>0)return{kind:"unverifiable",corrupt:o};if(n.length>0)return{kind:"held",holders:n};if((await e.reingest(e.sourceId)).status==="unchanged")return{kind:"unchanged"};let d=G(t,e.sourceId);return d.kind==="ok"?{kind:"landed",changeContext:d.changeContext}:d}function $e(t,e,n){let o=t.getNode(e)?.content??{},i=t.getNode(n)?.content??{},r=[...new Set([...Object.keys(o),...Object.keys(i)])].sort().filter(s=>JSON.stringify(o[s])!==JSON.stringify(i[s]));return r.length>0?`updated: ${r.join(", ")}`:"updated"}function Ve(t,e,n,o,i,d,r){let s=new Set((r?.rows??[]).map(f=>f.matched_cid).filter(f=>!!f)),a=[];for(let[f,h]of n.superseded)h===null||f===h||e.superseded.has(f)||n.nodeLabel.get(f)===w.USECASE&&a.push({kind:"MODIFY",ref:k(n,f),old_cid:f,new_cid:h,summary:$e(n,f,h)});let l=d.map(f=>({kind:"ADD",ref:k(n,f),cid:f}));for(let f of r?.rows??[])f.kind==="MODIFY"&&f.matched_cid?a.push({kind:"MODIFY",ref:k(n,f.matched_cid),old_cid:f.matched_cid,new_cid:null,summary:`${f.why} (staged)`}):f.kind==="ADD"&&l.push({kind:"ADD",ref:f.title,cid:null});let p=[],m=V(t,n,i),g=new Map;for(let{cid:f}of n.byLabel(w.USECASE)){if(!N(n,f)||s.has(f))continue;let h=n.derivesInto(f),y=h.filter(c=>String(c.props.source_id)===o);if(y.length===0)continue;let S=j(n,f,o);S!==null&&!S.stale||y.some(c=>c.props.source_cid===i)||y.some(c=>{let _=String(c.props.anchor),x=F(_);return x?.kind==="img-whole"?!1:x?.kind==="img-part"?Ae(n,c,i):m!==null&&Ie(t,n,c,m,g)})||h.some(c=>{let _=String(c.props.source_id);if(_===o)return!1;let x=n.heads.get(_);return x!=null})||p.push({kind:"ARCHIVE",ref:k(n,f),cid:f,why:`evidence decayed: no quote from ${o} relocates into @${b(i)}, no other live source, no fresh evidence this run`,impact:Re(n,n.tipOf(f))})}let u=(f,h)=>f.ref<h.ref?-1:f.ref>h.ref?1:0;return[...a.sort(u),...l.sort(u),...p.sort(u)]}function lt(t,e,n,o,i){let d=e.rows.find(u=>u.temp_ref===n);if(!d)return{ok:!1,message:`held item ${n} missing from the plan artifact`};let r=d,s=E(t);if(r.matched_cid){let u=s.tipOf(r.matched_cid);if(s.superseded.get(u)===null)return{ok:!1,message:`use-case for "${r.title}" was retired meanwhile \u2014 nothing to update`};u!==r.matched_cid&&(r={...r,matched_cid:u,uc:{...r.uc,matches_existing:{cid:u}}})}let a=i?{edited:i}:"approve",l=De(t,s,{source_id:e.source_id,...e.staged_source_cid!==void 0?{staged_source_cid:e.staged_source_cid}:{},rows:[r]},new Map([[r.temp_ref,a]]),o);if(l.errors)return{ok:!1,message:l.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let p=E(t),m=r.matched_cid?p.tipOf(r.matched_cid):l.record?.nodes.find(u=>u.label==="usecase")?.cid??l.record?.review[0]?.id;return{ok:!0,ref:m?k(p,m):r.title,kind:r.kind}}async function ut(t,e,n,o={}){let i=E(t);t.prefetch(fe(i,e),{token:null});let d=i.heads.get(e)??null,r=new Set(i.staleList().filter(c=>c.state==="stale").map(c=>c.cid)),s=await n.reingest(e);if(s.status==="unchanged"&&!o.resumeHeld&&!o.reextractUnchanged)return{source_id:e,changed:!1,head:{status:s.status,before:d,after:s.cid},note:`nothing to reconcile \u2014 ${e} is unchanged`,skipped_arms:ke,changeset:[],rows:[]};let a=o.resumeHeld?{minted:[],matched:[],held:o.resumeHeld}:await n.reextract(e),l=E(t),p=a.minted.map(c=>{let _=k(l,c);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${e}`,provenance:`extraction commit \u2014 DERIVES ${e} @ ${b(s.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=l.staleList().filter(c=>c.state==="stale"&&!r.has(c.cid)&&N(l,c.cid)).map(c=>c.cid),g=m.map(c=>{let _=k(l,c),x=xe.has(l.nodeLabel.get(c)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:Se(l,c),action:x?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],f=[];for(let c of a.held?.rows??[])if(c.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:c.title,held_ref:c.temp_ref,reason:`${c.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${e} @ ${b(s.cid)}`,action:"approve to commit + design"});else{let _=c.matched_cid?l.tipOf(c.matched_cid):null,x=_?l.getNode(_)?.content.criteria??[]:[],J=(c.uc.updated?.criteria??[]).map(O=>typeof O=="string"?O:O.text),be=[...J.filter(O=>!x.includes(O)),...c.uc.updated?.criteria!==void 0?x.filter(O=>!J.includes(O)):[]],Q=_?Re(l,_,be):void 0;f.push({kind:"MODIFY",origin:"content-change",ref:c.matched_cid?k(l,c.matched_cid):c.title,held_ref:c.temp_ref,reason:`${c.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${e} @ ${b(s.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...Q?{impact:Q}:{}})}let h=new Set;for(let c of[...a.minted,...a.matched])h.add(l.tipOf(c));for(let c of a.held?.rows??[])c.matched_cid&&h.add(l.tipOf(c.matched_cid));for(let c of m){let _=M(l,l.tipOf(c));_&&l.nodeLabel.get(_)===w.USECASE&&h.add(l.tipOf(_))}let y=[];for(let c of await pe(l,"design")){if(c.kind!=="no-verifies")continue;let _=l.resolve(c.ref);if(!_)continue;let x=M(l,_.tip);!x||!h.has(l.tipOf(x))||y.push({kind:"ADD",origin:"content-change",ref:c.ref,reason:c.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${k(l,x)}`,action:c.ready_command})}let S=[];for(let{cid:c}of l.byLabel(w.USECASE))N(l,c)&&l.stale(c)==="orphaned"&&S.push({kind:"REMOVE",ref:k(l,c),reason:"orphaned \u2014 no live source evidences this use-case",provenance:Se(l,c),action:"plan-only \u2014 REMOVE is not executed in this release"});let v=new Set,R=[...p.sort(L),...u.sort(L),...y.sort(L),...f.sort(L),...g.sort(L),...S.sort(L)].filter(c=>{let _=`${c.kind}\0${c.ref}`;return v.has(_)?!1:(v.add(_),!0)});return{source_id:e,changed:!0,head:{status:s.status,before:d,after:s.cid},note:Le,skipped_arms:ke,changeset:Ve(t,i,l,e,s.cid,a.minted,a.held),rows:R,...a.held?{held:a.held}:{}}}function ft(t,e){return async n=>{let{ingestFile:o}=await import("./ingest-ZHHHBUXR.js"),{convertPdf:i}=await import("./pdf-convert-YB6PJFMI.js"),{convertDocx:d}=await import("./docx-convert-DO5AQYD3.js"),r=await o({store:t,filePath:e,asId:n,converters:{pdf:i,docx:d}});return{status:r.status,cid:r.cid}}}function pt(t,e,n,o={}){return async i=>{let{ingestThroughPlugin:d}=await import("./lane-CNGO7LH5.js"),r=await d({store:t,plugin:e,ref:n,named:o.named??!1,asId:i,...o.connect?{connect:o.connect}:{},...o.registry?{registry:o.registry}:{}});return{status:r.status,cid:r.cid}}}function gt(t,e,n,o,i){return async()=>{let r=(i??(await import("./dispatch-BV6XMCN3.js")).findProvider)(e);if(!r)throw new Error(`the remote re-ingest failed \u2014 no provider matches '${e}'`);let s=await r.ingest(e,void 0,{out:n.out,err:n.err,confirm:async()=>!0,isTTY:!1},t,{credentials:o});if(s.code!==0||!s.result)throw new Error("the remote re-ingest failed \u2014 fix the reported problem and re-run");return{status:s.result.status,cid:s.result.source_cid}}}function mt(t,e){return async n=>{let o=[],[{runExtract:i},{resolveAgentAuthEnv:d},{runAgent:r},{preflightTurn:s}]=await Promise.all([import("./run-YUHHD54J.js"),import("./spawner-MQ4XEHIX.js"),import("./bridge-2UHJOVLX.js"),import("./turn-preflight-R4PU6NYY.js")]),a=await d(e.credentials),l=new Set(E(t).byLabel(w.USECASE).map(v=>v.cid)),p=U(t,n)??void 0,m=0,g=await i({mode:"override",source:n,...p?{changeContext:p}:{}},{agent:r,store:t,credentials:e.credentials,onIngestRefusal:e.onIngestRefusal,preflightTurn:()=>s(a),ask:async()=>[],review:async v=>{if(!e.stage)return new Map(v.map(c=>[c.temp_ref,{resolution:c.matches_existing&&c.changed?"edited":"skipped"}]));let R=new Map;for(let c of v){if(c.matches_existing&&!c.changed){R.set(c.temp_ref,{resolution:"skipped"});continue}o.push({kind:c.matches_existing?"MODIFY":"ADD",temp_ref:c.temp_ref,title:c.title,why:c.matches_existing?`updated: ${Object.keys(c.updated??{}).join(", ")||"content"}`:`newly extracted from ${n}`,...c.matches_existing?{matched_cid:c.matches_existing.cid,updated:c.updated}:{},uc:c}),R.set(c.temp_ref,{resolution:"rejected"})}return R},confirmStale:async()=>!1,out:v=>e.hostOut?.(v),progress:v=>e.hostProgress?.(v),emit:v=>{v.type==="commit"&&typeof v.assumed=="number"&&(m+=v.assumed),e.hostEmit?.(v)},isTTY:!1,auth:a});if(g!==0)throw new Error(`reconcile: re-extract of ${n} failed (exit ${g})`);let u=E(t),f=u.heads.get(n),h=[],y=[];if(typeof f=="string"){let v=new Set;for(let R of u.edgesFrom(f))R.type!==C.DERIVES||u.nodeLabel.get(R.dst)!==w.USECASE||v.has(R.dst)||(v.add(R.dst),!(e.stage&&u.trust.get(R.dst)==="archived")&&(l.has(R.dst)?y:h).push(R.dst))}let S=E(t).heads.get(n);return{minted:h,matched:y,defaultsTaken:m,...e.stage?{held:{source_id:n,...S!=null?{staged_source_cid:S}:{},rows:o}}:{}}}}var Ne=["title","description","summary","value"];function Ce(t,e){let n=[],o=e.updated;if(!o)return n;for(let r of Ne){let s=o[r];if(typeof s!="string"||s===t[r])continue;let a=t[r];typeof a=="string"&&a.length>0&&n.push({op:"-",field:r,text:a}),n.push({op:"+",field:r,text:s})}let i=(t.criteria??[]).map(String),d=o.criteria??[];if(d.length>0)if(d.some(r=>"op"in r))for(let r of d)r.op==="set"&&n.push({op:"+",field:"criteria",text:r.text}),r.op==="remove"&&n.push({op:"-",field:"criteria",text:r.text});else{let r=d.map(s=>s.text);for(let s of i)r.includes(s)||n.push({op:"-",field:"criteria",text:s});for(let s of r)i.includes(s)||n.push({op:"+",field:"criteria",text:s})}return n}function H(t){let e=t.filter(r=>r.field==="criteria"),n=e.filter(r=>r.op==="+").length,o=e.filter(r=>r.op==="-").length,i=[...new Set(t.filter(r=>r.field!=="criteria").map(r=>r.field))],d=[];return e.length>0&&d.push(`${e.length} criteria changed \xB7 +${n} \u2212${o}`),i.length>0&&d.push(`${i.join("/")} reworded`),d.join(" \xB7 ")||"no field changes"}var Ee={high:0,med:1,low:2};function Y(t,e){return e?t.displayNameOf(e)??`${e.slice(0,19)}\u2026`:"(new)"}function T(t,e){if(!e)return;let n=t.edgesInto(e).filter(o=>o.type===C.BELONGS_TO||o.type===C.SCOPED_TO);if(n.length!==0)return{stale:n.length,direct:n.slice(0,3).map(o=>Y(t,o.src))}}function Oe(t){return oe(t).map(e=>({...e.source_id!==void 0?{source_id:e.source_id}:{},anchor:e.anchor,quote:e.quote??""}))}function K(t,e){let n=ge(t),o=[];for(let i of n.updates){let d=e.resolve(i.matches_existing.cid),r=d?e.tipOf(d.cid):null,s=(r?e.getNode(r)?.content:void 0)??{},a=Ce(s,i);o.push({key:$("MODIFY",i.matches_existing.cid),kind:"MODIFY",...r?{ref:r}:{},display:Y(e,r),title:typeof s.title=="string"?s.title:i.title,changeLine:i.change_note??H(a),diff:a,diffSummary:a.length>4?H(a):null,...i.risk!==void 0?{risk:i.risk}:{},cites:Oe(i),...i.matches_existing?.reason!==void 0?{tier:i.matches_existing.reason}:{},...T(e,r)!==void 0?{impact:T(e,r)}:{},payload:i})}for(let i of n.adds)o.push({key:$("ADD",i.temp_ref),kind:"ADD",display:"(new)",title:i.title,changeLine:i.summary??i.title,diff:[],diffSummary:null,...i.risk!==void 0?{risk:i.risk}:{},cites:Oe(i),payload:i});for(let i of n.archives){let d=e.resolve(i.target),r=d?e.tipOf(d.cid):null,s=(r?e.getNode(r)?.content:void 0)??{};o.push({key:$("ARCHIVE",i.target),kind:"ARCHIVE",...r?{ref:r}:{},display:Y(e,r),title:typeof s.title=="string"?s.title:i.target,changeLine:i.reason,diff:[],diffSummary:null,...typeof s.risk=="string"?{risk:s.risk}:{},cites:[],reason:i.reason,basis:i.basis,...T(e,r)!==void 0?{impact:T(e,r)}:{}})}return o.sort((i,d)=>(Ee[i.risk??"low"]??2)-(Ee[d.risk??"low"]??2))}function q(t,e){return t.filter(n=>!(n.key in e)||e[n.key]?.pending!==void 0)}function Fe(t,e){if(e.kind==="ADD")return null;let n=e.ref?t.resolve(e.ref):null;return n?t.tipOf(n.cid):null}async function Lt(t){let{store:e,graph:n,card:o,verdict:i,by:d}=t,r=Fe(n,o);if(o.kind!=="ADD"&&(!r||(n.trust.get(r)??null)==="archived"))return{ok:!1,refusal:`its target ${o.display} was retired while the review was open \u2014 nothing landed`,code:"TARGET_RETIRED"};if(i==="reject")return t.signals?.({ref:o.display,verdict:"reject",...t.note?{reason:t.note}:{}}),{ok:!0,landed:"none",note:"nothing saved \u2014 rejections aren't remembered yet; it may be re-proposed"};if(i==="defer"){let u=je({store:e,card:o,note:t.note,changeBasis:t.changeBasis,tip:r,proposalId:t.proposalId,by:d});return u.ok?(t.signals?.({ref:o.display,verdict:"defer",...t.note?{reason:t.note}:{}}),{ok:!0,landed:"none",note:"gap recorded \u2014 visible in cover gaps until a later verdict resolves it"}):{ok:!1,refusal:u.refusal,code:"DEFER_GAP_INVALID"}}if(t.changeBasis?.to_cid){let u=n.resolve(t.changeBasis.source_id);if(!u)return{ok:!1,refusal:D().text("SOURCE_UNRESOLVED",{source_id:t.changeBasis.source_id}),code:"SOURCE_UNRESOLVED"};if(u.cid!==t.changeBasis.to_cid)return{ok:!1,refusal:D().text("SOURCE_MOVED",{source_id:t.changeBasis.source_id}),code:"SOURCE_MOVED"}}if(o.kind==="ARCHIVE"){let u=(t.proposal.archived??[]).filter(y=>{let S=n.resolve(y.target);return S!=null&&n.tipOf(S.cid)===r}),f=re({...t.proposal,archived:u},n);if(u.length===0||f.errors.length>0)return{ok:!1,refusal:f.errors.length>0?`${f.errors.map(y=>y.detail).join("; ")} \u2014 nothing landed; the card re-presents`:D().text("ARCHIVE_UNRESOLVED",{use_case:o.display}),code:f.errors[0]?.code??"ARCHIVE_UNRESOLVED"};let h;try{h=se({store:e,graph:n,verdicts:new Map([[r,{resolution:"rejected",...o.reason??t.note?{reason:o.reason??t.note}:{}}]]),by:d})}catch(y){if(y instanceof le)return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again",code:"CONCURRENT_APPEND"};throw y}return h.errors?{ok:!1,refusal:h.errors.map(y=>y.detail).join("; "),code:h.errors[0]?.code??"VALIDATION"}:(t.signals?.({ref:o.display,verdict:"archive"}),I({store:e,graph:n,targetTip:r,resolvedBy:r,...t.changeBasis?{sourceId:t.changeBasis.source_id}:{},by:d}),{ok:!0,landed:"archived"})}let s=o.payload,a=o.kind==="MODIFY"&&r&&s.matches_existing&&r!==s.matches_existing.cid?{...s,matches_existing:{...s.matches_existing,cid:r}}:s,l={version:1,read_basis:n.latestHash,source:t.proposal.source,...t.proposal.sources?{sources:t.proposal.sources}:{},use_cases:[a]},p=await me(ye(e,t.sid??`card-${process.pid}`,t.probe),{verb:"maintain",ucTargets:r?[{ref:r}]:[],newBuCandidates:o.kind==="ADD"?[{tempRef:a.temp_ref,title:a.title,probeText:`${a.title} ${a.summary??""}`.trim()}]:[],sourcePins:[],readBasis:n.latestHash},u=>{let f=P({store:e,graph:u.graph,scope:u.scope,proposal:l,proposalId:`${t.proposalId}:${o.key}`,verdicts:new Map([[a.temp_ref,{resolution:"approved"}]]),by:d,autoName:!0,allowStaleBasis:!0,eventIds:u.eventIds("maintain",1),...t.sid?{sid:u.sid}:{},probeHits:u.probeHits,...t.matchUnreviewed?{matchUnreviewed:!0}:{}});return f.errors!==null?{errors:f.errors}:{result:f,record:f.record}});if(!p.ok||!("result"in p)){let u=!p.ok&&p.kind==="validation"?p.errors:null;return{ok:!1,refusal:u?u.map(h=>h.detail).join("; "):"concurrent activity kept moving the store \u2014 try the card again",code:u?u[0]?.code??"VALIDATION":"CONCURRENT_APPEND"}}t.signals?.({ref:o.display,verdict:"approve"});let m=p.result.record?.nodes.find(u=>u.label==="usecase")?.cid,g=o.kind==="MODIFY"?m??r??void 0:m;return o.kind==="MODIFY"&&r&&I({store:e,graph:n,targetTip:r,resolvedBy:m??r,...t.changeBasis?{sourceId:t.changeBasis.source_id}:{},by:d}),{ok:!0,landed:o.kind==="MODIFY"?"successor":"minted",...g?{offer:{kind:o.kind==="MODIFY"?"evolve":"design",target:g}}:{}}}function je(t){let{card:e,changeBasis:n}=t,o={kind:"reconcile_deferred",derived:!0,text:e.changeLine||e.title,...e.risk?{risk:e.risk}:{},...t.note?{risk_rationale:t.note}:{},...t.tip?{ref:e.display,uc:t.tip}:{},...n?{basis:{source_id:n.source_id,from_cid:n.from_cid??"",to_cid:n.to_cid??""}}:{},...t.proposalId?{proposal_id:t.proposalId}:{},...e.payload?.temp_ref?{temp_ref:e.payload.temp_ref}:{}};return ce({store:t.store,content:o,...t.tip?{annotates:t.tip}:{},by:t.by})}var z=Ge(),Ue=12e4,W=new Set;function Ft(t,e){let n=`${t}:${e}`;return W.add(n),{process:z,pid:process.pid,done:()=>W.delete(n)}}function Me(t,e,n,o,i){return o.process===z?W.has(`${t}:${e}`):X()||o.pid!==void 0&&!ae(o.pid)?!1:i-Date.parse(n.at)<Ue}function jt(t){return t?.pending?t.pending.process===z?"this session":"another session":null}function Be(t,e){for(let n of t.recordsSince(t.parse(e.after)))if(e.kind==="record"&&n.proposal_id===e.proposal_id||e.kind==="archive"&&n.review.some(o=>o.id===e.target&&o.resolution==="rejected")||e.kind==="gap"&&n.nodes.some(o=>{let i=o.content;return o.label==="gap"&&i.kind==="reconcile_deferred"&&i.proposal_id===e.proposal_id&&i.text===e.text}))return n;return null}function He(t,e){if(e.kind==="gap"||!e.closes)return;let n=E(t),o=n.tipOf(e.closes.target);I({store:t,graph:n,targetTip:o,resolvedBy:o,by:e.closes.by,...e.closes.source?{sourceId:e.closes.source}:{}})}function Ye(t,e,n){let{pending:o,...i}=t;if(e.kind!=="record")return i;let d=n.nodes.find(r=>r.label==="usecase")?.cid??e.offer.fallback;return d?{...i,offer:{kind:e.offer.kind,key:d,title:e.offer.title}}:i}function Gt(t,e){let n=e.replaces;if(!n)return;let o=t.proposals(),i=o.verdicts(e.proposal_id);if(i.seeded_from===n)return;let d=B(t,n),r=E(t),s=g=>{let u=o.read(g);return u?K(u,r):[]},a=s(e.proposal_id),l=new Map(s(n).map(g=>[g.key,g]));for(let[g,u]of Object.entries(d.verdicts)){if(u.pending)continue;let f=l.get(g),h=f?.kind==="ADD"?f.title.toLowerCase():null,S=(h!==null?a.find(v=>v.kind==="ADD"&&v.title.toLowerCase()===h):a.find(v=>v.key===g&&v.kind!=="ADD"))?.key??(a.some(v=>v.key===g)?`${g}@${n}`:g);S in i.verdicts||(i.verdicts[S]=u)}i.seeded_from=n;let p=q(a,i.verdicts).length;a.length>0&&p===0&&!Object.values(i.verdicts).some(g=>g.pending)&&(i.resolved=!0),o.saveVerdicts(e.proposal_id,i);let m=o.verdicts(n);m.steer&&(delete m.steer,o.saveVerdicts(n,m))}function B(t,e){let n=t.proposals(),o=n.verdicts(e),i=Date.now(),d=!1;for(let[r,s]of Object.entries(o.verdicts)){if(!s.pending)continue;let a=Be(t,s.pending);if(a)He(t,s.pending),o.verdicts[r]=Ye(s,s.pending,a);else{if(Me(e,r,s,s.pending,i))continue;delete o.verdicts[r]}d=!0}if(d){let r=n.read(e);(r?q(K(r,E(t)),o.verdicts).length:1)===0&&!Object.values(o.verdicts).some(a=>a.pending)&&(o.resolved=!0),n.saveVerdicts(e,o)}return o}export{Ft as a,jt as b,Gt as c,B as d,Pe as e,at as f,lt as g,ut as h,ft as i,pt as j,gt as k,mt as l,K as m,q as n,Fe as o,Lt as p};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-JFBEHCJN.js";import{a as m}from"./chunk-GGV336P5.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-VZA7BPCK.js";import{a as c,b as s,h as a,y as u}from"./chunk-QMOGBKJM.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-Z47ZEFH7.js";import{a as m}from"./chunk-ZCBOHWN3.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-TM45NPWL.js";import{a as c,b as s,h as a,y as u}from"./chunk-J4FIESTB.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-4IEQNX7F.js";import{f as s}from"./chunk-MYZHOBS4.js";import{existsSync as c,mkdirSync as l,readFileSync as f,renameSync as p,writeFileSync as m}from"fs";import{dirname as d,join as u}from"path";function x(n){return u(n,".testmuai","variables","assurance.json")}function S(n){for(let e of n.declarations){let o=s(e.name);if(o)throw new Error(`variable declaration refused: ${o}`)}let i={};if(c(n.file)){let e=a(f(n.file,"utf8"),n.file);e&&typeof e=="object"&&!Array.isArray(e)&&(i=e)}let r=[],t=[];for(let e of n.declarations){if(Object.hasOwn(i,e.name)||n.known?.has(e.name)){t.push(e.name);continue}i[e.name]={value:"",secret:!!e.secret,description:e.description},r.push(e.name)}if(r.length>0){l(d(n.file),{recursive:!0});let e=`${n.file}.tmp-${process.pid}-${Date.now()}`;m(e,JSON.stringify(i,null,2)+`
2
+ import{a}from"./chunk-4IEQNX7F.js";import{f as s}from"./chunk-EHB55V23.js";import{existsSync as c,mkdirSync as l,readFileSync as f,renameSync as p,writeFileSync as m}from"fs";import{dirname as d,join as u}from"path";function x(n){return u(n,".testmuai","variables","assurance.json")}function S(n){for(let e of n.declarations){let o=s(e.name);if(o)throw new Error(`variable declaration refused: ${o}`)}let i={};if(c(n.file)){let e=a(f(n.file,"utf8"),n.file);e&&typeof e=="object"&&!Array.isArray(e)&&(i=e)}let r=[],t=[];for(let e of n.declarations){if(Object.hasOwn(i,e.name)||n.known?.has(e.name)){t.push(e.name);continue}i[e.name]={value:"",secret:!!e.secret,description:e.description},r.push(e.name)}if(r.length>0){l(d(n.file),{recursive:!0});let e=`${n.file}.tmp-${process.pid}-${Date.now()}`;m(e,JSON.stringify(i,null,2)+`
3
3
  `),p(e,n.file)}return{written:r,skipped:t}}export{x as a,S as b};
@@ -1,9 +1,9 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as V,e as P,f as Ve,k as He}from"./chunk-GXMD23XB.js";import{b as Pe}from"./chunk-DHYGCHKB.js";import{j as Oe,k as X}from"./chunk-VQZOKTJ2.js";import{h as Y}from"./chunk-QQI6N3FO.js";import{e as Re}from"./chunk-ZKPY3AXW.js";import{e as ge,i as he}from"./chunk-XMPTFXPW.js";import{a as ee,b as Se,c as _e}from"./chunk-G3J4XY3Z.js";import{a as Me,b as Ue,c as De,d as te,g as Ce,m as ne,n as G,o as Ae,p as se,q as Be,r as je,s as re,t as Fe,u as Ge}from"./chunk-DBTMKBHU.js";import{e as Te}from"./chunk-ZGQM6KWN.js";import{c as Ne,h as Ee}from"./chunk-ORNVIEUA.js";import{j as Le,k as $e}from"./chunk-I2VU2DTS.js";import{f as xe,g as q,j as Z,n as ve}from"./chunk-RLOJH5O6.js";import{j as ke}from"./chunk-REKHAN53.js";import{b as F}from"./chunk-CJE7PKRV.js";import{b as Q}from"./chunk-K3OSK6PB.js";import{B as we,Ha as m,f as pe,p as Ie,w as be}from"./chunk-TLOYTGVT.js";import{a as E,e as ye}from"./chunk-I2MC6VVX.js";import{j as J}from"./chunk-Z777GGHB.js";import{d as j}from"./chunk-DBMW3VUN.js";import{a as me}from"./chunk-FOJHSG5M.js";import{existsSync as oe,readFileSync as ae,statSync as H}from"fs";import{basename as de,extname as K}from"path";var ie=1024*1024,qe=1e3,Ze=e=>12e4+Math.ceil(e/ie)*1e3,v=e=>e>=ie?`${(e/ie).toFixed(1).replace(/\.0$/,"")} MB`:`${Math.max(1,Math.round(e/1024))} KB`,et=e=>new Promise(i=>setTimeout(i,e)),tt=e=>/^[a-z][a-z0-9+.-]*:/i.test(e)&&!oe(e);async function Ke(e,i,s,l){let o=new Map(l.map(a=>[a.sourceId,a.head])),d=[];for(let a of s){let r=o.get(a.sourceId);(r?await e.mainNode(i,r).then(f=>f.content.blob,()=>null):null)!==F(a.bytes)&&d.push(a)}return d}var nt=new Set(["KIND_MISMATCH","SITE_MOVED","UUID_MOVED","WEB_URL_CHANGED"]);function T(e){let i=e.code==="PLUGIN_HOOK_FAILED"||e.code==="PLUGIN_HOOK_TIMEOUT";return{refusal:{code:e.code,message:e.message,remedy:e.remedy??"check the source, then run the command again",...i?{support:!0}:{}},exit:i?1:2}}async function st(e,i,s){let l=i.plugin.manifest.id,o=ee(e),d;try{d=await _e(i.plugin,"claim",j.hookMs,()=>i.plugin.claim({ref:i.ref,named:i.named,isFile:o}))}catch(t){if(t instanceof Ne)return T(t.refusal);throw t}if(d==null)return T({code:"PLUGIN_NOT_CLAIMED",message:`plugin ${l} does not read ${i.ref}`,remedy:i.named?`drop the ${l}: prefix, or name the plugin that reads it`:"ingest it as a file of a built-in kind"});let a=d.sourceId;if(typeof a!="string")return T({code:"PLUGIN_HOOK_FAILED",message:`plugin ${l} answered claim with something that is not a claim`});let r=s??a;if(!Se(r))return T({code:"PLUGIN_SOURCE_ID_INVALID",message:`${JSON.stringify(r)} is not an id a source may have: it starts with a letter or digit and holds letters, digits and . _ -, at most 128 characters`,remedy:s===void 0?"give the source an id with --as <id>":"give another id with --as <id>"});let y={id:l,ref:i.ref,named:i.named,isFile:o},f=v(j.contentBytes);if(!o)return{item:{kind:"file",path:e,node:`ref:${e}`,file:e,bytes:Buffer.alloc(0),sourceId:r,limit:f,plugin:y}};let I=de(e),c;try{c=ae(e)}catch{return{refusal:m.ingestCantOpen(I),exit:2}}if(c.byteLength>j.contentBytes)return{refusal:m.ingestTooLarge(I,v(c.byteLength),f),exit:2};let{dev:u,ino:p}=H(e);return{item:{kind:"file",path:e,node:`${u}:${p}`,file:I,bytes:c,sourceId:r,limit:f,plugin:y}}}var S=e=>e.kind==="file"?e.path:e.address;function We(e){if(e.provider.name==="web")return`web|${e.sourceId}`;let i=new URL(e.address),s=e.provider.name.startsWith("linear")?`${i.host}/${i.pathname.split("/")[1]??""}`:i.host;return`${e.provider.name}|${s.toLowerCase()}|${e.sourceId}`}var rt=(e,i)=>e.kind==="file"?i.kind==="file"&&e.node===i.node:i.kind==="link"&&We(e)===We(i);async function it(e,i,s){let l=new Map;for(let t of e)l.set(t.sourceId,[...l.get(t.sourceId)??[],t]);let o=[...l.values()].filter(t=>t.length>1);if(o.length===0)return null;let d=i?.map(t=>t.sourceId)??null,a=new Set(o.flatMap(t=>t.slice(1))),r=new Set([...l.keys(),...d??[]]),y=t=>{if(d===null)return null;let R=2;for(;r.has(`${t}-${R}`);)R++;return r.add(`${t}-${R}`),`${t}-${R}`},f=t=>t.kind==="file"?t.path:te(t.provider.name,t.address),I=new Set(i?.filter(t=>t.head!==null).map(t=>t.sourceId)),c=e.filter(t=>!a.has(t)&&I.has(t.sourceId)),u=await s(c.flatMap(t=>t.kind==="file"?[t]:[])),p=e.filter(t=>!a.has(t)&&!u.includes(t));return je(o.map(t=>({names:t.map(f),id:t[0].sourceId})),p.map(S),e.filter(t=>a.has(t)).map(t=>({ref:S(t),as:y(t.sourceId),place:l.get(t.sourceId).indexOf(t)+1})),{reviews:u.flatMap(t=>t.kind==="file"?[{name:t.file,ref:t.path,id:t.sourceId}]:[]),link:c.some(t=>t.kind==="link"),firstTwin:p.some(t=>l.get(t.sourceId).length>1)})}async function Ft(e){try{return await ot(e)}finally{await be()}}async function ot(e){let i=e.mode==="agent",s=n=>i?ke(ge("ndjson",n,e.testing?.agentLines?{stdout:e.testing.agentLines,stderr:()=>{}}:void 0),{atQuestionsOnly:!0}):null,l=s("extract");l&&e.choice.onboarded&&l.event({type:"folder_linked",project_id:e.choice.projectId,project:e.choice.projectName});let o=(n,h,g=!1,O=l)=>O?(O.event({type:"error",code:n.code,message:n.message,...we(n),...n.notAdded?{not_added:n.notAdded}:{}}),O.done(h,"refused")):(g&&e.choice.onboarded?process.stdout.write(`${Oe(e.choice.projectName)}
2
+ import{d as V,e as P,f as Ve,k as He}from"./chunk-7SU53QGU.js";import{b as Pe}from"./chunk-6HRNG4CK.js";import{j as Oe,k as X}from"./chunk-4CJQ7XZP.js";import{h as Y}from"./chunk-3RO2YGKH.js";import{e as Re}from"./chunk-NI3TIAD7.js";import{e as ge,i as he}from"./chunk-XMPTFXPW.js";import{a as ee,b as Se,c as _e}from"./chunk-32HED7X2.js";import{a as Me,b as Ue,c as De,d as te,g as Ce,m as ne,n as G,o as Ae,p as se,q as Be,r as je,s as re,t as Fe,u as Ge}from"./chunk-X2MDL6S4.js";import{e as Te}from"./chunk-LRNUGKYH.js";import{c as Ne,h as Ee}from"./chunk-ZDCXWEQG.js";import{j as Le,k as $e}from"./chunk-L3BUPFAQ.js";import{f as xe,g as q,j as Z,n as ve}from"./chunk-Z24SD2EJ.js";import{j as ke}from"./chunk-REKHAN53.js";import{b as F}from"./chunk-CQDCNP7V.js";import{b as Q}from"./chunk-EBJW6POT.js";import{B as we,Ha as m,f as pe,p as Ie,w as be}from"./chunk-WE7HRAGO.js";import{a as E,e as ye}from"./chunk-4C7WVQOD.js";import{j as J}from"./chunk-PI7OXS62.js";import{d as j}from"./chunk-DBMW3VUN.js";import{a as me}from"./chunk-FOJHSG5M.js";import{existsSync as oe,readFileSync as ae,statSync as H}from"fs";import{basename as de,extname as K}from"path";var ie=1024*1024,qe=1e3,Ze=e=>12e4+Math.ceil(e/ie)*1e3,v=e=>e>=ie?`${(e/ie).toFixed(1).replace(/\.0$/,"")} MB`:`${Math.max(1,Math.round(e/1024))} KB`,et=e=>new Promise(i=>setTimeout(i,e)),tt=e=>/^[a-z][a-z0-9+.-]*:/i.test(e)&&!oe(e);async function Ke(e,i,s,l){let o=new Map(l.map(a=>[a.sourceId,a.head])),d=[];for(let a of s){let r=o.get(a.sourceId);(r?await e.mainNode(i,r).then(f=>f.content.blob,()=>null):null)!==F(a.bytes)&&d.push(a)}return d}var nt=new Set(["KIND_MISMATCH","SITE_MOVED","UUID_MOVED","WEB_URL_CHANGED"]);function T(e){let i=e.code==="PLUGIN_HOOK_FAILED"||e.code==="PLUGIN_HOOK_TIMEOUT";return{refusal:{code:e.code,message:e.message,remedy:e.remedy??"check the source, then run the command again",...i?{support:!0}:{}},exit:i?1:2}}async function st(e,i,s){let l=i.plugin.manifest.id,o=ee(e),d;try{d=await _e(i.plugin,"claim",j.hookMs,()=>i.plugin.claim({ref:i.ref,named:i.named,isFile:o}))}catch(t){if(t instanceof Ne)return T(t.refusal);throw t}if(d==null)return T({code:"PLUGIN_NOT_CLAIMED",message:`plugin ${l} does not read ${i.ref}`,remedy:i.named?`drop the ${l}: prefix, or name the plugin that reads it`:"ingest it as a file of a built-in kind"});let a=d.sourceId;if(typeof a!="string")return T({code:"PLUGIN_HOOK_FAILED",message:`plugin ${l} answered claim with something that is not a claim`});let r=s??a;if(!Se(r))return T({code:"PLUGIN_SOURCE_ID_INVALID",message:`${JSON.stringify(r)} is not an id a source may have: it starts with a letter or digit and holds letters, digits and . _ -, at most 128 characters`,remedy:s===void 0?"give the source an id with --as <id>":"give another id with --as <id>"});let y={id:l,ref:i.ref,named:i.named,isFile:o},f=v(j.contentBytes);if(!o)return{item:{kind:"file",path:e,node:`ref:${e}`,file:e,bytes:Buffer.alloc(0),sourceId:r,limit:f,plugin:y}};let I=de(e),c;try{c=ae(e)}catch{return{refusal:m.ingestCantOpen(I),exit:2}}if(c.byteLength>j.contentBytes)return{refusal:m.ingestTooLarge(I,v(c.byteLength),f),exit:2};let{dev:u,ino:p}=H(e);return{item:{kind:"file",path:e,node:`${u}:${p}`,file:I,bytes:c,sourceId:r,limit:f,plugin:y}}}var S=e=>e.kind==="file"?e.path:e.address;function We(e){if(e.provider.name==="web")return`web|${e.sourceId}`;let i=new URL(e.address),s=e.provider.name.startsWith("linear")?`${i.host}/${i.pathname.split("/")[1]??""}`:i.host;return`${e.provider.name}|${s.toLowerCase()}|${e.sourceId}`}var rt=(e,i)=>e.kind==="file"?i.kind==="file"&&e.node===i.node:i.kind==="link"&&We(e)===We(i);async function it(e,i,s){let l=new Map;for(let t of e)l.set(t.sourceId,[...l.get(t.sourceId)??[],t]);let o=[...l.values()].filter(t=>t.length>1);if(o.length===0)return null;let d=i?.map(t=>t.sourceId)??null,a=new Set(o.flatMap(t=>t.slice(1))),r=new Set([...l.keys(),...d??[]]),y=t=>{if(d===null)return null;let R=2;for(;r.has(`${t}-${R}`);)R++;return r.add(`${t}-${R}`),`${t}-${R}`},f=t=>t.kind==="file"?t.path:te(t.provider.name,t.address),I=new Set(i?.filter(t=>t.head!==null).map(t=>t.sourceId)),c=e.filter(t=>!a.has(t)&&I.has(t.sourceId)),u=await s(c.flatMap(t=>t.kind==="file"?[t]:[])),p=e.filter(t=>!a.has(t)&&!u.includes(t));return je(o.map(t=>({names:t.map(f),id:t[0].sourceId})),p.map(S),e.filter(t=>a.has(t)).map(t=>({ref:S(t),as:y(t.sourceId),place:l.get(t.sourceId).indexOf(t)+1})),{reviews:u.flatMap(t=>t.kind==="file"?[{name:t.file,ref:t.path,id:t.sourceId}]:[]),link:c.some(t=>t.kind==="link"),firstTwin:p.some(t=>l.get(t.sourceId).length>1)})}async function Ft(e){try{return await ot(e)}finally{await be()}}async function ot(e){let i=e.mode==="agent",s=n=>i?ke(ge("ndjson",n,e.testing?.agentLines?{stdout:e.testing.agentLines,stderr:()=>{}}:void 0),{atQuestionsOnly:!0}):null,l=s("extract");l&&e.choice.onboarded&&l.event({type:"folder_linked",project_id:e.choice.projectId,project:e.choice.projectName});let o=(n,h,g=!1,O=l)=>O?(O.event({type:"error",code:n.code,message:n.message,...we(n),...n.notAdded?{not_added:n.notAdded}:{}}),O.done(h,"refused")):(g&&e.choice.onboarded?process.stdout.write(`${Oe(e.choice.projectName)}
3
3
  `):e.mode==="interactive"&&process.stdout.write(`
4
4
  `),X(n),process.stdout.write(`
5
- `),h),d=(n,h)=>o(n,h,!0),a=(n,h)=>h.length>0?{...n,detail:Fe(h.map(g=>g.name)),notAdded:h.map(g=>g.ref)}:n;if(e.opts.plan)return d(m.notYet("context ingest --plan"),2);if(e.opts.as!==void 0&&e.paths.length>1)return d(Be(e.paths),2);let r=[],y=n=>{r.some(h=>rt(h,n))||r.push(n)},f=q.flatMap(n=>n.extensions).join(" ");for(let n of e.paths){let h=r.map(k=>({name:k.kind==="file"?k.file:te(k.provider.name,k.address),ref:S(k)})),g=(k,Ye)=>d(a(k,h),Ye),O=Ee().route(n,ee);if(O!==null){let k=await st(n,O,e.opts.as);if("refusal"in k)return g(k.refusal,k.exit);y(k.item);continue}if(Le(n)){let k=$e(n);if(!k?.fetch)return g(se(n),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);y({kind:"link",address:n,provider:k,sourceId:e.opts.as??k.sourceIdFor(n)??n});continue}if(tt(n))return g(se(n),2);let w=de(n),L=Z(n);if(!L.ok)return g(m.ingestUnsupported(`${w} is a file type kane can't ingest (${K(n)||"no extension"}) \u2014 supported: ${f}`),2);if(!oe(n)||!H(n).isFile())return g(m.ingestNoFile(n),2);let D;try{D=ae(n)}catch{return g(m.ingestCantOpen(w),2)}if(D.byteLength>L.media.maxBytes)return g(m.ingestTooLarge(w,v(D.byteLength),v(L.media.maxBytes)),2);if(L.media.sniff&&!L.media.sniff(D))return g(m.ingestNotItsType(w,K(n).slice(1)),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);let fe;try{fe=e.opts.as??ve(n)}catch{return g(m.ingestNoSourceId(w),2)}let{dev:Je,ino:Qe}=H(n);y({kind:"file",path:n,node:`${Je}:${Qe}`,file:w,bytes:D,sourceId:fe,limit:v(L.media.maxBytes)})}let I=r[0],c;try{c=e.testing?.basicAuth??await Re()}catch(n){if(!(n instanceof he))throw n;return d({code:n.code,message:n.message,...n.remedy?{remedy:n.remedy}:{}},2)}let u=pe({url:e.choice.latticeUrl,basicAuth:c,...e.testing?.run?.fetch?{fetch:e.testing.run.fetch}:{}}),p=e.choice.projectId,t=null,R=null;try{t=await u.sources(p)}catch(n){n instanceof E&&(n.code==="NO_CONTEXT"||n.code==="NOT_FOUND")?t=[]:R=n}let b=await it(r,t,n=>Ke(u,p,n,t??[]));if(b)return d(b,2);if(t===null){let{exit:n,...h}=Pe(R,e.choice,null);return d(h,n)}let x=new Set(t.filter(n=>n.head!==null).map(n=>n.sourceId)),$=r.filter(n=>x.has(n.sourceId)),N=$.flatMap(n=>n.kind==="file"?[n]:[]);if(r.length>1&&N.length>0&&N.length===$.length){let n=await Ke(u,p,N,t);if(n.length>0){let h=n.map(g=>({name:g.file,ref:S(g),id:g.sourceId}));return d(re(h,r.filter(g=>!n.includes(g)).map(S),e.choice.projectName),2)}}let M=r.length===1?$[0]:void 0;if(M){let{reviewNewVersion:n}=await import("./reconcile-remote-23D6SXXT.js"),h=e.mode==="interactive";h&&!e.choice.onboarded&&process.stdout.write(`using project "${e.choice.projectName}", shared with your team
6
- `);let g=s("reconcile");return n({choice:e.choice,person:u,basicAuth:c,item:M,...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,mode:e.mode==="agent"?"agent":h?"interactive":"ci",io:g,refuse:(O,w=2)=>o(O,w,!1,g),projectLine:h,nothing:(O,w)=>`${h?` ${me.green("\u2714")} `:""}${O} is already in "${w}", unchanged`,...e.testing?{testing:e.testing}:{}})}let C=e.testing?.run?.retryDeadlineMs??12e4,ze=dt(e.testing?.remoteDeps),le=[],_=r.map((n,h)=>{let g=at({person:u,choice:e.choice,item:n,first:h===0,then:e.mode==="ci"?"pause":"extract",...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,retryMs:C,remoteDeps:ze,refusal:O=>a(O,_.slice(0,h).map(w=>({name:w.name??w.file,ref:w.path??w.file}))),alone:O=>re(O.map(w=>{let L=_[w].remote;return{name:_[w].name??_[w].file,ref:S(r[w]),id:r[w].sourceId,...L?{shown:Te({source:r[w].sourceId,page:Ce({...L,address:L.origin.url})})}:{}}}),r.filter((w,L)=>!O.includes(L)).map(S),e.choice.projectName),...e.testing?{testing:e.testing}:{}});return le.push(g.ended),g.step}),ce={verb:"extract",choice:e.choice,start:{kind:"new",body:{projectId:p,verb:"extract",mode:e.mode==="interactive"?"interactive":"agent",sourceId:I.sourceId}},run:{source:I.sourceId,...e.opts.force?{force:!0}:{},...e.opts.trust!==void 0?{trust:e.opts.trust}:{}}},A=e.testing?.remoteDeps?{...e.testing.run,remoteDeps:e.testing.remoteDeps}:e.testing?.run,U;if(e.mode==="interactive"){let{runInteractiveRemote:n}=await import("./interactive-remote-PBRQHTAF.js");U=await n({...ce,subject:I.kind==="link"?De(I.provider.name,I.address):I.sourceId,ingest:_,testing:{basicAuth:c,...e.testing?.check?{check:e.testing.check}:{},...A?{run:A}:{},...e.testing?.mount?{mount:e.testing.mount}:{},...e.testing?.onController?{onController:e.testing.onController}:{}}})}else U=await He({...ce,mode:"agent",basicAuth:c,io:l,check:e.testing?.check??Ve,onProgress:()=>{},ingest:_,signals:!0,onRefusal:n=>{X(n),process.stdout.write(`
5
+ `),h),d=(n,h)=>o(n,h,!0),a=(n,h)=>h.length>0?{...n,detail:Fe(h.map(g=>g.name)),notAdded:h.map(g=>g.ref)}:n;if(e.opts.plan)return d(m.notYet("context ingest --plan"),2);if(e.opts.as!==void 0&&e.paths.length>1)return d(Be(e.paths),2);let r=[],y=n=>{r.some(h=>rt(h,n))||r.push(n)},f=q.flatMap(n=>n.extensions).join(" ");for(let n of e.paths){let h=r.map(k=>({name:k.kind==="file"?k.file:te(k.provider.name,k.address),ref:S(k)})),g=(k,Ye)=>d(a(k,h),Ye),O=Ee().route(n,ee);if(O!==null){let k=await st(n,O,e.opts.as);if("refusal"in k)return g(k.refusal,k.exit);y(k.item);continue}if(Le(n)){let k=$e(n);if(!k?.fetch)return g(se(n),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);y({kind:"link",address:n,provider:k,sourceId:e.opts.as??k.sourceIdFor(n)??n});continue}if(tt(n))return g(se(n),2);let w=de(n),L=Z(n);if(!L.ok)return g(m.ingestUnsupported(`${w} is a file type kane can't ingest (${K(n)||"no extension"}) \u2014 supported: ${f}`),2);if(!oe(n)||!H(n).isFile())return g(m.ingestNoFile(n),2);let D;try{D=ae(n)}catch{return g(m.ingestCantOpen(w),2)}if(D.byteLength>L.media.maxBytes)return g(m.ingestTooLarge(w,v(D.byteLength),v(L.media.maxBytes)),2);if(L.media.sniff&&!L.media.sniff(D))return g(m.ingestNotItsType(w,K(n).slice(1)),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);let fe;try{fe=e.opts.as??ve(n)}catch{return g(m.ingestNoSourceId(w),2)}let{dev:Je,ino:Qe}=H(n);y({kind:"file",path:n,node:`${Je}:${Qe}`,file:w,bytes:D,sourceId:fe,limit:v(L.media.maxBytes)})}let I=r[0],c;try{c=e.testing?.basicAuth??await Re()}catch(n){if(!(n instanceof he))throw n;return d({code:n.code,message:n.message,...n.remedy?{remedy:n.remedy}:{}},2)}let u=pe({url:e.choice.latticeUrl,basicAuth:c,...e.testing?.run?.fetch?{fetch:e.testing.run.fetch}:{}}),p=e.choice.projectId,t=null,R=null;try{t=await u.sources(p)}catch(n){n instanceof E&&(n.code==="NO_CONTEXT"||n.code==="NOT_FOUND")?t=[]:R=n}let b=await it(r,t,n=>Ke(u,p,n,t??[]));if(b)return d(b,2);if(t===null){let{exit:n,...h}=Pe(R,e.choice,null);return d(h,n)}let x=new Set(t.filter(n=>n.head!==null).map(n=>n.sourceId)),$=r.filter(n=>x.has(n.sourceId)),N=$.flatMap(n=>n.kind==="file"?[n]:[]);if(r.length>1&&N.length>0&&N.length===$.length){let n=await Ke(u,p,N,t);if(n.length>0){let h=n.map(g=>({name:g.file,ref:S(g),id:g.sourceId}));return d(re(h,r.filter(g=>!n.includes(g)).map(S),e.choice.projectName),2)}}let M=r.length===1?$[0]:void 0;if(M){let{reviewNewVersion:n}=await import("./reconcile-remote-3W6ZTO3G.js"),h=e.mode==="interactive";h&&!e.choice.onboarded&&process.stdout.write(`using project "${e.choice.projectName}", shared with your team
6
+ `);let g=s("reconcile");return n({choice:e.choice,person:u,basicAuth:c,item:M,...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,mode:e.mode==="agent"?"agent":h?"interactive":"ci",io:g,refuse:(O,w=2)=>o(O,w,!1,g),projectLine:h,nothing:(O,w)=>`${h?` ${me.green("\u2714")} `:""}${O} is already in "${w}", unchanged`,...e.testing?{testing:e.testing}:{}})}let C=e.testing?.run?.retryDeadlineMs??12e4,ze=dt(e.testing?.remoteDeps),le=[],_=r.map((n,h)=>{let g=at({person:u,choice:e.choice,item:n,first:h===0,then:e.mode==="ci"?"pause":"extract",...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,retryMs:C,remoteDeps:ze,refusal:O=>a(O,_.slice(0,h).map(w=>({name:w.name??w.file,ref:w.path??w.file}))),alone:O=>re(O.map(w=>{let L=_[w].remote;return{name:_[w].name??_[w].file,ref:S(r[w]),id:r[w].sourceId,...L?{shown:Te({source:r[w].sourceId,page:Ce({...L,address:L.origin.url})})}:{}}}),r.filter((w,L)=>!O.includes(L)).map(S),e.choice.projectName),...e.testing?{testing:e.testing}:{}});return le.push(g.ended),g.step}),ce={verb:"extract",choice:e.choice,start:{kind:"new",body:{projectId:p,verb:"extract",mode:e.mode==="interactive"?"interactive":"agent",sourceId:I.sourceId}},run:{source:I.sourceId,...e.opts.force?{force:!0}:{},...e.opts.trust!==void 0?{trust:e.opts.trust}:{}}},A=e.testing?.remoteDeps?{...e.testing.run,remoteDeps:e.testing.remoteDeps}:e.testing?.run,U;if(e.mode==="interactive"){let{runInteractiveRemote:n}=await import("./interactive-remote-7ZSTI66T.js");U=await n({...ce,subject:I.kind==="link"?De(I.provider.name,I.address):I.sourceId,ingest:_,testing:{basicAuth:c,...e.testing?.check?{check:e.testing.check}:{},...A?{run:A}:{},...e.testing?.mount?{mount:e.testing.mount}:{},...e.testing?.onController?{onController:e.testing.onController}:{}}})}else U=await He({...ce,mode:"agent",basicAuth:c,io:l,check:e.testing?.check??Ve,onProgress:()=>{},ingest:_,signals:!0,onRefusal:n=>{X(n),process.stdout.write(`
7
7
  `)},...A?{testing:A}:{}});let W=le.map(n=>n()),B=[...W].reverse().find(n=>n.sid!==null)?.sid??null,ue=W.flatMap(n=>n.added!==null?[{name:n.name,status:n.added}]:[]),z=W.find(n=>n.refused!==null)?.refused??null;if(z!==null)return o(z.refusal,z.exit);if(e.mode==="ci"&&ue.length>0&&B!==null){let n=ue.map(({name:h,status:g})=>g==="unchanged"?`${h} is already in "${e.choice.projectName}", unchanged`:g==="versioned"?`added a new version of ${h} to session ${B}, not saved yet`:`added ${h} to session ${B}, not saved yet`);return process.stdout.write(`${n.join(`
8
8
  `)}
9
9
  extract: kane-cli context extract --resume ${B}
@@ -0,0 +1,7 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as A}from"./chunk-TDPWFYTJ.js";import{b as T}from"./chunk-LV7224DG.js";import{d as x}from"./chunk-C4KAPGBS.js";import{a as S}from"./chunk-MMBBQ4OZ.js";import{a as y}from"./chunk-TD6GCEIK.js";import{a as m}from"./chunk-ZCBOHWN3.js";import{f as R}from"./chunk-A7RJQJNT.js";import{d as g,i as E}from"./chunk-J4FIESTB.js";import{spawn as U,execSync as L}from"child_process";import{appendFileSync as P,existsSync as f,mkdirSync as h}from"fs";import{homedir as V}from"os";import{join as D,resolve as s,dirname as v,delimiter as M}from"path";import{fileURLToPath as k}from"url";import{createInterface as I}from"readline";async function*N(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function O(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function w(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function b(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(k(import.meta.url));function B(){for(let e of["python3","python"])try{return L(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function H(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(f(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(f(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(f(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(f(u))return{cmd:u,args:["main.py"],cwd:t};let a=B();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function C(e){return e?D(V(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function K(e){let n=U(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=C(e.sessionId);if(r)try{h(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{P(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(p,_)=>{d=p,l=_?String(_):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:p,signal:l??"none"}),u({code:p,signal:l})})}),a=N(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function G(e,n){if(!n?.platform||!n.target)return;if(R(n.target)){e.TESTMU_RUN_TARGET??="cloud",e.LT_HUB_URL??=m(e.TESTMUAI_ENV==="stage"?"stage":"prod").mobileHubUrl;return}let r=await x(n.platform)?.toolEnv(n.target)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(M)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=S();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(M),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function j(e){let n={...process.env,...y(process.env)};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=m(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=O(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new T().load(),d=b(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=w(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function W(e,n){let r=m(n?.environment),o=A();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=E),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload=$(r,e.org_id))}function $(e,n){return{url:e.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:e.mediaArtefactsHost,org_id:n,media_dir:g,files_url:e.tmsBaseUrl.replace(/\/api\/?$/,"")}}async function ue(e,n){let r=H();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
3
+ `);let o=j({environment:n?.environment,mode:n?.mode,assertionMode:n?.assertionMode,finalValidation:n?.finalValidation,username:e.username,accessKey:e.access_key,sessionId:e.session_id});e.device?.platform&&await G(o,e.device),W(e,{environment:n?.environment});let i=K({env:o,runner:r,log:n?.log,sessionId:e.session_id}),d=i.child;d.stdin.write(JSON.stringify(e)+`
4
+ `);let l=C(e.session_id);if(l)try{h(v(l),{recursive:!0}),P(l,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
5
+ `)}catch{}return{child:d,events:i.events,sendUserResponse(t){let a=JSON.stringify({type:"user_response",answer:t});try{d.stdin.write(a+`
6
+ `)}catch{}},sendCancel(t){let a=JSON.stringify({type:"cancel",reason:t});try{d.stdin.write(a+`
7
+ `)}catch{}},cancel(){d.kill("SIGTERM")},get stderr(){return i.getStderr()},get exitCode(){return i.getExitCode()},get exitSignal(){return i.getExitSignal()},exited:i.exited}}export{H as a,K as b,G as c,j as d,W as e,$ as f,ue as g};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{j as f,xa as a}from"./chunk-Z777GGHB.js";import{join as m}from"path";function Q(n,o){if(!f(o))throw new Error(`proposal id ${JSON.stringify(o)} is not a plain name (letters, digits, . _ - after a letter or digit)`);return m(n,"proposals",o,"proposal.json")}import{appendFileSync as g,readdirSync as l,readFileSync as u,rmSync as S,statSync as y}from"fs";import{join as t}from"path";import{randomBytes as E}from"crypto";var j="pending-facts.ndjson",h=/^pending-facts\.(\d+)-[0-9a-f]+\.ndjson$/,N=()=>`pending-facts.${process.pid}-${E(4).toString("hex")}.ndjson`;function v(n,o=1/0){let r=[];for(let i of l(n)){let s=h.exec(i);if(!s)continue;let e=Number(s[1]),c=Date.now()-y(t(n,i)).mtimeMs;if(e!==process.pid&&a(e)&&c<o){r.push(i);continue}let p=u(t(n,i),"utf8").split(`
2
+ import{j as f,xa as a}from"./chunk-PI7OXS62.js";import{join as m}from"path";function Q(n,o){if(!f(o))throw new Error(`proposal id ${JSON.stringify(o)} is not a plain name (letters, digits, . _ - after a letter or digit)`);return m(n,"proposals",o,"proposal.json")}import{appendFileSync as g,readdirSync as l,readFileSync as u,rmSync as S,statSync as y}from"fs";import{join as t}from"path";import{randomBytes as E}from"crypto";var j="pending-facts.ndjson",h=/^pending-facts\.(\d+)-[0-9a-f]+\.ndjson$/,N=()=>`pending-facts.${process.pid}-${E(4).toString("hex")}.ndjson`;function v(n,o=1/0){let r=[];for(let i of l(n)){let s=h.exec(i);if(!s)continue;let e=Number(s[1]),c=Date.now()-y(t(n,i)).mtimeMs;if(e!==process.pid&&a(e)&&c<o){r.push(i);continue}let p=u(t(n,i),"utf8").split(`
3
3
  `).filter(d=>d!=="");p.length>0&&g(t(n,j),p.join(`
4
4
  `)+`
5
5
  `),S(t(n,i))}return r}export{Q as a,j as b,h as c,N as d,v as e};