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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (634) hide show
  1. package/dist/ChatSurface-6NZGMNHL.js +2 -0
  2. package/dist/ChromeProfilePicker-M4WXOB5O.js +2 -0
  3. package/dist/CliFeedbackPrompt-6MJA7DF6.js +2 -0
  4. package/dist/CliUploadProgress-6NLS7XHH.js +2 -0
  5. package/dist/ConfigView-O4WKZ5PU.js +2 -0
  6. package/dist/EvidenceViewOffer-WIEWCZUP.js +2 -0
  7. package/dist/FolderPicker-AF7ZMV3M.js +2 -0
  8. package/dist/InfoBox-D7GGZJU4.js +2 -0
  9. package/dist/LinksBox-DXP66H3H.js +2 -0
  10. package/dist/ProfilesView-TWOY5PVC.js +2 -0
  11. package/dist/ProjectPicker-OBYHJJLU.js +2 -0
  12. package/dist/SaveSessionPrompt-7XSHS4NL.js +2 -0
  13. package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
  14. package/dist/SingleShotApp-XQUDR36R.js +2 -0
  15. package/dist/SummaryBox-IA2KS6GT.js +2 -0
  16. package/dist/TestMdRunView-LS2QUFWR.js +2 -0
  17. package/dist/TestrunEvidenceTable-HNDVJDIF.js +2 -0
  18. package/dist/WhoamiView-SNL75TEF.js +2 -0
  19. package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
  20. package/dist/app-client-U2YYF65L.js +2 -0
  21. package/dist/app-download-UI4ABEIX.js +2 -0
  22. package/dist/assurance-job-FFSSS4XV.js +7 -0
  23. package/dist/auth-7Z54TMQQ.js +2 -0
  24. package/dist/{binary-LVHXED3O.js → binary-THPLXCOD.js} +1 -1
  25. package/dist/bind-4XWK3DG2.js +2 -0
  26. package/dist/bootstrap-6ACT4ALI.js +2 -0
  27. package/dist/bridge-T6QMYKED.js +2 -0
  28. package/dist/build-5ZN47FAT.js +2 -0
  29. package/dist/catalog-MYPS2BXY.js +2 -0
  30. package/dist/{changelog-N5AZHXOS.js → changelog-SU674BVE.js} +1 -1
  31. package/dist/chat-committer-ZCSRJEUB.js +2 -0
  32. package/dist/chat-controller-XINCDH6Z.js +2 -0
  33. package/dist/child-G2GCW73X.js +2 -0
  34. package/dist/chunk-22PIMG52.js +2 -0
  35. package/dist/chunk-2DYHAP4E.js +2 -0
  36. package/dist/chunk-2TVPA3LL.js +2 -0
  37. package/dist/{chunk-FMUV6UCX.js → chunk-2XW33VOK.js} +1 -1
  38. package/dist/chunk-33DWJV67.js +235 -0
  39. package/dist/chunk-34R7BNZ2.js +2 -0
  40. package/dist/chunk-35ECWCCK.js +2 -0
  41. package/dist/{chunk-OHOJSADN.js → chunk-36N3EHW5.js} +1 -1
  42. package/dist/chunk-3BSYOCSW.js +3 -0
  43. package/dist/chunk-3E4ZO73O.js +6 -0
  44. package/dist/chunk-3F5FMH76.js +2 -0
  45. package/dist/chunk-3G2LSTK5.js +2 -0
  46. package/dist/chunk-3GXN6VF6.js +2 -0
  47. package/dist/chunk-3JLEDSG5.js +4 -0
  48. package/dist/chunk-3OQW2GTA.js +2 -0
  49. package/dist/chunk-3QICDXY5.js +5 -0
  50. package/dist/chunk-3RJHXOZH.js +3 -0
  51. package/dist/{chunk-Q5RDCSYM.js → chunk-3YTCKCBG.js} +1 -1
  52. package/dist/chunk-42PALMW2.js +4 -0
  53. package/dist/chunk-44B6THYK.js +2 -0
  54. package/dist/chunk-457Y5TEC.js +19 -0
  55. package/dist/chunk-47WQBG5I.js +6 -0
  56. package/dist/chunk-4I7YN6YY.js +3 -0
  57. package/dist/chunk-4IEQNX7F.js +2 -0
  58. package/dist/chunk-4LTHDJ3D.js +2 -0
  59. package/dist/chunk-4QFTHUJA.js +34 -0
  60. package/dist/chunk-4QTH7VYE.js +2 -0
  61. package/dist/chunk-4YW767UV.js +47 -0
  62. package/dist/chunk-54XA5MZH.js +2 -0
  63. package/dist/chunk-5AKJPYUW.js +11 -0
  64. package/dist/{chunk-AKE2CTV6.js → chunk-5D7ENQTQ.js} +1 -1
  65. package/dist/chunk-63EKRZKI.js +2 -0
  66. package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
  67. package/dist/{chunk-J3BGYSMD.js → chunk-6DZX5HLZ.js} +8 -8
  68. package/dist/{chunk-YBAVDT3G.js → chunk-6EB5VRAN.js} +1 -1
  69. package/dist/chunk-6NFOH4AC.js +4 -0
  70. package/dist/chunk-6PIIUAZF.js +3 -0
  71. package/dist/chunk-6UVIY56J.js +2 -0
  72. package/dist/chunk-72KYMWQ5.js +2 -0
  73. package/dist/chunk-72RC7JSA.js +21 -0
  74. package/dist/chunk-734ORT6O.js +4 -0
  75. package/dist/chunk-77ZZQJLX.js +2 -0
  76. package/dist/chunk-7AET4JKQ.js +2 -0
  77. package/dist/chunk-7DFBOVUB.js +2 -0
  78. package/dist/chunk-7HMSMAUG.js +29 -0
  79. package/dist/chunk-7HO4NX5W.js +1 -0
  80. package/dist/chunk-7KX2BHKG.js +2 -0
  81. package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
  82. package/dist/chunk-7NPTL66J.js +2 -0
  83. package/dist/chunk-7RWP4Y3H.js +2 -0
  84. package/dist/{chunk-PCKIANML.js → chunk-7SY34IIL.js} +1 -1
  85. package/dist/chunk-7V4BQSSV.js +2 -0
  86. package/dist/chunk-7XBNMOH4.js +6 -0
  87. package/dist/{chunk-SOCHN2PY.js → chunk-7YT4TTKL.js} +1 -1
  88. package/dist/{chunk-C25M2J5Q.js → chunk-ACMBMZDQ.js} +1 -1
  89. package/dist/chunk-AEWNWAXW.js +18 -0
  90. package/dist/chunk-AQ2OG2EF.js +2 -0
  91. package/dist/chunk-AUJSC7PU.js +4 -0
  92. package/dist/chunk-AVI5H4UM.js +13 -0
  93. package/dist/chunk-AVSMXDTX.js +2 -0
  94. package/dist/chunk-AZLNLHUA.js +4 -0
  95. package/dist/{chunk-HGFWIBVF.js → chunk-B7ZX5HEN.js} +5 -5
  96. package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
  97. package/dist/chunk-BWXLZS5O.js +2 -0
  98. package/dist/chunk-BY65QAAN.js +4 -0
  99. package/dist/chunk-C2RUDJ46.js +2 -0
  100. package/dist/chunk-C5Z7MQE6.js +2 -0
  101. package/dist/{chunk-WDMUPK6I.js → chunk-C62QWG4B.js} +1 -1
  102. package/dist/chunk-C6HI6Y3S.js +2 -0
  103. package/dist/chunk-CB4ARIHR.js +2 -0
  104. package/dist/{chunk-7WXMV3O3.js → chunk-CCP4X75B.js} +1 -1
  105. package/dist/chunk-CGITGJ3I.js +4 -0
  106. package/dist/chunk-CM4CHYSN.js +2 -0
  107. package/dist/{chunk-ZXY4P76I.js → chunk-CUXY6KQ2.js} +1 -1
  108. package/dist/chunk-D36V5OX6.js +2 -0
  109. package/dist/chunk-D756UWY2.js +6 -0
  110. package/dist/chunk-D7TKE7LK.js +2 -0
  111. package/dist/{chunk-UWXDURAB.js → chunk-D7U2M26S.js} +1 -1
  112. package/dist/chunk-DBMW3VUN.js +4 -0
  113. package/dist/chunk-DDZLCAEO.js +5 -0
  114. package/dist/chunk-DJC7NTLA.js +3 -0
  115. package/dist/chunk-DPGOAFKF.js +2 -0
  116. package/dist/chunk-DREQ3RAA.js +2 -0
  117. package/dist/chunk-DTUPEKEO.js +2 -0
  118. package/dist/chunk-DZOYYWOW.js +2 -0
  119. package/dist/chunk-E6KSRQXL.js +8 -0
  120. package/dist/chunk-EBPRPNSA.js +2 -0
  121. package/dist/chunk-ECPFI75W.js +5 -0
  122. package/dist/chunk-EECDDDSB.js +3 -0
  123. package/dist/chunk-EF47KRUK.js +2 -0
  124. package/dist/chunk-ETZMFRD6.js +2 -0
  125. package/dist/chunk-EZN7CF45.js +4 -0
  126. package/dist/{chunk-CNUCP6DK.js → chunk-F22K3RRX.js} +1 -1
  127. package/dist/{chunk-WRSIKZ2V.js → chunk-F5NHG7VB.js} +1 -1
  128. package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
  129. package/dist/chunk-FIP5L6LV.js +9 -0
  130. package/dist/chunk-FOJHSG5M.js +6 -0
  131. package/dist/chunk-FSYOTRMC.js +2 -0
  132. package/dist/chunk-FWDUVFS6.js +26 -0
  133. package/dist/chunk-FWUPJORV.js +6 -0
  134. package/dist/chunk-GFLB2SHW.js +2 -0
  135. package/dist/chunk-GMTHZUZ3.js +2 -0
  136. package/dist/chunk-GQRU3B54.js +1397 -0
  137. package/dist/chunk-GRURFGBP.js +2 -0
  138. package/dist/chunk-GXKY5A46.js +9 -0
  139. package/dist/chunk-HAW5WEKT.js +13 -0
  140. package/dist/chunk-HCJ2N3XB.js +12 -0
  141. package/dist/chunk-HHW6MRU3.js +6 -0
  142. package/dist/chunk-HIUAUZNL.js +2 -0
  143. package/dist/chunk-HJLMH7ZM.js +2 -0
  144. package/dist/{chunk-YWYORBY3.js → chunk-HJMCXSUJ.js} +1 -1
  145. package/dist/chunk-HK62JVQM.js +3 -0
  146. package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
  147. package/dist/chunk-I2MC6VVX.js +2 -0
  148. package/dist/chunk-I4RVVBG3.js +10 -0
  149. package/dist/chunk-I4WXALQR.js +2 -0
  150. package/dist/chunk-ICLUC44J.js +2 -0
  151. package/dist/{chunk-6HU5M2DS.js → chunk-IGEAET7M.js} +1 -1
  152. package/dist/{chunk-GCISXCDU.js → chunk-IINZZ4BZ.js} +1 -1
  153. package/dist/chunk-IJ2AHSWW.js +2 -0
  154. package/dist/{chunk-CSNJPD2J.js → chunk-IUQOG7Z5.js} +3 -3
  155. package/dist/chunk-IZ65ZPWY.js +3 -0
  156. package/dist/chunk-JGRXMTME.js +15 -0
  157. package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
  158. package/dist/chunk-JNSWKGTB.js +2 -0
  159. package/dist/chunk-JZP3Y4ZM.js +2 -0
  160. package/dist/chunk-KF4DKXSS.js +2 -0
  161. package/dist/chunk-KGNE5CIM.js +2 -0
  162. package/dist/chunk-KM3YCIDV.js +3 -0
  163. package/dist/{chunk-HAYV4D2I.js → chunk-KODJVOCN.js} +1 -1
  164. package/dist/chunk-KU3YHPWZ.js +2 -0
  165. package/dist/{chunk-M3UAZTDK.js → chunk-KXHJMAZU.js} +2 -2
  166. package/dist/chunk-L5DALV5N.js +2 -0
  167. package/dist/chunk-LAOTVZHV.js +6 -0
  168. package/dist/chunk-LCSJ7GOG.js +2 -0
  169. package/dist/{chunk-DWMESHFI.js → chunk-LIGTP3A3.js} +1 -1
  170. package/dist/chunk-LKQFG4RW.js +5 -0
  171. package/dist/{chunk-EBLXHOE3.js → chunk-LQQNPMOD.js} +1 -1
  172. package/dist/chunk-LSDJOVWW.js +6 -0
  173. package/dist/{chunk-C6S2RPZA.js → chunk-LUR7JFPP.js} +1 -1
  174. package/dist/chunk-LUZBGTYB.js +2 -0
  175. package/dist/chunk-LX2I4JEH.js +2 -0
  176. package/dist/{chunk-7GAHJZLH.js → chunk-M43WH5DQ.js} +1 -1
  177. package/dist/chunk-MEKPGQAM.js +21 -0
  178. package/dist/chunk-MNBGG4H3.js +16 -0
  179. package/dist/chunk-MYVKUJGS.js +2 -0
  180. package/dist/chunk-MYZHOBS4.js +2 -0
  181. package/dist/chunk-NC7D7GOM.js +21 -0
  182. package/dist/chunk-NIVFEACM.js +2 -0
  183. package/dist/chunk-NLZZLANH.js +4 -0
  184. package/dist/{chunk-XT7XA4DN.js → chunk-NXAJBSIF.js} +1 -1
  185. package/dist/chunk-NXRF7FFS.js +2 -0
  186. package/dist/chunk-NZ6AV2TA.js +4 -0
  187. package/dist/chunk-O3HHTKZ5.js +6 -0
  188. package/dist/chunk-OCDBTAYS.js +12 -0
  189. package/dist/chunk-OFSDB7B4.js +3 -0
  190. package/dist/{chunk-Q5CINJYL.js → chunk-OGFU4YY4.js} +1 -1
  191. package/dist/chunk-OJ33Q6DU.js +2 -0
  192. package/dist/chunk-P2ZQDQDB.js +2 -0
  193. package/dist/{chunk-KXEE6VCA.js → chunk-P3JXJ4BW.js} +1 -1
  194. package/dist/chunk-PAWQ4AKN.js +2 -0
  195. package/dist/chunk-PUVMC4PX.js +26 -0
  196. package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
  197. package/dist/chunk-Q3C6NDGI.js +2 -0
  198. package/dist/chunk-QBYENBMB.js +2 -0
  199. package/dist/chunk-QDFY5GGO.js +5 -0
  200. package/dist/chunk-QDXKEOKI.js +16 -0
  201. package/dist/{chunk-6VY62QC2.js → chunk-QENCC2ZS.js} +1 -1
  202. package/dist/chunk-QI5RZ7LL.js +2 -0
  203. package/dist/chunk-QXQ7KVEN.js +2 -0
  204. package/dist/chunk-R4JUKTDO.js +2 -0
  205. package/dist/chunk-R7KXAISS.js +12 -0
  206. package/dist/chunk-RDP7GWSY.js +2 -0
  207. package/dist/chunk-REKHAN53.js +5 -0
  208. package/dist/chunk-RF37IJNN.js +2 -0
  209. package/dist/{chunk-KWEOLPBJ.js → chunk-RFEON5GN.js} +1 -1
  210. package/dist/chunk-RHGW7B5Q.js +2 -0
  211. package/dist/chunk-RPRXRKKR.js +2 -0
  212. package/dist/{chunk-EOA6YPES.js → chunk-RTVHJ23A.js} +4 -4
  213. package/dist/chunk-RTVWQK7I.js +2 -0
  214. package/dist/chunk-RX6776AI.js +5 -0
  215. package/dist/{chunk-F7NSSQYZ.js → chunk-SGPAM5DZ.js} +1 -1
  216. package/dist/chunk-SMTBOSEJ.js +2 -0
  217. package/dist/chunk-SMXABALN.js +2 -0
  218. package/dist/{chunk-TM7VRLWS.js → chunk-SXRHKXSE.js} +1 -1
  219. package/dist/chunk-TNORODUF.js +2 -0
  220. package/dist/chunk-TU42YZOJ.js +6 -0
  221. package/dist/chunk-TU7TVFBK.js +2 -0
  222. package/dist/chunk-TW5AA5A7.js +8 -0
  223. package/dist/chunk-UEE3RZN4.js +14 -0
  224. package/dist/chunk-URH4FX3H.js +2 -0
  225. package/dist/chunk-UTM7D4PI.js +2 -0
  226. package/dist/chunk-UUJIGOEO.js +2 -0
  227. package/dist/chunk-UYDHOHSZ.js +2 -0
  228. package/dist/{chunk-4BZOG6PE.js → chunk-V7USCQWO.js} +1 -1
  229. package/dist/chunk-VJGWVBZR.js +1 -0
  230. package/dist/chunk-VLDCHFXF.js +2 -0
  231. package/dist/chunk-VO66KP2W.js +2 -0
  232. package/dist/chunk-VRIZDOO5.js +2 -0
  233. package/dist/{chunk-DOOI2JBD.js → chunk-VSVWNRI2.js} +1 -1
  234. package/dist/chunk-VUFIL5VR.js +6 -0
  235. package/dist/chunk-VX657KIK.js +2 -0
  236. package/dist/chunk-VXGN3IV7.js +2 -0
  237. package/dist/chunk-VZ4A6WMK.js +97 -0
  238. package/dist/chunk-VZJ6LUXX.js +2 -0
  239. package/dist/{chunk-RWSOZPJQ.js → chunk-W4QSZNMB.js} +1 -1
  240. package/dist/chunk-W54OT2FU.js +9 -0
  241. package/dist/{chunk-BL3SJDCG.js → chunk-W6HZF56M.js} +1 -1
  242. package/dist/chunk-W72ACCFL.js +27 -0
  243. package/dist/chunk-W7FLXW6Q.js +5 -0
  244. package/dist/chunk-WAOUE7MP.js +9 -0
  245. package/dist/chunk-WEIPY3CI.js +16 -0
  246. package/dist/chunk-WMGKUERB.js +6 -0
  247. package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
  248. package/dist/chunk-WOSANGV6.js +5 -0
  249. package/dist/{chunk-K3IQEL7R.js → chunk-WXJCJL5L.js} +1 -1
  250. package/dist/chunk-WZXPF3BI.js +2 -0
  251. package/dist/chunk-XB6BJPDL.js +2 -0
  252. package/dist/{chunk-4FHK4LKQ.js → chunk-XLEGGC4Y.js} +1 -1
  253. package/dist/chunk-XMPTFXPW.js +5 -0
  254. package/dist/chunk-XQMWHPZI.js +3 -0
  255. package/dist/{chunk-75MMTNPB.js → chunk-XRNQSXOM.js} +2 -2
  256. package/dist/{chunk-2PKME4VT.js → chunk-XZGEN4NU.js} +4 -4
  257. package/dist/chunk-XZYA7DNH.js +2 -0
  258. package/dist/{chunk-OIUV3ISA.js → chunk-Y6Y6RAY4.js} +1 -1
  259. package/dist/chunk-Y7E5L42F.js +3 -0
  260. package/dist/{chunk-GFBAK7WQ.js → chunk-YAW6JW6D.js} +7 -7
  261. package/dist/chunk-YDPTSDIJ.js +2 -0
  262. package/dist/chunk-YDSGXB25.js +2 -0
  263. package/dist/chunk-YGRULEZY.js +2 -0
  264. package/dist/chunk-YHFZFV3A.js +22 -0
  265. package/dist/chunk-YIKF4ERQ.js +375 -0
  266. package/dist/chunk-YLXWAY7D.js +2 -0
  267. package/dist/{chunk-UA2QDAWT.js → chunk-YPFQ4UGF.js} +1 -1
  268. package/dist/{chunk-4CYBXJIA.js → chunk-YQ5C6UDG.js} +1 -1
  269. package/dist/chunk-Z55KBMYV.js +2 -0
  270. package/dist/chunk-ZAFJQ3SM.js +2 -0
  271. package/dist/chunk-ZCRZFAOT.js +2 -0
  272. package/dist/chunk-ZFM77AQU.js +2 -0
  273. package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
  274. package/dist/chunk-ZHWU6L2G.js +5 -0
  275. package/dist/chunk-ZTHYAHDN.js +17 -0
  276. package/dist/{chunk-X2A6CC6B.js → chunk-ZTRRFG52.js} +1 -1
  277. package/dist/chunk-ZU4W2QGM.js +3 -0
  278. package/dist/committer-JGY66PFM.js +2 -0
  279. package/dist/config-754B73XK.js +2 -0
  280. package/dist/controller-client-PB3AZAGG.js +2 -0
  281. package/dist/cover-cmd-NBNZCR6C.js +2 -0
  282. package/dist/{credentials-QD32Y7K7.js → credentials-F7DYLVWY.js} +1 -1
  283. package/dist/{deps-bundle-OI7JJ22L.js → deps-bundle-PW3WEQJ7.js} +1 -1
  284. package/dist/{deps-resolve-ZOALDS6H.js → deps-resolve-SQYVN76L.js} +1 -1
  285. package/dist/descriptor-7T32VRMB.js +2 -0
  286. package/dist/design-chat-F3OEZPNJ.js +2 -0
  287. package/dist/design-committer-TRYP3LOZ.js +2 -0
  288. package/dist/design-headless-OTHYOX3E.js +2 -0
  289. package/dist/design-remote-2BEGCVCX.js +3 -0
  290. package/dist/device-env-CHFRRV6W.js +2 -0
  291. package/dist/dispatch-DVQ3H7EJ.js +2 -0
  292. package/dist/doctor-XY26Z35T.js +2 -0
  293. package/dist/docx-convert-6IZO5P5K.js +2 -0
  294. package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
  295. package/dist/evidence-P6FFKC7B.js +2 -0
  296. package/dist/evidence-presentation-YYTIDCBS.js +2 -0
  297. package/dist/evolve-cmd-WWOB3QJR.js +2 -0
  298. package/dist/evolve-remote-WLVY3QID.js +2 -0
  299. package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
  300. package/dist/explain-DGJ5T6V5.js +2 -0
  301. package/dist/explain-cmd-OP5I5W3O.js +12 -0
  302. package/dist/explain-cmd-VYAANFFZ.js +4 -0
  303. package/dist/explore-K5YBGHK6.js +2 -0
  304. package/dist/explore-context-tty-RZ7D2TBV.js +2 -0
  305. package/dist/explore-entry-EKXJ67BD.js +6 -0
  306. package/dist/explore-live-2YVRAQZO.js +5 -0
  307. package/dist/explore-run-tty-D47FGPX7.js +5 -0
  308. package/dist/extract-bind-W2NET364.js +14 -0
  309. package/dist/extract-chat-M65NWGUK.js +2 -0
  310. package/dist/extract-cmd-FTFLETOP.js +6 -0
  311. package/dist/extract-headless-G6W6JQ27.js +2 -0
  312. package/dist/feeder-NY45UFJK.js +2 -0
  313. package/dist/folder-flags-KKIH654K.js +2 -0
  314. package/dist/gaps-cmd-OIDDLRYL.js +3 -0
  315. package/dist/gate-7AKRPRMK.js +2 -0
  316. package/dist/gate-WISOUTHQ.js +2 -0
  317. package/dist/{generate-headless-6WMJYNI6.js → generate-headless-RURIEKVS.js} +3 -3
  318. package/dist/headless-io-FFM5T6KL.js +2 -0
  319. package/dist/hold-passthrough-IOWPVB4W.js +2 -0
  320. package/dist/identity-HL5CJJXR.js +2 -0
  321. package/dist/index.js +178 -160
  322. package/dist/ingest-PDGS5ZTL.js +2 -0
  323. package/dist/ingest-cmd-4G2AK4Y2.js +8 -0
  324. package/dist/ingest-remote-SSLUHQVG.js +2 -0
  325. package/dist/ink-screen-RZ7QDIUI.js +2 -0
  326. package/dist/install-ZVBHPXGP.js +2 -0
  327. package/dist/interactive-bind-SI2ZS55Q.js +26 -0
  328. package/dist/interactive-remote-J56EWJGA.js +65 -0
  329. package/dist/interrupt-guard-QETBPINI.js +2 -0
  330. package/dist/lane-AQYRIW24.js +2 -0
  331. package/dist/lattice-auth-6FEVSR7E.js +2 -0
  332. package/dist/lifecycle-cmd-HJ37LTXE.js +2 -0
  333. package/dist/list-cmd-6XL2FYLQ.js +3 -0
  334. package/dist/list-commands-5DCCKU3L.js +2 -0
  335. package/dist/list-remote-LXPQNXYN.js +15 -0
  336. package/dist/locks-cmd-JJ2QNTNY.js +2 -0
  337. package/dist/logical-ids-RXAQJZ3T.js +2 -0
  338. package/dist/login-flow-WEK3E476.js +2 -0
  339. package/dist/maintenance-cmd-BXXHP36K.js +2 -0
  340. package/dist/mobile-prompts-CECJ5UY2.js +2 -0
  341. package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
  342. package/dist/{objective-variable-gate-CG2KK5UX.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
  343. package/dist/onboarding-PDVYMTY5.js +5 -0
  344. package/dist/open-provider-OZAG6WZS.js +2 -0
  345. package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
  346. package/dist/pdf-convert-447ACUB3.js +2 -0
  347. package/dist/persist-recorded-session-A3ID7JFA.js +3 -0
  348. package/dist/phase-seed-LCJ4WSYV.js +2 -0
  349. package/dist/pipeline-GX3LKPI5.js +2 -0
  350. package/dist/prepare-target-FMT6QFHZ.js +2 -0
  351. package/dist/pull-cmd-UPFQYUND.js +2 -0
  352. package/dist/pull-route-FWBXJMR7.js +2 -0
  353. package/dist/readmodel-INMP6MNW.js +2 -0
  354. package/dist/real-device-run-X7JJWOIK.js +2 -0
  355. package/dist/reconcile-cmd-JBH365JL.js +5 -0
  356. package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
  357. package/dist/reconcile-remote-BCX6SWFC.js +13 -0
  358. package/dist/recording-banner-YKBAL6UB.js +2 -0
  359. package/dist/registry-VQC757MJ.js +2 -0
  360. package/dist/remote-entry-X6JMPC2K.js +2 -0
  361. package/dist/remote-mode-FDPA7EWG.js +4 -0
  362. package/dist/remote-words-YVB66R3F.js +2 -0
  363. package/dist/require-project-folder-MLMEQJYP.js +2 -0
  364. package/dist/resolve-run-intent-PC7TQZUL.js +2 -0
  365. package/dist/resolver-EID34LQE.js +2 -0
  366. package/dist/revert-FHOBLZWF.js +2 -0
  367. package/dist/review-cmd-EUHFLFMY.js +5 -0
  368. package/dist/run-5RQUCNYP.js +2 -0
  369. package/dist/run-PC5YO4AS.js +2 -0
  370. package/dist/run-channel-63SVP5OI.js +2 -0
  371. package/dist/run-remote-SJCRTL7O.js +2 -0
  372. package/dist/run-startup-gate-YO66G6LS.js +2 -0
  373. package/dist/run-test-md-BLNBK4MH.js +17 -0
  374. package/dist/scrollback-GGNBDFQV.js +2 -0
  375. package/dist/session-target-DD53UXO7.js +2 -0
  376. package/dist/session-worker.js +12 -0
  377. package/dist/sessions-CFV7FOIT.js +2 -0
  378. package/dist/sessions-cmd-S7WZBUCN.js +26 -0
  379. package/dist/sessions-remote-IWHWIQ2T.js +3 -0
  380. package/dist/shell-arg-FN3MT5U7.js +2 -0
  381. package/dist/{skill-installer-32YYMM4N.js → skill-installer-MAVQY6GW.js} +1 -1
  382. package/dist/spawner-C7NLLM4F.js +2 -0
  383. package/dist/store-MSA7KASS.js +2 -0
  384. package/dist/store-choice-3OJCV26J.js +2 -0
  385. package/dist/store-guard-OOSDLMEC.js +2 -0
  386. package/dist/store-id-YZ5WKJ25.js +2 -0
  387. package/dist/store-site-KA2DNBGY.js +2 -0
  388. package/dist/stream-warnings-GEQKKJU7.js +2 -0
  389. package/dist/structured-answers-EQ2AP3F7.js +2 -0
  390. package/dist/sync-cmd-RDFDMVKQ.js +2 -0
  391. package/dist/sync-setup-RBRDUV7Q.js +2 -0
  392. package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
  393. package/dist/tcg-generate-KIECTZ2C.js +2 -0
  394. package/dist/test-definition-VRI4YIYL.js +2 -0
  395. package/dist/testmd-actions-CMAG6HWI.js +2 -0
  396. package/dist/testmd-sync-UPAA5UMD.js +2 -0
  397. package/dist/tms-client-NXAB6VJD.js +2 -0
  398. package/dist/token-refresh-KP3AYMYK.js +2 -0
  399. package/dist/trust-gate-AT2XBWN4.js +2 -0
  400. package/dist/turn-preflight-LHYLRL7G.js +2 -0
  401. package/dist/ui-SNV3FD2G.js +4 -0
  402. package/dist/use-case-ref-NE4X4MZN.js +2 -0
  403. package/dist/validate-basic-M5JHHNZA.js +2 -0
  404. package/dist/{variable-receipt-YWNS24TH.js → variable-receipt-BXSZO36E.js} +1 -1
  405. package/dist/verdicts-XK3GAUX3.js +2 -0
  406. package/dist/version-check-Q737BE65.js +2 -0
  407. package/dist/{view-cmd-3WHG6MVB.js → view-cmd-XSNL5DGI.js} +4 -3
  408. package/dist/walk-session-SHGYLFRB.js +2 -0
  409. package/dist/with-telemetry-PM2HVN2B.js +2 -0
  410. package/package.json +11 -11
  411. package/dist/ChatSurface-FJPK3XEJ.js +0 -8
  412. package/dist/ChromeProfilePicker-7DUDJTE2.js +0 -2
  413. package/dist/CliFeedbackPrompt-ZZPYC6OS.js +0 -2
  414. package/dist/CliUploadProgress-WQYKIBAR.js +0 -2
  415. package/dist/ConfigView-KXNOODDW.js +0 -2
  416. package/dist/EvidenceViewOffer-BTBVPBZX.js +0 -2
  417. package/dist/FolderPicker-H4YEX5LV.js +0 -2
  418. package/dist/InfoBox-DTM7X24Z.js +0 -2
  419. package/dist/LinksBox-KFG3FVOT.js +0 -2
  420. package/dist/ProfilesView-KBZHT4KL.js +0 -2
  421. package/dist/ProjectPicker-OARWULNN.js +0 -2
  422. package/dist/SaveSessionPrompt-37SMU5MC.js +0 -2
  423. package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
  424. package/dist/SingleShotApp-UYCAW65Y.js +0 -2
  425. package/dist/SummaryBox-6RB5DSAH.js +0 -2
  426. package/dist/TestMdRunView-ZMOII3PL.js +0 -2
  427. package/dist/TestrunEvidenceTable-3UP2EYIV.js +0 -2
  428. package/dist/WhoamiView-MC62GERR.js +0 -2
  429. package/dist/app-client-PQFJAB63.js +0 -2
  430. package/dist/app-download-P6YXWSVQ.js +0 -2
  431. package/dist/auth-LXW4OFKF.js +0 -2
  432. package/dist/bind-ZYESQSCJ.js +0 -15
  433. package/dist/bootstrap-DI4UGMH3.js +0 -2
  434. package/dist/bridge-7J3JE3JS.js +0 -2
  435. package/dist/build-JIKYOZUH.js +0 -2
  436. package/dist/catalog-LLME3744.js +0 -2
  437. package/dist/chat-committer-6D7AQI6Z.js +0 -2
  438. package/dist/chat-controller-UJQ6Z4RE.js +0 -2
  439. package/dist/chunk-243ZJHT6.js +0 -4
  440. package/dist/chunk-2KVECC36.js +0 -2
  441. package/dist/chunk-2YEHV2CX.js +0 -2
  442. package/dist/chunk-3MCPTVJX.js +0 -2
  443. package/dist/chunk-3UI5VTQS.js +0 -4
  444. package/dist/chunk-3VAU3PNU.js +0 -2
  445. package/dist/chunk-3YIZG7WZ.js +0 -3
  446. package/dist/chunk-4Y2WH77W.js +0 -2
  447. package/dist/chunk-5EOX4MEY.js +0 -2
  448. package/dist/chunk-5HMN74RZ.js +0 -9
  449. package/dist/chunk-5LJRZI7S.js +0 -6
  450. package/dist/chunk-5RCS2LIQ.js +0 -26
  451. package/dist/chunk-5TQFOPJV.js +0 -2
  452. package/dist/chunk-5ZFOKYFB.js +0 -5
  453. package/dist/chunk-63DYVWNX.js +0 -2
  454. package/dist/chunk-6MD7SR7D.js +0 -9
  455. package/dist/chunk-7N6OCHPC.js +0 -7
  456. package/dist/chunk-A2SQD2AY.js +0 -4
  457. package/dist/chunk-AACQE24F.js +0 -2
  458. package/dist/chunk-AHFIRHSP.js +0 -18
  459. package/dist/chunk-AJT34ESA.js +0 -38
  460. package/dist/chunk-AUMJ4RVA.js +0 -21
  461. package/dist/chunk-AXTPNZPX.js +0 -2
  462. package/dist/chunk-BB2W35TW.js +0 -2
  463. package/dist/chunk-BKM2LWU2.js +0 -3
  464. package/dist/chunk-BUPRL2TE.js +0 -2
  465. package/dist/chunk-C44QQJR4.js +0 -239
  466. package/dist/chunk-CW3RHKLA.js +0 -5
  467. package/dist/chunk-D6E6KRVX.js +0 -2
  468. package/dist/chunk-DTRKTBCE.js +0 -17
  469. package/dist/chunk-DTRSYWZE.js +0 -2
  470. package/dist/chunk-EVFFDODK.js +0 -5
  471. package/dist/chunk-F2OBORCG.js +0 -2
  472. package/dist/chunk-FQNQVC5O.js +0 -5
  473. package/dist/chunk-FY7TCYPK.js +0 -6
  474. package/dist/chunk-GTVQYT3D.js +0 -35
  475. package/dist/chunk-HG5LLZBU.js +0 -2
  476. package/dist/chunk-I7TIGB7K.js +0 -2
  477. package/dist/chunk-IICT4VOU.js +0 -2
  478. package/dist/chunk-ILDHE4P4.js +0 -6
  479. package/dist/chunk-IPXKUYUK.js +0 -2
  480. package/dist/chunk-JQY5HRZ4.js +0 -15
  481. package/dist/chunk-JX6BFEDO.js +0 -4
  482. package/dist/chunk-K2UJYY2U.js +0 -2
  483. package/dist/chunk-KBM3XHAM.js +0 -2
  484. package/dist/chunk-KDNNMU7Q.js +0 -4
  485. package/dist/chunk-KJQNAOOE.js +0 -6
  486. package/dist/chunk-LH4IPANP.js +0 -2
  487. package/dist/chunk-LLG7NEGX.js +0 -6
  488. package/dist/chunk-LSDWPG6C.js +0 -2
  489. package/dist/chunk-MSGW4JDG.js +0 -2
  490. package/dist/chunk-NJ4BXZBX.js +0 -2
  491. package/dist/chunk-NLCCBXXV.js +0 -2
  492. package/dist/chunk-NMSZ7G6P.js +0 -2
  493. package/dist/chunk-OC6H6BYI.js +0 -6
  494. package/dist/chunk-OJAXOOZ5.js +0 -8
  495. package/dist/chunk-OMNLAGQC.js +0 -29
  496. package/dist/chunk-OOCCUUR2.js +0 -2
  497. package/dist/chunk-OXC6O5O7.js +0 -2
  498. package/dist/chunk-OZQDD2EX.js +0 -94
  499. package/dist/chunk-PEDINHVU.js +0 -2
  500. package/dist/chunk-PNUAP3RY.js +0 -8
  501. package/dist/chunk-Q2F5QB2W.js +0 -2
  502. package/dist/chunk-Q4YYAN6E.js +0 -2
  503. package/dist/chunk-Q6AHSGOE.js +0 -5
  504. package/dist/chunk-QAB3Y5FQ.js +0 -4
  505. package/dist/chunk-RDHWNSDP.js +0 -7
  506. package/dist/chunk-RKXHVP2Z.js +0 -2
  507. package/dist/chunk-RRY5IXOB.js +0 -2
  508. package/dist/chunk-RSSOJ3L2.js +0 -21
  509. package/dist/chunk-RTSBKCZY.js +0 -16
  510. package/dist/chunk-SID4X77D.js +0 -370
  511. package/dist/chunk-SRTKRHYI.js +0 -12
  512. package/dist/chunk-T2ONUKTL.js +0 -5
  513. package/dist/chunk-U6OTFMIT.js +0 -4
  514. package/dist/chunk-UD7KKHPW.js +0 -5
  515. package/dist/chunk-USOYXCZ4.js +0 -2
  516. package/dist/chunk-USY7VAO6.js +0 -2
  517. package/dist/chunk-V4B5QA3U.js +0 -4
  518. package/dist/chunk-VBS33P2C.js +0 -2
  519. package/dist/chunk-VHW7BMZQ.js +0 -2
  520. package/dist/chunk-VIO7CCFW.js +0 -5
  521. package/dist/chunk-VORWZLS3.js +0 -9
  522. package/dist/chunk-VVOKM2VO.js +0 -2
  523. package/dist/chunk-W5TTF7GB.js +0 -6
  524. package/dist/chunk-WESMQEPO.js +0 -2
  525. package/dist/chunk-WMI4P76K.js +0 -27
  526. package/dist/chunk-WNOC6MQC.js +0 -2
  527. package/dist/chunk-WVHMPIDQ.js +0 -2
  528. package/dist/chunk-XBX643ZD.js +0 -2
  529. package/dist/chunk-XKHWWKJZ.js +0 -3
  530. package/dist/chunk-XLSOQLVT.js +0 -2
  531. package/dist/chunk-Y3ZYN6AK.js +0 -4
  532. package/dist/chunk-YCCUBQY4.js +0 -2
  533. package/dist/chunk-YKTYVJBN.js +0 -3
  534. package/dist/chunk-YLQHY4A7.js +0 -2
  535. package/dist/chunk-Z7IGTVJW.js +0 -2
  536. package/dist/chunk-ZC2CKWLB.js +0 -2
  537. package/dist/chunk-ZER3FZSZ.js +0 -22
  538. package/dist/chunk-ZJYT72BA.js +0 -9
  539. package/dist/chunk-ZKSN2SJ7.js +0 -2
  540. package/dist/chunk-ZLWURCJ7.js +0 -2
  541. package/dist/committer-2QPBANRD.js +0 -2
  542. package/dist/config-YGTHSGQN.js +0 -2
  543. package/dist/controller-client-ZF5IXRUV.js +0 -2
  544. package/dist/cover-cmd-6RO366CC.js +0 -3
  545. package/dist/descriptor-3JJUOHBM.js +0 -2
  546. package/dist/design-committer-D44GSUXY.js +0 -2
  547. package/dist/device-env-DXDJJMTL.js +0 -2
  548. package/dist/dispatch-7EWWQRQ5.js +0 -2
  549. package/dist/doctor-TPYPEEUL.js +0 -2
  550. package/dist/docx-convert-SQRTF7XS.js +0 -2
  551. package/dist/evidence-NPFTBGDF.js +0 -2
  552. package/dist/evidence-presentation-XF23B7F2.js +0 -2
  553. package/dist/evolve-cmd-VGVXV6XW.js +0 -2
  554. package/dist/explain-NEFBUX5G.js +0 -2
  555. package/dist/explain-cmd-GOP5TE63.js +0 -9
  556. package/dist/explain-cmd-M7IX2YNB.js +0 -3
  557. package/dist/extract-bind-CKIRLXAJ.js +0 -14
  558. package/dist/extract-cmd-3EWLSPGS.js +0 -5
  559. package/dist/feeder-66TUPB2R.js +0 -2
  560. package/dist/gaps-cmd-WVC5GXQC.js +0 -3
  561. package/dist/gate-OYRDJMF6.js +0 -2
  562. package/dist/headless-io-75HUMWZB.js +0 -2
  563. package/dist/identity-ADZ4PAJF.js +0 -2
  564. package/dist/ingest-OSNNM3DH.js +0 -2
  565. package/dist/ingest-cmd-AECK5T4H.js +0 -2
  566. package/dist/install-ZV3KJZV4.js +0 -2
  567. package/dist/interactive-bind-IYS6KDOH.js +0 -26
  568. package/dist/interrupt-guard-UREUWNRL.js +0 -2
  569. package/dist/lifecycle-cmd-XCSBELFQ.js +0 -2
  570. package/dist/list-cmd-S4DSN2ET.js +0 -3
  571. package/dist/list-commands-GLNGHPDU.js +0 -2
  572. package/dist/locks-cmd-67OHQZNV.js +0 -2
  573. package/dist/logical-ids-GLVM2SVR.js +0 -2
  574. package/dist/login-flow-ASUUU7SO.js +0 -2
  575. package/dist/maintenance-cmd-K5KXRIFL.js +0 -2
  576. package/dist/mobile-prompts-ZUZTA3RV.js +0 -2
  577. package/dist/open-provider-YIBB77FE.js +0 -2
  578. package/dist/pdf-convert-RLXSXFWN.js +0 -2
  579. package/dist/persist-recorded-session-EWV56TSZ.js +0 -3
  580. package/dist/phase-seed-MKHEWUN6.js +0 -2
  581. package/dist/pipeline-LAWACB2O.js +0 -2
  582. package/dist/prepare-target-WGPCZKLE.js +0 -2
  583. package/dist/readmodel-FVLRQWZ7.js +0 -2
  584. package/dist/real-device-run-MDLFKFVQ.js +0 -2
  585. package/dist/reconcile-cmd-XFM2ZXUJ.js +0 -2
  586. package/dist/reconcile-deps-V5VLDPYT.js +0 -4
  587. package/dist/reconcile-engine-VZBTMPUK.js +0 -2
  588. package/dist/recording-banner-CJHRPHHF.js +0 -2
  589. package/dist/records-LMCVKPE5.js +0 -2
  590. package/dist/registry-3JXQFZEG.js +0 -2
  591. package/dist/require-project-folder-SE5GVCYJ.js +0 -2
  592. package/dist/resolve-run-intent-DD4MB6UD.js +0 -2
  593. package/dist/resolver-TLO4SRWV.js +0 -2
  594. package/dist/revert-NOUECRW4.js +0 -2
  595. package/dist/review-cmd-7EOYQMPE.js +0 -5
  596. package/dist/run-EHUNJPW6.js +0 -2
  597. package/dist/run-OTMPUQSH.js +0 -2
  598. package/dist/run-channel-RGH4WIQX.js +0 -2
  599. package/dist/run-test-md-KBDEHGXJ.js +0 -17
  600. package/dist/scrollback-JLPJR25X.js +0 -2
  601. package/dist/session-items-2ATN7VXG.js +0 -2
  602. package/dist/session-target-UMNASXI7.js +0 -2
  603. package/dist/sessions-NH7WQWMX.js +0 -2
  604. package/dist/sessions-cmd-M3SECFKQ.js +0 -25
  605. package/dist/spawner-DPT2RLAO.js +0 -2
  606. package/dist/store-guard-U32JE6JJ.js +0 -2
  607. package/dist/store-id-EOSGEKVK.js +0 -2
  608. package/dist/structured-answers-ZI2B6JJE.js +0 -2
  609. package/dist/sync-cmd-3EP7LZGL.js +0 -2
  610. package/dist/sync-setup-SWTBVQEV.js +0 -2
  611. package/dist/tcg-generate-KXU7E2GF.js +0 -2
  612. package/dist/testmd-actions-PEWCPQ5R.js +0 -2
  613. package/dist/testmd-sync-ZWFQWZ2X.js +0 -2
  614. package/dist/tms-client-KU6HCA23.js +0 -2
  615. package/dist/token-refresh-QD3OCGJJ.js +0 -2
  616. package/dist/trust-gate-EX7R2P4Y.js +0 -2
  617. package/dist/turn-preflight-JGYT7LXP.js +0 -2
  618. package/dist/ui-JEJGTURD.js +0 -4
  619. package/dist/validate-basic-AAIXSAWH.js +0 -2
  620. package/dist/verdicts-LAB5BGCC.js +0 -2
  621. package/dist/version-check-EHOLX3YH.js +0 -2
  622. package/dist/walk-session-XP4KYFKO.js +0 -2
  623. package/dist/with-telemetry-FJMJQDCM.js +0 -2
  624. /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
  625. /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
  626. /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
  627. /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
  628. /package/dist/{chunk-NOL7MNZH.js → chunk-A7RJQJNT.js} +0 -0
  629. /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
  630. /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
  631. /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
  632. /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
  633. /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
  634. /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as Se}from"./chunk-VUFIL5VR.js";import{d as Qe}from"./chunk-3AGP2BVN.js";import{N as $,O as Le,Q as Ve,S as Be,T as je,U as We,V as fe}from"./chunk-MEKPGQAM.js";import"./chunk-DZOYYWOW.js";import"./chunk-VXGN3IV7.js";import"./chunk-CB4ARIHR.js";import"./chunk-BSRSXYDZ.js";import{a as N}from"./chunk-R7KXAISS.js";import"./chunk-WMGKUERB.js";import"./chunk-WOSANGV6.js";import"./chunk-XMPTFXPW.js";import{a as de}from"./chunk-73Y6T2UK.js";import"./chunk-SMXABALN.js";import"./chunk-WN5VKKJ3.js";import{a as he,b as re,c as ve,d as ie,e as nn,f as tn,h as j,i as Re}from"./chunk-47WQBG5I.js";import"./chunk-YDSGXB25.js";import{e as _e,f as on,g as ke,h as $e,i as sn,j as cn,k as an,l as Ee}from"./chunk-OFSDB7B4.js";import{a as we,c as ye,d as rn}from"./chunk-LKQFG4RW.js";import"./chunk-TNORODUF.js";import"./chunk-I6S6DZ2E.js";import"./chunk-W7FLXW6Q.js";import{a as W}from"./chunk-KM3YCIDV.js";import"./chunk-R4JUKTDO.js";import"./chunk-OJ33Q6DU.js";import"./chunk-O3HHTKZ5.js";import{a as Xe,c as en}from"./chunk-LCSJ7GOG.js";import"./chunk-HAW5WEKT.js";import"./chunk-HJLMH7ZM.js";import"./chunk-IZ65ZPWY.js";import"./chunk-73ZFOJOK.js";import"./chunk-EF47KRUK.js";import"./chunk-3GXN6VF6.js";import"./chunk-LD5B3QFW.js";import"./chunk-HD6NR44L.js";import"./chunk-42PALMW2.js";import{a as F,b as qe,c as Je}from"./chunk-JNSWKGTB.js";import{c as ze,h as Ze}from"./chunk-I4RVVBG3.js";import{f as Ke}from"./chunk-UUJIGOEO.js";import{i as me,j as te,k as pe}from"./chunk-ZTHYAHDN.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import{j as Ge,l as ge,n as Ye}from"./chunk-AZLNLHUA.js";import"./chunk-AQ2OG2EF.js";import"./chunk-DPGOAFKF.js";import"./chunk-MNBGG4H3.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-REKHAN53.js";import"./chunk-VLDCHFXF.js";import"./chunk-EZN7CF45.js";import"./chunk-7XBNMOH4.js";import{a as Ne}from"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import{b as He}from"./chunk-ZFM77AQU.js";import{b as B}from"./chunk-RF37IJNN.js";import"./chunk-XZYA7DNH.js";import"./chunk-VJGWVBZR.js";import{Ia as Te,M as Fe,Wa as Z,a as Ce,c as Ue,n as Me,oa as H,vb as U}from"./chunk-UEE3RZN4.js";import{d as Ae}from"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-PUVMC4PX.js";import"./chunk-B7ZX5HEN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-7V4BQSSV.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A7RJQJNT.js";import"./chunk-HJMCXSUJ.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";import{existsSync as le,readFileSync as xn,statSync as In}from"fs";import{basename as G,dirname as fn,resolve as L}from"path";import{isAbsolute as Pn,resolve as bn}from"path";function oe(e,n,t){let r=Fe(e),i=r.heads.get(n);if(typeof i!="string")return{kind:"no-source"};let o=r.mediaOf(i).plugin;if(r.mediaOf(i).format!=="plugin"||o===void 0)return{kind:"not-plugin"};if(o.fetch!==void 0)return{kind:"plugin",plugin:o.id,ref:o.fetch.ref,fetched:!0};let s=null;for(let l of e.recordsSince(null))l.source_head_moves?.[n]===i?s=l.seq:l.source_head_moves?.[n]!==void 0&&(s=null);let c=s===null?null:e.tokenAt(s),p=c===null?null:e.intentOf(c),v=p?.verb==="ingest"?p.args:null;if(v?.source_id!==n||typeof v.label!="string"||v.label==="")return{kind:"no-envelope",plugin:o.id};let d=t!==void 0&&!Pn(v.label)?bn(t,v.label):v.label;return{kind:"plugin",plugin:o.id,ref:d}}var se=e=>Me(e)===null;function ln(e){if(!e||e.stale_refs.length===0)return"\u2014";let n=e.direct_refs??[];return`${e.stale_refs.length} stale${n.length>0?` \xB7 ${n.length} direct`:""}`}function Pe(e,n){let t=[...e.rows.filter(o=>o.kind!=="REMOVE").map(o=>[o.kind,H(o.ref),o.reason,ln(o.impact)]),...e.archive.map(o=>["ARCHIVE",H(o.ref),o.why,ln(o.impact)])],r=Math.max(40,n??100),i=[`reconcile ${e.source_id} \u2014 head ${e.head.status} \xB7 ${t.length} decision${t.length===1?"":"s"}`];return t.length>0&&i.push(...Qe(["kind","ref","why","impact"],t,r,2)),e.changed&&i.push(e.held?`extract ran in override mode; ${e.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${e.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),i.push("each row becomes a card below \u2014 verdicts commit as they land"),e.planPath&&i.push(`plan: ${e.planPath}`),i}var gn=new Set(["interactive","agent","ci","override"]);function On(e,n){if(e.mode!==void 0&&!gn.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`,code:"MODE_USAGE"};let t=e.mode,r="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return t==="interactive"&&!n?{error:r}:t||(n?"interactive":e.plan?"override":{error:r})}async function un(e){let{makeHeadlessIO:n,agentRefusal:t}=await import("./headless-io-FFM5T6KL.js");return t(n("ndjson","reconcile"),e,"MODE_USAGE")}function Dn(e,n,t,r,i=Ke){if(te(t)){let l=pe(t),g=l?.sourceIdFor(t)??null;if(l===null||g===null)return{error:`--from '${t}' is not a supported remote URL \u2014 supported: ${me.map(m=>m.hint).join("; ")}`};if(r!==void 0&&r!==g)return{error:`--source-id '${r}' does not match this URL's own identity '${g}' \u2014 re-run without --source-id. A source adopted with --as updates by re-running context ingest with the same --as; reconcile follows only the URL's own id`};let h=U(e);if(!h.heads.has(g))return{error:`unknown source '${g}' \u2014 see \`kane-cli context list --type source\`. If this URL was ingested under a custom id, update it by re-running context ingest with the same --as`};if(h.heads.get(g)==null)return{error:`source '${g}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let k=xe(e,g,{remoteUrl:t});return k!==null?{error:k}:{sourceId:g,remoteUrl:t}}if(r===void 0)return{error:"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"};let o=L(n,t);if(!le(o)||!In(o).isFile())return{error:`--from '${t}' is not a file \u2014 pass the changed source document`};let s=i.route(o,F);if(s!==null)return mn(e,r,s.plugin,o);let c=Ge(o);if(!c.ok)return{error:`--from '${t}' is not an ingestable document \u2014 allowed: ${c.allowlist.join(", ")}`};let p=U(e);if(!p.heads.has(r))return{error:`unknown source '${r}' \u2014 see \`kane-cli context list --type source\``};if(p.heads.get(r)==null)return{error:`source '${r}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let v=xe(e,r,{filePath:o});if(v!==null)return{error:v};let d=null;try{d=Ye(o)}catch{}return d!==null&&d!==r&&p.heads.get(d)!=null?{error:`'${G(o)}' already backs live source '${d}' \u2014 did you mean --source-id ${d}? To truly move these bytes under '${r}', retire '${d}' first`}:{sourceId:r,filePath:o}}function mn(e,n,t,r){let i=U(e);if(!i.heads.has(n))return{error:`unknown source '${n}' \u2014 see \`kane-cli context list --type source\``};let o=i.heads.get(n);if(o==null)return{error:`source '${n}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let s=ge(n,hn(i.mediaOf(o)),t.manifest.id,!1);if(s!==void 0)return{error:s};let c=N(e);for(let[p,v]of i.heads){if(p===n||v==null||i.mediaOf(v).format!=="plugin")continue;let d=oe(c,p,fn(e));if(d.kind==="plugin"&&d.ref===r)return{error:`'${se(r)?r:G(r)}' already backs live source '${p}' \u2014 did you mean --source-id ${p}? To truly move these bytes under '${n}', retire '${p}' first`}}return{sourceId:n,pluginRef:{plugin:t.manifest.id,ref:r}}}function Cn(e,n,t){let r=oe(N(e),n,fn(e));if(r.kind!=="plugin"&&r.kind!=="no-envelope")return{error:pn};let i=vn(t,n,r.plugin);if(i!==null)return{error:i};let o=`kane-cli maintain reconcile --from <file> --source-id ${n}`;if(r.kind==="no-envelope")return{error:`this machine holds no record of the file source '${n}' was read from \u2014 the store was cloned or pulled, or a revert moved its head; pass the file: ${o} [SOURCE_ORIGIN_UNKNOWN]`};if(r.fetched){let s=t.route(r.ref,F);return s===null||s.plugin.manifest.id!==r.plugin?{error:`source '${n}' was read by plugin ${r.plugin} from '${r.ref}', which this build routes to ${s===null?"no plugin":`plugin ${s.plugin.manifest.id}`} \u2014 reconcile it with a build whose plugin ${r.plugin} claims that reference [SOURCE_REF_UNROUTED]`}:{sourceId:n,pluginRef:{plugin:r.plugin,ref:r.ref}}}return F(r.ref)?{sourceId:n,pluginRef:{plugin:r.plugin,ref:r.ref}}:{error:`source '${n}' was last read from '${r.ref}', which is not there \u2014 pass its new place: ${o} [SOURCE_FILE_MISSING]`}}async function Un(e,n,t,r){if(te(n)||!se(n))return null;let i=r.route(n,F);if(i===null)return null;let o=i.plugin,s=o.manifest.id,c;try{c=await Je(o,"claim",Ae.hookMs,()=>o.claim({ref:i.ref,named:i.named,isFile:!1}))}catch(v){return{error:v instanceof Error?v.message:String(v)}}let p=c?.sourceId;return c==null?{error:`plugin ${s} does not read '${n}' \u2014 pass a reference it claims [PLUGIN_NOT_CLAIMED]`}:qe(p)?t!==void 0&&t!==p?{error:`--source-id '${t}' does not match the source plugin ${s} reads '${n}' as, '${p}' \u2014 re-run without --source-id`}:mn(e,p,o,n):{error:`plugin ${s} claimed '${n}' as ${JSON.stringify(p)}, which is not an id a source may have [PLUGIN_SOURCE_ID_INVALID]`}}var pn="reconcile needs --from <file|url> AND --source-id <id> (files only \u2014 a URL derives its own id) \u2014 see `kane-cli context list --type source` for ids";function An(e,n){let t=de(e);if(!le(t))return!1;let r=oe(N(t),n);return r.kind==="plugin"||r.kind==="no-envelope"}function hn(e){return e.format==="plugin"?e.plugin?.id??"":null}function vn(e,n,t){return e.byId(t)!==void 0?null:`PLUGIN_MISSING: source '${n}' is read by the plugin ${t}, which this build does not include \u2014 reconcile it with a build that has the ${t} plugin`}function M(e){return e==null?"(none)":e.slice(0,19)}function ne(e,n,t,r=!1,i){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${M(n.head.before)} \u2192 ${M(n.head.after)}`),r||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&(e.out(n.held?`extract ran in override mode; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),i?.({type:"defaults_taken",count:t?.defaultsTaken??0})),r){let o=n.changeset??[],s=(p,v)=>{let d=o.filter(l=>l.kind===p).length;return d>0?`${d} ${v}`:null},c=[s("ADD","add"),s("MODIFY","modify"),s("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${o.length} item(s)${c.length?` \u2014 ${c.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let o=n.changeset??[];e.out(`changeset: ${o.length} item(s)`);for(let s of o)if(s.kind==="MODIFY")e.out(` [MODIFY] ${H(s.ref)} \u2014 ${s.summary} (${M(s.old_cid)} \u2192 ${s.new_cid===null?"(staged)":M(s.new_cid)})`);else if(s.kind==="ADD")e.out(` [ADD] ${H(s.ref)}`);else{e.out(` [ARCHIVE] ${H(s.ref)} \u2014 ${s.why}`);let c=be(s.impact,"retiring drops");c&&e.out(` ${c}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let o of n.rows){e.out(` [${o.kind}] ${H(o.ref)} \u2014 ${o.reason}`);let s=be(o.impact,"approving marks");s&&e.out(` ${s}`),e.out(` provenance: ${o.provenance}`),e.out(` action: ${o.action}`)}}function Rn(e,n){return Pe({source_id:e.source_id,head:{status:e.head.status},rows:e.rows,archive:(e.changeset??[]).filter(t=>t.kind==="ARCHIVE"),changed:e.changed,held:!!e.held,defaultsTaken:n?.defaultsTaken},process.stdout.columns)}function be(e,n){if(!e||e.stale_refs.length===0)return null;let t=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(t.length>0?` \u2014 ${t.length} directly touched: ${t.join(", ")}`:"")}function A(e){return e==="interactive"?"override":e}async function Y(e,n,t,r,i,o,s=[],c="override",p,v,d,l,g,h,k){let{dir:m}=e,b;try{b=Re(m)}catch(f){return $(r,f instanceof Error?f.message:String(f)),1}try{if(!t){let{runWalkSession:f}=await import("./walk-session-SHGYLFRB.js"),{telemetryEnvName:R}=await import("./bootstrap-6ACT4ALI.js");return await f({credentials:B,onIngestRefusal:W,dir:m,rows:n,archive:s,held:p??null,childMode:c,runDesign:l??null,mark:o,markA:d,...v?{archiveState:v}:{},...h?{meta:{verb:"reconcile",sid:h,env:R()}}:{},...k?{resumeCmd:k}:{},signals:E=>T(m,E.ref,E.verdict,E.reason),...g?{script:g}:{}})}return await Hn(e,n,t,r,i,o,s,c,p,v)}finally{b()}}var K=(e,n,t=!1)=>t?`kane-cli maintain reconcile --source-id ${n}`:e?`kane-cli maintain reconcile --from ${e} --source-id ${n}`:void 0,Mn=e=>e===null?void 0:"filePath"in e?e.filePath:"remoteUrl"in e?e.remoteUrl:e.pluginRef.ref,q=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function J(e,n,t){let r=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:t,rows:r.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:n.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function ce(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var X=ce();async function ee(e,n,t,r,i,o,s,c,p){let{dir:v}=e;J(i,n,t);let d=n.changeset.filter(h=>h.kind==="ARCHIVE"&&p?.[h.ref]===void 0),l=n.rows;if(s==="ci"&&d.length>0)return i({type:"error",message:q(d.length),code:"HIGH_RISK_CI"}),i(ce()),2;let g;try{g=Re(v)}catch(h){return i({type:"error",message:h instanceof Error?h.message:String(h)}),i(ce()),2}try{return await Fn(e,n,t,r,i,o,s,l,d,c)}finally{g()}}async function Fn(e,n,t,r,i,o,s,c,p,v){let{dir:d,store:l}=e,g=0,h=0,k=0,m=0,b=0,f=0,R=0,E=new Set,I=(a,y)=>{try{v?.(a,y)}catch{}};for(let[a,y]of c.entries()){i({type:"reconcile_row_start",kind:y.kind,ref:y.ref,...y.impact?{stale:y.impact.stale_refs.length,direct:y.impact.direct_refs?.length??0}:{}});let w=(u,x,_)=>i({type:"reconcile_row_end",kind:y.kind,ref:y.ref,outcome:u,...x!==void 0?{exit_code:x}:{},..._?{detail:_}:{}});if(y.applied){h++,w("skipped");continue}if(y.kind==="REMOVE"){b++,w("plan-only");continue}if(y.held_ref&&n.held){let u=new Set;if(y.kind==="MODIFY"&&y.impact){let _=U(d);for(let P of y.impact.stale_refs){let C=_.resolve(P);C&&_.stale(C.tip)==="fresh"&&u.add(P)}}let x=ke(l,n.held,y.held_ref,Oe);if(!x.ok){k++,R===0&&(R=1),w("failed",1,x.message);continue}if(x.kind==="ADD"){let _=await r(x.ref,{yes:!0,mode:s});if(_!==0){_===3?(m++,R===0&&(R=3),w("paused",3)):(k++,R===0&&(R=1),w("failed",_));continue}}g++,x.kind!=="ADD"&&y.impact&&(f+=u.size),I(a,"approved"),T(d,y.ref,x.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),w("applied");continue}let O=we(U(d),y.ref);if(!O.ok){h++,w("skipped");continue}let S=O.target;if(E.has(S.ucTip)){h++,w("skipped");continue}if(y.kind==="ADD"){let u=await r(S.seamRef,{yes:!0,mode:s});if(u===3){m++,R===0&&(R=3),w("paused",3);continue}if(u!==0){k++,R===0&&(R=1),w("failed",u);continue}E.add(S.ucTip),g++,I(a,"approved"),T(d,y.ref,"gap-resolved-create"),w("applied")}else{let u=await ye(l,S,{yes:!0,mode:s},o,r,"batch");u.outcome==="evolved"?(E.add(S.ucTip),g++,I(a,"approved"),T(d,y.ref,"gap-resolved-evolve"),w("applied")):u.outcome==="paused"?(m++,R===0&&(R=u.code),w("paused",u.code)):u.outcome==="failed"?(k++,R===0&&(R=1),w("failed",u.code)):(h++,u.outcome==="unchanged"&&(E.add(S.ucTip),I(a,"skipped")),w("skipped",void 0,u.outcome==="unchanged"?"unchanged \u2014 the design agent found nothing to change":void 0))}}return p.length>0&&s!=="agent"&&(i({type:"reconcile_held",source_id:n.source_id,plan_path:t,held:p.map(a=>({ref:a.ref,why:a.why}))}),b+=p.length),p.length>0&&s==="agent"&&(i({type:"reconcile_paused",plan_path:t,pending:p.map(a=>({ref:a.ref,why:a.why}))}),m+=p.length,R===0&&(R=3)),i(ce({applied:g,skipped:h,plan_only:b,failed:k,paused:m,stale_created:f})),R}var Oe={kind:"human",id:process.env.USER??"operator"};function T(e,n,t,r){Ne(e,Tn(n,t,r))}function Tn(e,n,t){return{ts:new Date().toISOString(),command:"reconcile-walk",id:e,verdict:n,polarity:"preference",by:Oe,target:e,...t!==void 0?{reason:t}:{}}}async function Hn(e,n,t,r,i,o,s=[],c="override",p,v){let{dir:d,store:l}=e,g=0,h=0,k=0,m=0,b=0,f=0,R=0,E=new Set;for(let[I,a]of n.entries()){if(a.applied){r.out(`skipped ${a.ref} \u2014 already applied (${a.applied.outcome} at ${a.applied.at})`),h++;continue}let y=u=>{try{o?.(I,u)}catch(x){$(r,`could not record applied state for ${a.ref}: ${x instanceof Error?x.message:String(x)}`)}};if(a.kind==="REMOVE"){r.out(`REMOVE ${a.ref} \u2014 plan-only in this release (not executed)`),m++;continue}if(a.held_ref&&p){let u=ke(l,p,a.held_ref,Oe);if(!u.ok){$(r,`held ${a.ref}: ${u.message}`),b++,R===0&&(R=1);continue}if(r.out(`committed ${u.ref} (${a.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),u.kind==="ADD"){let x=await i(u.ref,{yes:t,mode:c});if(x===3){r.out(`design session for ${u.ref} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above`),f++,R===0&&(R=3),y("approved");continue}if(x!==0){$(r,`design run for ${u.ref} ended with exit code ${x}`),b++,R===0&&(R=1),y("approved");continue}}g++,y("approved"),T(d,a.ref,a.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let w=U(d),O=we(w,a.ref);if(!O.ok){r.out(`skipped ${a.ref} \u2014 ${O.message}`),h++;continue}let S=O.target;if(E.has(S.ucTip)){r.out(`skipped ${a.ref} \u2014 use-case ${S.display} already handled in this walk`),h++;continue}if(a.kind==="ADD"){let u=await i(S.seamRef,{yes:t,mode:c});if(u===3){r.out(`design session for ${S.display} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above; this row lands when that session completes`),f++,R===0&&(R=3);continue}if(u!==0){$(r,`design run for ${S.display} ended with exit code ${u}`),b++,R===0&&(R=1);continue}E.add(S.ucTip),g++,y("approved"),T(d,a.ref,"gap-resolved-create")}else{let u=await ye(l,S,{yes:!0,mode:c},r,i,"batch");u.outcome==="evolved"?(E.add(S.ucTip),g++,y("approved"),T(d,a.ref,"gap-resolved-evolve")):u.outcome==="paused"?(f++,R===0&&(R=u.code)):u.outcome==="failed"?(b++,R===0&&(R=u.code)):(h++,u.outcome==="unchanged"&&(E.add(S.ucTip),y("skipped")))}}for(let I of s)if(I.kind==="ARCHIVE"&&v?.[I.ref]===void 0){r.out(`[ARCHIVE] ${I.ref} \u2014 ${I.why}`);{let a=be(I.impact,"retiring drops");a&&r.out(` ${a}`)}r.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),m++}return r.out(`reconcile walk: ${g} applied, ${h} skipped, ${k} deferred, ${m} plan-only`+(b>0?`, ${b} failed`:"")+(f>0?`, ${f} paused`:"")),R}var Nn=new Set(me.map(e=>e.name));function xe(e,n,t){let r=U(e),i=r.heads.get(n);if(i==null)return null;let o=r.mediaOf(i);if("pluginRef"in t)return ge(n,hn(o),t.pluginRef.plugin,!1)??null;if("remoteUrl"in t){let s=pe(t.remoteUrl)?.name??"remote";return o.format!==s?`source '${n}' is backed by ${o.format} content, not a ${s} source \u2014 reconcile it with the --from it was originally ingested from`:null}return Nn.has(o.format)?`source '${n}' is a remote ${o.format} source \u2014 pass its URL to --from, not a file`:null}function De(e,n,t,r){let{store:i}=e;if("pluginRef"in n){let o=V(r).byId(n.pluginRef.plugin);if(o===void 0)throw new Error(`the plugin ${n.pluginRef.plugin} is not loaded`);let s=V(r).route(n.pluginRef.ref,F),c=s!==null&&s.plugin===o?s:{ref:n.pluginRef.ref,named:!1};return cn(i,o,c.ref,{connect:r.connections??ze,named:c.named,registry:V(r)})}return"remoteUrl"in n?an(i,n.remoteUrl,{out:t.out,err:t.err},B,r.remoteFindProvider):sn(i,n.filePath)}var V=e=>e.plugins??Ze();function wn(e){return"pluginRef"in e?{plugin_ref:e.pluginRef}:"remoteUrl"in e?{remote_url:e.remoteUrl}:{backing_path:e.filePath}}function yn(e,n,t,r){let i=xe(e,n.source_id,t);return i!==null?`stored plan cannot replay: ${i}`:"pluginRef"in t?vn(V(r),n.source_id,t.pluginRef.plugin):null}function _n(e){return e.plugin_ref!==void 0?{pluginRef:e.plugin_ref}:e.remote_url!==void 0?{remoteUrl:e.remote_url}:e.backing_path!==void 0?{filePath:e.backing_path}:null}var ae=Symbol("owned");async function Ie(e,n,t,r,i,o=!1,s=!1,c=!1){let{store:p}=e,v=i.seams??{reingest:De(e,t,r,i),reextract:Ee(p,{credentials:B,onIngestRefusal:W,stage:o,hostOut:h=>r.out(h),hostEmit:h=>{h.type!=="run_start"&&i.emitEvent?.(h)},...i.emitEvent?{}:{hostProgress:h=>process.stderr.write(h+`
3
+ `)}})},d=null,l={reingest:v.reingest,reextract:async h=>d=await v.reextract(h)},g;try{r.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),g=await(i.buildPlan??$e)(p,n,l,c?{reextractUnchanged:!0}:{})}catch(h){return h instanceof Error&&h.message.startsWith("SOURCE_ID_OWNED: ")?($(r,h.message),ae):($(r,`reconcile failed: ${h instanceof Error?h.message:String(h)}`),null)}if(g.changed)if(s)for(let h of Rn(g,d))r.out(h);else ne(r,g,d,!1,i.emitEvent);return g}function kn(e,n){if(n.plugin_ref===void 0||n.held===void 0)return null;let t=U(e).heads.get(n.source_id);if(typeof t!="string")return null;let r=n.held.staged_source_cid,i=null;if(r===void 0||t!==r)i={cid:t,where:"the source is now"};else if(F(n.plugin_ref.ref)){let o=xn(n.plugin_ref.ref),s=Ce("source",Ue(n.source_id,He(o)));s!==t&&(i={cid:s,where:`${G(n.plugin_ref.ref)} now holds`})}return i===null?null:`PLUGIN_VERSION_MOVED: plan ${n.created} was built for ${n.source_id} @${M(r??null)}, ${i.where} @${M(i.cid)} \u2014 its held rows are not carried across a version move; run kane-cli maintain reconcile --source-id ${n.source_id} again`}var $n=Symbol("set-aside");async function Ln(e){let n=N(e),[{render:t},r,{ScrollbackProvider:i},{ChatSurface:o},{makeChatController:s},{makeReconcileDeps:c}]=await Promise.all([import("./build-5ZN47FAT.js"),import("./react-QWOAB3TB.js"),import("./scrollback-GGNBDFQV.js"),import("./ChatSurface-6NZGMNHL.js"),import("./chat-controller-XINCDH6Z.js"),import("./reconcile-deps-TWJ3FTSU.js")]),p=r.default??r,v=s(),d=c({credentials:B,onIngestRefusal:W,store:n,note:l=>v.note(l),emitWalkSignal:(l,g,h)=>T(e,l,g,h)});return new Promise(l=>{let g=t(p.createElement(i,null,p.createElement(o,{controller:v,verb:"extract",reconcile:d,autoReview:!0,onReviewExit:()=>{g.unmount(),l(0)},onCtrlC:()=>{g.unmount(),l(d.pending()?3:0)}})),{exitOnCtrlC:!1})})}async function Vn(e,n,t,r,i){let{dir:o}=e,s=re(o,n);if("error"in s)return $(r,s.error),2;let{plan:c,path:p}=s,v=t==="override"||t==="ci";if(n===void 0&&t==="interactive"&&r.isTTY&&!await r.confirm(`apply plan ${G(p)} for ${c.source_id} (created ${c.created})?`))return r.out(`not applying ${G(p)}`),0;let d=i.runDesignForUc??Se,l=i.runDesignForUc??null,g=i.sessionScript,h=(a,y)=>j(p,a,y),k=(a,y)=>ie(p,a,y),m=Z(o);if(m===c.head_pin){if(t==="agent"||r.machine){let y=i.emitEvent??(()=>{});return ee(e,Q(c),p,d,y,r,A(t),h,c.archive_state)}let a=ve(c);if(t==="ci"&&a.length>0)return $(r,q(a.length)),2;if(r.out(`applying stored plan ${G(p)} for ${c.source_id} (${c.rows.length} row(s))`),!v)for(let y of Pe({source_id:c.source_id,head:{status:"stored plan"},rows:c.rows,archive:(c.changeset??[]).filter(w=>w.kind==="ARCHIVE"),changed:!1,held:!!c.held},process.stdout.columns))r.out(y);return Y(e,c.rows,v,r,d,h,c.changeset??[],A(t),c.held,c.archive_state,k,l,g,c.source_id,K(c.backing_path??c.remote_url,c.source_id,c.plugin_ref!==void 0))}let b=kn(o,c);if(b!==null)return $(r,b),2;if(r.out(`graph moved since this plan (${M(c.head_pin)} \u2192 ${M(m)}) \u2014 recomputing`),c.held)return En(e,c,r,i,t,d,!1);let f=_n(c);if(f===null)return $(r,`stored plan for ${c.source_id} names no backing file or URL \u2014 re-run reconcile --from`),2;let R=yn(o,c,f,i);if(R!==null)return $(r,R),2;let E=await Ie(e,c.source_id,f,r,i,!1,t==="interactive");if(E===ae)return 2;if(!E)return 1;if(!E.changed)return ne(r,E,null,!1,i.emitEvent),0;if(t==="agent"||r.machine){let a=i.emitEvent??(()=>{});return ee(e,E,null,d,a,r,A(t))}let I=E.changeset.filter(a=>a.kind==="ARCHIVE");return t==="ci"&&I.length>0?($(r,q(I.length)),2):Y(e,E.rows,v,r,d,void 0,E.changeset,A(t),E.held,void 0,void 0,l,g,E.source_id,K(Mn(f),E.source_id,"pluginRef"in f))}function Q(e,n=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:n?e.rows.filter(t=>t.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function Bn(e,n,t,r,i,o,s){let{dir:c}=e,p=r.runDesignForUc??null,v=r.sessionScript,d=tn(c,n);if(d===null)return null;if("error"in d)return $(t,d.error),2;let{plan:l,path:g}=d,h=l.rows.filter(f=>f.applied===void 0),k=ve(l),m=r.emitEvent??(()=>{});if(h.length===0&&k.length===0){t.out(`already reconciled \u2014 plan ${l.created} applied ${l.rows.length} row(s)`);let f=rn(U(c)).staleCount;return f>0&&(t.out(`${f} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),m({type:"stale_debt",count:f})),(i==="agent"||t.machine)&&(J(m,Q(l),g),m({...X})),0}let b=Z(c);if(b!==l.head_pin){let f=kn(c,l);if(f!==null){let R=nn(c,g);return t.out(`${f.replace(/^PLUGIN_VERSION_MOVED: /,"").replace(/ — .*$/,"")} \u2014 set aside (${R}); re-extracting ${l.source_id} at its current version`),m({type:"plan_set_aside",source_id:l.source_id,plan_path:R,code:"PLUGIN_VERSION_MOVED"}),$n}return t.out(`plan ${l.created} superseded \u2014 graph moved (${M(l.head_pin)} \u2192 ${M(b)}); recomputing`),En(e,l,t,r,i,o,s)}return t.out(`resuming plan ${l.created} \u2014 ${h.length} pending row(s)${k.length>0?`, ${k.length} undecided archive item(s)`:""}`),s?(ne(t,Q(l),null,!1,r.emitEvent),t.out(`plan stored: ${g}`),(i==="agent"||t.machine)&&(J(m,Q(l),g),m({...X})),0):i==="agent"||t.machine?ee(e,Q(l),g,o,m,t,A(i),(f,R)=>j(g,f,R),l.archive_state):i==="ci"&&k.length>0?($(t,q(k.length)),2):Y(e,l.rows,i==="override"||i==="ci",t,o,(f,R)=>j(g,f,R),l.changeset??[],A(i),l.held,l.archive_state,(f,R)=>ie(g,f,R),p,v,l.source_id,K(l.backing_path??l.remote_url,l.source_id,l.plugin_ref!==void 0))}async function En(e,n,t,r,i,o,s){let{dir:c,store:p}=e,v=r.runDesignForUc??null,d=r.sessionScript,l;if(n.held){let w=U(c),O=new Set(n.rows.filter(u=>u.held_ref!==void 0&&u.applied!==void 0).map(u=>u.held_ref)),S=[];for(let u of n.held.rows){if(O.has(u.temp_ref))continue;if(!u.matched_cid){S.push(u);continue}let x=w.tipOf(u.matched_cid);if(w.superseded.get(x)===null){t.out(`dropped held "${u.title}" \u2014 its use-case was retired meanwhile`),r.emitEvent?.({type:"held_dropped",ref:u.temp_ref,title:u.title,reason:"target_retired"});continue}S.push(x===u.matched_cid?u:{...u,matched_cid:x,uc:{...u.uc,matches_existing:{cid:x}}})}l={source_id:n.held.source_id,...n.plugin_ref!==void 0&&n.held.staged_source_cid!==void 0?{staged_source_cid:n.held.staged_source_cid}:{},rows:S}}let g=_n(n);if(g===null)return $(t,`stored plan for ${n.source_id} names no backing file or URL \u2014 re-run reconcile --from`),2;let h=yn(c,n,g,r);if(h!==null)return $(t,h),2;let k=r.seams??{reingest:De(e,g,t,r),reextract:Ee(p,{credentials:B,onIngestRefusal:W,stage:l!==void 0,hostOut:w=>t.out(w),hostEmit:w=>{w.type!=="run_start"&&r.emitEvent?.(w)},...r.emitEvent?{}:{hostProgress:w=>process.stderr.write(w+`
4
+ `)}})},m;try{m=await(r.buildPlan??$e)(p,n.source_id,k,{resumeHeld:l})}catch(w){return $(t,`reconcile failed: ${w instanceof Error?w.message:String(w)}`),1}if(i==="interactive"&&!s)for(let w of Rn(m,null))t.out(w);else ne(t,m,null,!1,r.emitEvent);let b=Z(c),f=null;if(b!=null){let w={},O=new Set(m.changeset.filter(S=>S.kind==="ARCHIVE").map(S=>S.ref));for(let[S,u]of Object.entries(n.archive_state??{}))O.has(S)&&(w[S]=u);f=he(c,{version:2,source_id:m.source_id,...wn(g),head_pin:b,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:m.skipped_arms,note:m.note,changeset:m.changeset,rows:m.rows,...m.held?{held:m.held}:{},...Object.keys(w).length>0?{archive_state:w}:{}}),t.out(`plan stored: ${f}`)}if(s){if(i==="agent"||t.machine){let w=r.emitEvent??(()=>{});J(w,m,f),w({...X})}return 0}let R=r.emitEvent??(()=>{}),E=f?re(c,f).plan.archive_state:void 0,I=f?(w,O)=>j(f,w,O):void 0,a=f?(w,O)=>ie(f,w,O):void 0;if(i==="agent"||t.machine)return ee(e,m,f,o,R,t,A(i),I,E);let y=m.changeset.filter(w=>w.kind==="ARCHIVE"&&E?.[w.ref]===void 0);return i==="ci"&&y.length>0?($(t,q(y.length)),2):Y(e,m.rows,i==="override"||i==="ci",t,o,I,m.changeset,A(i),m.held,E,a,v,d,m.source_id,K(n.backing_path??n.remote_url,m.source_id,n.plugin_ref!==void 0))}async function dn(e,n,t={},r=process.cwd()){let{telemetryBootstrap:i,telemetryEnvName:o}=await import("./bootstrap-6ACT4ALI.js"),s=i({verb:"reconcile",mode:typeof e.mode=="string"?e.mode:"interactive",contextRoot:L(r,".context"),env:o(),applyPlanPath:typeof e.apply=="string"?L(r,e.apply):void 0,write:!0,longSession:!0});(e.mode==="agent"||n.machine)&&t.emitEvent?.({type:"run_start",session:s.ids.session_id});{let v=le(L(r,".context"))?We(L(r,".context")):null;if(v)return e.mode==="agent"||n.machine?t.emitEvent?.(fe(v)):($(n,v.text),(n.err??n.out)(`next: ${v.remedy}`)),await s.end({exit_code:2}),2}let c=await Be(L(r,".context"));c&&(e.mode==="agent"||n.machine?t.emitEvent?.(je(c)):(n.err??n.out)(c.text));let p=await jn(e,n,t,r);return p===1&&e.mode!=="agent"&&(n.err??n.out)(s.supportFooter()),await s.end({exit_code:p}),p}async function jn(e,n,t={},r=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,o=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return $(n,"pass --plan OR --apply, not both"),2;let s=e.from!==void 0||!i,c=e.from!==void 0&&te(e.from),p=e.from!==void 0&&!c&&se(e.from)&&!F(L(r,e.from))&&V(t).route(e.from,F)!==null,v=e.from===void 0&&e.sourceId!==void 0&&!i&&An(r,e.sourceId);if(s&&!v&&(!e.from||!e.sourceId&&!c&&!p))return $(n,pn),2;if(e.from&&o!==void 0)return $(n,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let d=Le(r,n);if(!d)return 2;let l=N(d),g={dir:d,store:l};if(e.mode!==void 0&&!gn.has(e.mode))return un(`--mode must be interactive | agent | ci | override, got '${e.mode}'`);let h=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!h&&!n.isTTY)return $(n,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let k=!e.plan,m="override";if(e.from||v){let _=On(e,n.isTTY);if(typeof _=="object")return _.code==="MODE_USAGE"?un(_.error):($(n,_.error),2);m=_}let b=m==="override"||m==="ci";if(i&&!e.from){let{makeReconcileDeps:_}=await import("./reconcile-deps-TWJ3FTSU.js"),P=o===void 0?_({credentials:B,onIngestRefusal:W,store:l,emitWalkSignal:(D,z,ue)=>T(d,D,z,ue)}).pending():null;if(P?.kind==="cards"){let D=e.mode??"interactive";return!n.isTTY||D!=="interactive"?($(n,`a held changeset for ${P.source} awaits review (${P.count} change(s)) \u2014 resume in a terminal: kane-cli maintain reconcile --apply [HELD_REVIEW]`),2):(t.cardApplyMount??Ln)(d)}let C=e.mode??"interactive";return Vn(g,o===void 0?void 0:L(r,o),C,n,t)}let f=v?Cn(d,e.sourceId,V(t)):(p?await Un(d,e.from,e.sourceId,V(t)):null)??Dn(d,r,e.from,e.sourceId,V(t));if("error"in f)return $(n,f.error),2;let R=_=>_.corrupt>0?($(n,`cannot verify review holds \u2014 ${_.corrupt} session file(s) unreadable; inspect with kane-cli context sessions list, clean with kane-cli context sessions clean, then retry [SESSIONS_UNREADABLE]`),2):_.holders.length>0?($(n,`session ${_.holders[0]} holds item(s) for review pinned to ${f.sourceId} \u2014 finish that review first: kane-cli context extract --resume ${_.holders[0]} [SOURCE_HELD]`),2):null;if(!i){let _=R(_e(l,f.sourceId));if(_!==null)return _}if(m==="interactive"&&!e.plan&&!i){let _=t.seams?.reingest??De(g,f,n,t),P;try{P=await on(l,{sourceId:f.sourceId,reingest:_})}catch(D){return $(n,D instanceof Error?D.message:String(D)),D instanceof Error&&D.message.startsWith("SOURCE_ID_OWNED: ")?2:1}if(P.kind==="held"||P.kind==="unverifiable")return R(P.kind==="held"?{holders:P.holders,corrupt:0}:{holders:[],corrupt:P.corrupt})??2;let C=P.kind==="landed"?P.changeContext:null;if(P.kind==="first")return n.out(`${f.sourceId} landed for the first time \u2014 extract it: kane-cli context extract --source ${f.sourceId}`),0;if(P.kind==="unreadable")return $(n,`${f.sourceId} landed, but its version ${P.version} cannot be read \u2014 no change to review; check the store: kane-cli context fsck`),1;if(C){let z=await(t.chatMount??(async ue=>{let{bindExtractInteractive:Sn}=await import("./extract-bind-W2NET364.js");return Sn(ue)}))({mode:"interactive",posture:"reconcile",source:f.sourceId,changeContext:C});return z===3&&_e(l,f.sourceId).holders.length===0?0:z}}let E="pluginRef"in f?{pluginRef:f.pluginRef}:"remoteUrl"in f?{remoteUrl:f.remoteUrl}:{filePath:f.filePath},I=await Ie(g,f.sourceId,E,n,t,!!e.plan||m==="interactive",m==="interactive"&&!e.plan);if(I===ae)return 2;if(!I)return 1;let a=I,y=t.runDesignForUc??Se,w=t.runDesignForUc??null,O=t.sessionScript;if(!a.changed){let _=await Bn(g,f.sourceId,n,t,m,y,!!e.plan);if(_===$n){let P=await Ie(g,f.sourceId,E,n,t,!!e.plan||m==="interactive",m==="interactive"&&!e.plan,!0);if(P===ae)return 2;if(!P)return 1;a=P}else if(_!==null)return _}if(!a.changed){if(ne(n,a,null,!1,t.emitEvent),m==="agent"||n.machine){let _=t.emitEvent??(()=>{});J(_,a,null),_({...X})}return 0}let S=Z(d),u=null;if(S!=null?u=he(d,{version:2,source_id:a.source_id,...wn(E),head_pin:S,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:a.skipped_arms,note:a.note,changeset:a.changeset,rows:a.rows,...a.held?{held:a.held}:{}}):$(n,"no chain head after extract \u2014 plan not stored"),m==="agent"||n.machine){let _=t.emitEvent??(()=>{});if(!k)return J(_,a,u),_({...X}),0;let P=u?(C,D)=>j(u,C,D):void 0;return ee(g,a,u,y,_,n,A(m),P)}if(!k)return u&&n.out(`plan stored: ${u}`),0;let x=a.changeset.filter(_=>_.kind==="ARCHIVE");if(m==="ci"&&x.length>0)return u&&n.out(`plan stored: ${u}`),$(n,q(x.length)),2;if(u){n.out(`plan stored: ${u}`);let _=u;return Y(g,Wn(d,_)??a.rows,b,n,y,(P,C)=>j(_,P,C),a.changeset,A(m),a.held,void 0,void 0,w,O,a.source_id,K(e.from,a.source_id,"pluginRef"in f))}return Y(g,a.rows,b,n,y,void 0,a.changeset,A(m),a.held,void 0,void 0,w,O,a.source_id,K(e.from,a.source_id,"pluginRef"in f))}function Wn(e,n){let t=re(e,n);return"error"in t?null:t.plan.rows}async function bt(e,n={},t,r=process.cwd()){if(e.json&&e.mode!=="override"&&e.mode!=="ci"){let o=e.mode==="agent"?"--mode agent writes NDJSON already":"it needs --mode override or --mode ci";return(t?.stderr??(s=>{process.stderr.write(s)}))(`reconcile: --json ${o}
5
+ `),2}if(!t&&r===process.cwd()){let{remoteEntry:o}=await import("./remote-entry-X6JMPC2K.js"),s=await o("maintain reconcile",e.mode==="agent"||e.json===!0);if(s!==null){if("exit"in s)return s.exit;let{remoteReconcile:c}=await import("./reconcile-remote-BCX6SWFC.js");return c({choice:s.choice,opts:e})}}let i=e.json===!0;if(e.mode==="agent"||i){let{makeHeadlessIO:o}=await import("./headless-io-FFM5T6KL.js"),s=t?o("ndjson","reconcile",t):o("ndjson","reconcile"),c={...i?{machine:!0}:{},out:s.out,err:k=>s.event({type:"error",message:k}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:p}=await import("./run-channel-63SVP5OI.js"),v=2,d=de(r),l=i&&le(d)?Xe(N(d)):null,g=null,h=k=>{let m=k.source_id;k.type==="reconcile_plan"&&typeof m=="string"&&(g=m),s.event(k)};try{v=await p({event:h},()=>dn(e,c,{...n,emitEvent:h},r)),l!==null&&g!==null&&s.event({type:"reconcile_use_cases",source_id:g,use_cases:en(N(d),g,l)})}catch(k){k instanceof Te?(v=2,s.event(fe({code:k.code,text:k.message,remedy:k.remedy}))):(v=1,s.event({type:"error",message:k instanceof Error?k.message:String(k)}))}return s.done(v)}return dn(e,Ve(),n,r)}export{A as childModeFor,T as emitWalkSignal,Un as pluginRefInputs,bt as reconcileCommand,On as resolveReconcileMode,dn as runReconcileCommand,Cn as sourceIdInputs,Dn as validateReconcileInputs,Tn as walkSignal};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d}from"./chunk-FSYOTRMC.js";import"./chunk-OFSDB7B4.js";import"./chunk-LKQFG4RW.js";import"./chunk-RTVWQK7I.js";import"./chunk-TNORODUF.js";import"./chunk-I6S6DZ2E.js";import"./chunk-W7FLXW6Q.js";import"./chunk-R4JUKTDO.js";import"./chunk-OJ33Q6DU.js";import"./chunk-O3HHTKZ5.js";import"./chunk-HAW5WEKT.js";import"./chunk-HJLMH7ZM.js";import"./chunk-VZJ6LUXX.js";import"./chunk-35ECWCCK.js";import"./chunk-IZ65ZPWY.js";import"./chunk-73ZFOJOK.js";import"./chunk-EF47KRUK.js";import"./chunk-3GXN6VF6.js";import"./chunk-LD5B3QFW.js";import"./chunk-HD6NR44L.js";import"./chunk-3JLEDSG5.js";import"./chunk-42PALMW2.js";import"./chunk-DPGOAFKF.js";import"./chunk-ZHWU6L2G.js";import"./chunk-VLDCHFXF.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-UR6MHSHU.js";export{a as REVIEW_PAUSED,d as makeReconcileDeps,b as offerLaunch,c as toWalkCard};
@@ -0,0 +1,13 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as Y,c as O,e as H,f as _,g as W}from"./chunk-5AKJPYUW.js";import{f as $,k as F}from"./chunk-3RJHXOZH.js";import"./chunk-DDZLCAEO.js";import{b as L}from"./chunk-CM4CHYSN.js";import"./chunk-RHGW7B5Q.js";import{k as j}from"./chunk-HCJ2N3XB.js";import"./chunk-NLZZLANH.js";import{e as T}from"./chunk-3F5FMH76.js";import{d as x,e as I,i as A}from"./chunk-XMPTFXPW.js";import"./chunk-ZU4W2QGM.js";import"./chunk-73Y6T2UK.js";import"./chunk-HIUAUZNL.js";import{h as U}from"./chunk-457Y5TEC.js";import"./chunk-EECDDDSB.js";import"./chunk-7NPTL66J.js";import"./chunk-42PALMW2.js";import"./chunk-KF4DKXSS.js";import"./chunk-AUJSC7PU.js";import{a as w}from"./chunk-JNSWKGTB.js";import"./chunk-3QICDXY5.js";import{h as N}from"./chunk-UUJIGOEO.js";import{k as M}from"./chunk-ZTHYAHDN.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-AZLNLHUA.js";import"./chunk-AQ2OG2EF.js";import"./chunk-DPGOAFKF.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import{j as E}from"./chunk-REKHAN53.js";import"./chunk-ZFM77AQU.js";import"./chunk-RF37IJNN.js";import"./chunk-XZYA7DNH.js";import{B as P,Ha as u,f as D,w as C}from"./chunk-7HMSMAUG.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import{a as S}from"./chunk-I2MC6VVX.js";import"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HJMCXSUJ.js";import"./chunk-FOJHSG5M.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";var Q=["interactive","agent","ci","override"];async function me(e){try{return await V(e)}finally{await C()}}async function V(e){let{opts:t}=e,a=t.mode==="agent",l=t.mode==="override",p=a||l&&t.json===!0,y=e.testing?.agentLines?{stdout:e.testing.agentLines,stderr:()=>{}}:void 0,f=a||l?E(I(p?"ndjson":"human","reconcile",y),{atQuestionsOnly:!0}):null,g=!a&&!l&&(e.testing?.terminal??x()),d=!1,o=(n,s=2)=>f&&p?(f.event({type:"error",code:n.code,message:n.message,...P(n)}),f.done(s,"refused")):(d&&process.stdout.write(`
3
+ `),j(n),process.stdout.write(`
4
+ `),s);if(t.mode!==void 0&&!Q.includes(t.mode)){let n=I("ndjson","reconcile",y);return n.event({type:"error",code:"MODE_USAGE",message:`--mode must be interactive | agent | ci | override, got '${t.mode}'`}),n.done(2,"refused")}if(t.plan)return o(u.optionNotYet("--plan"));if(t.apply!==void 0&&t.apply!==!1)return o(u.optionNotYet("--apply"));if(t.mode==="ci")return o(u.optionNotYet(`--mode ${t.mode}`));if(t.mode==="interactive"&&!g)return process.stderr.write(`reconcile: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
5
+ `),2;if(!t.sourceId)return o(u.reconcileNeeds(e.choice.projectName,a));let i=t.sourceId,r=null,m="";if(t.from){let n=N().route(t.from,w);if(n!==null){let s=w(t.from),c=await O(t.from,n,s?i:void 0);if("refusal"in c)return o(c.refusal,c.exit);if(c.item.sourceId!==i)return o(u.reconcileRefOtherId(i,n.plugin.manifest.id,t.from,c.item.sourceId));r=c.item}else{if(Y(t.from)){let c=M(t.from);return o(u.reviewOnlyFiles(t.from,a,c?U(c.name,t.from,i):void 0))}let s=W(t.from);if(!s.ok)return o(s.refusal);r={kind:"file",path:t.from,node:"",file:s.file,bytes:s.bytes,sourceId:i,limit:s.limit},m=s.supported}}let b;try{b=e.testing?.basicAuth??await T()}catch(n){if(!(n instanceof A))throw n;return o({code:n.code,message:n.message,...n.remedy?{remedy:n.remedy}:{}})}let k=D({url:e.choice.latticeUrl,basicAuth:b,...e.testing?.run?.fetch?{fetch:e.testing.run.fetch}:{}}),B=e.choice.projectId;g&&e.choice.projectName&&(process.stdout.write(`using project "${e.choice.projectName}", shared with your team
6
+ `),d=!0);let R;try{R=await k.sources(B)}catch(n){if(n instanceof S&&n.code==="NOT_FOUND")R=[];else{let{exit:s,...c}=L(n,e.choice,null);return o(c,s)}}let h=R.find(n=>n.sourceId===i);if(h===void 0||h.head===null){let n=r?.kind==="file"?r.file:i;return o(u.reconcileSourceMissing({source:i,file:n,path:t.from??i,project:e.choice.projectName,removed:h!==void 0,agent:a}))}if(r===null){let n=h.media?.format==="plugin"?h.media.plugin:void 0;if(n===void 0||typeof n.id!="string")return o(u.reconcileNeeds(e.choice.projectName,a));let s=n.fetch?.ref;if(typeof s!="string")return o(u.reconcileOriginUnknown(i,a));let c=N().route(s,w);if(c===null||c.plugin.manifest.id!==n.id)return o(u.reconcileRefUnrouted(i,n.id,s,c===null?null:c.plugin.manifest.id));let v=await O(s,c,i);if("refusal"in v)return o(v.refusal,v.exit);r=v.item}return q({choice:e.choice,person:k,basicAuth:b,item:r,supported:m,mode:a?"agent":l?"override":g?"interactive":"ci",io:f,refuse:o,projectLine:d,nothing:u.nothingToReview,...e.testing?{testing:e.testing}:{}})}async function q(e){let{mode:t,io:a,item:l}=e,p=l.sourceId,y=e.choice.projectId,{step:f,ended:g}=H({person:e.person,choice:e.choice,item:l,first:!1,then:t==="ci"?"pause":"review",...e.as!==void 0?{as:e.as}:{},supported:e.supported,retryMs:e.testing?.run?.retryDeadlineMs??12e4,remoteDeps:_(e.testing?.remoteDeps),...e.testing?{testing:e.testing}:{}}),d=e.testing?.remoteDeps?{...e.testing.run,remoteDeps:e.testing.remoteDeps}:e.testing?.run,o={verb:"reconcile",choice:e.choice,start:{kind:"new",body:{projectId:y,verb:"reconcile",mode:t==="interactive"?"interactive":"agent",sourceId:p}},run:{source:p,...t==="override"?{override:!0}:{}}},i;if(t==="interactive"){let{runInteractiveRemote:m}=await import("./interactive-remote-J56EWJGA.js");i=await m({...o,subject:p,ingest:[f],testing:{basicAuth:e.basicAuth,...e.testing?.check?{check:e.testing.check}:{},...d?{run:d}:{},...e.testing?.mount?{mount:e.testing.mount}:{},...e.testing?.onController?{onController:e.testing.onController}:{}}})}else i=await F({...o,mode:"agent",basicAuth:e.basicAuth,io:a,check:e.testing?.check??$,onProgress:()=>{},ingest:[f],signals:!0,onRefusal:m=>{j(m),process.stdout.write(`
7
+ `)},...d?{testing:d}:{}});let r=g();if(r.refused!==null)return e.refuse(r.refused.refusal,r.refused.exit);if(r.added==="unchanged"&&r.behind===0&&!r.unread)return a?a.done(i):(process.stdout.write(`${e.projectLine?`
8
+ `:""}${e.nothing(r.name,e.choice.projectName)}
9
+
10
+ `),i);if(t==="ci"&&r.added!==null&&r.sid!==null){let m=r.added!=="unchanged"?u.reviewWaits(r.name,r.sid):r.behind>0?u.reviewBehind(r.name,e.choice.projectName,r.behind):u.reviewUnread(r.name,e.choice.projectName);return process.stdout.write(`${m}
11
+ ${u.reviewResume(r.sid)}
12
+
13
+ `),i}return a?a.done(i):i}export{me as remoteReconcile,q as reviewNewVersion};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as s}from"./chunk-3MSXQU2C.js";import{f as a}from"./chunk-3E4ZO73O.js";import"./chunk-34R7BNZ2.js";import"./chunk-QSCXXNC2.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";function m(t){let n=t.sessionName!==null,e={type:"recording_state",enabled:!0,session_id:t.sessionId,persist:n};return t.sessionName&&(e.session_name=t.sessionName),t.testPath&&(e.test_path=t.testPath),t.outputPath&&(e.output_path=t.outputPath),e}async function h(t){if(t.isAgent){a(m(t));return}let n=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:o}=await import("./build-5ZN47FAT.js"),{useEffect:r}=n,{InfoBox:u}=await import("./InfoBox-D7GGZJU4.js"),l=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:s(t.testPath??"")},{label:"output",value:s(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function c(){let{exit:i}=o();return r(()=>{let p=setTimeout(()=>i(),50);return()=>clearTimeout(p)},[i]),n.createElement(u,{title:"Recording",titleColor:"#ff9500",rows:l})}await e(n.createElement(c),{stdout:process.stderr}).waitUntilExit()}export{m as buildRecordingStateEvent,h as printRecordingBanner};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as a,c as b,d as c,e as d,f as e}from"./chunk-CUXY6KQ2.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-XRNQSXOM.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-GMTHZUZ3.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";export{d as discoverAll,a as knownPlatforms,c as providerFor,b as registeredPlatforms,e as resolveTarget};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e}from"./chunk-CM4CHYSN.js";import"./chunk-RHGW7B5Q.js";import"./chunk-HCJ2N3XB.js";import"./chunk-NLZZLANH.js";import"./chunk-3F5FMH76.js";import"./chunk-XMPTFXPW.js";import"./chunk-ZU4W2QGM.js";import"./chunk-73Y6T2UK.js";import"./chunk-REKHAN53.js";import"./chunk-RF37IJNN.js";import"./chunk-XZYA7DNH.js";import"./chunk-7HMSMAUG.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HJMCXSUJ.js";import"./chunk-FOJHSG5M.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";export{c as endedRefusal,b as openFailure,e as remoteChoiceForResume,d as remoteEntry,a as remoteRefusal};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{k as i}from"./chunk-HCJ2N3XB.js";import"./chunk-XMPTFXPW.js";import"./chunk-ZU4W2QGM.js";import"./chunk-73Y6T2UK.js";import"./chunk-REKHAN53.js";import{Ha as t}from"./chunk-7HMSMAUG.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-C2RUDJ46.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HJMCXSUJ.js";import"./chunk-FOJHSG5M.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";function d(r,e,n){return e==="agent"?"agent":e==="override"?"override":!e&&!process.stdin.isTTY?(process.stderr.write(`${r}: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
3
+ `),{exit:2}):e==="ci"?(i(t.notYet(`${n} --mode ${e}`)),{exit:2}):!process.stdin.isTTY||!process.stdout.isTTY?(process.stderr.write(`${r}: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
4
+ `),{exit:2}):"interactive"}export{d as remoteMode};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{$ as A,Aa as $,B as a,Ba as aa,C as b,Ca as ba,D as c,Da as ca,E as d,Ea as da,F as e,Fa as ea,G as f,Ga as fa,H as g,Ha as ga,I as h,J as i,K as j,L as k,M as l,N as m,O as n,P as o,Q as p,R as q,S as r,T as s,U as t,V as u,W as v,X as w,Y as x,Z as y,_ as z,aa as B,ba as C,ca as D,da as E,ea as F,fa as G,ga as H,ha as I,ia as J,ja as K,ka as L,la as M,ma as N,na as O,oa as P,pa as Q,qa as R,ra as S,sa as T,ta as U,ua as V,va as W,wa as X,xa as Y,ya as Z,za as _}from"./chunk-7HMSMAUG.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";export{r as ALREADY_DISCARDED,t as CHAT_ONLY,Y as LIST_STATUS,Z as LIST_UP_TO_DATE,_ as LIST_WHY,ca as RESUME_UNREADABLE,x as SAVE_VERB_KEYS,p as WORK_ONLY,L as addAgain,n as addedCount,I as addsText,a as agentRemedy,h as andList,U as casesThere,A as chatOnly,z as counted,d as designChanged,e as designDoneLine,g as designFinishedLine,ba as designWords,f as designedLine,q as discardDetail,M as documentsToAddAgain,i as doneCounted,j as doneLines,aa as evolveWords,c as heldByEvent,b as heldByOf,y as heldChangesOf,D as heldChangesShort,E as heldChangesText,O as itsText,W as joinedNext,$ as projectNamed,fa as pulledLines,Q as remoteResume,v as repinsOf,u as replacedCounts,C as saveCountsOf,H as saveRows,l as savedLines,s as savedResult,F as savesSomething,k as savingLines,o as sharesItems,ea as shellWord,K as startAgainNext,R as testFileOf,X as testFilesField,V as testFilesWords,T as testManagerField,S as testManagerWords,da as unreadableLine,m as updatedCount,N as uploadedFiles,w as withKeeps,P as withoutVersions,ga as words,B as workOnly,G as worthSaving,J as yoursText};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-KXHJMAZU.js";import"./chunk-VE3SUJMA.js";import"./chunk-C6HI6Y3S.js";import"./chunk-3G2LSTK5.js";import"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HJMCXSUJ.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-YAW6JW6D.js";import"./chunk-LQQNPMOD.js";import"./chunk-36N3EHW5.js";import"./chunk-7YT4TTKL.js";import"./chunk-NXAJBSIF.js";import"./chunk-IGEAET7M.js";import"./chunk-CUXY6KQ2.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-XRNQSXOM.js";import"./chunk-TZXXJWHA.js";import"./chunk-SXRHKXSE.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-GMTHZUZ3.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";export{l as CHOOSE_MOBILE_KIND_FIX,m as CHOOSE_MOBILE_KIND_MESSAGE,h as appNotSetEvent,e as appProblemFor,a as appSuitsTarget,b as deviceFromFlags,g as formatRunningOn,i as missingPieceMessage,c as nameNeedsVersionMessage,d as resolveRunIntent,f as resolveTestmdIntent,k as staleAppMessage,j as staleDeviceMessage};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-V7USCQWO.js";import"./chunk-FCD3NYOM.js";import"./chunk-3G2LSTK5.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{a as AuthResolver,b as classifyAuthFailure};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-Q3C6NDGI.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-UR6MHSHU.js";export{a as commitRevert};
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{O as F,R as Q,U as G,V as Y,W as H}from"./chunk-MEKPGQAM.js";import"./chunk-DZOYYWOW.js";import"./chunk-VXGN3IV7.js";import"./chunk-CB4ARIHR.js";import"./chunk-BSRSXYDZ.js";import{a as U}from"./chunk-R7KXAISS.js";import"./chunk-WMGKUERB.js";import"./chunk-WOSANGV6.js";import{e as P,h as D}from"./chunk-XMPTFXPW.js";import{a as A}from"./chunk-73Y6T2UK.js";import"./chunk-SMXABALN.js";import"./chunk-WN5VKKJ3.js";import{b as J}from"./chunk-KM3YCIDV.js";import"./chunk-MNBGG4H3.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-EZN7CF45.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-ZFM77AQU.js";import{M as C,N as V,R as j,S as E,Ua as M,ea as x}from"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-PUVMC4PX.js";import"./chunk-B7ZX5HEN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-7V4BQSSV.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A7RJQJNT.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";import{readFileSync as W}from"fs";import{existsSync as X}from"fs";var Z=new Set(["derived","skipped","archived","drift"]),N={kind:"human",id:process.env.USER??"operator"};function _(r,t){return r.nameOf.get(t)??t.slice(0,19)}function L(r,t){let d=r.getNode(t)?.content??{},h=r.derivesInto(t)[0]?.props.anchor;return{cid:t,uc:{temp_ref:t,title:String(d.title??d.text??""),summary:d.summary!==void 0?String(d.summary):void 0,risk:String(d.risk??"med"),cite:{anchor:typeof h=="string"?h:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function ee(r,t){let d=new Set,{records:h}=M(r);for(let c of h){if(c.proposal_id==null)continue;let a=new Set(c.review.map(u=>u.id));for(let u of c.nodes)a.has(u.cid)||d.add(u.cid)}for(let c of[...d])(t.trust.get(c)!=="derived"||t.superseded.has(c))&&d.delete(c);return d}var re=new Set(["approved","edited","rejected","skipped","supersede"]);function te(r){let t;try{t=JSON.parse(r)}catch(c){return{errors:[`not valid JSON: ${c instanceof Error?c.message:String(c)}`]}}if(!Array.isArray(t))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let d=[],h=[];return t.forEach((c,a)=>{if(c==null||typeof c!="object"||Array.isArray(c)){d.push(`[${a}]: not an object`);return}let u=c;(typeof u.ref!="string"||!u.ref.trim())&&d.push(`[${a}]: "ref" (slug or cid) is required`),(typeof u.resolution!="string"||!re.has(u.resolution))&&d.push(`[${a}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),u.resolution==="supersede"&&(typeof u.supersede_target!="string"||!u.supersede_target.trim())&&d.push(`[${a}]: resolution "supersede" requires "supersede_target" (slug or cid)`),u.edit!==void 0&&(u.edit==null||typeof u.edit!="object"||Array.isArray(u.edit))&&d.push(`[${a}]: "edit" must be an object ({title?, summary?, risk?})`),d.length===0&&h.push(u)}),d.length>0?{errors:d}:{entries:h}}async function ne(r,t,d,h=process.cwd()){let c=r.queue??"derived";if(!Z.has(c))return t.out(`unknown queue ${c} \u2014 one of: derived | skipped | archived | drift`),2;if(r.mode!=null&&r.mode!=="agent"&&r.mode!=="ci")return(t.err??t.out)(`error: review --mode must be agent | ci, got '${r.mode}'`),2;r.mode==="agent"&&(r={...r,json:!0});let a=r.json?P("ndjson","review",{stdout:s=>t.out(s.replace(/\n$/,"")),stderr:s=>(t.err??t.out)(s.replace(/\n$/,""))}):null,u;if(a){if(u=A(h),!X(u))return a.event({type:"error",message:"no context store here",remedy:"run kane-cli context ingest <files> first"}),a.done(2,"refused");let s=G(u);if(s)return a.event(Y(s)),a.done(2,"refused")}else{let s=F(h,t);if(!s||(u=s,H(u,t)))return 2}let S=U(u),n=C(S),w=s=>(t.err??t.out)(s);if(r.allowArchive&&!r.because?.trim())return w('error: --allow-archive requires --because "<reason>" (the audit trail on the record)'),2;if(r.mode==="ci"&&r.allowArchive)return w("error: ci mode never archives \u2014 nothing committed"),2;if((r.approve?.length??0)>0||(r.skip?.length??0)>0||(r.defer?.length??0)>0){if(r.verdicts)return w("error: --approve/--skip/--defer and --verdicts are mutually exclusive"),2;let s=new Map,o=r.mode==="agent"?a:null,m=[],p=i=>m.push({line:i,event:{type:"error",message:i}}),g=i=>m.push({line:`${i}: names nothing in the graph`,event:{type:"error",code:"ITEM_NOT_FOUND",message:`there's no item ${i} here, so nothing was approved`,remedy:"check the id, then run the command again"}}),v=[],y=i=>n.displayNameOf(i)??_(n,i);for(let i of r.approve??[]){let $=E(n,i);if($!==null){p($);continue}let e=V(n,j(n,i));if(!e){g(i);continue}s.set(e,{resolution:"approved"}),v.push({ref:y(e),resolution:"approved"})}for(let[i,$]of[[r.skip??[],"skipped"],[r.defer??[],"deferred"]])for(let e of i){let f=E(n,e),l=f===null?n.resolve(j(n,e)):null;f!==null?p(f):l?v.push({ref:y(l.tip),resolution:$}):g(e)}if(m.length>0){if(o){for(let i of m)o.event(i.event);return o.done(2,"refused")}for(let i of m)w(`error: ${i.line}`);return w("error: nothing committed (structured verdicts are atomic \u2014 fix every offender and re-run)"),2}if(s.size===0){if(o){for(let i of v)o.event({type:"review_verdict",...i});return o.done(0)}return t.out("nothing changed \u2014 every ref was skipped/deferred"),0}let b=x({store:S,graph:n,verdicts:s,by:N});if(b.errors){if(o){for(let i of b.errors)J(i.code,i.detail);return o.event({type:"error",code:"REVIEW_FAILED",message:"couldn't save the review, so nothing was approved",remedy:"run the command again"}),o.done(1)}for(let i of b.errors)w(`${i.code}: ${i.detail}`);return 1}if(o){for(let i of v)o.event({type:"review_verdict",...i});return o.done(0)}return t.out(`review: committed record ${b.record.seq} \u2014 ${s.size} approved`),0}if(r.verdicts){let s=e=>(t.err??t.out)(e),o;try{o=W(r.verdicts,"utf8")}catch{return s(`error: cannot read verdicts file ${r.verdicts}`),2}let m=te(o);if("errors"in m){for(let e of m.errors)s(`error: --verdicts ${r.verdicts}: ${e}`);return 2}let p=new Set([...n.trust.entries()].filter(([e,f])=>(f==="derived"||f==="archived")&&!n.superseded.has(e)).map(([e])=>e)),g=new Map,v=[];for(let e of m.entries){let f=E(n,e.ref)??(e.supersede_target?E(n,e.supersede_target):null);if(f!==null){v.push(`${e.ref}: ${f}`);continue}let l=V(n,j(n,e.ref));if(!l){v.push(`${e.ref}: names nothing in the graph`);continue}if(!p.has(l)){v.push(`${e.ref}: not in a review queue (trust: ${n.trust.get(l)??"?"})`);continue}if(g.has(l)){v.push(`${e.ref}: duplicate \u2014 an earlier entry already resolves to this node (${_(n,l)})`);continue}let k=e.supersede_target?V(n,j(n,e.supersede_target)):null;if(e.supersede_target&&!k){v.push(`${e.ref}: supersede_target ${e.supersede_target} names nothing live in the graph`);continue}g.set(l,{resolution:e.resolution,...e.reason?{reason:e.reason}:{},...e.edit?{edit:e.edit}:{},...k?{supersedeTarget:k}:{}})}if(v.length>0){for(let e of v)s(`error: --verdicts: ${e}`);return s("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let y=[...g.entries()].filter(([,e])=>e.resolution==="rejected"||e.resolution==="supersede");if(y.length>0&&r.mode==="ci")return s(`error: ci mode never archives \u2014 ${y.length} retiring verdict(s) (rejected/supersede) present, nothing committed`),2;if(y.length>0&&r.allowArchive){let{archiveImpact:e}=await import("./feeder-NY45UFJK.js");for(let[f,l]of y){let k=l.resolution==="supersede"?(()=>{let T=l.supersedeTarget?n.resolve(l.supersedeTarget):null;return T&&!n.superseded.has(T.tip)?T.tip:null})():f;if(k===null)continue;let K=e(n,k),B=l.resolution==="supersede"?`supersede (retires ${_(n,k)})`:`archive ${_(n,k)}`;s(`${B}: ${K.design_children} design child(ren) affected`)}for(let[,f]of y)f.reason||(f.reason=r.because)}let b=y.length>0&&!r.allowArchive,i=x({store:S,graph:n,verdicts:g,by:N,...b?{holdArchives:!0}:{}});if(i.errors){if(i.errors[0]?.code==="NO_VERDICTS")return s("nothing changed \u2014 every item was skipped"),0;for(let e of i.errors)s(`${e.code}: ${e.detail}`);return 1}b&&t.out(`${y.length} archive(s) held for interactive confirmation (re-run with --allow-archive --because "<reason>" to apply headlessly)`);let $=new Map;for(let e of g.values())$.set(e.resolution,($.get(e.resolution)??0)+1);if(r.json)for(let[e,f]of g.entries())t.out(JSON.stringify({ref:_(n,e),cid:e,resolution:f.resolution}));else{let e=[...$.entries()].map(([f,l])=>`${l} ${f}`).join(", ");t.out(`review: committed record ${i.record.seq} \u2014 ${e}`)}return 0}if(c==="drift"){let s=n.staleList().filter(({state:o})=>o!=="superseded").map(({cid:o,state:m})=>({ref:_(n,o),cid:o,state:m,title:String(n.getNode(o)?.content.title??n.getNode(o)?.content.source_id??""),pinned_sources:[...new Set(n.derivesInto(o).map(p=>String(p.props.source_id)))]}));if(r.json){for(let o of s)t.out(JSON.stringify(o));return 0}if(s.length===0)return t.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;t.out(`${s.length} item(s) whose evidence changed (re-extract the source to re-approve):`);for(let o of s)t.out(` [${o.state}] ${o.ref} \xB7 ${o.title} \xB7 sources: ${o.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!t.isTTY)return a?D(a,"review: verdict queues need a terminal","TTY_REQUIRED","run kane-cli context review in a terminal, or pass --verdicts <file.json>; the drift listing works anywhere"):(t.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2);let R,q;if(c==="archived")R=[...n.trust.entries()].filter(([s,o])=>o==="archived"&&!n.superseded.has(s)).map(([s])=>L(n,s)),q="skipped";else{let s=ee(u,n),o=[...n.trust.entries()].filter(([p,g])=>g==="derived"&&!n.superseded.has(p)).map(([p])=>p),m=c==="skipped"?o.filter(p=>s.has(p)):o;m.sort((p,g)=>Number(s.has(g))-Number(s.has(p))),R=m.map(p=>L(n,p)),q="skipped"}if(R.length===0)return t.out(`${c} queue is empty`),0;t.out(`${R.length} node(s) in the ${c} queue \u2014 approve promotes, reject ${c==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let z=await d(R,n,q),I=x({store:S,graph:n,verdicts:z,by:N});if(I.errors){if(I.errors[0]?.code==="NO_VERDICTS")return t.out("nothing changed \u2014 every item was skipped"),0;for(let s of I.errors)t.out(`${s.code}: ${s.detail}`);return 1}let O=I.record;return t.out(`committed record ${O.seq}: ${O.review.length} review fact(s), ${O.supersessions.length} supersession(s), ${O.nodes.length} new version(s)`),0}async function se(r,t,d){let[{render:h},c,{ReviewChecklist:a}]=await Promise.all([import("./build-5ZN47FAT.js"),import("./react-QWOAB3TB.js"),import("./ui-SNV3FD2G.js")]),u=c.default??c;return new Promise(S=>{let n=h(u.createElement(a,{items:r.map(w=>({uc:w.uc})),defaultResolution:d,onSubmit:w=>{n.unmount(),S(w)}}))})}async function he(r){let{bothTTY:t}=await import("./headless-io-FFM5T6KL.js");return!r.json&&r.mode!=="agent"&&await Q(A(process.cwd()),d=>process.stderr.write(d+`
3
+ `)),ne(r,{out:d=>process.stdout.write(d+`
4
+ `),err:d=>process.stderr.write(d+`
5
+ `),confirm:async()=>!1,isTTY:t()},se)}export{te as parseVerdictsFile,he as reviewCommand,ne as runReviewCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j}from"./chunk-AVI5H4UM.js";import"./chunk-LCSJ7GOG.js";import"./chunk-HAW5WEKT.js";import"./chunk-HJLMH7ZM.js";import{g as a}from"./chunk-E6KSRQXL.js";import"./chunk-54XA5MZH.js";import"./chunk-QDFY5GGO.js";import"./chunk-VZJ6LUXX.js";import"./chunk-35ECWCCK.js";import"./chunk-IZ65ZPWY.js";import"./chunk-7RWP4Y3H.js";import"./chunk-73ZFOJOK.js";import"./chunk-EF47KRUK.js";import"./chunk-3GXN6VF6.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-42PALMW2.js";import"./chunk-ZFMRQ57Y.js";import"./chunk-PZA3BSOE.js";import"./chunk-2RUSXQ3O.js";import"./chunk-KF4DKXSS.js";import"./chunk-AUJSC7PU.js";import"./chunk-JNSWKGTB.js";import"./chunk-UUJIGOEO.js";import"./chunk-ZTHYAHDN.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-AZLNLHUA.js";import"./chunk-AQ2OG2EF.js";import"./chunk-DPGOAFKF.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-ZFM77AQU.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-GMTHZUZ3.js";import"./chunk-UR6MHSHU.js";export{h as dedupPreFlags,c as deliveredImagesWire,f as displaySourceName,b as extractProtocolCtx,d as extractSessionId,i as ownMatchedOf,a as resolveAnswers,j as runExtract,e as sessionSourceRef,g as sourceBanner};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b,c,d,e,f,g}from"./chunk-YIKF4ERQ.js";import"./chunk-QI5RZ7LL.js";import"./chunk-44B6THYK.js";import"./chunk-W7FLXW6Q.js";import"./chunk-R4JUKTDO.js";import"./chunk-OJ33Q6DU.js";import"./chunk-7KX2BHKG.js";import"./chunk-D756UWY2.js";import"./chunk-LX2I4JEH.js";import"./chunk-O3HHTKZ5.js";import"./chunk-NXRF7FFS.js";import"./chunk-E6KSRQXL.js";import"./chunk-54XA5MZH.js";import"./chunk-QDFY5GGO.js";import"./chunk-VZJ6LUXX.js";import"./chunk-35ECWCCK.js";import"./chunk-IZ65ZPWY.js";import"./chunk-EF47KRUK.js";import"./chunk-3GXN6VF6.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import"./chunk-3BSYOCSW.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-42PALMW2.js";import"./chunk-ZFMRQ57Y.js";import"./chunk-PZA3BSOE.js";import"./chunk-2RUSXQ3O.js";import"./chunk-AUJSC7PU.js";import"./chunk-JNSWKGTB.js";import"./chunk-UUJIGOEO.js";import"./chunk-ZTHYAHDN.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-AZLNLHUA.js";import{b as a}from"./chunk-AQ2OG2EF.js";import"./chunk-DPGOAFKF.js";import"./chunk-4IEQNX7F.js";import"./chunk-MNBGG4H3.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-GRURFGBP.js";import"./chunk-MYZHOBS4.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-ZFM77AQU.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-QXQ7KVEN.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-PUVMC4PX.js";import"./chunk-B7ZX5HEN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-7V4BQSSV.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-GMTHZUZ3.js";import"./chunk-A7RJQJNT.js";import"./chunk-UR6MHSHU.js";export{a as USER_MESSAGE_MAX_BYTES,d as askedRedesign,e as designSessionId,g as formatVariablesClosing,c as openingStatementFor,f as runDesign,b as userMessageOverBudget};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as a,c as b,d as c,e as d}from"./chunk-6NFOH4AC.js";import"./chunk-4I7YN6YY.js";import"./chunk-UR6MHSHU.js";export{c as channelAppendId,b as channelEvent,d as channelWarn,a as runWithChannel};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i}from"./chunk-3RJHXOZH.js";import"./chunk-DDZLCAEO.js";import"./chunk-CM4CHYSN.js";import"./chunk-RHGW7B5Q.js";import"./chunk-HCJ2N3XB.js";import"./chunk-NLZZLANH.js";import"./chunk-3F5FMH76.js";import"./chunk-XMPTFXPW.js";import"./chunk-ZU4W2QGM.js";import"./chunk-73Y6T2UK.js";import{c as a}from"./chunk-HIUAUZNL.js";import"./chunk-457Y5TEC.js";import"./chunk-EECDDDSB.js";import"./chunk-7NPTL66J.js";import"./chunk-42PALMW2.js";import"./chunk-KF4DKXSS.js";import"./chunk-AUJSC7PU.js";import"./chunk-3QICDXY5.js";import"./chunk-ZTHYAHDN.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-AZLNLHUA.js";import"./chunk-AQ2OG2EF.js";import"./chunk-DPGOAFKF.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-REKHAN53.js";import"./chunk-ZFM77AQU.js";import"./chunk-RF37IJNN.js";import"./chunk-XZYA7DNH.js";import"./chunk-7HMSMAUG.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HJMCXSUJ.js";import"./chunk-FOJHSG5M.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";export{c as IngestRefused,b as IngestStopped,f as PAUSE_SAVES,a as STORE_CALL_TIMEOUT_MS,d as controllerCheck,h as finalExitOf,e as graceVerdict,i as runRemote,g as sessionEventTrace};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-URH4FX3H.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{b as prereqsReady,a as runStartupGate};
@@ -0,0 +1,17 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as $}from"./chunk-OGFU4YY4.js";import{L as j,M as Y,N as G,O as Z,P as q,Q as z}from"./chunk-VZ4A6WMK.js";import"./chunk-Y7E5L42F.js";import{d as N}from"./chunk-3E4ZO73O.js";import"./chunk-MEKPGQAM.js";import"./chunk-DZOYYWOW.js";import"./chunk-VXGN3IV7.js";import"./chunk-CB4ARIHR.js";import{a as A}from"./chunk-TU42YZOJ.js";import{a as M}from"./chunk-2DYHAP4E.js";import"./chunk-XZGEN4NU.js";import"./chunk-WD52ZNQY.js";import"./chunk-BHSHGWBL.js";import"./chunk-S3DAAAE5.js";import"./chunk-YAW6JW6D.js";import"./chunk-HCJ2N3XB.js";import"./chunk-IUQOG7Z5.js";import"./chunk-W3USRQX6.js";import"./chunk-RFEON5GN.js";import"./chunk-BSRSXYDZ.js";import{d as k}from"./chunk-AEWNWAXW.js";import"./chunk-72KYMWQ5.js";import"./chunk-JQ64X2TO.js";import{a as O}from"./chunk-URH4FX3H.js";import"./chunk-NZ6AV2TA.js";import{j as I}from"./chunk-JGRXMTME.js";import"./chunk-77ZZQJLX.js";import"./chunk-JIRNI5TB.js";import"./chunk-UTM7D4PI.js";import"./chunk-CCP4X75B.js";import"./chunk-WXJCJL5L.js";import"./chunk-TDPWFYTJ.js";import{H as L}from"./chunk-W54OT2FU.js";import"./chunk-YQ5C6UDG.js";import"./chunk-DREQ3RAA.js";import"./chunk-HQ2E2XCU.js";import"./chunk-SMTBOSEJ.js";import"./chunk-FIP5L6LV.js";import"./chunk-R7KXAISS.js";import"./chunk-WMGKUERB.js";import"./chunk-NLZZLANH.js";import"./chunk-WOSANGV6.js";import"./chunk-65VANXOF.js";import"./chunk-34R7BNZ2.js";import"./chunk-IINZZ4BZ.js";import"./chunk-3F5FMH76.js";import"./chunk-XMPTFXPW.js";import"./chunk-ZU4W2QGM.js";import"./chunk-V7USCQWO.js";import"./chunk-73Y6T2UK.js";import{b as T}from"./chunk-CGITGJ3I.js";import"./chunk-KXHJMAZU.js";import"./chunk-VE3SUJMA.js";import"./chunk-LQQNPMOD.js";import"./chunk-36N3EHW5.js";import"./chunk-4QFTHUJA.js";import"./chunk-FWUPJORV.js";import"./chunk-5D7ENQTQ.js";import"./chunk-7YT4TTKL.js";import"./chunk-W6HZF56M.js";import"./chunk-EBPRPNSA.js";import"./chunk-Y6Y6RAY4.js";import"./chunk-NXAJBSIF.js";import"./chunk-SMXABALN.js";import"./chunk-C6HI6Y3S.js";import"./chunk-IGEAET7M.js";import"./chunk-CUXY6KQ2.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-XRNQSXOM.js";import"./chunk-TZXXJWHA.js";import"./chunk-SXRHKXSE.js";import"./chunk-WN5VKKJ3.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-SGPAM5DZ.js";import"./chunk-LUR7JFPP.js";import"./chunk-FCD3NYOM.js";import"./chunk-3G2LSTK5.js";import"./chunk-4IEQNX7F.js";import"./chunk-MNBGG4H3.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-REKHAN53.js";import"./chunk-GRURFGBP.js";import"./chunk-MYZHOBS4.js";import"./chunk-VLDCHFXF.js";import"./chunk-EZN7CF45.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-ZFM77AQU.js";import"./chunk-RF37IJNN.js";import{a as w}from"./chunk-XZYA7DNH.js";import{r as _,w as E}from"./chunk-7HMSMAUG.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-PUVMC4PX.js";import"./chunk-B7ZX5HEN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-GMTHZUZ3.js";import{n as R,o as b,p as S}from"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import{a as x}from"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import{a as C}from"./chunk-HJMCXSUJ.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";import{resolve as B}from"path";import{existsSync as J}from"fs";function F(){return{register:(t,o)=>R(t,o),deregister:t=>b(t),cleanup:(t,o)=>S(t,o),remoteLogger:null}}function Q(t){if(t.mode!=="agent")return t;let{mode:o,...r}=t;return{...r,agent:!0}}async function Ce(t,o){let r=Q(o),n=B(t);if(!J(n))return process.stderr.write(`error: file not found: ${n}
3
+ `),2;if(r.finalValidation!==void 0&&r.finalValidation!=="on"&&r.finalValidation!=="off")return process.stderr.write(`error: --final-validation must be 'on' or 'off'
4
+ `),2;if(!n.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${n}
5
+ helpers are import-only \u2014 run a test that @imports it.
6
+ `),2;A(n);let i=!process.stdin.isTTY||!!r.agent;_({verb:"testmd",mode:i?"agent":"interactive"});let l=i?N("testmd"):null,c=F(),s;try{s=I(n)}catch(e){return process.stderr.write(`error: ${e.message}
7
+ `),2}for(let e of s.warnings)process.stderr.write(`warn: ${e}
8
+ `);if(s.steps.length===0)return process.stderr.write(`info: no steps in ${n}; nothing to run.
9
+ `),0;let d;try{d=X(r)}catch(e){if(e instanceof u)return process.stderr.write(e.message),e.exitCode;throw e}let a=new C,y=new T,V=!!(r.username&&r.accessKey);await O({isInteractive:!!process.stdin.isTTY&&!r.agent&&!V,creds:a,config:y,...L(n)!==null?{authOnly:!0}:{}});let P=a.getActiveProfile()??"default",p=r.env??void 0??a.getDefaultEnv()??"prod",K=x(p),D="v16-alpha",f;try{f=await M({creds:a,env:p,usernameFlag:r.username,accessKeyFlag:r.accessKey,log:()=>{}})}catch(e){return e instanceof w&&e.code==="not_authenticated"?process.stderr.write(`error: Not authenticated. Choose one:
10
+ \u2022 Pass credentials inline: --username <user> --access-key <key>
11
+ \u2022 Run 'kane-cli login --oauth' (browser-based)
12
+ \u2022 Run 'kane-cli login --username <user> --access-key <key>'
13
+ `):e instanceof w&&e.code==="refresh_failed"?process.stderr.write(`error: Token refresh failed. Run 'kane-cli login' to re-authenticate.
14
+ `):process.stderr.write(`error: auth resolution failed: ${e.message}
15
+ `),2}let v=String(f.resolvedCreds?.org_id??"");if(!v)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:h}=await import("./testmd-actions-CMAG6HWI.js"),m=h(e(n),v);if(m!==null)return m}let g=new k;l?.attachSessionDir(g.sessionDir);let H=$({isAgent:i,log:(e,h,m,W)=>g.log(e,h,m,W)}),U={path:n,cwd:process.cwd(),opts:r,isAgent:i,disableAskUser:!0,resolved:s,resolvedAuth:f,cliOverrides:d,environment:p,envConfig:K,profile:P,model:D,creds:a,configStore:y,session:g};try{return(await j(U,H,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
16
+ `),2}finally{await E()}}var u=class extends Error{constructor(r,n){super(r);this.exitCode=n;this.name="CliArgError"}};function X(t){let o={mode:"mode",assertionMode:"assertion_mode",finalValidation:"final_validation",maxSteps:"max_steps",timeout:"timeout",globalContext:"global_context",localContext:"local_context",codeExport:"code_export",codeLanguage:"code_language",headless:"headless",cdpEndpoint:"cdp_endpoint",wsEndpoint:"ws_endpoint"},r=new Set(["max_steps","timeout"]),n={};for(let[i,l]of Object.entries(o)){let c=t[i];if(c===void 0||c==="")continue;let s=c;if(r.has(l)&&(s=Number(c),Number.isNaN(s))){let d="--"+i.replace(/[A-Z]/g,a=>"-"+a.toLowerCase());throw new u(`error: ${d} must be a number
17
+ `,2)}n[l]=s}return n}export{Q as agentModeAlias,z as applyCliStepConfig,G as buildStepRunVariables,Y as buildTestLevelVariables,X as optsToOverrides,Z as replayVariablesForStep,q as resolveStepMaxSteps,Ce as runTestMdFile};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-WN5VKKJ3.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as ScrollbackProvider,b as useScrollback};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as e,b as f,c as g,d as h,e as i}from"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import{d as a,f as b,g as c,h as d}from"./chunk-A7RJQJNT.js";import"./chunk-UR6MHSHU.js";export{a as isDeviceTarget,b as isRealDeviceTarget,c as isVirtualDeviceTarget,d as platformOf,e as resolveSessionTarget,f as savedDeviceTarget,g as savedRealDeviceSelection,i as sessionTargetLabelFor,h as targetForKind};
@@ -0,0 +1,12 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as qn}from"./chunk-PAWQ4AKN.js";import{a as Fn}from"./chunk-C5Z7MQE6.js";import{a as Un}from"./chunk-LUZBGTYB.js";import"./chunk-47WQBG5I.js";import{a as Bn}from"./chunk-YDSGXB25.js";import{b as le,c as ve}from"./chunk-6UVIY56J.js";import{d as Ln}from"./chunk-FSYOTRMC.js";import"./chunk-OFSDB7B4.js";import{a as at,d as dt,e as ct,i as Fe,j as ye}from"./chunk-LKQFG4RW.js";import{a as Ee}from"./chunk-RTVWQK7I.js";import"./chunk-TNORODUF.js";import"./chunk-I6S6DZ2E.js";import{e as he,f as it}from"./chunk-YIKF4ERQ.js";import"./chunk-QI5RZ7LL.js";import{b as Mn}from"./chunk-44B6THYK.js";import{d as jn}from"./chunk-W7FLXW6Q.js";import"./chunk-KM3YCIDV.js";import{e as Re,f as Le,g as Nn,h as ce}from"./chunk-R4JUKTDO.js";import"./chunk-OJ33Q6DU.js";import{d as Tn}from"./chunk-7KX2BHKG.js";import{e as Be}from"./chunk-D756UWY2.js";import"./chunk-LX2I4JEH.js";import"./chunk-O3HHTKZ5.js";import"./chunk-NXRF7FFS.js";import{c as Pn,i as $n}from"./chunk-AVI5H4UM.js";import{a as Dn,c as In}from"./chunk-LCSJ7GOG.js";import{a as Rn,d as En}from"./chunk-HAW5WEKT.js";import"./chunk-HJLMH7ZM.js";import"./chunk-E6KSRQXL.js";import"./chunk-54XA5MZH.js";import"./chunk-QDFY5GGO.js";import{a as On}from"./chunk-VZJ6LUXX.js";import{n as An}from"./chunk-35ECWCCK.js";import"./chunk-IZ65ZPWY.js";import"./chunk-7RWP4Y3H.js";import{a as _n}from"./chunk-73ZFOJOK.js";import"./chunk-EF47KRUK.js";import"./chunk-3GXN6VF6.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import{b as se}from"./chunk-MYVKUJGS.js";import{b as Cn,d as xn,e as ot}from"./chunk-P2ZQDQDB.js";import"./chunk-3BSYOCSW.js";import{b as bn,c as Sn}from"./chunk-HIUAUZNL.js";import{f as hn,g as vn,h as je,i as yn,j as wn}from"./chunk-457Y5TEC.js";import{a as Me,b as kn}from"./chunk-EECDDDSB.js";import"./chunk-HD6NR44L.js";import{b as gn,e as mn,f as G,g as rt}from"./chunk-7NPTL66J.js";import{b as st}from"./chunk-BWXLZS5O.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-42PALMW2.js";import{g as rn}from"./chunk-ZFMRQ57Y.js";import{i as sn}from"./chunk-PZA3BSOE.js";import"./chunk-2RUSXQ3O.js";import"./chunk-KF4DKXSS.js";import"./chunk-AUJSC7PU.js";import{d as tt}from"./chunk-JNSWKGTB.js";import{b as Et}from"./chunk-D7TKE7LK.js";import{b as pn,h as fn,i as nt}from"./chunk-I4RVVBG3.js";import{a as _t}from"./chunk-3QICDXY5.js";import{c as cn,h as ln,i as un}from"./chunk-UUJIGOEO.js";import{k as Te,m as dn}from"./chunk-ZTHYAHDN.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import{j as on,k as an,q as et}from"./chunk-AZLNLHUA.js";import"./chunk-AQ2OG2EF.js";import"./chunk-DPGOAFKF.js";import"./chunk-4IEQNX7F.js";import"./chunk-MNBGG4H3.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import{l as nn}from"./chunk-REKHAN53.js";import"./chunk-GRURFGBP.js";import"./chunk-MYZHOBS4.js";import"./chunk-VLDCHFXF.js";import{a as Ze,c as Gt,d as Kt,e as Vt,g as Jt,j as Yt}from"./chunk-EZN7CF45.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import{b as Wt}from"./chunk-ZFM77AQU.js";import{b as re}from"./chunk-RF37IJNN.js";import"./chunk-XZYA7DNH.js";import{Ba as T,C as ge,Ca as ne,D as Zt,Ea as en,Fa as Xe,Ha as tn,g as Qe,ka as Qt,n as I,oa as Xt,pa as me}from"./chunk-7HMSMAUG.js";import{a as Ne,c as zt}from"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-I2MC6VVX.js";import{b as Rt}from"./chunk-RPRXRKKR.js";import"./chunk-QXQ7KVEN.js";import"./chunk-7AET4JKQ.js";import{d as Pt,f as $t}from"./chunk-DJC7NTLA.js";import"./chunk-QSCXXNC2.js";import{$a as qt,Ea as J,La as Ft,M as $,Ma as ze,Na as Ut,Qa as fe,R as Ye,S as Lt,a as Je,db as Ht,i as Nt,kb as $e,l as Tt,mb as _e,o as jt,oa as Bt,u as Pe}from"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import{f as Ae}from"./chunk-KU3YHPWZ.js";import{e as Mt}from"./chunk-6NFOH4AC.js";import"./chunk-PUVMC4PX.js";import"./chunk-B7ZX5HEN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-7V4BQSSV.js";import"./chunk-VO66KP2W.js";import{b as xe,g as Dt,i as Ve,j as It,k as Ot,p as At}from"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import{b as xt}from"./chunk-4I7YN6YY.js";import"./chunk-6PIIUAZF.js";import"./chunk-GMTHZUZ3.js";import"./chunk-NC7D7GOM.js";import"./chunk-ZCRZFAOT.js";import"./chunk-C2RUDJ46.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A7RJQJNT.js";import"./chunk-HJMCXSUJ.js";import"./chunk-D36V5OX6.js";import"./chunk-UR6MHSHU.js";import{parentPort as ks,workerData as Ss}from"worker_threads";function Ue(e){let t=new Set(e.call(I.children,null));return{has:n=>t.has(n),register(n,r){e.call(I.registerChild,{childId:n,...r?{useCase:r}:{}}),t.add(n)},ids:()=>[...t]}}function oe(e,t){return t===e?{}:{childId:t}}import{existsSync as rs,mkdirSync as tr,writeFileSync as ss}from"fs";import{join as nr}from"path";var ue=e=>({hash:e}),ie=e=>e.hash,Vr=4;function Jr(e,t,n,r,i){let s=a=>`${a.seq} after ${String(a.prev_hash)}`;if(e.record.seq!==r||e.record.prev_hash!==i)throw new J(`the record the sink answered with is at ${s(e.record)}, not at ${s(t)}`);ze(e.record,`stored record ${r}`);let o=fe(e.record);if(o!==e.hash)throw new J(`the sink answered record ${r} with hash ${e.hash}, but the record hashes to ${o}`);if(!e.replayed&&o!==n)throw new J(`the sink stored record ${r} other than the one handed to it, without a replayed attempt`);return{record:e.record,hash:o}}function Hn(e){let t=e.index(e.base);if(t.applied.hash!==e.base)throw new J(`the index handed in is at ${String(t.applied.hash)}, not at the base ${String(e.base)}`);let n=t.applied.seq,r=new Set(Object.keys(t.nodeLabel)),i=[],s=[],o=new Map(e.base===null?[]:[[e.base,n]]),a=new Map,c=new Map,u=new Map,g=h=>{for(let y of h.nodes)!r.has(y.cid)&&!a.has(y.cid)&&a.set(y.cid,{label:y.label,content:y.content})},f=(h,y)=>{i.push(h),s.push(y),o.set(y,h.seq),g(h)},p=e.base;for(let h of e.drafts??[]){ze(h.record,`draft ${h.record.seq}`);let y=fe(h.record);if(h.record.prev_hash!==p||h.record.seq!==n+i.length+1)throw new J(`draft ${h.record.seq} does not follow ${String(p)} at position ${n+i.length}`);f(h.record,y),h.envelope&&u.set(y,h.envelope),h.attempt&&c.set(h.attempt.id,{intentDigest:h.attempt.intentDigest,result:{token:ue(y),record:h.record}}),p=y}let l=t,m=()=>{let h=l??e.index(e.base);return l=null,h},_=h=>{let y=m();return h>0&&_e(null,y,i.slice(0,h),s.slice(0,h),{writeNodeFiles:!1}),Ze(y)},w=null,S=()=>w??=_(i.length);S();let R=()=>{if(!e.history)throw new J("this store holds no history before its base");return e.history},d=h=>{let y=e.history?.positionOf(h)??null;return y!==null&&y<n?y:null},v=h=>{let y=R().positionOf(h);if(y===null||y>=n)throw new J(`store token ${h} is not in this store's history`);return y},k=new Map,x=h=>{if(h.token===null)return S();let y=ie(h.token);if(y===S().index.applied.hash)return S();let E=k.get(y);if(E)return k.delete(y),k.set(y,E),E;let N=o.get(y),M;if(N!==void 0)M=_(N-n);else{v(y);let L=e.index(y);if(L.applied.hash!==y)throw new J(`store token ${y} is not in this store's history`);M=Ze(L)}return k.set(y,M),k.size>Vr&&k.delete(k.keys().next().value),M},P=h=>{let y=a.get(h)??e.nodeBody(h);if(y===null)throw new J(`node body missing for ${h}`);return y},K=()=>S().index.applied.hash,F=e.vectors??Yt(),C=(h,y)=>{Nt(S().index,h),qt(h,y.intent);let E=Ft(y.intent);if(y.eventId!==void 0){let B=c.get(y.eventId);if(B){if(B.intentDigest!==E)throw new J(`append refused: attempt ${y.eventId} was made by another intent; nothing was written`);return B.result}}let N=y.basis===null?null:ie(y.basis),M=K();if(N!==M)throw new Ut(`concurrent append detected: validated against ${String(N)} but the chain head is ${String(M)} \u2014 re-open and retry`);let L=S().index.applied.seq+1,q=Ht(h,L,M,{intent:y.intent,...y.provenance?{provenance:y.provenance}:{}}),ee=fe(q);if(y.provenance)try{jt(structuredClone(S().index),q,ee)}catch(B){throw B instanceof Tt?new J(`replayed record would not pass this store's checks: ${B.message}; nothing was written`):B}let Se=e.sink({record:q,hash:ee,intent:y.intent,attemptId:y.eventId??null}),W=Jr(Se,q,ee,L,M),Q={token:ue(W.hash),record:W.record};f(W.record,W.hash),u.set(W.hash,Pe(y.intent,{seq:W.record.seq,hash:W.hash,ts:W.record.ts})),y.eventId!==void 0&&c.set(y.eventId,{intentDigest:E,result:Q});try{let B=S();_e(null,B.index,[W.record],[W.hash],{writeNodeFiles:!1}),Gt(B,W.record)}catch(B){w=null;let V=B instanceof Error?B.message:String(B);return{...Q,warnings:[`committed, but the index refresh failed (${V}): read state rebuilds on the next read`]}}return Q};return{...Kt(x,P),prefetch:h=>e.prefetch?.(h),append:C,head:()=>{let h=K();return h===null?null:ue(h)},resolveToken:h=>{let y=ie(h),E=o.get(y)??d(y);return E===null?null:{seq:E,hash:y}},tokenAt:h=>{if(h>n){let E=s[h-n-1];return E===void 0?null:ue(E)}if(h===n&&e.base!==null)return ue(e.base);let y=e.history?.tokenAt(h)??null;return y===null?null:ue(y)},intentOf:h=>u.get(ie(h))??null,serialize:h=>h===null?null:ie(h),parse:h=>h===null?null:ue(h),sameToken:(h,y)=>h===null||y===null?h===y:ie(h)===ie(y),recordsSince:h=>{let y=h===null?null:ie(h),E=y===null?0:o.get(y);return E!==void 0&&(E>n||E===n&&y===e.base)?i.slice(E-n):(y!==null&&v(y),[...R().recordsAfter(y),...i])},getBlob:h=>e.sides.getBlob(h),putBlob:h=>e.sides.putBlob(h),blobPath:h=>e.sides.blobPath(h),logFile:h=>e.sides.logFile(h),designFiles:()=>e.sides.designFiles(),vectors:()=>F,parkedFacts:()=>e.sides.parkedFacts(),proposals:()=>e.sides.proposals(),signals:()=>e.sides.signals(),sessions:()=>e.sides.sessions(),locks:(h,y)=>e.sides.locks(h,y),exists:()=>!0,ensure:()=>({created:!1}),dirOrThrow:()=>{throw new J("the store over an in-memory index keeps no directory")}}}var De=500,Yr=2e4;function zr(e,t){let{json:n}=e.call(I.mainHistory,null),r=JSON.parse(n).items,i=[],s=[];if(r.forEach((o,a)=>{let c=o.record,u=`main's record at position ${o.position}`;if(o.position!==a+1)throw new Error(`${u} came where position ${a+1} belongs; Lattice's main records are out of order`);if(fe(c)!==o.hash)throw new Error(`${u} does not hash to ${o.hash}, the hash Lattice gave for it`);if(c.prev_hash!==(s[a-1]??null))throw new Error(`${u} does not follow the record before it`);i.push(c),s.push(o.hash)}),i.length!==t.basePosition||(s.at(-1)??null)!==t.baseHash)throw new Error(`main's records end at position ${i.length} (${s.at(-1)??"empty"}), not at the session's base ${t.basePosition} (${t.baseHash??"empty"})`);return{records:i,hashes:s}}function Wn(e,t){let n=$e();return _e(null,n,e.records.slice(0,t),e.hashes.slice(0,t),{writeNodeFiles:!1}),n}function Gn(e,t,n){let r=zr(e,t);return n(`main at the session's base (position ${t.basePosition}): its read model is rebuilt from main's history (${r.records.length} records); node bodies read per key`),Zr(e,t,Wn(r,t.basePosition),r)}function Zr(e,t,n,r){let i=null,s=()=>i??=new Map(r.hashes.map((o,a)=>[o,a+1]));return{baseIndex:n,indexAt:o=>Wn(r,o),...Qr(e,t,n),history:{recordsAfter:o=>r.records.slice(o===null?0:s().get(o)??r.records.length),positionOf:o=>s().get(o)??null,tokenAt:o=>r.hashes[o-1]??null}}}function Qr(e,t,n){let r=new Map,i=[],s=null,o=f=>n.nodeLabel[f],a=(f,p)=>{r.set(f,p),r.size>Yr&&r.delete(r.keys().next().value)},c=f=>{let{nodes:p}=e.call(I.mainNodes,{position:t.basePosition,cids:f});for(let l of f){let m=p[l]??null;if(m===null)throw new Error(`Lattice answered no body for node ${l}, which main's index at position ${t.basePosition} holds`);if(m.label!==o(l))throw new Error(`Lattice answered node ${l} as a ${m.label}, but main's index holds it as a ${o(l)}`);if(Je(m.label,m.content)!==l)throw new Error(`Lattice answered node ${l} with a body whose key is ${Je(m.label,m.content)}`);a(l,m)}},u=f=>{for(let l of i.splice(0))c(l);let p=f.filter(l=>!r.has(l));for(let l=0;l<p.length;l+=De)c(p.slice(l,l+De))},g=f=>[...new Set(f)].filter(p=>o(p)!==void 0&&!r.has(p));return{nodeBody(f){let p=o(f);if(p===void 0)return null;if(!r.has(f))for(let l of i.splice(0))c(l);if(!r.has(f)){if(s===null){s=new Map;for(let[_,w]of Object.entries(n.nodeLabel)){if(_ in n.superseded)continue;let S=s.get(w);S?S.push(_):s.set(w,[_])}}let l=s.get(p)??[],m=l.indexOf(f);u([f,...g([...l.slice(m+1),...l.slice(0,m)]).slice(0,De-1)])}return r.get(f)??null},prefetch:f=>u(g(f.nodes)),readAhead(f){let p=g(f);for(let l=0;l<p.length;l+=De){let m=p.slice(l,l+De);e.call(I.mainNodesAhead,{position:t.basePosition,cids:m}),i.push(m)}}}}function Kn(e){let t=/^delta-([1-9][0-9]*)\.json$/.exec(e)?.[1];return t===void 0?null:Number(t)}function Xr(e,t,n){let r=Kn(e);if(r===null)return[];let i=r>(n??0);return t.filter(s=>{let o=/^side-([1-9][0-9]*)\.json$/.exec(s)?.[1];return o===void 0||Number(o)>r?!1:i?Number(o)>(n??0):Number(o)!==n})}function Vn(e,t,n){return r=>{if(r!==t&&!n.has(r))throw new Error(`this host keeps the checkpoint chains of session ${t} and its registered children; ${r} is neither`);let i=oe(t,r),s=()=>e.call(I.chainList,i);return{read:o=>e.call(I.chainRead,{name:o,...i}),list:()=>s().names,write:(o,a)=>{e.call(I.chainWrite,{name:o,text:a,...i})},writeIfAbsent:(o,a)=>e.call(I.chainWriteIfAbsent,{name:o,text:a,...i}),remove:o=>{if(e.call(I.chainRemove,{name:o,...i}),Kn(o)===null)return;let a=e.call(I.pointer,i),c=typeof a?.seq=="number"?a.seq:null;for(let u of Xr(o,s().names,c))e.call(I.chainRemove,{name:u,...i})},bytes:()=>s().bytes}}}function Jn(e){return{read:t=>e.call(I.filesRead,{name:t}),list:t=>e.call(I.filesList,{folder:t}),write:(t,n)=>{let r=e.call(I.filesWrite,{name:t,text:n});r.written||Mt(`the rationale design/${t} was kept as first written, so this design's rationale was not stored: ${r.message}`)},where:t=>`design/${t}`}}function zn(e,t){let{sessionId:n,children:r}=t,i=p=>p===n||r.has(p),s=new Set,o=p=>{if(!i(p))throw new xe("SESSION_MISSING",`this host keeps session ${n} and its registered children, not ${p}`)},a=p=>e.call(I.stateGet,oe(n,p)),c=p=>{let l=a(p);return l===null||Yn(l)||p===n&&!s.has(p)&&u(l,p)?null:l},u=(p,l)=>An(p,e.call(I.chainRead,{name:"base.json",...oe(n,l)})!==null),g=(p,l)=>{e.call(I.statePut,{state:l,...oe(n,p)})},f=p=>({write(l,m){if(m==="state")return g(p,l);e.call(I.acknowledge,{pointer:l.checkpoint,side:t.side.snapshot(),...t.coverage(),state:l,...oe(n,p)})},complete(l){s.delete(p);let m=a(p);m!==null&&g(p,{...m,completed_at:t.now().toISOString(),ended:l})},release(){s.delete(p)}});return{expires:!1,create(p){if(!Dt.test(p.sid))throw new xe("SESSION_MISSING",`bad sid ${JSON.stringify(p.sid)}`);o(p.sid);let l=a(p.sid);if(l!==null&&(p.sid!==n||Yn(l)||s.has(p.sid)||!u(l,p.sid)))throw new xe("SESSION_LOCKED",`${p.sid} already exists \u2014 resume it`);let m=It(p);return g(p.sid,m),s.add(p.sid),Ve(m,f(p.sid))},resume(p){o(p);let l=c(p);if(l===null)throw new xe("SESSION_MISSING",`no session ${p}`);let m=Ot(l,t.now(),{expires:!1});return g(p,m),s.add(p),Ve(m,f(p))},peek:p=>i(p)?c(p):null,list(){let p=[n,...r.ids()].map(l=>({sid:l,state:c(l)}));return At(p.filter(l=>l.state!==null))},...Vt(t.chain,p=>(o(p),es(e.call(I.pointer,oe(n,p))))),appliedEvents:p=>t.sessionRecords(p).flatMap(l=>l.event_ids??[]),recordCount:(p,l)=>t.sessionRecords(p).filter(m=>m.seq<=l).length,isLive:p=>p===n||s.has(p),tidy:()=>{}}}function Yn(e){return typeof e?.completed_at=="string"}function es(e){let t=e;return typeof t=="object"&&t!==null&&Number.isInteger(t.seq)&&Number.isInteger(t.turn_id)&&typeof t.at=="string"&&typeof t.ts=="string"&&(t.full_seq===null||Number.isInteger(t.full_seq))?t:null}var Zn=500;function ts(e){let t=Buffer.alloc(e.length*4);return e.forEach((n,r)=>t.writeFloatLE(n,r*4)),t.toString("base64")}function ns(e){let t=Buffer.from(e,"base64"),n=new Float32Array(Math.floor(t.byteLength/4));for(let r=0;r<n.length;r++)n[r]=t.readFloatLE(r*4);return n}function Qn(e,t){let n=(c,u,g)=>`${c}
3
+ ${u}
4
+ ${g}`,r=new Map,i=new Set,s=new Map,o=!1,a=!1;return{prefetch(c,u,g){let f=`${c}
5
+ ${u}`;if(!i.has(f)){i.add(f);try{let p=e.call(I.vectorsRead,{alias:c,purpose:u});for(let[l,m]of Object.entries(p.vectors)){let _=ns(m);_.length===g&&r.set(n(c,u,l),_)}}catch(p){if(o)return;o=!0,t(`the session could not read the vectors Lattice keeps, so it embeds what it needs (said once per session): ${Qe(p)}`)}}},read:(c,u,g)=>r.get(n(c,u,g))??null,write(c,u,g,f){r.set(n(c,u,g),f);let p=`${c}
6
+ ${u}
7
+ ${f.length}`;s.has(p)||s.set(p,{alias:c,purpose:u,dims:f.length,vectors:new Map}),s.get(p).vectors.set(g,f)},writeBack(){if(s.size===0)return;let c=[...s.values()];s.clear();try{for(let{alias:u,purpose:g,dims:f,vectors:p}of c){let l=[...p];for(let m=0;m<l.length;m+=Zn){let _=Object.fromEntries(l.slice(m,m+Zn).map(([w,S])=>[w,ts(S)]));e.call(I.vectorsWrite,{alias:u,purpose:g,dims:f,vectors:_})}}}catch(u){if(a)return;a=!0,t(`Lattice did not keep this session's vectors, so a later session embeds them again (said once per session): ${Qe(u)}`)}}}}var we=e=>e.kind==="uc"?`uc:${e.id}`:e.kind;function Xn(e,t=()=>new Date){let n=new Map,r=new Map,i=(s,o)=>{for(let c of s){let u=n.get(we(c));u?u.count+=1:n.set(we(c),{grant:{owner_sid:e,pid:process.pid,ts:t().toISOString(),nonce:"memory",verb:o.verb??"session",hold:o.hold},count:1})}let a=!1;return{keys:s,assertHeld:()=>{},release:()=>{if(!a){a=!0;for(let c of[...s].reverse()){let u=n.get(we(c));u&&--u.count===0&&n.delete(we(c))}}},touch:()=>{}}};return{acquire:i,tryAcquire:i,holder:s=>n.get(we(s))?.grant??null,wait:async()=>"free",withKeySerialized:async(s,o)=>{let a=s.map(we).sort().join("|"),c=(r.get(a)??Promise.resolve()).then(o,o);return r.set(a,c.catch(()=>{})),c},releaseAll:()=>n.clear()}}function er(e=null,t=()=>{}){let n=e,r={proposals:structuredClone(n?.proposals??{}),signalLines:[...n?.signalLines??[]]},i=a=>r.proposals[a]??={proposal:null,review:null,verdicts:null},s={read:a=>structuredClone(r.proposals[a]?.proposal??null),write:(a,c)=>{i(a).proposal=structuredClone(c),t()},writeReview:(a,c)=>{i(a).review=structuredClone(c),t()},verdicts:a=>structuredClone(r.proposals[a]?.verdicts??{verdicts:{}}),saveVerdicts:(a,c)=>{i(a).verdicts=structuredClone(c),t()}},o={append:a=>{r.signalLines.push(JSON.stringify(a)),t()},snapshot:a=>{let c=[],u=0;for(let g of r.signalLines){let f=u+Buffer.byteLength(g)+1;if(a!==void 0&&f>a)break;c.push(JSON.parse(g)),u=f}return{signals:c,watermark:u}}};return{proposals:()=>s,signals:()=>o,snapshot:()=>structuredClone(r)}}function os(e,t){let n=[],r=null;do{let i=e.call(t,{after:r});n.push(...i.items),r=i.next}while(r!==null);return n}function rr(e,t){let n=e.call(I.scope,null),r=t.log??(()=>{}),i=new Set,s=Gn(e,n,r);s.readAhead(Object.values(s.baseIndex.heads).filter(d=>d!==null));let o=Qn(e,r),a=os(e,I.drafts).map(d=>({record:d.record,...d.attempt?{attempt:d.attempt}:{},envelope:d.envelope}));tr(t.sideDir,{recursive:!0});let c=nr(t.sideDir,"blobs"),u=e.call(I.pointer,null),g=u===null?e.call(I.sideGet,null):e.call(I.chainRead,{name:`side-${u.seq}.json`}),f=null,p=()=>{try{e.call(I.sideSave,{text:JSON.stringify(l.snapshot())})}catch(d){throw f=d,d}},l=er(g===null?null:JSON.parse(g),()=>p());t.publishSide?.(()=>{let d=f;if(f=null,d)throw d;p()});let m=null,_=d=>m.recordsSince(m.parse(n.baseHash)).filter(v=>v.sid===d),w=d=>{let{bytes:v}=e.call(I.getBlob,{fingerprint:d});return v===null?null:Buffer.from(v,"base64")},S=t.children??Ue(e),R=zn(e,{sessionId:t.sessionId,children:S,chain:Vn(e,t.sessionId,S),side:l,sessionRecords:_,coverage:()=>{let d=m.head(),v=d===null?null:m.resolveToken(d);return{eventSeq:t.lastEventSeq(),scope:v===null?{position:0,headHash:null}:{position:v.seq,headHash:v.hash}}},now:t.now??(()=>new Date)});return m=Hn({base:n.baseHash,index:d=>{if(d===n.baseHash)return structuredClone(s.baseIndex);if(d===null)return $e();let v=s.history.positionOf(d);if(v===null)throw new Error(`main holds no position ${d} up to the session's base`);return s.indexAt(v)},nodeBody:d=>s.nodeBody(d),prefetch:d=>s.prefetch(d),drafts:a,sink:d=>{let v=Pe(d.intent,{seq:d.record.seq,hash:d.hash,ts:d.record.ts}),k=e.call(I.appendDraft,{eventId:d.attemptId,record:d.record,envelope:v});return o.writeBack(),{record:k.record,hash:k.hash,replayed:k.replayed}},history:s.history,vectors:o,sides:{getBlob:w,putBlob:d=>{let v=Wt(d);if(t.knownBlobs?.includes(v)||i.has(v))return v;let{fingerprint:k}=e.call(I.putBlob,{bytes:d.toString("base64")});if(k!==v)throw new Error(`Lattice stored a blob under ${k}, not under its fingerprint ${v}`);return i.add(k),k},blobPath:d=>{let v=nr(c,d.replace(/[^A-Za-z0-9]/g,"_"));if(!rs(v)){let k=w(d);if(k===null)throw new Error(`Lattice holds no blob ${d}`);tr(c,{recursive:!0}),ss(v,k)}return v},logFile:()=>null,designFiles:()=>Jt(Jn(e)),parkedFacts:()=>{throw new Error("a session kept by Lattice parks no execution facts; execution sync is not part of a hosted session")},proposals:()=>l.proposals(),signals:()=>l.signals(),sessions:()=>R,locks:(d,v)=>Xn(d,v?.now)}}),m}var is=["override","agent"];function be(e){let{childSession:t,confirmUnreviewed:n,...r}=e;return async(i,s)=>{let o=s.onChildEvent?f=>s.onChildEvent({verb:"design",...f}):void 0,a=f=>{let p=On(f);p&&s.detail&&!s.detail.refused&&(s.detail.refused=p),o?.(f)},c=s.mode??"override";if(!is.includes(c))return a({type:"error",code:"MODE_USAGE",message:`error: a design child runs in override or agent mode, not '${c}'`,final:!0}),2;let u={...r,ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,...o||s.detail?{emit:a}:{}};if(s.resume!==void 0)return it({resume:s.resume,mode:c},u);let g=t?.(i);return it({useCase:i,force:!0,mode:c,...s.because?{because:s.because}:{},...s.changeDelta!==void 0?{changeDelta:s.changeDelta}:{},...s.priorDesign!==void 0?{priorDesign:s.priorDesign}:{},...s.repinsKept?{repinsKept:!0}:{},...s.statement?{statement:s.statement}:{},...s.agentStatement?{agentStatement:s.agentStatement}:{},...n?{confirmUnreviewed:n}:{},...g?{sessionId:g.id,registerSession:f=>g.register(f)}:{}},u)}}function sr(e,t,n,r={}){return(i,s)=>ve({ucRef:i,verb:"evolve",force:!0,evolution:{...s.because?{because:s.because}:{},...s.changeDelta!==void 0?{changeDelta:s.changeDelta}:{},...s.priorDesign!==void 0?{priorDesign:s.priorDesign}:{},...r.changed?.(i)?{changed:!0}:{}},...s.statement?{statement:s.statement}:{},childSession:n(i),...r.quietEnding?{quietEnding:!0}:{},...r.onHeld?{onHeld:o=>r.onHeld(i,o)}:{}},e,t)}function z(e,t){let n=e.resolve(t);return(n?e.displayNameOf(n.tip):null)??t}var ae=(e,t)=>{let n=e.getNode(e.tipOf(t))?.content?.title;return typeof n=="string"&&n!==""?n:void 0};function as(e,t,n){return(r,i)=>{let s=t[r]??null,o=s!==null?Te(s):null,a=o&&s!==null?je(o.name,s,r):void 0,c=o&&s!==null?`${Qt([s])}${a?` --as ${Xe(a)}`:""}`:cs(e,r)?`kane-cli maintain reconcile --source-id ${Xe(r)}`:null,u=i!==void 0&&ds($(e),r,i);return!n||c===null?{cmd:c,remedy:T.reviewSource(c,r,u)}:{cmd:`${c} --mode agent`,remedy:T.reviewSourceAgent(u)}}}function ds(e,t,n){let r=e.heads.get(t);return typeof r!="string"||!e.extractedSourceCids.has(r)?!1:e.byLabel(Ae.GAP).some(({cid:i,content:s})=>{let o=s.basis;return s.kind==="reconcile_deferred"&&typeof s.uc=="string"&&e.tipOf(s.uc)===n&&o?.source_id===t&&o.to_cid===r&&!e.superseded.has(i)&&e.trust.get(i)!=="archived"})}function cs(e,t){let n=$(e),r=n.heads.get(t);if(typeof r!="string")return!1;let i=n.mediaOf(r);return i.format==="plugin"&&typeof i.plugin?.id=="string"&&typeof i.plugin.fetch?.ref=="string"}function ar(e,t){return{review:as(e,t.origins,t.agent),question(n,r,i,s){let o=$(e),a=ae(o,n.ucTip),c=a?`"${a}"`:n.display.toUpperCase(),u=r.total===1,g=Re(o,n.ucTip),f=g?`${c} changed after its ${u?"test was":"tests were"} designed`:`${c} hasn't changed since its tests were designed`,p=Le(o,n.ucTip),l=r.touched===0&&p.sources.length===0&&p.repinnable,m=g?u?{label:"update it",detail:r.touched>0?"its change touches its test":l?"its test isn't touched; saving marks it up to date":"its change doesn't touch its test"}:{label:"update them",detail:r.touched===r.total?`its change touches all ${r.total} of its tests`:r.touched===0?l?`none of its ${r.total} tests is touched; saving marks them up to date`:`its change touches none of its ${r.total} tests`:`only what its change touches: ${r.touched} of its ${r.total} tests`}:{label:"update them",detail:"only what your reason touches"},_=s?{label:"leave it out",detail:u?"its test stays out of date":"its tests stay out of date"}:{label:"stop here",detail:"nothing is started"};return{id:ye(n),header:"Update?",text:i?`${f}
8
+ your reason: ${i}`:f,risk:"med",rationale:g?"updating designs its tests again: what its change touches is replaced, the rest stays as it is":"updating designs its tests again: only what your reason touches is replaced",options:[m,_],recommended_index:0,allow_free_text:!1}},answerWhy:n=>n==="proceed"?"update its tests":"leave it out"}}function dr(e,t,n,r,i){let s=$(e);if(Lt(s,t)!==null)return{refusal:T.ambiguousRef(t,r)};let o=Ye(s,t),a=at(s,o);if(!a.ok){let p=s.resolve(o);return p?s.nodeLabel.get(p.tip)===Ae.USECASE&&s.superseded.has(p.tip)?{refusal:{message:ne.removed(t,r).message}}:s.nodeLabel.get(p.tip)===Ae.USECASE&&s.trust.get(p.tip)==="archived"?{refusal:T.archived(ae(s,p.tip),z(s,o),r)}:{refusal:T.notInUseCase(t)}:{refusal:T.unknownRef(t,r)}}let c=z(s,a.target.ucTip),u=ae(s,a.target.ucTip);if(!ce(s,a.target.ucTip))return{refusal:T.noTests(u,c),noDesign:c};let g=lt(s,c,u,r);if(g)return{refusal:g};let f=Le(s,a.target.ucTip);return!n&&Nn(f)?{refusal:T.sourceChanged(u,c,ct(f.sources,i,a.target.ucTip)),sourceChanged:c}:!n&&!Re(s,a.target.ucTip)?{refusal:T.nothingChanged(u,c)}:null}function ls(e,t,n,r,i,s){let o=dr(e,t,n,r,i);if(o===null)return null;let a=o.refusal;return o.noDesign!==void 0?s({type:"evolve_skipped",use_case:o.noDesign,reason:"no-design",...a.next?{next:a.next}:{}}):o.sourceChanged!==void 0?s({type:"evolve_skipped",use_case:o.sourceChanged,reason:"source_changed",...a.remedy?{remedy:a.remedy}:{},...a.next?{next:a.next}:{}}):s({type:"error",...a.code?{code:a.code}:{},message:a.message,...a.next?{next:a.next}:{}}),2}function lt(e,t,n,r){let i=Tn(e,{useCase:t,resuming:!1});return i?.code==="UC_ARCHIVED"?T.archived(n,t,r):i?.code==="UC_UNREVIEWED"?T.unreviewed(n,t):null}async function cr(e){let{store:t,run:n}=e,r=ar(t,{origins:e.origins,agent:!0}),i=n.resume!==void 0,s=i&&n.kept!==void 0&&n.kept!=="unread"?n.kept:null,o=i?s?.request??(n.useCase?{ref:n.useCase,fromStale:!1}:{fromStale:!0}):{...n.ref!==void 0?{ref:n.ref}:{},fromStale:n.fromStale===!0,...n.because?{because:n.because}:{}};if(!i&&n.ref!==void 0){let C=ls(t,n.ref,n.because,e.projectName,r.review,e.emit);if(C!==null)return{code:C,unstarted:!0}}let a=i?pr(t,e.children,o,s):null,c=Bn(n.answer),u=a?{given:new Map([...a.keptGiven,...c.given]),...c.unreadable!==void 0?{unreadable:c.unreadable}:{}}:c;for(let C of a?.upToDate??[])e.emit({type:"evolve_skipped",use_case:C,reason:"up_to_date"});if(a?.nothingLeft)return{code:0,unstarted:!1};let g=!1,f=!1,p=()=>{f||(f=!0,e.logEvent({type:"evolve_answers",request:o,answers:[...u.given].flatMap(([C,h])=>typeof h=="string"?[{id:C,choice:h}]:[])}))},l=[],m=!1,_=C=>{l.includes(C)||l.push(C)},w=null,S=null,R=!1,d=C=>{if(C.type==="evolve_diff"&&R){R=!1;return}if(C.type==="evolve_diff"&&C.repinned&&(m=!0),!(w!==null&&(C.type==="session_paused"||C.type==="session_complete"))){if(w!==null){let h=Ee(C,{verb:"design",id:w});S!==null?S.push(h):e.emit(h);return}if(a){if(C.type==="evolve_skipped"&&C.reason==="declined"&&a.keptDeclines.has(`evolve:${String(C.use_case)}`)&&!c.given.has(`evolve:${String(C.use_case)}`)||C.type==="evolve_target"&&a.passedOver.has(`evolve:${String(C.use_case)}`))return;if(C.type==="evolve_paused"&&Array.isArray(C.pending_questions)){let h=C.pending_questions.map(E=>E.id),y=E=>`${me("design",e.sessionId,!0)} ${h.map(N=>`--answer ${N}=${E}`).join(" ")}`;e.emit({...C,next:[{cmd:y(1),why:"update its tests"},{cmd:y(2),why:"leave it out"}]});return}}if(C.type==="evolve_skipped"&&C.reason==="no-design"&&C.next===void 0){e.emit({...C,next:T.noTests(void 0,String(C.use_case)).next});return}e.emit(C)}},v=C=>[{cmd:`kane-cli maintain evolve ${C} --mode agent`,why:"update its tests later"}],k=(C,h,y,E,N={})=>e.emit({type:"child_end",child:"evolve",ok:E,use_case:C,dur_s:Math.max(1,Math.round((Date.now()-h)/1e3)),exit_code:y,...N}),x=(C,h,y,E,N,M)=>{let L=N===0&&(M||le(t,y,E)),q=N===3&&e.stopped();return k(C,h,N,L,{...L&&M?{outcome:"unchanged"}:{},...!L&&!q?{next:v(C)}:{}}),L&&!M&&(m=!0),!L&&!q&&_(C),N===3&&!q?1:N},P=async(C,h,y,E)=>{p(),g=!0;let N=Date.now(),M=!1;w=y,S=null,e.emit({type:"child_start",child:"evolve",subject:h,session_id:y});let L=1;try{L=await be(e.childRun)(C,{...E,mode:"override",resume:y,onChildEvent:q=>{q.type==="nothing_to_change"&&(M=!0),q.type!=="message_sent"&&E.onChildEvent?.(q)}})}catch(q){throw w=null,k(h,N,1,!1),q}return w=null,x(h,N,y,null,L,M)},K=async(C,h)=>{if(e.stopped())return 3;let y=$(t),E=z(y,C),N=lt(y,E,void 0,e.projectName);if(N)return e.emit({type:"evolve_skipped",use_case:E,reason:N.code==="UC_ARCHIVED"?"archived":"unreviewed",...N.next?{next:N.next}:{}}),R=!0,0;let M=a?.resumable.get(E);if(M!==void 0)return a.resumable.delete(E),P(C,E,M,h);let L=he(new Date),q=t.head(),ee=Date.now(),Se=!1,W=!1;w=L,S=[];let Q=(D,j,U={})=>k(E,ee,D,j,U),B=be({...e.childRun,childSession:()=>({id:L,register:D=>{p(),e.children.register(D,E),g=!0,W=!0,e.emit({type:"child_start",child:"evolve",subject:E,session_id:L});for(let j of S??[])e.emit(j);S=null}})}),V=1;try{V=await B(C,{...h,mode:"override",onChildEvent:D=>{D.type==="nothing_to_change"&&(Se=!0),D.type!=="message_sent"&&h.onChildEvent?.(D)}})}catch(D){if(w=null,S=null,D instanceof Ne&&D.code==="SESSION_CLASH"){let j=ge(D.extra?.heldBy);return e.emit({type:"evolve_skipped",use_case:E,reason:"held",...j?{held_by:{verb:j.verb,mine:j.mine}}:{},next:v(E)}),_(E),R=!0,0}throw W&&Q(1,!1),D}let A=S;if(w=null,S=null,!W){if(V===0)return V;e.emit({type:"child_start",child:"evolve",subject:E});for(let D of A??[])e.emit(D);return Q(V,!1,{next:v(E)}),_(E),V}return x(E,ee,L,q,V,Se)},F=await Fe(t,{...o.ref!==void 0?{ref:o.ref}:{},...o.because?{because:o.because}:{},mode:"override"},{io:{out:()=>{},err:(C,h)=>h?e.emit({type:"error",message:C.replace(/^error: /,""),code:h}):e.log(C),isTTY:!1,confirm:async()=>!1},asks:{blast:u},runDesign:K,onChild:()=>{},emit:d,by:{kind:"human",id:"owner"},words:r});if(g&&e.stopped()&&(F===0||F===3)){let C=me("design",e.sessionId,!0);return e.emit({type:"session_paused",sid:e.sessionId,mode:"agent",resume:C,expires_at:null,pending_questions:[],next:[{cmd:C,why:"goes on with the update where it stopped"}]}),{code:3,unstarted:!1}}return g&&e.logEvent({type:"evolve_not_updated",use_cases:l,still_stale:ur(t,e.children,new Set(u.given.keys()),l)}),o.ref===void 0&&l.length>0?{code:m?0:F===0?1:F,unstarted:!g&&!i,notUpdated:l}:{code:F,unstarted:!g&&!i}}function lr(e,t){let n=$(e),r=new Set,i=new Map;for(let s of t.ids()){let o;try{o=e.sessions().peek(s)?.use_case}catch{o=void 0}if(typeof o!="string"&&(o=e.recordsSince(null).find(u=>u.sid===s&&u.design_of)?.design_of?.uc_cid),typeof o!="string")continue;let a=z(n,o);le(e,s,null)?(r.add(a),i.delete(a)):r.has(a)||i.set(a,s)}return{done:r,resumable:i}}function ur(e,t,n,r){let i=$(e),{done:s}=lr(e,t);return dt(i).targets.filter(o=>ce(i,o.ucTip)&&!n.has(ye(o))).map(o=>z(i,o.ucTip)).filter(o=>!s.has(o)&&!r.includes(o))}function pr(e,t,n,r){let i=$(e),{done:s,resumable:o}=lr(e,t),a=m=>m.replace(/^evolve:/,""),c=new Set,u=new Set,g=!1,f=[];if(n.ref!==void 0){let m=at(i,Ye(i,n.ref));if(m.ok){let _=z(i,m.target.ucTip);s.has(_)?g=!0:!n.because&&!o.has(_)&&!Re(i,m.target.ucTip)?(f.push(_),g=!0):c.add(ye(m.target))}}else{for(let m of dt(i).targets)ce(i,m.ucTip)&&(s.has(z(i,m.ucTip))?u.add(ye(m)):c.add(ye(m)));for(let m of r?.answers??[])m.choice==="proceed"&&!c.has(m.id)&&!s.has(a(m.id))&&f.push(a(m.id))}let p=new Map([...(r?.answers??[]).filter(m=>c.has(m.id)).map(m=>[m.id,m.choice]),...[...u].map(m=>[m,"decline"])]),l=new Set([...p].filter(([,m])=>m==="decline").map(([m])=>m));return{done:s,resumable:o,keptGiven:p,keptDeclines:l,passedOver:u,asked:c,upToDate:f,nothingLeft:g}}async function fr(e){let{store:t,run:n}=e,r=ar(t,{origins:e.origins,agent:!1}),i=n.resume!==void 0,s=i&&n.kept!==void 0&&n.kept!=="unread"?n.kept:null,o=i?s?.request??(n.useCase?{ref:n.useCase,fromStale:!1}:{fromStale:!0}):{...n.ref!==void 0?{ref:n.ref}:{},fromStale:n.fromStale===!0,...n.because?{because:n.because}:{}};if(!i&&n.ref!==void 0){let d=dr(t,n.ref,n.because,e.projectName,r.review);if(d!==null)return await e.askMain({kind:"refused",message:d.refusal.message,...d.refusal.remedy?{next:d.refusal.remedy}:{}}),{code:2,unstarted:!0}}let a=i?pr(t,e.children,o,s):null,c={...o.ref!==void 0?{ref:o.ref}:{},...o.because?{because:o.because}:{},mode:"override"},u={out:()=>{},err:d=>e.log(d),isTTY:!1,confirm:async()=>!1},g={kind:"human",id:"owner"};if(a?.nothingLeft){let[d]=a.upToDate;if(d!==void 0){let v=$(t),k=v.resolve(d)?.tip,x=(k?ae(v,k):void 0)??d;await e.askMain({kind:"lines",lines:[{text:T.resumingOne(x,ir(t,a.resumable.get(d)),or)},T.upToDateNothing(x)],continues:!0})}return{code:0,unstarted:!1}}if(a&&[...a.asked].every(d=>a.keptGiven.has(d)))return await R(new Map(a.keptGiven));let f=[],p=null,l=[],m=await Fe(t,c,{io:u,asks:{blast:{given:new Map(a?.keptGiven??[])}},runDesign:async()=>{throw new Error("no update runs before its question is answered")},onChild:()=>{},emit:d=>{if(d.type==="evolve_paused"&&Array.isArray(d.pending_questions)&&(f=d.pending_questions),d.type==="evolve_batch"&&(p=Number(d.use_cases)),d.type==="evolve_skipped"&&d.reason==="source_changed"){let v=$(t),k=String(d.use_case),x=v.resolve(k)?.tip;l.push(...T.leftOutSourceChanged(x?ae(v,x):void 0,k,String(d.remedy??"")))}},by:g,words:r});if(m!==3||f.length===0)return m===0&&o.ref===void 0&&p===0&&await e.askMain(l.length>0?{kind:"lines",lines:l,stopped:!0}:{kind:"lines",lines:[{text:T.upToDate(e.projectName)}]}),{code:m===3?0:m,unstarted:!i};let _=new Map(a?.keptGiven??[]),w=[],S=f.filter(d=>{let v=$(t),k=z(v,d.id.replace(/^evolve:/,"")),x=v.resolve(k)?.tip,P=lt(v,k,void 0,e.projectName);return P?(P.code!=="UC_ARCHIVED"&&w.push(...T.cantUpdate((x?ae(v,x):void 0)??k,k)),_.set(d.id,"decline"),!1):!0});if(S.length===0&&!i)return await e.askMain({kind:"lines",lines:[...l,...l.length>0?[{text:""}]:[],{text:T.changedCount(f.length)},...w],stopped:!0}),{code:0,unstarted:!0};for(let[d,v]of S.entries()){let[k=v.text]=v.text.split(`
9
+ `),x=d===0?[...i?[{text:T.moreAnswers(S.length)}]:[],...w]:[],P=await e.askMain({kind:"evolve-entry",head:k,...o.because?{reason:o.because}:{},options:v.options,...d===0&&o.ref===void 0&&!i?{batch:{useCases:f.length}}:{},...x.length>0?{before:x}:{},...d===0&&l.length>0?{lead:l}:{},last:d===S.length-1});if(!P.go&&P.code===130)return{code:130,unstarted:!0};_.set(v.id,P.go?"proceed":"decline")}return await R(_);async function R(d){if(!i&&![...d.values()].includes("proceed"))return{code:0,unstarted:!0};let{controller:v}=await e.mountChat(),k=!1,x=!1,P=!1,K=!1,F="",C=[],h=[],y=(A,D)=>{C.includes(A)||(C.push(A),h.push(D))},E=A=>{let D=$(t),j=D.resolve(A)?.tip??null,U=z(D,A);return{uc:U,title:(j?ae(D,j):void 0)??U,tip:j}},N=()=>{x||(x=!0,e.logEvent({type:"evolve_answers",request:o,answers:[...d].map(([A,D])=>({id:A,choice:D}))}))};if(a){let A=$(t),D=U=>{let te=A.resolve(U)?.tip;return(te?ae(A,te):void 0)??U},j=o.ref!==void 0?T.resumingOne(D(z(A,o.ref)),ir(t,a.resumable.get(z(A,o.ref))),or):T.resumingBatch(a.passedOver.size+[...d].filter(([U,te])=>te==="proceed"&&!a.passedOver.has(U)).length+a.upToDate.length,a.passedOver.size);v.ledger({kind:"lines",lines:[{text:j},...a.upToDate.map(U=>T.upToDateNow(D(U)))]})}let M={quietEnding:!0,changed:A=>{let{tip:D}=E(A);return D!==null&&Re($(t),D)},onHeld:(A,D)=>{let{uc:j,title:U}=E(A);K=!0,v.ledger({kind:"lines",lines:T.held(ge(D)?.mine===!0,U,j)}),y(j,U)}},L=sr(v,e.childRun,A=>(F=he(new Date),{id:F,register:D=>{N(),e.children.register(D,E(A).uc),k=!0}}),M),q=(A,D)=>(N(),k=!0,F=D,ve({ucRef:A,verb:"evolve",force:!0,resume:!0,childSession:{id:D,register:()=>{}},quietEnding:!0,evolution:{...M.changed(A)?{changed:!0}:{}}},v,e.childRun)),ee=A=>{let{tip:D}=E(A),j=D!==null?Le($(t),D).sources:[],{remedy:U}=ct(j,r.review,D??void 0);j.length>0&&U&&v.ledger({kind:"lines",lines:T.stillSourceChanged(U)})},Q=await Fe(t,c,{io:u,asks:{blast:{given:d}},runDesign:async(A,D)=>{if(e.stopped())return 3;let{uc:j,title:U}=E(A);K=!1;let te=a?.resumable.get(j);te!==void 0&&a.resumable.delete(j);let Ct=te!==void 0?null:t.head(),Ce=te!==void 0?await q(A,te):await L(A,D);return K?0:Ce===3&&e.stopped()?3:Ce===0&&le(t,F,Ct)?(P=!0,ee(A),0):Ce===0&&!t.recordsSince(Ct).some(Kr=>Kr.sid===F)?(D.onChildEvent?.({type:"nothing_to_change"}),ee(A),0):(v.ledger({kind:"lines",lines:T.later(j)}),y(j,U),Ce===3?1:Ce)},onChild:()=>{},emit:A=>{A.type==="evolve_diff"&&A.repinned&&(P=!0),e.logEvent(A)},by:g,words:r});if(e.stopped())return{code:3,unstarted:!k&&!i};let B=k?ur(t,e.children,new Set(d.keys()),C):[];k&&e.logEvent({type:"evolve_not_updated",use_cases:C,still_stale:B});let V=o.ref===void 0&&C.length>0;return(V||B.length>0)&&e.notUpdated(V?C:[],V?h:[],B.length),V?{code:P?0:Q===0?1:Q,unstarted:!k&&!i}:{code:Q,unstarted:!k&&!i}}}var or=4;function ir(e,t){return t===void 0?0:Mn(e.recordsSince(null).filter(n=>n.sid===t).map(n=>n.design_phase?.phase).filter(n=>typeof n=="string"))}function gr(e){return{verb:e.verb,mode:e.mode,contextRoot:null,env:Pt(),...e.run.resume!==void 0?{resumeSid:e.run.resume}:{},write:!0,longSession:!0,sessionId:e.supportId,remote:{sessionId:e.sessionId,projectId:e.projectId}}}function us(e,t=process.env){let n=e.TESTMUAI_BASIC_AUTH??t.TESTMUAI_BASIC_AUTH;if(n){let i=Buffer.from(n,"base64").toString("utf8"),s=i.indexOf(":");if(s>0)return{token:null,basic:{username:i.slice(0,s),accessKey:i.slice(s+1)}}}let r=e.TESTMUAI_API_KEY??t.TESTMUAI_API_KEY;return{token:r||null}}function ps(e,t=process.env){let n;return{controller:async()=>n??=us(e,t),lis:async()=>{throw new Error("a source plugin's connection carries the controller's credential only")}}}function mr(e,t={}){let n=ps(e);return r=>pn(r,{...t,credentials:n})}async function hr(e){let t=e.testing?.sourcePlugins;if(t){let n=await import(t.module),{registry:r,connections:i}=n.sourcePluginsFor(t.name,{auth:e.auth});nt(()=>r,i??mr(e.auth));return}nt(fn,mr(e.auth))}var X=(e,t,n)=>`${e} ${e===1?t:n}`,vr=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`,fs={"chat.added_use_cases":({minted:e,matched:t})=>e===0&&t>0?`${t===1?"1":`all ${t}`} matched existing \u2014 nothing new added`:`added ${X(e,"use-case","use-cases")} to this session`+(t>0?` \xB7 ${t} matched existing`:""),"chat.added_design":({acs:e,scenarios:t,tests:n,gaps:r,linked:i,update:s})=>{let o=[e?X(e,"acceptance criterion","acceptance criteria"):null,t?X(t,"scenario","scenarios"):null,n?X(n,"test","tests"):null,r?X(r,"open question","open questions"):null].filter(c=>c!==null),a=i?X(i,"scenario","scenarios"):null;return o.length?(s?`updated ${vr(o)} in this session`:`added ${vr(o)} to this session`)+(a?` \xB7 ${a} linked`:""):a?`linked ${a} to the acceptance criteria ${i===1?"it checks":"they check"}`:"updated this session's design"},"chat.proposal_refused":()=>"proposal failed validation \u2014 nothing added to this session","note.phase_unchanged":({update:e,kind:t,count:n})=>{if(!e||t===void 0||n===void 0)return"this phase matched what's already there \u2014 nothing new added";let[r,i]=t==="acs"?["acceptance criterion","acceptance criteria"]:t==="scenarios"?["scenario","scenarios"]:["test","tests"];return n===1?`its ${r} stays as it was`:`its ${n} ${i} stay as they were`},"chat.commit_failed":()=>"something couldn't be added to this session","chat.repair_sent":()=>"that couldn't be added to this session as it was \u2014 the agent is fixing it","chat.held_degraded":({held:e})=>`held ${X(e,"use-case","use-cases")} back \u2014 the duplicate check couldn't run fully, so nothing was added this turn; ${e===1?"it's":"they're"} kept with this session`,"chat.child_back":({drafts:e})=>`${e} added to this session`,"chat.refine_hint":({added:e,held:t})=>{let n=t===1?"the change":"the changes";return t===0?'chat to refine ("looks good" approves)':e===0?`chat to refine (${n} ${t===1?"is":"are"} kept with this session, not applied)`:`chat to refine ("looks good" approves new use-cases, not ${n})`},"chat.updates_held":({count:e})=>e===1?"held 1 change to an existing use-case \u2014 kept with this session, not applied":`held ${e} changes to existing use-cases \u2014 kept with this session, not applied`,"note.dedup_reduced":()=>"note: the duplicate check can't run fully, so from here on new use-cases are held back and this session will pause instead of finishing","note.chain_recovered":()=>"resuming from this session's last step","note.chain_truncated":({lost:e})=>e===1?"this session's last turn couldn't be read, so it resumes from before it":`this session's last ${e} turns couldn't be read, so it resumes from before them`,"chat.approved":({count:e})=>`approved ${X(e,"use-case","use-cases")}`,"chat.stales":()=>"","note.turns_unrecorded":()=>"note: this chat's messages can't be kept with the session \u2014 the agent has them now, but not after a resume","note.receipt_unbuilt":()=>"note: the change was added to this session, but the agent wasn't told, so it may not know about it","warning.variables_unwritten":()=>"warning: couldn't add the new variables to this folder; add them before running the tests","note.assumed_defaults":({count:e})=>`note: while you were away, ${e===1?"1 question was":`${e} questions were`} answered for you`,"note.checkpoint_not_saved":()=>"warning: couldn't keep this session's last step, so the session is pausing"},gs={"header.extract":({source:e,sources:t,index:n})=>n>1?{text:`extracting "${e}"`,tail:`source ${n} of ${t}`}:{text:`extracting "${e}"${t>1?` and ${t-1} more`:""}`,tail:`${X(t,"source","sources")} to read`},"header.resume_design":({use_case:e,done:t,phases:n})=>({text:`resuming "${e}"`,tail:`${t} of ${n} phases done`}),"header.design":({title:e,id:t,phases:n})=>({text:`designing tests for ${e!==null?`"${e}"`:Bt(t)}`,tail:`${X(n,"phase","phases")} to go`})},qe={...xt(_t,fs,gs),phaseNotesUnderAdded:!0};function yr(e,t){return t.size===0?e:{...e,sourceName:n=>t.get(n)}}function pt(e){return Ln({store:e.store,credentials:re,sessionId:e.sessionId,children:()=>e.children.ids(),childSession:t=>({id:Pn(new Date,t),register:n=>e.children.register(n)}),agent:e.agent.agent,...e.agent.auth?{auth:e.agent.auth}:{},...e.agent.preflightTurn?{preflightTurn:e.agent.preflightTurn}:{},...e.agent.probe?{probe:e.agent.probe}:{},...e.ask?{ask:e.ask}:{},...e.note?{note:e.note}:{},...e.narrate?{narrate:e.narrate}:{},...e.telemetry?{telemetry:e.telemetry,tracePath:Me}:{},matchUnreviewed:!0,by:e.by,emit:e.emit,changeSince:"cited"})}function wr(e,t,n){let r=new Map;for(let{key:i,card:s}of e)r.set(i,s.kind==="ADD"?`new-${t.indexOf(i)+1}`:Ie(n,s.ref));return r}function He(e,t){let n=r=>{let i=Number(/(\d+)$/.exec(r)?.[1]??Number.MAX_SAFE_INTEGER);return[r.startsWith("new-")?1:0,i]};return[...e].sort((r,i)=>{let[s,o]=n(t.get(r.key)??r.key),[a,c]=n(t.get(i.key)??i.key);return s-a||o-c})}function Ie(e,t){let n=e.resolve(t);return(n?e.displayNameOf(n.tip)??e.displayNameOf(n.cid)??t:t).toLowerCase()}function br(e,t,n){return e.map(({key:r,card:i,viewLines:s})=>{let o=t.get(r)??r,a=i.kind==="ADD"?null:n.resolve(i.ref),c=a?String(n.getNode(a.tip)?.content.title??i.title):i.title,u=i.kind==="MODIFY";return{key:o,kind:i.kind,...i.kind==="ADD"?{}:{use_case:o},title:c,change:i.why,...u?{diff:s.map(g=>({op:g.op,field:g.field,text:g.text})),tests:Oe(n,i.ref)}:{}}})}function Oe(e,t){return Be(e,t).filter(n=>e.nodeLabel.get(n)==="test").length}function kr(e,t,n,r=n){let i=$(t),s=i.heads.get(n),o=[];if(typeof s=="string"){if(ut?.head!==s){let a=null;try{a=Rn(t,i,s)}catch{a=null}ut={head:s,lines:a?.split(`
10
+ `)??[]}}o=ut.lines}return e.map(a=>{let c={...a,card:{...a.card,...a.card.kind==="MODIFY"?{tests:Oe(i,a.card.ref)}:{},...a.card.diffSummary?{diffSummary:G.diffSummary(a.viewLines)}:{}}},u=Number(/L(\d+)/.exec(a.card.citeLines?.[0]??"")?.[1]);if(!Number.isInteger(u)||u<1||o.length===0)return c;let g=null;for(let f=Math.min(u,o.length)-1;f>=0&&g===null;f--)g=/^#+\s+(.+)$/.exec(o[f])?.[1]?.trim()??null;return{...c,card:{...c.card,provenance:`${gn(r)}, ${g??`line ${u}`}`}}})}var ut=null;function ft(e,t,n,r){let i=ce(e,n.key)!==null,s=r!==void 0?t.sessions().peek(r)?.force_scope:void 0;if(s!==void 0)return{verb:n.kind==="evolve"?"evolve":"design",replaces:s.filter(a=>e.nodeLabel.get(a)==="test").length,force:i};let o=Oe(e,n.key);return{...Rr(n.kind,o,i),replaces:o}}function Sr(e,t,n,r){let i={own:0,carried:0};for(let s of t)if(!n.has(s))try{let o=e.sessions().loadCheckpoint(s);i[o.base.verb==="design"?"carried":"own"]+=o.agent?.usage_total?.credits??0}catch(o){r(`resume: ${s}'s credits weren't counted: its checkpoint couldn't be read (${o instanceof Error?o.message:String(o)})`)}return i}function ms(e,t,n){try{return e.sessions().loadCheckpoint(t).agent?.usage_total?.credits??0}catch(r){return n?.(`resume: ${t}'s credits weren't counted: its checkpoint couldn't be read (${r instanceof Error?r.message:String(r)})`),0}}function Cr(e,t){let n=e.resumableChildren?.()[0];if(!n)return;let r=$(t),{verb:i,replaces:s}=ft(r,t,n.offer,n.child),o=r.resolve(n.offer.key),a=(o?r.getNode(r.tipOf(o.cid))?.content?.title:void 0)??n.offer.title;return{card:n.card,title:String(a),verb:i,replaces:s}}async function xr(e){let t=e.answer==="resume"?e.review.resumableChildren?.().find(d=>d.card===e.card):void 0,n=e.answer==="resume"?t:e.review.pendingOffers?.().find(d=>d.card===e.card);if(!n)return{code:2,verb:"design",tests:0,added:0};if(e.answer==="later")return e.review.offerAnswered?.(n.proposalId,e.card,"declined"),{code:0,verb:"design",tests:0,added:0};let r=$(e.store),{verb:i,force:s,replaces:o}=ft(r,e.store,n.offer,t?.child),a=i!=="evolve"?[]:t?hs(r,e.store.sessions().peek(t.child)?.force_scope??Be(r,n.offer.key),vs(e.store,t.child)):Be(r,n.offer.key),c=t?.child??he(new Date);t||e.review.offerAnswered?.(n.proposalId,e.card,"accepted",c);let u=st(e.parent.state.turns),g=n.offer.kind==="evolve"?Ie(r,n.offer.key):void 0,f=null,p=t?ms(e.store,t.child,e.log):0,l=e.parent.state.credits?.total,m=()=>{p>0&&e.parent.state.credits?.total===l&&e.parent.creditsCarriedIn?.(p)},_;try{_=await ve({ucRef:n.offer.key,force:s,verb:i,quietEnding:!0,...i==="evolve"&&o>0?{replaces:o}:{},...t?{resume:!0}:{},...!t&&i==="evolve"?{statement:_r(r,n.offer.key,o)}:{},childSession:{id:c,register:d=>e.children.register(d,g)},onEnded:d=>{e.review.offerEnded?.(n.proposalId,e.card,d)},onHeld:d=>{f=ge(d)}},e.parent,e.run)}catch(d){throw m(),d}if(_!==0&&m(),f!==null)return e.parent.ledger({kind:"lines",lines:G.childHeld(f.mine,g??Ie(r,n.offer.key))}),{code:_,verb:i,tests:0,added:0};let w=[...e.parent.state.ledger].reverse().find(d=>d.kind==="childClose"),S=_===0&&w?.kind==="childClose"?w.tests??0:0,R=w?.kind==="childClose"&&w.unfinished===!0;if(_===0&&!R){let d=e.designed.added+(i==="design"?S:0),v=i==="evolve"?G.againBack(ys($(e.store),a)):d>0?G.back(d):null;v!==null&&e.parent.ledger({kind:"lines",lines:[{text:v,dim:!0}]})}else if(!(_===3&&e.parent.state.status==="pausing")){let d=n.offer.kind==="evolve"?G.childFailedNext(Ie(r,n.offer.key),i).map(v=>({text:` ${v}`})):[{text:` ${G.childFailedNew}`,dim:!0}];e.parent.ledger({kind:"lines",lines:d})}return{code:_,verb:i,tests:S,added:st(e.parent.state.turns)-u}}function hs(e,t,n){let r=new Set(n.flatMap(o=>o.nodes.map(a=>a.cid))),i=n.flatMap(o=>o.supersessions.filter(a=>a.kind==="node").map(a=>a.old)),s=i.flatMap(o=>e.nodeLabel.get(o)==="scenario"?e.edgesInto(o).filter(a=>a.type==="automates").map(a=>a.src):[]);return[...new Set([...t,...i,...s])].filter(o=>!r.has(o))}function vs(e,t){try{let n=e.parse(e.sessions().loadCheckpoint(t).base.store_watermark);return e.recordsSince(n!==null&&e.resolveToken(n)!==null?n:null).filter(r=>r.sid===t)}catch{return[]}}function ys(e,t){let n={scenarios:0,tests:0},r=0,i=0,s=o=>String(e.getNode(o)?.content.title??"").trim().toLowerCase();for(let o of t){let a=e.nodeLabel.get(o);if(a!=="scenario"&&a!=="test")continue;if(!e.superseded.has(o)){a==="test"&&(i+=1);continue}let c=e.superseded.get(o);c&&s(c)===s(o)?a==="test"&&(r+=1):n[a==="test"?"tests":"scenarios"]+=1}return{replaced:n,updated:r,kept:i}}function _r(e,t,n){let r=e.resolve(t),i=r?e.displayNameOf(r.tip)??e.displayNameOf(r.cid)??t:t,s=r?String(e.getNode(r.tip)?.content?.title??i):i,o={id:i,title:s,replaces:n},a=o.replaces===1?"its test and the scenario it automates":`its ${o.replaces} tests and the scenarios they automate`;return[`[kane] ${o.id} "${o.title}" changed in this review: the person approved the change and chose to design its tests again.`,"Design them for its new version, phase by phase, each with finalize_design: acceptance criteria, scenarios, acceptance criteria + exercises, tests + gaps.",`Your phases replace ${a}, so don't edit those in a chat; acceptance criteria can still be edited in one.`].join(" ")}function Rr(e,t,n){return{verb:e==="evolve"&&t>0?"evolve":"design",force:n}}function Er(e,t){let n=null;for(let r of[...t.ids()].reverse()){let i;try{i=e.sessions().peek(r)?.reconcile?.proposal_id}catch(o){n??=o;continue}if(i===void 0)continue;let s=e.proposals().read(i);return s?s.use_cases.filter(o=>!o.matches_existing).map(o=>_n("ADD",o.temp_ref)):null}if(n!==null)throw n;return null}function gt(e){let t=$(e.store),{verb:n}=Rr(e.offer.kind,Oe(t,e.offer.key),ce(t,e.offer.key)!==null),r={kind:n,key:e.key,title:e.title};return n!=="evolve"?{offer:r}:{offer:r,run:async()=>{let i=e.review.pendingOffers?.().find(l=>l.card===e.card),s=he(new Date);i&&e.review.offerAnswered?.(i.proposalId,e.card,"accepted",s),e.emit({type:"child_start",child:"evolve",subject:e.key,session_id:s});let o=Date.now(),a=e.store.head(),c=be({...e.run,childSession:()=>({id:s,register:l=>e.children.register(l,e.key)})}),u=1,g=null,f,p={ok:!0};try{u=await c(e.offer.key,{yes:!0,mode:"override",agentStatement:_r(t,e.offer.key,Oe(t,e.offer.key)),onChildEvent:l=>{l.type==="error"&&f===void 0&&typeof l.message=="string"&&(f=l.message),l.type!=="message_sent"&&!Dr.has(l.type)&&e.emit(Ee(l,{verb:"design",id:s}))}})}catch(l){if(!(l instanceof Ne&&l.code==="SESSION_CLASH"))throw l;g=ge(l.extra?.heldBy),f=l.message,u=2}finally{let l=i!==void 0&&u===3&&e.stopped?.()===!0;i&&!l&&e.review.offerEnded?.(i.proposalId,e.card,"ran");let m=u===0&&le(e.store,s,a);e.emit({type:"child_end",child:"evolve",ok:m,dur_s:Math.max(1,Math.round((Date.now()-o)/1e3)),exit_code:u,...g!==null?{held_by:Zt(g)}:{},...!m&&!l?{next:[{cmd:`kane-cli maintain evolve ${e.key} --mode agent`,why:"update its tests later"}]}:{}}),p=m||l?{ok:!0}:{ok:!1,useCase:e.key,error:f?.replace(/^error: /,"")??(u===0?"it wrote no design with tests":`it ended with exit ${u}`)}}return p}}}var Dr=new Set(["session_paused","session_complete"]);async function Ir(e){for(let t of e.review.resumableChildren?.()??[]){let n=$(e.store),{verb:r}=ft(n,e.store,t.offer,t.child),i=Ie(n,t.offer.key);e.emit({type:"child_start",child:r,subject:i,session_id:t.child});let s=Date.now(),o=1;try{o=await be(e.run)(t.offer.key,{yes:!0,mode:"override",resume:t.child,onChildEvent:a=>{Dr.has(a.type)||e.emit(Ee(a,{verb:"design",id:t.child}))}})}finally{o===3&&e.stopped()||e.review.offerEnded?.(t.proposalId,t.card,"ran");let a=o===0&&le(e.store,t.child,null);e.emit({type:"child_end",child:r,ok:a,dur_s:Math.max(1,Math.round((Date.now()-s)/1e3)),exit_code:o,...!a&&!e.stopped()?{next:[r==="evolve"?{cmd:`kane-cli maintain evolve ${i} --mode agent`,why:"update its tests later"}:{cmd:`kane-cli design tests --use-case ${i} --mode agent`,why:"designs its tests again later"}]}:{}})}if(e.stopped())return!0}return!1}function Or(e,t){return[{cmd:`kane-cli context extract --resume ${e} --mode agent${t.map(n=>` --answer ${n}=approve`).join("")}`,why:"answer each change: approve, reject or defer"}]}var ws=["approve","reject","defer"];function mt(e){let t=e.filter(n=>/^q\d+=/i.test(n.trim()));return{questions:t,cards:e.filter(n=>!t.includes(n))}}function Ar(e,t){let n=i=>({kind:"refuse",code:"STRUCTURED_TARGET_UNKNOWN",error:i}),r=[];for(let i of e){let s=i.indexOf("="),o=(s>0?i.slice(0,s):i).trim().toLowerCase(),a=(s>0?i.slice(s+1):"").trim().toLowerCase();if(!t.includes(o))return n(`error: --answer ${o} names no card in this review; its cards are ${t.join(", ")}`);if(!ws.includes(a))return n(`error: --answer ${i.trim()} isn't a verdict; a card takes approve, reject or defer`);if(r.some(c=>c.key===o))return n(`error: --answer ${o} is given twice; answer each card once`);r.push({key:o,verdict:a})}return{kind:"apply",verdicts:r}}async function We(e){let t=0,n=new Map(e.items.map(r=>[e.keys.get(r.key)??r.key,r]));for(let{key:r,verdict:i}of e.verdicts){if(e.stopped?.())return{failedChildren:t};let s=n.get(r);if(!s)continue;let o;try{o=await e.review.applyVerdict(s.key,i)}catch(g){let f=g.code==="CONCURRENT_APPEND"?"CONCURRENT_APPEND":"CONNECTION_FAILED";e.emit({type:"card_refused",source:e.words.source,key:r,verdict:i,code:f,refusal:f==="CONCURRENT_APPEND"?G.refused(s.card,f,e.words).line:G.notLanded});continue}if(!o.ok){e.emit({type:"card_refused",source:e.words.source,key:r,verdict:i,code:o.code,refusal:G.refused(s.card,o.code,e.words).line});continue}let a=G.receipt(s.card,i),c=o.offer?e.onApproved?.(s,o.offer):void 0;e.emit({type:"card_verdict",source:e.words.source,key:r,verdict:i,line:a.line,...a.note?{note:a.note}:{},...c?.offer?{offer:c.offer}:{}});let u=await c?.run?.();u&&!u.ok&&(t++,e.emit({type:"error",code:"DESIGN_CHILD_FAILED",key:r,use_case:u.useCase,message:`the redesign of ${u.useCase} failed: ${u.error}`}))}return{failedChildren:t}}async function Pr(e){let t=s=>e.keys.get(s.key)??s.key,n=e.items.filter(s=>s.card.kind==="ARCHIVE"),{failedChildren:r}=await We({review:e.review,items:e.items,keys:e.keys,verdicts:e.items.map(s=>({key:t(s),verdict:s.card.kind==="ARCHIVE"?"defer":"approve"})),emit:e.emit,words:e.words,...e.onApproved?{onApproved:e.onApproved}:{},...e.stopped?{stopped:e.stopped}:{}});if(n.length>0&&e.emit({type:"reconcile_held",source_id:e.words.source,held:n.map(s=>({ref:t(s),why:s.card.why||s.card.title}))}),e.stopped?.())return{failed:r};let i=e.loadCards();if(i.length===0)return{failed:r};await We({review:e.review,items:i,keys:e.keys,verdicts:i.map(s=>({key:t(s),verdict:"defer"})),emit:e.emit,words:e.words});for(let s of i)e.emit({type:"error",code:"OVERRIDE_UNDECIDED",key:t(s),message:`the review couldn't decide card ${t(s)} (${s.card.title}) itself: it is left deferred, and the others went on`});return{failed:i.length+r}}function bs(e,t){let n=new Set;for(let r=t;r&&!n.has(r);r=e.superseded.get(r)){if(e.trust.get(r)==="archived")return!0;n.add(r)}return!1}function $r(e,t){let n=new Set(t),r=[...new Set(t.filter(s=>!bs(e,s)).map(s=>e.tipOf(s)))].filter(s=>n.has(s)&&e.hasNode(s));if(r.length===0)return null;let i=r.map(s=>{let o=e.getNode(s).content,a=e.displayNameOf(s);return{temp_ref:s,...a?{logical_id:a}:{},title:String(o.title??""),risk:String(o.risk??""),...typeof o.description=="string"?{description:o.description}:{}}});return{headline:qe.text("chat.added_use_cases",{minted:i.length,matched:0}),items:i}}var b=Ss;Rt(b.supportId);kn(b.traceVerb);var Z=ks,O=e=>Z.postMessage(e);Et(yr(qe,new Map((b.ingest??[]).flatMap(e=>e.remote?[[e.sourceId,hn({provider:e.remote.provider,display:e.remote.display,...e.remote.title!==void 0?{title:e.remote.title}:{}})]]:[]))),(e,t)=>O({type:"event",event:{type:"warning",message:e.replace(/^warning:\s*/,""),...t?{code:t}:{}}}),()=>b.supportId);var Cs=/^error: (agent failed|repair run failed|agent ended)/,jr=e=>b.run.resume===void 0?e:{...e,out:t=>en(t)?O({type:"log",line:t}):e.out(t)},pe=e=>O({type:"log",line:e});async function xs(){if(b.testing?.agent){let{standIn:t}=await import(b.testing.agent.module);return t(b.testing.agent.name)}let{runAgent:e}=await import("./bridge-T6QMYKED.js");return{agent:e}}function Mr(e){try{return structuredClone(e)}catch{return JSON.parse(JSON.stringify(e))}}function Lr(e){let t={};(e.state.pending?.questions??[]).forEach((i,s)=>t[s]=[...e.multiSelection(s)]);let n=new Set;for(let i of e.state.turns)for(let s of i.items??[])n.add(s.temp_ref);for(let i of e.state.activeTurn?.items??[])n.add(i.temp_ref);let r={};for(let i of n){let s=e.aliasOf(i);s!==void 0&&(r[i]=s)}return{multi:t,canIngest:!1,senderAlive:e.senderAlive(),aliases:r}}function _s(e,t){let{baseHash:n}=t.call(I.scope,null);return()=>e.recordsSince(e.parse(n)).flatMap(r=>r.nodes.filter(i=>i.label==="usecase").map(i=>i.cid))}function Rs(e,t){let n=_s(e,t);return{addedBefore:n,checkIn:()=>$r(se(e).graph(),n())}}async function bt(e,t){let{buildExtractChat:n}=await import("./extract-chat-M65NWGUK.js"),r=null,i=()=>{r&&O({type:"mirror",state:Mr(r.state),view:Lr(r)})},s=await n({site:se(e),store:e,credentials:re,agent:H.agent,auth:Y.auth,preflight:Y.preflightTurn,onRender:i,...Y.probe?{probe:Y.probe}:{},matchUnreviewed:!0,...t?{addedBefore:t.addedBefore,resumedCheckIn:t.checkIn}:{}});return r=s.controller,i(),Z.on("message",o=>{if(o.type!=="controller")return;if(o.member==="approveAdded"){Promise.resolve(s.controller.approveAdded()).then(c=>O({type:"approved",go:c}),()=>O({type:"approved",go:!1}));return}let a=s.controller[o.member];typeof a=="function"&&Promise.resolve(a.apply(s.controller,o.args)).catch(()=>{})}),s}async function Es(e,t,n,r,i){let s=await bt(t,i),o=i?e:{...e,sessionId:b.sessionId},a=i?[...i.addedBefore()]:null;return $n(o,{...jr(s.runDeps({isTTY:!0,onSummary:r,telemetry:de})),emit:n,note:pe,...a?{addedBefore:()=>a}:{}})}function Ge(e){return new Promise(t=>{let n=r=>{r.type==="preMountAnswer"&&(Z.off("message",n),t(r.answer))};Z.on("message",n),O({type:"preMount",question:e})})}async function Br(e,t,n){if(!e.useCase)return null;let r=e.useCase,[{designEntryGate:i},{designGate:s},{phaseLadderFor:o},{liveUseCase:a}]=await Promise.all([import("./trust-gate-AT2XBWN4.js"),import("./gate-WISOUTHQ.js"),import("./phase-seed-LCJ4WSYV.js"),import("./use-case-ref-NE4X4MZN.js")]),c=b.mode==="agent",u=se(t).graph(),g=async(R,d)=>{if(O({type:"unstarted"}),!c)return await Ge({kind:"refused",message:R.message,...R.next?{next:R.next.cmd?`${R.next.lead} ${R.next.cmd}`:R.next.lead}:{}}),2;let v=R.next?.cmd,k=v===void 0?void 0:d==="error"?[{cmd:v,why:R.next.why??R.next.lead}]:[{cmd:v,why:R.next.why??R.next.lead,title:"Redesign"},...R.more??[]];return n({type:d,...R.code?{code:R.code}:{},message:R.message,final:!0,...k?{next:k}:{}}),2},f=a(u,r);if(!f.ok){if(f.why==="unknown"){let R=[...u.names.keys()].filter(d=>d.startsWith("uc-")).sort().slice(0,6);return g(ne.unknown(r,b.projectName,R),"gate_refused")}return g(f.why==="removed"?ne.removed(r,b.projectName):ne.notUseCase(r,f.label),"gate_refused")}let p=u.getNode(f.cid)?.content?.title,l=typeof p=="string"&&p.trim()!==""?p:void 0,m;try{m=e.resume?t.sessions().peek(e.resume)?.use_case:void 0}catch{m=void 0}let _=i(u,{useCase:r,resuming:!!e.resume,sessionUseCase:m});if(_?.code==="UC_ARCHIVED")return g(ne.archived(l,r,b.projectName),"error");if(_?.code==="UC_UNREVIEWED"&&!e.allowUnreviewed)return g(ne.unapproved(l,r,c),"error");if(!c||e.resume)return null;let w=e.phase!==void 0&&o(t,u,r).length>0,S=s(u,r,!!e.force||w);return S.ok||!S.wall?null:g(ne.designed(l,r,S.wall.kind==="designed-stale"),"gate_refused")}async function Ds(e,t,n,r){let[{buildDesignChat:i},{runDesign:s,askedRedesign:o},{designGate:a},{captureForceScope:c}]=await Promise.all([import("./design-chat-F3OEZPNJ.js"),import("./run-PC5YO4AS.js"),import("./gate-WISOUTHQ.js"),import("./design-committer-TRYP3LOZ.js")]),u=se(t),g=await Br(e,t,n);if(g!==null)return g;let f=e;if(!e.resume&&e.useCase&&!e.phase){let w=u.graph(),S=a(w,e.useCase,!!e.force);if(!S.ok&&S.wall){let R=w.resolve(e.useCase)?.tip,d=R!==void 0?w.getNode(R)?.content?.title:void 0,v=await Ge({kind:"design-entry",wall:S.wall.kind,...typeof d=="string"&&d.trim()!==""?{title:d}:{},display:S.wall.display,testsReplaced:c(w,e.useCase).filter(k=>w.getNode(k)?.label==="test").length,sessionId:b.sessionId});if(!v.go)return v.code;f=v.because?o(f,v.because):{...f,...v.force?{force:!0}:{}}}}let p=await i({site:u,store:t,credentials:re,agent:H.agent,auth:Y.auth,preflight:Y.preflightTurn,...f.useCase?{useCase:f.useCase}:{},testFilesAt:"save"}),{controller:l}=p,m=()=>O({type:"mirror",state:Mr(l.state),view:Lr(l)});l.subscribe(m),m(),Z.on("message",w=>{if(w.type!=="controller")return;let S=l[w.member];typeof S=="function"&&Promise.resolve(S.apply(l,w.args)).catch(()=>{})});let _=async w=>(await Ge({kind:"retarget",message:Xt(w)})).go;return s({...jn(t,f),...b.fresh?{sessionId:b.sessionId}:{},confirmRetarget:_},{...jr(p.runDeps({isTTY:!0,onSummary:r,telemetry:de})),emit:n,note:pe})}function Is(e,t){try{let n=se(e).graph(),r=t.filter(s=>{let o=n.resolve(s);return o!==null&&n.getNode(o.tip)?.label==="test"}).length,i=Cn({graph:n,ids:t,cwd:b.projectDir});if(i.variables.length===0&&i.noStartPage.length===0)return;try{xn(i,b.projectDir)}catch(s){O({type:"log",line:`the variables the designed tests need couldn't be written to ${i.file}: ${ot(s)}`})}O({type:"needed",needed:i,tests:r})}catch(n){O({type:"log",line:`the designed tests' needs couldn't be read: ${ot(n)}`})}}var kt=Symbol("ready to write"),Fr=e=>new Proxy(e,{get:(t,n,r)=>n==="putBlob"?()=>{throw kt}:Reflect.get(t,n,r)});function Nr(e){let t=new Map;return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,i=>(t.has(n)||t.set(n,r(i)),t.get(n))]))}function Ur(e){let t=e instanceof Error?e.message:String(e),n=e?.code;return{code:typeof n=="string"?n:/^([A-Z][A-Z0-9_]+):\s*/.exec(t)?.[1]??/\s*\[([A-Z][A-Z0-9_]+)\]$/.exec(t)?.[1]??"INGEST_FAILED",message:t.replace(/^[A-Z][A-Z0-9_]+:\s*/,"").replace(/\s*\[[A-Z][A-Z0-9_]+\]$/,"")}}var qr=(b.ingest??[]).map(e=>e.fingerprint).filter(e=>typeof e=="string"&&e!=="");function Os(e){return new Promise(t=>{let n=r=>{r.type!=="ingestUploaded"||r.index!==e||(Z.off("message",n),r.ok&&r.fingerprint!==void 0&&qr.push(r.fingerprint),t(r.ok))};Z.on("message",n)})}function ht(e){return new Promise(t=>{let n=r=>{r.type!=="ingestGo"||r.index!==e||(Z.off("message",n),t(r.go))};Z.on("message",n)})}async function As(){if(b.testing?.remoteDeps){let e=await import(b.testing.remoteDeps.module);return{credentials:re,...e.remoteDepsFor(b.testing.remoteDeps.name)}}return{credentials:re}}async function Ps(e,t){let n=ln().byId(t.plugin.id);if(n===void 0)return{outcome:{outcome:"refused",code:"PLUGIN_MISSING",message:`${t.file} is read by plugin ${t.plugin.id}, which this build does not include`}};let r=un(),i={plugin:n,ref:t.plugin.ref,named:t.plugin.named,isFile:t.plugin.isFile,asId:t.sourceId},s=t.plugin.isFile?{bytes:t.bytes}:void 0,o=a=>tt({...i,store:a,supplied:s});try{return{outcome:{outcome:(await tt({...i,store:Fr(e),...s?{supplied:s}:{...r?{connect:r}:{},onFetched:c=>s=c}})).status==="unchanged"?"unchanged":"created"}}}catch(a){if(a instanceof cn){let{code:c,message:u,remedy:g}=a.refusal;return{outcome:{outcome:"refused",code:c,message:u,...g?{facts:{remedy:g}}:{}}}}return a!==kt?{outcome:{outcome:"refused",...Ur(a)}}:{outcome:{outcome:"created"},pluginWrite:o,...t.plugin.isFile?{}:{fetched:s.bytes}}}}async function $s(e,t,n){if(t.plugin)return Ps(e,t);let r=Buffer.from(t.bytes),i,s=t.file,o;if(t.remote){let a=dn(t.remote.provider),c=an(t.remote.mediaType);if(!a?.prepare||!c)return{outcome:{outcome:"refused",code:"UNSUPPORTED_MEDIA",message:`${t.file} can't be added`}};let u={provider:t.remote.provider,sourceId:t.sourceId,bytes:r,media:c,label:t.remote.label,display:t.remote.display,...t.remote.title!==void 0?{title:t.remote.title}:{},origin:t.remote.origin,identity:t.remote.identity,warnings:[],...t.remote.downloads?{downloads:t.remote.downloads}:{}},g=await a.prepare(u,e,await n());if(!g.ok){let{code:f,message:p,facts:l}=g.failure;return{outcome:{outcome:"refused",code:f,message:p,...l?{facts:l}:{}}}}({media:i,label:s}=g),o=Nr(g.converters)}else{let a=on(t.file);if(!a.ok)return{outcome:{outcome:"refused",code:a.code,message:`${t.file} is a file type kane can't ingest`}};i=a.media,o=Nr({pdf:rn,docx:sn})}try{return{outcome:{outcome:(await et({store:Fr(e),bytes:r,media:i,sourceId:t.sourceId,label:s,converters:o})).status==="unchanged"?"unchanged":"created"},write:{bytes:r,media:i,label:s,converters:o}}}catch(a){return a===kt?{outcome:{outcome:"created"},write:{bytes:r,media:i,label:s,converters:o}}:{outcome:{outcome:"refused",...Ur(a)}}}}async function Ns(e,t,n){let r=null,i=()=>r??=As(),s=[];for(let c of t)s.push(await $s(e,c,i));let o=s.findIndex(c=>c.outcome.outcome==="refused");if(o>=0)return O({type:"ingestOutcome",index:o,...s[o].outcome}),await ht(o),2;if(t.length>1){let c=$(e),u=s.flatMap((g,f)=>g.outcome.outcome==="created"&&c.heads.get(t[f].sourceId)!=null?[f]:[]);if(u.length>0)return O({type:"ingestOutcome",index:u[0],outcome:"refused",code:"NEW_VERSION_ALONE",message:"a new version is reviewed on its own",facts:{newVersions:u.join(",")}}),await ht(u[0]),2}for(let[c,u]of s.entries())if(u.fetched!==void 0&&(O({type:"ingestFetched",index:c,bytes:u.fetched}),!await Os(c)))return 2;for(let[c,u]of s.entries())if(O({type:"ingestOutcome",index:c,...u.outcome}),!await ht(c))return 2;let a=null;for(let[c,u]of t.entries()){let g=s[c],f=u.plugin!==void 0&&!u.plugin.isFile,p=f?Tr(e,u.sourceId):null,l=g.outcome.outcome==="refused"?"unchanged":g.outcome.outcome,m=[],_=null,w,S=null;if(g.outcome.outcome==="created"&&(g.write||g.pluginWrite))try{let k=g.pluginWrite?await g.pluginWrite(e):await et({store:e,sourceId:u.sourceId,...g.write});if(l=k.status,m=k.warnings??[],k.status==="created"&&(w=Ts(e,u.sourceId,k.blob)),k.composite){let{kind:x,pages:P,delivered:K,omitted:F}=k.composite;_={kind:x,...P!==void 0?{pages:P}:{},delivered:K,omitted:F},u.remote&&K+F>0&&(S={delivered:K,omitted:F})}}catch(k){return O({type:"log",line:`the source wasn't written after its result was taken: ${k instanceof Error&&k.stack?k.stack:String(k)}`}),O({type:"ingestUnwritten",index:c}),2}let R=b.verb==="reconcile"&&l==="unchanged"?En(e,u.sourceId):null,d=R?.behind.length??0,v=R?.unread===!0;u.then==="review"&&(a={status:l,behind:d,unread:v}),n({type:"ingested",source_id:u.sourceId,status:l,...d>0?{behind:d}:{},...v?{unread:!0}:{},...f?{cursor:{from:p,to:Tr(e,u.sourceId)}}:{},...m.length>0?{warnings:m}:{},..._?{media:_}:{},...w?{duplicate_of:w}:{},...u.remote?{origin:u.remote.origin}:{}}),O({type:"ingested",index:c,status:l,...d>0?{behind:d}:{},...v?{unread:!0}:{},...w?{duplicateOf:w}:{},...S?{attachments:S}:{}})}return t[0]?.then==="review"&&a!==null&&a.status==="unchanged"&&a.behind===0&&!a.unread||t[0]?.then==="pause"?0:null}function Tr(e,t){let n=$(e),r=n.heads.get(t);return typeof r=="string"?n.mediaOf(r).plugin?.fetch?.cursor??null:null}function Ts(e,t,n){let r=$(e);for(let[i,s]of r.heads.entries())if(i!==t&&s!=null&&r.getNode(s)?.content.blob===n)return i}var St=()=>b.ingest?.[0]?.sourceId??b.review.sourceId,js=()=>b.ingest?.[0]?.file??b.review?.file??"<file>",yt=e=>{let t=St(),n=b.ingest?.[0]?.remote,r=b.review?.page,i;if(n)i=vn({...n,address:n.origin.url},je(n.provider,n.origin.url,t));else if(r){let s=Te(r.address)?.name??"web";i=wn(s,r.address,yn(e,t),r.as)}return{source:t,file:js(),...i?{page:i}:{}}},Hr=e=>e.pending()===null&&(e.givenVerdicts?.().length??0)>0,wt=e=>b.run.resume!==void 0&&(e.pending()?.kind==="cards"||Hr(e));function ke(e,t){return{store:e,projectDir:null,agent:t.agent,credentials:re,...t.auth?{auth:t.auth}:{},...t.preflightTurn?{preflightTurn:t.preflightTurn}:{},testFilesAt:"save",note:pe,telemetry:de,tracePath:Me}}var Ms=new Set(["reasoning_delta","reasoning_done","tool_activity","decision_activity","usage","text_delta","progress"]);async function Ls(e,t,n,r){let i=St(),s=yt(e),o=mn(s);O({type:"reviewMirror",review:{pending:null,cards:[],lastReadError:null,given:[],named:s}});let c=(await bt(e)).controller,u=null,g=pt({store:e,note:d=>O({type:"log",line:`review: ${d}`}),children:t,sessionId:b.sessionId,by:{kind:"human",id:"owner"},agent:n,telemetry:de,ask:d=>c.ask(d),narrate:d=>{d.type==="proposal"?u=d.narrative??null:Ms.has(d.type)&&c.onAgentEvent(d)},emit:r});if(b.run.resume!==void 0){let d=Sr(e,t.ids(),new Set((g.resumableChildren?.()??[]).map(v=>v.child)),v=>O({type:"log",line:v}));d.own+d.carried>0&&c.creditsSoFar?.(d.own+d.carried,d.carried)}let f={again:0,added:0},p=async(d,v)=>{let k=await xr({review:g,store:e,children:t,parent:c,run:ke(e,n),card:d,answer:v,designed:f,log:x=>O({type:"log",line:x})});return k.code===0&&(f[k.verb==="evolve"?"again":"added"]+=k.tests),k.code===3&&c.state.status==="pausing"&&(m.push({type:"pause"}),_?.()),k},l,m=[],_=null,w=c.attachSender(d=>{m.push(d),_?.()}),S=async()=>{for(;m.length===0;)await new Promise(d=>_=d);return m.shift()},R=async d=>{c.setWorking?.(`Reading ${s.page?.reading??i}\u2026`);let v=await d(),k=g.loadCards();return l.mirror(),c.setWorking?.(null),c.narrated?.(u,k.length>0?{kind:"commit",ok:!0,held:!0,line:G.held(o,k.map(x=>x.card.kind))}:void 0),u=null,v};l=bn({...g,loadCards:()=>kr(g.loadCards(),e,i,o),offer:p,...g.steer?{steer:d=>R(()=>g.steer(d))}:{}},O,d=>O({type:"log",line:d}),s,b.run.resume!==void 0?()=>Cr(g,e):void 0),c.ledger({kind:"header",text:G.header(o),tail:""}),Z.on("message",d=>{d.type==="review"&&l.serve(d)});try{if(!wt(g)){let d=await R(()=>g.startReview(i));if(d!==3)return d!==0&&H.interrupted()?3:d}for(;;){let d=await S();if(d.type==="session_complete")return 0;if(d.type==="pause")return 3;d.type==="user_message"&&d.text&&g.steer&&await R(()=>g.steer(d.text))}}finally{w()}}async function Bs(e,t,n,r){let i=St(),s=b.run.override===!0?Dn(e):new Set,o=[],a=null,c=pt({store:e,note:w=>O({type:"log",line:`review: ${w}`}),children:t,sessionId:b.sessionId,by:{kind:"human",id:"owner"},agent:r,telemetry:de,emit:w=>{if(w.type==="review_cards")return void(o=w.dropped);if(!(w.type==="card_verdict"||w.type==="card_refused")){if(w.type==="review_resolved")return void(a=w);w.child_id!==void 0&&(w.type==="session_paused"||w.type==="session_complete")||n(w)}}});n({type:"run_start"});let u=me("extract",b.sessionId,!0),g=w=>n({type:"session_paused",sid:b.sessionId,source_id:i,mode:"agent",resume:u,expires_at:null,pending_questions:[],next:[{cmd:u,why:"resume"}],...w});if(b.run.resume!==void 0&&await Ir({review:c,store:e,run:ke(e,r),emit:n,stopped:H.interrupted}))return g({}),3;if(wt(c)&&Hr(c))return 0;if(!wt(c)){let w=await c.startReview(i);if(w!==3)return w!==0&&H.interrupted()?(g({}),3):w}let f=c.loadCards(),p=$(e),l=wr(f,Er(e,t)??f.filter(w=>w.card.kind==="ADD").map(w=>w.key),p);if(f=He(f,l),b.run.override===!0){let w=ke(e,r),S=b.testing?.refuseCard,R=S?Object.assign(Object.create(c),{applyVerdict:async(v,k,x)=>v===S||l.get(v)===S?{ok:!1,code:"CONCURRENT_APPEND",refusal:"the store moved under the review (test)"}:c.applyVerdict(v,k,x)}):c,d=await Pr({review:R,items:f,keys:l,emit:n,words:yt(e),loadCards:()=>He(c.loadCards(),l),onApproved:(v,k)=>gt({review:c,store:e,children:t,run:w,emit:n,card:v.key,key:l.get(v.key)??v.key,offer:k,title:rt(v.card),stopped:H.interrupted}),stopped:H.interrupted});return a&&n(a),n({type:"reconcile_use_cases",source_id:i,use_cases:In(e,i,s)}),d.failed>0&&O({type:"itemsFailed",count:d.failed}),H.interrupted()?(g({}),3):0}let m=mt(b.run.answer??[]).cards;if(m.length>0){let w=Ar(m,f.map(d=>l.get(d.key)??d.key));if(w.kind==="refuse")return n({type:"error",message:w.error,code:w.code}),2;let S=ke(e,r),R=await We({review:c,items:f,keys:l,verdicts:w.verdicts,emit:n,words:yt(e),onApproved:(d,v)=>gt({review:c,store:e,children:t,run:S,emit:n,card:d.key,key:l.get(d.key)??d.key,offer:v,title:rt(d.card),stopped:H.interrupted}),stopped:H.interrupted});if(a&&n(a),R.failedChildren>0&&O({type:"itemsFailed",count:R.failedChildren}),f=He(c.loadCards(),l),f.length===0&&H.interrupted())return(c.resumableChildren?.()??[]).length>0?(g({}),3):(g({reason:"review_decided",pending_cards:[],next:[{cmd:me("extract",b.sessionId,!0),why:"finish the review"}]}),3);if(f.length===0)return 0}n({type:"review_cards",source:i,cards:br(f,l,p),dropped:o});let _=f.map(w=>l.get(w.key)??w.key);return g({reason:"review_pending",pending_cards:_,next:Or(b.sessionId,_)}),3}var Ke,vt=new Set,Wr=await xs(),de=$t(gr(b)),H=Fn(Wr.agent,()=>{},null),Y={auth:{...b.auth,...de.spawnEnv()},...Wr,preflightTurn:async()=>b.preflight,telemetry:de,agent:H.agent},Gr=!1,Fs=()=>H.interrupted()||Gr;Z.on("message",e=>{e.type==="stop"&&H.interrupt(),e.type==="kill"&&H.kill(),e.type==="controller"&&e.member==="requestPause"&&(Gr=!0)});try{await hr(b);let e=new zt(b.bridge,45e4),t=b.lastEventSeq,n=Ue(e),r=rr(e,{sessionId:b.sessionId,sideDir:b.sideDir,children:n,lastEventSeq:()=>t,log:x=>O({type:"log",line:x}),knownBlobs:qr}),i=x=>{t+=1,O({type:"sessionEvent",seq:t,kind:x.type,payload:x})},s=x=>{if(!(H.interrupted()&&x.type==="error"&&Cs.test(String(x.message??"")))){if(x.type==="commit")for(let P of x.minted??[])typeof P.logical_id=="string"&&vt.add(P.logical_id);t+=1,O({type:"sessionEvent",seq:t,kind:x.type,payload:x}),O({type:"event",event:x})}},{run:o}=b,a=b.landed??[],c=b.verb==="extract"&&o.resume!==void 0&&a.length>0&&e.call(I.stateGet,{})===null,u=b.fresh||c,g=[...new Set((b.ingest??[]).map(x=>x.sourceId))],f=g.length>1?g:c?a:[],p=b.verb==="reconcile"?mt(o.answer??[]).questions:b.verb==="evolve"?[]:o.answer??[],l=p.length?nn({opts:{resume:o.resume,answer:p},reader:r.sessions(),verb:b.verb==="design"?"design":"extract"}):{kind:"none"};if(l.kind==="apply"){let x=P=>b.verb==="design"?s({type:"note",text:P}):pe(P);for(let P of l.notes)x(P);l.matchedQids.length>0&&x(`applying ${l.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let P of l.matchedQids)s({type:"panel_resolved",id:P,by:"user",via:"flag"})}let m=l.kind==="apply"&&l.statement?[o.message,l.statement].filter(Boolean).join(`
11
+
12
+ `):o.message,_=l.kind==="refuse"?(s({type:"error",message:l.error,code:l.code}),2):null,w=o.override?"override":b.mode,S=o.override?x=>O({type:"out",line:x}):()=>{},R={mode:w,...f.length>1?{sources:f}:f.length===1?{source:f[0]}:o.source!==void 0?{source:o.source}:{},...o.resume!==void 0&&!c?{resume:o.resume}:{},...m!==void 0?{message:m}:{},...o.force!==void 0?{force:o.force}:{},...o.trust!==void 0?{trust:o.trust}:{},remainderSession:x=>n.register(x)},d=x=>O({type:"summary",facts:x}),v={mode:w,...o.useCase!==void 0?{useCase:o.useCase}:{},...o.resume!==void 0?{resume:o.resume}:{},...m!==void 0?{message:m}:{},...o.force!==void 0?{force:o.force}:{},...o.allowUnreviewed!==void 0?{allowUnreviewed:o.allowUnreviewed}:{},...o.phase!==void 0?{phase:o.phase}:{},...o.plan!==void 0?{plan:o.plan}:{},...o.max!==void 0?{max:o.max}:{},...o.strength!==void 0?{strength:o.strength}:{}},k=b.ingest?await Ns(r,b.ingest,s):null;Ke=_!==null?_:k!==null?k:b.verb==="evolve"&&b.mode==="agent"?await(async()=>{let x=await cr({store:r,children:n,emit:s,logEvent:i,log:pe,childRun:ke(r,Y),run:o,sessionId:b.sessionId,projectName:b.projectName,origins:b.origins??{},stopped:H.interrupted});return x.unstarted&&O({type:"unstarted"}),x.notUpdated&&O({type:"notUpdated",useCases:x.notUpdated}),x.code})():b.verb==="evolve"?await(async()=>{let x=await fr({store:r,children:n,logEvent:i,log:pe,childRun:ke(r,Y),run:o,projectName:b.projectName,origins:b.origins??{},stopped:Fs,askMain:Ge,mountChat:()=>bt(r),notUpdated:(P,K,F)=>O({type:"notUpdated",useCases:P,titles:K,stillStale:F})});return x.unstarted&&O({type:"unstarted"}),x.code})():b.verb==="reconcile"&&b.mode==="interactive"?await Ls(r,n,Y,i):b.verb==="reconcile"?await Bs(r,n,s,Y):b.verb==="design"&&b.mode==="interactive"?await Ds(v,r,s,d):b.verb==="design"?await Br(v,r,s)??await Un({...v,...b.fresh?{sessionId:b.sessionId}:{}},se(r),{emit:s,out:S,progress:()=>{},channel:!0},{...Y,testFilesAt:"save"}):b.mode==="agent"?await qn(R,se(r),{...u?{sid:b.sessionId}:{},emit:s,out:S,note:pe,progress:()=>{},onSummary:d,channel:!0},{...Y,matchUnreviewed:!0}):await Es(R,r,s,d,u?void 0:Rs(r,e)),b.verb==="design"&&vt.size>0&&Is(r,[...vt])}catch(e){O({type:"log",line:e instanceof Error&&e.stack?e.stack:String(e)}),O({type:"event",event:{type:"error",message:tn.runStopped(b.verb)}}),Ke=1}finally{H.dispose()}await de.end({exit_code:Ke});O({type:"done",code:Ke});
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-UR6MHSHU.js";export{a as SESSION_PATCH_KEYS,g as SID_RE,b as SessionError,c as TTL_MS,q as cleanSessions,l as createSession,d as expiryOf,h as givenSessionIdRefusal,o as listSessions,j as newSessionState,n as peekSession,k as renewedSessionState,m as resumeSession,e as sessionExpired,f as sessionExpiry,i as sessionHandle,p as sessionListRows};
@@ -0,0 +1,26 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as $}from"./chunk-RX6776AI.js";import{a as w}from"./chunk-R7KXAISS.js";import"./chunk-WMGKUERB.js";import"./chunk-WOSANGV6.js";import{a as g}from"./chunk-73Y6T2UK.js";import{e as h}from"./chunk-35ECWCCK.js";import"./chunk-BWXLZS5O.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-42PALMW2.js";import"./chunk-EZN7CF45.js";import"./chunk-7XBNMOH4.js";import"./chunk-ZCIWQHCO.js";import"./chunk-ZFM77AQU.js";import"./chunk-22PIMG52.js";import"./chunk-UEE3RZN4.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-6NFOH4AC.js";import"./chunk-7V4BQSSV.js";import{n as p,o as m,q as f}from"./chunk-HHW6MRU3.js";import"./chunk-7DFBOVUB.js";import"./chunk-4I7YN6YY.js";import"./chunk-UR6MHSHU.js";function b(t,n=new Date){let o=new Date(t).getTime()-n.getTime();if(Number.isNaN(o))return"unknown";if(o<=0)return"EXPIRED";let e=Math.floor(o/36e5),i=Math.round(o%36e5/6e4);return e>0?`${e}h ${i}m`:`${i}m`}function l(t){return t.verb==="design"?`kane-cli design tests --resume ${t.sid} --mode ${t.mode==="agent"?"agent":"interactive"}`:t.verb===void 0||t.verb==="extract"?`kane-cli context extract --resume ${t.sid}${t.mode==="agent"?" --mode agent":""}`:null}var k="kane-cli maintain reconcile --apply";function S(t,n){try{return w(t).proposals().verdicts(n).resolved===!0}catch{return!1}}function x(t){return t.verb==="design"?t.use_case??"?":t.verb===void 0||t.verb==="extract"?"extract corpus":`${t.verb} session`}function j(t,n,o){let e,i,s;try{if(e=p(t,n),!e)return process.stderr.write(`error: no session ${n} (kane-cli context sessions lists them)
3
+ `),2;i=e.pending.questions.map(h),s=l(e)}catch{return process.stderr.write(`error: session ${n} has a corrupt state.json \u2014 remove with: kane-cli context sessions clean ${n}
4
+ `),2}let r=new Date(e.expires_at).getTime()<=Date.now(),c=e.reconcile?.proposal_id&&!S(t,e.reconcile.proposal_id)?{cmd:k,needs:"tty"}:null;if(o)return process.stdout.write(JSON.stringify({sid:e.sid,verb:e.verb??"extract",use_case:e.use_case,mode:e.mode,created_at:e.created_at,expires_at:e.expires_at,...r?{expired:!0}:c?{held_review:c}:s!==null?{resume:s}:{},pending_questions:i,pending_proposals:e.pending.proposals.length,assumed:e.assumed,...e.force?{force:!0}:{}})+`
5
+ `),0;let v=x(e);process.stdout.write(`${e.sid} ${e.verb??"extract"} \xB7 ${v} \xB7 ${e.mode} \xB7 expires in ${b(e.expires_at)}
6
+ `),r?process.stdout.write(` expired at ${e.expires_at} \u2014 not resumable; discard with: kane-cli context sessions clean ${e.sid}
7
+ `):c?process.stdout.write(` held for review: its changeset's verdicts are given in a terminal: ${c.cmd}
8
+ `):s===null?process.stdout.write(` created by a newer kane-cli (verb "${e.verb}") \u2014 resume it with that build
9
+ `):(process.stdout.write(` resume: ${s}
10
+ `),process.stdout.write(` answer in words: ${s} --message "<your statement>"
11
+ `)),i.length===0&&process.stdout.write(` pending questions: none
12
+ `);for(let[a,u]of i.entries())process.stdout.write(` q${a+1} [${u.risk}] ${u.text}
13
+ `),u.options.forEach((d,_)=>{let y=_===u.recommended_index?" (recommended)":"";process.stdout.write(` - ${$(d.label)}${y}${d.detail?` \u2014 ${d.detail}`:""}
14
+ `)});return e.assumed.length>0&&process.stdout.write(` assumed while away: ${e.assumed.map(a=>`${a.questionId}\u2192${a.optionId}`).join(", ")}
15
+ `),0}async function I(t,n,o){{let{remoteEntry:s}=await import("./remote-entry-X6JMPC2K.js"),r=await s(t==="discard"?"context sessions discard":"context sessions",n.mode==="agent",void 0,{onboard:n.json!==!0});if(r!==null){if("exit"in r)return r.exit;let{remoteSessions:c}=await import("./sessions-remote-IWHWIQ2T.js");return c(t,n,o,r.choice)}}let e=g(process.cwd());if(t==="show")return o?j(e,o,!!n.json):(process.stderr.write(`error: sessions show needs a <sid> (kane-cli context sessions lists them)
16
+ `),2);if(t==="clean"){let{removed:s,skipped:r}=f(e,{all:n.all,sid:o});for(let c of r)process.stderr.write(`error: session ${c.sid} not removed \u2014 ${c.reason}
17
+ `);return o&&s.length===0?(r.length>0||process.stderr.write(`error: no session ${o}
18
+ `),2):(process.stdout.write(s.length?`removed: ${s.join(", ")}
19
+ `:`nothing to clean
20
+ `),r.length>0?2:0)}let i=m(e);if(n.json){for(let s of i){let r=s.corrupt?null:l(s);process.stdout.write(JSON.stringify(s.corrupt||r===null?s:{...s,resume:r})+`
21
+ `)}return 0}if(i.length===0)return process.stdout.write(`no sessions
22
+ `),0;for(let s of i){if(s.corrupt){process.stdout.write(`${s.sid} CORRUPT state.json \u2014 remove with: kane-cli context sessions clean ${s.sid}
23
+ `);continue}let r=l(s);process.stdout.write(`${s.sid} ${s.verb??"extract"} \xB7 ${x(s)} \xB7 pending ${s.pendingCount} \xB7 expires in ${b(s.expires_at)}
24
+ `+(r===null?` created by a newer kane-cli (verb "${s.verb}") \u2014 resume it with that build
25
+ `:` resume: ${r}
26
+ `))}return 0}export{l as resumeCommandFor,x as sessionSubject,I as sessionsCommand};