@testmuai/kane-cli 0.10.0-rc.3 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/dist/ChatSurface-FIYDTZSI.js +2 -0
  2. package/dist/{ChromeProfilePicker-M4WXOB5O.js → ChromeProfilePicker-Q6FIGVYU.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-6MJA7DF6.js → CliFeedbackPrompt-2NV2G65E.js} +1 -1
  4. package/dist/{CliUploadProgress-6NLS7XHH.js → CliUploadProgress-JZ5FXODE.js} +1 -1
  5. package/dist/{ConfigView-O4WKZ5PU.js → ConfigView-TZ4YINOE.js} +1 -1
  6. package/dist/EvidenceViewOffer-LKPN5BHX.js +2 -0
  7. package/dist/FolderPicker-H5K74PCH.js +2 -0
  8. package/dist/InfoBox-DNSOAK5L.js +2 -0
  9. package/dist/{LinksBox-DXP66H3H.js → LinksBox-32TZOANP.js} +1 -1
  10. package/dist/{ProfilesView-TWOY5PVC.js → ProfilesView-UC4MPM54.js} +1 -1
  11. package/dist/ProjectPicker-ZJ5RW6XL.js +2 -0
  12. package/dist/SaveSessionPrompt-F327WC7A.js +2 -0
  13. package/dist/SingleShotApp-OMLRYOSI.js +2 -0
  14. package/dist/{SummaryBox-IA2KS6GT.js → SummaryBox-XGFO5X76.js} +1 -1
  15. package/dist/TestMdRunView-ZZ77QTAQ.js +2 -0
  16. package/dist/TestrunEvidenceTable-G7MPF55X.js +2 -0
  17. package/dist/{WhoamiView-SNL75TEF.js → WhoamiView-4XIJXMTU.js} +1 -1
  18. package/dist/{app-download-UI4ABEIX.js → app-download-XEDO3EMV.js} +1 -1
  19. package/dist/{assurance-job-FFSSS4XV.js → assurance-job-MD65GQLC.js} +1 -1
  20. package/dist/{auth-7Z54TMQQ.js → auth-WBIEHHDS.js} +1 -1
  21. package/dist/{binary-THPLXCOD.js → binary-NVYLR36K.js} +1 -1
  22. package/dist/bind-H3ALI2NG.js +2 -0
  23. package/dist/bootstrap-JEVSVPQ2.js +2 -0
  24. package/dist/bridge-2UHJOVLX.js +2 -0
  25. package/dist/{catalog-MYPS2BXY.js → catalog-5UYBWA4W.js} +1 -1
  26. package/dist/catalog-client-VVKV4JKW.js +2 -0
  27. package/dist/{changelog-SU674BVE.js → changelog-FPWJXERY.js} +1 -1
  28. package/dist/chat-committer-ZKEKJA2R.js +2 -0
  29. package/dist/chat-controller-FXRJXUG3.js +2 -0
  30. package/dist/child-JHYENXE7.js +2 -0
  31. package/dist/chunk-226AGYHB.js +87 -0
  32. package/dist/{chunk-MNBGG4H3.js → chunk-23DKB2MT.js} +1 -1
  33. package/dist/{chunk-EECDDDSB.js → chunk-2COXO5LQ.js} +1 -1
  34. package/dist/{chunk-LUR7JFPP.js → chunk-2GEAKFAV.js} +1 -1
  35. package/dist/{chunk-7SY34IIL.js → chunk-2QKBXRLI.js} +1 -1
  36. package/dist/{chunk-AVSMXDTX.js → chunk-2ULYGALF.js} +1 -1
  37. package/dist/{chunk-JNSWKGTB.js → chunk-32HED7X2.js} +1 -1
  38. package/dist/{chunk-GRURFGBP.js → chunk-32MFECUA.js} +1 -1
  39. package/dist/{chunk-MYVKUJGS.js → chunk-35BG2EMW.js} +1 -1
  40. package/dist/{chunk-3GXN6VF6.js → chunk-3KY7HHQU.js} +1 -1
  41. package/dist/{chunk-7NPTL66J.js → chunk-3V4J65GN.js} +1 -1
  42. package/dist/{chunk-457Y5TEC.js → chunk-3YIA3DSL.js} +1 -1
  43. package/dist/{chunk-36N3EHW5.js → chunk-44SIFDNY.js} +1 -1
  44. package/dist/{chunk-MEKPGQAM.js → chunk-45NM23EQ.js} +2 -2
  45. package/dist/{chunk-I2MC6VVX.js → chunk-4C7WVQOD.js} +1 -1
  46. package/dist/{chunk-TU42YZOJ.js → chunk-4HARMERK.js} +1 -1
  47. package/dist/{chunk-ICLUC44J.js → chunk-4HYPMGDF.js} +1 -1
  48. package/dist/{chunk-7KX2BHKG.js → chunk-4KCYNP2K.js} +1 -1
  49. package/dist/{chunk-IJ2AHSWW.js → chunk-4LGQHTXM.js} +1 -1
  50. package/dist/{chunk-ETZMFRD6.js → chunk-4NEPHIAO.js} +1 -1
  51. package/dist/{chunk-3E4ZO73O.js → chunk-54NJJVG5.js} +1 -1
  52. package/dist/{chunk-734ORT6O.js → chunk-5F44KH3R.js} +1 -1
  53. package/dist/{chunk-E6KSRQXL.js → chunk-5F5IVART.js} +1 -1
  54. package/dist/{chunk-EBPRPNSA.js → chunk-5KJU4MG4.js} +1 -1
  55. package/dist/{chunk-JZP3Y4ZM.js → chunk-5MFPQYW3.js} +1 -1
  56. package/dist/{chunk-QENCC2ZS.js → chunk-5WLXAQ4H.js} +1 -1
  57. package/dist/{chunk-RFEON5GN.js → chunk-5XVWT6UK.js} +1 -1
  58. package/dist/{chunk-W4QSZNMB.js → chunk-6CS23F3E.js} +1 -1
  59. package/dist/{chunk-DZOYYWOW.js → chunk-6JUS2ULI.js} +1 -1
  60. package/dist/chunk-6K5BEEAJ.js +2 -0
  61. package/dist/{chunk-4QFTHUJA.js → chunk-6LEHGRRG.js} +1 -1
  62. package/dist/{chunk-LSDJOVWW.js → chunk-6SD4XTYC.js} +1 -1
  63. package/dist/{chunk-TW5AA5A7.js → chunk-6SWHEBPR.js} +1 -1
  64. package/dist/{chunk-URH4FX3H.js → chunk-6YBH3WUW.js} +1 -1
  65. package/dist/{chunk-ZAFJQ3SM.js → chunk-73HMW2WA.js} +1 -1
  66. package/dist/{chunk-NXAJBSIF.js → chunk-75FF7J5R.js} +1 -1
  67. package/dist/{chunk-P3JXJ4BW.js → chunk-7DLDADQR.js} +1 -1
  68. package/dist/{chunk-7NCJMWFX.js → chunk-7LYLJ75Z.js} +1 -1
  69. package/dist/chunk-7O2FIZB7.js +9 -0
  70. package/dist/chunk-7PCLHURF.js +101 -0
  71. package/dist/{chunk-PUVMC4PX.js → chunk-7V34ZMMS.js} +1 -1
  72. package/dist/{chunk-AEWNWAXW.js → chunk-7XJNYLQW.js} +2 -2
  73. package/dist/{chunk-WEIPY3CI.js → chunk-7ZR5CQY3.js} +1 -1
  74. package/dist/{chunk-2DYHAP4E.js → chunk-A474TUCE.js} +1 -1
  75. package/dist/chunk-A4ZV2SHL.js +5 -0
  76. package/dist/chunk-A7IMHUFY.js +27 -0
  77. package/dist/{chunk-XLEGGC4Y.js → chunk-ABMM37L2.js} +1 -1
  78. package/dist/{chunk-NIVFEACM.js → chunk-AUSLHNXQ.js} +1 -1
  79. package/dist/{chunk-YPFQ4UGF.js → chunk-B226SFOV.js} +1 -1
  80. package/dist/{chunk-DJC7NTLA.js → chunk-B57ZRHEQ.js} +1 -1
  81. package/dist/{chunk-CGITGJ3I.js → chunk-BHQIH2FE.js} +1 -1
  82. package/dist/{chunk-FWUPJORV.js → chunk-BJT6PZXL.js} +1 -1
  83. package/dist/{chunk-VX657KIK.js → chunk-C6P6YUCR.js} +1 -1
  84. package/dist/chunk-CB344EDO.js +2 -0
  85. package/dist/chunk-CCOD4GQJ.js +2 -0
  86. package/dist/{chunk-ZFM77AQU.js → chunk-CQDCNP7V.js} +1 -1
  87. package/dist/{chunk-VUFIL5VR.js → chunk-D4QXYAYA.js} +2 -2
  88. package/dist/{chunk-Y7E5L42F.js → chunk-DLP5S3TO.js} +1 -1
  89. package/dist/{chunk-35ECWCCK.js → chunk-DXIQVBMI.js} +1 -1
  90. package/dist/chunk-DXLZCJH5.js +7 -0
  91. package/dist/{chunk-OJ33Q6DU.js → chunk-E4GIGM5V.js} +1 -1
  92. package/dist/{chunk-I4WXALQR.js → chunk-EAWU2TOG.js} +1 -1
  93. package/dist/{chunk-ACMBMZDQ.js → chunk-EEOAU43D.js} +1 -1
  94. package/dist/{chunk-MYZHOBS4.js → chunk-EHB55V23.js} +1 -1
  95. package/dist/{chunk-UYDHOHSZ.js → chunk-ENRFXGID.js} +1 -1
  96. package/dist/{chunk-RTVHJ23A.js → chunk-ET5EK2CM.js} +1 -1
  97. package/dist/{chunk-EF47KRUK.js → chunk-EZMRWXRT.js} +1 -1
  98. package/dist/chunk-FAMQ4DHU.js +2 -0
  99. package/dist/{chunk-C2RUDJ46.js → chunk-FI2DVNRT.js} +1 -1
  100. package/dist/{chunk-AUJSC7PU.js → chunk-FNUGDPTS.js} +1 -1
  101. package/dist/{chunk-VLDCHFXF.js → chunk-FOLUB336.js} +1 -1
  102. package/dist/{chunk-NZ6AV2TA.js → chunk-FYPIF3BE.js} +1 -1
  103. package/dist/{chunk-HHW6MRU3.js → chunk-G4K3TP2I.js} +1 -1
  104. package/dist/{chunk-P2ZQDQDB.js → chunk-GAKBHNC4.js} +1 -1
  105. package/dist/{chunk-DPGOAFKF.js → chunk-GBQ4K25P.js} +1 -1
  106. package/dist/{chunk-O3HHTKZ5.js → chunk-GEZVC4S3.js} +1 -1
  107. package/dist/chunk-GJ7MO2FW.js +9 -0
  108. package/dist/{chunk-EZN7CF45.js → chunk-GJXO6FF7.js} +1 -1
  109. package/dist/{chunk-QDFY5GGO.js → chunk-GLM5UGTF.js} +1 -1
  110. package/dist/{chunk-HK62JVQM.js → chunk-GQARXS6F.js} +1 -1
  111. package/dist/{chunk-I4RVVBG3.js → chunk-GT3JDX5H.js} +1 -1
  112. package/dist/{chunk-YLXWAY7D.js → chunk-GZQAETB2.js} +1 -1
  113. package/dist/{chunk-7HMSMAUG.js → chunk-H4TIVILC.js} +5 -5
  114. package/dist/{chunk-VXGN3IV7.js → chunk-HG2ILWCE.js} +1 -1
  115. package/dist/{chunk-M43WH5DQ.js → chunk-HHOVANJ7.js} +1 -1
  116. package/dist/{chunk-CM4CHYSN.js → chunk-HM6LZ2KM.js} +1 -1
  117. package/dist/{chunk-QDXKEOKI.js → chunk-HNF3PWF3.js} +6 -6
  118. package/dist/{chunk-R7KXAISS.js → chunk-HVOXMCKE.js} +1 -1
  119. package/dist/{chunk-D7U2M26S.js → chunk-HWPWCCEV.js} +1 -1
  120. package/dist/{chunk-XRNQSXOM.js → chunk-HX5OLRKU.js} +2 -2
  121. package/dist/{chunk-4I7YN6YY.js → chunk-HYJVYYAZ.js} +2 -2
  122. package/dist/{chunk-CUXY6KQ2.js → chunk-I52NWH4U.js} +1 -1
  123. package/dist/{chunk-IGEAET7M.js → chunk-IB5WG5YY.js} +1 -1
  124. package/dist/{chunk-LAOTVZHV.js → chunk-IH73ZCBB.js} +1 -1
  125. package/dist/{chunk-TU7TVFBK.js → chunk-IT5JVCZN.js} +1 -1
  126. package/dist/{chunk-54XA5MZH.js → chunk-IZ66FKPC.js} +1 -1
  127. package/dist/{chunk-44B6THYK.js → chunk-JNPFEBUR.js} +1 -1
  128. package/dist/{chunk-RX6776AI.js → chunk-JTNEF5ZP.js} +1 -1
  129. package/dist/{chunk-QBYENBMB.js → chunk-JUVY6PHY.js} +1 -1
  130. package/dist/{chunk-5AKJPYUW.js → chunk-K4K2BGQC.js} +3 -3
  131. package/dist/{chunk-HJMCXSUJ.js → chunk-K75WIRI5.js} +1 -1
  132. package/dist/{chunk-FSYOTRMC.js → chunk-KKLCXRW6.js} +1 -1
  133. package/dist/{chunk-7YT4TTKL.js → chunk-KN7GZWKK.js} +1 -1
  134. package/dist/{chunk-ZTHYAHDN.js → chunk-L3BUPFAQ.js} +4 -4
  135. package/dist/{chunk-7XBNMOH4.js → chunk-LLQWEGXD.js} +1 -1
  136. package/dist/chunk-LTPOMMAB.js +2 -0
  137. package/dist/{chunk-CCP4X75B.js → chunk-LWCP4GLY.js} +1 -1
  138. package/dist/chunk-LXCTV75T.js +12 -0
  139. package/dist/{chunk-RDP7GWSY.js → chunk-LZGAFKYH.js} +1 -1
  140. package/dist/{chunk-3QICDXY5.js → chunk-LZPYIFHZ.js} +1 -1
  141. package/dist/{chunk-3OQW2GTA.js → chunk-M3TFOFUQ.js} +1 -1
  142. package/dist/{chunk-V7USCQWO.js → chunk-M7Y5GGVJ.js} +1 -1
  143. package/dist/{chunk-SMTBOSEJ.js → chunk-MEMXFTLD.js} +1 -1
  144. package/dist/{chunk-D756UWY2.js → chunk-MINDIQET.js} +1 -1
  145. package/dist/{chunk-ZTRRFG52.js → chunk-MP6NCJFE.js} +1 -1
  146. package/dist/{chunk-GXKY5A46.js → chunk-MSYRAPDK.js} +1 -1
  147. package/dist/{chunk-HJLMH7ZM.js → chunk-MUX2A37P.js} +1 -1
  148. package/dist/{chunk-YHFZFV3A.js → chunk-NCP54AIQ.js} +9 -9
  149. package/dist/{chunk-ZU4W2QGM.js → chunk-NVD2MXHQ.js} +1 -1
  150. package/dist/{chunk-FWDUVFS6.js → chunk-O2Y46A3G.js} +17 -17
  151. package/dist/{chunk-XZGEN4NU.js → chunk-O3TXAMFW.js} +1 -1
  152. package/dist/{chunk-YGRULEZY.js → chunk-O5KTMDTH.js} +1 -1
  153. package/dist/{chunk-PAWQ4AKN.js → chunk-OK6NLITG.js} +1 -1
  154. package/dist/{chunk-7AET4JKQ.js → chunk-OKA6FPJM.js} +1 -1
  155. package/dist/{chunk-3YTCKCBG.js → chunk-OVNTCBNS.js} +1 -1
  156. package/dist/{chunk-YQ5C6UDG.js → chunk-P4VFC6HO.js} +1 -1
  157. package/dist/{chunk-LQQNPMOD.js → chunk-PC22QRIY.js} +1 -1
  158. package/dist/{chunk-XQMWHPZI.js → chunk-PEUIHME2.js} +1 -1
  159. package/dist/{chunk-UEE3RZN4.js → chunk-PI7OXS62.js} +1 -1
  160. package/dist/{chunk-D7TKE7LK.js → chunk-POA336CU.js} +1 -1
  161. package/dist/{chunk-WZXPF3BI.js → chunk-PR5EGLEI.js} +1 -1
  162. package/dist/{chunk-YIKF4ERQ.js → chunk-PRBWZXFA.js} +2 -2
  163. package/dist/{chunk-XZYA7DNH.js → chunk-PVN64537.js} +1 -1
  164. package/dist/{chunk-VSVWNRI2.js → chunk-PWNYTIVA.js} +1 -1
  165. package/dist/chunk-Q4JV4U65.js +161 -0
  166. package/dist/{chunk-LUZBGTYB.js → chunk-Q5AKIQIE.js} +1 -1
  167. package/dist/{chunk-6EB5VRAN.js → chunk-QB77LRF4.js} +1 -1
  168. package/dist/{chunk-GQRU3B54.js → chunk-QUNIY6NN.js} +1 -1
  169. package/dist/{chunk-KODJVOCN.js → chunk-QVMXL675.js} +1 -1
  170. package/dist/{chunk-LCSJ7GOG.js → chunk-R6TFRAMZ.js} +1 -1
  171. package/dist/{chunk-4YW767UV.js → chunk-RAVAJZV2.js} +7 -7
  172. package/dist/{chunk-DDZLCAEO.js → chunk-RDAIOJCR.js} +1 -1
  173. package/dist/{chunk-RPRXRKKR.js → chunk-RQKMSNEU.js} +1 -1
  174. package/dist/{chunk-ECPFI75W.js → chunk-RRKYHUOD.js} +1 -1
  175. package/dist/{chunk-3RJHXOZH.js → chunk-S7XCOBYD.js} +1 -1
  176. package/dist/{chunk-Q3C6NDGI.js → chunk-SALZ6WSF.js} +1 -1
  177. package/dist/{chunk-ZFMRQ57Y.js → chunk-SIHX5FW5.js} +1 -1
  178. package/dist/{chunk-FIP5L6LV.js → chunk-SSOUYKVG.js} +1 -1
  179. package/dist/{chunk-TNORODUF.js → chunk-SVIIUKJ2.js} +1 -1
  180. package/dist/{chunk-7RWP4Y3H.js → chunk-T77LTLAD.js} +1 -1
  181. package/dist/{chunk-NLZZLANH.js → chunk-TAY7J5VS.js} +1 -1
  182. package/dist/chunk-TD6GCEIK.js +2 -0
  183. package/dist/{chunk-LKQFG4RW.js → chunk-TM6VLC6V.js} +1 -1
  184. package/dist/{chunk-YAW6JW6D.js → chunk-TMH4TPMB.js} +1 -1
  185. package/dist/{chunk-OFSDB7B4.js → chunk-TU2KPOW2.js} +2 -2
  186. package/dist/{chunk-3BSYOCSW.js → chunk-U2VYTVKV.js} +1 -1
  187. package/dist/{chunk-LIGTP3A3.js → chunk-UCVP7ZY4.js} +1 -1
  188. package/dist/{chunk-RHGW7B5Q.js → chunk-UICJ2KLJ.js} +1 -1
  189. package/dist/chunk-UJLULWSR.js +21 -0
  190. package/dist/{chunk-OCDBTAYS.js → chunk-UMNCM4RJ.js} +2 -2
  191. package/dist/{chunk-WOSANGV6.js → chunk-UWPG5MWM.js} +1 -1
  192. package/dist/{chunk-W6HZF56M.js → chunk-V3OZJO7Y.js} +1 -1
  193. package/dist/{chunk-3F5FMH76.js → chunk-VE4HLIGA.js} +1 -1
  194. package/dist/{chunk-RF37IJNN.js → chunk-W2HRX3DR.js} +1 -1
  195. package/dist/{chunk-NXRF7FFS.js → chunk-W54BX6HC.js} +1 -1
  196. package/dist/{chunk-IZ65ZPWY.js → chunk-W5HFUBXD.js} +1 -1
  197. package/dist/{chunk-HAW5WEKT.js → chunk-WEJR2V7R.js} +1 -1
  198. package/dist/{chunk-F5NHG7VB.js → chunk-X3A4QPA3.js} +1 -1
  199. package/dist/{chunk-AVI5H4UM.js → chunk-X52YIWGG.js} +1 -1
  200. package/dist/{chunk-72RC7JSA.js → chunk-X6FCXBXU.js} +1 -1
  201. package/dist/{chunk-PZA3BSOE.js → chunk-X7S7IGCV.js} +1 -1
  202. package/dist/{chunk-6DZX5HLZ.js → chunk-XCUF5AVM.js} +1 -1
  203. package/dist/{chunk-F22K3RRX.js → chunk-XHFU5TGS.js} +1 -1
  204. package/dist/chunk-XNXJXGVB.js +4 -0
  205. package/dist/{chunk-C62QWG4B.js → chunk-XZ6J3Y2W.js} +1 -1
  206. package/dist/{chunk-JGRXMTME.js → chunk-YDB72F4K.js} +1 -1
  207. package/dist/{chunk-7DFBOVUB.js → chunk-YJAQZMJT.js} +1 -1
  208. package/dist/chunk-YO6SNXBJ.js +2 -0
  209. package/dist/{chunk-AZLNLHUA.js → chunk-Z24SD2EJ.js} +1 -1
  210. package/dist/{chunk-HQ2E2XCU.js → chunk-Z36KVIRR.js} +1 -1
  211. package/dist/{chunk-WAOUE7MP.js → chunk-Z6SI7YNV.js} +1 -1
  212. package/dist/{chunk-6NFOH4AC.js → chunk-ZAQGIC33.js} +1 -1
  213. package/dist/{chunk-6UVIY56J.js → chunk-ZCL7XIVS.js} +1 -1
  214. package/dist/{chunk-UUJIGOEO.js → chunk-ZDCXWEQG.js} +1 -1
  215. package/dist/{chunk-SGPAM5DZ.js → chunk-ZDQYGLCZ.js} +1 -1
  216. package/dist/{chunk-42PALMW2.js → chunk-ZHAMVLQZ.js} +1 -1
  217. package/dist/{chunk-W7FLXW6Q.js → chunk-ZMWTRXFH.js} +1 -1
  218. package/dist/{chunk-KXHJMAZU.js → chunk-ZO3ZAMUU.js} +2 -2
  219. package/dist/{chunk-L5DALV5N.js → chunk-ZZZGTDYE.js} +1 -1
  220. package/dist/commands-R5AYK6XM.js +2 -0
  221. package/dist/{committer-JGY66PFM.js → committer-UO3B3S5Y.js} +1 -1
  222. package/dist/{config-754B73XK.js → config-YMHI3H3Y.js} +1 -1
  223. package/dist/cover-cmd-DVQIGFDY.js +2 -0
  224. package/dist/{credentials-F7DYLVWY.js → credentials-BCR73VGS.js} +1 -1
  225. package/dist/{deps-bundle-PW3WEQJ7.js → deps-bundle-6WLX44OA.js} +1 -1
  226. package/dist/{deps-resolve-SQYVN76L.js → deps-resolve-DSAKPZ3T.js} +1 -1
  227. package/dist/{design-chat-F3OEZPNJ.js → design-chat-YUI2JPO6.js} +1 -1
  228. package/dist/design-committer-7YIPFKMO.js +2 -0
  229. package/dist/design-headless-KIP6R7UV.js +2 -0
  230. package/dist/{design-remote-2BEGCVCX.js → design-remote-XMSHDDUX.js} +2 -2
  231. package/dist/device-env-K7J5NN66.js +2 -0
  232. package/dist/dispatch-BV6XMCN3.js +2 -0
  233. package/dist/{doctor-XY26Z35T.js → doctor-PGTNOMSP.js} +1 -1
  234. package/dist/{docx-convert-6IZO5P5K.js → docx-convert-DO5AQYD3.js} +1 -1
  235. package/dist/{dossier-NROC2MCY.js → dossier-5XKNAK6Q.js} +1 -1
  236. package/dist/evidence-RO3RDZXO.js +2 -0
  237. package/dist/evidence-presentation-LSFOZGLH.js +2 -0
  238. package/dist/evolve-cmd-U2ALVGMT.js +2 -0
  239. package/dist/evolve-remote-K2MCCVMM.js +2 -0
  240. package/dist/{exit-manager-EDHCETUN.js → exit-manager-EGWAZHCR.js} +1 -1
  241. package/dist/{explain-cmd-VYAANFFZ.js → explain-cmd-KNDORU2D.js} +1 -1
  242. package/dist/{explain-cmd-OP5I5W3O.js → explain-cmd-UWK5YVXG.js} +1 -1
  243. package/dist/explore-S2BGQUIF.js +2 -0
  244. package/dist/{explore-context-tty-RZ7D2TBV.js → explore-context-tty-WJHUSP3A.js} +1 -1
  245. package/dist/{explore-entry-EKXJ67BD.js → explore-entry-3EX2T3NS.js} +4 -4
  246. package/dist/{explore-live-2YVRAQZO.js → explore-live-TRY5A2ME.js} +1 -1
  247. package/dist/{explore-run-tty-D47FGPX7.js → explore-run-tty-ZV5XFKZA.js} +2 -2
  248. package/dist/{extract-bind-W2NET364.js → extract-bind-TXUBMK3T.js} +3 -3
  249. package/dist/extract-chat-VPYDGQKO.js +2 -0
  250. package/dist/{extract-cmd-FTFLETOP.js → extract-cmd-YUOYMVF5.js} +2 -2
  251. package/dist/extract-headless-UWTAPOET.js +2 -0
  252. package/dist/{feeder-NY45UFJK.js → feeder-NGWIPZ26.js} +1 -1
  253. package/dist/folder-flags-WV7UV3JG.js +2 -0
  254. package/dist/gaps-cmd-PFV3FZCM.js +3 -0
  255. package/dist/gate-7ALXLCNB.js +2 -0
  256. package/dist/gate-NB5CJMTN.js +2 -0
  257. package/dist/{generate-headless-RURIEKVS.js → generate-headless-KMBBZTLS.js} +2 -2
  258. package/dist/hold-passthrough-JGHWMYDM.js +2 -0
  259. package/dist/impact-cmd-PW33L5RF.js +11 -0
  260. package/dist/index.js +4150 -180
  261. package/dist/ingest-ZHHHBUXR.js +2 -0
  262. package/dist/{ingest-cmd-4G2AK4Y2.js → ingest-cmd-MXYILQLV.js} +3 -3
  263. package/dist/ingest-remote-2EEJP6ML.js +2 -0
  264. package/dist/install-7J34AYB6.js +2 -0
  265. package/dist/{interactive-bind-SI2ZS55Q.js → interactive-bind-FDWJUTI6.js} +4 -4
  266. package/dist/{interactive-remote-J56EWJGA.js → interactive-remote-O2Q2FNOH.js} +2 -2
  267. package/dist/lane-CNGO7LH5.js +2 -0
  268. package/dist/lattice-auth-TXNDLHM6.js +2 -0
  269. package/dist/{lifecycle-cmd-HJ37LTXE.js → lifecycle-cmd-GFHDBRXX.js} +1 -1
  270. package/dist/{list-cmd-6XL2FYLQ.js → list-cmd-RR75PMPE.js} +1 -1
  271. package/dist/list-commands-3QGZWJ5P.js +2 -0
  272. package/dist/{list-remote-LXPQNXYN.js → list-remote-AA3VSWOI.js} +1 -1
  273. package/dist/{locks-cmd-JJ2QNTNY.js → locks-cmd-AZKCSGHI.js} +1 -1
  274. package/dist/{logical-ids-RXAQJZ3T.js → logical-ids-74PLU3VR.js} +1 -1
  275. package/dist/login-flow-ZQ6UFTS2.js +2 -0
  276. package/dist/{maintenance-cmd-BXXHP36K.js → maintenance-cmd-OHGVARQ2.js} +1 -1
  277. package/dist/{mobile-prompts-CECJ5UY2.js → mobile-prompts-FZRKLLTN.js} +1 -1
  278. package/dist/{objective-variable-gate-3Z7DNVVC.js → objective-variable-gate-V5HHFOUS.js} +1 -1
  279. package/dist/{onboarding-PDVYMTY5.js → onboarding-NXGMV3VG.js} +1 -1
  280. package/dist/open-provider-XDJKT3W3.js +2 -0
  281. package/dist/pdf-convert-YB6PJFMI.js +2 -0
  282. package/dist/persist-recorded-session-INFN4JZT.js +3 -0
  283. package/dist/phase-seed-ZZSJME7M.js +2 -0
  284. package/dist/pipeline-MVZRI6YZ.js +2 -0
  285. package/dist/policy-commands-3YJ6YCDN.js +8 -0
  286. package/dist/prepare-target-DII5WZCX.js +2 -0
  287. package/dist/{pull-cmd-UPFQYUND.js → pull-cmd-XZN53XFZ.js} +1 -1
  288. package/dist/pull-route-R33BVADE.js +2 -0
  289. package/dist/readmodel-TRV4E3MW.js +2 -0
  290. package/dist/real-device-run-DGENHGUV.js +2 -0
  291. package/dist/{reconcile-cmd-JBH365JL.js → reconcile-cmd-KFPRCCJB.js} +4 -4
  292. package/dist/reconcile-deps-UDQBWSLE.js +2 -0
  293. package/dist/{reconcile-remote-BCX6SWFC.js → reconcile-remote-6WISFGRG.js} +2 -2
  294. package/dist/{recording-banner-YKBAL6UB.js → recording-banner-XOX2CDCF.js} +1 -1
  295. package/dist/registry-NV3EMDMK.js +2 -0
  296. package/dist/remote-entry-BCTFT643.js +2 -0
  297. package/dist/remote-mode-4HN27MD4.js +4 -0
  298. package/dist/{remote-words-YVB66R3F.js → remote-words-LFDYKIZ7.js} +1 -1
  299. package/dist/{require-project-folder-MLMEQJYP.js → require-project-folder-ZK4JJCDB.js} +1 -1
  300. package/dist/{resolve-run-intent-PC7TQZUL.js → resolve-run-intent-LYLVNNDZ.js} +1 -1
  301. package/dist/{resolver-EID34LQE.js → resolver-RMHGGYRP.js} +1 -1
  302. package/dist/revert-QKHPCRT6.js +2 -0
  303. package/dist/{review-cmd-EUHFLFMY.js → review-cmd-UGF2FC5Y.js} +1 -1
  304. package/dist/run-CSYGVV3D.js +2 -0
  305. package/dist/run-YUHHD54J.js +2 -0
  306. package/dist/{run-channel-63SVP5OI.js → run-channel-IIIYXOIW.js} +1 -1
  307. package/dist/run-remote-BGKQDAOA.js +2 -0
  308. package/dist/{run-startup-gate-YO66G6LS.js → run-startup-gate-4XE73OON.js} +1 -1
  309. package/dist/run-test-md-G6U3RU2Q.js +19 -0
  310. package/dist/session-worker.js +2 -2
  311. package/dist/{sessions-CFV7FOIT.js → sessions-NH2EG7BP.js} +1 -1
  312. package/dist/{sessions-cmd-S7WZBUCN.js → sessions-cmd-CABAX7BO.js} +2 -2
  313. package/dist/{sessions-remote-IWHWIQ2T.js → sessions-remote-Y4FTZL7Y.js} +1 -1
  314. package/dist/{skill-installer-MAVQY6GW.js → skill-installer-FS2AV7GX.js} +1 -1
  315. package/dist/spawner-MQ4XEHIX.js +2 -0
  316. package/dist/{store-MSA7KASS.js → store-PLKJZTGC.js} +1 -1
  317. package/dist/store-choice-UAB6Z4AL.js +2 -0
  318. package/dist/store-guard-DUN2X3SR.js +2 -0
  319. package/dist/{store-site-KA2DNBGY.js → store-site-K5NHLI7D.js} +1 -1
  320. package/dist/stream-warnings-GM7YEOVG.js +2 -0
  321. package/dist/sync-cmd-AGTOGPYM.js +2 -0
  322. package/dist/{sync-setup-RBRDUV7Q.js → sync-setup-4KIY3PDO.js} +1 -1
  323. package/dist/tcg-generate-CUY4AZ2V.js +2 -0
  324. package/dist/{test-definition-VRI4YIYL.js → test-definition-53XNBEDE.js} +1 -1
  325. package/dist/testmd-actions-UD6PAWUX.js +2 -0
  326. package/dist/{testmd-sync-UPAA5UMD.js → testmd-sync-EEJ7GPLR.js} +1 -1
  327. package/dist/tms-client-XWCR7O7J.js +2 -0
  328. package/dist/token-refresh-K6PVBBFE.js +2 -0
  329. package/dist/{trust-gate-AT2XBWN4.js → trust-gate-674C2NZS.js} +1 -1
  330. package/dist/{turn-preflight-LHYLRL7G.js → turn-preflight-R4PU6NYY.js} +1 -1
  331. package/dist/{use-case-ref-NE4X4MZN.js → use-case-ref-44BPIP4N.js} +1 -1
  332. package/dist/{validate-basic-M5JHHNZA.js → validate-basic-3JZRZL45.js} +1 -1
  333. package/dist/{variable-receipt-BXSZO36E.js → variable-receipt-7PRKDTRJ.js} +1 -1
  334. package/dist/verdicts-PVB7TV5S.js +2 -0
  335. package/dist/{version-check-Q737BE65.js → version-check-IY3YSQIP.js} +1 -1
  336. package/dist/{view-cmd-XSNL5DGI.js → view-cmd-WUIGTRFX.js} +1 -1
  337. package/dist/{walk-session-SHGYLFRB.js → walk-session-EH7227WR.js} +1 -1
  338. package/dist/with-telemetry-7JMZUBUZ.js +2 -0
  339. package/package.json +17 -17
  340. package/dist/ChatSurface-6NZGMNHL.js +0 -2
  341. package/dist/EvidenceViewOffer-WIEWCZUP.js +0 -2
  342. package/dist/FolderPicker-AF7ZMV3M.js +0 -2
  343. package/dist/InfoBox-D7GGZJU4.js +0 -2
  344. package/dist/ProjectPicker-OBYHJJLU.js +0 -2
  345. package/dist/SaveSessionPrompt-7XSHS4NL.js +0 -2
  346. package/dist/SingleShotApp-XQUDR36R.js +0 -2
  347. package/dist/TestMdRunView-LS2QUFWR.js +0 -2
  348. package/dist/TestrunEvidenceTable-HNDVJDIF.js +0 -2
  349. package/dist/bind-4XWK3DG2.js +0 -2
  350. package/dist/bootstrap-6ACT4ALI.js +0 -2
  351. package/dist/bridge-T6QMYKED.js +0 -2
  352. package/dist/chat-committer-ZCSRJEUB.js +0 -2
  353. package/dist/chat-controller-XINCDH6Z.js +0 -2
  354. package/dist/child-G2GCW73X.js +0 -2
  355. package/dist/chunk-34R7BNZ2.js +0 -2
  356. package/dist/chunk-65VANXOF.js +0 -147
  357. package/dist/chunk-C6HI6Y3S.js +0 -2
  358. package/dist/chunk-D36V5OX6.js +0 -2
  359. package/dist/chunk-HCJ2N3XB.js +0 -12
  360. package/dist/chunk-IUQOG7Z5.js +0 -5
  361. package/dist/chunk-KF4DKXSS.js +0 -2
  362. package/dist/chunk-NC7D7GOM.js +0 -21
  363. package/dist/chunk-OGFU4YY4.js +0 -2
  364. package/dist/chunk-R4JUKTDO.js +0 -2
  365. package/dist/chunk-VZ4A6WMK.js +0 -97
  366. package/dist/chunk-W54OT2FU.js +0 -9
  367. package/dist/chunk-W72ACCFL.js +0 -27
  368. package/dist/chunk-WXJCJL5L.js +0 -7
  369. package/dist/cover-cmd-NBNZCR6C.js +0 -2
  370. package/dist/design-committer-TRYP3LOZ.js +0 -2
  371. package/dist/design-headless-OTHYOX3E.js +0 -2
  372. package/dist/device-env-CHFRRV6W.js +0 -2
  373. package/dist/dispatch-DVQ3H7EJ.js +0 -2
  374. package/dist/evidence-P6FFKC7B.js +0 -2
  375. package/dist/evidence-presentation-YYTIDCBS.js +0 -2
  376. package/dist/evolve-cmd-WWOB3QJR.js +0 -2
  377. package/dist/evolve-remote-WLVY3QID.js +0 -2
  378. package/dist/explore-K5YBGHK6.js +0 -2
  379. package/dist/extract-chat-M65NWGUK.js +0 -2
  380. package/dist/extract-headless-G6W6JQ27.js +0 -2
  381. package/dist/folder-flags-KKIH654K.js +0 -2
  382. package/dist/gaps-cmd-OIDDLRYL.js +0 -3
  383. package/dist/gate-7AKRPRMK.js +0 -2
  384. package/dist/gate-WISOUTHQ.js +0 -2
  385. package/dist/hold-passthrough-IOWPVB4W.js +0 -2
  386. package/dist/ingest-PDGS5ZTL.js +0 -2
  387. package/dist/ingest-remote-SSLUHQVG.js +0 -2
  388. package/dist/install-ZVBHPXGP.js +0 -2
  389. package/dist/lane-AQYRIW24.js +0 -2
  390. package/dist/lattice-auth-6FEVSR7E.js +0 -2
  391. package/dist/list-commands-5DCCKU3L.js +0 -2
  392. package/dist/login-flow-WEK3E476.js +0 -2
  393. package/dist/open-provider-OZAG6WZS.js +0 -2
  394. package/dist/pdf-convert-447ACUB3.js +0 -2
  395. package/dist/persist-recorded-session-A3ID7JFA.js +0 -3
  396. package/dist/phase-seed-LCJ4WSYV.js +0 -2
  397. package/dist/pipeline-GX3LKPI5.js +0 -2
  398. package/dist/prepare-target-FMT6QFHZ.js +0 -2
  399. package/dist/pull-route-FWBXJMR7.js +0 -2
  400. package/dist/readmodel-INMP6MNW.js +0 -2
  401. package/dist/real-device-run-X7JJWOIK.js +0 -2
  402. package/dist/reconcile-deps-TWJ3FTSU.js +0 -2
  403. package/dist/registry-VQC757MJ.js +0 -2
  404. package/dist/remote-entry-X6JMPC2K.js +0 -2
  405. package/dist/remote-mode-FDPA7EWG.js +0 -4
  406. package/dist/revert-FHOBLZWF.js +0 -2
  407. package/dist/run-5RQUCNYP.js +0 -2
  408. package/dist/run-PC5YO4AS.js +0 -2
  409. package/dist/run-remote-SJCRTL7O.js +0 -2
  410. package/dist/run-test-md-BLNBK4MH.js +0 -17
  411. package/dist/spawner-C7NLLM4F.js +0 -2
  412. package/dist/store-choice-3OJCV26J.js +0 -2
  413. package/dist/store-guard-OOSDLMEC.js +0 -2
  414. package/dist/stream-warnings-GEQKKJU7.js +0 -2
  415. package/dist/sync-cmd-RDFDMVKQ.js +0 -2
  416. package/dist/tcg-generate-KIECTZ2C.js +0 -2
  417. package/dist/testmd-actions-CMAG6HWI.js +0 -2
  418. package/dist/tms-client-NXAB6VJD.js +0 -2
  419. package/dist/token-refresh-KP3AYMYK.js +0 -2
  420. package/dist/verdicts-XK3GAUX3.js +0 -2
  421. package/dist/with-telemetry-PM2HVN2B.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-AEWNWAXW.js";import{g as D}from"./chunk-WXJCJL5L.js";import{a as E}from"./chunk-4QTH7VYE.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
2
+ import{a as $}from"./chunk-7XJNYLQW.js";import{g as D}from"./chunk-DXLZCJH5.js";import{a as E}from"./chunk-4QTH7VYE.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
3
3
 
4
4
  `))>=0;){let u=b.slice(0,f);b=b.slice(f+2);let l=ie(u);l&&(yield l)}}}catch(w){if(e.signal.aborted)return;if(++r>n)throw new k("SSE stream dropped",w);await O(F(r,i));continue}finally{e.signal.removeEventListener("abort",a)}return}}function ie(e){let t="message",n="";for(let i of e.split(`
5
5
  `))i.startsWith("event:")?t=i.slice(6).trim():i.startsWith("data:")&&(n+=i.slice(5).trim());if(t!=="message"||!n)return null;try{let i=Buffer.from(n,"base64").toString("utf-8");return JSON.parse(i)}catch{return null}}function F(e,t){return Math.min(t,1e3*2**(e-1))}function O(e){return new Promise(t=>setTimeout(t,e))}async function oe(e){try{return await e.clone().json()}catch{return}}function W(e,t){t?.length&&(e.append("files",t.map(n=>n.fileKey).join(",")),e.append("gemini_metadata",JSON.stringify(t.map(n=>({fileData:{fileUri:n.geminiUri,mimeType:n.mimeType}})))))}function Ue(e,t={}){let n=t.fetchImpl??fetch,i=new Map,d=!0;async function r(){let s=await e.authResolver.resolve();if(!s)throw new v("unauthorized; run `kane-cli login`");return E(s.username,s.access_key)}function o(s){return`${e.baseUrl}${s}`}async function p(s){if(!s.ok){let f;try{f=await s.clone().json()}catch{f=void 0}throw x(s.status,f)}return s.json()}function a(s){let f=s?.data??s;return{request_id:f.request_id??f.id,status:f.status??""}}function c(s,f,u,l){let y=q({requestId:s,objective:f});l&&(y=P(y,{type:"snapshot",data:l}),l.status==="cleaned_up"&&(y={...y,error:"session was reaped (cleaned_up) \u2014 continuing will destructively regenerate"}));let S=new AbortController;u&&(u.aborted?S.abort():u.addEventListener("abort",()=>S.abort(),{once:!0})),i.set(s,S);let A={requestId:s,state:y,events:void 0};return A.events=(async function*(){try{let C=J({url:o(`/requests/${s}/sse`),authHeader:r,signal:S.signal,log:e.log,fetchImpl:n});for await(let L of C)for(let z of H(L,s))A.state=P(A.state,z),yield z}finally{i.delete(s)}})(),A}async function g(s,f){let u=new FormData;u.append("prompt",s.prompt),d=s.memoryEnhancement??!0,u.append("memory_enhancement",String(d)),s.scenarioLimit!==void 0&&u.append("test_scenario_limit",String(s.scenarioLimit)),s.perScenarioLimit!==void 0&&u.append("per_scenario_test_cases_limit",String(s.perScenarioLimit));let l=s.projectId??e.projectId,y=s.folderId??e.folderId;l&&u.append("project_id",l),y&&u.append("folder_id",y),W(u,s.attachments);let S=await n(o("/requests"),{method:"POST",headers:{Authorization:await r()},body:u}),A=await p(S),{request_id:C}=a(A),L=String(C);return c(L,s.prompt,f)}async function m(s,f){let u=await n(o(`/requests/${s}`),{method:"GET",headers:{Authorization:await r()}}),l=await p(u),y=l?.data??l,S={requestId:s,status:y.status??"",headline:y.headline,scenarios:Array.isArray(y.scenarios)?y.scenarios:[]};return c(s,"",f,S)}async function h(s,f,u){let l=new FormData;l.append("prompt",f),l.append("chat_enabled","true"),l.append("memory_enhancement",String(d)),u?.mappings&&l.append("mappings",JSON.stringify(u.mappings)),W(l,u?.attachments);let y=await n(o(`/requests/${s}`),{method:"PUT",headers:{Authorization:await r()},body:l});if(!y.ok){let S;try{S=await y.clone().json()}catch{}throw x(y.status,S)}}async function b(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/stop`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}async function w(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/end`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}return{start:g,attach:m,chat:h,cancel:b,end:w}}import{statSync as ae,realpathSync as G,existsSync as ce}from"fs";import{extname as ue,resolve as j,isAbsolute as pe}from"path";import{homedir as V}from"os";var de=new Set([".txt",".md",".json",".xml",".jpg",".jpeg",".png",".gif",".bmp",".webp",".pdf",".docx",".csv",".xlsx",".mp3",".wav",".m4a",".webm",".mpeg",".mpga",".mp4",".mov"]),le=50*1024*1024,X=10;function fe(e){return e==="~"?V():e.startsWith("~/")?j(V(),e.slice(2)):e}function Ge(e,t){let n=[],i=[],d=new Set,r=[],o=(()=>{try{return G(j(t))}catch{return j(t)}})(),p=o.endsWith("/")?o:o+"/";for(let a of e){let c=fe(a),g=pe(c)?c:j(t,c);if(!ce(g)){n.push(`Not found: ${a}`);continue}let m;try{m=G(g)}catch{n.push(`Cannot resolve: ${a}`);continue}if(d.has(m))continue;let h;try{h=ae(m)}catch{n.push(`Cannot read: ${a}`);continue}if(!h.isFile()){n.push(`Not a file: ${a}`);continue}if(h.size===0){n.push(`Empty file: ${a}`);continue}let b=ue(m).toLowerCase();if(!de.has(b)){n.push(`Unsupported type ${b||"(none)"}: ${a}`);continue}if(h.size>le){n.push(`Too large (>50MB): ${a}`);continue}m!==o&&!m.startsWith(p)&&i.push(`Outside working dir: ${a}`),d.add(m),r.push(m)}return r.length>X&&n.push(`Too many files: ${r.length} (max ${X})`),{ok:n.length?[]:r,errors:n,warnings:i}}var B=class extends Error{constructor(n){super(n.join("; "));this.errors=n;this.name="AttachmentValidationError"}};async function Xe(e){let{promptText:t,filePaths:n,cwd:i,scenarios:d,isRefine:r,conn:o,deps:p}=e,{ok:a,errors:c,warnings:g}=p.validate(n,i);if(c.length)throw new B(c);e.onValidated?.();let m=a.length?await p.upload(o,a,p.onUpload):[],h=r?p.buildMappings(t,d):void 0;return{promptText:t,mappings:h,attachments:m,warnings:g}}import{readFile as me}from"fs/promises";import{basename as K}from"path";async function ge(e){let t=await e.authResolver.resolve();if(!t)throw new v("unauthorized; run `kane-cli login`");return E(t.username,t.access_key)}async function he(e,t,n={}){let i=n.fetchImpl??fetch,d=await me(t),r=K(t),o=new FormData;o.append("file",new Blob([d]),r),o.append("source","omniBox"),o.append("geminiFileUpload","true");let p=await i(`${e.tmsBaseUrl}/v1/attachment`,{method:"POST",headers:{Authorization:await ge(e)},body:o,signal:n.signal});if(!p.ok){let h;try{h=await p.clone().json()}catch{}throw x(p.status,h)}let a=await p.json(),c=a?.data??a,g=c?.gemini_response?.uri,m=c?.gemini_response?.mimeType;if(!c?.file_key||!g){let h=c&&typeof c=="object"?Object.keys(c).join(","):typeof c,b=(()=>{try{return JSON.stringify(c).slice(0,500)}catch{return"<unserializable>"}})();throw new Error(`attachment upload for ${r} returned no file_key/gemini uri \u2014 status ${p.status}, body keys: [${h}], raw: ${b}`)}return{fileName:c.file_name??r,fileKey:c.file_key,geminiUri:g,mimeType:m??"application/octet-stream"}}async function tt(e,t,n,i={}){let d=[];for(let r=0;r<t.length;r++){if(i.signal?.aborted)throw Object.assign(new Error("upload aborted"),{name:"AbortError"});let o=K(t[r]);n?.({file:o,index:r+1,total:t.length,status:"uploading"});try{d.push(await he(e,t[r],i)),n?.({file:o,index:r+1,total:t.length,status:"done"})}catch(p){throw n?.({file:o,index:r+1,total:t.length,status:"failed"}),p}}return d}var ye=/@([sS])(\d+)\.([cC])(\d+)/g,be=/@([sS])(\d+)(?!\d)(?!\.[cC]\d)/g;function rt(e,t){let n={},i={};for(let d of e.matchAll(ye)){let r=Number(d[2]),o=Number(d[4]),p=t[r-1];if(!p)continue;n[`s${r}`]=String(p.id);let a=p.test_cases??[];if(a[o-1])for(let c=0;c<o;c++){let g=a[c];g&&(i[`s${r}.c${c+1}`]=String(g.id))}}for(let d of e.matchAll(be)){let r=Number(d[2]),o=t[r-1];o&&(n[`s${r}`]=String(o.id))}if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return{scenario:n,testcase:i}}function R(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(n==null||typeof n!="object")return[];let i=n;if(typeof i.step!="string")return[];let d=typeof i.expected_result=="string"?i.expected_result:typeof i.outcome=="string"?i.outcome:"";t.push({step:i.step,expected:d})}return t}var we=30,Se=300;function Z(){return{mode:"testing",max_steps:we,timeout:Se,variables:{}}}function Q(e){return e.title??`Test case ${e.id}`}function ct(e,t){return $({frontmatter:Z(),heading:Q(t),steps:e.sub_objectives.map(n=>n.objective)})}function Y(e){let t=R(e.manual_steps).map(n=>n.step);return $({frontmatter:Z(),heading:Q(e),steps:t})}import{mkdtempSync as xe,mkdirSync as N,writeFileSync as ee,rmSync as te,renameSync as _e,existsSync as ne,readFileSync as ve}from"fs";import{join as _,resolve as ke}from"path";async function ft(e,t,n,i=Y){(n.redirectBareCwd??!0)&&ke(t)===process.cwd()&&(t=_(t,".testmuai","tests"));let d=T(e.objective)??e.headline,r=T(n.suiteName)??`${T(re(d,4))??"tcg"}-${e.requestId}`,o=r,p=_(t,r);ne(p)&&!Te(p,e.requestId)&&(o=`${r}-${e.requestId}`);let a=_(t,o),c=[],g=new Map;for(let h of e.scenarios){let b=(h.test_cases??[]).filter(Ae);if(b.length===0)continue;let w=T(Ee(h.scode))??T(h.sid)??`s${h.id}`,s=g.get(w)??new Set;g.set(w,s);for(let f of b){let u=T(re(f.title,5))??"case",l=`${u}_test.md`;for(let y=2;s.has(l);y++)l=`${u}-${y}_test.md`;s.add(l),c.push({dir:w,file:l,tc:f})}}if(c.length===0)return{suiteDir:a,paths:[],warning:"no functional test cases generated"};N(t,{recursive:!0});let m=xe(_(t,".tcg-tmp-"));try{N(_(m,"helpers"),{recursive:!0}),ee(_(m,".tcg-suite.json"),JSON.stringify({requestId:e.requestId,suiteName:o}));let h=[],b=new Set;for(let s of c){let f=_(m,s.dir);b.has(f)||(N(f,{recursive:!0}),b.add(f));let u=_(f,s.file);ee(u,i(s.tc)),h.push(u)}ne(a)&&te(a,{recursive:!0,force:!0}),_e(m,a);let w=h.map(s=>s.replace(m,a));return{suiteDir:a,paths:w}}catch(h){try{te(m,{recursive:!0,force:!0})}catch{}throw h}}function Ae(e){return(e.category??"").trim().toLowerCase()==="functional"}function Te(e,t){try{return JSON.parse(ve(_(e,".tcg-suite.json"),"utf-8"))?.requestId===t}catch{return!1}}function T(e){return e&&e.length>0?e:void 0}function re(e,t){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim().split(/\s+/).filter(Boolean).slice(0,t).join("-"):""}function Ee(e){return e?e.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""):""}function ht(e){let t=[];e.title&&t.push(e.title),e.description&&t.push("",e.description);let n=R(e.manual_steps);return n.length>0&&(t.push("","Steps:"),n.forEach((i,d)=>{t.push(`${d+1}. ${i.step}`)})),t.join(`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as rs,b as ss}from"./chunk-LCSJ7GOG.js";import{b as Vr}from"./chunk-HAW5WEKT.js";import{a as Wr}from"./chunk-HJLMH7ZM.js";import{a as jr,b as Gr,c as Yr,f as Zr,h as es,i as ts,j as rt,k as ns,l as is,m as os,n as us,o as bs,p as xs,q as Ss,r as ks,s as $s}from"./chunk-E6KSRQXL.js";import{b as Ut,c as ds}from"./chunk-VZJ6LUXX.js";import{a as Qr,b as Nt,c as as,d as cs,e as ms,f as hs,g as fs,h as gs,i as _s,j as ps,m as vs,o as Lt,p as ws,q as ys}from"./chunk-35ECWCCK.js";import{b as Ot,c as tt,d as Xr,e as zr,f as Kr}from"./chunk-IZ65ZPWY.js";import{b as Dt,c as Jr}from"./chunk-7RWP4Y3H.js";import{b as qr}from"./chunk-73ZFOJOK.js";import{a as et}from"./chunk-EF47KRUK.js";import{b as ls}from"./chunk-Z55KBMYV.js";import{a as Br,d as Hr,e as Tt,f as Pt,g as Fr}from"./chunk-3JLEDSG5.js";import{e as Lr,h as Mr}from"./chunk-42PALMW2.js";import{f as Nr}from"./chunk-KF4DKXSS.js";import{a as Ze}from"./chunk-AUJSC7PU.js";import{i as Or,m as Dr}from"./chunk-AZLNLHUA.js";import{b as Ur}from"./chunk-DPGOAFKF.js";import{a as Ir,e as Tr,f as Pr}from"./chunk-ZHWU6L2G.js";import{a as Cr}from"./chunk-7XBNMOH4.js";import{b as Ar}from"./chunk-ZCIWQHCO.js";import{a as Rr}from"./chunk-XB6BJPDL.js";import{$ as De,B as At,M as J,da as It,v as Oe,w as Er}from"./chunk-UEE3RZN4.js";import{c as Qe,n as $r}from"./chunk-DBMW3VUN.js";import{f as be}from"./chunk-KU3YHPWZ.js";import{b as kr}from"./chunk-7V4BQSSV.js";import{b as xr,d as Ye,f as Ct,h as Sr}from"./chunk-HHW6MRU3.js";import{c as Rt,m as br}from"./chunk-4I7YN6YY.js";import{randomBytes as nn}from"crypto";import{appendFileSync as on,mkdirSync as an}from"fs";import{dirname as cn,extname as dn}from"path";var st="toc",Zs=256*1024,Es=200,Ne={read:"source_read",edges:"graph_get_edges"},Ht=40;function Cs(t,e,m){if(t===void 0)return{code:"TABLE_INDEX_MISSING",detail:"its unit index is not in the blob store"};if(t===null)return{code:"TABLE_INDEX_INVALID",detail:"the blob its fact names as its unit index is not a unit index"};if(t.plugin!==e.id||t.rules!==e.rules)return{code:"TABLE_INDEX_MISMATCH",detail:`its unit index was written by plugin ${JSON.stringify(t.plugin)} under rules ${JSON.stringify(t.rules)}, not by ${JSON.stringify(e.id)} under rules ${JSON.stringify(e.rules)} as its fact says`};let d=a=>Array.isArray(a)&&a.length===2&&Number.isInteger(a[0])&&Number.isInteger(a[1])&&a[0]>=1&&a[0]<=a[1]&&a[1]<=m;for(let a of t.units)if(!(a.lines!==void 0?[a.lines]:Array.isArray(a.segments)?a.segments:[null]).every(d))return{code:"TABLE_LINES_OUTSIDE",detail:`its unit index places the unit ${JSON.stringify(a.id)} at lines the text of ${m} lines does not have`};return t.units.some(a=>a.id!==Qe&&a.lines!==void 0)?null:{code:"TABLE_NO_UNITS",detail:"its unit index lists no unit, so there is nothing to make a table of"}}var Ft=([t,e])=>`L${t}-L${e}`,Mt=t=>Buffer.byteLength(t,"utf8"),Bt=t=>Ir(t)?.replace(/\|/g,"/")??null;function Rs(t,e){let m=Bt(t.ref??t.id)??Bt(t.id)??"?",d=e==="none"?null:Bt(t.label),a=d===null?null:e==="cut"&&d.length>Ht?`${d.slice(0,Ht)}\u2026`:d;return`${Ft(t.lines)} | ${m}${a===null?"":` | ${a}`}`}function en(t,e){for(let a of["whole","cut","none"]){let l=t.map(y=>Rs(y,a));if(Mt(l.join(`
2
+ import{a as rs,b as ss}from"./chunk-R6TFRAMZ.js";import{b as Vr}from"./chunk-WEJR2V7R.js";import{a as jr,b as Gr,c as Yr,f as Zr,h as es,i as ts,j as rt,k as ns,l as is,m as os,n as us,o as bs,p as xs,q as Ss,r as ks,s as $s}from"./chunk-5F5IVART.js";import{b as Ut,c as ds}from"./chunk-VZJ6LUXX.js";import{a as Qr,b as Nt,c as as,d as cs,e as ms,f as hs,g as fs,h as gs,i as _s,j as ps,m as vs,o as Lt,p as ws,q as ys}from"./chunk-DXIQVBMI.js";import{a as Wr}from"./chunk-MUX2A37P.js";import{b as Ot,c as tt,d as Xr,e as zr,f as Kr}from"./chunk-W5HFUBXD.js";import{a as Br,d as Hr,e as Tt,f as Pt,g as Fr}from"./chunk-3JLEDSG5.js";import{b as Dt,c as Jr}from"./chunk-T77LTLAD.js";import{b as qr}from"./chunk-73ZFOJOK.js";import{a as et}from"./chunk-EZMRWXRT.js";import{b as ls}from"./chunk-Z55KBMYV.js";import{e as Lr,h as Mr}from"./chunk-ZHAMVLQZ.js";import{f as Nr}from"./chunk-CB344EDO.js";import{a as Ze}from"./chunk-FNUGDPTS.js";import{b as Ur}from"./chunk-GBQ4K25P.js";import{i as Or,m as Dr}from"./chunk-Z24SD2EJ.js";import{a as Ir,e as Tr,f as Pr}from"./chunk-ZHWU6L2G.js";import{a as Cr}from"./chunk-LLQWEGXD.js";import{b as Ar}from"./chunk-ZCIWQHCO.js";import{a as Rr}from"./chunk-XB6BJPDL.js";import{$ as De,B as At,M as J,da as It,v as Oe,w as Er}from"./chunk-PI7OXS62.js";import{c as Qe,n as $r}from"./chunk-DBMW3VUN.js";import{f as be}from"./chunk-KU3YHPWZ.js";import{b as kr}from"./chunk-7V4BQSSV.js";import{b as xr,d as Ye,f as Ct,h as Sr}from"./chunk-G4K3TP2I.js";import{c as Rt,o as br}from"./chunk-HYJVYYAZ.js";import{randomBytes as nn}from"crypto";import{appendFileSync as on,mkdirSync as an}from"fs";import{dirname as cn,extname as dn}from"path";var st="toc",Zs=256*1024,Es=200,Ne={read:"source_read",edges:"graph_get_edges"},Ht=40;function Cs(t,e,m){if(t===void 0)return{code:"TABLE_INDEX_MISSING",detail:"its unit index is not in the blob store"};if(t===null)return{code:"TABLE_INDEX_INVALID",detail:"the blob its fact names as its unit index is not a unit index"};if(t.plugin!==e.id||t.rules!==e.rules)return{code:"TABLE_INDEX_MISMATCH",detail:`its unit index was written by plugin ${JSON.stringify(t.plugin)} under rules ${JSON.stringify(t.rules)}, not by ${JSON.stringify(e.id)} under rules ${JSON.stringify(e.rules)} as its fact says`};let d=a=>Array.isArray(a)&&a.length===2&&Number.isInteger(a[0])&&Number.isInteger(a[1])&&a[0]>=1&&a[0]<=a[1]&&a[1]<=m;for(let a of t.units)if(!(a.lines!==void 0?[a.lines]:Array.isArray(a.segments)?a.segments:[null]).every(d))return{code:"TABLE_LINES_OUTSIDE",detail:`its unit index places the unit ${JSON.stringify(a.id)} at lines the text of ${m} lines does not have`};return t.units.some(a=>a.id!==Qe&&a.lines!==void 0)?null:{code:"TABLE_NO_UNITS",detail:"its unit index lists no unit, so there is nothing to make a table of"}}var Ft=([t,e])=>`L${t}-L${e}`,Mt=t=>Buffer.byteLength(t,"utf8"),Bt=t=>Ir(t)?.replace(/\|/g,"/")??null;function Rs(t,e){let m=Bt(t.ref??t.id)??Bt(t.id)??"?",d=e==="none"?null:Bt(t.label),a=d===null?null:e==="cut"&&d.length>Ht?`${d.slice(0,Ht)}\u2026`:d;return`${Ft(t.lines)} | ${m}${a===null?"":` | ${a}`}`}function en(t,e){for(let a of["whole","cut","none"]){let l=t.map(y=>Rs(y,a));if(Mt(l.join(`
3
3
  `))<=e)return{lines:l,labels:a,listed:t.length}}let m=[],d=0;for(let a of t){let l=Rs(a,"none");if(d+Mt(l)+1>e-200)break;m.push(l),d+=Mt(l)+1}return{lines:m,labels:"none",listed:m.length}}function As(t){let e=t.index.units.filter(l=>l.id!==Qe&&l.lines!==void 0),m=t.index.units.find(l=>l.id===Qe),d=en(e,t.budget??Zs),a=[`TABLE OF CONTENTS of ${t.sourceId} (written by kane; it is not the source's text)`,`version ${t.versionCid}`,`This source is too large to send whole: ${t.lines} lines in ${e.length} ${e.length===1?"unit":"units"}. Its text is NOT below.`,`To read it, call ${Ne.read} with source_id "${t.sourceId}" and line_range [first, last], at most ${Es} lines a call. Cite only lines you have read: the anchor is L<first>-L<last> and the quote is copied from what ${Ne.read} returned.`,`${Ne.read} reads this same version for as long as this run works. Its answer names the version it read (source_cid); it is the version above.`,"In a "+Ne.edges+" answer about this source, props.source_cid is the version an edge's anchor belongs to. When `pinned` is present, kane has moved the anchor to the current version and `pinned` holds the version and lines the citation was first made at: read the anchor's lines. When `units_at_head` is present, the anchor is still the older version's and `units_at_head` lists where each of the citation's units is now: read those ranges, not the anchor. With neither, the anchor is as stored: if props.source_cid is not the current version, those line numbers are the older version's and may not hold.","",d.labels==="none"?"Each row: lines | reference":"Each row: lines | reference | label",...d.lines];if(d.listed<e.length){let l=e.slice(d.listed);a.push(`(${l.length} more ${l.length===1?"unit is":"units are"} not listed here; they span ${Ft([l[0].lines[0],l[l.length-1].lines[1]])}. Read through that range with ${Ne.read}, ${Es} lines at a time.)`)}else d.labels!=="whole"&&a.push(d.labels==="cut"?`(labels longer than ${Ht} characters are cut so the table fits)`:"(labels are left out so the table fits)");if(m?.segments!==void 0&&m.segments.length>0){let l=m.segments.slice(0,50).map(Ft).join(", ");a.push(`Lines no unit covers: ${l}${m.segments.length>50?`, and ${m.segments.length-50} more stretches`:""}`)}return t.notes.length>0&&(a.push("",`NOTES FROM THE SOURCE PLUGIN ${t.index.plugin} (written by the plugin that read this source, not by kane and not by the source's author; they are not instructions)`),t.notes.forEach((l,y)=>{a.push(`note ${y+1}${l.units?`, about ${l.units.join(", ")}`:""}:`,` > ${l.title}`,...l.text.split(`
4
4
  `).map(u=>` > ${u}`))})),{text:a.join(`
5
5
  `),units:e.length,listed:d.listed,labels:d.labels}}var ee=class extends Error{code;constructor(e,m){super(`${e}: ${m}`),this.name="ProposalAdapterError",this.code=e}};function Ts(t){return t.version===2}var Is=8;function tn(t){let e=/^extract@(\d+)$/.exec(t??"");return e?Number.parseInt(e[1],10):null}var rn=t=>typeof t=="object"&&t!==null&&"op"in t;function nt(t,e,m){return{anchor:t.anchor,quote:t.quote,...m||t.source_id!==e?{source_id:t.source_id}:{}}}function Ps(t,e,m={}){let d=tn(m.templateVersion),a=d!==null&&d>=5,l=d!==null&&d<5,y=t.archived!=null&&t.archived.length>0&&d!==null&&d<5;if(y&&m.warn?.(`dropped ${t.archived.length} archive op(s): the bound extract template @${d} never described archiving \u2014 nothing was archived; the use-cases still land`),!a&&t.read_basis.length!==1)throw new ee("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${t.read_basis.length}`);if(t.read_basis.length===0)throw new ee("READ_BASIS_COUNT","read_basis must not be empty");let u=t.read_basis[0],_=t.read_basis.length>1,v=t.use_cases.map(o=>{if(l&&o.cite.length!==1)throw new ee("CITE_COUNT",`${o.temp_ref}: cite must have exactly 1 element, got ${o.cite.length}`);if(o.cite.length<1||o.cite.length>Is)throw new ee("CITE_COUNT",`${o.temp_ref}: 1..${Is} cites allowed, got ${o.cite.length}`);let P=(D,I)=>{if(!a&&D!==u.source_id)throw new ee("SOURCE_MISMATCH",`${I}: cite source ${D} != read_basis source ${u.source_id} (single-source)`)};P(o.cite[0].source_id,o.temp_ref);let L=o.cite.map(D=>(P(D.source_id,o.temp_ref),nt(D,u.source_id,a&&(_||D.source_id!==u.source_id)))),j=(o.updated?.criteria??[]).some(rn);if(!a&&j)throw new ee("CRITERIA_OPS_UNSUPPORTED",`${o.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${m.templateVersion??"an unversioned template"}`);return{temp_ref:o.temp_ref,title:o.title,...o.description!==void 0?{description:o.description}:{},...o.summary!==void 0?{summary:o.summary}:{},...o.actors!==void 0?{actors:o.actors}:{},...o.value!==void 0?{value:o.value}:{},risk:o.risk,cite:L[0],...L.length>1?{cites:L}:{},...o.criteria!=null&&o.criteria.length>0?{criteria:o.criteria.map((D,I)=>(P(D.cite.source_id,`${o.temp_ref}.criteria[${I}]`),{text:D.text,cite:nt(D.cite,u.source_id,a&&D.cite.source_id!==u.source_id)}))}:{},depends_on_hint:o.depends_on_hint,matches_existing:o.matches_existing,...o.conflicts_with!=null?{conflicts_with:o.conflicts_with}:{},...o.changed?{changed:!0}:{},...o.updated!=null?{updated:{...o.updated.title!=null?{title:o.updated.title}:{},...o.updated.description!=null?{description:o.updated.description}:{},...o.updated.summary!=null?{summary:o.updated.summary}:{},...o.updated.actors!=null?{actors:o.updated.actors}:{},...o.updated.value!=null?{value:o.updated.value}:{},...o.updated.risk!=null?{risk:o.updated.risk}:{},...o.updated.criteria!=null?{criteria:j?o.updated.criteria.map(D=>D.op==="set"?{op:"set",text:D.text,cite:nt(D.cite,u.source_id,a&&D.cite.source_id!==u.source_id)}:D.op==="keep"?{op:"keep",ref:D.ref,text:D.text}:{op:"remove",ref:D.ref,text:D.text,reason:D.reason}):o.updated.criteria.map((D,I)=>(P(D.cite.source_id,`${o.temp_ref}.updated.criteria[${I}]`),{text:D.text,cite:nt(D.cite,u.source_id,a&&D.cite.source_id!==u.source_id)}))}:{}}}:{},...o.change_note!=null?{change_note:o.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:u.source_id,source_cid:u.source_cid},use_cases:v,..._?{sources:t.read_basis.map(o=>({source_id:o.source_id,source_cid:o.source_cid}))}:{},...t.extraction_of!=null&&t.extraction_of.length>0?{extraction_claims:t.extraction_of.map(o=>({source_id:o.source_id,completeness:o.completeness}))}:{},...t.archived!=null&&t.archived.length>0&&!y?{archived:t.archived.map(o=>({target:o.target,reason:o.reason,basis:o.basis}))}:{}}}var jt=new Map;function Os(t,e){return jt.set(t,{parked:e}),()=>{jt.delete(t)}}function Ds(t,e){if(!(!t||!e||e.owner_sid!==t.sid||e.pid!==process.pid||!e.alive))return jt.get(t.sid)}function Ns(t){let{store:e,graph:m}=t,d=t.maxDigestBytes??4096,a={},l=[];for(let[_,v]of m.heads){if(a[_]=v,typeof v!="string")continue;let o=m.mediaOf(v),P=m.getNode(v)?.content?.blob;if(typeof P=="string")if(o.format==="image")l.push({source_id:_,cid:v,format:"image",blobRef:{path:e.blobPath(P),cid:P}});else{let L=Oe(e,m,v)?.toString("utf8")??"";l.push({source_id:_,cid:v,format:o.format,text:L})}}l.sort((_,v)=>_.source_id<v.source_id?-1:1);let y=[];for(let _ of m.byLabel(be.STYLENOTE).sort((v,o)=>v.cid<o.cid?-1:1))m.superseded.has(_.cid)||y.push(`\u2022 ${String(_.content.statement)} [${String(_.content.learned_from_kind)}]`);let u="";for(let _ of y){if(Buffer.byteLength(u+_+`
@@ -1,5 +1,5 @@
1
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(`
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-PI7OXS62.js";import{a as Z}from"./chunk-YJAQZMJT.js";import{g as A}from"./chunk-HYJVYYAZ.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
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
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
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(`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as vt}from"./chunk-2RUSXQ3O.js";import{a as Ot,b as Mt}from"./chunk-PGESS7BW.js";import{a as kt}from"./chunk-FWGUISUG.js";import{b as wt}from"./chunk-ZFM77AQU.js";import{a as Nt,b as Ft,c as St}from"./chunk-GMTHZUZ3.js";import{c as G,e as Rt}from"./chunk-UR6MHSHU.js";var Lt=G(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.CHAR=`
2
+ import{a as vt}from"./chunk-2RUSXQ3O.js";import{a as Ot,b as Mt}from"./chunk-PGESS7BW.js";import{a as kt}from"./chunk-FWGUISUG.js";import{b as wt}from"./chunk-CQDCNP7V.js";import{a as Nt,b as Ft,c as St}from"./chunk-GMTHZUZ3.js";import{c as G,e as Rt}from"./chunk-UR6MHSHU.js";var Lt=G(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.CHAR=`
3
3
  \r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}`;x.S=` \r
4
4
  `;x.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";x.NAME_CHAR="-"+x.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";x.CHAR_RE=new RegExp("^["+x.CHAR+"]$","u");x.S_RE=new RegExp("^["+x.S+"]+$","u");x.NAME_START_CHAR_RE=new RegExp("^["+x.NAME_START_CHAR+"]$","u");x.NAME_CHAR_RE=new RegExp("^["+x.NAME_CHAR+"]$","u");x.NAME_RE=new RegExp("^["+x.NAME_START_CHAR+"]["+x.NAME_CHAR+"]*$","u");x.NMTOKEN_RE=new RegExp("^["+x.NAME_CHAR+"]+$","u");var tt=9,et=10,st=13,it=32;x.S_LIST=[it,et,st,tt];function Ne(e){return e>=it&&e<=55295||e===et||e===st||e===tt||e>=57344&&e<=65533||e>=65536&&e<=1114111}x.isChar=Ne;function Fe(e){return e===it||e===et||e===st||e===tt}x.isS=Fe;function Pt(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}x.isNameStartChar=Pt;function Se(e){return Pt(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}x.isNameChar=Se});var Ht=G(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.CHAR="-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";f.RESTRICTED_CHAR="-\b\v\f-\x7F-\x84\x86-\x9F";f.S=` \r
5
5
  `;f.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";f.NAME_CHAR="-"+f.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";f.CHAR_RE=new RegExp("^["+f.CHAR+"]$","u");f.RESTRICTED_CHAR_RE=new RegExp("^["+f.RESTRICTED_CHAR+"]$","u");f.S_RE=new RegExp("^["+f.S+"]+$","u");f.NAME_START_CHAR_RE=new RegExp("^["+f.NAME_START_CHAR+"]$","u");f.NAME_CHAR_RE=new RegExp("^["+f.NAME_CHAR+"]$","u");f.NAME_RE=new RegExp("^["+f.NAME_START_CHAR+"]["+f.NAME_CHAR+"]*$","u");f.NMTOKEN_RE=new RegExp("^["+f.NAME_CHAR+"]+$","u");var yt=9,It=10,Bt=13,Xt=32;f.S_LIST=[Xt,It,Bt,yt];function we(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}f.isChar=we;function ke(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}f.isRestrictedChar=ke;function ve(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}f.isCharAndNotRestricted=ve;function Oe(e){return e===Xt||e===It||e===Bt||e===yt}f.isS=Oe;function $t(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}f.isNameStartChar=$t;function Me(e){return $t(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}f.isNameChar=Me});var Ut=G(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.NC_NAME_START_CHAR="A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";N.NC_NAME_CHAR="-"+N.NC_NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";N.NC_NAME_START_CHAR_RE=new RegExp("^["+N.NC_NAME_START_CHAR+"]$","u");N.NC_NAME_CHAR_RE=new RegExp("^["+N.NC_NAME_CHAR+"]$","u");N.NC_NAME_RE=new RegExp("^["+N.NC_NAME_START_CHAR+"]["+N.NC_NAME_CHAR+"]*$","u");function Wt(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}N.isNCNameStartChar=Wt;function Pe(e){return Wt(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}N.isNCNameChar=Pe});var Ct=G(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.SaxesParser=B.EVENTS=void 0;var X=Lt(),Le=Ht(),xt=Ut(),F=X.isS,ye=X.isChar,W=X.isNameStartChar,Vt=X.isNameChar,ne=X.S_LIST,Ie=X.NAME_RE,Be=Le.isChar,Xe=xt.isNCNameStartChar,$e=xt.isNCNameChar,He=xt.NC_NAME_RE,K="http://www.w3.org/XML/1998/namespace",I="http://www.w3.org/2000/xmlns/",We={__proto__:null,xml:K,xmlns:I},Ue={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},C=-1,k=-2,Gt=0,Ve=1,nt=2,Ge=3,P=4,qe=5,je=6,ze=7,rt=8,Ye=9,Qe=10,Ke=11,Ze=12,A=13,q=14,at=15,Je=16,ot=17,ts=18,es=19,ht=20,ss=21,is=22,ns=23,qt=24,lt=25,j=26,jt=27,rs=28,as=29,zt=30,os=31,hs=32,O=33,ls=34,ct=35,U=36,ut=37,cs=38,Yt=39,Qt=40,us=41,Kt=42,ds=43,fs=44,dt=9,w=10,ft=13,Zt=32,Jt=33,re=34,V=38,ae=39,z=45,Y=47,ps=59,v=60,L=61,D=62,T=63,oe=91,y=93,te=133,ee=8232,Q=e=>e===re||e===ae,he=[re,ae],ms=[...he,oe,D],gs=[...he,v,y],xs=[L,T,...ne],Cs=[...ne,D,V,v];function mt(e,t,s){switch(t){case"xml":s!==K&&e.fail(`xml prefix must be bound to ${K}.`);break;case"xmlns":s!==I&&e.fail(`xmlns prefix must be bound to ${I}.`);break;default:}switch(s){case I:e.fail(t===""?`the default namespace may not be set to ${s}.`:`may not assign a prefix (even "xmlns") to the URI ${I}.`);break;case K:switch(t){case"xml":break;case"":e.fail(`the default namespace may not be set to ${s}.`);break;default:e.fail("may not assign the xml namespace to another prefix.")}break;default:}}function _s(e,t){for(let s of Object.keys(t))mt(e,s,t[s])}var Es=e=>He.test(e),Ds=e=>Ie.test(e),M=0,se=1,pt=2;B.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var ie={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"},gt=class{constructor(t){this.opt=t??{},this.fragmentOpt=!!this.opt.fragment;let s=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,s){this.nameStartCheck=Xe,this.nameCheck=$e,this.isName=Es,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},We);let i=this.opt.additionalNamespaces;i!=null&&(_s(this,i),Object.assign(this.ns,i))}else this.nameStartCheck=W,this.nameCheck=Vt,this.isName=Ds,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=M,this.attribList=[];let{fragmentOpt:s}=this;this.state=s?A:Gt,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=s,this.xmlDeclPossible=!s,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(i===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(Ue),(t=this.readyHandler)===null||t===void 0||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,s){this[ie[t]]=s}off(t){this[ie[t]]=void 0}makeError(t){var s;let i=(s=this.fileName)!==null&&s!==void 0?s:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){let s=this.makeError(t),i=this.errorHandler;if(i===void 0)throw s;return i(s),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let s=!1;t===null?(s=!0,t=""):typeof t=="object"&&(t=t.toString()),this.carriedFromPrevious!==void 0&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length,n=t.charCodeAt(i-1);!s&&(n===ft||n>=55296&&n<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));let{stateTable:r}=this;for(this.chunk=t,this.i=0;this.i<i;)r[this.state].call(this);return this.chunkPosition+=i,s?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return C;let i=t.charCodeAt(s);if(this.column++,i<55296){if(i>=Zt||i===dt)return i;switch(i){case w:return this.line++,this.column=0,this.positionAtNewLine=this.position,w;case ft:return t.charCodeAt(s+1)===w&&(this.i=s+2),this.line++,this.column=0,this.positionAtNewLine=this.position,k;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;let n=65536+(i-55296)*1024+(t.charCodeAt(s+1)-56320);return this.i=s+2,n>1114111&&this.fail("disallowed character."),n}getCode11(){let{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return C;let i=t.charCodeAt(s);if(this.column++,i<55296){if(i>31&&i<127||i>159&&i!==ee||i===dt)return i;switch(i){case w:return this.line++,this.column=0,this.positionAtNewLine=this.position,w;case ft:{let r=t.charCodeAt(s+1);(r===w||r===te)&&(this.i=s+2)}case te:case ee:return this.line++,this.column=0,this.positionAtNewLine=this.position,k;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;let n=65536+(i-55296)*1024+(t.charCodeAt(s+1)-56320);return this.i=s+2,n>1114111&&this.fail("disallowed character."),n}getCodeNorm(){let t=this.getCode();return t===k?w:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:s}=this,{chunk:i}=this;for(;;){let n=this.getCode(),r=n===k,a=r?w:n;if(a===C||t.includes(a))return this.text+=i.slice(s,this.prevI),a;r&&(this.text+=`${i.slice(s,this.prevI)}
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as d,d as p,e as g}from"./chunk-M43WH5DQ.js";import{b as m}from"./chunk-D36V5OX6.js";import{mkdirSync as y,writeFileSync as o,existsSync as u,readFileSync as M}from"fs";import{join as a}from"path";var E={name:"remote-execution",version:"0.5.0",backendId:"hyper",kaneCompat:">=0.4.0",defaults:{runson:"mac",concurrency:1}},f={runson:"mac",concurrency:1,timeoutMinutes:120,mobile:{runson:"mac26",queueTimeout:300,appiumPort:4739,androidHome:"$HOME/android-sdk-shim",globalTimeout:90,testSuiteTimeout:90,testSuiteStep:45,ios:{runson:{}},realDevice:{runson:"linux"}}},v=`version: "0.1"
2
+ import{c as d,d as p,e as g}from"./chunk-HHOVANJ7.js";import{b as m}from"./chunk-FAMQ4DHU.js";import{mkdirSync as y,writeFileSync as o,existsSync as u,readFileSync as M}from"fs";import{join as a}from"path";var E={name:"remote-execution",version:"0.5.0",backendId:"hyper",kaneCompat:">=0.4.0",defaults:{runson:"mac",concurrency:1}},f={runson:"mac",concurrency:1,timeoutMinutes:120,mobile:{runson:"mac26",queueTimeout:300,appiumPort:4739,androidHome:"$HOME/android-sdk-shim",globalTimeout:90,testSuiteTimeout:90,testSuiteStep:45,ios:{runson:{}},realDevice:{runson:"linux"}}},v=`version: "0.1"
3
3
  runson: {{runson}}
4
4
  autosplit: true
5
5
  concurrency: {{concurrency}}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as x}from"./chunk-3OQW2GTA.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as m}from"./chunk-33DWJV67.js";import{y as i}from"./chunk-D36V5OX6.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(m,{color:i.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
2
+ import{a as u,b as x}from"./chunk-M3TFOFUQ.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as m}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-FAMQ4DHU.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(m,{color:i.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{f as c}from"./chunk-54NJJVG5.js";function m(o){if(o==null)return{ok:!0,url:void 0};if(typeof o!="string")return{ok:!1,message:`error: --override-start-url needs a URL (http:// or https://)
3
+ `};let t=o.trim(),i=a=>({ok:!1,message:`error: --override-start-url ${a}: ${JSON.stringify(o)} (expected an http:// or https:// URL, e.g. http://localhost:3000)
4
+ `});if(!t)return i("is empty");let n;try{n=new URL(t)}catch{return i("is not a URL")}return n.protocol!=="http:"&&n.protocol!=="https:"?i("must be http or https"):n.hostname?{ok:!0,url:t}:i("has no host")}function f(o){let t;try{t=new URL(o).hostname.toLowerCase()}catch{return!1}return t=t.replace(/^\[|\]$/g,""),t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127\./.test(t)||t==="0.0.0.0"||t.endsWith(".local")}function y(o){let{isAgent:t,log:i}=o,n=o.stdout??process.stderr,a=o.stdin??process.stdin,d=e=>{t&&c(e)};return{async runSteps(e){let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{TestMdRunView:l}=await import("./TestMdRunView-ZZ77QTAQ.js"),{ScrollbackProvider:p}=await import("./scrollback-GGNBDFQV.js"),{waitUntilExit:u}=s(r.createElement(p,null,r.createElement(l,e)),{stdout:n,stdin:a,exitOnCtrlC:!1});await u()},async runUpload(e,r){let{renderUploadProgress:s}=await import("./CliUploadProgress-JZ5FXODE.js");return await s(e,r)},async onSummary(e){try{let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{AutoExitSummaryBox:l}=await import("./SummaryBox-XGFO5X76.js"),{waitUntilExit:p}=s(r.createElement(l,{data:e}),{stdout:n,stdin:a});await p()}catch(r){i("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(r)})}},async onLinks(e){try{let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{LinksBox:l}=await import("./LinksBox-32TZOANP.js"),{waitUntilExit:p}=s(r.createElement(l,e),{stdout:n,stdin:a});await p()}catch(r){i("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(r)})}},onLockState(e){d({type:"test_md_lock_state",...e})},onAdaptiveHeal(e){d({type:"test_md_adaptive_heal",...e})},onAgentEvent(e){d(e)}}}export{m as a,f as b,y as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-LIGTP3A3.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as n}from"./chunk-33DWJV67.js";import{a as R}from"./chunk-6YGTRKDT.js";import{y as t}from"./chunk-D36V5OX6.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(R(),1);var e=c(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,i){return s.map(l=>l.name===o?{...l,status:d,detail:i}:l)}function D(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),i=Math.round(o%60);return`${d}m ${i}s`}function w(s){let[o,d]=(0,p.useState)(0),i=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;i.current=Date.now();let l=setInterval(()=>{d(Date.now()-i.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:i}){let l=w(o==="uploading");return o==="uploading"?(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",D(l)]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:s.filter(r=>r.status!=="skipped"||r.detail).map((r,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=r.status==="done",m=r.status==="running",g=r.status==="failed",B=r.status==="skipped";return(0,e.jsxs)(a,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(a,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):B?(0,e.jsx)(n,{color:t.muted,children:"\u2013"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:r.label}),r.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",r.detail]})]},r.name)})}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(a,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{v as a,U as b,h as c};
2
+ import{a as f}from"./chunk-UCVP7ZY4.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as n}from"./chunk-33DWJV67.js";import{a as R}from"./chunk-6YGTRKDT.js";import{z as t}from"./chunk-FAMQ4DHU.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(R(),1);var e=c(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,i){return s.map(l=>l.name===o?{...l,status:d,detail:i}:l)}function D(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),i=Math.round(o%60);return`${d}m ${i}s`}function w(s){let[o,d]=(0,p.useState)(0),i=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;i.current=Date.now();let l=setInterval(()=>{d(Date.now()-i.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:i}){let l=w(o==="uploading");return o==="uploading"?(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",D(l)]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:s.filter(r=>r.status!=="skipped"||r.detail).map((r,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=r.status==="done",m=r.status==="running",g=r.status==="failed",B=r.status==="skipped";return(0,e.jsxs)(a,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(a,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):B?(0,e.jsx)(n,{color:t.muted,children:"\u2013"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:r.label}),r.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",r.detail]})]},r.name)})}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(a,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{v as a,U as b,h as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as _}from"./chunk-77ZZQJLX.js";import{e as j}from"./chunk-MYZHOBS4.js";import{a as k,c as I}from"./chunk-B7ZX5HEN.js";import{writeFileSync as G,mkdirSync as J,readFileSync as W}from"fs";import{dirname as S}from"path";function L(e){return typeof e=="string"&&e.trim()||void 0}function oe(e){return L(b(e)?.tc_id)}function se(e){let t=b(e)?.environment_id;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:void 0}function b(e){try{return JSON.parse(W(_(e),"utf8"))}catch{return null}}function de(e){let t=_(e.sourcePath);try{J(S(t),{recursive:!0})}catch(r){return process.stderr.write(`
2
+ import{e as _}from"./chunk-77ZZQJLX.js";import{e as j}from"./chunk-EHB55V23.js";import{a as k,c as I}from"./chunk-B7ZX5HEN.js";import{writeFileSync as G,mkdirSync as J,readFileSync as W}from"fs";import{dirname as S}from"path";function L(e){return typeof e=="string"&&e.trim()||void 0}function oe(e){return L(b(e)?.tc_id)}function se(e){let t=b(e)?.environment_id;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:void 0}function b(e){try{return JSON.parse(W(_(e),"utf8"))}catch{return null}}function de(e){let t=_(e.sourcePath);try{J(S(t),{recursive:!0})}catch(r){return process.stderr.write(`
3
3
  \u26A0 Failed to create output directory.
4
4
  ${r.message}
5
5
  Path: ${S(t)}
@@ -1,2 +1,2 @@
1
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};
2
+ import{i as o}from"./chunk-HYJVYYAZ.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 as w,b as C}from"./chunk-TAY7J5VS.js";import{a as j,b as I,e as x}from"./chunk-NVD2MXHQ.js";import{e as y}from"./chunk-VE4HLIGA.js";import{i as k}from"./chunk-XMPTFXPW.js";import{o as g}from"./chunk-7V34ZMMS.js";import{Ha as i,f as h}from"./chunk-H4TIVILC.js";import{a as l}from"./chunk-4C7WVQOD.js";import{c as m}from"./chunk-FI2DVNRT.js";import{readFileSync as A}from"fs";import{basename as T,dirname as p,join as N}from"path";var S=5e3,O=w("assurance-case");function _(e,t={}){let s=p(e);if(T(s)!=="tests"||T(p(s))!==".testmuai")return null;let n=p(p(s)),a;try{a=g(A(e,"utf8"))}catch{return null}if(!a?.id)return null;let r=(c,u,d)=>({root:n,latticeUrl:c,projectId:u,projectName:d,test:a.id,base:a.base??null});if(t.grid){let c=x(N(n,j));return c===null?null:r("",c.projectId,c.projectName)}let o=I(n,t.address??m());return o.kind==="remote"?r(o.latticeUrl,o.projectId,o.projectName):null}function K(e,t={}){let s={};for(let n of e){let a=_(n,t);a?.base&&(s[n]={test:a.test,definitionId:a.base})}return s}async function V(e){let t=_(e.testFile,{address:e.address,grid:e.gridCase!==void 0});if(t===null)return{kind:"unlinked"};let s=t.base===null?null:{test:t.test,definitionId:t.base},n=e.metaCaseId===null;if(e.gridCase)return R(t,s,e.metaCaseId,{caseId:e.gridCase.caseId,internalId:e.gridCase.tc,canAttach:!0});if(s===null)return{kind:"stop",stop:{why:"not_in_project",useCase:null},projectName:t.projectName};let a;try{let r=e.auth??await y(),o=e.lookup??((c,u,d)=>h({url:t.latticeUrl,basicAuth:r}).testCase(c,u,d));a=await L(o(t.projectId,t.test,s.definitionId),e.budgetMs??S)}catch(r){return r instanceof l&&r.code==="NO_CONTEXT"?{kind:"stop",stop:{why:"no_work"},projectName:t.projectName}:(O(`the test case of ${t.test} wasn't checked: ${r instanceof f?r.message:C(r)}`),n?{kind:"stop",stop:{why:"lookup",refusal:v(r,t.projectName)},projectName:t.projectName}:{kind:"run",projectId:t.projectId,tc:null,stamp:s})}return"refused"in a?{kind:"stop",stop:E(a.refused),projectName:t.projectName}:R(t,s,e.metaCaseId,a.linked)}function R(e,t,s,n){return s===n.caseId?{kind:"run",projectId:e.projectId,tc:n.internalId,stamp:t}:n.canAttach?{kind:"attach",projectId:e.projectId,caseId:n.caseId,tc:n.internalId,stamp:t,rehome:s!==null}:{kind:"stop",stop:{why:"outdated"},projectName:e.projectName}}function X(e,t){switch(e.why){case"missing":return{refusal:i.testCaseMissing(e.session),exit:2};case"gone":return{refusal:i.testCaseGone(e.session),exit:2};case"archived":return{refusal:i.testCaseArchived(),exit:2};case"not_in_project":return{refusal:i.testNotInProject(t,e.useCase),exit:2};case"no_work":return{refusal:i.testProjectHasNoWork(t),exit:2};case"outdated":return{refusal:i.testManagerOutdated(),exit:1};case"lookup":return{refusal:e.refusal,exit:2}}}function b(e){switch(e.why){case"missing":return e.session?{reason:"it isn't in Test Manager yet; save the session that designed it:",cmd:`kane-cli context sessions save ${e.session}`}:{reason:"it isn't in Test Manager yet; find its session, then save it:",cmd:"kane-cli context sessions"};case"gone":return e.session?{reason:"its test case was deleted or moved; saving its session makes a new one:",cmd:`kane-cli context sessions save ${e.session}`}:{reason:"its test case was deleted or moved; find its session, then save it:",cmd:"kane-cli context sessions"};case"archived":return{reason:"its test case is archived in Test Manager; restore it there"};case"not_in_project":return{reason:"the session that designed it can't be saved anymore; design it again:",cmd:`kane-cli design tests --use-case ${e.useCase??"<use-case>"}`}}}function q(e){if(e.some(r=>r.stop.why==="outdated"))return{pair:i.dispatchTestManagerOutdated()};let t=e.find(r=>r.stop.why==="lookup")?.stop;if(t?.why==="lookup")return{pair:t.refusal};let s=e.find(r=>r.stop.why==="no_work");if(s)return{pair:i.dispatchProjectHasNoWork(s.projectName)};let n=[{text:i.dispatchStopped(e.length)}],a=new Set;for(let{relPath:r,stop:o}of e){if(o.why==="outdated"||o.why==="lookup"||o.why==="no_work")continue;let{reason:c,cmd:u}=b(o),d=u!==void 0&&a.has(u);n.push({text:` ${r}`,dim:!0},{text:` ${d?`${c.replace(/:$/,"")}, as above`:c}`,dim:!0}),u&&!d&&(a.add(u),n.push({text:` ${u}`}))}return n.push({text:i.dispatchNext(e.length)}),{lines:n}}function z(e){return{refusal:e.reason==="outdated"?i.testManagerMadeItsOwn():i.testCaseAttachFailed(),exit:1}}function E(e){switch(e.code){case"NO_CASE":return{why:"missing",session:e.session};case"CASE_BROKEN":return{why:"gone",session:e.session};case"CASE_ARCHIVED":return{why:"archived",internalId:e.internalId};case"TEST_FILE_STALE":return{why:"not_in_project",useCase:e.useCase}}}function v(e,t){return e instanceof k?{code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}}:e instanceof l&&e.status===401?i.credentialsRejected():e instanceof l&&e.code==="NOT_FOUND"?i.noAccess(t):e instanceof l&&e.code==="PROJECT_NOT_MARKED"?i.assuranceOff(t):i.noConnection()}var f=class extends Error{};async function L(e,t){let s,n=new Promise((a,r)=>{s=setTimeout(()=>r(new f(`Lattice took over ${t} ms`)),t)});try{return await Promise.race([e,n])}finally{clearTimeout(s)}}export{S as a,_ as b,K as c,V as d,X as e,q as f,z as g,f as h,L as i};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Ce}from"./chunk-AQ2OG2EF.js";import{b as Me,d as Le}from"./chunk-VRIZDOO5.js";import{c as ke,g as Oe}from"./chunk-ZHWU6L2G.js";import{b as F}from"./chunk-ZFM77AQU.js";import{B as Ie,L as Ee,M as $e,Na as Be,a as ne,c as te,k as oe,r as we,x as re,y as se}from"./chunk-UEE3RZN4.js";import{d as L,j as he,k as be,l as ye,m as ve,n as ie,p as _e,q as j}from"./chunk-DBMW3VUN.js";import{f as ee,h as xe}from"./chunk-KU3YHPWZ.js";import{readFileSync as We}from"fs";import{basename as ue,extname as Ue}from"path";import{extname as Pe}from"path";var Fe={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},De={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},je={kind:"web",media_type:"application/x-kane-web-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},Te={kind:"linear",media_type:"application/x-kane-linear-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},Ge={kind:"linear-doc",media_type:"application/x-kane-linear-doc-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},Ke={kind:"plugin",media_type:"application/x-kane-plugin-envelope",extensions:[],cite:"verbatim",maxBytes:25*1024*1024},le=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(Ve)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Fe,De,Te,Ge,Ke],Ve=Buffer.from([208,207,17,224,161,177,26,225]),ae={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence",web:"web",linear:"linear","linear-doc":"linearDoc",plugin:"plugin"},en=new Set(Object.keys(ae));function Se(e){let i=Pe(e).toLowerCase(),n=le.find(o=>o.extensions.includes(i));return n?{ok:!0,media:n}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:le.flatMap(o=>o.extensions)}}function nn(e){return[...le,je].find(i=>i.media_type===e)??null}function K(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function Ne(e,i,n){if(n===void 0)return;let o=n!==null?[n]:e.byLabel(ee.SOURCE).filter(d=>d.content.source_id===i).map(d=>d.cid);if(o.length!==0){for(let d of o){let p=e.mediaOf(d);if(p.format==="plugin")return p.plugin?.id??""}return null}}function Xe(e,i,n,o){if(i===void 0||i===n)return;let d=o?"a retired source":"a source",p=i===null?`${d} of a built-in kind`:`${d} the ${i} plugin reads`,t=n===null?"a file or URL of a built-in kind":`a source the ${n} plugin reads`;return`SOURCE_ID_OWNED: '${e}' is ${p} \u2014 ${t} cannot become a version of it; ingest it under another id`}function Ye(e,i,n){return Ce({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:i,numbered_text:Ie(n)})}var Ae=2e3;function ze(e){let n=ue(e,Ue(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return oe(n),n}function wn(e){let i=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!i)return null;let n=(i[1]??"").replace(/[-_.]+$/,"");return n.length>0&&n!==e?n:null}async function In(e){let{store:i,filePath:n,asId:o,confirmSameSource:d,converters:p}=e,t=i.ensure(),s=We(n),g=Se(n);if(!g.ok)throw new Error(`${ue(n)} is a file type kane can't ingest (${Ue(n)||"no extension"}) \u2014 supported: ${g.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(s.byteLength>g.media.maxBytes)throw new Error(`${ue(n)} is too large \u2014 ${K(s.byteLength)}, the limit for ${g.media.media_type} is ${K(g.media.maxBytes)} [FILE_TOO_LARGE]`);if(g.media.sniff&&!g.media.sniff(s)){let w=g.media.sniffFail?.(s);throw new Error(w??`MEDIA_SNIFF_MISMATCH: ${n} does not look like ${g.media.media_type}`)}let C;o!==void 0?(oe(o),C=o):C=ze(n);let v=await He({store:i,bytes:s,media:g.media,sourceId:C,label:n,confirmSameSource:d,converters:p});return t.gitignore?{...v,gitignore:t.gitignore}:v}async function He(e){let{store:i,bytes:n,media:o,confirmSameSource:d,converters:p}=e,t=o.kind==="plugin"?e.plugin:void 0;if(o.kind==="plugin"&&!t)throw new Error("a source-plugin version needs the plugin it was read by");let s=e.sourceId,g=e.label??s,C=i.ensure();if(n.byteLength>o.maxBytes)throw new Error(`the content is too large \u2014 ${K(n.byteLength)}, the limit for ${o.media_type} is ${K(o.maxBytes)} [FILE_TOO_LARGE]`);let v=[],w=ae[o.kind];if(o.cite==="verbatim"&&!w){try{new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${g} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}n.toString("utf8").split(`
2
+ import{a as Ce}from"./chunk-AQ2OG2EF.js";import{b as Me,d as Le}from"./chunk-VRIZDOO5.js";import{c as ke,g as Oe}from"./chunk-ZHWU6L2G.js";import{b as F}from"./chunk-CQDCNP7V.js";import{B as Ie,L as Ee,M as $e,Na as Be,a as ne,c as te,k as oe,r as we,x as re,y as se}from"./chunk-PI7OXS62.js";import{d as L,j as he,k as be,l as ye,m as ve,n as ie,p as _e,q as j}from"./chunk-DBMW3VUN.js";import{f as ee,h as xe}from"./chunk-KU3YHPWZ.js";import{readFileSync as We}from"fs";import{basename as ue,extname as Ue}from"path";import{extname as Pe}from"path";var Fe={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},De={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},je={kind:"web",media_type:"application/x-kane-web-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},Te={kind:"linear",media_type:"application/x-kane-linear-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},Ge={kind:"linear-doc",media_type:"application/x-kane-linear-doc-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},Ke={kind:"plugin",media_type:"application/x-kane-plugin-envelope",extensions:[],cite:"verbatim",maxBytes:25*1024*1024},le=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(Ve)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Fe,De,Te,Ge,Ke],Ve=Buffer.from([208,207,17,224,161,177,26,225]),ae={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence",web:"web",linear:"linear","linear-doc":"linearDoc",plugin:"plugin"},en=new Set(Object.keys(ae));function Se(e){let i=Pe(e).toLowerCase(),n=le.find(o=>o.extensions.includes(i));return n?{ok:!0,media:n}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:le.flatMap(o=>o.extensions)}}function nn(e){return[...le,je].find(i=>i.media_type===e)??null}function K(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function Ne(e,i,n){if(n===void 0)return;let o=n!==null?[n]:e.byLabel(ee.SOURCE).filter(d=>d.content.source_id===i).map(d=>d.cid);if(o.length!==0){for(let d of o){let p=e.mediaOf(d);if(p.format==="plugin")return p.plugin?.id??""}return null}}function Xe(e,i,n,o){if(i===void 0||i===n)return;let d=o?"a retired source":"a source",p=i===null?`${d} of a built-in kind`:`${d} the ${i} plugin reads`,t=n===null?"a file or URL of a built-in kind":`a source the ${n} plugin reads`;return`SOURCE_ID_OWNED: '${e}' is ${p} \u2014 ${t} cannot become a version of it; ingest it under another id`}function Ye(e,i,n){return Ce({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:i,numbered_text:Ie(n)})}var Ae=2e3;function ze(e){let n=ue(e,Ue(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return oe(n),n}function wn(e){let i=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!i)return null;let n=(i[1]??"").replace(/[-_.]+$/,"");return n.length>0&&n!==e?n:null}async function In(e){let{store:i,filePath:n,asId:o,confirmSameSource:d,converters:p}=e,t=i.ensure(),s=We(n),g=Se(n);if(!g.ok)throw new Error(`${ue(n)} is a file type kane can't ingest (${Ue(n)||"no extension"}) \u2014 supported: ${g.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(s.byteLength>g.media.maxBytes)throw new Error(`${ue(n)} is too large \u2014 ${K(s.byteLength)}, the limit for ${g.media.media_type} is ${K(g.media.maxBytes)} [FILE_TOO_LARGE]`);if(g.media.sniff&&!g.media.sniff(s)){let w=g.media.sniffFail?.(s);throw new Error(w??`MEDIA_SNIFF_MISMATCH: ${n} does not look like ${g.media.media_type}`)}let C;o!==void 0?(oe(o),C=o):C=ze(n);let v=await He({store:i,bytes:s,media:g.media,sourceId:C,label:n,confirmSameSource:d,converters:p});return t.gitignore?{...v,gitignore:t.gitignore}:v}async function He(e){let{store:i,bytes:n,media:o,confirmSameSource:d,converters:p}=e,t=o.kind==="plugin"?e.plugin:void 0;if(o.kind==="plugin"&&!t)throw new Error("a source-plugin version needs the plugin it was read by");let s=e.sourceId,g=e.label??s,C=i.ensure();if(n.byteLength>o.maxBytes)throw new Error(`the content is too large \u2014 ${K(n.byteLength)}, the limit for ${o.media_type} is ${K(o.maxBytes)} [FILE_TOO_LARGE]`);let v=[],w=ae[o.kind];if(o.cite==="verbatim"&&!w){try{new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${g} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}n.toString("utf8").split(`
3
3
  `).some(h=>h.length>Ae)&&v.push(`long line detected (> ${Ae} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let k=F(n),O=new Map,I=null,_=null,m=null,B=new Map,R=!1;for(let h=0;;h++){let c=$e(i),u=c.heads.get(s),U=u!=null?c.getNode(u)?.content:void 0,b=Xe(s,Ne(c,s,u),t?t.id:null,u===null);if(b)throw new Error(b);if(u!=null&&U?.blob===k)return{status:"unchanged",source_id:s,cid:u,blob:k};if(u==null){for(let[r,E]of c.heads.entries())if(!(r===s||E==null)&&c.getNode(E)?.content.blob===k){if(Ne(c,r,E)!==(t?t.id:null))continue;let f;if(O.has(r)?f=O.get(r):h===0&&d?(f=await d(r),O.set(r,f)):(f=!1,O.set(r,f),h>0&&v.push(`same bytes already ingested as '${r}' \u2014 minted under '${s}' anyway (the twin appeared mid-commit; not prompted)`)),f)return{status:"unchanged",source_id:r,cid:E,blob:k};break}}let V=t?ne("source",te(s,k)):void 0,W=V!==void 0&&c.nodeLabel.has(V)?c.mediaOf(V):void 0,l=W?.format==="plugin"&&W.plugin?W:void 0,X=null;if(l){let r=[];if(l.text_blob&&i.getBlob(l.text_blob)===null&&r.push(`its text (${l.text_blob.slice(0,19)})`),l.plugin.index&&(X=ie(i.getBlob(l.plugin.index)),X===null&&r.push(`its unit index (${l.plugin.index.slice(0,19)})`)),l.plugin.notes&&i.getBlob(l.plugin.notes)===null&&r.push(`its notes (${l.plugin.notes.slice(0,19)})`),l.plugin.coverage&&i.getBlob(l.plugin.coverage)===null&&r.push(`its coverage plan (${l.plugin.coverage.slice(0,19)})`),r.length>0)throw new Error(`VERSION_BLOB_MISSING: this store has held these bytes of '${s}' before, and ${r.join(" and ")} from that ingest ${r.length>1?"are":"is"} not in the blob store \u2014 a version keeps what its first ingest stored, so it cannot be read again; restore the blobs from a copy of this store (kane-cli context fsck names what is missing)`)}if(!l&&m===null){let r={},E,f=null,A=null,M;if(w){let $=p?.[w];if(!$)throw new Error(`${w.toUpperCase()}_CONVERTER_MISSING: ${w} ingestion requires the converter \u2014 the command layer wires it`);let x=await $(n),y=re(x.projection);y.replaced>0&&v.push(se(s,y.replaced)),f=Buffer.from(y.text,"utf8");let D=Ye(s,o.kind,f),ge=()=>new Error(`PROJECTION_TOO_LARGE: serialized source payload ${D} bytes > ${4e5} \u2014 split the document and re-ingest`);if(D>4e5){if(!t)throw ge();if(f.byteLength>L.textBytes)throw new Error(`PLUGIN_TEXT_TOO_LARGE: plugin ${t.id} rendered ${s} to ${f.byteLength} bytes of text; a plugin's source may be at most ${L.textBytes} \u2014 split the source and ingest the parts`)}if(r={text_blob:F(f),...x.inventory.length>0?{images:x.inventory}:{},converter:x.converter},A=x.blobs,E={kind:o.kind,...x.pages!==void 0?{pages:x.pages}:{},delivered:x.delivered.length,omitted:x.inventory.length-x.delivered.length},t){let T=be(x.units,y.text);if(!T.ok)M={fault:T.fault};else{let me=ye(t.id,t.rules,T.units,y.text),G=ve(me);M=G.ok?{index:me,bytes:G.bytes,fp:F(G.bytes),given:T.units}:{fault:G.fault}}if(D>4e5&&(!("index"in M)||M.given.length===0))throw ge()}}else if(o.cite==="verbatim"){let $=re(n.toString("utf8"));$.replaced>0&&(v.push(se(s,$.replaced)),f=Buffer.from($.text,"utf8"),r={text_blob:F(f)})}let P=[...r.text_blob?[r.text_blob]:[],...A?A.keys():[]];m={derived:r,composite:E,projBytes:f,derivedBlobs:A,derivedFps:P,...M?{units:M}:{}}}let a=l?{derived:{...l.text_blob?{text_blob:l.text_blob}:{},...l.converter?{converter:l.converter}:{}},composite:{kind:o.kind,delivered:0,omitted:0},projBytes:null,derivedBlobs:null,derivedFps:l.text_blob?[l.text_blob]:[]}:m;if(l)i.putBlob(n);else if(!R){if(i.putBlob(n),a.projBytes!==null&&i.putBlob(a.projBytes),a.derivedBlobs!==null)for(let[,r]of a.derivedBlobs)i.putBlob(r);R=!0}let Y=te(s,k),z=xe("source",Y);if(z.length>0)throw new Error(`source node fails ${z[0].code}: ${z[0].detail}`);let H=ne("source",Y),S,N,J,q=[],Q=[],Z=[];if(t){let r=null,E;l?(E=l.plugin.index,r=X,N=r?{indexed:r.units.length}:{fault:{code:"UNIT_LIST_INVALID",detail:"this version was first stored without a unit index, and a version keeps what its first ingest stored"}}):a.units&&"index"in a.units?(i.putBlob(a.units.bytes),r=a.units.index,E=a.units.fp,N={indexed:r.units.length}):a.units&&(N={fault:a.units.fault});let f=u!=null?c.mediaOf(u):void 0,A=r&&f?.format==="plugin"&&f.plugin?.index?ie(i.getBlob(f.plugin.index)):null,M=r&&A&&A.plugin===r.plugin&&A.rules===r.rules?A:null,P=r&&M&&u!=null?_e(M,r):null;if(P!==null&&P.changed.length>0&&e.explain&&!l&&u!=null&&a.projBytes!==null){let y=B.get(u);if(y===void 0){let D=f?.text_blob?i.getBlob(f.text_blob):null;y=D===null?{reasons:{},warnings:[]}:await Qe({call:e.explain,ms:e.explainMs??L.explainMs,plugin:t.id,sourceId:s,changed:P.changed,before:{index:M,text:D.toString("utf8")},after:{index:r,text:a.projBytes.toString("utf8")}}),B.set(u,y)}q=y.warnings,Object.keys(y.reasons).length>0&&(J=y.reasons)}let $;if(l)$=l.plugin.notes;else if(t.notes!==void 0)$=t.notes;else if(e.context&&a.projBytes!==null){if(I===null){let y=a.units&&"index"in a.units?a.units.given:[];I=await Je({call:e.context,ms:e.contextMs??L.hookMs,plugin:t.id,sourceId:s,text:a.projBytes.toString("utf8"),units:y})}I.notes!==null&&(i.putBlob(I.notes.bytes),$=I.notes.fp),Q=I.warnings}let x;l?x=l.plugin.coverage:t.coverage!==void 0?x=t.coverage:e.coverage&&a.units&&"index"in a.units&&(_===null&&(_=await qe({call:e.coverage,ms:e.coverageMs??L.hookMs,plugin:t.id,sourceId:s,units:a.units.given})),_.plan!==null&&(i.putBlob(_.plan.bytes),x=_.plan.fp),Z=_.warnings),S={id:l?l.plugin.id:t.id,rules:l?l.plugin.rules:t.rules,...E?{index:E}:{},...$?{notes:$}:{},...x?{coverage:x}:{},...(l?l.plugin.cites_deep:t.citesDeep)===!0?{cites_deep:!0}:{},...P!==null&&u!=null?{changes:{from:u,...P,...J?{reasons:J}:{}}}:{},...t.fetch!==void 0?{fetch:{ref:t.fetch.ref,...t.fetch.cursor!==void 0?{cursor:t.fetch.cursor}:{}}}:{}}}let ce=N&&"fault"in N?[...v,`${s} is stored without a unit index: ${N.fault.detail} [${N.fault.code}] \u2014 everything that cites an earlier version of it reads stale`]:v,pe=q.length>0||Q.length>0||Z.length>0?[...ce,...q,...Q,...Z]:ce,Re=[...a.derivedFps,...S?.index?[S.index]:[],...S?.notes?[S.notes]:[],...S?.coverage?[S.coverage]:[]],fe={format:o.kind,media_type:o.media_type,anchors_supported:t?["L-L"]:w?["L-L","img#ref"]:o.cite==="verbatim"?["L-L"]:[],...a.derived,...S?{plugin:S}:{}};try{Ee(i,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:H,label:ee.SOURCE,content:Y}],edges:[],review:[],supersessions:[],media:{[s]:fe},...e.eventIds&&e.eventIds.length>0?{event_ids:e.eventIds}:{},source_head_moves:{[s]:H}},{graph:c,expectPrev:c.latestHash,intent:{v:1,verb:"ingest",args:we({source_id:s,blob:k,label:g,media:fe,derived_blobs:Re,eventIds:e.eventIds??null}),pins:{prior_head:u??null}},provenance:e.provenance})}catch(r){if(r instanceof Be&&h<3)continue;throw r}return{status:u!=null?"versioned":"created",source_id:s,cid:H,blob:k,...pe.length?{warnings:pe}:{},...a.composite?{composite:a.composite}:{},...C.gitignore?{gitignore:C.gitignore}:{},...N?{units:N}:{}}}}async function Je(e){let i="the version, its units and what changed are stored as they are; only the notes are missing",n;try{n=await e.call({text:e.text,units:e.units},e.ms)}catch(t){let s=j(t instanceof Error?t.message:String(t))??"it failed";return{notes:null,warnings:[`plugin ${e.plugin} gave no notes for ${e.sourceId}: ${s} \u2014 ${i} [PLUGIN_CONTEXT_FAILED]`]}}let o=Oe(e.plugin,n,new Set(e.units.map(t=>t.id))),d=[];if(o.invalid!==void 0&&d.push(`plugin ${e.plugin} answered context for ${e.sourceId} with ${o.invalid} \u2014 ${i} [PLUGIN_NOTES_INVALID]`),o.dropped.length>0){let t=o.dropped.reduce((s,g)=>s+g.count,0);d.push(`${t} ${t===1?"note":"notes"} of plugin ${e.plugin} for ${e.sourceId} ${t===1?"is":"are"} not kept: ${o.dropped.map(s=>`${s.count} ${s.why}`).join("; ")} \u2014 the version, its units and what changed are stored as they are, with the notes that are kept [PLUGIN_NOTES_DROPPED]`)}if(o.notes===null)return{notes:null,warnings:d};let p=ke(o.notes);return{notes:{bytes:p,fp:F(p)},warnings:d}}async function qe(e){let i="the version, its units and what changed are stored as they are, with no coverage plan: every unit of it is expected to have tests",n;try{n=await e.call({units:e.units},e.ms)}catch(p){let t=j(p instanceof Error?p.message:String(p))??"it failed";return{plan:null,warnings:[`plugin ${e.plugin} gave no coverage plan for ${e.sourceId}: ${t} \u2014 ${i} [PLUGIN_COVERAGE_FAILED]`]}}let o=Le(e.plugin,n,e.units.map(p=>p.id));if(o.plan===null)return{plan:null,warnings:[`plugin ${e.plugin} gave no coverage plan for ${e.sourceId}: ${o.fault} \u2014 ${i} [PLUGIN_COVERAGE_FAILED]`]};let d=Me(o.plan);return{plan:{bytes:d,fp:F(d)},warnings:[]}}async function Qe(e){let i=m=>{let B=he(m.text),R=new Map(m.index.units.map(h=>[h.id,h]));return h=>{let c=R.get(h);if(c===void 0||c.lines===void 0)return null;let{text:u,segments:U,...b}=c;return{unit:{...b,lines:[c.lines[0],c.lines[1]]},text:B.slice(c.lines[0]-1,c.lines[1]).join(`
4
4
  `)}}},n=i(e.before),o=i(e.after),d={},p=[],t=[],s=[],g="",C=0,v=[],w=[],k=Date.now();for(let m=0;m<e.changed.length;m++){let B=e.changed[m],R=n(B),h=o(B);if(R===null||h===null)continue;let c=e.ms-(Date.now()-k);if(c<=0){v=e.changed.slice(m).filter(b=>n(b)!==null&&o(b)!==null);break}let u;try{u=await e.call({sourceId:e.sourceId,before:R,after:h},c)}catch(b){p.push(B),g===""&&(g=b instanceof Error?b.message:String(b));continue}if(u==null)continue;let U=j(u);if(U===null){s.push(B);continue}if(U.length>L.reasonChars){t.push(B);continue}if(C+Buffer.byteLength(U,"utf8")>L.reasonsBytes){w=e.changed.slice(m).filter(b=>n(b)!==null&&o(b)!==null);break}C+=Buffer.byteLength(U,"utf8"),d[B]=U}let O=m=>`${m.length} changed ${m.length===1?"unit":"units"} of ${e.sourceId} (${m.slice(0,5).join(", ")}${m.length>5?`, and ${m.length-5} more`:""})`,I="the version, its units and what changed are stored as they are; only the wording is missing",_=[];return p.length>0&&_.push(`plugin ${e.plugin} gave no reason for ${O(p)}: ${j(g)??"it failed"} \u2014 ${I} [PLUGIN_EXPLAIN_FAILED]`),v.length>0&&_.push(`plugin ${e.plugin} was not asked for a reason for ${O(v)}: its answers took the ${Math.round(e.ms/1e3)} seconds a version's reasons may take \u2014 ${I} [PLUGIN_EXPLAIN_TIMEOUT]`),s.length>0&&_.push(`plugin ${e.plugin} answered with something that is not a line of text for ${O(s)} \u2014 ${I} [PLUGIN_REASON_INVALID]`),t.length>0&&_.push(`plugin ${e.plugin} gave a reason over ${L.reasonChars} characters for ${O(t)}; it is dropped \u2014 ${I} [PLUGIN_REASON_TOO_LONG]`),w.length>0&&_.push(`the reasons of plugin ${e.plugin} passed ${L.reasonsBytes} bytes for one version; none is kept for ${O(w)} \u2014 ${I} [PLUGIN_REASONS_OVER_LIMIT]`),{reasons:d,warnings:_}}export{Fe as a,De as b,je as c,Te as d,Ge as e,Ke as f,le as g,ae as h,en as i,Se as j,nn as k,Xe as l,Ye as m,ze as n,wn as o,In as p,He as q};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as h}from"./chunk-65VANXOF.js";import{b as y,c as v}from"./chunk-VZ7KXRXB.js";import{randomUUID as k,randomBytes as D}from"crypto";import{promises as i}from"fs";import{join as c}from"path";function p(t=process.cwd()){return c(t,".testmuai","evidence")}function b(t,e=process.cwd()){return c(p(e),`${t}.evidence`)}function W(){return k()}var S=/\.evidence\.tmp-(\d+)-[0-9a-f]+$/;async function _(t,e,r=process.cwd()){let n=p(r);await i.mkdir(n,{recursive:!0});let o=b(e,r),a=c(n,`${e}.evidence.tmp-${process.pid}-${D(6).toString("hex")}`);return await i.copyFile(t,a),await i.rename(a,o),o}async function I(t=process.cwd()){let e=p(t),r;try{r=await i.readdir(e)}catch{return[]}return r.filter(n=>n.endsWith(".evidence")).sort().map(n=>c(e,n))}async function L(t,e=process.cwd()){if(await P(t))return t;let r=b(t,e);return await P(r)?r:null}async function P(t){try{return await i.stat(t),!0}catch{return!1}}function E(t){try{return process.kill(t,0),!0}catch(e){return e?.code==="EPERM"}}async function M(t=process.cwd(),e=E){let r=p(t);await h(r).catch(()=>({restored:[],removed:[]}));let n=[],o=[],a;try{a=await i.readdir(r,{withFileTypes:!0})}catch{return{aborted:n,removed:o}}for(let u of a){let d=u.name.match(S);if(d){let g=Number(d[1]);if(Number.isFinite(g)&&e(g))continue;let w=c(r,u.name);await i.rm(w,{force:!0}),o.push(w);continue}if(!u.isDirectory()||!u.name.endsWith(".evidence"))continue;let m=c(r,u.name),f=c(m,"run.yaml"),s;try{s=y(await i.readFile(f,"utf8"))}catch{continue}if(s?.status!=="running")continue;let l=s?.environment?.pid;if(typeof l=="number"&&e(l))continue;let x=s?.environment?.saved===!0;s?.environment?.origin==="inline"&&!x?(await i.rm(m,{recursive:!0,force:!0}),o.push(m)):(s.status="aborted",await i.writeFile(f,v(s,{lineWidth:-1})),n.push(m))}return{aborted:n,removed:o}}export{p as a,b,W as c,_ as d,I as e,L as f,M as g};
2
+ import{c as h}from"./chunk-Q4JV4U65.js";import{b as y,c as v}from"./chunk-VZ7KXRXB.js";import{randomUUID as k,randomBytes as D}from"crypto";import{promises as i}from"fs";import{join as c}from"path";function p(t=process.cwd()){return c(t,".testmuai","evidence")}function b(t,e=process.cwd()){return c(p(e),`${t}.evidence`)}function W(){return k()}var S=/\.evidence\.tmp-(\d+)-[0-9a-f]+$/;async function _(t,e,r=process.cwd()){let n=p(r);await i.mkdir(n,{recursive:!0});let o=b(e,r),a=c(n,`${e}.evidence.tmp-${process.pid}-${D(6).toString("hex")}`);return await i.copyFile(t,a),await i.rename(a,o),o}async function I(t=process.cwd()){let e=p(t),r;try{r=await i.readdir(e)}catch{return[]}return r.filter(n=>n.endsWith(".evidence")).sort().map(n=>c(e,n))}async function L(t,e=process.cwd()){if(await P(t))return t;let r=b(t,e);return await P(r)?r:null}async function P(t){try{return await i.stat(t),!0}catch{return!1}}function E(t){try{return process.kill(t,0),!0}catch(e){return e?.code==="EPERM"}}async function M(t=process.cwd(),e=E){let r=p(t);await h(r).catch(()=>({restored:[],removed:[]}));let n=[],o=[],a;try{a=await i.readdir(r,{withFileTypes:!0})}catch{return{aborted:n,removed:o}}for(let u of a){let d=u.name.match(S);if(d){let g=Number(d[1]);if(Number.isFinite(g)&&e(g))continue;let w=c(r,u.name);await i.rm(w,{force:!0}),o.push(w);continue}if(!u.isDirectory()||!u.name.endsWith(".evidence"))continue;let m=c(r,u.name),f=c(m,"run.yaml"),s;try{s=y(await i.readFile(f,"utf8"))}catch{continue}if(s?.status!=="running")continue;let l=s?.environment?.pid;if(typeof l=="number"&&e(l))continue;let x=s?.environment?.saved===!0;s?.environment?.origin==="inline"&&!x?(await i.rm(m,{recursive:!0,force:!0}),o.push(m)):(s.status="aborted",await i.writeFile(f,v(s,{lineWidth:-1})),n.push(m))}return{aborted:n,removed:o}}export{p as a,b,W as c,_ as d,I as e,L as f,M as g};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as A,l as E}from"./chunk-HK62JVQM.js";import{d as _,e as v}from"./chunk-C6HI6Y3S.js";import{a as P}from"./chunk-4QTH7VYE.js";import{mkdtempSync as N,rmSync as B}from"fs";import{tmpdir as U}from"os";import{join as D}from"path";function T(e){let o=Promise.resolve(),i=new Map,r=s=>{try{B(s,{recursive:!0,force:!0})}catch{}};function a(s){let f=o.then(async()=>{if(i.has(s))throw new Error(`chrome slot ${s} already acquired (one acquire per worker index)`);let c=N(D(U(),"kane-testrun-chrome-")),g;try{g=await e.launch({userDataDir:c,width:e.width,height:e.height,headless:e.headless})}catch(u){throw r(c),u}return i.set(s,{chrome:g,dataDir:c}),{cdpEndpoint:g.cdpEndpoint,release(){let u=i.get(s);if(u){i.delete(s);try{u.chrome.kill()}catch{}r(u.dataDir)}}}});return o=f.catch(()=>{}),f}return{acquire:a,killAll(){for(let[,s]of i){try{s.chrome.kill()}catch{}r(s.dataDir)}i.clear()}}}var x=4;function Y(e){let o=T(e);return{kind:"local",maxParallel:x,async acquire(i){let r=await o.acquire(i);return{cdpEndpoint:r.cdpEndpoint,release:async()=>{r.release()}}},async releaseAll(){o.killAll()},releaseAllSync(){o.killAll()}}}function $(e){return e.replace(/([?&]capabilities=)[^&\s'"]*/g,"$1<redacted>")}function S(e){let o=new Set;for(let r of e)!r||r.length<4||(o.add(r),o.add(encodeURIComponent(r)),o.add(JSON.stringify(r).slice(1,-1)),o.add(encodeURIComponent(JSON.stringify(r).slice(1,-1))));let i=[...o].sort((r,a)=>a.length-r.length);return r=>{let a=$(r);for(let s of i)a=a.split(s).join("<redacted>");return a}}function Q(e){let o=S(e);return i=>JSON.parse(o(JSON.stringify(i)))}import{spawnSync as M}from"child_process";var h=20,ne=["us","eu","mumbai","oregon"],j={stage:"wss://stage-cdp.lambdatestinternal.com",prod:"wss://cdp.lambdatest.com"};function se(e,o){if(!o)return j[e];if(e!=="prod")throw new Error(`--hps-region ${o}: regional HPS hosts are prod only; stage has one host`);return`wss://cdp-${o}.lambdatest.com`}function K(e,o,i,r){let a={user:o.username,accessKey:o.access_key,browserName:"Chrome"};return r&&(a.tunnel=!0,r.name&&(a.tunnelName=r.name)),`${e.replace(/\/+$/,"")}/kane-cli?capabilities=${encodeURIComponent(JSON.stringify(a))}&testId=${encodeURIComponent(i)}`}function ae(e,o,i){let r=new _(e,o.username,o.access_key);return{create:(a,s)=>r.createBrowserSession({...i(),worker_index:a,source:"explore"},{signal:s}),release:(a,s)=>r.endBrowserSession(a,{signal:s})}}var G=`
2
+ import{c as A,l as E}from"./chunk-GQARXS6F.js";import{e as _,f as v}from"./chunk-6K5BEEAJ.js";import{a as P}from"./chunk-4QTH7VYE.js";import{mkdtempSync as N,rmSync as B}from"fs";import{tmpdir as U}from"os";import{join as D}from"path";function T(e){let o=Promise.resolve(),i=new Map,r=s=>{try{B(s,{recursive:!0,force:!0})}catch{}};function a(s){let f=o.then(async()=>{if(i.has(s))throw new Error(`chrome slot ${s} already acquired (one acquire per worker index)`);let c=N(D(U(),"kane-testrun-chrome-")),g;try{g=await e.launch({userDataDir:c,width:e.width,height:e.height,headless:e.headless})}catch(u){throw r(c),u}return i.set(s,{chrome:g,dataDir:c}),{cdpEndpoint:g.cdpEndpoint,release(){let u=i.get(s);if(u){i.delete(s);try{u.chrome.kill()}catch{}r(u.dataDir)}}}});return o=f.catch(()=>{}),f}return{acquire:a,killAll(){for(let[,s]of i){try{s.chrome.kill()}catch{}r(s.dataDir)}i.clear()}}}var x=4;function Y(e){let o=T(e);return{kind:"local",maxParallel:x,async acquire(i){let r=await o.acquire(i);return{cdpEndpoint:r.cdpEndpoint,release:async()=>{r.release()}}},async releaseAll(){o.killAll()},releaseAllSync(){o.killAll()}}}function $(e){return e.replace(/([?&]capabilities=)[^&\s'"]*/g,"$1<redacted>")}function S(e){let o=new Set;for(let r of e)!r||r.length<4||(o.add(r),o.add(encodeURIComponent(r)),o.add(JSON.stringify(r).slice(1,-1)),o.add(encodeURIComponent(JSON.stringify(r).slice(1,-1))));let i=[...o].sort((r,a)=>a.length-r.length);return r=>{let a=$(r);for(let s of i)a=a.split(s).join("<redacted>");return a}}function Q(e){let o=S(e);return i=>JSON.parse(o(JSON.stringify(i)))}import{spawnSync as M}from"child_process";var h=20,ne=["us","eu","mumbai","oregon"],j={stage:"wss://stage-cdp.lambdatestinternal.com",prod:"wss://cdp.lambdatest.com"};function se(e,o){if(!o)return j[e];if(e!=="prod")throw new Error(`--hps-region ${o}: regional HPS hosts are prod only; stage has one host`);return`wss://cdp-${o}.lambdatest.com`}function K(e,o,i,r){let a={user:o.username,accessKey:o.access_key,browserName:"Chrome"};return r&&(a.tunnel=!0,r.name&&(a.tunnelName=r.name)),`${e.replace(/\/+$/,"")}/kane-cli?capabilities=${encodeURIComponent(JSON.stringify(a))}&testId=${encodeURIComponent(i)}`}function ae(e,o,i){let r=new _(e,o.username,o.access_key);return{create:(a,s)=>r.createBrowserSession({...i(),worker_index:a,source:"explore"},{signal:s}),release:(a,s)=>r.endBrowserSession(a,{signal:s})}}var G=`
3
3
  const ids = JSON.parse(process.env.KANE_HPS_IDS || "[]");
4
4
  Promise.allSettled(ids.map((id) => fetch(process.env.KANE_HPS_FORGE + "/kane-cli/v1/browser-sessions/" + encodeURIComponent(id), {
5
5
  method: "DELETE", headers: { Authorization: process.env.KANE_HPS_AUTH, Accept: "application/json" },
@@ -1,4 +1,4 @@
1
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+`
2
+ import{j as s}from"./chunk-HYJVYYAZ.js";import{AsyncLocalStorage as c}from"async_hooks";function a(n,t){let e=s();e?e(n,t):process.stderr.write(n+`
3
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
4
  `)?r.slice(0,-1):r,t)}export{a,l as b,g as c,v as d,h as e};
@@ -1,2 +1,2 @@
1
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};
2
+ import{a as V}from"./chunk-RTVWQK7I.js";import{a as j,f as q}from"./chunk-PRBWZXFA.js";import{c as H,e as A,g as P}from"./chunk-4KCYNP2K.js";import{c as _}from"./chunk-JNPFEBUR.js";import{a as O}from"./chunk-VZJ6LUXX.js";import{n as L}from"./chunk-DXIQVBMI.js";import{c as h}from"./chunk-BWXLZS5O.js";import{a as I}from"./chunk-GFLB2SHW.js";import{M as S}from"./chunk-PI7OXS62.js";import{o as D}from"./chunk-HYJVYYAZ.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};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{i as U}from"./chunk-ZTHYAHDN.js";import{g as S}from"./chunk-AZLNLHUA.js";import{a as E}from"./chunk-DBMW3VUN.js";var h=1,v=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;var L=["cites-deep"],C=["observe","events","refresh","check","tools","migrate"],d={remote:"fetch",explain:"explain",context:"context",coverage:"coverage"},x=class extends Error{remedy;constructor(a,p){super(a),this.name="SourcePluginRefusal",this.remedy=p}};var T=class extends Error{refusal;constructor(a){super(`${a.code}: ${a.message}${a.remedy?` \u2014 ${a.remedy}`:""}`),this.name="SourcePluginError",this.refusal=a}};function A(l){let a=l.manifest?.capabilities;return Array.isArray(a)?a:[]}var i=(l,a,p={})=>{throw new T({code:l,message:a,...p})},R="test-",O=new Set(["http","https","file"]),b=new Set(U.map(l=>l.name)),G=Object.values(d),$=/^([a-z][a-z0-9-]{1,31}):([\s\S]+)$/,_={plugins:[],byId:()=>{},route:()=>null},D=l=>/(\.[^./\\]+)$/.exec(l)?.[1]?.toLowerCase()??"";function Y(l,a={}){let p=new Set(S.flatMap(o=>o.extensions)),c=new Map,P=new Map,I=new Map;for(let o of l){let r=o?.manifest,e=typeof r?.id=="string"?r.id:"",t={plugin:e||"(no id)"};r?.contract!==h&&i("PLUGIN_CONTRACT_UNSUPPORTED",`plugin ${t.plugin} is written against contract ${String(r?.contract)}; this build has contract ${h}`,t),E.test(e)||i("PLUGIN_ID_INVALID",`${JSON.stringify(r.id)} is not a plugin id: lower-case letters, digits and hyphens, starting with a letter, 2 to 32 characters`,t),e.startsWith(R)&&a.allowTestPlugins!==!0&&i("PLUGIN_ID_RESERVED",`plugin ${e} is a test plugin: an id starting with ${R} is loaded by the conformance suite only`,t),O.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it already means something at the start of an input`,t),b.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it is the name of a built-in remote source kind`,t),(c.has(e)||I.has(e))&&i("PLUGIN_ID_TAKEN",`two loaded plugins use the name ${e}`,t),(typeof r.version!="string"||r.version==="")&&i("PLUGIN_ID_INVALID",`plugin ${e} names no version`,t),(typeof r.rules!="string"||r.rules==="")&&i("PLUGIN_RULES_MISSING",`plugin ${e} names no fingerprint-rules version`,t),r.capabilities!==void 0&&!Array.isArray(r.capabilities)&&i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e}: capabilities must be a list of capability names`,t);let u=A(o);for(let n of u){if(L.includes(n))continue;if(!(n in d)){let N=C.includes(n);i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e} lists the capability ${JSON.stringify(n)}, which ${N?"is reserved and not defined yet":"this contract does not define"}`,t)}let s=d[n];typeof o[s]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} lists the capability ${n} and has no ${s} hook`,t)}u.includes("cites-deep")&&!(u.includes("context")&&typeof o.context=="function")&&i("PLUGIN_CITES_DEEP_WITHOUT_CONTEXT",`plugin ${e} lists the capability cites-deep without the capability context and its hook: the instruction to cite each criterion, scenario and test could never reach the design agent`,{...t,remedy:"list the context capability, with its hook, and say in its design note what each item should cite"});for(let n of G){let s=Object.entries(d).find(([,N])=>N===n)[0];o[n]!==void 0&&!u.includes(s)&&i("PLUGIN_HOOK_WITHOUT_CAPABILITY",`plugin ${e} has the hook ${n} and does not list the capability ${s}`,t)}for(let n of["claim","render","index"])typeof o[n]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} has no ${n} hook, which every plugin needs`,t);let g=r.claims?.extensions??[];Array.isArray(g)||i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims its extensions as ${JSON.stringify(g)}, which is not a list`,t);for(let n of g){(typeof n!="string"||!/^\.[a-z0-9][a-z0-9._-]*$/.test(n))&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${JSON.stringify(n)}, which is not a file extension: lower-case, starting with a dot`,t);let s=n;s.lastIndexOf(".")!==0&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which holds a second dot: an input's extension is what follows its last dot, so no input would ever be routed to it`,t),p.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which a built-in source kind already reads`,t),P.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which plugin ${P.get(s).manifest.id} already claims`,t),P.set(s,o)}let y=r.claims?.schemes??[];Array.isArray(y)||i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims its schemes as ${JSON.stringify(y)}, which is not a list`,t);for(let n of y){(typeof n!="string"||!E.test(n)||O.has(n))&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${JSON.stringify(n)}, which is not one a plugin may have`,t);let s=n;b.has(s)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which is the name of a built-in remote source kind`,t),(I.has(s)||c.has(s)&&s!==e)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which another loaded plugin already uses`,t),I.set(s,o)}c.set(e,o)}for(let[o,r]of I)A(r).includes("remote")||i("PLUGIN_SCHEME_WITHOUT_REMOTE",`plugin ${r.manifest.id} claims the scheme ${o} but has no remote capability, so it can never read a ${o}:// input`,{plugin:r.manifest.id});return c.size===0?_:{plugins:[...c.values()],byId:o=>c.get(o),route(o,r){let e=$.exec(o);if(e&&!r(o)){let u=I.get(e[1]);if(u)return{plugin:u,ref:o,named:!1};let g=c.get(e[1]);if(g)return{plugin:g,ref:e[2],named:!0}}let t=P.get(D(o));return t&&!/^https?:\/\//i.test(o)?{plugin:t,ref:o,named:!1}:null}}}var f=_,m,J=()=>f,j=()=>m;function q(l,a){if(f!==_)throw new Error("a source-plugin registry is already installed: a host installs its registry once");return f=l,m=a,()=>{f===l&&(f=_,m=void 0)}}export{v as a,x as b,T as c,A as d,i as e,_ as f,Y as g,J as h,j as i,q as j};
2
+ import{i as U}from"./chunk-L3BUPFAQ.js";import{g as S}from"./chunk-Z24SD2EJ.js";import{a as E}from"./chunk-DBMW3VUN.js";var h=1,v=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;var L=["cites-deep"],C=["observe","events","refresh","check","tools","migrate"],d={remote:"fetch",explain:"explain",context:"context",coverage:"coverage"},x=class extends Error{remedy;constructor(a,p){super(a),this.name="SourcePluginRefusal",this.remedy=p}};var T=class extends Error{refusal;constructor(a){super(`${a.code}: ${a.message}${a.remedy?` \u2014 ${a.remedy}`:""}`),this.name="SourcePluginError",this.refusal=a}};function A(l){let a=l.manifest?.capabilities;return Array.isArray(a)?a:[]}var i=(l,a,p={})=>{throw new T({code:l,message:a,...p})},R="test-",O=new Set(["http","https","file"]),b=new Set(U.map(l=>l.name)),G=Object.values(d),$=/^([a-z][a-z0-9-]{1,31}):([\s\S]+)$/,_={plugins:[],byId:()=>{},route:()=>null},D=l=>/(\.[^./\\]+)$/.exec(l)?.[1]?.toLowerCase()??"";function Y(l,a={}){let p=new Set(S.flatMap(o=>o.extensions)),c=new Map,P=new Map,I=new Map;for(let o of l){let r=o?.manifest,e=typeof r?.id=="string"?r.id:"",t={plugin:e||"(no id)"};r?.contract!==h&&i("PLUGIN_CONTRACT_UNSUPPORTED",`plugin ${t.plugin} is written against contract ${String(r?.contract)}; this build has contract ${h}`,t),E.test(e)||i("PLUGIN_ID_INVALID",`${JSON.stringify(r.id)} is not a plugin id: lower-case letters, digits and hyphens, starting with a letter, 2 to 32 characters`,t),e.startsWith(R)&&a.allowTestPlugins!==!0&&i("PLUGIN_ID_RESERVED",`plugin ${e} is a test plugin: an id starting with ${R} is loaded by the conformance suite only`,t),O.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it already means something at the start of an input`,t),b.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it is the name of a built-in remote source kind`,t),(c.has(e)||I.has(e))&&i("PLUGIN_ID_TAKEN",`two loaded plugins use the name ${e}`,t),(typeof r.version!="string"||r.version==="")&&i("PLUGIN_ID_INVALID",`plugin ${e} names no version`,t),(typeof r.rules!="string"||r.rules==="")&&i("PLUGIN_RULES_MISSING",`plugin ${e} names no fingerprint-rules version`,t),r.capabilities!==void 0&&!Array.isArray(r.capabilities)&&i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e}: capabilities must be a list of capability names`,t);let u=A(o);for(let n of u){if(L.includes(n))continue;if(!(n in d)){let N=C.includes(n);i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e} lists the capability ${JSON.stringify(n)}, which ${N?"is reserved and not defined yet":"this contract does not define"}`,t)}let s=d[n];typeof o[s]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} lists the capability ${n} and has no ${s} hook`,t)}u.includes("cites-deep")&&!(u.includes("context")&&typeof o.context=="function")&&i("PLUGIN_CITES_DEEP_WITHOUT_CONTEXT",`plugin ${e} lists the capability cites-deep without the capability context and its hook: the instruction to cite each criterion, scenario and test could never reach the design agent`,{...t,remedy:"list the context capability, with its hook, and say in its design note what each item should cite"});for(let n of G){let s=Object.entries(d).find(([,N])=>N===n)[0];o[n]!==void 0&&!u.includes(s)&&i("PLUGIN_HOOK_WITHOUT_CAPABILITY",`plugin ${e} has the hook ${n} and does not list the capability ${s}`,t)}for(let n of["claim","render","index"])typeof o[n]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} has no ${n} hook, which every plugin needs`,t);let g=r.claims?.extensions??[];Array.isArray(g)||i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims its extensions as ${JSON.stringify(g)}, which is not a list`,t);for(let n of g){(typeof n!="string"||!/^\.[a-z0-9][a-z0-9._-]*$/.test(n))&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${JSON.stringify(n)}, which is not a file extension: lower-case, starting with a dot`,t);let s=n;s.lastIndexOf(".")!==0&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which holds a second dot: an input's extension is what follows its last dot, so no input would ever be routed to it`,t),p.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which a built-in source kind already reads`,t),P.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which plugin ${P.get(s).manifest.id} already claims`,t),P.set(s,o)}let y=r.claims?.schemes??[];Array.isArray(y)||i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims its schemes as ${JSON.stringify(y)}, which is not a list`,t);for(let n of y){(typeof n!="string"||!E.test(n)||O.has(n))&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${JSON.stringify(n)}, which is not one a plugin may have`,t);let s=n;b.has(s)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which is the name of a built-in remote source kind`,t),(I.has(s)||c.has(s)&&s!==e)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which another loaded plugin already uses`,t),I.set(s,o)}c.set(e,o)}for(let[o,r]of I)A(r).includes("remote")||i("PLUGIN_SCHEME_WITHOUT_REMOTE",`plugin ${r.manifest.id} claims the scheme ${o} but has no remote capability, so it can never read a ${o}:// input`,{plugin:r.manifest.id});return c.size===0?_:{plugins:[...c.values()],byId:o=>c.get(o),route(o,r){let e=$.exec(o);if(e&&!r(o)){let u=I.get(e[1]);if(u)return{plugin:u,ref:o,named:!1};let g=c.get(e[1]);if(g)return{plugin:g,ref:e[2],named:!0}}let t=P.get(D(o));return t&&!/^https?:\/\//i.test(o)?{plugin:t,ref:o,named:!1}:null}}}var f=_,m,J=()=>f,j=()=>m;function q(l,a){if(f!==_)throw new Error("a source-plugin registry is already installed: a host installs its registry once");return f=l,m=a,()=>{f===l&&(f=_,m=void 0)}}export{v as a,x as b,T as c,A as d,i as e,_ as f,Y as g,J as h,j as i,q as j};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as t}from"./chunk-LUR7JFPP.js";async function l(e){let o=e.credentials.expires_at,i=e.thresholdSeconds??300;if(o-Date.now()/1e3>=i)return null;let r=e.creds.loadClient(e.profile,e.env);if(!r)return null;let n=await new t(e.env).refreshToken(e.credentials.refresh_token,r.client_id),s=Math.floor(Date.now()/1e3)+n.expires_in;return e.creds.saveCredentials(e.profile,e.env,{access_token:n.access_token,refresh_token:n.refresh_token,expires_at:s,scope:n.scope}),{accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:s,scope:n.scope}}export{l as a};
2
+ import{a as t}from"./chunk-2GEAKFAV.js";async function l(e){let o=e.credentials.expires_at,i=e.thresholdSeconds??300;if(o-Date.now()/1e3>=i)return null;let r=e.creds.loadClient(e.profile,e.env);if(!r)return null;let n=await new t(e.env).refreshToken(e.credentials.refresh_token,r.client_id),s=Math.floor(Date.now()/1e3)+n.expires_in;return e.creds.saveCredentials(e.profile,e.env,{access_token:n.access_token,refresh_token:n.refresh_token,expires_at:s,scope:n.scope}),{accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:s,scope:n.scope}}export{l as a};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{L as _,a as b,c as x,r as S,x as k,y as O}from"./chunk-UEE3RZN4.js";import{f as v,h as C}from"./chunk-KU3YHPWZ.js";var F=e=>`conv#turn=${e}`,$=(e,r)=>`${e}:turn:${r}`,N=/^(.+):turn:(\d+)$/,G=e=>N.test(e);function P(e){return e.flatMap(r=>{let t=r;return t.kind==="user_message"&&typeof t.data?.message_id=="string"?[t.data.message_id]:[]})}function L(e,r,t,n,o=[]){let a=e.parse(t);if(a!==null&&e.resolveToken(a)===null)return[];let m=new Set(P(n)),s=new Set;for(let i of e.recordsSince(a))i.conv?.source_id===r&&i.conv.turn>=1&&s.add(i.conv.turn);for(let i of o){let c=N.exec(i);c&&c[1]===r&&s.add(Number(c[2]))}if(s.size===0)return[];let d=e.headOf(r,{token:null}),l=typeof d=="string"?e.getNode(d,{token:null})?.content?.blob:void 0,f=typeof l=="string"?e.getBlob(l)?.toString("utf8")??"":"",p=[];for(let i of[...s].sort((c,u)=>c-u)){let c=$(r,i),u=m.has(c)?null:y(f,i);u?.speaker==="person"&&p.push({message_id:c,text:u.text})}return p}function y(e,r){for(let t of e.split(`
2
+ import{L as _,a as b,c as x,r as S,x as k,y as O}from"./chunk-PI7OXS62.js";import{f as v,h as C}from"./chunk-KU3YHPWZ.js";var F=e=>`conv#turn=${e}`,$=(e,r)=>`${e}:turn:${r}`,N=/^(.+):turn:(\d+)$/,G=e=>N.test(e);function P(e){return e.flatMap(r=>{let t=r;return t.kind==="user_message"&&typeof t.data?.message_id=="string"?[t.data.message_id]:[]})}function L(e,r,t,n,o=[]){let a=e.parse(t);if(a!==null&&e.resolveToken(a)===null)return[];let m=new Set(P(n)),s=new Set;for(let i of e.recordsSince(a))i.conv?.source_id===r&&i.conv.turn>=1&&s.add(i.conv.turn);for(let i of o){let c=N.exec(i);c&&c[1]===r&&s.add(Number(c[2]))}if(s.size===0)return[];let d=e.headOf(r,{token:null}),l=typeof d=="string"?e.getNode(d,{token:null})?.content?.blob:void 0,f=typeof l=="string"?e.getBlob(l)?.toString("utf8")??"":"",p=[];for(let i of[...s].sort((c,u)=>c-u)){let c=$(r,i),u=m.has(c)?null:y(f,i);u?.speaker==="person"&&p.push({message_id:c,text:u.text})}return p}function y(e,r){for(let t of e.split(`
3
3
  `))if(t.trim())try{let n=JSON.parse(t);if(n.turn===r){let o=n.speaker==="person"||n.speaker==="agent"||n.speaker==="kane"?n.speaker:null;return{text:k(n.text).text,speaker:o}}}catch{}return null}function H(e,r){return y(e,r)?.text??null}var E={format:"conversation",media_type:"text/x-conversation",anchors_supported:["#turn="]},V="su-conv-";function J(e){let{store:r,graph:t,sessionStamp:n}=e,o=`${V}${n}`,a=t.heads.get(o);if(typeof a=="string")return{record:null,errors:[{code:"CONV_SOURCE_EXISTS",detail:`${o} already exists \u2014 resume it`}],sourceId:o,cid:a};let m=r.putBlob(Buffer.from("","utf8")),s=x(o,m),d=C("source",s);if(d.length>0)return{record:null,errors:d.map(p=>({code:p.code,detail:p.detail})),sourceId:o,cid:""};let l=b("source",s);return{record:_(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:l,label:v.SOURCE,content:s}],edges:[],review:[],supersessions:[],source_head_moves:{[o]:l},media:{[o]:E},conv:{source_id:o,turn:0,append_of:null}},{graph:t,scope:{sourcePins:[{source_id:o}]},expectPrev:t.latestHash,intent:{v:1,verb:"conv-mint",args:S({sessionStamp:n,by:e.by}),pins:{}},provenance:e.provenance}).record,errors:null,sourceId:o,cid:l}}function X(e){let{store:r,graph:t,sourceId:n,force:o}=e,{text:a,replaced:m}=k(e.text),s=t.heads.get(n),d=t.convChains.get(n);if(typeof s!="string"||!d)return{record:null,errors:[{code:"CONV_SOURCE_MISSING",detail:`${n} is not a live conversation source`}]};let f=t.getNode(s)?.content?.blob;if(typeof f!="string")return{record:null,errors:[{code:"CONV_SOURCE_MISSING",detail:`${n} head node unreadable`}]};let p=r.getBlob(f)?.toString("utf8")??"",i=d.turns,c=i>0?y(p,i):null;if(!o&&c!==null&&c.text===a&&c.speaker===(e.speaker??null))return{record:null,errors:null,turn:i,cid:s,idempotent:!0};let u=i+1,I=e.speaker?{turn:u,text:a,speaker:e.speaker}:{turn:u,text:a},T=`${p}${JSON.stringify(I)}
4
4
  `,w=r.putBlob(Buffer.from(T,"utf8")),h=x(n,w),g=b("source",h),R=_(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:g,label:v.SOURCE,content:h}],edges:[],review:[],supersessions:[],source_head_moves:{[n]:g},media:{[n]:E},conv:{source_id:n,turn:u,append_of:s}},{graph:t,scope:{sourcePins:[{source_id:n}]},expectPrev:t.latestHash,intent:{v:1,verb:"conv-turn",args:S({sourceId:n,text:a,force:o??!1,by:e.by,...e.speaker?{speaker:e.speaker}:{}}),pins:{append_of:s}},provenance:e.provenance}),B=m>0?{warnings:[O(n,m)]}:{};return{record:R.record,errors:null,turn:u,cid:g,idempotent:!1,...B}}export{F as a,$ as b,G as c,P as d,L as e,H as f,V as g,J as h,X as i};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as N}from"./chunk-R4JUKTDO.js";import{C as k,M as C,O as R,R as v,sa as G,sb as D,ub as I,v as b}from"./chunk-UEE3RZN4.js";import{f as w,g as _}from"./chunk-KU3YHPWZ.js";var l=(e,t,i=new Set)=>{let n=e.nameOf.get(t);if(n!==void 0)return n;if(i.has(t))return t;i.add(t);for(let[o,s]of e.superseded){if(s!==t||G(o,t,c=>e.nodeLabel.get(c)))continue;let u=l(e,o,i);if(u!==o)return u}return t};function F(e,t){let i=e.stale(t);if(i==="fresh")return;if(i==="orphaned")return"orphaned \u2014 no live source evidences this item";let n=[],o=new Map;for(let s of e.derivesInto(t))o.set(String(s.props.source_id),s);for(let[s,u]of o){let c=e.heads.get(s);if(c==null)continue;let g=D(e,t,s);if(g!==null){g.stale&&n.push(`DERIVES pin ${s} broke \u2014 ${I(s,g)}`);continue}if(c===u.props.source_cid)continue;let S=e.convChains.get(s)?.chain;S&&S.includes(String(u.props.source_cid))||n.push(`DERIVES pin ${s}@${String(u.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let s of e.edgesFrom(t)){if(s.type===_.DERIVES||!e.superseded.has(s.dst))continue;let u=e.tipOf(s.dst);if(e.superseded.has(u)){n.push(`${s.type} pin \u2192 ${l(e,s.dst)} \u2014 target retired`);continue}let c=P(e,s.dst,u);n.push(c.length>0?`${l(e,s.dst)} updated: ${c.map(g=>g.field).join(", ")}`:`${s.type} pin \u2192 ${l(e,s.dst)} \u2014 target superseded`)}return n.length>0?n.join("; "):"stale \u2014 a pinned dependency moved"}function P(e,t,i){let n=e.getNode(t)?.content??{},o=e.getNode(i)?.content??{},s=c=>c===void 0?"":Array.isArray(c)?c.map(String).join(" \xB7 "):typeof c=="object"?JSON.stringify(c):String(c),u=[];for(let c of[...new Set([...Object.keys(n),...Object.keys(o)])].sort())JSON.stringify(n[c])!==JSON.stringify(o[c])&&u.push({field:c,old:s(n[c]),new:s(o[c])});return u}function L(e,t){let i=[];for(let{cid:n}of e.byLabel(w.SCENARIO))e.superseded.has(n)||e.edgesFrom(n).some(o=>o.type===_.BELONGS_TO&&e.tipOf(o.dst)===t)&&i.push(n);return i}function j(e,t){let i=[],n=[],o=[],s=[],u=[],c=[],g=L(e,t),S=new Set(g),p=(d,f)=>{let r=F(e,f);return r===void 0?d:{...d,stale:!0,stale_reason:r}};for(let d of g){let f=e.getNode(d)?.content??{};i.push(p({ref:l(e,d),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},d));for(let r of e.edgesInto(d)){if(r.type!==_.AUTOMATES||e.superseded.has(r.src))continue;let a=e.getNode(r.src)?.content??{},y=e.edgesFrom(r.src).filter(m=>m.type===_.VERIFIES&&!e.superseded.has(m.dst)).map(m=>l(e,m.dst));n.push(p({ref:l(e,r.src),title:String(a.title??""),automates:l(e,d),check:a.check,verifies:y,...typeof a.target=="string"?{target:a.target}:{},...typeof a.app=="string"?{app:a.app}:{}},r.src)),u.push(r.src)}for(let r of e.edgesFrom(d))r.type!==_.EXERCISES||e.superseded.has(r.dst)||s.push({scenario:l(e,d),ac:l(e,r.dst)})}for(let{cid:d}of e.byLabel(w.AC)){if(e.superseded.has(d))continue;let f=e.edgesFrom(d).find(x=>x.type===_.SCOPED_TO);if(!f)continue;let r=e.tipOf(f.dst),a=e.superseded.has(r)&&e.nodeLabel.get(r)===w.SCENARIO&&e.edgesFrom(r).some(x=>x.type===_.BELONGS_TO&&e.tipOf(x.dst)===t);if(!(r===t||S.has(r)||a))continue;let m=e.getNode(d)?.content??{},O={ref:l(e,d),text:String(m.text??""),kind:String(m.kind??""),scope:r===t?"use-case":l(e,r)};o.push(a?{...O,stale:!0,stale_reason:`orphaned: its scenario ${l(e,r)} was retired \u2014 re-scope it (scoped_to_repoints) to a live scenario or the use case if it still holds; a redesign retires it with its scenario otherwise`}:p(O,d)),c.push(d)}let E=[],h=new Set;for(let d of[t,...g,...u,...c])for(let f of e.retractedEdgesTouching(d))h.has(f.ecid)||(h.add(f.ecid),E.push({type:f.type,src:l(e,f.src),dst:l(e,f.dst),at:f.retraction.at,...f.retraction.reason?{reason:f.retraction.reason}:{}}));return{scenarios:i,tests:n,acs:o,exercises:s,retracted_edges:E}}function $(e,t,i){let n=b(e,t,i);return n===null?null:n.toString("utf8")}function A(e,t){let i=t.split(`
2
+ import{h as N}from"./chunk-LTPOMMAB.js";import{C as k,M as C,O as R,R as v,sa as G,sb as D,ub as I,v as b}from"./chunk-PI7OXS62.js";import{f as w,g as _}from"./chunk-KU3YHPWZ.js";var l=(e,t,i=new Set)=>{let n=e.nameOf.get(t);if(n!==void 0)return n;if(i.has(t))return t;i.add(t);for(let[o,s]of e.superseded){if(s!==t||G(o,t,c=>e.nodeLabel.get(c)))continue;let u=l(e,o,i);if(u!==o)return u}return t};function F(e,t){let i=e.stale(t);if(i==="fresh")return;if(i==="orphaned")return"orphaned \u2014 no live source evidences this item";let n=[],o=new Map;for(let s of e.derivesInto(t))o.set(String(s.props.source_id),s);for(let[s,u]of o){let c=e.heads.get(s);if(c==null)continue;let g=D(e,t,s);if(g!==null){g.stale&&n.push(`DERIVES pin ${s} broke \u2014 ${I(s,g)}`);continue}if(c===u.props.source_cid)continue;let S=e.convChains.get(s)?.chain;S&&S.includes(String(u.props.source_cid))||n.push(`DERIVES pin ${s}@${String(u.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let s of e.edgesFrom(t)){if(s.type===_.DERIVES||!e.superseded.has(s.dst))continue;let u=e.tipOf(s.dst);if(e.superseded.has(u)){n.push(`${s.type} pin \u2192 ${l(e,s.dst)} \u2014 target retired`);continue}let c=P(e,s.dst,u);n.push(c.length>0?`${l(e,s.dst)} updated: ${c.map(g=>g.field).join(", ")}`:`${s.type} pin \u2192 ${l(e,s.dst)} \u2014 target superseded`)}return n.length>0?n.join("; "):"stale \u2014 a pinned dependency moved"}function P(e,t,i){let n=e.getNode(t)?.content??{},o=e.getNode(i)?.content??{},s=c=>c===void 0?"":Array.isArray(c)?c.map(String).join(" \xB7 "):typeof c=="object"?JSON.stringify(c):String(c),u=[];for(let c of[...new Set([...Object.keys(n),...Object.keys(o)])].sort())JSON.stringify(n[c])!==JSON.stringify(o[c])&&u.push({field:c,old:s(n[c]),new:s(o[c])});return u}function L(e,t){let i=[];for(let{cid:n}of e.byLabel(w.SCENARIO))e.superseded.has(n)||e.edgesFrom(n).some(o=>o.type===_.BELONGS_TO&&e.tipOf(o.dst)===t)&&i.push(n);return i}function j(e,t){let i=[],n=[],o=[],s=[],u=[],c=[],g=L(e,t),S=new Set(g),p=(d,f)=>{let r=F(e,f);return r===void 0?d:{...d,stale:!0,stale_reason:r}};for(let d of g){let f=e.getNode(d)?.content??{};i.push(p({ref:l(e,d),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},d));for(let r of e.edgesInto(d)){if(r.type!==_.AUTOMATES||e.superseded.has(r.src))continue;let a=e.getNode(r.src)?.content??{},y=e.edgesFrom(r.src).filter(m=>m.type===_.VERIFIES&&!e.superseded.has(m.dst)).map(m=>l(e,m.dst));n.push(p({ref:l(e,r.src),title:String(a.title??""),automates:l(e,d),check:a.check,verifies:y,...typeof a.target=="string"?{target:a.target}:{},...typeof a.app=="string"?{app:a.app}:{}},r.src)),u.push(r.src)}for(let r of e.edgesFrom(d))r.type!==_.EXERCISES||e.superseded.has(r.dst)||s.push({scenario:l(e,d),ac:l(e,r.dst)})}for(let{cid:d}of e.byLabel(w.AC)){if(e.superseded.has(d))continue;let f=e.edgesFrom(d).find(x=>x.type===_.SCOPED_TO);if(!f)continue;let r=e.tipOf(f.dst),a=e.superseded.has(r)&&e.nodeLabel.get(r)===w.SCENARIO&&e.edgesFrom(r).some(x=>x.type===_.BELONGS_TO&&e.tipOf(x.dst)===t);if(!(r===t||S.has(r)||a))continue;let m=e.getNode(d)?.content??{},O={ref:l(e,d),text:String(m.text??""),kind:String(m.kind??""),scope:r===t?"use-case":l(e,r)};o.push(a?{...O,stale:!0,stale_reason:`orphaned: its scenario ${l(e,r)} was retired \u2014 re-scope it (scoped_to_repoints) to a live scenario or the use case if it still holds; a redesign retires it with its scenario otherwise`}:p(O,d)),c.push(d)}let E=[],h=new Set;for(let d of[t,...g,...u,...c])for(let f of e.retractedEdgesTouching(d))h.has(f.ecid)||(h.add(f.ecid),E.push({type:f.type,src:l(e,f.src),dst:l(e,f.dst),at:f.retraction.at,...f.retraction.reason?{reason:f.retraction.reason}:{}}));return{scenarios:i,tests:n,acs:o,exercises:s,retracted_edges:E}}function $(e,t,i){let n=b(e,t,i);return n===null?null:n.toString("utf8")}function A(e,t){let i=t.split(`
3
3
  `).map(o=>o.replace(/^\d+\| /,"")),n=[];for(let o of e.split(`
4
4
  `)){let s=o.trim();if(s.length===0)continue;let u=i.find(c=>c.includes(s));u!==void 0&&!n.includes(u.trim())&&n.push(u.trim())}return n.length>0?n.join(`
5
5
  `):{removed:!0}}function T(e,t,i,n,o){let s=o?{requested:o}:{};if(n!==void 0&&n.trim().length>0)return{kind:"user-directive",text:n.trim(),...s};let u=[i,...j(t,i).acs.map(p=>t.resolve(p.ref)?.tip??"")].filter(Boolean),c=[],g=new Set;for(let p of u){let E=new Map;for(let d of R(t,p))for(let f of t.derivesInto(d))E.set(String(f.props.source_id),f);let h=(d,f,r)=>{let a=String(f.props.anchor),y=`${d}\0${a}`;if(g.has(y)||a==="img#whole")return;g.add(y);let m=$(e,t,String(f.props.source_cid)),O=m===null?null:k(m,a);if(O===null)return;let x=$(e,t,r);c.push({source_id:d,anchor:a,old_anchor_text:O,new_anchor_text:x===null?{removed:!0}:A(O,x)})};for(let[d,f]of E){let r=t.heads.get(d);if(r==null)continue;let a=D(t,p,d);if(a!==null){for(let y of a.failed)y.props.source_cid!==r&&h(d,y,r);continue}r!==f.props.source_cid&&h(d,f,r)}}let S;for(let[p,E]of t.superseded){if(E!==i||t.nodeLabel.get(p)!==w.USECASE)continue;let h=P(t,p,i);h.length>0&&(S=h);break}return{kind:"source-change",changes:c,...S?{uc_updated:S}:{},...s}}function U(e,t,i,n,o){let s=j(t,i);if(s.scenarios.length===0&&s.tests.length===0&&s.acs.length===0)return;let u=T(e,t,i,n,o);if(!(!o&&u.kind==="source-change"&&u.changes.length===0&&!u.uc_updated))return{prior_design:s,change_delta:u}}function K(e,t){if(!t.force||t.resume||!t.useCase||t.priorDesign!==void 0||t.changeDelta!==void 0)return t;let i=C(e),n=i.resolve(v(i,t.useCase));if(!n||i.nodeLabel.get(n.tip)!==w.USECASE||N(i,n.tip)===null)return t;let o=U(e,i,n.tip);return o?{...t,priorDesign:o.prior_design,changeDelta:o.change_delta}:t}export{F as a,j as b,U as c,K as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{d as g}from"./chunk-C6HI6Y3S.js";import{a as m}from"./chunk-C2RUDJ46.js";var _="KaneAI Generated",E="Untitled";async function p(e){let r=e.config.load(),d=new g(m(e.env).tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key),n=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(l=>l.name===n);if(a)t=a.project_id,s=a.name,e.log("info","ENSURE_PROJECT_FOUND","Found default project",{project_id:t,name:s});else{let l=await d.createProject(n);t=l.id,s=l.name,e.log("info","ENSURE_PROJECT_CREATED","Created default project",{project_id:t,name:s})}f(e.creds,e.config,e.profile,e.env,{projectId:t,projectName:s})}let c=r.folder_id??null,i=r.folder_name??null,u=!r.project_id;if(!c||u){let a=(await d.listFolders(t)).find(l=>l.name===o);if(a)c=a.id,i=a.name,e.log("info","ENSURE_FOLDER_FOUND","Found default folder",{folder_id:c,name:i});else{let l=await d.createFolder(t,o);c=l.id,i=l.name,e.log("info","ENSURE_FOLDER_CREATED","Created default folder",{folder_id:c,name:i})}f(e.creds,e.config,e.profile,e.env,{folderId:c,folderName:i})}return{projectId:t,projectName:s??n,folderId:c,folderName:i??o}}function A(e,r,d){let n=e.loadProfileConfig(r,d)??{};return{projectId:n.project_id??null,folderId:n.folder_id??null}}function N(e,r){return e.projectId===null||e.folderId===null||r===null?"needs-picker":r.project==="ok"&&r.folder==="ok"?"ok":r.project==="error"&&r.folder==="error"?"ok-tms-degraded":"needs-picker"}var k=(e,r)=>`error: profile "${e}" (${r}) has no project/folder configured AND no TMS credentials were available to auto-configure one.
2
+ import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{e as g}from"./chunk-6K5BEEAJ.js";import{a as m}from"./chunk-FI2DVNRT.js";var _="KaneAI Generated",E="Untitled";async function p(e){let r=e.config.load(),d=new g(m(e.env).tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key),n=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(l=>l.name===n);if(a)t=a.project_id,s=a.name,e.log("info","ENSURE_PROJECT_FOUND","Found default project",{project_id:t,name:s});else{let l=await d.createProject(n);t=l.id,s=l.name,e.log("info","ENSURE_PROJECT_CREATED","Created default project",{project_id:t,name:s})}f(e.creds,e.config,e.profile,e.env,{projectId:t,projectName:s})}let c=r.folder_id??null,i=r.folder_name??null,u=!r.project_id;if(!c||u){let a=(await d.listFolders(t)).find(l=>l.name===o);if(a)c=a.id,i=a.name,e.log("info","ENSURE_FOLDER_FOUND","Found default folder",{folder_id:c,name:i});else{let l=await d.createFolder(t,o);c=l.id,i=l.name,e.log("info","ENSURE_FOLDER_CREATED","Created default folder",{folder_id:c,name:i})}f(e.creds,e.config,e.profile,e.env,{folderId:c,folderName:i})}return{projectId:t,projectName:s??n,folderId:c,folderName:i??o}}function A(e,r,d){let n=e.loadProfileConfig(r,d)??{};return{projectId:n.project_id??null,folderId:n.folder_id??null}}function N(e,r){return e.projectId===null||e.folderId===null||r===null?"needs-picker":r.project==="ok"&&r.folder==="ok"?"ok":r.project==="error"&&r.folder==="error"?"ok-tms-degraded":"needs-picker"}var k=(e,r)=>`error: profile "${e}" (${r}) has no project/folder configured AND no TMS credentials were available to auto-configure one.
3
3
 
4
4
  discover IDs:
5
5
  kane-cli projects list --search "<keyword>" --limit 10
@@ -14,4 +14,4 @@ set them:
14
14
  kane-cli config folder <folder-id>
15
15
  `;function C(e,r){return k(e,r)}function D(e){return`info: auto-configured project "${e.projectName}" (${e.projectId}) and folder "${e.folderName}" (${e.folderId}). Change with: kane-cli config project <id> / kane-cli config folder <id>.`}function S(e){return`${JSON.stringify(T(e))}
16
16
  `}function T(e){return{type:"project_folder_auto_defaulted",project_id:e.projectId,project_name:e.projectName,folder_id:e.folderId,folder_name:e.folderName}}async function x(e){if(e.isLocal)return e.log("info","GATE_SKIP_LOCAL","Gate skipped (--local)",{}),{status:"skip",reason:"local"};j(e.creds,e.config,e.profile,e.env,e.log);let r=A(e.creds,e.profile,e.env),d=null;if(r.projectId!==null){let o=m(e.env);d=await new g(o.tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key).validateProjectFolder(r.projectId,r.folderId??""),e.log("info","GATE_VALIDATE","TMS project/folder validation",{project:d.project,folder:d.folder,folder_was_cached:r.folderId!==null})}else r.folderId!==null&&(f(e.creds,e.config,e.profile,e.env,{folderId:null,folderName:null}),e.log("warn","GATE_CLEARED_ORPHAN_FOLDER","Cleared orphan folder (no project cached)",{folder_id:r.folderId}),r.folderId=null);let n=N(r,d);if(n==="ok")return{status:"ok",projectId:r.projectId,folderId:r.folderId};if(n==="ok-tms-degraded")return e.log("warn","GATE_TMS_DEGRADED","TMS validation failed; using cached IDs",{project_id:r.projectId,folder_id:r.folderId}),{status:"ok",projectId:r.projectId,folderId:r.folderId};if(d){let o={};d.project==="missing"?(o.projectId=null,o.projectName=null,o.folderId=null,o.folderName=null):d.folder==="missing"&&(o.folderId=null,o.folderName=null),Object.keys(o).length>0&&(f(e.creds,e.config,e.profile,e.env,o),e.log("info","GATE_CLEARED_STALE","Cleared stale cached IDs before re-resolve",{project_cleared:d.project==="missing",folder_cleared:d.folder==="missing"||d.project==="missing"}))}try{let o=await p({creds:e.creds,config:e.config,profile:e.profile,env:e.env,tmsCreds:e.tmsCreds,log:e.log}),t={projectId:o.projectId,projectName:o.projectName,folderId:o.folderId,folderName:o.folderName};return e.log("info","GATE_AUTO_DEFAULTED","Auto-configured project/folder",{project_id:t.projectId,project_name:t.projectName,folder_id:t.folderId,folder_name:t.folderName}),e.onAnnounce?e.onAnnounce(t):process.stderr.write(`${D(t)}
17
- `),{status:"ok",projectId:t.projectId,folderId:t.folderId,autoDefaulted:t}}catch(o){let t=C(e.profile,e.env);if(e.log("error","GATE_FATAL","Auto-default failed",{profile:e.profile,env:e.env,cached_project_id:r.projectId,cached_folder_id:r.folderId,validation:d,error:o instanceof Error?o.message:String(o)}),e.onFatalExit)e.onFatalExit(t);else{process.stderr.write(t);let{shutdown:s}=await import("./exit-manager-EDHCETUN.js");s(2,"Project/folder gate failed")}return{status:"cancelled"}}}export{p as a,A as b,N as c,C as d,D as e,S as f,T as g,x as h};
17
+ `),{status:"ok",projectId:t.projectId,folderId:t.folderId,autoDefaulted:t}}catch(o){let t=C(e.profile,e.env);if(e.log("error","GATE_FATAL","Auto-default failed",{profile:e.profile,env:e.env,cached_project_id:r.projectId,cached_folder_id:r.folderId,validation:d,error:o instanceof Error?o.message:String(o)}),e.onFatalExit)e.onFatalExit(t);else{process.stderr.write(t);let{shutdown:s}=await import("./exit-manager-EGWAZHCR.js");s(2,"Project/folder gate failed")}return{status:"cancelled"}}}export{p as a,A as b,N as c,C as d,D as e,S as f,T as g,x as h};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h,b as x,c as O}from"./chunk-3AGP2BVN.js";import{oa as B}from"./chunk-UEE3RZN4.js";import{a as S}from"./chunk-HCBYKLMW.js";import{b as i}from"./chunk-33DWJV67.js";import{a as w}from"./chunk-FOJHSG5M.js";import{y as s}from"./chunk-D36V5OX6.js";import{e as L}from"./chunk-UR6MHSHU.js";var e=L(S(),1),W={high:0,med:1,low:2},E={high:s.red,med:"yellow",low:s.dim};function j(d){return d.map((n,o)=>({r:n,i:o})).sort((n,o)=>(W[n.r.risk??"zz"]??3)-(W[o.r.risk??"zz"]??3)||n.i-o.i).map(({r:n})=>n)}function z(d,n=120,o="risk"){if(d.length===0)return null;let a=j(d),l=t=>t.held?"(held)":t.staged||!t.id?"(staged)":B(t.id),p=Math.max(2,...a.map(t=>l(t).length)),g=o!==null,r=o!==null?Math.max(o.length,...a.map(t=>(t.badge??"").length)):0,m=n>=84&&a.some(t=>t.summary),c=2+(g?1:0)+(m?1:0),u=c+1+c*2,b=n-u-p-r,k=Math.max(...a.map(t=>Math.max(t.title.length,(t.marker??"").length)),5),f=Math.max(5,m?Math.min(k,Math.max(16,Math.floor(b*.5))):Math.min(k,b)),T=m?Math.max(7,b-f):0,R=(t,$,M,I)=>O(t,$,M,I.map(A=>A.length)),C=(t,$,M,I)=>[x(h(t,p),p),x(h($,f),f),...g?[x(h(M,r),r)]:[],...m?[x(h(I,T),T)]:[]],y=C("id","title",o??"","summary");return{showBadge:g,showSummary:m,headerCells:y,top:R("\u250C","\u252C","\u2510",y),middle:R("\u251C","\u253C","\u2524",y),bottom:R("\u2514","\u2534","\u2518",y),rows:a.map(t=>({cells:C(l(t),h(t.title,f),h(t.badge??"",r),h(t.summary??"",T)),badgeColor:t.badgeColor??E[t.badge??""]??s.dim,...t.marker?{markerCells:C("",h(t.marker,f),"","")}:{}}))}}function K(d,n){let o=z(d,n.width,n.badgeHeader===void 0?"risk":n.badgeHeader);if(o===null)return[];let a=(r,m)=>n.color?D(r,m):m,l=r=>a(s.dim,r),p=r=>n.color?w.bold(r):r,g=[l(o.top),`${l("\u2502 ")}${o.headerCells.map(p).join(l(" \u2502 "))}${l(" \u2502")}`,l(o.middle)];for(let r of o.rows){let[m,c,...u]=r.cells,b=o.showBadge?[a(r.badgeColor,u[0])]:[],k=o.showSummary?[u[o.showBadge?1:0]]:[];g.push(`${l("\u2502 ")}${a(s.assuranceAccent,m)}${l(" \u2502 ")}${[c,...b,...k].join(l(" \u2502 "))}${l(" \u2502")}`),r.markerCells&&g.push(l(`\u2502 ${r.markerCells.join(" \u2502 ")} \u2502`))}return g.push(l(o.bottom)),g}function D(d,n){if(d.startsWith("#"))return w.hex(d)(n);let o=w[d];return typeof o=="function"?o(n):n}function v({rows:d,width:n=120,badgeHeader:o="risk"}){let a=z(d,n,o);if(a===null)return null;let{showBadge:l,showSummary:p,headerCells:g}=a,r=[];r.push((0,e.jsx)(i,{color:s.dim,children:a.top},"t")),r.push((0,e.jsxs)(i,{children:[g.map((m,c)=>(0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:c===0?"\u2502 ":" \u2502 "}),(0,e.jsx)(i,{bold:!0,children:m})]},c)),(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},"h")),r.push((0,e.jsx)(i,{color:s.dim,children:a.middle},"m"));for(let[m,c]of a.rows.entries()){let u=c.cells;r.push((0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:"\u2502 "}),(0,e.jsx)(i,{color:s.assuranceAccent,children:u[0]}),(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[1],l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),(0,e.jsx)(i,{color:c.badgeColor,children:u[2]})]}):null,p?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[l?3:2]]}):null,(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},`r-${m}`)),c.markerCells&&r.push((0,e.jsx)(i,{color:s.dim,children:`\u2502 ${c.markerCells.join(" \u2502 ")} \u2502`},`mk-${m}`))}return r.push((0,e.jsx)(i,{color:s.dim,children:a.bottom},"b")),(0,e.jsx)(e.Fragment,{children:r})}export{K as a,v as b};
2
+ import{a as h,b as x,c as O}from"./chunk-3AGP2BVN.js";import{oa as B}from"./chunk-PI7OXS62.js";import{a as S}from"./chunk-HCBYKLMW.js";import{b as i}from"./chunk-33DWJV67.js";import{a as w}from"./chunk-FOJHSG5M.js";import{z as s}from"./chunk-FAMQ4DHU.js";import{e as L}from"./chunk-UR6MHSHU.js";var e=L(S(),1),W={high:0,med:1,low:2},E={high:s.red,med:"yellow",low:s.dim};function j(d){return d.map((n,o)=>({r:n,i:o})).sort((n,o)=>(W[n.r.risk??"zz"]??3)-(W[o.r.risk??"zz"]??3)||n.i-o.i).map(({r:n})=>n)}function z(d,n=120,o="risk"){if(d.length===0)return null;let a=j(d),l=t=>t.held?"(held)":t.staged||!t.id?"(staged)":B(t.id),p=Math.max(2,...a.map(t=>l(t).length)),g=o!==null,r=o!==null?Math.max(o.length,...a.map(t=>(t.badge??"").length)):0,m=n>=84&&a.some(t=>t.summary),c=2+(g?1:0)+(m?1:0),u=c+1+c*2,b=n-u-p-r,k=Math.max(...a.map(t=>Math.max(t.title.length,(t.marker??"").length)),5),f=Math.max(5,m?Math.min(k,Math.max(16,Math.floor(b*.5))):Math.min(k,b)),T=m?Math.max(7,b-f):0,R=(t,$,M,I)=>O(t,$,M,I.map(A=>A.length)),C=(t,$,M,I)=>[x(h(t,p),p),x(h($,f),f),...g?[x(h(M,r),r)]:[],...m?[x(h(I,T),T)]:[]],y=C("id","title",o??"","summary");return{showBadge:g,showSummary:m,headerCells:y,top:R("\u250C","\u252C","\u2510",y),middle:R("\u251C","\u253C","\u2524",y),bottom:R("\u2514","\u2534","\u2518",y),rows:a.map(t=>({cells:C(l(t),h(t.title,f),h(t.badge??"",r),h(t.summary??"",T)),badgeColor:t.badgeColor??E[t.badge??""]??s.dim,...t.marker?{markerCells:C("",h(t.marker,f),"","")}:{}}))}}function K(d,n){let o=z(d,n.width,n.badgeHeader===void 0?"risk":n.badgeHeader);if(o===null)return[];let a=(r,m)=>n.color?D(r,m):m,l=r=>a(s.dim,r),p=r=>n.color?w.bold(r):r,g=[l(o.top),`${l("\u2502 ")}${o.headerCells.map(p).join(l(" \u2502 "))}${l(" \u2502")}`,l(o.middle)];for(let r of o.rows){let[m,c,...u]=r.cells,b=o.showBadge?[a(r.badgeColor,u[0])]:[],k=o.showSummary?[u[o.showBadge?1:0]]:[];g.push(`${l("\u2502 ")}${a(s.assuranceAccent,m)}${l(" \u2502 ")}${[c,...b,...k].join(l(" \u2502 "))}${l(" \u2502")}`),r.markerCells&&g.push(l(`\u2502 ${r.markerCells.join(" \u2502 ")} \u2502`))}return g.push(l(o.bottom)),g}function D(d,n){if(d.startsWith("#"))return w.hex(d)(n);let o=w[d];return typeof o=="function"?o(n):n}function v({rows:d,width:n=120,badgeHeader:o="risk"}){let a=z(d,n,o);if(a===null)return null;let{showBadge:l,showSummary:p,headerCells:g}=a,r=[];r.push((0,e.jsx)(i,{color:s.dim,children:a.top},"t")),r.push((0,e.jsxs)(i,{children:[g.map((m,c)=>(0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:c===0?"\u2502 ":" \u2502 "}),(0,e.jsx)(i,{bold:!0,children:m})]},c)),(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},"h")),r.push((0,e.jsx)(i,{color:s.dim,children:a.middle},"m"));for(let[m,c]of a.rows.entries()){let u=c.cells;r.push((0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:"\u2502 "}),(0,e.jsx)(i,{color:s.assuranceAccent,children:u[0]}),(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[1],l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),(0,e.jsx)(i,{color:c.badgeColor,children:u[2]})]}):null,p?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[l?3:2]]}):null,(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},`r-${m}`)),c.markerCells&&r.push((0,e.jsx)(i,{color:s.dim,children:`\u2502 ${c.markerCells.join(" \u2502 ")} \u2502`},`mk-${m}`))}return r.push((0,e.jsx)(i,{color:s.dim,children:a.bottom},"b")),(0,e.jsx)(e.Fragment,{children:r})}export{K as a,v as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{l as a,m as b,n as c,o as d}from"./chunk-GJ7MO2FW.js";import"./chunk-Z36KVIRR.js";import"./chunk-Q4JV4U65.js";import"./chunk-226AGYHB.js";import"./chunk-6K5BEEAJ.js";import"./chunk-3G2LSTK5.js";import"./chunk-VZ7KXRXB.js";import"./chunk-FI2DVNRT.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K75WIRI5.js";import"./chunk-FAMQ4DHU.js";import"./chunk-UR6MHSHU.js";export{c as resolveVerdictTarget,b as runEvidenceLintPolicy,a as runEvidenceValidate,d as runEvidenceVerdict};