@testmuai/kane-cli 0.8.23 → 0.10.0-rc.1

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 (645) hide show
  1. package/dist/ChatSurface-VPD5G67Q.js +2 -0
  2. package/dist/ChromeProfilePicker-CRKQEFYD.js +2 -0
  3. package/dist/CliFeedbackPrompt-M7BMWLKK.js +2 -0
  4. package/dist/CliUploadProgress-OP7DXMC2.js +2 -0
  5. package/dist/ConfigView-XI74BCCH.js +2 -0
  6. package/dist/EvidenceViewOffer-HAAK6DS5.js +2 -0
  7. package/dist/FolderPicker-W5S6RFCP.js +2 -0
  8. package/dist/InfoBox-OWUEHV2D.js +2 -0
  9. package/dist/LinksBox-PNSESNCU.js +2 -0
  10. package/dist/ProfilesView-PYDZZHKO.js +2 -0
  11. package/dist/ProjectPicker-BGFCUGT5.js +2 -0
  12. package/dist/SaveSessionPrompt-SUJE54GS.js +2 -0
  13. package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
  14. package/dist/SingleShotApp-4TDXZEUA.js +2 -0
  15. package/dist/SummaryBox-FALOODAQ.js +2 -0
  16. package/dist/TestMdRunView-4GPRWHEU.js +2 -0
  17. package/dist/TestrunEvidenceTable-OBVQJ6IO.js +2 -0
  18. package/dist/WhoamiView-6WXGRANY.js +2 -0
  19. package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
  20. package/dist/app-client-U2YYF65L.js +2 -0
  21. package/dist/app-download-RXVZB6MM.js +2 -0
  22. package/dist/assurance-job-C3TXZGLL.js +7 -0
  23. package/dist/auth-7Z54TMQQ.js +2 -0
  24. package/dist/{binary-MOJTQGUV.js → binary-DJCDMGPX.js} +1 -1
  25. package/dist/bind-XVO4CQYV.js +2 -0
  26. package/dist/bootstrap-TY5RANJ7.js +2 -0
  27. package/dist/bridge-T6QMYKED.js +2 -0
  28. package/dist/build-5ZN47FAT.js +2 -0
  29. package/dist/catalog-RRQF4TCA.js +2 -0
  30. package/dist/{changelog-2N6HKKKQ.js → changelog-GBEVIUFJ.js} +1 -1
  31. package/dist/chat-committer-ZCSRJEUB.js +2 -0
  32. package/dist/chat-controller-XINCDH6Z.js +2 -0
  33. package/dist/child-G2GCW73X.js +2 -0
  34. package/dist/chunk-22PIMG52.js +2 -0
  35. package/dist/chunk-252FWF2G.js +19 -0
  36. package/dist/{chunk-AT3RME5W.js → chunk-2IZRPMZN.js} +1 -1
  37. package/dist/chunk-2NFS4KE4.js +2 -0
  38. package/dist/{chunk-LHUW5QDT.js → chunk-2OOFURWD.js} +1 -1
  39. package/dist/chunk-2OSFI33O.js +97 -0
  40. package/dist/chunk-2S3W2JT3.js +5 -0
  41. package/dist/chunk-2SWSVJUP.js +12 -0
  42. package/dist/chunk-2TVPA3LL.js +2 -0
  43. package/dist/chunk-2XW33VOK.js +2 -0
  44. package/dist/chunk-33DWJV67.js +235 -0
  45. package/dist/chunk-34R7BNZ2.js +2 -0
  46. package/dist/chunk-35ECWCCK.js +2 -0
  47. package/dist/chunk-3BSYOCSW.js +3 -0
  48. package/dist/chunk-3G2LSTK5.js +2 -0
  49. package/dist/chunk-3GXN6VF6.js +2 -0
  50. package/dist/chunk-3JLEDSG5.js +4 -0
  51. package/dist/chunk-3QICDXY5.js +5 -0
  52. package/dist/chunk-3UVSAAES.js +10 -0
  53. package/dist/chunk-42PALMW2.js +4 -0
  54. package/dist/chunk-432ZOE42.js +21 -0
  55. package/dist/chunk-44B6THYK.js +2 -0
  56. package/dist/chunk-47WQBG5I.js +6 -0
  57. package/dist/{chunk-J2FJ62K4.js → chunk-4D5PC6QE.js} +1 -1
  58. package/dist/chunk-4I7YN6YY.js +3 -0
  59. package/dist/chunk-4IEQNX7F.js +2 -0
  60. package/dist/{chunk-SYJXTB4J.js → chunk-4LPX2OLV.js} +1 -1
  61. package/dist/chunk-4LTHDJ3D.js +2 -0
  62. package/dist/chunk-4QTH7VYE.js +2 -0
  63. package/dist/chunk-54XA5MZH.js +2 -0
  64. package/dist/chunk-57MDWTON.js +2 -0
  65. package/dist/{chunk-3C32LVLX.js → chunk-5BUIIFLC.js} +1 -1
  66. package/dist/chunk-5D7ENQTQ.js +2 -0
  67. package/dist/chunk-63EKRZKI.js +2 -0
  68. package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
  69. package/dist/chunk-672CQECV.js +47 -0
  70. package/dist/chunk-6LIC2R22.js +3 -0
  71. package/dist/chunk-6NFOH4AC.js +4 -0
  72. package/dist/chunk-6NWT2TEJ.js +2 -0
  73. package/dist/chunk-6PIIUAZF.js +3 -0
  74. package/dist/{chunk-MBJHS653.js → chunk-6U7ID777.js} +1 -1
  75. package/dist/chunk-6UVIY56J.js +2 -0
  76. package/dist/chunk-72KYMWQ5.js +2 -0
  77. package/dist/chunk-72RC7JSA.js +21 -0
  78. package/dist/chunk-74W4AOT2.js +2 -0
  79. package/dist/chunk-77ZZQJLX.js +2 -0
  80. package/dist/chunk-7DFBOVUB.js +2 -0
  81. package/dist/chunk-7EXDYXXD.js +2 -0
  82. package/dist/chunk-7HO4NX5W.js +1 -0
  83. package/dist/chunk-7KX2BHKG.js +2 -0
  84. package/dist/chunk-7LKCWO2R.js +11 -0
  85. package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
  86. package/dist/chunk-7RPKHKA3.js +2 -0
  87. package/dist/chunk-7RWP4Y3H.js +2 -0
  88. package/dist/chunk-7V4BQSSV.js +2 -0
  89. package/dist/chunk-7XBNMOH4.js +6 -0
  90. package/dist/chunk-A6TJOZ24.js +2 -0
  91. package/dist/chunk-A7RJQJNT.js +2 -0
  92. package/dist/chunk-AA674WLL.js +2 -0
  93. package/dist/chunk-AIXJYMSP.js +9 -0
  94. package/dist/chunk-AJQZ3ST5.js +8 -0
  95. package/dist/chunk-AQ2OG2EF.js +2 -0
  96. package/dist/chunk-AUJSC7PU.js +4 -0
  97. package/dist/chunk-AVI5H4UM.js +13 -0
  98. package/dist/chunk-AZLNLHUA.js +4 -0
  99. package/dist/chunk-B2HXPGIZ.js +26 -0
  100. package/dist/chunk-B7ZX5HEN.js +8 -0
  101. package/dist/{chunk-XQQHSC7G.js → chunk-BJJUKB5K.js} +1 -1
  102. package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
  103. package/dist/{chunk-TONFENRW.js → chunk-BVO4C5F2.js} +1 -1
  104. package/dist/chunk-BWXLZS5O.js +2 -0
  105. package/dist/chunk-BY65QAAN.js +4 -0
  106. package/dist/chunk-BZVNI44O.js +6 -0
  107. package/dist/chunk-C5Z7MQE6.js +2 -0
  108. package/dist/chunk-C6HI6Y3S.js +2 -0
  109. package/dist/chunk-CB4ARIHR.js +2 -0
  110. package/dist/chunk-CPBBYNL7.js +4 -0
  111. package/dist/{chunk-GFNCGN5V.js → chunk-D4FFXCX6.js} +2 -2
  112. package/dist/chunk-D756UWY2.js +6 -0
  113. package/dist/chunk-DBMW3VUN.js +4 -0
  114. package/dist/chunk-DD5TULWQ.js +34 -0
  115. package/dist/{chunk-SY4T44VC.js → chunk-DDJNYQBH.js} +1 -1
  116. package/dist/{chunk-KJIDMW6N.js → chunk-DHQ4SQWA.js} +1 -1
  117. package/dist/chunk-DNGOT65K.js +3 -0
  118. package/dist/chunk-DPGOAFKF.js +2 -0
  119. package/dist/chunk-DREQ3RAA.js +2 -0
  120. package/dist/chunk-DTUPEKEO.js +2 -0
  121. package/dist/chunk-E6KSRQXL.js +8 -0
  122. package/dist/chunk-EF47KRUK.js +2 -0
  123. package/dist/chunk-ENL4XTQ2.js +2 -0
  124. package/dist/chunk-EXFDIVNI.js +9 -0
  125. package/dist/chunk-EZN7CF45.js +4 -0
  126. package/dist/chunk-F3U6T4YD.js +22 -0
  127. package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
  128. package/dist/chunk-FFL55I2M.js +2 -0
  129. package/dist/chunk-FIP5L6LV.js +9 -0
  130. package/dist/chunk-FOJHSG5M.js +6 -0
  131. package/dist/chunk-FSYOTRMC.js +2 -0
  132. package/dist/chunk-GFLB2SHW.js +2 -0
  133. package/dist/chunk-GMTHZUZ3.js +2 -0
  134. package/dist/chunk-GRURFGBP.js +2 -0
  135. package/dist/chunk-GZFLJORM.js +2 -0
  136. package/dist/{chunk-PXHN7SFG.js → chunk-H3HHSTEK.js} +4 -4
  137. package/dist/chunk-HAW5WEKT.js +13 -0
  138. package/dist/chunk-HFJSP4KD.js +2 -0
  139. package/dist/chunk-HHW6MRU3.js +6 -0
  140. package/dist/chunk-HIUAUZNL.js +2 -0
  141. package/dist/chunk-HJLMH7ZM.js +2 -0
  142. package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
  143. package/dist/chunk-I2KOGINW.js +7 -0
  144. package/dist/chunk-I2MC6VVX.js +2 -0
  145. package/dist/chunk-I5NSJBOZ.js +2 -0
  146. package/dist/chunk-I6OQISK4.js +2 -0
  147. package/dist/chunk-IBBD36FQ.js +2 -0
  148. package/dist/chunk-IINZZ4BZ.js +2 -0
  149. package/dist/{chunk-UYI4WPNQ.js → chunk-IMDMRJQ6.js} +2 -2
  150. package/dist/chunk-IXW7FOGX.js +2 -0
  151. package/dist/chunk-IZ65ZPWY.js +3 -0
  152. package/dist/chunk-JD52IXON.js +9 -0
  153. package/dist/chunk-JGRXMTME.js +15 -0
  154. package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
  155. package/dist/chunk-JNSWKGTB.js +2 -0
  156. package/dist/chunk-JPYW6U4D.js +2 -0
  157. package/dist/chunk-JQSLUGD4.js +3 -0
  158. package/dist/chunk-K45BKGB5.js +8 -0
  159. package/dist/chunk-KF4DKXSS.js +2 -0
  160. package/dist/chunk-KGNE5CIM.js +2 -0
  161. package/dist/chunk-KM3YCIDV.js +3 -0
  162. package/dist/chunk-KU3YHPWZ.js +2 -0
  163. package/dist/chunk-L4UVUFL6.js +3 -0
  164. package/dist/chunk-LCSJ7GOG.js +2 -0
  165. package/dist/chunk-LKQFG4RW.js +5 -0
  166. package/dist/chunk-LNNWCBPQ.js +2 -0
  167. package/dist/chunk-LRS5MGBY.js +3 -0
  168. package/dist/chunk-LRXBJTD4.js +4 -0
  169. package/dist/chunk-LSDJOVWW.js +6 -0
  170. package/dist/chunk-LWJRSUE2.js +2 -0
  171. package/dist/chunk-LX2I4JEH.js +2 -0
  172. package/dist/{chunk-K6VDRR3H.js → chunk-M6MBMRFR.js} +1 -1
  173. package/dist/chunk-MGNRNLBE.js +2 -0
  174. package/dist/chunk-MII3JOO3.js +4 -0
  175. package/dist/chunk-MNBGG4H3.js +16 -0
  176. package/dist/chunk-MYVKUJGS.js +2 -0
  177. package/dist/chunk-MYZHOBS4.js +2 -0
  178. package/dist/chunk-MZOIHUVX.js +27 -0
  179. package/dist/{chunk-OFRYEWZE.js → chunk-N3TCNZSX.js} +1 -1
  180. package/dist/chunk-NC7D7GOM.js +21 -0
  181. package/dist/{chunk-CLQP3DHT.js → chunk-NDEI7R4K.js} +1 -1
  182. package/dist/chunk-NFRA64NU.js +10 -0
  183. package/dist/chunk-NLZZLANH.js +4 -0
  184. package/dist/{chunk-5HOHXV2K.js → chunk-NQTYWHPB.js} +1 -1
  185. package/dist/chunk-NWBLYMH7.js +3 -0
  186. package/dist/chunk-NWD54VV5.js +2 -0
  187. package/dist/chunk-NXRF7FFS.js +2 -0
  188. package/dist/chunk-O3HHTKZ5.js +6 -0
  189. package/dist/{chunk-FPFS6OSR.js → chunk-OAKYUBD3.js} +1 -1
  190. package/dist/chunk-OEWYXCTA.js +7 -0
  191. package/dist/{chunk-BASTDR3M.js → chunk-OF7WPCTQ.js} +1 -1
  192. package/dist/chunk-OFSDB7B4.js +3 -0
  193. package/dist/chunk-OJ33Q6DU.js +2 -0
  194. package/dist/chunk-OQ5G773E.js +2 -0
  195. package/dist/chunk-OVNRRI4E.js +2 -0
  196. package/dist/{chunk-RAARDC2O.js → chunk-OZNBTSW5.js} +1 -1
  197. package/dist/chunk-P2ZQDQDB.js +2 -0
  198. package/dist/chunk-P7MSVLAH.js +6 -0
  199. package/dist/chunk-PUVMC4PX.js +26 -0
  200. package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
  201. package/dist/chunk-Q3C6NDGI.js +2 -0
  202. package/dist/chunk-QCKA665H.js +2 -0
  203. package/dist/chunk-QDFY5GGO.js +5 -0
  204. package/dist/chunk-QHRUBG7J.js +2 -0
  205. package/dist/chunk-QI5RZ7LL.js +2 -0
  206. package/dist/chunk-QNLVC5ZB.js +2 -0
  207. package/dist/{chunk-DSKJ6J7Y.js → chunk-QQ4TKLWP.js} +1 -1
  208. package/dist/chunk-QS5ZJFGF.js +4 -0
  209. package/dist/chunk-QTZBVDPR.js +12 -0
  210. package/dist/chunk-QXQ7KVEN.js +2 -0
  211. package/dist/chunk-R4JUKTDO.js +2 -0
  212. package/dist/chunk-R7KXAISS.js +12 -0
  213. package/dist/chunk-RDP7GWSY.js +2 -0
  214. package/dist/chunk-REKHAN53.js +5 -0
  215. package/dist/{chunk-5RHR4DMF.js → chunk-RFEON5GN.js} +1 -1
  216. package/dist/chunk-RFIIM33J.js +2 -0
  217. package/dist/chunk-RG372DON.js +6 -0
  218. package/dist/chunk-RPRXRKKR.js +2 -0
  219. package/dist/chunk-RTVWQK7I.js +2 -0
  220. package/dist/chunk-RW3Z2HMB.js +7 -0
  221. package/dist/chunk-RX47NRSM.js +2 -0
  222. package/dist/chunk-RX6776AI.js +5 -0
  223. package/dist/chunk-S53AQU7R.js +6 -0
  224. package/dist/{chunk-HJX5PQRD.js → chunk-SA6IKFFD.js} +1 -1
  225. package/dist/{chunk-2MEQTHNI.js → chunk-SLKYD44Y.js} +1 -1
  226. package/dist/chunk-SMTBOSEJ.js +2 -0
  227. package/dist/chunk-SMXABALN.js +2 -0
  228. package/dist/chunk-SONMD3W5.js +5 -0
  229. package/dist/chunk-SWMTXMKB.js +2 -0
  230. package/dist/chunk-SXRHKXSE.js +2 -0
  231. package/dist/chunk-T3HEJASG.js +5 -0
  232. package/dist/chunk-T4AVLJCW.js +6 -0
  233. package/dist/{chunk-J6TBTWW7.js → chunk-T6K2MEWP.js} +1 -1
  234. package/dist/{chunk-D6BULK7E.js → chunk-T7H4LBFK.js} +1 -1
  235. package/dist/chunk-TNORODUF.js +2 -0
  236. package/dist/chunk-TW63WWEN.js +2 -0
  237. package/dist/chunk-UALJTPSA.js +18 -0
  238. package/dist/chunk-UAWWLLTI.js +2 -0
  239. package/dist/chunk-UEE3RZN4.js +14 -0
  240. package/dist/chunk-UTM7D4PI.js +2 -0
  241. package/dist/chunk-UUJIGOEO.js +2 -0
  242. package/dist/chunk-UYDHOHSZ.js +2 -0
  243. package/dist/chunk-V5JGXOV7.js +2 -0
  244. package/dist/chunk-V7S6S5W3.js +2 -0
  245. package/dist/{chunk-HBSYBL6J.js → chunk-VG44B5JD.js} +1 -1
  246. package/dist/chunk-VJGWVBZR.js +1 -0
  247. package/dist/chunk-VLDCHFXF.js +2 -0
  248. package/dist/chunk-VO66KP2W.js +2 -0
  249. package/dist/{chunk-D4XR7EEQ.js → chunk-VQLH63X7.js} +14 -12
  250. package/dist/chunk-VRIZDOO5.js +2 -0
  251. package/dist/chunk-VYHT2IET.js +1397 -0
  252. package/dist/chunk-VZJ6LUXX.js +2 -0
  253. package/dist/chunk-W3OVSDBN.js +29 -0
  254. package/dist/chunk-W7FLXW6Q.js +5 -0
  255. package/dist/{chunk-IEW7AW64.js → chunk-WEM3MOAL.js} +1 -1
  256. package/dist/chunk-WI7K6VKQ.js +2 -0
  257. package/dist/chunk-WMGKUERB.js +6 -0
  258. package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
  259. package/dist/chunk-WOSANGV6.js +5 -0
  260. package/dist/chunk-WYSZ6TPW.js +15 -0
  261. package/dist/chunk-XB6BJPDL.js +2 -0
  262. package/dist/{chunk-5ESGUPSR.js → chunk-XBEYWXPV.js} +1 -1
  263. package/dist/chunk-XIPKSXRQ.js +16 -0
  264. package/dist/chunk-XJ7HCXKW.js +2 -0
  265. package/dist/chunk-XMPTFXPW.js +5 -0
  266. package/dist/chunk-XZYA7DNH.js +2 -0
  267. package/dist/chunk-Y4T4SLDO.js +2 -0
  268. package/dist/chunk-Y6Y6RAY4.js +2 -0
  269. package/dist/chunk-YDPTSDIJ.js +2 -0
  270. package/dist/chunk-YDSGXB25.js +2 -0
  271. package/dist/chunk-YIKF4ERQ.js +375 -0
  272. package/dist/chunk-Z55KBMYV.js +2 -0
  273. package/dist/chunk-ZCRZFAOT.js +2 -0
  274. package/dist/chunk-ZFM77AQU.js +2 -0
  275. package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
  276. package/dist/chunk-ZHWU6L2G.js +5 -0
  277. package/dist/chunk-ZTHYAHDN.js +17 -0
  278. package/dist/chunk-ZZP5SHUV.js +3 -0
  279. package/dist/committer-JGY66PFM.js +2 -0
  280. package/dist/config-5ZOALGKE.js +2 -0
  281. package/dist/controller-client-PB3AZAGG.js +2 -0
  282. package/dist/cover-cmd-UA2SVIZZ.js +2 -0
  283. package/dist/{credentials-PSQWWFGD.js → credentials-MRG452Y6.js} +1 -1
  284. package/dist/{deps-bundle-PPOQHJTB.js → deps-bundle-FWINW4XM.js} +1 -1
  285. package/dist/{deps-resolve-AX6ZAKLH.js → deps-resolve-IET4KIBO.js} +1 -1
  286. package/dist/descriptor-7T32VRMB.js +2 -0
  287. package/dist/design-chat-MM5PJD2N.js +2 -0
  288. package/dist/design-committer-TRYP3LOZ.js +2 -0
  289. package/dist/design-headless-FZONCKHW.js +2 -0
  290. package/dist/design-remote-SPVRIY2H.js +3 -0
  291. package/dist/device-env-LXJ65AVF.js +2 -0
  292. package/dist/dispatch-DVQ3H7EJ.js +2 -0
  293. package/dist/doctor-VAX2BWQF.js +2 -0
  294. package/dist/docx-convert-6IZO5P5K.js +2 -0
  295. package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
  296. package/dist/evidence-LVVK7ROT.js +2 -0
  297. package/dist/evidence-presentation-YYTIDCBS.js +2 -0
  298. package/dist/evolve-cmd-AGRKG7T3.js +2 -0
  299. package/dist/evolve-remote-BGHULJTL.js +2 -0
  300. package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
  301. package/dist/explain-DGJ5T6V5.js +2 -0
  302. package/dist/explain-cmd-VYAANFFZ.js +4 -0
  303. package/dist/explain-cmd-WOBGS6KX.js +12 -0
  304. package/dist/explore-LOKNOVNP.js +2 -0
  305. package/dist/explore-context-tty-JTZVZFOE.js +2 -0
  306. package/dist/explore-entry-5OGNLFAU.js +6 -0
  307. package/dist/explore-live-2XZHUYFS.js +5 -0
  308. package/dist/explore-run-tty-LGTIK2NA.js +5 -0
  309. package/dist/extract-bind-NM2BBK4I.js +14 -0
  310. package/dist/extract-chat-HLQMJJIC.js +2 -0
  311. package/dist/extract-cmd-T2TSAC3N.js +6 -0
  312. package/dist/extract-headless-OQTQ3FJK.js +2 -0
  313. package/dist/feeder-NY45UFJK.js +2 -0
  314. package/dist/folder-flags-WXUR6OPJ.js +2 -0
  315. package/dist/gaps-cmd-PTSKPTF7.js +3 -0
  316. package/dist/gate-P57VP4E5.js +2 -0
  317. package/dist/gate-WISOUTHQ.js +2 -0
  318. package/dist/{generate-headless-TEDHS3F2.js → generate-headless-JYZP6VXZ.js} +3 -3
  319. package/dist/headless-io-FFM5T6KL.js +2 -0
  320. package/dist/hold-passthrough-IOWPVB4W.js +2 -0
  321. package/dist/identity-HL5CJJXR.js +2 -0
  322. package/dist/index.js +194 -175
  323. package/dist/ingest-PDGS5ZTL.js +2 -0
  324. package/dist/ingest-cmd-LHCBMO4Z.js +8 -0
  325. package/dist/ingest-remote-D5TO5JQP.js +2 -0
  326. package/dist/ink-screen-RZ7QDIUI.js +2 -0
  327. package/dist/install-Z6K2D2VY.js +2 -0
  328. package/dist/interactive-bind-5EJQUGKI.js +26 -0
  329. package/dist/interactive-remote-D77ULJGL.js +65 -0
  330. package/dist/interrupt-guard-QETBPINI.js +2 -0
  331. package/dist/lane-AQYRIW24.js +2 -0
  332. package/dist/lattice-auth-74XGF77Y.js +2 -0
  333. package/dist/lifecycle-cmd-7SM6UCMH.js +2 -0
  334. package/dist/list-cmd-Z6FZXMFU.js +3 -0
  335. package/dist/list-commands-CZYZ7GIG.js +2 -0
  336. package/dist/list-remote-WOPOC6KK.js +15 -0
  337. package/dist/locks-cmd-JJ2QNTNY.js +2 -0
  338. package/dist/logical-ids-RXAQJZ3T.js +2 -0
  339. package/dist/login-flow-2FZEOVHM.js +2 -0
  340. package/dist/maintenance-cmd-VRTGZVRE.js +2 -0
  341. package/dist/mobile-prompts-KNAHU64X.js +2 -0
  342. package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
  343. package/dist/{objective-variable-gate-JALOH6SL.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
  344. package/dist/onboarding-LGT6PMDZ.js +5 -0
  345. package/dist/open-provider-OZAG6WZS.js +2 -0
  346. package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
  347. package/dist/pdf-convert-447ACUB3.js +2 -0
  348. package/dist/persist-recorded-session-BX7II5P7.js +3 -0
  349. package/dist/phase-seed-LCJ4WSYV.js +2 -0
  350. package/dist/pipeline-IXVTVRS5.js +2 -0
  351. package/dist/prepare-target-ULMKVKMC.js +2 -0
  352. package/dist/pull-cmd-6AL2WYHB.js +2 -0
  353. package/dist/pull-route-TTVARJMV.js +2 -0
  354. package/dist/readmodel-INMP6MNW.js +2 -0
  355. package/dist/real-device-run-2LFS5WE2.js +2 -0
  356. package/dist/reconcile-cmd-R6H37SQR.js +5 -0
  357. package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
  358. package/dist/reconcile-remote-GWDV5CUT.js +13 -0
  359. package/dist/recording-banner-ACC67Q2U.js +2 -0
  360. package/dist/registry-6IJYQXQC.js +2 -0
  361. package/dist/remote-entry-YL7O2NJQ.js +2 -0
  362. package/dist/remote-mode-7G6PLJCW.js +4 -0
  363. package/dist/remote-words-45USLRVN.js +2 -0
  364. package/dist/require-project-folder-A3UDRELU.js +2 -0
  365. package/dist/resolve-run-intent-ZGPSUBXV.js +2 -0
  366. package/dist/resolver-IPM6R7U4.js +2 -0
  367. package/dist/revert-FHOBLZWF.js +2 -0
  368. package/dist/review-cmd-NNT5C5RZ.js +5 -0
  369. package/dist/run-5RQUCNYP.js +2 -0
  370. package/dist/run-PC5YO4AS.js +2 -0
  371. package/dist/run-channel-63SVP5OI.js +2 -0
  372. package/dist/run-remote-3AYYVPKX.js +2 -0
  373. package/dist/run-startup-gate-NKRMKYBB.js +2 -0
  374. package/dist/run-test-md-HE6DUWQR.js +17 -0
  375. package/dist/scrollback-GGNBDFQV.js +2 -0
  376. package/dist/session-target-DD53UXO7.js +2 -0
  377. package/dist/session-worker.js +12 -0
  378. package/dist/sessions-CFV7FOIT.js +2 -0
  379. package/dist/sessions-cmd-GYMETJHG.js +26 -0
  380. package/dist/sessions-remote-GI7GOBMH.js +3 -0
  381. package/dist/shell-arg-FN3MT5U7.js +2 -0
  382. package/dist/{skill-installer-T2IOCPET.js → skill-installer-3QAVQGDH.js} +1 -1
  383. package/dist/spawner-C7NLLM4F.js +2 -0
  384. package/dist/store-X6XPFSKF.js +2 -0
  385. package/dist/store-choice-RT73HAI7.js +2 -0
  386. package/dist/store-guard-SNWKLHQV.js +2 -0
  387. package/dist/store-id-YZ5WKJ25.js +2 -0
  388. package/dist/store-site-KA2DNBGY.js +2 -0
  389. package/dist/stream-warnings-GEQKKJU7.js +2 -0
  390. package/dist/structured-answers-EQ2AP3F7.js +2 -0
  391. package/dist/sync-cmd-NBPPDG3B.js +2 -0
  392. package/dist/sync-setup-5NUCH6N3.js +2 -0
  393. package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
  394. package/dist/tcg-generate-Z23CUISY.js +2 -0
  395. package/dist/test-definition-VRI4YIYL.js +2 -0
  396. package/dist/testmd-actions-GH5BW5V5.js +2 -0
  397. package/dist/testmd-sync-ACKCIOL3.js +2 -0
  398. package/dist/tms-client-NXAB6VJD.js +2 -0
  399. package/dist/token-refresh-4UCYAG6A.js +2 -0
  400. package/dist/trust-gate-AT2XBWN4.js +2 -0
  401. package/dist/turn-preflight-LHYLRL7G.js +2 -0
  402. package/dist/ui-SNV3FD2G.js +4 -0
  403. package/dist/use-case-ref-NE4X4MZN.js +2 -0
  404. package/dist/validate-basic-RE2WLIGQ.js +2 -0
  405. package/dist/{variable-receipt-F55CSW5Z.js → variable-receipt-BXSZO36E.js} +1 -1
  406. package/dist/verdicts-XK3GAUX3.js +2 -0
  407. package/dist/version-check-4FJVZP3K.js +2 -0
  408. package/dist/{view-cmd-ELDKYRMZ.js → view-cmd-N47BQZPD.js} +4 -3
  409. package/dist/walk-session-DA7QWXSW.js +2 -0
  410. package/dist/with-telemetry-7V4LY2BG.js +2 -0
  411. package/package.json +11 -11
  412. package/dist/ChatSurface-GBZX4LWL.js +0 -8
  413. package/dist/ChromeProfilePicker-UONX2UVC.js +0 -2
  414. package/dist/CliFeedbackPrompt-6BJCNRNG.js +0 -2
  415. package/dist/CliUploadProgress-K4Z22DSY.js +0 -2
  416. package/dist/ConfigView-BB22G7JO.js +0 -2
  417. package/dist/EvidenceViewOffer-25IQF3TX.js +0 -2
  418. package/dist/FolderPicker-65JFR2NW.js +0 -2
  419. package/dist/InfoBox-OU5PLRIL.js +0 -2
  420. package/dist/LinksBox-DH7TSUXW.js +0 -2
  421. package/dist/ProfilesView-MGJKBOF5.js +0 -2
  422. package/dist/ProjectPicker-YFV6K77F.js +0 -2
  423. package/dist/SaveSessionPrompt-64QKQB6B.js +0 -2
  424. package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
  425. package/dist/SingleShotApp-VYKUCRVW.js +0 -2
  426. package/dist/SummaryBox-DGS3LVRF.js +0 -2
  427. package/dist/TestMdRunView-LKAITAA4.js +0 -2
  428. package/dist/TestrunEvidenceTable-PHBAB4XQ.js +0 -2
  429. package/dist/WhoamiView-6HWPYN6Y.js +0 -2
  430. package/dist/app-client-ZCCNE3RV.js +0 -2
  431. package/dist/app-download-SQ2LYYL7.js +0 -2
  432. package/dist/auth-NWBIFCB7.js +0 -2
  433. package/dist/bind-S3IQTPNN.js +0 -15
  434. package/dist/bootstrap-RCV7PNMQ.js +0 -2
  435. package/dist/bridge-O7ENTV4K.js +0 -2
  436. package/dist/build-JIKYOZUH.js +0 -2
  437. package/dist/chat-committer-6D7AQI6Z.js +0 -2
  438. package/dist/chat-controller-UJQ6Z4RE.js +0 -2
  439. package/dist/chunk-2A7OQRAD.js +0 -17
  440. package/dist/chunk-2FH4HJYB.js +0 -5
  441. package/dist/chunk-2KVECC36.js +0 -2
  442. package/dist/chunk-2YEHV2CX.js +0 -2
  443. package/dist/chunk-3OKX64UR.js +0 -2
  444. package/dist/chunk-3UI5VTQS.js +0 -4
  445. package/dist/chunk-3UMVRJX3.js +0 -6
  446. package/dist/chunk-3VAU3PNU.js +0 -2
  447. package/dist/chunk-5EOX4MEY.js +0 -2
  448. package/dist/chunk-5LJRZI7S.js +0 -6
  449. package/dist/chunk-5UHY3PTQ.js +0 -3
  450. package/dist/chunk-5ZFOKYFB.js +0 -5
  451. package/dist/chunk-63DYVWNX.js +0 -2
  452. package/dist/chunk-6YZ3VP3E.js +0 -2
  453. package/dist/chunk-7KRY26OF.js +0 -4
  454. package/dist/chunk-7N6OCHPC.js +0 -7
  455. package/dist/chunk-A2SQD2AY.js +0 -4
  456. package/dist/chunk-AACQE24F.js +0 -2
  457. package/dist/chunk-AGDPEZXT.js +0 -4
  458. package/dist/chunk-AIK7BAME.js +0 -8
  459. package/dist/chunk-ATYXPCM6.js +0 -6
  460. package/dist/chunk-AXTPNZPX.js +0 -2
  461. package/dist/chunk-BB2W35TW.js +0 -2
  462. package/dist/chunk-BKM2LWU2.js +0 -3
  463. package/dist/chunk-BL5QHONU.js +0 -2
  464. package/dist/chunk-C44QQJR4.js +0 -239
  465. package/dist/chunk-C7NWWGLT.js +0 -6
  466. package/dist/chunk-CAJZQQ3G.js +0 -3
  467. package/dist/chunk-CSVPZ33X.js +0 -2
  468. package/dist/chunk-CXF6AZWY.js +0 -2
  469. package/dist/chunk-D6E6KRVX.js +0 -2
  470. package/dist/chunk-D7WG7SRA.js +0 -2
  471. package/dist/chunk-DDHGEJJP.js +0 -2
  472. package/dist/chunk-DUYRCVI5.js +0 -2
  473. package/dist/chunk-DWHF5HUD.js +0 -2
  474. package/dist/chunk-EM3PU2YW.js +0 -2
  475. package/dist/chunk-EVFFDODK.js +0 -5
  476. package/dist/chunk-EYOCNMUM.js +0 -2
  477. package/dist/chunk-F2OBORCG.js +0 -2
  478. package/dist/chunk-FMBPUXWL.js +0 -8
  479. package/dist/chunk-FORNRNHU.js +0 -2
  480. package/dist/chunk-FQJOWUEN.js +0 -2
  481. package/dist/chunk-FQNQVC5O.js +0 -5
  482. package/dist/chunk-FY7TCYPK.js +0 -6
  483. package/dist/chunk-HJGVM6TS.js +0 -370
  484. package/dist/chunk-HPHETGRE.js +0 -2
  485. package/dist/chunk-I7TIGB7K.js +0 -2
  486. package/dist/chunk-IGHK2ENL.js +0 -2
  487. package/dist/chunk-IICT4VOU.js +0 -2
  488. package/dist/chunk-IIDBLJ5A.js +0 -18
  489. package/dist/chunk-JFZA4UON.js +0 -9
  490. package/dist/chunk-K2UJYY2U.js +0 -2
  491. package/dist/chunk-KBM3XHAM.js +0 -2
  492. package/dist/chunk-KDNNMU7Q.js +0 -4
  493. package/dist/chunk-KJQNAOOE.js +0 -6
  494. package/dist/chunk-LF42V6P6.js +0 -7
  495. package/dist/chunk-LNFU4JZ7.js +0 -2
  496. package/dist/chunk-LNSBC32V.js +0 -2
  497. package/dist/chunk-LSDWPG6C.js +0 -2
  498. package/dist/chunk-MKMJOMLX.js +0 -8
  499. package/dist/chunk-MKQ7ZRDW.js +0 -2
  500. package/dist/chunk-MSGW4JDG.js +0 -2
  501. package/dist/chunk-MV3Q335C.js +0 -7
  502. package/dist/chunk-MWIE6LOZ.js +0 -4
  503. package/dist/chunk-MZ7W4WLF.js +0 -4
  504. package/dist/chunk-NIFJJX6N.js +0 -12
  505. package/dist/chunk-NJ4BXZBX.js +0 -2
  506. package/dist/chunk-NLCCBXXV.js +0 -2
  507. package/dist/chunk-ODU2JSMA.js +0 -8
  508. package/dist/chunk-OYKRCDT4.js +0 -15
  509. package/dist/chunk-Q2F5QB2W.js +0 -2
  510. package/dist/chunk-Q4YYAN6E.js +0 -2
  511. package/dist/chunk-Q6AHSGOE.js +0 -5
  512. package/dist/chunk-QAG67DUT.js +0 -2
  513. package/dist/chunk-QGXVQIN5.js +0 -27
  514. package/dist/chunk-QQCEP3QP.js +0 -2
  515. package/dist/chunk-QU7P7B3W.js +0 -4
  516. package/dist/chunk-RAPV3BTA.js +0 -98
  517. package/dist/chunk-RD72POF2.js +0 -2
  518. package/dist/chunk-RDHWNSDP.js +0 -7
  519. package/dist/chunk-RGRFL7XG.js +0 -29
  520. package/dist/chunk-RKXHVP2Z.js +0 -2
  521. package/dist/chunk-RMVASIVL.js +0 -35
  522. package/dist/chunk-RRY5IXOB.js +0 -2
  523. package/dist/chunk-RSSOJ3L2.js +0 -21
  524. package/dist/chunk-SB2SKN34.js +0 -2
  525. package/dist/chunk-SFFDVF3J.js +0 -9
  526. package/dist/chunk-T2ONUKTL.js +0 -5
  527. package/dist/chunk-TAOHYWEO.js +0 -2
  528. package/dist/chunk-U6OTFMIT.js +0 -4
  529. package/dist/chunk-UD7KKHPW.js +0 -5
  530. package/dist/chunk-UF4MU2AZ.js +0 -22
  531. package/dist/chunk-UQSVO7TY.js +0 -9
  532. package/dist/chunk-URWWROLS.js +0 -9
  533. package/dist/chunk-V4B5QA3U.js +0 -4
  534. package/dist/chunk-VACHFCNC.js +0 -21
  535. package/dist/chunk-VAN7ECN6.js +0 -2
  536. package/dist/chunk-VIO7CCFW.js +0 -5
  537. package/dist/chunk-VOYMN2WQ.js +0 -5
  538. package/dist/chunk-VVOKM2VO.js +0 -2
  539. package/dist/chunk-W5TTF7GB.js +0 -6
  540. package/dist/chunk-WESMQEPO.js +0 -2
  541. package/dist/chunk-WICJY6KL.js +0 -6
  542. package/dist/chunk-WJR2FU7S.js +0 -16
  543. package/dist/chunk-WVHMPIDQ.js +0 -2
  544. package/dist/chunk-X4NUVVCJ.js +0 -26
  545. package/dist/chunk-XLSOQLVT.js +0 -2
  546. package/dist/chunk-YCCUBQY4.js +0 -2
  547. package/dist/chunk-YFQGOOF7.js +0 -2
  548. package/dist/chunk-YI3H2UIB.js +0 -2
  549. package/dist/chunk-YKTYVJBN.js +0 -3
  550. package/dist/chunk-YLQHY4A7.js +0 -2
  551. package/dist/chunk-ZIHG6EKH.js +0 -2
  552. package/dist/chunk-ZKSN2SJ7.js +0 -2
  553. package/dist/chunk-ZLWURCJ7.js +0 -2
  554. package/dist/committer-2QPBANRD.js +0 -2
  555. package/dist/config-7E4NS553.js +0 -2
  556. package/dist/controller-client-ZF5IXRUV.js +0 -2
  557. package/dist/cover-cmd-6KZX46S2.js +0 -3
  558. package/dist/descriptor-3JJUOHBM.js +0 -2
  559. package/dist/design-committer-D44GSUXY.js +0 -2
  560. package/dist/device-env-TZQDB5T3.js +0 -2
  561. package/dist/dispatch-KMWEDMKE.js +0 -2
  562. package/dist/doctor-XDF3MA4W.js +0 -2
  563. package/dist/docx-convert-SQRTF7XS.js +0 -2
  564. package/dist/evidence-EUIDOVOR.js +0 -2
  565. package/dist/evidence-presentation-XF23B7F2.js +0 -2
  566. package/dist/evolve-cmd-QVTGTCJ5.js +0 -2
  567. package/dist/explain-NEFBUX5G.js +0 -2
  568. package/dist/explain-cmd-36SVSHU7.js +0 -9
  569. package/dist/explain-cmd-JAOHSI4F.js +0 -3
  570. package/dist/extract-bind-PLMSZKLZ.js +0 -14
  571. package/dist/extract-cmd-RJBHPPF3.js +0 -5
  572. package/dist/feeder-66TUPB2R.js +0 -2
  573. package/dist/gaps-cmd-3WZPDDYS.js +0 -3
  574. package/dist/gate-OYRDJMF6.js +0 -2
  575. package/dist/headless-io-75HUMWZB.js +0 -2
  576. package/dist/identity-ADZ4PAJF.js +0 -2
  577. package/dist/ingest-OSNNM3DH.js +0 -2
  578. package/dist/ingest-cmd-JDIOPJBN.js +0 -2
  579. package/dist/install-Y3VKFBK3.js +0 -2
  580. package/dist/interactive-bind-XUMKEGAN.js +0 -26
  581. package/dist/interrupt-guard-UREUWNRL.js +0 -2
  582. package/dist/lifecycle-cmd-FBDRFIOE.js +0 -2
  583. package/dist/list-cmd-TFUACRAM.js +0 -3
  584. package/dist/list-commands-OHIQFJGQ.js +0 -2
  585. package/dist/locks-cmd-67OHQZNV.js +0 -2
  586. package/dist/logical-ids-GLVM2SVR.js +0 -2
  587. package/dist/login-flow-OHNKSVYZ.js +0 -2
  588. package/dist/maintenance-cmd-7OSUIDL4.js +0 -2
  589. package/dist/mobile-prompts-DEVUZRG3.js +0 -2
  590. package/dist/open-provider-746LLSEO.js +0 -2
  591. package/dist/pdf-convert-RLXSXFWN.js +0 -2
  592. package/dist/persist-recorded-session-GPP6UKN6.js +0 -3
  593. package/dist/phase-seed-MKHEWUN6.js +0 -2
  594. package/dist/pipeline-QPTPZVUJ.js +0 -2
  595. package/dist/prepare-target-N7QRNYOS.js +0 -2
  596. package/dist/readmodel-FVLRQWZ7.js +0 -2
  597. package/dist/reconcile-cmd-SMGLHMLF.js +0 -2
  598. package/dist/reconcile-deps-DVIJK5UZ.js +0 -4
  599. package/dist/reconcile-engine-KL2J5SNQ.js +0 -2
  600. package/dist/recording-banner-TCFFB6KE.js +0 -2
  601. package/dist/records-LMCVKPE5.js +0 -2
  602. package/dist/registry-BFFA4YJK.js +0 -2
  603. package/dist/require-project-folder-2224ZMJ5.js +0 -2
  604. package/dist/resolve-run-intent-HFXGEOYK.js +0 -2
  605. package/dist/resolver-GJR2Z7JY.js +0 -2
  606. package/dist/revert-NOUECRW4.js +0 -2
  607. package/dist/review-cmd-CQE6SBZA.js +0 -5
  608. package/dist/run-BXKWDJFJ.js +0 -2
  609. package/dist/run-HSP2MZPU.js +0 -2
  610. package/dist/run-channel-RGH4WIQX.js +0 -2
  611. package/dist/run-test-md-2ELPAASM.js +0 -17
  612. package/dist/scrollback-JLPJR25X.js +0 -2
  613. package/dist/session-items-2ATN7VXG.js +0 -2
  614. package/dist/session-target-UWROGOCY.js +0 -2
  615. package/dist/sessions-NH7WQWMX.js +0 -2
  616. package/dist/sessions-cmd-IV25N2L7.js +0 -25
  617. package/dist/spawner-HQM2757J.js +0 -2
  618. package/dist/store-guard-NAW26EEQ.js +0 -2
  619. package/dist/store-id-EOSGEKVK.js +0 -2
  620. package/dist/structured-answers-ZI2B6JJE.js +0 -2
  621. package/dist/sync-cmd-Q6ZYEVWI.js +0 -2
  622. package/dist/sync-setup-CA362C5S.js +0 -2
  623. package/dist/tcg-generate-CDB2N5LD.js +0 -2
  624. package/dist/testmd-actions-BDWDE2TG.js +0 -2
  625. package/dist/testmd-sync-EPTUVJYJ.js +0 -2
  626. package/dist/tms-client-KU6HCA23.js +0 -2
  627. package/dist/token-refresh-TKBOHXSD.js +0 -2
  628. package/dist/trust-gate-EX7R2P4Y.js +0 -2
  629. package/dist/turn-preflight-JGYT7LXP.js +0 -2
  630. package/dist/ui-JEJGTURD.js +0 -4
  631. package/dist/validate-basic-V7R4RH5M.js +0 -2
  632. package/dist/verdicts-7IUZFXB4.js +0 -2
  633. package/dist/version-check-PUUSB7AY.js +0 -2
  634. package/dist/walk-session-EGIMA4VG.js +0 -2
  635. package/dist/with-telemetry-LRWWBISP.js +0 -2
  636. /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
  637. /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
  638. /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
  639. /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
  640. /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
  641. /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
  642. /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
  643. /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
  644. /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
  645. /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
@@ -0,0 +1,47 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{c as Ut}from"./chunk-74W4AOT2.js";import{a as lt,b as ut}from"./chunk-S53AQU7R.js";import{b as xt,c as bt,d as yt,e as vt,f as _t}from"./chunk-WYSZ6TPW.js";import{a as wt,b as kt,c as Rt,d as Et,e as St}from"./chunk-VYHT2IET.js";import{c as q,d as Ie,f as It,g as Lt,k as At,l as ce,m as pe,q as J,v as Ot}from"./chunk-2SWSVJUP.js";import{b as Ee,d as se}from"./chunk-ZUZ6QJRA.js";import{b as Se,c as ct,d as pt,e as dt,f as ie,g as ae,h as mt,i as ft,j as gt,k as ht,m as h,n as X,o as $t,p as je,q as Te,r as Ce,s as Pe}from"./chunk-JD52IXON.js";import{a as le,b as S}from"./chunk-KGNE5CIM.js";import{e as W,l as ue,n as Le,q as jt,r as Tt,s as Ct,t as Pt}from"./chunk-ZZP5SHUV.js";import{a as st,b as it}from"./chunk-DNGOT65K.js";import{d as Re,f as H}from"./chunk-P7MSVLAH.js";import{a as nt}from"./chunk-AA674WLL.js";import{l as at}from"./chunk-QTZBVDPR.js";import{a as ot}from"./chunk-UTM7D4PI.js";import{a as Ze,b as ke,d as et}from"./chunk-I2KOGINW.js";import{a as tt}from"./chunk-DREQ3RAA.js";import{b as Ye}from"./chunk-LRXBJTD4.js";import{e as ze}from"./chunk-T4AVLJCW.js";import{d as Qe}from"./chunk-C6HI6Y3S.js";import{a as qe}from"./chunk-FCD3NYOM.js";import{a as rt}from"./chunk-XZYA7DNH.js";import{n as Xe,o as Je}from"./chunk-NC7D7GOM.js";import{a as oe}from"./chunk-MGNRNLBE.js";import{a as K}from"./chunk-4QTH7VYE.js";import{a as F}from"./chunk-RZ4F3BHX.js";import{a as ne}from"./chunk-XBEYWXPV.js";import{a as We}from"./chunk-FOJHSG5M.js";import{a as M,b as re,y as Ke}from"./chunk-I6OQISK4.js";import{join as Ne}from"path";import{appendFileSync as or,mkdirSync as sr}from"fs";import{dirname as ir}from"path";function Nt(e,t,n){if(t)try{sr(ir(t),{recursive:!0})}catch{}let r="",o=c=>{if(!(!t||!c))try{or(t,n(c))}catch{}};e.child.stderr?.on("data",c=>{r+=c.toString();let g=r.lastIndexOf(`
3
+ `);g<0||(o(r.slice(0,g+1)),r=r.slice(g+1))}),e.child.stderr?.on("end",()=>{o(r),r=""});let i=e.getStderr.bind(e);return Object.assign(e,{getStderr:()=>n(i())})}var ar={seeding:"seeding",replay:"replaying",walking:"walking",settling:"settling",verifying:"verifying"},lr=8,ur=6,k=e=>typeof e=="string"&&e?e:null,V=e=>typeof e=="number"&&Number.isFinite(e)?e:null,de=class{s={run_id:null,exploration_id:null,status:"running",stop_reason:null,progress:null,browsers:[],version:0,updated_at:0};subs=new Set;now;constructor(t={}){this.now=t.now??Date.now}snapshot(){return structuredClone(this.s)}subscribe(t){return this.subs.add(t),()=>{this.subs.delete(t)}}end(t){this.s.status!=="ended"&&(this.s.status="ended",this.s.stop_reason=t,this.s.browsers=[],this.changed())}apply(t){this.reduce(t)&&this.changed()}changed(){if(this.s.version+=1,this.s.updated_at=this.now(),!this.subs.size)return;let t=this.snapshot();for(let n of this.subs)try{n(t)}catch{}}browser(t,n){let r=this.s.browsers.find(o=>o.worker===t)??null;return!r&&n&&(r={worker:t,state:"opening",since:this.now(),lease:null,step:null,steps:[],trail:[],held:null},this.s.browsers.push(r),this.s.browsers.sort((o,i)=>o.worker-i.worker)),r}setState(t,n){t.state!==n&&(t.state=n,t.since=this.now())}reduce(t){let n=V(t.worker_index);switch(t.type){case"explore_start":return this.s.run_id=k(t.run_id),this.s.exploration_id=k(t.exploration_id),this.s.status="running",!0;case"browser_request":return n===null?!1:(this.browser(n,!0),!0);case"browser_release":{if(n===null)return!1;let r=this.s.browsers.length;return this.s.browsers=this.s.browsers.filter(o=>o.worker!==n),this.s.browsers.length!==r}case"lease_start":{if(n===null||!k(t.lease_id))return!1;let r=this.browser(n,!0),o=t.reach&&typeof t.reach=="object"&&!Array.isArray(t.reach)?t.reach:null;return r.lease={id:String(t.lease_id),kind:String(t.kind??""),target:k(t.target),reach:o,started_at:this.now()},r.step=null,r.steps=[],this.setState(r,"starting"),!0}case"lease_step":{if(n===null)return!1;let r=this.browser(n,!1);if(!r||!r.lease||r.lease.id!==t.lease_id)return!1;let o={ordinal:V(t.ordinal)??r.steps.length,phase:String(t.phase??""),intent:k(t.intent),junction_id:k(t.junction_id),known:t.known===!0,url_pattern:k(t.url_pattern),flow_id:k(t.flow_id),navigated:t.navigated===!0,at:this.now()};return r.step=o,r.steps=[...r.steps,o].slice(-lr),o.junction_id&&r.trail[r.trail.length-1]!==o.junction_id&&(r.trail=[...r.trail,o.junction_id].slice(-ur)),this.setState(r,ar[o.phase]??"walking"),!0}case"lease_end":{let r=this.s.browsers.find(o=>o.lease?.id===t.lease_id);return r?(r.lease=null,r.step=null,r.steps=[],this.setState(r,r.held?"holding":"idle"),!0):!1}case"session_held":{if(n===null)return!1;let r=this.browser(n,!0);return r.held={kind:String(t.kind??""),start_flow:k(t.start_flow),junction_id:k(t.junction_id),url_pattern:k(t.url_pattern)},r.lease||this.setState(r,"holding"),!0}case"session_released":{if(n===null)return!1;let r=this.browser(n,!1);return!r||!r.held?!1:(r.held=null,r.lease||this.setState(r,"idle"),!0)}case"progress":return this.s.progress={frontier:V(t.frontier)??0,visited:V(t.visited)??0,active_workers:V(t.active_workers)??0,elapsed_s:V(t.elapsed_s)??0},!0;case"explore_control":return t.control!=="stop"||this.s.status!=="running"?!1:(this.s.status="paused",!0);case"explore_end":return this.s.status="ended",this.s.stop_reason=k(t.stop_reason),this.s.browsers=[],!0;default:return!1}}};var me=class{link=null;wanted=new Map;source=async(t,n)=>(this.wanted.set(t,n),this.link?.start(t),{stop:async()=>{this.wanted.get(t)===n&&(this.wanted.delete(t),this.link?.stop(t))}});attach(t){if(this.link=t,t)for(let n of this.wanted.keys())t.start(n)}frame(t,n){this.wanted.get(t)?.(n)}};var cr=500,pr=1e4,Bt=5e3,dr=async(e,t)=>{let n=new AbortController,r=()=>n.abort(),o=setTimeout(r,t.timeoutMs);t.signal.addEventListener("abort",r,{once:!0});try{let i=await F(e,{method:"POST",headers:t.headers,body:t.body,signal:n.signal}),c=null;try{c=await i.json()}catch{}return{status:i.status,body:c}}finally{clearTimeout(o),t.signal.removeEventListener("abort",r)}},fe=class{constructor(t){this.opts=t;this.post=t.post??dr,this.unsubscribeModel=t.model.subscribe(()=>this.stateChanged())}post;target=null;off=!1;framesOff=!1;abort=new AbortController;unsubscribeModel;stateInFlight=!1;stateDirty=!1;lastStateAt=0;stateTimer=null;heartbeat=null;watched=new Map;stopAsked=!1;waiting=new Map;sending=new Set;arm(t){this.off||(this.letAllGo(),this.abort.abort(),this.abort=new AbortController,this.stateInFlight=!1,this.target=t,this.framesOff=!1,this.stateDirty=!0,this.sendState())}async close(){this.off=!0,this.unsubscribeModel(),this.clearTimers(),this.letAllGo(),this.abort.abort()}url(t,n=""){let r=this.target;return`${r.baseUrl.replace(/\/+$/,"")}${n}/exploration/${encodeURIComponent(r.explorationId)}/runs/${encodeURIComponent(r.runId)}/live/${t}`}stateChanged(){if(this.off||!this.target||(this.stateDirty=!0,this.stateInFlight||this.stateTimer))return;let t=cr-(Date.now()-this.lastStateAt);t<=0?this.sendState():this.stateTimer=setTimeout(()=>{this.stateTimer=null,this.sendState()},t)}sendState(){if(this.off||!this.target||this.stateInFlight)return;let t=this.target;this.stateDirty=!1,this.stateInFlight=!0,this.lastStateAt=Date.now(),this.heartbeat&&clearTimeout(this.heartbeat),this.heartbeat=null;let n;try{n=JSON.stringify(this.opts.model.snapshot())}catch{this.stateInFlight=!1;return}this.post(this.url("state"),{headers:{Authorization:t.authHeader,"Content-Type":"application/json"},body:n,timeoutMs:Bt,signal:this.abort.signal}).then(r=>{if(this.target===t){if(r.status===404||r.status===403||r.status===401)return this.turnOff(r.status);r.status>=200&&r.status<300&&(this.stopIfAsked(r.body),this.follow(r.body))}},()=>{}).finally(()=>{this.target!==t||this.off||(this.stateInFlight=!1,this.heartbeat=setTimeout(()=>{this.heartbeat=null,this.stateDirty=!0,this.sendState()},pr),this.stateDirty&&this.stateChanged())})}turnOff(t){this.off||(this.off=!0,this.clearTimers(),this.letAllGo(),this.abort.abort(),this.opts.onWarn?.(`live view is off for this run: the controller has no live routes (HTTP ${t})`))}stopIfAsked(t){this.stopAsked||!t||typeof t!="object"||t.stop!==!0||(this.stopAsked=!0,this.opts.onStop?.())}follow(t){let n=t&&typeof t=="object"?t.watched:void 0;if(!Array.isArray(n)||this.framesOff)return;let r=new Set(n.filter(o=>Number.isInteger(o)&&o>=0));for(let o of[...this.watched.keys()])r.has(o)||this.letGo(o);for(let o of r)this.watched.has(o)||this.watched.set(o,this.opts.frames.subscribe(new Map([[o,Rt]]),i=>this.frame(i)))}frame(t){t.kind!=="frame"||this.off||!this.watched.has(t.worker)||(this.waiting.set(t.worker,{data:t.data,at:t.at}),this.sendFrame(t.worker))}sendFrame(t){if(this.sending.has(t)||!this.target)return;let n=this.waiting.get(t);if(n===void 0)return;this.waiting.delete(t);let r=this.target;this.sending.add(t);let o=Number.isFinite(n.at)?`&at=${Math.round(n.at)}`:"";this.post(`${this.url("frames","/public")}?worker=${t}${o}`,{headers:{"X-Live-Token":r.liveToken,"Content-Type":"image/jpeg"},body:Buffer.from(n.data,"base64"),timeoutMs:Bt,signal:this.abort.signal}).then(i=>{this.target===r&&(i.status===410?this.letGo(t):i.status===401&&!this.framesOff&&(this.framesOff=!0,this.letAllGo(),this.opts.onWarn?.("live frames are off for this run: the controller refused its live token (HTTP 401)")))},()=>{}).finally(()=>{this.target===r&&(this.sending.delete(t),!this.off&&this.watched.has(t)&&this.sendFrame(t))})}letGo(t){let n=this.watched.get(t);this.watched.delete(t),this.waiting.delete(t),n?.()}letAllGo(){for(let t of[...this.watched.keys()])this.letGo(t);this.sending.clear()}clearTimers(){this.stateTimer&&clearTimeout(this.stateTimer),this.heartbeat&&clearTimeout(this.heartbeat),this.stateTimer=this.heartbeat=null}};function ge(e,t){return`watch live: kane-cli explore view --exploration-id ${e}${t?` --env ${t}`:""}`}async function Mt(e){let t=new de,n=new me,r=new kt({start:e.startSource??n.source}),o=new fe({model:t,frames:r,post:e.post,onWarn:e.onWarn,onStop:e.onStop}),i=!1,c=!1,g=!1;return{model:t,frames:r,onBrowser(a){c||r.addBrowser(a)},offBrowser(a){r.removeBrowser(a)},attachRunner(a){n.attach(c?null:a)},runnerFrame(a,u){c||n.frame(a,u)},onEvent(a){t.apply(a),a.type==="explore_start"&&!i&&typeof a.exploration_id=="string"&&a.exploration_id&&(i=!0,e.onExploration?.(a.exploration_id))},armRun(a){if(!c){if(!a.liveToken){g||e.onWarn?.("live view is off for this run: the controller handed out no live token"),g=!0;return}o.arm({...e.controller,explorationId:a.explorationId,runId:a.runId,liveToken:a.liveToken})}},async close(a){c||(c=!0,await o.close(),n.attach(null),t.end(a),await r.close())}}}import{readFileSync as fr}from"fs";import{basename as gr}from"path";import{randomUUID as Kt}from"crypto";function $e(e){let t=[];for(let[n,r]of Object.entries(e)){if(r.type==="parameter")continue;let o=n.replace(/^(secrets\.user\.|global\.|environment\.)/,"");t.push({name:o,secret:!!r.secret,value:String(r.value??"")})}return t}async function Ht(e,t){if(t.activeRun){let u=null;try{u=await t.activeRun()}catch{u=null}if(u)return{ok:!1,error:`RUN_ACTIVE: run ${u.runId} is ${u.state} on exploration ${u.explorationId}; stop it or wait for it to end`}}let n=e.variables.filter(u=>u.secret),r=e.variables.filter(u=>!u.secret),o=[["LT_USERNAME",e.login.username],["LT_ACCESS_KEY",e.login.accessKey],...n.map(u=>[u.name,u.value])];for(let[u,l]of o){if(e.dev?.skipPush===u){e.onNote?.(`dev: not pushing secret ${u} (KANE_EXPLORE_DEV_SKIP_SECRET_PUSH)`);continue}try{await t.pushSecret(u,l)}catch(f){return{ok:!1,error:`could not push secret ${u} to HyperExecute Secrets: ${z(f)}`}}}for(let u of r)try{await t.upsertGlobal(u.name,u.value)}catch(l){return{ok:!1,error:`could not push variable ${u.name} to Test Manager: ${z(l)}`}}let i=o.map(([u])=>u);if(e.dev?.skipCheck)return e.onNote?.("dev: not checking the HyperExecute secrets list (KANE_EXPLORE_DEV_SKIP_SECRET_CHECK); the VM's check must refuse a missing secret"),a();let c;try{c=await t.hxSecretNames(i)}catch(u){return{ok:!1,error:`could not read your HyperExecute secrets to check them: ${z(u)}`}}let g=i.filter(u=>!c.includes(u));if(g.length)return{ok:!1,error:`HyperExecute Secrets does not list ${g.join(", ")} after the push; the VM would run without ${g.length===1?"it":"them"}`};return a();async function a(){let u=e.body;if(e.devBundle)try{let{kane_version:l,...f}=e.body;u={...f,dev:await e.devBundle()}}catch(l){return{ok:!1,error:`--dev-bundle: could not upload the bundle: ${z(l)}`}}try{return{ok:!0,reply:await t.remoteRun({...u,variables:e.variables.map(f=>({name:f.name,secret:f.secret}))})}}catch(l){if(l instanceof le&&l.code==="SECRETS_MISSING"){let f=l.body??{};return{ok:!1,secretsMissing:!0,error:typeof f.error=="string"&&f.error?f.error:"HyperExecute refused the job: a secret it names is missing",explorationId:typeof f.exploration_id=="string"?f.exploration_id:null,runId:typeof f.run_id=="string"?f.run_id:null}}return{ok:!1,error:`could not launch the remote run: ${z(l)}`}}}}async function Vt(e,t,n){let r={Authorization:K(t.username,t.accessKey),Accept:"application/json"},o=new URLSearchParams({username:t.username});for(let a of n)o.append("secretKey",a);let i=await F(`${e}/logistics/v1.0/all-secrets/list?${o}`,{method:"GET",headers:r});if(i.status===404&&(i=await F(`${e}/logistics/v1.0/secrets/list/${encodeURIComponent(t.username)}`,{method:"GET",headers:r})),!i.ok)throw new Error(`HTTP ${i.status}`);let c=null;try{c=await i.json()}catch{c=null}let g=mr(c);return n.filter(a=>g.has(a))}function mr(e){let t=new Set,n=e&&typeof e=="object"?e:{},r=Array.isArray(n.Data)?n.Data:Array.isArray(n.data)?n.data:Array.isArray(e)?e:[];for(let o of r)if(typeof o=="string")t.add(o);else if(o&&typeof o=="object"){let i=o,c=i.key??i.secretKey??i.Key??i.name;typeof c=="string"&&t.add(c)}return t}var Dt=["allowDomain","deny","allowPost","depthCaps","slowBudget","recheck","focus","hpsRegion","tunnel","tunnelName"];function Ae(e,t){let n={};t&&(n.deps=t);for(let r of Dt){let o=e[r];o===void 0||Array.isArray(o)&&!o.length||(n[r]=o)}return n}function Gt(e){let t=e.args&&typeof e.args=="object"?e.args:{},n={url:e.url,prompt:e.prompt,browser:"remote",headless:!0};typeof e.max_parallel=="number"&&e.max_parallel>0&&(n.maxParallel=e.max_parallel),typeof e.max_leases=="number"&&e.max_leases>0&&(n.maxLeases=e.max_leases),Array.isArray(e.allowed_domains)&&(n.allowDomain=e.allowed_domains),typeof e.policy=="string"&&e.policy&&(n.policy=e.policy);for(let r of Dt)t[r]!==void 0&&(n[r]=t[r]);return typeof t.deps=="string"&&t.deps&&(n.depsText=t.deps),n}function Ft(e,t){let n={},r=[];for(let o of e){if(!o.secret){n[o.name]={value:"",secret:!1};continue}let i=t[o.name];if(!i||i.includes("${{.secrets.")){r.push(o.name);continue}n[o.name]={value:i,secret:!0}}return r.length?{ok:!1,missing:r}:{ok:!0,variables:n}}function z(e){return e instanceof Error?e.message:String(e)}function Wt(e){let t=$e(e.variables).map(n=>({name:n.name,secret:n.secret}));return{url:e.url,prompt:e.prompt,policy:e.policy??ue,...t.length?{variables:t}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Ae({...e.opts,allowDomain:e.allowedDomains},e.depsText)}}function hr(e){let t={},n=(e.KANE_EXPLORE_DEV_SKIP_SECRET_PUSH??"").trim();return n&&(t.skipPush=n),(e.KANE_EXPLORE_DEV_SKIP_SECRET_CHECK??"").trim()==="1"&&(t.skipCheck=!0),t}async function wr(e,t){let n=fr(t),r=new qe(e.controllerBaseUrl,{username:e.basic.username,accessKey:e.basic.access_key}),o=`${Kt()}-${gr(t)}`,c=(await r.getPresignedUrls("explore-dev",Kt(),[{key:"bundle",content_type:"application/gzip",filename:o}])).urls.bundle;if(!c)throw new Error("the presign reply named no URL for the bundle");return await ot(c.upload_url,n,"application/gzip"),c.blob_url}function xr(e){return{project_id:e.projectId,url:e.url,prompt:e.prompt,policy:e.policy??ue,...e.allowedDomains.length?{allowed_domains:e.allowedDomains}:{},...e.contextEnabled===!1?{context_enabled:!1}:{},...e.maxParallel?{max_parallel:e.maxParallel}:{},...e.maxLeases?{max_leases:e.maxLeases}:{},args:Ae(e.opts,e.depsText),kane_version:e.kaneVersion}}async function qt(e,t){let n=new S({baseUrl:e.controllerBaseUrl,auth:e.basic}),r=new st(e.secretsBaseUrl),o=new it(e.tmsBaseUrl,e.basic.username,e.basic.access_key),i={username:e.basic.username,accessKey:e.basic.access_key},c=xr(t),g=t.dev,a=await Ht({variables:$e(t.variables),login:i,body:c,...g?{dev:hr(process.env),onNote:u=>e.emit({type:"warning",message:u}),devBundle:async()=>({bundle_url:await wr(e,g.bundlePath),controller_url:g.controllerUrl})}:{}},{pushSecret:(u,l)=>r.pushSecret({secretKey:u,secretValue:l,username:i.username,accessKey:i.accessKey,orgId:e.orgId}),upsertGlobal:async(u,l)=>{await o.upsertVariable({name:u,value:l})},hxSecretNames:u=>Vt(e.secretsBaseUrl,i,u),remoteRun:u=>n.remoteRun(u),activeRun:async()=>{if(!t.projectId)return null;let l=(await n.listExplorations({state:"running",project:t.projectId,limit:1})).explorations.find(f=>f.project_id===t.projectId&&f.current_session);return l&&l.current_session?{explorationId:l.exploration_id,runId:l.current_session.run_id,state:l.current_session.state}:null}});if(!a.ok&&a.secretsMissing)return{ok:!1,error:a.error,exitCode:2,stopped:{explorationId:a.explorationId,runId:a.runId}};if(!a.ok){if(t.contextEnabled===!1&&vt(a.error))return{ok:!1,error:yt,exitCode:2};let u=/could not launch/.test(a.error)||a.error.startsWith("RUN_ACTIVE:");return{ok:!1,error:a.error,exitCode:u?1:2}}return e.emit({type:"explore_remote_started",exploration_id:a.reply.exploration_id,run_id:a.reply.run_id,state:a.reply.state,hx_job_id:a.reply.hx_job_id,job_link:a.reply.job_link,created:a.reply.created,policy:c.policy??ue}),t.contextEnabled===!1&&!a.reply.created&&e.emit({type:"warning",message:`exploration ${a.reply.exploration_id} already exists; its assurance context is unchanged \u2014 use \`kane-cli explore context off ${a.reply.exploration_id}\``}),e.terminal||(process.stderr.write(`exploration ${a.reply.exploration_id}, run ${a.reply.run_id}: queued on HyperExecute
4
+ `),a.reply.job_link&&process.stderr.write(`job: ${a.reply.job_link}
5
+ `),process.stderr.write(ge(a.reply.exploration_id,e.env)+`
6
+ `)),{ok:!0,explorationId:a.reply.exploration_id,runId:a.reply.run_id}}async function Xt(e,t,n,r){let o=new S({baseUrl:e.controllerBaseUrl,auth:e.basic}),i;try{i=await o.runRequest(t,n)}catch(l){let f=l instanceof le?l.code:"";return{ok:!1,error:`could not read run ${n}'s request${f?` (${f})`:""}: ${l.message}`,exitCode:2,stopped:!1}}let c=i.requested&&typeof i.requested=="object"?i.requested:{},g=Array.isArray(c.variables)?c.variables:[],a=Ft(g,r);if(!a.ok){let l=`secret${a.missing.length===1?"":"s"} ${a.missing.join(", ")} not set on this machine (HyperExecute Secrets has no value for ${a.missing.length===1?"it":"them"})`,f=W("secrets_missing",l);try{let y=await o.startRun(t,{run_id:n,sessions:1,client_release:M});await o.endRun(t,n,{remark:f,stop_reason:"secrets_missing",last_seq:y.next_seq-1,complete:!1,totals:{},unacked:0})}catch(y){return{ok:!1,error:`${l}; stopping the run also failed: ${y.message}`,exitCode:1,stopped:!1}}return{ok:!1,error:l,exitCode:1,stopped:!0}}return{ok:!0,opts:{...Gt({...c,url:c.url??i.target_url,prompt:c.prompt??i.prompt}),explorationId:t,claimRunId:n,variables:JSON.stringify(a.variables)}}}import{existsSync as kr}from"fs";function he(e,t,n){let r=typeof e.explorationId=="string"?e.explorationId.trim():"";return r&&t?{explorationId:r}:n?{projectId:n}:null}function Jt(e){let t=e.trim();try{let n=new URL(t);return`${n.protocol}//${n.host}${n.pathname.replace(/\/+$/,"")}${n.search}${n.hash}`}catch{return t.replace(/\/+$/,"").toLowerCase()}}function br(e,t){return Jt(e)===Jt(t)}var yr=10;async function Oe(e,t){let n;for(let r=0;r<yr;r++){let o=await e.listExplorations({state:"all",limit:100,...n?{cursor:n}:{},..."projectId"in t?{project:t.projectId}:{}}),i=o.explorations.find(c=>"projectId"in t?c.project_id===t.projectId:c.exploration_id===t.explorationId);if(i)return i;if(!o.next_cursor)return null;n=o.next_cursor}return null}function vr(e){return`use a new --project for another site, or kane-cli explore delete ${e} first`}function Ue(e,t){let n=e.target_url??"";return!n||!t.trim()||br(n,t)?null:{error:`--url ${t.trim()} is not exploration ${e.exploration_id}'s URL (${n}): one exploration per project explores one URL`,next:vr(e.exploration_id)}}var _r=e=>We.hex(Ke.dim)(e),Rr=`error: --setup and --setup-check were replaced by --deps <plain language> (repeatable, or @file), which the recon runs once as its setup walk; see kane-cli explore run --help
7
+ `,Er=`
8
+ One project has one exploration, of one URL: a re-run takes the exploration's
9
+ URL, and a different --url is refused (use a new --project for another site,
10
+ or kane-cli explore delete <id> first).
11
+
12
+ Examples:
13
+ # a project's first run, on HyperExecute (exits once the run is queued)
14
+ $ kane-cli explore run --project <id> --url https://example.com \\
15
+ --prompt "Explore checkout"
16
+ # run again: the URL is the project's exploration's
17
+ $ kane-cli explore run --project <id> --max-leases 40
18
+ # a read-only run on this machine
19
+ $ kane-cli explore run --project <id> --policy read_only --local-orchestration
20
+ # a local app, through your LT tunnel (start LT first)
21
+ $ kane-cli explore run --project <id> --url http://localhost:3000 \\
22
+ --tunnel-name dev
23
+ `;function zt(e){let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Ee("must be a positive integer");return t}function uo(e){let t=e.command("explore").description("Explore an app into a map of its screens and flows").enablePositionalOptions().option("--exploration-id <id>",X({purpose:"On a terminal: open this exploration's card",values:"an id from kane-cli explore list --all",dflt:"pick a project first"})).option("--env <name>",Te).option("--username <user>",Ce).option("--access-key <key>",Pe).option("--agent",je).configureHelp({sortSubcommands:!0,...pe([{title:"Target",flags:["--exploration-id"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])}).addHelpText("after",`
24
+ On a terminal, plain \`kane-cli explore\` opens the project picker, then the
25
+ exploration's card (run again, watch, stop, map, sessions, context, delete);
26
+ with --agent or a pipe it prints this help. Each command's --help lists its
27
+ options, grouped, with their values, defaults and examples.
28
+ `).action(async(n,r)=>{if(r.args.length>0&&r.error(`error: unknown command '${r.args[0]}'`,{exitCode:2}),ce(n,At()))return r.help();let{runExploreEntryAction:o}=await import("./explore-entry-5OGNLFAU.js");process.exitCode=await o(n)});t.command("run").description("Run one exploration of an app into its project's map: on HyperExecute by default (exits once the run is queued; stop it with explore stop), or on this machine with --local-orchestration. A terminal opens a setup form and a review first; --agent or a pipe gets NDJSON on stdout, done last").option("--url <url>",h("url")).option("--project <id>",h("project")).option("--exploration-id <id>",h("explorationId")).option("--prompt <text>",h("prompt"),"Explore the app").option("--max-leases <n>",h("maxLeases"),zt).option("--max-parallel <n>",h("maxParallel"),zt).option("--depth-caps <depth:cap,\u2026>",h("depthCaps")).option("--slow-budget <spec>",h("slowBudget")).option("--no-recheck",h("recheck")).option("--policy <policy>",h("policy")).option("--allow-domain <host>",h("allowDomain"),we,[]).option("--deny <name>",h("deny"),we,[]).option("--allow-post <host/path>",h("allowPost"),we,[]).option("--focus <screen>",h("focus")).option("--local-orchestration",h("localOrchestration")).option("--browser <where>",h("browser"),"local").option("--headless",h("headless")).option("--tunnel",h("tunnel")).option("--tunnel-name <name>",h("tunnelName")).option("--deps <text>",h("deps"),we,[]).option("--variables <json>",h("variables")).option("--variables-file <path>",h("variablesFile")).option("--no-context",h("context")).option("--agent",h("agent")).option("--env <name>",h("env")).option("--username <user>",h("username")).option("--access-key <key>",h("accessKey")).addOption(new se("--claim-run <run-id>","On a HyperExecute VM: take over this queued run (the job's own command; needs --exploration-id)").hideHelp()).addOption(new se("--dev-bundle <tgz>","Dev only: the VM installs this kane-cli bundle and talks to EXPLORE_DEV_CONTROLLER_URL").hideHelp()).addOption(new se("--hps-region <region>",`With remote browsers on prod: the regional host (${ae.join(", ")})`).hideHelp()).configureHelp(pe($t())).addHelpText("after",Er).configureOutput({outputError:(n,r)=>r(/\'--setup(?:-check)?(?:=|\')/.test(n)?Rr:n)}).action(async n=>{process.exitCode=await Or(n)}),t.command("view").description("Serve a live graph of an exploration's map on 127.0.0.1 (polls the service; Ctrl-C to stop)").option("--exploration-id <id>",X({purpose:"The exploration to view",values:"an id from kane-cli explore list --all"})).option("--project <id>",X({purpose:"View this project's exploration instead (a project has one)",values:"a project id"})).option("--port <n>",X({purpose:"The port on 127.0.0.1",values:"1-65535",dflt:"the first free of 7420-7429"}),Sr).option("--agent",je).option("--env <name>",Te).option("--username <user>",Ce).option("--access-key <key>",Pe).configureHelp(pe([{title:"Target",flags:["--exploration-id","--project"]},{title:"Server",flags:["--port"]},{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])).addHelpText("after",`
29
+ Name the exploration with --exploration-id or --project, not both.
30
+
31
+ Examples:
32
+ $ kane-cli explore view --project <id>
33
+ $ kane-cli explore view --exploration-id <id> --port 7430
34
+ `).action(async n=>{process.exitCode=await Nr(n)}),Ot(t),Ut(t),t.command("assurance-job",{hidden:!0}).description("One cut of an exploration into its project's assurance (the controller's job; input from the environment)").action(async()=>{let{runAssuranceJob:n}=await import("./assurance-job-C3TXZGLL.js");process.exitCode=await n()})}function Sr(e){let t=Number(e);if(!Number.isInteger(t)||t<1||t>65535)throw new Ee("must be an integer 1-65535");return t}function we(e,t){return[...t,e]}function Qt(e){let t=new Set;for(let n of e){let r=n.trim().toLowerCase();if(r){try{r.includes("://")&&(r=new URL(r).hostname)}catch{}r=r.replace(/\/.*$/,"").replace(/^www\./,"").replace(/\.$/,""),r&&t.add(r)}}return[...t]}function Ir(e,t){if(e.some(r=>r.trim()==="*"))return{posts:["*"]};let n=new Set;for(let r of e){let o=r.trim();if(!o)continue;let i=y=>({error:`--allow-post ${JSON.stringify(o)}: ${y}; write it as host/path, e.g. api.example.com/v1/flags`});if(o.includes("://"))return i("no scheme");if(/[?#]/.test(o))return i("no query or fragment (the match is on host and path only)");if(o.includes("*"))return i("no partial wildcards (name the endpoint exactly, or pass a bare * for every POST)");if(/\s/.test(o))return i("no whitespace");let c=o.indexOf("/");if(c<=0)return i("a host followed by a path starting with /");let g=o.slice(0,c).toLowerCase(),a=o.slice(c),u=/^([^:]+?)\.?(?::(\d+))?$/.exec(g);if(!u)return i("an invalid host");let l=u[1],f=u[2]&&u[2]!=="80"&&u[2]!=="443"?`:${u[2]}`:"";if(g=l+f,!t.some(y=>l===y||l.endsWith(`.${y}`)))return i(`host ${l} is outside the run's domains (${t.join(", ")||"none"}); add it with --allow-domain first`);n.add(g+a)}return{posts:[...n]}}function Lr(e){if(e===void 0)return{caps:{}};let t={};for(let n of e.split(",").map(r=>r.trim()).filter(Boolean)){let r=/^(\d+):(\d+)$/.exec(n);if(!r)return{error:`--depth-caps "${e}": each entry is depth:cap with whole numbers, e.g. 0:0,1:3,2:1`};t[String(Number(r[1]))]=Number(r[2])}return Object.keys(t).length?{caps:t}:{error:`--depth-caps "${e}": give at least one depth:cap pair`}}var jr={response:"response_ms",page:"page_ready_ms",step:"step_ms"};function Tr(e){if(e===void 0)return{budgets:{}};let t={};for(let n of e.split(",").map(r=>r.trim()).filter(Boolean)){let r=/^(response|page|step)=(\d+(?:\.\d+)?)(s|ms)$/.exec(n);if(!r)return{error:`--slow-budget "${e}": each entry is response|page|step=<number>s or ms, e.g. response=3s,page=4s,step=2.5s`};let o=Math.round(Number(r[2])*(r[3]==="s"?1e3:1));if(o<1)return{error:`--slow-budget "${e}": a budget is more than 0`};t[jr[r[1]]]=o}return Object.keys(t).length?{budgets:t}:{error:`--slow-budget "${e}": give at least one budget`}}function Yt(e){return e.context===!1?{contextEnabled:!1}:{}}function Cr(e){let t=e.tunnelName;if(t!==void 0){let n=String(t).trim();return!n||/[\u0000-\u001f\u007f]/.test(n)?{error:"--tunnel-name: the name the LT tunnel was started with (--tunnelName)"}:{tunnel:{name:n}}}return{tunnel:e.tunnel===!0?{name:null}:null}}var Pr="--tunnel on a remote run: the remote browsers reach your apps through the LT tunnel on this machine; keep it (and this machine) up until the run ends, or its pages fail to load";function Be(e){return async t=>{let n=await J(e,"explore run");return n.ok?Oe(new S({baseUrl:n.controllerBaseUrl,auth:n.basic,timeoutMs:5e3}),t):null}}async function tr(e){let t=typeof e.project=="string"?e.project:"";if(!t)return null;try{let n=await J(e,"explore run");if(!n.ok)return null;let r=oe(e.env??new ne().getDefaultEnv()??"prod"),o=new Qe(r.tmsBaseUrl,n.basic.username,n.basic.access_key);return await wt((async()=>{try{let c=await o.getProject(t);if(c?.name)return c.name}catch{}return(await o.listProjects()).find(c=>String(c.project_id)===t)?.name??null})(),4e3,()=>null)}catch{return null}}var $r=async(e,t=Be(e))=>{let n=null,r=typeof e.project=="string"?e.project:"",o=he(e,!!e.localOrchestration,r||null),i=null;if(o)try{i=await t(o)}catch{i=null}if(i){let g=Ue(i,typeof e.url=="string"?e.url:"");if(g){for(let a of Ie(g.error,g.next))process.stderr.write(a+`
35
+ `);return 2}n=i.target_url??null}let c=await(await import("./explore-run-tty-LGTIK2NA.js")).setupRunOpts(e,n,await tr(e));return"opts"in c?c.opts:c.code};function Ar(e){if(e.startsWith("RUN_ACTIVE:"))return"watch it (kane-cli explore view) or stop it (kane-cli explore stop) first \u2014 one run per exploration";if(/HyperExecute Secrets does not list/.test(e))return"check the secret's name in HyperExecute Secrets and your variables files, then launch again; or run it here with --local-orchestration";if(/a secret it names is missing|SECRETS_MISSING/.test(e))return"add the missing secret to your variables files (secret: true) and launch again";if(/REMOTE_UNAVAILABLE|503|could not launch the remote run|could not read your HyperExecute secrets|could not push/.test(e))return"try again in a minute, or run it on this machine with --local-orchestration"}async function Or(e,t,n={}){let r=ce(e,t),o=r?Re("explore"):null,i=s=>s,c=null,g=s=>{o?o.emit(i(s)):c?.(i(s))},a=s=>{o?H(i(s)):process.stderr.write(`${s.type}: ${i(s).message}
36
+ `)},u=s=>(g({...bt({state:s.state??null,remark:s.remark??null,exitCode:s.exitCode,explorationId:s.explorationId??null,runId:s.runId??null,committed:s.committed??0,pending:s.pending??0,lastSeq:s.lastSeq??0,stopReason:s.stopReason??null,complete:s.complete??!1,runDir:s.runDir??null,error:s.error}),...s.teardown?{teardown:s.teardown}:{},...s.credits?{credits:s.credits}:{},...typeof s.creditsConsumed=="number"?{credits_consumed:s.creditsConsumed}:{},...s.focus?{focus:s.focus}:{},...s.refused?{refused:s.refused}:{},...s.parallelism?{parallelism:s.parallelism}:typeof s.peakParallel=="number"?{peak_parallel:s.peakParallel}:{}}),s.exitCode),l=(s,p)=>(a({type:"error",message:s}),p&&!o&&process.stderr.write(`next: ${p}
37
+ `),u({exitCode:2,error:s})),f=typeof e.claimRun=="string"&&e.claimRun?e.claimRun:null;if(f&&!r)return l("--claim-run is the HyperExecute VM's own mode; it never runs on a terminal");let y=Le(e);if("error"in y)return l(y.error,y.next);if(!r){let s=await(n.setup??(p=>$r(p,n.lookupExploration??Be(p))))(e);if(s===null)return 0;if(typeof s=="number")return s;e=s}if(!f&&!(typeof e.url=="string"&&e.url.trim())){let s=he(e,!!e.localOrchestration,typeof e.project=="string"&&e.project?e.project:null),p=null;if(s)try{p=await(n.lookupExploration??Be(e))(s)}catch{p=null}p?.target_url&&(e={...e,url:p.target_url})}if(!f&&!(typeof e.url=="string"&&e.url.trim()))return l("required option '--url <url>' not specified");let I=!!e.localOrchestration||!!f;if(f&&e.localOrchestration)return l("--claim-run is the VM's own mode; it takes no --local-orchestration");if(e.devBundle&&I)return l("--dev-bundle is for a remote run (the default), not --local-orchestration or --claim-run");if(f){let s=String(e.explorationId??"").trim();if(!s)return l("--claim-run needs --exploration-id");let p=await J(e,"explore run --claim-run");if(!p.ok)return l(p.error);let m=String(e.env??new ne().getDefaultEnv()??"prod"),d=await Xt(er(m,p.basic,"",A=>g(A)),s,f,process.env);if(!d.ok)return H(i({type:"error",message:d.error})),d.stopped?u({exitCode:d.exitCode,error:d.error,state:"stopped",remark:W("secrets_missing",d.error),explorationId:s,runId:f}):u({exitCode:d.exitCode,error:d.error,explorationId:s,runId:f});e={...e,...d.opts,env:e.env,username:e.username,accessKey:e.accessKey}}let _=Le(e);if("error"in _)return l(_.error,_.next);let x=_.policy,U={prompt:"",deps:""},R={},N="";try{let s=typeof e.depsText=="string"?e.depsText:lt(e.deps??[]);N=s;let p=ut({prompt:e.prompt??"Explore the app",deps:s},{globalDir:Ne(re,"variables"),localDir:Ne(process.cwd(),".testmuai","variables"),file:e.variablesFile,inline:e.variables,onLoadError:m=>a({type:"warning",message:m})});if("error"in p)return l(p.error);U={prompt:p.prompt,deps:p.deps},R=p.variables}catch(s){return l(`variables: ${s.message}`)}let w=Qt(e.allowDomain??[]);if(U.deps&&w.length===0)return l("--deps needs --allow-domain for every host the app signs in or writes on (e.g. --allow-domain testmuai.com --allow-domain lambdatest.com)");let L=[...new Set([...w,...Qt([String(e.url??"")])])],b=I?String(e.browser??"local"):"remote";if(!I&&e.browser!==void 0&&e.browser!=="local")return l("--browser applies to --local-orchestration; a remote run always uses remote browsers");if(b!=="local"&&b!=="remote")return l(`--browser ${b}: local or remote`);let j=e.hpsRegion;if(j!==void 0&&b!=="remote")return l("--hps-region needs --browser remote");if(j!==void 0&&!ae.includes(j))return l(`--hps-region ${j}: one of ${ae.join(", ")}`);let T=Cr(e);if("error"in T)return l(T.error);if(T.tunnel&&b!=="remote")return l("--tunnel needs remote browsers (a remote run, or --browser remote): a local Chrome already reaches this machine");let D=e.maxParallel??1;if(b==="local"&&D>Se)return l(`--max-parallel ${D}: at most ${Se} browsers run on this machine at once (--browser remote runs up to ${ie})`);if(b==="remote"&&D>ie)return l(`--max-parallel ${D}: at most ${ie} remote browsers at once`);let xe=Lr(e.depthCaps);if("error"in xe)return l(xe.error);let be=Tr(e.slowBudget);if("error"in be)return l(be.error);let Q=Ir(e.allowPost??[],L);if("error"in Q)return l(Q.error);x==="mutating"&&Q.posts.length&&a({type:"warning",code:"allow_post_ignored",message:jt});let Y=new ne,E=e.env??Y.getDefaultEnv()??"prod",O=oe(E),G=new Ye().load(),rr=Y.loadProfileConfig(Y.getActiveProfile()??"default",E)?.project_id??null,C=e.project??G.project_id??rr??null;if(x==="mutating"){let s=Tt(String(e.url??"")),p=Ct(String(e.url??""));o?H(i({type:"warning",code:"policy_mutating",policy:x,host:s,message:p})):process.stderr.write((process.stderr.columns?at(p,process.stderr.columns):p)+`
38
+ `);let m=n.mutatingMemory??Pt();if(!r&&!(C&&m.confirmed(C))){let A=await(n.confirmMutating??(async B=>(await import("./explore-run-tty-LGTIK2NA.js")).confirmMutatingRun({...B,projectName:B.projectName??(B.projectId?await tr({...e,project:B.projectId}):null)})))({host:s,projectId:C,projectName:C===G.project_id?G.project_name??null:null});if(A!==!0)return process.stderr.write(`setup discarded; nothing launched
39
+ `),A===null?130:0;C&&m.remember(C)}}if(!r&&n.afterChecks)return n.afterChecks();let Me=new Set;r||(c=s=>{s.type==="explore_remote_started"?process.stderr.write(q("queued on HyperExecute",` \xB7 run ${String(s.run_id).slice(0,8)}${s.job_link?` \xB7 ${String(s.job_link)}`:""}`,"done")+`
40
+ `):(s.type==="warning"||s.type==="error")&&process.stderr.write(`${String(s.type)}: ${String(s.message)}
41
+ `);for(let p of Me)p(s)});let He=(s,p)=>{if(o)H(i({type:"error",message:s}));else for(let m of Ie(i({message:s}).message,p??Ar(s)))process.stderr.write(m+`
42
+ `)},v,Ve="";try{let s=await nt({creds:Y,env:E,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});v=s.basicAuth,Ve=String(s.resolvedCreds?.org_id??"")}catch(s){return s instanceof rt&&s.code==="not_authenticated"?l("not authenticated: pass --username/--access-key or run 'kane-cli login'"):l(`auth resolution failed: ${s.message}`)}if(!v)return l("explore needs Basic credentials (username + access key); none resolved");if(!f){let s=he(e,I,C),p=null,m=v;if(s)try{p=await(n.lookupExploration??(A=>Oe(new S({baseUrl:O.controllerBaseUrl,auth:m,timeoutMs:5e3}),A)))(s)}catch{p=null}let d=p?Ue(p,String(e.url??"")):null;if(d)return He(d.error,d.next),u({exitCode:2,error:d.error})}if(n.afterUrlCheck)return n.afterUrlCheck();if(!I){T.tunnel&&g({type:"warning",message:Pr});let s={...er(E,v,Ve,te=>g(te)),terminal:!r},p;if(typeof e.devBundle=="string"&&e.devBundle){let te=(process.env.EXPLORE_DEV_CONTROLLER_URL??"").trim();if(!te)return l("--dev-bundle needs EXPLORE_DEV_CONTROLLER_URL (the controller the VM talks to: the tunnel URL)");if(!kr(e.devBundle))return l(`--dev-bundle ${e.devBundle}: no such file`);p={bundlePath:e.devBundle,controllerUrl:te}}let m=C;if(!m)return l("a remote run needs a project: pass --project <id> or set one (kane-cli config set-project); one project has one exploration");r||process.stderr.write(q("launching on HyperExecute")+`
43
+ `);let d=await qt(s,{opts:e,variables:R,depsText:N,prompt:e.prompt??"Explore the app",url:String(e.url),projectId:m,allowedDomains:w,policy:x,...Yt(e),maxParallel:e.maxParallel,maxLeases:e.maxLeases,kaneVersion:M,...p?{dev:p}:{}});if(!d.ok)return He(d.error,d.stopped?"add the missing secret to your variables files (secret: true) or HyperExecute Secrets, then launch again":void 0),d.stopped?u({exitCode:d.exitCode,error:d.error,state:"stopped",remark:W("secrets_missing",d.error),explorationId:d.stopped.explorationId,runId:d.stopped.runId}):u({exitCode:d.exitCode,error:d.error});let A=u({exitCode:0,state:"queued",explorationId:d.explorationId,runId:d.runId});if(r)return A;let{runLiveView:B}=await import("./explore-live-2XZHUYFS.js");return(await B({client:new S({baseUrl:O.controllerBaseUrl,auth:v}),explorationId:d.explorationId,runId:d.runId,mode:"remote",env:E,policy:x})).exitCode}let ye=Ze();if(!ye)return l("v16-runner not found");let De=G.window_size?.width??1280,Ge=G.window_size?.height??800,Fe=C,$,Z={explorationId:null,runId:null};if(b==="remote"){if(E!=="stage"&&E!=="prod")return l(`--browser remote: no remote browsers for env ${E}`);let s;try{s=mt(E,j??null)}catch(m){return l(m.message)}let p=v;i=dt([p.access_key]),$=ht({hpsBase:s,auth:p,forge:ft(O.tmsBaseUrl,p,()=>({exploration_id:Z.explorationId,run_id:Z.runId,project_id:Fe,hx_job_id:tt().jobId??null,kane_version:M,region:j??null,tunnel:!!T.tunnel,tunnel_name:T.tunnel?.name??null})),tunnel:T.tunnel,releaseSync:m=>gt(O.tmsBaseUrl,p,m),onEvent:m=>g({type:"remote_browser",...m})})}else $=ct({launch:ze,width:De,height:Ge,headless:!!e.headless});Xe("explore-browsers",()=>$.releaseAllSync());let P=null,ve=null;try{P=await Mt({controller:{baseUrl:O.controllerBaseUrl,authHeader:K(v.username,v.access_key)},onWarn:s=>g({type:"warning",message:s}),onExploration:s=>{process.stderr.write(ge(s,e.env)+`
44
+ `)},onStop:()=>{g({type:"warning",message:"explore stop: the run is stopping cleanly"}),ve?.()}})}catch(s){g({type:"warning",message:`live mode is off for this run: ${s.message}`})}let _e=()=>{},nr=new Promise(s=>{_e=s}),ee=null;r||Me.add(s=>{s.type!=="explore_run_started"||ee||(ee=import("./explore-live-2XZHUYFS.js").then(({runLiveView:p})=>p({client:new S({baseUrl:O.controllerBaseUrl,auth:v}),explorationId:String(s.exploration_id),runId:String(s.run_id),mode:"local",env:E,policy:x,ended:nr})))});try{let s=await _t({url:e.url,prompt:U.prompt,maxLeases:e.maxLeases,explorationId:e.explorationId,...typeof e.claimRunId=="string"?{claimRunId:e.claimRunId}:{requested:Wt({opts:e,url:String(e.url),prompt:e.prompt??"Explore the app",depsText:N,variables:R,allowedDomains:w,policy:x,maxParallel:e.maxParallel,maxLeases:e.maxLeases})},projectId:Fe,policy:x,context:U,variables:R,allowedDomains:w,...Yt(e),allowPosts:x==="read_only"?Q.posts:[],depthCaps:xe.caps,slowBudgets:be.budgets,recheck:e.recheck!==!1,maxParallel:D,...typeof e.focus=="string"?{focus:e.focus}:{},denyNames:(e.deny??[]).map(m=>m.trim()).filter(Boolean),headless:!!e.headless,width:De,height:Ge,auth:v,clientRelease:M},{client:new S({baseUrl:O.controllerBaseUrl,auth:v}),spawnRunner:m=>{let d=et({environment:E,username:v.username,accessKey:v.access_key,sessionId:m});return $.kind==="local"?ke({env:d,runner:ye,sessionId:m}):Nt(ke({env:d,runner:ye}),Ne(re,"sessions",m,"runner-stderr.log"),pt([v.access_key]))},acquireBrowser:async m=>{let d=await $.acquire(m);return P?.onBrowser(m),{cdpEndpoint:d.cdpEndpoint,release:()=>{P?.offBrowser(m),d.release()}}},releaseBrowsersOnInterrupt:$.kind==="remote",frameLink:m=>P?.attachRunner(m),onFrame:(m,d)=>P?.runnerFrame(m,d),onLiveRun:m=>{Z.explorationId=m.explorationId,Z.runId=m.runId,P?.armRun(m)},emit:m=>{let d=i(m);o?o.emit(d):c?.(d),P?.onEvent(d)},baseDir:re,onInterrupt:m=>{ve=m;let d=Mr(m);return()=>{ve=null,d()}}});await $.releaseAll(),await P?.close(s.stopReason??s.remark?.code??"stopped");let p=u(f?{...s,exitCode:xt(s)}:s);return _e(p),ee&&await ee,p}finally{_e(1),await P?.close("stopped"),await $.releaseAll(),Je("explore-browsers")}}var Ur=3e3;async function Nr(e,t={}){let n=t.tty??!ce(e),r=t.out??(w=>{process.stdout.write(w+`
45
+ `)}),o=n?null:Re("explore"),i=String(e.explorationId??"").trim(),c=String(e.project??"").trim(),g=(w,L,b)=>(o?.emit({type:"done",status:L,exit_code:w,exploration_id:i||null,...b?{error:b}:{}}),w),a=(w,L)=>{if(o)H({type:"error",message:w});else{let b=t.err??(j=>{process.stderr.write(j+`
46
+ `)});b(`error: ${w}`),L&&b(`next: ${L}`)}return g(2,"error",w)};if(i&&c)return a("--exploration-id or --project, not both","kane-cli explore view --exploration-id <id>");if(!i&&!c)return a("name the exploration: --exploration-id or --project","kane-cli explore list --all names them (or plain kane-cli explore to pick one)");let u=await J(e,"explore view");if(!u.ok)return a(u.error,"kane-cli login");let l=u.basic,f={controllerBaseUrl:u.controllerBaseUrl};if(c){try{i=(await new S({baseUrl:f.controllerBaseUrl,auth:l}).listExplorations({state:"all",project:c})).explorations.find(L=>L.project_id===c)?.exploration_id??""}catch(w){return a(`could not find project ${c}'s exploration: ${w.message}`)}if(!i)return a(`project ${c} has no exploration`,`start one: kane-cli explore run --project ${c} --url <app>`)}let y=K(l.username,l.access_key),I={controllerBaseUrl:f.controllerBaseUrl,authHeader:y,explorationId:i,port:e.port,live:{controller:{baseUrl:f.controllerBaseUrl,authHeader:y}}},_=await Et(I);if(_.kind==="not_found")return a(`exploration ${i} not found`,"kane-cli explore list --all");if(_.kind==="error")return a(`could not read the map: ${_.message}`);let x;try{x=await St(I)}catch(w){return a(`could not bind 127.0.0.1${I.port?`:${I.port}`:""}: ${w.message}`,"pass another --port, or leave it out for the first free one")}let U=t.hold?null:Hr(),R=null;try{R=await new S({baseUrl:f.controllerBaseUrl,auth:l,timeoutMs:Ur}).getContext(i)}catch{}o&&o.emit({type:"explore_view_started",url:x.url,exploration_id:i,context:R});let N=null;if(!o){let w=!t.out&&!!process.stdin.isTTY&&!!process.stdout.isTTY;w&&Zt(x.url),r(q("map viewer ready",` \xB7 ${x.url}`)),r(_r(` ${w?"opened in your browser \xB7 ":""}live when a run is going`)),r("");let L=_.kind==="ok"&&_.body.counts&&typeof _.body.counts=="object"?_.body.counts:null,b=R?`context ${R.enabled?"on":"off"}${R.last_job?` \xB7 ${R.last_job.status}`:""}`:"";for(let j of It({status:q("serving"),meta:["explore",i.slice(0,8),u.environment??""],tallies:[...Lt(L).filter(T=>!T.endsWith("findings")&&!T.endsWith("finding")),...b?[b]:[]],keys:[...w?["o open again"]:[],"ctrl+c stop serving"]}))r(j);w&&!t.hold&&(N=Br(()=>{Zt(x.url)}))}t.onStarted?.(x);try{await(U??t.hold())}finally{N?.()}return await x.close(),g(0,"stopped")}async function Zt(e){try{let{default:t}=await import("./open-MQLQKFAW.js");await t(e)}catch{process.stderr.write(`could not open a browser: open ${e}
47
+ `)}}function Br(e){let t=process.stdin;if(!t.isTTY)return()=>{};let n=r=>{let o=r.toString("utf8");o===""?process.kill(process.pid,"SIGINT"):(o==="o"||o==="O")&&e()};return t.setRawMode(!0),t.resume(),t.on("data",n),()=>{t.off("data",n);try{t.setRawMode(!1)}catch{}t.pause()}}function Mr(e){let t=process.listeners("SIGINT");for(let n of t)process.removeListener("SIGINT",n);return process.on("SIGINT",e),()=>{process.removeListener("SIGINT",e);for(let n of t)process.on("SIGINT",n)}}function Hr(){return new Promise(e=>{let t=process.listeners("SIGINT"),n=process.listeners("SIGTERM");process.removeAllListeners("SIGINT"),process.removeAllListeners("SIGTERM");let r=()=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r);for(let o of t)process.on("SIGINT",o);for(let o of n)process.on("SIGTERM",o);e()};process.once("SIGINT",r),process.once("SIGTERM",r)})}function er(e,t,n,r){let o=oe(e);return{env:e,controllerBaseUrl:o.controllerBaseUrl,secretsBaseUrl:o.secretsBaseUrl,tmsBaseUrl:o.tmsBaseUrl,basic:t,orgId:n,emit:r}}export{Rr as a,Er as b,uo as c,Qt as d,Ir as e,Lr as f,Tr as g,Yt as h,Cr as i,Pr as j,Or as k,Ur as l,Nr as m,Mr as n};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as v,b as P}from"./chunk-NLZZLANH.js";import{a as x,c as $,d as B,e as k}from"./chunk-P2ZQDQDB.js";import{b as F,d as I}from"./chunk-MNBGG4H3.js";import{c as M,d as _,e as R}from"./chunk-W3OVSDBN.js";import{a as S}from"./chunk-I2MC6VVX.js";import{o as j}from"./chunk-PUVMC4PX.js";import{existsSync as A,readdirSync as U,readFileSync as D}from"fs";import{join as L}from"path";var H=new Set(["unwritable","unreadable","unresolved"]),K=/^@import\s+(\S+)\s*$/,N=1e3;async function V(e){let i=[];for(let t=e.basePosition+1;t<=e.position;t++)i.push(await e.person.mainRecord(e.projectId,t));return i}async function re(e){try{let i=Array.from({length:Math.max(0,e.landing.position-e.landing.basePosition)},(f,p)=>e.landing.basePosition+1+p),[t,d]=await Promise.all([Promise.all(i.map(f=>e.person.mainRecord(e.projectId,f))),e.person.nodes(e.projectId,"usecase")]),c=new Map(d.flatMap(f=>f.name?[[f.cid,f.name]]:[])),g=new Set;for(let{record:f}of t){for(let l of M(f))l.label==="usecase"&&g.add(l.cid);let p=f.design_of?.uc_cid;typeof p=="string"&&g.add(p);for(let l of f.edges??[])(l.type==="belongs_to"||l.type==="scoped_to")&&typeof l.dst=="string"&&g.add(l.dst)}let w=f=>e.person.mainNode(e.projectId,f).catch(p=>p instanceof S&&p.code==="NOT_FOUND"?null:Promise.reject(p)),h=new Set;for(let f of g){let p=c.get(f);if(p){h.add(p.toLowerCase());continue}let l=await w(f);for(let u=0;l!==null&&l.name===null&&l.supersededBy&&u<N;u++)l=await w(l.supersededBy);l?.label==="usecase"&&l.name&&h.add(l.name.toLowerCase())}return h}catch(i){(e.trace??v("test-manager"))(`the session's use cases couldn't be read after the save: ${P(i)}`);return}}function C(e){let i=e.content.test_md_blob;return typeof i!="string"?[]:i.split(`
3
+ `).flatMap(t=>{let d=K.exec(t.trim());return d?[d[1]]:[]})}async function W(e){let i=new Map,t=new Map,d=new Map,c=new Map;for(let{record:n}of e.records){for(let o of M(n))i.set(o.cid,{label:o.label,content:o.content});for(let{cid:o,slug:r}of _(n))t.set(o,r),d.set(r,o);for(let o of R(n))c.set(o.old,o.new)}let{chainOf:g,tipOf:w}=T(c),h=n=>e.person.mainNode(e.projectId,n).catch(o=>o instanceof S&&o.code==="NOT_FOUND"?null:Promise.reject(o)),f=new Map([...c].flatMap(([n,o])=>o===null?[]:[[o,n]]));for(let[n,o]of[...i]){if(o.label!=="test"||c.has(n))continue;let r=n;for(let y=0;f.has(r)&&!t.has(r)&&y<N;y++)r=f.get(r);if(t.has(r)||i.has(r))continue;let m=await h(r);m===null||m.label!=="test"||!m.name||d.has(m.name)||(i.set(r,{label:m.label,content:m.content}),t.set(r,m.name),d.set(m.name,r))}let p=[...t.keys()].filter(n=>{if(i.get(n)?.label!=="test")return!1;let{later:o,retired:r}=g(n);return!r&&!o.some(m=>t.has(m))}),l=await X({read:h,nodes:i,nameOf:t,byName:d,next:c,tests:p,cwd:e.cwd}),u=e.trace??v("test-files"),s=await z({records:e.records,read:h,nameOf:t,here:[...l.wrote,...l.unchanged??[]],cwd:e.cwd,trace:u}).catch(n=>(u(`the replaced tests' files couldn't be looked for: ${P(n)}`),[])),a=q({tests:p,nodes:i,nameOf:t,tipOf:w,minted:l,cwd:e.cwd,trace:e.trace??v("test-files")});return{...l,saved:p.map(n=>t.get(n)),...s.length>0?{replaced:s}:{},...a?{needed:a}:{}}}function T(e){let i=t=>{let d=[],c=t;for(let g=0;e.has(c)&&g<N;g++){let w=e.get(c);if(w===null)return{later:d,retired:!0};d.push(w),c=w}return{later:d,retired:!1}};return{chainOf:i,tipOf:t=>i(t).later.at(-1)??t}}async function X(e){let{read:i,nodes:t,nameOf:d,byName:c,next:g,tests:w}=e,{chainOf:h,tipOf:f}=T(g),p=w.flatMap(u=>C(t.get(f(u))));for(;p.length>0;){let u=p.pop();if(c.has(u))continue;let s=await i(u);if(s===null||s.label!=="test")continue;let a=s;for(let n=0;a.supersededBy&&n<N;n++){let o=await i(a.supersededBy);if(o===null)throw new Error(`main names ${a.supersededBy} as what replaced ${a.cid}, but doesn't hold it`);a=o}t.set(s.cid,{label:s.label,content:s.content}),t.set(a.cid,{label:a.label,content:a.content}),d.set(s.cid,u),c.set(u,s.cid),a.cid!==s.cid&&g.set(s.cid,a.cid),p.push(...C(t.get(a.cid)))}return I({graph:{nameOf:d,getNode:u=>t.get(u)??null,resolve:u=>{let s=c.get(u)??(t.has(u)?u:void 0);if(s===void 0)return null;let{later:a,retired:n}=h(s),o=a.at(-1)??s;return{cid:s,tip:o,superseded:n||o!==s}}},cids:w,cwd:e.cwd,skipSame:!0,refuseUnwritable:!0,...e.overwriteEdited?{overwriteEdited:!0}:{}})}function q(e){try{let i=new Map([...e.minted.wrote,...e.minted.unchanged??[]].map(d=>[d.id,d.path])),t=x({cwd:e.cwd,tests:e.tests.map(d=>{let c=e.nameOf.get(d);return $(c,e.nodes.get(e.tipOf(d))?.content??{},i.get(c))})});if(t.variables.length===0&&t.noStartPage.length===0)return;try{B(t,e.cwd)}catch(d){e.trace(`the variables the saved tests need couldn't be written to ${t.file}: ${k(d)}`)}return t}catch(i){e.trace(`what the saved tests need couldn't be read: ${k(i)}`);return}}async function z(e){let i=new Map,t=new Map,d=new Set,c=new Map;for(let{record:s}of e.records){for(let r of M(s))d.add(r.cid);for(let r of R(s))c.set(r.old,r.new);for(let r of s.edges??[])r.type!=="verifies"||typeof r.src!="string"||typeof r.dst!="string"||t.set(r.src,(t.get(r.src)??new Set).add(r.dst));let a=s.design_of?.uc_cid;if(typeof a!="string")continue;let n=i.get(a)??{retired:[],made:[]};i.set(a,n);let o=new Set(M(s).flatMap(r=>r.label==="test"?[r.cid]:[]));for(let r of R(s))(r.new===null||r.new!==r.old&&o.has(r.new))&&n.retired.push(r.old);n.made.push(...o)}let g=F(e.cwd);if(![...i.values()].some(s=>s.retired.length>0)||!A(g))return[];let w=new Map(e.here.map(s=>[s.id,s.path])),h=new Set(e.here.map(s=>s.path)),f=new Map;for(let s of U(g)){let a=L(g,s);if(!(!s.endsWith("_test.md")||h.has(a)))try{let n=j(D(a,"utf8"));n?.base&&n.id&&f.set(n.base,{id:n.id,file:a})}catch{}}let p=new Set([...i.values()].flatMap(s=>s.made.flatMap(a=>[...t.get(a)??[]]))),l=async s=>{let a=new Set;for(let n=s,o=0;n&&!a.has(n)&&o<N;o++){if(a.add(n),!c.has(n)&&!p.has(n)&&!d.has(n)){let r=await e.read(n).catch(m=>e.trace(`a criterion's later versions couldn't be read: ${P(m)}`));c.set(n,r?.supersededBy??null)}n=c.get(n)}return a},u=[];for(let{retired:s,made:a}of i.values())for(let n of s){let o=await e.read(n),r=o?.label==="test"?o.content.definitionId:void 0,m=typeof r=="string"?f.get(r):void 0;if(!m||!o)continue;let y=new Set;for(let b of o.edgesOut)if(b.type==="verifies"){b.other&&c.set(b.dst,b.other.supersededBy);for(let O of await l(b.dst))y.add(O)}let E=a.flatMap(b=>{let O=w.get(e.nameOf.get(b)??"");return O&&[...t.get(b)??[]].some(G=>y.has(G))?[O]:[]});u.push({test:m.id,file:m.file,replacedBy:E})}return u}async function ie(e){let i=e.trace??v("test-files");try{let t=await V({person:e.person,projectId:e.projectId,basePosition:e.landing.basePosition,position:e.landing.position}),d=await W({person:e.person,projectId:e.projectId,records:t,cwd:e.cwd,trace:i});for(let c of d.refused)H.has(c.kind)&&i(`test file for ${c.id} not written: ${c.reason}`);return d}catch(t){return i(`main couldn't be read after the save: ${P(t)}`),"unread"}}export{re as a,X as b,ie as c};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{j as s}from"./chunk-4I7YN6YY.js";import{AsyncLocalStorage as c}from"async_hooks";function a(n,t){let e=s();e?e(n,t):process.stderr.write(n+`
3
+ `)}var i=new c;function l(n,t){let e=i.getStore(),o=n.attempt!==void 0,r=o?n.attempt:e?.attempt,p=!o&&e?e.appends:{made:0};return i.run({channel:n,...r!==void 0?{attempt:r}:{},appends:p},t)}function g(n){let t=i.getStore()?.channel.event;if(t){t(n);return}process.env.KANE_DEV_MODE==="1"&&a(JSON.stringify(n))}function v(){let n=i.getStore();return n?.attempt===void 0?null:(n.appends.made+=1,`${n.attempt}:${n.appends.made}`)}function h(n,t,e=""){let o=i.getStore()?.channel.event;if(o){o({type:"warning",message:n,...t?{code:t}:{}});return}let r=e+n;a(r.endsWith(`
4
+ `)?r.slice(0,-1):r,t)}export{a,l as b,g as c,v as d,h as e};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as S}from"./chunk-5BUIIFLC.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as b,b as c,j as x}from"./chunk-33DWJV67.js";import{a as $}from"./chunk-6YGTRKDT.js";import{y as o}from"./chunk-I6OQISK4.js";import{e as y}from"./chunk-UR6MHSHU.js";var T=y($(),1);var n=y(R(),1);function k(e){return e.caseTc!==void 0&&!e.anyAuthorStepRan&&!e.degradedReadonly&&!e.lockHeld}function A(e){let t=e.decisions.filter(a=>a.kind==="replay").length,l=e.decisions.filter(a=>a.kind==="author").length,p=e.outcomes.filter(a=>a.status==="passed").length,f=e.outcomes.filter(a=>a.status==="failed").length,h=e.outcomes.filter(a=>a.status==="skipped").length,s=o.green,u;e.cancelled||e.overallStatus==="interrupted"?(s=o.orange,u="CANCELLED"):e.overallStatus==="failed"?(s=o.red,u="FAILED"):u="PASSED";let r=`${u} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${f} failed, ${h} skipped)`,C=`${t} replay \xB7 ${l} author`,v=e.retryTriggered,_="yes \u2014 healed after a replay miss",i,m=o.dim;if(e.cancelled)i="\u2013 not committed (cancellation)";else if(e.uploadResult?.notSaved)i=e.caseTc?`\u2717 not pushed to ${e.caseTc}`:"\u2717 not pushed",m=o.red;else if(e.overallStatus==="failed")i="\u2013 not committed (run failed)",m=o.red;else if(!e.shouldCommit)e.isFirstRun?i="\u2013 not committed (first run skipped commit)":k(e)?i=`\u2013 ${e.caseTc} unchanged: every step replayed`:e.lockHeld?i="\u2013 not committed":i="\u2013 not committed (readonly fallback / no lock)";else if(e.committed===!1&&!e.uploadResult?.testcaseId)i="\u2013 not committed (commit did not land)",m=o.red;else{let a=e.uploadResult?.testcaseId;i=e.caseTc?`\u2713 pushed to ${e.caseTc}`:a?`\u2713 pushed (testcase=${a})`:"\u2713 pushed",m=o.green}let D=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",d,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success||e.uploadResult?.notSaved?(d="\u2713 TMS",g=o.green):e.uploadResult?(d=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):d="\u2013 not run":d="\u2013 skipped (--local or no auth)",{resultLine:{color:s,text:r},breakdown:C,showRetries:v,retriesText:_,commitText:i,commitColor:m,artifactsText:D,uploadText:d,uploadColor:g}}function O(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,f=e.outcomes.filter(r=>r.status==="failed").length,h=e.outcomes.filter(r=>r.status==="skipped").length,s,u=!1;return e.cancelled?s="cancellation":e.overallStatus==="failed"?s="run_failed":e.shouldCommit&&(e.committed===!0||e.uploadResult?.testcaseId)?(s="ok",u=!0):!e.shouldCommit&&!e.isFirstRun&&k(e)?s="unchanged":!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?s="readonly_fallback":s="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:f,skipped:h,replay_decisions:t,author_decisions:l},adaptive_heal:{triggered:e.retryTriggered},commit:{committed:u,reason:s,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function B({data:e}){let t=A(e),l=[{label:"result",value:(0,n.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,n.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"adaptive heal",value:(0,n.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,n.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,n.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,n.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,n.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function U({data:e}){let{exit:t}=x();return(0,T.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,n.jsx)(b,{flexDirection:"column",children:(0,n.jsx)(B,{data:e})})}export{A as a,O as b,B as c,U as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{createHash as f,randomBytes as p}from"crypto";import r from"fs";import u from"os";import s from"path";function l(t){return s.join(t,"store.json")}function a(){return`ctx-${p(6).toString("hex")}`}function S(t){return f("sha256").update(`${u.hostname()}|${s.resolve(t)}`).digest("hex").slice(0,32)}function _(t){try{let e=JSON.parse(r.readFileSync(l(t),"utf8"));if(typeof e.context_lineage_id=="string"&&typeof e.context_instance_id=="string")return e}catch{}return null}function m(t){try{return JSON.parse(r.readFileSync(t,"utf8"))}catch{return{}}}function y(t,e){r.mkdirSync(s.dirname(t),{recursive:!0});let n=`${t}.tmp-${process.pid}`;r.writeFileSync(n,JSON.stringify(e,null,2),{mode:384}),r.renameSync(n,t)}function g(t,e){let n=l(t),i=`${n}.tmp-${process.pid}`;r.writeFileSync(i,JSON.stringify(e,null,2)+`
3
+ `,{mode:420}),r.renameSync(i,n)}function O(t,e){let n=_(t);if(!n){n={context_lineage_id:a(),context_instance_id:a(),created_at:new Date().toISOString(),schema:1};try{g(t,n)}catch{return{ids:n,cloned:!1}}}let i=!1;try{let o=m(e),d=S(t),c=o[n.context_lineage_id];c&&c.fingerprint!==d&&r.existsSync(s.join(c.store_path,"store.json"))&&(i=!0,n={...n,context_instance_id:a()},g(t,n)),o[n.context_lineage_id]={fingerprint:d,store_path:s.resolve(t),last_seen:new Date().toISOString()},y(e,o)}catch{}return{ids:n,cloned:i}}export{_ as a,O as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as y}from"./chunk-DUYRCVI5.js";import{createServer as b}from"http";import{createReadStream as C,promises as S}from"fs";import{randomBytes as R}from"crypto";var u="127.0.0.1";function A(n,e){if(!n)return null;let o=/^bytes=(\d*)-(\d*)$/.exec(n.trim());if(!o)return null;let[,a,r]=o;if(a===""&&r==="")return null;if(a===""){let i=Number(r);return i===0||e===0?"unsatisfiable":{start:Math.max(0,e-i),end:e-1}}let t=Number(a);if(t>=e)return"unsatisfiable";let c=r===""?e-1:Math.min(Number(r),e-1);return c<t?null:{start:t,end:c}}async function I(n){let e=R(16).toString("hex"),o=b((r,t)=>{H(r,t,n,e).catch(()=>t.destroy())});await new Promise((r,t)=>{o.once("error",t),o.listen(n.port??0,u,()=>{o.removeListener("error",t),r()})});let a=o.address().port;return{port:a,urlFor:r=>`http://${u}:${a}/${e}/${encodeURIComponent(r)}`,close:()=>new Promise(r=>{o.close(()=>r()),o.closeAllConnections()})}}async function H(n,e,o,a){let r=n.url??"/",t=s=>{try{o.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:s,path:r})}catch{}};if(n.headers.host!==`${u}:${n.socket.localPort}`){t("host_mismatch"),e.writeHead(403).end();return}let c=n.headers.origin;if(c!==void 0&&!o.allowedOrigins.includes(c)){t("origin_denied"),e.writeHead(403).end();return}let i=c?{"Access-Control-Allow-Origin":c,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(n.method==="OPTIONS"){let s={...i,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};n.headers["access-control-request-private-network"]==="true"&&(s["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,s).end();return}if(n.method!=="GET"&&n.method!=="HEAD"){e.writeHead(405,i).end();return}let v;try{let s=new URL(n.url??"/",`http://${u}`).pathname.split("/");if(s.length!==3||s[1]!==a){t("bad_token"),e.writeHead(404,i).end();return}v=decodeURIComponent(s[2])}catch{t("not_found"),e.writeHead(404,i).end();return}let g=o.packs.get(v);if(!g){t("not_found"),e.writeHead(404,i).end();return}let d;try{let s=await S.stat(g);if(!s.isFile())throw new Error("not a file");d=s.size}catch{t("not_found"),e.writeHead(404,i).end();return}let h={...i,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(n.method==="HEAD"){e.writeHead(200,{...h,"Content-Length":String(d)}).end();return}let l=A(n.headers.range,d);if(l==="unsatisfiable"){t("unsatisfiable"),e.writeHead(416,{...i,"Content-Range":`bytes */${d}`}).end();return}let[m,p,w]=l===null?[0,d-1,200]:[l.start,l.end,206],E={...h,"Content-Length":String(p-m+1)};if(w===206&&(E["Content-Range"]=`bytes ${m}-${p}/${d}`),e.writeHead(w,E),d===0){e.end();return}let f=C(g,{start:m,end:p});f.on("error",()=>e.destroy()),e.on("close",()=>f.destroy()),f.pipe(e)}function O(n,e){return(e??y(n).evidenceViewerUrl).replace(/\/+$/,"")}function k(n,e){return`${e}/?pack=${encodeURIComponent(n)}`}function P(n){return`evidence: view locally with \`kane-cli evidence serve ${n}\``}export{A as a,I as b,O as c,k as d,P as e};
2
+ import{a as y}from"./chunk-MGNRNLBE.js";import{createServer as b}from"http";import{createReadStream as C,promises as S}from"fs";import{randomBytes as R}from"crypto";var u="127.0.0.1";function A(n,e){if(!n)return null;let o=/^bytes=(\d*)-(\d*)$/.exec(n.trim());if(!o)return null;let[,a,r]=o;if(a===""&&r==="")return null;if(a===""){let i=Number(r);return i===0||e===0?"unsatisfiable":{start:Math.max(0,e-i),end:e-1}}let t=Number(a);if(t>=e)return"unsatisfiable";let c=r===""?e-1:Math.min(Number(r),e-1);return c<t?null:{start:t,end:c}}async function I(n){let e=R(16).toString("hex"),o=b((r,t)=>{H(r,t,n,e).catch(()=>t.destroy())});await new Promise((r,t)=>{o.once("error",t),o.listen(n.port??0,u,()=>{o.removeListener("error",t),r()})});let a=o.address().port;return{port:a,urlFor:r=>`http://${u}:${a}/${e}/${encodeURIComponent(r)}`,close:()=>new Promise(r=>{o.close(()=>r()),o.closeAllConnections()})}}async function H(n,e,o,a){let r=n.url??"/",t=s=>{try{o.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:s,path:r})}catch{}};if(n.headers.host!==`${u}:${n.socket.localPort}`){t("host_mismatch"),e.writeHead(403).end();return}let c=n.headers.origin;if(c!==void 0&&!o.allowedOrigins.includes(c)){t("origin_denied"),e.writeHead(403).end();return}let i=c?{"Access-Control-Allow-Origin":c,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(n.method==="OPTIONS"){let s={...i,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};n.headers["access-control-request-private-network"]==="true"&&(s["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,s).end();return}if(n.method!=="GET"&&n.method!=="HEAD"){e.writeHead(405,i).end();return}let v;try{let s=new URL(n.url??"/",`http://${u}`).pathname.split("/");if(s.length!==3||s[1]!==a){t("bad_token"),e.writeHead(404,i).end();return}v=decodeURIComponent(s[2])}catch{t("not_found"),e.writeHead(404,i).end();return}let g=o.packs.get(v);if(!g){t("not_found"),e.writeHead(404,i).end();return}let d;try{let s=await S.stat(g);if(!s.isFile())throw new Error("not a file");d=s.size}catch{t("not_found"),e.writeHead(404,i).end();return}let h={...i,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(n.method==="HEAD"){e.writeHead(200,{...h,"Content-Length":String(d)}).end();return}let l=A(n.headers.range,d);if(l==="unsatisfiable"){t("unsatisfiable"),e.writeHead(416,{...i,"Content-Range":`bytes */${d}`}).end();return}let[m,p,w]=l===null?[0,d-1,200]:[l.start,l.end,206],E={...h,"Content-Length":String(p-m+1)};if(w===206&&(E["Content-Range"]=`bytes ${m}-${p}/${d}`),e.writeHead(w,E),d===0){e.end();return}let f=C(g,{start:m,end:p});f.on("error",()=>e.destroy()),e.on("close",()=>f.destroy()),f.pipe(e)}function O(n,e){return(e??y(n).evidenceViewerUrl).replace(/\/+$/,"")}function k(n,e){return`${e}/?pack=${encodeURIComponent(n)}`}function P(n){return`evidence: view locally with \`kane-cli evidence serve ${n}\``}export{A as a,I as b,O as c,k as d,P as e};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as V}from"./chunk-RTVWQK7I.js";import{a as j,f as q}from"./chunk-YIKF4ERQ.js";import{c as _}from"./chunk-44B6THYK.js";import{c as H,e as A,g as P}from"./chunk-7KX2BHKG.js";import{a as O}from"./chunk-VZJ6LUXX.js";import{n as L}from"./chunk-35ECWCCK.js";import{c as h}from"./chunk-BWXLZS5O.js";import{a as I}from"./chunk-GFLB2SHW.js";import{M as S}from"./chunk-UEE3RZN4.js";import{m as D}from"./chunk-4I7YN6YY.js";function F(e,n){try{let s=e.sessions().peek(n);return!s||!L(s,e.sessions().hasBase(n))?!1:(e.sessions().resume(n).complete({ended:"failed",code:"SESSION_KEPT_NOTHING"}),!0)}catch{return!1}}var J=e=>e!==null?{fixCmd:e}:{};function Q(e,n){return e.recordsSince(null).flatMap(o=>{let r=o.design_phase?.phase;return o.sid===n&&typeof r=="string"&&_[r]?[_[r]]:[]}).at(-1)}function X(e,n,s){return e.recordsSince(s).some(o=>o.sid!==n||!o.design_of?!1:o.design_phase?.phase==="tests"||o.nodes.some(r=>r.label==="test"))}async function le(e,n,s){let o=n.enterNested?.("opening the design\u2026")??(()=>{});try{return await Z(e,n,s)}finally{o()}}async function Z(e,n,s){let{force:o=!1,verb:r="design",childSession:d}=e,i=e.resume===!0?d:void 0;if(e.resume===!0&&i===void 0)return n.note("design child not resumed \u2014 a resume needs the child's session"),n.endUnstartedTurn(),2;if(i!==void 0&&F(s.store,i.id))return n.note(`design child ${i.id} kept nothing to resume \u2014 its agent never started; its offer opens again`),n.endUnstartedTurn(),2;let f=(()=>{if(i===void 0)return e.ucRef;try{return s.store.sessions().peek(i.id)?.use_case??e.ucRef}catch{return e.ucRef}})(),y=!1;if(i===void 0)try{let t=H(S(s.store),f);if(!t.ok&&(t.code==="UC_UNREVIEWED"||t.code==="UC_ARCHIVED")){let l=e.confirmUnreviewed??(C=>P(m=>n.ask(m),C)),a=!A(t);if(a||!await l(t))return n.note(t.reviewCmd!==void 0?`design child refused \u2014 approve it first: ${t.reviewCmd}`:"design child refused \u2014 approve it first"),n.endUnstartedTurn(),e.onEnded?.(a?"refused":"declined",a?{code:t.code}:void 0),2;y=!0}}catch{y=!1}let p=(()=>{try{let t=S(s.store),l=t.resolve(f);return(l?t.getNode(l.tip)?.content?.title:void 0)??f}catch{return f}})(),c=d?.id??i?.id,E=i?null:s.store.head(),B=i&&c!==void 0?Q(s.store,c):void 0,W=h(n.state.turns).entries.length,R=()=>h(n.state.turns).entries.filter(t=>t.kind==="test").length,$=R(),T=n.state.credits?.total,K=Date.now();n.ledger({kind:"childOpen",verb:r,subject:p,...d?{sid:d.id}:{},...i?{resumed:!0}:{},...e.replaces?{replaces:e.replaces}:{},...B?{landed:B}:{},...e.evolution?{update:!0}:{},...e.evolution?.changed?{changed:!0}:{}});let M=t=>{let l=Math.max(1,Math.round((Date.now()-K)/1e3)),a=h(n.state.turns).entries.length-W,C=R()-$,m=n.state.credits?.total,w=m!==void 0&&T!==void 0?m-T:m,U=e.evolution!==void 0&&t===0&&c!==void 0&&!s.store.recordsSince(E).some(x=>x.sid===c),G=t===0&&c!==void 0&&!U&&!X(s.store,c,E);if(n.ledger(t===0?{kind:"childClose",verb:r,subject:p,ok:!0,durS:l,...e.evolution?{update:!0}:{},...U?{untouched:!0}:{},...G?{unfinished:!0}:{},...a>0?{results:`${a} item${a===1?"":"s"}`}:{},...C>0?{tests:C}:{},...e.evolution&&c!==void 0?{testsWritten:j(s.store.recordsSince(E).filter(x=>x.sid===c),S(s.store))}:{},...w!==void 0&&w>0?{credits:w}:{}}:{kind:"childClose",verb:r,subject:p,ok:!1,durS:l,exitCode:t,...e.evolution?{update:!0}:{},...J(i!==void 0?D().command("next.resume_child",{sid:i.id}):D().command("next.design_use_case",{use_case:f,force:o||r==="evolve"}))}),e.quietEnding)return;let z=h(n.state.turns).entries.length;n.ledger({kind:"childBack",parentVerb:"extract",context:D().text("chat.child_back",{drafts:z})})},b="",u=1,v=!1,k,g,N=d?.id,Y=(...t)=>(v=!0,s.agent(...t));try{u=await q(i?{resume:i.id,mode:"interactive"}:{useCase:f,force:o,mode:"interactive",...y?{allowUnreviewed:!0}:{},...e.statement?{agentStatement:e.statement}:{},...e.evolution?.because?{because:e.evolution.because}:{},...e.evolution?.changeDelta!==void 0?{changeDelta:e.evolution.changeDelta}:{},...e.evolution?.priorDesign!==void 0?{priorDesign:e.evolution.priorDesign}:{},...d?{sessionId:d.id,registerSession:t=>d.register(t)}:{}},{...s,emit:t=>{!v&&k===void 0&&(k=O(t)??void 0),s.emit?.(V(t,{verb:"design",...N!==void 0?{id:N}:{}}))},agent:Y,ask:t=>n.ask(t),chat:n,nested:!0,out:t=>{b=t},progress:()=>{},isTTY:!0})}catch(t){if(!(e.onHeld&&t instanceof I&&t.code==="SESSION_CLASH"))throw t;g={heldBy:t.extra?.heldBy??null},u=2}finally{let t=u===3&&n.state.status==="pausing";g?n.ledger({kind:"childClose",verb:r,subject:p,ok:!1,durS:0,held:!0}):t&&e.quietEnding||M(u),v||n.endUnstartedTurn(),v&&!t?e.onEnded?.("ran",{exit:u}):g?e.onEnded?.("refused",{code:"SESSION_CLASH"}):k?.final&&e.onEnded?.("refused",{code:k.code})}return g?(e.onHeld(g.heldBy),u):(u!==0&&b&&!e.quietEnding&&n.note(b),u)}export{Q as a,X as b,le as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as c}from"./chunk-JQ64X2TO.js";function l(r,s){let t=s.syntax?.trim()??"";return t.startsWith("${")&&t.endsWith("}")?t:"${"+r+"}"}function u(r,s,t){let n=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return r.replace(new RegExp(`\\{\\{\\s*${n}(?=\\s*\\}\\}|[.\\[])`,"g"),`{{${t}.${s}`)}function b(r,s){let t={},n={},o=s;for(let[e,a]of Object.entries(r)){if(c(a)){t[e]={value:a.value,secret:!!a.secret,syntax:l(e,a),type:"parameter"},n[e]=e;continue}if(e.startsWith("global.")||e.startsWith("secrets.user.")||e.startsWith("environment.")){let i=e.startsWith("secrets.user.");t[e]={value:a.value,secret:i,syntax:`{{${e}}}`,type:i?"secret":e.startsWith("environment.")?"environment":"global"},n[e]=e;continue}if(a.secret){let i=`secrets.user.${e}`;t[i]={value:a.value,secret:!0,syntax:`{{secrets.user.${e}}}`,type:"secret"},n[e]=i,o=u(o,e,"secrets.user")}else{let i=`global.${e}`;t[i]={value:a.value,secret:!1,syntax:`{{global.${e}}}`,type:"global"},n[e]=i,o=u(o,e,"global")}}return{variables:t,objective:o,keyMap:n}}var p=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function f(r){return typeof r!="string"||!r.includes("{{")?r:r.replace(p,"{{$1}}")}function g(r){if(typeof r=="string")return f(r);if(Array.isArray(r))return r.map(s=>g(s));if(r&&typeof r=="object"){let s={};for(let[t,n]of Object.entries(r))s[t]=g(n);return s}return r}export{b as a,f as b,g as c};
@@ -0,0 +1,21 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as d,g as B,k as re}from"./chunk-CB4ARIHR.js";import{a as te}from"./chunk-4IEQNX7F.js";import{fb as ee}from"./chunk-UEE3RZN4.js";import{a as Z}from"./chunk-7DFBOVUB.js";import{g as A}from"./chunk-4I7YN6YY.js";import{createHash as ve,randomBytes as F}from"crypto";import{mkdirSync as ke,mkdtempSync as P,rmSync as $,existsSync as Oe,renameSync as Re}from"fs";import{tmpdir as j}from"os";import{join as _,dirname as de}from"path";import{spawn as ie}from"child_process";function N(n,e=process.env){let t=n.replace(/https?:\/\/[^\s/@]+:[^\s/@]+@/gi,"https://[redacted]@").replace(/(authorization\s*[:=])[^\r\n]+/gi,"$1 [redacted]"),r=e.KANE_SYNC_GIT_TOKEN;if(r)for(let i of[r,Buffer.from(`x-access-token:${r}`).toString("base64")])t=t.split(i).join("[redacted]");return t}function Ae(n,e){if(n.GIT_SSH_COMMAND)return ne(n.GIT_SSH_COMMAND);if(!n.GIT_SSH)return e?ne(e):"ssh -o BatchMode=yes"}function ne(n){return/(^|\s)-o\s*BatchMode=yes(\s|$)/.test(n)?n:`${n} -o BatchMode=yes`}var Ce=/^(?:ssh:\/\/|[^/\s@:]+@[^/\s:]+:)/i,se=new Map;function Ne(n,e){let t=[e??"",n.GIT_CONFIG_GLOBAL??"",n.HOME??""].join("\0"),r=se.get(t);return r===void 0&&(r=ae(["config","--get","core.sshCommand"],n,e,12e4).then(i=>i.code===0&&i.stdout.toString().trim()||void 0,()=>{}),se.set(t,r)),r}var oe=new Set(["fetch","push","clone","ls-remote"]);function xe(n,e,t){if(t!==void 0)return t;if(!n.some(i=>oe.has(i)))return 12e4;let r=e.KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS;if(r!==void 0){if(!/^\d+$/.test(r)||Number(r)<60||Number(r)>3600)throw new Error("KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS must be 60 to 3600");return Number(r)*1e3}return 9e5}function Ie(n){if(n.some(t=>/^(--force(?:-with-lease|-if-includes)?(?:=|$)|--mirror(?:=|$)|--delete(?:=|$)|-f$)/.test(t)))throw new Error("Git location cannot force, mirror or delete");let e=n.indexOf("push");if(e>=0){let t=n.slice(e+1);if(t.length!==3||t[0]!=="--porcelain"||!/^[0-9a-f]{40,64}:refs\/(heads|kane\/probe)\/[A-Za-z0-9._/-]+$/.test(t[2]))throw new Error("Git location requires an exact commit SHA and explicit ref")}}var H=async(n,e={})=>{Ie(n);let t={...process.env,...e.env};for(let h of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_CONFIG_PARAMETERS"])delete t[h];e.env?.GIT_INDEX_FILE&&(t.GIT_INDEX_FILE=e.env.GIT_INDEX_FILE);let r=[["core.autocrlf","false"],["core.eol","lf"],["core.symlinks","false"],["core.hooksPath","/dev/null"],["gc.autoDetach","false"],["gc.pruneExpire","3.days.ago"],["maintenance.auto","false"],["push.followTags","false"],["push.gpgSign","false"],["commit.gpgSign","false"]],i=t.KANE_SYNC_GIT_HTTP_POST_BUFFER;if(i!==void 0){if(!/^\d+$/.test(i)||Number(i)<1048576||Number(i)>536870912)throw new Error("KANE_SYNC_GIT_HTTP_POST_BUFFER must be 1048576 to 536870912 bytes; use it only for a proxy that rejects chunked uploads");r.push(["http.postBuffer",i])}for(let h of Object.keys(t))h.startsWith("GIT_TRACE")&&delete t[h];let s=n.find(h=>h.startsWith("https://"));if(t.KANE_SYNC_GIT_TOKEN&&s){let h=new URL(s);r.push([`http.${h.origin}${h.pathname}.extraheader`,""],[`http.${h.origin}${h.pathname}.extraheader`,`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${t.KANE_SYNC_GIT_TOKEN}`).toString("base64")}`],["credential.helper",""])}for(let h of Object.keys(t))/^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/.test(h)&&delete t[h];let a=!t.GIT_SSH_COMMAND&&!t.GIT_SSH&&n.some(h=>oe.has(h))&&n.some(h=>Ce.test(h))?await Ne({...t},e.cwd):void 0;r.forEach(([h,u],g)=>{t[`GIT_CONFIG_KEY_${g}`]=h,t[`GIT_CONFIG_VALUE_${g}`]=u}),t.GIT_CONFIG_COUNT=String(r.length),t.GIT_TERMINAL_PROMPT="0",t.GCM_INTERACTIVE="never",t.GIT_ASKPASS="",t.SSH_ASKPASS="";let c=Ae(t,a);return c!==void 0&&(t.GIT_SSH_COMMAND=c),t.GIT_NO_REPLACE_OBJECTS="1",ae(n,t,e.cwd,xe(n,t,e.timeout),e.input)};function ae(n,e,t,r,i){return new Promise((s,o)=>{let a=ie("git",n,{cwd:t,env:e,windowsHide:!0,detached:process.platform!=="win32",stdio:["pipe","pipe","pipe"]}),c=[],h=0,u="",g=!1,w=()=>{if(process.platform==="win32"&&a.pid)ie("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>a.kill("SIGKILL"));else try{a.pid&&process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},S=setTimeout(()=>{g=!0,w()},r);a.stdout.on("data",l=>{h+=l.length,h>128*1024*1024?w():c.push(l)}),a.stderr.on("data",l=>{u.length<64e3&&(u+=l.toString())}),a.stdin.on("error",()=>{}),a.on("error",l=>{clearTimeout(S),o(new d("SYNC_GIT_REQUIRED",`Git could not start: ${N(l.message,e)}`,"Install Git 2.31 or newer, then run the command again: https://git-scm.com/downloads"))}),a.on("close",l=>{clearTimeout(S),s({code:g||h>128*1024*1024?124:l??1,stdout:Buffer.concat(c),stderr:N(g?"Git operation timed out":u,e)})}),a.stdin.end(i)})}async function ce(n=H){let e=await n(["--version"],{timeout:1e4}),t=/git version (\d+)\.(\d+)/.exec(e.stdout.toString());if(e.code||!t||+t[1]<2||+t[1]==2&&+t[2]<31)throw new d("SYNC_GIT_REQUIRED","This location needs Git 2.31 or newer.","Install or update Git, then run setup again: https://git-scm.com/downloads")}function he(n){let e=/^([^/@:]+)@([^/:]+):/.exec(n);if(e)return{user:e[1],host:e[2]};try{let t=new URL(n);return{host:t.hostname||"the server",user:t.username||"git",port:t.port||void 0}}catch{return{host:"the server",user:"git"}}}function yt(n){let e=/^[^/@:]+@([^/:]+):/.exec(n);if(e)return e[1].toLowerCase();try{return new URL(n).hostname.toLowerCase()}catch{return""}}function Y(n,e){let{host:t,user:r,port:i}=he(e),s=N(n).trim().split(`
3
+ `).slice(-2).join(" ").trim();return/Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`this computer has not accepted ${t}'s SSH host key yet`,remedy:`in a terminal run: ssh -T ${i?`-p ${i} `:""}${r}@${t} and answer yes, then run the command again`,diagnostic:s}:/Permission denied \(publickey/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`${t} did not accept your SSH key`,remedy:"load it with ssh-add, or ask the repository owner to grant your account access",diagnostic:s}:/could not read Username|Authentication failed|Access denied|Invalid username or (password|token)|returned error: 401|returned error: 403/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`sign in is needed, or your account has no access to this repository on ${t}`,remedy:"sign in through Git, or ask the owner to grant your account access",diagnostic:s}:/Could not resolve host|Connection refused|Connection timed out|timed out|Network is unreachable|Failed to connect/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:`${t} could not be reached`,remedy:"check the address and your network, then run the command again",diagnostic:s}:/not found|does not appear to be a git repository|Repository not found/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:"no repository answered at that address, or your account cannot see it; a private repository looks missing until access is granted",remedy:"check the address, then run the command again",diagnostic:s}:{code:"SYNC_LOCATION_UNREACHABLE",message:`git could not read the repository on ${t}`,remedy:"check the address and your access, then run the command again",...s?{diagnostic:s}:{}}}function M(n,e){return(n.startsWith(e)?n:n.charAt(0).toUpperCase()+n.slice(1))+"."}function wt(n,e){let t=Y(n,e),{host:r}=he(e),i=t.remedy.replace(/,? ?(and )?then run the command again$/,"");return i?`${M(t.message,r)} ${M(i,r)}`:M(t.message,r)}var Pe=Buffer.from(`* -text -filter -ident -working-tree-encoding
4
+ `),$e="refs/kane/tip",Ge=/unexpected disconnect|hung up unexpectedly|Connection reset|Connection timed out|timed out|Could not resolve host|Failed to connect|RPC failed|Broken pipe|early EOF/i,Ue={GIT_AUTHOR_NAME:"kane-cli context",GIT_AUTHOR_EMAIL:"context@kane-cli.invalid",GIT_COMMITTER_NAME:"kane-cli context",GIT_COMMITTER_EMAIL:"context@kane-cli.invalid"},G=class n{constructor(e){this.options=e;this.exec=e.exec??H,this.prefix=e.prefix?`${e.prefix}/`:"";let t=ve("sha256").update(JSON.stringify([e.url,e.branch,this.prefix])).digest("hex");if(this.repo=_(e.cacheDir??_(A().baseDir,"context-sync","mirrors"),`${t}.git`),this.ref=e.ref??`refs/heads/${e.branch}`,!/^refs\/(heads|kane\/probe)\/[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(this.ref)||this.ref.includes(".."))throw new Error("Invalid Git location ref")}kind="git";contractVersion=1;ceilingTier=1;exec;repo;ref;prefix;ready;tip=null;tree=new Map;async run(e,t={}){let r=await this.exec(["--git-dir",this.repo,...e],t);if(r.code)throw new Error(`Git ${e[0]} failed: ${r.stderr||"unable to read the location"}`);return r.stdout}async transfer(e){let t=await this.exec(["--git-dir",this.repo,...e]);if(t.code){let r=Y(t.stderr||"",this.options.url);throw new d(r.code,r.message,r.remedy,r.diagnostic)}return t.stdout}get name(){return this.options.name??"<name>"}takenRemedy(e){return e===1?`${this.name} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${this.name}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${this.name} --rebase`}init(){return this.ready??=(async()=>{if(await ce(this.exec),ke(de(this.repo),{recursive:!0}),!Oe(this.repo)){let e=P(_(de(this.repo),".init-"));try{let t=await this.exec(["init","--bare",e]);if(t.code)throw new Error(`Cannot open Git cache: ${t.stderr}`);try{Re(e,this.repo)}catch(r){if(!["EEXIST","ENOTEMPTY"].includes(r.code??""))throw r}}finally{$(e,{recursive:!0,force:!0})}}if((await this.run(["rev-parse","--is-bare-repository"])).toString().trim()!=="true")throw new Error("The Git cache must be a bare repository");await this.refresh()})()}async refresh(){let t=(await this.transfer(["ls-remote",this.options.url,this.ref])).toString().trim();if(!t){this.tip=null,this.tree=new Map;return}let r=t.split(/\s+/)[0];if(!/^[0-9a-f]{40,64}$/.test(r))throw new Error("Git returned an invalid ref");if(r===this.tip)return;let i=`refs/kane/snapshots/${F(16).toString("hex")}`;await this.transfer(["fetch","--no-tags","--no-write-fetch-head",this.options.url,`${this.ref}:${i}`]);let s=(await this.run(["rev-parse",i])).toString().trim();await this.run(["update-ref",$e,s]),await this.run(["update-ref","-d",i]);let o=await this.readTree(s);this.tip=s,this.tree=o}contextKeys(e){let t=new Map;for(let[r,i]of e)r.startsWith(`${this.prefix}kane-context/`)&&t.set(r,i);return t}async readTree(e){let t=await this.run(["ls-tree","-rz","--full-tree",e]),r=new Map;for(let i of t.toString().split("\0").filter(Boolean)){let s=/^(\d+) (\w+) ([0-9a-f]+)\t([\s\S]+)$/.exec(i);if(!s)throw new Error("Git returned an invalid tree entry");if(s[4].startsWith(`${this.prefix}kane-context/`)&&(s[1]!=="100644"||s[2]!=="blob"))throw new d("SYNC_OBJECT_CORRUPT","Context storage contains a link or non-file object.","Ask the repository owner to restore the original context files.");r.set(s[4],s[3])}return r}key(e){if(!/^[a-zA-Z0-9_~./-]+$/.test(e)||e.split("/").some(t=>!t||t==="."||t===".."||t.toLowerCase()===".git"))throw new Error("Invalid context storage key");return this.prefix+e}async head(e){return await this.init(),this.tree.has(this.key(e))}async get(e){await this.init();let t=this.tree.get(this.key(e));return t?this.run(["cat-file","blob",t]):null}async list(e){return await this.init(),e&&e.replace(/\/$/,"")&&this.key(e.replace(/\/$/,"")),[...this.tree.keys()].filter(t=>t.startsWith(this.prefix+e)).map(t=>t.slice(this.prefix.length)).sort()}async beginTransaction(){await this.init();let e=new Map(this.tree),t=this.tip,r=new Map,i=!1,s=()=>{if(i)throw new Error("Git transaction is closed")},o=async a=>{s();let c=this.key(a),h=r.get(c),u=e.get(c);return h?Buffer.from(h):u?this.run(["cat-file","blob",u]):null};return{get:o,head:async a=>await o(a)!==null,stageIfAbsent:async(a,c)=>{s();let h=this.key(a);if(e.has(h)||r.has(h))return"exists";if(c.length>1e8)throw new d("SYNC_LOCATION_REFUSED_WRITE","A context object is too large for this Git location.","Use an S3 location for this context.");return r.set(h,Buffer.from(c)),"staged"},abort:async()=>{i=!0,r.clear()},commit:async()=>{s();try{if(!r.size)return{created:[]};let a=this.prefix+"kane-context/.gitattributes";e.has(a)||r.set(a,Pe);let c=new Map;for(let[l,m]of r)c.set(l,(await this.run(["hash-object","-w","--no-filters","--stdin"],{input:m})).toString().trim());let h=this.contextKeys(e),u=()=>{this.assertUnchanged(h);for(let[l,m]of this.contextKeys(this.tree))h.set(l,m)},g=!1,w="",S=0;for(let l=0;l<4;l++){u();for(let f of this.tree.keys())if(!(!f.startsWith(this.prefix)||e.has(f)||c.has(f))&&B(f.slice(this.prefix.length))!==null)throw new d("SYNC_BEHIND","the location gained records after this batch was prepared; nothing was published","run kane-cli context pull, then push again");let m=new Map;for(let[f,b]of c){let C=this.tree.get(f);if(C&&C!==b){let R=B(f.slice(this.prefix.length));throw R?new d("SYNC_POSITION_TAKEN",g?`position ${R} on ${this.name} now holds different work; an earlier publication could not be confirmed`:`position ${R} on ${this.name} was published by another writer; this batch was not published`,this.takenRemedy(R)):new d("SYNC_OBJECT_CORRUPT",`existing context object ${f} differs from the intended bytes`,"the object needs a person to look; nothing was published")}C||m.set(f,b)}if(!m.size)return await this.verifyPublication(c),{created:[]};t=this.tip;let x=await this.build(t,m);await this.checkAttributes(x,[...r.keys()]),S++;let E=await this.exec(["--git-dir",this.repo,"push","--porcelain",this.options.url,`${x}:${this.ref}`]),y=N(E.stdout.toString()+`
5
+ `+E.stderr);w=y.trim();let O=E.code!==0&&/\[rejected\]|\[remote rejected\]/.test(y),p=E.code!==0&&(E.code===124||Ge.test(y));g||=p;try{await this.refresh()}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","we could not confirm whether your context was uploaded; your local work is safe","check the connection and retry; kane-cli compares the published data before writing again")}if(u(),[...c].every(([f,b])=>this.tree.get(f)===b)){await this.verifyPublication(c);let f=E.code===0&&!E.stdout.toString().split(`
6
+ `).some(b=>b.startsWith("= "));return f&&await this.maintain(),{created:f?[...m.keys()].map(b=>b.slice(this.prefix.length)):[]}}if(E.code===0)throw new d("SYNC_PUBLICATION_UNKNOWN","the server accepted publication, but a fresh read did not confirm all context objects","retry after checking the location; do not discard local context");if(this.tip===t&&!g)throw new d("SYNC_LOCATION_REFUSED_WRITE",`${this.name} refused publication`,"check repository write access and branch rules, then retry",y.trim());if(this.tip===t&&!O&&g){await new Promise(f=>setTimeout(f,200*(l+1)+Math.random()*200));continue}await new Promise(f=>setTimeout(f,50*(l+1)+Math.random()*100))}throw new d("SYNC_PUBLICATION_UNKNOWN",`publication could not be confirmed after ${S} attempts; your local work is safe`,"run kane-cli context sync status, then retry",w||void 0)}finally{i=!0,r.clear()}}}}async maintain(){try{await this.exec(["--git-dir",this.repo,"gc","--auto","--quiet"],{timeout:3e5})}catch{}}assertUnchanged(e){for(let[t,r]of e)if(t.startsWith(`${this.prefix}kane-context/`)&&this.tree.get(t)!==r)throw new d("SYNC_REMOTE_ROLLED_BACK","The location changed or removed previously observed context data.","Ask the repository owner to restore the published context; keep your local copy.")}async verifyPublication(e){try{await this.verify(e)}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","Publication was observed, but its bytes could not be fully verified. Your local work is safe.","Check the connection and retry before discarding local context.")}}async verify(e){for(let[t,r]of e){if(this.tree.get(t)!==r)throw new Error("Published context verification failed");let i=await this.run(["cat-file","blob",r]);if((await this.run(["hash-object","--no-filters","--stdin"],{input:i})).toString().trim()!==r)throw new Error("Published bytes do not match their Git object")}}async checkAttributes(e,t=[]){if(!e)return;let r=P(_(j(),"kane-git-attributes-"));try{let i={GIT_INDEX_FILE:_(r,"index")};await this.run(["read-tree",e],{env:i});let s=["commits/000000/000000001.json","blobs/ab/1234","proposals/sample/1234.json"].map(u=>`${this.prefix}kane-context/v1/${u}`),o=t.filter(u=>u.startsWith(`${this.prefix}kane-context/`)&&!u.endsWith("/.gitattributes")),a=Buffer.from([...new Set([...s,...o])].join("\0")+"\0"),h=(await this.run(["check-attr","--cached","-z","--stdin","text","filter","ident","working-tree-encoding"],{env:i,input:a})).toString().split("\0");for(let u=0;u+2<h.length;u+=3)if(!["unset","unspecified"].includes(h[u+2]))throw new d("SYNC_LOCATION_REFUSED_WRITE",`Git attributes transform context bytes (${h[u+1]}).`,"Use a dedicated context repository with no text, filter, ident or encoding conversions.")}finally{$(r,{recursive:!0,force:!0})}}async build(e,t){let r=P(_(j(),"kane-git-index-"));try{let i={GIT_INDEX_FILE:_(r,"index")};await this.run(e?["read-tree",e]:["read-tree","--empty"],{env:i});let s=Buffer.from([...t].map(([l,m])=>`100644 ${m} ${l}\0`).join(""));await this.run(["update-index","-z","--index-info"],{env:i,input:s});let a=["commit-tree",(await this.run(["write-tree"],{env:i})).toString().trim(),...e?["-p",e]:[],"-m",`Append context objects
7
+
8
+ Kane-Context: v1`],c=await this.exec(["--git-dir",this.repo,...a]),h=(c.code===0?c.stdout:await this.run(a,{env:Ue})).toString().trim(),u=(await this.run(["rev-list","--parents","-n","1",h])).toString().trim().split(" ");if(u.length!==(e?2:1)||e&&u[1]!==e)throw new Error("Unsafe Git commit parent");let g=(await this.run(["diff-tree","--no-commit-id","--name-status","--no-renames","-r","-z",...e?[e,h]:["--root",h]])).toString().split("\0").filter(Boolean);if(g.length!==t.size*2||g.some((l,m)=>m%2===0?l!=="A":!t.has(l)))throw new Error("Unsafe Git commit: unexpected changed path or file mode");let w=await this.readTree(h),S=e?await this.readTree(e):new Map;if(w.size!==S.size+t.size||[...S].some(([l,m])=>w.get(l)!==m)||[...t].some(([l,m])=>S.has(l)||w.get(l)!==m))throw new Error("Unsafe Git commit: only intended new keys may be added");return h}finally{$(r,{recursive:!0,force:!0})}}async putIfAbsent(e,t){let r=await this.beginTransaction();try{if(await r.stageIfAbsent(e,t)==="exists")return"exists";try{return(await r.commit()).created.includes(e)?"created":"exists"}catch(i){if(i instanceof d&&["SYNC_POSITION_TAKEN","SYNC_OBJECT_CORRUPT"].includes(i.code)&&await this.head(e))return"exists";throw i}}finally{await r.abort()}}async probe(){await this.init();let e=re(F(16).toString("hex"));try{await this.putIfAbsent(e,Buffer.from("connection check"))}catch(c){if(c instanceof d&&c.code==="SYNC_LOCATION_REFUSED_WRITE")return await this.refresh(),{tier:3,detail:"This location can be downloaded, but publication was refused."};throw c}if(await this.putIfAbsent(e,Buffer.from("must not replace"))!=="exists")throw new d("SYNC_PROBE_INCONCLUSIVE","Exclusive create could not be verified.","Retry the connection check.");let t=P(_(j(),"kane-git-reader-"));try{let c=new n({...this.options,cacheDir:t});if(!Buffer.from(await c.get(e)??[]).equals(Buffer.from("connection check"))||!await c.head(e)||!(await c.list(e)).includes(e))throw new Error("Independent reader could not confirm published bytes")}finally{$(t,{recursive:!0,force:!0})}let r=`refs/kane/probe/${F(16).toString("hex")}`,i=Array.from({length:8},()=>new n({...this.options,ref:r}));if((await Promise.allSettled(i.map(c=>c.head(e)))).some(c=>c.status==="rejected"))throw new d("SYNC_PROBE_INCONCLUSIVE","The concurrent connection check could not initialize its independent clients.","Retry the connection check.");let o=await Promise.allSettled(i.map((c,h)=>c.putIfAbsent(e,Buffer.from(`contender ${h}`))));if(o.some(c=>c.status==="rejected"))throw new d("SYNC_PROBE_INCONCLUSIVE","The server did not complete the concurrent connection check. Its scratch-ref policy may differ from the storage branch.","Ask the repository owner to allow the connection-check ref, then retry.");if(o.filter(c=>c.status==="fulfilled"&&c.value==="created").length!==1)throw new d("SYNC_PROBE_INCONCLUSIVE","The concurrent connection check did not produce exactly one winner.","Do not publish to this location until its connection check passes.");return{tier:1,detail:"Can download and publish; independent reads and concurrent writes verified."}}};import{closeSync as De,existsSync as Le,linkSync as Ke,lstatSync as Be,mkdirSync as He,openSync as Me,readFileSync as Ye,readdirSync as Fe,realpathSync as q,rmSync as ue,statSync as z,writeFileSync as je}from"fs";import{randomBytes as ze}from"crypto";import{dirname as le,join as fe,resolve as pe,sep as U}from"path";var We=[/^Dropbox( \(.*\))?$/,/^Mobile Documents$/,/^OneDrive(-.*)?$/,/^Google ?Drive(-.*)?$/,/^My Drive$/,/^CloudStorage$/,/^iCloud Drive/],qe="a folder synced by Dropbox, OneDrive, Google Drive or iCloud cannot be a location: these keep both sides of a conflict as duplicate files instead of refusing the second write \u2014 use a directory outside the sync client, a git-tracked folder, or an s3:// bucket";function me(n){return n.split(U).some(e=>We.some(t=>t.test(e)))}function Xe(n){try{return q(n)}catch{return n}}var ge=".tmp-";function Je(n){try{return Be(n),!0}catch{return!1}}var T=n=>n.code??"",I=new Set(["ENOENT","ENOTDIR"]),W=new Set(["EACCES","EPERM"]),D=class{kind="dir";contractVersion=1;ceilingTier;root;createRoot;constructor(e,t={}){if(this.root=pe(e),me(this.root)||me(Xe(this.root)))throw new Error(qe);this.ceilingTier=1,this.createRoot=t.createRoot??!0}requireRoot(){if(!this.createRoot){try{if(z(this.root).isDirectory())return}catch(e){if(W.has(T(e)))throw this.denied();if(!I.has(T(e)))throw e}throw this.unreachable()}}unreachable(){return new d("SYNC_LOCATION_UNREACHABLE",`nothing answered at ${this.root}: that folder does not exist and cannot be created`,"check the path, then run the command again")}denied(){return new d("SYNC_LOCATION_DENIED",`${this.root} cannot be read by this account`,"ask the owner of the folder for access")}readFault(e){return W.has(T(e))?this.denied():e}writeFault(e){return I.has(T(e))||T(e)==="EROFS"?this.rootExists()?this.refusedWrite("its filesystem is read-only"):this.unreachable():W.has(T(e))?this.refusedWrite("this account has no write access"):e}refusedWrite(e){return new d("SYNC_LOCATION_REFUSED_WRITE",`${this.root} cannot be written: ${e}`,"ask the owner of the folder for write access, or pull from it without pushing")}rootExists(){try{return z(this.root).isDirectory()}catch{return!1}}path(e){let t=e.split("/"),r=e!==""&&!e.startsWith("/")&&!e.includes("\\")&&t.every(s=>s!==""&&s!=="."&&s!==".."),i=r?pe(this.root,...t):"";if(!r||!i.startsWith(this.root+U)||!this.contained(i))throw new Error(`bad key ${e}`);return i}contained(e){let t=e;for(;!Je(t);)t=le(t);if(t===this.root||!t.startsWith(this.root+U))return!0;try{let r=q(this.root),i=q(t);return i===r||i.startsWith(r+U)}catch{return!1}}async head(e){this.requireRoot();try{return z(this.path(e)).isFile()}catch(t){if(I.has(T(t)))return!1;throw this.readFault(t)}}async get(e){this.requireRoot();try{return new Uint8Array(Ye(this.path(e)))}catch(t){if(I.has(T(t)))return null;throw this.readFault(t)}}async list(e){this.requireRoot();let t=e.lastIndexOf("/"),r=t===-1?"":e.slice(0,t),i=r===""?this.root:this.path(r),s=[],o=(a,c)=>{for(let h of Fe(a,{withFileTypes:!0})){let u=c+h.name;h.isDirectory()?o(fe(a,h.name),`${u}/`):!h.name.startsWith(ge)&&u.startsWith(e)&&s.push(u)}};try{o(i,r===""?"":`${r}/`)}catch(a){if(I.has(T(a))&&!Le(i))return[];throw this.readFault(a)}return s.sort()}async putIfAbsent(e,t){this.requireRoot();let r=this.path(e),i=le(r),s=fe(i,`${ge}${process.pid}-${ze(6).toString("hex")}`),o;try{He(i,{recursive:!0}),o=Me(s,"wx")}catch(c){throw this.writeFault(c)}try{je(o,t),Z(o)}finally{De(o)}let a="created";try{Ke(s,r)}catch(c){if(c.code!=="EEXIST")throw ue(s,{force:!0}),c;a="exists"}return ue(s,{force:!0}),ee(i),a}};var J=new TextEncoder,Ve={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},Qe=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]),L=class{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:r,service:i,region:s,cache:o,retries:a,initRetryMs:c}){if(e==null)throw new TypeError("accessKeyId is a required option");if(t==null)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=r,this.service=i,this.region=s,this.cache=o||new Map,this.retries=a??10,this.initRetryMs=c||50}async sign(e,t){if(e instanceof Request){let{method:s,url:o,headers:a,body:c}=e;t=Object.assign({method:s,url:o,headers:a},t),t.body==null&&a.has("Content-Type")&&(t.body=c!=null&&a.has("X-Amz-Content-Sha256")?c:await e.clone().arrayBuffer()),e=o}let r=new V(Object.assign({url:e.toString()},t,this,t&&t.aws)),i=Object.assign({},t,await r.sign());delete i.aws;try{return new Request(i.url.toString(),i)}catch(s){if(s instanceof TypeError)return new Request(i.url.toString(),Object.assign({duplex:"half"},i));throw s}}async fetch(e,t){for(let r=0;r<=this.retries;r++){let i=fetch(await this.sign(e,t));if(r===this.retries)return i;let s=await i;if(s.status<500&&s.status!==429)return s;await new Promise(o=>setTimeout(o,Math.random()*this.initRetryMs*Math.pow(2,r)))}throw new Error("An unknown error occurred, ensure retries is not negative")}},V=class{constructor({method:e,url:t,headers:r,body:i,accessKeyId:s,secretAccessKey:o,sessionToken:a,service:c,region:h,cache:u,datetime:g,signQuery:w,appendSessionToken:S,allHeaders:l,singleEncode:m}){if(t==null)throw new TypeError("url is a required option");if(s==null)throw new TypeError("accessKeyId is a required option");if(o==null)throw new TypeError("secretAccessKey is a required option");this.method=e||(i?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(r||{}),this.body=i,this.accessKeyId=s,this.secretAccessKey=o,this.sessionToken=a;let x,E;(!c||!h)&&([x,E]=Ze(this.url,this.headers)),this.service=c||x||"",this.region=h||E||"us-east-1",this.cache=u||new Map,this.datetime=g||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=w,this.appendSessionToken=S||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let y=this.signQuery?this.url.searchParams:this.headers;if(y.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&y.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(p=>l||!Qe.has(p)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(p=>p+":"+(p==="host"?this.url.host:(this.headers.get(p)||"").replace(/\s+/g," "))).join(`
9
+ `),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&(this.service==="s3"&&!y.has("X-Amz-Expires")&&y.set("X-Amz-Expires","86400"),y.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),y.set("X-Amz-SignedHeaders",this.signedHeaders)),this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch{this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");m||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=Se(this.encodedPath);let O=new Set;this.encodedSearch=[...this.url.searchParams].filter(([p])=>{if(!p)return!1;if(this.service==="s3"){if(O.has(p))return!1;O.add(p)}return!0}).map(p=>p.map(f=>Se(encodeURIComponent(f)))).sort(([p,f],[b,C])=>p<b?-1:p>b?1:f<C?-1:f>C?1:0).map(p=>p.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),r=this.cache.get(t);if(!r){let i=await v("AWS4"+this.secretAccessKey,e),s=await v(i,this.region),o=await v(s,this.service);r=await v(o,"aws4_request"),this.cache.set(t,r)}return X(await v(r,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,X(await ye(await this.canonicalString()))].join(`
10
+ `)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
11
+ `,this.signedHeaders,await this.hexBodyHash()].join(`
12
+ `)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!="string"&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=X(await ye(this.body||""))}return e}};async function v(n,e){let t=await crypto.subtle.importKey("raw",typeof n=="string"?J.encode(n):n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",t,J.encode(e))}async function ye(n){return crypto.subtle.digest("SHA-256",typeof n=="string"?J.encode(n):n)}var we=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function X(n){let e=new Uint8Array(n),t="";for(let r=0;r<e.length;r++){let i=e[r];t+=we[i>>>4&15],t+=we[i&15]}return t}function Se(n){return n.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())}function Ze(n,e){let{hostname:t,pathname:r}=n;if(t.endsWith(".on.aws")){let a=t.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(t.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(t.endsWith(".backblazeb2.com")){let a=t.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}let i=t.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),s=i&&i[1]||"",o=i&&i[2];if(o==="us-gov")o="us-gov-west-1";else if(o==="s3"||o==="s3-accelerate")o="us-east-1",s="s3";else if(s==="iot")t.startsWith("iot.")?s="execute-api":t.startsWith("data.jobs.iot.")?s="iot-jobs-data":s=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(s==="autoscaling"){let a=(e.get("X-Amz-Target")||"").split(".")[0];a==="AnyScaleFrontendService"?s="application-autoscaling":a==="AnyScaleScalingPlannerFrontendService"&&(s="autoscaling-plans")}else o==null&&s.startsWith("s3-")?(o=s.slice(3).replace(/^fips-|^external-1/,""),s="s3"):s.endsWith("-fips")?s=s.slice(0,-5):o&&/-\d$/.test(s)&&!/-\d$/.test(o)&&([s,o]=[o,s]);return[Ve[s]||s,o||""]}var Q=3,et=[300,900],tt=200,rt=15e3,it=/<Key>([^<]*)<\/Key>/g,nt=/<NextContinuationToken>([^<]*)<\/NextContinuationToken>/,Ee=n=>new Promise(e=>setTimeout(e,n));function st(n){let e=n instanceof Error?n.name:"";return e==="TimeoutError"||e==="AbortError"?"timeout":"network"}async function ot(n){try{return await n.text()}catch{return""}}var K=class n{kind="s3";contractVersion=1;ceilingTier=1;client;base;prefix;pageSize;name;constructor(e){this.client=new L({accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,service:"s3",region:e.region}),this.base=e.endpoint?`${e.endpoint.replace(/\/+$/,"")}/${e.bucket}`:`https://${e.bucket}.s3.${e.region}.amazonaws.com`,this.prefix=e.prefix,this.pageSize=e.pageSize??1e3,this.name=e.name??"this location"}url(e){return`${this.base}/${this.prefix}${e}`}static line(e,t,r){return`${e} ${new URL(t).pathname} -> ${r}`}answer(e,t,r){let i=n.line(e,t,r);return r===404?new d("SYNC_LOCATION_UNREACHABLE",`nothing answered at ${this.base}: no bucket there`,"check the bucket name and the endpoint, then run the command again",i):r===401||r===403?new d("SYNC_LOCATION_DENIED",`the bucket at ${this.base} did not accept ${this.name}'s access keys, even for reading`,`ask the owner of the bucket for access, or bind it again with the right keys: kane-cli context sync add ${this.name} <descriptor> --credential-env <VAR>`,i):r>=500||r===429?this.unreachable(i):r===301||r===307||r===308?new d("SYNC_LOCATION_UNREACHABLE",`the bucket at ${this.base} answered with a redirect: it lives in another region or behind another endpoint`,`set region=<its region> (or endpoint=<its endpoint>) in the descriptor, then bind ${this.name} again`,i):new Error(i)}unreachable(e){return new d("SYNC_LOCATION_UNREACHABLE",`nothing answered at ${this.base}`,"check the endpoint and your network, then run the command again",e)}async request(e,t,r={}){let i="";for(let s=0;s<Q;s++){s>0&&await Ee(et[s-1]);let o;try{o=await fetch(await this.client.sign(t,{method:e,headers:r.headers,body:r.body&&new Uint8Array(r.body),signal:AbortSignal.timeout(rt)}))}catch(a){i=st(a);continue}if((o.status>=500||o.status===429)&&s<Q-1){i=String(o.status);continue}return o}throw this.unreachable(`${n.line(e,t,i)} after ${Q} attempts`)}async head(e){let t=await this.request("HEAD",this.url(e));if(t.status===200)return!0;if(t.status===404)return!1;throw this.answer("HEAD",this.url(e),t.status)}async bodyOf(e,t,r,i){try{return await i(e)}catch{throw this.unreachable(n.line(t,r,"body read failed"))}}async get(e){let t=await this.request("GET",this.url(e));if(t.status===200)return new Uint8Array(await this.bodyOf(t,"GET",this.url(e),r=>r.arrayBuffer()));if(t.status===404)return null;throw this.answer("GET",this.url(e),t.status)}async list(e){let t=[],r=null;do{let i=new URLSearchParams({"list-type":"2",prefix:this.prefix+e,"max-keys":String(this.pageSize)});r&&i.set("continuation-token",r);let s=`${this.base}?${i.toString()}`,o=await this.request("GET",s);if(o.status!==200)throw this.answer("GET",s,o.status);let a=await this.bodyOf(o,"GET",s,c=>c.text());for(let c of a.matchAll(it))t.push(c[1].slice(this.prefix.length));r=nt.exec(a)?.[1]??null}while(r);return t.sort()}async putIfAbsent(e,t){let r=await this.create(e,t);if(r!=="conflict")return r;if(await Ee(tt),await this.head(e))return"exists";let i=await this.create(e,t);if(i!=="conflict")return i;throw new Error(`${n.line("PUT",this.url(e),409)} twice (ConditionalRequestConflict) and the key is still absent`)}async create(e,t){let r=this.url(e),i=await this.request("PUT",r,{headers:{"If-None-Match":"*","Content-Type":"application/octet-stream"},body:t});if(i.status===200||i.status===201)return"created";if(i.status===412)return"exists";if(i.status===409&&(await ot(i)).includes("ConditionalRequestConflict"))return"conflict";throw i.status===401||i.status===403?new d("SYNC_LOCATION_REFUSED_WRITE",`${this.name}'s access keys cannot write to ${this.base}`,"ask the owner of the bucket for write access, or pull from it without pushing",n.line("PUT",r,i.status)):this.answer("PUT",r,i.status)}};import{chmodSync as at,mkdirSync as ct,readFileSync as ht,rmSync as dt,writeFileSync as ut}from"fs";import{join as be}from"path";var Te="context-sync",lt=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function k(n,e=A().baseDir){if(!lt.test(n))throw new Error(`bad location name ${JSON.stringify(n)} \u2014 letters, digits, dot, dash and underscore only`);return be(e,Te,`${n}.json`)}function _e(n,e=A().baseDir){let t=process.env.KANE_SYNC_S3_ACCESS_KEY_ID,r=process.env.KANE_SYNC_S3_SECRET_ACCESS_KEY;if(t&&r)return{accessKeyId:t,secretAccessKey:r};let i=k(n,e),s;try{s=ht(i,"utf-8")}catch{return null}let o=te(s,i);if(typeof o!="object"||o===null||!("accessKeyId"in o)||!("secretAccessKey"in o)||typeof o.accessKeyId!="string"||typeof o.secretAccessKey!="string")throw new Error(`${i} does not hold an access key and a secret \u2014 re-add the location to replace it`);return{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey}}function jt(n,e,t=A().baseDir){let r=k(n,t);ct(be(t,Te),{recursive:!0,mode:448}),ut(r,JSON.stringify(e)+`
13
+ `,{mode:384}),at(r,384)}function zt(n,e=A().baseDir){dt(k(n,e),{force:!0})}function Qt(n,e,t,r={}){switch(n.kind){case"fake":{let i=t?.get(n.location.slice(7));if(!i)throw new Error(`${n.location} is a test-only location and no test registered it`);return i}case"git":return new G({url:n.gitUrl,branch:n.branch,prefix:n.prefix,name:e});case"dir":return new D(n.path,{createRoot:r.createRoot});case"s3":{let i=_e(e);if(!i)throw new Error(`no credentials for ${e} \u2014 re-add it with --credential-env <VAR> or --credential-file <path> (kane-cli context sync add), set KANE_SYNC_S3_ACCESS_KEY_ID and KANE_SYNC_S3_SECRET_ACCESS_KEY, or write {"accessKeyId", "secretAccessKey"} to ${k(e)} with mode 0600`);return new K({endpoint:n.endpoint,region:n.region,bucket:n.bucket,prefix:n.prefix,name:e,...i})}}}export{H as a,ce as b,yt as c,wt as d,k as e,jt as f,zt as g,Qt as h};
14
+ /*! Bundled license information:
15
+
16
+ aws4fetch/dist/aws4fetch.esm.js:
17
+ (**
18
+ * @license MIT <https://opensource.org/licenses/MIT>
19
+ * @copyright Michael Hart 2024
20
+ *)
21
+ */
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{h as m,i as h,j as _,o as w,p as E,q as l,r as f,s as u,t as d,u as x}from"./chunk-2SWSVJUP.js";import{a as g,b as y}from"./chunk-KGNE5CIM.js";function C(t,e){let r=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;if(t.code==="TOO_SOON")return`${r!==null?`in ${Math.max(1,Math.ceil(r/60))} min, `:"later, "}kane-cli explore context sync ${e}`;if(t.code==="CONTEXT_OFF")return`kane-cli explore context on ${e}`}async function b(t,e,r){if(r.out&&!r.projectNames)return;let s=await new y({baseUrl:t.controllerBaseUrl,auth:t.basic,timeoutMs:w}).viewSummary(e),n=typeof s?.project_id=="string"?s.project_id:"";if(n)return(await E(r,t)([n]))[n]??n.slice(0,8)}function k(t){let e=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;return t.code==="TOO_SOON"&&e!==null?`TOO_SOON: the last cut was taken too recently (a run's end takes one too); the next can start in ${Math.max(1,Math.ceil(e/60))} min`:t.code==="CONTEXT_OFF"?`CONTEXT_OFF: assurance context is off for this exploration${typeof t.body?.off_reason=="string"?` (${t.body.off_reason})`:""}; turn it on with explore context on`:u(t)}async function N(t,e,r,s={}){let n=f(s,e,r),i=await l(r,`explore context ${t}`);if(!i.ok)return n.fail(i.error);let a=d(i);try{if(t==="sync"){let o=await a.syncContext(e);if(!n.tty)n.event({type:"explore_context_sync",exploration_id:e,state:o.state,job_id:o.job_id??null,cut:o.cut??null,trigger:o.trigger??null,running_job_id:o.running_job_id??null,hx_job_link:o.hx_job_link??null,...o.state==="failed"?{error:o.error??null}:{}});else if(o.state!=="failed")for(let O of h(e,o))n.out(O);return o.state==="failed"?n.fail(T(e,o),1,j(e,o)):n.ok()}let c=t==="status"?await a.getContext(e):await a.setContext(e,t==="on");if(!n.tty)n.event({type:"explore_context",exploration_id:e,action:t,context:c});else if(t==="status")for(let o of m(c,{project:await b(i,e,s)}))n.out(o);else for(let o of _(e,c,t,await b(i,e,s)))n.out(o);return n.ok()}catch(c){let o=A(c,t,e);return n.fail(o.message,o.code,o.next)}}function A(t,e,r){if(t instanceof g){if(t.code==="NO_ENDED_RUN")return{message:"NO_ENDED_RUN: no run of this exploration has ended yet; the first assurance job runs when one ends",code:1,next:"run it first: kane-cli explore run \u2026, then sync"};if(t.status===404)return{message:`exploration ${r} not found, or this service has no assurance context yet`,code:2};if(t.status===501)return{message:`this service has no assurance context yet (exploration ${r})`,code:2};if(t.code==="NOT_CONFIGURED")return{message:"NOT_CONFIGURED: assurance jobs are not set up on this service (no HyperExecute or report URL); context stays on and runs once they are",code:1};if(t.status===401||t.status===403)return{message:u(t),code:2};if(t.status<500){let s=C(t,r);return{message:k(t),code:1,...s?{next:s}:{}}}}return{message:`could not ${e==="status"?"read":e==="sync"?"sync":"change"} the assurance context: ${u(t)}`,code:1}}function T(t,e){return`${e.error?.code??"LAUNCH_FAILED"}: the assurance job could not launch${e.error?.message?` (${e.error.message})`:""}; explore context status ${t} shows it`}function j(t,e){let r=e.error?.code??"LAUNCH_FAILED";return`try again: kane-cli explore context sync ${t}${r==="HX_TRIGGER_FAILED"?"; or run with --local-orchestration":""}`}var $="usage: kane-cli explore context <status|on|off|sync> <exploration-id> (or explore context <exploration-id> on a terminal for the panel)";async function F(t,e,r={}){let s=f(r,t??null,e);if(!s.tty||!t)return s.fail($);let n=await l(e,"explore context");if(!n.ok)return s.fail(n.error);let{runContextPanel:i}=await import("./explore-context-tty-JTZVZFOE.js"),a=typeof e.env=="string"?e.env:"prod";return await i({client:d(n),explorationId:t,env:a})==="exit"?130:0}function p(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function U(t){let e=x(t.command("context").description("An exploration's assurance context (on by default): on, off, status, sync; with only the id, the panel on a terminal").argument("[exploration-id]","The exploration (no action: the context panel on a terminal)")).action(async(s,n)=>{process.exitCode=await F(s,p(n))}),r=[["status","Whether context is on, what is pending or running, and what the last assurance job did"],["on","Turn assurance context on (catches up from the newest ended run)"],["off","Turn assurance context off: the next cut is skipped; nothing already saved is deleted"],["sync","Ask for an assurance job now: launched, pending behind a running job, or up to date"]];for(let[s,n]of r)x(e.command(s).description(n).argument("<exploration-id>","The exploration")).action(async(i,a)=>{process.exitCode=await N(s,i,{...p(e.opts()),...p(a)})})}export{A as a,T as b,U as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{dirname as o,basename as s,join as r}from"path";function g(t){let n=s(t);return n.endsWith("_test.md")?n.slice(0,-8):n.endsWith("_module.md")?n.slice(0,-10):n.endsWith(".md")?n.slice(0,-3):n}function e(t){return r(o(t),`output-${g(t)}`)}function m(t){return r(e(t),"Result.md")}function u(t){return r(e(t),".internal")}function d(t){return r(u(t),"meta.json")}function f(t){return r(u(t),"execution.json")}function a(t,n,i){return r(e(t),`${n}-${i}-code`)}function x(t){return r(e(t),"generated-code")}function l(t){return e(t)+".staging"}function p(t){return r(u(t),"steps")}function D(t,n,i){return r(p(t),`${n}-${i}`)}export{g as a,e as b,m as c,u as d,d as e,f,a as g,x as h,l as i,p as j,D as k};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{i as o}from"./chunk-4I7YN6YY.js";import{fsyncSync as i}from"fs";function n(f){o()&&i(f)}export{n as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-HCBYKLMW.js";import{a as m,b as r,i as d}from"./chunk-33DWJV67.js";import{a as u}from"./chunk-6YGTRKDT.js";import{y as o}from"./chunk-I6OQISK4.js";import{e as s}from"./chunk-UR6MHSHU.js";var l=s(u(),1);var e=s(a(),1);function T({message:t,confirmLabel:c,choice:n}){return(0,e.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:o.dim,paddingX:1,children:[(0,e.jsx)(r,{bold:!0,children:t}),(0,e.jsxs)(m,{marginTop:1,children:[(0,e.jsx)(r,{color:n==="yes"?o.red:o.dim,children:`\u276F ${c}`}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:n==="no"?o.green:o.dim,children:"\u276F No"})]}),(0,e.jsx)(r,{color:o.dim,children:"\u2190 \u2192 choose \xB7 \u21B5 confirm \xB7 esc cancel"})]})}function y({message:t,onConfirm:c,onCancel:n,confirmLabel:p="Yes, end"}){let[f,g]=(0,l.useState)("no");return d((b,i)=>{(i.leftArrow||i.rightArrow)&&g(x=>x==="yes"?"no":"yes"),i.return&&(f==="yes"?c:n)(),i.escape&&n()}),(0,e.jsx)(T,{message:t,confirmLabel:p,choice:f})}export{y as a};
@@ -0,0 +1 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{m as d}from"./chunk-4I7YN6YY.js";function a(n,e){return n.trust.get(e)}function c(n,e){return a(n,e)==="derived"?"unreviewed":void 0}function u(n,e){let t=n.resolve(e);if(!t)return{ok:!1,code:"UNKNOWN_REF",detail:`${e} names nothing in the graph`};let r=t.tip,i=a(n,r),o=d(),s=o.command("next.review_use_case",{use_case:e});return i==="archived"?{ok:!1,code:"UC_ARCHIVED",detail:`${e} is archived (previously rejected by the owner) \u2014 re-approve it before designing`,ref:e,...s!==null?{reviewCmd:s}:{}}:i==="derived"?{ok:!1,code:"UC_UNREVIEWED",detail:o.text("UC_UNREVIEWED",{use_case:e}),ref:e,...s!==null?{reviewCmd:s}:{}}:{ok:!0}}function g(n,e){if(!e.useCase||e.allowUnreviewed||e.resuming&&e.sessionUseCase===e.useCase)return null;let t=u(n,e.useCase);return!t.ok&&(t.code==="UC_UNREVIEWED"||t.code==="UC_ARCHIVED")?t:null}function p(n){return n.code==="UC_UNREVIEWED"}function v(n,e){return a(n,e)==="derived"?"quarantine":"evidence-attach"}async function f(n,e){let t={id:"trust-gate",header:"unreviewed use-case",text:`design: ${e.detail??"this use-case is unreviewed"} \u2014 design against it anyway?`,risk:"high",rationale:e.reviewCmd?`approve it first: ${e.reviewCmd}`:"",options:[{label:"no \u2014 approve it first",detail:e.reviewCmd??"review it before designing"},{label:"design against it anyway",detail:"the design will build on an unreviewed use-case"}],recommended_index:0,allow_free_text:!1},r=await n([t]);return Array.isArray(r)?r.find(i=>i.id==="trust-gate")?.selected_index===1:!1}export{a,c as b,u as c,g as d,p as e,v as f,f as g};
@@ -0,0 +1,11 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as V,e as P,f as Ve,k as He}from"./chunk-LRS5MGBY.js";import{b as Pe}from"./chunk-QCKA665H.js";import{j as Oe,k as X}from"./chunk-QTZBVDPR.js";import{e as Re}from"./chunk-NWD54VV5.js";import{e as ge,i as he}from"./chunk-XMPTFXPW.js";import{h as Y}from"./chunk-L4UVUFL6.js";import{a as Me,b as Ue,c as De,d as te,g as Ce,m as ne,n as G,o as Ae,p as se,q as Be,r as je,s as re,t as Fe,u as Ge}from"./chunk-252FWF2G.js";import{e as Te}from"./chunk-FFL55I2M.js";import{a as ee,b as Se,c as _e}from"./chunk-JNSWKGTB.js";import{c as Ne,h as Ee}from"./chunk-UUJIGOEO.js";import{j as Le,k as $e}from"./chunk-ZTHYAHDN.js";import{f as xe,g as q,j as Z,n as ve}from"./chunk-AZLNLHUA.js";import{j as ke}from"./chunk-REKHAN53.js";import{b as F}from"./chunk-ZFM77AQU.js";import{b as Q}from"./chunk-SWMTXMKB.js";import{B as we,Ha as m,f as pe,p as Ie,w as be}from"./chunk-W3OVSDBN.js";import{a as E,e as ye}from"./chunk-I2MC6VVX.js";import{j as J}from"./chunk-UEE3RZN4.js";import{d as j}from"./chunk-DBMW3VUN.js";import{a as me}from"./chunk-FOJHSG5M.js";import{existsSync as oe,readFileSync as ae,statSync as H}from"fs";import{basename as de,extname as K}from"path";var ie=1024*1024,qe=1e3,Ze=e=>12e4+Math.ceil(e/ie)*1e3,v=e=>e>=ie?`${(e/ie).toFixed(1).replace(/\.0$/,"")} MB`:`${Math.max(1,Math.round(e/1024))} KB`,et=e=>new Promise(i=>setTimeout(i,e)),tt=e=>/^[a-z][a-z0-9+.-]*:/i.test(e)&&!oe(e);async function Ke(e,i,s,l){let o=new Map(l.map(a=>[a.sourceId,a.head])),d=[];for(let a of s){let r=o.get(a.sourceId);(r?await e.mainNode(i,r).then(f=>f.content.blob,()=>null):null)!==F(a.bytes)&&d.push(a)}return d}var nt=new Set(["KIND_MISMATCH","SITE_MOVED","UUID_MOVED","WEB_URL_CHANGED"]);function T(e){let i=e.code==="PLUGIN_HOOK_FAILED"||e.code==="PLUGIN_HOOK_TIMEOUT";return{refusal:{code:e.code,message:e.message,remedy:e.remedy??"check the source, then run the command again",...i?{support:!0}:{}},exit:i?1:2}}async function st(e,i,s){let l=i.plugin.manifest.id,o=ee(e),d;try{d=await _e(i.plugin,"claim",j.hookMs,()=>i.plugin.claim({ref:i.ref,named:i.named,isFile:o}))}catch(t){if(t instanceof Ne)return T(t.refusal);throw t}if(d==null)return T({code:"PLUGIN_NOT_CLAIMED",message:`plugin ${l} does not read ${i.ref}`,remedy:i.named?`drop the ${l}: prefix, or name the plugin that reads it`:"ingest it as a file of a built-in kind"});let a=d.sourceId;if(typeof a!="string")return T({code:"PLUGIN_HOOK_FAILED",message:`plugin ${l} answered claim with something that is not a claim`});let r=s??a;if(!Se(r))return T({code:"PLUGIN_SOURCE_ID_INVALID",message:`${JSON.stringify(r)} is not an id a source may have: it starts with a letter or digit and holds letters, digits and . _ -, at most 128 characters`,remedy:s===void 0?"give the source an id with --as <id>":"give another id with --as <id>"});let y={id:l,ref:i.ref,named:i.named,isFile:o},f=v(j.contentBytes);if(!o)return{item:{kind:"file",path:e,node:`ref:${e}`,file:e,bytes:Buffer.alloc(0),sourceId:r,limit:f,plugin:y}};let I=de(e),c;try{c=ae(e)}catch{return{refusal:m.ingestCantOpen(I),exit:2}}if(c.byteLength>j.contentBytes)return{refusal:m.ingestTooLarge(I,v(c.byteLength),f),exit:2};let{dev:u,ino:p}=H(e);return{item:{kind:"file",path:e,node:`${u}:${p}`,file:I,bytes:c,sourceId:r,limit:f,plugin:y}}}var S=e=>e.kind==="file"?e.path:e.address;function We(e){if(e.provider.name==="web")return`web|${e.sourceId}`;let i=new URL(e.address),s=e.provider.name.startsWith("linear")?`${i.host}/${i.pathname.split("/")[1]??""}`:i.host;return`${e.provider.name}|${s.toLowerCase()}|${e.sourceId}`}var rt=(e,i)=>e.kind==="file"?i.kind==="file"&&e.node===i.node:i.kind==="link"&&We(e)===We(i);async function it(e,i,s){let l=new Map;for(let t of e)l.set(t.sourceId,[...l.get(t.sourceId)??[],t]);let o=[...l.values()].filter(t=>t.length>1);if(o.length===0)return null;let d=i?.map(t=>t.sourceId)??null,a=new Set(o.flatMap(t=>t.slice(1))),r=new Set([...l.keys(),...d??[]]),y=t=>{if(d===null)return null;let R=2;for(;r.has(`${t}-${R}`);)R++;return r.add(`${t}-${R}`),`${t}-${R}`},f=t=>t.kind==="file"?t.path:te(t.provider.name,t.address),I=new Set(i?.filter(t=>t.head!==null).map(t=>t.sourceId)),c=e.filter(t=>!a.has(t)&&I.has(t.sourceId)),u=await s(c.flatMap(t=>t.kind==="file"?[t]:[])),p=e.filter(t=>!a.has(t)&&!u.includes(t));return je(o.map(t=>({names:t.map(f),id:t[0].sourceId})),p.map(S),e.filter(t=>a.has(t)).map(t=>({ref:S(t),as:y(t.sourceId),place:l.get(t.sourceId).indexOf(t)+1})),{reviews:u.flatMap(t=>t.kind==="file"?[{name:t.file,ref:t.path,id:t.sourceId}]:[]),link:c.some(t=>t.kind==="link"),firstTwin:p.some(t=>l.get(t.sourceId).length>1)})}async function Ft(e){try{return await ot(e)}finally{await be()}}async function ot(e){let i=e.mode==="agent",s=n=>i?ke(ge("ndjson",n,e.testing?.agentLines?{stdout:e.testing.agentLines,stderr:()=>{}}:void 0),{atQuestionsOnly:!0}):null,l=s("extract");l&&e.choice.onboarded&&l.event({type:"folder_linked",project_id:e.choice.projectId,project:e.choice.projectName});let o=(n,h,g=!1,O=l)=>O?(O.event({type:"error",code:n.code,message:n.message,...we(n),...n.notAdded?{not_added:n.notAdded}:{}}),O.done(h,"refused")):(g&&e.choice.onboarded?process.stdout.write(`${Oe(e.choice.projectName)}
3
+ `):e.mode==="interactive"&&process.stdout.write(`
4
+ `),X(n),process.stdout.write(`
5
+ `),h),d=(n,h)=>o(n,h,!0),a=(n,h)=>h.length>0?{...n,detail:Fe(h.map(g=>g.name)),notAdded:h.map(g=>g.ref)}:n;if(e.opts.plan)return d(m.notYet("context ingest --plan"),2);if(e.opts.as!==void 0&&e.paths.length>1)return d(Be(e.paths),2);let r=[],y=n=>{r.some(h=>rt(h,n))||r.push(n)},f=q.flatMap(n=>n.extensions).join(" ");for(let n of e.paths){let h=r.map(k=>({name:k.kind==="file"?k.file:te(k.provider.name,k.address),ref:S(k)})),g=(k,Ye)=>d(a(k,h),Ye),O=Ee().route(n,ee);if(O!==null){let k=await st(n,O,e.opts.as);if("refusal"in k)return g(k.refusal,k.exit);y(k.item);continue}if(Le(n)){let k=$e(n);if(!k?.fetch)return g(se(n),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);y({kind:"link",address:n,provider:k,sourceId:e.opts.as??k.sourceIdFor(n)??n});continue}if(tt(n))return g(se(n),2);let w=de(n),L=Z(n);if(!L.ok)return g(m.ingestUnsupported(`${w} is a file type kane can't ingest (${K(n)||"no extension"}) \u2014 supported: ${f}`),2);if(!oe(n)||!H(n).isFile())return g(m.ingestNoFile(n),2);let D;try{D=ae(n)}catch{return g(m.ingestCantOpen(w),2)}if(D.byteLength>L.media.maxBytes)return g(m.ingestTooLarge(w,v(D.byteLength),v(L.media.maxBytes)),2);if(L.media.sniff&&!L.media.sniff(D))return g(m.ingestNotItsType(w,K(n).slice(1)),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);let fe;try{fe=e.opts.as??ve(n)}catch{return g(m.ingestNoSourceId(w),2)}let{dev:Je,ino:Qe}=H(n);y({kind:"file",path:n,node:`${Je}:${Qe}`,file:w,bytes:D,sourceId:fe,limit:v(L.media.maxBytes)})}let I=r[0],c;try{c=e.testing?.basicAuth??await Re()}catch(n){if(!(n instanceof he))throw n;return d({code:n.code,message:n.message,...n.remedy?{remedy:n.remedy}:{}},2)}let u=pe({url:e.choice.latticeUrl,basicAuth:c,...e.testing?.run?.fetch?{fetch:e.testing.run.fetch}:{}}),p=e.choice.projectId,t=null,R=null;try{t=await u.sources(p)}catch(n){n instanceof E&&(n.code==="NO_CONTEXT"||n.code==="NOT_FOUND")?t=[]:R=n}let b=await it(r,t,n=>Ke(u,p,n,t??[]));if(b)return d(b,2);if(t===null){let{exit:n,...h}=Pe(R,e.choice,null);return d(h,n)}let x=new Set(t.filter(n=>n.head!==null).map(n=>n.sourceId)),$=r.filter(n=>x.has(n.sourceId)),N=$.flatMap(n=>n.kind==="file"?[n]:[]);if(r.length>1&&N.length>0&&N.length===$.length){let n=await Ke(u,p,N,t);if(n.length>0){let h=n.map(g=>({name:g.file,ref:S(g),id:g.sourceId}));return d(re(h,r.filter(g=>!n.includes(g)).map(S),e.choice.projectName),2)}}let M=r.length===1?$[0]:void 0;if(M){let{reviewNewVersion:n}=await import("./reconcile-remote-GWDV5CUT.js"),h=e.mode==="interactive";h&&!e.choice.onboarded&&process.stdout.write(`using project "${e.choice.projectName}", shared with your team
6
+ `);let g=s("reconcile");return n({choice:e.choice,person:u,basicAuth:c,item:M,...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,mode:e.mode==="agent"?"agent":h?"interactive":"ci",io:g,refuse:(O,w=2)=>o(O,w,!1,g),projectLine:h,nothing:(O,w)=>`${h?` ${me.green("\u2714")} `:""}${O} is already in "${w}", unchanged`,...e.testing?{testing:e.testing}:{}})}let C=e.testing?.run?.retryDeadlineMs??12e4,ze=dt(e.testing?.remoteDeps),le=[],_=r.map((n,h)=>{let g=at({person:u,choice:e.choice,item:n,first:h===0,then:e.mode==="ci"?"pause":"extract",...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,retryMs:C,remoteDeps:ze,refusal:O=>a(O,_.slice(0,h).map(w=>({name:w.name??w.file,ref:w.path??w.file}))),alone:O=>re(O.map(w=>{let L=_[w].remote;return{name:_[w].name??_[w].file,ref:S(r[w]),id:r[w].sourceId,...L?{shown:Te({source:r[w].sourceId,page:Ce({...L,address:L.origin.url})})}:{}}}),r.filter((w,L)=>!O.includes(L)).map(S),e.choice.projectName),...e.testing?{testing:e.testing}:{}});return le.push(g.ended),g.step}),ce={verb:"extract",choice:e.choice,start:{kind:"new",body:{projectId:p,verb:"extract",mode:e.mode==="interactive"?"interactive":"agent",sourceId:I.sourceId}},run:{source:I.sourceId,...e.opts.force?{force:!0}:{},...e.opts.trust!==void 0?{trust:e.opts.trust}:{}}},A=e.testing?.remoteDeps?{...e.testing.run,remoteDeps:e.testing.remoteDeps}:e.testing?.run,U;if(e.mode==="interactive"){let{runInteractiveRemote:n}=await import("./interactive-remote-D77ULJGL.js");U=await n({...ce,subject:I.kind==="link"?De(I.provider.name,I.address):I.sourceId,ingest:_,testing:{basicAuth:c,...e.testing?.check?{check:e.testing.check}:{},...A?{run:A}:{},...e.testing?.mount?{mount:e.testing.mount}:{},...e.testing?.onController?{onController:e.testing.onController}:{}}})}else U=await He({...ce,mode:"agent",basicAuth:c,io:l,check:e.testing?.check??Ve,onProgress:()=>{},ingest:_,signals:!0,onRefusal:n=>{X(n),process.stdout.write(`
7
+ `)},...A?{testing:A}:{}});let W=le.map(n=>n()),B=[...W].reverse().find(n=>n.sid!==null)?.sid??null,ue=W.flatMap(n=>n.added!==null?[{name:n.name,status:n.added}]:[]),z=W.find(n=>n.refused!==null)?.refused??null;if(z!==null)return o(z.refusal,z.exit);if(e.mode==="ci"&&ue.length>0&&B!==null){let n=ue.map(({name:h,status:g})=>g==="unchanged"?`${h} is already in "${e.choice.projectName}", unchanged`:g==="versioned"?`added a new version of ${h} to session ${B}, not saved yet`:`added ${h} to session ${B}, not saved yet`);return process.stdout.write(`${n.join(`
8
+ `)}
9
+ extract: kane-cli context extract --resume ${B}
10
+
11
+ `),U}return l?l.done(U):U}function at(e){let{person:i,item:s}=e,l=e.choice.projectId,o={sid:null,added:null,behind:0,unread:!1,refused:null},d=()=>{},a=null,r=s.kind==="link"?s:null,y=e.refusal??(u=>u),f=s.kind==="file"?s.limit:"",I=s.kind==="file"?s.plugin:void 0,c={...I?{plugin:I,...I.isFile?{}:{deferred:!0}}:{},file:s.kind==="file"?s.file:Ue(s.provider.name,s.address),path:s.kind==="file"?s.path:s.address,bytes:s.kind==="file"?s.bytes:Buffer.alloc(0),sourceId:s.sourceId,then:e.then,...r?{fetch:async u=>{u({kind:"fetching",file:c.file,ref:r.address,provider:r.provider.name,...e.first?{subject:!0}:{}});let p=await r.provider.fetch(r.address,e.as,await e.remoteDeps());if(!p.ok){let R=ne(r.provider.name,r.address,p.failure);throw new P(y(R),R.support?1:2,`the fetch refused ${r.address}: ${p.failure.code}`)}let t=p.fetched;if(f=v(t.media.maxBytes),t.bytes.byteLength>t.media.maxBytes)throw new P(y(G(r.provider.name,r.address,v(t.bytes.byteLength),f)),2,`${t.bytes.byteLength} bytes`);c.name=c.file=Me(t),c.bytes=t.bytes,c.sourceId=t.sourceId,c.remote={provider:t.provider,mediaType:t.media.media_type,label:t.label,display:t.display,...t.title!==void 0?{title:t.title}:{},origin:t.origin,identity:t.identity,...t.downloads?{downloads:t.downloads}:{}}}}:{},upload:(u,p)=>{d=u;let{file:t,bytes:R}=c;return ft(i,l,{file:t,name:c.name??t,bytes:R,sourceId:c.sourceId,...c.remote?{typed:{mediaType:c.remote.mediaType,origin:c.remote.origin}}:I?{typed:{mediaType:xe.media_type}}:{},tooLarge:()=>r?G(r.provider.name,r.address,v(R.byteLength),f):m.ingestTooLarge(t,v(R.byteLength),f),supported:e.supported,projectName:e.choice.projectName,onboarded:e.choice.onboarded===!0,progress:u,...e.first?{subject:!0}:{},stopped:p,hashedCapMs:e.testing?.hashedCapMs??Ze(R.byteLength),pollMs:e.testing?.pollMs??qe,seen:e.testing?.onUploadState},b=>a=b).catch(b=>{throw b instanceof P?new P(y(b.refusal),b.exit,b.detail):b})},result:async(u,p,t)=>{if(o.sid=p,I&&a===null){if(u.outcome!=="refused")return!0;t(`the plugin lane refused ${c.file}: ${u.code}: ${u.message}`);let x=T({code:u.code,message:u.message,...u.facts?.remedy?{remedy:u.facts.remedy}:{}});return o.refused??={refusal:y(x.refusal),exit:x.exit},!1}let R=u.outcome==="refused"?{sessionId:p,outcome:"refused",code:u.code,message:u.message}:{sessionId:p,outcome:u.outcome};u.outcome==="refused"&&t(`the conversion refused ${c.file}: ${u.code}: ${u.message}`);let b=await lt(i,l,a,R,e.retryMs,d);if(b.taken?e.testing?.onUploadState?.(a,b.state):t(`the upload's result (${R.outcome}) was not taken: ${b.why}`),u.outcome==="refused"){let{code:x,message:$,facts:N}=u;if(x==="NEW_VERSION_ALONE"&&e.alone)return o.refused??={refusal:e.alone((N?.newVersions??"").split(",").map(Number)),exit:2},!1;let M=v(c.bytes.byteLength),C=r?ut(r.provider.name,r.address,e.choice.projectName,{code:x,message:$,...N?{facts:N}:{}},M,f):I&&x.startsWith("PLUGIN_")?T({code:x,message:$,...N?.remedy?{remedy:N.remedy}:{}}):ct(c.file,x,$,M,f);return o.refused??={refusal:y(C.refusal),exit:C.exit},!1}if(b.taken)return!0;if(o.refused??={refusal:y(m.resultRefused(c.name??c.file)),exit:1},b.refusedBy){let x=b.refusedBy;await i.uploadResult(l,a,{sessionId:p,outcome:"refused",code:x.code,message:x.message}).catch($=>t(`the refused result was not posted: ${$ instanceof Error?$.message:String($)}`))}return!1},cancel:async u=>{a!==null&&await i.uploadResult(l,a,{sessionId:u,outcome:"refused",code:"CANCELLED",message:"stopped before the file was added"})},onAdded:(u,p,t)=>{o.sid=p,o.added=u,o.behind=t.behind??0,o.unread=t.unread===!0},onUnwritten:u=>{o.sid=u,o.refused??={refusal:y(m.resultRefused(c.name??c.file)),exit:1}}};return{step:c,ended:()=>({...o,name:c.name??c.file})}}function dt(e){return async()=>{if(!e)return{credentials:Q};let i=await import(e.module);return{credentials:Q,...i.remoteDepsFor(e.name)}}}function Gt(e){let i=de(e),s=Z(e),l=q.flatMap(a=>a.extensions).join(" "),o=a=>({ok:!1,refusal:a});if(!s.ok)return o(m.ingestUnsupported(`${i} is a file type kane can't ingest (${K(e)||"no extension"}) \u2014 supported: ${l}`));if(!oe(e)||!H(e).isFile())return o(m.ingestNoFile(e));let d;try{d=ae(e)}catch{return o(m.ingestCantOpen(i))}return d.byteLength>s.media.maxBytes?o(m.ingestTooLarge(i,v(d.byteLength),v(s.media.maxBytes))):s.media.sniff&&!s.media.sniff(d)?o(m.ingestNotItsType(i,K(e).slice(1))):{ok:!0,file:i,bytes:d,limit:v(s.media.maxBytes),supported:l}}async function lt(e,i,s,l,o,d){let a=ye(o),r=null;for(;;)try{return{taken:!0,state:(await e.uploadResult(i,s,l)).state}}catch(f){if(r=f,!(f instanceof E))break;if(!f.retryable)return{taken:!1,why:`${f.code}: ${f.message}`,refusedBy:f};let I=c=>d({kind:"retry",attempt:a.attempt,nextInS:Math.ceil(c/1e3),giveUpAt:new Date(a.endsAt()??Date.now()).toISOString(),cause:Ie(f)});if(!await a.again(I))break}let y=await e.getUpload(i,s).catch(()=>null);return y!==null&&y.state===l.outcome&&y.sessionId===l.sessionId?{taken:!0,state:y.state}:{taken:!1,why:`no answer, and the upload reads ${y?.state??"unknown"}: ${r instanceof Error?r.message:String(r)}`}}function ct(e,i,s,l,o){if(i==="FILE_TOO_LARGE")return{refusal:m.ingestTooLarge(e,l,o),exit:2};if(i==="UNSUPPORTED_MEDIA")return{refusal:m.ingestUnsupported(s),exit:2};if(i==="PROJECTION_TOO_LARGE")return{refusal:m.ingestTextTooLarge(e),exit:2};let d=m.conversionRefused(e,i);return{refusal:d,exit:d.support?1:2}}function ut(e,i,s,l,o,d){if(nt.has(l.code))return{refusal:Ae(e,i,l,s),exit:2};if(l.code==="FILE_TOO_LARGE"||l.code==="PROJECTION_TOO_LARGE")return{refusal:G(e,i,o,d),exit:2};let a=ne(e,i,l);return{refusal:a,exit:a.support?1:2}}async function ft(e,i,s,l){let{file:o,name:d,bytes:a}=s,r=(t,R,b)=>{throw new P(t,R,b instanceof Error?b.message:String(b))},y=t=>{if(!(t instanceof E))throw t;return t.code==="UNREACHABLE"?r(/no answer within/.test(t.message)?m.uploadStalled(d):m.uploadDropped(d),/no answer within/.test(t.message)?1:2,t):t.code==="TOO_LARGE"?r(s.tooLarge(),2,t):t.code==="UPLOAD_NOT_OPEN"&&t.extra.state==="expired"?r(m.uploadExpired(d),2,t):t.code==="MARK_REFUSED"?(s.onboarded&&Y(process.cwd()),r(m.markRefused(s.projectName,s.onboarded),2,t)):t.code==="PROJECT_NOT_MARKED"?(s.onboarded&&Y(process.cwd()),r(m.assuranceOff(s.projectName),2,t)):r(m.uploadNotTaken(d),1,t)},f;try{f=await e.openUpload(i,s.typed?{sourceId:s.sourceId,bytes:a.byteLength,mediaType:s.typed.mediaType,...s.typed.origin?{origin:s.typed.origin}:{}}:{sourceId:s.sourceId,filename:o,bytes:a.byteLength})}catch(t){return s.typed&&t instanceof E&&t.code==="BAD_REQUEST"?r(Ge(s.projectName),2,t):t instanceof E&&t.code==="BAD_REQUEST"&&/not a type a source can be/.test(t.message)?r(m.ingestUnsupported(`${o} is a file type kane can't ingest \u2014 supported: ${s.supported}`),2,t):y(t)}l(f.uploadId),s.seen?.(f.uploadId,"open");let I=s.subject?{subject:!0}:{};s.progress({kind:"upload",file:o,sentBytes:0,totalBytes:a.byteLength,...I});let c;try{if({etag:c}=await e.putUpload(f.url,f.headers,a,(R,b)=>s.progress({kind:"upload",file:o,sentBytes:R,totalBytes:b,...I})),s.progress({kind:"upload",file:o,sentBytes:a.byteLength,totalBytes:a.byteLength,...I}),s.stopped())throw new V;let t=await e.completeUpload(i,f.uploadId,c);s.seen?.(f.uploadId,t.state)}catch(t){if(t instanceof V)throw t;t instanceof E&&t.code==="UPLOAD_NOT_OPEN"&&["hashed","created","unchanged","refused"].includes(String(t.extra.state))||y(t)}s.progress({kind:"reading",file:o});let u=Date.now()+s.hashedCapMs,p;for(;;){if(s.stopped())throw new V;try{p=await e.getUpload(i,f.uploadId)}catch(t){return y(t)}if(s.seen?.(f.uploadId,p.state),p.state==="hashed")break;if(p.state==="failed")return r(m.uploadNotTaken(d),1,`the hash failed: ${p.reason?.code??""}`);if(p.state==="expired")return r(m.uploadExpired(d),2,"the upload's window ended");if(Date.now()>=u)return r(m.uploadStalled(d),1,`not hashed within ${s.hashedCapMs} ms (${p.state})`);await et(s.pollMs)}return p.fingerprint!==F(a)?r(m.uploadNotTaken(d),1,`Lattice hashed ${p.fingerprint}, not ${F(a)}`):{uploadId:f.uploadId,fingerprint:p.fingerprint}}export{tt as a,T as b,st as c,Ft as d,at as e,dt as f,Gt as g};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as i}from"./chunk-5GUD3CIH.js";function c(t){let o=[];t.executionId&&o.push({label:"execution",kind:"execution",packPath:i(t.executionId,t.cwd),status:t.executionStatus??"passed"});for(let e of t.authored)e.executionId&&o.push({label:e.relPath,kind:"authored",packPath:i(e.executionId,t.cwd),status:e.overallStatus,...e.testId?{testId:e.testId}:{},...e.commitId?{commitId:e.commitId}:{},...e.sourceExecutionId?{sourceExecutionId:e.sourceExecutionId}:{}});return o}function s(t){return t.map(o=>`kane-cli evidence serve ${o.packPath} # ${o.kind==="authored"?`${o.label} (authored)`:o.label}`)}export{c as a,s as b};
2
+ import{b as i}from"./chunk-HQ2E2XCU.js";function c(t){let o=[];t.executionId&&o.push({label:"execution",kind:"execution",packPath:i(t.executionId,t.cwd),status:t.executionStatus??"passed"});for(let e of t.authored)e.executionId&&o.push({label:e.relPath,kind:"authored",packPath:i(e.executionId,t.cwd),status:e.overallStatus,...e.testId?{testId:e.testId}:{},...e.commitId?{commitId:e.commitId}:{},...e.sourceExecutionId?{sourceExecutionId:e.sourceExecutionId}:{}});return o}function s(t){return t.map(o=>`kane-cli evidence serve ${o.packPath} # ${o.kind==="authored"?`${o.label} (authored)`:o.label}`)}export{c as a,s as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as G,f as K,h as j}from"./chunk-VG44B5JD.js";import{a as q,b as z,d as V,e as H}from"./chunk-RFIIM33J.js";import{a as J,b as y,c as Q}from"./chunk-SA6IKFFD.js";import{a as N,b as L,c as O}from"./chunk-DHQ4SQWA.js";import{d as B,f as $}from"./chunk-2OOFURWD.js";import{a as E}from"./chunk-MMBBQ4OZ.js";import{b as R,c as I,j as U}from"./chunk-D4FFXCX6.js";import{a as F}from"./chunk-TZXXJWHA.js";import{e as S}from"./chunk-Z7S3IWUX.js";import{n as h}from"./chunk-NC7D7GOM.js";import{b as _,r as C,s as P}from"./chunk-A7RJQJNT.js";function W(e){return e.kind==="simulator"?e.id:e.virtualName??e.id}function X(e,r,o={}){let t={platform:e.platform,udid:e.id,target:e.kind};return r&&(t.app_package=r),o.noReset!==void 0&&(t.no_reset=o.noReset),o.appiumUrl&&(t.appium_url=o.appiumUrl),e.platform==="android"&&o.autoGrantPermissions!==void 0&&(t.auto_grant_permissions=o.autoGrantPermissions),e.platform==="ios"&&o.autoAcceptAlerts!==void 0&&(t.auto_accept_alerts=o.autoAcceptAlerts),t}function Y(e=process.env){let r=e.KANE_APPIUM_URL?.trim();return r||null}function m(e){return`${e.platform}|${W(e)}`}var g=new Map,Z=new Set;function ee(e){return Z.has(m(e))}function ye(e,r,o){r.state==="stopped"&&(g.has(m(r))||oe(e,r,o))}async function re(e,r,o){let t=g.get(m(r));return t?(o?.(`waiting for ${r.displayName} to finish booting\u2026`),t):oe(e,r,o)}function oe(e,r,o){let t=m(r),a=e.prepare(r,o);g.set(t,a),r.state==="stopped"&&a.then(()=>Z.add(t),()=>{});let n=()=>{g.get(t)===a&&g.delete(t)};return a.then(n,n),a.catch(()=>{}),a}import{basename as le}from"path";import{spawnSync as pe}from"child_process";async function de(e,r,o){if(!e.teardownPlan||!o.appPackage&&!o.shutdown)return;let t;try{t=await e.teardownPlan(r,o)}catch{return}t.length!==0&&h(`device:${r.id}`,()=>{G({udid:r.id,displayName:r.displayName});for(let a of t)try{pe(a.file,a.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var te={emulator:[".apk"],simulator:[".zip"]};async function ce(e,r,o,t){if(e.kind==="package")return e;if(e.kind==="app_id"){let a=r.cloudUpload;if(!a)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let n=await Q({appId:e.value,baseUrl:a.baseUrl,auth:a.auth,...te[o]?{accepts:te[o]}:{},...t?{onProgress:t}:{}}),s=x(n.path);if(!s||s.kind==="app_id")throw new Error(`${n.name} is not a build this CLI can install (from ${e.value}).`);return s}try{let a=new q,n=await V(e.value,a),s=new J;await s.find(n)||t?.(`copying ${le(e.value)} into the local app store\u2026`);let i=await s.put({key:n,sourcePath:e.value,source:"local"});return{...e,value:i.path}}catch{return e}}function ue(e){h(`appium:${e}`,()=>{j({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},v=class extends Error{constructor(o,t){super(o);this.doctorText=t;this.name="MobilePreflightError"}};async function ge(e,r,o){let t=o.cloudUpload,a=await H({path:e,type:r,env:t.env,orgId:t.orgId,userId:t.userId,auth:t.auth,baseUrl:t.baseUrl,...o.onProgress?{onProgress:o.onProgress}:{}});if(z(a)){o.onProgress?.(`app not uploaded \u2014 ${a.reason}`);return}return a.appId}var fe="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",ae=C(_);function x(e){let r=e.trim();if(y(r))return{kind:"app_id",value:r};let o=P(r,ae);return o?{kind:o.slice(1),value:r}:null}function me(e){return!!e&&(P(e,ae)!==void 0||y(e.trim()))}function ve(e){return e.filter(r=>r.required&&r.status==="fail")}function be(e,r){return!!r&&S(e,r)}async function Ke(e){let r=F();if(!r.supported)throw new k(r.reason);let o=Y()??e.appiumUrl??e.defaults?.appium_url,t=!!(e.agent||!e.interactive),a=U(),n=!!E();t&&e.platform?.toLowerCase()!=="ios"&&!n&&((await a.status("emulator")).installed||await a.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let s=await N(e.platform,{appiumUrl:o});if(O(s)){let l=s.sections.flatMap(w=>ve(w.checks)).map(w=>w.label).join(", ");throw new v(`Mobile toolchain not ready (${l}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,L(s))}let p=await $({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),i;if(p.ok)i=p.target;else if(p.reason==="needs-picker"&&e.pickTarget){let l=await e.pickTarget(p.candidates);if(!l)throw new Error("Target selection cancelled");i=l}else throw new Error(p.message);let u=B(i.platform);if(!u)throw new Error(`No provider for platform "${i.platform}"`);let d=R(i);if(!d)throw new Error(`No managed dependencies serve ${i.platform} ${i.kind} targets yet.`);if(!(n&&i.platform.toLowerCase()==="android"))try{await a.ensure(d,{automatic:t,onProgress:e.onProgress})}catch(l){throw l instanceof I?new v(l.message,l.message):l}let ie=i.state!=="ready"||ee(i);i=await re(u,i,e.onProgress);let ne=await K(d,{...o?{appiumUrl:o}:{},device:{udid:i.id,displayName:i.displayName},onProgress:e.onProgress});ue(d);let D=be(i,e.defaults?.default_target)?e.defaults?.default_app:void 0,f=e.app??(me(D)?D:void 0);if(e.app&&!x(e.app))throw new Error(`${e.app}: ${fe}`);let c=f?x(f):null,M=c?await ce(c,e,d,e.onProgress):null,b=M?await u.ensureApp(i,M,e.onProgress):void 0,T=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&f?await ge(c.value,d,e):void 0;await de(u,i,{shutdown:ie,...b?{appPackage:b}:{}});let se=X(i,b,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ne.url,autoGrantPermissions:e.defaults?.auto_grant_permissions,autoAcceptAlerts:e.defaults?.auto_accept_alerts}),A=T??f;return{device:se,target:i,provider:u,...T?{appId:T}:{},...A?{appRef:A}:{}}}export{W as a,X as b,ye as c,re as d,k as e,v as f,fe as g,x as h,me as i,Ke as j};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as d}from"./chunk-73ZFOJOK.js";import{a as m}from"./chunk-EF47KRUK.js";import{da as u}from"./chunk-UEE3RZN4.js";function h(e,r){return`${e}:hold:${r}`}function g(e,r){let n=[],o=[];for(let i of e.use_cases){let c=i.matches_existing;c?.cid&&r.hasNode(c.cid)?n.push({ref:c.cid,expectedTip:r.tipOf(c.cid)}):o.push({tempRef:i.temp_ref,title:String(i.title??""),probeText:String(i.title??"")})}return{verb:"extract",ucTargets:n,newBuCandidates:o,sourcePins:[{source_id:e.source.source_id,source_cid:e.source.source_cid}],readBasis:e.read_basis??null}}async function b(e){let r=d(e.proposal),n=t=>r.passthrough.use_cases.filter(a=>{let l=a.matches_existing?.cid,s=l?t.resolve(l):null,p=s?t.tipOf(s.cid):null;return p!=null&&(e.matchUnreviewed===!0||(t.trust.get(p)??null)!=="derived")}),o=n(e.graph),i=new Set(o.map(t=>t.temp_ref));return{ok:(await m(e.ctx,{...g({...r.passthrough,use_cases:o},e.graph),eventIds:[h(e.sid,e.proposalId)]},t=>{let a={...r.passthrough,use_cases:n(t.graph).filter(p=>i.has(p.temp_ref))},l=new Map(a.use_cases.map(p=>[p.temp_ref,{resolution:"approved"}])),s=u({store:e.store,graph:t.graph,scope:t.scope,proposal:a,proposalId:e.proposalId,verdicts:l,by:e.by,autoName:!0,allowStaleBasis:!0,eventIds:t.eventIds("extract",1),...e.durable?{sid:t.sid}:{},probeHits:t.probeHits,...e.matchUnreviewed?{matchUnreviewed:!0}:{}});return s.errors!==null?{errors:s.errors}:{result:s,record:s.record}})).ok,skippedAttach:r.passthrough.use_cases.length-o.length}}export{h as a,g as b,b as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{createHash as s}from"crypto";function f(n){if(n===null)return"null";let t=typeof n;if(t==="string")return JSON.stringify(n.normalize("NFC"));if(t==="boolean")return n?"true":"false";if(t==="number"){if(!Number.isFinite(n))throw new Error("non-finite number is not canonicalizable");return JSON.stringify(n)}if(Array.isArray(n))return"["+n.map(i=>i===void 0?"null":f(i)).join(",")+"]";if(t==="object"){let i=n,e=new Map;for(let r of Object.keys(i)){if(i[r]===void 0)continue;let o=r.normalize("NFC");if(e.has(o))throw new Error(`canonicalization collision: NFC-equivalent duplicate key ${JSON.stringify(o)}`);e.set(o,i[r])}return"{"+[...e.keys()].sort((r,o)=>Buffer.compare(Buffer.from(r,"utf8"),Buffer.from(o,"utf8"))).map(r=>JSON.stringify(r)+":"+f(e.get(r))).join(",")+"}"}throw new Error("unsupported type for canonicalization: "+t)}function a(n){return s("sha256").update(n).digest("hex")}export{f as a,a as b};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{Ea as L,Ua as U}from"./chunk-UEE3RZN4.js";import{a as E}from"./chunk-7DFBOVUB.js";var x="ckpt/1";var B="checkpoints",m="base.json",y=t=>`delta-${t}.json`,w=t=>`full-${t}.json`,re=["turn","ask","final"],se=["extract","design","walk"];function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return Array.isArray(t)&&t.every(r=>typeof r=="string")}function K(t){let r=[],e=(n,i)=>{n||r.push(i)};if(!d(t))return{ok:!1,errors:["record: not an object"]};e(t.schema===x,`schema: expected "${x}"`);let s=t.kind;if(s==="base")e(typeof t.sid=="string"&&t.sid.length>0,"base.sid: non-empty string"),e(typeof t.verb=="string"&&se.includes(t.verb),"base.verb: extract|design|walk"),e(typeof t.mode=="string","base.mode: string"),e(typeof t.created_at=="string","base.created_at: string"),e(d(t.run_config),"base.run_config: object"),d(t.run_config)&&e(!("resume"in t.run_config),"base.run_config: must not carry `resume`"),e(typeof t.conv_source=="string",'base.conv_source: string ("" when absent)'),e(typeof t.store_watermark=="string"||t.store_watermark===null,"base.store_watermark: string | null (null = genesis)");else if(s==="delta"||s==="full"){e(typeof t.sid=="string"&&t.sid.length>0,"delta.sid: non-empty string"),e(Number.isInteger(t.seq)&&t.seq>=1,"delta.seq: integer \u2265 1"),e(Number.isInteger(t.turn_id),"delta.turn_id: integer"),e(typeof t.at=="string"&&re.includes(t.at),"delta.at: turn|ask|final"),e(typeof t.ts=="string","delta.ts: string");let n=t.agent;if(d(n)){e(Number.isInteger(n.agent_state_schema),"agent.agent_state_schema: integer"),e(Array.isArray(n.delta_items),"agent.delta_items: array"),e(d(n.binding),"agent.binding: object");let o=n.usage_total;e(d(o)&&typeof o.input_tokens=="number"&&typeof o.output_tokens=="number"&&typeof o.credits=="number","agent.usage_total: {input_tokens, output_tokens, credits} numbers"),n.base_fingerprint!==void 0&&e(typeof n.base_fingerprint=="string","agent.base_fingerprint: string when present"),s==="full"&&e(typeof n.base_fingerprint=="string","full: agent.base_fingerprint required")}else r.push("delta.agent: object");let i=t.kane;if(d(i)){e(D(i.applied_events),"kane.applied_events: string[]"),e(D(i.held_receipts),"kane.held_receipts: string[]");let o=i.pending;e(d(o)&&Array.isArray(o.questions)&&Array.isArray(o.proposals),"kane.pending: {questions[], proposals[]}"),e(Array.isArray(i.parent_asks),"kane.parent_asks: array"),e(d(i.read_basis),"kane.read_basis: object");let p=i.corpus_cursor;if(e(d(p)&&D(p.remaining),"kane.corpus_cursor: {remaining: string[]}"),e(typeof i.store_watermark=="string"||i.store_watermark===null,"kane.store_watermark: string | null (null = genesis)"),i.awaits!==void 0){let a=i.awaits;e(d(i.awaits)&&typeof a.call=="string"&&(typeof a.event_id=="string"||typeof a.event_prefix=="string"),"kane.awaits: {call, event_id | event_prefix}")}i.ingest_registry!==void 0&&e(Array.isArray(i.ingest_registry)&&i.ingest_registry.every(a=>d(a)&&typeof a.ref=="string"&&typeof a.entered_at=="string"),"kane.ingest_registry: [{ref, entered_at, consumed?}]"),i.sent_unread!==void 0&&e(D(i.sent_unread),"kane.sent_unread: string[]"),i.ingest_schedule!==void 0&&e(Array.isArray(i.ingest_schedule)&&i.ingest_schedule.every(a=>d(a)&&typeof a.source_id=="string"&&typeof a.cid=="string"&&["pending","done","skipped"].includes(String(a.status))),"kane.ingest_schedule: [{source_id, cid, status}]")}else r.push("delta.kane: object")}else r.push('kind: expected "base" | "delta" | "full"');return{ok:r.length===0,errors:r}}import{readFileSync as ke}from"fs";import{join as _e}from"path";import{closeSync as N,linkSync as ie,mkdirSync as G,openSync as I,readFileSync as oe,readdirSync as Y,renameSync as ae,rmSync as F,statSync as ce,writeFileSync as M}from"fs";import{join as j}from"path";function pe(t,r){let e=j(t,"sessions",r,B),s=n=>j(e,n);return{read:n=>{try{return oe(s(n),"utf8")}catch(i){if(i.code==="ENOENT")return null;throw i}},list:()=>{try{return Y(e)}catch{return[]}},write:(n,i)=>{G(e,{recursive:!0}),le(s(n),i,e)},writeIfAbsent:(n,i)=>(G(e,{recursive:!0}),de(s(n),i,e)),remove:n=>F(s(n),{force:!0}),bytes:()=>fe(e)}}function le(t,r,e){let s=`${t}.tmp-${process.pid}`,n=I(s,"w");try{M(n,r,{mode:384}),E(n)}finally{N(n)}ae(s,t);try{let i=I(e,"r");E(i),N(i)}catch{}}var ue=new Set(["EPERM","ENOTSUP","EXDEV"]);function de(t,r,e){let s=`${t}.tmp-${process.pid}`,n=I(s,"w");try{M(n,r,{mode:384}),E(n)}finally{N(n)}try{ie(s,t)}catch(i){let o=i.code??"";if(o==="EEXIST")return!1;if(!ue.has(o))throw i;if(!ge(t,r))return!1}finally{F(s,{force:!0})}try{let i=I(e,"r");E(i),N(i)}catch{}return!0}function ge(t,r){let e;try{e=I(t,"wx")}catch(n){if(n.code==="EEXIST")return!1;throw n}let s=!1;try{M(e,r),E(e),s=!0}finally{N(e),s||F(t,{force:!0})}return!0}function fe(t){let r=0;try{for(let e of Y(t))try{r+=ce(j(t,e)).size}catch{}}catch{return 0}return r}var me=3,$e=600*1e3,h=class extends Error{constructor(e,s){super(`${e}: ${s}`);this.code=e}},S=class extends Error{constructor(r){super(`CHECKPOINT_WRITE: ${r}`)}},V=class extends S{},he=(t,r)=>_e(t,"sessions",r,"state.json"),Ce=new Set,J=new Set;function W(t,r,e){for(let s of Ce)try{s(t,r,e)}catch{}}var be=new Set;function De(t,r=new Date){for(let e of be)try{e(t,r)}catch{}}function He(t,r){let e=JSON.stringify(r)+`
3
+ `;t.writeIfAbsent(m,e)||ye(t.read(m))||(t.remove(m),t.writeIfAbsent(m,e))}function ye(t){if(t===null)return!1;try{return JSON.parse(t),!0}catch{return!1}}function Z(t,r){let e;try{e=JSON.parse(r)}catch(n){throw new h("CHECKPOINT_CORRUPT",`${t}: ${n.message}`)}let s=K(e);if(!s.ok)throw new h("CHECKPOINT_CORRUPT",`${t}: ${s.errors.join("; ")}`);return e}function X(t,r){let e=t.read(r);if(e===null)throw new h("CHECKPOINT_MISSING",`${r} is not in the chain`);return Z(r,e)}function ee(t){let r=[],e=[];for(let s of t.list()){let n=/^delta-(\d+)\.json$/.exec(s);n&&r.push(Number(n[1]));let i=/^full-(\d+)\.json$/.exec(s);i&&e.push(Number(i[1]))}return r.sort((s,n)=>s-n),e.sort((s,n)=>s-n),{deltas:r,fulls:e}}function Be(t,r){try{return JSON.parse(ke(he(t,r),"utf8")).checkpoint??null}catch{return null}}function te(t,r,e){let s=[],n,i=0;if(e.full_seq!==null){let a=X(t,w(e.full_seq));s.push(a),n=a.agent.base_fingerprint,i=e.full_seq}let o;for(let a=i+1;a<=e.seq;a++)try{let u=X(t,y(a));s.push(u),!n&&u.agent.base_fingerprint&&(n=u.agent.base_fingerprint)}catch(u){if(u instanceof h&&u.code==="CHECKPOINT_CORRUPT"){o={resumableAt:a-1,turnsLost:e.seq-(a-1)};break}throw u}if(s.length===0)throw new h("CHECKPOINT_CORRUPT",`${r}: pointer names seq ${e.seq} but no chain records exist`);return{items:s.flatMap(a=>a.agent.delta_items),last:s[s.length-1],base_fingerprint:n,fallback:o}}function Ke(t,r,e,s,n){let i=performance.now(),o=r.state.sid,p=r.state.checkpoint;if(p){if(e.seq<p.seq)throw new S(`seq regression: got ${e.seq}, pointer at ${p.seq} (${o})`);if(e.seq===p.seq){if(e.turn_id===p.turn_id&&e.at===p.at)return p;throw new S(`seq regression: seq ${e.seq} re-used with different metadata (turn ${e.turn_id}/${p.turn_id}, at ${e.at}/${p.at}) (${o})`)}}let a=(n?.now??(()=>new Date))(),u=a.toISOString(),l={schema:x,kind:"delta",sid:o,seq:e.seq,turn_id:e.turn_id,at:e.at,ts:u,agent:{agent_state_schema:e.agent_state_schema,delta_items:e.delta_items,binding:e.binding,usage_total:e.usage_total,...e.base_fingerprint!==void 0?{base_fingerprint:e.base_fingerprint}:{}},kane:s},A=Math.max(1,n?.retries??me),g=JSON.stringify(l)+`
4
+ `,C=!1;Buffer.byteLength(g)>524288&&!J.has(o)&&(J.add(o),C=!0,n?.onSoftCap?.("note: this session's checkpoints are getting large \u2014 long pasted inputs are kept verbatim; consider ingesting big documents as sources instead"));let v=!1,q;for(let f=0;f<A&&!v;f++)try{t.write(y(e.seq),g),v=!0}catch(k){q=k}if(!v)throw new S(`delta-${e.seq} write failed after ${A} attempts: ${q?.message??"unknown"} (${o})`);let _=p?.full_seq??null,P=t.bytes()>67108864;if(e.seq%25===0||P){let f=[],k=e.base_fingerprint;if(p){let R=te(t,o,p);f=R.items,k=k??R.base_fingerprint}if(f=[...f,...e.delta_items],!k)throw new S(`compaction at seq ${e.seq}: no base_fingerprint anywhere in the chain (${o})`);let c={...l,kind:"full",agent:{...l.agent,delta_items:f,base_fingerprint:k}};t.write(w(e.seq),JSON.stringify(c)+`
5
+ `),_=e.seq}let b={seq:e.seq,turn_id:e.turn_id,at:e.at,ts:u,full_seq:_};if(r.save({checkpoint:b}),_===e.seq){let{deltas:f,fulls:k}=ee(t);for(let c of f)c<=_&&t.remove(y(c));for(let c of k)c<_&&t.remove(w(c))}let T=t.bytes();if(P&&T>67108864)throw W(o,b,a),new V(`session ${o} checkpoint dir is ${Math.round(T/(1024*1024))}MB (cap ${Math.round(67108864/(1024*1024))}MB) even after compaction \u2014 pausing; resume in a fresh session or trim the conversation`);return W(o,b,a),n?.onStat?.({sid:o,seq:e.seq,persist_ms:performance.now()-i,bytes:Buffer.byteLength(g),dir_bytes:T,compacted:_===e.seq,soft_warned:C}),b}function je(t,r,e){let s=t.read(m);if(s===null)throw new h("CHECKPOINT_MISSING",`${r}: no ${m} \u2014 not a checkpoint session`);let n=Z(m,s),i=p=>{let{deltas:a,fulls:u}=ee(t);if(!p){let g=[...a.map(y),...u.map(w)];return{base:n,agent:null,kane:null,pointer:null,orphans:g}}let l=te(t,r,p),A=[...a.filter(g=>g>p.seq).map(y),...u.filter(g=>g>p.seq).map(w)];return{base:n,agent:{delta_items:l.items,binding:l.last.agent.binding,base_fingerprint:l.base_fingerprint,agent_state_schema:l.last.agent.agent_state_schema,...l.last.agent.usage_total?{usage_total:l.last.agent.usage_total}:{}},kane:l.last.kane,pointer:p,orphans:A,...l.fallback?{fallback:l.fallback}:{}}},o=e();try{return i(o)}catch(p){if(!(p instanceof h&&p.code==="CHECKPOINT_MISSING"))throw p;return i(e())}}function Fe(t,r){let e=[];for(let s of U(t).records)if(s.sid===r)for(let n of s.event_ids??[])e.push(n);return e}function Me(t,r,e,s,n){let i=n.verb??"extract",o=t.parse(e.store_watermark),p=o===null?null:t.resolveToken(o);if(o!==null&&p===null)throw new L(`watermark not in chain: ${e.store_watermark} names no record in this store (rebuilt or foreign?) \u2014 re-ground the session or abandon it`);let a=t.recordsSince(o),u=p===null?0:t.sessions().recordCount(r,p.seq),l=new Map;for(let c of a)c.sid===r&&l.set(c.seq,++u);let A=c=>l.get(c.seq)??0,g=new Set(e.applied_events),C=0,v=[];for(let c of a){if(typeof c.sid!="string"){C+=1;continue}if(c.sid===r){if((c.event_ids??[]).length===0){C+=1;continue}v.push(c)}}C>0&&n.onNote?.(`reconcile: skipped ${C} store record(s) not attributable to this session (pre-sid grace)`);let q=n.ownActors??["extract-agent","design-agent","owner"],_=[],P=[];for(let c of v){if(n.resent!==void 0&&(c.event_ids??[]).includes(n.resent))continue;let R=(c.event_ids??[]).filter(ne=>!g.has(ne));if(R.length===0)continue;P.push(...R);let O;try{O=n.composeReceipt(c,s,{verb:i,commitN:A(c),...n.ucRef?{ucRef:n.ucRef}:{},...n.typedBlockers?{typedBlockers:!0}:{},...n.ignoreGaps?.size?{ignoreGaps:n.ignoreGaps}:{}}).text}catch{O=`commit ${R[0]} at ${c.ts} \u2014 details unavailable (graph moved since)`}let $=c.review?.[0]?.by;$?.id&&!q.includes($.id)&&(O+=`
6
+ (committed by ${$.kind}:${$.id} while this session was suspended)`),_.push(O)}let b=e.pending.proposals??[],T=b.filter(c=>typeof c.event_id=="string"&&s.appliedEvents.has(c.event_id)),k=b.filter(c=>!(typeof c.event_id=="string"&&s.appliedEvents.has(c.event_id))).filter(c=>c.state==="accepted-pending-commit");return{redeliverReceipts:_,recommit:k,prunedPending:T,newlyApplied:P,skippedNoSid:C}}function Ve(t,r){for(let e of r)/^(?:delta|full)-\d+\.json$/.test(e)&&t.remove(e)}export{x as a,m as b,pe as c,De as d,He as e,Be as f,Ke as g,je as h,Fe as i,Me as j,Ve as k};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{y as l}from"./chunk-I6OQISK4.js";import{e as y}from"./chunk-UR6MHSHU.js";var o=y($(),1);function L(a){let c=a.findIndex(m=>m.free);return c>=0?c:null}var v=60,A=100;function N({headline:a,ask:c=!1,rows:m,sel:u,focused:x,freeText:n=null,freeTextNote:d,sublines:B=[],gapAbove:p=!0,accent:s=l.assuranceAccent}){let{stdout:C}=O(),b=C?.columns??80,S=b<v,F=Math.min(b-1,A),f=e=>x&&u===e?(0,o.jsx)(t,{color:s,children:"\u276F"}):" ",T=c?`? ${a}`:a,g=Math.max(4,F-3),R=B.map((e,r)=>(0,o.jsx)(t,{color:l.dim,children:` ${e.length>g?`${e.slice(0,g-1)}\u2026`:e}`},`sub-${r}`)),k=0,w=m.map((e,r)=>e.free?n?(0,o.jsxs)(i,{flexDirection:"column",children:[(0,o.jsxs)(i,{children:[(0,o.jsxs)(t,{children:[(0,o.jsx)(t,{color:s,children:"\u276F"})," ",(0,o.jsx)(t,{color:l.dim,children:"\u270E "})]}),n.keysFromPanel?(0,o.jsx)(P,{value:n.value,placeholder:e.label}):(0,o.jsx)(h,{value:n.value,onChange:n.onChange,onSubmit:n.onSubmit,onCancel:n.onCancel,placeholder:e.label})]}),d?(0,o.jsx)(t,{color:l.muted,children:` ${d}`}):null]},e.key):(0,o.jsxs)(t,{children:[f(r)," ",(0,o.jsx)(t,{color:l.dim,children:`\u270E ${e.label}`})]},e.key):(k+=1,(0,o.jsxs)(t,{bold:x&&u===r,children:[f(r),` ${k}. ${e.label}`,e.detail?(0,o.jsx)(t,{color:l.dim,bold:!1,children:` \u2014 ${e.detail}`}):null]},e.key)));return S?(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,w]}):(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,(0,o.jsx)(t,{children:" "}),w]})}export{L as a,N as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var t={desktop:{label:"Desktop",hint:"Chrome on this machine",phrase:"the desktop browser",realDevice:!1,needsMobileHost:!1,builds:[]},emulator:{label:"Emulator",hint:"a virtual Android device on this machine",phrase:"an emulator",platform:"android",realDevice:!1,needsMobileHost:!0,builds:[".apk"]},simulator:{label:"Simulator",hint:"a virtual iOS device on this machine",phrase:"a simulator",platform:"ios",realDevice:!1,needsMobileHost:!0,builds:[".zip"]},android:{label:"Android",hint:"a real Android device in the TestMu AI cloud",phrase:"a real Android device",platform:"android",realDevice:!0,needsMobileHost:!1,builds:[".apk",".aab"]},ios:{label:"iOS",hint:"a real iOS device in the TestMu AI cloud",phrase:"a real iOS device",platform:"ios",realDevice:!0,needsMobileHost:!1,builds:[".ipa"]}},n=["desktop","emulator","simulator","android","ios"],c=["emulator","simulator","android","ios"];function o(e){return typeof e=="string"&&n.includes(e)}function a(e){return o(e)&&e!=="desktop"}function p(e){return a(e)?e:void 0}function g(e){return o(e)&&t[e].realDevice}function f(e){return a(e)&&!t[e].realDevice}function T(e){return t[e].platform}function b(e){return e==="ios"?"iOS":"Android"}function v(e){return t[e].label}function m(e){return t[e].hint}function D(e){return t[e].phrase}function l(e){return t[e].needsMobileHost}function S(e){return n.filter(r=>e||!l(r))}function h(e){return e==="ios"?"ios":"android"}function x(e){return e==="ios"?"simulator":"emulator"}function k(e){return t[e].builds}function y(e){return[...new Set(e.flatMap(r=>t[r].builds))]}function u(e,r){let i=e.trim().toLowerCase();return r.find(s=>i.endsWith(s))}function M(e,r){return u(r,t[e].builds)!==void 0}function A(e){let r=t[e].builds;return`${/^\.[aeiou]/i.test(r[0]??"")?"an":"a"} ${d(r,"or")}`}function d(e,r){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${r} ${e[e.length-1]}`}export{n as a,c as b,o as c,a as d,p as e,g as f,f as g,T as h,b as i,v as j,m as k,D as l,l as m,S as n,h as o,x as p,k as q,y as r,u as s,M as t,A as u,d as v};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as _}from"./chunk-BVO4C5F2.js";import{a as A}from"./chunk-OAKYUBD3.js";import{a as i}from"./chunk-XZYA7DNH.js";import{a as h}from"./chunk-MGNRNLBE.js";async function w(d){let{creds:a,env:l,usernameFlag:c,accessKeyFlag:u,log:r}=d,e=null,o=null;if(c&&u)e={username:c,access_key:u},r("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:c});else{let s=a.resolveAuth();s?.method==="basic"&&(e={username:s.username,access_key:s.access_key},r("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:s.username}))}if(!e){let{credentials:s,profile:k}=a.getActiveCredentials();if(!s)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(o=s.access_token,s.expires_at-Date.now()/1e3<300)try{let n=await A({creds:a,profile:k,env:l,credentials:s});n&&(o=n.accessToken,r("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw r("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new i(`Token refresh failed: ${m}`,"refresh_failed")}}let v=h(l),E=async()=>o,g=e?{username:e.username,access_key:e.access_key}:null,f=new _(v.controllerBaseUrl,E,g,r),t=await f.resolve();return t&&!e&&(e={username:t.username,access_key:t.access_key},r("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:t.username})),{basicAuth:e,token:o,resolver:f,resolvedCreds:t}}export{w as a};