@testmuai/kane-cli 0.8.7 → 0.8.8

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 (236) hide show
  1. package/bin/kane-cli.cjs +5 -1
  2. package/dist/{ChatSurface-3PEXML4X.js → ChatSurface-LS3KF7XY.js} +1 -1
  3. package/dist/{ChromeProfilePicker-E3CZ52RH.js → ChromeProfilePicker-UIJ5ZBLY.js} +1 -1
  4. package/dist/{CliFeedbackPrompt-BEVZRLQA.js → CliFeedbackPrompt-EIQQBWDY.js} +1 -1
  5. package/dist/{CliUploadProgress-V2FLLVR6.js → CliUploadProgress-6U77ZBAX.js} +1 -1
  6. package/dist/{ConfigView-ZOGKVFQT.js → ConfigView-MVFLCF5N.js} +1 -1
  7. package/dist/EvidenceViewOffer-ANVEOXJA.js +2 -0
  8. package/dist/FolderPicker-HVI6KITN.js +2 -0
  9. package/dist/{InfoBox-4TNE7QMG.js → InfoBox-57MRRSJI.js} +1 -1
  10. package/dist/{LinksBox-TXO5X5UD.js → LinksBox-RKAEQBFS.js} +1 -1
  11. package/dist/{ProfilesView-S4YPEZEF.js → ProfilesView-RQCQFIXH.js} +1 -1
  12. package/dist/{ProjectPicker-LWFX2QT2.js → ProjectPicker-5JEEHLY3.js} +1 -1
  13. package/dist/{SaveSessionPrompt-MJTCIQIZ.js → SaveSessionPrompt-TQROE5JM.js} +1 -1
  14. package/dist/SingleShotApp-VJVY3F4H.js +2 -0
  15. package/dist/{SummaryBox-UIVK3QDR.js → SummaryBox-C4UY6R65.js} +1 -1
  16. package/dist/TestMdRunView-X3CCNYV5.js +2 -0
  17. package/dist/{TestrunEvidenceTable-GYGVNCYW.js → TestrunEvidenceTable-LY24PK3T.js} +1 -1
  18. package/dist/{WhoamiView-NRGMMLL4.js → WhoamiView-2FIHHS4G.js} +1 -1
  19. package/dist/{app-download-HTQOD3YF.js → app-download-TO672LBR.js} +1 -1
  20. package/dist/{auth-5URO2XJU.js → auth-EVXJVU72.js} +1 -1
  21. package/dist/{binary-2U4YTTFS.js → binary-Y4DKNDQH.js} +1 -1
  22. package/dist/{bind-NO4TMSHJ.js → bind-FVCVYYL3.js} +3 -3
  23. package/dist/{bootstrap-UOEW3VZM.js → bootstrap-4XBQFKWF.js} +1 -1
  24. package/dist/bridge-6DCBL3GY.js +2 -0
  25. package/dist/{changelog-7BPYLUDK.js → changelog-LAQ2VGK6.js} +1 -1
  26. package/dist/{chat-committer-GUK6IBCL.js → chat-committer-K3NOTLOU.js} +1 -1
  27. package/dist/chat-controller-YJCNU76T.js +2 -0
  28. package/dist/{chunk-YGVY63PE.js → chunk-2MQP4SSF.js} +1 -1
  29. package/dist/{chunk-OHD4CZXT.js → chunk-36ZVMJTJ.js} +1 -1
  30. package/dist/{chunk-3IM5QGVV.js → chunk-3GZ4FQ4L.js} +1 -1
  31. package/dist/{chunk-ZFRWVWUR.js → chunk-4BIJCAR4.js} +1 -1
  32. package/dist/chunk-4PMZ5FCD.js +2 -0
  33. package/dist/{chunk-C4OVX65Q.js → chunk-54JZ6VEW.js} +1 -1
  34. package/dist/{chunk-GAO6ZMCT.js → chunk-5G22NOZK.js} +1 -1
  35. package/dist/{chunk-MROHDW4W.js → chunk-5LYPSIBC.js} +1 -1
  36. package/dist/{chunk-T3DVIDBA.js → chunk-5M5BG4MT.js} +1 -1
  37. package/dist/{chunk-Z7HUW3L4.js → chunk-5YCOYFZH.js} +1 -1
  38. package/dist/{chunk-ILKSL4PI.js → chunk-6FCPS2VT.js} +1 -1
  39. package/dist/{chunk-B27X3C2E.js → chunk-6LYQ4MJH.js} +1 -1
  40. package/dist/{chunk-TKQSIKMR.js → chunk-6T3DWH56.js} +1 -1
  41. package/dist/{chunk-DSNB7EI6.js → chunk-6TVNJDSE.js} +1 -1
  42. package/dist/{chunk-VMRP44MN.js → chunk-7CXIOJB3.js} +1 -1
  43. package/dist/{chunk-NQFAZM2D.js → chunk-7RTITBZG.js} +1 -1
  44. package/dist/{chunk-P4JUY54O.js → chunk-7UYSTQMI.js} +1 -1
  45. package/dist/{chunk-HL4UXOHV.js → chunk-7YX2HUHY.js} +1 -1
  46. package/dist/chunk-AKX4VRRR.js +2 -0
  47. package/dist/{chunk-DJC6MLO4.js → chunk-AO5QH6UU.js} +1 -1
  48. package/dist/{chunk-IQBKCLLR.js → chunk-AS5UKK27.js} +1 -1
  49. package/dist/{chunk-7VAE7WXF.js → chunk-ATIX6CVS.js} +2 -2
  50. package/dist/{chunk-A66ZGHO2.js → chunk-AZ73FJRK.js} +1 -1
  51. package/dist/{chunk-F7RR24BL.js → chunk-BAKOH2BR.js} +1 -1
  52. package/dist/{chunk-HO3T5LJH.js → chunk-BRE426DP.js} +1 -1
  53. package/dist/{chunk-SZTUZZEA.js → chunk-BYOXTXLC.js} +1 -1
  54. package/dist/{chunk-46HYKID6.js → chunk-CQCV2RJK.js} +2 -2
  55. package/dist/{chunk-IJABR5SX.js → chunk-DHPBVHED.js} +1 -1
  56. package/dist/{chunk-HEWWWMUN.js → chunk-EEFZXZTZ.js} +1 -1
  57. package/dist/{chunk-F43KOMVB.js → chunk-EV64VI66.js} +1 -1
  58. package/dist/{chunk-2RO2BWCZ.js → chunk-FGRTNRBS.js} +2 -2
  59. package/dist/{chunk-QZB7CBRO.js → chunk-FL6TCYA5.js} +1 -1
  60. package/dist/{chunk-IMR64OCZ.js → chunk-GX3FPJUG.js} +1 -1
  61. package/dist/{chunk-R2JRQD4I.js → chunk-GZLQ2AR6.js} +1 -1
  62. package/dist/chunk-H4WIA4IP.js +26 -0
  63. package/dist/{chunk-76ILJPZF.js → chunk-H6YGG3GC.js} +1 -1
  64. package/dist/{chunk-YKYZKBMH.js → chunk-HJOGBE23.js} +17 -17
  65. package/dist/{chunk-ZH2ROVHE.js → chunk-HK3FFI7Y.js} +2 -2
  66. package/dist/{chunk-NM6PEYED.js → chunk-HPBI3P6I.js} +3 -3
  67. package/dist/{chunk-U35Y7SGB.js → chunk-HZDNGNO2.js} +1 -1
  68. package/dist/chunk-IPEA7ZOF.js +8 -0
  69. package/dist/{chunk-WNHLKDOT.js → chunk-IVQX3AKL.js} +1 -1
  70. package/dist/{chunk-5ZV64NAG.js → chunk-IWVA37B6.js} +1 -1
  71. package/dist/{chunk-3BY7MX3D.js → chunk-JE6OO2Q6.js} +1 -1
  72. package/dist/{chunk-3YKNJIVB.js → chunk-JPGRUMCS.js} +1 -1
  73. package/dist/{chunk-B2KXIFZD.js → chunk-JQW2QFSX.js} +1 -1
  74. package/dist/{chunk-JZ26R6UL.js → chunk-JUJ4SAGH.js} +1 -1
  75. package/dist/{chunk-UOLERTKE.js → chunk-K5DL7CZ4.js} +1 -1
  76. package/dist/{chunk-44PZPNXJ.js → chunk-K6JRFRGS.js} +1 -1
  77. package/dist/chunk-KAZGHWGK.js +5 -0
  78. package/dist/{chunk-Q4CTSXDM.js → chunk-KGKJU27A.js} +1 -1
  79. package/dist/{chunk-4EFDEDTL.js → chunk-LI5FMAUO.js} +1 -1
  80. package/dist/{chunk-UFYIQ4E3.js → chunk-LMYE3M75.js} +1 -1
  81. package/dist/{chunk-N2N5T5JN.js → chunk-LPH4TERT.js} +1 -1
  82. package/dist/{chunk-EU5ZH334.js → chunk-N5I2QYFD.js} +1 -1
  83. package/dist/chunk-N7Z7BQYO.js +3 -0
  84. package/dist/{chunk-OADHU5HL.js → chunk-NAZ36RKI.js} +1 -1
  85. package/dist/{chunk-X7R2JWOJ.js → chunk-O4IEPE3T.js} +1 -1
  86. package/dist/{chunk-SWXEBLKX.js → chunk-O5U6EAL3.js} +1 -1
  87. package/dist/chunk-OGJR5VIG.js +363 -0
  88. package/dist/{chunk-QQ67Z4IW.js → chunk-OO7LFDET.js} +1 -1
  89. package/dist/chunk-OQAN2WYO.js +26 -0
  90. package/dist/{chunk-72J4V3DA.js → chunk-P67CGWD6.js} +1 -1
  91. package/dist/{chunk-YYSWJU6H.js → chunk-PQYBIWZH.js} +1 -1
  92. package/dist/{chunk-E5C3HUIY.js → chunk-PYHWCV2V.js} +1 -1
  93. package/dist/{chunk-YDEK2FJQ.js → chunk-Q6743UUQ.js} +1 -1
  94. package/dist/{chunk-5DBK6QNS.js → chunk-QQ5MHSSY.js} +1 -1
  95. package/dist/{chunk-C765HUXU.js → chunk-QVR2PB6Y.js} +1 -1
  96. package/dist/{chunk-BISBPWN3.js → chunk-QXLX6LMJ.js} +1 -1
  97. package/dist/{chunk-E6AF53HZ.js → chunk-R4PLEH2A.js} +40 -39
  98. package/dist/{chunk-DTBKKC2R.js → chunk-RHL7KZNC.js} +1 -1
  99. package/dist/chunk-RSSOJ3L2.js +21 -0
  100. package/dist/{chunk-VHA7UNDW.js → chunk-S6M36UIV.js} +1 -1
  101. package/dist/{chunk-HHQ67JCU.js → chunk-SQWVGI3J.js} +1 -1
  102. package/dist/{chunk-6YVVTYVO.js → chunk-UDW4ZZAW.js} +7 -7
  103. package/dist/{chunk-CUM23TLF.js → chunk-UH2ZTX4E.js} +1 -1
  104. package/dist/{chunk-GYTZLUFV.js → chunk-UPHF2J5E.js} +1 -1
  105. package/dist/{chunk-C5ZIKKIB.js → chunk-UY2ES2Z6.js} +1 -1
  106. package/dist/{chunk-K7VX6YIT.js → chunk-UYLNH4SH.js} +1 -1
  107. package/dist/{chunk-HAGJA7KG.js → chunk-V5DYLGAM.js} +1 -1
  108. package/dist/{chunk-LOMPRMG3.js → chunk-VCDXUUJQ.js} +1 -1
  109. package/dist/{chunk-LRZXVDPY.js → chunk-VQVERWC3.js} +1 -1
  110. package/dist/{chunk-AJXOJF2X.js → chunk-W3Z7AZNT.js} +1 -1
  111. package/dist/{chunk-TMFFHGCT.js → chunk-WALVOFKR.js} +4 -4
  112. package/dist/{chunk-7CU5EBC6.js → chunk-WDOEMLFZ.js} +1 -1
  113. package/dist/chunk-WHEWZR2C.js +15 -0
  114. package/dist/{chunk-Z3EEMIVV.js → chunk-WIAZN7G4.js} +1 -1
  115. package/dist/{chunk-YC6HYBLN.js → chunk-WPSQYEBP.js} +2 -2
  116. package/dist/{chunk-GJ6RJVXH.js → chunk-WRIPTYSN.js} +1 -1
  117. package/dist/{chunk-BPHQNTUD.js → chunk-WYOEOJM2.js} +1 -1
  118. package/dist/{chunk-T4LAHU57.js → chunk-XFTF7OOY.js} +3 -3
  119. package/dist/{chunk-6AUSG5SB.js → chunk-XJ4TJARR.js} +1 -1
  120. package/dist/{chunk-IRPAWAK7.js → chunk-XLVH4CIZ.js} +3 -3
  121. package/dist/{chunk-HLXOYLZV.js → chunk-XMTSHHYQ.js} +1 -1
  122. package/dist/{chunk-XWKUZJCP.js → chunk-YMLC55J4.js} +1 -1
  123. package/dist/chunk-ZDAO5D6D.js +16 -0
  124. package/dist/{chunk-AUERMBX5.js → chunk-ZHKBSKCB.js} +1 -1
  125. package/dist/{chunk-XAQ3Y63J.js → chunk-ZIJLOYXX.js} +18 -18
  126. package/dist/{chunk-VOXDZS4N.js → chunk-ZKRL6HMY.js} +2 -2
  127. package/dist/{chunk-DMOZM22N.js → chunk-ZSFOANLG.js} +1 -1
  128. package/dist/{committer-JC6BIBNR.js → committer-C6UCDYMC.js} +1 -1
  129. package/dist/{config-XNDP425N.js → config-5UNFAVY6.js} +1 -1
  130. package/dist/{cover-cmd-HREOYWWD.js → cover-cmd-5LPHIOSI.js} +1 -1
  131. package/dist/{credentials-ZTBWB3LK.js → credentials-64JYS7AQ.js} +1 -1
  132. package/dist/{deps-bundle-OHCYH5KL.js → deps-bundle-5JPHXHQV.js} +1 -1
  133. package/dist/{deps-resolve-K2NX2W3K.js → deps-resolve-WFZZ22XH.js} +1 -1
  134. package/dist/descriptor-PWUUNYV7.js +2 -0
  135. package/dist/design-committer-UPC6NZUF.js +2 -0
  136. package/dist/dispatch-JLMCXOSK.js +2 -0
  137. package/dist/{doctor-XXOGVMAI.js → doctor-KJMR7NRK.js} +1 -1
  138. package/dist/{dossier-2M62K2PA.js → dossier-Y6TJWFZU.js} +1 -1
  139. package/dist/evidence-OFTY5U4X.js +2 -0
  140. package/dist/{evolve-cmd-WQB7E2B5.js → evolve-cmd-LU6LPT4F.js} +1 -1
  141. package/dist/exit-manager-ZLDO54S4.js +2 -0
  142. package/dist/{explain-AOZNHWMB.js → explain-3HAZY7Q6.js} +1 -1
  143. package/dist/{explain-cmd-7VTWRROR.js → explain-cmd-RMJPXD4U.js} +1 -1
  144. package/dist/{explain-cmd-2SCD5T6U.js → explain-cmd-XCRO4AS6.js} +1 -1
  145. package/dist/{extract-bind-3YXY7ZU2.js → extract-bind-YYIOEAYR.js} +3 -3
  146. package/dist/{extract-cmd-WGXEJ54C.js → extract-cmd-Q7OG6RY6.js} +2 -2
  147. package/dist/{feeder-GVZSWX6Q.js → feeder-IOR3XRNF.js} +1 -1
  148. package/dist/gaps-cmd-JIUM5YDY.js +3 -0
  149. package/dist/{gate-54BRAE7N.js → gate-E3BLIUEA.js} +1 -1
  150. package/dist/{generate-headless-PCNAJ2LS.js → generate-headless-NCVM643E.js} +2 -2
  151. package/dist/index.js +91 -91
  152. package/dist/ingest-TTUQ7UDK.js +2 -0
  153. package/dist/ingest-cmd-42VRDSPV.js +2 -0
  154. package/dist/install-5NMP6ZV4.js +2 -0
  155. package/dist/{interactive-bind-ZFMG2JIX.js → interactive-bind-ZDJS7PCV.js} +4 -4
  156. package/dist/{lifecycle-cmd-5FRGYY3M.js → lifecycle-cmd-KSMETBPP.js} +1 -1
  157. package/dist/{list-cmd-DD4WYJSH.js → list-cmd-V3HJ5K4O.js} +1 -1
  158. package/dist/{list-commands-64THS67Y.js → list-commands-3IKFZSGB.js} +1 -1
  159. package/dist/{logical-ids-U2OUMYCP.js → logical-ids-MLXAH45L.js} +1 -1
  160. package/dist/login-flow-UXUQ7GQT.js +2 -0
  161. package/dist/{maintenance-cmd-7V44VGL4.js → maintenance-cmd-VFYGKY3X.js} +1 -1
  162. package/dist/{mobile-prompts-RITBS32L.js → mobile-prompts-XPQSRBIW.js} +1 -1
  163. package/dist/persist-recorded-session-MFQ7JCLJ.js +3 -0
  164. package/dist/{phase-seed-ATH337WF.js → phase-seed-BMOSAA74.js} +1 -1
  165. package/dist/pipeline-2XITQU5W.js +2 -0
  166. package/dist/prepare-target-CKRWHYXS.js +2 -0
  167. package/dist/readmodel-TDRFVDVI.js +2 -0
  168. package/dist/reconcile-cmd-BKIJFVQT.js +2 -0
  169. package/dist/{reconcile-deps-XEUZHUQX.js → reconcile-deps-Y5G456WD.js} +2 -2
  170. package/dist/reconcile-engine-WDC2MEOY.js +2 -0
  171. package/dist/{recording-banner-NLS7K2RV.js → recording-banner-P3RUW62P.js} +1 -1
  172. package/dist/{records-XWF6KDQH.js → records-JLS63SDI.js} +1 -1
  173. package/dist/registry-OEY4IXB6.js +2 -0
  174. package/dist/{require-project-folder-V4F74R4A.js → require-project-folder-ZGQLWZV5.js} +1 -1
  175. package/dist/resolve-run-intent-DHZD6A4B.js +2 -0
  176. package/dist/{resolver-7EAM4A6O.js → resolver-W54NOQXY.js} +1 -1
  177. package/dist/{revert-2UCOMQ4J.js → revert-PRR3D4XM.js} +1 -1
  178. package/dist/{review-cmd-VN6VGUWJ.js → review-cmd-SAGIKWEW.js} +1 -1
  179. package/dist/run-7TZTUTTU.js +2 -0
  180. package/dist/run-BGQTRIU4.js +2 -0
  181. package/dist/{run-test-md-CPGKD3DD.js → run-test-md-WO2UDYPM.js} +2 -2
  182. package/dist/{sessions-cmd-ME7NM6ES.js → sessions-cmd-VDQGRBEM.js} +1 -1
  183. package/dist/{skill-installer-WEV2M32J.js → skill-installer-UTVUPOTD.js} +1 -1
  184. package/dist/{spawner-GG6YQB4A.js → spawner-SHCGHLQS.js} +1 -1
  185. package/dist/{structured-answers-2WOTULBQ.js → structured-answers-YAVW65G4.js} +1 -1
  186. package/dist/tcg-generate-YDNE643C.js +2 -0
  187. package/dist/testmd-actions-UCJ4ULSX.js +2 -0
  188. package/dist/token-refresh-ZNV2OSZC.js +2 -0
  189. package/dist/{validate-basic-QJL4DCKY.js → validate-basic-XEPS5I6V.js} +1 -1
  190. package/dist/verdicts-SOX22V6V.js +2 -0
  191. package/dist/{version-check-KONSQ4M3.js → version-check-LWDLMWBJ.js} +1 -1
  192. package/dist/{view-cmd-ZSMU4I4J.js → view-cmd-SXXNDZIC.js} +1 -1
  193. package/dist/{walk-session-X2N4XHLU.js → walk-session-M3OIWR5K.js} +1 -1
  194. package/dist/with-telemetry-SF5RHYQE.js +2 -0
  195. package/package.json +11 -14
  196. package/dist/EvidenceViewOffer-KWX27WNZ.js +0 -2
  197. package/dist/FolderPicker-EIKQSSF6.js +0 -2
  198. package/dist/SingleShotApp-5LCIH6DQ.js +0 -2
  199. package/dist/TestMdRunView-RE5GX5QX.js +0 -2
  200. package/dist/bridge-P2EBLXPY.js +0 -2
  201. package/dist/chat-controller-6GUUMUVP.js +0 -2
  202. package/dist/chunk-56PAQAX5.js +0 -19
  203. package/dist/chunk-7EFG27IZ.js +0 -355
  204. package/dist/chunk-E5Q5CDOX.js +0 -2
  205. package/dist/chunk-FVKLNQ4T.js +0 -26
  206. package/dist/chunk-GDB2V6QA.js +0 -21
  207. package/dist/chunk-LWZ7EIXX.js +0 -2
  208. package/dist/chunk-Q3S5EKX5.js +0 -21
  209. package/dist/chunk-UASEGQ7B.js +0 -11
  210. package/dist/chunk-WXHQYYD5.js +0 -2
  211. package/dist/chunk-YC2TFACE.js +0 -5
  212. package/dist/descriptor-OEUZZCOK.js +0 -2
  213. package/dist/design-committer-IIHKNEYF.js +0 -2
  214. package/dist/dispatch-JZWIFKRB.js +0 -2
  215. package/dist/evidence-FN2SQB6Z.js +0 -2
  216. package/dist/exit-manager-3FVBTNYR.js +0 -2
  217. package/dist/gaps-cmd-MFZ52DC7.js +0 -3
  218. package/dist/ingest-TTSDUMH5.js +0 -2
  219. package/dist/ingest-cmd-D2MD6EAK.js +0 -2
  220. package/dist/install-RHINEFR5.js +0 -2
  221. package/dist/login-flow-B5J6JXQN.js +0 -2
  222. package/dist/persist-recorded-session-Z5SCYWXR.js +0 -3
  223. package/dist/pipeline-HMFLLUZJ.js +0 -2
  224. package/dist/prepare-target-HOEFIKXN.js +0 -2
  225. package/dist/readmodel-UZETCXV6.js +0 -2
  226. package/dist/reconcile-cmd-Q7CBNPRX.js +0 -2
  227. package/dist/reconcile-engine-ES2INERY.js +0 -2
  228. package/dist/registry-E5RSXYQJ.js +0 -2
  229. package/dist/resolve-run-intent-WSOCGJUN.js +0 -2
  230. package/dist/run-45ODACZR.js +0 -2
  231. package/dist/run-ZYARNPAS.js +0 -2
  232. package/dist/tcg-generate-DASCY23M.js +0 -2
  233. package/dist/testmd-actions-X6HEL5NH.js +0 -2
  234. package/dist/token-refresh-ZTQFC3Q3.js +0 -2
  235. package/dist/verdicts-CRNN765C.js +0 -2
  236. package/dist/with-telemetry-Y6MVROKX.js +0 -2
package/bin/kane-cli.cjs CHANGED
@@ -7,7 +7,11 @@
7
7
  // would parse as ESM where `require` is undefined.)
8
8
  // Escape hatch: KANE_CLI_SYSTEM_NODE=1 forces the system node, silently.
9
9
  "use strict";
10
- var MIN_MAJOR = 20; // lockstep with package.json "engines"
10
+ // System-node fallback floor, lockstep with the tsup target. Deliberately NOT
11
+ // mirrored into package.json "engines": npm resolves a bare install to the
12
+ // newest version whose engines match the host node, so an engines floor makes
13
+ // old-node hosts silently install an old CLI instead of this one.
14
+ var MIN_MAJOR = 20;
11
15
  var path = require("path");
12
16
  var entry = path.join(__dirname, "..", "dist", "index.js");
13
17
 
@@ -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-DMOZM22N.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-SWXEBLKX.js";import{a as tt}from"./chunk-5ZV64NAG.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-WNHLKDOT.js";import{a as gn,b as hn,c as pn}from"./chunk-K7VX6YIT.js";import"./chunk-NVGBE2DR.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-AJXOJF2X.js";import"./chunk-B2KXIFZD.js";import"./chunk-ILKSL4PI.js";import"./chunk-CUM23TLF.js";import"./chunk-HLXOYLZV.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-T3DVIDBA.js";import{x as r}from"./chunk-N2N5T5JN.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-ZSFOANLG.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-UYLNH4SH.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-5M5BG4MT.js";import{x as r}from"./chunk-LPH4TERT.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-DJC6MLO4.js";import"./chunk-YDEK2FJQ.js";import"./chunk-N2N5T5JN.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-AO5QH6UU.js";import"./chunk-Q6743UUQ.js";import"./chunk-LPH4TERT.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-Z7HUW3L4.js";import"./chunk-YDEK2FJQ.js";import"./chunk-N2N5T5JN.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-5YCOYFZH.js";import"./chunk-Q6743UUQ.js";import"./chunk-LPH4TERT.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-7CU5EBC6.js";import"./chunk-GJ6RJVXH.js";import"./chunk-5Y2G4NC7.js";import"./chunk-N2N5T5JN.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-WDOEMLFZ.js";import"./chunk-WRIPTYSN.js";import"./chunk-5Y2G4NC7.js";import"./chunk-LPH4TERT.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-T3DVIDBA.js";import{x as n}from"./chunk-N2N5T5JN.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-5M5BG4MT.js";import{x as n}from"./chunk-LPH4TERT.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-LMYE3M75.js";import"./chunk-ZIJLOYXX.js";import"./chunk-QQ5MHSSY.js";import"./chunk-7RTITBZG.js";import"./chunk-5GUD3CIH.js";import"./chunk-YMLC55J4.js";import"./chunk-H4WIA4IP.js";import"./chunk-EHN5HTUD.js";import"./chunk-IPEA7ZOF.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-P7YZ3PU3.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-SQWVGI3J.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-HK3FFI7Y.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-V5DYLGAM.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-LPH4TERT.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-XJ4TJARR.js";import"./chunk-YCCUBQY4.js";import"./chunk-PYHWCV2V.js";import"./chunk-BPMSNGXQ.js";import"./chunk-Q6743UUQ.js";import"./chunk-V5DYLGAM.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-LPH4TERT.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-QZB7CBRO.js";import"./chunk-T3DVIDBA.js";import"./chunk-N2N5T5JN.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-FL6TCYA5.js";import"./chunk-5M5BG4MT.js";import"./chunk-LPH4TERT.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-YYSWJU6H.js";import"./chunk-N2N5T5JN.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-PQYBIWZH.js";import"./chunk-LPH4TERT.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-VHA7UNDW.js";import"./chunk-YDEK2FJQ.js";import"./chunk-N2N5T5JN.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-S6M36UIV.js";import"./chunk-Q6743UUQ.js";import"./chunk-LPH4TERT.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-AUERMBX5.js";import"./chunk-YCCUBQY4.js";import"./chunk-E5C3HUIY.js";import"./chunk-BPMSNGXQ.js";import"./chunk-YDEK2FJQ.js";import"./chunk-HAGJA7KG.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-N2N5T5JN.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-ZHKBSKCB.js";import"./chunk-YCCUBQY4.js";import"./chunk-PYHWCV2V.js";import"./chunk-BPMSNGXQ.js";import"./chunk-Q6743UUQ.js";import"./chunk-V5DYLGAM.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-LPH4TERT.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-BPHQNTUD.js";import"./chunk-S3DAAAE5.js";import"./chunk-QZB7CBRO.js";import"./chunk-T3DVIDBA.js";import"./chunk-N2N5T5JN.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-WYOEOJM2.js";import"./chunk-S3DAAAE5.js";import"./chunk-FL6TCYA5.js";import"./chunk-5M5BG4MT.js";import"./chunk-LPH4TERT.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-7YX2HUHY.js";import"./chunk-DHPBVHED.js";import"./chunk-4BIJCAR4.js";import"./chunk-OO7LFDET.js";import"./chunk-VZ7KXRXB.js";import"./chunk-TDPWFYTJ.js";import"./chunk-O4IEPE3T.js";import"./chunk-UY2ES2Z6.js";import"./chunk-ZHKBSKCB.js";import"./chunk-XJ4TJARR.js";import"./chunk-YCCUBQY4.js";import"./chunk-PYHWCV2V.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-6T3DWH56.js";import"./chunk-TAOHYWEO.js";import"./chunk-Q6743UUQ.js";import"./chunk-Z7S3IWUX.js";import"./chunk-GZLQ2AR6.js";import"./chunk-V5DYLGAM.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-H6YGG3GC.js";import"./chunk-LPH4TERT.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-C765HUXU.js";import"./chunk-QZB7CBRO.js";import"./chunk-T3DVIDBA.js";import"./chunk-N2N5T5JN.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-QVR2PB6Y.js";import"./chunk-FL6TCYA5.js";import"./chunk-5M5BG4MT.js";import"./chunk-LPH4TERT.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-7CXIOJB3.js";import"./chunk-UPHF2J5E.js";import"./chunk-3GZ4FQ4L.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-O4IEPE3T.js";import"./chunk-WRIPTYSN.js";import"./chunk-5Y2G4NC7.js";import"./chunk-2MQP4SSF.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-HK3FFI7Y.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-V5DYLGAM.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-FL6TCYA5.js";import"./chunk-5M5BG4MT.js";import"./chunk-LPH4TERT.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-BISBPWN3.js";import"./chunk-NQFAZM2D.js";import"./chunk-RFHMDQXZ.js";import"./chunk-HAGJA7KG.js";import"./chunk-T3DVIDBA.js";import"./chunk-N2N5T5JN.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-QXLX6LMJ.js";import"./chunk-7RTITBZG.js";import"./chunk-RFHMDQXZ.js";import"./chunk-V5DYLGAM.js";import"./chunk-5M5BG4MT.js";import"./chunk-LPH4TERT.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-T3DVIDBA.js";import{x as o}from"./chunk-N2N5T5JN.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-5M5BG4MT.js";import{x as o}from"./chunk-LPH4TERT.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-TKQSIKMR.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-N2N5T5JN.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
2
+ import{b as a,c as b}from"./chunk-6T3DWH56.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-LPH4TERT.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-ZTBWB3LK.js"),import("./resolver-7EAM4A6O.js"),import("./config-XNDP425N.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-GG6YQB4A.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-64JYS7AQ.js"),import("./resolver-W54NOQXY.js"),import("./config-5UNFAVY6.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-SHCGHLQS.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-A66ZGHO2.js";import"./chunk-MROHDW4W.js";import"./chunk-N2N5T5JN.js";import"./chunk-UR6MHSHU.js";export{b as ensureHyperexecuteBinary,a as hyperexecuteDownloadUrl};
2
+ import{a,b}from"./chunk-AZ73FJRK.js";import"./chunk-5LYPSIBC.js";import"./chunk-LPH4TERT.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-7EFG27IZ.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-LWZ7EIXX.js";import"./chunk-Q4CTSXDM.js";import"./chunk-JZ26R6UL.js";import"./chunk-6YVVTYVO.js";import"./chunk-2RO2BWCZ.js";import"./chunk-GAO6ZMCT.js";import"./chunk-OADHU5HL.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-BZAGVBCX.js";import"./chunk-WNHLKDOT.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-YC6HYBLN.js";import"./chunk-TMFFHGCT.js";import"./chunk-2UIHS2FH.js";import"./chunk-YKTYVJBN.js";import"./chunk-F43KOMVB.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-C4OVX65Q.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-R7QAS6LZ.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-UASEGQ7B.js";import"./chunk-5DT7PIGB.js";import"./chunk-GDB2V6QA.js";import"./chunk-NVGBE2DR.js";import{a as m}from"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-IDX3TOPY.js";import"./chunk-AJXOJF2X.js";import"./chunk-B2KXIFZD.js";import"./chunk-ILKSL4PI.js";import"./chunk-CUM23TLF.js";import"./chunk-HLXOYLZV.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-N2N5T5JN.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-2WOTULBQ.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-UZETCXV6.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-OGJR5VIG.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-N7Z7BQYO.js";import"./chunk-KGKJU27A.js";import"./chunk-JUJ4SAGH.js";import"./chunk-UDW4ZZAW.js";import"./chunk-FGRTNRBS.js";import"./chunk-5G22NOZK.js";import"./chunk-NAZ36RKI.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-WPSQYEBP.js";import"./chunk-WALVOFKR.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-LPH4TERT.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}
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-ZFMG2JIX.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-GG6YQB4A.js"),{runAgent:s}=await import("./bridge-P2EBLXPY.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-2WOTULBQ.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-UOEW3VZM.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-ZDJS7PCV.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-SHCGHLQS.js"),{runAgent:s}=await import("./bridge-6DCBL3GY.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-4XBQFKWF.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-4EFDEDTL.js";import"./chunk-E5Q5CDOX.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-N2N5T5JN.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
2
+ import{a,b}from"./chunk-LI5FMAUO.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-LPH4TERT.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-BYOXTXLC.js";import"./chunk-K6JRFRGS.js";import"./chunk-WPSQYEBP.js";import"./chunk-UD7KKHPW.js";import"./chunk-LPH4TERT.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-N2N5T5JN.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-LPH4TERT.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-WNHLKDOT.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-AJXOJF2X.js";import{a as de}from"./chunk-B2KXIFZD.js";import"./chunk-ILKSL4PI.js";import{a as _,b as x}from"./chunk-CUM23TLF.js";import{g as ie,j as se}from"./chunk-HLXOYLZV.js";import"./chunk-DBIBROYW.js";import{e as k,f as D,g as ne,h as H}from"./chunk-WXHQYYD5.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-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};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-IWVA37B6.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-IVQX3AKL.js";import"./chunk-NVGBE2DR.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-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-ZH2ROVHE.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as Xe}from"child_process";import{closeSync as ze,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as z,join as A}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as _}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=_(this.deps.home,".testmuai","kaneai","mobile"),r=_(e,"android-sdk");return{root:r,emulatorDir:_(r,"emulator"),systemImageDir:_(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:_(e,"avd"),manifest:_(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(_(e,"platforms"),{recursive:!0}),await de(_(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(_(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(_(e.systemImageDir,"system.img"))}}},ue;function F(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,X=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
2
+ import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-HK3FFI7Y.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as Xe}from"child_process";import{closeSync as ze,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as z,join as A}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as _}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=_(this.deps.home,".testmuai","kaneai","mobile"),r=_(e,"android-sdk");return{root:r,emulatorDir:_(r,"emulator"),systemImageDir:_(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:_(e,"avd"),manifest:_(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(_(e,"platforms"),{recursive:!0}),await de(_(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(_(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(_(e.systemImageDir,"system.img"))}}},ue;function F(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,X=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
3
3
  `)){let o=r.trim();if(!o||o.startsWith("*"))continue;let u=o.toLowerCase();if(u.startsWith("list of devices")||u.startsWith("adb server"))continue;let g=o.split(/\s+/),f=g[0],v=g[1];if(!f||!v||!f.startsWith("emulator-"))continue;let b=ot(g.slice(2)),S=b.model?b.model.replace(/_/g," "):void 0;e.push({platform:G,kind:"emulator",id:f,displayName:S??f,state:st[v]??"offline"})}return e}function me(t){let e=[];for(let r of t.split(`
4
4
  `)){let o=r.trim();o&&/^[A-Za-z0-9._-]+$/.test(o)&&(e.includes(o)||e.push(o))}return e}function dt(t){for(let e of t.split(`
5
5
  `)){let r=e.trim();if(!(!r||r==="OK"))return r}}function lt(t){let e=/^Version\s+(\S+)/m.exec(t);return e?.[1]?e[1].split("-")[0]:/Android Debug Bridge version\s+(\S+)/.exec(t)?.[1]}function ut(t){let e=[];for(let r of t.split(`
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as o,b as i}from"./chunk-4EFDEDTL.js";import{resolve as n}from"path";async function w(c,s,r={}){let e=i({verb:c,mode:"cli",contextRoot:n(process.cwd(),".context"),env:o(),write:r.write});try{let t=await s(e);return r.write&&t===0&&await e.lateBindContext(n(process.cwd(),".context")),t===1&&process.stderr.write(e.supportFooter()+`
2
+ import{a as o,b as i}from"./chunk-LI5FMAUO.js";import{resolve as n}from"path";async function w(c,s,r={}){let e=i({verb:c,mode:"cli",contextRoot:n(process.cwd(),".context"),env:o(),write:r.write});try{let t=await s(e);return r.write&&t===0&&await e.lateBindContext(n(process.cwd(),".context")),t===1&&process.stderr.write(e.supportFooter()+`
3
3
  `),await e.end({exit_code:t}),t}catch(t){throw e.error("cli_crash"),process.stderr.write(e.supportFooter()+`
4
4
  `),await e.end({exit_code:1}),t}}export{w as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as R}from"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-X7R2JWOJ.js";import{d as S}from"./chunk-YGVY63PE.js";import{a as y}from"./chunk-MMBBQ4OZ.js";import{a as p}from"./chunk-HAGJA7KG.js";import{d as g,i as E}from"./chunk-N2N5T5JN.js";import{spawn as M,execSync as h}from"child_process";import{appendFileSync as b,existsSync as m,mkdirSync as C}from"fs";import{homedir as L}from"os";import{join as V,resolve as s,dirname as v,delimiter as T}from"path";import{fileURLToPath as U}from"url";import{createInterface as I}from"readline";async function*A(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function O(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function w(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function N(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(U(import.meta.url));function k(){for(let e of["python3","python"])try{return h(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function D(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(m(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(m(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(m(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(m(u))return{cmd:u,args:["main.py"],cwd:t};let a=k();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function P(e){return e?V(L(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function K(e){let n=M(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=P(e.sessionId);if(r)try{C(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{b(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(f,_)=>{d=f,l=_?String(_):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:f,signal:l??"none"}),u({code:f,signal:l})})}),a=A(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function B(e,n){if(!n?.platform||!n.target_kind)return;let r=await S(n.platform)?.toolEnv(n.target_kind)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(T)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=y();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(T),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function H(e){let n={...process.env};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=p(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=O(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new x().load(),d=N(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=w(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function G(e,n){let r=p(n?.environment),o=R();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=E),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload={url:r.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:r.mediaArtefactsHost,org_id:e.org_id,media_dir:g})}async function oe(e,n){let r=D();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
2
+ import{a as R}from"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-O4IEPE3T.js";import{d as S}from"./chunk-2MQP4SSF.js";import{a as y}from"./chunk-MMBBQ4OZ.js";import{a as p}from"./chunk-V5DYLGAM.js";import{d as g,i as E}from"./chunk-LPH4TERT.js";import{spawn as M,execSync as h}from"child_process";import{appendFileSync as b,existsSync as m,mkdirSync as C}from"fs";import{homedir as L}from"os";import{join as V,resolve as s,dirname as v,delimiter as T}from"path";import{fileURLToPath as U}from"url";import{createInterface as I}from"readline";async function*A(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function O(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function w(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function N(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(U(import.meta.url));function k(){for(let e of["python3","python"])try{return h(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function D(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(m(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(m(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(m(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(m(u))return{cmd:u,args:["main.py"],cwd:t};let a=k();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function P(e){return e?V(L(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function K(e){let n=M(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=P(e.sessionId);if(r)try{C(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{b(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(f,_)=>{d=f,l=_?String(_):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:f,signal:l??"none"}),u({code:f,signal:l})})}),a=A(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function B(e,n){if(!n?.platform||!n.target_kind)return;let r=await S(n.platform)?.toolEnv(n.target_kind)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(T)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=y();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(T),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function H(e){let n={...process.env};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=p(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=O(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new x().load(),d=N(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=w(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function G(e,n){let r=p(n?.environment),o=R();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=E),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload={url:r.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:r.mediaArtefactsHost,org_id:e.org_id,media_dir:g})}async function oe(e,n){let r=D();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
3
3
  `);let o=H({environment:n?.environment,mode:n?.mode,assertionMode:n?.assertionMode,finalValidation:n?.finalValidation,username:e.username,accessKey:e.access_key,sessionId:e.session_id});e.device?.platform&&await B(o,e.device),G(e,{environment:n?.environment});let i=K({env:o,runner:r,log:n?.log,sessionId:e.session_id}),d=i.child;d.stdin.write(JSON.stringify(e)+`
4
4
  `);let l=P(e.session_id);if(l)try{C(v(l),{recursive:!0}),b(l,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
5
5
  `)}catch{}return{child:d,events:i.events,sendUserResponse(t){let a=JSON.stringify({type:"user_response",answer:t});try{d.stdin.write(a+`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-YDEK2FJQ.js";import{x as r}from"./chunk-N2N5T5JN.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a as i,b as n,i as p}from"./chunk-C44QQJR4.js";import{a as x}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var b=d(x(),1);var e=d(g(),1),v=[{value:"desktop",label:"Desktop",hint:"Chrome on this machine"},{value:"emulator",label:"Emulator",hint:"a virtual Android device"},{value:"simulator",label:"Simulator",hint:"a virtual iOS device"}];function T(a){return a==="all"?v:v.filter(l=>l.value!=="desktop")}function B({mode:a="all",onSelect:l,onCancel:c}){let u=T(a),[h,m]=(0,b.useState)(0);return p((s,o)=>{if(o.escape&&c){c();return}o.upArrow&&m(t=>Math.max(0,t-1)),o.downArrow&&m(t=>Math.min(u.length-1,t+1)),o.return&&l(u[h].value)}),(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:r.orange,bold:!0,children:a==="all"?"Where should tests run?":"Which kind of device?"}),(0,e.jsx)(i,{marginTop:1,flexDirection:"column",children:u.map((s,o)=>{let t=o===h;return(0,e.jsxs)(i,{children:[(0,e.jsxs)(n,{color:t?r.orange:void 0,children:[t?"\u276F ":" ",s.label]}),(0,e.jsxs)(n,{color:r.dim,children:[" ",s.hint]})]},s.value)})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:r.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,e.jsx)(f,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{B as a};
2
+ import{a as f}from"./chunk-Q6743UUQ.js";import{x as r}from"./chunk-LPH4TERT.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a as i,b as n,i as p}from"./chunk-C44QQJR4.js";import{a as x}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var b=d(x(),1);var e=d(g(),1),v=[{value:"desktop",label:"Desktop",hint:"Chrome on this machine"},{value:"emulator",label:"Emulator",hint:"a virtual Android device"},{value:"simulator",label:"Simulator",hint:"a virtual iOS device"}];function T(a){return a==="all"?v:v.filter(l=>l.value!=="desktop")}function B({mode:a="all",onSelect:l,onCancel:c}){let u=T(a),[h,m]=(0,b.useState)(0);return p((s,o)=>{if(o.escape&&c){c();return}o.upArrow&&m(t=>Math.max(0,t-1)),o.downArrow&&m(t=>Math.min(u.length-1,t+1)),o.return&&l(u[h].value)}),(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:r.orange,bold:!0,children:a==="all"?"Where should tests run?":"Which kind of device?"}),(0,e.jsx)(i,{marginTop:1,flexDirection:"column",children:u.map((s,o)=>{let t=o===h;return(0,e.jsxs)(i,{children:[(0,e.jsxs)(n,{color:t?r.orange:void 0,children:[t?"\u276F ":" ",s.label]}),(0,e.jsxs)(n,{color:r.dim,children:[" ",s.hint]})]},s.value)})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:r.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,e.jsx)(f,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{B as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-RZ4F3BHX.js";var c=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_inFlightFlush=null;_stoppingFast=!1;_droppedBatches=0;_droppedEntries=0;constructor(t){this.config=t}start(){if(this.flushTimer)return;let t=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},t),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(t){this.currentRunIndex=t}log(t,e,s,n={}){if(this.stopped)return;let i=this.buildEntry(t,e,s,n);this.buffer.push(i)}logStep(t,e,s,n={}){if(this.stopped)return;let i=this.buildEntry("debug",e,s,n);i.run_index=t,this.stepBuffer.has(t)||this.stepBuffer.set(t,[]),this.stepBuffer.get(t).push(i)}escalate(t){let e=this.stepBuffer.get(t);e&&e.length>0&&this.buffer.push(...e),this.stepBuffer.delete(t)}discardSteps(t){this.stepBuffer.delete(t)}async flush(){if(this.buffer.length===0)return;let t=this._flushBody();this._inFlightFlush=t;try{await t}finally{this._inFlightFlush===t&&(this._inFlightFlush=null)}}async _flushBody(){let t=this.buffer.splice(0),e=null;try{e=await this.config.getToken()}catch{this.buffer.unshift(...t);return}let s={"Content-Type":"application/json"};e&&(s.Authorization=`Bearer ${e}`);let n=JSON.stringify(t);for(let i=0;i<3;i++){try{let o=new AbortController,u=setTimeout(()=>o.abort(),1e4),f=await a(this.config.proxyUrl,{method:"POST",headers:s,body:n,signal:o.signal});if(clearTimeout(u),f.ok)return}catch{}if(this._stoppingFast){this.buffer.unshift(...t);return}i<2&&await new Promise(o=>setTimeout(o,1e3*Math.pow(2,i)))}this._droppedBatches++,this._droppedEntries+=t.length}async flushOnce(t){if(this.buffer.length===0)return"empty";let e=this.buffer.splice(0),s=Date.now()+t,n=!1,i,o=null;try{o=await Promise.race([this.config.getToken(),new Promise(h=>{i=setTimeout(()=>{n=!0,h(null)},t),i.unref&&i.unref()})])}catch{o=null}finally{i&&clearTimeout(i)}let u=s-Date.now();if(n||u<=0)return this.buffer.unshift(...e),"timeout";let f={"Content-Type":"application/json"};o&&(f.Authorization=`Bearer ${o}`);try{let h=new AbortController,l=setTimeout(()=>h.abort(),u);l.unref&&l.unref();let p=await a(this.config.proxyUrl,{method:"POST",headers:f,body:JSON.stringify(e),signal:h.signal});return clearTimeout(l),p.ok?"sent":(this.buffer.unshift(...e),"failed")}catch{return this.buffer.unshift(...e),Date.now()>=s?"timeout":"failed"}}async stopAndFlushOnce(t){let e=Date.now()+t;this._stoppingFast=!0,this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null);let s=this._inFlightFlush;if(s){let i;await Promise.race([s.catch(()=>{}),new Promise(o=>{i=setTimeout(o,t),i.unref&&i.unref()})]),i&&clearTimeout(i)}if(this.buffer.length===0)return"empty";let n=e-Date.now();if(n<=0)return"timeout";try{return await this.flushOnce(n)}catch{return"failed"}}drainBuffer(){return this.buffer.splice(0)}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(t){return this.stepBuffer.get(t)?.length??0}buildEntry(t,e,s,n){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:t,event:e,message:s,session_id:this.config.sessionId,run_index:e.startsWith("tcg_")?null:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:n,timestamp:new Date().toISOString()}}};function y(r=process.env){try{let t=r.KANE_CLI_USER_AGENT;return t&&t.trim()?d(t):r.CLAUDECODE==="1"||r.CLAUDE_CODE_ENTRYPOINT?"claude-code":r.CURSOR_TRACE_ID||r.TERM_PROGRAM==="cursor"?"cursor":r.TERM_PROGRAM==="vscode"||r.VSCODE_PID?"vscode":r.CI==="true"||r.GITHUB_ACTIONS==="true"||r.GITLAB_CI==="true"||r.CIRCLECI==="true"||r.BUILDKITE==="true"?"ci":"unknown"}catch{return"unknown"}}function d(r){return r.toLowerCase().replace(/[^a-z0-9_-]/g,"-").slice(0,40)}export{c as a,y as b};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as B,c as b}from"./chunk-NVGBE2DR.js";import{C as T}from"./chunk-AJXOJF2X.js";import{a as L,c as F}from"./chunk-CUM23TLF.js";import{b as P,j}from"./chunk-HLXOYLZV.js";import{a as N,d as R,f as $}from"./chunk-WXHQYYD5.js";import{existsSync as re,mkdirSync as se,readFileSync as ae,writeFileSync as de}from"fs";import{basename as A,extname as H,join as le}from"path";var K=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function Z(e){return typeof e=="string"&&e!=="."&&e!==".."&&K.test(e)}function k(e){if(!Z(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(K)} (no path separators)`)}import{extname as q}from"path";var Q={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ee={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},xe={kind:"web",media_type:"application/x-kane-web-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},te={kind:"linear",media_type:"application/x-kane-linear-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ne={kind:"linear-doc",media_type:"application/x-kane-linear-doc-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},z=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(ie)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Q,ee,te,ne],ie=Buffer.from([208,207,17,224,161,177,26,225]),M={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence",web:"web",linear:"linear","linear-doc":"linearDoc"},ge=new Set(Object.keys(M));function J(e){let n=q(e).toLowerCase(),t=z.find(i=>i.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:z.flatMap(i=>i.extensions)}}function v(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function ce(e,n,t){return G({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:n,numbered_text:U(t)})}var Y=2e3;function me(e){let t=A(e,H(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return k(t),t}function Ce(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function W(e){let n=le(e,"meta.json");re(n)||(se(e,{recursive:!0}),de(n,JSON.stringify({schema:N,canonicalizer:"v1"},null,2)+`
2
+ import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as B,c as b}from"./chunk-NVGBE2DR.js";import{C as T}from"./chunk-W3Z7AZNT.js";import{a as L,c as F}from"./chunk-UH2ZTX4E.js";import{b as P,j}from"./chunk-XMTSHHYQ.js";import{a as N,d as R,f as $}from"./chunk-AKX4VRRR.js";import{existsSync as re,mkdirSync as se,readFileSync as ae,writeFileSync as de}from"fs";import{basename as A,extname as H,join as le}from"path";var K=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function Z(e){return typeof e=="string"&&e!=="."&&e!==".."&&K.test(e)}function k(e){if(!Z(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(K)} (no path separators)`)}import{extname as q}from"path";var Q={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ee={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},xe={kind:"web",media_type:"application/x-kane-web-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},te={kind:"linear",media_type:"application/x-kane-linear-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ne={kind:"linear-doc",media_type:"application/x-kane-linear-doc-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},z=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(ie)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Q,ee,te,ne],ie=Buffer.from([208,207,17,224,161,177,26,225]),M={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence",web:"web",linear:"linear","linear-doc":"linearDoc"},ge=new Set(Object.keys(M));function J(e){let n=q(e).toLowerCase(),t=z.find(i=>i.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:z.flatMap(i=>i.extensions)}}function v(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function ce(e,n,t){return G({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:n,numbered_text:U(t)})}var Y=2e3;function me(e){let t=A(e,H(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return k(t),t}function Ce(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function W(e){let n=le(e,"meta.json");re(n)||(se(e,{recursive:!0}),de(n,JSON.stringify({schema:N,canonicalizer:"v1"},null,2)+`
3
3
  `))}async function Se(e){let{contextDir:n,filePath:t,asId:i,confirmSameSource:_,converters:w}=e;W(n);let o=ae(t),s=J(t);if(!s.ok)throw new Error(`${A(t)} is a file type kane can't ingest (${H(t)||"no extension"}) \u2014 supported: ${s.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(o.byteLength>s.media.maxBytes)throw new Error(`${A(t)} is too large \u2014 ${v(o.byteLength)}, the limit for ${s.media.media_type} is ${v(s.media.maxBytes)} [FILE_TOO_LARGE]`);if(s.media.sniff&&!s.media.sniff(o)){let m=s.media.sniffFail?.(o);throw new Error(m??`MEDIA_SNIFF_MISMATCH: ${t} does not look like ${s.media.media_type}`)}let c;return i!==void 0?(k(i),c=i):c=me(t),pe({contextDir:n,bytes:o,media:s.media,sourceId:c,label:t,confirmSameSource:_,converters:w})}async function pe(e){let{contextDir:n,bytes:t,media:i,confirmSameSource:_,converters:w}=e,o=e.sourceId,s=e.label??o;if(W(n),t.byteLength>i.maxBytes)throw new Error(`the content is too large \u2014 ${v(t.byteLength)}, the limit for ${i.media_type} is ${v(i.maxBytes)} [FILE_TOO_LARGE]`);let c=[],m=M[i.kind];if(i.cite==="verbatim"&&!m){try{new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${s} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}t.toString("utf8").split(`
4
4
  `).some(f=>f.length>Y)&&c.push(`long line detected (> ${Y} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let p=B(t),y=new Map,l=null,C=!1;for(let f=0;;f++){let g=T(n),u=g.heads.get(o),X=u!=null?g.getNode(u)?.content:void 0;if(u!=null&&X?.blob===p)return{status:"unchanged",source_id:o,cid:u,blob:p};if(u==null){for(let[r,x]of g.heads.entries())if(!(r===o||x==null)&&g.getNode(x)?.content.blob===p){let a;if(y.has(r)?a=y.get(r):f===0&&_?(a=await _(r),y.set(r,a)):(a=!1,y.set(r,a),f>0&&c.push(`same bytes already ingested as '${r}' \u2014 minted under '${o}' anyway (the twin appeared mid-commit; not prompted)`)),a)return{status:"unchanged",source_id:r,cid:x,blob:p};break}}if(l===null){let r={},x,a=null,S=null;if(m){let O=w?.[m];if(!O)throw new Error(`${m.toUpperCase()}_CONVERTER_MISSING: ${m} ingestion requires the converter \u2014 the command layer wires it`);let d=await O(t);a=Buffer.from(d.projection,"utf8");let D=ce(o,i.kind,a);if(D>4e5)throw new Error(`PROJECTION_TOO_LARGE: serialized source payload ${D} bytes > ${4e5} \u2014 split the document and re-ingest`);r={text_blob:B(a),...d.inventory.length>0?{images:d.inventory}:{},converter:d.converter},S=d.blobs,x={kind:i.kind,...d.pages!==void 0?{pages:d.pages}:{},delivered:d.delivered.length,omitted:d.inventory.length-d.delivered.length}}l={derived:r,composite:x,projBytes:a,derivedBlobs:S}}if(!C){if(b(n,t),l.projBytes!==null&&b(n,l.projBytes),l.derivedBlobs!==null)for(let[,r]of l.derivedBlobs)b(n,r);C=!0}let h=F(o,p),E=$("source",h);if(E.length>0)throw new Error(`source node fails ${E[0].code}: ${E[0].detail}`);let I=L("source",h);try{j(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:I,label:R.SOURCE,content:h}],edges:[],review:[],supersessions:[],media:{[o]:{format:i.kind,media_type:i.media_type,anchors_supported:m?["L-L","img#ref"]:i.cite==="verbatim"?["L-L"]:[],...l.derived}},...e.eventIds&&e.eventIds.length>0?{event_ids:e.eventIds}:{},source_head_moves:{[o]:I}},{expectPrev:g.latestHash})}catch(r){if(r instanceof P&&f<3)continue;throw r}return{status:u!=null?"versioned":"created",source_id:o,cid:I,blob:p,...c.length?{warnings:c}:{},...l.composite?{composite:l.composite}:{}}}}export{k as a,Q as b,ee as c,xe as d,te as e,ne as f,ge as g,J as h,ce as i,me as j,Ce as k,Se as l,pe as m};