@testmuai/kane-cli 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/dist/ChatSurface-E7QKI4LA.js +8 -0
  2. package/dist/{ChromeProfilePicker-4CDSPBWL.js → ChromeProfilePicker-DGDWGCZD.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-TLRVBA4E.js → CliFeedbackPrompt-SYCZXSME.js} +1 -1
  4. package/dist/{CliUploadProgress-WGGFLUSF.js → CliUploadProgress-VDEAKXJY.js} +1 -1
  5. package/dist/{ConfigView-DBANTBXC.js → ConfigView-HPKRQXMC.js} +1 -1
  6. package/dist/EvidenceViewOffer-F5YG54OC.js +2 -0
  7. package/dist/{FolderPicker-W7RCIFEL.js → FolderPicker-4NSDXQY5.js} +1 -1
  8. package/dist/{HelpView-FBCX32U7.js → HelpView-ON6BFGJM.js} +1 -1
  9. package/dist/{InfoBox-KK2ICVS4.js → InfoBox-B23NZ6IG.js} +1 -1
  10. package/dist/{LinksBox-KKRANMR3.js → LinksBox-TI26VFFH.js} +1 -1
  11. package/dist/{ProfilesView-DGPXSAQN.js → ProfilesView-CRO5AH3H.js} +1 -1
  12. package/dist/{ProjectPicker-ESQSL4TT.js → ProjectPicker-3N7LJOXU.js} +1 -1
  13. package/dist/{SaveSessionPrompt-AQGP5W6E.js → SaveSessionPrompt-UTOEC5AW.js} +1 -1
  14. package/dist/SingleShotApp-Y3YDFQSD.js +2 -0
  15. package/dist/{SummaryBox-BFZJW2KK.js → SummaryBox-JK64EKC2.js} +1 -1
  16. package/dist/TestMdRunView-O6JTHV5W.js +2 -0
  17. package/dist/{WhoamiView-JABY3I5Q.js → WhoamiView-6QSLPNF6.js} +1 -1
  18. package/dist/{auth-76LVI6B5.js → auth-IKFVW3NX.js} +1 -1
  19. package/dist/bind-KCUSVJXG.js +12 -0
  20. package/dist/bootstrap-NFYYRGGR.js +2 -0
  21. package/dist/bridge-JSKEO4N3.js +2 -0
  22. package/dist/{changelog-PSWPPOAF.js → changelog-AAH2ZBYO.js} +1 -1
  23. package/dist/chat-committer-UUC6JTRJ.js +2 -0
  24. package/dist/chat-controller-T2FAI55V.js +2 -0
  25. package/dist/{chunk-NAE7MBR2.js → chunk-23VPUWBD.js} +3 -3
  26. package/dist/chunk-2UIHS2FH.js +2 -0
  27. package/dist/chunk-2WFZIQ62.js +2 -0
  28. package/dist/chunk-2WRBTLFN.js +13 -0
  29. package/dist/chunk-2YEHV2CX.js +2 -0
  30. package/dist/{chunk-KVQOBPAZ.js → chunk-3Q6WAK6P.js} +1 -1
  31. package/dist/{chunk-6HEGD6H2.js → chunk-4LTXE3IX.js} +1 -1
  32. package/dist/{chunk-KT6G7AF2.js → chunk-4NFCAGRK.js} +1 -1
  33. package/dist/chunk-53IBTIL3.js +12 -0
  34. package/dist/{chunk-FCMLIK7P.js → chunk-5DBK6QNS.js} +1 -1
  35. package/dist/chunk-5DT7PIGB.js +5 -0
  36. package/dist/{chunk-XDHZMCTA.js → chunk-5FJJJNJK.js} +2 -2
  37. package/dist/{chunk-XVDJ423L.js → chunk-5SXMV66P.js} +1 -1
  38. package/dist/{chunk-6UJDOAYR.js → chunk-5WXGMXGA.js} +2 -2
  39. package/dist/chunk-5ZQZOVWY.js +4 -0
  40. package/dist/{chunk-5KFS3GAZ.js → chunk-6KPPGMO2.js} +1 -1
  41. package/dist/{chunk-RNSSM2BK.js → chunk-74HTO7K3.js} +1 -1
  42. package/dist/{chunk-PMHJRT3A.js → chunk-7KORP5FF.js} +1 -1
  43. package/dist/chunk-7OYZR6JA.js +3 -0
  44. package/dist/chunk-7QJ75SYR.js +8 -0
  45. package/dist/{chunk-DXV6MBTD.js → chunk-AECMF3T2.js} +1 -1
  46. package/dist/{chunk-3LWTUMDG.js → chunk-AFBKGZFG.js} +1 -1
  47. package/dist/{chunk-AM5S4KG4.js → chunk-AFPHLUQ5.js} +1 -1
  48. package/dist/chunk-AJ56AMT6.js +9 -0
  49. package/dist/{chunk-NJPTOKW5.js → chunk-APPYQZFK.js} +1 -1
  50. package/dist/{chunk-CSQ46PJ7.js → chunk-AXTGYOMK.js} +1 -1
  51. package/dist/{chunk-HPMS5KO6.js → chunk-B5RS2XZU.js} +2 -2
  52. package/dist/chunk-BKHXPBWN.js +2 -0
  53. package/dist/{chunk-SRDHPKJT.js → chunk-BXYWX4J3.js} +1 -1
  54. package/dist/chunk-C3T7TKAC.js +349 -0
  55. package/dist/{chunk-JEUA4UWK.js → chunk-CLGC7VEO.js} +1 -1
  56. package/dist/{chunk-L4JIMNKW.js → chunk-CUM23TLF.js} +1 -1
  57. package/dist/chunk-DBIBROYW.js +5 -0
  58. package/dist/chunk-DBKNJRJG.js +2 -0
  59. package/dist/{chunk-M7WQM4UA.js → chunk-DUAXZYAD.js} +1 -1
  60. package/dist/chunk-DZPGG4S6.js +7 -0
  61. package/dist/{chunk-2KBD6JZX.js → chunk-EOLFTMWF.js} +1 -1
  62. package/dist/{chunk-2XGDWUJ5.js → chunk-F7ISS545.js} +1 -1
  63. package/dist/{chunk-JKTFTF24.js → chunk-FBHRBFHP.js} +1 -1
  64. package/dist/{chunk-L7VREJTG.js → chunk-FDIPQRX4.js} +1 -1
  65. package/dist/{chunk-AAONIIQV.js → chunk-GFKCTYCA.js} +1 -1
  66. package/dist/{chunk-73C4PRYU.js → chunk-GYNTNKNB.js} +1 -1
  67. package/dist/{chunk-KNDSQ4PS.js → chunk-H32GM5G4.js} +1 -1
  68. package/dist/{chunk-323MLBYA.js → chunk-HYSFJSIG.js} +1 -1
  69. package/dist/chunk-I7TIGB7K.js +2 -0
  70. package/dist/chunk-IDX3TOPY.js +6 -0
  71. package/dist/{chunk-CVOGP253.js → chunk-IMR64OCZ.js} +1 -1
  72. package/dist/{chunk-IBNC444G.js → chunk-IOD3HQVW.js} +1 -1
  73. package/dist/{chunk-URQUQWGW.js → chunk-J5FBU425.js} +40 -40
  74. package/dist/chunk-JKM2PUHI.js +4 -0
  75. package/dist/{chunk-ZM5PVRJK.js → chunk-JPWLGHPM.js} +1 -1
  76. package/dist/{chunk-5JTUL6XL.js → chunk-JZ26R6UL.js} +1 -1
  77. package/dist/chunk-KBM3XHAM.js +2 -0
  78. package/dist/{chunk-SY3HLQMV.js → chunk-KCCSWEGA.js} +1 -1
  79. package/dist/{chunk-APAIWBIH.js → chunk-KQZA2QSC.js} +1 -1
  80. package/dist/{chunk-X3ICV5M5.js → chunk-KWIK22R6.js} +1 -1
  81. package/dist/{chunk-33QXD75Y.js → chunk-M6FKJKC6.js} +2 -2
  82. package/dist/{chunk-IXVOXJP6.js → chunk-MK7JUOYV.js} +1 -1
  83. package/dist/chunk-N2P4MI32.js +2 -0
  84. package/dist/{chunk-JRMDGLLT.js → chunk-O75ZHGJG.js} +1 -1
  85. package/dist/chunk-OR6MCL6Z.js +2 -0
  86. package/dist/chunk-ORQNKZ2Z.js +5 -0
  87. package/dist/{chunk-QROUKGKU.js → chunk-OS4VSIHT.js} +1 -1
  88. package/dist/{chunk-UI7KULSI.js → chunk-OUJQVBUT.js} +3 -3
  89. package/dist/{chunk-UBFKZEX3.js → chunk-PLOWZLG5.js} +1 -1
  90. package/dist/chunk-QIGPXYMF.js +19 -0
  91. package/dist/chunk-QOFZSHSC.js +47 -0
  92. package/dist/{chunk-2XMJ6YAE.js → chunk-R5T4RLF5.js} +1 -1
  93. package/dist/chunk-R7QAS6LZ.js +4 -0
  94. package/dist/{chunk-CDQX6HGJ.js → chunk-RDNFVZEB.js} +1 -1
  95. package/dist/{chunk-NRTHYROA.js → chunk-SFII7HPP.js} +1 -1
  96. package/dist/{chunk-3FN5VJMV.js → chunk-SL6PCVM2.js} +1 -1
  97. package/dist/{chunk-LQZ2BU7Q.js → chunk-STVP2XHO.js} +1 -1
  98. package/dist/chunk-TH47OOBV.js +4 -0
  99. package/dist/{chunk-OHRS3H7Z.js → chunk-TRJUD3XJ.js} +1 -1
  100. package/dist/{chunk-BAL64WSI.js → chunk-UC7MNPIN.js} +1 -1
  101. package/dist/chunk-UD7KKHPW.js +5 -0
  102. package/dist/chunk-VAYBKR76.js +4 -0
  103. package/dist/chunk-VFII6C46.js +2 -0
  104. package/dist/{chunk-R2RGSO4B.js → chunk-VHZ4S57N.js} +1 -1
  105. package/dist/{chunk-WJ5HDEVH.js → chunk-VLWMMOMF.js} +1 -1
  106. package/dist/chunk-VMM4LC4V.js +10 -0
  107. package/dist/{chunk-322JEJEH.js → chunk-VOOPWFHW.js} +1 -1
  108. package/dist/{chunk-4OPQJ7PE.js → chunk-VRLUNZAK.js} +1 -1
  109. package/dist/{chunk-AH7ZZIZY.js → chunk-VRVFPMCR.js} +1 -1
  110. package/dist/{chunk-F6ZOJXYU.js → chunk-VT54ARGE.js} +1 -1
  111. package/dist/{chunk-NBKQT7LJ.js → chunk-VWKVUOXU.js} +1 -1
  112. package/dist/chunk-W4B5LOEX.js +4 -0
  113. package/dist/{chunk-36OC3TFE.js → chunk-W5TTF7GB.js} +2 -2
  114. package/dist/chunk-WXHQYYD5.js +2 -0
  115. package/dist/{chunk-NOCIMJSN.js → chunk-XUS4WKDS.js} +1 -1
  116. package/dist/chunk-XWKUZJCP.js +2 -0
  117. package/dist/chunk-YTHQNN2L.js +3 -0
  118. package/dist/{chunk-V36ATG7A.js → chunk-ZBOWFJB2.js} +2 -2
  119. package/dist/chunk-ZMNJBUAO.js +2 -0
  120. package/dist/{chunk-LR5XO2KD.js → chunk-ZRASQ63J.js} +1 -1
  121. package/dist/{chunk-C4G7RVJ6.js → chunk-ZUGCHQFC.js} +1 -1
  122. package/dist/committer-SWEWEYNX.js +2 -0
  123. package/dist/{config-R3GF2FZA.js → config-CWZV6XPT.js} +1 -1
  124. package/dist/{cover-cmd-TXICWHUU.js → cover-cmd-NWIRJY5Z.js} +1 -1
  125. package/dist/{credentials-XN4ROCQ3.js → credentials-YHTJGKEO.js} +1 -1
  126. package/dist/descriptor-OEUZZCOK.js +2 -0
  127. package/dist/design-committer-VYT6NU3T.js +2 -0
  128. package/dist/dispatch-WVNXB7AD.js +2 -0
  129. package/dist/docx-convert-CHLJUTFH.js +2 -0
  130. package/dist/{dossier-QZV74XOS.js → dossier-KTLTGT2X.js} +1 -1
  131. package/dist/{evidence-V23FPVXQ.js → evidence-IVDNXWPL.js} +1 -1
  132. package/dist/evolve-cmd-XBX4SX5H.js +2 -0
  133. package/dist/{exit-manager-HNFATGSM.js → exit-manager-XZL4KIJU.js} +1 -1
  134. package/dist/explain-UAAQWHYR.js +2 -0
  135. package/dist/{explain-cmd-RZW6QJYM.js → explain-cmd-75MCF2ZV.js} +1 -1
  136. package/dist/{explain-cmd-X7JZLSZZ.js → explain-cmd-IZEHWZV5.js} +1 -1
  137. package/dist/extract-bind-5OWELRME.js +10 -0
  138. package/dist/extract-cmd-ZRYMJ6IC.js +5 -0
  139. package/dist/feeder-C3TOJPKK.js +2 -0
  140. package/dist/{gaps-cmd-BWCRLLBK.js → gaps-cmd-XBRXKXDL.js} +1 -1
  141. package/dist/{gate-YHBPWEM5.js → gate-54BRAE7N.js} +1 -1
  142. package/dist/{generate-headless-BSTDLZZY.js → generate-headless-D6BISWDC.js} +2 -2
  143. package/dist/{headless-io-BL3TEAX5.js → headless-io-66RG5NN5.js} +1 -1
  144. package/dist/identity-ADZ4PAJF.js +2 -0
  145. package/dist/index.js +43 -43
  146. package/dist/ingest-EX72IEQT.js +2 -0
  147. package/dist/ingest-cmd-YTGOICTC.js +2 -0
  148. package/dist/{interactive-bind-43HGDF5K.js → interactive-bind-XSRD36MO.js} +7 -6
  149. package/dist/{lifecycle-cmd-D6TVTYRK.js → lifecycle-cmd-EQSFAZG6.js} +1 -1
  150. package/dist/{list-cmd-XCAV2FKA.js → list-cmd-IRJSUCM5.js} +1 -1
  151. package/dist/{list-commands-747UTUSS.js → list-commands-RCYHJ5Y3.js} +1 -1
  152. package/dist/locks-cmd-CSVSWY2Y.js +2 -0
  153. package/dist/logical-ids-TEBCQJGO.js +2 -0
  154. package/dist/login-flow-PYAPYCPY.js +2 -0
  155. package/dist/maintenance-cmd-MVFA6H74.js +2 -0
  156. package/dist/pdf-convert-OZIRUADA.js +2 -0
  157. package/dist/{persist-recorded-session-MDPWWUA7.js → persist-recorded-session-DTYCLXTQ.js} +1 -1
  158. package/dist/phase-seed-DIRETNU6.js +2 -0
  159. package/dist/pipeline-MXFOD6ES.js +2 -0
  160. package/dist/readmodel-XOYGGQ3S.js +2 -0
  161. package/dist/reconcile-cmd-EG6BOU3A.js +2 -0
  162. package/dist/reconcile-deps-HTT6IPHT.js +4 -0
  163. package/dist/reconcile-engine-JQNXALNY.js +2 -0
  164. package/dist/{recording-banner-TALO7PUR.js → recording-banner-76GCIPUN.js} +1 -1
  165. package/dist/records-IOZTZUZV.js +2 -0
  166. package/dist/{require-project-folder-R347LFDQ.js → require-project-folder-ACRDP5ZB.js} +1 -1
  167. package/dist/{resolver-IDCGRPFJ.js → resolver-SRPCFW7P.js} +1 -1
  168. package/dist/revert-NQ7GEVSE.js +2 -0
  169. package/dist/review-cmd-L3V5UP5T.js +4 -0
  170. package/dist/run-GMZCDRDD.js +2 -0
  171. package/dist/run-TFRWPGXP.js +2 -0
  172. package/dist/run-channel-RGH4WIQX.js +2 -0
  173. package/dist/{run-test-md-DFNIGYB7.js → run-test-md-KEHSRMCM.js} +2 -2
  174. package/dist/sessions-GIEXOCE4.js +2 -0
  175. package/dist/{sessions-cmd-AQWLL5ZN.js → sessions-cmd-ZVYGSRJ3.js} +4 -4
  176. package/dist/{skill-installer-ANXTCXQV.js → skill-installer-HBN3A35K.js} +1 -1
  177. package/dist/spawner-GC5CFAJ7.js +2 -0
  178. package/dist/structured-answers-A43Q25CZ.js +5 -0
  179. package/dist/tcg-generate-V7YFNC5O.js +2 -0
  180. package/dist/testmd-actions-MNDOO76O.js +2 -0
  181. package/dist/token-refresh-3UYMCYG3.js +2 -0
  182. package/dist/{validate-basic-O2DP2XJL.js → validate-basic-ZGWPBYB6.js} +1 -1
  183. package/dist/verdicts-SCETLY5J.js +2 -0
  184. package/dist/{version-check-RNR3JCQ5.js → version-check-CJWKDAXV.js} +1 -1
  185. package/dist/{view-cmd-YSEGA5PI.js → view-cmd-SOVM64L2.js} +1 -1
  186. package/dist/walk-session-YUYRULPY.js +2 -0
  187. package/dist/with-telemetry-E7QWPGL6.js +2 -0
  188. package/package.json +6 -6
  189. package/dist/ChatSurface-D66CACLX.js +0 -8
  190. package/dist/EvidenceViewOffer-DNCQ3A6R.js +0 -2
  191. package/dist/SingleShotApp-SMCAIKCE.js +0 -2
  192. package/dist/TestMdRunView-FMKZJ3A3.js +0 -2
  193. package/dist/bind-AACBTSAA.js +0 -12
  194. package/dist/bootstrap-CNOZ5VRB.js +0 -2
  195. package/dist/bridge-T4HL4TG7.js +0 -2
  196. package/dist/chat-committer-4BQBOKI4.js +0 -2
  197. package/dist/chat-controller-NNTMKEPG.js +0 -2
  198. package/dist/chunk-2SREGETM.js +0 -4
  199. package/dist/chunk-3STZLM5J.js +0 -4
  200. package/dist/chunk-5YPBPZUR.js +0 -2
  201. package/dist/chunk-BQHKBOSF.js +0 -11
  202. package/dist/chunk-DQ54MH7F.js +0 -13
  203. package/dist/chunk-EV3EHXEI.js +0 -4
  204. package/dist/chunk-F7WKDMX7.js +0 -47
  205. package/dist/chunk-FPFOW6BS.js +0 -2
  206. package/dist/chunk-GVIPTX6T.js +0 -6
  207. package/dist/chunk-GW5DWAXY.js +0 -2
  208. package/dist/chunk-HJERKSBK.js +0 -349
  209. package/dist/chunk-IQDWBTRJ.js +0 -3
  210. package/dist/chunk-KRXSXQBU.js +0 -12
  211. package/dist/chunk-NAC7SFBE.js +0 -5
  212. package/dist/chunk-NRC2G4Y5.js +0 -5
  213. package/dist/chunk-O56PUUNL.js +0 -9
  214. package/dist/chunk-QM4S2APK.js +0 -2
  215. package/dist/chunk-SE6WNCYU.js +0 -4
  216. package/dist/chunk-SWESH2J7.js +0 -10
  217. package/dist/chunk-T63R6QT4.js +0 -4
  218. package/dist/chunk-UPPEOQJQ.js +0 -3
  219. package/dist/chunk-UX2B7L6K.js +0 -2
  220. package/dist/chunk-VOHQA2SP.js +0 -2
  221. package/dist/chunk-W5DOU2DV.js +0 -2
  222. package/dist/chunk-W6VD2XFO.js +0 -19
  223. package/dist/chunk-WWNSD6FA.js +0 -6
  224. package/dist/chunk-ZLCZDAEX.js +0 -6
  225. package/dist/committer-2EJPVVCQ.js +0 -2
  226. package/dist/descriptor-KXDJ4XYD.js +0 -2
  227. package/dist/design-committer-BQUWD6AC.js +0 -2
  228. package/dist/docx-convert-ZBVQO2LG.js +0 -2
  229. package/dist/evolve-cmd-PZCPXDMR.js +0 -2
  230. package/dist/explain-UE4IACQH.js +0 -2
  231. package/dist/extract-bind-BFY7IRL4.js +0 -10
  232. package/dist/extract-cmd-U3MGK2LP.js +0 -6
  233. package/dist/feeder-XGTFV7TZ.js +0 -2
  234. package/dist/ingest-AL6CABJT.js +0 -2
  235. package/dist/ingest-cmd-O6OWWZT4.js +0 -2
  236. package/dist/locks-cmd-QAULI5LV.js +0 -2
  237. package/dist/logical-ids-4G4FAHNJ.js +0 -2
  238. package/dist/login-flow-CV76ENHV.js +0 -2
  239. package/dist/maintenance-cmd-ZRB4NTGG.js +0 -2
  240. package/dist/pdf-convert-S7VYE6AV.js +0 -2
  241. package/dist/phase-seed-52LRE3LH.js +0 -2
  242. package/dist/pipeline-LM5JAK7F.js +0 -2
  243. package/dist/readmodel-X7L7W2BA.js +0 -2
  244. package/dist/reconcile-cmd-DGCSDML6.js +0 -2
  245. package/dist/records-5SVUXJBW.js +0 -2
  246. package/dist/revert-DXXYXJGN.js +0 -2
  247. package/dist/review-cmd-2QF5HTI7.js +0 -4
  248. package/dist/run-52UIBPXD.js +0 -2
  249. package/dist/run-VRVH4VO3.js +0 -2
  250. package/dist/sessions-BLXZVK5U.js +0 -2
  251. package/dist/spawner-AH5FTUYU.js +0 -2
  252. package/dist/structured-answers-QHFGZPSS.js +0 -5
  253. package/dist/tcg-generate-WKCBBKI5.js +0 -2
  254. package/dist/testmd-actions-RPYG6TJG.js +0 -2
  255. package/dist/token-refresh-NIDUOTRM.js +0 -2
  256. package/dist/verdicts-TJH3O5UW.js +0 -2
  257. package/dist/walk-session-HXW4OSA2.js +0 -2
  258. package/dist/with-telemetry-PNP6CAVM.js +0 -2
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as U,b as te,c as ne,j as x}from"./chunk-W4B5LOEX.js";import{a as M,b as J}from"./chunk-2UIHS2FH.js";import{a as B}from"./chunk-N2P4MI32.js";import{b as j,d as ee}from"./chunk-NVGBE2DR.js";import{A as Q}from"./chunk-TH47OOBV.js";import{x as q}from"./chunk-ZUGCHQFC.js";var w="https://integrations.lambdatest.com",g=class extends Error{constructor(e,r){super(r);this.code=e;this.name="LisError"}};function he(t){let n=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${q[n].shareApiBaseUrl}/lis/api/v1`}function ye(t){let n=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let r=t.auth?.TESTMUAI_API_KEY||n.TESTMUAI_API_KEY;return r?{authorization:`Bearer ${r}`}:{}}function $(t){let n=t.split(`
3
+ `,1)[0].replace(/[\u0000-\u001f\u007f-\u009f]/g,"");return n.length>200?`${n.slice(0,200)}\u2026`:n}function Ee(t,n,e="the issue"){return t===401||t===403?new g("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new g("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${$(n)||`HTTP ${t}`}`)}function P(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new g("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}function Z(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{return{}}}function re(t){return Z(t).code}function C(t,n="the issue"){let e=Z(t);switch(e.code){case"TOKEN_EXPIRED":return new g("LIS_SETUP",`your Atlassian connection needs a resync \u2014 reconnect at ${w} and retry`);case"NOT_INSTALLED":return new g("LIS_SETUP",`no Atlassian connection for this account \u2014 create one at ${w} and retry`);case"SCOPE_MISSING":return new g("LIS_SETUP",`the connection has no Confluence access \u2014 reconnect with Confluence at ${w} and retry`);case"FORBIDDEN":return new g("LIS_FORBIDDEN",`you don't have access to ${n}`);case"NOT_FOUND":return new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${n}: ${$(e.message??"")||"not found"}`);case"PAYLOAD_TOO_LARGE":return new g("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");case"INVALID_PAYLOAD":return new g("LIS_UNAVAILABLE",`the integrations service rejected the request (${$(e.message??"")||"invalid payload"}) \u2014 retry later`);case"NOT_SUPPORTED":return new g("LIS_UNAVAILABLE","the integrations service does not support this operation yet");case"UPSTREAM_ERROR":case"UPSTREAM_TIMEOUT":return new g("LIS_UNAVAILABLE","Atlassian is not responding through the integrations service \u2014 retry later");default:return Ee(t.status,e.message??"",n)}}var be=3e4,_e=5;async function N(t,n,e){let r=e.env??process.env,d=e.fetchImpl??fetch;for(let o=0;;o++){let h=new AbortController,E=setTimeout(()=>h.abort(),be);try{let s=await d(`${he(r)}${t}`,{...n,headers:{"content-type":"application/json",...ye(e),...n.headers??{}},signal:h.signal}),u=await Promise.race([s.arrayBuffer(),new Promise((c,l)=>{h.signal.addEventListener("abort",()=>l(new DOMException("aborted","AbortError")),{once:!0})})]),a={status:s.status,ok:s.ok,headers:s.headers,bytes:Buffer.from(u)};if(a.status===429){if(o>0)throw new g("LIS_RATE_LIMITED","the integrations service is busy \u2014 try again in a moment");let c=Z(a).data?.retry_after_sec,l=Math.min(Math.max(typeof c=="number"&&Number.isFinite(c)?c:1,0),_e);clearTimeout(E),await new Promise(y=>setTimeout(y,l*1e3));continue}return a}catch(s){throw s instanceof g?s:h.signal.aborted?new g("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new g("LIS_UNAVAILABLE",`could not reach the integrations service (${$(s instanceof Error?s.message:String(s))}) \u2014 check your connection and retry`)}finally{clearTimeout(E)}}}function D(t){let n=t.headers.get("content-type")??"application/octet-stream";if(n.includes("json"))try{let e=JSON.parse(t.bytes.toString("utf8")),r=e.content??e.data?.content;if(typeof r=="string")return{bytes:Buffer.from(r,"base64"),mediaType:e.mime_type??e.data?.mime_type??"application/octet-stream"}}catch{}return{bytes:t.bytes,mediaType:n}}async function k(t={}){let n=await N("/jira/info",{method:"GET"},t);if(!n.ok)throw C(n);let e=P(n),r=(e.data?.SELECTED_PROJECTS??[]).map(d=>d?.key).filter(d=>typeof d=="string"&&d.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:r,capabilities:{document:e.data?.capabilities?.document===!0,comments:e.data?.capabilities?.comments===!0}}}async function F(t,n={}){let e=await N("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},n);if(!e.ok)throw C(e);let r=P(e);if(r.type==="error"||!r.data)throw new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${$(r.message??"")||"issue not found or not accessible"}`);return r.data}var se=100,Ae=5e3,Ie=60;async function V(t,n={}){let e=[],r=new Set,d=null,o=0;for(let h=0;;h++){if(h>=Ie)throw new g("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let E=await N("/jira/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:se,cursor:d,start_at:o,order_by:"created",fetch_all:!1})},n);if(!E.ok)throw C(E,"the issue's comments");let s=P(E);if(s.type==="error"||!s.data)throw new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${$(s.message??"")||"unavailable"}`);for(let R of s.data.comments??[]){let m=String(R.id);r.has(m)||(r.add(m),e.push(R))}let u=s.data.pagination;if(!u?.has_more)return e;if(e.length>=Ae)throw new g("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let a=u.next_cursor??null,c=u.next_start_at!=null,l=c?u.next_start_at:o+se;if(!(a!=null&&a!==d||a==null&&c&&l!==o))throw new g("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");d=a,o=l}}async function G(t,n={}){let e=await N("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok){if(re(e)===void 0){if(e.status===413)throw new g("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new g("JIRA_NOT_CONNECTED",`Jira is not connected for this account \u2014 connect it at ${w} and retry`)}throw C(e,`attachment ${t}`)}return D(e)}var K="kane.source.jira/2";function oe(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let n=t.map(oe).filter(e=>e!==null);return n.length===0?null:n.join(", ")}if(t!==null&&typeof t=="object"){let n=t;for(let e of["name","value","displayName"])if(typeof n[e]=="string")return n[e];return null}return null}function ie(t,n,e){let r=[],d={},o=t.additional_fields??{};for(let a of Object.keys(o).sort()){let c=oe(o[a]);if(c===null){r.push(`field "${a}" has no stable text form \u2014 dropped from the envelope`);continue}d[a]=c}let h=[...t.attachments??[]].map(a=>({id:String(a.id),filename:a.filename??"",media_type:a.mime_type??"application/octet-stream",size:a.size??0})).sort((a,c)=>{let l=Number(a.id),y=Number(c.id);return Number.isFinite(l)&&Number.isFinite(y)?l-y:a.id<c.id?-1:a.id>c.id?1:0}),E=e.map(a=>({id:String(a.id),author:a.author?.display_name??"",body:a.body??"",created:a.created??""})).sort((a,c)=>{if(a.created!==c.created)return a.created<c.created?-1:1;let l=Number(a.id),y=Number(c.id);return Number.isFinite(l)&&Number.isFinite(y)&&l!==y?l-y:a.id<c.id?-1:a.id>c.id?1:0}),s=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(s))throw new Error(`cannot build a stable identity for issue key "${s}" \u2014 expected a PROJECT-NUMBER key`);let u={schema:K,site:n,project:s.slice(0,s.lastIndexOf("-")),issue:{id:t.id,key:s},content:{summary:t.summary??"",description:t.description??"",fields:d},attachments:h,comments:E};return{bytes:Buffer.from(JSON.stringify(u),"utf8"),envelope:u,warnings:r}}var ae=64,Le=16,we=6e6,Se=5e7,Re=12e6,ve={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},$e=new Set(["png","jpeg","webp"]);function ce(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==K)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${K}`);let r=[],d=new Map,o=[],h=0,E=new Map,s=[];for(let c=0;c<e.attachments.length;c++){let l=e.attachments[c],y=`i${c+1}`,R=`attachment:${l.filename}`,m=I=>`[img#${y}] ${l.filename} (${l.media_type}, ${l.size} bytes${I?"":" \u2014 not delivered"})`,p=(I,L,T)=>{r.push({ref:y,loc:R,media_type:I,...T?.blob?{blob:T.blob}:{},...T?.appearance?{appearance:T.appearance}:{},delivery:L,...T?.duplicate_of?{duplicate_of:T.duplicate_of}:{}})};if(!l.media_type.startsWith("image/")){p(l.media_type,"unsupported-vision-media-type"),s.push(m(!1));continue}let S;try{S=await t.fetchAttachment(l.id)}catch{p(l.media_type,"external-image-not-fetched"),s.push(m(!1));continue}let f=S.bytes,i=M(f),b=ve[i.format],_=j(f);if(d.set(_,f),!$e.has(i.format)){let I=i.format==="gif"||i.format==="bmp"||i.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";p(b,I,{blob:_}),s.push(m(!1));continue}if(i.width===void 0||i.height===void 0||i.width*i.height>Se){p(b,"undecodable",{blob:_}),s.push(m(!1));continue}let A;if(i.format==="png"||i.format==="jpeg"){let I=J(f,i.format);if(I===null){p(b,"undecodable",{blob:_}),s.push(m(!1));continue}A=B(I.data,{width:I.width,height:I.height,channels:I.channels})}if(i.width<ae||i.height<ae){p(b,"below-dimension-floor",{blob:_,appearance:A}),s.push(m(!1));continue}let v=E.get(_);if(v!==void 0){p(b,"duplicate",{blob:_,appearance:A,duplicate_of:v}),s.push(m(!1));continue}if(f.byteLength>we){p(b,"image-too-large",{blob:_,appearance:A}),s.push(m(!1));continue}if(h+f.byteLength>Re){p(b,"vision-byte-budget-reached",{blob:_,appearance:A}),s.push(m(!1));continue}if(o.length>=Le){p(b,"image-cap-reached",{blob:_,appearance:A}),s.push(m(!1));continue}E.set(_,y),h+=f.byteLength,o.push(y),p(b,"selected",{blob:_,appearance:A}),s.push(m(!0))}let u=[];u.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&u.push("",...e.content.description.split(`
4
+ `));let a=Object.keys(e.content.fields);return a.length>0&&u.push("","--- fields ---",...a.map(c=>`${c}: ${e.content.fields[c]}`)),s.length>0&&u.push("","--- attachments ---",...s),e.comments.length>0&&(u.push("","--- comments ---"),e.comments.forEach((c,l)=>{l>0&&u.push(""),u.push(`[${l+1}] ${c.author} \xB7 ${c.created}`,...c.body.split(`
5
+ `))})),{projection:u.join(`
6
+ `)+`
7
+ `,inventory:r,blobs:d,delivered:o,converter:{name:"jira-convert",version:"2",policy:"v1"}}}}var Te=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function Y(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.lastIndexOf("browse");if(r===-1||r+1>=e.length)return null;let d=e[r+1];return Te.test(d)?{site:n.hostname,issueKey:d.toUpperCase()}:null}function H(t,n){let e=Q(t),r=e.heads.get(n);if(r==null)return null;let d=e.getNode(r)?.content?.blob;if(typeof d!="string")return null;let o=ee(t,d);if(o===null)return null;try{let h=JSON.parse(o.toString("utf8"));return typeof h.site=="string"&&h.site.length>0?h.site:null}catch{return null}}async function Ce(t,n,e,r,d){let o=Y(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let h=d?.lis??{jiraInfo:k,jiraIssue:F,jiraAttachment:G,jiraComments:V};try{let s={auth:await(d?.authEnv??(await import("./auth-IKFVW3NX.js")).resolveLisAuthEnv)(),env:process.env},u=await h.jiraInfo(s);if(!u.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${w} and retry`),{code:1};if(u.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issue comments yet \u2014 resync it at ${w} and retry`),{code:1};let a=o.issueKey.slice(0,o.issueKey.lastIndexOf("-"));if(!u.selectAll&&u.selectedProjects.length>0&&!u.selectedProjects.includes(a))return(e.err??e.out)(`error: ${t}: project ${a} is not in the integration's selected projects (${u.selectedProjects.join(", ")}) \u2014 add it at ${w}`),{code:1};let c=await h.jiraIssue(o.issueKey,s),l=await h.jiraComments(o.issueKey,s),y=o.site;if(c.host)try{y=new URL(c.host).hostname}catch{y=c.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:R,warnings:m}=ie(c,y,l),p=n??o.issueKey.toLowerCase();U(p);let S=H(r,p);if(S!==null&&S!==y)return(e.err??e.out)(`error: ${t}: source '${p}' was ingested from ${S}, but this read serves ${y} \u2014 retire it first (kane-cli context retire ${p}) or ingest under a different id with --as`),{code:1};let f=await x({contextDir:r,bytes:R,media:te,sourceId:p,label:t,confirmSameSource:e.isTTY?i=>e.confirm(`identical content already ingested as ${i} \u2014 treat as the same source?`):void 0,converters:{jira:ce({fetchAttachment:i=>h.jiraAttachment(i,s)})}});e.out(z(e.isTTY,f,o.issueKey));for(let i of m)e.out(`warning: ${i}`);for(let i of f.warnings??[])e.out(`warning: ${i}`);if(f.composite){let i=f.composite.delivered+f.composite.omitted;e.out(`${f.source_id}: jira, ${i} attachments, ${f.composite.delivered} images delivered (${f.composite.omitted} omitted)`)}return{code:0,result:{status:f.status,source_id:f.source_id,source_cid:f.cid}}}catch(E){return E instanceof g?((e.err??e.out)(`error: ${t}: ${E.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${Ne(E instanceof Error?E.message:String(E))}`),{code:1})}}function Ne(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the issue's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var ue={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>Y(t)!==null,ingest:Ce,sourceIdFor:t=>{let n=Y(t);return n?n.issueKey.toLowerCase():null}};async function le(t,n={}){let e=await N("/jira/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw C(e,"the page");let r=P(e);if(r.type==="error"||!r.data)throw new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch the page: ${$(r.message??"")||"page not found or not accessible"}`);return r.data}async function de(t,n={}){let e=await N("/jira/attachment",{method:"POST",body:JSON.stringify({source:"confluence",download:t})},n);if(!e.ok)throw C(e,"the page's attachment");return{bytes:D(e).bytes}}var W="kane.source.confluence/1";function me(t,n){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this page \u2014 the integrations service returned no page id");let e=[...t.labels??[]].filter(o=>typeof o=="string").sort(),r=[...t.attachments??[]].map(o=>({id:String(o.id),filename:o.filename??"",media_type:o.mime_type??"application/octet-stream",size:o.size??0})).sort((o,h)=>o.id<h.id?-1:o.id>h.id?1:0),d={schema:W,site:n,page:{id:t.id},space:{key:t.space?.key??""},title:t.title??"",labels:e,content:{body:t.body??""},attachments:r};return{bytes:Buffer.from(JSON.stringify(d),"utf8"),envelope:d,warnings:[]}}var pe=64,Oe=16,Pe=6e6,je=5e7,Ue=12e6,xe={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Be=new Set(["png","jpeg","webp"]);function fe(t){let n=new Map(Object.entries(t.downloads));return async e=>{let r;try{r=JSON.parse(e.toString("utf8"))}catch{throw new Error("CONFLUENCE_ENVELOPE_SCHEMA: source bytes are not a kane confluence envelope")}if(r.schema!==W)throw new Error(`CONFLUENCE_ENVELOPE_SCHEMA: unknown envelope schema "${r.schema}" \u2014 this CLI understands ${W}`);let d=[],o=new Map,h=[],E=0,s=new Map,u=[];for(let c=0;c<r.attachments.length;c++){let l=r.attachments[c],y=`i${c+1}`,R=`attachment:${l.filename}`,m=L=>`[img#${y}] ${l.filename} (${l.media_type}, ${l.size} bytes${L?"":" \u2014 not delivered"})`,p=(L,T,O)=>{d.push({ref:y,loc:R,media_type:L,...O?.blob?{blob:O.blob}:{},...O?.appearance?{appearance:O.appearance}:{},delivery:T,...O?.duplicate_of?{duplicate_of:O.duplicate_of}:{}})};if(!l.media_type.startsWith("image/")){p(l.media_type,"unsupported-vision-media-type"),u.push(m(!1));continue}let S=n.get(l.id);if(!S){p(l.media_type,"external-image-not-fetched"),u.push(m(!1));continue}let f;try{f=await t.fetchAttachment({id:l.id,download:S})}catch{p(l.media_type,"external-image-not-fetched"),u.push(m(!1));continue}let i=f.bytes,b=M(i),_=xe[b.format],A=j(i);if(o.set(A,i),!Be.has(b.format)){let L=b.format==="gif"||b.format==="bmp"||b.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";p(_,L,{blob:A}),u.push(m(!1));continue}if(b.width===void 0||b.height===void 0||b.width*b.height>je){p(_,"undecodable",{blob:A}),u.push(m(!1));continue}let v;if(b.format==="png"||b.format==="jpeg"){let L=J(i,b.format);if(L===null){p(_,"undecodable",{blob:A}),u.push(m(!1));continue}v=B(L.data,{width:L.width,height:L.height,channels:L.channels})}if(b.width<pe||b.height<pe){p(_,"below-dimension-floor",{blob:A,appearance:v}),u.push(m(!1));continue}let I=s.get(A);if(I!==void 0){p(_,"duplicate",{blob:A,appearance:v,duplicate_of:I}),u.push(m(!1));continue}if(i.byteLength>Pe){p(_,"image-too-large",{blob:A,appearance:v}),u.push(m(!1));continue}if(E+i.byteLength>Ue){p(_,"vision-byte-budget-reached",{blob:A,appearance:v}),u.push(m(!1));continue}if(h.length>=Oe){p(_,"image-cap-reached",{blob:A,appearance:v}),u.push(m(!1));continue}s.set(A,y),E+=i.byteLength,h.push(y),p(_,"selected",{blob:A,appearance:v}),u.push(m(!0))}let a=[];return a.push(`${r.title} \xB7 ${r.site} \xB7 ${r.space.key}`),r.labels.length>0&&a.push(`labels: ${r.labels.join(", ")}`),r.content.body!==""&&a.push("",...r.content.body.split(`
8
+ `)),u.length>0&&a.push("","--- attachments ---",...u),{projection:a.join(`
9
+ `)+`
10
+ `,inventory:d,blobs:o,delivered:h,converter:{name:"confluence-convert",version:"1",policy:"v1"}}}}var Me=/^[A-Za-z0-9~][A-Za-z0-9._~-]*$/;function X(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.indexOf("wiki");if(r===-1||e[r+1]!=="spaces"||e[r+3]!=="pages")return null;let d=e[r+2],o=e[r+4];return d===void 0||o===void 0||!Me.test(d)||!/^\d+$/.test(o)?null:{site:n.hostname,spaceKey:d,pageId:o}}async function Je(t,n,e,r,d){let o=X(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Confluence page URL (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)`),{code:1};let h=d?.lis??{jiraInfo:k,jiraIssue:F,jiraAttachment:G,jiraComments:V},E=d?.confluence??{confluenceDocument:le,confluenceAttachment:de};try{let u={auth:await(d?.authEnv??(await import("./auth-IKFVW3NX.js")).resolveLisAuthEnv)(),env:process.env},a=await h.jiraInfo(u);if(!a.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${w} and retry`),{code:1};if(a.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection has no Confluence access \u2014 reconnect with Confluence at ${w} and retry`),{code:1};let c=await E.confluenceDocument(o.pageId,u),l=o.site;if(c.url)try{l=new URL(c.url).hostname}catch{}let{bytes:y,warnings:R}=me(c,l),m=n??`page-${o.pageId}`;U(m);let p=H(r,m);if(p!==null&&p!==l)return(e.err??e.out)(`error: ${t}: source '${m}' was ingested from ${p}, but this read serves ${l} \u2014 retire it first (kane-cli context retire ${m}) or ingest under a different id with --as`),{code:1};let S=Object.fromEntries((c.attachments??[]).filter(i=>typeof i.download=="string"&&i.download.length>0).map(i=>[String(i.id),i.download])),f=await x({contextDir:r,bytes:y,media:ne,sourceId:m,label:t,confirmSameSource:e.isTTY?i=>e.confirm(`identical content already ingested as ${i} \u2014 treat as the same source?`):void 0,converters:{confluence:fe({downloads:S,fetchAttachment:i=>E.confluenceAttachment(i.download,u)})}});e.out(z(e.isTTY,f,`${o.spaceKey}/${o.pageId}`));for(let i of R)e.out(`warning: ${i}`);for(let i of f.warnings??[])e.out(`warning: ${i}`);if(f.composite){let i=f.composite.delivered+f.composite.omitted;e.out(`${f.source_id}: confluence, ${i} attachments, ${f.composite.delivered} images delivered (${f.composite.omitted} omitted)`)}return{code:0,result:{status:f.status,source_id:f.source_id,source_cid:f.cid}}}catch(s){return s instanceof g?((e.err??e.out)(`error: ${t}: ${s.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${De(s instanceof Error?s.message:String(s))}`),{code:1})}}function De(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the page in Confluence and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page's text is too large to ingest \u2014 trim the page in Confluence and retry":t}var ge={name:"confluence",hint:"Confluence page URLs (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)",match:t=>X(t)!==null,ingest:Je,sourceIdFor:t=>{let n=X(t);return n?`page-${n.pageId}`:null}};function z(t,n,e){return t?n.status==="created"?`landed ${n.source_id} (${e}) \u2014 new source`:n.status==="versioned"?`landed ${n.source_id} (${e}) \u2014 new version; dependents go stale`:`${n.source_id} unchanged \u2014 already landed`:`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`}var ke=[ue,ge];function xt(t){return/^https?:\/\/.+/i.test(t)}function Bt(t){return ke.find(n=>n.match(t))??null}export{z as a,ke as b,xt as c,Bt as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,f as o}from"./chunk-C4G7RVJ6.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,f as o}from"./chunk-ZUGCHQFC.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{y as n}from"./chunk-C4G7RVJ6.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
2
+ import{y as n}from"./chunk-ZUGCHQFC.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as h}from"./chunk-AAONIIQV.js";import{d as l}from"./chunk-M7WQM4UA.js";import{b as u}from"./chunk-WWNSD6FA.js";import{d as f}from"./chunk-5YPBPZUR.js";import{existsSync as w,readFileSync as _,readdirSync as R}from"fs";import{join as p}from"path";function g(i,r){let{records:t}=l(i),o=new Set;for(let e of t)for(let n of e.review)n.resolution!=="pending"&&o.add(n.id);let s=[],d=new Set;for(let e=t.length-1;e>=0;e--)for(let n of t[e].dedup_hits??[]){if(n.new_cid===void 0)continue;let c=`${n.new_cid}|${n.candidate_cid}`;d.has(c)||(d.add(c),!o.has(n.new_cid)&&(r.superseded.has(n.new_cid)||r.superseded.has(n.candidate_cid)||r.trust.get(n.new_cid)==="derived"&&s.push({new_cid:n.new_cid,candidate_cid:n.candidate_cid,score:n.score,scorer:n.scorer})))}return s}var a=(i,r)=>i.displayNameOf(r)??r.slice(0,19);function m(i,r){return{design_children:i.edgesInto(r).filter(o=>(o.type==="belongs_to"||o.type==="scoped_to")&&!i.superseded.has(o.src)).length}}function v(i,r){let{records:t}=l(i),o=new Set,s=new Map;for(let e of t)for(let n of e.review)n.kind==="pending_archive"?s.set(n.id,n.reason):n.resolution!=="pending"&&o.add(n.id);let d=new Map;for(let[e,n]of s)r.superseded.has(e)||r.trust.get(e)!=="derived"||o.has(e)||d.set(e,n);return{all:s,live:d}}function y(i,r){let t=[],o=new Set;for(let e of g(i.contextDir,r)){o.add(e.new_cid);let n=e.scorer==="lexical_fallback"?" (lexical fallback \u2014 the probe ran degraded)":"";t.push({kind:"PAIR",ref:a(r,e.new_cid),title:String(r.getNode(e.new_cid)?.content.title??e.new_cid.slice(0,12)),why:`possible duplicate of ${a(r,e.candidate_cid)} \u2014 score ${e.score}${n}`,pair:{candidate_cid:e.candidate_cid,candidate_ref:a(r,e.candidate_cid),score:e.score,scorer:e.scorer}})}let{all:s,live:d}=v(i.contextDir,r);for(let[e,n]of d)t.push({kind:"REVIEW",ref:a(r,e),title:String(r.getNode(e)?.content.title??e.slice(0,12)),why:`archive held for interactive confirmation${n?` \u2014 ${n}`:""}`,held:!0,impact:m(r,e)});for(let e of k(i.contextDir))t.push({kind:"MODIFY_HELD",ref:`${e.sid}:${e.tempRef}`,title:String(e.content.title??e.tempRef),why:`${e.rationale} \u2014 held by paused/dead session ${e.sid}`,heldPayload:e});for(let{cid:e,content:n}of r.byLabel(f.USECASE))r.superseded.has(e)||r.trust.get(e)!=="derived"||o.has(e)||s.has(e)||t.push({kind:"REVIEW",ref:a(r,e),title:String(n.title??e.slice(0,12)),why:"unreviewed \u2014 approve, archive, or defer",impact:m(r,e)});return t}function F(i,r){let t={REVIEW:0,PAIR:0,MODIFY_HELD:0};for(let o of y(i,r))t[o.kind]++;return t}function b(i,r){try{let t=JSON.parse(_(p(i,"sessions",r,".lock"),"utf8"));return typeof t.pid=="number"&&u(t.pid)}catch{return!1}}function k(i){let r=[],t=p(i,"sessions");if(!w(t))return r;let o=[];try{o=R(t)}catch{return r}for(let s of o){if(!w(p(t,s,"state.json"))||b(i,s))continue;let d=[],e=!1;try{let c=h(i,s).kane;c?.pending?.proposals?.length&&(d=c.pending.proposals,e=!0)}catch{e=!1}if(!e)try{d=JSON.parse(_(p(t,s,"state.json"),"utf8")).pending?.proposals??[]}catch{continue}for(let n of d)r.push({sid:s,tempRef:String(n.tempRef??n.temp_ref??"held"),...typeof n.event_id=="string"?{event_id:n.event_id}:{},label:String(n.label??"usecase"),content:n.content??{},rationale:String(n.rationale??"held payload")})}return r}export{m as a,v as b,y as c,F as d};
2
+ import{g as h}from"./chunk-GFKCTYCA.js";import{d as l}from"./chunk-DUAXZYAD.js";import{b as u}from"./chunk-DBIBROYW.js";import{d as f}from"./chunk-WXHQYYD5.js";import{existsSync as w,readFileSync as _,readdirSync as R}from"fs";import{join as p}from"path";function g(i,r){let{records:t}=l(i),o=new Set;for(let e of t)for(let n of e.review)n.resolution!=="pending"&&o.add(n.id);let s=[],d=new Set;for(let e=t.length-1;e>=0;e--)for(let n of t[e].dedup_hits??[]){if(n.new_cid===void 0)continue;let c=`${n.new_cid}|${n.candidate_cid}`;d.has(c)||(d.add(c),!o.has(n.new_cid)&&(r.superseded.has(n.new_cid)||r.superseded.has(n.candidate_cid)||r.trust.get(n.new_cid)==="derived"&&s.push({new_cid:n.new_cid,candidate_cid:n.candidate_cid,score:n.score,scorer:n.scorer})))}return s}var a=(i,r)=>i.displayNameOf(r)??r.slice(0,19);function m(i,r){return{design_children:i.edgesInto(r).filter(o=>(o.type==="belongs_to"||o.type==="scoped_to")&&!i.superseded.has(o.src)).length}}function v(i,r){let{records:t}=l(i),o=new Set,s=new Map;for(let e of t)for(let n of e.review)n.kind==="pending_archive"?s.set(n.id,n.reason):n.resolution!=="pending"&&o.add(n.id);let d=new Map;for(let[e,n]of s)r.superseded.has(e)||r.trust.get(e)!=="derived"||o.has(e)||d.set(e,n);return{all:s,live:d}}function y(i,r){let t=[],o=new Set;for(let e of g(i.contextDir,r)){o.add(e.new_cid);let n=e.scorer==="lexical_fallback"?" (lexical fallback \u2014 the probe ran degraded)":"";t.push({kind:"PAIR",ref:a(r,e.new_cid),title:String(r.getNode(e.new_cid)?.content.title??e.new_cid.slice(0,12)),why:`possible duplicate of ${a(r,e.candidate_cid)} \u2014 score ${e.score}${n}`,pair:{candidate_cid:e.candidate_cid,candidate_ref:a(r,e.candidate_cid),score:e.score,scorer:e.scorer}})}let{all:s,live:d}=v(i.contextDir,r);for(let[e,n]of d)t.push({kind:"REVIEW",ref:a(r,e),title:String(r.getNode(e)?.content.title??e.slice(0,12)),why:`archive held for interactive confirmation${n?` \u2014 ${n}`:""}`,held:!0,impact:m(r,e)});for(let e of k(i.contextDir))t.push({kind:"MODIFY_HELD",ref:`${e.sid}:${e.tempRef}`,title:String(e.content.title??e.tempRef),why:`${e.rationale} \u2014 held by paused/dead session ${e.sid}`,heldPayload:e});for(let{cid:e,content:n}of r.byLabel(f.USECASE))r.superseded.has(e)||r.trust.get(e)!=="derived"||o.has(e)||s.has(e)||t.push({kind:"REVIEW",ref:a(r,e),title:String(n.title??e.slice(0,12)),why:"unreviewed \u2014 approve, archive, or defer",impact:m(r,e)});return t}function F(i,r){let t={REVIEW:0,PAIR:0,MODIFY_HELD:0};for(let o of y(i,r))t[o.kind]++;return t}function b(i,r){try{let t=JSON.parse(_(p(i,"sessions",r,".lock"),"utf8"));return typeof t.pid=="number"&&u(t.pid)}catch{return!1}}function k(i){let r=[],t=p(i,"sessions");if(!w(t))return r;let o=[];try{o=R(t)}catch{return r}for(let s of o){if(!w(p(t,s,"state.json"))||b(i,s))continue;let d=[],e=!1;try{let c=h(i,s).kane;c?.pending?.proposals?.length&&(d=c.pending.proposals,e=!0)}catch{e=!1}if(!e)try{d=JSON.parse(_(p(t,s,"state.json"),"utf8")).pending?.proposals??[]}catch{continue}for(let n of d)r.push({sid:s,tempRef:String(n.tempRef??n.temp_ref??"held"),...typeof n.event_id=="string"?{event_id:n.event_id}:{},label:String(n.label??"usecase"),content:n.content??{},rationale:String(n.rationale??"held payload")})}return r}export{m as a,v as b,y as c,F as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as g}from"./chunk-C4G7RVJ6.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
2
+ import{c as g}from"./chunk-ZUGCHQFC.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
3
3
  `),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
4
4
  `),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
5
5
  `)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as $e}from"./chunk-IXVOXJP6.js";import{a as te}from"./chunk-R2RGSO4B.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-APAIWBIH.js";import{a as ve}from"./chunk-73C4PRYU.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{y as i}from"./chunk-C4G7RVJ6.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
2
+ import{d as $e}from"./chunk-MK7JUOYV.js";import{a as te}from"./chunk-VHZ4S57N.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-KQZA2QSC.js";import{a as ve}from"./chunk-GYNTNKNB.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{y as i}from"./chunk-ZUGCHQFC.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
3
3
  `)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function je({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,De.useState)(!0);K(()=>c(T=>!T),500);let v=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=ze(v,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((T,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:T.length?T:" "},d))})}var U=R(k(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{label:e.label,shimmer:e.shimmer}):null,n?(0,U.jsx)(je,{text:t??""}):null]})}var r=R(k(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function z(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Fe(e){let t=[];for(let n of e)z(n)||(n.children&&n.children.length>0?t.push({...n,children:Fe(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function P({step:e,indent:t=2}){let n=e.actionType?Oe(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:v}=ee(),S=v?.columns??80,T=Math.max(20,S-t-21),d=e.objective??"",L=d.length>T?d.slice(0,T-1)+"\u2026":d,O=(e.duration??0)*1e3,y=e.duration!=null?O<1e3?`${Math.round(O)}ms`:`${(O/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:L,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:L}):c?(0,r.jsx)(o,{color:i.dim,children:L}):(0,r.jsx)(o,{color:i.dim,children:L})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:y})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((h,b)=>(0,r.jsx)(P,{step:h,indent:t+2},`child-${b}`))})]})}function Xe(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(P,{step:e.step})})}function _e({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:v,describeVisible:S,describeRevealing:T}){let d=(0,I.useRef)(new Set),L=(0,I.useRef)(!1),O=(0,I.useRef)(new Set),y=(0,I.useRef)(!1),h=(0,I.useRef)(new Set),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{e.length===0&&b.current>0&&(d.current.clear(),L.current=!1,O.current.clear(),y.current=!1,h.current.clear()),b.current=e.length},[e.length]);let B=e.flatMap(p=>[p,...p.children??[]]),F=B.some(p=>p.status==="running"),M=B.some(p=>p.status==="failed"),X=B.length===0||B.every(p=>p.status==="pending"),Y=B.filter(p=>p.status==="passed"||p.status==="failed").length,N;X?N="starting":F?N="running":M?N="failed":N="passed";let J=(0,I.useRef)(null),[ce,he]=(0,I.useState)(0);(0,I.useEffect)(()=>{B.length===0||X?(J.current=null,he(0)):F&&J.current==null&&(J.current=Date.now())},[F,X,B.length]),(0,I.useEffect)(()=>{if(!F)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[F]);let ae=(0,I.useRef)(new Set),[,xe]=(0,I.useState)(0),be=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let g of e)(g.status==="passed"||g.status==="failed")&&!ae.current.has(g.index)&&(ae.current.add(g.index),p.push({key:`step_${g.index}`,type:"step",step:{...g,children:g.children?[...g.children]:void 0}}));if(p.length>0){for(let g of p)c(Xe(g));xe(g=>g+1)}},[e,t,l,u,c]),(0,I.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!y.current&&l&&l[0]!=null&&(y.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!L.current&&(L.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let g=e.flatMap((x,f)=>{let m=x.children??[];return!O.current.has(f)&&m.length>0&&(O.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&O.current.has(f)&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),m});for(let x of g){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...x,children:void 0}})})));for(let $ of x.children??[]){let w=`child-${x.childId??"p"}-${x.index}-${$.childId??"p"}-${$.index}-${$.objective}`;d.current.has(w)||($.status==="passed"||$.status==="failed"||$.status==="stopped")&&(d.current.add(w),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:$})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:x})})))}}else for(let g of e){let x=`${g.index}-${g.objective}`,f=!!g.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})));for(let m of g.children??[]){let $=`child-${g.index}-${m.childId??"p"}-${m.index}-${m.objective}`;d.current.has($)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:m})})))}!f&&!d.current.has(x)&&(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})))}d.current.size>p&&xe(g=>g+1)},[e,c,t,n,l]);let G=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||G.push(p);else if(c&&!u)if(t)for(let p of e){let g=p.children??[],x=[];for(let f of g){let m=`${f.childId??"p"}-${f.index}-${f.objective}`,$=d.current.has(m);if(f.branchObjective){let w=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!$||w.length>0)&&x.push({...f,children:w})}else $||x.push(f)}x.length>0&&G.push({...p,children:x})}else for(let p of e){let g=`${p.index}-${p.objective}`,x=d.current.has(g),f=(p.children??[]).filter(m=>{let $=`child-${p.index}-${m.childId??"p"}-${m.index}-${m.objective}`;return!d.current.has($)});x?f.length>0&&G.push({...p,children:f}):G.push({...p,children:f})}if(!u){let p=c?G:e,g=le(p),x=ge(g,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((m,$)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:$>0?1:0,children:m.children&&m.children.length>0?m.children.map(w=>{if(z(w))return null;let Q=!!w.branchObjective,ue=`${w.childId??"p"}-${w.index}-${w.objective}`,Ke=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!Ke&&(0,r.jsx)(P,{step:{...w,children:void 0}}),(w.children??[]).filter(Z=>!z(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:Z})},`f${$}-${w.index}-${Z.childId??"p"}-${Z.index}`))]},`f${$}-host-${w.childId??"p"}-${w.index}`):(0,r.jsx)(P,{step:w},`f${$}-${w.childId??"p"}-${w.index}`)}):m.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},$))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(m,$)=>z(m)?null:(0,r.jsx)(P,{step:m},$)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(m=>!(m.status==="running"&&(!m.children||m.children.length===0))).map(m=>{let $=`${m.index}-${m.objective}`;return c&&d.current.has($)?(0,r.jsx)(s,{flexDirection:"column",children:(m.children??[]).filter(w=>!z(w)).map(w=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:w})},`${w.childId??"p"}-${w.index}`))},`branch-children-${m.index}`):(0,r.jsx)(P,{step:m},m.index)})]}),(0,r.jsx)(se,{activity:x,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),g=ge(p,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>z(x)?null:(0,r.jsx)(P,{step:x},f)}),(0,r.jsx)(se,{activity:g,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ne=le(G),Ge=ge(Ne,T),Re=Fe(G);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(P,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ge,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var W=R(k(),1);function Ae({runner:e,runKey:t,onStepCommit:n}){let l=Ie({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,W.jsxs)(W.Fragment,{children:[l&&(0,W.jsx)(ke,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,W.jsx)(_e,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var D=R(k(),1),Ye=64;function Je(e){return e.split(`
4
4
  `).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function qe({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:v}){let S=e==="passed",T=S?i.green:i.red,d=S?"\u2713":"\u2717",L=e.toUpperCase(),O=a??(S?l:Math.max(0,l-1)),y=u??(S?0:1),h=y>0?`${l} steps (${O} passed, ${y} failed)`:`${l} steps`,b=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,B=Je(t);return(0,D.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,D.jsxs)(s,{borderStyle:"round",borderColor:T,flexDirection:"column",paddingX:2,paddingY:1,width:Ye+6,children:[(0,D.jsxs)(s,{flexDirection:"column",children:[(0,D.jsxs)(o,{bold:!0,color:T,children:[d," ",L]}),(0,D.jsxs)(o,{color:i.dim,wrap:"wrap",children:[h," \xB7 ",b,typeof v=="number"&&v>0?` \xB7 ${parseFloat(v.toFixed(4))} credits`:""]})]}),B.length>0&&(0,D.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:B.map((F,M)=>(0,D.jsxs)(s,{marginBottom:M<B.length-1?1:0,children:[(0,D.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,D.jsx)(s,{flexShrink:1,children:(0,D.jsx)(o,{wrap:"wrap",children:F})})]},M))}),c&&!S&&(0,D.jsx)(s,{marginTop:1,children:(0,D.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var j=R(k(),1);function Me({message:e,code:t,remediation:n,docsUrl:l}){return(0,j.jsx)(ve,{title:"Error",variant:"error",children:(0,j.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,j.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,j.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Code: "}),(0,j.jsx)(o,{color:i.dim,children:t})]}),n&&(0,j.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,j.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,j.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Docs: "}),(0,j.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var E=R(k(),1);function un(e){let{exit:t}=Te(),{append:n}=ye(),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{l.current||(l.current=!0,n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,E.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,E.jsx)(Qe,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,E.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,A.useRef)(null),u=(0,A.useCallback)(async y=>{let h=await e.getNextStep(y);return h?(a.current=h,h.config):(a.current=null,null)},[e]),c=(0,A.useCallback)((y,h)=>{let b=a.current;if(!b)return;let B=b.mode==="replay"?"cyan":"#dc4e08",F=b.modeReason?` (${b.modeReason})`:"",M=b.perStepOverrides?Object.entries(b.perStepOverrides):[];n((0,E.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,E.jsxs)(o,{children:[(0,E.jsxs)(o,{color:i.dim,children:[b.banner.stepLabel," "]}),(0,E.jsxs)(o,{color:B,children:["[",b.mode,"]"]}),(0,E.jsx)(o,{color:i.dim,children:F})]}),(0,E.jsx)(o,{color:i.dim,children:b.banner.objective}),M.length>0&&(0,E.jsxs)(o,{color:i.dim,children:["overrides: ",M.map(([X,Y])=>`${X}=${Y}`).join(", ")]})]}))},[n]),v=(0,A.useRef)(0),S=(0,A.useRef)(!1),T=(0,A.useCallback)((y,h)=>(y.hadError?n((0,E.jsx)(Me,{message:y.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsx)(qe,{status:y.status,summary:y.runEnd?.summary??"",duration:y.runEnd?.duration??0,steps:y.stepsTotal,stepsPassed:y.stepsPassed,stepsFailed:y.stepsFailed,reason:y.runEnd?.reason,creditsConsumed:y.runEnd?.credits_consumed})})),e.onStepEnd?.(y,h)??!0),[n,e]),d=we({getNextConfig:u,onStepStart:c,onStepEnd:T,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),L=250,O=5e3;return Se((y,h)=>{if(h.ctrl&&y==="c"){let b=Date.now(),B=b-v.current;if(B<L)return;S.current&&B<O?(d.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>t())):(S.current=!0,n((0,E.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),v.current=b}}),(0,E.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,E.jsx)(Ae,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function Qe({data:e}){return(0,E.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{_e as a,ke as b,Ie as c,de as d,qe as e,Me as f,un as g};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as B,c as b}from"./chunk-NVGBE2DR.js";import{A as T}from"./chunk-TH47OOBV.js";import{a as L,c as F}from"./chunk-CUM23TLF.js";import{b as P,i as j}from"./chunk-DUAXZYAD.js";import{a as R,d as $,f as D}from"./chunk-WXHQYYD5.js";import{existsSync as ie,mkdirSync as oe,readFileSync as re,writeFileSync as se}from"fs";import{basename as C,extname as H,join as ae}from"path";var K=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function q(e){return typeof e=="string"&&e!=="."&&e!==".."&&K.test(e)}function k(e){if(!q(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(K)} (no path separators)`)}import{extname as W}from"path";var Q={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ee={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},z=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(te)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Q,ee],te=Buffer.from([208,207,17,224,161,177,26,225]),S={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence"},pe=new Set(Object.keys(S));function J(e){let n=W(e).toLowerCase(),t=z.find(i=>i.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:z.flatMap(i=>i.extensions)}}function v(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function de(e,n,t){return G({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:n,numbered_text:U(t)})}var Y=2e3;function ce(e){let t=C(e,H(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return k(t),t}function ke(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function X(e){let n=ae(e,"meta.json");ie(n)||(oe(e,{recursive:!0}),se(n,JSON.stringify({schema:R,canonicalizer:"v1"},null,2)+`
3
+ `))}async function Se(e){let{contextDir:n,filePath:t,asId:i,confirmSameSource:y,converters:h}=e;X(n);let o=re(t),s=J(t);if(!s.ok)throw new Error(`${C(t)} is a file type kane can't ingest (${H(t)||"no extension"}) \u2014 supported: ${s.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(o.byteLength>s.media.maxBytes)throw new Error(`${C(t)} is too large \u2014 ${v(o.byteLength)}, the limit for ${s.media.media_type} is ${v(s.media.maxBytes)} [FILE_TOO_LARGE]`);if(s.media.sniff&&!s.media.sniff(o)){let m=s.media.sniffFail?.(o);throw new Error(m??`MEDIA_SNIFF_MISMATCH: ${t} does not look like ${s.media.media_type}`)}let l;return i!==void 0?(k(i),l=i):l=ce(t),le({contextDir:n,bytes:o,media:s.media,sourceId:l,label:t,confirmSameSource:y,converters:h})}async function le(e){let{contextDir:n,bytes:t,media:i,confirmSameSource:y,converters:h}=e,o=e.sourceId,s=e.label??o;if(X(n),t.byteLength>i.maxBytes)throw new Error(`the content is too large \u2014 ${v(t.byteLength)}, the limit for ${i.media_type} is ${v(i.maxBytes)} [FILE_TOO_LARGE]`);let l=[],m=S[i.kind];if(i.cite==="verbatim"&&!m){try{new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${s} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}t.toString("utf8").split(`
4
+ `).some(p=>p.length>Y)&&l.push(`long line detected (> ${Y} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let f=B(t),_=new Map,c=null,M=!1;for(let p=0;;p++){let x=T(n),u=x.heads.get(o),Z=u!=null?x.getNode(u)?.content:void 0;if(u!=null&&Z?.blob===f)return{status:"unchanged",source_id:o,cid:u,blob:f};if(u==null){for(let[r,g]of x.heads.entries())if(!(r===o||g==null)&&x.getNode(g)?.content.blob===f){let a;if(_.has(r)?a=_.get(r):p===0&&y?(a=await y(r),_.set(r,a)):(a=!1,_.set(r,a),p>0&&l.push(`same bytes already ingested as '${r}' \u2014 minted under '${o}' anyway (the twin appeared mid-commit; not prompted)`)),a)return{status:"unchanged",source_id:r,cid:g,blob:f};break}}if(c===null){let r={},g,a=null,O=null;if(m){let A=h?.[m];if(!A)throw new Error(`${m.toUpperCase()}_CONVERTER_MISSING: ${m} ingestion requires the converter \u2014 the command layer wires it`);let d=await A(t);a=Buffer.from(d.projection,"utf8");let N=de(o,i.kind,a);if(N>4e5)throw new Error(`PROJECTION_TOO_LARGE: serialized source payload ${N} bytes > ${4e5} \u2014 split the document and re-ingest`);r={text_blob:B(a),...d.inventory.length>0?{images:d.inventory}:{},converter:d.converter},O=d.blobs,g={kind:i.kind,...d.pages!==void 0?{pages:d.pages}:{},delivered:d.delivered.length,omitted:d.inventory.length-d.delivered.length}}c={derived:r,composite:g,projBytes:a,derivedBlobs:O}}if(!M){if(b(n,t),c.projBytes!==null&&b(n,c.projBytes),c.derivedBlobs!==null)for(let[,r]of c.derivedBlobs)b(n,r);M=!0}let w=F(o,f),E=D("source",w);if(E.length>0)throw new Error(`source node fails ${E[0].code}: ${E[0].detail}`);let I=L("source",w);try{j(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:I,label:$.SOURCE,content:w}],edges:[],review:[],supersessions:[],media:{[o]:{format:i.kind,media_type:i.media_type,anchors_supported:m?["L-L","img#ref"]:i.cite==="verbatim"?["L-L"]:[],...c.derived}},...e.eventIds&&e.eventIds.length>0?{event_ids:e.eventIds}:{},source_head_moves:{[o]:I}},{expectPrev:x.latestHash})}catch(r){if(r instanceof P&&p<3)continue;throw r}return{status:u!=null?"versioned":"created",source_id:o,cid:I,blob:f,...l.length?{warnings:l}:{},...c.composite?{composite:c.composite}:{}}}}export{k as a,Q as b,ee as c,pe as d,J as e,de as f,ce as g,ke as h,Se as i,le as j};
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{closeSync as A,existsSync as $,mkdirSync as h,openSync as k,readFileSync as p,readdirSync as w,renameSync as _,rmSync as g,writeFileSync as m}from"fs";import{join as l}from"path";var a=class extends Error{constructor(r,t){super(`${r}: ${t}`);this.code=r}},d=e=>l(e,"reconcile","plans");function u(e,n){let r=`${e}.tmp-${process.pid}`;m(r,n,{mode:384}),_(r,e)}function N(e,n){let r=d(e);h(r,{recursive:!0});let t=l(r,`${n.created}-${n.source_id}.json`);return u(t,JSON.stringify(n,null,2)+`
2
+ import{closeSync as A,existsSync as $,mkdirSync as h,openSync as _,readFileSync as p,readdirSync as w,renameSync as k,rmSync as g,writeFileSync as m}from"fs";import{join as l}from"path";var a=class extends Error{constructor(r,t){super(`${r}: ${t}`);this.code=r}},d=e=>l(e,"reconcile","plans");function u(e,n){let r=`${e}.tmp-${process.pid}`;m(r,n,{mode:384}),k(r,e)}function N(e,n){let r=d(e);h(r,{recursive:!0});let t=l(r,`${n.created}-${n.source_id}.json`);return u(t,JSON.stringify(n,null,2)+`
3
3
  `),t}function y(e,n){let r=n;if(r===void 0){let o=d(e),c=[];try{c=w(o).filter(P=>P.endsWith(".json")).sort()}catch{}if(c.length===0)return{error:`no stored plans under ${o} \u2014 run reconcile --plan first`};r=l(o,c[c.length-1])}if(!$(r))return{error:`no such plan file: ${r}`};let t;try{t=p(r,"utf8")}catch(o){return{error:`cannot read plan ${r}: ${o instanceof Error?o.message:String(o)}`}}let i;try{i=JSON.parse(t)}catch(o){return{error:`corrupted plan ${r}: ${o instanceof Error?o.message:String(o)}`}}let s=i?.version;return s===1?{error:`plan predates the vocabulary change \u2014 recompute with --from <file> --source-id <id> (${r})`}:s!==2?{error:`unsupported plan version ${String(s)} in ${r} (expected 2)`}:Array.isArray(i.rows)?{plan:i,path:r}:{error:`not a reconcile plan \u2014 ${r} has no rows[] (hand-edited?)`}}function S(e){let n=e.archive_state??{};return(e.changeset??[]).filter(r=>r.kind==="ARCHIVE"&&n[r.ref]===void 0).map(r=>r.ref)}function D(e,n,r){let t=y("",e);if("error"in t)throw new a("PLAN_UNREADABLE",t.error);let i=t.plan,s=i.archive_state??{};if(s[n]!==void 0)throw new a("ROW_ALREADY_APPLIED",`archive ${n} already ${s[n].outcome}`);s[n]={at:new Date().toISOString(),outcome:r},i.archive_state=s,u(e,JSON.stringify(i,null,2)+`
4
4
  `)}function R(e,n){let r=d(e),t=[];try{t=w(r).filter(i=>i.endsWith(`-${n}.json`)).sort()}catch{}return t.length===0?null:y(e,l(r,t[t.length-1]))}function O(e,n){let r=R(e,n);if(r===null||"error"in r)return null;let t=r.plan.rows.filter(i=>i.applied===void 0).length+S(r.plan).length;return t>0?{path:r.path,created:r.plan.created,pending:t}:null}function I(e,n,r){let t;try{t=JSON.parse(p(e,"utf8"))}catch(s){throw new a("PLAN_UNREADABLE",`${e}: ${s instanceof Error?s.message:String(s)}`)}let i=t.rows?.[n];if(!i)throw new a("ROW_MISSING",`${e} has no row ${n}`);if(i.applied)throw new a("ROW_ALREADY_APPLIED",`row ${n} of ${e} was already applied (${i.applied.outcome} at ${i.applied.at})`);i.applied={at:new Date().toISOString(),outcome:r},u(e,JSON.stringify(t,null,2)+`
5
- `)}function x(e){let n=d(e);h(n,{recursive:!0});let r=l(n,".walk-lock");for(let t=0;t<2;t++)try{let i=k(r,"wx");return m(i,`${process.pid}
5
+ `)}function x(e){let n=d(e);h(n,{recursive:!0});let r=l(n,".walk-lock");for(let t=0;t<2;t++)try{let i=_(r,"wx");return m(i,`${process.pid}
6
6
  `),A(i),()=>{try{g(r)}catch{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=f(r);if(!Number.isFinite(s)){let c=Date.now()+50;for(;Date.now()<c;);s=f(r)}if(Number.isFinite(s)&&E(s))throw new a("WALK_LOCKED",`another reconciliation is already running (pid ${s}) \u2014 wait for it to finish; if it appears stuck, stop that process before retrying`);try{g(r)}catch{}}throw new a("WALK_LOCKED",`could not take the walk lock at ${l(n,".walk-lock")}`)}function f(e){try{return parseInt(p(e,"utf8").trim(),10)}catch{return NaN}}function E(e){try{return process.kill(e,0),!0}catch{return!1}}export{N as a,y as b,S as c,D as d,R as e,O as f,I as g,x as h};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var l="assurance/context@1";var u={source:{hashed:["blob","source_id"],required:["blob","source_id"],enums:{}},usecase:{hashed:["actors","criteria","derived","description","risk","summary","title","value"],required:["derived","risk","title"],enums:{risk:["high","med","low"]}},scenario:{hashed:["case_type","derived","description","intent","parameters","tags","technique_notes","title"],required:["case_type","derived","intent","title"],enums:{case_type:["happy","negative","boundary","edge","security","a11y","perf","i18n"]}},ac:{hashed:["derived","expected_answer","kind","measurable","risk","text"],required:["derived","risk","text"],enums:{risk:["high","med","low"],kind:["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"]}},test:{hashed:["check","config","definitionId","derived","objectives_blob","surface_required","test_md_blob","title"],required:["definitionId","derived","title"],enums:{}},gap:{hashed:["basis","derived","kind","question","ref","risk","risk_rationale","text","uc"],unhashed:["proposal_id","temp_ref"],required:["derived","kind"],enums:{kind:["ambiguous","incomplete","contradictory","unmeasurable","missing-expected-result","budget-evicted","invariant-unexercised","reconcile_deferred"],risk:["high","med","low"]}},stylenote:{hashed:["derived","learned_from_kind","statement","tags","text"],unhashed:["learned_from"],required:["derived","learned_from_kind","statement"],enums:{learned_from_kind:["edit","directed-edit","mistake","usage"]}}},f={DERIVES:{src:["source"],dst:["usecase","ac","scenario","test"],salient:["anchor","source_cid","source_id"],optionalSalient:["claim"],props:["anchor","claim","quote","source_cid","source_id"],pin:{comparesTo:"source_head"},cardinality:"many",acyclic:!1},belongs_to:{src:["scenario"],dst:["usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},scoped_to:{src:["ac"],dst:["scenario","usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},exercises:{src:["scenario"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},verifies:{src:["test"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},automates:{src:["test"],dst:["scenario"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src-and-dst",acyclic:!1},depends_on:{src:["usecase","scenario"],dst:["usecase","scenario"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},reuses:{src:["test"],dst:["test"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},annotates:{src:["gap","stylenote"],dst:["source","usecase","scenario","ac","test"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1}},E=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];var g={presence:{operators:["exists","forall"],baseline:"null",requires:[]},"forbidden-presence":{operators:["exists","forall"],baseline:"null",requires:[]},count:{operators:["equals","gte","lte"],baseline:"null",requires:[],operand_forms:["literal","derived"]},delta:{operators:["changed-by"],baseline:"required",requires:[]},"state-transition":{operators:["changed-by","equals"],baseline:"required",requires:[]},absolute:{operators:["equals","contains","gte","lte"],baseline:"null",requires:[]},bound:{operators:["gte","lte"],baseline:"null",requires:[]},propagation:{operators:["exists","equals"],baseline:"null",requires:[]},latency:{operators:["lte"],baseline:"null",requires:["within"]},graded:{operators:["gte"],baseline:"null",requires:["metric","threshold"]}},y=Object.freeze({SOURCE:"source",USECASE:"usecase",SCENARIO:"scenario",AC:"ac",TEST:"test",GAP:"gap",STYLENOTE:"stylenote"}),h=Object.freeze({DERIVES:"DERIVES",BELONGS_TO:"belongs_to",SCOPED_TO:"scoped_to",EXERCISES:"exercises",VERIFIES:"verifies",AUTOMATES:"automates",DEPENDS_ON:"depends_on",REUSES:"reuses",ANNOTATES:"annotates"});function c(n,s,i){let r=[],e=g[n];if(!e)return r.push({code:"BAD_CHECK",detail:`${i}.kind ${JSON.stringify(n)} not in ${E.join("|")}`}),r;let o=s.operator;o!==void 0&&!e.operators.includes(o)&&r.push({code:"BAD_CHECK",detail:`${i}: operator ${JSON.stringify(o)} illegal for kind "${String(n)}" (legal: ${e.operators.join("|")})`});for(let a of e.requires)(s[a]===void 0||s[a]===null||s[a]==="")&&r.push({code:"BAD_CHECK",detail:`${i}: kind "${String(n)}" requires "${a}"`});e.baseline==="null"&&s.baseline!==void 0&&s.baseline!==null&&r.push({code:"BAD_CHECK",detail:`${i}: kind "${String(n)}" must carry baseline null (only delta/state-transition have one)`});let t=s.operand;if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let a=Object.keys(t),d=t.derived;(!(e.operand_forms?.includes("derived")??!1)||a.length!==1||a[0]!=="derived"||typeof d!="string"||!d.trim())&&r.push({code:"BAD_CHECK",detail:`${i}: object operand is only the count derivation form {derived: "<how the runtime value is computed>"}`})}return r}function m(n,s){let i=u[n];if(!i)return[{code:"UNKNOWN_LABEL",detail:`unknown node label ${JSON.stringify(n)}`}];let r=[];for(let e of Object.keys(s))s[e]!==void 0&&!i.hashed.includes(e)&&!(i.unhashed??[]).includes(e)&&r.push({code:"UNKNOWN_FIELD",detail:`${n}.${e} is not in the ${l} schema`});for(let e of i.required)(s[e]===void 0||s[e]===null)&&r.push({code:"MISSING_FIELD",detail:`${n}.${e} is required`});for(let[e,o]of Object.entries(i.enums)){let t=s[e];t!==void 0&&!o.includes(t)&&r.push({code:"BAD_ENUM",detail:`${n}.${e} ${JSON.stringify(t)} not in ${o.join("|")}`})}if(n==="test"&&s.check&&typeof s.check=="object"){let e=s.check;r.push(...c(e.kind,e,"test.check"))}if(n==="ac"&&s.expected_answer&&typeof s.expected_answer=="object"){let e=s.expected_answer;r.push(...c(s.kind??e.kind,e,"ac.expected_answer"))}return r}function p(n){return f[n]}function S(n,s,i,r){let e=p(n);if(!e)return[{code:"UNKNOWN_EDGE_TYPE",detail:`unknown edge type ${JSON.stringify(n)}`}];let o=[];e.src.includes(s)||o.push({code:"ILLEGAL_EDGE",detail:`${n} src must be ${e.src.join("|")}, got ${s}`}),e.dst.includes(i)||o.push({code:"ILLEGAL_EDGE",detail:`${n} dst must be ${e.dst.join("|")}, got ${i}`}),n==="depends_on"&&s!==i&&o.push({code:"ILLEGAL_EDGE",detail:`depends_on links same-label nodes only, got ${s}\u2192${i}`});for(let t of e.salient)(r[t]===void 0||r[t]===null)&&o.push({code:"MISSING_SALIENT",detail:`${n}.props.${t} is salient (inside the ecid) and required`});for(let t of Object.keys(r))r[t]!==void 0&&(e.props.includes(t)||o.push({code:"UNKNOWN_EDGE_PROP",detail:`${n}.props.${t} is not in the ${l} schema`}));return o}function k(n,s){let i=u[n];if(!i)return s;let r={};for(let e of i.hashed)s[e]!==void 0&&(r[e]=s[e]);return r}function N(n,s){let i=p(n);if(!i)return s;let r={};for(let e of i.salient)s[e]!==void 0&&(r[e]=s[e]);for(let e of i.optionalSalient??[])s[e]!==void 0&&(r[e]=s[e]);return r}export{l as a,u as b,f as c,y as d,h as e,m as f,p as g,S as h,k as i,N as j};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  function l(r){let{isAgent:c,log:m}=r,a=r.stdout??process.stderr,s=r.stdin??process.stdin,p=t=>{c&&process.stdout.write(JSON.stringify(t)+`
3
- `)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-FMKZJ3A3.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-WGGFLUSF.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-BFZJW2KK.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-KKRANMR3.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};
3
+ `)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-O6JTHV5W.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-VDEAKXJY.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-JK64EKC2.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-TI26VFFH.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d,e as f}from"./chunk-WXHQYYD5.js";var G={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},_=.75;function a(e,n){return!e.superseded.has(n)&&e.trust.get(n)!=="archived"}function E(e,n){return e.edgesInto(n).some(t=>t.type===f.VERIFIES&&a(e,t.src))}function m(e,n="med"){let t=e.risk;return t==="high"||t==="med"||t==="low"?t:n}function u(e,n){return e.displayNameOf(n)??n}function y(e,n){return`kane-cli design tests --use-case ${u(e,n)}`}function b(e,n){let t=e.edgesFrom(n).find(i=>i.type===f.SCOPED_TO&&a(e,i.dst));if(!t)return null;let s=e.nodeLabel.get(t.dst);if(s===d.USECASE)return t.dst;if(s===d.SCENARIO){let i=e.edgesFrom(t.dst).find(r=>r.type===f.BELONGS_TO&&a(e,r.dst));return i?i.dst:null}return null}function v(e,n){let t=b(e,n);return t?y(e,t):w(e,n)}function w(e,n){return`kane-cli design explain ${u(e,n)}`}function h(e,n){let t=e.edgesFrom(n).find(i=>i.type===f.AUTOMATES&&a(e,i.dst));if(!t)return null;let s=e.edgesFrom(t.dst).find(i=>i.type===f.BELONGS_TO&&a(e,i.dst));return s?s.dst:null}function x(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.AC))a(e,t)&&(E(e,t)||n.push({ref:u(e,t),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:m(s),stage:"design",tag:"create",ready_command:v(e,t)}));return n}function S(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.USECASE)){if(!a(e,t))continue;let i=e.edgesInto(t).filter(o=>o.type===f.BELONGS_TO&&a(e,o.src));if(i.length===0){n.push({ref:u(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:m(s),stage:"design",tag:"create",ready_command:y(e,t)});continue}i.every(o=>e.getNode(o.src)?.content.case_type==="happy")&&n.push({ref:u(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:m(s),stage:"design",tag:"create",ready_command:y(e,t)})}return n}function L(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.GAP)){if(!a(e,t))continue;let i=s.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&a(e,r.tip)?r.tip:null,l=o?e.nodeLabel.get(o):null,p=s.kind==="reconcile_deferred"?"kane-cli maintain reconcile":l===d.USECASE?y(e,o):l===d.AC?v(e,o):w(e,t),c=s.question&&typeof s.question=="object"?s.question:void 0,g=typeof s.text=="string"&&s.text||(c&&typeof c.header=="string"?c.header:"")||"design gap";n.push({ref:u(e,t),kind:String(s.kind),why:g,risk:m(s),stage:"design",tag:"create",ready_command:p,...typeof s.risk_rationale=="string"?{risk_rationale:s.risk_rationale}:{},...c?{question:c}:{}})}return n}function C(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.AC)){if(!a(e,t))continue;let i=e.stale(t);i==="fresh"||i==="superseded"||n.push({ref:u(e,t),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${u(e,t)}`,risk:m(s),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:t,content:s}of e.byLabel(d.TEST)){if(!a(e,t))continue;let i=e.stale(t);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(t).filter(k=>k.type===f.VERIFIES&&a(e,k.dst)),o=r.map(k=>m(e.getNode(k.dst)?.content??{})),l=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",p=r[0]?.dst??null,c=p?null:h(e,t),g=p?v(e,p):c?y(e,c):w(e,t);n.push({ref:u(e,t),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:l,stage:"design",tag:"evolve",ready_command:g})}return n}async function O(e,n,t){for(let s of e)if(s.tag==="create"){if(!t){s.meta={embed_arm:"skipped"};continue}try{let i=n.resolve(s.ref),r=i?n.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||s.why,l=r?.label===d.USECASE?"scenario":"test",c=(await t.searchSimilar(o,{label:l,k:1}))[0];c&&c.score>=_?(s.tag="reuse-candidate",s.meta={embed_arm:"used",near_hit:{ref:u(n,c.cid),score:c.score}}):s.meta={embed_arm:"used",near_hit:null}}catch{s.meta={embed_arm:"skipped"}}}}function A(e,n){let t=G[n.risk]-G[e.risk];if(t!==0)return t;let s=R[e.tag]-R[n.tag];return s!==0?s:e.ref<n.ref?-1:e.ref>n.ref?1:0}function T(e,n){let t=[],s=r=>{let o=e.resolve(r);return o&&!o.superseded?m(e.getNode(o.tip)?.content??{}):"med"},i=r=>{let o=e.resolve(r),l=o&&!o.superseded?b(e,o.tip):null;return l?u(e,l):r};for(let r of n.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?t.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:s(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?t.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:s(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&t.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:s(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return t}async function N(e,n,t,s){if(n!=="design"&&!s)throw new Error(`gaps-engine: stage "${n}" requires a pack's usecases doc`);let i=[];return(n==="design"||n==="all")&&i.push(...x(e),...S(e),...L(e),...C(e)),(n==="cover"||n==="all")&&i.push(...T(e,s)),await O(i,e,t),i.sort(A),i}export{a,E as b,b as c,N as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as w,b as O}from"./chunk-R5T4RLF5.js";import{a as I}from"./chunk-KBM3XHAM.js";import{e as L}from"./chunk-IDX3TOPY.js";import{a as N,b as k}from"./chunk-BKM2LWU2.js";import{a as R,b as y,c as T,d as m,e as A,f as b,g as r}from"./chunk-QIGPXYMF.js";import{b as x}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,j as v}from"./chunk-ZUGCHQFC.js";import{platform as X,arch as Y}from"os";import P from"fs";import M from"fs";import D from"path";var V=1e3,d=0,j=new Set([130,3]),a=class t{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,n={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=n}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let i=m(this.ids,e,n);this.logger.log(R[e],e,e,C(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...C(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(V);(n==="failed"||n==="timeout")&&A(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);M.mkdirSync(D.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};M.appendFileSync(n,JSON.stringify(i)+`
3
+ `,{flag:"a",mode:384})}catch{}}};function C(t){let e={event:t.event,session_id:t.session_id,operation_id:t.operation_id,verb:t.verb,mode:t.mode,component:t.component,seq:t.seq,context_lineage_id:t.context_lineage_id,context_instance_id:t.context_instance_id};t.parent_operation_id&&(e.parent_operation_id=t.parent_operation_id),t.agent_session_id&&(e.agent_session_id=t.agent_session_id);for(let[n,i]of Object.entries(t.context))e[n]=i;return e}var u=process.env.KANE_TELEMETRY_URL||v;function B(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function _e(t){let e=process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1"),n=t.env??B(),i=null;if(t.resumeSid&&t.contextRoot)try{let o=L(t.contextRoot,t.resumeSid);o?.user_session_id&&(i=o.user_session_id)}catch{}if(!i&&t.applyPlanPath)try{let o=JSON.parse(P.readFileSync(t.applyPlanPath,"utf8"));o.telemetry?.user_session_id&&(i=o.telemetry.user_session_id)}catch{}let s=i!==null;i||(i=y());let l=null,c=null,f=!1;if(t.contextRoot&&P.existsSync(t.contextRoot))if(t.write&&e){let o=k(t.contextRoot);l=o.ids.context_lineage_id,c=o.ids.context_instance_id,f=o.cloned}else{let o=N(t.contextRoot);l=o?.context_lineage_id??null,c=o?.context_instance_id??null}let h={session_id:i,operation_id:T(),context_lineage_id:l,context_instance_id:c,verb:t.verb,mode:t.mode,component:"kane-cli"},_=null;if(e){let o=I(n),S={org_id:o.org_id??"",user_id:o.user_id??"",machine_id:o.machine_id,email:null,email_domain:"",user_type:o.user_type??"unknown",env:o.env,plan:o.plan??"unknown"},U=t.mode==="interactive"||t.mode==="cli"?"cli":"agent";_=new w({proxyUrl:u,sessionId:i,identity:S,device:{cli_version:g,platform:X(),arch:Y(),host_agent:O(),invocation_mode:U},getToken:async()=>null}),t.longSession&&_.start()}let p=new a({envelope:h,logger:_,longSession:!!t.longSession,proxyUrl:u,clientVersion:`kane-cli/${g}`,telemetryEnabled:e});return e&&(r(h),p.event("ASR_CMD_START",{resumed:s,applied_plan:!!t.applyPlanPath}),f&&p.event("ASR_CONTEXT_CLONED"),b(async o=>{try{return(await E(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).ok}catch{return!1}}).catch(()=>{})),p}export{B as a,_e as b};
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as k}from"./chunk-FPFOW6BS.js";import{p as a}from"./chunk-W6VD2XFO.js";import{a as m}from"./chunk-2WVKOZ6W.js";import{a as y}from"./chunk-JRMDGLLT.js";import{a as h}from"./chunk-F6ZOJXYU.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
2
+ import{a as k}from"./chunk-OR6MCL6Z.js";import{p as a}from"./chunk-QIGPXYMF.js";import{a as m}from"./chunk-2WVKOZ6W.js";import{a as y}from"./chunk-O75ZHGJG.js";import{a as h}from"./chunk-VT54ARGE.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
3
3
  `)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function b(t,e,r=n=>process.stdout.write(`${n}
4
- `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-NIDUOTRM.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
4
+ `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-3UYMCYG3.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
5
5
  `,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
6
6
  `,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
7
7
  `,exitCode:2}}}function O(t){return{id:t.project_id,name:t.name}}function M(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function _(t,e=r=>process.stdout.write(`${r}
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ function c(t,s){return`${t}:${s}`}function d(t){let s=t.use_cases.filter(e=>!e.matches_existing),r=t.use_cases.filter(e=>e.matches_existing!=null&&(e.changed===!0||e.updated!=null)),n=t.use_cases.filter(e=>e.matches_existing!=null&&!(e.changed===!0||e.updated!=null)),{archived:a,...i}=t;return{adds:s,updates:r,archives:t.archived??[],passthrough:{...i,use_cases:n}}}export{c as a,d as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-4OPQJ7PE.js";import{n as d,y as o}from"./chunk-C4G7RVJ6.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as u,b as c,i as A}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(d).map(i=>{let e=P(d,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(d,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(d,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
2
+ import{a as b}from"./chunk-VRLUNZAK.js";import{n as d,y as o}from"./chunk-ZUGCHQFC.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as u,b as c,i as A}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(d).map(i=>{let e=P(d,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(d,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(d,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as a}from"os";import{join as t}from"path";var m="0.7.1",d="kane-cli",e=t(a(),".testmuai","kaneai"),g=t(e,"profiles"),h=t(e,"tui-config.json"),_=t(e,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",b=`https://registry.npmjs.org/${n}`,r="kane-cli",x=[{dir:t(a(),".claude","skills",r),agent:"Claude Code"},{dir:t(a(),".agents","skills",r),agent:"Codex CLI"},{dir:t(a(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",U="https://kaneai-playground.lambdatest.io",R=9222,I=9230,E=t(e,"chrome-profiles"),o=t(e,"hints"),C=t(o,"state.json");function T(s){return t(o,`catalog-${s}.json`)}var c="127.0.0.1",S=18392,f=18400,i="/callback";function N(s){return`http://${c}:${s}${i}`}var P="KANE CLI",B="*",O={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com"}},k={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,e as c,h as d,_ as e,A as f,L as g,n as h,x as i,u as j,U as k,R as l,I as m,E as n,C as o,T as p,c as q,S as r,f as s,i as t,N as u,P as v,B as w,O as x,k as y};
2
+ import{homedir as a}from"os";import{join as t}from"path";var m="0.7.2",d="kane-cli",e=t(a(),".testmuai","kaneai"),g=t(e,"profiles"),h=t(e,"tui-config.json"),_=t(e,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",b=`https://registry.npmjs.org/${n}`,r="kane-cli",x=[{dir:t(a(),".claude","skills",r),agent:"Claude Code"},{dir:t(a(),".agents","skills",r),agent:"Codex CLI"},{dir:t(a(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",U="https://kaneai-playground.lambdatest.io",R=9222,I=9230,E=t(e,"chrome-profiles"),o=t(e,"hints"),C=t(o,"state.json");function T(s){return t(o,`catalog-${s}.json`)}var c="127.0.0.1",S=18392,f=18400,i="/callback";function N(s){return`http://${c}:${s}${i}`}var P="KANE CLI",B="*",O={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com"}},k={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,e as c,h as d,_ as e,A as f,L as g,n as h,x as i,u as j,U as k,R as l,I as m,E as n,C as o,T as p,c as q,S as r,f as s,i as t,N as u,P as v,B as w,O as x,k as y};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o,s as p,t as q,u as r}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import{h as a}from"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{b as SLUG_RE,c as checkAcyclic,d as checkCardinality,e as citesOf,q as commitDeferGap,o as commitNames,n as commitPairMerge,l as commitProposal,p as commitRetire,m as commitReviewFacts,f as criteriaShape,i as mintEventId,j as nextEventIds,a as recordsSince,r as resolveDeferGaps,k as resolveLivingTip,g as validateCriterionOps,h as validateProposal};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
2
+ import{a}from"./chunk-O75ZHGJG.js";import"./chunk-ZUGCHQFC.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O}from"./chunk-DYW5C6II.js";import{a as g,b as S,d as G}from"./chunk-QROUKGKU.js";import"./chunk-ZLCZDAEX.js";import{e as w,f as $}from"./chunk-CJJXT5DO.js";import{d as x}from"./chunk-QM4S2APK.js";import{e as k}from"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import{a as b}from"./chunk-L5LI2JF4.js";import{a as R}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-BL3TEAX5.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
2
+ import{b as O}from"./chunk-DYW5C6II.js";import{a as g,b as S,d as G}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import{e as w,f as $}from"./chunk-CJJXT5DO.js";import{d as x}from"./chunk-XWKUZJCP.js";import{e as k}from"./chunk-EHN5HTUD.js";import{a as b}from"./chunk-L5LI2JF4.js";import{A as R}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-66RG5NN5.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
3
3
  `));return n.event({type:"coverage",...y}),n.done(0,void 0,M(y.completeness??[]))}let s=S(o,e);if(!s)return 2;let a=t.from?await $(t.from,o):await P(o);if(!a)return g(e,t.from?`no evidence pack at '${t.from}'`:"no evidence pack in .testmuai/evidence \u2014 run a test first, or pass --from <pack>"),2;let l=await k(a,"coverage/usecases.yaml");if(l==null)return g(e,`${h(a)} carries no coverage/usecases.yaml \u2014 the pack predates coverage or its project had no .context at seal time`),2;let i=b(l);if(!i||!Array.isArray(i.usecases))return g(e,`${h(a)}: coverage/usecases.yaml is not a usecases document`),2;let u=R(s),d=D(i,u),m=await x(u,"design");if(t.json)return e.out(JSON.stringify({pack:a,depth:d,completeness:m},null,2)),0;e.out(`coverage \u2014 ${h(a)}`),e.out(""),e.out("depth (proven by the pack):");for(let r of d){let p=r.stale.length?` \xB7 ${r.stale.length} stale`:"";e.out(` ${N[r.status]} ${_(r.pct)} ${String(r.pct).padStart(3)}% ${r.id} \u2014 ${r.status} (${r.acs.passed}/${r.acs.total} ACs proven${r.acs.failed?`, ${r.acs.failed} failed`:""}${r.acs.blocked?`, ${r.acs.blocked} blocked`:""})${p}`)}e.out(""),e.out("completeness (live graph):"),m.length===0&&e.out(" no design gaps \u2014 every AC verified, every use-case scenarioed");for(let r of m)e.out(` [${r.risk}] ${r.tag} ${r.ref} \u2014 ${r.why}`),e.out(` \u2192 ${r.ready_command}`);return 0}function M(t){return t.filter(e=>e.ready_command.startsWith("kane-cli ")&&O(e.ready_command)).slice(0,4).map(e=>({cmd:e.ready_command,why:e.why}))}export{I as coverCommand,M as coverNext,D as depthRows};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-F6ZOJXYU.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
2
+ import{a}from"./chunk-VT54ARGE.js";import"./chunk-ZUGCHQFC.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-WXHQYYD5.js";import"./chunk-UR6MHSHU.js";export{a as topologyDescriptor};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-3Q6WAK6P.js";import"./chunk-AFPHLUQ5.js";import"./chunk-BB2W35TW.js";import"./chunk-DNNZ353O.js";import"./chunk-NVGBE2DR.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{a as captureForceScope,b as commitDesign,c as designPhaseLadder};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d}from"./chunk-VMM4LC4V.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-NVGBE2DR.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-ZUGCHQFC.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-QOFZSHSC.js";import"./chunk-BKHXPBWN.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-NVGBE2DR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{a as DOCX_CONVERTER_POLICY,b as DOCX_CONVERTER_VERSION,d as DOCX_IMAGE_CAP,c as DOCX_IMAGE_DIMENSION_FLOOR,f as DOCX_IMAGE_MAX_BYTES,g as DOCX_IMAGE_MAX_PIXELS,e as DOCX_VISION_BYTE_BUDGET,i as convertDocx,h as renderTokens};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u}from"./chunk-JEUA4UWK.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var q=i=>`cite ${i.source_id??"?"} ${i.anchor??""}${i.quote?` \u2014 "${i.quote}"`:""}`;function I(i,_){let l=i.resolve(_);if(!l)return null;let c=l.tip,y=i.nodeLabel.get(c);if(!y)return null;let h=i.getNode(c);if(!h)return null;let s=h.content,f=i.displayNameOf(c)??_,d=[],o=(e,t,n=!1)=>{d.push({text:`${e.padEnd(12)} ${t}`,dim:n})},L=i.trust.get(c)??"derived";o("status",`${L}${i.superseded.has(c)?" \xB7 superseded":""}`,!0);let k=typeof s.risk=="string"?s.risk:null;k&&o("risk",k);for(let[e,t]of[["title",null],["description","description"],["value","value"],["summary","summary"],["statement","statement"],["text","text"],["intent","intent"],["case_type","case type"],["technique_notes","technique"],["kind","kind"],["change_note","change"]]){if(!t)continue;let n=s[e];typeof n=="string"&&n&&o(t,n)}let p=[];{let e=l.cid,t=new Set;for(;!t.has(e);){t.add(e),p.push(e);let n=i.superseded.get(e);if(typeof n!="string")break;e=n}}let g=p.flatMap(e=>i.edgesInto(e)).filter(e=>e.type==="DERIVES"),x=e=>{if(!e.source_cid||!e.anchor)return;let t=/^L(\d+)-L(\d+)$/.exec(e.anchor);if(!t)return;let n=i.getNode(e.source_cid)?.content?.text_blob;if(typeof n!="string")return;let r=n.split(`
2
+ import{a as u}from"./chunk-CLGC7VEO.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";var q=i=>`cite ${i.source_id??"?"} ${i.anchor??""}${i.quote?` \u2014 "${i.quote}"`:""}`;function I(i,_){let l=i.resolve(_);if(!l)return null;let c=l.tip,y=i.nodeLabel.get(c);if(!y)return null;let h=i.getNode(c);if(!h)return null;let s=h.content,f=i.displayNameOf(c)??_,d=[],o=(e,t,n=!1)=>{d.push({text:`${e.padEnd(12)} ${t}`,dim:n})},L=i.trust.get(c)??"derived";o("status",`${L}${i.superseded.has(c)?" \xB7 superseded":""}`,!0);let k=typeof s.risk=="string"?s.risk:null;k&&o("risk",k);for(let[e,t]of[["title",null],["description","description"],["value","value"],["summary","summary"],["statement","statement"],["text","text"],["intent","intent"],["case_type","case type"],["technique_notes","technique"],["kind","kind"],["change_note","change"]]){if(!t)continue;let n=s[e];typeof n=="string"&&n&&o(t,n)}let p=[];{let e=l.cid,t=new Set;for(;!t.has(e);){t.add(e),p.push(e);let n=i.superseded.get(e);if(typeof n!="string")break;e=n}}let g=p.flatMap(e=>i.edgesInto(e)).filter(e=>e.type==="DERIVES"),x=e=>{if(!e.source_cid||!e.anchor)return;let t=/^L(\d+)-L(\d+)$/.exec(e.anchor);if(!t)return;let n=i.getNode(e.source_cid)?.content?.text_blob;if(typeof n!="string")return;let r=n.split(`
3
3
  `).slice(Number(t[1])-1,Number(t[2])).join(" ").trim();return r?r.length>120?`${r.slice(0,119)}\u2026`:r:void 0},m=new Map,b=new Set;for(let e of g){let t=e.props;if(!t.claim)continue;let n=`${t.claim}|${t.source_id??"?"}|${t.source_cid??"?"}|${t.anchor??"?"}`;if(b.has(n))continue;b.add(n);let r=m.get(t.claim)??[];r.push({source_id:t.source_id,anchor:t.anchor,quote:x(t)}),m.set(t.claim,r)}let D=Array.isArray(s.criteria)?s.criteria:[];for(let[e,t]of D.entries()){o(e===0?"criteria":"",`${e+1}. ${t}`);for(let n of m.get(t)??[])d.push({text:` ${q(n)}`,dim:!0})}let v=g.find(e=>!e.props.claim);if(v){let e=v.props;d.push({text:` ${q({...e,quote:x(e)})}`,dim:!0})}let a=s.check;a?.kind&&o("check",`${a.kind}${a.verified_against?` vs ${u(String(a.verified_against))}`:""}`);let $=s.expected_answer;$?.operator&&o("expects",`${$.operator} \xB7 ${String($.operand??"")}`);let S=new Set,w=!0;for(let e of g){let t=e.props,n=`${t.source_id??"?"}@${t.source_cid??e.src}`;S.has(n)||(S.add(n),o(w?"provenance":"",`${t.source_id??"?"} @ ${String(t.source_cid??e.src).slice(7,15)}`,!0),w=!1)}let N=p.flatMap(e=>i.edgesFrom(e)).filter(e=>e.type==="depends_on");for(let[e,t]of N.entries()){let n=String(i.getNode(i.tipOf(t.dst))?.content?.title??""),r=i.displayNameOf(t.dst);o(e===0?"depends on":"",`${r?u(r):t.dst.slice(0,12)}${n?` ${n}`:""}`)}return{id:u(f),rawId:f,title:String(s.title??s.text??s.statement??f),label:y,lines:d}}export{I as buildDossier};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-DQ54MH7F.js";import"./chunk-FCMLIK7P.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,i as buildEnvironment,j as buildEvidenceRunConfig,g as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,h as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,d as shortHash,c as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,f as testIdForInline,e as testIdForTestmd,k as validatePack,a as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,b as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
2
+ import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-2WRBTLFN.js";import"./chunk-5DBK6QNS.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-O75ZHGJG.js";import"./chunk-ZUGCHQFC.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,i as buildEnvironment,j as buildEvidenceRunConfig,g as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,h as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,d as shortHash,c as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,f as testIdForInline,e as testIdForTestmd,k as validatePack,a as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,b as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g}from"./chunk-AFBKGZFG.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import"./chunk-JFAFKHDX.js";import"./chunk-JZ26R6UL.js";import"./chunk-5DT7PIGB.js";import"./chunk-DNNZ353O.js";import"./chunk-NVGBE2DR.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n}from"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-UR6MHSHU.js";export{n as _reset,i as cleanup,h as deregister,e as getRemoteLogger,b as getSupportContext,m as installHandlers,f as isShuttingDown,d as logOrBufferRemote,g as register,k as setInkExit,c as setRemoteLogger,a as setSupportContext,l as setTerminalRestore,j as shutdown};
2
+ import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n}from"./chunk-QIGPXYMF.js";import"./chunk-5EOX4MEY.js";import"./chunk-UR6MHSHU.js";export{n as _reset,i as cleanup,h as deregister,e as getRemoteLogger,b as getSupportContext,m as installHandlers,f as isShuttingDown,d as logOrBufferRemote,g as register,k as setInkExit,c as setRemoteLogger,a as setSupportContext,l as setTerminalRestore,j as shutdown};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-7KORP5FF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{a as explain};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a}from"./chunk-QROUKGKU.js";import{a as i}from"./chunk-PMHJRT3A.js";import"./chunk-ZLCZDAEX.js";import"./chunk-CH273NAE.js";import{a as n}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=a(process.cwd(),{out:r=>process.stdout.write(r+`
2
+ import{b as a}from"./chunk-OS4VSIHT.js";import{a as i}from"./chunk-7KORP5FF.js";import"./chunk-5DT7PIGB.js";import{A as n}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=a(process.cwd(),{out:r=>process.stdout.write(r+`
3
3
  `),err:r=>process.stderr.write(r+`
4
4
  `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY});if(!o)return 2;let c=n(o),t=i(o,c,s);if(p.json)return process.stdout.write(JSON.stringify(t)+`
5
5
  `),t.target?0:1;if(!t.target)return process.stdout.write(`error: ${s} names nothing in the graph
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as E}from"./chunk-KHU7C6EE.js";import{a as x}from"./chunk-PMHJRT3A.js";import{a as k}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import{a as h}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import{d,e as g}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";async function _(f,$={}){let m=$.contextDir??k(process.cwd()),e=$.out??(c=>process.stdout.write(c+`
2
+ import{a as x}from"./chunk-7KORP5FF.js";import{b as E}from"./chunk-KHU7C6EE.js";import"./chunk-L5LI2JF4.js";import{A as h}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import{d,e as g}from"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as k}from"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";async function _(f,$={}){let m=$.contextDir??k(process.cwd()),e=$.out??(c=>process.stdout.write(c+`
3
3
  `)),o=h(m),u=o.resolve(f);if(!u){let c=[...o.names.keys()].filter(n=>/^(t|sc|ac|gap)-/.test(n)).sort();return e(`no design rationale recorded for ${f} (exists: ${c.slice(0,12).join(", ")||"(no designed items)"})`),1}let a=u.tip,s=o.nodeLabel.get(a),r=o.getNode(a),l=o.nameOf.get(a)??a.slice(0,19);if(s===d.TEST){let c=String(r?.content.definitionId??""),n=c?E(m,c):null;if(!n){let i=null;for(let S of o.edgesFrom(a))if(S.type===g.VERIFIES){for(let p of o.edgesFrom(S.dst))if(p.type===g.SCOPED_TO){i=o.nameOf.get(p.dst)??p.dst.slice(0,19);break}if(i)break}return e(`no design rationale recorded for ${f} (exists: test ${l}, but its sidecar is missing \u2014 re-run: kane-cli design tests${i?` --use-case ${i}`:""} --force)`),1}e(`${l} \u2014 ${String(r?.content.title??"")}`),e(`technique: ${n.technique}`),e(`profile family: ${n.profile_family}`),e(`anchored to: ${n.anchor}`),e(`expected how: ${n.expected_how}`),e(`combinatorial: strength ${n.combinatorial.strength} \u2014 ${n.combinatorial.reason}`),e(`surface: ${n.surface_state} \xB7 deferred bindings: ${n.deferred_bindings}`);let t=r?.content.check;t&&e(`check: ${String(t.kind)} ${String(t.operator)} ${String(t.operand??t.within??"")} \u2014 verified against ${String(t.verified_against)}`);for(let i of o.edgesFrom(a))i.type===g.AUTOMATES&&e(`automates: ${o.nameOf.get(i.dst)??i.dst.slice(0,19)}`),i.type===g.VERIFIES&&e(`verifies: ${o.nameOf.get(i.dst)??i.dst.slice(0,19)}`),i.type===g.REUSES&&e(`imports: ${o.nameOf.get(i.dst)??i.dst.slice(0,19)}`);return 0}if(s===d.SCENARIO||s===d.AC||s===d.GAP){let n=x(m,o,f).entries.filter(t=>t.kind==="judgement"||t.kind==="review");if(e(`${l} \u2014 ${String(r?.content.title??r?.content.text??"")}`),s===d.SCENARIO&&(e(`case type: ${String(r?.content.case_type??"")} \xB7 intent: ${String(r?.content.intent??"")}`),e(`technique: ${String(r?.content.technique_notes??"")}`)),s===d.AC){let t=r?.content.expected_answer;e(`kind: ${String(r?.content.kind??"")}${t?` \xB7 oracle: ${String(t.operator)} ${String(t.operand??"")}`:""}`)}n.length===0&&e("(no recorded judgements yet \u2014 approvals and design-time judgements land here)");for(let t of n)e(t.kind==="judgement"?`judgement: ${t.rationale??t.detail}`:`review: ${t.detail}`);return 0}return e(`no design rationale recorded for ${f} (exists: ${s??"nothing"} ${l} \u2014 design explains tests, scenarios, ACs, and gaps)`),1}export{_ as designExplainCommand};
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{f as Y,g as F}from"./chunk-53IBTIL3.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-AJ56AMT6.js";import"./chunk-DZPGG4S6.js";import"./chunk-F7ISS545.js";import"./chunk-7OYZR6JA.js";import"./chunk-JFAFKHDX.js";import"./chunk-BB2W35TW.js";import{c as Q}from"./chunk-YKTYVJBN.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import{a as P}from"./chunk-VLWMMOMF.js";import{a as q}from"./chunk-JZ26R6UL.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-6KPPGMO2.js";import{c as U}from"./chunk-5DT7PIGB.js";import"./chunk-R7QAS6LZ.js";import"./chunk-QOFZSHSC.js";import"./chunk-BKHXPBWN.js";import{d as $}from"./chunk-DBKNJRJG.js";import"./chunk-5FJJJNJK.js";import"./chunk-VMM4LC4V.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-GFKCTYCA.js";import"./chunk-NVGBE2DR.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as C}from"./chunk-CH273NAE.js";import{a as M,b as N}from"./chunk-YTHQNN2L.js";import"./chunk-R5T4RLF5.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-QIGPXYMF.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-ZUGCHQFC.js";import"./chunk-UR6MHSHU.js";async function X(r){let[{render:n},s,{QuestionBatchPrompt:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),m=s.default??s;return new Promise(w=>{let y=n(m.createElement(p,{questions:r,onSubmit:t=>{y.unmount(),w(t)}}))})}async function Z(r,n){let[{render:s},p,{ReviewChecklist:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),w=p.default??p;return new Promise(y=>{let t=s(w.createElement(m,{items:r.map(x=>{let g=n.get(x.temp_ref);return{uc:x,dedupWith:g&&!g.archived?g.cid:void 0,archivedMatch:g?.archived?{cid:g.cid,reason:g.reason}:void 0}}),onSubmit:x=>{t.unmount(),y(x)}}))})}async function ee(r){let{createInterface:n}=await import("readline/promises"),s=n({input:process.stdin,output:process.stdout});try{let p=await s.question(`${r} [y/N] `);return/^y(es)?$/i.test(p.trim())}finally{s.close()}}async function de(r){let n=C(process.cwd()),s=N({verb:"extract",mode:r.plan?"cli":"interactive",contextRoot:n,env:M(),resumeSid:r.resume,write:!0,longSession:!0}),m={...await $(),...s.spawnEnv()},w=await Q(m);if(!w.ok)return process.stderr.write((w.message??"error: turn-endpoint preflight failed")+`
3
+ `),process.stderr.write(s.supportFooter()+`
4
+ `),s.error("preflight_auth"),await s.end({exit_code:2}),2;let y=async()=>w;if(r.plan){let i=await F(r,{contextDir:n,agent:P,preflightTurn:y,ask:X,review:Z,confirmStale:ee,out:u=>process.stdout.write(u+`
5
+ `),progress:u=>process.stderr.write(u+`
6
+ `),isTTY:U(),auth:m,telemetry:s});return i===1&&process.stderr.write(s.supportFooter()+`
7
+ `),await s.end({exit_code:i}),i}let[{render:t},x,{ScrollbackProvider:g},{ChatSurface:c},{ScrollbackTap:E},{makeChatController:V},{setInkExit:T},G]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-E7QKI4LA.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-T2FAI55V.js"),import("./exit-manager-XZL4KIJU.js"),Promise.all([import("./chat-committer-UUC6JTRJ.js"),import("./descriptor-OEUZZCOK.js"),import("./explain-UAAQWHYR.js"),import("./readmodel-XOYGGQ3S.js")])]),[{commitChatTurn:S},{topologyDescriptor:e},{explain:a},{openGraph:v}]=G,_=x.default??x,d=V({commitChatTurn:S,descriptor:e(),contextDir:n,refreshGraph:()=>v(n),graph:v(n),explain:a,by:{kind:"human",id:"owner"},dedupFlags:i=>Y(i,v(n))}),j={current:null},H=0,I=null,D=!1,z=()=>{if(H+=1,H>=2){try{A.unmount()}catch{}process.exit(130)}d.requestPause(),I=setTimeout(()=>{D||(D=!0,(async()=>{d.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await j.current?.flush();try{A.unmount()}catch{}process.exit(130)})())},5e3)},O=await import("./dossier-KTLTGT2X.js"),B=i=>{try{return O.buildDossier(v(n),i)}catch{return null}},L={listUcs:()=>{let i=v(n),u=new Set(d.state.turns.flatMap(o=>(o.items??[]).map(l=>l.title.toLowerCase()))),f={high:0,med:1,low:2};return i.byLabel("usecase").filter(o=>!i.superseded.has(o.cid)).map((o,l)=>{let h=o.content,b=String(h.title??o.cid.slice(0,12)),k=q(i,o.cid),R=k?k.designed_at_cid===o.cid?"current":"stale":void 0;return{key:o.cid,title:b,badge:R==="current"?"designed":R==="stale"?"designed \xB7 stale":u.has(b.toLowerCase())?"drafted this session":"existing",designed:R,risk:h.risk,i:l}}).sort((o,l)=>(f[o.risk??"zz"]??3)-(f[l.risk??"zz"]??3)||o.i-l.i).map(({key:o,title:l,badge:h,designed:b})=>({key:o,title:l,badge:h,designed:b}))},runDesignChild:async(i,u=!1)=>{try{let{designEntryCheck:h,confirmUnreviewedViaAsk:b}=await import("./trust-gate-EX7R2P4Y.js"),k=h(v(n),i);if(!k.ok&&(k.code==="UC_UNREVIEWED"||k.code==="UC_ARCHIVED")&&!await b(K=>d.ask(K),k))return d.note(`design child refused \u2014 approve it first: ${k.reviewCmd}`),2}catch{}let[{runDesign:f}]=await Promise.all([import("./run-GMZCDRDD.js")]),o="",l=await f({useCase:i,force:u,mode:"interactive"},{contextDir:n,agent:P,preflightTurn:y,ask:h=>d.ask(h),chat:d,nested:!0,out:h=>{o=h},progress:()=>{},isTTY:!0,auth:m});return l!==0&&o&&d.note(o),l}},{makeReconcileDeps:W}=await import("./reconcile-deps-HTT6IPHT.js"),J=W({contextDir:n,...r.changeContext?{changeContext:r.changeContext}:{},note:i=>d.note(i)}),A=t(_.createElement(g,null,_.createElement(E,{into:j}),_.createElement(c,{controller:d,verb:"extract",onCtrlC:z,chain:L,inspect:B,reconcile:J})),{exitOnCtrlC:!1});T(()=>A.unmount()),d.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let i=F(r,{contextDir:n,agent:P,preflightTurn:y,ask:f=>d.ask(f),review:async f=>new Map(f.map(o=>[o.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:f=>d.note(f),progress:()=>{},isTTY:U(),auth:m,chat:d,telemetry:s});i.finally(()=>{D=!0});let u=await i;return u===1&&process.stderr.write(s.supportFooter()+`
8
+ `),await s.end({exit_code:u}),u}finally{D=!0,I&&clearTimeout(I),await j.current?.flush();try{A.unmount()}catch{}}}async function ue(r){let n=N({verb:"extract",mode:r.mode,contextRoot:C(process.cwd()),env:M(),resumeSid:r.resume,write:!0,longSession:!0}),{makeHeadlessIO:s,resolveEncoding:p,guardedChannels:m}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:w,prepareStructuredResume:y}=await import("./structured-answers-A43Q25CZ.js"),t=w(s(p(r.mode),"extract")),{runWithChannel:x}=await import("./run-channel-RGH4WIQX.js"),g=p(r.mode)==="ndjson"?e=>x({event:a=>t.event(a)},e):e=>e();for(let e of r.landed??[]){let a=e;t.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...a.warnings?.length?{warnings:a.warnings}:{},...a.media?{media:a.media}:{},...a.duplicate_of?{duplicate_of:a.duplicate_of}:{},...a.lineage_candidate?{lineage_candidate:a.lineage_candidate}:{}})}let c;try{c=y({opts:r,contextDir:C(process.cwd()),verb:"extract"})}catch(e){let a=e instanceof Error?e.message:String(e);return t.out(`error: ${a}`),r.mode==="agent"&&t.event({type:"error",message:a}),await n.end({exit_code:1}),r.mode==="agent"?t.done(1,"error"):1}if(c.kind==="refuse")return t.out(c.error),r.mode==="agent"&&t.event({type:"error",message:c.error,code:c.code}),await n.end({exit_code:2}),r.mode==="agent"?t.done(2,"refused"):2;let E=r;if(c.kind==="apply"){for(let e of c.notes)t.out(e);if(c.matchedQids.length>0){t.out(`applying ${c.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of c.matchedQids)t.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}c.statement&&(E={...r,message:[r.message,c.statement].filter(Boolean).join(`
9
+
10
+ `)})}let{makeInterruptGuard:V}=await import("./interrupt-guard-UREUWNRL.js"),T=V(P,e=>t.out(e)),S=m(t,()=>T.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let e=await g(async()=>{let a={...await $(),...n.spawnEnv()};return F(E,{contextDir:C(process.cwd()),agent:T.agent,preflightTurn:()=>Q(a),ask:async()=>[],review:async v=>new Map(v.map(_=>[_.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:S.out,emit:S.emit,progress:t.progress,isTTY:!1,auth:a,telemetry:n})});return T.interrupted()&&e!==3?(t.out("interrupted \u2014 no session saved"),await n.end({exit_code:130}),t.done(130)):(e===1&&t.out(n.supportFooter()),await n.end({exit_code:e}),t.done(e))}catch(e){return t.event({type:"error",message:`error: extract failed: ${e instanceof Error?e.message:String(e)}`}),t.out(`error: extract failed: ${e instanceof Error?e.message:String(e)}`),t.out('hint: the full trace is in the file named on the "trace:" line at the start of this run'),t.done(1)}finally{T.dispose()}}export{ue as bindExtractHeadless,de as bindExtractInteractive};