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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/{ChatSurface-VPD5G67Q.js → ChatSurface-6NZGMNHL.js} +1 -1
  2. package/dist/{ChromeProfilePicker-CRKQEFYD.js → ChromeProfilePicker-M4WXOB5O.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-M7BMWLKK.js → CliFeedbackPrompt-6MJA7DF6.js} +1 -1
  4. package/dist/{CliUploadProgress-OP7DXMC2.js → CliUploadProgress-6NLS7XHH.js} +1 -1
  5. package/dist/{ConfigView-XI74BCCH.js → ConfigView-O4WKZ5PU.js} +1 -1
  6. package/dist/{EvidenceViewOffer-HAAK6DS5.js → EvidenceViewOffer-WIEWCZUP.js} +1 -1
  7. package/dist/FolderPicker-AF7ZMV3M.js +2 -0
  8. package/dist/InfoBox-D7GGZJU4.js +2 -0
  9. package/dist/{LinksBox-PNSESNCU.js → LinksBox-DXP66H3H.js} +1 -1
  10. package/dist/{ProfilesView-PYDZZHKO.js → ProfilesView-TWOY5PVC.js} +1 -1
  11. package/dist/ProjectPicker-OBYHJJLU.js +2 -0
  12. package/dist/SaveSessionPrompt-7XSHS4NL.js +2 -0
  13. package/dist/SingleShotApp-XQUDR36R.js +2 -0
  14. package/dist/{SummaryBox-FALOODAQ.js → SummaryBox-IA2KS6GT.js} +1 -1
  15. package/dist/TestMdRunView-LS2QUFWR.js +2 -0
  16. package/dist/TestrunEvidenceTable-HNDVJDIF.js +2 -0
  17. package/dist/{WhoamiView-6WXGRANY.js → WhoamiView-SNL75TEF.js} +1 -1
  18. package/dist/{app-download-RXVZB6MM.js → app-download-UI4ABEIX.js} +1 -1
  19. package/dist/{assurance-job-C3TXZGLL.js → assurance-job-FFSSS4XV.js} +1 -1
  20. package/dist/{binary-DJCDMGPX.js → binary-THPLXCOD.js} +1 -1
  21. package/dist/{bind-XVO4CQYV.js → bind-4XWK3DG2.js} +1 -1
  22. package/dist/{bootstrap-TY5RANJ7.js → bootstrap-6ACT4ALI.js} +1 -1
  23. package/dist/{catalog-RRQF4TCA.js → catalog-MYPS2BXY.js} +1 -1
  24. package/dist/{changelog-GBEVIUFJ.js → changelog-SU674BVE.js} +1 -1
  25. package/dist/{chunk-AA674WLL.js → chunk-2DYHAP4E.js} +1 -1
  26. package/dist/{chunk-VG44B5JD.js → chunk-36N3EHW5.js} +1 -1
  27. package/dist/{chunk-P7MSVLAH.js → chunk-3E4ZO73O.js} +1 -1
  28. package/dist/{chunk-NWD54VV5.js → chunk-3F5FMH76.js} +1 -1
  29. package/dist/{chunk-I5NSJBOZ.js → chunk-3OQW2GTA.js} +1 -1
  30. package/dist/{chunk-LRS5MGBY.js → chunk-3RJHXOZH.js} +1 -1
  31. package/dist/{chunk-DDJNYQBH.js → chunk-3YTCKCBG.js} +1 -1
  32. package/dist/{chunk-252FWF2G.js → chunk-457Y5TEC.js} +1 -1
  33. package/dist/{chunk-DD5TULWQ.js → chunk-4QFTHUJA.js} +1 -1
  34. package/dist/{chunk-672CQECV.js → chunk-4YW767UV.js} +7 -7
  35. package/dist/{chunk-7LKCWO2R.js → chunk-5AKJPYUW.js} +3 -3
  36. package/dist/{chunk-VQLH63X7.js → chunk-6DZX5HLZ.js} +1 -1
  37. package/dist/{chunk-QHRUBG7J.js → chunk-6EB5VRAN.js} +1 -1
  38. package/dist/{chunk-QS5ZJFGF.js → chunk-734ORT6O.js} +1 -1
  39. package/dist/{chunk-57MDWTON.js → chunk-7AET4JKQ.js} +1 -1
  40. package/dist/{chunk-W3OVSDBN.js → chunk-7HMSMAUG.js} +1 -1
  41. package/dist/{chunk-FFL55I2M.js → chunk-7NPTL66J.js} +1 -1
  42. package/dist/{chunk-T7H4LBFK.js → chunk-7SY34IIL.js} +1 -1
  43. package/dist/{chunk-RFIIM33J.js → chunk-7YT4TTKL.js} +1 -1
  44. package/dist/{chunk-CPBBYNL7.js → chunk-ACMBMZDQ.js} +1 -1
  45. package/dist/{chunk-UALJTPSA.js → chunk-AEWNWAXW.js} +1 -1
  46. package/dist/{chunk-V7S6S5W3.js → chunk-AVSMXDTX.js} +1 -1
  47. package/dist/{chunk-MGNRNLBE.js → chunk-C2RUDJ46.js} +1 -1
  48. package/dist/{chunk-QQ4TKLWP.js → chunk-C62QWG4B.js} +1 -1
  49. package/dist/{chunk-OEWYXCTA.js → chunk-CCP4X75B.js} +1 -1
  50. package/dist/{chunk-LRXBJTD4.js → chunk-CGITGJ3I.js} +1 -1
  51. package/dist/{chunk-QCKA665H.js → chunk-CM4CHYSN.js} +1 -1
  52. package/dist/{chunk-2OOFURWD.js → chunk-CUXY6KQ2.js} +1 -1
  53. package/dist/{chunk-I6OQISK4.js → chunk-D36V5OX6.js} +1 -1
  54. package/dist/{chunk-LNNWCBPQ.js → chunk-D7TKE7LK.js} +1 -1
  55. package/dist/{chunk-2IZRPMZN.js → chunk-D7U2M26S.js} +1 -1
  56. package/dist/{chunk-SONMD3W5.js → chunk-DDZLCAEO.js} +1 -1
  57. package/dist/{chunk-NWBLYMH7.js → chunk-DJC7NTLA.js} +1 -1
  58. package/dist/{chunk-TW63WWEN.js → chunk-DZOYYWOW.js} +1 -1
  59. package/dist/{chunk-UAWWLLTI.js → chunk-EBPRPNSA.js} +1 -1
  60. package/dist/{chunk-T3HEJASG.js → chunk-ECPFI75W.js} +1 -1
  61. package/dist/{chunk-JQSLUGD4.js → chunk-EECDDDSB.js} +1 -1
  62. package/dist/{chunk-7EXDYXXD.js → chunk-ETZMFRD6.js} +1 -1
  63. package/dist/{chunk-5BUIIFLC.js → chunk-F22K3RRX.js} +1 -1
  64. package/dist/{chunk-BJJUKB5K.js → chunk-F5NHG7VB.js} +1 -1
  65. package/dist/{chunk-B2HXPGIZ.js → chunk-FWDUVFS6.js} +3 -3
  66. package/dist/{chunk-T4AVLJCW.js → chunk-FWUPJORV.js} +1 -1
  67. package/dist/{chunk-VYHT2IET.js → chunk-GQRU3B54.js} +1 -1
  68. package/dist/{chunk-AIXJYMSP.js → chunk-GXKY5A46.js} +1 -1
  69. package/dist/{chunk-QTZBVDPR.js → chunk-HCJ2N3XB.js} +1 -1
  70. package/dist/{chunk-XBEYWXPV.js → chunk-HJMCXSUJ.js} +1 -1
  71. package/dist/{chunk-ZZP5SHUV.js → chunk-HK62JVQM.js} +1 -1
  72. package/dist/{chunk-3UVSAAES.js → chunk-I4RVVBG3.js} +1 -1
  73. package/dist/{chunk-JPYW6U4D.js → chunk-I4WXALQR.js} +1 -1
  74. package/dist/{chunk-OVNRRI4E.js → chunk-ICLUC44J.js} +1 -1
  75. package/dist/{chunk-DHQ4SQWA.js → chunk-IGEAET7M.js} +1 -1
  76. package/dist/{chunk-IXW7FOGX.js → chunk-IJ2AHSWW.js} +1 -1
  77. package/dist/{chunk-2S3W2JT3.js → chunk-IUQOG7Z5.js} +1 -1
  78. package/dist/{chunk-IBBD36FQ.js → chunk-JZP3Y4ZM.js} +1 -1
  79. package/dist/{chunk-NDEI7R4K.js → chunk-KODJVOCN.js} +1 -1
  80. package/dist/{chunk-IMDMRJQ6.js → chunk-KXHJMAZU.js} +1 -1
  81. package/dist/{chunk-OQ5G773E.js → chunk-L5DALV5N.js} +1 -1
  82. package/dist/{chunk-S53AQU7R.js → chunk-LAOTVZHV.js} +1 -1
  83. package/dist/{chunk-NQTYWHPB.js → chunk-LIGTP3A3.js} +1 -1
  84. package/dist/{chunk-7RPKHKA3.js → chunk-LQQNPMOD.js} +1 -1
  85. package/dist/{chunk-OZNBTSW5.js → chunk-LUR7JFPP.js} +1 -1
  86. package/dist/{chunk-QNLVC5ZB.js → chunk-LUZBGTYB.js} +1 -1
  87. package/dist/{chunk-N3TCNZSX.js → chunk-M43WH5DQ.js} +1 -1
  88. package/dist/{chunk-432ZOE42.js → chunk-MEKPGQAM.js} +1 -1
  89. package/dist/{chunk-GZFLJORM.js → chunk-NIVFEACM.js} +1 -1
  90. package/dist/{chunk-SA6IKFFD.js → chunk-NXAJBSIF.js} +1 -1
  91. package/dist/{chunk-MII3JOO3.js → chunk-NZ6AV2TA.js} +1 -1
  92. package/dist/{chunk-2SWSVJUP.js → chunk-OCDBTAYS.js} +1 -1
  93. package/dist/{chunk-SLKYD44Y.js → chunk-OGFU4YY4.js} +1 -1
  94. package/dist/{chunk-4LPX2OLV.js → chunk-P3JXJ4BW.js} +1 -1
  95. package/dist/{chunk-Y4T4SLDO.js → chunk-PAWQ4AKN.js} +1 -1
  96. package/dist/{chunk-6NWT2TEJ.js → chunk-QBYENBMB.js} +1 -1
  97. package/dist/{chunk-XIPKSXRQ.js → chunk-QDXKEOKI.js} +3 -3
  98. package/dist/{chunk-T6K2MEWP.js → chunk-QENCC2ZS.js} +1 -1
  99. package/dist/{chunk-SWMTXMKB.js → chunk-RF37IJNN.js} +1 -1
  100. package/dist/{chunk-XJ7HCXKW.js → chunk-RHGW7B5Q.js} +1 -1
  101. package/dist/{chunk-H3HHSTEK.js → chunk-RTVHJ23A.js} +1 -1
  102. package/dist/{chunk-OAKYUBD3.js → chunk-SGPAM5DZ.js} +1 -1
  103. package/dist/{chunk-RG372DON.js → chunk-TU42YZOJ.js} +1 -1
  104. package/dist/{chunk-V5JGXOV7.js → chunk-TU7TVFBK.js} +1 -1
  105. package/dist/{chunk-AJQZ3ST5.js → chunk-TW5AA5A7.js} +1 -1
  106. package/dist/{chunk-WI7K6VKQ.js → chunk-URH4FX3H.js} +1 -1
  107. package/dist/{chunk-BVO4C5F2.js → chunk-V7USCQWO.js} +1 -1
  108. package/dist/{chunk-4D5PC6QE.js → chunk-VSVWNRI2.js} +1 -1
  109. package/dist/{chunk-BZVNI44O.js → chunk-VUFIL5VR.js} +2 -2
  110. package/dist/{chunk-74W4AOT2.js → chunk-VX657KIK.js} +1 -1
  111. package/dist/{chunk-A6TJOZ24.js → chunk-VXGN3IV7.js} +1 -1
  112. package/dist/{chunk-2OSFI33O.js → chunk-VZ4A6WMK.js} +3 -3
  113. package/dist/{chunk-M6MBMRFR.js → chunk-W4QSZNMB.js} +1 -1
  114. package/dist/{chunk-EXFDIVNI.js → chunk-W54OT2FU.js} +2 -2
  115. package/dist/{chunk-NFRA64NU.js → chunk-W6HZF56M.js} +1 -1
  116. package/dist/{chunk-MZOIHUVX.js → chunk-W72ACCFL.js} +2 -2
  117. package/dist/{chunk-JD52IXON.js → chunk-WAOUE7MP.js} +1 -1
  118. package/dist/{chunk-WYSZ6TPW.js → chunk-WEIPY3CI.js} +10 -9
  119. package/dist/{chunk-I2KOGINW.js → chunk-WXJCJL5L.js} +1 -1
  120. package/dist/{chunk-LWJRSUE2.js → chunk-WZXPF3BI.js} +1 -1
  121. package/dist/{chunk-OF7WPCTQ.js → chunk-XLEGGC4Y.js} +1 -1
  122. package/dist/{chunk-6LIC2R22.js → chunk-XQMWHPZI.js} +1 -1
  123. package/dist/{chunk-D4FFXCX6.js → chunk-XRNQSXOM.js} +2 -2
  124. package/dist/{chunk-RW3Z2HMB.js → chunk-XZGEN4NU.js} +1 -1
  125. package/dist/{chunk-DNGOT65K.js → chunk-Y7E5L42F.js} +1 -1
  126. package/dist/{chunk-K45BKGB5.js → chunk-YAW6JW6D.js} +1 -1
  127. package/dist/{chunk-ENL4XTQ2.js → chunk-YGRULEZY.js} +1 -1
  128. package/dist/{chunk-F3U6T4YD.js → chunk-YHFZFV3A.js} +2 -2
  129. package/dist/{chunk-RX47NRSM.js → chunk-YLXWAY7D.js} +1 -1
  130. package/dist/{chunk-WEM3MOAL.js → chunk-YPFQ4UGF.js} +1 -1
  131. package/dist/{chunk-6U7ID777.js → chunk-YQ5C6UDG.js} +1 -1
  132. package/dist/{chunk-HFJSP4KD.js → chunk-ZAFJQ3SM.js} +1 -1
  133. package/dist/{chunk-2NFS4KE4.js → chunk-ZTRRFG52.js} +1 -1
  134. package/dist/{chunk-L4UVUFL6.js → chunk-ZU4W2QGM.js} +1 -1
  135. package/dist/{config-5ZOALGKE.js → config-754B73XK.js} +1 -1
  136. package/dist/{cover-cmd-UA2SVIZZ.js → cover-cmd-NBNZCR6C.js} +1 -1
  137. package/dist/{credentials-MRG452Y6.js → credentials-F7DYLVWY.js} +1 -1
  138. package/dist/{deps-bundle-FWINW4XM.js → deps-bundle-PW3WEQJ7.js} +1 -1
  139. package/dist/{deps-resolve-IET4KIBO.js → deps-resolve-SQYVN76L.js} +1 -1
  140. package/dist/{design-chat-MM5PJD2N.js → design-chat-F3OEZPNJ.js} +1 -1
  141. package/dist/{design-headless-FZONCKHW.js → design-headless-OTHYOX3E.js} +1 -1
  142. package/dist/{design-remote-SPVRIY2H.js → design-remote-2BEGCVCX.js} +2 -2
  143. package/dist/device-env-CHFRRV6W.js +2 -0
  144. package/dist/{doctor-VAX2BWQF.js → doctor-XY26Z35T.js} +1 -1
  145. package/dist/{evidence-LVVK7ROT.js → evidence-P6FFKC7B.js} +1 -1
  146. package/dist/{evolve-cmd-AGRKG7T3.js → evolve-cmd-WWOB3QJR.js} +1 -1
  147. package/dist/{evolve-remote-BGHULJTL.js → evolve-remote-WLVY3QID.js} +1 -1
  148. package/dist/{explain-cmd-WOBGS6KX.js → explain-cmd-OP5I5W3O.js} +1 -1
  149. package/dist/explore-K5YBGHK6.js +2 -0
  150. package/dist/{explore-context-tty-JTZVZFOE.js → explore-context-tty-RZ7D2TBV.js} +1 -1
  151. package/dist/{explore-entry-5OGNLFAU.js → explore-entry-EKXJ67BD.js} +4 -4
  152. package/dist/{explore-live-2XZHUYFS.js → explore-live-2YVRAQZO.js} +1 -1
  153. package/dist/{explore-run-tty-LGTIK2NA.js → explore-run-tty-D47FGPX7.js} +2 -2
  154. package/dist/{extract-bind-NM2BBK4I.js → extract-bind-W2NET364.js} +3 -3
  155. package/dist/{extract-chat-HLQMJJIC.js → extract-chat-M65NWGUK.js} +1 -1
  156. package/dist/{extract-cmd-T2TSAC3N.js → extract-cmd-FTFLETOP.js} +2 -2
  157. package/dist/{extract-headless-OQTQ3FJK.js → extract-headless-G6W6JQ27.js} +1 -1
  158. package/dist/{folder-flags-WXUR6OPJ.js → folder-flags-KKIH654K.js} +1 -1
  159. package/dist/{gaps-cmd-PTSKPTF7.js → gaps-cmd-OIDDLRYL.js} +1 -1
  160. package/dist/{gate-P57VP4E5.js → gate-7AKRPRMK.js} +1 -1
  161. package/dist/{generate-headless-JYZP6VXZ.js → generate-headless-RURIEKVS.js} +2 -2
  162. package/dist/index.js +19 -19
  163. package/dist/{ingest-cmd-LHCBMO4Z.js → ingest-cmd-4G2AK4Y2.js} +3 -3
  164. package/dist/{ingest-remote-D5TO5JQP.js → ingest-remote-SSLUHQVG.js} +1 -1
  165. package/dist/install-ZVBHPXGP.js +2 -0
  166. package/dist/{interactive-bind-5EJQUGKI.js → interactive-bind-SI2ZS55Q.js} +2 -2
  167. package/dist/{interactive-remote-D77ULJGL.js → interactive-remote-J56EWJGA.js} +1 -1
  168. package/dist/{lattice-auth-74XGF77Y.js → lattice-auth-6FEVSR7E.js} +1 -1
  169. package/dist/{lifecycle-cmd-7SM6UCMH.js → lifecycle-cmd-HJ37LTXE.js} +1 -1
  170. package/dist/{list-cmd-Z6FZXMFU.js → list-cmd-6XL2FYLQ.js} +1 -1
  171. package/dist/{list-commands-CZYZ7GIG.js → list-commands-5DCCKU3L.js} +1 -1
  172. package/dist/{list-remote-WOPOC6KK.js → list-remote-LXPQNXYN.js} +1 -1
  173. package/dist/login-flow-WEK3E476.js +2 -0
  174. package/dist/{maintenance-cmd-VRTGZVRE.js → maintenance-cmd-BXXHP36K.js} +1 -1
  175. package/dist/{mobile-prompts-KNAHU64X.js → mobile-prompts-CECJ5UY2.js} +1 -1
  176. package/dist/{onboarding-LGT6PMDZ.js → onboarding-PDVYMTY5.js} +1 -1
  177. package/dist/{persist-recorded-session-BX7II5P7.js → persist-recorded-session-A3ID7JFA.js} +1 -1
  178. package/dist/{pipeline-IXVTVRS5.js → pipeline-GX3LKPI5.js} +1 -1
  179. package/dist/{prepare-target-ULMKVKMC.js → prepare-target-FMT6QFHZ.js} +1 -1
  180. package/dist/{pull-cmd-6AL2WYHB.js → pull-cmd-UPFQYUND.js} +1 -1
  181. package/dist/{pull-route-TTVARJMV.js → pull-route-FWBXJMR7.js} +1 -1
  182. package/dist/real-device-run-X7JJWOIK.js +2 -0
  183. package/dist/{reconcile-cmd-R6H37SQR.js → reconcile-cmd-JBH365JL.js} +4 -4
  184. package/dist/{reconcile-remote-GWDV5CUT.js → reconcile-remote-BCX6SWFC.js} +2 -2
  185. package/dist/{recording-banner-ACC67Q2U.js → recording-banner-YKBAL6UB.js} +1 -1
  186. package/dist/registry-VQC757MJ.js +2 -0
  187. package/dist/remote-entry-X6JMPC2K.js +2 -0
  188. package/dist/{remote-mode-7G6PLJCW.js → remote-mode-FDPA7EWG.js} +1 -1
  189. package/dist/{remote-words-45USLRVN.js → remote-words-YVB66R3F.js} +1 -1
  190. package/dist/{require-project-folder-A3UDRELU.js → require-project-folder-MLMEQJYP.js} +1 -1
  191. package/dist/{resolve-run-intent-ZGPSUBXV.js → resolve-run-intent-PC7TQZUL.js} +1 -1
  192. package/dist/{resolver-IPM6R7U4.js → resolver-EID34LQE.js} +1 -1
  193. package/dist/{review-cmd-NNT5C5RZ.js → review-cmd-EUHFLFMY.js} +1 -1
  194. package/dist/{run-remote-3AYYVPKX.js → run-remote-SJCRTL7O.js} +1 -1
  195. package/dist/{run-startup-gate-NKRMKYBB.js → run-startup-gate-YO66G6LS.js} +1 -1
  196. package/dist/{run-test-md-HE6DUWQR.js → run-test-md-BLNBK4MH.js} +2 -2
  197. package/dist/session-worker.js +2 -2
  198. package/dist/{sessions-cmd-GYMETJHG.js → sessions-cmd-S7WZBUCN.js} +1 -1
  199. package/dist/{sessions-remote-GI7GOBMH.js → sessions-remote-IWHWIQ2T.js} +1 -1
  200. package/dist/{skill-installer-3QAVQGDH.js → skill-installer-MAVQY6GW.js} +1 -1
  201. package/dist/{store-X6XPFSKF.js → store-MSA7KASS.js} +1 -1
  202. package/dist/{store-choice-RT73HAI7.js → store-choice-3OJCV26J.js} +1 -1
  203. package/dist/{store-guard-SNWKLHQV.js → store-guard-OOSDLMEC.js} +1 -1
  204. package/dist/{sync-cmd-NBPPDG3B.js → sync-cmd-RDFDMVKQ.js} +1 -1
  205. package/dist/{sync-setup-5NUCH6N3.js → sync-setup-RBRDUV7Q.js} +1 -1
  206. package/dist/tcg-generate-KIECTZ2C.js +2 -0
  207. package/dist/{testmd-actions-GH5BW5V5.js → testmd-actions-CMAG6HWI.js} +1 -1
  208. package/dist/{testmd-sync-ACKCIOL3.js → testmd-sync-UPAA5UMD.js} +1 -1
  209. package/dist/token-refresh-KP3AYMYK.js +2 -0
  210. package/dist/{validate-basic-RE2WLIGQ.js → validate-basic-M5JHHNZA.js} +1 -1
  211. package/dist/{version-check-4FJVZP3K.js → version-check-Q737BE65.js} +1 -1
  212. package/dist/{view-cmd-N47BQZPD.js → view-cmd-XSNL5DGI.js} +1 -1
  213. package/dist/{walk-session-DA7QWXSW.js → walk-session-SHGYLFRB.js} +1 -1
  214. package/dist/{with-telemetry-7V4LY2BG.js → with-telemetry-PM2HVN2B.js} +1 -1
  215. package/package.json +11 -11
  216. package/dist/FolderPicker-W5S6RFCP.js +0 -2
  217. package/dist/InfoBox-OWUEHV2D.js +0 -2
  218. package/dist/ProjectPicker-BGFCUGT5.js +0 -2
  219. package/dist/SaveSessionPrompt-SUJE54GS.js +0 -2
  220. package/dist/SingleShotApp-4TDXZEUA.js +0 -2
  221. package/dist/TestMdRunView-4GPRWHEU.js +0 -2
  222. package/dist/TestrunEvidenceTable-OBVQJ6IO.js +0 -2
  223. package/dist/device-env-LXJ65AVF.js +0 -2
  224. package/dist/explore-LOKNOVNP.js +0 -2
  225. package/dist/install-Z6K2D2VY.js +0 -2
  226. package/dist/login-flow-2FZEOVHM.js +0 -2
  227. package/dist/real-device-run-2LFS5WE2.js +0 -2
  228. package/dist/registry-6IJYQXQC.js +0 -2
  229. package/dist/remote-entry-YL7O2NJQ.js +0 -2
  230. package/dist/tcg-generate-Z23CUISY.js +0 -2
  231. package/dist/token-refresh-4UCYAG6A.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{K as $,s as p}from"./chunk-W3OVSDBN.js";import{a as f}from"./chunk-QXQ7KVEN.js";import{oa as u}from"./chunk-UEE3RZN4.js";var w=e=>e===1?"1 change":`${e} changes`,v=e=>e===1?"waits":"wait";function c(e){let t=/^(\S+-\d+) · (.+)$/.exec(e.title);return t?`${u(t[1])} "${t[2]}"`:`"${e.title}"`}var y=e=>typeof e=="string"?`"${e}"`:e.bare,d=y,j=e=>typeof e=="string"?e:e.bare;function D(e,t){return t.page?{...e,page:t.page}:null}var m=e=>e.page?.bare?{bare:e.page.shown}:e.page?.shown??e.source,O={header:e=>`reviewing what changed in ${d(e)}`,held:(e,t)=>{let n=t.filter(s=>s==="ADD").length,i=t.filter(s=>s==="ARCHIVE").length,r=t.length-n-i,o=[n>0?`${n} new ${n===1?"use-case":"use-cases"}`:null,r>0?`${r} changed`:null,i>0?`${i} no longer in it`:null].filter(s=>s!==null);return`${w(t.length)} from ${d(e)} ${v(t.length)} for your review: ${o.join(", ")}`},waiting:(e,t)=>`${w(t)} from ${d(e)} ${v(t)} for your review`,reviewRow:(e,t)=>`review ${w(t)} from ${d(e)}`,finishForNow:{label:"finish for now",detail:"the review waits in this session"},adjust:"adjust \u2014 tell me what to change",reviewed:(e,t)=>{let n=t.approved+t.rejected+t.deferred,i=[t.approved>0?`${t.approved} approved`:null,t.rejected>0?t.rejected===1?"1 kept as it was":`${t.rejected} kept as they were`:null,t.deferred>0?`${t.deferred} left for later`:null].filter(r=>r!==null);return`reviewed ${n===1?"the change":`the ${n} changes`} from ${d(e)}: ${i.join(" \xB7 ")}`},finishSession:"finish the session",diffTitle:e=>c(e),receipt:(e,t)=>{let n=c(e),i=e.kind==="ADD",r="nothing is saved for this change, and it may be suggested again";return t==="approve"?{line:i?`added ${n} to this session`:e.kind==="ARCHIVE"?`archived ${n} in this session`:`approved the change to ${n} in this session`}:t==="reject"?{line:i?`left ${n} out of this session`:`kept ${n} as it is`,note:r}:{line:i?`left ${n} out for now, as an open question`:`left ${n} as it is for now, as an open question`}},refused:(e,t,n)=>t==="TARGET_RETIRED"?{line:`${c(e)} was archived while you were reviewing, so nothing changed`}:t==="SOURCE_MOVED"?{line:`${d(m(n))} changed again while you were reviewing, so this change wasn't taken`,next:["next: to review the latest version, run:",n.page?` kane-cli context ingest ${f(n.page.address)}${n.page.as?` --as ${f(n.page.as)}`:""}`:` kane-cli maintain reconcile --from ${n.file} --source-id ${n.source}`]}:t==="SOURCE_UNRESOLVED"?{line:`${d(m(n))} was removed while you were reviewing, so this change can't be taken`}:t==="ARCHIVE_UNRESOLVED"?{line:`${c(e)} changed while you were reviewing, so it can't be archived`,moveOn:!0}:t==="CONCURRENT_APPEND"?{line:"that didn't go through: the project was busy; try the card again"}:t==="ALREADY_VERDICTED"||t==="CARD_GONE"||t==="HOLD_GONE"?{line:"that change isn't in this review anymore, so nothing was done"}:{line:"that change can't be taken, so nothing was done",next:[`if this keeps failing, share this id with support: ${p(`refused_${t}`)}`]},chatRefused:e=>{let t=[];for(let n of e){let i=n.ref?`${u(n.ref)}${n.title?` "${n.title}"`:""}`:null;n.code==="EXPECTED_CID_MOVED"&&i?n.moved?t.push(`${i} changed after the agent read it, so this edit wasn't made`,"continue, and the agent works from its latest version"):t.push(`the agent's edit to ${i} didn't match it as it is now, so it wasn't made`,"continue, and the agent reads it again"):t.push("continue, and the agent tries again",`if this keeps failing, share this id with support: ${p(`refused_${n.code}`)}`)}return[...new Set(t)]},approveRefused:e=>{let t=e.find(n=>n.code==="EXPECTED_CID_MOVED"&&n.ref);return t?{line:`${`${u(t.ref)}${t.title?` "${t.title}"`:""}`} changed after it was shown to you, so nothing was approved`,notes:['view what was added to see it as it is now, then pick "looks good" again']}:{line:"that didn't go through, so nothing was approved",notes:['pick "looks good" again',`if this keeps failing, share this id with support: ${p(`refused_${e[0]?.code??"APPROVE"}`)}`]}},diffSummary:e=>{let t=e.filter(s=>s.field==="criteria"),n=Math.max(t.filter(s=>s.op==="+").length,t.filter(s=>s.op==="-").length),i=[...new Set(e.filter(s=>s.field!=="criteria").map(s=>s.field))],r=i.length>0?`its ${i.join(" and ")}`:null,o=n>0?`${n} acceptance ${n===1?"criterion":"criteria"} changed`:null;return o&&r?`${o}, and ${r}`:o??`${r} changed`},steering:"reading the change again, with your words",steerNothing:"your words left nothing to review",steerFailed:"that didn't go through; the changes wait as they were",offerAsks:e=>e>0?"design its tests again?":"design its tests?",notLanded:"that didn't go through; try the card again",offer:(e,t)=>t>0?{headline:t===1?`the test of "${e}" was designed for its old version`:`the ${t} tests of "${e}" were designed for its old version`,rows:[{key:"run",label:t===1?"design it again now":"design them again now",detail:t===1?"replaces it if it no longer fits":"replaces any that no longer fit"},{key:"later",label:"later",detail:`kane-cli context list --stale lists ${t===1?"it":"them"}`}]}:{headline:`"${e}" has no tests yet`,rows:[{key:"run",label:"design its tests now"},{key:"later",label:"later",detail:"design them after you save"}]},childOpen:(e,t)=>`designing the tests of "${t}"${e==="evolve"?" again":""}`,childClosed:(e,t,n)=>[`designed the tests of "${t}"${e==="evolve"?" again":""}`,n.join(" \xB7 ")].filter(Boolean).join(" \u2014 "),childTests:(e,t)=>`${l(t)}${e==="evolve"?"":" added"}`,back:e=>`back to the review \u2014 ${l(e)} added in this session`,againBack:e=>{let t=(a,h)=>a===1?`its test ${h}`:`its ${a} tests ${h}`,i=[e.replaced.scenarios+e.replaced.tests>0&&"replaced",e.updated>0&&"updated",e.kept>0&&"kept"].filter(a=>a!==!1);if(i.length===0)return null;let r=`${[...e.replaced.scenarios>0?[k(e.replaced.scenarios)]:[],...e.replaced.tests>0?[l(e.replaced.tests)]:[]].join(" and ")} replaced`;if(i.length===1)return`back to the review \u2014 ${i[0]==="replaced"?e.replaced.scenarios===0?t(e.replaced.tests,"replaced"):r:i[0]==="updated"?t(e.updated,"updated"):e.kept===1?"its test kept as it was":`its ${e.kept} tests kept as they were`}`;let o=[],s=0;return i.forEach((a,h)=>{let b=h===i.length-1;if(a==="replaced"){o.push(r),s+=e.replaced.tests;return}let g=a==="updated"?e.updated:e.kept;b?o.push(s>0?`the other ${g===1?"test":`${g} tests`} ${a}`:t(g,a)):(o.push(`${l(g)} ${a}`),s+=g)}),`back to the review \u2014 ${o.join(", ")}`},childUnfinished:e=>e==="evolve"?"designing its tests again didn't finish":"designing its tests didn't finish",childFailed:(e,t)=>`couldn't design the tests of "${t}"${e==="evolve"?" again":""}`,childFailedNext:(e,t)=>t==="evolve"?["next: to update them later, run:",` kane-cli maintain evolve ${e}`]:["next: to design its tests later, run:",` kane-cli design tests --use-case ${e}`],childFailedNew:"its tests can be designed after you save this session",updateOpen:(e,t)=>`updating the tests of "${e}"${t?" \u2014 its use-case changed":""}`,updateClosed:(e,t)=>[`updated the tests of "${e}"`,t.join(" \xB7 ")].filter(Boolean).join(" \u2014 "),updateTests:e=>[...e.added>0?[`${l(e.added)} added`]:[],...$({changes:{tests:e.updated}})].join(", ")||null,updateUnfinished:e=>`updating the tests of "${e}" didn't finish`,updateFinishing:"finishing the update\u2026",updateFailed:e=>`couldn't update the tests of "${e}"`,updateUntouched:e=>`finished here: the tests of "${e}" weren't changed`,childHeld:(e,t)=>[{text:` \u2717 its tests can't be designed again now: ${e?"you're designing them in another session":"someone else is designing them"}`},{text:" the change stays approved in this session; to update its tests later, run:",dim:!0},{text:` kane-cli maintain evolve ${t}`,dim:!0}]},l=e=>e===1?"1 test":`${e} tests`,k=e=>e===1?"1 scenario":`${e} scenarios`;function S(e){return/^\S+-\d+ · (.+)$/.exec(e.title)?.[1]??e.title}export{c as a,y as b,j as c,D as d,m as e,O as f,S as g};
2
+ import{K as $,s as p}from"./chunk-7HMSMAUG.js";import{a as f}from"./chunk-QXQ7KVEN.js";import{oa as u}from"./chunk-UEE3RZN4.js";var w=e=>e===1?"1 change":`${e} changes`,v=e=>e===1?"waits":"wait";function c(e){let t=/^(\S+-\d+) · (.+)$/.exec(e.title);return t?`${u(t[1])} "${t[2]}"`:`"${e.title}"`}var y=e=>typeof e=="string"?`"${e}"`:e.bare,d=y,j=e=>typeof e=="string"?e:e.bare;function D(e,t){return t.page?{...e,page:t.page}:null}var m=e=>e.page?.bare?{bare:e.page.shown}:e.page?.shown??e.source,O={header:e=>`reviewing what changed in ${d(e)}`,held:(e,t)=>{let n=t.filter(s=>s==="ADD").length,i=t.filter(s=>s==="ARCHIVE").length,r=t.length-n-i,o=[n>0?`${n} new ${n===1?"use-case":"use-cases"}`:null,r>0?`${r} changed`:null,i>0?`${i} no longer in it`:null].filter(s=>s!==null);return`${w(t.length)} from ${d(e)} ${v(t.length)} for your review: ${o.join(", ")}`},waiting:(e,t)=>`${w(t)} from ${d(e)} ${v(t)} for your review`,reviewRow:(e,t)=>`review ${w(t)} from ${d(e)}`,finishForNow:{label:"finish for now",detail:"the review waits in this session"},adjust:"adjust \u2014 tell me what to change",reviewed:(e,t)=>{let n=t.approved+t.rejected+t.deferred,i=[t.approved>0?`${t.approved} approved`:null,t.rejected>0?t.rejected===1?"1 kept as it was":`${t.rejected} kept as they were`:null,t.deferred>0?`${t.deferred} left for later`:null].filter(r=>r!==null);return`reviewed ${n===1?"the change":`the ${n} changes`} from ${d(e)}: ${i.join(" \xB7 ")}`},finishSession:"finish the session",diffTitle:e=>c(e),receipt:(e,t)=>{let n=c(e),i=e.kind==="ADD",r="nothing is saved for this change, and it may be suggested again";return t==="approve"?{line:i?`added ${n} to this session`:e.kind==="ARCHIVE"?`archived ${n} in this session`:`approved the change to ${n} in this session`}:t==="reject"?{line:i?`left ${n} out of this session`:`kept ${n} as it is`,note:r}:{line:i?`left ${n} out for now, as an open question`:`left ${n} as it is for now, as an open question`}},refused:(e,t,n)=>t==="TARGET_RETIRED"?{line:`${c(e)} was archived while you were reviewing, so nothing changed`}:t==="SOURCE_MOVED"?{line:`${d(m(n))} changed again while you were reviewing, so this change wasn't taken`,next:["next: to review the latest version, run:",n.page?` kane-cli context ingest ${f(n.page.address)}${n.page.as?` --as ${f(n.page.as)}`:""}`:` kane-cli maintain reconcile --from ${n.file} --source-id ${n.source}`]}:t==="SOURCE_UNRESOLVED"?{line:`${d(m(n))} was removed while you were reviewing, so this change can't be taken`}:t==="ARCHIVE_UNRESOLVED"?{line:`${c(e)} changed while you were reviewing, so it can't be archived`,moveOn:!0}:t==="CONCURRENT_APPEND"?{line:"that didn't go through: the project was busy; try the card again"}:t==="ALREADY_VERDICTED"||t==="CARD_GONE"||t==="HOLD_GONE"?{line:"that change isn't in this review anymore, so nothing was done"}:{line:"that change can't be taken, so nothing was done",next:[`if this keeps failing, share this id with support: ${p(`refused_${t}`)}`]},chatRefused:e=>{let t=[];for(let n of e){let i=n.ref?`${u(n.ref)}${n.title?` "${n.title}"`:""}`:null;n.code==="EXPECTED_CID_MOVED"&&i?n.moved?t.push(`${i} changed after the agent read it, so this edit wasn't made`,"continue, and the agent works from its latest version"):t.push(`the agent's edit to ${i} didn't match it as it is now, so it wasn't made`,"continue, and the agent reads it again"):t.push("continue, and the agent tries again",`if this keeps failing, share this id with support: ${p(`refused_${n.code}`)}`)}return[...new Set(t)]},approveRefused:e=>{let t=e.find(n=>n.code==="EXPECTED_CID_MOVED"&&n.ref);return t?{line:`${`${u(t.ref)}${t.title?` "${t.title}"`:""}`} changed after it was shown to you, so nothing was approved`,notes:['view what was added to see it as it is now, then pick "looks good" again']}:{line:"that didn't go through, so nothing was approved",notes:['pick "looks good" again',`if this keeps failing, share this id with support: ${p(`refused_${e[0]?.code??"APPROVE"}`)}`]}},diffSummary:e=>{let t=e.filter(s=>s.field==="criteria"),n=Math.max(t.filter(s=>s.op==="+").length,t.filter(s=>s.op==="-").length),i=[...new Set(e.filter(s=>s.field!=="criteria").map(s=>s.field))],r=i.length>0?`its ${i.join(" and ")}`:null,o=n>0?`${n} acceptance ${n===1?"criterion":"criteria"} changed`:null;return o&&r?`${o}, and ${r}`:o??`${r} changed`},steering:"reading the change again, with your words",steerNothing:"your words left nothing to review",steerFailed:"that didn't go through; the changes wait as they were",offerAsks:e=>e>0?"design its tests again?":"design its tests?",notLanded:"that didn't go through; try the card again",offer:(e,t)=>t>0?{headline:t===1?`the test of "${e}" was designed for its old version`:`the ${t} tests of "${e}" were designed for its old version`,rows:[{key:"run",label:t===1?"design it again now":"design them again now",detail:t===1?"replaces it if it no longer fits":"replaces any that no longer fit"},{key:"later",label:"later",detail:`kane-cli context list --stale lists ${t===1?"it":"them"}`}]}:{headline:`"${e}" has no tests yet`,rows:[{key:"run",label:"design its tests now"},{key:"later",label:"later",detail:"design them after you save"}]},childOpen:(e,t)=>`designing the tests of "${t}"${e==="evolve"?" again":""}`,childClosed:(e,t,n)=>[`designed the tests of "${t}"${e==="evolve"?" again":""}`,n.join(" \xB7 ")].filter(Boolean).join(" \u2014 "),childTests:(e,t)=>`${l(t)}${e==="evolve"?"":" added"}`,back:e=>`back to the review \u2014 ${l(e)} added in this session`,againBack:e=>{let t=(a,h)=>a===1?`its test ${h}`:`its ${a} tests ${h}`,i=[e.replaced.scenarios+e.replaced.tests>0&&"replaced",e.updated>0&&"updated",e.kept>0&&"kept"].filter(a=>a!==!1);if(i.length===0)return null;let r=`${[...e.replaced.scenarios>0?[k(e.replaced.scenarios)]:[],...e.replaced.tests>0?[l(e.replaced.tests)]:[]].join(" and ")} replaced`;if(i.length===1)return`back to the review \u2014 ${i[0]==="replaced"?e.replaced.scenarios===0?t(e.replaced.tests,"replaced"):r:i[0]==="updated"?t(e.updated,"updated"):e.kept===1?"its test kept as it was":`its ${e.kept} tests kept as they were`}`;let o=[],s=0;return i.forEach((a,h)=>{let b=h===i.length-1;if(a==="replaced"){o.push(r),s+=e.replaced.tests;return}let g=a==="updated"?e.updated:e.kept;b?o.push(s>0?`the other ${g===1?"test":`${g} tests`} ${a}`:t(g,a)):(o.push(`${l(g)} ${a}`),s+=g)}),`back to the review \u2014 ${o.join(", ")}`},childUnfinished:e=>e==="evolve"?"designing its tests again didn't finish":"designing its tests didn't finish",childFailed:(e,t)=>`couldn't design the tests of "${t}"${e==="evolve"?" again":""}`,childFailedNext:(e,t)=>t==="evolve"?["next: to update them later, run:",` kane-cli maintain evolve ${e}`]:["next: to design its tests later, run:",` kane-cli design tests --use-case ${e}`],childFailedNew:"its tests can be designed after you save this session",updateOpen:(e,t)=>`updating the tests of "${e}"${t?" \u2014 its use-case changed":""}`,updateClosed:(e,t)=>[`updated the tests of "${e}"`,t.join(" \xB7 ")].filter(Boolean).join(" \u2014 "),updateTests:e=>[...e.added>0?[`${l(e.added)} added`]:[],...$({changes:{tests:e.updated}})].join(", ")||null,updateUnfinished:e=>`updating the tests of "${e}" didn't finish`,updateFinishing:"finishing the update\u2026",updateFailed:e=>`couldn't update the tests of "${e}"`,updateUntouched:e=>`finished here: the tests of "${e}" weren't changed`,childHeld:(e,t)=>[{text:` \u2717 its tests can't be designed again now: ${e?"you're designing them in another session":"someone else is designing them"}`},{text:" the change stays approved in this session; to update its tests later, run:",dim:!0},{text:` kane-cli maintain evolve ${t}`,dim:!0}]},l=e=>e===1?"1 test":`${e} tests`,k=e=>e===1?"1 scenario":`${e} scenarios`;function S(e){return/^\S+-\d+ · (.+)$/.exec(e.title)?.[1]??e.title}export{c as a,y as b,j as c,D as d,m as e,O as f,S as g};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-OVNRRI4E.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as d,b as c,i as A}from"./chunk-33DWJV67.js";import{a as D}from"./chunk-6YGTRKDT.js";import{m as u,y as o}from"./chunk-I6OQISK4.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(u).map(i=>{let e=P(u,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(u,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(u,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(d,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(d,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
2
+ import{a as b}from"./chunk-ICLUC44J.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as d,b as c,i as A}from"./chunk-33DWJV67.js";import{a as D}from"./chunk-6YGTRKDT.js";import{m as u,y as o}from"./chunk-D36V5OX6.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(u).map(i=>{let e=P(u,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(u,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(u,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(d,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(d,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(d,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as I}from"./chunk-SXRHKXSE.js";import{f as c,h as w,i as y,l,q as f,t as A}from"./chunk-A7RJQJNT.js";import{b as m}from"./chunk-I6OQISK4.js";import{createHash as U}from"crypto";import{createReadStream as F}from"fs";import{mkdir as x,readFile as P,rename as $,writeFile as D}from"fs/promises";import{dirname as b,join as E}from"path";var k=60,S=5;function C(){return{entries:[]}}function v(){return E(m,"mobile","app-cache.json")}async function h(e){let r=U("sha256");for await(let t of F(e))r.update(t);return r.digest("hex")}function N(){return{readFile:e=>P(e,"utf8"),writeFile:async(e,r)=>{await x(b(e),{recursive:!0});let t=`${e}.tmp`;await D(t,r),await $(t,e)},hashFile:h,now:()=>new Date}}function g(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,a,i]=r,o=new Date(`${t}-${a}-${i}T00:00:00Z`);return Number.isNaN(o.getTime())?void 0:o.toISOString()}function O(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=k-S}var d=class{deps;constructor(r={}){this.deps={...N(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(v()));if(!r||typeof r!="object")return C();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return C()}}async write(r){await this.deps.writeFile(v(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(a=>a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(a=>!(a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),a=t.entries.length;t.entries=t.entries.filter(i=>!(i.sha256===r.sha256&&i.env===r.env&&i.orgId===r.orgId&&i.type===r.type)),t.entries.length!==a&&await this.write(t)}isNearExpiry(r){return O(r,this.deps.now())}};import{createHash as j}from"crypto";import{readdir as T,stat as _}from"fs/promises";import{basename as p,extname as B,join as R,relative as Y}from"path";function ae(e){return e.skipped===!0}function H(e,r){return A(r,e)?null:B(e).toLowerCase()===".ipa"&&!c(r)?`${p(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:c(r)?`${p(e)} is not an ${y(w(r))} build \u2014 ${l(r)} takes ${f(r).join(" or ")}.`:`${p(e)} cannot be uploaded for ${l(r)} \u2014 expected one of ${f(r).join(", ")}.`}async function J(e,r){if(!(await _(e)).isDirectory())return r.hashOf(e);let a=[],i=async n=>{for(let s of await T(n,{withFileTypes:!0})){let u=R(n,s.name);s.isDirectory()?await i(u):s.isFile()&&a.push(u)}};await i(e),a.sort();let o=j("sha256");for(let n of a)o.update(Y(e,n)),o.update("\0"),o.update(await h(n)),o.update("\0");return o.digest("hex")}async function se(e){let r=H(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new d,a=e.client??new I(e.baseUrl,{...e.auth,orgId:e.orgId}),i;try{i=await J(e.path,t)}catch(s){return{skipped:!0,reason:`could not read ${p(e.path)}: ${s.message}`}}let o={sha256:i,env:e.env,orgId:e.orgId,type:e.type},n=await t.lookup(o);if(n){if(await a.liveness(n.appId)!=="gone")return{appId:n.appId,...n.appUrl?{appUrl:n.appUrl}:{},fromCache:!0};e.onProgress?.(`${n.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(o)}try{e.onProgress?.(`uploading ${p(e.path)}\u2026`);let s=await a.upload(e.path,e.type);return await t.remember({sha256:i,env:e.env,orgId:e.orgId,type:e.type,appId:s.appId,...s.appUrl?{appUrl:s.appUrl}:{},...g(s.url)?{storedAt:g(s.url)}:{},sourcePath:e.path}),e.onProgress?.(s.cached?`${p(e.path)} already in the cloud (${s.appId})`:`${p(e.path)} uploaded (${s.appId})`),{appId:s.appId,...s.appUrl?{appUrl:s.appUrl}:{},fromCache:!1}}catch(s){return{skipped:!0,reason:s.message}}}export{d as a,ae as b,H as c,J as d,se as e};
2
+ import{h as I}from"./chunk-SXRHKXSE.js";import{f as c,h as w,i as y,l,q as f,t as A}from"./chunk-A7RJQJNT.js";import{b as m}from"./chunk-D36V5OX6.js";import{createHash as U}from"crypto";import{createReadStream as F}from"fs";import{mkdir as x,readFile as P,rename as $,writeFile as D}from"fs/promises";import{dirname as b,join as E}from"path";var k=60,S=5;function C(){return{entries:[]}}function v(){return E(m,"mobile","app-cache.json")}async function h(e){let r=U("sha256");for await(let t of F(e))r.update(t);return r.digest("hex")}function N(){return{readFile:e=>P(e,"utf8"),writeFile:async(e,r)=>{await x(b(e),{recursive:!0});let t=`${e}.tmp`;await D(t,r),await $(t,e)},hashFile:h,now:()=>new Date}}function g(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,a,i]=r,o=new Date(`${t}-${a}-${i}T00:00:00Z`);return Number.isNaN(o.getTime())?void 0:o.toISOString()}function O(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=k-S}var d=class{deps;constructor(r={}){this.deps={...N(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(v()));if(!r||typeof r!="object")return C();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return C()}}async write(r){await this.deps.writeFile(v(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(a=>a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(a=>!(a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),a=t.entries.length;t.entries=t.entries.filter(i=>!(i.sha256===r.sha256&&i.env===r.env&&i.orgId===r.orgId&&i.type===r.type)),t.entries.length!==a&&await this.write(t)}isNearExpiry(r){return O(r,this.deps.now())}};import{createHash as j}from"crypto";import{readdir as T,stat as _}from"fs/promises";import{basename as p,extname as B,join as R,relative as Y}from"path";function ae(e){return e.skipped===!0}function H(e,r){return A(r,e)?null:B(e).toLowerCase()===".ipa"&&!c(r)?`${p(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:c(r)?`${p(e)} is not an ${y(w(r))} build \u2014 ${l(r)} takes ${f(r).join(" or ")}.`:`${p(e)} cannot be uploaded for ${l(r)} \u2014 expected one of ${f(r).join(", ")}.`}async function J(e,r){if(!(await _(e)).isDirectory())return r.hashOf(e);let a=[],i=async n=>{for(let s of await T(n,{withFileTypes:!0})){let u=R(n,s.name);s.isDirectory()?await i(u):s.isFile()&&a.push(u)}};await i(e),a.sort();let o=j("sha256");for(let n of a)o.update(Y(e,n)),o.update("\0"),o.update(await h(n)),o.update("\0");return o.digest("hex")}async function se(e){let r=H(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new d,a=e.client??new I(e.baseUrl,{...e.auth,orgId:e.orgId}),i;try{i=await J(e.path,t)}catch(s){return{skipped:!0,reason:`could not read ${p(e.path)}: ${s.message}`}}let o={sha256:i,env:e.env,orgId:e.orgId,type:e.type},n=await t.lookup(o);if(n){if(await a.liveness(n.appId)!=="gone")return{appId:n.appId,...n.appUrl?{appUrl:n.appUrl}:{},fromCache:!0};e.onProgress?.(`${n.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(o)}try{e.onProgress?.(`uploading ${p(e.path)}\u2026`);let s=await a.upload(e.path,e.type);return await t.remember({sha256:i,env:e.env,orgId:e.orgId,type:e.type,appId:s.appId,...s.appUrl?{appUrl:s.appUrl}:{},...g(s.url)?{storedAt:g(s.url)}:{},sourcePath:e.path}),e.onProgress?.(s.cached?`${p(e.path)} already in the cloud (${s.appId})`:`${p(e.path)} uploaded (${s.appId})`),{appId:s.appId,...s.appUrl?{appUrl:s.appUrl}:{},fromCache:!1}}catch(s){return{skipped:!0,reason:s.message}}}export{d as a,ae as b,H as c,J as d,se as e};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $e,b as we,g as Ee}from"./chunk-OEWYXCTA.js";import{a as te}from"./chunk-NQTYWHPB.js";import{a as G}from"./chunk-5Y2G4NC7.js";import{b as ye}from"./chunk-WN5VKKJ3.js";import{a as Be}from"./chunk-5BUIIFLC.js";import{a as Te}from"./chunk-I5NSJBOZ.js";import{a as E}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as ve,k as ee}from"./chunk-33DWJV67.js";import{a as z}from"./chunk-6YGTRKDT.js";import{y as i}from"./chunk-I6OQISK4.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(z(),1);var I=R(z(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function ke(e){let t=Ee(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,I.useState)(0),[a,u]=(0,I.useState)("idle"),c=(0,I.useRef)("idle"),B=(0,I.useRef)(0),S=(0,I.useRef)(!1),v=(0,I.useRef)(null),d=(0,I.useRef)(null),O=(0,I.useCallback)(m=>{c.current=m,u(m)},[]),P=(0,I.useCallback)(async m=>{e.reportVerdictOnComplete&&await t.shutdownRunner($e(e.runVerdict?.()??(m?"failed":"passed"))),e.onAllComplete?.()},[t,e]),T=(0,I.useCallback)(async m=>{let b=await e.getNextConfig(m);if(!b){O("done"),await P(!1);return}let C=m?B.current+1:0;B.current=C,l(C),e.onStepStart?.(b,C),v.current=null,d.current=null,O("running"),await t.startRun(b,e.spawnOpts)},[t,e,O]);(0,I.useEffect)(()=>{S.current||(S.current=!0,T(null))},[]),(0,I.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===v.current||c.current!=="running")return;v.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let m=t.lastRunEnd,b=de(t.steps),C=t.bifurcationInfo,A={status:m.status==="passed"?"passed":"failed",duration_s:m.duration??0,reason:m.reason,runEnd:m,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:C&&!C.isSingleFlow?C.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(A,B.current)??!0)){O("done"),P(A.status==="failed");return}T(A)},[t.lastRunEnd]),(0,I.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let m=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:m.passed,stepsFailed:m.failed,stepsTotal:m.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,B.current)??!0)){O("done"),P(!0);return}T(b)},[t.runError,t.lastRunEnd]);let k=(0,I.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:k}}var pe=R(z(),1);var ne=R(E(),1),Ce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Le({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);G(()=>{l(B=>(B+1)%Ce.length)},80),G(()=>{u(B=>(B+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ce[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Oe(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var L=R(z(),1);var Pe=R(z(),1);var re=R(E(),1),Ue="#ffc580",We="#ffd9a8",Ie="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Pe.useState)(0),a=4;if(G(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Ie,children:e});let u=e.split("").map((c,B)=>{let S=n-a,v=Math.abs(B-S-a/2),d;return v<=a/2?d=Ue:v<=a?d=We:d=Ie,(0,re.jsx)(o,{color:d,children:c},B)});return(0,re.jsx)(o,{children:u})}var _=R(E(),1),ze={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=ze[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Xe={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function De(e){return Xe[e]??"\u25CF"}var q=R(E(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let B=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return B?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(v=>(0,q.jsx)(s,{marginLeft:2,children:l(v,`${S}-${v.childId??"p"}-${v.index}`)},`${S}-${v.childId??"p"}-${v.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var K=R(E(),1);function je({label:e,shimmer:t=!1}){return(0,K.jsxs)(s,{marginLeft:6,children:[(0,K.jsx)(te,{}),(0,K.jsx)(o,{children:" "}),t?(0,K.jsx)(oe,{text:e,active:!0}):(0,K.jsx)(o,{color:i.dim,children:e})]})}var Fe=R(z(),1);var me=R(E(),1);function Ye(e,t){let n=[];for(let l of e.split(`
2
+ import{a as $e,b as we,g as Ee}from"./chunk-CCP4X75B.js";import{a as te}from"./chunk-LIGTP3A3.js";import{a as G}from"./chunk-5Y2G4NC7.js";import{b as ye}from"./chunk-WN5VKKJ3.js";import{a as Be}from"./chunk-F22K3RRX.js";import{a as Te}from"./chunk-3OQW2GTA.js";import{a as E}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as ve,k as ee}from"./chunk-33DWJV67.js";import{a as z}from"./chunk-6YGTRKDT.js";import{y as i}from"./chunk-D36V5OX6.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(z(),1);var I=R(z(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function ke(e){let t=Ee(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,I.useState)(0),[a,u]=(0,I.useState)("idle"),c=(0,I.useRef)("idle"),B=(0,I.useRef)(0),S=(0,I.useRef)(!1),v=(0,I.useRef)(null),d=(0,I.useRef)(null),O=(0,I.useCallback)(m=>{c.current=m,u(m)},[]),P=(0,I.useCallback)(async m=>{e.reportVerdictOnComplete&&await t.shutdownRunner($e(e.runVerdict?.()??(m?"failed":"passed"))),e.onAllComplete?.()},[t,e]),T=(0,I.useCallback)(async m=>{let b=await e.getNextConfig(m);if(!b){O("done"),await P(!1);return}let C=m?B.current+1:0;B.current=C,l(C),e.onStepStart?.(b,C),v.current=null,d.current=null,O("running"),await t.startRun(b,e.spawnOpts)},[t,e,O]);(0,I.useEffect)(()=>{S.current||(S.current=!0,T(null))},[]),(0,I.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===v.current||c.current!=="running")return;v.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let m=t.lastRunEnd,b=de(t.steps),C=t.bifurcationInfo,A={status:m.status==="passed"?"passed":"failed",duration_s:m.duration??0,reason:m.reason,runEnd:m,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:C&&!C.isSingleFlow?C.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(A,B.current)??!0)){O("done"),P(A.status==="failed");return}T(A)},[t.lastRunEnd]),(0,I.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let m=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:m.passed,stepsFailed:m.failed,stepsTotal:m.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,B.current)??!0)){O("done"),P(!0);return}T(b)},[t.runError,t.lastRunEnd]);let k=(0,I.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:k}}var pe=R(z(),1);var ne=R(E(),1),Ce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Le({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);G(()=>{l(B=>(B+1)%Ce.length)},80),G(()=>{u(B=>(B+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ce[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Oe(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var L=R(z(),1);var Pe=R(z(),1);var re=R(E(),1),Ue="#ffc580",We="#ffd9a8",Ie="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Pe.useState)(0),a=4;if(G(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Ie,children:e});let u=e.split("").map((c,B)=>{let S=n-a,v=Math.abs(B-S-a/2),d;return v<=a/2?d=Ue:v<=a?d=We:d=Ie,(0,re.jsx)(o,{color:d,children:c},B)});return(0,re.jsx)(o,{children:u})}var _=R(E(),1),ze={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=ze[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Xe={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function De(e){return Xe[e]??"\u25CF"}var q=R(E(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let B=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return B?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(v=>(0,q.jsx)(s,{marginLeft:2,children:l(v,`${S}-${v.childId??"p"}-${v.index}`)},`${S}-${v.childId??"p"}-${v.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var K=R(E(),1);function je({label:e,shimmer:t=!1}){return(0,K.jsxs)(s,{marginLeft:6,children:[(0,K.jsx)(te,{}),(0,K.jsx)(o,{children:" "}),t?(0,K.jsx)(oe,{text:e,active:!0}):(0,K.jsx)(o,{color:i.dim,children:e})]})}var Fe=R(z(),1);var me=R(E(),1);function Ye(e,t){let n=[];for(let l of e.split(`
3
3
  `)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function _e({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,Fe.useState)(!0);G(()=>c(v=>!v),500);let B=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=Ye(B,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((v,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:v.length?v:" "},d))})}var H=R(E(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(je,{label:e.label,shimmer:e.shimmer}):null,n?(0,H.jsx)(_e,{text:t??""}):null]})}var r=R(E(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function X(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Ae(e){let t=[];for(let n of e)X(n)||(n.children&&n.children.length>0?t.push({...n,children:Ae(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function D({step:e,indent:t=2}){let n=e.actionType?De(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:B}=ee(),S=B?.columns??80,v=Math.max(20,S-t-21),d=e.objective??"",O=d.length>v?d.slice(0,v-1)+"\u2026":d,P=(e.duration??0)*1e3,T=e.duration!=null?P<1e3?`${Math.round(P)}ms`:`${(P/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:O,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:O}):c?(0,r.jsx)(o,{color:i.dim,children:O}):(0,r.jsx)(o,{color:i.dim,children:O})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:T})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((k,m)=>(0,r.jsx)(D,{step:k,indent:t+2},`child-${m}`))})]})}function Je(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(D,{step:e.step})})}function Me({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:B,describeVisible:S,describeRevealing:v}){let d=(0,L.useRef)(new Set),O=(0,L.useRef)(!1),P=(0,L.useRef)(new Set),T=(0,L.useRef)(!1),k=(0,L.useRef)(new Set),m=(0,L.useRef)(0);(0,L.useEffect)(()=>{e.length===0&&m.current>0&&(d.current.clear(),O.current=!1,P.current.clear(),T.current=!1,k.current.clear()),m.current=e.length},[e.length]);let b=e.flatMap(p=>[p,...p.children??[]]),C=b.some(p=>p.status==="running"),A=b.some(p=>p.status==="failed"),W=b.length===0||b.every(p=>p.status==="pending"),Y=b.filter(p=>p.status==="passed"||p.status==="failed").length,N;W?N="starting":C?N="running":A?N="failed":N="passed";let J=(0,L.useRef)(null),[ce,he]=(0,L.useState)(0);(0,L.useEffect)(()=>{b.length===0||W?(J.current=null,he(0)):C&&J.current==null&&(J.current=Date.now())},[C,W,b.length]),(0,L.useEffect)(()=>{if(!C)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[C]);let ae=(0,L.useRef)(new Set),[,xe]=(0,L.useState)(0),be=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let h of e)(h.status==="passed"||h.status==="failed")&&!ae.current.has(h.index)&&(ae.current.add(h.index),p.push({key:`step_${h.index}`,type:"step",step:{...h,children:h.children?[...h.children]:void 0}}));if(p.length>0){for(let h of p)c(Je(h));xe(h=>h+1)}},[e,t,l,u,c]),(0,L.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!T.current&&l&&l[0]!=null&&(T.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!O.current&&(O.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let h=e.flatMap((x,f)=>{let g=x.children??[];return!P.current.has(f)&&g.length>0&&(P.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!k.current.has(f)&&(k.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&P.current.has(f)&&!k.current.has(f)&&(k.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),g});for(let x of h){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:{...x,children:void 0}})})));for(let y of x.children??[]){let $=`child-${x.childId??"p"}-${x.index}-${y.childId??"p"}-${y.index}-${y.objective}`;d.current.has($)||(y.status==="passed"||y.status==="failed"||y.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(D,{step:y})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:x})})))}}else for(let h of e){let x=`${h.index}-${h.objective}`,f=!!h.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:{...h,children:void 0}})})));for(let g of h.children??[]){let y=`child-${h.index}-${g.childId??"p"}-${g.index}-${g.objective}`;d.current.has(y)||(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(y),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(D,{step:g})})))}!f&&!d.current.has(x)&&(h.status==="passed"||h.status==="failed"||h.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:{...h,children:void 0}})})))}d.current.size>p&&xe(h=>h+1)},[e,c,t,n,l]);let V=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||V.push(p);else if(c&&!u)if(t)for(let p of e){let h=p.children??[],x=[];for(let f of h){let g=`${f.childId??"p"}-${f.index}-${f.objective}`,y=d.current.has(g);if(f.branchObjective){let $=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!y||$.length>0)&&x.push({...f,children:$})}else y||x.push(f)}x.length>0&&V.push({...p,children:x})}else for(let p of e){let h=`${p.index}-${p.objective}`,x=d.current.has(h),f=(p.children??[]).filter(g=>{let y=`child-${p.index}-${g.childId??"p"}-${g.index}-${g.objective}`;return!d.current.has(y)});x?f.length>0&&V.push({...p,children:f}):V.push({...p,children:f})}if(!u){let p=c?V:e,h=le(p),x=ge(h,v);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((g,y)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:y>0?1:0,children:g.children&&g.children.length>0?g.children.map($=>{if(X($))return null;let Q=!!$.branchObjective,ue=`${$.childId??"p"}-${$.index}-${$.objective}`,He=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!He&&(0,r.jsx)(D,{step:{...$,children:void 0}}),($.children??[]).filter(Z=>!X(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:Z})},`f${y}-${$.index}-${Z.childId??"p"}-${Z.index}`))]},`f${y}-host-${$.childId??"p"}-${$.index}`):(0,r.jsx)(D,{step:$},`f${y}-${$.childId??"p"}-${$.index}`)}):g.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},y))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(g,y)=>X(g)?null:(0,r.jsx)(D,{step:g},y)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(g=>!(g.status==="running"&&(!g.children||g.children.length===0))).map(g=>{let y=`${g.index}-${g.objective}`;return c&&d.current.has(y)?(0,r.jsx)(s,{flexDirection:"column",children:(g.children??[]).filter($=>!X($)).map($=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(D,{step:$})},`${$.childId??"p"}-${$.index}`))},`branch-children-${g.index}`):(0,r.jsx)(D,{step:g},g.index)})]}),(0,r.jsx)(se,{activity:x,describe:B,describeVisible:S}),b.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),h=ge(p,v);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>X(x)?null:(0,r.jsx)(D,{step:x},f)}),(0,r.jsx)(se,{activity:h,describe:B,describeVisible:S}),b.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ge=le(V),Ke=ge(Ge,v),Re=Ae(V);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(D,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ke,describe:B,describeVisible:S}),b.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var U=R(E(),1);function qe({runner:e,runKey:t,onStepCommit:n}){let l=Oe({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,U.jsxs)(U.Fragment,{children:[l&&(0,U.jsx)(Le,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,U.jsx)(Me,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var j=R(E(),1),Qe=64;function Ze(e){return e.split(`
4
4
  `).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function Ne({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:B}){let S=e==="passed",v=S?i.green:i.red,d=S?"\u2713":"\u2717",O=e.toUpperCase(),P=a??(S?l:Math.max(0,l-1)),T=u??(S?0:1),k=T>0?`${l} steps (${P} passed, ${T} failed)`:`${l} steps`,m=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,b=Ze(t);return(0,j.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,j.jsxs)(s,{borderStyle:"round",borderColor:v,flexDirection:"column",paddingX:2,paddingY:1,width:Qe+6,children:[(0,j.jsxs)(s,{flexDirection:"column",children:[(0,j.jsxs)(o,{bold:!0,color:v,children:[d," ",O]}),(0,j.jsxs)(o,{color:i.dim,wrap:"wrap",children:[k," \xB7 ",m,typeof B=="number"&&B>0?` \xB7 ${parseFloat(B.toFixed(4))} credits`:""]})]}),b.length>0&&(0,j.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:b.map((C,A)=>(0,j.jsxs)(s,{marginBottom:A<b.length-1?1:0,children:[(0,j.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,j.jsx)(s,{flexShrink:1,children:(0,j.jsx)(o,{wrap:"wrap",children:C})})]},A))}),c&&!S&&(0,j.jsx)(s,{marginTop:1,children:(0,j.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var F=R(E(),1);function Ve({message:e,code:t,remediation:n,docsUrl:l}){return(0,F.jsx)(Te,{title:"Error",variant:"error",children:(0,F.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,F.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,F.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,F.jsx)(o,{color:i.muted,children:"Code: "}),(0,F.jsx)(o,{color:i.dim,children:t})]}),n&&(0,F.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,F.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,F.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,F.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,F.jsx)(o,{color:i.muted,children:"Docs: "}),(0,F.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var w=R(E(),1),et=1e4;function gn(e){let{exit:t}=ve(),{append:n}=ye(),l=(0,M.useRef)(!1);(0,M.useEffect)(()=>{l.current||(l.current=!0,n((0,w.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,w.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,w.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,w.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,w.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,w.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,w.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,w.jsx)(tt,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,w.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,M.useRef)(null),u=(0,M.useCallback)(async T=>{let k=await e.getNextStep(T);return k?(a.current=k,k.config):(a.current=null,null)},[e]),c=(0,M.useCallback)((T,k)=>{let m=a.current;if(!m)return;let b=m.mode==="replay"?"cyan":"#dc4e08",C=m.modeReason?` (${m.modeReason})`:"",A=m.perStepOverrides?Object.entries(m.perStepOverrides):[];n((0,w.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,w.jsxs)(o,{children:[(0,w.jsxs)(o,{color:i.dim,children:[m.banner.stepLabel," "]}),(0,w.jsxs)(o,{color:b,children:["[",m.mode,"]"]}),(0,w.jsx)(o,{color:i.dim,children:C})]}),(0,w.jsx)(o,{color:i.dim,children:m.banner.objective}),A.length>0&&(0,w.jsxs)(o,{color:i.dim,children:["overrides: ",A.map(([W,Y])=>`${W}=${Y}`).join(", ")]})]}))},[n]),B=(0,M.useRef)(0),S=(0,M.useRef)(!1),v=(0,M.useCallback)((T,k)=>(T.hadError?n((0,w.jsx)(Ve,{message:T.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,w.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,w.jsx)(Ne,{status:T.status,summary:T.runEnd?.summary??"",duration:T.runEnd?.duration??0,steps:T.stepsTotal,stepsPassed:T.stepsPassed,stepsFailed:T.stepsFailed,reason:T.runEnd?.reason,creditsConsumed:T.runEnd?.credits_consumed})})),e.onStepEnd?.(T,k)??!0),[n,e]),d=ke({getNextConfig:u,onStepStart:c,onStepEnd:v,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts,...e.reportVerdictOnComplete?{reportVerdictOnComplete:!0}:{},...e.runVerdict?{runVerdict:e.runVerdict}:{}}),O=250,P=5e3;return Se((T,k)=>{if(k.ctrl&&T==="c"){let m=Date.now(),b=m-B.current;if(b<O)return;if(S.current&&b<P){d.cancel(),e.onCancel?.();let C=e.reportVerdictOnComplete?d.runner.shutdownRunner(we,{timeoutMs:et}):Promise.resolve();e.exitOnComplete!==!1&&C.then(()=>setImmediate(()=>t()))}else S.current=!0,n((0,w.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}));B.current=m}}),(0,w.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,w.jsx)(qe,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function tt({data:e}){return(0,w.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{Me as a,Le as b,Oe as c,de as d,Ne as e,Ve as f,gn as g};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b,c as R}from"./chunk-72KYMWQ5.js";import{a as y}from"./chunk-TDPWFYTJ.js";import{b as v}from"./chunk-34R7BNZ2.js";import{c as S}from"./chunk-VZ7KXRXB.js";import{a as f}from"./chunk-RZ4F3BHX.js";import{b as _}from"./chunk-I6OQISK4.js";import{randomUUID as U}from"crypto";import{mkdirSync as P,writeFileSync as g,appendFileSync as G,existsSync as h,readFileSync as B}from"fs";import{join as d}from"path";import{writeFileSync as E,mkdirSync as A,existsSync as L}from"fs";import{join as c,relative as j}from"path";function I(r){let t=Object.keys(r.frontmatter).length>0?S(r.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${r.heading}`,""),r.steps.forEach((n,o)=>{s.push(`## Step ${o+1}`,n,"")}),s.join(`
2
+ import{b,c as R}from"./chunk-72KYMWQ5.js";import{a as y}from"./chunk-TDPWFYTJ.js";import{b as v}from"./chunk-34R7BNZ2.js";import{c as S}from"./chunk-VZ7KXRXB.js";import{a as f}from"./chunk-RZ4F3BHX.js";import{b as _}from"./chunk-D36V5OX6.js";import{randomUUID as U}from"crypto";import{mkdirSync as P,writeFileSync as g,appendFileSync as G,existsSync as h,readFileSync as B}from"fs";import{join as d}from"path";import{writeFileSync as E,mkdirSync as A,existsSync as L}from"fs";import{join as c,relative as j}from"path";function I(r){let t=Object.keys(r.frontmatter).length>0?S(r.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${r.heading}`,""),r.steps.forEach((n,o)=>{s.push(`## Step ${o+1}`,n,"")}),s.join(`
3
3
  `)}var T=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),D=new Set(["model","env"]),u=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=c(this.opts.cwd,".testmuai","tests");try{A(t,{recursive:!0})}catch(a){process.stderr.write(`
4
4
  \u26A0 Failed to create ${j(this.opts.cwd,t)}/
5
5
  ${a.message}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as m,j as g}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{y as u}from"./chunk-I6OQISK4.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(a,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(a,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(m,{color:u.orange,children:[t.label,":"]}),(0,r.jsx)(m,{color:u.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
2
+ import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as m,j as g}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{y as u}from"./chunk-D36V5OX6.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(a,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(a,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(m,{color:u.orange,children:[t.label,":"]}),(0,r.jsx)(m,{color:u.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as n}from"./chunk-XBEYWXPV.js";import{x as s}from"./chunk-I6OQISK4.js";function E(t="prod",r=process.env){let e=s[t];return t!=="stage"?e:{authBaseUrl:r.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:r.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:r.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:r.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:r.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:r.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:r.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:r.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:r.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:r.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl,mediaArtefactsHost:r.KANE_STAGE_MEDIA_ARTEFACTS_HOST??e.mediaArtefactsHost,mobileAppBaseUrl:r.KANE_STAGE_MOBILE_APP_URL??e.mobileAppBaseUrl,mobileHubUrl:r.KANE_STAGE_MOBILE_HUB_URL??e.mobileHubUrl,lrmaaBaseUrl:r.KANE_STAGE_LRMAA_URL??e.lrmaaBaseUrl,latticeBaseUrl:r.KANE_LATTICE_URL??e.latticeBaseUrl,deviceStreamUrl:r.KANE_STAGE_DEVICE_STREAM_URL??e.deviceStreamUrl}}function U(){let t=process.env.TESTMUAI_ENV;return t!==void 0&&t!==""?t==="stage"?"stage":"prod":new n().getDefaultEnv()==="stage"?"stage":"prod"}function a(){let t=process.env.KANE_LATTICE_URL;return t!==void 0&&t.trim()===""?"":E(U()).latticeBaseUrl.trim()}export{E as a,U as b,a as c};
2
+ import{a as n}from"./chunk-HJMCXSUJ.js";import{x as s}from"./chunk-D36V5OX6.js";function E(t="prod",r=process.env){let e=s[t];return t!=="stage"?e:{authBaseUrl:r.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:r.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:r.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:r.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:r.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:r.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:r.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:r.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:r.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:r.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl,mediaArtefactsHost:r.KANE_STAGE_MEDIA_ARTEFACTS_HOST??e.mediaArtefactsHost,mobileAppBaseUrl:r.KANE_STAGE_MOBILE_APP_URL??e.mobileAppBaseUrl,mobileHubUrl:r.KANE_STAGE_MOBILE_HUB_URL??e.mobileHubUrl,lrmaaBaseUrl:r.KANE_STAGE_LRMAA_URL??e.lrmaaBaseUrl,latticeBaseUrl:r.KANE_LATTICE_URL??e.latticeBaseUrl,deviceStreamUrl:r.KANE_STAGE_DEVICE_STREAM_URL??e.deviceStreamUrl}}function U(){let t=process.env.TESTMUAI_ENV;return t!==void 0&&t!==""?t==="stage"?"stage":"prod":new n().getDefaultEnv()==="stage"?"stage":"prod"}function a(){let t=process.env.KANE_LATTICE_URL;return t!==void 0&&t.trim()===""?"":E(U()).latticeBaseUrl.trim()}export{E as a,U as b,a 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-NQTYWHPB.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-I6OQISK4.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-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};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ne,b as te,c as re,d as ie,e as z}from"./chunk-I2KOGINW.js";import{b as se,c as oe}from"./chunk-IINZZ4BZ.js";import{n as ee,p as j}from"./chunk-NC7D7GOM.js";import{a as $e}from"./chunk-6YGTRKDT.js";import{e as Te}from"./chunk-UR6MHSHU.js";function Oe(r){let e=r==="passed"?"passed":"failed";return{testStatus:e,remark:`kane-cli: ${e}`}}var Le={testStatus:"failed",remark:"cancelled"};var Ae="https://www.testmuai.com/pricing/",De=/Real Mobile App Automation not allowed on your current plan/i,L=class extends Error{code="plan_required";constructor(e){super(e),this.name="RealDevicePlanError"}};function ae(r){return!r||!De.test(r)?null:["Real devices aren't included in your TestMu AI plan.","Running on a real device needs the KaneAI Max or Real Device Plus Automation Cloud plan.",`See plans: ${Ae}`].join(`
2
+ import{a as ne,b as te,c as re,d as ie,e as z}from"./chunk-WXJCJL5L.js";import{b as se,c as oe}from"./chunk-IINZZ4BZ.js";import{n as ee,p as j}from"./chunk-NC7D7GOM.js";import{a as $e}from"./chunk-6YGTRKDT.js";import{e as Te}from"./chunk-UR6MHSHU.js";function Oe(r){let e=r==="passed"?"passed":"failed";return{testStatus:e,remark:`kane-cli: ${e}`}}var Le={testStatus:"failed",remark:"cancelled"};var Ae="https://www.testmuai.com/pricing/",De=/Real Mobile App Automation not allowed on your current plan/i,L=class extends Error{code="plan_required";constructor(e){super(e),this.name="RealDevicePlanError"}};function ae(r){return!r||!De.test(r)?null:["Real devices aren't included in your TestMu AI plan.","Running on a real device needs the KaneAI Max or Real Device Plus Automation Cloud plan.",`See plans: ${Ae}`].join(`
3
3
  `)}function ue(r){return{command:"start",...r}}function de(r,e,s){return{command:"run",run_id:r,kind:e,...s}}function le(r){return{command:"cancel",...r?{run_id:r}:{}}}function ce(r){return{command:"ask_user_response",answer:r}}function pe(r={}){return{command:"shutdown",...r.testStatus?{test_status:r.testStatus,remark:r.remark??""}:{}}}var W=Symbol("run-queue-end"),J=class{items=[];waiting=null;ended=!1;error=null;push(e){if(this.waiting){let{resolve:s}=this.waiting;this.waiting=null,s(e)}else this.items.push(e)}end(){if(this.ended=!0,this.waiting){let{resolve:e}=this.waiting;this.waiting=null,e(W)}}fail(e){if(this.error=e,this.waiting){let{reject:s}=this.waiting;this.waiting=null,s(e)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(W):new Promise((e,s)=>{this.waiting={resolve:e,reject:s}})}},F=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;onEvent;exited;constructor(e){this.env=e.env,this.runner=e.runner,this.log=e.log,this.sessionId=e.sessionId,this.spawnFn=e.spawn??te,this.onEvent=e.onEvent;let s;this.exited=new Promise(d=>{s=d}),this.exitResolve=s}async start(e){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let s=new Promise((d,g)=>{this.pendingReady={resolve:d,reject:g}});this.writeCommand(ue(e)),await s}async*run(e,s,d){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${e}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new J,_={runId:e,queue:g};this.activeRun=_,this.writeCommand(de(e,s,d));try{for(;;){let v=await g.next();if(v===W||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===e)))break}}finally{this.activeRun===_&&(this.activeRun=null)}}sendUserResponse(e){this.writeCommand(ce(e))}cancel(e){this.writeCommand(le(e))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(e={}){this.shuttingDown=!0,this.proc&&(this.writeCommand(pe(e)),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(e){let s=JSON.stringify(e)+`
4
4
  `;try{this.proc?.child.stdin?.write(s)}catch{}}async consume(){if(!this.proc)return;try{for await(let d of this.proc.events){if(d.type==="ready"){this.onReady();continue}if(d.type==="error"&&this.pendingReady){this.onStartError(d.message);continue}try{this.onEvent?.(d)}catch{}this.routeEvent(d)}}catch(d){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:d instanceof Error?d.message:String(d)})}let{code:e,signal:s}=await this.proc.exited;this.onExit(e,s)}onReady(){if(this.pendingReady){let{resolve:e}=this.pendingReady;this.pendingReady=null,e()}}onStartError(e){if(!this.pendingReady)return;let{reject:s}=this.pendingReady;this.pendingReady=null;let d=ae(e);if(d){this.log?.("error","REAL_DEVICE_PLAN_REQUIRED","The mobile hub refused the session over the plan",{reason:e}),s(new L(d));return}s(new Error(`failed to start: ${e??"unknown error"}`))}routeEvent(e){let s=this.activeRun;if(!s){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:e.type});return}s.queue.push(e)}onExit(e,s){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:e,signal:s},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:e,signal:s}),this.pendingReady){let{reject:d}=this.pendingReady;this.pendingReady=null,d(new Error(`v16-runner exited before ready (code=${e}, signal=${s??"none"})`))}if(this.activeRun){let{queue:d}=this.activeRun;if(this.activeRun=null,this.shuttingDown)d.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";d.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${e}, signal=${s??"none"})${g?`
5
5
  ${g}`:""}`))}}}}};var p=Te($e(),1);function he(r){let e={cdp_endpoint:r.cdp_endpoint,ws_endpoint:r.ws_endpoint,width:r.width,height:r.height,headless:r.headless,model:r.model,max_steps:r.max_steps,network_ws:r.network_ws,network_sse:r.network_sse,session_id:r.session_id};return r.device&&(e.device=r.device),r.auth&&(e.auth=r.auth),r.project_id&&(e.project_id=r.project_id),r.disable_ask_user&&(e.disable_ask_user=!0),r.media_upload&&(e.media_upload=r.media_upload),r.username&&(e.username=r.username),r.access_key&&(e.access_key=r.access_key),e}function N(r,e){let s=null,d=(g,_)=>{for(let v=0;v<g.length;v++){let E=g[v],h=[..._,v];e(E)&&(s===null||h.length>s.length)&&(s=h),E.children&&E.children.length>0&&d(E.children,h)}};return d(r,[]),s}function T(r,e,s){if(e.length===0)return[...r];let d=e[0],g=[...r],_=g[d];if(e.length===1)g[d]=s(_);else{let v=e.slice(1),E=T(_.children??[],v,s);g[d]={..._,children:E}}return g}var Ue=6e4;function fe(){return{steps:[],maxOrdinal:0}}function Me(r,e){if(e.type==="run_start"&&e.child_id)return e.environment?.resolution?{...r,resolution:e.environment.resolution}:r;if(e.type==="run_start"){let s=oe(r.runnerEnvironment,se(e.environment));if(s)return{...r,runnerEnvironment:s,...s.resolution?{resolution:s.resolution}:{}}}if(e.type==="step_end"&&typeof e.ordinal=="number"&&e.id){let s={id:e.id,ordinal:e.ordinal,status:e.status,...e.kind?{kind:e.kind}:{},...typeof e.duration=="number"?{duration_ms:Math.round(e.duration*1e3)}:{},...typeof e.action_id=="string"&&e.action_id?{action_id:e.action_id}:{}};return{...r,steps:[...r.steps,s],maxOrdinal:Math.max(r.maxOrdinal,e.ordinal)}}return r}function H(r){let e=r.indexOf(": ");return e>0&&e<15?r.slice(e+2):r}function Q(r){return r.map(e=>{let s=e.children?Q(e.children):e.children;return e.status==="running"?{...e,status:"stopped",phase:void 0,children:s}:s!==e.children?{...e,children:s}:e})}function nn(r,e,s,d,g){let[_,v]=(0,p.useState)(!1),[E,h]=(0,p.useState)([]),[me,$]=(0,p.useState)(null),[ve,B]=(0,p.useState)(null),[ge,C]=(0,p.useState)(null),[Re,X]=(0,p.useState)(null),[Se,Y]=(0,p.useState)([]),[ye,Z]=(0,p.useState)(null),[we,xe]=(0,p.useState)(void 0),[_e,A]=(0,p.useState)(0),x=(0,p.useRef)(null),D=(0,p.useRef)(null),k=(0,p.useRef)(null),w=(0,p.useRef)(null),b=(0,p.useRef)(0),V=(0,p.useRef)(!1),U=(0,p.useRef)(fe()),M=(0,p.useRef)(null),Ee=(0,p.useCallback)(async(f,S)=>{let I=M.current;if(I)try{await I}catch{}h([]),$(null),B(null),C(null),X(null),Y([]),Z(null),xe(f.max_steps),v(!0),w.current=null,b.current=0,U.current=fe();let y=x.current;if(y&&k.current!==f.session_id){try{y.kill()}catch{}x.current=null,k.current=null,A(n=>n+1),y=null}if(!y){let n=ne();if(!n){C("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let l=ie({environment:S?.environment,mode:S?.mode,assertionMode:S?.assertionMode,finalValidation:S?.finalValidation,username:f.username,accessKey:f.access_key,sessionId:f.session_id});f.device?.platform&&await re(l,f.device);let u=new F({env:l,runner:n,log:S?.log,sessionId:f.session_id,...S?.onRunnerEvent?{onEvent:S.onRunnerEvent}:{}});x.current=u,k.current=f.session_id,y=u,ee("runner",()=>{try{u.kill()}catch{}});let o={...f};z(o,{environment:S?.environment});let a=he(o);try{await u.start(a)}catch(t){C(t instanceof Error?t.message:String(t)),v(!1),j("runner","Runner start failed"),x.current=null,k.current=null,A(i=>i+1);return}}let q={...f};delete q.run_id,z(q,{environment:S?.environment});let je=`run-${f.run_index}`,Ne=f.mode==="replay"?"replay":"author",G=y,K=(async()=>{V.current=!1;for await(let n of G.run(je,Ne,q)){if(V.current)break;switch(U.current=Me(U.current,n),n.type){case"run_start":if(n.child_id)break;if(w.current&&!w.current.isSingleFlow){let l=b.current;b.current++,h(u=>u.map((o,a)=>a===l?{...o,status:"running"}:o.status==="running"&&!o.children?.some(t=>t.status==="running")?{...o,status:o.children?.some(t=>t.status==="failed")?"failed":"passed"}:o))}break;case"bifurcation":{let l=n.flows??[],u=n.count??l.length,o={flows:l,isSingleFlow:n.is_single_flow??u<=1};X(o),w.current=o,b.current=0,h(l.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{e?.("STEP_START",`Step ${n.index} started`,{index:n.index,objective:n.objective,child_id:n.child_id});let l=n.index,u=n.objective??`Step ${l}`,o=n.child_id,a=w.current&&!w.current.isSingleFlow;if(o)h(t=>{let i=N(t,c=>c.branchChildId===o)??N(t,c=>c.status==="running");return i?T(t,i,c=>{let m=(c.children??[]).map(R=>R.status==="running"&&R.childId===o?{...R,status:"stopped",phase:void 0}:R);return m.push({index:l,objective:u,status:"running",childId:o}),{...c,children:m}}):t});else if(a){let t=Math.max(0,b.current-1);h(i=>{let c=[...i];if(t>=c.length)return i;let m={...c[t]},P=[...m.children??[]].map(O=>O.status==="running"&&O.childId===void 0?{...O,status:"stopped",phase:void 0}:O);return P.push({index:l,objective:u,status:"running"}),m.children=P,m.status="running",c[t]=m,c})}else h(t=>{let i=Q(t);return i.some(m=>m.index===l)?i.map(m=>m.index===l?{...m,status:"running",objective:u}:m):[...i,{index:l,objective:u,status:"running"}]});break}case"step_event":{e?.("STEP_EVENT",`Step ${n.index} ${n.event}`,{index:n.index,phase:n.event,action_type:n.action_type,detail:n.detail,child_id:n.child_id});let l=n.child_id,u=w.current&&!w.current.isSingleFlow;if(n.event==="cm_init"&&n.checkpoint_count!=null){Y(o=>[...o,n.checkpoint_count]);break}if(n.event==="replay_started"){Z({recordingLength:n.recording_length??0});break}if(n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&s?.(n.detail),l){let o=t=>{if(t.index!==n.index||t.childId!==l)return t;let i={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(i.objective=n.detail),n.action_type&&(i.actionType=n.action_type),{...t,...i}},a=t=>t.map(i=>{let c=o(i);return c!==i?c:i.children&&i.children.length>0?{...i,children:a(i.children)}:i});h(t=>t.map(i=>i.children?{...i,children:a(i.children)}:i))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let i={...t[o]},c=[...i.children??[]];if(!c.some(R=>R.index===n.index&&R.childId===void 0))c.push({index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type});else for(let R=0;R<c.length;R++){if(c[R].index!==n.index||c[R].childId!==void 0)continue;let P={phase:n.event};n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(P.objective=n.detail),n.action_type&&(P.actionType=n.action_type),c[R]={...c[R],...P}}return i.children=c,t[o]=i,t})}else h(o=>o.some(t=>t.index===n.index)?o.map(t=>{if(t.index!==n.index)return t;let i={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(i.objective=n.detail),n.action_type&&(i.actionType=n.action_type),{...t,...i}}):[...Q(o),{index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type}]);break}case"step_end":{e?.("STEP_END",`Step ${n.index} ${n.status}`,{index:n.index,status:n.status,duration:n.duration,summary:n.summary,child_id:n.child_id}),d?.();let l=n.child_id,u=w.current&&!w.current.isSingleFlow;if(l){let o=t=>t.index===n.index&&t.childId===l?{...t,status:n.status,duration:n.duration,phase:void 0,objective:t.objective.startsWith("Step ")?H(n.summary||t.objective):t.objective}:t,a=t=>t.map(i=>{let c=o(i);return c!==i?c:i.children&&i.children.length>0?{...i,children:a(i.children)}:i});h(t=>t.map(i=>i.children?{...i,children:a(i.children)}:i))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let i={...t[o]},c=(i.children??[]).map(m=>m.index===n.index&&m.childId===void 0?{...m,status:n.status,duration:n.duration,phase:void 0,objective:m.objective.startsWith("Step ")?H(n.summary||m.objective):m.objective}:m);return i.children=c,t[o]=i,t})}else h(o=>o.map(a=>a.index===n.index?{...a,status:n.status,duration:n.duration,phase:void 0,objective:a.objective.startsWith("Step ")?H(n.summary||a.objective):a.objective}:a));{let a=w.current&&!w.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof n.ordinal=="number"&&n.id?{ordinal:n.ordinal,id:n.id}:void 0;r?.(n.index,a,n.child_id,t)}break}case"child_agent_start":{let l=n.objective??"",u=n.child_id;h(o=>{let a=N(o,t=>t.status==="running");return a?T(o,a,t=>({...t,objective:`${l} (branch)`,phase:`child: ${l.slice(0,50)}`,branchObjective:l,branchChildId:u})):o});break}case"child_agent_end":{let l=n.child_id,u=`child ${n.success?"done":"failed"}`;h(o=>{let a=N(o,t=>t.branchChildId===l);return a?T(o,a,t=>({...t,phase:u})):o.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(n);break;case"ask_user":$(n.question??"");break;case"run_end":h(l=>l.map(u=>u.status==="running"?{...u,status:n.status,phase:void 0}:u)),v(!1),B(n);break;case"error":v(!1),C(n.message??"Runner error"),h(l=>l.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(n=>{if(x.current!==G)return;let u=[n instanceof Error?n.message:String(n)],o=G.stderr;o&&!u.join(`
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as c}from"./chunk-5D7ENQTQ.js";import{a as w}from"./chunk-2XW33VOK.js";import{d as h,h as g}from"./chunk-A7RJQJNT.js";import{c as b,j as v}from"./chunk-I6OQISK4.js";import{readFileSync as C,writeFileSync as k,mkdirSync as x,existsSync as T}from"fs";import{dirname as S}from"path";var f={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:v,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",assertion_failure_mode:"stop",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},I=f;function E(r){let{mobile:e,...o}=r,t={...o};delete t.target,delete t.device,delete t.device_name,delete t.os_version,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let s=n.default_target?.name?.trim(),l=n.default_target?.os_version?.trim();if(s||l)s&&(t.device_name=s),l&&(t.os_version=l);else{let i=n.default_target?.id?.trim();i&&(t.device=i)}n.default_app&&(t.app=n.default_app);let a={};n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url);for(let i of c)n[i]!==void 0&&(a[i]=n[i]);return Object.keys(a).length>0&&(t.mobile=a),t}function R(r){let e=r.mobile??{},o=typeof r.target=="string"?r.target:void 0,t=typeof r.device=="string"&&r.device.trim()!==""?r.device.trim():void 0,n=d=>typeof d=="string"&&d.trim()!==""?d.trim():void 0,s=n(r.device_name),l=n(r.os_version),a=typeof r.app=="string"&&r.app!==""?r.app:void 0,i={},_=o??e.tui_target;_&&(i.tui_target=_);let p=w(_,void 0).kind,u=h(p)?p:null;u&&(s||l)?i.default_target={platform:g(u),kind:u,...s?{name:s}:{},...l?{os_version:l}:{}}:u&&t?i.default_target={platform:g(u),kind:u,id:t}:(e.default_target?.id?.trim()||e.default_target?.name?.trim())&&(i.default_target=e.default_target);let m=a??e.default_app;m&&(i.default_app=m),e.no_reset!==void 0&&(i.no_reset=e.no_reset),e.appium_url!==void 0&&(i.appium_url=e.appium_url);for(let d of c)e[d]!==void 0&&(i[d]=e[d]);return Object.keys(i).length>0?i:void 0}var y=class{constructor(e=b){this.path=e}exists(){return T(this.path)}load(){try{let e=C(this.path,"utf-8"),o=JSON.parse(e),t=R(o),{target:n,device:s,app:l,...a}=o;return{...f,...a,...t?{mobile:t}:{},code_export:{...f.code_export,...o.code_export??{}},generate:{...f.generate,...o.generate??{}}}}catch{return{...f,code_export:{...f.code_export},generate:{...f.generate}}}}write(e){try{x(S(this.path),{recursive:!0}),k(this.path,JSON.stringify(E(e),null,2)+`
2
+ import{b as c}from"./chunk-5D7ENQTQ.js";import{a as w}from"./chunk-2XW33VOK.js";import{d as h,h as g}from"./chunk-A7RJQJNT.js";import{c as b,j as v}from"./chunk-D36V5OX6.js";import{readFileSync as C,writeFileSync as k,mkdirSync as x,existsSync as T}from"fs";import{dirname as S}from"path";var f={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:v,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",assertion_failure_mode:"stop",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},I=f;function E(r){let{mobile:e,...o}=r,t={...o};delete t.target,delete t.device,delete t.device_name,delete t.os_version,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let s=n.default_target?.name?.trim(),l=n.default_target?.os_version?.trim();if(s||l)s&&(t.device_name=s),l&&(t.os_version=l);else{let i=n.default_target?.id?.trim();i&&(t.device=i)}n.default_app&&(t.app=n.default_app);let a={};n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url);for(let i of c)n[i]!==void 0&&(a[i]=n[i]);return Object.keys(a).length>0&&(t.mobile=a),t}function R(r){let e=r.mobile??{},o=typeof r.target=="string"?r.target:void 0,t=typeof r.device=="string"&&r.device.trim()!==""?r.device.trim():void 0,n=d=>typeof d=="string"&&d.trim()!==""?d.trim():void 0,s=n(r.device_name),l=n(r.os_version),a=typeof r.app=="string"&&r.app!==""?r.app:void 0,i={},_=o??e.tui_target;_&&(i.tui_target=_);let p=w(_,void 0).kind,u=h(p)?p:null;u&&(s||l)?i.default_target={platform:g(u),kind:u,...s?{name:s}:{},...l?{os_version:l}:{}}:u&&t?i.default_target={platform:g(u),kind:u,id:t}:(e.default_target?.id?.trim()||e.default_target?.name?.trim())&&(i.default_target=e.default_target);let m=a??e.default_app;m&&(i.default_app=m),e.no_reset!==void 0&&(i.no_reset=e.no_reset),e.appium_url!==void 0&&(i.appium_url=e.appium_url);for(let d of c)e[d]!==void 0&&(i[d]=e[d]);return Object.keys(i).length>0?i:void 0}var y=class{constructor(e=b){this.path=e}exists(){return T(this.path)}load(){try{let e=C(this.path,"utf-8"),o=JSON.parse(e),t=R(o),{target:n,device:s,app:l,...a}=o;return{...f,...a,...t?{mobile:t}:{},code_export:{...f.code_export,...o.code_export??{}},generate:{...f.generate,...o.generate??{}}}}catch{return{...f,code_export:{...f.code_export},generate:{...f.generate}}}}write(e){try{x(S(this.path),{recursive:!0}),k(this.path,JSON.stringify(E(e),null,2)+`
3
3
  `)}catch(o){let t=o instanceof Error?o.message:String(o);process.stderr.write(`[config] Failed to save config: ${t}
4
4
  `)}}set(e,o){let t=this.load();t[e]=o,this.write(t)}save(e){this.write({...this.load(),...e})}getMobile(){return this.load().mobile??{}}setMobile(e){let o={...this.getMobile()};for(let t of Object.keys(e)){let n=e[t];n===void 0?delete o[t]:o[t]=n}this.set("mobile",Object.keys(o).length>0?o:void 0)}writeRaw(e){this.write(e)}};export{I as a,y as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as B}from"./chunk-XJ7HCXKW.js";import{b as N,f as d}from"./chunk-QTZBVDPR.js";import{a as g,b as E}from"./chunk-NLZZLANH.js";import{e as y,f as _}from"./chunk-NWD54VV5.js";import{d as C,e as O,i as x}from"./chunk-XMPTFXPW.js";import{b as F,f as U,g as v}from"./chunk-L4UVUFL6.js";import{C as h,Ha as c,f as R,r as P,w as S}from"./chunk-W3OVSDBN.js";import{a as w}from"./chunk-I2MC6VVX.js";async function I(e,r){let o=await r.project(e);return o===null?"no_access":o.marked?"marked":"unmarked"}var M=5e3;async function D(e,r=()=>!0){try{for(;;){if(!r())return{found:!1,failed:!0};let o=await e.next();if(o.done)return{found:!1};if(o.value.length>0)return{found:!0,rows:o.value}}}catch{return{found:!1,failed:!0}}}async function j(e,r={}){let o=await L(e,r.budgetMs??M);return o.state==="unknown"&&G(`shared projects weren't checked, so this folder goes on locally: ${o.reason}`),o}async function L(e,r){let o;try{o=await y()}catch(a){return a instanceof x?{state:"unknown",reason:"not signed in",signedOut:!0}:{state:"unknown",reason:"the credentials couldn't be read"}}let t,n=!1,s=new Promise(a=>{t=setTimeout(()=>{n=!0,a({state:"unknown",reason:`the project list took over ${r} ms`})},r)}),l=(async()=>{let a=R({url:e,basicAuth:o}).projects(),i=await D(a,()=>!n);return i.found?{state:"rolled_out",first:{rows:i.rows,more:a}}:i.failed?{state:"unknown",reason:"the project list couldn't be read"}:{state:"not_rolled_out"}})();try{return await Promise.race([l,s])}finally{clearTimeout(t)}}var G=g("remote-check");var T=e=>({code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}});async function A(e,r=_(e.latticeUrl)){let o;try{o=await I(e.projectId,r)}catch(t){if(t instanceof x)return T(t);if(t instanceof w&&t.retryable)return c.noConnection();if(t instanceof w&&t.status===401)return c.credentialsRejected();throw t}return o==="no_access"?c.noAccess(e.projectName):null}function H(e,r,o,t){if(e instanceof w){if(e.code==="SESSION_CLASH"&&t!==void 0&&h(e.extra.heldBy)!==null)return{...c.projectBusy({project:r.projectName,verb:t.verb==="evolve"?"design":t.verb,resume:o!==null,held:h(e.extra.heldBy),...t.useCase?{useCase:t.useCase}:{},...t.title!==void 0?{title:t.title}:{},...t.agent?{agent:!0}:{}}),exit:2};if(e.code==="MARK_REFUSED")return{...c.markRefused(r.projectName,r.onboarded===!0),exit:2};if(e.code==="PROJECT_NOT_MARKED")return{...c.assuranceOff(r.projectName),exit:2};if(e.retryable)return{...c.noConnectionAtStart(),exit:2};if(e.status===401)return{...c.credentialsRejected(),exit:2};if(e.code==="SESSION_ENDED")return{...$(e,o??""),exit:2};if(e.code==="NOT_FOUND"&&o!==null)return{...c.noSuchSession(o),exit:2};if(e.code==="FORMS_REFUSED")return{...J(e.extra)?c.versionCliOlder():c.versionServiceOlder(),exit:2}}else if(e instanceof B)return{...e.side==="cli_older"?c.versionCliOlder():c.versionServiceOlder(),exit:2};return{...c.openFailed(),exit:1}}function $(e,r){return e.extra.ended==="failed"?c.sessionFailed(r):c.sessionFinished(r)}function J(e){let r=typeof e.claimed=="number"?e.claimed:null;return r===null?!1:typeof e.oldestRead=="number"&&r<e.oldestRead?!0:typeof e.highestWriter=="number"&&e.highestWriter>r}async function fe(e,r,o,t={}){P({verb:e,mode:r?"agent":"interactive"});let n=await K(e,r,o,t);return n!==null&&"exit"in n&&await S(),n}async function K(e,r,o,t){let n=F(process.cwd()),s=e.split(" ").at(-1);if(t.project!==void 0||t.local===!0){let i=await W(n,e,s,r,{...t,...o!==void 0?{resume:o}:{}});if(i!=="undecided")return i}if(n.kind==="refuse")return{exit:d(n.refusal,s,r)};let l=n;if(n.kind==="pick"){if(o===void 0){if(!N.has(e)||!(!r&&C()&&t.onboard!==!1))return null;let u=await j(n.latticeUrl);if(u.state==="unknown"&&u.signedOut&&e==="context ingest"){let{signIn:m}=await import("./onboarding-LGT6PMDZ.js");if(await m()!=="signed_in")return null;u=await j(n.latticeUrl)}if(u.state!=="rolled_out")return null;let{onboard:k}=await import("./onboarding-LGT6PMDZ.js"),p=e==="context extract"?"context extract":"context ingest",f=await k(n,{first:u.first,verb:p});return"exit"in f?f:"local"in f?p==="context extract"&&f.made?{exit:0}:null:{choice:f.choice}}if((await j(n.latticeUrl)).state!=="rolled_out")return null;try{l=await V(n,o,await y())}catch(i){return i instanceof x?{exit:d(T(i),s,r)}:{exit:d(H(i,{kind:"remote",latticeUrl:n.latticeUrl,projectId:"",projectName:""},o),s,r)}}}if(l.kind!=="remote")return null;let a=await A(l);return a?{exit:d(a,s,r)}:{choice:l}}async function W(e,r,o,t,n){let[{decideFolderFlags:s},{personTms:l,workLocally:a}]=await Promise.all([import("./folder-flags-WXUR6OPJ.js"),import("./onboarding-LGT6PMDZ.js")]),i=await s(e,{...n,agent:t},{getProject:async m=>(await l()).getProject(m)});if(i.kind==="none")return"undecided";if(i.kind==="refuse")return{exit:d(i.refusal,o,t)};let u=r==="context extract"?"context extract":"context ingest";if(i.kind==="local"){let m=a(u,{print:!t});if(!m.made)return null;if(t){let b=O("ndjson","extract");if(b.event({type:"folder_local",gitignore:m.gitignore}),u==="context extract")return{exit:b.done(0)}}return u==="context extract"?{exit:0}:null}if(n.notBuilt)return{exit:d(n.notBuilt,o,t)};let k=e;try{v(process.cwd(),{projectId:i.projectId,projectName:i.projectName,writtenBy:"kane-cli"})}catch(m){return g("remote-check")(`the folder's link couldn't be written: ${E(m)}`),{exit:d(c.projectFileUnwritable(U(process.cwd())),o,t)}}let p={kind:"remote",latticeUrl:k.latticeUrl,projectId:i.projectId,projectName:i.projectName,onboarded:!0},f=await A(p);return f?{exit:d(f,o,t)}:{choice:p}}async function V(e,r,o,t){let n=R({url:e.latticeUrl,basicAuth:o,...t?{fetch:t}:{}}),s=await n.getSession(r),l="";for await(let a of n.projects()){let i=a.find(u=>u.projectId===s.projectId);if(i){l=i.name;break}}return{kind:"remote",latticeUrl:e.latticeUrl,projectId:s.projectId,projectName:l}}export{A as a,H as b,$ as c,fe as d,V as e};
2
+ import{a as B}from"./chunk-RHGW7B5Q.js";import{b as N,f as d}from"./chunk-HCJ2N3XB.js";import{a as g,b as E}from"./chunk-NLZZLANH.js";import{e as y,f as _}from"./chunk-3F5FMH76.js";import{d as C,e as O,i as x}from"./chunk-XMPTFXPW.js";import{b as F,f as U,g as v}from"./chunk-ZU4W2QGM.js";import{C as h,Ha as c,f as R,r as P,w as S}from"./chunk-7HMSMAUG.js";import{a as w}from"./chunk-I2MC6VVX.js";async function I(e,r){let o=await r.project(e);return o===null?"no_access":o.marked?"marked":"unmarked"}var M=5e3;async function D(e,r=()=>!0){try{for(;;){if(!r())return{found:!1,failed:!0};let o=await e.next();if(o.done)return{found:!1};if(o.value.length>0)return{found:!0,rows:o.value}}}catch{return{found:!1,failed:!0}}}async function j(e,r={}){let o=await L(e,r.budgetMs??M);return o.state==="unknown"&&G(`shared projects weren't checked, so this folder goes on locally: ${o.reason}`),o}async function L(e,r){let o;try{o=await y()}catch(a){return a instanceof x?{state:"unknown",reason:"not signed in",signedOut:!0}:{state:"unknown",reason:"the credentials couldn't be read"}}let t,n=!1,s=new Promise(a=>{t=setTimeout(()=>{n=!0,a({state:"unknown",reason:`the project list took over ${r} ms`})},r)}),l=(async()=>{let a=R({url:e,basicAuth:o}).projects(),i=await D(a,()=>!n);return i.found?{state:"rolled_out",first:{rows:i.rows,more:a}}:i.failed?{state:"unknown",reason:"the project list couldn't be read"}:{state:"not_rolled_out"}})();try{return await Promise.race([l,s])}finally{clearTimeout(t)}}var G=g("remote-check");var T=e=>({code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}});async function A(e,r=_(e.latticeUrl)){let o;try{o=await I(e.projectId,r)}catch(t){if(t instanceof x)return T(t);if(t instanceof w&&t.retryable)return c.noConnection();if(t instanceof w&&t.status===401)return c.credentialsRejected();throw t}return o==="no_access"?c.noAccess(e.projectName):null}function H(e,r,o,t){if(e instanceof w){if(e.code==="SESSION_CLASH"&&t!==void 0&&h(e.extra.heldBy)!==null)return{...c.projectBusy({project:r.projectName,verb:t.verb==="evolve"?"design":t.verb,resume:o!==null,held:h(e.extra.heldBy),...t.useCase?{useCase:t.useCase}:{},...t.title!==void 0?{title:t.title}:{},...t.agent?{agent:!0}:{}}),exit:2};if(e.code==="MARK_REFUSED")return{...c.markRefused(r.projectName,r.onboarded===!0),exit:2};if(e.code==="PROJECT_NOT_MARKED")return{...c.assuranceOff(r.projectName),exit:2};if(e.retryable)return{...c.noConnectionAtStart(),exit:2};if(e.status===401)return{...c.credentialsRejected(),exit:2};if(e.code==="SESSION_ENDED")return{...$(e,o??""),exit:2};if(e.code==="NOT_FOUND"&&o!==null)return{...c.noSuchSession(o),exit:2};if(e.code==="FORMS_REFUSED")return{...J(e.extra)?c.versionCliOlder():c.versionServiceOlder(),exit:2}}else if(e instanceof B)return{...e.side==="cli_older"?c.versionCliOlder():c.versionServiceOlder(),exit:2};return{...c.openFailed(),exit:1}}function $(e,r){return e.extra.ended==="failed"?c.sessionFailed(r):c.sessionFinished(r)}function J(e){let r=typeof e.claimed=="number"?e.claimed:null;return r===null?!1:typeof e.oldestRead=="number"&&r<e.oldestRead?!0:typeof e.highestWriter=="number"&&e.highestWriter>r}async function fe(e,r,o,t={}){P({verb:e,mode:r?"agent":"interactive"});let n=await K(e,r,o,t);return n!==null&&"exit"in n&&await S(),n}async function K(e,r,o,t){let n=F(process.cwd()),s=e.split(" ").at(-1);if(t.project!==void 0||t.local===!0){let i=await W(n,e,s,r,{...t,...o!==void 0?{resume:o}:{}});if(i!=="undecided")return i}if(n.kind==="refuse")return{exit:d(n.refusal,s,r)};let l=n;if(n.kind==="pick"){if(o===void 0){if(!N.has(e)||!(!r&&C()&&t.onboard!==!1))return null;let u=await j(n.latticeUrl);if(u.state==="unknown"&&u.signedOut&&e==="context ingest"){let{signIn:m}=await import("./onboarding-PDVYMTY5.js");if(await m()!=="signed_in")return null;u=await j(n.latticeUrl)}if(u.state!=="rolled_out")return null;let{onboard:k}=await import("./onboarding-PDVYMTY5.js"),p=e==="context extract"?"context extract":"context ingest",f=await k(n,{first:u.first,verb:p});return"exit"in f?f:"local"in f?p==="context extract"&&f.made?{exit:0}:null:{choice:f.choice}}if((await j(n.latticeUrl)).state!=="rolled_out")return null;try{l=await V(n,o,await y())}catch(i){return i instanceof x?{exit:d(T(i),s,r)}:{exit:d(H(i,{kind:"remote",latticeUrl:n.latticeUrl,projectId:"",projectName:""},o),s,r)}}}if(l.kind!=="remote")return null;let a=await A(l);return a?{exit:d(a,s,r)}:{choice:l}}async function W(e,r,o,t,n){let[{decideFolderFlags:s},{personTms:l,workLocally:a}]=await Promise.all([import("./folder-flags-KKIH654K.js"),import("./onboarding-PDVYMTY5.js")]),i=await s(e,{...n,agent:t},{getProject:async m=>(await l()).getProject(m)});if(i.kind==="none")return"undecided";if(i.kind==="refuse")return{exit:d(i.refusal,o,t)};let u=r==="context extract"?"context extract":"context ingest";if(i.kind==="local"){let m=a(u,{print:!t});if(!m.made)return null;if(t){let b=O("ndjson","extract");if(b.event({type:"folder_local",gitignore:m.gitignore}),u==="context extract")return{exit:b.done(0)}}return u==="context extract"?{exit:0}:null}if(n.notBuilt)return{exit:d(n.notBuilt,o,t)};let k=e;try{v(process.cwd(),{projectId:i.projectId,projectName:i.projectName,writtenBy:"kane-cli"})}catch(m){return g("remote-check")(`the folder's link couldn't be written: ${E(m)}`),{exit:d(c.projectFileUnwritable(U(process.cwd())),o,t)}}let p={kind:"remote",latticeUrl:k.latticeUrl,projectId:i.projectId,projectName:i.projectName,onboarded:!0},f=await A(p);return f?{exit:d(f,o,t)}:{choice:p}}async function V(e,r,o,t){let n=R({url:e.latticeUrl,basicAuth:o,...t?{fetch:t}:{}}),s=await n.getSession(r),l="";for await(let a of n.projects()){let i=a.find(u=>u.projectId===s.projectId);if(i){l=i.name;break}}return{kind:"remote",latticeUrl:e.latticeUrl,projectId:s.projectId,projectName:l}}export{A as a,H as b,$ as c,fe as d,V as e};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-D4FFXCX6.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as ze}from"child_process";import{closeSync as Xe,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as X,join as S}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as M}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=M(this.deps.home,".testmuai","kaneai","mobile"),r=M(e,"android-sdk");return{root:r,emulatorDir:M(r,"emulator"),systemImageDir:M(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:M(e,"avd"),manifest:M(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(M(e,"platforms"),{recursive:!0}),await de(M(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(M(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(M(e.systemImageDir,"system.img"))}}},ue;function B(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,z=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
2
+ import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-XRNQSXOM.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as ze}from"child_process";import{closeSync as Xe,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as X,join as S}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as M}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=M(this.deps.home,".testmuai","kaneai","mobile"),r=M(e,"android-sdk");return{root:r,emulatorDir:M(r,"emulator"),systemImageDir:M(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:M(e,"avd"),manifest:M(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(M(e,"platforms"),{recursive:!0}),await de(M(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(M(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(M(e.systemImageDir,"system.img"))}}},ue;function B(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,z=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
3
3
  `)){let o=r.trim();if(!o||o.startsWith("*"))continue;let u=o.toLowerCase();if(u.startsWith("list of devices")||u.startsWith("adb server"))continue;let g=o.split(/\s+/),p=g[0],w=g[1];if(!p||!w)continue;let v=ot(g.slice(2)),x=/^(localhost|127\.0\.0\.1):\d{1,5}$/.test(p),P=/^[A-Za-z0-9._-]+:\d{1,5}$/.test(p),C=/^sdk_/.test(v.product??"")||/^sdk_/.test(v.model??"")||/^emu/.test(v.device??"");if(!p.startsWith("emulator-")&&!x&&!(P&&C))continue;let l=v.model?v.model.replace(/_/g," "):void 0;e.push({platform:G,kind:"emulator",id:p,displayName:l??p,state:st[w]??"offline"})}return e}function me(t){let e=[];for(let r of t.split(`
4
4
  `)){let o=r.trim();o&&/^[A-Za-z0-9._-]+$/.test(o)&&(e.includes(o)||e.push(o))}return e}function dt(t){for(let e of t.split(`
5
5
  `)){let r=e.trim();if(!(!r||r==="OK"))return r}}function lt(t){let e=/^Version\s+(\S+)/m.exec(t);return e?.[1]?e[1].split("-")[0]:/Android Debug Bridge version\s+(\S+)/.exec(t)?.[1]}function ut(t){let e=[];for(let r of t.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var b="0.10.0-rc.1";var a=t(s(),".testmuai","kaneai"),g=t(a,"profiles"),h=t(a,"tui-config.json"),u=t(a,"media"),U="https://registry.npmjs.org/@testmuai/kane-cli",_="https://api.github.com/repos/LambdaTest/kane-cli/releases",i="@testmuai/kane-cli-skill",A=`https://registry.npmjs.org/${i}`,r="kane-cli",x=[{dir:t(s(),".claude","skills",r),agent:"Claude Code"},{dir:t(s(),".agents","skills",r),agent:"Codex CLI"},{dir:t(s(),".gemini","skills",r),agent:"Gemini CLI"}],L="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",I=9222,E=9230,C=t(a,"chrome-profiles"),o=t(a,"hints"),v=t(o,"state.json");function B(e){return t(o,`catalog-${e}.json`)}var l=t(a,"mobile");function f(e,n="android"){return t(l,n==="ios"?`device-catalog-ios-${e}.json`:`device-catalog-${e}.json`)}var m="127.0.0.1",S=18392,T=18400,c="/callback";function N(e){return`http://${m}:${e}${c}`}var O="KANE CLI",P="*",k={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com",mobileAppBaseUrl:"https://api.lambdatest.com",mobileHubUrl:"https://mobile-hub.lambdatest.com/wd/hub",lrmaaBaseUrl:"https://mobile-api.lambdatest.com/mobile-automation/api/v1",latticeBaseUrl:"https://kaneai-api.lambdatest.com/v16-lattice",deviceStreamUrl:"https://stream-microfrontend.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com",mobileAppBaseUrl:"https://stage-api.lambdatestinternal.com",mobileHubUrl:"https://stage-mobile-hub.lambdatestinternal.com/wd/hub",lrmaaBaseUrl:"https://stage-mobile-api.lambdatestinternal.com/mobile-automation/api/v1",latticeBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-lattice",deviceStreamUrl:"https://stage-stream-microfrontend.lambdatestinternal.com"}},D={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444",amber:"#fbbf24"};export{b as a,a as b,h as c,u as d,U as e,_ as f,i as g,x as h,L as i,R as j,I as k,E as l,C as m,v as n,B as o,f as p,m as q,S as r,T as s,c as t,N as u,O as v,P as w,k as x,D as y};
2
+ import{homedir as s}from"os";import{join as t}from"path";var b="0.10.0-rc.3";var a=t(s(),".testmuai","kaneai"),g=t(a,"profiles"),h=t(a,"tui-config.json"),u=t(a,"media"),U="https://registry.npmjs.org/@testmuai/kane-cli",_="https://api.github.com/repos/LambdaTest/kane-cli/releases",i="@testmuai/kane-cli-skill",A=`https://registry.npmjs.org/${i}`,r="kane-cli",x=[{dir:t(s(),".claude","skills",r),agent:"Claude Code"},{dir:t(s(),".agents","skills",r),agent:"Codex CLI"},{dir:t(s(),".gemini","skills",r),agent:"Gemini CLI"}],L="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",I=9222,E=9230,C=t(a,"chrome-profiles"),o=t(a,"hints"),v=t(o,"state.json");function B(e){return t(o,`catalog-${e}.json`)}var l=t(a,"mobile");function f(e,n="android"){return t(l,n==="ios"?`device-catalog-ios-${e}.json`:`device-catalog-${e}.json`)}var m="127.0.0.1",S=18392,T=18400,c="/callback";function N(e){return`http://${m}:${e}${c}`}var O="KANE CLI",P="*",k={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com",mobileAppBaseUrl:"https://api.lambdatest.com",mobileHubUrl:"https://mobile-hub.lambdatest.com/wd/hub",lrmaaBaseUrl:"https://mobile-api.lambdatest.com/mobile-automation/api/v1",latticeBaseUrl:"https://kaneai-api.lambdatest.com/v16-lattice",deviceStreamUrl:"https://stream-microfrontend.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com",mobileAppBaseUrl:"https://stage-api.lambdatestinternal.com",mobileHubUrl:"https://stage-mobile-hub.lambdatestinternal.com/wd/hub",lrmaaBaseUrl:"https://stage-mobile-api.lambdatestinternal.com/mobile-automation/api/v1",latticeBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-lattice",deviceStreamUrl:"https://stage-stream-microfrontend.lambdatestinternal.com"}},D={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444",amber:"#fbbf24"};export{b as a,a as b,h as c,u as d,U as e,_ as f,i as g,x as h,L as i,R as j,I as k,E as l,C as m,v as n,B as o,f as p,m as q,S as r,T as s,c as t,N as u,O as v,P as w,k as x,D as y};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-3QICDXY5.js";import{a as p}from"./chunk-RPRXRKKR.js";import{f as e}from"./chunk-4I7YN6YY.js";import{a as t,b as i,x as n}from"./chunk-I6OQISK4.js";import{dirname as d}from"path";import{fileURLToPath as l}from"url";import{existsSync as a}from"fs";import{join as c,resolve as f}from"path";function g(r){for(let o of[f(r,".."),f(r,"../..")])if(a(c(o,"package.json")))return o;return null}function u(r=m,o,s=p){e({version:t,baseDir:i,authEnvironments:n,packageRoot:g(d(l(import.meta.url))),wording:r,...o?{warn:o}:{},userSessionId:s})}u();export{g as a,u as b};
2
+ import{a as m}from"./chunk-3QICDXY5.js";import{a as p}from"./chunk-RPRXRKKR.js";import{f as e}from"./chunk-4I7YN6YY.js";import{a as t,b as i,x as n}from"./chunk-D36V5OX6.js";import{dirname as d}from"path";import{fileURLToPath as l}from"url";import{existsSync as a}from"fs";import{join as c,resolve as f}from"path";function g(r){for(let o of[f(r,".."),f(r,"../..")])if(a(c(o,"package.json")))return o;return null}function u(r=m,o,s=p){e({version:t,baseDir:i,authEnvironments:n,packageRoot:g(d(l(import.meta.url))),wording:r,...o?{warn:o}:{},userSessionId:s})}u();export{g as a,u as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O,d as S}from"./chunk-6U7ID777.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{n as P,o as R}from"./chunk-NC7D7GOM.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{y as s}from"./chunk-I6OQISK4.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
2
+ import{b as O,d as S}from"./chunk-YQ5C6UDG.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{n as P,o as R}from"./chunk-NC7D7GOM.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{y as s}from"./chunk-D36V5OX6.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as K}from"./chunk-XJ7HCXKW.js";import{b as U}from"./chunk-NLZZLANH.js";import{b as W}from"./chunk-FFL55I2M.js";import{a as S}from"./chunk-3QICDXY5.js";import{$,Aa as v,I as C,K as _,L as b,N as E,O as P,Q as p,U as h,Y as f,Z as F,a as j,aa as O,ba as N,ca as A,da as M,ka as y,ma as D,pa as c,qa as I,sa as L,wa as T}from"./chunk-W3OVSDBN.js";import{oa as R}from"./chunk-UEE3RZN4.js";import{a as g}from"./chunk-FOJHSG5M.js";var G={history:"project",search:"project_ready",session:"project_ready"},B={useCases:"use_cases",criteria:"acceptance_criteria",scenarios:"scenarios",tests:"tests",openQuestions:"open_questions",sources:"sources",styleNotes:"style_notes"},V=(e,t)=>t===null||t<=0?null:Math.min(100,Math.floor(e*100/t)),Y=e=>e.startsWith("design-")||e.startsWith("evolve-")?"design":"extract",q=e=>({cmd:`kane-cli context sessions save ${e} --yes --mode agent`,why:"save it to the project"});function de(e,t=Date.now(),s={}){switch(e.kind){case"connect":return e.step==="service"?{type:"remote_connect",step:"connect"}:{type:"remote_connect",step:"open_session",...e.sid!==void 0?{sid:e.sid}:{},...e.project!==void 0?{project:e.project}:{}};case"load":return{type:"remote_load",part:G[e.part],percent:V(e.done,e.total)};case"write":return null;case"retry":return{type:"remote_retry",attempt:e.attempt,next_in_s:e.nextInS,give_up_in_s:Math.max(0,Math.round((Date.parse(e.giveUpAt)-t)/1e3)),cause:e.cause};case"upload":return{type:"remote_upload",file:e.file,percent:V(e.sentBytes,e.totalBytes)};case"reading":return null;case"fetching":return{type:"remote_fetch",ref:e.ref,provider:e.provider};case"paused":{if(e.reason==="ctrl_c")return null;let n=S.command("next.resume_session",{verb:Y(e.sid),sid:e.sid,mode:"agent"});return{type:"session_paused",sid:e.sid,...s.sourceId?{source_id:s.sourceId}:{},...s.mode?{mode:s.mode}:{},reason:e.reason,resume:n,expires_at:null,pending_questions:[],...(e.reason==="connection_lost"||e.reason==="not_accepted")&&n!==null?{next:[{cmd:n,why:"resume"}]}:{}}}case"save":{let n=a=>Object.fromEntries(Object.entries(a).flatMap(([l,d])=>l in B&&typeof d=="number"?[[B[l],d]]:[])),r=e.counts?n(e.counts):void 0,o=e.heldChanges??(e.counts?F(e.counts):0),i=Object.fromEntries(f.flatMap(a=>{let l=e[a]??e.counts?.[a],d=l?n(l):{};return Object.values(d).some(x=>x>0)?[[a,d]]:[]}));return{type:"session_save",phase:e.phase,sid:e.sid,...e.project!==void 0?{project:e.project}:{},...r!==void 0?{adds:r}:{},...e.notUpdated!==void 0&&e.notUpdated.length>0?{not_updated:e.notUpdated}:{},...i,...o>0?{held_changes:o}:{},...e.replaces?{replaces:n(e.replaces)}:{},...e.keeps?{marks_up_to_date:{tests:e.keeps}}:{},...(e.uncounted??e.counts?.uncounted??0)>0?{other_work:!0}:{},...e.landed!==void 0?{saved:e.landed}:{},...(()=>{let a=L(e.testManager,e.sid,e.sessionUseCases?new Set(e.sessionUseCases):void 0,I(e.testFiles));return a?{test_manager:a}:{}})(),...e.testFiles!==void 0?{test_files:T(e.testFiles,e.sid,{testManager:e.testManager})}:{},...e.reason!==void 0?{reason:e.reason}:{},...e.code!==void 0?{code:e.code}:{},...e.stillStale?{next:[{cmd:"kane-cli maintain evolve --from-stale --mode agent",why:"update the use-cases still out of date"}]}:{}}}case"overlap":return{type:"remote_overlap",sessions:e.sessions.map(n=>({sid:n.sid,owner:n.owner,state:n.state,added:n.added,...n.owner!=="someone_else"&&n.state==="paused"?{next:[{cmd:c(n.verb==="design"||n.verb==="evolve"?"design":"extract",n.sid,!0),why:"goes on with that session where it stopped"}]}:{}}))};case"ended":return{type:"session_ended",sid:e.sid,reason:e.reason};case"not_ended":{let n=S.command("next.resume_session",{verb:Y(e.sid),sid:e.sid,mode:"agent"});return{type:"error",code:"SESSION_NOT_ENDED",message:`${v(e.project)} didn't take this session's last step; the work is safe in the session`,...n!==null?{next:[{cmd:n,why:"ends the session, so it can be saved"}]}:{}}}case"finished_before":return{type:"session_complete",sid:e.sid,...s.sourceId?{source_id:s.sourceId}:{},next:[q(e.sid)]}}}function ce(e,t,s={}){return{type:"session_complete",sid:e,...s.sourceId?{source_id:s.sourceId}:{},...s.noStartPage?.length?{no_start_page:s.noStartPage}:{},...t?{next:[q(e),{cmd:`kane-cli context sessions discard ${e} --yes --mode agent`,why:"throw away what this session added"}]}:{}}}var J=e=>e.notUpdated?[`not updated: ${e.notUpdated}`]:[],k={connection_lost:"lost connection",computer_slept:"this computer slept for over 2 minutes",resumed_elsewhere:"resumed in another terminal",not_accepted:"something couldn't be added to this session",ctrl_c:"ctrl+c",model_unavailable:"the model service did not answer",unexpected:"stopped unexpectedly"},w=e=>e.added===0?[]:[e.verb==="extract"?`${e.added} use-case${e.added===1?"":"s"} added, not saved yet`:`${e.added} added, not saved yet`],u=e=>e.credits?[e.credits]:[],m=e=>e.tracePath?{tracePath:e.tracePath}:{};function pe(e){let t=c(e.verb,e.sid,!1),s=e.reason==="resumed_elsewhere"?["this session goes on in the other terminal; your work is safe",...w(e),"to bring it back here, resume it (the other terminal then stops)",...u(e)]:["your work is safe \u2014 resume it from any machine",...w(e),...u(e)];return{state:"paused",reason:k[e.reason],facts:s,resume:t,resumeMessage:`${t} --message "<your words>"`,...m(e)}}function he(e,t){if(e)return{kind:"ingest",refs:e};let s=[...new Set((t?.uploads??[]).filter(r=>r.outcome==="created"&&!r.filename).map(r=>r.sourceId))],n=t?D(t):[];return n.length+s.length>0?{kind:"resumed",files:n,unnamed:s}:{kind:"extract"}}var H=e=>`discard: kane-cli context sessions discard ${e}`;function fe(e){let t=e.again,s=t.kind==="extract"?[H(e.sid),"then start again: kane-cli context extract"]:["start again with the same sources:",...t.kind==="ingest"?[` ${y(t.refs)}`]:t.files.length>0?[` ${y(t.files)}`]:[],...t.kind==="resumed"?t.unnamed.map(n=>` ${g.dim(`${t.files.length>0?"and ":""}the source "${n}", added again by its address`)}`):[],H(e.sid)];return{state:"paused",reason:e.reason==="held_back"?"the duplicate check couldn't run fully":k[e.reason],facts:[`this session read ${e.sources} sources, so it can't be resumed or saved`,...e.added>0?[`its ${e.added} use-case${e.added===1?"":"s"} won't reach the project`]:[],...s,...u(e)],...m(e)}}function ye(e,t){let s={cmd:`kane-cli context sessions discard ${e} --yes --mode agent`,why:"throw away this session"};if(t.kind==="extract")return{next:[s,{cmd:"kane-cli context extract --mode agent",why:"start again"}]};let n=t.kind==="ingest"?t.refs:t.files;return{next:[...n.length>0?[{cmd:`${y(n)} --mode agent`,why:"start again"}]:[],s],...t.kind==="resumed"&&t.unnamed.length>0?{not_named:[...t.unnamed]}:{}}}var ve=e=>e.filter(t=>t.kind==="header"&&t.source!==void 0).length;function xe(e){let t=c(e.verb,e.sid,!1);return{state:"paused",reason:"the duplicate check couldn't run fully",facts:[e.added>0?"what was added is safe \u2014 resume it from any machine":"nothing was added yet \u2014 resume it from any machine",...w(e),`${e.held} use-case${e.held===1?"":"s"} held back, not added`,...u(e)],resume:t,resumeMessage:`${t} --message "<your words>"`,...m(e)}}var X=e=>e.verb==="evolve"&&e.replaces?`designing its ${e.replaces===1?"test":`${e.replaces} tests`} again didn't finish`:"designing its tests didn't finish";function Se(e){let t=c("extract",e.sid,!1),s=a=>a===1?"1 change":`${a} changes`,n=[...(e.replaced?.scenarios??0)>0?[e.replaced.scenarios===1?"1 scenario":`${e.replaced.scenarios} scenarios`]:[],...(e.replaced?.tests??0)>0?[e.replaced.tests===1?"1 test":`${e.replaced.tests} tests`]:[]],r=n.length>0?`, ${n.join(" and ")} replaced`:"",o=[e.decided>0?"what you decided is safe \u2014 resume it from any machine":"nothing was decided yet \u2014 resume it from any machine",...e.approved>0?[`${s(e.approved)} approved${r}, not saved yet`]:[],...e.unfinished?[X(e.unfinished)]:[],...e.left>0?[`${s(e.left)} not reviewed yet`]:[],...u(e)];return{state:"paused",reason:e.unfinished||e.left===0?k[e.why??"ctrl_c"]:`${s(e.left)} from ${W(e.source)} ${e.left===1?"isn't":"aren't"} reviewed yet`,facts:o,resume:t,resumeMessage:`${t} --message "<your words>"`,...m(e)}}function _e(e){let[t,...s]=e.how==="saved"?["saved from another terminal",`saved to "${e.projectName}" from another terminal`]:e.how==="discarded"?["discarded from another terminal",`discarded from another terminal \u2014 nothing was saved to "${e.projectName}"`]:["ended in another terminal","this session ended in another terminal, so it stops here","to see your sessions, run: kane-cli context sessions"];return{state:"complete",reason:t,facts:[...s,...u(e)],...m(e)}}function Q(e){let t=[e.adds,e.heldChanges?A(e.heldChanges):""].filter(Boolean);return t.length>0?C(t):$({...e,adds:e.adds})?h:p}function be(e,t){let n=`${e===h||e===p||e.startsWith("1 ")&&!e.includes(", ")&&!e.includes(" and ")?"it's":"they're"} thrown away`;return t===void 0?`${n}, and this can't be undone`:`${n}; nothing reaches "${t}", and this can't be undone`}function $e(e){let{heldChanges:t,chatTurns:s,uncounted:n}=e;return{heldChanges:t,chatTurns:s,uncounted:n,...Object.fromEntries(f.map(r=>[r,e[r]])),...e.replaces?{replaces:e.replaces}:{},...e.keeps?{keeps:e.keeps}:{}}}function we(e){return{state:"complete",reason:"not saved yet",facts:[`not saved yet: ${e.changed??Q(e)}`,...e.changed?[]:b(e),...J(e),...e.needed??[],"kept as it is until you save or discard it",`save: kane-cli context sessions save ${e.sid}`,`discard: kane-cli context sessions discard ${e.sid}`,...u(e)],...m(e)}}function ke(e){return{state:"complete",reason:"not saved yet",facts:[`not saved yet: ${Q(e)}`,...b(e),`${v(e.projectName)} didn't take this session's last step; your work is safe`,`save: ${c(e.verb,e.sid,!1)}`,...u(e)],...m(e)}}var z=(e,t)=>e||($({...t,adds:e})?h:O({...t,adds:e})?p:"");function Re(e){let t=z(e.adds,e);return{state:"complete",reason:"saved",facts:[`saved to "${e.projectName}"${t?`: ${t}`:""}`,..._(e),...e.heldChanges?[M(e.heldChanges)]:[],...J(e),...e.testManager?[e.testManager]:[],...e.testManagerNextRun?[e.testManagerNextRun]:[],...e.testFiles?[e.testFiles]:[],...e.testFilesKept?[e.testFilesKept]:[],...e.testFilesReplaced?[e.testFilesReplaced]:[],...e.testFilesNeeded??[],...u(e)],...m(e)}}var je=e=>_(e);function Ce(e,t,s={}){let n=z(t,s);return`\u2714 saved to "${e}"${n?` \u2014 ${n}`:""}`}function Ee(e,t){return e?.facts.find(s=>s.startsWith("credits used:"))??(t?`credits used: ${t.total.toFixed(1)}`:null)}var Z=4;function ee(e,t){let s=e.map(r=>({sid:r.sessionId,verb:r.verb,subject:r.useCase??r.sourceId,title:(r.useCase?r.useCaseTitle:r.sourceTitle)??null,state:j(r),added:null,last_activity_at:r.lastActivityAt??r.createdAt,owner:K(r,t)})),n=r=>Date.parse(r.last_activity_at??"")||0;return s.sort((r,o)=>+(o.owner==="you")-+(r.owner==="you")||n(o)-n(r))}var te={reconcile:"review"},se={ready_to_save:"ready to save",paused:"paused",running:"running",saved:"saved",discarded:"discarded",failed:"ended with an error"};function ne(e,t){let s=Date.parse(e??"");if(Number.isNaN(s))return"";let n=Math.floor((t-s)/6e4);if(n<1)return"just now";if(n<60)return`${n} min ago`;let r=new Date(s),o=a=>a.toDateString(),i=`${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}`;return o(r)===o(new Date(t))?`${Math.floor(n/60)} h ago`:o(r)===o(new Date(t-864e5))?`yesterday ${i}`:`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${i}`}function re(e,t){return e.length===0?["no open sessions"]:e.flatMap(s=>{let n=s.title?`"${s.title}"`:s.subject&&R(s.subject),r=[...s.added?[`${s.added} added`]:[],...s.updated?[`${s.updated} updated`]:[]],o=[te[s.verb]??s.verb,...n?[n]:[],se[s.state],...r,ne(s.last_activity_at,t),...s.owner==="someone_else"?["someone else"]:[]],i=`${s.sid} ${o.filter(Boolean).join(" \xB7 ")}`;return s.owner==="someone_else"?[i]:s.state==="ready_to_save"?[i,g.dim(` save: kane-cli context sessions save ${s.sid}`)]:s.state==="paused"?[i,g.dim(` resume: ${c(s.verb==="design"||s.verb==="evolve"?"design":"extract",s.sid,!1)}`)]:[i]})}async function Ie(e){let t=await e.person.listSessions(e.projectId),s=await ae(e.person,e.projectId,ee(t,e.me).filter(n=>n.state!=="saved"&&n.state!=="discarded"),e.log??(()=>{}));return e.out(e.json?JSON.stringify(s)+`
2
+ import{c as K}from"./chunk-RHGW7B5Q.js";import{b as U}from"./chunk-NLZZLANH.js";import{b as W}from"./chunk-7NPTL66J.js";import{a as S}from"./chunk-3QICDXY5.js";import{$,Aa as v,I as C,K as _,L as b,N as E,O as P,Q as p,U as h,Y as f,Z as F,a as j,aa as O,ba as N,ca as A,da as M,ka as y,ma as D,pa as c,qa as I,sa as L,wa as T}from"./chunk-7HMSMAUG.js";import{oa as R}from"./chunk-UEE3RZN4.js";import{a as g}from"./chunk-FOJHSG5M.js";var G={history:"project",search:"project_ready",session:"project_ready"},B={useCases:"use_cases",criteria:"acceptance_criteria",scenarios:"scenarios",tests:"tests",openQuestions:"open_questions",sources:"sources",styleNotes:"style_notes"},V=(e,t)=>t===null||t<=0?null:Math.min(100,Math.floor(e*100/t)),Y=e=>e.startsWith("design-")||e.startsWith("evolve-")?"design":"extract",q=e=>({cmd:`kane-cli context sessions save ${e} --yes --mode agent`,why:"save it to the project"});function de(e,t=Date.now(),s={}){switch(e.kind){case"connect":return e.step==="service"?{type:"remote_connect",step:"connect"}:{type:"remote_connect",step:"open_session",...e.sid!==void 0?{sid:e.sid}:{},...e.project!==void 0?{project:e.project}:{}};case"load":return{type:"remote_load",part:G[e.part],percent:V(e.done,e.total)};case"write":return null;case"retry":return{type:"remote_retry",attempt:e.attempt,next_in_s:e.nextInS,give_up_in_s:Math.max(0,Math.round((Date.parse(e.giveUpAt)-t)/1e3)),cause:e.cause};case"upload":return{type:"remote_upload",file:e.file,percent:V(e.sentBytes,e.totalBytes)};case"reading":return null;case"fetching":return{type:"remote_fetch",ref:e.ref,provider:e.provider};case"paused":{if(e.reason==="ctrl_c")return null;let n=S.command("next.resume_session",{verb:Y(e.sid),sid:e.sid,mode:"agent"});return{type:"session_paused",sid:e.sid,...s.sourceId?{source_id:s.sourceId}:{},...s.mode?{mode:s.mode}:{},reason:e.reason,resume:n,expires_at:null,pending_questions:[],...(e.reason==="connection_lost"||e.reason==="not_accepted")&&n!==null?{next:[{cmd:n,why:"resume"}]}:{}}}case"save":{let n=a=>Object.fromEntries(Object.entries(a).flatMap(([l,d])=>l in B&&typeof d=="number"?[[B[l],d]]:[])),r=e.counts?n(e.counts):void 0,o=e.heldChanges??(e.counts?F(e.counts):0),i=Object.fromEntries(f.flatMap(a=>{let l=e[a]??e.counts?.[a],d=l?n(l):{};return Object.values(d).some(x=>x>0)?[[a,d]]:[]}));return{type:"session_save",phase:e.phase,sid:e.sid,...e.project!==void 0?{project:e.project}:{},...r!==void 0?{adds:r}:{},...e.notUpdated!==void 0&&e.notUpdated.length>0?{not_updated:e.notUpdated}:{},...i,...o>0?{held_changes:o}:{},...e.replaces?{replaces:n(e.replaces)}:{},...e.keeps?{marks_up_to_date:{tests:e.keeps}}:{},...(e.uncounted??e.counts?.uncounted??0)>0?{other_work:!0}:{},...e.landed!==void 0?{saved:e.landed}:{},...(()=>{let a=L(e.testManager,e.sid,e.sessionUseCases?new Set(e.sessionUseCases):void 0,I(e.testFiles));return a?{test_manager:a}:{}})(),...e.testFiles!==void 0?{test_files:T(e.testFiles,e.sid,{testManager:e.testManager})}:{},...e.reason!==void 0?{reason:e.reason}:{},...e.code!==void 0?{code:e.code}:{},...e.stillStale?{next:[{cmd:"kane-cli maintain evolve --from-stale --mode agent",why:"update the use-cases still out of date"}]}:{}}}case"overlap":return{type:"remote_overlap",sessions:e.sessions.map(n=>({sid:n.sid,owner:n.owner,state:n.state,added:n.added,...n.owner!=="someone_else"&&n.state==="paused"?{next:[{cmd:c(n.verb==="design"||n.verb==="evolve"?"design":"extract",n.sid,!0),why:"goes on with that session where it stopped"}]}:{}}))};case"ended":return{type:"session_ended",sid:e.sid,reason:e.reason};case"not_ended":{let n=S.command("next.resume_session",{verb:Y(e.sid),sid:e.sid,mode:"agent"});return{type:"error",code:"SESSION_NOT_ENDED",message:`${v(e.project)} didn't take this session's last step; the work is safe in the session`,...n!==null?{next:[{cmd:n,why:"ends the session, so it can be saved"}]}:{}}}case"finished_before":return{type:"session_complete",sid:e.sid,...s.sourceId?{source_id:s.sourceId}:{},next:[q(e.sid)]}}}function ce(e,t,s={}){return{type:"session_complete",sid:e,...s.sourceId?{source_id:s.sourceId}:{},...s.noStartPage?.length?{no_start_page:s.noStartPage}:{},...t?{next:[q(e),{cmd:`kane-cli context sessions discard ${e} --yes --mode agent`,why:"throw away what this session added"}]}:{}}}var J=e=>e.notUpdated?[`not updated: ${e.notUpdated}`]:[],k={connection_lost:"lost connection",computer_slept:"this computer slept for over 2 minutes",resumed_elsewhere:"resumed in another terminal",not_accepted:"something couldn't be added to this session",ctrl_c:"ctrl+c",model_unavailable:"the model service did not answer",unexpected:"stopped unexpectedly"},w=e=>e.added===0?[]:[e.verb==="extract"?`${e.added} use-case${e.added===1?"":"s"} added, not saved yet`:`${e.added} added, not saved yet`],u=e=>e.credits?[e.credits]:[],m=e=>e.tracePath?{tracePath:e.tracePath}:{};function pe(e){let t=c(e.verb,e.sid,!1),s=e.reason==="resumed_elsewhere"?["this session goes on in the other terminal; your work is safe",...w(e),"to bring it back here, resume it (the other terminal then stops)",...u(e)]:["your work is safe \u2014 resume it from any machine",...w(e),...u(e)];return{state:"paused",reason:k[e.reason],facts:s,resume:t,resumeMessage:`${t} --message "<your words>"`,...m(e)}}function he(e,t){if(e)return{kind:"ingest",refs:e};let s=[...new Set((t?.uploads??[]).filter(r=>r.outcome==="created"&&!r.filename).map(r=>r.sourceId))],n=t?D(t):[];return n.length+s.length>0?{kind:"resumed",files:n,unnamed:s}:{kind:"extract"}}var H=e=>`discard: kane-cli context sessions discard ${e}`;function fe(e){let t=e.again,s=t.kind==="extract"?[H(e.sid),"then start again: kane-cli context extract"]:["start again with the same sources:",...t.kind==="ingest"?[` ${y(t.refs)}`]:t.files.length>0?[` ${y(t.files)}`]:[],...t.kind==="resumed"?t.unnamed.map(n=>` ${g.dim(`${t.files.length>0?"and ":""}the source "${n}", added again by its address`)}`):[],H(e.sid)];return{state:"paused",reason:e.reason==="held_back"?"the duplicate check couldn't run fully":k[e.reason],facts:[`this session read ${e.sources} sources, so it can't be resumed or saved`,...e.added>0?[`its ${e.added} use-case${e.added===1?"":"s"} won't reach the project`]:[],...s,...u(e)],...m(e)}}function ye(e,t){let s={cmd:`kane-cli context sessions discard ${e} --yes --mode agent`,why:"throw away this session"};if(t.kind==="extract")return{next:[s,{cmd:"kane-cli context extract --mode agent",why:"start again"}]};let n=t.kind==="ingest"?t.refs:t.files;return{next:[...n.length>0?[{cmd:`${y(n)} --mode agent`,why:"start again"}]:[],s],...t.kind==="resumed"&&t.unnamed.length>0?{not_named:[...t.unnamed]}:{}}}var ve=e=>e.filter(t=>t.kind==="header"&&t.source!==void 0).length;function xe(e){let t=c(e.verb,e.sid,!1);return{state:"paused",reason:"the duplicate check couldn't run fully",facts:[e.added>0?"what was added is safe \u2014 resume it from any machine":"nothing was added yet \u2014 resume it from any machine",...w(e),`${e.held} use-case${e.held===1?"":"s"} held back, not added`,...u(e)],resume:t,resumeMessage:`${t} --message "<your words>"`,...m(e)}}var X=e=>e.verb==="evolve"&&e.replaces?`designing its ${e.replaces===1?"test":`${e.replaces} tests`} again didn't finish`:"designing its tests didn't finish";function Se(e){let t=c("extract",e.sid,!1),s=a=>a===1?"1 change":`${a} changes`,n=[...(e.replaced?.scenarios??0)>0?[e.replaced.scenarios===1?"1 scenario":`${e.replaced.scenarios} scenarios`]:[],...(e.replaced?.tests??0)>0?[e.replaced.tests===1?"1 test":`${e.replaced.tests} tests`]:[]],r=n.length>0?`, ${n.join(" and ")} replaced`:"",o=[e.decided>0?"what you decided is safe \u2014 resume it from any machine":"nothing was decided yet \u2014 resume it from any machine",...e.approved>0?[`${s(e.approved)} approved${r}, not saved yet`]:[],...e.unfinished?[X(e.unfinished)]:[],...e.left>0?[`${s(e.left)} not reviewed yet`]:[],...u(e)];return{state:"paused",reason:e.unfinished||e.left===0?k[e.why??"ctrl_c"]:`${s(e.left)} from ${W(e.source)} ${e.left===1?"isn't":"aren't"} reviewed yet`,facts:o,resume:t,resumeMessage:`${t} --message "<your words>"`,...m(e)}}function _e(e){let[t,...s]=e.how==="saved"?["saved from another terminal",`saved to "${e.projectName}" from another terminal`]:e.how==="discarded"?["discarded from another terminal",`discarded from another terminal \u2014 nothing was saved to "${e.projectName}"`]:["ended in another terminal","this session ended in another terminal, so it stops here","to see your sessions, run: kane-cli context sessions"];return{state:"complete",reason:t,facts:[...s,...u(e)],...m(e)}}function Q(e){let t=[e.adds,e.heldChanges?A(e.heldChanges):""].filter(Boolean);return t.length>0?C(t):$({...e,adds:e.adds})?h:p}function be(e,t){let n=`${e===h||e===p||e.startsWith("1 ")&&!e.includes(", ")&&!e.includes(" and ")?"it's":"they're"} thrown away`;return t===void 0?`${n}, and this can't be undone`:`${n}; nothing reaches "${t}", and this can't be undone`}function $e(e){let{heldChanges:t,chatTurns:s,uncounted:n}=e;return{heldChanges:t,chatTurns:s,uncounted:n,...Object.fromEntries(f.map(r=>[r,e[r]])),...e.replaces?{replaces:e.replaces}:{},...e.keeps?{keeps:e.keeps}:{}}}function we(e){return{state:"complete",reason:"not saved yet",facts:[`not saved yet: ${e.changed??Q(e)}`,...e.changed?[]:b(e),...J(e),...e.needed??[],"kept as it is until you save or discard it",`save: kane-cli context sessions save ${e.sid}`,`discard: kane-cli context sessions discard ${e.sid}`,...u(e)],...m(e)}}function ke(e){return{state:"complete",reason:"not saved yet",facts:[`not saved yet: ${Q(e)}`,...b(e),`${v(e.projectName)} didn't take this session's last step; your work is safe`,`save: ${c(e.verb,e.sid,!1)}`,...u(e)],...m(e)}}var z=(e,t)=>e||($({...t,adds:e})?h:O({...t,adds:e})?p:"");function Re(e){let t=z(e.adds,e);return{state:"complete",reason:"saved",facts:[`saved to "${e.projectName}"${t?`: ${t}`:""}`,..._(e),...e.heldChanges?[M(e.heldChanges)]:[],...J(e),...e.testManager?[e.testManager]:[],...e.testManagerNextRun?[e.testManagerNextRun]:[],...e.testFiles?[e.testFiles]:[],...e.testFilesKept?[e.testFilesKept]:[],...e.testFilesReplaced?[e.testFilesReplaced]:[],...e.testFilesNeeded??[],...u(e)],...m(e)}}var je=e=>_(e);function Ce(e,t,s={}){let n=z(t,s);return`\u2714 saved to "${e}"${n?` \u2014 ${n}`:""}`}function Ee(e,t){return e?.facts.find(s=>s.startsWith("credits used:"))??(t?`credits used: ${t.total.toFixed(1)}`:null)}var Z=4;function ee(e,t){let s=e.map(r=>({sid:r.sessionId,verb:r.verb,subject:r.useCase??r.sourceId,title:(r.useCase?r.useCaseTitle:r.sourceTitle)??null,state:j(r),added:null,last_activity_at:r.lastActivityAt??r.createdAt,owner:K(r,t)})),n=r=>Date.parse(r.last_activity_at??"")||0;return s.sort((r,o)=>+(o.owner==="you")-+(r.owner==="you")||n(o)-n(r))}var te={reconcile:"review"},se={ready_to_save:"ready to save",paused:"paused",running:"running",saved:"saved",discarded:"discarded",failed:"ended with an error"};function ne(e,t){let s=Date.parse(e??"");if(Number.isNaN(s))return"";let n=Math.floor((t-s)/6e4);if(n<1)return"just now";if(n<60)return`${n} min ago`;let r=new Date(s),o=a=>a.toDateString(),i=`${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}`;return o(r)===o(new Date(t))?`${Math.floor(n/60)} h ago`:o(r)===o(new Date(t-864e5))?`yesterday ${i}`:`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${i}`}function re(e,t){return e.length===0?["no open sessions"]:e.flatMap(s=>{let n=s.title?`"${s.title}"`:s.subject&&R(s.subject),r=[...s.added?[`${s.added} added`]:[],...s.updated?[`${s.updated} updated`]:[]],o=[te[s.verb]??s.verb,...n?[n]:[],se[s.state],...r,ne(s.last_activity_at,t),...s.owner==="someone_else"?["someone else"]:[]],i=`${s.sid} ${o.filter(Boolean).join(" \xB7 ")}`;return s.owner==="someone_else"?[i]:s.state==="ready_to_save"?[i,g.dim(` save: kane-cli context sessions save ${s.sid}`)]:s.state==="paused"?[i,g.dim(` resume: ${c(s.verb==="design"||s.verb==="evolve"?"design":"extract",s.sid,!1)}`)]:[i]})}async function Ie(e){let t=await e.person.listSessions(e.projectId),s=await ae(e.person,e.projectId,ee(t,e.me).filter(n=>n.state!=="saved"&&n.state!=="discarded"),e.log??(()=>{}));return e.out(e.json?JSON.stringify(s)+`
3
3
  `:re(s,Date.now()).join(`
4
4
  `)+`
5
5
  `),0}async function ae(e,t,s,n){let r=s.map(a=>({...a})),o=0,i=async()=>{for(let a=o++;a<r.length;a=o++){let l=r[a].sid,d=await N(e,t,l).catch(x=>(n(`${l}'s count couldn't be read: ${U(x)}`),null));r[a].added=d?P(d):null,d&&(r[a].updated=E(d))}};return await Promise.all(Array.from({length:Math.min(Z,r.length)},i)),r}export{de as a,ce as b,pe as c,he as d,fe as e,ye as f,ve as g,xe as h,Se as i,_e as j,Q as k,be as l,$e as m,we as n,ke as o,Re as p,je as q,Ce as r,Ee as s,se as t,ne as u,Ie as v};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as O}from"./chunk-QSCXXNC2.js";import{b as A}from"./chunk-VO66KP2W.js";import{n as L}from"./chunk-HHW6MRU3.js";import{a as k,b as P}from"./chunk-6PIIUAZF.js";import{a as b,b as R,c as x,d as y,e as T,g as I,h as f}from"./chunk-NC7D7GOM.js";import{d as w,g as p}from"./chunk-ZCRZFAOT.js";import{a as v}from"./chunk-RZ4F3BHX.js";import{a as m,i as S}from"./chunk-I6OQISK4.js";var h=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_inFlightFlush=null;_stoppingFast=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,n,s={}){if(this.stopped)return;let o=this.buildEntry(e,t,n,s);this.buffer.push(o)}logStep(e,t,n,s={}){if(this.stopped)return;let o=this.buildEntry("debug",t,n,s);o.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(o)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this._flushBody();this._inFlightFlush=e;try{await e}finally{this._inFlightFlush===e&&(this._inFlightFlush=null)}}async _flushBody(){let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let n={"Content-Type":"application/json"};t&&(n.Authorization=`Bearer ${t}`);let s=JSON.stringify(e);for(let o=0;o<3;o++){try{let l=new AbortController,a=setTimeout(()=>l.abort(),1e4),c=await v(this.config.proxyUrl,{method:"POST",headers:n,body:s,signal:l.signal});if(clearTimeout(a),c.ok)return}catch{}if(this._stoppingFast){this.buffer.unshift(...e);return}o<2&&await new Promise(l=>setTimeout(l,1e3*Math.pow(2,o)))}this._droppedBatches++,this._droppedEntries+=e.length}async flushOnce(e){if(this.buffer.length===0)return"empty";let t=this.buffer.splice(0),n=Date.now()+e,s=!1,o,l=null;try{l=await Promise.race([this.config.getToken(),new Promise(d=>{o=setTimeout(()=>{s=!0,d(null)},e),o.unref&&o.unref()})])}catch{l=null}finally{o&&clearTimeout(o)}let a=n-Date.now();if(s||a<=0)return this.buffer.unshift(...t),"timeout";let c={"Content-Type":"application/json"};l&&(c.Authorization=`Bearer ${l}`);try{let d=new AbortController,u=setTimeout(()=>d.abort(),a);u.unref&&u.unref();let r=await v(this.config.proxyUrl,{method:"POST",headers:c,body:JSON.stringify(t),signal:d.signal});return clearTimeout(u),r.ok?"sent":(this.buffer.unshift(...t),"failed")}catch{return this.buffer.unshift(...t),Date.now()>=n?"timeout":"failed"}}async stopAndFlushOnce(e){let t=Date.now()+e;this._stoppingFast=!0,this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null);let n=this._inFlightFlush;if(n){let o;await Promise.race([n.catch(()=>{}),new Promise(l=>{o=setTimeout(l,e),o.unref&&o.unref()})]),o&&clearTimeout(o)}if(this.buffer.length===0)return"empty";let s=t-Date.now();if(s<=0)return"timeout";try{return await this.flushOnce(s)}catch{return"failed"}}drainBuffer(){return this.buffer.splice(0)}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,n,s){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:e,event:t,message:n,session_id:this.config.sessionId,run_index:t.startsWith("tcg_")?null:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:s,timestamp:new Date().toISOString()}}};import{platform as $,arch as V}from"os";import M from"fs";import B from"fs";import U from"path";var F=1e3,_=0,j=new Set([130,3]),g=class i{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,t={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=t}get enabled(){return this.logger!==null}event(e,t={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let n=y(this.ids,e,t);this.logger.log(x[e],e,e,C(n))}error(e,t={}){this.logger&&(this.logger.escalate(_),this.event("ASR_ERROR",{...t,error_code:e}))}child(e,t){return new i({...this.opts,envelope:{...this.ids,operation_id:t,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:t}=await import("./store-id-YZ5WKJ25.js"),{ids:n,cloned:s}=t(e,p());this.ids.context_lineage_id=n.context_lineage_id,this.ids.context_instance_id=n.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}spoolError(e,t={}){this.logger&&(this.event("ASR_ERROR",{...t,error_code:e}),T(this.logger.drainBuffer()))}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let t=typeof e.kind=="string"?e.kind.slice(0,64):"trace",n={...C(y(this.ids,"ASR_CMD_START",{})),trace_kind:t};typeof e.code=="string"&&(n.trace_code=e.code.slice(0,64)),delete n.event,this.logger.logStep(_,`trace_${t}`,t,n)}}wireTrace(e,t,n){if(!this.logger)return;n&&this.agentSession(n);let s=t&&typeof t=="object"?t:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;case"design_phase_committed":this.event("ASR_COMMIT",{phase:s.phase,duration_ms:s.ms});break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(_):this.logger.escalate(_),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let t=await this.logger.flushOnce(F);(t==="failed"||t==="timeout")&&T(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),f(null)}}writeManifestLine(e){try{let t=w(this.ids.context_instance_id??null);B.mkdirSync(U.dirname(t),{recursive:!0});let n={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};B.appendFileSync(t,JSON.stringify(n)+`
2
+ import{a as O}from"./chunk-QSCXXNC2.js";import{b as A}from"./chunk-VO66KP2W.js";import{n as L}from"./chunk-HHW6MRU3.js";import{a as k,b as P}from"./chunk-6PIIUAZF.js";import{a as b,b as R,c as x,d as y,e as T,g as I,h as f}from"./chunk-NC7D7GOM.js";import{d as w,g as p}from"./chunk-ZCRZFAOT.js";import{a as v}from"./chunk-RZ4F3BHX.js";import{a as m,i as S}from"./chunk-D36V5OX6.js";var h=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_inFlightFlush=null;_stoppingFast=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,n,s={}){if(this.stopped)return;let o=this.buildEntry(e,t,n,s);this.buffer.push(o)}logStep(e,t,n,s={}){if(this.stopped)return;let o=this.buildEntry("debug",t,n,s);o.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(o)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this._flushBody();this._inFlightFlush=e;try{await e}finally{this._inFlightFlush===e&&(this._inFlightFlush=null)}}async _flushBody(){let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let n={"Content-Type":"application/json"};t&&(n.Authorization=`Bearer ${t}`);let s=JSON.stringify(e);for(let o=0;o<3;o++){try{let l=new AbortController,a=setTimeout(()=>l.abort(),1e4),c=await v(this.config.proxyUrl,{method:"POST",headers:n,body:s,signal:l.signal});if(clearTimeout(a),c.ok)return}catch{}if(this._stoppingFast){this.buffer.unshift(...e);return}o<2&&await new Promise(l=>setTimeout(l,1e3*Math.pow(2,o)))}this._droppedBatches++,this._droppedEntries+=e.length}async flushOnce(e){if(this.buffer.length===0)return"empty";let t=this.buffer.splice(0),n=Date.now()+e,s=!1,o,l=null;try{l=await Promise.race([this.config.getToken(),new Promise(d=>{o=setTimeout(()=>{s=!0,d(null)},e),o.unref&&o.unref()})])}catch{l=null}finally{o&&clearTimeout(o)}let a=n-Date.now();if(s||a<=0)return this.buffer.unshift(...t),"timeout";let c={"Content-Type":"application/json"};l&&(c.Authorization=`Bearer ${l}`);try{let d=new AbortController,u=setTimeout(()=>d.abort(),a);u.unref&&u.unref();let r=await v(this.config.proxyUrl,{method:"POST",headers:c,body:JSON.stringify(t),signal:d.signal});return clearTimeout(u),r.ok?"sent":(this.buffer.unshift(...t),"failed")}catch{return this.buffer.unshift(...t),Date.now()>=n?"timeout":"failed"}}async stopAndFlushOnce(e){let t=Date.now()+e;this._stoppingFast=!0,this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null);let n=this._inFlightFlush;if(n){let o;await Promise.race([n.catch(()=>{}),new Promise(l=>{o=setTimeout(l,e),o.unref&&o.unref()})]),o&&clearTimeout(o)}if(this.buffer.length===0)return"empty";let s=t-Date.now();if(s<=0)return"timeout";try{return await this.flushOnce(s)}catch{return"failed"}}drainBuffer(){return this.buffer.splice(0)}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,n,s){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:e,event:t,message:n,session_id:this.config.sessionId,run_index:t.startsWith("tcg_")?null:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:s,timestamp:new Date().toISOString()}}};import{platform as $,arch as V}from"os";import M from"fs";import B from"fs";import U from"path";var F=1e3,_=0,j=new Set([130,3]),g=class i{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,t={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=t}get enabled(){return this.logger!==null}event(e,t={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let n=y(this.ids,e,t);this.logger.log(x[e],e,e,C(n))}error(e,t={}){this.logger&&(this.logger.escalate(_),this.event("ASR_ERROR",{...t,error_code:e}))}child(e,t){return new i({...this.opts,envelope:{...this.ids,operation_id:t,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:t}=await import("./store-id-YZ5WKJ25.js"),{ids:n,cloned:s}=t(e,p());this.ids.context_lineage_id=n.context_lineage_id,this.ids.context_instance_id=n.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}spoolError(e,t={}){this.logger&&(this.event("ASR_ERROR",{...t,error_code:e}),T(this.logger.drainBuffer()))}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let t=typeof e.kind=="string"?e.kind.slice(0,64):"trace",n={...C(y(this.ids,"ASR_CMD_START",{})),trace_kind:t};typeof e.code=="string"&&(n.trace_code=e.code.slice(0,64)),delete n.event,this.logger.logStep(_,`trace_${t}`,t,n)}}wireTrace(e,t,n){if(!this.logger)return;n&&this.agentSession(n);let s=t&&typeof t=="object"?t:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;case"design_phase_committed":this.event("ASR_COMMIT",{phase:s.phase,duration_ms:s.ms});break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(_):this.logger.escalate(_),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let t=await this.logger.flushOnce(F);(t==="failed"||t==="timeout")&&T(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),f(null)}}writeManifestLine(e){try{let t=w(this.ids.context_instance_id??null);B.mkdirSync(U.dirname(t),{recursive:!0});let n={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};B.appendFileSync(t,JSON.stringify(n)+`
3
3
  `,{flag:"a",mode:384})}catch{}}};function C(i){let e={event:i.event,session_id:i.session_id,operation_id:i.operation_id,verb:i.verb,mode:i.mode,component:i.component,seq:i.seq,context_lineage_id:i.context_lineage_id,context_instance_id:i.context_instance_id};i.parent_operation_id&&(e.parent_operation_id=i.parent_operation_id),i.agent_session_id&&(e.agent_session_id=i.agent_session_id),i.lattice_session_id&&(e.lattice_session_id=i.lattice_session_id),i.project_id&&(e.project_id=i.project_id);for(let[t,n]of Object.entries(i.context))e[t]=n;return e}import{isMainThread as X}from"worker_threads";var E=()=>process.env.KANE_TELEMETRY_URL||S;function Y(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function z(){return process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1")}function me(i){let e=z(),t=i.env??Y(),n=i.sessionId??null;if(!n&&i.resumeSid&&i.contextRoot)try{let r=L(i.contextRoot,i.resumeSid);r?.user_session_id&&(n=r.user_session_id)}catch{}if(!n&&i.applyPlanPath)try{let r=JSON.parse(M.readFileSync(i.applyPlanPath,"utf8"));r.telemetry?.user_session_id&&(n=r.telemetry.user_session_id)}catch{}let s=i.sessionId===void 0?n!==null:i.resumeSid!==void 0;n||(n=b());let o=null,l=null,a=!1;if(i.contextRoot&&M.existsSync(i.contextRoot))if(i.write&&e){let r=P(i.contextRoot,p());o=r.ids.context_lineage_id,l=r.ids.context_instance_id,a=r.cloned}else{let r=k(i.contextRoot);o=r?.context_lineage_id??null,l=r?.context_instance_id??null}let c={session_id:n,operation_id:R(),context_lineage_id:o,context_instance_id:l,...i.remote?{lattice_session_id:i.remote.sessionId,project_id:i.remote.projectId}:{},verb:i.verb,mode:i.mode,component:"kane-cli"},d=null;if(e){let r=A(t),N={org_id:r.org_id??"",user_id:r.user_id??"",machine_id:r.machine_id,email:null,email_domain:"",user_type:r.user_type??"unknown",env:r.env,plan:r.plan??"unknown"},D=i.mode==="interactive"||i.mode==="cli"?"cli":"agent";d=new h({proxyUrl:E(),sessionId:n,identity:N,device:{cli_version:m,platform:$(),arch:V(),host_agent:O(),invocation_mode:D},getToken:async()=>null}),i.longSession&&d.start()}let u=new g({envelope:c,logger:d,longSession:!!i.longSession,proxyUrl:E(),clientVersion:`kane-cli/${m}`,telemetryEnabled:e});return e&&!i.errorsOnly&&(f(c),u.event("ASR_CMD_START",{resumed:s,applied_plan:!!i.applyPlanPath}),a&&u.event("ASR_CONTEXT_CLONED"),X&&I(E()).catch(()=>{})),u}export{h as a,F as b,E as c,Y as d,z as e,me as f};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as s}from"./chunk-HCBYKLMW.js";import{a as m,b as o}from"./chunk-33DWJV67.js";import{y as i}from"./chunk-I6OQISK4.js";import{e as x}from"./chunk-UR6MHSHU.js";var t=x(s(),1);function d({label:r,text:c,accent:a,color:n,width:l=15}){return(0,t.jsxs)(o,{children:[(0,t.jsx)(o,{color:i.dim,children:` ${r.padEnd(l)}`}),(0,t.jsx)(o,{color:n??(a?i.assuranceAccent:void 0),children:c})]})}function u({head:r,rows:c,minWidth:a=15}){let n=c.filter(e=>e.text),l=Math.max(a,...n.map(e=>e.label.length+2));return(0,t.jsxs)(m,{flexDirection:"column",children:[r?(0,t.jsx)(o,{bold:!0,children:r}):null,n.map((e,p)=>(0,t.jsx)(d,{label:e.label,text:e.text,color:e.color,width:l},p))]})}export{d as a,u as b};
2
+ import{a as s}from"./chunk-HCBYKLMW.js";import{a as m,b as o}from"./chunk-33DWJV67.js";import{y as i}from"./chunk-D36V5OX6.js";import{e as x}from"./chunk-UR6MHSHU.js";var t=x(s(),1);function d({label:r,text:c,accent:a,color:n,width:l=15}){return(0,t.jsxs)(o,{children:[(0,t.jsx)(o,{color:i.dim,children:` ${r.padEnd(l)}`}),(0,t.jsx)(o,{color:n??(a?i.assuranceAccent:void 0),children:c})]})}function u({head:r,rows:c,minWidth:a=15}){let n=c.filter(e=>e.text),l=Math.max(a,...n.map(e=>e.label.length+2));return(0,t.jsxs)(m,{flexDirection:"column",children:[r?(0,t.jsx)(o,{bold:!0,children:r}):null,n.map((e,p)=>(0,t.jsx)(d,{label:e.label,text:e.text,color:e.color,width:l},p))]})}export{d as a,u as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as k,f as l}from"./chunk-Y6Y6RAY4.js";import{b as p}from"./chunk-SA6IKFFD.js";import{a as f}from"./chunk-MGNRNLBE.js";import{a as d}from"./chunk-RZ4F3BHX.js";import{promises as g}from"fs";import{basename as _,join as w}from"path";var D=3e3,S="/deviceSkin";function b(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function v(e){if(e.model){let r=b(e.model);return r?`real-${r}`:void 0}let n=e.name?.trim();return n&&!k(n)?n:void 0}function y(e){let n=e?.data?.skin,r=typeof n?.skin_url=="string"?n.skin_url.trim():"",t=n?.skin_data??{},i=u=>typeof u=="number"&&Number.isFinite(u)?u:void 0,s=i(t.width),o=i(t.height);if(!r||!s||!o)return;let m={width:s,height:o};for(let u of["top","right","bottom","left","radius"]){let c=i(t[u]);c!==void 0&&(m[u]=c)}return{skin_url:r,skin_data:m}}var a=new Map;async function h(e,n,r={}){let t=`${f(e).lrmaaBaseUrl}${S}/${encodeURIComponent(n)}`;if(a.has(t))return a.get(t);try{let i=await(r.request??d)(t,{method:"GET",signal:AbortSignal.timeout(D)});if(!i.ok)return;let s=y(await i.json());return a.set(t,s),s}catch{return}}function A(e){let n=(e??"").trim().replace(/^lt:\/\//i,"").trim();if(n)return(p(n)?n:_(n))||void 0}async function P(e){try{let n=w(e,"steps"),r=(await g.readdir(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,i)=>(parseInt(t,10)||0)-(parseInt(i,10)||0));for(let t of r)try{let i=await g.readFile(w(n,t,"step.json"),"utf8"),o=JSON.parse(i).basis?.window;if(Array.isArray(o)&&o.length===2&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))&&Number(o[0])>0&&Number(o[1])>0)return`${Math.round(Number(o[0]))}x${Math.round(Number(o[1]))}`}catch{}return}catch{return}}async function T(e,n,r){if(!e.native_platform||!n.environment)return e;let t=v({model:n.deviceModel,name:l(n.runnerEnvironment?.device)});if(!t)return e;let i=await h(n.environment,t,r);return i?{...e,skin_url:i.skin_url,skin_data:i.skin_data}:e}export{v as a,h as b,A as c,P as d,T as e};
2
+ import{e as k,f as l}from"./chunk-Y6Y6RAY4.js";import{b as p}from"./chunk-NXAJBSIF.js";import{a as f}from"./chunk-C2RUDJ46.js";import{a as d}from"./chunk-RZ4F3BHX.js";import{promises as g}from"fs";import{basename as _,join as w}from"path";var D=3e3,S="/deviceSkin";function b(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function v(e){if(e.model){let r=b(e.model);return r?`real-${r}`:void 0}let n=e.name?.trim();return n&&!k(n)?n:void 0}function y(e){let n=e?.data?.skin,r=typeof n?.skin_url=="string"?n.skin_url.trim():"",t=n?.skin_data??{},i=u=>typeof u=="number"&&Number.isFinite(u)?u:void 0,s=i(t.width),o=i(t.height);if(!r||!s||!o)return;let m={width:s,height:o};for(let u of["top","right","bottom","left","radius"]){let c=i(t[u]);c!==void 0&&(m[u]=c)}return{skin_url:r,skin_data:m}}var a=new Map;async function h(e,n,r={}){let t=`${f(e).lrmaaBaseUrl}${S}/${encodeURIComponent(n)}`;if(a.has(t))return a.get(t);try{let i=await(r.request??d)(t,{method:"GET",signal:AbortSignal.timeout(D)});if(!i.ok)return;let s=y(await i.json());return a.set(t,s),s}catch{return}}function A(e){let n=(e??"").trim().replace(/^lt:\/\//i,"").trim();if(n)return(p(n)?n:_(n))||void 0}async function P(e){try{let n=w(e,"steps"),r=(await g.readdir(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,i)=>(parseInt(t,10)||0)-(parseInt(i,10)||0));for(let t of r)try{let i=await g.readFile(w(n,t,"step.json"),"utf8"),o=JSON.parse(i).basis?.window;if(Array.isArray(o)&&o.length===2&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))&&Number(o[0])>0&&Number(o[1])>0)return`${Math.round(Number(o[0]))}x${Math.round(Number(o[1]))}`}catch{}return}catch{return}}async function T(e,n,r){if(!e.native_platform||!n.environment)return e;let t=v({model:n.deviceModel,name:l(n.runnerEnvironment?.device)});if(!t)return e;let i=await h(n.environment,t,r);return i?{...e,skin_url:i.skin_url,skin_data:i.skin_data}:e}export{v as a,h as b,A as c,P as d,T as e};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as o,e as p}from"./chunk-XMPTFXPW.js";import{a as m}from"./chunk-RPRXRKKR.js";import{d,f as c}from"./chunk-NWBLYMH7.js";import{Ia as a}from"./chunk-UEE3RZN4.js";import{resolve as l}from"path";async function g(s,w,t={}){let r=c({verb:s,mode:"cli",contextRoot:l(process.cwd(),".context"),env:d(),write:t.write,sessionId:m()}),n=()=>{o(t.mode??"")!=="ndjson"&&process.stderr.write(r.supportFooter()+`
2
+ import{b as o,e as p}from"./chunk-XMPTFXPW.js";import{a as m}from"./chunk-RPRXRKKR.js";import{d,f as c}from"./chunk-DJC7NTLA.js";import{Ia as a}from"./chunk-UEE3RZN4.js";import{resolve as l}from"path";async function g(s,w,t={}){let r=c({verb:s,mode:"cli",contextRoot:l(process.cwd(),".context"),env:d(),write:t.write,sessionId:m()}),n=()=>{o(t.mode??"")!=="ndjson"&&process.stderr.write(r.supportFooter()+`
3
3
  `)};try{let e=await w(r);return t.write&&e===0&&await r.lateBindContext(l(process.cwd(),".context")),e===1&&n(),await r.end({exit_code:e}),e}catch(e){if(e instanceof a){if(o(t.mode??"")==="ndjson"){let i=p("ndjson",t.streamVerb??s,{stdout:y=>process.stdout.write(y),stderr:()=>{}});i.event({type:"sync_error",code:e.code,detail:e.message,remedy:e.remedy}),i.done(2,"refused")}else process.stderr.write(`error: ${e.message}
4
4
  next: ${e.remedy}
5
5
  `);return r.error("rebase_open"),await r.end({exit_code:2}),2}throw r.error("cli_crash"),n(),await r.end({exit_code:1}),e}}export{g as a};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as i}from"./chunk-NWBLYMH7.js";import{a as s,b as c,c as n}from"./chunk-ZCRZFAOT.js";import{appendFileSync as m,mkdirSync as u,readFileSync as g,writeFileSync as f}from"fs";import o from"path";var l=!1,p,x=({verb:r,contextInstanceId:e,sessionId:t})=>l&&e===null?n(p??r,t):c(e,r,t);function P(r){l=!0,p=r}function h(r,e){return{path:r,line:(t,d={})=>{if(r!==null)try{u(o.dirname(r),{recursive:!0}),m(r,JSON.stringify({ts:new Date().toISOString(),level:"info",user_session_id:e,source:"kane-cli",kind:t,data:d})+`
2
+ import{e as i}from"./chunk-DJC7NTLA.js";import{a as s,b as c,c as n}from"./chunk-ZCRZFAOT.js";import{appendFileSync as m,mkdirSync as u,readFileSync as g,writeFileSync as f}from"fs";import o from"path";var l=!1,p,x=({verb:r,contextInstanceId:e,sessionId:t})=>l&&e===null?n(p??r,t):c(e,r,t);function P(r){l=!0,p=r}function h(r,e){return{path:r,line:(t,d={})=>{if(r!==null)try{u(o.dirname(r),{recursive:!0}),m(r,JSON.stringify({ts:new Date().toISOString(),level:"info",user_session_id:e,source:"kane-cli",kind:t,data:d})+`
3
3
  `)}catch{}}}}function k(r,e){return h(i()?n(r,e):null,e)}var a=r=>o.join(s(),"shared","logs","sessions",`${r}.trace`);function R(r,e){try{u(o.dirname(a(r)),{recursive:!0}),f(a(r),e)}catch{}}function O(r){if(!i())return null;try{return g(a(r),"utf8").trim()||null}catch{return null}}export{x as a,P as b,h as c,k as d,R as e,O as f};