@testmuai/kane-cli 0.8.10 → 0.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/{ChatSurface-OWGOCHG3.js → ChatSurface-YFJDAXOG.js} +1 -1
  2. package/dist/{ChromeProfilePicker-QIMCWPPI.js → ChromeProfilePicker-PUCZN6WU.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-34E2AXS4.js → CliFeedbackPrompt-JAIB5MHS.js} +1 -1
  4. package/dist/{CliUploadProgress-TRKOSED7.js → CliUploadProgress-53LQMQJD.js} +1 -1
  5. package/dist/{ConfigView-XVKR7ATN.js → ConfigView-7HFP4OXS.js} +1 -1
  6. package/dist/EvidenceViewOffer-2T2ZGHIF.js +2 -0
  7. package/dist/FolderPicker-LTQW4YNR.js +2 -0
  8. package/dist/{InfoBox-QM5YEBMH.js → InfoBox-62YG3YNQ.js} +1 -1
  9. package/dist/{LinksBox-CSEDEZGU.js → LinksBox-6NS3GHWO.js} +1 -1
  10. package/dist/{ProfilesView-CZVPREIS.js → ProfilesView-HIKK2HPC.js} +1 -1
  11. package/dist/{ProjectPicker-F6FEWNMY.js → ProjectPicker-2CJMO5TD.js} +1 -1
  12. package/dist/{SaveSessionPrompt-RUSFOLBZ.js → SaveSessionPrompt-4DTPZSXD.js} +1 -1
  13. package/dist/SingleShotApp-KXZF5ZJM.js +2 -0
  14. package/dist/{SummaryBox-KOJXTZVZ.js → SummaryBox-A6LKKQXJ.js} +1 -1
  15. package/dist/TestMdRunView-6X6W5YAP.js +2 -0
  16. package/dist/{TestrunEvidenceTable-KGVBX76H.js → TestrunEvidenceTable-7SCCTZPH.js} +1 -1
  17. package/dist/{WhoamiView-IOTBOCGK.js → WhoamiView-PDMQ6F5N.js} +1 -1
  18. package/dist/{app-download-7AF6QL2C.js → app-download-K2ELUXWR.js} +1 -1
  19. package/dist/{auth-2HTDCT7X.js → auth-5WJSFLCP.js} +1 -1
  20. package/dist/{binary-NKX3NEK7.js → binary-QVQRWQFK.js} +1 -1
  21. package/dist/{bind-IMBQFRKT.js → bind-5WELCZ4S.js} +3 -3
  22. package/dist/{bootstrap-TNFANHSS.js → bootstrap-3LNHRDQH.js} +1 -1
  23. package/dist/bridge-WFSSMJ57.js +2 -0
  24. package/dist/{changelog-SQVLSCYO.js → changelog-TK6DWFVW.js} +1 -1
  25. package/dist/{chat-committer-K3NOTLOU.js → chat-committer-MAW25ICC.js} +1 -1
  26. package/dist/chat-controller-6GW2HSJP.js +2 -0
  27. package/dist/{chunk-EH3YMGQ7.js → chunk-2E55VQYA.js} +1 -1
  28. package/dist/{chunk-PCVTSFIX.js → chunk-2KQF6WLX.js} +4 -4
  29. package/dist/{chunk-5EKTQY2S.js → chunk-2QSG5ZG6.js} +1 -1
  30. package/dist/{chunk-BG2AZQLI.js → chunk-2ZBY2GME.js} +1 -1
  31. package/dist/{chunk-54JZ6VEW.js → chunk-3D7VYEDP.js} +1 -1
  32. package/dist/{chunk-LTNMOEHT.js → chunk-3FJNTRAS.js} +1 -1
  33. package/dist/{chunk-HE3ZKFRC.js → chunk-3PMEHGH3.js} +1 -1
  34. package/dist/chunk-47WY2637.js +84 -0
  35. package/dist/{chunk-YUA2VDWH.js → chunk-4AZ7IG2A.js} +1 -1
  36. package/dist/{chunk-HNNVVK2O.js → chunk-4FXSDPQW.js} +1 -1
  37. package/dist/{chunk-ZXTVP4WX.js → chunk-4SXJKDHO.js} +2 -2
  38. package/dist/{chunk-6S3Z3WPF.js → chunk-4VYWTTT4.js} +2 -2
  39. package/dist/{chunk-XTUSDGAB.js → chunk-4VZRBBLF.js} +1 -1
  40. package/dist/{chunk-SAFETUCL.js → chunk-5LEO463W.js} +1 -1
  41. package/dist/{chunk-KUAFVRSR.js → chunk-5NBT5IVT.js} +1 -1
  42. package/dist/{chunk-ZFZB4CGJ.js → chunk-6DOS5CJ5.js} +1 -1
  43. package/dist/{chunk-N7Z7BQYO.js → chunk-6GH4DRKR.js} +1 -1
  44. package/dist/{chunk-RP7FW23G.js → chunk-7B7OSHPX.js} +1 -1
  45. package/dist/{chunk-NJQNHD5P.js → chunk-7HUJVIMO.js} +1 -1
  46. package/dist/{chunk-2ULZVQZV.js → chunk-7KRCBN6X.js} +1 -1
  47. package/dist/{chunk-USUFF3S6.js → chunk-7P3JGF2X.js} +1 -1
  48. package/dist/{chunk-WAI5UHW3.js → chunk-A4BDLZOD.js} +1 -1
  49. package/dist/{chunk-LUTRUSIV.js → chunk-A76UL3EN.js} +1 -1
  50. package/dist/{chunk-YXPWGIQ2.js → chunk-ASK4AZFC.js} +1 -1
  51. package/dist/{chunk-RJ4YFH7K.js → chunk-AXW3WDFO.js} +1 -1
  52. package/dist/{chunk-IVQX3AKL.js → chunk-B7K5WOOU.js} +1 -1
  53. package/dist/{chunk-P3UGM74Z.js → chunk-B7TJIUKZ.js} +1 -1
  54. package/dist/{chunk-FOP6CJAM.js → chunk-BE4FBVKY.js} +1 -1
  55. package/dist/chunk-BHSHGWBL.js +2 -0
  56. package/dist/chunk-CABRAZOL.js +5 -0
  57. package/dist/{chunk-W7PBJXLJ.js → chunk-CBLUNSF4.js} +1 -1
  58. package/dist/{chunk-5Q3W3SX7.js → chunk-CL3AMEK6.js} +1 -1
  59. package/dist/{chunk-ZDAO5D6D.js → chunk-CQKKDIKA.js} +1 -1
  60. package/dist/{chunk-2BIPFAGX.js → chunk-CRPBARFG.js} +1 -1
  61. package/dist/{chunk-WEJA3EVI.js → chunk-DEUDRSU7.js} +1 -1
  62. package/dist/{chunk-GHL2A273.js → chunk-DHWS7SLT.js} +2 -2
  63. package/dist/{chunk-NYQOYOBA.js → chunk-DJJO4IHY.js} +1 -1
  64. package/dist/{chunk-C33E5XQM.js → chunk-DLJIML73.js} +1 -1
  65. package/dist/{chunk-EV64VI66.js → chunk-DP7GPS6S.js} +1 -1
  66. package/dist/chunk-F7R6A6P5.js +4 -0
  67. package/dist/{chunk-EKOL4WCC.js → chunk-FIODM24X.js} +1 -1
  68. package/dist/{chunk-SU3QKERU.js → chunk-FQRWYXFG.js} +1 -1
  69. package/dist/{chunk-6FCPS2VT.js → chunk-FYLMTZ3J.js} +1 -1
  70. package/dist/{chunk-YHL5NA43.js → chunk-G5ZGEZCA.js} +1 -1
  71. package/dist/{chunk-AWEUKXZQ.js → chunk-GMXM4WHF.js} +1 -1
  72. package/dist/{chunk-CSCJLGIY.js → chunk-GSNGC7HI.js} +1 -1
  73. package/dist/{chunk-HXSOZWFL.js → chunk-GV5BX2IQ.js} +1 -1
  74. package/dist/{chunk-5YBKKWJA.js → chunk-HFRMJP2P.js} +1 -1
  75. package/dist/chunk-HJBORIFP.js +26 -0
  76. package/dist/{chunk-WIAZN7G4.js → chunk-HULEZ3D3.js} +1 -1
  77. package/dist/{chunk-NDKHC6KL.js → chunk-IX4FH5W6.js} +1 -1
  78. package/dist/{chunk-CKNVMB4E.js → chunk-JAO7TZBV.js} +1 -1
  79. package/dist/{chunk-LKUWEQ5M.js → chunk-JJJREAFQ.js} +1 -1
  80. package/dist/{chunk-ESHDTCSZ.js → chunk-K6BWPGBO.js} +1 -1
  81. package/dist/chunk-KRL2BDI5.js +8 -0
  82. package/dist/{chunk-ML2E3JGK.js → chunk-M3Q7IQMS.js} +1 -1
  83. package/dist/{chunk-FH6EDP77.js → chunk-M7CGNE2D.js} +4 -4
  84. package/dist/{chunk-M6SFFAAQ.js → chunk-NBXYL2JT.js} +6 -6
  85. package/dist/chunk-NGASEXVA.js +27 -0
  86. package/dist/{chunk-WXJQDLXX.js → chunk-NLSR2IFN.js} +1 -1
  87. package/dist/{chunk-H4WIA4IP.js → chunk-NP3VGFZM.js} +1 -1
  88. package/dist/{chunk-BUM367KV.js → chunk-NVRXDLJN.js} +1 -1
  89. package/dist/{chunk-SAKUG4KE.js → chunk-NYUMJDCE.js} +1 -1
  90. package/dist/chunk-O7RB4X6I.js +21 -0
  91. package/dist/{chunk-QJNQN6ND.js → chunk-OC7TJTQG.js} +1 -1
  92. package/dist/{chunk-GOF5PQ5T.js → chunk-OGJ6ZSLC.js} +1 -1
  93. package/dist/{chunk-EEFZXZTZ.js → chunk-OKBEMFAW.js} +1 -1
  94. package/dist/{chunk-CXKWVHZK.js → chunk-OKCULEBD.js} +1 -1
  95. package/dist/{chunk-XMTSHHYQ.js → chunk-OXHMUZJV.js} +1 -1
  96. package/dist/chunk-OZMYKG6E.js +6 -0
  97. package/dist/{chunk-5G22NOZK.js → chunk-QHSF2CXK.js} +1 -1
  98. package/dist/{chunk-BZCVLCMG.js → chunk-QIRZBOKA.js} +1 -1
  99. package/dist/{chunk-W3Z7AZNT.js → chunk-R4EGL7VM.js} +1 -1
  100. package/dist/{chunk-KAZGHWGK.js → chunk-S63XGGBE.js} +1 -1
  101. package/dist/{chunk-JGZWR3CR.js → chunk-SNKFWPEM.js} +2 -2
  102. package/dist/chunk-T4OJX2GZ.js +15 -0
  103. package/dist/chunk-TB2CCKL7.js +2 -0
  104. package/dist/{chunk-TI7MR3PB.js → chunk-TSW5A7W3.js} +1 -1
  105. package/dist/{chunk-UH2ZTX4E.js → chunk-TYRTD5DD.js} +1 -1
  106. package/dist/{chunk-RSNG5PBN.js → chunk-URLZULC7.js} +1 -1
  107. package/dist/{chunk-BQSLPF5M.js → chunk-VGLY4HWA.js} +1 -1
  108. package/dist/{chunk-D6566A2X.js → chunk-VUOAFV27.js} +1 -1
  109. package/dist/{chunk-WAWMIKSI.js → chunk-W4IRHQGO.js} +9 -9
  110. package/dist/{chunk-OSRRMY6M.js → chunk-W7NI6JCF.js} +1 -1
  111. package/dist/chunk-WD52ZNQY.js +2 -0
  112. package/dist/chunk-WRVDIZAI.js +6 -0
  113. package/dist/{chunk-PMOUXVUC.js → chunk-X6WB2QTT.js} +1 -1
  114. package/dist/{chunk-B4CYIZP5.js → chunk-XB7EMX6J.js} +1 -1
  115. package/dist/{chunk-KRKGZ2ZW.js → chunk-XS2LZFCH.js} +1 -1
  116. package/dist/{chunk-UEANTGQS.js → chunk-XYSFPVJX.js} +1 -1
  117. package/dist/{chunk-47OUD76M.js → chunk-Y4ODYIOP.js} +1 -1
  118. package/dist/{chunk-O5U6EAL3.js → chunk-YELGHSVH.js} +1 -1
  119. package/dist/{chunk-DF3DUGJS.js → chunk-YQ4MRF57.js} +4 -4
  120. package/dist/{chunk-NYSFEZUR.js → chunk-YSNBXUM6.js} +1 -1
  121. package/dist/{chunk-KGKJU27A.js → chunk-Z4QLCWLB.js} +1 -1
  122. package/dist/{chunk-SXX7ZE6L.js → chunk-Z6GMZOVL.js} +3 -3
  123. package/dist/{chunk-IWVA37B6.js → chunk-ZES42R57.js} +1 -1
  124. package/dist/{chunk-ETIQJIDI.js → chunk-ZMJD3CI7.js} +1 -1
  125. package/dist/{committer-C6UCDYMC.js → committer-42AFWMEX.js} +1 -1
  126. package/dist/{config-UF635MC4.js → config-KU2UICMC.js} +1 -1
  127. package/dist/{cover-cmd-5LPHIOSI.js → cover-cmd-HAOBK2IC.js} +1 -1
  128. package/dist/{credentials-3KBLEVJH.js → credentials-BEC4I5SE.js} +1 -1
  129. package/dist/{deps-bundle-WGF4YYGO.js → deps-bundle-EY5T7OH3.js} +1 -1
  130. package/dist/{deps-resolve-DVJPU4YX.js → deps-resolve-MPLFFCZZ.js} +1 -1
  131. package/dist/design-committer-2BQVZPO4.js +2 -0
  132. package/dist/dispatch-NE35HS5F.js +2 -0
  133. package/dist/{doctor-2KRK42L2.js → doctor-JBXA6WNL.js} +1 -1
  134. package/dist/{docx-convert-JMUMT5C4.js → docx-convert-BIV5T7F5.js} +1 -1
  135. package/dist/{dossier-Y6TJWFZU.js → dossier-WSWXZAPL.js} +1 -1
  136. package/dist/effective-decisions-UNE2TFVA.js +2 -0
  137. package/dist/{evidence-CDCFEYS7.js → evidence-MJV3PY2J.js} +1 -1
  138. package/dist/evolve-cmd-I4Z6IPIM.js +2 -0
  139. package/dist/explain-O3A2HZWD.js +2 -0
  140. package/dist/{explain-cmd-RMJPXD4U.js → explain-cmd-BXFR5DB6.js} +1 -1
  141. package/dist/{explain-cmd-XCRO4AS6.js → explain-cmd-IRQ2YX5L.js} +1 -1
  142. package/dist/{extract-bind-VFQWACVO.js → extract-bind-PPMY4FFA.js} +3 -3
  143. package/dist/{extract-cmd-2OFQBBJ4.js → extract-cmd-RHVLPNQB.js} +2 -2
  144. package/dist/{feeder-IOR3XRNF.js → feeder-52VBZY3R.js} +1 -1
  145. package/dist/{gaps-cmd-JIUM5YDY.js → gaps-cmd-MSDGU6OU.js} +1 -1
  146. package/dist/{generate-headless-B35UUR5A.js → generate-headless-NSK32S53.js} +2 -2
  147. package/dist/index.js +115 -115
  148. package/dist/ingest-WTPY2VLS.js +2 -0
  149. package/dist/ingest-cmd-GOPW3SNF.js +2 -0
  150. package/dist/install-BDHZVEY4.js +2 -0
  151. package/dist/{interactive-bind-OWASLPBQ.js → interactive-bind-4FNW3OYT.js} +4 -4
  152. package/dist/{lifecycle-cmd-KSMETBPP.js → lifecycle-cmd-HYNG5KH6.js} +1 -1
  153. package/dist/{list-cmd-V3HJ5K4O.js → list-cmd-Y4WEOT3E.js} +1 -1
  154. package/dist/{list-commands-SLQDF6AT.js → list-commands-CJCEW7MQ.js} +1 -1
  155. package/dist/{logical-ids-MLXAH45L.js → logical-ids-N3UZACB4.js} +1 -1
  156. package/dist/login-flow-DLG2WHSZ.js +2 -0
  157. package/dist/{maintenance-cmd-VFYGKY3X.js → maintenance-cmd-UJNH47SG.js} +1 -1
  158. package/dist/{mobile-prompts-6MGOXIKX.js → mobile-prompts-SJZVJWSB.js} +1 -1
  159. package/dist/persist-recorded-session-FWBAOQEF.js +3 -0
  160. package/dist/{phase-seed-BMOSAA74.js → phase-seed-2WI7KUYO.js} +1 -1
  161. package/dist/pipeline-B2TYZBMB.js +2 -0
  162. package/dist/prepare-target-JGVB7OKC.js +2 -0
  163. package/dist/readmodel-YDLGQDMH.js +2 -0
  164. package/dist/reconcile-cmd-6ILIXD3U.js +2 -0
  165. package/dist/{reconcile-deps-RYO67ZXY.js → reconcile-deps-GMQA6ULT.js} +2 -2
  166. package/dist/{reconcile-engine-PRH6YIAZ.js → reconcile-engine-XLLYS5ZB.js} +1 -1
  167. package/dist/{recording-banner-CH2SZ4IU.js → recording-banner-CQBXZMT3.js} +1 -1
  168. package/dist/{records-JLS63SDI.js → records-EW4PIJ5W.js} +1 -1
  169. package/dist/registry-AA5YIO5Y.js +2 -0
  170. package/dist/{replay-policy-CVQ6OJX5.js → replay-policy-A62KXE6Y.js} +1 -1
  171. package/dist/{require-project-folder-XY77JKAQ.js → require-project-folder-K3E3QIOZ.js} +1 -1
  172. package/dist/{resolve-run-intent-JFIGIF72.js → resolve-run-intent-3CENNCF3.js} +1 -1
  173. package/dist/{resolver-6VDNZ6KP.js → resolver-PSNP72H4.js} +1 -1
  174. package/dist/{revert-PRR3D4XM.js → revert-RXHWWUMQ.js} +1 -1
  175. package/dist/{review-cmd-SAGIKWEW.js → review-cmd-JUOWTME4.js} +1 -1
  176. package/dist/run-6CMGGU2W.js +2 -0
  177. package/dist/run-PZIYMD35.js +2 -0
  178. package/dist/{run-test-md-OLGWTC4I.js → run-test-md-XBM6RMCI.js} +2 -2
  179. package/dist/{sessions-cmd-VDQGRBEM.js → sessions-cmd-PGE6LP2W.js} +1 -1
  180. package/dist/{skill-installer-NT7ZT6O4.js → skill-installer-FBOPYFYS.js} +1 -1
  181. package/dist/{spawner-YQSAPZR4.js → spawner-URQ5OAY7.js} +1 -1
  182. package/dist/{structured-answers-YAVW65G4.js → structured-answers-BZWJUX22.js} +1 -1
  183. package/dist/tcg-generate-BPLQ7WJ5.js +2 -0
  184. package/dist/testmd-actions-WJS2YM7B.js +2 -0
  185. package/dist/testmd-sync-TPUBEORI.js +2 -0
  186. package/dist/token-refresh-IT4LVE2H.js +2 -0
  187. package/dist/{validate-basic-OMAFYHME.js → validate-basic-BXBHTTTO.js} +1 -1
  188. package/dist/verdicts-J5MJHUGG.js +2 -0
  189. package/dist/{version-check-FRVZSYNF.js → version-check-BGHE3LAK.js} +1 -1
  190. package/dist/{view-cmd-SXXNDZIC.js → view-cmd-XD5ENSML.js} +1 -1
  191. package/dist/{walk-session-LNFOCPJ6.js → walk-session-EYBUURRA.js} +1 -1
  192. package/dist/{with-telemetry-4ATZC6IR.js → with-telemetry-L3SO6J3L.js} +1 -1
  193. package/package.json +11 -11
  194. package/dist/EvidenceViewOffer-M2TGMSNE.js +0 -2
  195. package/dist/FolderPicker-WZTNQ5IV.js +0 -2
  196. package/dist/SingleShotApp-WBFVUZFP.js +0 -2
  197. package/dist/TestMdRunView-BEXL7TIN.js +0 -2
  198. package/dist/bridge-SXYWYZDO.js +0 -2
  199. package/dist/chat-controller-YJCNU76T.js +0 -2
  200. package/dist/chunk-724NYDMU.js +0 -27
  201. package/dist/chunk-CPGUTSUD.js +0 -6
  202. package/dist/chunk-EKCGZXZE.js +0 -2
  203. package/dist/chunk-I3OVXNBW.js +0 -7
  204. package/dist/chunk-I5KYZHJ5.js +0 -71
  205. package/dist/chunk-IPEA7ZOF.js +0 -8
  206. package/dist/chunk-SXUQBPQ6.js +0 -2
  207. package/dist/chunk-TGPI7VDR.js +0 -21
  208. package/dist/chunk-VIJUT5AR.js +0 -26
  209. package/dist/chunk-WHEWZR2C.js +0 -15
  210. package/dist/chunk-XIGTZTFP.js +0 -5
  211. package/dist/design-committer-UPC6NZUF.js +0 -2
  212. package/dist/dispatch-YTIJKX6C.js +0 -2
  213. package/dist/effective-decisions-DRM3JSR4.js +0 -2
  214. package/dist/evolve-cmd-L3JIBYP5.js +0 -2
  215. package/dist/explain-3HAZY7Q6.js +0 -2
  216. package/dist/ingest-TTUQ7UDK.js +0 -2
  217. package/dist/ingest-cmd-LAUSXSI3.js +0 -2
  218. package/dist/install-ENSOEMSX.js +0 -2
  219. package/dist/login-flow-YKQUXP75.js +0 -2
  220. package/dist/persist-recorded-session-RKG7HOEW.js +0 -3
  221. package/dist/pipeline-M25AR7RM.js +0 -2
  222. package/dist/prepare-target-UGACDQEJ.js +0 -2
  223. package/dist/readmodel-TDRFVDVI.js +0 -2
  224. package/dist/reconcile-cmd-MR2MSVZ5.js +0 -2
  225. package/dist/registry-ARR5ITIQ.js +0 -2
  226. package/dist/run-GTBYWSLW.js +0 -2
  227. package/dist/run-UETW72YU.js +0 -2
  228. package/dist/tcg-generate-D73BMKOE.js +0 -2
  229. package/dist/testmd-actions-XPYXS36F.js +0 -2
  230. package/dist/token-refresh-2XVSIFRM.js +0 -2
  231. package/dist/verdicts-KEBSV2NL.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as wn,b as me,c as It,d as $n,e as Dt,g as rt,h as it,i as Cn,j as Rn,l as Sn,m as Bt,n as In}from"./chunk-5EKTQY2S.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as yn}from"./chunk-O5U6EAL3.js";import{a as tt}from"./chunk-IWVA37B6.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as xn,b as kn,c as bn}from"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-IVQX3AKL.js";import{a as gn,b as hn,c as pn}from"./chunk-SU3QKERU.js";import"./chunk-NVGBE2DR.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-LUTRUSIV.js";import{x as r}from"./chunk-WEJA3EVI.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(hn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${bn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[kn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
2
+ import{a as wn,b as me,c as It,d as $n,e as Dt,g as rt,h as it,i as Cn,j as Rn,l as Sn,m as Bt,n as In}from"./chunk-2QSG5ZG6.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as yn}from"./chunk-YELGHSVH.js";import{a as tt}from"./chunk-ZES42R57.js";import{a as xn,b as kn,c as bn}from"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-B7K5WOOU.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as gn,b as hn,c as pn}from"./chunk-FQRWYXFG.js";import"./chunk-NVGBE2DR.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-R4EGL7VM.js";import"./chunk-JQW2QFSX.js";import"./chunk-FYLMTZ3J.js";import"./chunk-TYRTD5DD.js";import"./chunk-OXHMUZJV.js";import"./chunk-DBIBROYW.js";import"./chunk-IAHKTEET.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-A76UL3EN.js";import{x as r}from"./chunk-DEUDRSU7.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(hn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${bn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[kn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
3
3
  `)){if(f.length<=u){g.push(f);continue}let p="";for(let C of f.split(" "))p&&p.length+1+C.length>u?(g.push(p),p=C):p=p?`${p} ${C}`:C;g.push(p)}let x=Math.max(0,g.length-l);return{body:g.slice(-l).join(`
4
4
  `),hidden:x}}function Wn(t){let o={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},l={key:"keep",label:"keep the existing design",detail:"back to the list"};return t.designed==="stale"?[{...o,detail:"the use-case changed since it was designed"},l]:[l,o]}function Xi({controller:t,verb:o="extract",onCtrlC:l,chain:u=null,inspect:g=null,reconcile:x=null,autoReview:f=!1,onReviewExit:p,meta:C=null}){let[,M]=(0,m.useState)(0),[v,T]=(0,m.useState)(!1),[W,$]=(0,m.useState)(null),[I,N]=(0,m.useState)(null),L=(0,m.useRef)(null),[B,P]=(0,m.useState)(null),O=(0,m.useRef)(null),H=e=>{O.current=e,P(e)},K=e=>{L.current=e,N(e),e===null&&H(null)},re=(0,m.useRef)([]),[S,$e]=(0,m.useState)(null),z=(0,m.useRef)(null),j=e=>{z.current=e,$e(e)},[h,ce]=(0,m.useState)(null),D=(0,m.useRef)(null),w=e=>{D.current=e,ce(e)},[X,Pe]=(0,m.useState)(null),Lt=(0,m.useRef)(null),he=e=>{Lt.current=e,Pe(e)},lt=(0,m.useRef)({approved:0,rejected:0,deferred:0}),Ce=(0,m.useRef)(!1),ae=(0,m.useRef)(null),Ot=fn(),{stdout:Vn}=Ze(),Nn=Vn?.columns??80,_t=(0,m.useRef)(0),ct=(0,m.useRef)(0);(0,m.useEffect)(()=>{let e=()=>{let i=t.state.ledger;for(let c=_t.current;c<i.length;c++){let d=i[c],b=d.kind==="turn"?Tn(t.state.turns,d.turnIndex):void 0;Ot.append((0,E.jsx)(Mn,{block:d,annotations:b},`lg-${c}`))}_t.current=i.length};e();let s=t.subscribe(()=>{e();let i=t.state;L.current&&(i.pending||i.status==="pausing")&&(K(null),i.pending&&$("questions arrived \u2014 back to chat")),M(c=>c+1)});return M(i=>i+1),s},[t,Ot]);let{thinking:ue,status:de,pending:_,confirm:qe,ledger:ie,activeTurn:Pt,stream:Kn,notice:je}=t.state,qt=(Kn?.text??"").trimEnd(),jt=qt.length>0,Un=v&&(ue.liveThinking.length>0||ue.thinkingLog.length>0),Qn=Gr(ue.liveThinking||ue.thinkingLog.map(e=>e.text).join(`
5
5
  `),Nn-6,Fn),Ft=jt?qt.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-HXSOZWFL.js";import"./chunk-KUAFVRSR.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
2
+ import{a,b,c}from"./chunk-GV5BX2IQ.js";import"./chunk-5NBT5IVT.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-RP7FW23G.js";import"./chunk-KUAFVRSR.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
2
+ import{a as r}from"./chunk-7B7OSHPX.js";import"./chunk-5NBT5IVT.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P,b as g,c as f}from"./chunk-SAFETUCL.js";import"./chunk-WAI5UHW3.js";import"./chunk-5Y2G4NC7.js";import"./chunk-WEJA3EVI.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
2
+ import{a as P,b as g,c as f}from"./chunk-5LEO463W.js";import"./chunk-A4BDLZOD.js";import"./chunk-5Y2G4NC7.js";import"./chunk-DEUDRSU7.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as C,b as l,c as o}from"./chunk-LUTRUSIV.js";import{x as n}from"./chunk-WEJA3EVI.js";import{a as b}from"./chunk-HCBYKLMW.js";import{a as u,j as p}from"./chunk-C44QQJR4.js";import{a as y}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var x=a(y(),1);var e=a(b(),1);function T({model:w,authLabel:B,profile:h,env:D,defaultUrl:s,projectId:i,projectName:d,folderId:t,folderName:f,windowSize:P,chromeProfile:R,target:r,deviceName:m,osVersion:v,appLabel:g}){let V=i?d?`${d} (${i})`:i:"(none)",$=t?f?`${f} (${t})`:t:"(none)",{exit:c}=p();return(0,x.useEffect)(()=>{let S=setTimeout(()=>c(),50);return()=>clearTimeout(S)},[c]),(0,e.jsx)(u,{flexDirection:"column",children:(0,e.jsx)(C,{title:"Configuration",children:(0,e.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(o,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:B}),(0,e.jsx)(l,{label:" profile",value:h}),(0,e.jsx)(l,{label:" env",value:D}),(0,e.jsx)(o,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:s??"(none)",valueColor:s?n.orange:n.dim}),(0,e.jsx)(l,{label:" model",value:w}),(0,e.jsx)(l,{label:" window",value:P}),(0,e.jsx)(l,{label:" project",value:V}),(0,e.jsx)(l,{label:" folder",value:$}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device_name",value:m??"(not set)",valueColor:m?void 0:n.dim}),(0,e.jsx)(l,{label:" os_version",value:v??"(not set)",valueColor:v?void 0:n.dim}),(0,e.jsx)(l,{label:" app",value:g??"(not set)",valueColor:g?void 0:n.dim})]})]}),(0,e.jsx)(o,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:R,valueColor:n.dim})]})})})}export{T as ConfigView};
2
+ import{a as C,b as l,c as o}from"./chunk-A76UL3EN.js";import{x as n}from"./chunk-DEUDRSU7.js";import{a as b}from"./chunk-HCBYKLMW.js";import{a as u,j as p}from"./chunk-C44QQJR4.js";import{a as y}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var x=a(y(),1);var e=a(b(),1);function T({model:w,authLabel:B,profile:h,env:D,defaultUrl:s,projectId:i,projectName:d,folderId:t,folderName:f,windowSize:P,chromeProfile:R,target:r,deviceName:m,osVersion:v,appLabel:g}){let V=i?d?`${d} (${i})`:i:"(none)",$=t?f?`${f} (${t})`:t:"(none)",{exit:c}=p();return(0,x.useEffect)(()=>{let S=setTimeout(()=>c(),50);return()=>clearTimeout(S)},[c]),(0,e.jsx)(u,{flexDirection:"column",children:(0,e.jsx)(C,{title:"Configuration",children:(0,e.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(o,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:B}),(0,e.jsx)(l,{label:" profile",value:h}),(0,e.jsx)(l,{label:" env",value:D}),(0,e.jsx)(o,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:s??"(none)",valueColor:s?n.orange:n.dim}),(0,e.jsx)(l,{label:" model",value:w}),(0,e.jsx)(l,{label:" window",value:P}),(0,e.jsx)(l,{label:" project",value:V}),(0,e.jsx)(l,{label:" folder",value:$}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device_name",value:m??"(not set)",valueColor:m?void 0:n.dim}),(0,e.jsx)(l,{label:" os_version",value:v??"(not set)",valueColor:v?void 0:n.dim}),(0,e.jsx)(l,{label:" app",value:g??"(not set)",valueColor:g?void 0:n.dim})]})]}),(0,e.jsx)(o,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:R,valueColor:n.dim})]})})})}export{T as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-ASK4AZFC.js";import"./chunk-O7RB4X6I.js";import"./chunk-QQ5MHSSY.js";import"./chunk-5GUD3CIH.js";import"./chunk-4FXSDPQW.js";import"./chunk-YMLC55J4.js";import"./chunk-NP3VGFZM.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-KRL2BDI5.js";import"./chunk-VZ7KXRXB.js";import"./chunk-P7YZ3PU3.js";import"./chunk-R4EGL7VM.js";import"./chunk-JQW2QFSX.js";import"./chunk-FYLMTZ3J.js";import"./chunk-TYRTD5DD.js";import"./chunk-OXHMUZJV.js";import"./chunk-DBIBROYW.js";import"./chunk-IAHKTEET.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-3PMEHGH3.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-4VYWTTT4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-BE4FBVKY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-M3Q7IQMS.js";import"./chunk-YCCUBQY4.js";import"./chunk-FIODM24X.js";import"./chunk-BPMSNGXQ.js";import"./chunk-5NBT5IVT.js";import"./chunk-BE4FBVKY.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-ZFZB4CGJ.js";import"./chunk-LUTRUSIV.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
2
+ import{a}from"./chunk-6DOS5CJ5.js";import"./chunk-A76UL3EN.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-YUA2VDWH.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-4AZ7IG2A.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-NYSFEZUR.js";import"./chunk-KUAFVRSR.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
2
+ import{a,b}from"./chunk-YSNBXUM6.js";import"./chunk-5NBT5IVT.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-BQSLPF5M.js";import"./chunk-YCCUBQY4.js";import"./chunk-EKOL4WCC.js";import"./chunk-BPMSNGXQ.js";import"./chunk-KUAFVRSR.js";import"./chunk-FOP6CJAM.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
2
+ import{a,b}from"./chunk-VGLY4HWA.js";import"./chunk-YCCUBQY4.js";import"./chunk-FIODM24X.js";import"./chunk-BPMSNGXQ.js";import"./chunk-5NBT5IVT.js";import"./chunk-BE4FBVKY.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-OSRRMY6M.js";import"./chunk-S3DAAAE5.js";import"./chunk-ZFZB4CGJ.js";import"./chunk-LUTRUSIV.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
2
+ import{a,b,c}from"./chunk-W7NI6JCF.js";import"./chunk-S3DAAAE5.js";import"./chunk-6DOS5CJ5.js";import"./chunk-A76UL3EN.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-NYUMJDCE.js";import"./chunk-OC7TJTQG.js";import"./chunk-CBLUNSF4.js";import"./chunk-W4IRHQGO.js";import"./chunk-VZ7KXRXB.js";import"./chunk-TDPWFYTJ.js";import"./chunk-7KRCBN6X.js";import"./chunk-CRPBARFG.js";import"./chunk-VGLY4HWA.js";import"./chunk-M3Q7IQMS.js";import"./chunk-YCCUBQY4.js";import"./chunk-FIODM24X.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-3FJNTRAS.js";import"./chunk-TAOHYWEO.js";import"./chunk-5NBT5IVT.js";import"./chunk-Z7S3IWUX.js";import"./chunk-XB7EMX6J.js";import"./chunk-BE4FBVKY.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-NVRXDLJN.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-SXUQBPQ6.js";import"./chunk-ZFZB4CGJ.js";import"./chunk-LUTRUSIV.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
2
+ import{a,b,c,d}from"./chunk-TB2CCKL7.js";import"./chunk-6DOS5CJ5.js";import"./chunk-A76UL3EN.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{g as a}from"./chunk-GMXM4WHF.js";import"./chunk-Y4ODYIOP.js";import"./chunk-AXW3WDFO.js";import"./chunk-A4BDLZOD.js";import"./chunk-5Y2G4NC7.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-7KRCBN6X.js";import"./chunk-4VZRBBLF.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-4VYWTTT4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-BE4FBVKY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-6DOS5CJ5.js";import"./chunk-A76UL3EN.js";import"./chunk-DEUDRSU7.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-TI7MR3PB.js";import"./chunk-HNNVVK2O.js";import"./chunk-RFHMDQXZ.js";import"./chunk-FOP6CJAM.js";import"./chunk-LUTRUSIV.js";import"./chunk-WEJA3EVI.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as buildServeMap,b as renderTestrunEvidenceTable};
2
+ import{a,b}from"./chunk-TSW5A7W3.js";import"./chunk-4FXSDPQW.js";import"./chunk-RFHMDQXZ.js";import"./chunk-BE4FBVKY.js";import"./chunk-A76UL3EN.js";import"./chunk-DEUDRSU7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as buildServeMap,b as renderTestrunEvidenceTable};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as r}from"./chunk-LUTRUSIV.js";import{x as o}from"./chunk-WEJA3EVI.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as s}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var f=a(T(),1);var e=a(p(),1);function V({profile:g,env:v,authenticated:n,authMethod:h,username:c,tokenStatus:t,expiresAt:d,serverStatus:u,detail:m}){let{exit:x}=s();return(0,f.useEffect)(()=>{let B=setTimeout(()=>x(),50);return()=>clearTimeout(B)},[x]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:u==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):u==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:g}),(0,e.jsx)(r,{label:"Environment",value:v}),(0,e.jsx)(r,{label:"Method",value:h}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),d&&(0,e.jsx)(r,{label:"Expires",value:d}),m&&(0,e.jsx)(r,{label:"Detail",value:m})]})]})})})}export{V as WhoamiView};
2
+ import{a as b,b as r}from"./chunk-A76UL3EN.js";import{x as o}from"./chunk-DEUDRSU7.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as s}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var f=a(T(),1);var e=a(p(),1);function V({profile:g,env:v,authenticated:n,authMethod:h,username:c,tokenStatus:t,expiresAt:d,serverStatus:u,detail:m}){let{exit:x}=s();return(0,f.useEffect)(()=>{let B=setTimeout(()=>x(),50);return()=>clearTimeout(B)},[x]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:u==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):u==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:g}),(0,e.jsx)(r,{label:"Environment",value:v}),(0,e.jsx)(r,{label:"Method",value:h}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),d&&(0,e.jsx)(r,{label:"Expires",value:d}),m&&(0,e.jsx)(r,{label:"Detail",value:m})]})]})})})}export{V as WhoamiView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b}from"./chunk-LTNMOEHT.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-WEJA3EVI.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
2
+ import{b as a,c as b}from"./chunk-3FJNTRAS.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DEUDRSU7.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-3KBLEVJH.js"),import("./resolver-6VDNZ6KP.js"),import("./config-UF635MC4.js")]),t=new n,o=t.getActiveProfile()??"default",c=t.loadCredentials(o,e);if(typeof c?.access_token!="string")return null;let r=await new a(s(e).controllerBaseUrl,async()=>c.access_token,null).resolve();return typeof r?.username!="string"||!r.username||typeof r.access_key!="string"||!r.access_key?null:Buffer.from(`${r.username}:${r.access_key}`,"utf8").toString("base64")}catch{return null}}async function u(e={}){let n=e.env??process.env,s=await(e.resolveBase??(async()=>(await import("./spawner-YQSAPZR4.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
2
+ import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-BEC4I5SE.js"),import("./resolver-PSNP72H4.js"),import("./config-KU2UICMC.js")]),t=new n,o=t.getActiveProfile()??"default",c=t.loadCredentials(o,e);if(typeof c?.access_token!="string")return null;let r=await new a(s(e).controllerBaseUrl,async()=>c.access_token,null).resolve();return typeof r?.username!="string"||!r.username||typeof r.access_key!="string"||!r.access_key?null:Buffer.from(`${r.username}:${r.access_key}`,"utf8").toString("base64")}catch{return null}}async function u(e={}){let n=e.env??process.env,s=await(e.resolveBase??(async()=>(await import("./spawner-URQ5OAY7.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-CKNVMB4E.js";import"./chunk-ETIQJIDI.js";import"./chunk-WEJA3EVI.js";import"./chunk-UR6MHSHU.js";export{b as ensureHyperexecuteBinary,a as hyperexecuteDownloadUrl};
2
+ import{a,b}from"./chunk-JAO7TZBV.js";import"./chunk-ZMJD3CI7.js";import"./chunk-DEUDRSU7.js";import"./chunk-UR6MHSHU.js";export{b as ensureHyperexecuteBinary,a as hyperexecuteDownloadUrl};
@@ -1,12 +1,12 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as _}from"./chunk-PCVTSFIX.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-N7Z7BQYO.js";import"./chunk-KGKJU27A.js";import"./chunk-JUJ4SAGH.js";import"./chunk-WXJQDLXX.js";import"./chunk-JGZWR3CR.js";import"./chunk-5G22NOZK.js";import"./chunk-C33E5XQM.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-BZAGVBCX.js";import"./chunk-IVQX3AKL.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-NJQNHD5P.js";import"./chunk-DF3DUGJS.js";import"./chunk-2UIHS2FH.js";import"./chunk-YKTYVJBN.js";import"./chunk-EV64VI66.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import"./chunk-54JZ6VEW.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-R7QAS6LZ.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-ZDAO5D6D.js";import"./chunk-5DT7PIGB.js";import"./chunk-H4WIA4IP.js";import"./chunk-IPEA7ZOF.js";import"./chunk-NVGBE2DR.js";import{a as m}from"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-IDX3TOPY.js";import"./chunk-W3Z7AZNT.js";import"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import"./chunk-UH2ZTX4E.js";import"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-EYOCNMUM.js";import"./chunk-WEJA3EVI.js";import"./chunk-UR6MHSHU.js";import{existsSync as O}from"fs";var P=new Set(["interactive","agent","ci","override"]);function H(e){return e.mode!=null&&!P.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,phase:e.phase,allowUnreviewed:e.allowUnreviewed,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function B(e){let p=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
3
- `),2;let{makeHeadlessIO:s,agentRefusal:d}=await import("./headless-io-66RG5NN5.js");return d(s("ndjson","design"),t,r)};if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-66RG5NN5.js");return r(t("ndjson","design"),`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let T=H(e);if("error"in T)return p(T.error);let o=T;{let{validateResumeMessage:t}=await import("./headless-io-66RG5NN5.js"),r=t(o,"design");if(r)return p(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-YAVW65G4.js"),r=t(e,"design");if(r)return p(r,"STRUCTURED_FLAGS_USAGE")}if(!O(m(process.cwd())))return p("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let y=!!o.resume;if(o.useCase&&o.resume&&!e.allowUnreviewed)try{let{peekSession:t}=await import("./sessions-GIEXOCE4.js"),r=t(m(process.cwd()),o.resume);y=!!(r&&r.use_case===o.useCase)}catch{y=!1}if(o.useCase&&!y&&!e.allowUnreviewed)try{let[{openGraph:t},{designEntryCheck:r}]=await Promise.all([import("./readmodel-TDRFVDVI.js"),import("./trust-gate-EX7R2P4Y.js")]),s=r(t(m(process.cwd())),o.useCase);if(!s.ok&&(s.code==="UC_UNREVIEWED"||s.code==="UC_ARCHIVED"))if((o.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:l}=await import("readline/promises"),c=l({input:process.stdin,output:process.stderr}),f=(await c.question(`design: ${s.detail}
2
+ import{a as _}from"./chunk-2KQF6WLX.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-6GH4DRKR.js";import"./chunk-Z4QLCWLB.js";import"./chunk-NLSR2IFN.js";import"./chunk-SNKFWPEM.js";import"./chunk-QHSF2CXK.js";import"./chunk-BZAGVBCX.js";import"./chunk-DLJIML73.js";import"./chunk-BB2W35TW.js";import"./chunk-JUJ4SAGH.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-B7K5WOOU.js";import"./chunk-R7QAS6LZ.js";import"./chunk-XS2LZFCH.js";import"./chunk-BKHXPBWN.js";import"./chunk-7HUJVIMO.js";import"./chunk-YQ4MRF57.js";import"./chunk-2UIHS2FH.js";import"./chunk-N2P4MI32.js";import"./chunk-YKTYVJBN.js";import"./chunk-DP7GPS6S.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import"./chunk-3D7VYEDP.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-CQKKDIKA.js";import"./chunk-5DT7PIGB.js";import"./chunk-NP3VGFZM.js";import"./chunk-NVGBE2DR.js";import{a as m}from"./chunk-CH273NAE.js";import"./chunk-KRL2BDI5.js";import"./chunk-VZ7KXRXB.js";import"./chunk-IDX3TOPY.js";import"./chunk-R4EGL7VM.js";import"./chunk-JQW2QFSX.js";import"./chunk-FYLMTZ3J.js";import"./chunk-TYRTD5DD.js";import"./chunk-OXHMUZJV.js";import"./chunk-DBIBROYW.js";import"./chunk-IAHKTEET.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-EYOCNMUM.js";import"./chunk-DEUDRSU7.js";import"./chunk-UR6MHSHU.js";import{existsSync as O}from"fs";var P=new Set(["interactive","agent","ci","override"]);function H(e){return e.mode!=null&&!P.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,phase:e.phase,allowUnreviewed:e.allowUnreviewed,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function B(e){let p=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
3
+ `),2;let{makeHeadlessIO:s,agentRefusal:d}=await import("./headless-io-66RG5NN5.js");return d(s("ndjson","design"),t,r)};if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-66RG5NN5.js");return r(t("ndjson","design"),`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let T=H(e);if("error"in T)return p(T.error);let o=T;{let{validateResumeMessage:t}=await import("./headless-io-66RG5NN5.js"),r=t(o,"design");if(r)return p(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-BZWJUX22.js"),r=t(e,"design");if(r)return p(r,"STRUCTURED_FLAGS_USAGE")}if(!O(m(process.cwd())))return p("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let y=!!o.resume;if(o.useCase&&o.resume&&!e.allowUnreviewed)try{let{peekSession:t}=await import("./sessions-GIEXOCE4.js"),r=t(m(process.cwd()),o.resume);y=!!(r&&r.use_case===o.useCase)}catch{y=!1}if(o.useCase&&!y&&!e.allowUnreviewed)try{let[{openGraph:t},{designEntryCheck:r}]=await Promise.all([import("./readmodel-YDLGQDMH.js"),import("./trust-gate-EX7R2P4Y.js")]),s=r(t(m(process.cwd())),o.useCase);if(!s.ok&&(s.code==="UC_UNREVIEWED"||s.code==="UC_ARCHIVED"))if((o.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:l}=await import("readline/promises"),c=l({input:process.stdin,output:process.stderr}),f=(await c.question(`design: ${s.detail}
4
4
  Design against it anyway? (y/N) `)).trim().toLowerCase();if(c.close(),f!=="y"&&f!=="yes")return process.stderr.write(`aborted \u2014 approve it first: ${s.reviewCmd}
5
5
  `),2}else if(e.mode==="agent"){let{makeHeadlessIO:l}=await import("./headless-io-66RG5NN5.js"),c=l("ndjson","design");return c.event({type:"error",code:s.code,message:`design: ${s.detail}`,next:[s.reviewCmd]}),c.event({type:"done",status:"refused",exit_code:2,next:[s.reviewCmd,`kane-cli design tests --use-case ${o.useCase} --mode agent --allow-unreviewed`]}),2}else return process.stderr.write(`design: ${s.detail} (${s.reviewCmd})
6
6
  `),2}catch(t){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(t)}
7
7
  `)}let i=null,x=null;try{if(!o.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
8
8
  `),2;let t=o.mode??"interactive";if(t==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
9
- `),2;let{bindDesignInteractive:n}=await import("./interactive-bind-OWASLPBQ.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-YQSAPZR4.js"),{runAgent:s}=await import("./bridge-SXYWYZDO.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:l}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:f,resolveEncoding:D,guardedChannels:R}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:A,prepareStructuredResume:U}=await import("./structured-answers-YAVW65G4.js");i=A(f(D(t),"design"));let{runWithChannel:$}=await import("./run-channel-RGH4WIQX.js"),w=i,I=D(t)==="ndjson"?n=>$({event:g=>w.event(g)},n):n=>n(),E=n=>{w.out(n),w.event({type:"note",text:n})},{telemetryBootstrap:N,telemetryEnvName:G}=await import("./bootstrap-TNFANHSS.js"),u=N({verb:"design",mode:t,contextRoot:m(process.cwd()),env:G(),resumeSid:o.resume,write:!0,longSession:!0});x=n=>u.end(n);let a=U({opts:e,contextDir:m(process.cwd()),verb:"design"});if(a.kind==="refuse")return i.out(a.error),t==="agent"&&i.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?i.done(2,"refused"):2;let C;if(a.kind==="apply"){for(let n of a.notes)E(n);if(a.matchedQids.length>0){E(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let n of a.matchedQids)i.event({type:"panel_resolved",id:n,by:"user",via:"flag"})}a.statement&&(C=[o.message,a.statement].filter(Boolean).join(`
9
+ `),2;let{bindDesignInteractive:n}=await import("./interactive-bind-4FNW3OYT.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-URQ5OAY7.js"),{runAgent:s}=await import("./bridge-WFSSMJ57.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:l}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:f,resolveEncoding:D,guardedChannels:R}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:A,prepareStructuredResume:U}=await import("./structured-answers-BZWJUX22.js");i=A(f(D(t),"design"));let{runWithChannel:$}=await import("./run-channel-RGH4WIQX.js"),w=i,I=D(t)==="ndjson"?n=>$({event:g=>w.event(g)},n):n=>n(),E=n=>{w.out(n),w.event({type:"note",text:n})},{telemetryBootstrap:N,telemetryEnvName:G}=await import("./bootstrap-3LNHRDQH.js"),u=N({verb:"design",mode:t,contextRoot:m(process.cwd()),env:G(),resumeSid:o.resume,write:!0,longSession:!0});x=n=>u.end(n);let a=U({opts:e,contextDir:m(process.cwd()),verb:"design"});if(a.kind==="refuse")return i.out(a.error),t==="agent"&&i.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?i.done(2,"refused"):2;let C;if(a.kind==="apply"){for(let n of a.notes)E(n);if(a.matchedQids.length>0){E(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let n of a.matchedQids)i.event({type:"panel_resolved",id:n,by:"user",via:"flag"})}a.statement&&(C=[o.message,a.statement].filter(Boolean).join(`
10
10
 
11
11
  `))}let b=c();b&&E(b);let v=l(s,n=>i.out(n)),k=R(i,()=>v.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let n=t==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async h=>{let{createInterface:Y}=await import("readline/promises"),S=Y({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await S.question(`${h} [y/N] `)).trim())}finally{S.close()}}:void 0,g=await I(async()=>{let h={...await r(),...u.spawnEnv()};return _({...o,mode:t,...C!==void 0?{message:C}:{},...n?{confirmRetarget:n}:{}},{contextDir:m(process.cwd()),agent:v.agent,preflightTurn:()=>d(h),ask:async()=>[],out:k.out,emit:k.emit,progress:w.progress,isTTY:!1,auth:h,telemetry:u})});return v.interrupted()&&g!==3?(i.out("interrupted \u2014 no session saved"),await u.end({exit_code:130}),i.done(130)):(g===1&&i.out(u.supportFooter()),await u.end({exit_code:g}),i.done(g))}finally{v.dispose()}}catch(t){x&&await x({exit_code:1}).catch(()=>{});let r=t instanceof Error?t.message:String(t);i?.event({type:"error",message:`error: design failed: ${r}`});let s=i?d=>i.out(d):d=>process.stderr.write(d+`
12
12
  `);return s(`error: design failed: ${r}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&t instanceof Error&&t.stack&&s(t.stack),s('hint: the full trace is in the file named on the "trace:" line at the start of this run'),i?i.done(1):1}}export{B as designTestsCommand};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-CSCJLGIY.js";import"./chunk-4PMZ5FCD.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-WEJA3EVI.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
2
+ import{a,b}from"./chunk-GSNGC7HI.js";import"./chunk-4PMZ5FCD.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DEUDRSU7.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-VUOAFV27.js";import"./chunk-G5ZGEZCA.js";import"./chunk-7HUJVIMO.js";import"./chunk-UD7KKHPW.js";import"./chunk-DEUDRSU7.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{b as i,f as c}from"./chunk-WEJA3EVI.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{b as i,f as c}from"./chunk-DEUDRSU7.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{A as fetchChangelog,v as formatChangelog};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P,c as fe}from"./chunk-BZAGVBCX.js";import{a as L,b as ge}from"./chunk-IVQX3AKL.js";import{a as he}from"./chunk-427OQS2N.js";import{d as ue}from"./chunk-NVGBE2DR.js";import{B as ae,C as le,E as pe,e as oe,f as re,h as ce,p as A}from"./chunk-W3Z7AZNT.js";import{a as de}from"./chunk-JQW2QFSX.js";import"./chunk-6FCPS2VT.js";import{a as _,b as x}from"./chunk-UH2ZTX4E.js";import{g as ie,j as se}from"./chunk-XMTSHHYQ.js";import"./chunk-DBIBROYW.js";import{e as k,f as D,g as ne,h as H}from"./chunk-AKX4VRRR.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";var Ie=new Set(["approve","edit","reject"]);function Ae($){let{contextDir:m,graph:s,ops:me,by:f}=$,F=$.mintable??he(),j=ie(m);if(s.latestHash!==j)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(j)} \u2014 re-open and retry`}]};let U=[],y=[],Y=new Set;for(let e of me){if(s.appliedEvents.has(e.eventId)||Y.has(e.eventId)){U.push(e.eventId);continue}Y.add(e.eventId),y.push(e)}if(y.length===0)return{record:null,errors:null,applied:[],skipped:U,minted:[],staleDelta:[]};let o=[],M=[],I=[],C=[],v=[],G=[],B=[...$.judgements??[]],V=[],J=new Map,z=new Set,Q=[],T=new Set,ve=new Set(F),X=new Set;for(let e of y){if(!Ie.has(e.kind))continue;let n=e.target,t=s.resolve(n),i=t?s.tipOf(t.cid):n;X.has(i)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),X.add(i)}let R=(e,n,t)=>{let i=s.resolve(n);if(!i)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let d=s.tipOf(i.cid);return d!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:d}}),null):t},K=e=>new Set(pe(s,s.tipOf(e))),S=[],E=new Set,Z=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of y){if(e.kind!=="retract"){S.push(e);continue}let n=R("retract",e.target,e.expectedCid);if(!n)continue;let t=new Map;for(let d of K(n))for(let a of[...s.edgesFrom(d),...s.edgesInto(d)])t.set(a.ecid,a);let i;if(e.edgeEcid!==void 0){if(s.superseded.has(e.edgeEcid)){o.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(i=t.get(e.edgeEcid),!i){o.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let d=e.edgeRef;if(d.type===k.DERIVES){o.push(Z(e.target));continue}let a=(r,c)=>{let N=A(s,c);if(N)return N;let b=s.resolve(c)!==null;return o.push(b?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${d.type} ${r} '${c}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${d.type} ${r} got (unknown) for '${c}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},g=a("dst",d.dst);if(!g)continue;let l=K(g.cid),p=null;if(d.src!==void 0){let r=a("src",d.src);if(!r)continue;p=K(r.cid)}let h=[...t.values()].filter(r=>r.type===d.type&&l.has(r.dst)&&(p===null||p.has(r.src)));if(h.length===0){o.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${d.type} edge onto ${d.dst}${d.src!==void 0?` from ${d.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(h.length>1){let r=h.map(c=>`${c.type} ${s.displayNameOf(c.src)??c.src} \u2192 ${s.displayNameOf(c.dst)??c.dst} (${c.ecid})`).join("; ");o.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${h.length} live ${d.type} edges match \u2014 ${r} \u2014 add src to disambiguate`});continue}i=h[0]}else{o.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(i.type===k.DERIVES){o.push(Z(e.target));continue}if(E.has(i.ecid)){o.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${i.ecid} was retracted earlier in this turn`});continue}E.add(i.ecid),S.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:i.ecid,reason:e.reason,eventId:e.eventId})}let w=new Map;for(let e of S){if(e.kind!=="edit")continue;let n=s.resolve(e.target);if(!n||s.tipOf(n.cid)!==e.expectedCid||s.superseded.has(e.expectedCid))continue;let t=s.getNode(e.expectedCid);if(!t)continue;let i={...t.content};for(let[a,g]of Object.entries(e.edit))g!==void 0&&(i[a]=g);if(typeof i.title=="string"&&!i.title.trim()||D(t.label,i).length>0)continue;let d=_(t.label,i);d!==e.expectedCid&&w.set(e.expectedCid,d)}for(let e of S)if(e.kind==="approve"){let n=R("approve",e.target,e.expectedCid);n&&C.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let n=R("reject",e.target,e.expectedCid);if(!n)continue;if(C.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){o.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}v.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:f})}}else if(e.kind==="edit"){let n=R("edit",e.target,e.expectedCid);if(!n)continue;let t=s.getNode(n);if(!t){o.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let i={...t.content};for(let[l,p]of Object.entries(e.edit))p!==void 0&&(i[l]=p);if(typeof i.title=="string"&&!i.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let d=D(t.label,i);if(d.length>0){for(let l of d)o.push({code:l.code,detail:`edit ${e.target}: ${l.detail}`});continue}let a=_(t.label,i);if(a===n){C.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(oe(s,n,a)){o.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let g=re({graph:s,oldTip:n,newCid:a,newLabel:t.label,by:f,reason:`re-blessed onto ${a} (edited in chat)`,skipEcids:E,dstRedirect:w});if(g.errors.length>0){for(let l of g.errors)o.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${l}`});continue}M.push({cid:a,label:t.label,content:i}),I.push(...g.edges),v.push({kind:"node",old:n,new:a,reason:e.reason??"edited in chat",by:f}),v.push(...g.supersessions),C.push({id:a,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!R("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let i=A(s,t.src),d=A(s,t.dst);if(!i||!d){let[u,W]=i?["dst",t.dst]:["src",t.src],ye=s.resolve(W)!==null;o.push(ye?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${u} '${W}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${u} got (unknown) for '${W}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}let a=s.nodeLabel.get(i.cid)??"(unknown)",g=s.nodeLabel.get(d.cid)??"(unknown)";for(let u of H(t.type,a,g,t.props))o.push({code:u.code,detail:`enhance ${e.target}: ${u.detail}`});let l=x(t.type,i.cid,d.cid,t.props),p=w.get(i.cid)??i.cid,h=w.get(d.cid)??d.cid,r=x(t.type,p,h,t.props);if(s.superseded.has(l)||E.has(l)||s.superseded.has(r)){let u=s.superseded.has(l)||E.has(l)?l:r;o.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${u}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(s.edgesFrom(i.cid).some(u=>u.ecid===l)||I.some(u=>u.ecid===r))continue;let c=ce(s,t.type,i.cid,d.cid,Q);c&&o.push(c);let N=de(s,{type:t.type,src:i.cid,dst:d.cid},{pending:[],retracted:E},`enhance ${e.target}`);N&&o.push(N);let b=ne(t.type)?.cardinality;if(b==="one-live-per-src"||b==="one-live-per-src-and-dst"){let u=`${t.type}|${i.cid}`;T.has(u)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${i.cid}: two one-live edges in one turn`}),T.add(u)}if(b==="one-live-per-src-and-dst"){let u=`${t.type}|dst|${d.cid}`;T.has(u)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${d.cid}: two one-live edges in one turn (strict 1:1)`}),T.add(u)}I.push({ecid:r,type:t.type,src:p,dst:h,props:t.props}),Q.push({src:i.cid,dst:d.cid,type:t.type})}}else if(e.kind==="retract")v.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!ve.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${F.join("|")})`,data:{gate:[...F]}});continue}let n=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof n!="string"||!t){o.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}let i=s.getNode(n)?.content?.blob,d=typeof i=="string"?ue(m,i)?.toString("utf8")??"":"",a=ge(d,e.cite.turn);if(a===null){o.push({code:"BAD_ANCHOR",detail:`add: ${L(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!a.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${L(e.cite.turn)}`});continue}let g={...e.content,derived:!0},l=D(e.label,g);if(l.length>0){for(let c of l)o.push({code:c.code,detail:`add: ${c.detail}`});continue}let p=_(e.label,g),h={source_id:e.convSourceId,source_cid:n,anchor:L(e.cite.turn),quote:e.cite.quote};for(let c of H(k.DERIVES,"source",e.label,h))o.push({code:c.code,detail:`add: ${c.detail}`});M.push({cid:p,label:e.label,content:g}),I.push({ecid:x("DERIVES",n,p,h),type:k.DERIVES,src:n,dst:p,props:h}),e.rationale&&B.push({about:p,rationale:e.rationale,by:f});let r=ae(e.label,c=>z.has(c),s.names.keys());r!==null&&(z.add(r),G.push({cid:p,slug:r,by:f})),V.push({cid:p,...r!==null?{slug:r}:{}}),J.set(e.eventId,p)}if(o.length)return{record:null,errors:o};let ee=new Date().toISOString();for(let e of S){if(e.kind==="add"){let n=J.get(e.eventId);n&&P(m,{ts:ee,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:n});continue}for(let n of fe(e,{ts:ee,command:"extract-chat",by:f}))P(m,n)}let te=y.map(e=>e.eventId).sort(),Ee=se(m,{ts:new Date().toISOString(),proposal_id:null,nodes:M,edges:I,review:C,supersessions:v,...G.length>0?{names:G}:{},...B.length>0?{judgements:B}:{},event_ids:te,...$.sid?{sid:$.sid}:{},source_head_moves:{}},{expectPrev:j}),q=le(m),O=new Set;for(let e of v)if(e.kind==="node"){O.add(e.old);for(let n of q.edgesInto(e.old))O.add(n.src)}for(let e of V)O.add(e.cid);let $e=[...O].map(e=>({cid:e,state:q.stale(q.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:Ee.record,errors:null,applied:te,skipped:U,minted:V,staleDelta:$e}}export{Ae as commitChatTurn};
2
+ import{a as P,c as fe}from"./chunk-BZAGVBCX.js";import{a as L,b as ge}from"./chunk-B7K5WOOU.js";import{a as he}from"./chunk-427OQS2N.js";import{d as ue}from"./chunk-NVGBE2DR.js";import{B as ae,C as le,E as pe,e as oe,f as re,h as ce,p as A}from"./chunk-R4EGL7VM.js";import{a as de}from"./chunk-JQW2QFSX.js";import"./chunk-FYLMTZ3J.js";import{a as _,b as x}from"./chunk-TYRTD5DD.js";import{g as ie,j as se}from"./chunk-OXHMUZJV.js";import"./chunk-DBIBROYW.js";import"./chunk-IAHKTEET.js";import{e as k,f as D,g as ne,h as H}from"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";var Ie=new Set(["approve","edit","reject"]);function Ae($){let{contextDir:m,graph:s,ops:me,by:f}=$,F=$.mintable??he(),j=ie(m);if(s.latestHash!==j)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(j)} \u2014 re-open and retry`}]};let U=[],y=[],Y=new Set;for(let e of me){if(s.appliedEvents.has(e.eventId)||Y.has(e.eventId)){U.push(e.eventId);continue}Y.add(e.eventId),y.push(e)}if(y.length===0)return{record:null,errors:null,applied:[],skipped:U,minted:[],staleDelta:[]};let o=[],M=[],I=[],C=[],v=[],G=[],B=[...$.judgements??[]],V=[],J=new Map,z=new Set,Q=[],T=new Set,ve=new Set(F),X=new Set;for(let e of y){if(!Ie.has(e.kind))continue;let n=e.target,t=s.resolve(n),i=t?s.tipOf(t.cid):n;X.has(i)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),X.add(i)}let R=(e,n,t)=>{let i=s.resolve(n);if(!i)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let d=s.tipOf(i.cid);return d!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:d}}),null):t},K=e=>new Set(pe(s,s.tipOf(e))),S=[],E=new Set,Z=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of y){if(e.kind!=="retract"){S.push(e);continue}let n=R("retract",e.target,e.expectedCid);if(!n)continue;let t=new Map;for(let d of K(n))for(let a of[...s.edgesFrom(d),...s.edgesInto(d)])t.set(a.ecid,a);let i;if(e.edgeEcid!==void 0){if(s.superseded.has(e.edgeEcid)){o.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(i=t.get(e.edgeEcid),!i){o.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let d=e.edgeRef;if(d.type===k.DERIVES){o.push(Z(e.target));continue}let a=(r,c)=>{let N=A(s,c);if(N)return N;let b=s.resolve(c)!==null;return o.push(b?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${d.type} ${r} '${c}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${d.type} ${r} got (unknown) for '${c}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},g=a("dst",d.dst);if(!g)continue;let l=K(g.cid),p=null;if(d.src!==void 0){let r=a("src",d.src);if(!r)continue;p=K(r.cid)}let h=[...t.values()].filter(r=>r.type===d.type&&l.has(r.dst)&&(p===null||p.has(r.src)));if(h.length===0){o.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${d.type} edge onto ${d.dst}${d.src!==void 0?` from ${d.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(h.length>1){let r=h.map(c=>`${c.type} ${s.displayNameOf(c.src)??c.src} \u2192 ${s.displayNameOf(c.dst)??c.dst} (${c.ecid})`).join("; ");o.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${h.length} live ${d.type} edges match \u2014 ${r} \u2014 add src to disambiguate`});continue}i=h[0]}else{o.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(i.type===k.DERIVES){o.push(Z(e.target));continue}if(E.has(i.ecid)){o.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${i.ecid} was retracted earlier in this turn`});continue}E.add(i.ecid),S.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:i.ecid,reason:e.reason,eventId:e.eventId})}let w=new Map;for(let e of S){if(e.kind!=="edit")continue;let n=s.resolve(e.target);if(!n||s.tipOf(n.cid)!==e.expectedCid||s.superseded.has(e.expectedCid))continue;let t=s.getNode(e.expectedCid);if(!t)continue;let i={...t.content};for(let[a,g]of Object.entries(e.edit))g!==void 0&&(i[a]=g);if(typeof i.title=="string"&&!i.title.trim()||D(t.label,i).length>0)continue;let d=_(t.label,i);d!==e.expectedCid&&w.set(e.expectedCid,d)}for(let e of S)if(e.kind==="approve"){let n=R("approve",e.target,e.expectedCid);n&&C.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let n=R("reject",e.target,e.expectedCid);if(!n)continue;if(C.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){o.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}v.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:f})}}else if(e.kind==="edit"){let n=R("edit",e.target,e.expectedCid);if(!n)continue;let t=s.getNode(n);if(!t){o.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let i={...t.content};for(let[l,p]of Object.entries(e.edit))p!==void 0&&(i[l]=p);if(typeof i.title=="string"&&!i.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let d=D(t.label,i);if(d.length>0){for(let l of d)o.push({code:l.code,detail:`edit ${e.target}: ${l.detail}`});continue}let a=_(t.label,i);if(a===n){C.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(oe(s,n,a)){o.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let g=re({graph:s,oldTip:n,newCid:a,newLabel:t.label,by:f,reason:`re-blessed onto ${a} (edited in chat)`,skipEcids:E,dstRedirect:w});if(g.errors.length>0){for(let l of g.errors)o.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${l}`});continue}M.push({cid:a,label:t.label,content:i}),I.push(...g.edges),v.push({kind:"node",old:n,new:a,reason:e.reason??"edited in chat",by:f}),v.push(...g.supersessions),C.push({id:a,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!R("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let i=A(s,t.src),d=A(s,t.dst);if(!i||!d){let[u,W]=i?["dst",t.dst]:["src",t.src],ye=s.resolve(W)!==null;o.push(ye?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${u} '${W}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${u} got (unknown) for '${W}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}let a=s.nodeLabel.get(i.cid)??"(unknown)",g=s.nodeLabel.get(d.cid)??"(unknown)";for(let u of H(t.type,a,g,t.props))o.push({code:u.code,detail:`enhance ${e.target}: ${u.detail}`});let l=x(t.type,i.cid,d.cid,t.props),p=w.get(i.cid)??i.cid,h=w.get(d.cid)??d.cid,r=x(t.type,p,h,t.props);if(s.superseded.has(l)||E.has(l)||s.superseded.has(r)){let u=s.superseded.has(l)||E.has(l)?l:r;o.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${u}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(s.edgesFrom(i.cid).some(u=>u.ecid===l)||I.some(u=>u.ecid===r))continue;let c=ce(s,t.type,i.cid,d.cid,Q);c&&o.push(c);let N=de(s,{type:t.type,src:i.cid,dst:d.cid},{pending:[],retracted:E},`enhance ${e.target}`);N&&o.push(N);let b=ne(t.type)?.cardinality;if(b==="one-live-per-src"||b==="one-live-per-src-and-dst"){let u=`${t.type}|${i.cid}`;T.has(u)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${i.cid}: two one-live edges in one turn`}),T.add(u)}if(b==="one-live-per-src-and-dst"){let u=`${t.type}|dst|${d.cid}`;T.has(u)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${d.cid}: two one-live edges in one turn (strict 1:1)`}),T.add(u)}I.push({ecid:r,type:t.type,src:p,dst:h,props:t.props}),Q.push({src:i.cid,dst:d.cid,type:t.type})}}else if(e.kind==="retract")v.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!ve.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${F.join("|")})`,data:{gate:[...F]}});continue}let n=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof n!="string"||!t){o.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}let i=s.getNode(n)?.content?.blob,d=typeof i=="string"?ue(m,i)?.toString("utf8")??"":"",a=ge(d,e.cite.turn);if(a===null){o.push({code:"BAD_ANCHOR",detail:`add: ${L(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!a.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${L(e.cite.turn)}`});continue}let g={...e.content,derived:!0},l=D(e.label,g);if(l.length>0){for(let c of l)o.push({code:c.code,detail:`add: ${c.detail}`});continue}let p=_(e.label,g),h={source_id:e.convSourceId,source_cid:n,anchor:L(e.cite.turn),quote:e.cite.quote};for(let c of H(k.DERIVES,"source",e.label,h))o.push({code:c.code,detail:`add: ${c.detail}`});M.push({cid:p,label:e.label,content:g}),I.push({ecid:x("DERIVES",n,p,h),type:k.DERIVES,src:n,dst:p,props:h}),e.rationale&&B.push({about:p,rationale:e.rationale,by:f});let r=ae(e.label,c=>z.has(c),s.names.keys());r!==null&&(z.add(r),G.push({cid:p,slug:r,by:f})),V.push({cid:p,...r!==null?{slug:r}:{}}),J.set(e.eventId,p)}if(o.length)return{record:null,errors:o};let ee=new Date().toISOString();for(let e of S){if(e.kind==="add"){let n=J.get(e.eventId);n&&P(m,{ts:ee,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:n});continue}for(let n of fe(e,{ts:ee,command:"extract-chat",by:f}))P(m,n)}let te=y.map(e=>e.eventId).sort(),Ee=se(m,{ts:new Date().toISOString(),proposal_id:null,nodes:M,edges:I,review:C,supersessions:v,...G.length>0?{names:G}:{},...B.length>0?{judgements:B}:{},event_ids:te,...$.sid?{sid:$.sid}:{},source_head_moves:{}},{expectPrev:j}),q=le(m),O=new Set;for(let e of v)if(e.kind==="node"){O.add(e.old);for(let n of q.edgesInto(e.old))O.add(n.src)}for(let e of V)O.add(e.cid);let $e=[...O].map(e=>({cid:e,state:q.stale(q.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:Ee.record,errors:null,applied:te,skipped:U,minted:V,staleDelta:$e}}export{Ae as commitChatTurn};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-ZES42R57.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-B7K5WOOU.js";import"./chunk-NVGBE2DR.js";import"./chunk-TYRTD5DD.js";import"./chunk-OXHMUZJV.js";import"./chunk-DBIBROYW.js";import"./chunk-IAHKTEET.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-5Q3W3SX7.js";import{a as m}from"./chunk-FOP6CJAM.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-BUM367KV.js";import{a as c,b as s,h as a,w as u}from"./chunk-WEJA3EVI.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-CL3AMEK6.js";import{a as m}from"./chunk-BE4FBVKY.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-NVRXDLJN.js";import{a as c,b as s,h as a,w as u}from"./chunk-DEUDRSU7.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Je}from"./chunk-ZKSN2SJ7.js";import{a as Qe,b as ue}from"./chunk-N7Z7BQYO.js";import{a as Ve,b as Ke}from"./chunk-JUJ4SAGH.js";import{a as X,b as je,e as le,f as de,g as Fe,h as We}from"./chunk-WXJQDLXX.js";import{a as Be,c as Ue,d as He,e as me,f as ze}from"./chunk-5G22NOZK.js";import{a as Pe,b as qe,c as Ne}from"./chunk-C33E5XQM.js";import{a as Te,b as Ie,c as Oe}from"./chunk-BB2W35TW.js";import{a as Me}from"./chunk-L2TV4G56.js";import{c as Le}from"./chunk-IVQX3AKL.js";import{a as Ce,e as Ae}from"./chunk-EV64VI66.js";import{a as Ge}from"./chunk-GX3FPJUG.js";import{c as Ye}from"./chunk-ZDAO5D6D.js";import{b as ve,c as we,e as ke,f as Se,g as xe,h as ae,k as oe,l as ce}from"./chunk-H4WIA4IP.js";import{d as ye}from"./chunk-IPEA7ZOF.js";import{b as ne}from"./chunk-VZ7KXRXB.js";import{a as be,b as re}from"./chunk-IDX3TOPY.js";import{C as F}from"./chunk-W3Z7AZNT.js";import{g as Re}from"./chunk-XMTSHHYQ.js";import{a as De,e as $e,f as Ee}from"./chunk-DBIBROYW.js";import{d as V,e as Y}from"./chunk-AKX4VRRR.js";import{a as _e}from"./chunk-5EOX4MEY.js";import{mkdirSync as Rt,appendFileSync as Ct,rmdirSync as pt}from"fs";import{randomBytes as At}from"crypto";import{dirname as gt,join as he}from"path";function Xe(t,e){let n=[];for(let i of e??[]){let m=t.resolve(i.ref)?.tip??null;m!==i.cid&&n.push({ref:i.ref,pinned:i.cid,now:m})}return n}import{existsSync as pe,readFileSync as ge,readdirSync as _t}from"fs";import{join as ee}from"path";var Ze=`
2
+ import{a as Je}from"./chunk-ZKSN2SJ7.js";import{a as Qe,b as ue}from"./chunk-6GH4DRKR.js";import{a as X,b as je,e as le,f as de,g as Fe,h as We}from"./chunk-NLSR2IFN.js";import{a as Be,c as Ue,d as He,e as me,f as ze}from"./chunk-QHSF2CXK.js";import{a as Pe,b as qe,c as Ne}from"./chunk-DLJIML73.js";import{a as Te,b as Ie,c as Oe}from"./chunk-BB2W35TW.js";import{a as Ve,b as Ke}from"./chunk-JUJ4SAGH.js";import{a as Me}from"./chunk-L2TV4G56.js";import{c as Le}from"./chunk-B7K5WOOU.js";import{a as Ce,e as Ae}from"./chunk-DP7GPS6S.js";import{a as Ge}from"./chunk-GX3FPJUG.js";import{c as Ye}from"./chunk-CQKKDIKA.js";import{b as ve,c as we,e as ke,f as Se,g as xe,h as ae,k as oe,l as ce}from"./chunk-NP3VGFZM.js";import{d as ye}from"./chunk-KRL2BDI5.js";import{b as ne}from"./chunk-VZ7KXRXB.js";import{a as be,b as re}from"./chunk-IDX3TOPY.js";import{C as F}from"./chunk-R4EGL7VM.js";import{g as Re}from"./chunk-OXHMUZJV.js";import{a as De,e as $e,f as Ee}from"./chunk-DBIBROYW.js";import{d as V,e as Y}from"./chunk-AKX4VRRR.js";import{a as _e}from"./chunk-5EOX4MEY.js";import{mkdirSync as Rt,appendFileSync as Ct,rmdirSync as pt}from"fs";import{randomBytes as At}from"crypto";import{dirname as gt,join as he}from"path";function Xe(t,e){let n=[];for(let i of e??[]){let m=t.resolve(i.ref)?.tip??null;m!==i.cid&&n.push({ref:i.ref,pinned:i.cid,now:m})}return n}import{existsSync as pe,readFileSync as ge,readdirSync as _t}from"fs";import{join as ee}from"path";var Ze=`
3
3
  version: 1
4
4
  techniques:
5
5
  - id: eqp
@@ -355,9 +355,9 @@ pitfalls:
355
355
 
356
356
  `),e.initialMessage].filter(Boolean).join(`
357
357
 
358
- `)};if(!r)return e.out(`error: session ${t.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`),e.emit?.({type:"error",message:`error: session ${t.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`}),i.release(),2}let v=t.resume?void 0:t.phase,P=!1;if(v!==void 0){let{checkPhaseEntry:s,phaseEntryCmd:c,phaseLadderFor:l}=await import("./phase-seed-BMOSAA74.js");P=l(e.contextDir,n,r).length>0;let o=s(e.contextDir,n,r,v);if(!o.ok&&o.code==="UNKNOWN_PHASE")return e.out(`error: ${o.message}`),e.emit?.({type:"error",code:"UNKNOWN_PHASE",message:o.message}),i?.release(),2;if(!o.ok&&o.code==="PHASE_ORDER"){let p=t.askPhaseEntry?await t.askPhaseEntry({message:o.message,earliest:o.earliest}):"cancel";if(p==="earliest")e.out(`starting at ${o.earliest} instead (${o.missing.join(", ")} not committed yet)`),v=o.earliest;else if(p==="proceed")e.out(`note: entering at ${v} with ${o.missing.join(", ")} uncommitted \u2014 proceeding on your say-so`),e.emit?.({type:"phase_entry_override",phase:v,missing:o.missing});else{let h=(t.mode??"interactive")==="agent",T=c(r,o.earliest,h);return e.out(`error: ${o.message}`),e.emit?.({type:"error",code:"PHASE_ORDER",message:o.message,next:[{cmd:T,why:`${o.earliest} is the earliest uncommitted phase for ${r}`,title:`Start at ${o.earliest}`}]}),i?.release(),2}}}let y=!!(t.force||i?.state.force),I=!!(t.resume&&i),k=Ke(n,r,y||I||P);if(!k.ok){let s=(t.mode??"interactive")==="interactive";if(k.wall&&s&&t.askDesignEntry){let{captureForceScope:c}=await import("./design-committer-UPC6NZUF.js"),l=c(n,r).length,o=await t.askDesignEntry({wall:k.wall.kind,message:k.message,display:k.wall.display,impactPairs:l});if(o.pick==="redesign"||o.pick==="proceed"){if(!o.because.trim())return e.out("a redesign needs a reason (--because) \u2014 nothing executed"),i?.release(),2;e.out(o.pick==="redesign"?`redesigning ${k.wall.display} (${l} pair(s) superseded) \u2014 because: ${o.because.trim()}`:`proceeding against the stale design (noted) \u2014 because: ${o.because.trim()}`),t={...t,force:!0,because:t.because??o.because.trim()},y=!0}else return o.pick==="view"?(e.out(`view the existing design: kane-cli context view ${k.wall.display}`),i?.release(),0):o.pick==="refresh"?(e.out(`refresh it first: kane-cli maintain evolve ${k.wall.display}`),i?.release(),0):(e.out("nothing executed \u2014 list use-cases: kane-cli context list"),i?.release(),0)}else{e.out(`design: ${k.message}`);let c=k.wall&&t.mode==="agent"?[{cmd:`kane-cli context view ${k.wall.display}`,why:"view the existing design",title:"View the design"},...k.wall.kind==="designed-stale"?[{cmd:`kane-cli maintain evolve ${k.wall.display}`,why:"the use-case moved since the design \u2014 evolve refreshes it",title:"Evolve the design"}]:[],{cmd:`kane-cli design tests --use-case ${k.wall.display} --force --mode agent`,why:"redesign \u2014 supersedes the live scenario+test pairs",title:"Redesign"}]:void 0;return e.emit?.({type:"gate_refused",message:k.message,...c?{next:c}:{}}),i?.release(),k.code}}if(e.preflightTurn){let s=await e.preflightTurn();if(!s.ok)return e.out(s.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:s.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),i?.release(),2}let S={contextDir:e.contextDir,resolveAlias:s=>qe(s,{env:process.env,auth:e.auth}),embed:(s,c)=>Ne(s,c,{env:process.env,auth:e.auth})};e.chat?.setWorking?.("assembling context\u2026");let _=await lt(e.contextDir,r,{max:t.max,strength:t.strength,embedSearch:S});if(t.priorDesign!==void 0&&(_.prior_design=t.priorDesign),t.changeDelta!==void 0&&(_.change_delta=t.changeDelta),t.because&&(_.because=t.because),v!==void 0){let{buildPhaseSeed:s}=await import("./phase-seed-BMOSAA74.js"),c=s(e.contextDir,n,r,v);_.prior_design===void 0&&c.priorDesign!==void 0&&(_.prior_design=c.priorDesign),_.entry_phase=v,c.phaseLadder.length>0&&(_.phase_ladder=c.phaseLadder)}let N=e.now?.()??new Date,K=`${N.toISOString().replace(/[-:]/g,"").slice(0,15)}-${At(2).toString("hex")}`,D=t.mode??"interactive",L=D==="interactive"&&!!e.chat&&!e.nested,g=m?{...m.spawnConfig,mode:D}:ut(_,{session_id:t.resume??`design-${K}`,mode:D,ucCid:_.usecase.cid,readBasis:n.latestHash,topology:Ge("design")}),f={current:null};if(g.resume&&"schema"in g.resume){let s=g.resume.binding?.template_version;typeof s=="string"&&(f.current=s)}t.plan?g.chat=!1:g.chat=!0;let $=e.telemetry?.enabled?e.telemetry:void 0,u=$?_e($.ids.context_instance_id??null,"design",$.ids.session_id):he(e.contextDir,"logs",`design-${K}.log`);Rt(gt(u),{recursive:!0}),L||e.out(`trace: ${X(u)}`),e.emit?.({type:"run_start",mode:D,trace:u,use_case:r,...$?{session:$.ids.session_id}:{}});let b=(s,c,l)=>{try{Ct(u,JSON.stringify({ts:new Date().toISOString(),level:s==="error"?"error":"info",run_id:$?.ids.operation_id,...$?{user_session_id:$.ids.session_id}:{},kind:s,session_id:l,data:c})+`
359
- `)}catch{}$?.wireTrace(s,c,l)};{let s=e.out;if(s[ft]!==!0){let c=l=>{b("transcript",{line:l}),s(l)};c[ft]=!0,e.out=c}}if(t.resume&&i){m||(g.resume={agent_state:i.state.agent_state}),e.out(`resuming design session ${t.resume}`),i.state.assumed.length>0&&e.out(`note: ${i.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${t.resume} lists them`);try{let{readRecords:s}=await import("./records-JLS63SDI.js"),c=s(e.contextDir).records.filter(l=>l.sid===t.resume).map(l=>l.design_phase).filter(l=>l!=null&&typeof l.phase=="string");if(c.length>0){let l=c.map(p=>`${p.phase}${p.completeness==="partial"?" (partial)":""}`).join(" \u2192 "),o=`[kane] durable record for this session (${t.resume}) on ${r}: design phases already COMMITTED \u2014 ${l}. Those finalizes landed; do not re-send them. Continue from the next uncommitted phase, or finish if the design is complete.`;e={...e,initialMessage:[e.initialMessage,o].filter(Boolean).join(`
358
+ `)};if(!r)return e.out(`error: session ${t.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`),e.emit?.({type:"error",message:`error: session ${t.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`}),i.release(),2}let v=t.resume?void 0:t.phase,P=!1;if(v!==void 0){let{checkPhaseEntry:s,phaseEntryCmd:c,phaseLadderFor:l}=await import("./phase-seed-2WI7KUYO.js");P=l(e.contextDir,n,r).length>0;let o=s(e.contextDir,n,r,v);if(!o.ok&&o.code==="UNKNOWN_PHASE")return e.out(`error: ${o.message}`),e.emit?.({type:"error",code:"UNKNOWN_PHASE",message:o.message}),i?.release(),2;if(!o.ok&&o.code==="PHASE_ORDER"){let p=t.askPhaseEntry?await t.askPhaseEntry({message:o.message,earliest:o.earliest}):"cancel";if(p==="earliest")e.out(`starting at ${o.earliest} instead (${o.missing.join(", ")} not committed yet)`),v=o.earliest;else if(p==="proceed")e.out(`note: entering at ${v} with ${o.missing.join(", ")} uncommitted \u2014 proceeding on your say-so`),e.emit?.({type:"phase_entry_override",phase:v,missing:o.missing});else{let h=(t.mode??"interactive")==="agent",T=c(r,o.earliest,h);return e.out(`error: ${o.message}`),e.emit?.({type:"error",code:"PHASE_ORDER",message:o.message,next:[{cmd:T,why:`${o.earliest} is the earliest uncommitted phase for ${r}`,title:`Start at ${o.earliest}`}]}),i?.release(),2}}}let y=!!(t.force||i?.state.force),I=!!(t.resume&&i),k=Ke(n,r,y||I||P);if(!k.ok){let s=(t.mode??"interactive")==="interactive";if(k.wall&&s&&t.askDesignEntry){let{captureForceScope:c}=await import("./design-committer-2BQVZPO4.js"),l=c(n,r).length,o=await t.askDesignEntry({wall:k.wall.kind,message:k.message,display:k.wall.display,impactPairs:l});if(o.pick==="redesign"||o.pick==="proceed"){if(!o.because.trim())return e.out("a redesign needs a reason (--because) \u2014 nothing executed"),i?.release(),2;e.out(o.pick==="redesign"?`redesigning ${k.wall.display} (${l} pair(s) superseded) \u2014 because: ${o.because.trim()}`:`proceeding against the stale design (noted) \u2014 because: ${o.because.trim()}`),t={...t,force:!0,because:t.because??o.because.trim()},y=!0}else return o.pick==="view"?(e.out(`view the existing design: kane-cli context view ${k.wall.display}`),i?.release(),0):o.pick==="refresh"?(e.out(`refresh it first: kane-cli maintain evolve ${k.wall.display}`),i?.release(),0):(e.out("nothing executed \u2014 list use-cases: kane-cli context list"),i?.release(),0)}else{e.out(`design: ${k.message}`);let c=k.wall&&t.mode==="agent"?[{cmd:`kane-cli context view ${k.wall.display}`,why:"view the existing design",title:"View the design"},...k.wall.kind==="designed-stale"?[{cmd:`kane-cli maintain evolve ${k.wall.display}`,why:"the use-case moved since the design \u2014 evolve refreshes it",title:"Evolve the design"}]:[],{cmd:`kane-cli design tests --use-case ${k.wall.display} --force --mode agent`,why:"redesign \u2014 supersedes the live scenario+test pairs",title:"Redesign"}]:void 0;return e.emit?.({type:"gate_refused",message:k.message,...c?{next:c}:{}}),i?.release(),k.code}}if(e.preflightTurn){let s=await e.preflightTurn();if(!s.ok)return e.out(s.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:s.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),i?.release(),2}let S={contextDir:e.contextDir,resolveAlias:s=>qe(s,{env:process.env,auth:e.auth}),embed:(s,c)=>Ne(s,c,{env:process.env,auth:e.auth})};e.chat?.setWorking?.("assembling context\u2026");let _=await lt(e.contextDir,r,{max:t.max,strength:t.strength,embedSearch:S});if(t.priorDesign!==void 0&&(_.prior_design=t.priorDesign),t.changeDelta!==void 0&&(_.change_delta=t.changeDelta),t.because&&(_.because=t.because),v!==void 0){let{buildPhaseSeed:s}=await import("./phase-seed-2WI7KUYO.js"),c=s(e.contextDir,n,r,v);_.prior_design===void 0&&c.priorDesign!==void 0&&(_.prior_design=c.priorDesign),_.entry_phase=v,c.phaseLadder.length>0&&(_.phase_ladder=c.phaseLadder)}let N=e.now?.()??new Date,K=`${N.toISOString().replace(/[-:]/g,"").slice(0,15)}-${At(2).toString("hex")}`,D=t.mode??"interactive",L=D==="interactive"&&!!e.chat&&!e.nested,g=m?{...m.spawnConfig,mode:D}:ut(_,{session_id:t.resume??`design-${K}`,mode:D,ucCid:_.usecase.cid,readBasis:n.latestHash,topology:Ge("design")}),f={current:null};if(g.resume&&"schema"in g.resume){let s=g.resume.binding?.template_version;typeof s=="string"&&(f.current=s)}t.plan?g.chat=!1:g.chat=!0;let $=e.telemetry?.enabled?e.telemetry:void 0,u=$?_e($.ids.context_instance_id??null,"design",$.ids.session_id):he(e.contextDir,"logs",`design-${K}.log`);Rt(gt(u),{recursive:!0}),L||e.out(`trace: ${X(u)}`),e.emit?.({type:"run_start",mode:D,trace:u,use_case:r,...$?{session:$.ids.session_id}:{}});let b=(s,c,l)=>{try{Ct(u,JSON.stringify({ts:new Date().toISOString(),level:s==="error"?"error":"info",run_id:$?.ids.operation_id,...$?{user_session_id:$.ids.session_id}:{},kind:s,session_id:l,data:c})+`
359
+ `)}catch{}$?.wireTrace(s,c,l)};{let s=e.out;if(s[ft]!==!0){let c=l=>{b("transcript",{line:l}),s(l)};c[ft]=!0,e.out=c}}if(t.resume&&i){m||(g.resume={agent_state:i.state.agent_state}),e.out(`resuming design session ${t.resume}`),i.state.assumed.length>0&&e.out(`note: ${i.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${t.resume} lists them`);try{let{readRecords:s}=await import("./records-EW4PIJ5W.js"),c=s(e.contextDir).records.filter(l=>l.sid===t.resume).map(l=>l.design_phase).filter(l=>l!=null&&typeof l.phase=="string");if(c.length>0){let l=c.map(p=>`${p.phase}${p.completeness==="partial"?" (partial)":""}`).join(" \u2192 "),o=`[kane] durable record for this session (${t.resume}) on ${r}: design phases already COMMITTED \u2014 ${l}. Those finalizes landed; do not re-send them. Continue from the next uncommitted phase, or finish if the design is complete.`;e={...e,initialMessage:[e.initialMessage,o].filter(Boolean).join(`
360
360
 
361
361
  `)}}}catch{}t.message&&(e={...e,initialMessage:[e.initialMessage,t.message].filter(Boolean).join(`
362
362
 
363
- `)})}let w=null,R={current:n},J={detach:null},Z=()=>{let s=J.detach;J.detach=null,s&&s()},a=(s,c)=>{let l=i;if(!l)return{};let o=s.ask,p=Fe({contextDir:s.contextDir,cwd:gt(s.contextDir),handle:l,note:h=>s.chat?s.chat.note(h):s.out(h),graphSlot:c,...s.now?{now:s.now}:{}});if(s.chat?.attachIngest){let h=s.chat;J.detach=h.attachIngest(async T=>{try{l.save({ingest_registry:de(l.state.ingest_registry,T,s.now?.()??new Date)});let B=await p({id:`attach-${l.state.sid}-${(l.state.ingest_registry??[]).length}`,ref:T,purpose:null});return B.ok?(h.deferBatch({source_id:B.result.source_id,cid:B.result.cid}),{ok:!0}):{ok:!1,error:B.error.message}}catch(B){return{ok:!1,error:B instanceof Error?B.message:String(B)}}})}return{ask:async h=>{let T=await o(h);if(Array.isArray(T)){let B=T.filter(j=>{if(j.free_text==null||j.free_text.trim()==="")return!1;let ie=h.find(ht=>ht.id===j.id);return j.selected_index!=null&&ie?.options[j.selected_index]?.input===!0}).map(j=>j.free_text.trim());if(B.length>0){let j=l.state.ingest_registry;for(let ie of B)j=de(j,ie,s.now?.()??new Date);l.save({ingest_registry:j})}}return T},ingest:p}};e.nested||e.chat?.attachOnCommitted?.(s=>{R.current=s});let d="";if(e.chat&&!t.plan&&!e.nested){let s=Le({contextDir:e.contextDir,graph:F(e.contextDir),sessionStamp:g.session_id,by:e.by??{kind:"human",id:"owner"}});s.errors===null||s.errors[0]?.code==="CONV_SOURCE_EXISTS"?(d=s.sourceId,e.chat.attachConversationSource?.(d),R.current=F(e.contextDir)):e.out(`warning: notes you add in chat can't be saved to the context this session (${s.errors[0]?.detail})`)}let A=F(e.contextDir),C;if(!t.plan){let s=Ie(A,r);if(I&&s!==null&&s.live){let c=A.resolve(r);C={uc_root:Te(A,c.cid),next_gen:s.gen,expected_prev_gen:s.gen}}else{let c=Oe(A,r,{...y?{force:!0}:{},because:t.because??(y?"forced redesign (--force)":void 0)});if("error"in c)return e.out(`design: ${c.error.detail}`),e.emit?.({type:"gate_refused",message:c.error.detail,code:c.error.code}),i?.release(),2;C=c}}let G=$e(e.contextDir,g.session_id),E=null,O=()=>{try{E?.release()}catch{}};if(!t.plan)try{E=G.acquire([Ee(A,r).key],{hold:"session",verb:"design"})}catch(s){if(s instanceof De&&s.code==="UC_HELD"){let c=s.holder,l=`design: ${r} is being designed by another session${c?.alive===!1?` \u2014 that session looks stopped; resume it with kane-cli design tests --resume ${c?.owner_sid??"<session>"}`:""} \u2014 pick another use-case (kane-cli design tests) or wait for it to finish`;return e.out(l),e.emit?.({type:"error",code:"UC_HELD",message:l}),i?.release(),2}throw s}let U={contextDir:e.contextDir,rootSid:g.session_id,locks:G,probe:{batchSimilar:async()=>({hits:[],degraded:!1,probeBasis:null}),recheckLocal:()=>({hits:[],uncachedNewNodes:[]})}},M=!t.plan&&D!=="ci",H=()=>Object.fromEntries((n.resolve(r)?n.edgesInto(n.resolve(r).tip):[]).filter(s=>s.type==="DERIVES"&&typeof s.props.source_id=="string").map(s=>[String(s.props.source_id),n.heads.get(String(s.props.source_id))??null])),z=!1;M&&!i&&(z=!0,i=re(e.contextDir,{sid:g.session_id,mode:"agent",created_at:N.toISOString(),expires_at:new Date(N.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},read_basis:H(),assumed:[],corpus_cursor:{remaining:[]},conv_source:d,target_pins:n.resolve(r)?[{ref:r,cid:n.resolve(r).tip}]:[],verb:"design",use_case:r,...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},...y?{force:!0}:{},...$?{user_session_id:$.ids.session_id}:{}}));let q;if(M&&i){let{resume:s,...c}=g;Ae(e.contextDir,g.session_id,{schema:Ce,kind:"base",sid:g.session_id,verb:"design",mode:D,created_at:N.toISOString(),run_config:c,conv_source:d||i.state.conv_source||"",...r?{use_case:r}:{},...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},store_watermark:Re(e.contextDir)}),g.checkpoints=!0,t.resume&&b("resume_kind",{kind:m?m.view.pointer===null?"bare-base":m.view.pointer.at==="final"?"pause":"crash":"v1-shim"},g.session_id);let l=m?0:i.state.checkpoint?.seq??0,o=i;q=He({contextDir:e.contextDir,handle:o,seqBase:()=>l,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>H(),corpusCursor:()=>({remaining:[]}),onSoftCap:h=>e.out(h),onStat:h=>b("ckpt_stat",h,g.session_id),...e.now?{now:e.now}:{}});let p=q;q={...p,persist:h=>{let T=h.binding?.template_version;return typeof T=="string"&&T&&(f.current=T),p.persist(h)}}}!M&&!t.plan&&(g.checkpoints=!0,q={persist:s=>{let c=s.binding?.template_version;return typeof c=="string"&&c&&(f.current=c),{seq:s.seq,turn_id:s.turn_id,at:s.at,ts:new Date().toISOString(),full_seq:null}}});let Q=()=>{if(!i)return;let s=i.state.checkpoint;if(s){let c=D!=="interactive"?` --mode ${D}`:"";e.out(`session ${i.state.sid} kept its last checkpoint (seq ${s.seq}, ${s.ts}) \u2014 resume with: kane-cli design tests --resume ${i.state.sid}${c}`),i.release()}else if(z){try{i.complete()}catch{i.release()}try{pt(he(e.contextDir,"sessions"))}catch{}}else i.release();i=null},se=t.plan?Tt(e.out,e.emit,b,u):mt({templateVersion:()=>f.current,contextDir:e.contextDir,ucRef:r,by:{kind:"ai",id:"design-agent"},force:y,engine:"design@1",note:s=>e.chat?e.chat.note(s):e.out(s),commitLine:s=>e.chat?e.chat.ledger({kind:"commit",ok:!0,line:s}):e.out(s),steer:e.chat?s=>e.chat.submit(s):void 0,event:e.emit,resuming:I,...i?.state.force_scope?.length?{forceScope:i.state.force_scope}:{},onForceScope:s=>{w=s},...t.because?{because:t.because}:{},aliases:e.chat?s=>e.chat.registerAliases?.(s):void 0,onCommitted:s=>{R.current=s},protocol:U,...C?{generationTicket:C}:{},...I?{generationStamped:!0}:{}});e.chat||(b("design_budget",{max_pairs:_.budget.max_pairs??null,strength:_.budget.strength_override??null}),e.out(`designing: ${_.usecase.logical_id??r}`)),e.chat?.setWorking?.(`designing ${_.usecase.logical_id??r}\u2026`);let x;try{x=await le(g,{...e,graphSlot:R,...a(e,R),...q?{checkpoint:q}:{}},new Map,n,b,se)}catch(s){throw b("error",{message:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack:void 0},g.session_id),Q(),s}finally{e.chat?.setWorking?.(null),Z()}if(x.errorCode==="binding_mismatch"&&m){let s=await e.ask([{id:"binding-mismatch",text:"this session's saved conversation is no longer accepted by the service \u2014 start the conversation fresh (committed work is kept), or stop and keep the session?",risk:"high",rationale:"the service refused the saved conversation on the first turn after resume",options:[{label:"start fresh",detail:"continue with a fresh conversation \u2014 earlier answers may be re-asked"},{label:"stop",detail:"stop here; the session stays resumable"}],recommended_index:1,allow_free_text:!1}]);if((Array.isArray(s)?s.find(o=>o.id==="binding-mismatch"):void 0)?.selected_index!==0){let o=`resume abandoned: binding mismatch on session ${g.session_id} \u2014 the session is preserved`;return e.out(o),e.emit?.({type:"error",message:o,code:"BINDING_MISMATCH"}),i?.release(),2}b("binding_migrate",{sid:g.session_id},g.session_id);let l=g.resume&&"schema"in g.resume?{...g.resume,binding:{}}:void 0;try{x=await le({...g,...l?{resume:l}:{}},{...e,graphSlot:R,...a(e,R),...q?{checkpoint:q}:{}},new Map,n,b,se)}catch(o){throw b("error",{message:o instanceof Error?o.message:String(o),stack:o instanceof Error?o.stack:void 0},g.session_id),Q(),o}finally{e.chat?.setWorking?.(null),Z()}}if(x.highRisk)return e.out(`error: ${x.highRisk.length} high-risk decision${x.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),e.emit?.({type:"error",message:`error: high-risk question(s) in ci mode (fail-closed): ${x.highRisk.map(s=>s.id).join(", ")}`,code:"HIGH_RISK_CI"}),Q(),O(),1;if(x.paused){let s=i;s||(s=re(e.contextDir,{sid:g.session_id,mode:"agent",created_at:N.toISOString(),expires_at:new Date(N.getTime()+1440*60*1e3).toISOString(),agent_state:x.paused.agent_state,pending:{questions:[],proposals:[]},read_basis:Object.fromEntries((n.resolve(r)?n.edgesInto(n.resolve(r).tip):[]).filter(o=>o.type==="DERIVES"&&typeof o.props.source_id=="string").map(o=>[String(o.props.source_id),n.heads.get(String(o.props.source_id))??null])),assumed:[],corpus_cursor:{remaining:[]},conv_source:d,target_pins:n.resolve(r)?[{ref:r,cid:n.resolve(r).tip}]:[],verb:"design",use_case:r,...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},...y?{force:!0}:{},...$?{user_session_id:$.ids.session_id}:{}}));try{y&&!s.state.force&&s.save({force:!0}),$&&s.state.user_session_id!==$.ids.session_id&&s.save({user_session_id:$.ids.session_id}),d&&s.state.conv_source!==d&&s.save({conv_source:d});let o=e.chat?.drainHeldReceipts?.()??[];(o.length>0||(s.state.held_receipts?.length??0)>0)&&s.save({held_receipts:o}),w!==null&&s.save({force_scope:w}),Ue(s,x.paused)}catch(o){let p=s.state.checkpoint,h=`error: couldn't persist the pause for session ${s.state.sid}`+(p?` \u2014 last durable checkpoint: seq ${p.seq} @ ${p.ts}`:" \u2014 no durable checkpoint exists")+` (${o instanceof Error?o.message:String(o)})`;return e.out(h),e.emit?.({type:"error",message:h,code:"PAUSE_PERSIST_FAILED",sid:s.state.sid}),1}b("session_paused",{sid:s.state.sid},g.session_id);let c=D!=="interactive"?` --mode ${D}`:"",l=`kane-cli design tests --resume ${s.state.sid}${c}`;if(L||e.out(`paused \u2014 resume with: ${l}`),e.emit?.({type:"session_paused",sid:s.state.sid,mode:D,resume:l,expires_at:s.state.expires_at,pending_questions:x.paused.pending.questions}),L){let o=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"ctrl+c",facts:[`session ${s.state.sid} saved \u2014 designing ${_.usecase.logical_id??r}`,...s.state.expires_at?[`expires: ${s.state.expires_at}`]:[],...o!==void 0?[`credits used: ${o.toFixed(1)}`]:[]],resume:l,resumeMessage:`${l} --message "<your words>"`,tracePath:X(u)})}return O(),3}if(x.crashed&&i?.state.checkpoint){let s=i.state.checkpoint,c=D!=="interactive"?` --mode ${D}`:"",l=`kane-cli design tests --resume ${i.state.sid}${c}`;if(b("agent_crashed_resumable",{sid:i.state.sid,seq:s.seq},g.session_id),L||e.out(`agent crashed \u2014 session ${i.state.sid} is resumable at checkpoint seq ${s.seq} (at most the in-flight turn lost); resume with: ${l}`),e.emit?.({type:"session_paused",sid:i.state.sid,mode:D,resume:l,expires_at:i.state.expires_at,crashed:!0}),L){let o=e.chat?.state.credits?.total;e.onSummary?.({state:"crashed",facts:[`agent crashed \u2014 session ${i.state.sid} is resumable at checkpoint seq ${s.seq}`,"at most the in-flight turn was lost",...o!==void 0?[`credits used: ${o.toFixed(1)}`]:[]],resume:l,resumeMessage:`${l} --message "<your words>"`,tracePath:X(u)})}return i.release(),i=null,3}if(x.error)return e.out(`error: design agent failed: ${x.error}`),e.emit?.({type:"error",message:`error: design agent failed: ${x.error}`}),Q(),O(),1;if(x.proposal==null&&D!=="interactive")return e.out(`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${u})`),e.emit?.({type:"error",message:`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${u})`}),Q(),O(),1;let W=0;if(x.proposal==null)try{let{readRecords:s}=await import("./records-JLS63SDI.js"),c=t.resume??g.session_id;W=s(e.contextDir).records.filter(l=>l.sid===c).reduce((l,o)=>l+o.nodes.filter(p=>p.label!=="source").length,0)}catch{}if(x.proposal==null&&e.out(W>0?`done \u2014 ${W} item(s) committed in this session (earlier legs included); nothing new since the resume`:"done \u2014 nothing designed this session (no finalize before the session ended)"),x.assumedDefaults&&e.out(`assumed: ${x.assumedDefaults} default(s) taken while unattended`),i&&e.emit?.({type:"session_complete",sid:t.resume??g.session_id}),$?.event("ASR_SESSION_COMPLETE",{}),i?.complete(),z)try{pt(he(e.contextDir,"sessions"))}catch{}if(L){let s=e.chat.state.ledger.filter(o=>o.kind==="answer"&&o.receipt.form==="assumed").length??0,c=(x.assumedDefaults??0)+s,l=e.chat.state.credits?.total??x.creditsTotal;e.onSummary?.({state:"complete",facts:[`designed: ${_.usecase.logical_id??r}${x.proposal==null?W>0?` (${W} item(s) committed across this session)`:" (nothing committed this session)":""}`,...c>0?[`${c} assumed default(s)`]:[],...l!==void 0?[`credits used: ${l.toFixed(1)}`]:[]],tracePath:X(u)})}return t.plan||We(e.contextDir),O(),0}export{Is as a};
363
+ `)})}let w=null,R={current:n},J={detach:null},Z=()=>{let s=J.detach;J.detach=null,s&&s()},a=(s,c)=>{let l=i;if(!l)return{};let o=s.ask,p=Fe({contextDir:s.contextDir,cwd:gt(s.contextDir),handle:l,note:h=>s.chat?s.chat.note(h):s.out(h),graphSlot:c,...s.now?{now:s.now}:{}});if(s.chat?.attachIngest){let h=s.chat;J.detach=h.attachIngest(async T=>{try{l.save({ingest_registry:de(l.state.ingest_registry,T,s.now?.()??new Date)});let B=await p({id:`attach-${l.state.sid}-${(l.state.ingest_registry??[]).length}`,ref:T,purpose:null});return B.ok?(h.deferBatch({source_id:B.result.source_id,cid:B.result.cid}),{ok:!0}):{ok:!1,error:B.error.message}}catch(B){return{ok:!1,error:B instanceof Error?B.message:String(B)}}})}return{ask:async h=>{let T=await o(h);if(Array.isArray(T)){let B=T.filter(j=>{if(j.free_text==null||j.free_text.trim()==="")return!1;let ie=h.find(ht=>ht.id===j.id);return j.selected_index!=null&&ie?.options[j.selected_index]?.input===!0}).map(j=>j.free_text.trim());if(B.length>0){let j=l.state.ingest_registry;for(let ie of B)j=de(j,ie,s.now?.()??new Date);l.save({ingest_registry:j})}}return T},ingest:p}};e.nested||e.chat?.attachOnCommitted?.(s=>{R.current=s});let d="";if(e.chat&&!t.plan&&!e.nested){let s=Le({contextDir:e.contextDir,graph:F(e.contextDir),sessionStamp:g.session_id,by:e.by??{kind:"human",id:"owner"}});s.errors===null||s.errors[0]?.code==="CONV_SOURCE_EXISTS"?(d=s.sourceId,e.chat.attachConversationSource?.(d),R.current=F(e.contextDir)):e.out(`warning: notes you add in chat can't be saved to the context this session (${s.errors[0]?.detail})`)}let A=F(e.contextDir),C;if(!t.plan){let s=Ie(A,r);if(I&&s!==null&&s.live){let c=A.resolve(r);C={uc_root:Te(A,c.cid),next_gen:s.gen,expected_prev_gen:s.gen}}else{let c=Oe(A,r,{...y?{force:!0}:{},because:t.because??(y?"forced redesign (--force)":void 0)});if("error"in c)return e.out(`design: ${c.error.detail}`),e.emit?.({type:"gate_refused",message:c.error.detail,code:c.error.code}),i?.release(),2;C=c}}let G=$e(e.contextDir,g.session_id),E=null,O=()=>{try{E?.release()}catch{}};if(!t.plan)try{E=G.acquire([Ee(A,r).key],{hold:"session",verb:"design"})}catch(s){if(s instanceof De&&s.code==="UC_HELD"){let c=s.holder,l=`design: ${r} is being designed by another session${c?.alive===!1?` \u2014 that session looks stopped; resume it with kane-cli design tests --resume ${c?.owner_sid??"<session>"}`:""} \u2014 pick another use-case (kane-cli design tests) or wait for it to finish`;return e.out(l),e.emit?.({type:"error",code:"UC_HELD",message:l}),i?.release(),2}throw s}let U={contextDir:e.contextDir,rootSid:g.session_id,locks:G,probe:{batchSimilar:async()=>({hits:[],degraded:!1,probeBasis:null}),recheckLocal:()=>({hits:[],uncachedNewNodes:[]})}},M=!t.plan&&D!=="ci",H=()=>Object.fromEntries((n.resolve(r)?n.edgesInto(n.resolve(r).tip):[]).filter(s=>s.type==="DERIVES"&&typeof s.props.source_id=="string").map(s=>[String(s.props.source_id),n.heads.get(String(s.props.source_id))??null])),z=!1;M&&!i&&(z=!0,i=re(e.contextDir,{sid:g.session_id,mode:"agent",created_at:N.toISOString(),expires_at:new Date(N.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},read_basis:H(),assumed:[],corpus_cursor:{remaining:[]},conv_source:d,target_pins:n.resolve(r)?[{ref:r,cid:n.resolve(r).tip}]:[],verb:"design",use_case:r,...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},...y?{force:!0}:{},...$?{user_session_id:$.ids.session_id}:{}}));let q;if(M&&i){let{resume:s,...c}=g;Ae(e.contextDir,g.session_id,{schema:Ce,kind:"base",sid:g.session_id,verb:"design",mode:D,created_at:N.toISOString(),run_config:c,conv_source:d||i.state.conv_source||"",...r?{use_case:r}:{},...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},store_watermark:Re(e.contextDir)}),g.checkpoints=!0,t.resume&&b("resume_kind",{kind:m?m.view.pointer===null?"bare-base":m.view.pointer.at==="final"?"pause":"crash":"v1-shim"},g.session_id);let l=m?0:i.state.checkpoint?.seq??0,o=i;q=He({contextDir:e.contextDir,handle:o,seqBase:()=>l,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>H(),corpusCursor:()=>({remaining:[]}),onSoftCap:h=>e.out(h),onStat:h=>b("ckpt_stat",h,g.session_id),...e.now?{now:e.now}:{}});let p=q;q={...p,persist:h=>{let T=h.binding?.template_version;return typeof T=="string"&&T&&(f.current=T),p.persist(h)}}}!M&&!t.plan&&(g.checkpoints=!0,q={persist:s=>{let c=s.binding?.template_version;return typeof c=="string"&&c&&(f.current=c),{seq:s.seq,turn_id:s.turn_id,at:s.at,ts:new Date().toISOString(),full_seq:null}}});let Q=()=>{if(!i)return;let s=i.state.checkpoint;if(s){let c=D!=="interactive"?` --mode ${D}`:"";e.out(`session ${i.state.sid} kept its last checkpoint (seq ${s.seq}, ${s.ts}) \u2014 resume with: kane-cli design tests --resume ${i.state.sid}${c}`),i.release()}else if(z){try{i.complete()}catch{i.release()}try{pt(he(e.contextDir,"sessions"))}catch{}}else i.release();i=null},se=t.plan?Tt(e.out,e.emit,b,u):mt({templateVersion:()=>f.current,contextDir:e.contextDir,ucRef:r,by:{kind:"ai",id:"design-agent"},force:y,engine:"design@1",note:s=>e.chat?e.chat.note(s):e.out(s),commitLine:s=>e.chat?e.chat.ledger({kind:"commit",ok:!0,line:s}):e.out(s),steer:e.chat?s=>e.chat.submit(s):void 0,event:e.emit,resuming:I,...i?.state.force_scope?.length?{forceScope:i.state.force_scope}:{},onForceScope:s=>{w=s},...t.because?{because:t.because}:{},aliases:e.chat?s=>e.chat.registerAliases?.(s):void 0,onCommitted:s=>{R.current=s},protocol:U,...C?{generationTicket:C}:{},...I?{generationStamped:!0}:{}});e.chat||(b("design_budget",{max_pairs:_.budget.max_pairs??null,strength:_.budget.strength_override??null}),e.out(`designing: ${_.usecase.logical_id??r}`)),e.chat?.setWorking?.(`designing ${_.usecase.logical_id??r}\u2026`);let x;try{x=await le(g,{...e,graphSlot:R,...a(e,R),...q?{checkpoint:q}:{}},new Map,n,b,se)}catch(s){throw b("error",{message:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack:void 0},g.session_id),Q(),s}finally{e.chat?.setWorking?.(null),Z()}if(x.errorCode==="binding_mismatch"&&m){let s=await e.ask([{id:"binding-mismatch",text:"this session's saved conversation is no longer accepted by the service \u2014 start the conversation fresh (committed work is kept), or stop and keep the session?",risk:"high",rationale:"the service refused the saved conversation on the first turn after resume",options:[{label:"start fresh",detail:"continue with a fresh conversation \u2014 earlier answers may be re-asked"},{label:"stop",detail:"stop here; the session stays resumable"}],recommended_index:1,allow_free_text:!1}]);if((Array.isArray(s)?s.find(o=>o.id==="binding-mismatch"):void 0)?.selected_index!==0){let o=`resume abandoned: binding mismatch on session ${g.session_id} \u2014 the session is preserved`;return e.out(o),e.emit?.({type:"error",message:o,code:"BINDING_MISMATCH"}),i?.release(),2}b("binding_migrate",{sid:g.session_id},g.session_id);let l=g.resume&&"schema"in g.resume?{...g.resume,binding:{}}:void 0;try{x=await le({...g,...l?{resume:l}:{}},{...e,graphSlot:R,...a(e,R),...q?{checkpoint:q}:{}},new Map,n,b,se)}catch(o){throw b("error",{message:o instanceof Error?o.message:String(o),stack:o instanceof Error?o.stack:void 0},g.session_id),Q(),o}finally{e.chat?.setWorking?.(null),Z()}}if(x.highRisk)return e.out(`error: ${x.highRisk.length} high-risk decision${x.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),e.emit?.({type:"error",message:`error: high-risk question(s) in ci mode (fail-closed): ${x.highRisk.map(s=>s.id).join(", ")}`,code:"HIGH_RISK_CI"}),Q(),O(),1;if(x.paused){let s=i;s||(s=re(e.contextDir,{sid:g.session_id,mode:"agent",created_at:N.toISOString(),expires_at:new Date(N.getTime()+1440*60*1e3).toISOString(),agent_state:x.paused.agent_state,pending:{questions:[],proposals:[]},read_basis:Object.fromEntries((n.resolve(r)?n.edgesInto(n.resolve(r).tip):[]).filter(o=>o.type==="DERIVES"&&typeof o.props.source_id=="string").map(o=>[String(o.props.source_id),n.heads.get(String(o.props.source_id))??null])),assumed:[],corpus_cursor:{remaining:[]},conv_source:d,target_pins:n.resolve(r)?[{ref:r,cid:n.resolve(r).tip}]:[],verb:"design",use_case:r,...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},...y?{force:!0}:{},...$?{user_session_id:$.ids.session_id}:{}}));try{y&&!s.state.force&&s.save({force:!0}),$&&s.state.user_session_id!==$.ids.session_id&&s.save({user_session_id:$.ids.session_id}),d&&s.state.conv_source!==d&&s.save({conv_source:d});let o=e.chat?.drainHeldReceipts?.()??[];(o.length>0||(s.state.held_receipts?.length??0)>0)&&s.save({held_receipts:o}),w!==null&&s.save({force_scope:w}),Ue(s,x.paused)}catch(o){let p=s.state.checkpoint,h=`error: couldn't persist the pause for session ${s.state.sid}`+(p?` \u2014 last durable checkpoint: seq ${p.seq} @ ${p.ts}`:" \u2014 no durable checkpoint exists")+` (${o instanceof Error?o.message:String(o)})`;return e.out(h),e.emit?.({type:"error",message:h,code:"PAUSE_PERSIST_FAILED",sid:s.state.sid}),1}b("session_paused",{sid:s.state.sid},g.session_id);let c=D!=="interactive"?` --mode ${D}`:"",l=`kane-cli design tests --resume ${s.state.sid}${c}`;if(L||e.out(`paused \u2014 resume with: ${l}`),e.emit?.({type:"session_paused",sid:s.state.sid,mode:D,resume:l,expires_at:s.state.expires_at,pending_questions:x.paused.pending.questions}),L){let o=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"ctrl+c",facts:[`session ${s.state.sid} saved \u2014 designing ${_.usecase.logical_id??r}`,...s.state.expires_at?[`expires: ${s.state.expires_at}`]:[],...o!==void 0?[`credits used: ${o.toFixed(1)}`]:[]],resume:l,resumeMessage:`${l} --message "<your words>"`,tracePath:X(u)})}return O(),3}if(x.crashed&&i?.state.checkpoint){let s=i.state.checkpoint,c=D!=="interactive"?` --mode ${D}`:"",l=`kane-cli design tests --resume ${i.state.sid}${c}`;if(b("agent_crashed_resumable",{sid:i.state.sid,seq:s.seq},g.session_id),L||e.out(`agent crashed \u2014 session ${i.state.sid} is resumable at checkpoint seq ${s.seq} (at most the in-flight turn lost); resume with: ${l}`),e.emit?.({type:"session_paused",sid:i.state.sid,mode:D,resume:l,expires_at:i.state.expires_at,crashed:!0}),L){let o=e.chat?.state.credits?.total;e.onSummary?.({state:"crashed",facts:[`agent crashed \u2014 session ${i.state.sid} is resumable at checkpoint seq ${s.seq}`,"at most the in-flight turn was lost",...o!==void 0?[`credits used: ${o.toFixed(1)}`]:[]],resume:l,resumeMessage:`${l} --message "<your words>"`,tracePath:X(u)})}return i.release(),i=null,3}if(x.error)return e.out(`error: design agent failed: ${x.error}`),e.emit?.({type:"error",message:`error: design agent failed: ${x.error}`}),Q(),O(),1;if(x.proposal==null&&D!=="interactive")return e.out(`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${u})`),e.emit?.({type:"error",message:`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${u})`}),Q(),O(),1;let W=0;if(x.proposal==null)try{let{readRecords:s}=await import("./records-EW4PIJ5W.js"),c=t.resume??g.session_id;W=s(e.contextDir).records.filter(l=>l.sid===c).reduce((l,o)=>l+o.nodes.filter(p=>p.label!=="source").length,0)}catch{}if(x.proposal==null&&e.out(W>0?`done \u2014 ${W} item(s) committed in this session (earlier legs included); nothing new since the resume`:"done \u2014 nothing designed this session (no finalize before the session ended)"),x.assumedDefaults&&e.out(`assumed: ${x.assumedDefaults} default(s) taken while unattended`),i&&e.emit?.({type:"session_complete",sid:t.resume??g.session_id}),$?.event("ASR_SESSION_COMPLETE",{}),i?.complete(),z)try{pt(he(e.contextDir,"sessions"))}catch{}if(L){let s=e.chat.state.ledger.filter(o=>o.kind==="answer"&&o.receipt.form==="assumed").length??0,c=(x.assumedDefaults??0)+s,l=e.chat.state.credits?.total??x.creditsTotal;e.onSummary?.({state:"complete",facts:[`designed: ${_.usecase.logical_id??r}${x.proposal==null?W>0?` (${W} item(s) committed across this session)`:" (nothing committed this session)":""}`,...c>0?[`${c} assumed default(s)`]:[],...l!==void 0?[`credits used: ${l.toFixed(1)}`]:[]],tracePath:X(u)})}return t.plan||We(e.contextDir),O(),0}export{Is as a};