@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,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as Tr}from"./chunk-OQ5G773E.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-IXW7FOGX.js";import{a as ln,b as wr}from"./chunk-RX47NRSM.js";import{a as St,b as un}from"./chunk-RX6776AI.js";import{a as xr,b as kr,c as vr}from"./chunk-H3HHSTEK.js";import{a as pr,b as ue}from"./chunk-A6TJOZ24.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{e as ze,f as S,g as br}from"./chunk-FFL55I2M.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-UEE3RZN4.js";import{a as ur}from"./chunk-I5NSJBOZ.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{y as o}from"./chunk-I6OQISK4.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
2
+ import{b as Tr}from"./chunk-L5DALV5N.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-IJ2AHSWW.js";import{a as ln,b as wr}from"./chunk-YLXWAY7D.js";import{a as St,b as un}from"./chunk-RX6776AI.js";import{a as xr,b as kr,c as vr}from"./chunk-RTVHJ23A.js";import{a as pr,b as ue}from"./chunk-VXGN3IV7.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{e as ze,f as S,g as br}from"./chunk-7NPTL66J.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-UEE3RZN4.js";import{a as ur}from"./chunk-3OQW2GTA.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{y as o}from"./chunk-D36V5OX6.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
3
3
  `)){if(u.length<=f){p.push(u);continue}let x="";for(let y of u.split(" "))x&&x.length+1+y.length>f?(p.push(x),x=y):x=x?`${x} ${y}`:y;p.push(x)}let a=Math.max(0,p.length-c);return{body:p.slice(-c).join(`
4
4
  `),hidden:a}}function wn(e){return e.resumed?[{role:"agent",turnIndex:0,items:e.resumed.items},...e.turns]:e.turns}function Wr(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},c={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},c]:[c,s]}function Vr(e){return e.length===0?null:{approved:e.filter(s=>s.verdict==="approve").length,rejected:e.filter(s=>s.verdict==="reject").length,deferred:e.filter(s=>s.verdict==="defer").length}}function ds(e,s){return s?`the changes in ${e} could not be read: ${s.message}`:"no reviewable changes came back \u2014 the source may be unchanged"}function fo({controller:e,verb:s="extract",onCtrlC:c,chain:f=null,inspect:p=null,reconcile:a=null,autoReview:u=!1,onReviewExit:x,meta:y=null,remote:T=null}){let[,P]=(0,g.useState)(0),[V,re]=(0,g.useState)(!1),[C,b]=(0,g.useState)(null),[I,pe]=(0,g.useState)(null),q=(0,g.useRef)(null),[fe,we]=(0,g.useState)(null),W=(0,g.useRef)(null),xe=t=>{W.current=t,we(t)},ie=t=>{q.current=t,pe(t),t===null&&xe(null)},Z=(0,g.useRef)([]),[A,Pe]=(0,g.useState)(null),H=(0,g.useRef)(null),F=t=>{H.current=t,Pe(t)},[h,me]=(0,g.useState)(null),B=(0,g.useRef)(null),$=t=>{B.current=t,me(t)},[Q,et]=(0,g.useState)(null),yn=(0,g.useRef)(null),be=t=>{yn.current=t,et(t)},Mt=(0,g.useRef)({approved:0,rejected:0,deferred:0}),[Kr,Ur]=(0,g.useState)(null),je=(0,g.useRef)({added:0,updated:0}),Fe=(0,g.useRef)(!1),se=(0,g.useRef)(null),[ye,_t]=(0,g.useState)(null),Tn=(0,g.useRef)(new Set),$n=fr(),{stdout:Hr}=Me(),Qr=Hr?.columns??80,Rn=(0,g.useRef)(0),N=T!==null,R=T?.review??null,tt=N&&e.state.ledger.at(-1)?.kind==="agent",Ot=(0,g.useRef)(0);(0,g.useEffect)(()=>{let t=i=>R!==null&&i?.kind==="header"&&(i.era??0)>0,n=()=>{let i=e.state.ledger;for(let d=Rn.current;d<i.length;d++){let v=i[d];if(t(v))continue;let _=v.kind==="turn"?yr(e.state.turns,v.turnIndex,N?At:void 0):void 0;N&&_&&_.fresh.length===0&&_.unchanged.length===0||$n.append((0,D.jsx)(Lr,{block:v,annotations:_,remote:N,afterHeader:i[d-1]?.kind==="header"&&!t(i[d-1])||i[d-1]?.kind==="lines"},`lg-${d}`))}Rn.current=i.length};n();let l=e.subscribe(()=>{n();let i=e.state;q.current&&(i.pending||i.status==="pausing")&&(ie(null),i.pending&&b("questions arrived \u2014 back to chat")),P(d=>d+1)});return P(i=>i+1),l},[e,$n]);let{thinking:ge,status:ee,pending:M,confirm:qe,ledger:oe,activeTurn:Cn,stream:Xr,notice:nt}=e.state,Sn=(Xr?.text??"").trimEnd(),En=Sn.length>0,Gr=V&&(ge.liveThinking.length>0||ge.thinkingLog.length>0),zr=cs(ge.liveThinking||ge.thinkingLog.map(t=>t.text).join(`
5
5
  `),Qr-6,Nr),An=En?Sn.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{r as i,s as u}from"./chunk-NC7D7GOM.js";async function d(e){if(!e.isInteractive)return{recovered:!1};if(f(e.creds,e.authOnly===!0))return{recovered:!1};let{SingleShotApp:a}=await import("./SingleShotApp-4TDXZEUA.js"),{ScrollbackProvider:t}=await import("./scrollback-GGNBDFQV.js"),{render:r}=await import("./build-5ZN47FAT.js"),o=await import("./react-QWOAB3TB.js"),n={current:null},l={current:!1},{waitUntilExit:c,unmount:s}=r(o.default.createElement(t,null,o.default.createElement(a,{resultRef:n,mode:"login",loginCompleteRef:l,...e.authOnly?{authOnly:!0}:{}})),{exitOnCtrlC:!1});u(()=>s()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),l.current?{recovered:!0}:e.onCancel==="return"?{recovered:!1,cancelled:!0}:(i(0,"Startup gate cancelled"),{recovered:!1})}function f(e,a=!1){let t=e.getActiveProfile(),r=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,r)||e.loadCredentials(t,r)))return!1;if(a)return!0;let n=e.loadProfileConfig(t,r)??{};return!!n.project_id&&!!n.folder_id}export{d as a,f as b};
2
+ import{r as i,s as u}from"./chunk-NC7D7GOM.js";async function d(e){if(!e.isInteractive)return{recovered:!1};if(f(e.creds,e.authOnly===!0))return{recovered:!1};let{SingleShotApp:a}=await import("./SingleShotApp-XQUDR36R.js"),{ScrollbackProvider:t}=await import("./scrollback-GGNBDFQV.js"),{render:r}=await import("./build-5ZN47FAT.js"),o=await import("./react-QWOAB3TB.js"),n={current:null},l={current:!1},{waitUntilExit:c,unmount:s}=r(o.default.createElement(t,null,o.default.createElement(a,{resultRef:n,mode:"login",loginCompleteRef:l,...e.authOnly?{authOnly:!0}:{}})),{exitOnCtrlC:!1});u(()=>s()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),l.current?{recovered:!0}:e.onCancel==="return"?{recovered:!1,cancelled:!0}:(i(0,"Startup gate cancelled"),{recovered:!1})}function f(e,a=!1){let t=e.getActiveProfile(),r=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,r)||e.loadCredentials(t,r)))return!1;if(a)return!0;let n=e.loadProfileConfig(t,r)??{};return!!n.project_id&&!!n.folder_id}export{d as a,f as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-TY5RANJ7.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
2
+ import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-6ACT4ALI.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-OVNRRI4E.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{y as t}from"./chunk-I6OQISK4.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-ICLUC44J.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{y as t}from"./chunk-D36V5OX6.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{N as v,O as x,Q as g}from"./chunk-432ZOE42.js";import{a as p}from"./chunk-R7KXAISS.js";import{a as b}from"./chunk-YDSGXB25.js";import{d as h,i as C}from"./chunk-LKQFG4RW.js";import{b as y}from"./chunk-HD6NR44L.js";import{M as E}from"./chunk-UEE3RZN4.js";async function O(o,e,n,t={},i=process.cwd()){let u=e.mode==="agent";if(o&&e.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!o&&!e.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;if(!u&&(e.answer?.length??0)>0)return v(n,"--answer rides --mode agent: the blast-radius question is asked on the stream and answered on the next call. In a terminal, answer the prompt instead"),2;let s=x(i,n);if(!s)return 2;let a=()=>h(E(p(s))).targets.length===0;if(!e.yes&&!n.isTTY&&!u&&!(e.fromStale&&a()))return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless, run with --mode agent (the question rides the stream and is answered with --answer on the next call) or let kane-cli maintain reconcile drive it"),2;let d=u?b(e.answer):null,m=t.emitEvent;return C(p(s),{...o?{ref:o}:{},...e.because?{because:e.because}:{},...e.mode?{mode:e.mode}:{},...e.yes?{yes:!0}:{}},{io:n,asks:{blast:d??{ask:async(c,l)=>await n.confirm(`proceed with the re-design of ${l}?`)?"proceed":"decline"}},runDesign:t.runDesignForUc??I,...t.onChild?{onChild:t.onChild}:!m&&n.isTTY?{onChild:$(n)}:{},...m?{emit:m}:{},by:{kind:"human",id:process.env.USER??"operator"}})}function $(o){let e="",n="evolve";return t=>{t.kind==="start"?(e=t.subject,n=t.verb,o.out(`\u25CF ${y(t.verb).ing} ${t.subject}`)):t.kind==="end"&&o.out(t.ok?`\u25CF ${y(n).ed} ${e} \u2014 ${t.durS}s`:`\u25CF ${n} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}${t.fixCmd?` \xB7 ${t.fixCmd}`:""}`)}}var I=async(o,e)=>{let{designTestsCommand:n}=await import("./bind-XVO4CQYV.js"),t=a=>n({useCase:o,force:!0,...e.mode?{mode:e.mode}:e.yes?{mode:"override"}:{},...e.because?{because:e.because}:{},...e.changeDelta!==void 0?{changeDelta:e.changeDelta}:{},...e.priorDesign!==void 0?{priorDesign:e.priorDesign}:{},...e.repinsKept?{repinsKept:!0}:{},...e.statement?{statement:e.statement}:{},...a?{onEvent:a}:{}});if(e.mode!=="agent")return t(e.onChildEvent);let i=e.onChildEvent,u=process.stdout.write,s="";process.stdout.write=((a,d,m)=>{if(i){s+=typeof a=="string"?a:Buffer.isBuffer(a)?a.toString("utf8"):String(a);let l=s.indexOf(`
2
+ import{N as v,O as x,Q as g}from"./chunk-MEKPGQAM.js";import{a as p}from"./chunk-R7KXAISS.js";import{a as b}from"./chunk-YDSGXB25.js";import{d as h,i as C}from"./chunk-LKQFG4RW.js";import{b as y}from"./chunk-HD6NR44L.js";import{M as E}from"./chunk-UEE3RZN4.js";async function O(o,e,n,t={},i=process.cwd()){let u=e.mode==="agent";if(o&&e.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!o&&!e.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;if(!u&&(e.answer?.length??0)>0)return v(n,"--answer rides --mode agent: the blast-radius question is asked on the stream and answered on the next call. In a terminal, answer the prompt instead"),2;let s=x(i,n);if(!s)return 2;let a=()=>h(E(p(s))).targets.length===0;if(!e.yes&&!n.isTTY&&!u&&!(e.fromStale&&a()))return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless, run with --mode agent (the question rides the stream and is answered with --answer on the next call) or let kane-cli maintain reconcile drive it"),2;let d=u?b(e.answer):null,m=t.emitEvent;return C(p(s),{...o?{ref:o}:{},...e.because?{because:e.because}:{},...e.mode?{mode:e.mode}:{},...e.yes?{yes:!0}:{}},{io:n,asks:{blast:d??{ask:async(c,l)=>await n.confirm(`proceed with the re-design of ${l}?`)?"proceed":"decline"}},runDesign:t.runDesignForUc??I,...t.onChild?{onChild:t.onChild}:!m&&n.isTTY?{onChild:$(n)}:{},...m?{emit:m}:{},by:{kind:"human",id:process.env.USER??"operator"}})}function $(o){let e="",n="evolve";return t=>{t.kind==="start"?(e=t.subject,n=t.verb,o.out(`\u25CF ${y(t.verb).ing} ${t.subject}`)):t.kind==="end"&&o.out(t.ok?`\u25CF ${y(n).ed} ${e} \u2014 ${t.durS}s`:`\u25CF ${n} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}${t.fixCmd?` \xB7 ${t.fixCmd}`:""}`)}}var I=async(o,e)=>{let{designTestsCommand:n}=await import("./bind-4XWK3DG2.js"),t=a=>n({useCase:o,force:!0,...e.mode?{mode:e.mode}:e.yes?{mode:"override"}:{},...e.because?{because:e.because}:{},...e.changeDelta!==void 0?{changeDelta:e.changeDelta}:{},...e.priorDesign!==void 0?{priorDesign:e.priorDesign}:{},...e.repinsKept?{repinsKept:!0}:{},...e.statement?{statement:e.statement}:{},...a?{onEvent:a}:{}});if(e.mode!=="agent")return t(e.onChildEvent);let i=e.onChildEvent,u=process.stdout.write,s="";process.stdout.write=((a,d,m)=>{if(i){s+=typeof a=="string"?a:Buffer.isBuffer(a)?a.toString("utf8"):String(a);let l=s.indexOf(`
3
3
  `);for(;l>=0;)S(s.slice(0,l),i),s=s.slice(l+1),l=s.indexOf(`
4
- `)}let c=typeof d=="function"?d:m;return typeof c=="function"&&queueMicrotask(()=>c(null)),!0});try{return await t()}finally{process.stdout.write=u,i&&s.length>0&&S(s,i)}};function S(o,e){let n=o.trim();if(!n.startsWith("{"))return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t!="object"||typeof t.type!="string")return;let i=t;i.type!=="done"&&e(i)}async function B(o,e,n={},t,i=process.cwd()){if(!t&&i===process.cwd()){let{remoteEntry:d}=await import("./remote-entry-YL7O2NJQ.js"),m=await d("maintain evolve",e.mode==="agent");if(m!==null){if("exit"in m)return m.exit;let{remoteEvolve:c}=await import("./evolve-remote-BGHULJTL.js");return c({choice:m.choice,...o!==void 0?{ref:o}:{},opts:e})}}let{makeHeadlessIO:u,agentRefusal:s}=await import("./headless-io-FFM5T6KL.js");if(e.mode!==void 0&&e.mode!=="interactive"&&e.mode!=="agent")return s(u("ndjson","evolve",t),`--mode must be interactive | agent, got '${e.mode}'`,"MODE_USAGE");if(e.mode==="agent"){let d=process.stdout.write.bind(process.stdout),m=process.stderr.write.bind(process.stderr),c=u("ndjson","evolve",t??{stdout:r=>{d(r)},stderr:r=>{m(r)}}),l=[],D=r=>{(r.type==="evolve_paused"||r.type==="session_paused")&&Array.isArray(r.next)&&l.push(...r.next),c.event(r)},k={out:c.out,err:(r,w)=>c.event({type:"error",message:r,...w?{code:w}:{}}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:T}=await import("./run-channel-63SVP5OI.js"),f=2;try{f=await T({event:r=>c.event(r)},()=>O(o,e,k,{...n,emitEvent:D},i))}catch(r){f=1,c.event({type:"error",message:r instanceof Error?r.message:String(r)})}return c.done(f,void 0,l.length>0?l:void 0)}let a=t?{...g(),out:d=>t.stdout(`${d}
4
+ `)}let c=typeof d=="function"?d:m;return typeof c=="function"&&queueMicrotask(()=>c(null)),!0});try{return await t()}finally{process.stdout.write=u,i&&s.length>0&&S(s,i)}};function S(o,e){let n=o.trim();if(!n.startsWith("{"))return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t!="object"||typeof t.type!="string")return;let i=t;i.type!=="done"&&e(i)}async function B(o,e,n={},t,i=process.cwd()){if(!t&&i===process.cwd()){let{remoteEntry:d}=await import("./remote-entry-X6JMPC2K.js"),m=await d("maintain evolve",e.mode==="agent");if(m!==null){if("exit"in m)return m.exit;let{remoteEvolve:c}=await import("./evolve-remote-WLVY3QID.js");return c({choice:m.choice,...o!==void 0?{ref:o}:{},opts:e})}}let{makeHeadlessIO:u,agentRefusal:s}=await import("./headless-io-FFM5T6KL.js");if(e.mode!==void 0&&e.mode!=="interactive"&&e.mode!=="agent")return s(u("ndjson","evolve",t),`--mode must be interactive | agent, got '${e.mode}'`,"MODE_USAGE");if(e.mode==="agent"){let d=process.stdout.write.bind(process.stdout),m=process.stderr.write.bind(process.stderr),c=u("ndjson","evolve",t??{stdout:r=>{d(r)},stderr:r=>{m(r)}}),l=[],D=r=>{(r.type==="evolve_paused"||r.type==="session_paused")&&Array.isArray(r.next)&&l.push(...r.next),c.event(r)},k={out:c.out,err:(r,w)=>c.event({type:"error",message:r,...w?{code:w}:{}}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:T}=await import("./run-channel-63SVP5OI.js"),f=2;try{f=await T({event:r=>c.event(r)},()=>O(o,e,k,{...n,emitEvent:D},i))}catch(r){f=1,c.event({type:"error",message:r instanceof Error?r.message:String(r)})}return c.done(f,void 0,l.length>0?l:void 0)}let a=t?{...g(),out:d=>t.stdout(`${d}
5
5
  `),err:d=>t.stderr(`${d}
6
6
  `),isTTY:!1}:g();return O(o,e,a,n,i)}export{O as a,I as b,S as c,B as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{h as m,i as h,j as _,o as w,p as E,q as l,r as f,s as u,t as d,u as x}from"./chunk-2SWSVJUP.js";import{a as g,b as y}from"./chunk-KGNE5CIM.js";function C(t,e){let r=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;if(t.code==="TOO_SOON")return`${r!==null?`in ${Math.max(1,Math.ceil(r/60))} min, `:"later, "}kane-cli explore context sync ${e}`;if(t.code==="CONTEXT_OFF")return`kane-cli explore context on ${e}`}async function b(t,e,r){if(r.out&&!r.projectNames)return;let s=await new y({baseUrl:t.controllerBaseUrl,auth:t.basic,timeoutMs:w}).viewSummary(e),n=typeof s?.project_id=="string"?s.project_id:"";if(n)return(await E(r,t)([n]))[n]??n.slice(0,8)}function k(t){let e=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;return t.code==="TOO_SOON"&&e!==null?`TOO_SOON: the last cut was taken too recently (a run's end takes one too); the next can start in ${Math.max(1,Math.ceil(e/60))} min`:t.code==="CONTEXT_OFF"?`CONTEXT_OFF: assurance context is off for this exploration${typeof t.body?.off_reason=="string"?` (${t.body.off_reason})`:""}; turn it on with explore context on`:u(t)}async function N(t,e,r,s={}){let n=f(s,e,r),i=await l(r,`explore context ${t}`);if(!i.ok)return n.fail(i.error);let a=d(i);try{if(t==="sync"){let o=await a.syncContext(e);if(!n.tty)n.event({type:"explore_context_sync",exploration_id:e,state:o.state,job_id:o.job_id??null,cut:o.cut??null,trigger:o.trigger??null,running_job_id:o.running_job_id??null,hx_job_link:o.hx_job_link??null,...o.state==="failed"?{error:o.error??null}:{}});else if(o.state!=="failed")for(let O of h(e,o))n.out(O);return o.state==="failed"?n.fail(T(e,o),1,j(e,o)):n.ok()}let c=t==="status"?await a.getContext(e):await a.setContext(e,t==="on");if(!n.tty)n.event({type:"explore_context",exploration_id:e,action:t,context:c});else if(t==="status")for(let o of m(c,{project:await b(i,e,s)}))n.out(o);else for(let o of _(e,c,t,await b(i,e,s)))n.out(o);return n.ok()}catch(c){let o=A(c,t,e);return n.fail(o.message,o.code,o.next)}}function A(t,e,r){if(t instanceof g){if(t.code==="NO_ENDED_RUN")return{message:"NO_ENDED_RUN: no run of this exploration has ended yet; the first assurance job runs when one ends",code:1,next:"run it first: kane-cli explore run \u2026, then sync"};if(t.status===404)return{message:`exploration ${r} not found, or this service has no assurance context yet`,code:2};if(t.status===501)return{message:`this service has no assurance context yet (exploration ${r})`,code:2};if(t.code==="NOT_CONFIGURED")return{message:"NOT_CONFIGURED: assurance jobs are not set up on this service (no HyperExecute or report URL); context stays on and runs once they are",code:1};if(t.status===401||t.status===403)return{message:u(t),code:2};if(t.status<500){let s=C(t,r);return{message:k(t),code:1,...s?{next:s}:{}}}}return{message:`could not ${e==="status"?"read":e==="sync"?"sync":"change"} the assurance context: ${u(t)}`,code:1}}function T(t,e){return`${e.error?.code??"LAUNCH_FAILED"}: the assurance job could not launch${e.error?.message?` (${e.error.message})`:""}; explore context status ${t} shows it`}function j(t,e){let r=e.error?.code??"LAUNCH_FAILED";return`try again: kane-cli explore context sync ${t}${r==="HX_TRIGGER_FAILED"?"; or run with --local-orchestration":""}`}var $="usage: kane-cli explore context <status|on|off|sync> <exploration-id> (or explore context <exploration-id> on a terminal for the panel)";async function F(t,e,r={}){let s=f(r,t??null,e);if(!s.tty||!t)return s.fail($);let n=await l(e,"explore context");if(!n.ok)return s.fail(n.error);let{runContextPanel:i}=await import("./explore-context-tty-JTZVZFOE.js"),a=typeof e.env=="string"?e.env:"prod";return await i({client:d(n),explorationId:t,env:a})==="exit"?130:0}function p(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function U(t){let e=x(t.command("context").description("An exploration's assurance context (on by default): on, off, status, sync; with only the id, the panel on a terminal").argument("[exploration-id]","The exploration (no action: the context panel on a terminal)")).action(async(s,n)=>{process.exitCode=await F(s,p(n))}),r=[["status","Whether context is on, what is pending or running, and what the last assurance job did"],["on","Turn assurance context on (catches up from the newest ended run)"],["off","Turn assurance context off: the next cut is skipped; nothing already saved is deleted"],["sync","Ask for an assurance job now: launched, pending behind a running job, or up to date"]];for(let[s,n]of r)x(e.command(s).description(n).argument("<exploration-id>","The exploration")).action(async(i,a)=>{process.exitCode=await N(s,i,{...p(e.opts()),...p(a)})})}export{A as a,T as b,U as c};
2
+ import{h as m,i as h,j as _,o as w,p as E,q as l,r as f,s as u,t as d,u as x}from"./chunk-OCDBTAYS.js";import{a as g,b as y}from"./chunk-KGNE5CIM.js";function C(t,e){let r=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;if(t.code==="TOO_SOON")return`${r!==null?`in ${Math.max(1,Math.ceil(r/60))} min, `:"later, "}kane-cli explore context sync ${e}`;if(t.code==="CONTEXT_OFF")return`kane-cli explore context on ${e}`}async function b(t,e,r){if(r.out&&!r.projectNames)return;let s=await new y({baseUrl:t.controllerBaseUrl,auth:t.basic,timeoutMs:w}).viewSummary(e),n=typeof s?.project_id=="string"?s.project_id:"";if(n)return(await E(r,t)([n]))[n]??n.slice(0,8)}function k(t){let e=typeof t.body?.retry_after_s=="number"?t.body.retry_after_s:null;return t.code==="TOO_SOON"&&e!==null?`TOO_SOON: the last cut was taken too recently (a run's end takes one too); the next can start in ${Math.max(1,Math.ceil(e/60))} min`:t.code==="CONTEXT_OFF"?`CONTEXT_OFF: assurance context is off for this exploration${typeof t.body?.off_reason=="string"?` (${t.body.off_reason})`:""}; turn it on with explore context on`:u(t)}async function N(t,e,r,s={}){let n=f(s,e,r),i=await l(r,`explore context ${t}`);if(!i.ok)return n.fail(i.error);let a=d(i);try{if(t==="sync"){let o=await a.syncContext(e);if(!n.tty)n.event({type:"explore_context_sync",exploration_id:e,state:o.state,job_id:o.job_id??null,cut:o.cut??null,trigger:o.trigger??null,running_job_id:o.running_job_id??null,hx_job_link:o.hx_job_link??null,...o.state==="failed"?{error:o.error??null}:{}});else if(o.state!=="failed")for(let O of h(e,o))n.out(O);return o.state==="failed"?n.fail(T(e,o),1,j(e,o)):n.ok()}let c=t==="status"?await a.getContext(e):await a.setContext(e,t==="on");if(!n.tty)n.event({type:"explore_context",exploration_id:e,action:t,context:c});else if(t==="status")for(let o of m(c,{project:await b(i,e,s)}))n.out(o);else for(let o of _(e,c,t,await b(i,e,s)))n.out(o);return n.ok()}catch(c){let o=A(c,t,e);return n.fail(o.message,o.code,o.next)}}function A(t,e,r){if(t instanceof g){if(t.code==="NO_ENDED_RUN")return{message:"NO_ENDED_RUN: no run of this exploration has ended yet; the first assurance job runs when one ends",code:1,next:"run it first: kane-cli explore run \u2026, then sync"};if(t.status===404)return{message:`exploration ${r} not found, or this service has no assurance context yet`,code:2};if(t.status===501)return{message:`this service has no assurance context yet (exploration ${r})`,code:2};if(t.code==="NOT_CONFIGURED")return{message:"NOT_CONFIGURED: assurance jobs are not set up on this service (no HyperExecute or report URL); context stays on and runs once they are",code:1};if(t.status===401||t.status===403)return{message:u(t),code:2};if(t.status<500){let s=C(t,r);return{message:k(t),code:1,...s?{next:s}:{}}}}return{message:`could not ${e==="status"?"read":e==="sync"?"sync":"change"} the assurance context: ${u(t)}`,code:1}}function T(t,e){return`${e.error?.code??"LAUNCH_FAILED"}: the assurance job could not launch${e.error?.message?` (${e.error.message})`:""}; explore context status ${t} shows it`}function j(t,e){let r=e.error?.code??"LAUNCH_FAILED";return`try again: kane-cli explore context sync ${t}${r==="HX_TRIGGER_FAILED"?"; or run with --local-orchestration":""}`}var $="usage: kane-cli explore context <status|on|off|sync> <exploration-id> (or explore context <exploration-id> on a terminal for the panel)";async function F(t,e,r={}){let s=f(r,t??null,e);if(!s.tty||!t)return s.fail($);let n=await l(e,"explore context");if(!n.ok)return s.fail(n.error);let{runContextPanel:i}=await import("./explore-context-tty-RZ7D2TBV.js"),a=typeof e.env=="string"?e.env:"prod";return await i({client:d(n),explorationId:t,env:a})==="exit"?130:0}function p(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function U(t){let e=x(t.command("context").description("An exploration's assurance context (on by default): on, off, status, sync; with only the id, the panel on a terminal").argument("[exploration-id]","The exploration (no action: the context panel on a terminal)")).action(async(s,n)=>{process.exitCode=await F(s,p(n))}),r=[["status","Whether context is on, what is pending or running, and what the last assurance job did"],["on","Turn assurance context on (catches up from the newest ended run)"],["off","Turn assurance context off: the next cut is skipped; nothing already saved is deleted"],["sync","Ask for an assurance job now: launched, pending behind a running job, or up to date"]];for(let[s,n]of r)x(e.command(s).description(n).argument("<exploration-id>","The exploration")).action(async(i,a)=>{process.exitCode=await N(s,i,{...p(e.opts()),...p(a)})})}export{A as a,T as b,U as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{y as l}from"./chunk-I6OQISK4.js";import{e as y}from"./chunk-UR6MHSHU.js";var o=y($(),1);function L(a){let c=a.findIndex(m=>m.free);return c>=0?c:null}var v=60,A=100;function N({headline:a,ask:c=!1,rows:m,sel:u,focused:x,freeText:n=null,freeTextNote:d,sublines:B=[],gapAbove:p=!0,accent:s=l.assuranceAccent}){let{stdout:C}=O(),b=C?.columns??80,S=b<v,F=Math.min(b-1,A),f=e=>x&&u===e?(0,o.jsx)(t,{color:s,children:"\u276F"}):" ",T=c?`? ${a}`:a,g=Math.max(4,F-3),R=B.map((e,r)=>(0,o.jsx)(t,{color:l.dim,children:` ${e.length>g?`${e.slice(0,g-1)}\u2026`:e}`},`sub-${r}`)),k=0,w=m.map((e,r)=>e.free?n?(0,o.jsxs)(i,{flexDirection:"column",children:[(0,o.jsxs)(i,{children:[(0,o.jsxs)(t,{children:[(0,o.jsx)(t,{color:s,children:"\u276F"})," ",(0,o.jsx)(t,{color:l.dim,children:"\u270E "})]}),n.keysFromPanel?(0,o.jsx)(P,{value:n.value,placeholder:e.label}):(0,o.jsx)(h,{value:n.value,onChange:n.onChange,onSubmit:n.onSubmit,onCancel:n.onCancel,placeholder:e.label})]}),d?(0,o.jsx)(t,{color:l.muted,children:` ${d}`}):null]},e.key):(0,o.jsxs)(t,{children:[f(r)," ",(0,o.jsx)(t,{color:l.dim,children:`\u270E ${e.label}`})]},e.key):(k+=1,(0,o.jsxs)(t,{bold:x&&u===r,children:[f(r),` ${k}. ${e.label}`,e.detail?(0,o.jsx)(t,{color:l.dim,bold:!1,children:` \u2014 ${e.detail}`}):null]},e.key)));return S?(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,w]}):(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,(0,o.jsx)(t,{children:" "}),w]})}export{L as a,N as b};
2
+ import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{y as l}from"./chunk-D36V5OX6.js";import{e as y}from"./chunk-UR6MHSHU.js";var o=y($(),1);function L(a){let c=a.findIndex(m=>m.free);return c>=0?c:null}var v=60,A=100;function N({headline:a,ask:c=!1,rows:m,sel:u,focused:x,freeText:n=null,freeTextNote:d,sublines:B=[],gapAbove:p=!0,accent:s=l.assuranceAccent}){let{stdout:C}=O(),b=C?.columns??80,S=b<v,F=Math.min(b-1,A),f=e=>x&&u===e?(0,o.jsx)(t,{color:s,children:"\u276F"}):" ",T=c?`? ${a}`:a,g=Math.max(4,F-3),R=B.map((e,r)=>(0,o.jsx)(t,{color:l.dim,children:` ${e.length>g?`${e.slice(0,g-1)}\u2026`:e}`},`sub-${r}`)),k=0,w=m.map((e,r)=>e.free?n?(0,o.jsxs)(i,{flexDirection:"column",children:[(0,o.jsxs)(i,{children:[(0,o.jsxs)(t,{children:[(0,o.jsx)(t,{color:s,children:"\u276F"})," ",(0,o.jsx)(t,{color:l.dim,children:"\u270E "})]}),n.keysFromPanel?(0,o.jsx)(P,{value:n.value,placeholder:e.label}):(0,o.jsx)(h,{value:n.value,onChange:n.onChange,onSubmit:n.onSubmit,onCancel:n.onCancel,placeholder:e.label})]}),d?(0,o.jsx)(t,{color:l.muted,children:` ${d}`}):null]},e.key):(0,o.jsxs)(t,{children:[f(r)," ",(0,o.jsx)(t,{color:l.dim,children:`\u270E ${e.label}`})]},e.key):(k+=1,(0,o.jsxs)(t,{bold:x&&u===r,children:[f(r),` ${k}. ${e.label}`,e.detail?(0,o.jsx)(t,{color:l.dim,bold:!1,children:` \u2014 ${e.detail}`}):null]},e.key)));return S?(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,w]}):(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,(0,o.jsx)(t,{children:" "}),w]})}export{L as a,N as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as vs,b as ws,c as Is,d as ks,e as _s,f as Ss}from"./chunk-DNGOT65K.js";import{R as Ls}from"./chunk-432ZOE42.js";import{a as jr,b as fs,c as ps,d as Mt,e as ut,f as gs,g as Rs,h as $r,i as Mr,j as Vr,k as Cs,l as Es}from"./chunk-RW3Z2HMB.js";import{a as as}from"./chunk-WD52ZNQY.js";import{a as mt,b as hs,c as Fr}from"./chunk-BHSHGWBL.js";import{c as ys}from"./chunk-S3DAAAE5.js";import{f as Nr,h as Ur,i as Br}from"./chunk-K45BKGB5.js";import{k as As}from"./chunk-QTZBVDPR.js";import{d as xs}from"./chunk-2S3W2JT3.js";import{a as xr}from"./chunk-W3USRQX6.js";import{b as Kr,c as Hr}from"./chunk-RFEON5GN.js";import{a as Ot}from"./chunk-72KYMWQ5.js";import{a as _o,b as So,c as Ro,d as Co,e as Eo,f as Ao,g as wr,i as xo}from"./chunk-JQ64X2TO.js";import{d as $t,e as ms}from"./chunk-MII3JOO3.js";import{b as ds,c as Pr,d as Tr,e as Dr,f as he,g as Lr,i as Or,k as us}from"./chunk-JGRXMTME.js";import{a as ct,b as X,c as ss,e as we,f as Ye,g as Ar,k as is}from"./chunk-77ZZQJLX.js";import{a as ls}from"./chunk-UTM7D4PI.js";import{a as yo,b as bo,c as Nt,e as Ut,f as _r}from"./chunk-OEWYXCTA.js";import{a as jt,c as Lo,d as Oo,e as Ft,f as jo}from"./chunk-I2KOGINW.js";import{A as Vo,B as Ko,D as Sr,E as Ho,G as zo,I as Jo,J as Qo,K as Zo,M as Xo,N as es,W as ts,X as rs,ba as ns,ca as os,h as Bt,u as Bo,v as $o,z as Mo}from"./chunk-EXFDIVNI.js";import{a as Uo}from"./chunk-DREQ3RAA.js";import{c as Go,d as qo}from"./chunk-FIP5L6LV.js";import{a as Yo}from"./chunk-R7KXAISS.js";import{c as Fo,e as No}from"./chunk-IINZZ4BZ.js";import{d as Cr}from"./chunk-XMPTFXPW.js";import{a as Rr}from"./chunk-73Y6T2UK.js";import{g as Po,h as To}from"./chunk-IMDMRJQ6.js";import{f as lo,i as co,j as uo}from"./chunk-7RPKHKA3.js";import{a as fo,b as go,d as ho}from"./chunk-DD5TULWQ.js";import{e as po}from"./chunk-T4AVLJCW.js";import{h as mo}from"./chunk-5D7ENQTQ.js";import{a as vo,b as wo,d as Io,e as ko}from"./chunk-UAWWLLTI.js";import{a as vr}from"./chunk-Y6Y6RAY4.js";import{d as dt}from"./chunk-C6HI6Y3S.js";import{a as to}from"./chunk-Z7S3IWUX.js";import{d as ro}from"./chunk-4JOD47QI.js";import{a as Fe}from"./chunk-FCD3NYOM.js";import{a as no}from"./chunk-3G2LSTK5.js";import{a as bs}from"./chunk-4IEQNX7F.js";import{c as Ps,h as Ts,i as Ds}from"./chunk-GRURFGBP.js";import{c as cs}from"./chunk-MYZHOBS4.js";import{Ha as Er,s as Wo}from"./chunk-W3OVSDBN.js";import{a as Zn}from"./chunk-RPRXRKKR.js";import{a as Ir}from"./chunk-NWBLYMH7.js";import{a as kr}from"./chunk-QSCXXNC2.js";import{a as Do}from"./chunk-VO66KP2W.js";import{j as oo,m as so,n as Lt,o as io,p as ao}from"./chunk-NC7D7GOM.js";import{a as ae}from"./chunk-MGNRNLBE.js";import{a as Dt}from"./chunk-4QTH7VYE.js";import{a as ve}from"./chunk-RZ4F3BHX.js";import{a as Xn}from"./chunk-E47GFYXA.js";import{e as br,f as lt,p as eo}from"./chunk-A7RJQJNT.js";import{a as Pt,b as Tt,i as Qn,j as ze}from"./chunk-I6OQISK4.js";import{join as ke,basename as Me}from"path";import{existsSync as el,readFileSync as $i}from"fs";function Os(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let n=e.steps[r],o=t[r],s=" ".repeat(n.trace.length-1),d=`step ${n.flatIndex}`;if(o.kind==="replay"){let p=o.replayOnly?` [replay-only @${o.replayOnly}]`:"";process.stderr.write(`[replay-trace] ${s}${d}: REPLAY${p} (would skip; v1 always authors)
2
+ import{a as vs,b as ws,c as Is,d as ks,e as _s,f as Ss}from"./chunk-Y7E5L42F.js";import{R as Ls}from"./chunk-MEKPGQAM.js";import{a as jr,b as fs,c as ps,d as Mt,e as ut,f as gs,g as Rs,h as $r,i as Mr,j as Vr,k as Cs,l as Es}from"./chunk-XZGEN4NU.js";import{a as as}from"./chunk-WD52ZNQY.js";import{a as mt,b as hs,c as Fr}from"./chunk-BHSHGWBL.js";import{c as ys}from"./chunk-S3DAAAE5.js";import{f as Nr,h as Ur,i as Br}from"./chunk-YAW6JW6D.js";import{k as As}from"./chunk-HCJ2N3XB.js";import{d as xs}from"./chunk-IUQOG7Z5.js";import{a as xr}from"./chunk-W3USRQX6.js";import{b as Kr,c as Hr}from"./chunk-RFEON5GN.js";import{a as Ot}from"./chunk-72KYMWQ5.js";import{a as _o,b as So,c as Ro,d as Co,e as Eo,f as Ao,g as wr,i as xo}from"./chunk-JQ64X2TO.js";import{d as $t,e as ms}from"./chunk-NZ6AV2TA.js";import{b as ds,c as Pr,d as Tr,e as Dr,f as he,g as Lr,i as Or,k as us}from"./chunk-JGRXMTME.js";import{a as ct,b as X,c as ss,e as we,f as Ye,g as Ar,k as is}from"./chunk-77ZZQJLX.js";import{a as ls}from"./chunk-UTM7D4PI.js";import{a as yo,b as bo,c as Nt,e as Ut,f as _r}from"./chunk-CCP4X75B.js";import{a as jt,c as Lo,d as Oo,e as Ft,f as jo}from"./chunk-WXJCJL5L.js";import{A as Vo,B as Ko,D as Sr,E as Ho,G as zo,I as Jo,J as Qo,K as Zo,M as Xo,N as es,W as ts,X as rs,ba as ns,ca as os,h as Bt,u as Bo,v as $o,z as Mo}from"./chunk-W54OT2FU.js";import{a as Uo}from"./chunk-DREQ3RAA.js";import{c as Go,d as qo}from"./chunk-FIP5L6LV.js";import{a as Yo}from"./chunk-R7KXAISS.js";import{c as Fo,e as No}from"./chunk-IINZZ4BZ.js";import{d as Cr}from"./chunk-XMPTFXPW.js";import{a as Rr}from"./chunk-73Y6T2UK.js";import{g as Po,h as To}from"./chunk-KXHJMAZU.js";import{f as lo,i as co,j as uo}from"./chunk-LQQNPMOD.js";import{a as fo,b as go,d as ho}from"./chunk-4QFTHUJA.js";import{e as po}from"./chunk-FWUPJORV.js";import{h as mo}from"./chunk-5D7ENQTQ.js";import{a as vo,b as wo,d as Io,e as ko}from"./chunk-EBPRPNSA.js";import{a as vr}from"./chunk-Y6Y6RAY4.js";import{d as dt}from"./chunk-C6HI6Y3S.js";import{a as to}from"./chunk-Z7S3IWUX.js";import{d as ro}from"./chunk-4JOD47QI.js";import{a as Fe}from"./chunk-FCD3NYOM.js";import{a as no}from"./chunk-3G2LSTK5.js";import{a as bs}from"./chunk-4IEQNX7F.js";import{c as Ps,h as Ts,i as Ds}from"./chunk-GRURFGBP.js";import{c as cs}from"./chunk-MYZHOBS4.js";import{Ha as Er,s as Wo}from"./chunk-7HMSMAUG.js";import{a as Zn}from"./chunk-RPRXRKKR.js";import{a as Ir}from"./chunk-DJC7NTLA.js";import{a as kr}from"./chunk-QSCXXNC2.js";import{a as Do}from"./chunk-VO66KP2W.js";import{j as oo,m as so,n as Lt,o as io,p as ao}from"./chunk-NC7D7GOM.js";import{a as ae}from"./chunk-C2RUDJ46.js";import{a as Dt}from"./chunk-4QTH7VYE.js";import{a as ve}from"./chunk-RZ4F3BHX.js";import{a as Xn}from"./chunk-E47GFYXA.js";import{e as br,f as lt,p as eo}from"./chunk-A7RJQJNT.js";import{a as Pt,b as Tt,i as Qn,j as ze}from"./chunk-D36V5OX6.js";import{join as ke,basename as Me}from"path";import{existsSync as el,readFileSync as $i}from"fs";function Os(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let n=e.steps[r],o=t[r],s=" ".repeat(n.trace.length-1),d=`step ${n.flatIndex}`;if(o.kind==="replay"){let p=o.replayOnly?` [replay-only @${o.replayOnly}]`:"";process.stderr.write(`[replay-trace] ${s}${d}: REPLAY${p} (would skip; v1 always authors)
3
3
  `)}else process.stderr.write(`[replay-trace] ${s}${d}: AUTHOR (${o.reason})
4
4
  `)}}function Ne(e){process.env.KANE_REPLAY_TRACE==="1"&&process.stderr.write(e)}function js(e,t){let r=e===0?"(none)":`0..${e-1}`,n=e>=t?"(none)":`${e}..${t-1}`;Ne(`[replay-trace] phase: replay ${r}, author ${n}
5
5
  `)}function Fs(e,t){Ne(`[replay-trace] step ${e}: REPLAY ${t==="ok"?"OK":"FAILED"}
@@ -69,8 +69,8 @@ ${a.message}`:a.message;process.stderr.write(`error: mobile target preparation f
69
69
  `);else if(Hn&&($||b.isFirstRun))process.stderr.write(`note: --no-evidence-publish has no effect on author/commit runs
70
70
  `);else if(qn){let a=c.basicAuth,u=O,f=G,y=await Oi({controller:new Fe(h.controllerBaseUrl,{username:a.username,accessKey:a.access_key}),tms:new dt(h.tmsBaseUrl,c.resolvedCreds?.username??a.username,c.resolvedCreds?.access_key??a.access_key),testId:Gn,sessionId:l.sessionId,executionId:u.executionId,sealedPackPath:Q.pack,projectId:f});gr||=y.ok,y.ok?l.log("info","EVIDENCE_INGESTED","Replay evidence uploaded and ingested",{execution_id:u.executionId,project_id:f}):(l.log("warn","EVIDENCE_PUBLISH_FAILED","Replay evidence publish failed",{execution_id:u.executionId,stage:y.stage,error:y.error}),process.stderr.write(` \u26A0 evidence publish failed (${y.stage}): ${y.error}
71
71
  `)),t.onAgentEvent({type:"test_md_evidence_ingest",status:y.ok?"ok":"failed",evidence_id:u.executionId,...y.ok?{}:{stage:y.stage}})}if(fn=!0,await dl(n,b,l,te.outcomes,te.overallStatus,kt,Pe,ie.uploadResult,K,s,{resolvedAuth:c,tmsBaseUrl:h.tmsBaseUrl},$,me,gt.committed),b.isFirstRun&&s.testmdSync!==!1)try{let a=he(n);if(ms({shouldUploadPipeline:Ct,uploadSucceeded:!!ie.uploadResult?.success,metaCommitId:a?.commit_id,metaTestId:a?.test_id})){let u=await $t({sourcePath:n,testId:a.test_id,sessionId:l.sessionId,commitId:a.commit_id,controller:new Fe(h.controllerBaseUrl,{username:c.basicAuth.username,accessKey:c.basicAuth.access_key})});u.ok?l.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:a.commit_id,bytes:u.bytes}):(l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:a.commit_id,stage:u.stage,error:u.error}),process.stderr.write(` \u26A0 bundle sync failed (${u.stage}): ${u.error}
72
- `)),t.onAgentEvent({type:"test_md_bundle_sync",status:u.ok?"ok":"failed",commit_id:a.commit_id,path:n,...u.ok?{bytes:u.bytes}:{stage:u.stage}})}}catch(a){l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{error:a instanceof Error?a.message:String(a)})}else b.isFirstRun&&l.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:"flag"});let zn=ae(m),Et=ie.uploadResult?.testcaseId,At=Et&&ie.uploadResult?.shareId&&G?Gt(zn.testManagerUiUrl,G,Et,ie.uploadResult.shareId):void 0,Zi=i.unitFiles.filter(a=>a.file!==i.rootPath).map(a=>{let u=i.steps.filter(g=>g.owningFile===a.file),f=u.filter(g=>ht.has(g.flatIndex)).length,w=(a.kind==="test"?he(a.file):null)?.commit_id===l.sessionId;return{path:a.file,kind:a.kind,replayed:u.length-f,authored:f,committed:w,...w?{commit_id:l.sessionId}:{}}}),Yn={overallStatus:te.overallStatus,durationS:Pe,creditsConsumed:Ve,decisions:b.decisions,outcomes:te.outcomes,cancelled:me,retryTriggered:yt,lockHeld:$,anyAuthorStepRan:pe,isFirstRun:b.isFirstRun,wantsPush:s.push===!0,uploadResult:ie.uploadResult,shouldUploadArtifacts:He,shouldReplaceLocalOutput:pe&&!me,shouldCommit:($||b.isFirstRun)&&!me&&te.overallStatus==="passed"&&!b.degradedReadonly,committed:gt.committed,...(C.kind==="attach"||C.kind==="run")&&(C.tc??Le)?{caseTc:C.tc??Le}:{},degradedReadonly:b.degradedReadonly,shareUrl:At,imports:Zi},{buildSummaryEvent:Xi}=await import("./SummaryBox-FALOODAQ.js");d?t.onAgentEvent(Xi(Yn)):await t.onSummary(Yn);let Wn=ie.uploadResult?.notSaved===!0;if(!d){let a=Et&&G?oi(zn.testManagerUiUrl,G,Et):void 0;await t.onLinks({recordedTestPath:n,outputDir:X(n),shareableLink:At,testCaseLink:a,codeExportDir:ie.uploadResult?.codeExportDir})}let hr=!d&&!me&&!!process.stdin.isTTY&&!!process.stderr.isTTY,Jn=()=>{if(!Wn)return;let a=Ni(process.cwd(),n);Vi(Er.testRunNotSaved(C.kind==="attach"?C.tc:null,te.overallStatus==="passed",a.startsWith("..")?n:a),{isAgent:d,host:t})};hr&&Jn();let it=!e.suppressEvidenceOffer&&Q?Re:void 0;if(re.ownsLifecycle&&Q&&Kn&&!e.suppressEvidenceOffer){for(let u of Ti(it))process.stderr.write(u+`
73
- `);let{offerEvidenceView:a}=await import("./evidence-LVVK7ROT.js");await a({packPath:Q.pack,env:m,isTTY:hr,log:u=>process.stderr.write(u+`
72
+ `)),t.onAgentEvent({type:"test_md_bundle_sync",status:u.ok?"ok":"failed",commit_id:a.commit_id,path:n,...u.ok?{bytes:u.bytes}:{stage:u.stage}})}}catch(a){l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{error:a instanceof Error?a.message:String(a)})}else b.isFirstRun&&l.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:"flag"});let zn=ae(m),Et=ie.uploadResult?.testcaseId,At=Et&&ie.uploadResult?.shareId&&G?Gt(zn.testManagerUiUrl,G,Et,ie.uploadResult.shareId):void 0,Zi=i.unitFiles.filter(a=>a.file!==i.rootPath).map(a=>{let u=i.steps.filter(g=>g.owningFile===a.file),f=u.filter(g=>ht.has(g.flatIndex)).length,w=(a.kind==="test"?he(a.file):null)?.commit_id===l.sessionId;return{path:a.file,kind:a.kind,replayed:u.length-f,authored:f,committed:w,...w?{commit_id:l.sessionId}:{}}}),Yn={overallStatus:te.overallStatus,durationS:Pe,creditsConsumed:Ve,decisions:b.decisions,outcomes:te.outcomes,cancelled:me,retryTriggered:yt,lockHeld:$,anyAuthorStepRan:pe,isFirstRun:b.isFirstRun,wantsPush:s.push===!0,uploadResult:ie.uploadResult,shouldUploadArtifacts:He,shouldReplaceLocalOutput:pe&&!me,shouldCommit:($||b.isFirstRun)&&!me&&te.overallStatus==="passed"&&!b.degradedReadonly,committed:gt.committed,...(C.kind==="attach"||C.kind==="run")&&(C.tc??Le)?{caseTc:C.tc??Le}:{},degradedReadonly:b.degradedReadonly,shareUrl:At,imports:Zi},{buildSummaryEvent:Xi}=await import("./SummaryBox-IA2KS6GT.js");d?t.onAgentEvent(Xi(Yn)):await t.onSummary(Yn);let Wn=ie.uploadResult?.notSaved===!0;if(!d){let a=Et&&G?oi(zn.testManagerUiUrl,G,Et):void 0;await t.onLinks({recordedTestPath:n,outputDir:X(n),shareableLink:At,testCaseLink:a,codeExportDir:ie.uploadResult?.codeExportDir})}let hr=!d&&!me&&!!process.stdin.isTTY&&!!process.stderr.isTTY,Jn=()=>{if(!Wn)return;let a=Ni(process.cwd(),n);Vi(Er.testRunNotSaved(C.kind==="attach"?C.tc:null,te.overallStatus==="passed",a.startsWith("..")?n:a),{isAgent:d,host:t})};hr&&Jn();let it=!e.suppressEvidenceOffer&&Q?Re:void 0;if(re.ownsLifecycle&&Q&&Kn&&!e.suppressEvidenceOffer){for(let u of Ti(it))process.stderr.write(u+`
73
+ `);let{offerEvidenceView:a}=await import("./evidence-P6FFKC7B.js");await a({packPath:Q.pack,env:m,isTTY:hr,log:u=>process.stderr.write(u+`
74
74
  `)})}return hr||Jn(),it&&t.onAgentEvent(Ei(it,Q.pack)),t.onAgentEvent({type:"test_md_done",overall_status:te.overallStatus,duration_s:Pe,session_id:l.sessionId,...At?{share_url:At}:{},...it?{coverage:Ai(it)}:{}}),await l.reportCompletedSession({runsCompleted:l.getStepRunRecords().length,creditsConsumed:Ve,durationSeconds:Pe}),{overallStatus:te.overallStatus,exitCode:te.overallStatus==="passed"&&!Wn?0:1,outputDir:X(n),durationS:Pe,creditsConsumed:Ve,uploadResult:ie.uploadResult,anyAuthorStepRan:pe,resultCode:$o(xe),...pr.length?{pendingInvestigations:pr}:{},ownPack:re.ownsLifecycle?Ri({executionId:O?.executionId,testId:b.testId??O?.testId,testcaseId:ie?.uploadResult?.testcaseId,commitId:l.sessionId,published:gr,coverage:Re}):void 0}}finally{!fn&&($||b.unitLocks.length>0)&&await cl(b,l,$,{resolvedAuth:c,tmsBaseUrl:h.tmsBaseUrl})}}function nl(e){if((e.env??process.env).KANE_CLI_MODE==="hyperexecute")return null;let t=cs({globalDir:e.globalDir,localDir:ke(e.cwd,".testmuai","variables"),file:e.opts.variablesFile,inline:e.opts.variables}),r=Ts(e.resolved,t,{authorFrom:e.authorFrom,produced:e.produced});return r.length===0?null:{text:Kr(r,{cwd:e.cwd,entryFile:Me(e.resolved.rootPath)}),event:Hr(r,{cwd:e.cwd})}}function ol(e,t){let r={...e,...t,...wr(e)},n=Object.keys(r).length>0?Ot(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:n.variables,auteurObjective:"",..._s(r)}}function Je(e,t,r){let n={...e,...t??{},...wr(e)};if(Object.keys(n).length===0)return{raw:n,variables:{},objective:r};let o=Ot(n,r);return{raw:n,variables:Is(o.variables,o.objective),objective:o.objective}}function sl(e,t,r){let n=Je(e,t,r).variables;return Object.keys(n).length>0?n:void 0}function il(e,t){return e.max_steps??t??50}function Ui(e,t){let r=new Set(er),n={...e};for(let[o,s]of Object.entries(t))r.has(o)||o!=="variables"&&s!==void 0&&e[o]===void 0&&(n[o]=s);return n}function al(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function ll(e,t,r,n,o,s,d={}){let p=ps(t);Os(t,p);let i=we(e),c=!d.setAsideMeta&&el(i)?JSON.parse($i(i,"utf8")):null,v=c?.testcase_id,m=c?.test_id,h=c?.commit_id,k=r.push===!0,D=r.author===!0;k&&!v&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
75
75
  `);let S=n.resolvedAuth.basicAuth;if(!S){let $=await n.resolvedAuth.resolver.resolve(!0);$?.username&&$?.access_key&&(S={username:$.username,access_key:$.access_key},n.resolvedAuth.basicAuth=S)}let R=!!S,l=!r.local&&R&&m!=null&&h!=null&&v!=null,M=l&&(Mt(p)||k||D),B=fs(t,p);if(B.length>0)return process.stderr.write(`error: replay-only step(s) cannot be replayed \u2014 the agent cannot author them, so the run will not start:
76
76
  `+B.map(b=>` step ${b.flatIndex} "${b.heading}" @${b.kind} \u2014 ${b.reason} (${b.file})`).join(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as o,h as a}from"./chunk-N3TCNZSX.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
2
+ import{g as o,h as a}from"./chunk-M43WH5DQ.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
@@ -1,9 +1,9 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as me,c as U,d as fe,e as ge}from"./chunk-6U7ID777.js";import{a as ot}from"./chunk-DREQ3RAA.js";import{b as w,c as ue,d as at,f as de,g as le}from"./chunk-HQ2E2XCU.js";import{b as ft,c as gt,d as _t,e as vt,f as ht,j as yt,l as wt,m as kt,n as x,o as bt,p as xt,r as It}from"./chunk-SMTBOSEJ.js";import{c as St,d as Rt}from"./chunk-FIP5L6LV.js";import{a as V}from"./chunk-R7KXAISS.js";import{a as X,b as Z}from"./chunk-NLZZLANH.js";import{a as M,b as $,d as st}from"./chunk-65VANXOF.js";import{a as ae,c as rt,d as nt,e as it,f as ce}from"./chunk-IINZZ4BZ.js";import{e as J}from"./chunk-NWD54VV5.js";import{i as Et}from"./chunk-XMPTFXPW.js";import{a as Pt,b as Q,e as Ct}from"./chunk-L4UVUFL6.js";import{a as B}from"./chunk-73Y6T2UK.js";import{a as Je,b as Xe}from"./chunk-VG44B5JD.js";import{c as Qe,d as et,e as tt}from"./chunk-UAWWLLTI.js";import{g as Ze}from"./chunk-Y6Y6RAY4.js";import{a as F}from"./chunk-VLDCHFXF.js";import{d as mt}from"./chunk-XB6BJPDL.js";import{Ha as _,f as W}from"./chunk-W3OVSDBN.js";import{a as j}from"./chunk-I2MC6VVX.js";import{M as lt,vb as pt}from"./chunk-UEE3RZN4.js";import{f as pe,g as dt}from"./chunk-KU3YHPWZ.js";import{h as G,k as ct,m as ut,o as q}from"./chunk-PUVMC4PX.js";import{b as A,c as b}from"./chunk-VZ7KXRXB.js";import{c as K}from"./chunk-MGNRNLBE.js";import{f as We}from"./chunk-A7RJQJNT.js";import{a as qe}from"./chunk-I6OQISK4.js";function D(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var O={failed:3,broken:2,passed:1,skipped:0};function _e(e){let t="skipped";for(let r of e)O[r]>O[t]&&(t=r);return t}import{createHash as cr}from"crypto";import{basename as ur}from"path";function ve(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function he(e){return cr("sha256").update(e).digest("hex").slice(0,8)}function ye(e){let t=ur(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ve(t)}-${he(e)}`}function we(e,t){return`${ve(e)}-${he(t)}`}function ke(e,t=process.env){let r=ot(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},o={};for(let[i,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(o[i]=s);return o}function dr(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as I}from"fs";import{join as S}from"path";function be(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return b(t,{lineWidth:-1})}async function xe(e,t,r,n=process.cwd(),o){let i=o??w(e.execution_id,n),s=S(i,"tests",t);return await I.mkdir(S(i,"coverage"),{recursive:!0}),await I.writeFile(S(i,"coverage",".keep"),""),await I.mkdir(s,{recursive:!0}),await I.writeFile(S(i,"run.yaml"),be(e)),r&&await I.writeFile(S(s,r.path),r.content),i}async function lr(e,t=process.cwd()){let r=w(e.execution_id,t);await I.mkdir(S(r,"coverage"),{recursive:!0}),await I.writeFile(S(r,"coverage",".keep"),"");let n=A(be(e));return n.environment&&delete n.environment.run_kind,await I.writeFile(S(r,"run.yaml"),b(n,{lineWidth:-1})),r}async function pr(e,t=process.cwd()){return $(w(e,t),new Date().toISOString())}async function Ie(e,t=process.cwd()){await I.rm(w(e,t),{recursive:!0,force:!0})}import{promises as Se}from"fs";import{join as Re}from"path";function ee(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...e.assuranceBase?{assurance_base:e.assuranceBase}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return b(t,{lineWidth:-1})}function Ee(e){return b({logs:e},{lineWidth:-1})}async function Pe(e,t,r){await Se.writeFile(Re(e,"tests",t,"result.yaml"),r)}async function Ce(e,t,r){let n=Re(e,"tests",t,"logs");await Se.mkdir(n,{recursive:!0}),await Se.writeFile(Re(n,"meta.yaml"),r)}import{promises as te}from"fs";import{join as At}from"path";function jt(e){return At(e,".internal","meta.json")}async function Ot(e){let t;try{t=await te.readFile(jt(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function Ae(e,t){let r;try{r=await Ot(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await te.mkdir(At(e,".internal"),{recursive:!0});let o=jt(e),i=`${o}.tmp-${process.pid}-${Date.now()}`;await te.writeFile(i,JSON.stringify(r,null,2)+`
2
+ import{b as me,c as U,d as fe,e as ge}from"./chunk-YQ5C6UDG.js";import{a as ot}from"./chunk-DREQ3RAA.js";import{b as w,c as ue,d as at,f as de,g as le}from"./chunk-HQ2E2XCU.js";import{b as ft,c as gt,d as _t,e as vt,f as ht,j as yt,l as wt,m as kt,n as x,o as bt,p as xt,r as It}from"./chunk-SMTBOSEJ.js";import{c as St,d as Rt}from"./chunk-FIP5L6LV.js";import{a as V}from"./chunk-R7KXAISS.js";import{a as X,b as Z}from"./chunk-NLZZLANH.js";import{a as M,b as $,d as st}from"./chunk-65VANXOF.js";import{a as ae,c as rt,d as nt,e as it,f as ce}from"./chunk-IINZZ4BZ.js";import{e as J}from"./chunk-3F5FMH76.js";import{i as Et}from"./chunk-XMPTFXPW.js";import{a as Pt,b as Q,e as Ct}from"./chunk-ZU4W2QGM.js";import{a as B}from"./chunk-73Y6T2UK.js";import{a as Je,b as Xe}from"./chunk-36N3EHW5.js";import{c as Qe,d as et,e as tt}from"./chunk-EBPRPNSA.js";import{g as Ze}from"./chunk-Y6Y6RAY4.js";import{a as F}from"./chunk-VLDCHFXF.js";import{d as mt}from"./chunk-XB6BJPDL.js";import{Ha as _,f as W}from"./chunk-7HMSMAUG.js";import{a as j}from"./chunk-I2MC6VVX.js";import{M as lt,vb as pt}from"./chunk-UEE3RZN4.js";import{f as pe,g as dt}from"./chunk-KU3YHPWZ.js";import{h as G,k as ct,m as ut,o as q}from"./chunk-PUVMC4PX.js";import{b as A,c as b}from"./chunk-VZ7KXRXB.js";import{c as K}from"./chunk-C2RUDJ46.js";import{f as We}from"./chunk-A7RJQJNT.js";import{a as qe}from"./chunk-D36V5OX6.js";function D(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var O={failed:3,broken:2,passed:1,skipped:0};function _e(e){let t="skipped";for(let r of e)O[r]>O[t]&&(t=r);return t}import{createHash as cr}from"crypto";import{basename as ur}from"path";function ve(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function he(e){return cr("sha256").update(e).digest("hex").slice(0,8)}function ye(e){let t=ur(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ve(t)}-${he(e)}`}function we(e,t){return`${ve(e)}-${he(t)}`}function ke(e,t=process.env){let r=ot(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},o={};for(let[i,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(o[i]=s);return o}function dr(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as I}from"fs";import{join as S}from"path";function be(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return b(t,{lineWidth:-1})}async function xe(e,t,r,n=process.cwd(),o){let i=o??w(e.execution_id,n),s=S(i,"tests",t);return await I.mkdir(S(i,"coverage"),{recursive:!0}),await I.writeFile(S(i,"coverage",".keep"),""),await I.mkdir(s,{recursive:!0}),await I.writeFile(S(i,"run.yaml"),be(e)),r&&await I.writeFile(S(s,r.path),r.content),i}async function lr(e,t=process.cwd()){let r=w(e.execution_id,t);await I.mkdir(S(r,"coverage"),{recursive:!0}),await I.writeFile(S(r,"coverage",".keep"),"");let n=A(be(e));return n.environment&&delete n.environment.run_kind,await I.writeFile(S(r,"run.yaml"),b(n,{lineWidth:-1})),r}async function pr(e,t=process.cwd()){return $(w(e,t),new Date().toISOString())}async function Ie(e,t=process.cwd()){await I.rm(w(e,t),{recursive:!0,force:!0})}import{promises as Se}from"fs";import{join as Re}from"path";function ee(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...e.assuranceBase?{assurance_base:e.assuranceBase}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return b(t,{lineWidth:-1})}function Ee(e){return b({logs:e},{lineWidth:-1})}async function Pe(e,t,r){await Se.writeFile(Re(e,"tests",t,"result.yaml"),r)}async function Ce(e,t,r){let n=Re(e,"tests",t,"logs");await Se.mkdir(n,{recursive:!0}),await Se.writeFile(Re(n,"meta.yaml"),r)}import{promises as te}from"fs";import{join as At}from"path";function jt(e){return At(e,".internal","meta.json")}async function Ot(e){let t;try{t=await te.readFile(jt(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function Ae(e,t){let r;try{r=await Ot(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await te.mkdir(At(e,".internal"),{recursive:!0});let o=jt(e),i=`${o}.tmp-${process.pid}-${Date.now()}`;await te.writeFile(i,JSON.stringify(r,null,2)+`
3
3
  `),await te.rename(i,o)}async function mr(e){try{let t=await Ot(e);return t&&Array.isArray(t.executions)?t.executions:[]}catch{return[]}}async function fr(e,t,r=process.cwd()){let n=await de(e,r);if(!n){let i=`evidence: no pack found for "${e}"`;return t.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:e})):console.error(i),2}let o=await M(n,t.profile??"L1");return t.json?console.log(JSON.stringify({valid:o.valid,status:o.status,diagnostics:o.diagnostics})):console.log(`evidence: ${o.valid?"valid":"INVALID"} (${t.profile??"L1"}, status ${o.status})`),o.valid?0:1}function je(e){let t=[];for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(o=>o.resultCode):[r.resultCode];for(let o of n)t.push(D(o))}return _e(t)}function gr(e){let t=null;for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(o=>o.resultCode):[r.resultCode];for(let o of n)o!=null&&(t==null||O[D(o)]>O[D(t)]||O[D(o)]===O[D(t)]&&o>t)&&(t=o)}return t}import{promises as _r}from"fs";import{extname as Dt,basename as vr}from"path";var hr={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function Oe(e){let t;try{t=await _r.readdir(e)}catch{return[]}return t.filter(r=>r!=="meta.yaml"&&!r.startsWith(".")).sort().map(r=>({name:vr(r,Dt(r)),file:r,format:hr[Dt(r)]??"txt"}))}import{mkdirSync as yr,appendFileSync as wr}from"fs";import{join as Lt}from"path";function De(e,t){return Lt(e,"tests",t,"logs")}function Le(e,t,r,n={},o){try{o?.(t,r,r,n)}catch{}if(e)try{yr(e,{recursive:!0});let i=JSON.stringify({ts:new Date().toISOString(),level:t,event:r,...n})+`
4
4
  `;wr(Lt(e,"diagnostics.ndjson"),i)}catch{}}import{promises as R}from"fs";import{dirname as Cr,join as L}from"path";import{statSync as kr}from"fs";import{promises as Te}from"fs";import{basename as br,join as xr}from"path";var Ir=1e6,Sr=2e6;function Rr(){return Je.map(e=>Xe(e))}function Tt(e=Rr()){return e.map(t=>{let r=0;try{r=kr(t).size}catch{}return{path:t,offset:r}})}var Er=/\x1b\[[0-9;]*[A-Za-z]/g;async function Pr(e,t,r){let n;try{n=await Te.open(e,"r");let o=(await n.stat()).size,i=t<=o?t:0,s=o-i;if(s<=0)return null;let a=s>r?o-r:i,c=Buffer.alloc(Math.min(s,r));return await n.read(c,0,c.length,a),c.toString("utf8")}catch{return null}finally{await n?.close().catch(()=>{})}}async function Nt(e,t){let r=t.caps?.stderr??Ir,n=t.caps?.appium??Sr,o=[];t.runnerStderrPath&&o.push({src:t.runnerStderrPath,from:0,cap:r});for(let i of t.appiumMarks??[])o.push({src:i.path,from:i.offset,cap:n});for(let i of o){let s=await Pr(i.src,i.from,i.cap);if(s===null)continue;let a=s.replace(Er,"");if(a!=="")try{await Te.mkdir(e,{recursive:!0}),await Te.writeFile(xr(e,br(i.src)),a)}catch{}}}async function Ar(e){try{let t=L(e,"tests"),r=await R.readdir(t).catch(()=>[]);for(let n of r){let o=L(t,n,"steps"),i=await R.readdir(o).catch(()=>[]);for(let s of i){let a=await R.readFile(L(o,s,"failure.yaml"),"utf8").catch(()=>null);if(a!=null)try{let c=A(a);if(c&&typeof c=="object"&&c.triage)return!0}catch{}}}}catch{}return!1}async function Mt(e,t,r,n={}){let o=L(e,"tests",t,"logs");if(r)try{await R.mkdir(o,{recursive:!0}),await R.copyFile(r,L(o,"tui.log"))}catch{}await Nt(o,{runnerStderrPath:r?L(Cr(r),"runner-stderr.log"):void 0,appiumMarks:n.appiumMarks});let i=await Oe(o);if(!i.length&&n.requireRealLog)throw new Error(`evidence test ${t} has no real log to declare`);i.length&&await Ce(e,t,Ee(i))}async function Ne(e){let t=e.cwd??process.cwd(),r=e.packDir??w(e.executionId,t);if(!e.saved&&!e.packDir)return await Ie(e.executionId,t),{sealed:!1};await Mt(r,e.testId,e.tuiLogPath,{requireRealLog:e.requireRealLog,appiumMarks:e.appiumMarks});let n=L(r,"run.yaml"),o=A(await R.readFile(n,"utf8"));o.environment={...o.environment??{},saved:e.saved,run_kind:e.runKind},await R.writeFile(n,b(o,{lineWidth:-1}));let i=await R.open(n,"r+");try{await i.sync()}finally{await i.close()}let s=await Ar(r);await $(r,new Date().toISOString());let a;try{let u=await M(r,"L1");a=u.valid;let p=(u.diagnostics??[]).filter(d=>String(d?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(e.expectStatusDisagrees||s){let d=e.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${d}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!u.valid){console.warn(`evidence: sealed pack ${e.executionId} failed L1 validation`,u.diagnostics);let d=String(u.diagnostics?.[0]?.code??"");Le(De(r,e.testId),"warn","EVIDENCE_INVALID",{execution_id:e.executionId,first_code:d,surface:e.surface??"testmd"},e.log)}}catch(u){console.warn(`evidence: validation error for ${e.executionId}`,u)}let c;if(e.saved&&e.packDir)try{c=await at(r,e.executionId,t)}catch(u){console.warn(`evidence: store install failed for ${e.executionId}`,u)}if(e.outputStemDir)try{await Ae(e.outputStemDir,{execution_id:e.executionId,run_kind:e.runKind,status:e.verdict,valid:a,at:new Date().toISOString()})}catch(u){console.warn(`evidence: execution-pointer append failed for ${e.executionId} (pack is sealed)`,u)}return{sealed:!0,valid:a,storePath:c}}import{release as $t}from"os";import{execFileSync as jr}from"child_process";var Ft=!1,re;function Or(){if(!Ft)if(Ft=!0,process.platform==="darwin")try{re=jr("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{re=$t()||void 0}else re=$t()||void 0;return re}function Me(e){let t={os:ae(process.platform)},r=Or();if(r&&(t.os_version=r),e.cdpBrowser){let i=/^([A-Za-z]+)\/(\d+)/.exec(e.cdpBrowser);i&&(t.browser=i[1].replace(/^Headless/,""),t.browser_version=i[2])}e.resolution&&(t.resolution=e.resolution);let n=nt(t,e.runnerEnvironment);if(!n.native_platform)return n;e.deviceName&&(n.device=e.deviceName),!n.os_version&&e.deviceOsVersion&&(n.os_version=e.deviceOsVersion);let o=Qe(e.deviceApp);if(o&&(n.app=o),We(n.target)){let i=Ze(e.runnerEnvironment?.device);i&&(n.device=i)}return e.pixelResolution&&(n.viewport=n.resolution??Dr(e.pixelResolution,n.pixel_ratio)??e.pixelResolution,n.resolution=e.pixelResolution),n}function Dr(e,t){if(!t||!Number.isFinite(t)||t<=0)return;let r=/^(\d+)x(\d+)$/.exec(e);if(r)return`${Math.round(Number(r[1])/t)}x${Math.round(Number(r[2])/t)}`}async function Bt(e){if(e)try{let t=await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)return;let r=await t.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Lr(e){let t;return()=>(t||(t=Bt(e)),t)}import{promises as k,existsSync as E,readFileSync as $r}from"fs";import{basename as Fr,join as g}from"path";import{readFileSync as Tr}from"fs";import{dirname as Nr,resolve as Mr}from"path";function Vt(e,t){let r=Mr(e),n=Tr(r,"utf8");return G(t?ct(n,ut(Nr(r),t)):n)}async function Ut(e){for(let t of await k.readdir(e,{withFileTypes:!0})){let r=g(e,t.name);if(t.isDirectory()){await Ut(r);continue}try{await k.unlink(r)}catch{await k.truncate(r,0)}}await k.rmdir(e).catch(()=>{})}function Br(e){let t=e.authorBoundary<0||e.authorBoundary>e.totalSteps?e.totalSteps:e.authorBoundary;return{shrink_count:e.shrinkCount,complete_reauthor:t===0&&e.totalSteps>0,author_boundary:t,total_steps:e.totalSteps,reauthored_steps:e.totalSteps-t,credits_consumed:Math.round(e.creditsConsumed*100)/100}}var z=class e{constructor(t){this.opts=t}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_attempts=[];_packDirOverride;_attached=!1;appiumMarks=Tt();get attached(){return this._attached}static async attach(t){let r=Fr(t.packDir).replace(/\.evidence$/,""),n=new e({origin:"testrun",runKind:"author",pid:process.pid,title:t.testId,started:new Date().toISOString(),producerVersion:qe,cwd:t.cwd});n.executionId=r,n.testId=t.testId,n._packDirOverride=t.packDir,n._attached=!0;let o=g(t.packDir,"tests",t.testId);return await k.mkdir(o,{recursive:!0}),t.definition&&(await k.writeFile(g(o,t.definition.path),t.definition.content),n.definitionPath=t.definition.path,n.definitionContent=t.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=ue(),this.testId=this.opts.testmdRelPath?ye(this.opts.testmdRelPath):we(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let t=this.opts.definition??null;return await xe({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,t,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),t&&(this.definitionPath=t.path,this.definitionContent=t.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?g(this.opts.packRootDir,`${this.executionId}.evidence`):w(this.executionId,this.opts.cwd)}get packTestDir(){return g(this.pack,"tests",this.testId)}async writeDefinition(t,r="test.md"){await k.writeFile(g(this.packTestDir,r),t),this.definitionPath=r,this.definitionContent=t}computeEngineBlock(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=g(this.opts.cwd,this.opts.testmdRelPath);if(E(t))return q($r(t,"utf8"))??{}}}catch{}return{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=g(this.opts.cwd,this.opts.testmdRelPath),r=g(this.opts.cwd,".context"),n=E(r)?pt(r):void 0;if(E(t))return Vt(t,n)}if(this.definitionContent!=null)return G(this.definitionContent)}catch{}}noteSpawn(t){this.accumulatedSteps.push(...t.steps),this.maxOrdinal=Math.max(this.maxOrdinal,t.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}get attempts(){return this._attempts}async archiveAttempt(t,r,n={}){let o=this._attempts.length+1,i=g(this.packTestDir,String(o)),s=n.log,a=(u,l)=>s?.("warn","ARCHIVE_ATTEMPT_FAILED",`Attempt ${o}: ${u} could not be archived into ${o}/; the next attempt will mingle with it`,{attempt:o,dir:u,error:String(l)}),c;try{await k.mkdir(i,{recursive:!0})}catch(u){a(`${o}/`,u)}for(let u of["steps","logs","v16-trajectory"]){let l=g(this.packTestDir,u);if(!E(l))continue;let p=g(i,u);try{await k.rename(l,p);continue}catch(d){s?.("warn","ARCHIVE_ATTEMPT_RENAME_FAILED",`Attempt ${o}: rename of ${u}/ refused; copying it into ${o}/ and emptying the originals in place`,{attempt:o,dir:u,error:String(d),fallback:"copy+truncate"})}try{await k.cp(l,p,{recursive:!0}),await Ut(l)}catch(d){a(u,d)}}try{this.definitionPath&&E(g(this.packTestDir,this.definitionPath))&&await k.copyFile(g(this.packTestDir,this.definitionPath),g(i,this.definitionPath));let u=g(i,"steps");if(E(u)){for(let l of await k.readdir(u))if(E(g(u,l,"failure.yaml"))){c=`${o}/steps/${l}/failure.yaml`;break}}}catch(u){a("definition + failure pointer",u)}return this._attempts.push({n:o,status:t,steps:this.accumulatedSteps,...r!==void 0?{failedAt:r}:{},...c?{failure:c}:{}}),this.accumulatedSteps=[],this.maxOrdinal=0,o}async writeResult(t){let r=je(t.spawns),n=this._attempts.length?[...this._attempts.map(f=>({status:f.status})),{status:r,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{}}]:void 0,o=n?new Set(n.map(f=>f.status)).size>1:void 0,i=this._attempts.length>0,s=t.heal,a=i||s?.forced?{triggered:i,...i?{outcome:r==="passed"?"healed":"exhausted"}:{},...s?Br(s):{},...i?{attempts:this._attempts.map(f=>({n:f.n,status:f.status,failed_at:f.failedAt??-1,...f.failure?{failure:f.failure}:{}}))}:{}}:void 0,c=this.pack,u=ke(t.externalIdInput),l=ce(t.runnerEnv,t.intentEnv),p=this.computeDefinitionId(),{id:d,base:h}=this.computeEngineBlock();await Pe(c,this.testId,ee({testId:this.testId,status:r,durationMs:t.durationMs,definitionPath:this.definitionPath,definitionId:p,assuranceId:d,assuranceBase:h,externalId:u,environment:l,steps:t.steps,tags:t.tags,attempts:n,flaky:o,adaptiveHeal:a}));for(let f of this._attempts){let v=g(this.packTestDir,String(f.n));E(v)&&await k.writeFile(g(v,"result.yaml"),ee({testId:this.testId,status:f.status,definitionPath:this.definitionPath,definitionId:p,assuranceId:d,assuranceBase:h,externalId:u,environment:l,steps:f.steps,tags:t.tags}))}let y=t.externalIdInput;return t.log&&(y.commit_id||y.test_id||y.testcase_id)&&t.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:y.commit_id??null,test_id:y.test_id??null,testcase_id:y.testcase_id??null,tc_id:u.tc_id??null,project_id:y.project_id??null,session_id:y.session_id??null,session_name:y.session_name??null,hyper_test_instance_id:u.hyper_test_instance_id??null,hyper_job_id:u.hyper_job_id??null,hyper_task_id:u.hyper_task_id??null,dataset_id:u.dataset_id??null,dataset_row_id:u.dataset_row_id??null,dataset_version_id:u.dataset_version_id??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function Vr(e,t,r=le){try{let n=await r(e);if(n.aborted.length>0||n.removed.length>0)try{t?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as vn}from"fs";import{existsSync as tn,mkdirSync as rn,rmSync as nn,writeFileSync as on}from"fs";import{join as Be}from"path";import{mkdirSync as Ur,renameSync as zr,rmSync as Yr,writeFileSync as Hr}from"fs";import{join as zt}from"path";var Kr=5e6;function Yt(e,t,r){let n=zt(e,"coverage","sources"),o=new Map,i=!1;try{for(let s of r.usecases)for(let a of s.sources){if(o.has(a.id)){a.file=o.get(a.id);continue}if(!a.cid)continue;let c=t.getBlob(a.cid);if(c===null||c.byteLength>Kr)continue;i||(Ur(n,{recursive:!0}),i=!0);let u=zt(n,a.id),l=`${u}.tmp-${process.pid}`;Hr(l,c),zr(l,u);let p=`coverage/sources/${a.id}`;o.set(a.id,p),a.file=p}}catch{for(let s of r.usecases)for(let a of s.sources)delete a.file;if(i)try{Yr(n,{recursive:!0,force:!0})}catch{}}}function Gr(e){return e.state==="proven"?"covered":e.proven>0?"partial":"uncovered"}function qr(e,t,r){let n={};for(let s of e.perUc)n[s.id]={status:Gr(s),state:s.state,pct:Math.round(s.pct)};let o={};for(let[s,a]of Object.entries(e.perAc)){let c=a.state==="proven";o[s]={score:c?1:0,verified:c,passes:t[s]?.passes??0,counted:t[s]?.counted??0}}let i=Object.values(n).map(s=>s.status);return{rollup_version:2,stale_sources:e.flags.stale_sources,high_risk_gaps:(r??[]).filter(s=>s.risk==="high").length,aspects:{coverage:{config:e.config,acs:o,usecases:n,summary:{coverage_pct:Math.round(e.pct),acs_verified:`${e.criteria.proven}/${e.criteria.total}`,usecases_covered:`${i.filter(s=>s==="covered").length}/${i.length}`,uncovered:i.filter(s=>s==="uncovered").length}}}}}var Wr={passed:"passed",failed:"failed",broken:"blocked"};function Jr(e,t,r){let n=e.edgesFrom(t).find(i=>i.type===dt.SCOPED_TO),o=n?e.tipOf(n.dst):r;return o===r?{type:"usecase",ref:x(e,r)}:{type:"scenario",ref:x(e,o)}}function Ht(e,t,r){let n=It({graph:e,runs:t,thisRun:r}),{inScope:o}=wt(e),i=kt(e,new Set(o)),s=new Map(o.map(p=>[x(e,p),p])),a={},c=p=>F(e,p),u=n.perUc.map(p=>{let d=s.get(p.id),h=e.tipOf(d),y=ft(e,h,c).map(v=>_t(e,v,c,x)).sort((v,P)=>v.id<P.id?-1:1),f=(i.get(d)??[]).map(v=>{let P=x(e,v),Y=e.getNode(v)?.content??{},H=bt(e,v).sort((m,C)=>x(e,m)<x(e,C)?-1:1),oe=xt(e,t,v,H,r).sort((m,C)=>m.at<C.at?-1:m.at>C.at?1:0),N=n.perAc[P]?.this_run,se=H.length>0;a[P]={passes:oe.filter(m=>m.verdict==="passed").length,counted:oe.filter(m=>m.verdict==="passed"||m.verdict==="failed").length};let Ge=oe.slice(-10).map(m=>({execution_id:m.executionId,ts:m.at,verdict:m.verdict,stale_at_run:!!m.fact.stale_at_run,oracle_mode:String(m.fact.oracle_mode),...m.fact.via_parent?{via_parent:String(m.fact.via_parent)}:{}}));return{id:P,text:String(Y.text??""),risk:String(Y.risk??""),scope:Jr(e,v,h),covered_by:H.map(m=>x(e,m)),...se?{link_type:"verifies"}:{},execution:N===void 0?"not-run":Wr[N]??"not-run",...N!==void 0?{this_run:N}:{},fresh:se&&N===void 0?"unknown":e.stale(v)==="fresh"?"fresh":"stale",derived:!!Y.derived,...vt(Y),...se?{satisfied_by:H.map(m=>{let C=e.getNode(m)?.content.check?.verified_against;return{test:x(e,m),...C?{step:C}:{}}})}:{},...Ge.length?{executions:Ge}:{}}}).sort((v,P)=>v.id<P.id?-1:1);return{...gt(e,d,x),scenarios:y,acceptance_criteria:f}}),l=ht(e);return{usecases:u,...l.length?{gaps:l}:{},rollup:qr(n,a,l),coverage:n}}import{existsSync as Kt,readdirSync as Xr,readFileSync as Zr,statSync as Qr}from"fs";import{join as $e}from"path";function Fe(e){let t=$e(e,"tests");if(!Kt(t))return[];let r=[];for(let n of Xr(t).sort()){let o=$e(t,n,"result.yaml");if(!Qr($e(t,n)).isDirectory()||!Kt(o))continue;let i=A(Zr(o,"utf8"));!i?.assurance_id&&!i?.definition_id||r.push({test:n,...i.assurance_id?{assuranceId:String(i.assurance_id)}:{},...i.definition_id?{definitionId:String(i.definition_id)}:{},...i.assurance_base?{base:String(i.assurance_base)}:{},verdict:String(i.status??""),acs:St(i.steps??[])})}return r}function en(e,t){if(t.assuranceId){let r=e.resolve(t.assuranceId),n=r?e.tipOf(r.cid):null;if(n!==null&&e.nodeLabel.get(n)===pe.TEST&&F(e,n))return n}if(t.definitionId){for(let{cid:r,content:n}of e.byLabel(pe.TEST))if(F(e,r)&&n.definitionId===t.definitionId)return r}return null}function Gt(e,t,r){let n=new Map,o=new Set;for(let i of t){let s=en(e,i);if(s===null||i.definitionId===void 0||r.definitionNow(e,s)!==i.definitionId)continue;let a=`${r.executionId}/${i.test}`;o.add(a);let c=n.get(s)??[];c.push({about:s,definition_id_at_run:i.definitionId,verdict:i.verdict,...i.acs.length?{per_ac:i.acs.map(u=>({ac_ref:u.ref,verdict:u.verdict}))}:{},drift_flag:!1,oracle_mode:"authored",stale_at_run:!1,execution_id:a,started_at:r.at,mode:"testmd",local:!0}),n.set(s,c)}return{runs:i=>n.get(e.tipOf(i))??[],thisRun:o}}var qt=async(e,t,r)=>{if(t.kind==="grid")try{return Fe(e).some(i=>i.assuranceId)?{status:"pending",reason:"on_grid"}:{status:"skipped",reason:"not_assurance_project"}}catch{return{status:"pending",reason:"on_grid"}}if(t.kind==="none")return{status:"skipped",reason:t.reason};let n=Be(e,"coverage"),o=tn(n);try{let i=Fe(e),s;if(t.kind==="lattice"){let a=await t.ask(i,r.executionId);if(a==="no_context")return{status:"skipped",reason:"no_use_cases_yet"};if(a==="no_answer")return{status:"pending",reason:"project_no_answer"};s=a}else{if(!t.store.exists())return{status:"skipped",reason:"not_assurance_project"};let a=lt(t.store);t.store.prefetch(mt(a),{token:null});let{runs:c,thisRun:u}=Gt(a,i,{executionId:r.executionId,at:new Date().toISOString(),definitionNow:yt});s=Ht(a,c,u);let l=new Set(s.coverage.this_run?.usecases??[]);Yt(e,t.store,{usecases:s.usecases.filter(p=>l.has(p.id))})}return rn(n,{recursive:!0}),on(Be(n,"usecases.yaml"),b(s,{lineWidth:-1})),t.kind==="lattice"?{status:"written",computedBy:"project",project:t.project,doc:s.coverage}:{status:"written",computedBy:"local",doc:s.coverage}}catch(i){try{nn(o?Be(n,"sources"):n,{recursive:!0,force:!0})}catch{}return{status:"failed",detail:i instanceof Error?i.message:String(i)}}};import{readFileSync as sn}from"fs";import{basename as Wt,dirname as ne,join as an}from"path";var cn=5e3,un=X("assurance-case");function Xt(e,t={}){let r=ne(e);if(Wt(r)!=="tests"||Wt(ne(r))!==".testmuai")return null;let n=ne(ne(r)),o;try{o=q(sn(e,"utf8"))}catch{return null}if(!o?.id)return null;let i=(a,c,u)=>({root:n,latticeUrl:a,projectId:c,projectName:u,test:o.id,base:o.base??null});if(t.grid){let a=Ct(an(n,Pt));return a===null?null:i("",a.projectId,a.projectName)}let s=Q(n,t.address??K());return s.kind==="remote"?i(s.latticeUrl,s.projectId,s.projectName):null}function ns(e,t={}){let r={};for(let n of e){let o=Xt(n,t);o?.base&&(r[n]={test:o.test,definitionId:o.base})}return r}async function is(e){let t=Xt(e.testFile,{address:e.address,grid:e.gridCase!==void 0});if(t===null)return{kind:"unlinked"};let r=t.base===null?null:{test:t.test,definitionId:t.base},n=e.metaCaseId===null;if(e.gridCase)return Jt(t,r,e.metaCaseId,{caseId:e.gridCase.caseId,internalId:e.gridCase.tc,canAttach:!0});if(r===null)return{kind:"stop",stop:{why:"not_in_project",useCase:null},projectName:t.projectName};let o;try{let i=e.auth??await J(),s=e.lookup??((a,c,u)=>W({url:t.latticeUrl,basicAuth:i}).testCase(a,c,u));o=await Ve(s(t.projectId,t.test,r.definitionId),e.budgetMs??cn)}catch(i){return i instanceof j&&i.code==="NO_CONTEXT"?{kind:"stop",stop:{why:"no_work"},projectName:t.projectName}:(un(`the test case of ${t.test} wasn't checked: ${i instanceof T?i.message:Z(i)}`),n?{kind:"stop",stop:{why:"lookup",refusal:pn(i,t.projectName)},projectName:t.projectName}:{kind:"run",projectId:t.projectId,tc:null,stamp:r})}return"refused"in o?{kind:"stop",stop:ln(o.refused),projectName:t.projectName}:Jt(t,r,e.metaCaseId,o.linked)}function Jt(e,t,r,n){return r===n.caseId?{kind:"run",projectId:e.projectId,tc:n.internalId,stamp:t}:n.canAttach?{kind:"attach",projectId:e.projectId,caseId:n.caseId,tc:n.internalId,stamp:t,rehome:r!==null}:{kind:"stop",stop:{why:"outdated"},projectName:e.projectName}}function os(e,t){switch(e.why){case"missing":return{refusal:_.testCaseMissing(e.session),exit:2};case"gone":return{refusal:_.testCaseGone(e.session),exit:2};case"archived":return{refusal:_.testCaseArchived(),exit:2};case"not_in_project":return{refusal:_.testNotInProject(t,e.useCase),exit:2};case"no_work":return{refusal:_.testProjectHasNoWork(t),exit:2};case"outdated":return{refusal:_.testManagerOutdated(),exit:1};case"lookup":return{refusal:e.refusal,exit:2}}}function dn(e){switch(e.why){case"missing":return e.session?{reason:"it isn't in Test Manager yet; save the session that designed it:",cmd:`kane-cli context sessions save ${e.session}`}:{reason:"it isn't in Test Manager yet; find its session, then save it:",cmd:"kane-cli context sessions"};case"gone":return e.session?{reason:"its test case was deleted or moved; saving its session makes a new one:",cmd:`kane-cli context sessions save ${e.session}`}:{reason:"its test case was deleted or moved; find its session, then save it:",cmd:"kane-cli context sessions"};case"archived":return{reason:"its test case is archived in Test Manager; restore it there"};case"not_in_project":return{reason:"the session that designed it can't be saved anymore; design it again:",cmd:`kane-cli design tests --use-case ${e.useCase??"<use-case>"}`}}}function ss(e){if(e.some(i=>i.stop.why==="outdated"))return{pair:_.dispatchTestManagerOutdated()};let t=e.find(i=>i.stop.why==="lookup")?.stop;if(t?.why==="lookup")return{pair:t.refusal};let r=e.find(i=>i.stop.why==="no_work");if(r)return{pair:_.dispatchProjectHasNoWork(r.projectName)};let n=[{text:_.dispatchStopped(e.length)}],o=new Set;for(let{relPath:i,stop:s}of e){if(s.why==="outdated"||s.why==="lookup"||s.why==="no_work")continue;let{reason:a,cmd:c}=dn(s),u=c!==void 0&&o.has(c);n.push({text:` ${i}`,dim:!0},{text:` ${u?`${a.replace(/:$/,"")}, as above`:a}`,dim:!0}),c&&!u&&(o.add(c),n.push({text:` ${c}`}))}return n.push({text:_.dispatchNext(e.length)}),{lines:n}}function as(e){return{refusal:e.reason==="outdated"?_.testManagerMadeItsOwn():_.testCaseAttachFailed(),exit:1}}function ln(e){switch(e.code){case"NO_CASE":return{why:"missing",session:e.session};case"CASE_BROKEN":return{why:"gone",session:e.session};case"CASE_ARCHIVED":return{why:"archived",internalId:e.internalId};case"TEST_FILE_STALE":return{why:"not_in_project",useCase:e.useCase}}}function pn(e,t){return e instanceof Et?{code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}}:e instanceof j&&e.status===401?_.credentialsRejected():e instanceof j&&e.code==="NOT_FOUND"?_.noAccess(t):e instanceof j&&e.code==="PROJECT_NOT_MARKED"?_.assuranceOff(t):_.noConnection()}var T=class extends Error{};async function Ve(e,t){let r,n=new Promise((o,i)=>{r=setTimeout(()=>i(new T(`Lattice took over ${t} ms`)),t)});try{return await Promise.race([e,n])}finally{clearTimeout(r)}}var mn=1e4,fn=({url:e,basicAuth:t,projectId:r,body:n,budgetMs:o})=>W({url:e,basicAuth:t,requestDeadlineMs:o}).coverageRun(r,n),gn=X("pack-coverage");function Zt(e,t={}){if((t.env??process.env).KANE_CLI_MODE==="hyperexecute")return{kind:"grid"};let r=Q(e,t.address??K());switch(r.kind){case"local":return{kind:"local",store:V(B(e))};case"refuse":return r.code==="BOTH_STORES"?{kind:"local",store:V(B(e))}:{kind:"none",reason:"project_file_unreadable"};case"remote":{let n=t.budgetMs??mn;return{kind:"lattice",project:r.projectName,ask:async(o,i)=>{try{let s=await(t.auth??J)(),a={execution_id:i,members:o.map(_n)};return(await Ve((t.run??fn)({url:r.latticeUrl,basicAuth:s,projectId:r.projectId,body:a,budgetMs:n}),n)).pack}catch(s){return s instanceof j&&s.code==="NO_CONTEXT"?"no_context":(gn(`the shared project's coverage wasn't read: ${s instanceof T?s.message:Z(s)}`),"no_answer")}}}}case"pick":return{kind:"none",reason:"not_assurance_project"}}}var _n=e=>{let t=e.base??e.definitionId;return{...e.assuranceId?{assurance_id:e.assuranceId}:{},...t?{definition_id:t}:{},test:e.test,verdict:e.verdict,acs:e.acs}};async function hn(e){try{let t=new z({origin:"inline",runKind:"author",pid:e.pid,title:e.title,started:new Date().toISOString(),producerVersion:e.producerVersion,surfaces:e.surfaces,objectiveOrName:e.objectiveOrName,sessionId:e.sessionId,cwd:e.cwd,packRootDir:e.packRootDir}),r=await t.start();return{session:t,...r,packDir:t.pack,spawns:[],startedAtMs:Date.now(),cwd:e.cwd}}catch(t){return console.warn("evidence: inline pack creation failed",t),null}}function yn(e,t,r){if(!e)return;e.session.noteSpawn(t),t.resolution&&(e.resolution=t.resolution),e.runnerEnvironment=rt(e.runnerEnvironment,t.runnerEnvironment);let n=(r?.per_flow_metadata??[]).map(o=>({resultCode:o?.result_code!=null?Number(o.result_code):null}));e.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function wn(e){if(e)return{packTestDir:e.packTestDir,ordinalOffset:e.session.nextOrdinalOffset()}}async function kn(e,t){if(!e)return null;if(e.finalized)return e.finalized;let r=(n,o,i)=>t.log?t.log("warn",n,o,i):console.warn(`evidence: ${o}`,i??"");try{if(t.recordedTestPath)try{await e.session.writeDefinition(await vn.readFile(t.recordedTestPath,"utf8"))}catch(c){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(c)})}let n=t.cdpBrowserCapture?await t.cdpBrowserCapture():void 0,o=await e.session.writeResult({steps:e.session.steps,spawns:e.spawns.length?e.spawns:[{resultCode:null}],externalIdInput:{...t.externalIdInput,execution_id:e.executionId},runnerEnv:await tt(Me({cdpBrowser:n,resolution:e.resolution,runnerEnvironment:e.runnerEnvironment,deviceName:t.deviceName,deviceApp:t.deviceApp,pixelResolution:await et(e.packTestDir)}),{environment:t.environment,deviceModel:t.deviceModel,runnerEnvironment:e.runnerEnvironment}),intentEnv:it(t.model,e.runnerEnvironment),durationMs:t.durationMs??Date.now()-e.startedAtMs,log:t.log}),i=V(B(t.cwd??e.cwd??process.cwd()));try{if(t.recordedTestPath){let c=Rt({projectDir:t.cwd??e.cwd??process.cwd(),store:i,members:[{path:t.recordedTestPath,verdict:o,executionId:e.executionId,startedAt:new Date(e.startedAtMs).toISOString(),mode:"inline",local:t.local??!1}]});for(let u of c.warnings)r("EXEC_SYNC",u)}}catch(c){r("EXEC_SYNC","exec-sync failed",{error:String(c)})}let s;try{let c=t.cwd??e.cwd??process.cwd();s=await(t.coverageWriter??qt)(e.packDir,(t.coverageSource??Zt)(c),{executionId:e.executionId}),(s.status==="skipped"||s.status==="failed")&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${s.status==="skipped"?s.reason:s.detail}`)}catch(c){s={status:"failed",detail:String(c)},r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(c)})}let a=await Ne({executionId:e.executionId,testId:e.testId,saved:t.saved,runKind:"author",verdict:o,cwd:t.cwd??e.cwd,packDir:e.packDir,tuiLogPath:t.tuiLogPath,log:t.log,surface:"inline",requireRealLog:!!e.runnerEnvironment?.native_platform,appiumMarks:e.session.appiumMarks});return e.finalized={...a,coverage:s},t.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:e.executionId,verdict:o,valid:a.valid,pack:e.packDir,store_copy:a.storePath??null}),e.finalized}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as bn,openSync as xn,readSync as In,closeSync as Sn}from"fs";import{basename as Rn,resolve as En}from"path";async function Pn(e,t,r={}){let n=r.out??(l=>process.stdout.write(l+`
5
5
  `)),o=l=>(n(`error: ${l}`),2);if(t.env!=="prod"&&t.env!=="stage")return o(`invalid --env: ${String(t.env)}`);if(t.port!==void 0&&(!Number.isInteger(t.port)||t.port<1||t.port>65535))return o("invalid --port: expected an integer 1-65535");let i;try{i=U(t.env,t.viewerUrl),new URL(i)}catch{return o(`invalid --viewer-url: ${t.viewerUrl}`)}if(e.length===0)return o("no pack paths given");let s=new Map;for(let l of e){let p=En(l),d;try{d=bn(p)}catch{return o(`${l}: not found`)}if(d.isDirectory())return o(`${l}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!d.isFile())return o(`${l}: not a regular file`);let h=Buffer.alloc(2),y=xn(p,"r");try{In(y,h,0,2,0)}finally{Sn(y)}if(h.toString("latin1")!=="PK")return o(`${l}: not a sealed evidence pack (zip magic missing)`);let f=Rn(p);if(s.has(f))return o(`duplicate pack basename: ${f} (URL names collide \u2014 rename one)`);s.set(f,p)}let a=r.log??((l,p,d)=>process.stderr.write(`warn: ${p} reason=${d.reason} path=${d.path}
6
- `)),c;try{c=await me({packs:s,allowedOrigins:[new URL(i).origin],port:t.port,log:a})}catch(l){return o(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${l.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of s.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${fe(p,i)}`)}return n("press Ctrl-C to stop"),await(r.hold??Cn)(),await c.close(),0}function Cn(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as ie}from"fs";import{tmpdir as Dn}from"os";import{join as tr,resolve as ze}from"path";var An=["error","prefer_first","prefer_latest","discard"],jn=["external_id.commit_id","external_id.test_id","external_id.dataset_row_id","environment.os","environment.os_version","environment.browser","environment.browser_version","environment.device","environment.app"];function Qt(e){let t=e.replace(/-/g,"_");return An.includes(t)?t:null}function er(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...jn],on_same:e??"nest",on_different:e?"error":"split"}};return b({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Ue(e){try{if(!e.isTTY){e.log(ge(e.packPath));return}let t=U(e.env);await(e.renderPrompt??On)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function On(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-5ZN47FAT.js"),{EvidenceViewOffer:o}=await import("./EvidenceViewOffer-HAAK6DS5.js");await new Promise(i=>{let s=n(r.default.createElement(o,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),i()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Ln(e,t,r=process.cwd(),n={}){let o=n.out??(d=>process.stdout.write(d+`
6
+ `)),c;try{c=await me({packs:s,allowedOrigins:[new URL(i).origin],port:t.port,log:a})}catch(l){return o(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${l.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of s.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${fe(p,i)}`)}return n("press Ctrl-C to stop"),await(r.hold??Cn)(),await c.close(),0}function Cn(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as ie}from"fs";import{tmpdir as Dn}from"os";import{join as tr,resolve as ze}from"path";var An=["error","prefer_first","prefer_latest","discard"],jn=["external_id.commit_id","external_id.test_id","external_id.dataset_row_id","environment.os","environment.os_version","environment.browser","environment.browser_version","environment.device","environment.app"];function Qt(e){let t=e.replace(/-/g,"_");return An.includes(t)?t:null}function er(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...jn],on_same:e??"nest",on_different:e?"error":"split"}};return b({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Ue(e){try{if(!e.isTTY){e.log(ge(e.packPath));return}let t=U(e.env);await(e.renderPrompt??On)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function On(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-5ZN47FAT.js"),{EvidenceViewOffer:o}=await import("./EvidenceViewOffer-WIEWCZUP.js");await new Promise(i=>{let s=n(r.default.createElement(o,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),i()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Ln(e,t,r=process.cwd(),n={}){let o=n.out??(d=>process.stdout.write(d+`
7
7
  `)),i=n.err??(d=>process.stderr.write(d+`
8
8
  `)),s=d=>(i(`evidence merge: ${d}`),2);if(!t.runId)return s("--run-id is required (merged identity is the caller's fact)");if(t.rules&&t.onCollision)return s("--rules and --on-collision are mutually exclusive");let a;if(t.onCollision!==void 0){let d=Qt(t.onCollision);if(!d)return s(`invalid --on-collision: ${t.onCollision} (expected error | prefer-first | prefer-latest | discard)`);a=d}let c=[];for(let d of e){let h=await Tn(d,r);if(!h)return s(`no pack found for "${d}"`);c.push(h)}let u=t.out?ze(r,t.out):w(t.runId,r),l=null,p;t.rules?p=ze(r,t.rules):(l=await ie.mkdtemp(tr(Dn(),"kane-merge-rules-")),p=tr(l,"merge-rules.yaml"),await ie.writeFile(p,er(a)));try{let d=await(n.mergeFn??st)(c,{runId:t.runId,out:u,rulesPath:p,title:t.title,finalize:t.finalize});return t.json?o(JSON.stringify(d)):Nn(o,d),d.output.finalized&&!t.json&&await(n.offer??Ue)({packPath:u,env:t.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:i}),0}catch(d){let h=d instanceof Error?d.message:String(d);return d?.code==="ABORT"?(i(`evidence merge: aborted \u2014 ${h}`),1):s(h)}finally{l&&await ie.rm(l,{recursive:!0,force:!0}).catch(()=>{})}}async function Tn(e,t){let r=ze(t,e);if(await rr(r))return r;let n=w(e,t);return await rr(n)?n:null}async function rr(e){try{return await ie.stat(e),!0}catch{return!1}}function Nn(e,t){let{packs:r,tests:n,output:o}=t;e(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${o.path} (${o.finalized?"sealed":"live"})`);for(let i of r.skipped)e(` skipped ${i.runId}: ${i.rule} \u2014 ${i.reason}`);for(let i of n.collisions){let s;i.action==="nest"?s=`nested into ${i.folder}, latest ${i.winner}`:i.action==="split"?s=`split into ${i.folder}`:s=`winner ${i.winner}`,e(` collision ${i.test}: ${s} (${i.rule})`)}for(let i of n.discarded)e(` discarded ${i}`)}import{copyFileSync as Mn,existsSync as Ye,mkdirSync as $n}from"fs";import{join as nr}from"path";function Fn(e,t,r){try{let n=nr(e,"auteur","execution.json");if(Ye(n))return!0;for(let o of t)if(!(!o||!Ye(o)))return $n(nr(e,"auteur"),{recursive:!0}),Mn(o,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:t.find(o=>o&&Ye(o))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{mkdirSync as Bn,writeFileSync as Vn}from"fs";import{join as ir}from"path";function Un(e,t,r){try{return Bn(ir(e,"auteur"),{recursive:!0}),Vn(ir(e,"auteur","dataset.json"),JSON.stringify(t,null,2)+`
9
9
  `,"utf8"),!0}catch(n){try{r?.("debug","EVIDENCE_DATASET_WRITE_FAILED","auteur dataset record write failed",{dataset_id:t.dataset_id,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as zn}from"fs";import{join as Yn}from"path";var or="module_block";var Hn=new Set(["generative_block",or]);function Ke(e){let t=[],r=!0,n=i=>{if(i===null||typeof i!="object")return;let s=i;if(Array.isArray(s.operations))for(let a of s.operations){let c=a?.operation_id;typeof c=="string"&&c&&t.push(c)}if(Array.isArray(s.children)){Hn.has(s.content_type)||(r=!1);for(let a of s.children)n(a)}if(Array.isArray(s.branches)){r=!1;for(let a of s.branches){let c=a?.children;if(Array.isArray(c))for(let u of c)n(u)}}},o=e?.instructions;if(Array.isArray(o))for(let i of o)n(i);return{ids:t,linear:r}}function Kn(e){return Ke(e).ids}function He(e,t){let r=new Set(t.map(a=>a.action_id).filter(Boolean)),n=-1;for(let a of r){let c=e.indexOf(a);c>n&&(n=c)}let o=t.reduce((a,c)=>Math.max(a,c.ordinal),0),i=new Set,s=[];for(let a of e.slice(n+1))r.has(a)||i.has(a)||(i.add(a),s.push({id:a,ordinal:++o,status:"skipped",action_id:a}));return s}function sr(e,t){let r=new Set(t),n=e.filter(i=>i.action_id);if(n.some(i=>r.has(i.action_id))||n.length>t.length)return null;let o=0;return e.map(i=>i.action_id?{...i,action_id:t[o++]}:i)}function Gn(e,t){if(e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(t[r]!==e[r].action_id)return!1;return!0}function qn(e,t,r,n=!0){if(t.length===0)return{steps:e,tail:[]};let o=(r&&n?sr(e,t):null)??e,i=o.filter(a=>a.action_id),s=new Set(t);return i.length>0&&i.every(a=>s.has(a.action_id))?{steps:o,tail:He(t,o)}:i.length>0&&!Gn(i,t)?{steps:o,tail:[],unjoined:!0}:{steps:o,tail:He(t,o)}}function ar(e){try{let t=zn(Yn(e,"auteur","execution.json"),"utf8");return Ke(JSON.parse(t))}catch{return{ids:[],linear:!0}}}function Wn(e){return ar(e).ids}export{D as a,_e as b,ve as c,he as d,ye as e,we as f,ke as g,dr as h,be as i,xe as j,lr as k,pr as l,Ie as m,ee as n,Ee as o,Pe as p,Ce as q,Ae as r,mr as s,fr as t,je as u,gr as v,Oe as w,De as x,Le as y,Mt as z,Ne as A,Me as B,Bt as C,Lr as D,z as E,Vr as F,qt as G,Xt as H,ns as I,is as J,os as K,ss as L,as as M,Zt as N,hn as O,yn as P,wn as Q,kn as R,Pn as S,er as T,Ue as U,Ln as V,Fn as W,Un as X,or as Y,Ke as Z,Kn as _,He as $,sr as aa,qn as ba,ar as ca,Wn as da};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-MGNRNLBE.js";import{a as p}from"./chunk-RZ4F3BHX.js";function f(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=new Array(t.length+1),o=new Array(t.length+1);for(let r=0;r<=t.length;r++)n[r]=r;for(let r=1;r<=e.length;r++){o[0]=r;for(let i=1;i<=t.length;i++){let s=e[r-1]===t[i-1]?0:1;o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+s)}[n,o]=[o,n]}return n[t.length]}function C(e){let t=e.indexOf(".");return t>=0?e.slice(0,t):e}function l(e){return e.toLowerCase().replace(/\+/g,"plus").replace(/[^a-z0-9]/g,"")}function u(e){return e==="ios"?{os:"iOS",device:"simulator",target:"simulator"}:{os:"Android",device:"emulator",target:"emulator"}}var x=.4,y=3;function _(e,t,n){let o=l(t);if(o==="")return[];let r=Math.max(1,Math.round(o.length*x)),i=[];for(let s of e.devices){if(n&&!s.osVersions.includes(n))continue;let a=Math.min(f(o,l(s.name)),s.configName?f(o,l(s.configName)):1/0);a<=r&&i.push({device:s,score:a})}return i.sort((s,a)=>s.score-a.score||s.device.name.localeCompare(a.device.name)),i.slice(0,y).map(s=>s.device)}function w(e,t){let n=Number.parseFloat(t);if(!Number.isFinite(n))return e.osVersions[e.osVersions.length-1];let o,r=1/0;for(let i of e.osVersions){let s=Math.abs(Number.parseFloat(i)-n);Number.isFinite(s)&&s<r&&(r=s,o=i)}return o??e.osVersions[e.osVersions.length-1]}function D(e){return` See all devices: kane-cli devices list --target ${u(e).target} --remote`}function N(e,t){let n=l(t);return e.devices.find(o=>l(o.name)===n||o.configName!==void 0&&l(o.configName)===n)}function k(e,t){return e.runson?.[C(t)]}function G(e,t,n){let o=u(e.platform),r=N(e,t);if(!r){let i=_(e,t,n),s=i.length?` Did you mean: ${i.map(a=>`${a.name} (${a.osVersions.join(", ")})`).join(`
2
+ import{a as h}from"./chunk-C2RUDJ46.js";import{a as p}from"./chunk-RZ4F3BHX.js";function f(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=new Array(t.length+1),o=new Array(t.length+1);for(let r=0;r<=t.length;r++)n[r]=r;for(let r=1;r<=e.length;r++){o[0]=r;for(let i=1;i<=t.length;i++){let s=e[r-1]===t[i-1]?0:1;o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+s)}[n,o]=[o,n]}return n[t.length]}function C(e){let t=e.indexOf(".");return t>=0?e.slice(0,t):e}function l(e){return e.toLowerCase().replace(/\+/g,"plus").replace(/[^a-z0-9]/g,"")}function u(e){return e==="ios"?{os:"iOS",device:"simulator",target:"simulator"}:{os:"Android",device:"emulator",target:"emulator"}}var x=.4,y=3;function _(e,t,n){let o=l(t);if(o==="")return[];let r=Math.max(1,Math.round(o.length*x)),i=[];for(let s of e.devices){if(n&&!s.osVersions.includes(n))continue;let a=Math.min(f(o,l(s.name)),s.configName?f(o,l(s.configName)):1/0);a<=r&&i.push({device:s,score:a})}return i.sort((s,a)=>s.score-a.score||s.device.name.localeCompare(a.device.name)),i.slice(0,y).map(s=>s.device)}function w(e,t){let n=Number.parseFloat(t);if(!Number.isFinite(n))return e.osVersions[e.osVersions.length-1];let o,r=1/0;for(let i of e.osVersions){let s=Math.abs(Number.parseFloat(i)-n);Number.isFinite(s)&&s<r&&(r=s,o=i)}return o??e.osVersions[e.osVersions.length-1]}function D(e){return` See all devices: kane-cli devices list --target ${u(e).target} --remote`}function N(e,t){let n=l(t);return e.devices.find(o=>l(o.name)===n||o.configName!==void 0&&l(o.configName)===n)}function k(e,t){return e.runson?.[C(t)]}function G(e,t,n){let o=u(e.platform),r=N(e,t);if(!r){let i=_(e,t,n),s=i.length?` Did you mean: ${i.map(a=>`${a.name} (${a.osVersions.join(", ")})`).join(`
3
3
  `)}
4
4
  `:"";return{ok:!1,code:"device_not_found",detail:`no ${o.device} device named "${t}"`+(n&&i.length?` running ${o.os} ${n}`:"")+`.
5
5
  ${s}${D(e.platform)}`}}if(!r.osVersions.includes(n)){let i=w(r,n);return{ok:!1,code:"device_os_version_unsupported",detail:`${r.name} does not run ${o.os} ${n}.
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as B}from"./chunk-RG372DON.js";import{a as N}from"./chunk-AA674WLL.js";import{a as ie,b as ae,c as ce}from"./chunk-W3USRQX6.js";import{a as H}from"./chunk-WI7K6VKQ.js";import{d as le}from"./chunk-MII3JOO3.js";import{a as $,b as X,e as M,g as se}from"./chunk-77ZZQJLX.js";import{b as oe}from"./chunk-L4UVUFL6.js";import{b as L}from"./chunk-LRXBJTD4.js";import{a as te}from"./chunk-HFJSP4KD.js";import{a as ee}from"./chunk-FCD3NYOM.js";import{a as j}from"./chunk-XZYA7DNH.js";import{a as re,b as ne}from"./chunk-B7ZX5HEN.js";import{a as K}from"./chunk-MGNRNLBE.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as O}from"./chunk-XBEYWXPV.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as b,b as p,i as Z}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{y}from"./chunk-I6OQISK4.js";import{e as S}from"./chunk-UR6MHSHU.js";var D=S(q(),1);import{existsSync as P,readFileSync as Ye,rmSync as we,unlinkSync as ze}from"fs";import{resolve as Q}from"path";import{promises as ue,realpathSync as Re}from"fs";import{homedir as Pe}from"os";import{join as V,parse as Me,relative as de,resolve as fe}from"path";var me=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),R=class extends Error{constructor(s){super(`refusing to scan '${s}'. Run from your project root, or pass --root <dir>.`);this.cwd=s;this.name="HomeRefusedError"}};function ge(e){try{return Re(fe(e))}catch{return fe(e)}}function De(e){let r=ge(e),s=ge(Pe()),n=Me(r).root;if(process.platform==="win32"){let o=t=>t.toLowerCase();return o(r)===o(s)||o(r)===o(n)}return r===s||r===n}async function U(e){if(De(e.root))throw new R(e.root);let r=e.maxEntries??5e4,s=e.maxResults??5e3,n=new Set(e.ignore??[]),o=[],t=0,i=0,a=!1,u,c=[e.root];for(;c.length>0&&!a;){let l=c.shift(),g;try{g=await ue.readdir(l,{withFileTypes:!0})}catch{continue}i++;for(let _ of g){if(t++,t>r){a=!0,u="max_entries";break}let m=_.name,T=V(l,m);if(_.isDirectory()){if(me.has(m)||m.startsWith(".")||m.startsWith("output-")||n.has(m))continue;c.push(T)}else if(_.isFile()&&m.endsWith("_test.md")&&(o.push({path:T,relPath:de(e.root,T),source:"cwd"}),o.length>=s)){a=!0,u="max_results";break}}e.onProgress?.(i,o.length)}if(!a){let g=[{dir:V(e.root,".testmuai","tests"),depth:0}];for(;g.length>0&&!a;){let{dir:_,depth:m}=g.shift(),T;try{T=await ue.readdir(_,{withFileTypes:!0})}catch{continue}i++;for(let d of T){if(t++,t>r){a=!0,u="max_entries";break}let k=d.name,w=V(_,k);if(d.isDirectory()){if(m>=20||k.startsWith(".")||k.startsWith("output-")||me.has(k))continue;g.push({dir:w,depth:m+1})}else if(d.isFile()&&k.endsWith("_test.md")&&(o.push({path:w,relPath:de(e.root,w),source:"tests-dir"}),o.length>=s)){a=!0,u="max_results";break}}}}return{results:o,aborted:a,abortReason:u,dirsScanned:i}}import{readFileSync as Ce}from"fs";function Y(e){let r;try{r=Ce(e,"utf8")}catch{return{tags:[]}}try{let{global:s}=re(e,r),n=ne(s);return{tags:s.tags??[],...n?{mobileTarget:n}:{}}}catch{let s=$e(r);return{tags:[],...s?{mobileTarget:s}:{}}}}var pe={platform:"",app:""};function $e(e){let r=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!r)return;let s=r[1].split(/\r?\n/);for(let o of s){let t=/^target:\s*['"]?(emulator|simulator|android|ios)['"]?\s*$/.exec(o);if(t)return t[1]==="android"||t[1]==="ios"?{platform:t[1],app:"",realDevice:!0}:pe}let n=s.findIndex(o=>/^target:\s*$/.test(o));if(!(n<0))return s.slice(n+1).some(o=>/^\s+\S/.test(o))?pe:void 0}function W(e){return Y(e).tags}import{mkdirSync as Ie,writeFileSync as Fe}from"fs";import{join as Oe}from"path";function he(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Ae(e){let r=ae({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation},mobile:e.framework==="appium"}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:he(e.auth.username,e.auth.access_key)},body:JSON.stringify(r.body)});if(!s.ok)throw new Error(`code-export trigger failed: ${s.status} ${await s.text()}`);e.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:e.testcaseId})}async function Le(e){let r=ce({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId}),s=e.pollIntervalMs??5e3,n=e.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let t=await A(r,{headers:{authorization:he(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(c=>setTimeout(c,s));continue}let a=(await t.json()).data?.find(c=>c.code_name==="kane-cli-trigger");if(!a){await new Promise(c=>setTimeout(c,s));continue}let u=(a.status??"").toLowerCase();if(u==="in progress"||u==="in_progress"||u==="pending"){await new Promise(c=>setTimeout(c,s));continue}if(!a.url||a.url.length===0)throw new Error(`code-export status=${a.status} but no files returned`);Ie(e.outDir,{recursive:!0});for(let c of a.url){let l=Oe(e.outDir,c.file_name),g=await A(c.file_url);if(!g.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:c.file_name,status:g.status});continue}let _=await g.text();Fe(l,_,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:a.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function _e(e){return await Ae(e),await Le(e)}var E=S(q(),1);import{existsSync as je,readFileSync as Be}from"fs";var h=S(F(),1);function Ne(e){B(e);let r=M(e);if(!je(r))return null;try{return JSON.parse(Be(r,"utf8"))}catch{return{}}}function Ue(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function We(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Je(e){return e==="tests-dir"?"\u2726":" "}function Ge(e,r){return r==="all"?!0:r==="synced"?e.status==="synced":r==="local"?e.status==="local_only":r==="never_run"?e.status==="never_run":r==="cli"?e.source==="tests-dir":r==="hand"?e.source==="cwd":!0}var z=["all","synced","local","never_run","cli","hand"];function qe(e){let r=z.indexOf(e);return z[(r+1)%z.length]}function ye({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,E.useState)([]),[i,a]=(0,E.useState)(null),[u,c]=(0,E.useState)(!0),[l,g]=(0,E.useState)("all");(0,E.useEffect)(()=>{(async()=>{try{let d=await U({root:e}),k=[];for(let w of d.results){let G=Ne(w.path);G?.org_id!==void 0&&G.org_id!==r||k.push({path:w.path,relPath:w.relPath,name:$(w.path),status:Ue(G),source:w.source,tags:W(w.path)})}t(k),c(!1)}catch(d){d instanceof R,a(d.message),c(!1)}})()},[e,r]);let _=(0,E.useMemo)(()=>o.filter(d=>Ge(d,l)).map(d=>({id:d.path,label:`${We(d.status)} ${Je(d.source)} ${d.relPath}${d.tags.length>0?` [${d.tags.join(", ")}]`:""}`})),[o,l]),m=(0,E.useMemo)(()=>Xe(l,o),[l,o]);if(i)return(0,h.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:y.red,paddingX:2,paddingY:1,children:[(0,h.jsx)(p,{color:y.red,bold:!0,children:"testmd"}),(0,h.jsx)(b,{marginTop:1,children:(0,h.jsx)(p,{color:y.red,children:i})})]});let T=l==="all"?"all":Ke(l);return(0,h.jsx)(te,{title:`testmd \xB7 filter: ${T}`,items:_,loading:u,itemNoun:"tests",onSelect:d=>{let k=o.find(w=>w.path===d.id);k&&s(k)},onCancel:n,onTab:()=>g(d=>qe(d)),extraHint:"cycle filter",footer:m})}function Ke(e){return e==="synced"?"synced (\u2601)":e==="local"?"local (\u25A3)":e==="never_run"?"never run (\u25CB)":e==="cli"?"cli-generated (\u2726)":e==="hand"?"hand-written":"all"}function Xe(e,r){let s={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?y.orange:y.dim;return(0,h.jsxs)(b,{flexDirection:"column",children:[(0,h.jsx)(p,{color:y.dim,children:"legend:"}),(0,h.jsxs)(b,{children:[(0,h.jsx)(p,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,h.jsx)(p,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,h.jsx)(p,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,h.jsxs)(b,{children:[(0,h.jsx)(p,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,h.jsx)(p,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=S(q(),1);import{existsSync as He,readFileSync as Ve}from"fs";var f=S(F(),1);function xe({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[a,u]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let l=M(e);if(He(l))try{i(JSON.parse(Ve(l,"utf8")))}catch{i(null)}},[e]),Z((l,g)=>{if(g.escape){if(a){u(!1);return}n();return}if(a){l==="y"||l==="Y"?(u(!1),s("delete")):(l==="n"||l==="N")&&u(!1);return}l==="r"&&s("run"),l==="e"&&t?.testcase_id&&s("export"),l==="d"&&u(!0),l==="v"&&o&&o()});let c=({k:l,v:g})=>g?(0,f.jsxs)(p,{children:[(0,f.jsx)(p,{color:y.dim,children:l.padEnd(14)}),g]}):null;return(0,f.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:y.orange,paddingX:2,paddingY:1,children:[(0,f.jsx)(p,{color:y.orange,bold:!0,children:r}),(0,f.jsx)(b,{marginTop:1,flexDirection:"column",children:t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c,{k:"test_id",v:t.test_id}),(0,f.jsx)(c,{k:"testcase_id",v:t.testcase_id}),(0,f.jsx)(c,{k:"project_id",v:t.project_id}),(0,f.jsx)(c,{k:"folder_id",v:t.folder_id}),(0,f.jsx)(c,{k:"org_id",v:t.org_id}),(0,f.jsx)(c,{k:"session_name",v:t.session_name}),(0,f.jsx)(c,{k:"commit_id",v:t.commit_id})]}):(0,f.jsx)(p,{color:y.dim,children:"(never run \u2014 no meta.json)"})}),a?(0,f.jsx)(b,{marginTop:1,children:(0,f.jsxs)(p,{color:y.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,f.jsx)(b,{marginTop:1,children:(0,f.jsxs)(p,{color:y.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function C(e){B(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(Ye(r,"utf8"))}catch{return null}}function ke(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return ke(e,r)?null:(process.stderr.write(`error: this test belongs to org ${e.org_id}; you are logged in as org ${r}.
2
+ import{a as B}from"./chunk-TU42YZOJ.js";import{a as N}from"./chunk-2DYHAP4E.js";import{a as ie,b as ae,c as ce}from"./chunk-W3USRQX6.js";import{a as H}from"./chunk-URH4FX3H.js";import{d as le}from"./chunk-NZ6AV2TA.js";import{a as $,b as X,e as M,g as se}from"./chunk-77ZZQJLX.js";import{b as oe}from"./chunk-ZU4W2QGM.js";import{b as L}from"./chunk-CGITGJ3I.js";import{a as te}from"./chunk-ZAFJQ3SM.js";import{a as ee}from"./chunk-FCD3NYOM.js";import{a as j}from"./chunk-XZYA7DNH.js";import{a as re,b as ne}from"./chunk-B7ZX5HEN.js";import{a as K}from"./chunk-C2RUDJ46.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as O}from"./chunk-HJMCXSUJ.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as b,b as p,i as Z}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{y}from"./chunk-D36V5OX6.js";import{e as S}from"./chunk-UR6MHSHU.js";var D=S(q(),1);import{existsSync as P,readFileSync as Ye,rmSync as we,unlinkSync as ze}from"fs";import{resolve as Q}from"path";import{promises as ue,realpathSync as Re}from"fs";import{homedir as Pe}from"os";import{join as V,parse as Me,relative as de,resolve as fe}from"path";var me=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),R=class extends Error{constructor(s){super(`refusing to scan '${s}'. Run from your project root, or pass --root <dir>.`);this.cwd=s;this.name="HomeRefusedError"}};function ge(e){try{return Re(fe(e))}catch{return fe(e)}}function De(e){let r=ge(e),s=ge(Pe()),n=Me(r).root;if(process.platform==="win32"){let o=t=>t.toLowerCase();return o(r)===o(s)||o(r)===o(n)}return r===s||r===n}async function U(e){if(De(e.root))throw new R(e.root);let r=e.maxEntries??5e4,s=e.maxResults??5e3,n=new Set(e.ignore??[]),o=[],t=0,i=0,a=!1,u,c=[e.root];for(;c.length>0&&!a;){let l=c.shift(),g;try{g=await ue.readdir(l,{withFileTypes:!0})}catch{continue}i++;for(let _ of g){if(t++,t>r){a=!0,u="max_entries";break}let m=_.name,T=V(l,m);if(_.isDirectory()){if(me.has(m)||m.startsWith(".")||m.startsWith("output-")||n.has(m))continue;c.push(T)}else if(_.isFile()&&m.endsWith("_test.md")&&(o.push({path:T,relPath:de(e.root,T),source:"cwd"}),o.length>=s)){a=!0,u="max_results";break}}e.onProgress?.(i,o.length)}if(!a){let g=[{dir:V(e.root,".testmuai","tests"),depth:0}];for(;g.length>0&&!a;){let{dir:_,depth:m}=g.shift(),T;try{T=await ue.readdir(_,{withFileTypes:!0})}catch{continue}i++;for(let d of T){if(t++,t>r){a=!0,u="max_entries";break}let k=d.name,w=V(_,k);if(d.isDirectory()){if(m>=20||k.startsWith(".")||k.startsWith("output-")||me.has(k))continue;g.push({dir:w,depth:m+1})}else if(d.isFile()&&k.endsWith("_test.md")&&(o.push({path:w,relPath:de(e.root,w),source:"tests-dir"}),o.length>=s)){a=!0,u="max_results";break}}}}return{results:o,aborted:a,abortReason:u,dirsScanned:i}}import{readFileSync as Ce}from"fs";function Y(e){let r;try{r=Ce(e,"utf8")}catch{return{tags:[]}}try{let{global:s}=re(e,r),n=ne(s);return{tags:s.tags??[],...n?{mobileTarget:n}:{}}}catch{let s=$e(r);return{tags:[],...s?{mobileTarget:s}:{}}}}var pe={platform:"",app:""};function $e(e){let r=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!r)return;let s=r[1].split(/\r?\n/);for(let o of s){let t=/^target:\s*['"]?(emulator|simulator|android|ios)['"]?\s*$/.exec(o);if(t)return t[1]==="android"||t[1]==="ios"?{platform:t[1],app:"",realDevice:!0}:pe}let n=s.findIndex(o=>/^target:\s*$/.test(o));if(!(n<0))return s.slice(n+1).some(o=>/^\s+\S/.test(o))?pe:void 0}function W(e){return Y(e).tags}import{mkdirSync as Ie,writeFileSync as Fe}from"fs";import{join as Oe}from"path";function he(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Ae(e){let r=ae({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation},mobile:e.framework==="appium"}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:he(e.auth.username,e.auth.access_key)},body:JSON.stringify(r.body)});if(!s.ok)throw new Error(`code-export trigger failed: ${s.status} ${await s.text()}`);e.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:e.testcaseId})}async function Le(e){let r=ce({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId}),s=e.pollIntervalMs??5e3,n=e.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let t=await A(r,{headers:{authorization:he(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(c=>setTimeout(c,s));continue}let a=(await t.json()).data?.find(c=>c.code_name==="kane-cli-trigger");if(!a){await new Promise(c=>setTimeout(c,s));continue}let u=(a.status??"").toLowerCase();if(u==="in progress"||u==="in_progress"||u==="pending"){await new Promise(c=>setTimeout(c,s));continue}if(!a.url||a.url.length===0)throw new Error(`code-export status=${a.status} but no files returned`);Ie(e.outDir,{recursive:!0});for(let c of a.url){let l=Oe(e.outDir,c.file_name),g=await A(c.file_url);if(!g.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:c.file_name,status:g.status});continue}let _=await g.text();Fe(l,_,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:a.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function _e(e){return await Ae(e),await Le(e)}var E=S(q(),1);import{existsSync as je,readFileSync as Be}from"fs";var h=S(F(),1);function Ne(e){B(e);let r=M(e);if(!je(r))return null;try{return JSON.parse(Be(r,"utf8"))}catch{return{}}}function Ue(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function We(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Je(e){return e==="tests-dir"?"\u2726":" "}function Ge(e,r){return r==="all"?!0:r==="synced"?e.status==="synced":r==="local"?e.status==="local_only":r==="never_run"?e.status==="never_run":r==="cli"?e.source==="tests-dir":r==="hand"?e.source==="cwd":!0}var z=["all","synced","local","never_run","cli","hand"];function qe(e){let r=z.indexOf(e);return z[(r+1)%z.length]}function ye({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,E.useState)([]),[i,a]=(0,E.useState)(null),[u,c]=(0,E.useState)(!0),[l,g]=(0,E.useState)("all");(0,E.useEffect)(()=>{(async()=>{try{let d=await U({root:e}),k=[];for(let w of d.results){let G=Ne(w.path);G?.org_id!==void 0&&G.org_id!==r||k.push({path:w.path,relPath:w.relPath,name:$(w.path),status:Ue(G),source:w.source,tags:W(w.path)})}t(k),c(!1)}catch(d){d instanceof R,a(d.message),c(!1)}})()},[e,r]);let _=(0,E.useMemo)(()=>o.filter(d=>Ge(d,l)).map(d=>({id:d.path,label:`${We(d.status)} ${Je(d.source)} ${d.relPath}${d.tags.length>0?` [${d.tags.join(", ")}]`:""}`})),[o,l]),m=(0,E.useMemo)(()=>Xe(l,o),[l,o]);if(i)return(0,h.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:y.red,paddingX:2,paddingY:1,children:[(0,h.jsx)(p,{color:y.red,bold:!0,children:"testmd"}),(0,h.jsx)(b,{marginTop:1,children:(0,h.jsx)(p,{color:y.red,children:i})})]});let T=l==="all"?"all":Ke(l);return(0,h.jsx)(te,{title:`testmd \xB7 filter: ${T}`,items:_,loading:u,itemNoun:"tests",onSelect:d=>{let k=o.find(w=>w.path===d.id);k&&s(k)},onCancel:n,onTab:()=>g(d=>qe(d)),extraHint:"cycle filter",footer:m})}function Ke(e){return e==="synced"?"synced (\u2601)":e==="local"?"local (\u25A3)":e==="never_run"?"never run (\u25CB)":e==="cli"?"cli-generated (\u2726)":e==="hand"?"hand-written":"all"}function Xe(e,r){let s={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?y.orange:y.dim;return(0,h.jsxs)(b,{flexDirection:"column",children:[(0,h.jsx)(p,{color:y.dim,children:"legend:"}),(0,h.jsxs)(b,{children:[(0,h.jsx)(p,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,h.jsx)(p,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,h.jsx)(p,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,h.jsxs)(b,{children:[(0,h.jsx)(p,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,h.jsx)(p,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=S(q(),1);import{existsSync as He,readFileSync as Ve}from"fs";var f=S(F(),1);function xe({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[a,u]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let l=M(e);if(He(l))try{i(JSON.parse(Ve(l,"utf8")))}catch{i(null)}},[e]),Z((l,g)=>{if(g.escape){if(a){u(!1);return}n();return}if(a){l==="y"||l==="Y"?(u(!1),s("delete")):(l==="n"||l==="N")&&u(!1);return}l==="r"&&s("run"),l==="e"&&t?.testcase_id&&s("export"),l==="d"&&u(!0),l==="v"&&o&&o()});let c=({k:l,v:g})=>g?(0,f.jsxs)(p,{children:[(0,f.jsx)(p,{color:y.dim,children:l.padEnd(14)}),g]}):null;return(0,f.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:y.orange,paddingX:2,paddingY:1,children:[(0,f.jsx)(p,{color:y.orange,bold:!0,children:r}),(0,f.jsx)(b,{marginTop:1,flexDirection:"column",children:t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c,{k:"test_id",v:t.test_id}),(0,f.jsx)(c,{k:"testcase_id",v:t.testcase_id}),(0,f.jsx)(c,{k:"project_id",v:t.project_id}),(0,f.jsx)(c,{k:"folder_id",v:t.folder_id}),(0,f.jsx)(c,{k:"org_id",v:t.org_id}),(0,f.jsx)(c,{k:"session_name",v:t.session_name}),(0,f.jsx)(c,{k:"commit_id",v:t.commit_id})]}):(0,f.jsx)(p,{color:y.dim,children:"(never run \u2014 no meta.json)"})}),a?(0,f.jsx)(b,{marginTop:1,children:(0,f.jsxs)(p,{color:y.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,f.jsx)(b,{marginTop:1,children:(0,f.jsxs)(p,{color:y.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function C(e){B(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(Ye(r,"utf8"))}catch{return null}}function ke(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return ke(e,r)?null:(process.stderr.write(`error: this test belongs to org ${e.org_id}; you are logged in as org ${r}.
3
3
  Switch profiles with \`kane-cli profiles switch\` to act on it.
4
4
  `),2)}function be(){return oe(process.cwd()).kind==="remote"?{authOnly:!0}:{}}async function zt(e={}){let r=!!process.stdin.isTTY&&!e.json,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n,...be()});let o=s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,log:()=>{}});return t.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id)}}catch(t){if(t instanceof j)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function Qt(e,r){if(process.stdin.isTTY&&!e.json)return await et(r,e.root);let s=e.root??process.cwd(),n;try{n=await U({root:s,ignore:e.ignore})}catch(o){if(o instanceof R)return process.stderr.write(`error: ${o.message}
5
5
  `),2;throw o}for(let o of n.results){let t=C(o.path);if(!ke(t,r))continue;let i={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:$(o.path),has_meta:t!==null,source:o.source,synced:!!t?.testcase_id,tags:W(o.path)};t&&(t.test_id&&(i.test_id=t.test_id),t.testcase_id&&(i.testcase_id=t.testcase_id),t.org_id&&(i.org_id=t.org_id),t.project_id&&(i.project_id=t.project_id),t.folder_id&&(i.folder_id=t.folder_id)),process.stdout.write(JSON.stringify(i)+`
6
6
  `)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
7
- `),0}var Te=-1001,Ee=-1002,ve=-1003,x={action:null,path:null};function Qe(e,r){return x.action=e,x.path=r,e==="run"?Te:e==="export"?Ee:ve}function Ze({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(ye,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(xe,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Qe(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function et(e,r){let s=r??process.cwd(),{render:n}=await import("./build-5ZN47FAT.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:a}=n(D.default.createElement(Ze,{root:s,currentOrgId:e,onComplete:u=>{i(),t(u)}}),{stdout:process.stderr,exitOnCtrlC:!0});a().then(()=>t(0)).catch(()=>t(0))});if(o===Te&&x.path){let{runTestMdFile:t}=await import("./run-test-md-HE6DUWQR.js"),i=await t(x.path,{});return x.action=null,x.path=null,i}if(o===Ee&&x.path){let t=await rt(x.path,{},e);return x.action=null,x.path=null,t}if(o===ve&&x.path){let t=await tt(x.path,!0,e);return x.action=null,x.path=null,t}return o}async function Zt(e,r){let s=Q(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
7
+ `),0}var Te=-1001,Ee=-1002,ve=-1003,x={action:null,path:null};function Qe(e,r){return x.action=e,x.path=r,e==="run"?Te:e==="export"?Ee:ve}function Ze({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(ye,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(xe,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Qe(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function et(e,r){let s=r??process.cwd(),{render:n}=await import("./build-5ZN47FAT.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:a}=n(D.default.createElement(Ze,{root:s,currentOrgId:e,onComplete:u=>{i(),t(u)}}),{stdout:process.stderr,exitOnCtrlC:!0});a().then(()=>t(0)).catch(()=>t(0))});if(o===Te&&x.path){let{runTestMdFile:t}=await import("./run-test-md-BLNBK4MH.js"),i=await t(x.path,{});return x.action=null,x.path=null,i}if(o===Ee&&x.path){let t=await rt(x.path,{},e);return x.action=null,x.path=null,t}if(o===ve&&x.path){let t=await tt(x.path,!0,e);return x.action=null,x.path=null,t}return o}async function Zt(e,r){let s=Q(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
8
8
  `),2;let n=C(s),o=J(n,r);if(o!==null)return o;let t={path:s,name:$(s),has_meta:n!==null};return n&&(n.commit_id&&(t.commit_id=n.commit_id),n.test_id&&(t.test_id=n.test_id),n.testcase_id&&(t.testcase_id=n.testcase_id),n.project_id&&(t.project_id=n.project_id),n.folder_id&&(t.folder_id=n.folder_id),n.org_id&&(t.org_id=n.org_id),n.session_name&&(t.session_name=n.session_name)),process.stdout.write(JSON.stringify(t)+`
9
9
  `),0}async function tt(e,r,s){let n=Q(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
10
10
  `),2;let o=C(n),t=J(o,s);if(t!==null)return t;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as A,l as E}from"./chunk-ZZP5SHUV.js";import{d as _,e as v}from"./chunk-C6HI6Y3S.js";import{a as P}from"./chunk-4QTH7VYE.js";import{mkdtempSync as N,rmSync as B}from"fs";import{tmpdir as U}from"os";import{join as D}from"path";function T(e){let o=Promise.resolve(),i=new Map,r=s=>{try{B(s,{recursive:!0,force:!0})}catch{}};function a(s){let f=o.then(async()=>{if(i.has(s))throw new Error(`chrome slot ${s} already acquired (one acquire per worker index)`);let c=N(D(U(),"kane-testrun-chrome-")),g;try{g=await e.launch({userDataDir:c,width:e.width,height:e.height,headless:e.headless})}catch(u){throw r(c),u}return i.set(s,{chrome:g,dataDir:c}),{cdpEndpoint:g.cdpEndpoint,release(){let u=i.get(s);if(u){i.delete(s);try{u.chrome.kill()}catch{}r(u.dataDir)}}}});return o=f.catch(()=>{}),f}return{acquire:a,killAll(){for(let[,s]of i){try{s.chrome.kill()}catch{}r(s.dataDir)}i.clear()}}}var x=4;function Y(e){let o=T(e);return{kind:"local",maxParallel:x,async acquire(i){let r=await o.acquire(i);return{cdpEndpoint:r.cdpEndpoint,release:async()=>{r.release()}}},async releaseAll(){o.killAll()},releaseAllSync(){o.killAll()}}}function $(e){return e.replace(/([?&]capabilities=)[^&\s'"]*/g,"$1<redacted>")}function S(e){let o=new Set;for(let r of e)!r||r.length<4||(o.add(r),o.add(encodeURIComponent(r)),o.add(JSON.stringify(r).slice(1,-1)),o.add(encodeURIComponent(JSON.stringify(r).slice(1,-1))));let i=[...o].sort((r,a)=>a.length-r.length);return r=>{let a=$(r);for(let s of i)a=a.split(s).join("<redacted>");return a}}function Q(e){let o=S(e);return i=>JSON.parse(o(JSON.stringify(i)))}import{spawnSync as M}from"child_process";var h=20,ne=["us","eu","mumbai","london","oregon"],j={stage:"wss://stage-cdp.lambdatestinternal.com",prod:"wss://cdp.lambdatest.com"};function se(e,o){if(!o)return j[e];if(e!=="prod")throw new Error(`--hps-region ${o}: regional HPS hosts are prod only; stage has one host`);return`wss://cdp-${o}.lambdatestinternal.com`}function K(e,o,i,r){let a={user:o.username,accessKey:o.access_key,browserName:"Chrome"};return r&&(a.tunnel=!0,r.name&&(a.tunnelName=r.name)),`${e.replace(/\/+$/,"")}/kane-cli?capabilities=${encodeURIComponent(JSON.stringify(a))}&testId=${encodeURIComponent(i)}`}function ae(e,o,i){let r=new _(e,o.username,o.access_key);return{create:(a,s)=>r.createBrowserSession({...i(),worker_index:a,source:"explore"},{signal:s}),release:(a,s)=>r.endBrowserSession(a,{signal:s})}}var G=`
2
+ import{c as A,l as E}from"./chunk-HK62JVQM.js";import{d as _,e as v}from"./chunk-C6HI6Y3S.js";import{a as P}from"./chunk-4QTH7VYE.js";import{mkdtempSync as N,rmSync as B}from"fs";import{tmpdir as U}from"os";import{join as D}from"path";function T(e){let o=Promise.resolve(),i=new Map,r=s=>{try{B(s,{recursive:!0,force:!0})}catch{}};function a(s){let f=o.then(async()=>{if(i.has(s))throw new Error(`chrome slot ${s} already acquired (one acquire per worker index)`);let c=N(D(U(),"kane-testrun-chrome-")),g;try{g=await e.launch({userDataDir:c,width:e.width,height:e.height,headless:e.headless})}catch(u){throw r(c),u}return i.set(s,{chrome:g,dataDir:c}),{cdpEndpoint:g.cdpEndpoint,release(){let u=i.get(s);if(u){i.delete(s);try{u.chrome.kill()}catch{}r(u.dataDir)}}}});return o=f.catch(()=>{}),f}return{acquire:a,killAll(){for(let[,s]of i){try{s.chrome.kill()}catch{}r(s.dataDir)}i.clear()}}}var x=4;function Y(e){let o=T(e);return{kind:"local",maxParallel:x,async acquire(i){let r=await o.acquire(i);return{cdpEndpoint:r.cdpEndpoint,release:async()=>{r.release()}}},async releaseAll(){o.killAll()},releaseAllSync(){o.killAll()}}}function $(e){return e.replace(/([?&]capabilities=)[^&\s'"]*/g,"$1<redacted>")}function S(e){let o=new Set;for(let r of e)!r||r.length<4||(o.add(r),o.add(encodeURIComponent(r)),o.add(JSON.stringify(r).slice(1,-1)),o.add(encodeURIComponent(JSON.stringify(r).slice(1,-1))));let i=[...o].sort((r,a)=>a.length-r.length);return r=>{let a=$(r);for(let s of i)a=a.split(s).join("<redacted>");return a}}function Q(e){let o=S(e);return i=>JSON.parse(o(JSON.stringify(i)))}import{spawnSync as M}from"child_process";var h=20,ne=["us","eu","mumbai","oregon"],j={stage:"wss://stage-cdp.lambdatestinternal.com",prod:"wss://cdp.lambdatest.com"};function se(e,o){if(!o)return j[e];if(e!=="prod")throw new Error(`--hps-region ${o}: regional HPS hosts are prod only; stage has one host`);return`wss://cdp-${o}.lambdatest.com`}function K(e,o,i,r){let a={user:o.username,accessKey:o.access_key,browserName:"Chrome"};return r&&(a.tunnel=!0,r.name&&(a.tunnelName=r.name)),`${e.replace(/\/+$/,"")}/kane-cli?capabilities=${encodeURIComponent(JSON.stringify(a))}&testId=${encodeURIComponent(i)}`}function ae(e,o,i){let r=new _(e,o.username,o.access_key);return{create:(a,s)=>r.createBrowserSession({...i(),worker_index:a,source:"explore"},{signal:s}),release:(a,s)=>r.endBrowserSession(a,{signal:s})}}var G=`
3
3
  const ids = JSON.parse(process.env.KANE_HPS_IDS || "[]");
4
4
  Promise.allSettled(ids.map((id) => fetch(process.env.KANE_HPS_FORGE + "/kane-cli/v1/browser-sessions/" + encodeURIComponent(id), {
5
5
  method: "DELETE", headers: { Authorization: process.env.KANE_HPS_AUTH, Accept: "application/json" },