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

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 (375) hide show
  1. package/dist/ChatSurface-XUV3EQPZ.js +2 -0
  2. package/dist/{ChromeProfilePicker-M4WXOB5O.js → ChromeProfilePicker-FWPUDKD6.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-6MJA7DF6.js → CliFeedbackPrompt-D5L2DO6A.js} +1 -1
  4. package/dist/{CliUploadProgress-6NLS7XHH.js → CliUploadProgress-HQX57WE6.js} +1 -1
  5. package/dist/{ConfigView-O4WKZ5PU.js → ConfigView-DGQXKEON.js} +1 -1
  6. package/dist/EvidenceViewOffer-EIANIYN7.js +2 -0
  7. package/dist/FolderPicker-XOA7FTHF.js +2 -0
  8. package/dist/InfoBox-OBH7SUGC.js +2 -0
  9. package/dist/{LinksBox-DXP66H3H.js → LinksBox-WZ4RAMSH.js} +1 -1
  10. package/dist/{ProfilesView-TWOY5PVC.js → ProfilesView-AGRNPGSW.js} +1 -1
  11. package/dist/ProjectPicker-6KRLKV4U.js +2 -0
  12. package/dist/SaveSessionPrompt-J2OPDEOO.js +2 -0
  13. package/dist/SingleShotApp-QI4B2TSL.js +2 -0
  14. package/dist/{SummaryBox-IA2KS6GT.js → SummaryBox-XQJUZBAN.js} +1 -1
  15. package/dist/TestMdRunView-I4MV54FB.js +2 -0
  16. package/dist/TestrunEvidenceTable-WEIUSW3E.js +2 -0
  17. package/dist/{WhoamiView-SNL75TEF.js → WhoamiView-JQCURK2M.js} +1 -1
  18. package/dist/{app-download-UI4ABEIX.js → app-download-OU6AGH2X.js} +1 -1
  19. package/dist/{assurance-job-FFSSS4XV.js → assurance-job-ZI3L6I4F.js} +1 -1
  20. package/dist/{binary-THPLXCOD.js → binary-S5YL5GJD.js} +1 -1
  21. package/dist/bind-LIV72SEZ.js +2 -0
  22. package/dist/bootstrap-3V6TOO6I.js +2 -0
  23. package/dist/{bridge-T6QMYKED.js → bridge-SDEP7Y33.js} +1 -1
  24. package/dist/{catalog-MYPS2BXY.js → catalog-I3PC6LT6.js} +1 -1
  25. package/dist/catalog-client-WKYG3JN6.js +2 -0
  26. package/dist/{changelog-SU674BVE.js → changelog-IHNWFYWY.js} +1 -1
  27. package/dist/chat-committer-FM5NG46O.js +2 -0
  28. package/dist/{chat-controller-XINCDH6Z.js → chat-controller-FWFQVZTB.js} +1 -1
  29. package/dist/child-H2YSDFCG.js +2 -0
  30. package/dist/{chunk-QDFY5GGO.js → chunk-252GEI3H.js} +1 -1
  31. package/dist/{chunk-TNORODUF.js → chunk-2B75UL7Y.js} +1 -1
  32. package/dist/{chunk-FWDUVFS6.js → chunk-2EVP636F.js} +17 -17
  33. package/dist/{chunk-7XBNMOH4.js → chunk-2GE5X2A5.js} +1 -1
  34. package/dist/{chunk-DJC7NTLA.js → chunk-2L3A5NKZ.js} +1 -1
  35. package/dist/{chunk-CUXY6KQ2.js → chunk-2N75WO7Y.js} +1 -1
  36. package/dist/{chunk-CGITGJ3I.js → chunk-2PZKMT3I.js} +1 -1
  37. package/dist/{chunk-M43WH5DQ.js → chunk-2SY2NCOP.js} +1 -1
  38. package/dist/{chunk-Q3C6NDGI.js → chunk-32Y6QVFG.js} +1 -1
  39. package/dist/{chunk-734ORT6O.js → chunk-3OVFKUXV.js} +1 -1
  40. package/dist/{chunk-IGEAET7M.js → chunk-3T2TYDPT.js} +1 -1
  41. package/dist/{chunk-TU42YZOJ.js → chunk-3UHPVQLU.js} +1 -1
  42. package/dist/{chunk-WEIPY3CI.js → chunk-3ZPEQDXZ.js} +1 -1
  43. package/dist/{chunk-RHGW7B5Q.js → chunk-436FZ4KG.js} +1 -1
  44. package/dist/{chunk-YQ5C6UDG.js → chunk-4523YDTG.js} +1 -1
  45. package/dist/{chunk-7SY34IIL.js → chunk-45URQUAK.js} +1 -1
  46. package/dist/{chunk-VSVWNRI2.js → chunk-4BUEOKFV.js} +1 -1
  47. package/dist/{chunk-NZ6AV2TA.js → chunk-4JWJH6TB.js} +1 -1
  48. package/dist/{chunk-YPFQ4UGF.js → chunk-4MNSP4EO.js} +1 -1
  49. package/dist/{chunk-ZFMRQ57Y.js → chunk-4NUSW4A2.js} +1 -1
  50. package/dist/{chunk-FSYOTRMC.js → chunk-4R4YUOVY.js} +1 -1
  51. package/dist/{chunk-FWUPJORV.js → chunk-4SJAOAYY.js} +1 -1
  52. package/dist/{chunk-SMTBOSEJ.js → chunk-52VCA4K2.js} +1 -1
  53. package/dist/{chunk-4YW767UV.js → chunk-567D5ZTO.js} +7 -7
  54. package/dist/{chunk-W4QSZNMB.js → chunk-5IO5ZC4S.js} +1 -1
  55. package/dist/{chunk-LSDJOVWW.js → chunk-5R3ODQHH.js} +1 -1
  56. package/dist/{chunk-WXJCJL5L.js → chunk-5T6II7VN.js} +1 -1
  57. package/dist/{chunk-3YTCKCBG.js → chunk-65BG6GAE.js} +1 -1
  58. package/dist/{chunk-LAOTVZHV.js → chunk-6DZ7LVOG.js} +1 -1
  59. package/dist/chunk-6K5BEEAJ.js +2 -0
  60. package/dist/{chunk-42PALMW2.js → chunk-6TNLITJO.js} +1 -1
  61. package/dist/{chunk-VXGN3IV7.js → chunk-7C4IEL5V.js} +1 -1
  62. package/dist/{chunk-PUVMC4PX.js → chunk-7V34ZMMS.js} +1 -1
  63. package/dist/{chunk-DDZLCAEO.js → chunk-7ZJWUWSN.js} +1 -1
  64. package/dist/{chunk-ICLUC44J.js → chunk-A3TCFSCK.js} +1 -1
  65. package/dist/{chunk-F5NHG7VB.js → chunk-A4BB6GLN.js} +1 -1
  66. package/dist/{chunk-AVSMXDTX.js → chunk-AG5XJWEV.js} +1 -1
  67. package/dist/{chunk-GQRU3B54.js → chunk-AGXAJ2II.js} +1 -1
  68. package/dist/{chunk-6UVIY56J.js → chunk-AIGQCMGY.js} +1 -1
  69. package/dist/{chunk-RX6776AI.js → chunk-AU26ZZTX.js} +1 -1
  70. package/dist/{chunk-CCP4X75B.js → chunk-AUBSLPJZ.js} +1 -1
  71. package/dist/{chunk-XQMWHPZI.js → chunk-B2WFW74J.js} +1 -1
  72. package/dist/{chunk-NXRF7FFS.js → chunk-B7JLM3IX.js} +1 -1
  73. package/dist/{chunk-LUZBGTYB.js → chunk-BRVIK3BU.js} +1 -1
  74. package/dist/{chunk-URH4FX3H.js → chunk-BY2B4YJN.js} +1 -1
  75. package/dist/{chunk-Y7E5L42F.js → chunk-CBVHP7JB.js} +1 -1
  76. package/dist/{chunk-ZFM77AQU.js → chunk-CJE7PKRV.js} +1 -1
  77. package/dist/{chunk-2DYHAP4E.js → chunk-CJQUVHHS.js} +1 -1
  78. package/dist/{chunk-OFSDB7B4.js → chunk-COJINPOK.js} +2 -2
  79. package/dist/{chunk-JZP3Y4ZM.js → chunk-D6CS62O7.js} +1 -1
  80. package/dist/{chunk-457Y5TEC.js → chunk-DBTMKBHU.js} +1 -1
  81. package/dist/{chunk-CM4CHYSN.js → chunk-DHYGCHKB.js} +1 -1
  82. package/dist/{chunk-DZOYYWOW.js → chunk-DTYT6KBO.js} +1 -1
  83. package/dist/{chunk-6EB5VRAN.js → chunk-EC5IP5HZ.js} +1 -1
  84. package/dist/{chunk-35ECWCCK.js → chunk-EH43VWVR.js} +1 -1
  85. package/dist/{chunk-HQ2E2XCU.js → chunk-ENG2UTMX.js} +1 -1
  86. package/dist/{chunk-VUFIL5VR.js → chunk-EPJ5SJL2.js} +2 -2
  87. package/dist/{chunk-YHFZFV3A.js → chunk-EQWMOGLO.js} +9 -9
  88. package/dist/{chunk-XLEGGC4Y.js → chunk-EVZLINBN.js} +1 -1
  89. package/dist/{chunk-44B6THYK.js → chunk-EX6ORR7P.js} +1 -1
  90. package/dist/{chunk-EBPRPNSA.js → chunk-FBQ7PQJV.js} +1 -1
  91. package/dist/{chunk-AEWNWAXW.js → chunk-FLOQ5NZL.js} +2 -2
  92. package/dist/{chunk-LCSJ7GOG.js → chunk-FPPVNF53.js} +1 -1
  93. package/dist/{chunk-F22K3RRX.js → chunk-FPVGA6XT.js} +1 -1
  94. package/dist/{chunk-IJ2AHSWW.js → chunk-FVYIV36L.js} +1 -1
  95. package/dist/chunk-FYCD765R.js +161 -0
  96. package/dist/{chunk-AVI5H4UM.js → chunk-G2KTWFMU.js} +1 -1
  97. package/dist/{chunk-ACMBMZDQ.js → chunk-G3CYFCSR.js} +1 -1
  98. package/dist/{chunk-JNSWKGTB.js → chunk-G3J4XY3Z.js} +1 -1
  99. package/dist/{chunk-KXHJMAZU.js → chunk-GET4DINR.js} +2 -2
  100. package/dist/{chunk-54XA5MZH.js → chunk-GGS3ATPB.js} +1 -1
  101. package/dist/{chunk-C2RUDJ46.js → chunk-GGV336P5.js} +1 -1
  102. package/dist/{chunk-L5DALV5N.js → chunk-GI2JPIX5.js} +1 -1
  103. package/dist/{chunk-HAW5WEKT.js → chunk-GRO6DLN3.js} +1 -1
  104. package/dist/{chunk-3RJHXOZH.js → chunk-GXMD23XB.js} +1 -1
  105. package/dist/chunk-GYDJO32R.js +2 -0
  106. package/dist/{chunk-W7FLXW6Q.js → chunk-H4KPNGY4.js} +1 -1
  107. package/dist/{chunk-PAWQ4AKN.js → chunk-HBVHIEPB.js} +1 -1
  108. package/dist/{chunk-EF47KRUK.js → chunk-HGVM2OZU.js} +1 -1
  109. package/dist/{chunk-4QFTHUJA.js → chunk-HMQ5M4JJ.js} +1 -1
  110. package/dist/{chunk-ZTHYAHDN.js → chunk-I2VU2DTS.js} +1 -1
  111. package/dist/{chunk-7NCJMWFX.js → chunk-J4LQAT5P.js} +1 -1
  112. package/dist/{chunk-HK62JVQM.js → chunk-JCSVBD4F.js} +1 -1
  113. package/dist/{chunk-7AET4JKQ.js → chunk-JFBEHCJN.js} +1 -1
  114. package/dist/{chunk-EECDDDSB.js → chunk-JGLADDRH.js} +1 -1
  115. package/dist/{chunk-I4WXALQR.js → chunk-JOCEZK2M.js} +1 -1
  116. package/dist/{chunk-5AKJPYUW.js → chunk-JQ7ZZQXC.js} +3 -3
  117. package/dist/{chunk-C62QWG4B.js → chunk-JRSEAXFE.js} +1 -1
  118. package/dist/{chunk-D7U2M26S.js → chunk-JSLKCCD2.js} +1 -1
  119. package/dist/{chunk-RTVHJ23A.js → chunk-JT6WLJSV.js} +1 -1
  120. package/dist/{chunk-P3JXJ4BW.js → chunk-JTJ7IPNI.js} +1 -1
  121. package/dist/{chunk-ZTRRFG52.js → chunk-JX5NVKTV.js} +1 -1
  122. package/dist/{chunk-QBYENBMB.js → chunk-K2PLULJD.js} +1 -1
  123. package/dist/{chunk-RF37IJNN.js → chunk-K3OSK6PB.js} +1 -1
  124. package/dist/{chunk-3GXN6VF6.js → chunk-KDR662D2.js} +1 -1
  125. package/dist/{chunk-NLZZLANH.js → chunk-KRRZCY7U.js} +1 -1
  126. package/dist/{chunk-KODJVOCN.js → chunk-LHQUCRCH.js} +1 -1
  127. package/dist/{chunk-WOSANGV6.js → chunk-LNHBZEDC.js} +1 -1
  128. package/dist/{chunk-PZA3BSOE.js → chunk-LXM7VHYN.js} +1 -1
  129. package/dist/{chunk-D7TKE7LK.js → chunk-MHB6DMKZ.js} +1 -1
  130. package/dist/{chunk-W6HZF56M.js → chunk-MJKRJGER.js} +1 -1
  131. package/dist/{chunk-V7USCQWO.js → chunk-MKPDF26Q.js} +1 -1
  132. package/dist/{chunk-VLDCHFXF.js → chunk-MPEIMWQI.js} +1 -1
  133. package/dist/{chunk-YIKF4ERQ.js → chunk-MW2WNYJO.js} +2 -2
  134. package/dist/{chunk-MYVKUJGS.js → chunk-N3KTLWJL.js} +1 -1
  135. package/dist/{chunk-QDXKEOKI.js → chunk-NJCN6LP5.js} +6 -6
  136. package/dist/{chunk-IUQOG7Z5.js → chunk-NOFJXCYP.js} +1 -1
  137. package/dist/{chunk-I4RVVBG3.js → chunk-NTXFPNAP.js} +1 -1
  138. package/dist/{chunk-XZGEN4NU.js → chunk-ONZ2CSTZ.js} +1 -1
  139. package/dist/{chunk-UYDHOHSZ.js → chunk-OR2B6T3B.js} +1 -1
  140. package/dist/{chunk-UUJIGOEO.js → chunk-ORNVIEUA.js} +1 -1
  141. package/dist/{chunk-R7KXAISS.js → chunk-P2LDAW3C.js} +1 -1
  142. package/dist/{chunk-ECPFI75W.js → chunk-PBWYQR5I.js} +1 -1
  143. package/dist/{chunk-O3HHTKZ5.js → chunk-PCDIEYV6.js} +1 -1
  144. package/dist/{chunk-EZN7CF45.js → chunk-PL3SG3M2.js} +1 -1
  145. package/dist/{chunk-NXAJBSIF.js → chunk-PQXYHI5W.js} +1 -1
  146. package/dist/{chunk-WAOUE7MP.js → chunk-PTISAIZW.js} +1 -1
  147. package/dist/{chunk-XZYA7DNH.js → chunk-PVN64537.js} +1 -1
  148. package/dist/{chunk-NIVFEACM.js → chunk-QECTIQAC.js} +1 -1
  149. package/dist/chunk-QMOGBKJM.js +2 -0
  150. package/dist/{chunk-ZU4W2QGM.js → chunk-QQI6N3FO.js} +1 -1
  151. package/dist/{chunk-7RWP4Y3H.js → chunk-QVP4FSKT.js} +1 -1
  152. package/dist/{chunk-OCDBTAYS.js → chunk-QWZJ5QDO.js} +2 -2
  153. package/dist/{chunk-YLXWAY7D.js → chunk-RARD6TC6.js} +1 -1
  154. package/dist/chunk-RDH3E25Q.js +27 -0
  155. package/dist/{chunk-AZLNLHUA.js → chunk-RLOJH5O6.js} +1 -1
  156. package/dist/{chunk-RPRXRKKR.js → chunk-RQKMSNEU.js} +1 -1
  157. package/dist/{chunk-R4JUKTDO.js → chunk-SB6P5EQH.js} +1 -1
  158. package/dist/{chunk-TU7TVFBK.js → chunk-SBR6D6GS.js} +1 -1
  159. package/dist/{chunk-7HMSMAUG.js → chunk-TLOYTGVT.js} +5 -5
  160. package/dist/{chunk-LUR7JFPP.js → chunk-TZVPDGJD.js} +1 -1
  161. package/dist/{chunk-D756UWY2.js → chunk-U7NRZBB5.js} +1 -1
  162. package/dist/{chunk-72RC7JSA.js → chunk-UEPJ26X2.js} +1 -1
  163. package/dist/chunk-UJLULWSR.js +21 -0
  164. package/dist/{chunk-LQQNPMOD.js → chunk-ULGBK4NS.js} +1 -1
  165. package/dist/{chunk-6DZX5HLZ.js → chunk-UNWPBMVM.js} +1 -1
  166. package/dist/chunk-URAYFJGM.js +87 -0
  167. package/dist/{chunk-FIP5L6LV.js → chunk-USJ3LUAL.js} +1 -1
  168. package/dist/chunk-UUWSULIM.js +101 -0
  169. package/dist/chunk-UX2CDUPE.js +9 -0
  170. package/dist/{chunk-GXKY5A46.js → chunk-VA3BSIUQ.js} +1 -1
  171. package/dist/chunk-VQZOKTJ2.js +12 -0
  172. package/dist/{chunk-36N3EHW5.js → chunk-VVCZRCRD.js} +1 -1
  173. package/dist/{chunk-HJMCXSUJ.js → chunk-VZA7BPCK.js} +1 -1
  174. package/dist/{chunk-LIGTP3A3.js → chunk-W3NWHWK2.js} +1 -1
  175. package/dist/{chunk-E6KSRQXL.js → chunk-WERIGVOH.js} +1 -1
  176. package/dist/{chunk-ETZMFRD6.js → chunk-WKZLK57W.js} +1 -1
  177. package/dist/{chunk-3OQW2GTA.js → chunk-WQR2GYP7.js} +1 -1
  178. package/dist/{chunk-SGPAM5DZ.js → chunk-WX4VGH5Q.js} +1 -1
  179. package/dist/{chunk-OJ33Q6DU.js → chunk-WZLDFEWR.js} +1 -1
  180. package/dist/{chunk-ZAFJQ3SM.js → chunk-X3J4CC27.js} +1 -1
  181. package/dist/chunk-XLQ4F6BI.js +9 -0
  182. package/dist/{chunk-XRNQSXOM.js → chunk-XMALVGH7.js} +2 -2
  183. package/dist/{chunk-TW5AA5A7.js → chunk-Y3YULFCK.js} +1 -1
  184. package/dist/{chunk-7YT4TTKL.js → chunk-YGMQXS2J.js} +1 -1
  185. package/dist/{chunk-RDP7GWSY.js → chunk-YH4VZVHJ.js} +1 -1
  186. package/dist/{chunk-YGRULEZY.js → chunk-YI4ESDAX.js} +1 -1
  187. package/dist/{chunk-YAW6JW6D.js → chunk-YKL5H4K6.js} +1 -1
  188. package/dist/{chunk-VX657KIK.js → chunk-YKOEABP2.js} +1 -1
  189. package/dist/{chunk-3E4ZO73O.js → chunk-YYVBE6W2.js} +1 -1
  190. package/dist/{chunk-MEKPGQAM.js → chunk-Z5BFCTHI.js} +2 -2
  191. package/dist/{chunk-UEE3RZN4.js → chunk-Z777GGHB.js} +1 -1
  192. package/dist/{chunk-7NPTL66J.js → chunk-ZGQM6KWN.js} +1 -1
  193. package/dist/{chunk-QENCC2ZS.js → chunk-ZI3X7DI2.js} +1 -1
  194. package/dist/{chunk-3F5FMH76.js → chunk-ZKPY3AXW.js} +1 -1
  195. package/dist/chunk-ZRDX2ARO.js +4 -0
  196. package/dist/{chunk-MNBGG4H3.js → chunk-ZTAZ2R5Z.js} +1 -1
  197. package/dist/{chunk-LKQFG4RW.js → chunk-ZY65IZJR.js} +1 -1
  198. package/dist/{chunk-WZXPF3BI.js → chunk-ZZNQIFFI.js} +1 -1
  199. package/dist/commands-QOORPTSI.js +2 -0
  200. package/dist/{committer-JGY66PFM.js → committer-26UZDYSA.js} +1 -1
  201. package/dist/{config-754B73XK.js → config-B472DZSR.js} +1 -1
  202. package/dist/{cover-cmd-NBNZCR6C.js → cover-cmd-3VO6QC5Y.js} +1 -1
  203. package/dist/{credentials-F7DYLVWY.js → credentials-TLT3RQOO.js} +1 -1
  204. package/dist/{deps-bundle-PW3WEQJ7.js → deps-bundle-CMTIWBS5.js} +1 -1
  205. package/dist/{deps-resolve-SQYVN76L.js → deps-resolve-XLFZK74A.js} +1 -1
  206. package/dist/{design-chat-F3OEZPNJ.js → design-chat-I7X3QDDY.js} +1 -1
  207. package/dist/design-committer-Y7R56RFZ.js +2 -0
  208. package/dist/design-headless-HUQOXLZB.js +2 -0
  209. package/dist/{design-remote-2BEGCVCX.js → design-remote-UDC5FP45.js} +2 -2
  210. package/dist/device-env-MMGISNHN.js +2 -0
  211. package/dist/dispatch-P2445PUU.js +2 -0
  212. package/dist/{doctor-XY26Z35T.js → doctor-UHFCIM4B.js} +1 -1
  213. package/dist/{docx-convert-6IZO5P5K.js → docx-convert-N4KMLLKO.js} +1 -1
  214. package/dist/{dossier-NROC2MCY.js → dossier-6KMKEIXV.js} +1 -1
  215. package/dist/evidence-M3JTOJNL.js +2 -0
  216. package/dist/{evidence-presentation-YYTIDCBS.js → evidence-presentation-DV3DRB4S.js} +1 -1
  217. package/dist/evolve-cmd-K3JXACMN.js +2 -0
  218. package/dist/{evolve-remote-WLVY3QID.js → evolve-remote-CUDVV2O2.js} +1 -1
  219. package/dist/{exit-manager-EDHCETUN.js → exit-manager-EGWAZHCR.js} +1 -1
  220. package/dist/{explain-cmd-OP5I5W3O.js → explain-cmd-235TY7QX.js} +1 -1
  221. package/dist/{explain-cmd-VYAANFFZ.js → explain-cmd-R67B4YR3.js} +1 -1
  222. package/dist/explore-UDD5FHXW.js +2 -0
  223. package/dist/{explore-context-tty-RZ7D2TBV.js → explore-context-tty-YXEFT32U.js} +1 -1
  224. package/dist/{explore-entry-EKXJ67BD.js → explore-entry-V6L5FSP4.js} +4 -4
  225. package/dist/{explore-live-2YVRAQZO.js → explore-live-N5VBLBUI.js} +1 -1
  226. package/dist/{explore-run-tty-D47FGPX7.js → explore-run-tty-ZZQ33GNA.js} +2 -2
  227. package/dist/{extract-bind-W2NET364.js → extract-bind-BTINHHE5.js} +3 -3
  228. package/dist/{extract-chat-M65NWGUK.js → extract-chat-ABZ5S7UU.js} +1 -1
  229. package/dist/{extract-cmd-FTFLETOP.js → extract-cmd-45OZETCM.js} +2 -2
  230. package/dist/extract-headless-ALEFAMVS.js +2 -0
  231. package/dist/{feeder-NY45UFJK.js → feeder-L55TH2NC.js} +1 -1
  232. package/dist/folder-flags-HTKJCXKB.js +2 -0
  233. package/dist/{gaps-cmd-OIDDLRYL.js → gaps-cmd-ROGQWK5X.js} +1 -1
  234. package/dist/{gate-WISOUTHQ.js → gate-QA5J7UZA.js} +1 -1
  235. package/dist/gate-XFFFX5ZF.js +2 -0
  236. package/dist/{generate-headless-RURIEKVS.js → generate-headless-DAH3HHRQ.js} +2 -2
  237. package/dist/hold-passthrough-K5PP26CP.js +2 -0
  238. package/dist/impact-cmd-3VFJAKYK.js +11 -0
  239. package/dist/index.js +171 -165
  240. package/dist/ingest-S5R736ZV.js +2 -0
  241. package/dist/{ingest-cmd-4G2AK4Y2.js → ingest-cmd-YSEH5EPU.js} +3 -3
  242. package/dist/ingest-remote-C6AP2Q7E.js +2 -0
  243. package/dist/install-B26Y2NU4.js +2 -0
  244. package/dist/{interactive-bind-SI2ZS55Q.js → interactive-bind-P3GTFIZM.js} +4 -4
  245. package/dist/{interactive-remote-J56EWJGA.js → interactive-remote-PBRQHTAF.js} +2 -2
  246. package/dist/lane-7IEAE6AC.js +2 -0
  247. package/dist/lattice-auth-7EL4ET3P.js +2 -0
  248. package/dist/{lifecycle-cmd-HJ37LTXE.js → lifecycle-cmd-PUNFWKV5.js} +1 -1
  249. package/dist/{list-cmd-6XL2FYLQ.js → list-cmd-RD7YBF4S.js} +1 -1
  250. package/dist/list-commands-UZELZAB3.js +2 -0
  251. package/dist/{list-remote-LXPQNXYN.js → list-remote-KGKXPCQA.js} +1 -1
  252. package/dist/{locks-cmd-JJ2QNTNY.js → locks-cmd-LXZ6I4QG.js} +1 -1
  253. package/dist/{logical-ids-RXAQJZ3T.js → logical-ids-D5PFYY4C.js} +1 -1
  254. package/dist/login-flow-CHLGQGHK.js +2 -0
  255. package/dist/{maintenance-cmd-BXXHP36K.js → maintenance-cmd-WRWBCP3R.js} +1 -1
  256. package/dist/{mobile-prompts-CECJ5UY2.js → mobile-prompts-Z7NQHRGP.js} +1 -1
  257. package/dist/{onboarding-PDVYMTY5.js → onboarding-ZP4XDYEO.js} +1 -1
  258. package/dist/{open-provider-OZAG6WZS.js → open-provider-U26BBVUE.js} +1 -1
  259. package/dist/pdf-convert-LMKOKLXT.js +2 -0
  260. package/dist/{persist-recorded-session-A3ID7JFA.js → persist-recorded-session-4IRYG5CJ.js} +1 -1
  261. package/dist/phase-seed-2H6OXZXT.js +2 -0
  262. package/dist/pipeline-U7D25NST.js +2 -0
  263. package/dist/policy-commands-TY6WOR73.js +8 -0
  264. package/dist/prepare-target-EVL2QSXA.js +2 -0
  265. package/dist/{pull-cmd-UPFQYUND.js → pull-cmd-QJQANBAW.js} +1 -1
  266. package/dist/pull-route-AIOTLA3D.js +2 -0
  267. package/dist/{readmodel-INMP6MNW.js → readmodel-KXCFPL2M.js} +1 -1
  268. package/dist/real-device-run-QODMDUXF.js +2 -0
  269. package/dist/{reconcile-cmd-JBH365JL.js → reconcile-cmd-IJTQAJZX.js} +4 -4
  270. package/dist/reconcile-deps-2CTIFXDR.js +2 -0
  271. package/dist/{reconcile-remote-BCX6SWFC.js → reconcile-remote-23D6SXXT.js} +2 -2
  272. package/dist/{recording-banner-YKBAL6UB.js → recording-banner-MNRMMEX4.js} +1 -1
  273. package/dist/registry-MZYBLEW2.js +2 -0
  274. package/dist/remote-entry-DW2J56N4.js +2 -0
  275. package/dist/remote-mode-AFNCN6EE.js +4 -0
  276. package/dist/{remote-words-YVB66R3F.js → remote-words-RCNFI2TQ.js} +1 -1
  277. package/dist/{require-project-folder-MLMEQJYP.js → require-project-folder-7UH43GHI.js} +1 -1
  278. package/dist/{resolve-run-intent-PC7TQZUL.js → resolve-run-intent-XEWFYMGN.js} +1 -1
  279. package/dist/{resolver-EID34LQE.js → resolver-QMPX6RBR.js} +1 -1
  280. package/dist/{revert-FHOBLZWF.js → revert-37346WLE.js} +1 -1
  281. package/dist/{review-cmd-EUHFLFMY.js → review-cmd-2OECKNL5.js} +1 -1
  282. package/dist/run-JWOHNWA3.js +2 -0
  283. package/dist/run-QFJ6ZRVD.js +2 -0
  284. package/dist/run-remote-66QTUQ2M.js +2 -0
  285. package/dist/{run-startup-gate-YO66G6LS.js → run-startup-gate-USQFSW47.js} +1 -1
  286. package/dist/run-test-md-7DRWCSQE.js +19 -0
  287. package/dist/session-worker.js +2 -2
  288. package/dist/{sessions-cmd-S7WZBUCN.js → sessions-cmd-LQ2LZQOC.js} +2 -2
  289. package/dist/{sessions-remote-IWHWIQ2T.js → sessions-remote-H7CQST42.js} +1 -1
  290. package/dist/{skill-installer-MAVQY6GW.js → skill-installer-LKYY6XFJ.js} +1 -1
  291. package/dist/{store-MSA7KASS.js → store-KM5MG3XB.js} +1 -1
  292. package/dist/store-choice-4J2NN6OQ.js +2 -0
  293. package/dist/store-guard-34GG2TW2.js +2 -0
  294. package/dist/{store-site-KA2DNBGY.js → store-site-ZSFINU6C.js} +1 -1
  295. package/dist/stream-warnings-N4KVVWXV.js +2 -0
  296. package/dist/sync-cmd-3CHSWWWW.js +2 -0
  297. package/dist/{sync-setup-RBRDUV7Q.js → sync-setup-QQXYO6R4.js} +1 -1
  298. package/dist/tcg-generate-IPD5FQUW.js +2 -0
  299. package/dist/{test-definition-VRI4YIYL.js → test-definition-53XNBEDE.js} +1 -1
  300. package/dist/testmd-actions-V7P7BMKE.js +2 -0
  301. package/dist/{testmd-sync-UPAA5UMD.js → testmd-sync-PQ4GFKHB.js} +1 -1
  302. package/dist/tms-client-XWCR7O7J.js +2 -0
  303. package/dist/token-refresh-LR33BKAB.js +2 -0
  304. package/dist/{use-case-ref-NE4X4MZN.js → use-case-ref-NA3IXGQW.js} +1 -1
  305. package/dist/{validate-basic-M5JHHNZA.js → validate-basic-3DX3MMC7.js} +1 -1
  306. package/dist/verdicts-7GKZEDHV.js +2 -0
  307. package/dist/{version-check-Q737BE65.js → version-check-OV6AOVED.js} +1 -1
  308. package/dist/{view-cmd-XSNL5DGI.js → view-cmd-QDKBBNIU.js} +1 -1
  309. package/dist/{walk-session-SHGYLFRB.js → walk-session-BAYYPIKN.js} +1 -1
  310. package/dist/with-telemetry-62LW4VFI.js +2 -0
  311. package/package.json +12 -12
  312. package/dist/ChatSurface-6NZGMNHL.js +0 -2
  313. package/dist/EvidenceViewOffer-WIEWCZUP.js +0 -2
  314. package/dist/FolderPicker-AF7ZMV3M.js +0 -2
  315. package/dist/InfoBox-D7GGZJU4.js +0 -2
  316. package/dist/ProjectPicker-OBYHJJLU.js +0 -2
  317. package/dist/SaveSessionPrompt-7XSHS4NL.js +0 -2
  318. package/dist/SingleShotApp-XQUDR36R.js +0 -2
  319. package/dist/TestMdRunView-LS2QUFWR.js +0 -2
  320. package/dist/TestrunEvidenceTable-HNDVJDIF.js +0 -2
  321. package/dist/bind-4XWK3DG2.js +0 -2
  322. package/dist/bootstrap-6ACT4ALI.js +0 -2
  323. package/dist/chat-committer-ZCSRJEUB.js +0 -2
  324. package/dist/child-G2GCW73X.js +0 -2
  325. package/dist/chunk-65VANXOF.js +0 -147
  326. package/dist/chunk-C6HI6Y3S.js +0 -2
  327. package/dist/chunk-D36V5OX6.js +0 -2
  328. package/dist/chunk-HCJ2N3XB.js +0 -12
  329. package/dist/chunk-NC7D7GOM.js +0 -21
  330. package/dist/chunk-OGFU4YY4.js +0 -2
  331. package/dist/chunk-VZ4A6WMK.js +0 -97
  332. package/dist/chunk-W54OT2FU.js +0 -9
  333. package/dist/chunk-W72ACCFL.js +0 -27
  334. package/dist/design-committer-TRYP3LOZ.js +0 -2
  335. package/dist/design-headless-OTHYOX3E.js +0 -2
  336. package/dist/device-env-CHFRRV6W.js +0 -2
  337. package/dist/dispatch-DVQ3H7EJ.js +0 -2
  338. package/dist/evidence-P6FFKC7B.js +0 -2
  339. package/dist/evolve-cmd-WWOB3QJR.js +0 -2
  340. package/dist/explore-K5YBGHK6.js +0 -2
  341. package/dist/extract-headless-G6W6JQ27.js +0 -2
  342. package/dist/folder-flags-KKIH654K.js +0 -2
  343. package/dist/gate-7AKRPRMK.js +0 -2
  344. package/dist/hold-passthrough-IOWPVB4W.js +0 -2
  345. package/dist/ingest-PDGS5ZTL.js +0 -2
  346. package/dist/ingest-remote-SSLUHQVG.js +0 -2
  347. package/dist/install-ZVBHPXGP.js +0 -2
  348. package/dist/lane-AQYRIW24.js +0 -2
  349. package/dist/lattice-auth-6FEVSR7E.js +0 -2
  350. package/dist/list-commands-5DCCKU3L.js +0 -2
  351. package/dist/login-flow-WEK3E476.js +0 -2
  352. package/dist/pdf-convert-447ACUB3.js +0 -2
  353. package/dist/phase-seed-LCJ4WSYV.js +0 -2
  354. package/dist/pipeline-GX3LKPI5.js +0 -2
  355. package/dist/prepare-target-FMT6QFHZ.js +0 -2
  356. package/dist/pull-route-FWBXJMR7.js +0 -2
  357. package/dist/real-device-run-X7JJWOIK.js +0 -2
  358. package/dist/reconcile-deps-TWJ3FTSU.js +0 -2
  359. package/dist/registry-VQC757MJ.js +0 -2
  360. package/dist/remote-entry-X6JMPC2K.js +0 -2
  361. package/dist/remote-mode-FDPA7EWG.js +0 -4
  362. package/dist/run-5RQUCNYP.js +0 -2
  363. package/dist/run-PC5YO4AS.js +0 -2
  364. package/dist/run-remote-SJCRTL7O.js +0 -2
  365. package/dist/run-test-md-BLNBK4MH.js +0 -17
  366. package/dist/store-choice-3OJCV26J.js +0 -2
  367. package/dist/store-guard-OOSDLMEC.js +0 -2
  368. package/dist/stream-warnings-GEQKKJU7.js +0 -2
  369. package/dist/sync-cmd-RDFDMVKQ.js +0 -2
  370. package/dist/tcg-generate-KIECTZ2C.js +0 -2
  371. package/dist/testmd-actions-CMAG6HWI.js +0 -2
  372. package/dist/tms-client-NXAB6VJD.js +0 -2
  373. package/dist/token-refresh-KP3AYMYK.js +0 -2
  374. package/dist/verdicts-XK3GAUX3.js +0 -2
  375. package/dist/with-telemetry-PM2HVN2B.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as V,e as W,f as Q}from"./chunk-3JLEDSG5.js";import{d as I,j as T}from"./chunk-7XBNMOH4.js";import{Ea as $,M as y}from"./chunk-UEE3RZN4.js";import{d as N}from"./chunk-KU3YHPWZ.js";import{d as h,m as S}from"./chunk-4I7YN6YY.js";function B(e,n,t){let i=S();return e===void 0||e===n?null:e==="extract"||e==="design"?{code:"WRONG_VERB",message:i.text("WRONG_VERB",{sid:t,verb:e}),next:[h(i,"next.resume_session",{verb:e,sid:t},{why:`this session belongs to a ${e} run`})]}:{code:"WRONG_VERB",message:`error: session ${t} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}function X(e){return P(e)!==null}function P(e){let n=e,t=K(n);if(t<0)return null;let i=n[t].data?.tool_calls??[],r=i.map(o=>o.id),a=n.slice(t+1);if(r.length===0||a.some(o=>o?.kind!=="tool_result"))return null;let s=new Set(a.map(o=>o.data?.tool_call_id));if(!r.every(o=>s.has(o)))return null;let c=a.find(o=>o.data?.status==="ok"&&o.data?.payload?.accepted===!0);if(!c)return null;let _=i.find(o=>o.id===c.data?.tool_call_id),w=_?.arguments;return{name:typeof _?.name=="string"?_.name:"",arguments:w!==null&&typeof w=="object"?w:{}}}function Y(e){let n=e,t=K(n);if(t<0)return!1;let i=n.slice(t+1);if(i.some(s=>s?.kind!=="tool_result"))return!1;let r=new Set(i.map(s=>s.data?.tool_call_id)),a=(n[t].data?.tool_calls??[]).filter(s=>!r.has(s.id));return a.length===1&&a[0].name==="ask_user"}function K(e){for(let n=e.length-1;n>=0;n--)if(e[n]?.kind==="assistant_turn")return n;return-1}function ce(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function G(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,t)=>({id:`o${t}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function de(e,n,t){let i=n.pending.questions.map(G),r=W(e.state.pending.answers).filter(a=>n.pending.questions.some(s=>s.id===a.id&&Q(a,s)));e.save({agent_state:n.agent_state,pending:{questions:i,proposals:n.pending.proposals??[],...r.length>0?{answers:r}:{}},assumed:n.assumed.map(a=>({questionId:a.question_id,optionId:a.option_id,flagged:!0,eventId:`assumed:${n.sid}:${a.question_id}`}))}),t?.(),e.release(),I(e.state.sid)}function pe(e,n,t,i){if(t.name.startsWith("finalize"))return{call:t.name,event_id:`${e}:ckpt:${i}`};let r=t.arguments.ops;return Array.isArray(r)&&r.length>0&&n?{call:t.name,event_prefix:`chatop:${n}:s${i}:`}:null}function ge(e,n,t){if(!t)return!0;let i=y(e).appliedEvents;if(t.event_id!==void 0)return i.has(t.event_id)||n.includes(t.event_id);let r=t.event_prefix??"";for(let a of i)if(a.startsWith(r))return!0;return n.some(a=>a.startsWith(r))}function fe(e){return`the agent's last ${e==="finalize_design"?"design phase was":e.startsWith("finalize")?"proposal was":"changes were"} not saved before the session stopped \u2014 it is sent again`}function me(e){return e===1?"your last message was sent again":`your last ${e} messages were sent again`}function U(e,n,t){return t?.call!=="finalize_design"||t.event_id===void 0?!1:y(e).appliedEvents.has(t.event_id)&&!n.includes(t.event_id)}function _e(){return"the agent's last design phase was saved before the session stopped, but not all of its files \u2014 it is sent again to write them"}function he(e){return{persist(n,t){let i=e.seqBase(),r={seq:n.seq+i,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},a={applied_events:[...new Set([...e.handle.state.applied_events,...e.store.sessions().appliedEvents(e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(G):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:e.store.serialize(e.store.head()),...(()=>{let s=n.at==="turn"&&e.awaits?P(n.delta_items):null,c=s?e.awaits(s,r.seq):null;return c?{awaits:c}:{}})(),...t?.sentUnread?.length?{sent_unread:[...t.sentUnread]}:{},...(()=>{let s=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],c=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...s.length?{ingest_registry:s}:{},...c.length?{ingest_schedule:c}:{}}})()};return e.store.sessions().persistCheckpoint(e.handle,r,a,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}function D(e,n){return!e.checkpoint&&!n&&e.agent_state.items.length===0}var m=class extends Error{constructor(t,i,r=[]){super(`${t}: ${i}`);this.code=t;this.next=r}};function we(e){return[...new Set(["extract-agent","design-agent","owner",...e?[e.id]:[]])]}async function ke(e,n,t,i={}){let r=i.deps??{},a=S(),s=e.sessions().resume(n);try{let c=s.state.checkpoint??null,_=e.sessions().hasBase(n),w=!c&&s.state.agent_state.items.length>0;if(D(s.state,_))throw new m("SESSION_KEPT_NOTHING",`session ${n} kept nothing to resume \u2014 no checkpoint, no base and no agent snapshot; start the run again`);if(!c&&!_||w)throw new m("SESSION_V1",a.text("SESSION_V1",{sid:n}),[h(a,"next.abandon_session",{sid:n},{why:"abandon the pre-checkpoint session, then start a fresh run"})]);!c&&_&&r.onWarn?.(a.text("note.chain_recovered",{sid:n}));let o=e.sessions().loadCheckpoint(n);o.orphans.length>0&&e.sessions().gcOrphans(n,o.orphans),o.fallback&&r.onWarn?.(a.text("note.chain_truncated",{sid:n,at:o.fallback.resumableAt,lost:o.fallback.turnsLost}));let u=o.base;if(i.verb){let l=B(u.verb,i.verb,n);if(l)throw new m("WRONG_VERB",l.message,l.next)}if(i.useCase!==void 0&&i.useCase!==u.use_case&&!await(r.confirmRetarget?.(u.use_case,i.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",u.use_case?`session ${n} was designing ${u.use_case}; resuming onto ${i.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${i.useCase} needs an explicit retarget`,u.use_case?[h(a,"next.resume_session",{verb:"design",sid:n},{why:`continue on ${u.use_case} (the session's own subject)`})]:[]);let g=o.kane,R=[],j=g?.read_basis??Object.fromEntries(Object.entries(s.state.read_basis));for(let[l,d]of Object.entries(j)){let p=t.heads.get(l)??null;p!==d&&R.push({subject:l,pinned:d,live:p})}u.uc_tip!==void 0&&r.liveUcTip!==void 0&&r.liveUcTip!==u.uc_tip&&R.push({subject:u.use_case??"use-case",pinned:u.uc_tip,live:r.liveUcTip}),r.locks?.reacquire?.(n);let v={...u.run_config,checkpoints:!0};delete v.resume;let x;if(o.pointer===null||o.agent===null)x=v;else{if(!o.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);x={...v,resend_open_ask:!0,resume:{schema:2,binding:o.agent.binding,base_fingerprint:o.agent.base_fingerprint,delta_items:o.agent.delta_items,last_seq:o.pointer.seq}}}let C=g?.pending.questions??[],E=l=>{let d=`resolveq:${n}:${l}`,p=`assumed:${n}:${l}`;return t.appliedEvents.has(d)||t.appliedEvents.has(p)||s.isApplied(d)||s.isApplied(p)},H=g&&C.length>0?C.filter(l=>!E(l.id)):s.state.pending.questions.filter(l=>!E(l.id)),A={redeliverReceipts:[],recommit:[]},k,b;if(g){let l={...g,applied_events:[...new Set([...g.applied_events,...s.state.applied_events])].sort()},d=u.verb==="design"&&U(e,l.applied_events,g.awaits)?g.awaits?.event_id:void 0,p;try{p=T(e,n,l,t,{...d?{resent:d}:{},verb:u.verb==="design"?"design":"extract",...u.use_case?{ucRef:u.use_case}:{},...N(String(o.agent?.binding?.template_version??""))>=8?{typedBlockers:!0}:{},...s.state.force_scope?.length?{ignoreGaps:new Set(s.state.force_scope)}:{},composeReceipt:(f,q,L)=>V(f,q,L),onNote:r.onWarn,...r.ownActors?{ownActors:r.ownActors}:{}})}catch(f){throw f instanceof $?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${f.message}`,[h(a,"next.abandon_session",{sid:n},{why:"abandon the session if the store was rebuilt"})]):f}A={redeliverReceipts:p.redeliverReceipts,recommit:p.recommit},b=p.prunedPending;let O=g.pending.proposals??[];k=(O.length>0?O:s.state.pending.proposals).filter(f=>!(typeof f.event_id=="string"&&t.appliedEvents.has(f.event_id))),(p.newlyApplied.length>0||p.prunedPending.length>0)&&s.reconcileSave({appliedEvents:p.newlyApplied,heldReceipts:[...s.state.held_receipts??[],...p.redeliverReceipts],pending:{questions:s.state.pending.questions,proposals:k,...s.state.pending.answers?.length?{answers:s.state.pending.answers}:{}}})}else{let l=s.state.pending.proposals;b=l.filter(d=>typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)),k=l.filter(d=>!(typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)))}return{kind:"v2",handle:s,base:u,view:o,kane:g,spawnConfig:x,drift:R,reconcile:A,questions:H,represent:k,prunedPending:b}}catch(c){throw s.release(),c}}export{B as a,X as b,P as c,Y as d,ce as e,de as f,pe as g,ge as h,fe as i,me as j,U as k,_e as l,he as m,D as n,m as o,we as p,ke as q};
2
+ import{b as V,e as W,f as Q}from"./chunk-3JLEDSG5.js";import{d as I,j as T}from"./chunk-2GE5X2A5.js";import{Ea as $,M as y}from"./chunk-Z777GGHB.js";import{d as N}from"./chunk-KU3YHPWZ.js";import{d as h,m as S}from"./chunk-4I7YN6YY.js";function B(e,n,t){let i=S();return e===void 0||e===n?null:e==="extract"||e==="design"?{code:"WRONG_VERB",message:i.text("WRONG_VERB",{sid:t,verb:e}),next:[h(i,"next.resume_session",{verb:e,sid:t},{why:`this session belongs to a ${e} run`})]}:{code:"WRONG_VERB",message:`error: session ${t} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}function X(e){return P(e)!==null}function P(e){let n=e,t=K(n);if(t<0)return null;let i=n[t].data?.tool_calls??[],r=i.map(o=>o.id),a=n.slice(t+1);if(r.length===0||a.some(o=>o?.kind!=="tool_result"))return null;let s=new Set(a.map(o=>o.data?.tool_call_id));if(!r.every(o=>s.has(o)))return null;let c=a.find(o=>o.data?.status==="ok"&&o.data?.payload?.accepted===!0);if(!c)return null;let _=i.find(o=>o.id===c.data?.tool_call_id),w=_?.arguments;return{name:typeof _?.name=="string"?_.name:"",arguments:w!==null&&typeof w=="object"?w:{}}}function Y(e){let n=e,t=K(n);if(t<0)return!1;let i=n.slice(t+1);if(i.some(s=>s?.kind!=="tool_result"))return!1;let r=new Set(i.map(s=>s.data?.tool_call_id)),a=(n[t].data?.tool_calls??[]).filter(s=>!r.has(s.id));return a.length===1&&a[0].name==="ask_user"}function K(e){for(let n=e.length-1;n>=0;n--)if(e[n]?.kind==="assistant_turn")return n;return-1}function ce(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function G(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,t)=>({id:`o${t}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function de(e,n,t){let i=n.pending.questions.map(G),r=W(e.state.pending.answers).filter(a=>n.pending.questions.some(s=>s.id===a.id&&Q(a,s)));e.save({agent_state:n.agent_state,pending:{questions:i,proposals:n.pending.proposals??[],...r.length>0?{answers:r}:{}},assumed:n.assumed.map(a=>({questionId:a.question_id,optionId:a.option_id,flagged:!0,eventId:`assumed:${n.sid}:${a.question_id}`}))}),t?.(),e.release(),I(e.state.sid)}function pe(e,n,t,i){if(t.name.startsWith("finalize"))return{call:t.name,event_id:`${e}:ckpt:${i}`};let r=t.arguments.ops;return Array.isArray(r)&&r.length>0&&n?{call:t.name,event_prefix:`chatop:${n}:s${i}:`}:null}function ge(e,n,t){if(!t)return!0;let i=y(e).appliedEvents;if(t.event_id!==void 0)return i.has(t.event_id)||n.includes(t.event_id);let r=t.event_prefix??"";for(let a of i)if(a.startsWith(r))return!0;return n.some(a=>a.startsWith(r))}function fe(e){return`the agent's last ${e==="finalize_design"?"design phase was":e.startsWith("finalize")?"proposal was":"changes were"} not saved before the session stopped \u2014 it is sent again`}function me(e){return e===1?"your last message was sent again":`your last ${e} messages were sent again`}function U(e,n,t){return t?.call!=="finalize_design"||t.event_id===void 0?!1:y(e).appliedEvents.has(t.event_id)&&!n.includes(t.event_id)}function _e(){return"the agent's last design phase was saved before the session stopped, but not all of its files \u2014 it is sent again to write them"}function he(e){return{persist(n,t){let i=e.seqBase(),r={seq:n.seq+i,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},a={applied_events:[...new Set([...e.handle.state.applied_events,...e.store.sessions().appliedEvents(e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(G):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:e.store.serialize(e.store.head()),...(()=>{let s=n.at==="turn"&&e.awaits?P(n.delta_items):null,c=s?e.awaits(s,r.seq):null;return c?{awaits:c}:{}})(),...t?.sentUnread?.length?{sent_unread:[...t.sentUnread]}:{},...(()=>{let s=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],c=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...s.length?{ingest_registry:s}:{},...c.length?{ingest_schedule:c}:{}}})()};return e.store.sessions().persistCheckpoint(e.handle,r,a,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}function D(e,n){return!e.checkpoint&&!n&&e.agent_state.items.length===0}var m=class extends Error{constructor(t,i,r=[]){super(`${t}: ${i}`);this.code=t;this.next=r}};function we(e){return[...new Set(["extract-agent","design-agent","owner",...e?[e.id]:[]])]}async function ke(e,n,t,i={}){let r=i.deps??{},a=S(),s=e.sessions().resume(n);try{let c=s.state.checkpoint??null,_=e.sessions().hasBase(n),w=!c&&s.state.agent_state.items.length>0;if(D(s.state,_))throw new m("SESSION_KEPT_NOTHING",`session ${n} kept nothing to resume \u2014 no checkpoint, no base and no agent snapshot; start the run again`);if(!c&&!_||w)throw new m("SESSION_V1",a.text("SESSION_V1",{sid:n}),[h(a,"next.abandon_session",{sid:n},{why:"abandon the pre-checkpoint session, then start a fresh run"})]);!c&&_&&r.onWarn?.(a.text("note.chain_recovered",{sid:n}));let o=e.sessions().loadCheckpoint(n);o.orphans.length>0&&e.sessions().gcOrphans(n,o.orphans),o.fallback&&r.onWarn?.(a.text("note.chain_truncated",{sid:n,at:o.fallback.resumableAt,lost:o.fallback.turnsLost}));let u=o.base;if(i.verb){let l=B(u.verb,i.verb,n);if(l)throw new m("WRONG_VERB",l.message,l.next)}if(i.useCase!==void 0&&i.useCase!==u.use_case&&!await(r.confirmRetarget?.(u.use_case,i.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",u.use_case?`session ${n} was designing ${u.use_case}; resuming onto ${i.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${i.useCase} needs an explicit retarget`,u.use_case?[h(a,"next.resume_session",{verb:"design",sid:n},{why:`continue on ${u.use_case} (the session's own subject)`})]:[]);let g=o.kane,R=[],j=g?.read_basis??Object.fromEntries(Object.entries(s.state.read_basis));for(let[l,d]of Object.entries(j)){let p=t.heads.get(l)??null;p!==d&&R.push({subject:l,pinned:d,live:p})}u.uc_tip!==void 0&&r.liveUcTip!==void 0&&r.liveUcTip!==u.uc_tip&&R.push({subject:u.use_case??"use-case",pinned:u.uc_tip,live:r.liveUcTip}),r.locks?.reacquire?.(n);let v={...u.run_config,checkpoints:!0};delete v.resume;let x;if(o.pointer===null||o.agent===null)x=v;else{if(!o.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);x={...v,resend_open_ask:!0,resume:{schema:2,binding:o.agent.binding,base_fingerprint:o.agent.base_fingerprint,delta_items:o.agent.delta_items,last_seq:o.pointer.seq}}}let C=g?.pending.questions??[],E=l=>{let d=`resolveq:${n}:${l}`,p=`assumed:${n}:${l}`;return t.appliedEvents.has(d)||t.appliedEvents.has(p)||s.isApplied(d)||s.isApplied(p)},H=g&&C.length>0?C.filter(l=>!E(l.id)):s.state.pending.questions.filter(l=>!E(l.id)),A={redeliverReceipts:[],recommit:[]},k,b;if(g){let l={...g,applied_events:[...new Set([...g.applied_events,...s.state.applied_events])].sort()},d=u.verb==="design"&&U(e,l.applied_events,g.awaits)?g.awaits?.event_id:void 0,p;try{p=T(e,n,l,t,{...d?{resent:d}:{},verb:u.verb==="design"?"design":"extract",...u.use_case?{ucRef:u.use_case}:{},...N(String(o.agent?.binding?.template_version??""))>=8?{typedBlockers:!0}:{},...s.state.force_scope?.length?{ignoreGaps:new Set(s.state.force_scope)}:{},composeReceipt:(f,q,L)=>V(f,q,L),onNote:r.onWarn,...r.ownActors?{ownActors:r.ownActors}:{}})}catch(f){throw f instanceof $?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${f.message}`,[h(a,"next.abandon_session",{sid:n},{why:"abandon the session if the store was rebuilt"})]):f}A={redeliverReceipts:p.redeliverReceipts,recommit:p.recommit},b=p.prunedPending;let O=g.pending.proposals??[];k=(O.length>0?O:s.state.pending.proposals).filter(f=>!(typeof f.event_id=="string"&&t.appliedEvents.has(f.event_id))),(p.newlyApplied.length>0||p.prunedPending.length>0)&&s.reconcileSave({appliedEvents:p.newlyApplied,heldReceipts:[...s.state.held_receipts??[],...p.redeliverReceipts],pending:{questions:s.state.pending.questions,proposals:k,...s.state.pending.answers?.length?{answers:s.state.pending.answers}:{}}})}else{let l=s.state.pending.proposals;b=l.filter(d=>typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)),k=l.filter(d=>!(typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)))}return{kind:"v2",handle:s,base:u,view:o,kane:g,spawnConfig:x,drift:R,reconcile:A,questions:H,represent:k,prunedPending:b}}catch(c){throw s.release(),c}}export{B as a,X as b,P as c,Y as d,ce as e,de as f,pe as g,ge as h,fe as i,me as j,U as k,_e as l,he as m,D as n,m as o,we as p,ke as q};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as h}from"./chunk-65VANXOF.js";import{b as y,c as v}from"./chunk-VZ7KXRXB.js";import{randomUUID as k,randomBytes as D}from"crypto";import{promises as i}from"fs";import{join as c}from"path";function p(t=process.cwd()){return c(t,".testmuai","evidence")}function b(t,e=process.cwd()){return c(p(e),`${t}.evidence`)}function W(){return k()}var S=/\.evidence\.tmp-(\d+)-[0-9a-f]+$/;async function _(t,e,r=process.cwd()){let n=p(r);await i.mkdir(n,{recursive:!0});let o=b(e,r),a=c(n,`${e}.evidence.tmp-${process.pid}-${D(6).toString("hex")}`);return await i.copyFile(t,a),await i.rename(a,o),o}async function I(t=process.cwd()){let e=p(t),r;try{r=await i.readdir(e)}catch{return[]}return r.filter(n=>n.endsWith(".evidence")).sort().map(n=>c(e,n))}async function L(t,e=process.cwd()){if(await P(t))return t;let r=b(t,e);return await P(r)?r:null}async function P(t){try{return await i.stat(t),!0}catch{return!1}}function E(t){try{return process.kill(t,0),!0}catch(e){return e?.code==="EPERM"}}async function M(t=process.cwd(),e=E){let r=p(t);await h(r).catch(()=>({restored:[],removed:[]}));let n=[],o=[],a;try{a=await i.readdir(r,{withFileTypes:!0})}catch{return{aborted:n,removed:o}}for(let u of a){let d=u.name.match(S);if(d){let g=Number(d[1]);if(Number.isFinite(g)&&e(g))continue;let w=c(r,u.name);await i.rm(w,{force:!0}),o.push(w);continue}if(!u.isDirectory()||!u.name.endsWith(".evidence"))continue;let m=c(r,u.name),f=c(m,"run.yaml"),s;try{s=y(await i.readFile(f,"utf8"))}catch{continue}if(s?.status!=="running")continue;let l=s?.environment?.pid;if(typeof l=="number"&&e(l))continue;let x=s?.environment?.saved===!0;s?.environment?.origin==="inline"&&!x?(await i.rm(m,{recursive:!0,force:!0}),o.push(m)):(s.status="aborted",await i.writeFile(f,v(s,{lineWidth:-1})),n.push(m))}return{aborted:n,removed:o}}export{p as a,b,W as c,_ as d,I as e,L as f,M as g};
2
+ import{c as h}from"./chunk-FYCD765R.js";import{b as y,c as v}from"./chunk-VZ7KXRXB.js";import{randomUUID as k,randomBytes as D}from"crypto";import{promises as i}from"fs";import{join as c}from"path";function p(t=process.cwd()){return c(t,".testmuai","evidence")}function b(t,e=process.cwd()){return c(p(e),`${t}.evidence`)}function W(){return k()}var S=/\.evidence\.tmp-(\d+)-[0-9a-f]+$/;async function _(t,e,r=process.cwd()){let n=p(r);await i.mkdir(n,{recursive:!0});let o=b(e,r),a=c(n,`${e}.evidence.tmp-${process.pid}-${D(6).toString("hex")}`);return await i.copyFile(t,a),await i.rename(a,o),o}async function I(t=process.cwd()){let e=p(t),r;try{r=await i.readdir(e)}catch{return[]}return r.filter(n=>n.endsWith(".evidence")).sort().map(n=>c(e,n))}async function L(t,e=process.cwd()){if(await P(t))return t;let r=b(t,e);return await P(r)?r:null}async function P(t){try{return await i.stat(t),!0}catch{return!1}}function E(t){try{return process.kill(t,0),!0}catch(e){return e?.code==="EPERM"}}async function M(t=process.cwd(),e=E){let r=p(t);await h(r).catch(()=>({restored:[],removed:[]}));let n=[],o=[],a;try{a=await i.readdir(r,{withFileTypes:!0})}catch{return{aborted:n,removed:o}}for(let u of a){let d=u.name.match(S);if(d){let g=Number(d[1]);if(Number.isFinite(g)&&e(g))continue;let w=c(r,u.name);await i.rm(w,{force:!0}),o.push(w);continue}if(!u.isDirectory()||!u.name.endsWith(".evidence"))continue;let m=c(r,u.name),f=c(m,"run.yaml"),s;try{s=y(await i.readFile(f,"utf8"))}catch{continue}if(s?.status!=="running")continue;let l=s?.environment?.pid;if(typeof l=="number"&&e(l))continue;let x=s?.environment?.saved===!0;s?.environment?.origin==="inline"&&!x?(await i.rm(m,{recursive:!0,force:!0}),o.push(m)):(s.status="aborted",await i.writeFile(f,v(s,{lineWidth:-1})),n.push(m))}return{aborted:n,removed:o}}export{p as a,b,W as c,_ as d,I as e,L as f,M as g};
@@ -1,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-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(`
2
+ import{N as v,O as x,Q as g}from"./chunk-Z5BFCTHI.js";import{a as p}from"./chunk-P2LDAW3C.js";import{a as b}from"./chunk-YDSGXB25.js";import{d as h,i as C}from"./chunk-ZY65IZJR.js";import{b as y}from"./chunk-HD6NR44L.js";import{M as E}from"./chunk-Z777GGHB.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-LIV72SEZ.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-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}
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-DW2J56N4.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-CUDVV2O2.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,22 +1,22 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as j}from"./chunk-V7USCQWO.js";import{d}from"./chunk-C6HI6Y3S.js";import{r as a}from"./chunk-NC7D7GOM.js";import{a as y}from"./chunk-C2RUDJ46.js";import{a as h}from"./chunk-HJMCXSUJ.js";var $=10,u=200,C=1e4,N=1e6;function k(t,e,r="streaming"){let n=r==="full-fetch"?N:C,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function S(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function b(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
2
+ import{a as j}from"./chunk-MKPDF26Q.js";import{e as d}from"./chunk-6K5BEEAJ.js";import{r as a}from"./chunk-UJLULWSR.js";import{a as y}from"./chunk-GGV336P5.js";import{a as h}from"./chunk-VZA7BPCK.js";var $=10,u=200,C=1e4,N=1e6;function k(t,e,r="streaming"){let n=r==="full-fetch"?N:C,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function S(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function b(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
3
3
  `)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function T(t,e,r=n=>process.stdout.write(`${n}
4
- `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:m}=await import("./token-refresh-KP3AYMYK.js"),w=await m({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(m){return{ok:!1,reason:"refresh_failed",detail:m instanceof Error?m.message:String(m)}}let c=y(e),f=await new j(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
4
+ `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:m}=await import("./token-refresh-LR33BKAB.js"),w=await m({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(m){return{ok:!1,reason:"refresh_failed",detail:m instanceof Error?m.message:String(m)}}let c=y(e),f=await new j(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
5
5
  `,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
6
6
  `,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
7
- `,exitCode:2}}}function M(t){return{id:t.project_id,name:t.name}}function O(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function _(t,e=r=>process.stdout.write(`${r}
8
- `)){e(JSON.stringify(t))}function x(t,e){if(!t)return{error:`${e} name is required: kane-cli ${e}s create "<name>"`};let r=t.trim();return r.length===0?{error:`${e} name cannot be empty or whitespace`}:r.length>255?{error:`${e} name must be <= 255 characters`}:{name:r}}async function A(t){let e=k(t.limit,t.offset);if("error"in e){process.stderr.write(`error: ${e.error}
7
+ `,exitCode:2}}}function M(t){return{id:t.project_id,name:t.name}}function O(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function x(t,e=r=>process.stdout.write(`${r}
8
+ `)){e(JSON.stringify(t))}function _(t,e){if(!t)return{error:`${e} name is required: kane-cli ${e}s create "<name>"`};let r=t.trim();return r.length===0?{error:`${e} name cannot be empty or whitespace`}:r.length>255?{error:`${e} name must be <= 255 characters`}:{name:r}}async function A(t){let e=k(t.limit,t.offset);if("error"in e){process.stderr.write(`error: ${e.error}
9
9
  `),a(2,`projects: ${e.error}`);return}let r=await p(t);if(r)try{let n=new d(r.tmsBaseUrl,r.auth.username,r.auth.access_key),{items:o,doneStreaming:i}=await P(n,t.search,e.offset,e.limit),{slice:s,hasMore:c}=b(o,e),l=!i||c,f=s.map(M);g(t)?v(f,{limit:e.limit,offset:e.offset,has_more:l}):T(f,{limit:e.limit,offset:e.offset,total:o.length,hasMore:l,totalIsLowerBound:!i}),a(0,"projects list complete")}catch(n){process.stderr.write(`error: ${n instanceof Error?n.message:String(n)}
10
- `),a(1,`projects list failed: ${n instanceof Error?n.message:String(n)}`)}}async function I(t,e){let r=x(t,"project");if("error"in r){process.stderr.write(`error: ${r.error}
11
- `),a(2,`projects create: ${r.error}`);return}let n=await p(e);if(n)try{let i=await new d(n.tmsBaseUrl,n.auth.username,n.auth.access_key).createProject(r.name,e.description),s={id:i.id,name:i.name};g(e)?_(s):(process.stdout.write(`Created project "${s.name}" (${s.id}).
10
+ `),a(1,`projects list failed: ${n instanceof Error?n.message:String(n)}`)}}async function I(t,e){let r=_(t,"project");if("error"in r){process.stderr.write(`error: ${r.error}
11
+ `),a(2,`projects create: ${r.error}`);return}let n=await p(e);if(n)try{let i=await new d(n.tmsBaseUrl,n.auth.username,n.auth.access_key).createProject(r.name,e.description),s={id:i.id,name:i.name};g(e)?x(s):(process.stdout.write(`Created project "${s.name}" (${s.id}).
12
12
  `),process.stdout.write(`Bind it to your active profile with: kane-cli config project ${s.id}
13
13
  `)),a(0,"projects create complete")}catch(o){process.stderr.write(`error: ${o instanceof Error?o.message:String(o)}
14
14
  `),a(1,`projects create failed: ${o instanceof Error?o.message:String(o)}`)}}async function L(t){let e=k(t.limit,t.offset,"full-fetch");if("error"in e){process.stderr.write(`error: ${e.error}
15
15
  `),a(2,`folders: ${e.error}`);return}let r=await p(t);if(r)try{let o=await new d(r.tmsBaseUrl,r.auth.username,r.auth.access_key).listFolders(t.project),i=S(o,t.search),{slice:s,hasMore:c}=b(i,e),l=s.map(O);g(t)?v(l,{limit:e.limit,offset:e.offset,has_more:c}):T(l,{limit:e.limit,offset:e.offset,total:i.length,hasMore:c}),a(0,"folders list complete")}catch(n){process.stderr.write(`error: ${n instanceof Error?n.message:String(n)}
16
- `),a(1,`folders list failed: ${n instanceof Error?n.message:String(n)}`)}}async function F(t,e){let r=x(t,"folder");if("error"in r){process.stderr.write(`error: ${r.error}
17
- `),a(2,`folders create: ${r.error}`);return}let n=await p(e);if(n)try{let i=await new d(n.tmsBaseUrl,n.auth.username,n.auth.access_key).createFolder(e.project,r.name,e.description),s={id:i.id,name:i.name};g(e)?_(s):(process.stdout.write(`Created folder "${s.name}" (${s.id}).
16
+ `),a(1,`folders list failed: ${n instanceof Error?n.message:String(n)}`)}}async function F(t,e){let r=_(t,"folder");if("error"in r){process.stderr.write(`error: ${r.error}
17
+ `),a(2,`folders create: ${r.error}`);return}let n=await p(e);if(n)try{let i=await new d(n.tmsBaseUrl,n.auth.username,n.auth.access_key).createFolder(e.project,r.name,e.description),s={id:i.id,name:i.name};g(e)?x(s):(process.stdout.write(`Created folder "${s.name}" (${s.id}).
18
18
  `),process.stdout.write(`Bind it to your active profile with: kane-cli config folder ${s.id}
19
19
  `)),a(0,"folders create complete")}catch(o){process.stderr.write(`error: ${o instanceof Error?o.message:String(o)}
20
20
  `),a(1,`folders create failed: ${o instanceof Error?o.message:String(o)}`)}}async function p(t){let e=new h,r=t.profile??e.getActiveProfile()??"default",n=t.env??e.getDefaultEnv(),o=y(n),i=await B(r,n,t);if(!i.ok){let{message:s,exitCode:c}=E(r,n,i);return process.stderr.write(s),a(c,`${i.reason} for "${r}" [${n}]`),null}return{profile:r,envName:n,tmsBaseUrl:o.tmsBaseUrl,auth:i.creds}}function D(t){t.command("projects").summary("List or create Test Manager projects").description("List or create Test Manager projects. `kane-cli config project <id>` makes one the project your profile uses. At a terminal you get a table; with no terminal or with --agent, one JSON object per line.").argument("<action>","'list' or 'create'").argument("[name]","Project name (required for 'create')").option("--search <term>","Server-side name search (case-insensitive substring; list only)").option("--limit <n>",`Max items to return (1-${u}, default ${$}; list only)`).option("--offset <n>","Skip N items from the start (default 0; list only)").option("--description <text>","Project description (create only; default empty)").option("--profile <name>","Profile name (default: active)").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username, used instead of your saved sign-in").option("--access-key <key>","Basic auth access key").option("--agent","Print one JSON object per line (on by itself with no terminal)").action(async(e,r,n)=>{if(e==="list")return A(n);if(e==="create")return I(r,n);process.stderr.write(`error: unknown action "${e}" (try: list, create)
21
21
  `),a(2,`projects: unknown action "${e}"`)}),t.command("folders").summary("List or create Test Manager folders").description("List or create Test Manager folders. `kane-cli config folder <id>` makes one the folder your profile uses. At a terminal you get a table; with no terminal or with --agent, one JSON object per line.").argument("<action>","'list' or 'create'").argument("[name]","Folder name (required for 'create')").requiredOption("--project <id>","Test Manager project id (needed for both list and create)").option("--search <term>","Client-side name substring filter (case-insensitive; list only)").option("--limit <n>",`Max items to return (1-${u}, default ${$}; list only)`).option("--offset <n>","Skip N items from the start (default 0; list only)").option("--description <text>","Folder description (create only; default empty)").option("--profile <name>","Profile name (default: active)").option("--env <name>","Environment (prod or stage)").option("--username <user>","Basic auth username, used instead of your saved sign-in").option("--access-key <key>","Basic auth access key").option("--agent","Print one JSON object per line (on by itself with no terminal)").action(async(e,r,n)=>{if(e==="list")return L(n);if(e==="create")return F(r,n);process.stderr.write(`error: unknown action "${e}" (try: list, create)
22
- `),a(2,`folders: unknown action "${e}"`)})}export{k as a,S as b,b as c,v as d,T as e,B as f,E as g,x as h,D as i};
22
+ `),a(2,`folders: unknown action "${e}"`)})}export{k as a,S as b,b as c,v as d,T as e,B as f,E as g,g as h,_ as i,p as j,D as k};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-LUR7JFPP.js";import{a as C}from"./chunk-HJMCXSUJ.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-D36V5OX6.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
2
+ import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-TZVPDGJD.js";import{a as C}from"./chunk-VZA7BPCK.js";import{r as m,s as u,t as f,u as x,v as y}from"./chunk-QMOGBKJM.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
3
3
  Please open this URL manually: ${e}
4
4
  `)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
5
5
  <html lang="en">
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as g}from"./chunk-W7FLXW6Q.js";import{g as d}from"./chunk-D756UWY2.js";import{a as c}from"./chunk-3GXN6VF6.js";var p=["grounding","acs","scenarios","wiring","tests"];function P(i){let t=p.filter(e=>e!=="grounding"),n=0;for(let e of i)n=Math.max(n,t.indexOf(e)+1);return n}var x={acs:"acceptance criteria",scenarios:"scenarios",wiring:"acceptance criteria + exercises",tests:"tests + gaps"};function l(i,t,n){let e=t.resolve(n);if(e===null)return[];let s=c(t,e.cid),a=d(i.recordsSince(null),s),r=a.reduce((o,m)=>Math.max(o,m.generation),0);return a.filter(o=>o.generation===r)}function S(i,t,n,e){let s=p;if(!s.includes(e))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${s.join(" | ")}, got '${e}'`,valid:[...s]};let a=new Set(l(i,t,n).map(o=>o.phase)),r=s.slice(0,s.indexOf(e)).filter(o=>o!=="grounding"&&!a.has(o));return r.length===0?{ok:!0,phase:e}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${e} needs ${r.join(" + ")} committed first (nothing recorded for ${r.join(", ")})`,missing:r,earliest:r[0]}}function E(i,t,n,e){let s=l(i,t,n),a=t.resolve(n);if(a===null)return{priorDesign:void 0,phaseLadder:s};let r=g(t,a.tip);return{priorDesign:r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0?void 0:r,phaseLadder:s}}export{p as a,P as b,x as c,l as d,S as e,E as f};
2
+ import{b as g}from"./chunk-H4KPNGY4.js";import{g as d}from"./chunk-U7NRZBB5.js";import{a as c}from"./chunk-KDR662D2.js";var p=["grounding","acs","scenarios","wiring","tests"];function P(i){let t=p.filter(e=>e!=="grounding"),n=0;for(let e of i)n=Math.max(n,t.indexOf(e)+1);return n}var x={acs:"acceptance criteria",scenarios:"scenarios",wiring:"acceptance criteria + exercises",tests:"tests + gaps"};function l(i,t,n){let e=t.resolve(n);if(e===null)return[];let s=c(t,e.cid),a=d(i.recordsSince(null),s),r=a.reduce((o,m)=>Math.max(o,m.generation),0);return a.filter(o=>o.generation===r)}function S(i,t,n,e){let s=p;if(!s.includes(e))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${s.join(" | ")}, got '${e}'`,valid:[...s]};let a=new Set(l(i,t,n).map(o=>o.phase)),r=s.slice(0,s.indexOf(e)).filter(o=>o!=="grounding"&&!a.has(o));return r.length===0?{ok:!0,phase:e}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${e} needs ${r.join(" + ")} committed first (nothing recorded for ${r.join(", ")})`,missing:r,earliest:r[0]}}function E(i,t,n,e){let s=l(i,t,n),a=t.resolve(n);if(a===null)return{priorDesign:void 0,phaseLadder:s};let r=g(t,a.tip);return{priorDesign:r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0?void 0:r,phaseLadder:s}}export{p as a,P as b,x as c,l as d,S as e,E as f};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as k,f as l}from"./chunk-Y6Y6RAY4.js";import{b as p}from"./chunk-NXAJBSIF.js";import{a as f}from"./chunk-C2RUDJ46.js";import{a as d}from"./chunk-RZ4F3BHX.js";import{promises as g}from"fs";import{basename as _,join as w}from"path";var D=3e3,S="/deviceSkin";function b(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function v(e){if(e.model){let r=b(e.model);return r?`real-${r}`:void 0}let n=e.name?.trim();return n&&!k(n)?n:void 0}function y(e){let n=e?.data?.skin,r=typeof n?.skin_url=="string"?n.skin_url.trim():"",t=n?.skin_data??{},i=u=>typeof u=="number"&&Number.isFinite(u)?u:void 0,s=i(t.width),o=i(t.height);if(!r||!s||!o)return;let m={width:s,height:o};for(let u of["top","right","bottom","left","radius"]){let c=i(t[u]);c!==void 0&&(m[u]=c)}return{skin_url:r,skin_data:m}}var a=new Map;async function h(e,n,r={}){let t=`${f(e).lrmaaBaseUrl}${S}/${encodeURIComponent(n)}`;if(a.has(t))return a.get(t);try{let i=await(r.request??d)(t,{method:"GET",signal:AbortSignal.timeout(D)});if(!i.ok)return;let s=y(await i.json());return a.set(t,s),s}catch{return}}function A(e){let n=(e??"").trim().replace(/^lt:\/\//i,"").trim();if(n)return(p(n)?n:_(n))||void 0}async function P(e){try{let n=w(e,"steps"),r=(await g.readdir(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,i)=>(parseInt(t,10)||0)-(parseInt(i,10)||0));for(let t of r)try{let i=await g.readFile(w(n,t,"step.json"),"utf8"),o=JSON.parse(i).basis?.window;if(Array.isArray(o)&&o.length===2&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))&&Number(o[0])>0&&Number(o[1])>0)return`${Math.round(Number(o[0]))}x${Math.round(Number(o[1]))}`}catch{}return}catch{return}}async function T(e,n,r){if(!e.native_platform||!n.environment)return e;let t=v({model:n.deviceModel,name:l(n.runnerEnvironment?.device)});if(!t)return e;let i=await h(n.environment,t,r);return i?{...e,skin_url:i.skin_url,skin_data:i.skin_data}:e}export{v as a,h as b,A as c,P as d,T as e};
2
+ import{e as k,f as l}from"./chunk-Y6Y6RAY4.js";import{b as p}from"./chunk-PQXYHI5W.js";import{a as f}from"./chunk-GGV336P5.js";import{a as d}from"./chunk-RZ4F3BHX.js";import{promises as g}from"fs";import{basename as _,join as w}from"path";var D=3e3,S="/deviceSkin";function b(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function v(e){if(e.model){let r=b(e.model);return r?`real-${r}`:void 0}let n=e.name?.trim();return n&&!k(n)?n:void 0}function y(e){let n=e?.data?.skin,r=typeof n?.skin_url=="string"?n.skin_url.trim():"",t=n?.skin_data??{},i=u=>typeof u=="number"&&Number.isFinite(u)?u:void 0,s=i(t.width),o=i(t.height);if(!r||!s||!o)return;let m={width:s,height:o};for(let u of["top","right","bottom","left","radius"]){let c=i(t[u]);c!==void 0&&(m[u]=c)}return{skin_url:r,skin_data:m}}var a=new Map;async function h(e,n,r={}){let t=`${f(e).lrmaaBaseUrl}${S}/${encodeURIComponent(n)}`;if(a.has(t))return a.get(t);try{let i=await(r.request??d)(t,{method:"GET",signal:AbortSignal.timeout(D)});if(!i.ok)return;let s=y(await i.json());return a.set(t,s),s}catch{return}}function A(e){let n=(e??"").trim().replace(/^lt:\/\//i,"").trim();if(n)return(p(n)?n:_(n))||void 0}async function P(e){try{let n=w(e,"steps"),r=(await g.readdir(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,i)=>(parseInt(t,10)||0)-(parseInt(i,10)||0));for(let t of r)try{let i=await g.readFile(w(n,t,"step.json"),"utf8"),o=JSON.parse(i).basis?.window;if(Array.isArray(o)&&o.length===2&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))&&Number(o[0])>0&&Number(o[1])>0)return`${Math.round(Number(o[0]))}x${Math.round(Number(o[1]))}`}catch{}return}catch{return}}async function T(e,n,r){if(!e.native_platform||!n.environment)return e;let t=v({model:n.deviceModel,name:l(n.runnerEnvironment?.device)});if(!t)return e;let i=await h(n.environment,t,r);return i?{...e,skin_url:i.skin_url,skin_data:i.skin_data}:e}export{v as a,h as b,A as c,P as d,T as e};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b,c as R}from"./chunk-72KYMWQ5.js";import{a as y}from"./chunk-TDPWFYTJ.js";import{b as v}from"./chunk-34R7BNZ2.js";import{c as S}from"./chunk-VZ7KXRXB.js";import{a as f}from"./chunk-RZ4F3BHX.js";import{b as _}from"./chunk-D36V5OX6.js";import{randomUUID as U}from"crypto";import{mkdirSync as P,writeFileSync as g,appendFileSync as G,existsSync as h,readFileSync as B}from"fs";import{join as d}from"path";import{writeFileSync as E,mkdirSync as A,existsSync as L}from"fs";import{join as c,relative as j}from"path";function I(r){let t=Object.keys(r.frontmatter).length>0?S(r.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${r.heading}`,""),r.steps.forEach((n,o)=>{s.push(`## Step ${o+1}`,n,"")}),s.join(`
2
+ import{b,c as R}from"./chunk-72KYMWQ5.js";import{a as y}from"./chunk-TDPWFYTJ.js";import{b as S}from"./chunk-34R7BNZ2.js";import{c as v}from"./chunk-VZ7KXRXB.js";import{a as f}from"./chunk-RZ4F3BHX.js";import{b as _}from"./chunk-QMOGBKJM.js";import{randomUUID as U}from"crypto";import{mkdirSync as P,writeFileSync as g,appendFileSync as G,existsSync as h,readFileSync as B}from"fs";import{join as d}from"path";import{writeFileSync as E,mkdirSync as A,existsSync as L}from"fs";import{join as c,relative as j}from"path";function I(r){let t=Object.keys(r.frontmatter).length>0?v(r.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${r.heading}`,""),r.steps.forEach((n,o)=>{s.push(`## Step ${o+1}`,n,"")}),s.join(`
3
3
  `)}var T=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),D=new Set(["model","env"]),u=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=c(this.opts.cwd,".testmuai","tests");try{A(t,{recursive:!0})}catch(a){process.stderr.write(`
4
4
  \u26A0 Failed to create ${j(this.opts.cwd,t)}/
5
5
  ${a.message}
@@ -14,5 +14,5 @@ import{b,c as R}from"./chunk-72KYMWQ5.js";import{a as y}from"./chunk-TDPWFYTJ.js
14
14
  `)}catch{}}setResolvedGlobal(e){this._resolvedGlobal={...this._resolvedGlobal,...e}}setSessionName(e){this._sessionName=e}get sessionName(){return this._sessionName}setRecordingEnabled(e){this._recordingEnabled=e}get recorder(){return this._recorder}flushRecorder(){try{this._recorder?.flush()}catch(e){process.stderr.write(`[recorder] flush failed: ${e.message}
15
15
  `)}}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{P(this.sessionDir,{recursive:!0}),this._recorder=new u({cwd:process.cwd(),getResolvedGlobal:()=>this._resolvedGlobal,getName:()=>this._sessionName});let t={session_id:this.sessionId,started_at:this._startedAt,model:e.model,environment:e.environment,profile:e.profile,plan:this._plan,objectives:[],runs:[],status:"in_progress"};g(d(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
16
16
  `)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}get apMode(){return y()??"v2"}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,n){if(t===void 0){this._log(e);let l=e.indexOf(" "),a=l>0?e.slice(0,l):e,w=l>0?e.slice(l+1):"",N=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(N,a,w||e);return}let o=e,i=s;this._log(`${t} ${i}`,n),this._remoteLogger?.log(o,t,i,n)}logStep(e,t,s){this._log(`${e} ${t}`,s);let n=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(n,e,t,s)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,s){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${s}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:s})}logRunEnd(e,t,s,n,o){let i=(s??0).toFixed(1),l=(n??"").slice(0,100),a=o==null||o===""||Number.isNaN(Number(o))?null:Number(o);this._log(`RUN ${e} END status=${t} duration=${i}s summary="${l}"`,a!=null?{result_code:a}:void 0),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:n??"",result_code:a}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){let t=new Date().toISOString();this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let s={session_id:this.sessionId,started_at:this._startedAt,ended_at:t,model:this._model,environment:this._environment,profile:this._profile,plan:this._plan,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(n=>({index:n.index,objective:n.objective,status:n.status,summary:n.summary,run_dir:n.run_dir}))};if(h(this.sessionDir)&&g(d(this.sessionDir,"session.json"),JSON.stringify(s,null,2)+`
17
- `),this.flushRecorder(),this._recorder=null,this._flows.length>0){let n=this._flows.reduce((o,i)=>o+(Number.isFinite(i.creditsConsumed)?i.creditsConsumed??0:0),0);await this.reportCompletedSession({runsCompleted:this._flows.length,completedAt:t,creditsConsumed:n})}}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setUserIdentity(e,t){e&&(this._userName=e),t&&(this._userEmail=t)}get userName(){return this._userName}get userEmail(){return this._userEmail}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},n=t.run_dirs?.length??1;for(let o=0;o<n;o++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e,t){if(!(!this._started||!h(this.sessionDir)))try{let s=new Date().toISOString().slice(0,19).replace("T"," "),n=d(this.sessionDir,"tui.log"),o=t&&Object.keys(t).length>0?` ${JSON.stringify(t)}`:"";G(n,v(`[${s}] ${e}${o}
17
+ `),this.flushRecorder(),this._recorder=null,this._flows.length>0){let n=this._flows.reduce((o,i)=>o+(Number.isFinite(i.creditsConsumed)?i.creditsConsumed??0:0),0);await this.reportCompletedSession({runsCompleted:this._flows.length,completedAt:t,creditsConsumed:n})}}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setUserIdentity(e,t){e&&(this._userName=e),t&&(this._userEmail=t)}get userName(){return this._userName}get userEmail(){return this._userEmail}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},n=t.run_dirs?.length??1;for(let o=0;o<n;o++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e,t){if(!(!this._started||!h(this.sessionDir)))try{let s=new Date().toISOString().slice(0,19).replace("T"," "),n=d(this.sessionDir,"tui.log"),o=t&&Object.keys(t).length>0?` ${JSON.stringify(t)}`:"";G(n,S(`[${s}] ${e}${o}
18
18
  `))}catch{}}};export{I as a,ee as b,C as c,x as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as l}from"./chunk-HAW5WEKT.js";import{M as f,sb as m}from"./chunk-UEE3RZN4.js";import{f as a,g as u}from"./chunk-KU3YHPWZ.js";function O(e){let i=f(e),s=new Set;for(let{cid:t}of i.byLabel(a.USECASE)){if(i.superseded.has(t)||i.trust.get(t)==="archived")continue;let o=i.displayNameOf(t);o&&s.add(o)}return s}function g(e,i){let s=f(e),t=[];for(let{cid:o,content:r}of s.byLabel(a.USECASE)){if(s.superseded.has(o)||s.trust.get(o)==="archived")continue;let d=s.displayNameOf(o);if(!d||i.has(d))continue;let n=new Set;for(let c of s.derivesInto(o)){let p=s.getNode(c.src)?.content.source_id;typeof p=="string"&&n.add(p)}t.push({id:d,title:String(r.title??""),source_ids:[...n].sort()})}return t.sort((o,r)=>o.id.localeCompare(r.id,void 0,{numeric:!0}))}function U(e,i,s){let t=f(e),r=g(e,s).filter(n=>n.source_ids.includes(i)).map(n=>({id:n.id,state:"new",units_moved:[]})),d=new Set(r.map(n=>n.id));for(let n of l(e,i)){let c=t.displayNameOf(n);!c||d.has(c)||r.push({id:c,state:"stale",units_moved:m(t,n,i)?.changed??[]})}return r.sort((n,c)=>n.id.localeCompare(c.id,void 0,{numeric:!0}))}function b(e){let i=t=>!e.superseded.has(t)&&e.trust.get(t)!=="archived",s=new Set;for(let{cid:t}of e.byLabel(a.TEST))if(i(t))for(let o of e.edgesFrom(t)){if(o.type!==u.AUTOMATES||e.superseded.has(o.ecid))continue;let r=e.tipOf(o.dst);if(i(r))for(let d of e.edgesFrom(r))d.type!==u.BELONGS_TO||e.superseded.has(d.ecid)||s.add(e.tipOf(d.dst))}return s}export{O as a,g as b,U as c,b as d};
2
+ import{c as l}from"./chunk-GRO6DLN3.js";import{M as f,sb as m}from"./chunk-Z777GGHB.js";import{f as a,g as u}from"./chunk-KU3YHPWZ.js";function O(e){let i=f(e),s=new Set;for(let{cid:t}of i.byLabel(a.USECASE)){if(i.superseded.has(t)||i.trust.get(t)==="archived")continue;let o=i.displayNameOf(t);o&&s.add(o)}return s}function g(e,i){let s=f(e),t=[];for(let{cid:o,content:r}of s.byLabel(a.USECASE)){if(s.superseded.has(o)||s.trust.get(o)==="archived")continue;let d=s.displayNameOf(o);if(!d||i.has(d))continue;let n=new Set;for(let c of s.derivesInto(o)){let p=s.getNode(c.src)?.content.source_id;typeof p=="string"&&n.add(p)}t.push({id:d,title:String(r.title??""),source_ids:[...n].sort()})}return t.sort((o,r)=>o.id.localeCompare(r.id,void 0,{numeric:!0}))}function U(e,i,s){let t=f(e),r=g(e,s).filter(n=>n.source_ids.includes(i)).map(n=>({id:n.id,state:"new",units_moved:[]})),d=new Set(r.map(n=>n.id));for(let n of l(e,i)){let c=t.displayNameOf(n);!c||d.has(c)||r.push({id:c,state:"stale",units_moved:m(t,n,i)?.changed??[]})}return r.sort((n,c)=>n.id.localeCompare(c.id,void 0,{numeric:!0}))}function b(e){let i=t=>!e.superseded.has(t)&&e.trust.get(t)!=="archived",s=new Set;for(let{cid:t}of e.byLabel(a.TEST))if(i(t))for(let o of e.edgesFrom(t)){if(o.type!==u.AUTOMATES||e.superseded.has(o.ecid))continue;let r=e.tipOf(o.dst);if(i(r))for(let d of e.edgesFrom(r))d.type!==u.BELONGS_TO||e.superseded.has(d.ecid)||s.add(e.tipOf(d.dst))}return s}export{O as a,g as b,U as c,b as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as x}from"./chunk-3OQW2GTA.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as m}from"./chunk-33DWJV67.js";import{y as i}from"./chunk-D36V5OX6.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(m,{color:i.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
2
+ import{a as u,b as x}from"./chunk-WQR2GYP7.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as m}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-QMOGBKJM.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(m,{color:i.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O,c as P}from"./chunk-SMXABALN.js";import{a as M,b as $}from"./chunk-7NPTL66J.js";import{b as I,c as L}from"./chunk-BWXLZS5O.js";import{oa as j}from"./chunk-UEE3RZN4.js";import{a as D}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as _}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{y as f}from"./chunk-D36V5OX6.js";import{e as C}from"./chunk-UR6MHSHU.js";var F={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4,tests:4};function J(e,i,n={}){let r=[],u=L(e.turns).entries.length;if(i==="design"){let c;for(let g=e.ledger.length-1;g>=0;g--){let p=e.ledger[g];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let o=n.remote&&!c?e.ledger.find(g=>g.kind==="header")?.phase:void 0,v=c?F[c]:o;v&&r.push(`phase ${v}/4`),u>0&&!n.remote&&r.push(`${u} item${u===1?"":"s"} this session`)}else u>0&&!n.remote&&r.push(`${u} saved as draft${u===1?"":"s"}`);let l=n.remote?n.added??I(e.turns):0,a=n.remote?n.updated??0:0;(l>0||a>0)&&r.push([l>0?`${l} added`:"",a>0?`${a} updated`:"","not saved yet"].filter(Boolean).join(" \xB7 "));let h=e.pending?e.pending.resolution.filter(c=>!c).length:0;return h>0&&r.push(`${h} question${h===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function Z(e,i){let n=[],r=e.applied+e.committed+e.retired;n.push(`${r} applied`),n.push(`${i} to decide`);let u=[];return e.skipped>0&&u.push(`${e.skipped} skipped`),e.deferred>0&&u.push(`${e.deferred} deferred`),e.failed>0&&u.push(`${e.failed} failed`),{items:[...n,...u]}}var x=C(q(),1);function ne({onToggleThinking:e,onCtrlC:i,explorer:n,panel:r}){let l=(0,x.useRef)(null),a=(0,x.useRef)(""),h=()=>{l.current&&clearTimeout(l.current),l.current=null,a.current=""};return(0,x.useEffect)(()=>h,[]),O((c,o)=>{if(o.ctrl&&c==="t"){e();return}if(o.ctrl&&c==="c"){i();return}if(!o.ctrl&&c.includes("")){i();return}if(!o.ctrl&&c.includes("")){e();return}if(n&&n.isOpen()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),n.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return){h(),o.return?n.onEnter():n.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){(p[1]==="A"||p[1]==="B")&&n.onMove(p[1]==="A"?-1:1);return}n.onBack();return}if(o.upArrow){n.onMove(-1);return}if(o.downArrow){n.onMove(1);return}if(o.return){n.onEnter();return}if(o.escape){a.current="",v();return}return}if(r&&r.isFocused()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),r.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){h(),o.return?r.onSelect():o.leftArrow?r.onLeft?.():o.rightArrow?r.onRight?.():r.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){p[1]==="A"||p[1]==="B"?r.onMove(p[1]==="A"?-1:1):p[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(o.upArrow){r.onMove(-1);return}if(o.downArrow){r.onMove(1);return}if(o.leftArrow){r.onLeft?.();return}if(o.rightArrow){r.onRight?.();return}if(o.return){r.onSelect();return}if(o.escape){a.current="",v();return}if(/^[1-9]$/.test(c)){r.onDigit(Number(c));return}if(o.tab){r.onTab?.();return}if(c===" "&&r.isMulti()){r.onSpace();return}if(c&&!o.ctrl&&!o.meta){r.onType(c);return}return}}),null}var t=C(D(),1);function N(e,i=!1){return i?Y(e):e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}var Q=e=>e===0?null:e===1?"its test was designed for the old version":`its ${e} tests were designed for the old version`;function Y(e){return e.heldPayload?[{v:"approve",label:"approve the change",detail:"the use-case takes the new version"},{v:"skip",label:"keep it as it is",detail:"the change is dropped"},{v:"defer",label:"decide later",detail:"it keeps waiting"}]:e.kind==="ARCHIVE"?[...e.archiveRefused?[]:[{v:"archive",label:"archive",detail:"it's hidden from the project from now on"}],{v:"skip",label:"keep it",detail:"it stays as it is; this may be suggested again"},{v:"defer",label:"defer",detail:"decide later; it's kept as an open question"}]:e.kind==="ADD"?[{v:"approve",label:"approve",detail:"add it to this session"},{v:"skip",label:"reject",detail:"leave it out; it may be suggested again"},{v:"defer",label:"defer",detail:"leave it out for now, as an open question"}]:[{v:"approve",label:"approve",detail:"the use-case takes the new version"},{v:"skip",label:"reject",detail:"it stays as it is; the change may be suggested again"},{v:"defer",label:"defer",detail:"it stays as it is for now, as an open question"}]}function K(e,i=!1){let n=N(e,i);return e.viewDiff&&n.push({v:"view_diff",label:"view diff",detail:i?"the whole change, old \u2192 new":"full old \u2192 new"}),n}function R(e,i=!1){return e.kind==="ARCHIVE"?null:K(e,i).length}var G={ADD:{color:f.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:f.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60,X=(e,i)=>`${e.heldPayload?"changed earlier":e.kind==="ADD"?"new":e.kind==="ARCHIVE"?`no longer in ${$(i)}`:"changed"}:`;function de({card:e,position:i,sel:n=0,focused:r=!1,freeText:u=null,editorIntent:l="steer",remote:a,gapAbove:h=!0}){let{stdout:c}=_(),o=c?.columns??80,v=o<U,g=K(e,!!a),p=R(e,!!a),H=G[e.kind],S=d=>r&&n===d?(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"}):" ",b=e.impact,k=a?e.kind==="MODIFY"?Q(e.tests??0):null:b&&"stale_refs"in b&&b.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${b.stale_refs.length} item(s) stale`+((b.direct_refs?.length??0)>0?` \u2014 ${b.direct_refs.length} directly touched: ${b.direct_refs.join(", ")}`:""):b&&"design_children"in b?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${b.design_children} design child(ren)`:null,T=e.provenance&&e.provenance!==e.why?e.provenance:a?null:e.origin??null,B=a?[{label:"change",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...k?[{label:"tests",text:k}]:[]]:[{label:"why",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...k?[{label:"impact",text:k}]:[]],E=Math.max(...B.map(d=>d.label.length)),A=a?`? review the changes from ${$(a.source)}`:"? reconcile",y=a?`${i.n} of ${i.of}`:`item ${i.n} of ${i.of}`,W=(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{bold:!0,children:[(0,t.jsx)(s,{color:H.color,children:a?X(e,a.source):`[${e.kind}]`}),` ${a?M(e):j(e.title)}`]})}),B.map((d,w)=>a?(0,t.jsxs)(m,{paddingLeft:2,children:[(0,t.jsx)(m,{flexShrink:0,width:E+2,children:(0,t.jsx)(s,{color:f.dim,children:d.label})}),(0,t.jsx)(m,{flexGrow:1,children:(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})})]},`f-${w}`):(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.dim,children:`${d.label.padEnd(E)} `}),(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})]})},`f-${w}`)),e.diffSummary?(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:e.diffSummary})}):(e.diff??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:4,children:(0,t.jsx)(s,{color:d.op==="-"?"red":"green",children:`${d.op==="-"?"\u2212":"+"} ${d.field==="criteria"?a?"acceptance criterion":"criterion":d.field}: ${d.text}`})},`d-${w}`)),(a?[]:e.citeLines??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:d})},`c-${w}`)),(0,t.jsx)(s,{children:" "}),g.map((d,w)=>(0,t.jsxs)(s,{children:[S(w),` ${w+1}. ${d.label}`,(0,t.jsx)(s,{color:f.dim,children:` \u2014 ${d.detail}`})]},`o-${w}`)),p!==null||u&&l==="because"?u?(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsxs)(m,{children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"})," ",(0,t.jsx)(s,{color:f.dim,children:"\u270E "})]}),(0,t.jsx)(P,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:l==="because"?"why archive it?":l==="adjust"?"tell me what to change":"say what to adjust"})]}),(0,t.jsx)(s,{color:f.muted,children:l==="because"?" submits as: archive \xB7 your reason goes on the record":l==="adjust"?" the agent looks at this change again, with your words":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):p!==null?(0,t.jsxs)(s,{children:[S(p)," ",(0,t.jsx)(s,{color:f.dim,children:l==="adjust"?"\u270E adjust \u2014 tell me what to change":e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(v)return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A}),(0,t.jsx)(s,{color:f.dim,children:y}),W]});let V=Math.max(2,Math.min(o-1,100)-A.length-y.length);return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A})," ".repeat(V),(0,t.jsx)(s,{color:f.dim,children:y})]}),(0,t.jsx)(s,{children:" "}),W]})}function fe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&n.push("space toggle"),i.batchCount>1&&n.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(r=>r.input===!0))&&n.push("\u270E type your own"),i.canAttach&&n.push("@ attach a file or URL"),i.escBack&&n.push("esc back"),{keys:n}}function pe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.some(r=>r.free)&&n.push("\u270E type your own"),i.escBack&&n.push("esc back"),{keys:n}}function he(e){let i=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return R(e)!==null&&i.push("type = adjust"),i.push("esc \xB7 nothing to undo"),{keys:i}}export{J as a,Z as b,ne as c,N as d,K as e,R as f,de as g,fe as h,pe as i,he as j};
2
+ import{b as O,c as P}from"./chunk-SMXABALN.js";import{b as I,c as L}from"./chunk-BWXLZS5O.js";import{a as M,b as $}from"./chunk-ZGQM6KWN.js";import{oa as j}from"./chunk-Z777GGHB.js";import{a as D}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as _}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{z as f}from"./chunk-QMOGBKJM.js";import{e as C}from"./chunk-UR6MHSHU.js";var F={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4,tests:4};function J(e,i,n={}){let r=[],u=L(e.turns).entries.length;if(i==="design"){let c;for(let g=e.ledger.length-1;g>=0;g--){let p=e.ledger[g];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let o=n.remote&&!c?e.ledger.find(g=>g.kind==="header")?.phase:void 0,v=c?F[c]:o;v&&r.push(`phase ${v}/4`),u>0&&!n.remote&&r.push(`${u} item${u===1?"":"s"} this session`)}else u>0&&!n.remote&&r.push(`${u} saved as draft${u===1?"":"s"}`);let l=n.remote?n.added??I(e.turns):0,a=n.remote?n.updated??0:0;(l>0||a>0)&&r.push([l>0?`${l} added`:"",a>0?`${a} updated`:"","not saved yet"].filter(Boolean).join(" \xB7 "));let h=e.pending?e.pending.resolution.filter(c=>!c).length:0;return h>0&&r.push(`${h} question${h===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function Z(e,i){let n=[],r=e.applied+e.committed+e.retired;n.push(`${r} applied`),n.push(`${i} to decide`);let u=[];return e.skipped>0&&u.push(`${e.skipped} skipped`),e.deferred>0&&u.push(`${e.deferred} deferred`),e.failed>0&&u.push(`${e.failed} failed`),{items:[...n,...u]}}var x=C(q(),1);function ne({onToggleThinking:e,onCtrlC:i,explorer:n,panel:r}){let l=(0,x.useRef)(null),a=(0,x.useRef)(""),h=()=>{l.current&&clearTimeout(l.current),l.current=null,a.current=""};return(0,x.useEffect)(()=>h,[]),O((c,o)=>{if(o.ctrl&&c==="t"){e();return}if(o.ctrl&&c==="c"){i();return}if(!o.ctrl&&c.includes("")){i();return}if(!o.ctrl&&c.includes("")){e();return}if(n&&n.isOpen()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),n.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return){h(),o.return?n.onEnter():n.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){(p[1]==="A"||p[1]==="B")&&n.onMove(p[1]==="A"?-1:1);return}n.onBack();return}if(o.upArrow){n.onMove(-1);return}if(o.downArrow){n.onMove(1);return}if(o.return){n.onEnter();return}if(o.escape){a.current="",v();return}return}if(r&&r.isFocused()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),r.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){h(),o.return?r.onSelect():o.leftArrow?r.onLeft?.():o.rightArrow?r.onRight?.():r.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){p[1]==="A"||p[1]==="B"?r.onMove(p[1]==="A"?-1:1):p[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(o.upArrow){r.onMove(-1);return}if(o.downArrow){r.onMove(1);return}if(o.leftArrow){r.onLeft?.();return}if(o.rightArrow){r.onRight?.();return}if(o.return){r.onSelect();return}if(o.escape){a.current="",v();return}if(/^[1-9]$/.test(c)){r.onDigit(Number(c));return}if(o.tab){r.onTab?.();return}if(c===" "&&r.isMulti()){r.onSpace();return}if(c&&!o.ctrl&&!o.meta){r.onType(c);return}return}}),null}var t=C(D(),1);function N(e,i=!1){return i?Y(e):e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}var Q=e=>e===0?null:e===1?"its test was designed for the old version":`its ${e} tests were designed for the old version`;function Y(e){return e.heldPayload?[{v:"approve",label:"approve the change",detail:"the use-case takes the new version"},{v:"skip",label:"keep it as it is",detail:"the change is dropped"},{v:"defer",label:"decide later",detail:"it keeps waiting"}]:e.kind==="ARCHIVE"?[...e.archiveRefused?[]:[{v:"archive",label:"archive",detail:"it's hidden from the project from now on"}],{v:"skip",label:"keep it",detail:"it stays as it is; this may be suggested again"},{v:"defer",label:"defer",detail:"decide later; it's kept as an open question"}]:e.kind==="ADD"?[{v:"approve",label:"approve",detail:"add it to this session"},{v:"skip",label:"reject",detail:"leave it out; it may be suggested again"},{v:"defer",label:"defer",detail:"leave it out for now, as an open question"}]:[{v:"approve",label:"approve",detail:"the use-case takes the new version"},{v:"skip",label:"reject",detail:"it stays as it is; the change may be suggested again"},{v:"defer",label:"defer",detail:"it stays as it is for now, as an open question"}]}function K(e,i=!1){let n=N(e,i);return e.viewDiff&&n.push({v:"view_diff",label:"view diff",detail:i?"the whole change, old \u2192 new":"full old \u2192 new"}),n}function R(e,i=!1){return e.kind==="ARCHIVE"?null:K(e,i).length}var G={ADD:{color:f.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:f.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60,X=(e,i)=>`${e.heldPayload?"changed earlier":e.kind==="ADD"?"new":e.kind==="ARCHIVE"?`no longer in ${$(i)}`:"changed"}:`;function de({card:e,position:i,sel:n=0,focused:r=!1,freeText:u=null,editorIntent:l="steer",remote:a,gapAbove:h=!0}){let{stdout:c}=_(),o=c?.columns??80,v=o<U,g=K(e,!!a),p=R(e,!!a),H=G[e.kind],S=d=>r&&n===d?(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"}):" ",b=e.impact,k=a?e.kind==="MODIFY"?Q(e.tests??0):null:b&&"stale_refs"in b&&b.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${b.stale_refs.length} item(s) stale`+((b.direct_refs?.length??0)>0?` \u2014 ${b.direct_refs.length} directly touched: ${b.direct_refs.join(", ")}`:""):b&&"design_children"in b?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${b.design_children} design child(ren)`:null,T=e.provenance&&e.provenance!==e.why?e.provenance:a?null:e.origin??null,B=a?[{label:"change",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...k?[{label:"tests",text:k}]:[]]:[{label:"why",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...k?[{label:"impact",text:k}]:[]],E=Math.max(...B.map(d=>d.label.length)),A=a?`? review the changes from ${$(a.source)}`:"? reconcile",y=a?`${i.n} of ${i.of}`:`item ${i.n} of ${i.of}`,W=(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{bold:!0,children:[(0,t.jsx)(s,{color:H.color,children:a?X(e,a.source):`[${e.kind}]`}),` ${a?M(e):j(e.title)}`]})}),B.map((d,w)=>a?(0,t.jsxs)(m,{paddingLeft:2,children:[(0,t.jsx)(m,{flexShrink:0,width:E+2,children:(0,t.jsx)(s,{color:f.dim,children:d.label})}),(0,t.jsx)(m,{flexGrow:1,children:(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})})]},`f-${w}`):(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.dim,children:`${d.label.padEnd(E)} `}),(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})]})},`f-${w}`)),e.diffSummary?(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:e.diffSummary})}):(e.diff??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:4,children:(0,t.jsx)(s,{color:d.op==="-"?"red":"green",children:`${d.op==="-"?"\u2212":"+"} ${d.field==="criteria"?a?"acceptance criterion":"criterion":d.field}: ${d.text}`})},`d-${w}`)),(a?[]:e.citeLines??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:d})},`c-${w}`)),(0,t.jsx)(s,{children:" "}),g.map((d,w)=>(0,t.jsxs)(s,{children:[S(w),` ${w+1}. ${d.label}`,(0,t.jsx)(s,{color:f.dim,children:` \u2014 ${d.detail}`})]},`o-${w}`)),p!==null||u&&l==="because"?u?(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsxs)(m,{children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"})," ",(0,t.jsx)(s,{color:f.dim,children:"\u270E "})]}),(0,t.jsx)(P,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:l==="because"?"why archive it?":l==="adjust"?"tell me what to change":"say what to adjust"})]}),(0,t.jsx)(s,{color:f.muted,children:l==="because"?" submits as: archive \xB7 your reason goes on the record":l==="adjust"?" the agent looks at this change again, with your words":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):p!==null?(0,t.jsxs)(s,{children:[S(p)," ",(0,t.jsx)(s,{color:f.dim,children:l==="adjust"?"\u270E adjust \u2014 tell me what to change":e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(v)return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A}),(0,t.jsx)(s,{color:f.dim,children:y}),W]});let V=Math.max(2,Math.min(o-1,100)-A.length-y.length);return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A})," ".repeat(V),(0,t.jsx)(s,{color:f.dim,children:y})]}),(0,t.jsx)(s,{children:" "}),W]})}function fe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&n.push("space toggle"),i.batchCount>1&&n.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(r=>r.input===!0))&&n.push("\u270E type your own"),i.canAttach&&n.push("@ attach a file or URL"),i.escBack&&n.push("esc back"),{keys:n}}function pe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.some(r=>r.free)&&n.push("\u270E type your own"),i.escBack&&n.push("esc back"),{keys:n}}function he(e){let i=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return R(e)!==null&&i.push("type = adjust"),i.push("esc \xB7 nothing to undo"),{keys:i}}export{J as a,Z as b,ne as c,N as d,K as e,R as f,de as g,fe as h,pe as i,he as j};