@testmuai/kane-cli 0.6.11 → 0.7.1

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 (234) hide show
  1. package/dist/ChatSurface-D66CACLX.js +8 -0
  2. package/dist/{ChromeProfilePicker-54CAJDUF.js → ChromeProfilePicker-4CDSPBWL.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-TCAH4AHL.js → CliFeedbackPrompt-TLRVBA4E.js} +1 -1
  4. package/dist/{CliUploadProgress-UURZ63VQ.js → CliUploadProgress-WGGFLUSF.js} +1 -1
  5. package/dist/{ConfigView-5QGB7MUS.js → ConfigView-DBANTBXC.js} +1 -1
  6. package/dist/EvidenceViewOffer-DNCQ3A6R.js +2 -0
  7. package/dist/{FolderPicker-Y5MAYFIJ.js → FolderPicker-W7RCIFEL.js} +1 -1
  8. package/dist/{HelpView-S3GJGSCE.js → HelpView-FBCX32U7.js} +1 -1
  9. package/dist/{InfoBox-LYTNNMVJ.js → InfoBox-KK2ICVS4.js} +1 -1
  10. package/dist/{LinksBox-5MSEKNSV.js → LinksBox-KKRANMR3.js} +1 -1
  11. package/dist/{ProfilesView-LTHE5UIO.js → ProfilesView-DGPXSAQN.js} +1 -1
  12. package/dist/{ProjectPicker-XMXIGHSE.js → ProjectPicker-ESQSL4TT.js} +1 -1
  13. package/dist/{SaveSessionPrompt-VQDEA4WA.js → SaveSessionPrompt-AQGP5W6E.js} +1 -1
  14. package/dist/SingleShotApp-SMCAIKCE.js +2 -0
  15. package/dist/{SummaryBox-WWF3G263.js → SummaryBox-BFZJW2KK.js} +1 -1
  16. package/dist/TestMdRunView-FMKZJ3A3.js +2 -0
  17. package/dist/{WhoamiView-PDURYP7E.js → WhoamiView-JABY3I5Q.js} +1 -1
  18. package/dist/{auth-I4RB4KO3.js → auth-76LVI6B5.js} +1 -1
  19. package/dist/bind-AACBTSAA.js +12 -0
  20. package/dist/bootstrap-CNOZ5VRB.js +2 -0
  21. package/dist/bridge-T4HL4TG7.js +2 -0
  22. package/dist/{changelog-OKYH4F7I.js → changelog-PSWPPOAF.js} +1 -1
  23. package/dist/chat-committer-4BQBOKI4.js +2 -0
  24. package/dist/chat-controller-NNTMKEPG.js +2 -0
  25. package/dist/{chunk-NUQ423YE.js → chunk-2KBD6JZX.js} +1 -1
  26. package/dist/chunk-2SREGETM.js +4 -0
  27. package/dist/chunk-2XGDWUJ5.js +2 -0
  28. package/dist/{chunk-MJBCBQC2.js → chunk-322JEJEH.js} +1 -1
  29. package/dist/{chunk-SURF5Z7Y.js → chunk-323MLBYA.js} +1 -1
  30. package/dist/{chunk-HOQEMPMQ.js → chunk-33QXD75Y.js} +2 -2
  31. package/dist/{chunk-K7USHLVZ.js → chunk-36OC3TFE.js} +1 -1
  32. package/dist/{chunk-ZNHXIRCM.js → chunk-3FN5VJMV.js} +2 -2
  33. package/dist/chunk-3LWTUMDG.js +2 -0
  34. package/dist/chunk-3STZLM5J.js +4 -0
  35. package/dist/{chunk-KXUSG5ZI.js → chunk-4OPQJ7PE.js} +1 -1
  36. package/dist/chunk-5JTUL6XL.js +2 -0
  37. package/dist/{chunk-FMR2KPSK.js → chunk-5KFS3GAZ.js} +1 -1
  38. package/dist/{chunk-XZRIQ3GF.js → chunk-6HEGD6H2.js} +1 -1
  39. package/dist/{chunk-XWSAKVEY.js → chunk-6UJDOAYR.js} +2 -2
  40. package/dist/{chunk-QJIJC3KC.js → chunk-73C4PRYU.js} +1 -1
  41. package/dist/chunk-AAONIIQV.js +6 -0
  42. package/dist/chunk-AH7ZZIZY.js +2 -0
  43. package/dist/chunk-AM5S4KG4.js +6 -0
  44. package/dist/{chunk-7MRBMDZ5.js → chunk-APAIWBIH.js} +1 -1
  45. package/dist/{chunk-HMM5FJJO.js → chunk-BAL64WSI.js} +1 -1
  46. package/dist/chunk-BB2W35TW.js +2 -0
  47. package/dist/chunk-BQHKBOSF.js +11 -0
  48. package/dist/chunk-C4G7RVJ6.js +2 -0
  49. package/dist/{chunk-NTGYFYBP.js → chunk-CDQX6HGJ.js} +1 -1
  50. package/dist/{chunk-KSZ72BSC.js → chunk-CSQ46PJ7.js} +1 -1
  51. package/dist/chunk-DQ54MH7F.js +13 -0
  52. package/dist/{chunk-3AZTXJY4.js → chunk-DXV6MBTD.js} +1 -1
  53. package/dist/chunk-DYW5C6II.js +2 -0
  54. package/dist/{chunk-LHDNJJGE.js → chunk-F6ZOJXYU.js} +1 -1
  55. package/dist/chunk-GVIPTX6T.js +6 -0
  56. package/dist/chunk-GW5DWAXY.js +2 -0
  57. package/dist/chunk-HJERKSBK.js +349 -0
  58. package/dist/{chunk-POYZ6SAI.js → chunk-HPMS5KO6.js} +2 -2
  59. package/dist/{chunk-3RZ63RBO.js → chunk-IBNC444G.js} +1 -1
  60. package/dist/{chunk-73OQDAXF.js → chunk-IQDWBTRJ.js} +1 -1
  61. package/dist/chunk-IXVOXJP6.js +6 -0
  62. package/dist/{chunk-IQODWB32.js → chunk-JEUA4UWK.js} +1 -1
  63. package/dist/{chunk-GLA6QL3T.js → chunk-JKTFTF24.js} +1 -1
  64. package/dist/{chunk-KHJXOFDM.js → chunk-JRMDGLLT.js} +1 -1
  65. package/dist/{chunk-GIMTSDNC.js → chunk-KNDSQ4PS.js} +1 -1
  66. package/dist/chunk-KRXSXQBU.js +12 -0
  67. package/dist/{chunk-4CJ55EUY.js → chunk-KT6G7AF2.js} +1 -1
  68. package/dist/chunk-KVQOBPAZ.js +2 -0
  69. package/dist/chunk-L2TV4G56.js +4 -0
  70. package/dist/{chunk-6HYW5RFX.js → chunk-L4JIMNKW.js} +1 -1
  71. package/dist/{chunk-FSB3FTIQ.js → chunk-L7VREJTG.js} +1 -1
  72. package/dist/{chunk-MRP54NCJ.js → chunk-LQZ2BU7Q.js} +1 -1
  73. package/dist/{chunk-EAUUULJQ.js → chunk-LR5XO2KD.js} +1 -1
  74. package/dist/chunk-M7WQM4UA.js +4 -0
  75. package/dist/{chunk-KHQHVSZ6.js → chunk-NAC7SFBE.js} +1 -1
  76. package/dist/{chunk-DSOA6L73.js → chunk-NAE7MBR2.js} +3 -3
  77. package/dist/{chunk-NTNAHN25.js → chunk-NBKQT7LJ.js} +1 -1
  78. package/dist/{chunk-7NLQ3QQD.js → chunk-NJPTOKW5.js} +1 -1
  79. package/dist/{chunk-RFJAYURU.js → chunk-NOCIMJSN.js} +1 -1
  80. package/dist/chunk-NRC2G4Y5.js +5 -0
  81. package/dist/{chunk-H2W2UNTN.js → chunk-NRTHYROA.js} +1 -1
  82. package/dist/chunk-O56PUUNL.js +9 -0
  83. package/dist/chunk-OHRS3H7Z.js +5 -0
  84. package/dist/{chunk-FCHTL74E.js → chunk-PMHJRT3A.js} +1 -1
  85. package/dist/{chunk-GRB66C5S.js → chunk-QROUKGKU.js} +1 -1
  86. package/dist/{chunk-XXMNUJX4.js → chunk-R2RGSO4B.js} +1 -1
  87. package/dist/{chunk-MFOH7EYR.js → chunk-RNSSM2BK.js} +1 -1
  88. package/dist/chunk-SE6WNCYU.js +4 -0
  89. package/dist/{chunk-ICGHBZFZ.js → chunk-SRDHPKJT.js} +1 -1
  90. package/dist/chunk-SWESH2J7.js +10 -0
  91. package/dist/chunk-SY3HLQMV.js +4 -0
  92. package/dist/chunk-T63R6QT4.js +4 -0
  93. package/dist/{chunk-ZP4S5WGW.js → chunk-UBFKZEX3.js} +2 -2
  94. package/dist/chunk-UI7KULSI.js +7 -0
  95. package/dist/chunk-UPPEOQJQ.js +3 -0
  96. package/dist/chunk-URQUQWGW.js +62 -0
  97. package/dist/chunk-UX2B7L6K.js +2 -0
  98. package/dist/{chunk-XSKLH2MC.js → chunk-V36ATG7A.js} +2 -2
  99. package/dist/chunk-VGFTNLQQ.js +2 -0
  100. package/dist/{chunk-RGJIRS3B.js → chunk-W5DOU2DV.js} +1 -1
  101. package/dist/chunk-W6VD2XFO.js +19 -0
  102. package/dist/chunk-WJ5HDEVH.js +6 -0
  103. package/dist/chunk-WWNSD6FA.js +6 -0
  104. package/dist/{chunk-ZPCU6546.js → chunk-X3ICV5M5.js} +1 -1
  105. package/dist/chunk-XDHZMCTA.js +4 -0
  106. package/dist/{chunk-2WKX3RMA.js → chunk-XVDJ423L.js} +1 -1
  107. package/dist/chunk-ZLCZDAEX.js +6 -0
  108. package/dist/{chunk-NJAHRITS.js → chunk-ZM5PVRJK.js} +1 -1
  109. package/dist/committer-2EJPVVCQ.js +2 -0
  110. package/dist/{config-QISRENF5.js → config-R3GF2FZA.js} +1 -1
  111. package/dist/cover-cmd-TXICWHUU.js +3 -0
  112. package/dist/{credentials-OGLK7MPV.js → credentials-XN4ROCQ3.js} +1 -1
  113. package/dist/design-committer-BQUWD6AC.js +2 -0
  114. package/dist/docx-convert-ZBVQO2LG.js +1 -1
  115. package/dist/dossier-QZV74XOS.js +3 -0
  116. package/dist/evidence-V23FPVXQ.js +2 -0
  117. package/dist/evolve-cmd-PZCPXDMR.js +2 -0
  118. package/dist/{exit-manager-MXUD7GQ7.js → exit-manager-HNFATGSM.js} +1 -1
  119. package/dist/explain-UE4IACQH.js +2 -0
  120. package/dist/{explain-cmd-NWIYH5MI.js → explain-cmd-RZW6QJYM.js} +1 -1
  121. package/dist/{explain-cmd-DBUTPZHA.js → explain-cmd-X7JZLSZZ.js} +1 -1
  122. package/dist/extract-bind-BFY7IRL4.js +10 -0
  123. package/dist/extract-cmd-U3MGK2LP.js +6 -0
  124. package/dist/feeder-XGTFV7TZ.js +2 -0
  125. package/dist/gaps-cmd-BWCRLLBK.js +3 -0
  126. package/dist/{gate-B6C6KLFA.js → gate-YHBPWEM5.js} +1 -1
  127. package/dist/{generate-headless-TUA3HGRX.js → generate-headless-BSTDLZZY.js} +2 -2
  128. package/dist/{headless-io-PWW6YKH2.js → headless-io-BL3TEAX5.js} +1 -1
  129. package/dist/index.js +67 -68
  130. package/dist/ingest-AL6CABJT.js +2 -0
  131. package/dist/ingest-cmd-O6OWWZT4.js +2 -0
  132. package/dist/interactive-bind-43HGDF5K.js +24 -0
  133. package/dist/lifecycle-cmd-D6TVTYRK.js +2 -0
  134. package/dist/list-cmd-XCAV2FKA.js +3 -0
  135. package/dist/{list-commands-F53ZNYOZ.js → list-commands-747UTUSS.js} +1 -1
  136. package/dist/locks-cmd-QAULI5LV.js +2 -0
  137. package/dist/logical-ids-4G4FAHNJ.js +2 -0
  138. package/dist/login-flow-CV76ENHV.js +2 -0
  139. package/dist/maintenance-cmd-ZRB4NTGG.js +2 -0
  140. package/dist/next-TRSKMBO5.js +2 -0
  141. package/dist/paths-JCYX6UWL.js +2 -0
  142. package/dist/{persist-recorded-session-5ZFS5SMZ.js → persist-recorded-session-MDPWWUA7.js} +1 -1
  143. package/dist/phase-seed-52LRE3LH.js +2 -0
  144. package/dist/pipeline-LM5JAK7F.js +2 -0
  145. package/dist/readmodel-X7L7W2BA.js +2 -0
  146. package/dist/reconcile-cmd-DGCSDML6.js +2 -0
  147. package/dist/{recording-banner-ZZUF2MGT.js → recording-banner-TALO7PUR.js} +1 -1
  148. package/dist/records-5SVUXJBW.js +2 -0
  149. package/dist/{require-project-folder-NQBZFUPF.js → require-project-folder-R347LFDQ.js} +1 -1
  150. package/dist/revert-DXXYXJGN.js +2 -0
  151. package/dist/review-cmd-2QF5HTI7.js +4 -0
  152. package/dist/run-52UIBPXD.js +2 -0
  153. package/dist/run-VRVH4VO3.js +2 -0
  154. package/dist/{run-test-md-XOSCYVSS.js → run-test-md-DFNIGYB7.js} +2 -2
  155. package/dist/sessions-BLXZVK5U.js +2 -0
  156. package/dist/sessions-cmd-AQWLL5ZN.js +25 -0
  157. package/dist/{skill-installer-VYIIWAK7.js → skill-installer-ANXTCXQV.js} +1 -1
  158. package/dist/spawner-AH5FTUYU.js +2 -0
  159. package/dist/structured-answers-QHFGZPSS.js +5 -0
  160. package/dist/tcg-generate-WKCBBKI5.js +2 -0
  161. package/dist/testmd-actions-RPYG6TJG.js +2 -0
  162. package/dist/token-refresh-NIDUOTRM.js +2 -0
  163. package/dist/trust-gate-EX7R2P4Y.js +2 -0
  164. package/dist/{validate-basic-LP3S5PK7.js → validate-basic-O2DP2XJL.js} +1 -1
  165. package/dist/verdicts-TJH3O5UW.js +2 -0
  166. package/dist/{version-check-XP62HWLJ.js → version-check-RNR3JCQ5.js} +1 -1
  167. package/dist/{view-cmd-GQBFCPDL.js → view-cmd-YSEGA5PI.js} +1 -1
  168. package/dist/walk-session-HXW4OSA2.js +2 -0
  169. package/dist/with-telemetry-PNP6CAVM.js +2 -0
  170. package/package.json +6 -6
  171. package/dist/ChatSurface-TZ554O4U.js +0 -8
  172. package/dist/EvidenceViewOffer-SSAM4RRP.js +0 -2
  173. package/dist/SingleShotApp-A6PCNPLM.js +0 -2
  174. package/dist/TestMdRunView-MQ7ZPFN2.js +0 -2
  175. package/dist/bind-QJT726NE.js +0 -6
  176. package/dist/bootstrap-566PPFCC.js +0 -2
  177. package/dist/bridge-QCMEOQDD.js +0 -2
  178. package/dist/chat-committer-OS7ULZMH.js +0 -2
  179. package/dist/chat-controller-QLORQWJZ.js +0 -2
  180. package/dist/chunk-3C5GMAM4.js +0 -2
  181. package/dist/chunk-54IB6CXK.js +0 -5
  182. package/dist/chunk-54VQ46U2.js +0 -14
  183. package/dist/chunk-55Y65VPA.js +0 -347
  184. package/dist/chunk-6W6AIDLJ.js +0 -4
  185. package/dist/chunk-7E24OCGX.js +0 -2
  186. package/dist/chunk-7YPK6EDR.js +0 -4
  187. package/dist/chunk-FHKDTM5L.js +0 -6
  188. package/dist/chunk-FRBYGSGJ.js +0 -4
  189. package/dist/chunk-GG43HSU2.js +0 -3
  190. package/dist/chunk-HLRLP6TQ.js +0 -2
  191. package/dist/chunk-J2KSZUOO.js +0 -4
  192. package/dist/chunk-J44RN3FB.js +0 -2
  193. package/dist/chunk-JXKRO2ZJ.js +0 -13
  194. package/dist/chunk-M5PJQ5Y3.js +0 -6
  195. package/dist/chunk-MMPFU2YC.js +0 -2
  196. package/dist/chunk-MR7CX5VT.js +0 -9
  197. package/dist/chunk-MTNUZEO7.js +0 -12
  198. package/dist/chunk-OGWC3J3C.js +0 -4
  199. package/dist/chunk-RN4OSVTG.js +0 -6
  200. package/dist/chunk-RZJVQUBA.js +0 -61
  201. package/dist/chunk-V3UE6RJP.js +0 -2
  202. package/dist/chunk-Y5RNCJAN.js +0 -19
  203. package/dist/chunk-YSSTGJ7O.js +0 -7
  204. package/dist/chunk-Z2JSEL3I.js +0 -4
  205. package/dist/cover-cmd-SV3I23UM.js +0 -2
  206. package/dist/dossier-KJSJPWOW.js +0 -3
  207. package/dist/evidence-HDD7T7DX.js +0 -2
  208. package/dist/evolve-cmd-UE2BIMXK.js +0 -2
  209. package/dist/explain-EBVIUS2X.js +0 -2
  210. package/dist/extract-bind-6MQYKN3G.js +0 -8
  211. package/dist/extract-cmd-2RUIWFZG.js +0 -6
  212. package/dist/gaps-cmd-CKCHH3HQ.js +0 -2
  213. package/dist/ingest-FIIO67ZN.js +0 -2
  214. package/dist/ingest-cmd-CRMY46YC.js +0 -7
  215. package/dist/interactive-bind-53FCRK34.js +0 -10
  216. package/dist/lifecycle-cmd-32LG364Q.js +0 -2
  217. package/dist/list-cmd-UTZ2PQUK.js +0 -3
  218. package/dist/logical-ids-I7B3VJEH.js +0 -2
  219. package/dist/login-flow-D7KBR7XR.js +0 -2
  220. package/dist/maintenance-cmd-BZAGSYGI.js +0 -2
  221. package/dist/pipeline-MX3ZR5B3.js +0 -2
  222. package/dist/readmodel-S5RAQH3F.js +0 -2
  223. package/dist/reconcile-cmd-4377PWF5.js +0 -2
  224. package/dist/revert-RQJE56HF.js +0 -2
  225. package/dist/review-cmd-7LXGYHHQ.js +0 -4
  226. package/dist/run-2AIQUJ55.js +0 -2
  227. package/dist/run-YH5SCBYD.js +0 -2
  228. package/dist/sessions-cmd-DTQYDZNT.js +0 -23
  229. package/dist/spawner-7KXVKAD5.js +0 -2
  230. package/dist/tcg-generate-U6OCCS2E.js +0 -2
  231. package/dist/testmd-actions-RPALXRZK.js +0 -2
  232. package/dist/token-refresh-S7CYBZTE.js +0 -2
  233. package/dist/walk-session-YIKHE6PT.js +0 -2
  234. /package/dist/{chunk-BC7UVJJB.js → chunk-CH273NAE.js} +0 -0
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as Wt,b as he,c as Ut,d as st}from"./chunk-W5DOU2DV.js";import{a as Nt}from"./chunk-JEUA4UWK.js";import{a as Fe}from"./chunk-SY3HLQMV.js";import{a as Pt,b as Ft}from"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-5KFS3GAZ.js";import{a as _t,b as Ot,c as qt}from"./chunk-NRTHYROA.js";import"./chunk-NVGBE2DR.js";import{a as Et}from"./chunk-5Y2G4NC7.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{a as Pe}from"./chunk-YCCUBQY4.js";import{a as Lt}from"./chunk-73C4PRYU.js";import{b as Mt}from"./chunk-DFS4RMVP.js";import{y as r}from"./chunk-C4G7RVJ6.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as T,b as n,k as qe}from"./chunk-C44QQJR4.js";import{a as Pn}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var p=V(Pn(),1);var l=V(Q(),1),Fn=60,Wn=100;function it(e,s){let o=e.options.length,c=o,d=e.multi_select?c++:null,m=e.allow_free_text?c++:null,u=s?c++:null;return{optionCount:o,doneIdx:d,freeIdx:m,batchIdx:u,maxSel:c-1}}var Nn="\xA0",Un={high:{text:`\u203C${Nn}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function jn(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Vn(e,s,o){let c=g=>e[g].length+6,d=c(s),m=s,u=s;for(;;){let g=u+1<e.length?c(u+1):1/0,h=m-1>=0?c(m-1):1/0;if(g===1/0&&h===1/0)break;if(g<=h){if(d+g>o)break;d+=g,u+=1}else{if(d+h>o)break;d+=h,m-=1}}return{lo:m,hi:u}}function jt({batch:e,qView:s,sel:o=0,focused:c=!1,freeText:d=null,optionText:m=null,attach:u=null,canAttach:g=!1,multiSelFor:h}){let{stdout:I}=qe(),b=I?.columns??80,w=b<Fn,D=Math.min(b-1,Wn),C=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),x=e.questions[C],R=e.resolution[C],L=e.resolution.filter(F=>!F).length,S=e.questions.length-L,B=Fe(e),f=it(x,B!==""),U=h?h(C):[],O=Un[x.risk],q=F=>c&&o===F?(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",le=`? the agent needs ${L===1?"one answer":`${L} answers`}`,ae=e.questions.length>1?` \xB7 ${C+1} of ${e.questions.length} \xB7 ${S} answered`:"",Ae=(0,l.jsxs)(T,{flexDirection:"column",children:[(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsxs)(n,{bold:!0,children:[x.text,O?(0,l.jsx)(n,{color:O.color,bold:!1,children:` ${O.text}`}):null]})}),(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsx)(n,{color:r.dim,children:x.rationale})}),(0,l.jsx)(n,{children:" "}),x.options.map((F,P)=>{let X=c&&o===P;return m&&m.optionIndex===P?(0,l.jsx)(T,{flexDirection:"column",children:(0,l.jsxs)(T,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:r.assuranceAccent,children:`${P+1}. ${F.label}`}),(0,l.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,l.jsx)(Pe,{value:m.value,onChange:m.onChange,onSubmit:m.onSubmit,onCancel:m.onCancel,placeholder:F.detail||"type your answer"})]})},`o-${P}`):(0,l.jsxs)(T,{flexDirection:"column",children:[(0,l.jsxs)(n,{children:[q(P)," ",x.multi_select?(0,l.jsx)(n,{color:U.includes(P)?r.green:r.dim,children:U.includes(P)?"[x] ":"[ ] "}):null,(0,l.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${P+1}. ${F.label}`}),P===x.recommended_index?(0,l.jsx)(n,{color:r.dim,children:" (recommended)"}):null,R?.selected_index===P?(0,l.jsx)(n,{color:r.dim,children:" (current)"}):null]}),F.detail?(0,l.jsx)(T,{paddingLeft:5,children:(0,l.jsx)(n,{color:r.dim,children:F.detail})}):null]},`o-${P}`)}),x.multi_select&&f.doneIdx!=null?(0,l.jsxs)(n,{children:[q(f.doneIdx)," ",(0,l.jsx)(n,{color:r.green,children:"\u2714"}),(0,l.jsx)(n,{color:c&&o===f.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,x.allow_free_text?(0,l.jsx)(n,{children:" "}):null,x.allow_free_text?d?(0,l.jsxs)(T,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,l.jsx)(Pe,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"Tell me what to do"})]}):(0,l.jsxs)(n,{children:[f.freeIdx!=null?q(f.freeIdx):" "," ",(0,l.jsx)(n,{color:c&&f.freeIdx!=null&&o===f.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,l.jsxs)(T,{flexDirection:"column",marginTop:1,children:[(0,l.jsxs)(T,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,l.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,l.jsx)(Pe,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,l.jsx)(T,{paddingLeft:2,children:(0,l.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]}),be=B!==""?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n,{children:" "}),(0,l.jsxs)(n,{children:[c&&f.batchIdx!=null&&o===f.batchIdx?(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,l.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,l.jsx)(n,{bold:!0,color:c&&f.batchIdx!=null&&o===f.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,l.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,l.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(w)return(0,l.jsxs)(T,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsx)(n,{color:r.assuranceAccent,bold:!0,children:le}),e.questions.length>1?(0,l.jsx)(n,{color:r.dim,children:ae.replace(/^ · /,"")}):null,(0,l.jsx)(n,{children:" "}),Ae,be,(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsx)(n,{color:r.muted,children:"\u2191\u2193 \u23CE \xB7 \u2190 \u2192 questions \xB7 esc back"})})]});let ke=`\u2500\u2500 ${le}${ae} `,re=Math.max(2,D-ke.length),Z=g?"\u2191\u2193 select \xB7 \u23CE confirm \xB7 \u2190 \u2192 questions \xB7 type = your words \xB7 @ attach a file or URL \xB7 esc back":"\u2191\u2193 select \xB7 \u23CE confirm \xB7 \u2190 \u2192 questions \xB7 type = your words \xB7 esc back",M=`\u2500\u2500 ${Z} `,ce=Math.max(2,D-M.length),j=e.questions.map(F=>jn(F)),ee=e.questions.length>1?Vn(j,C,D-8):null;return(0,l.jsxs)(T,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(n,{bold:!0,children:le}),ae?(0,l.jsx)(n,{color:r.dim,children:ae}):null,` ${"\u2500".repeat(re)}`]}),ee?(0,l.jsx)(T,{marginTop:1,children:(0,l.jsxs)(n,{children:[ee.lo>0?(0,l.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",e.questions.slice(ee.lo,ee.hi+1).map((F,P)=>{let X=ee.lo+P,ye=P>0?" ":"";return X===C?(0,l.jsxs)(n,{children:[ye,(0,l.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${j[X]} `})]},F.id):(0,l.jsxs)(n,{children:[ye,e.resolution[X]?(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.green,children:"\u2713 "}),(0,l.jsx)(n,{color:r.dim,children:j[X]})]}):(0,l.jsx)(n,{color:r.dim,children:`\u25CB ${j[X]}`})]},F.id)}),ee.hi<e.questions.length-1?(0,l.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,l.jsx)(n,{children:" "}),Ae,be,(0,l.jsx)(n,{children:" "}),(0,l.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(n,{color:r.muted,children:Z}),` ${"\u2500".repeat(ce)}`]})]})}var E=V(Q(),1),Vt={high:0,med:1,low:2},Kn={high:r.red,med:"yellow",low:r.dim};function Qn(e){return e.map((s,o)=>({r:s,i:o})).sort((s,o)=>(Vt[s.r.risk??"zz"]??3)-(Vt[o.r.risk??"zz"]??3)||s.i-o.i).map(({r:s})=>s)}var se=(e,s)=>e.length<=s?e:s<=1?"\u2026":`${e.slice(0,s-1)}\u2026`,We=(e,s)=>e+" ".repeat(Math.max(0,s-e.length));function Kt({rows:e,width:s=120,badgeHeader:o="risk"}){if(e.length===0)return null;let c=Qn(e),d=S=>S.staged||!S.id?"(staged)":Nt(S.id),m=Math.max(2,...c.map(S=>d(S).length)),u=Math.max(o.length,...c.map(S=>(S.badge??"").length)),g=s>=96&&c.some(S=>S.summary),I=s-(g?13:10)-m-u,b=Math.max(...c.map(S=>Math.max(S.title.length,(S.marker??"").length)),5),w=Math.max(5,g?Math.min(b,Math.max(16,Math.floor(I*.5))):Math.min(b,I)),D=g?Math.max(7,I-w):0,C=(S,B,f,U)=>S+U.map(O=>`\u2500${"\u2500".repeat(O.length)}\u2500`).join(B)+f,x=(S,B,f,U)=>[We(se(S,m),m),We(se(B,w),w),We(se(f,u),u),...g?[We(se(U,D),D)]:[]],R=x("id","title",o,"summary"),L=[];L.push((0,E.jsx)(n,{color:r.dim,children:C("\u250C","\u252C","\u2510",R)},"t")),L.push((0,E.jsxs)(n,{children:[R.map((S,B)=>(0,E.jsxs)(n,{children:[(0,E.jsx)(n,{color:r.dim,children:B===0?"\u2502 ":" \u2502 "}),(0,E.jsx)(n,{bold:!0,children:S})]},B)),(0,E.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,E.jsx)(n,{color:r.dim,children:C("\u251C","\u253C","\u2524",R)},"m"));for(let[S,B]of c.entries()){let f=x(d(B),se(B.title,w),se(B.badge??"",u),se(B.summary??"",D)),U=B.badgeColor??Kn[B.badge??""]??r.dim;if(L.push((0,E.jsxs)(n,{children:[(0,E.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,E.jsx)(n,{color:r.assuranceAccent,children:f[0]}),(0,E.jsx)(n,{color:r.dim,children:" \u2502 "}),f[1],(0,E.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,E.jsx)(n,{color:U,children:f[2]}),g?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(n,{color:r.dim,children:" \u2502 "}),f[3]]}):null,(0,E.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${S}`)),B.marker){let O=x("",se(B.marker,w),"","");L.push((0,E.jsx)(n,{color:r.dim,children:`\u2502 ${O.join(" \u2502 ")} \u2502`},`mk-${S}`))}}return L.push((0,E.jsx)(n,{color:r.dim,children:C("\u2514","\u2534","\u2518",R)},"b")),(0,E.jsx)(E.Fragment,{children:L})}var Hn={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},ne=e=>Hn[e]??`${e}s`,Qt=e=>e==="ac"?"AC":e==="use-case"?"use-case":e,ot=e=>e.kind??"use-case",Ht=e=>`${ot(e)}:${e.temp_ref}`;function Xt(e){let s=e,o=s.badge??e.risk??null,c=s.why??e.summary??e.description??null;return JSON.stringify([e.title,o,c,s.extra??null,e.depends_on_hint??null])}function zt(e){return e.filter(s=>s.role==="agent"&&typeof s.turnIndex=="number"&&Array.isArray(s.items)&&s.items.length>0)}function oe(e){let s=new Map,o=1;for(let m of zt(e)){let u=new Set;for(let g of m.items){let h=Ht(g);if(u.has(h))continue;u.add(h);let I=s.get(h);s.set(h,{num:I?.num??o++,ref:g.temp_ref,kind:ot(g),item:g,turnIndex:m.turnIndex,fingerprint:Xt(g)})}}let c=[...s.values()].sort((m,u)=>m.num-u.num),d=[];for(let m of c){let u=d.find(g=>g.kind===m.kind);u?u.count++:d.push({kind:m.kind,label:ne(m.kind),count:1})}return{entries:c,byRef:s,counts:d}}function Gt(e,s){let c=zt(e).find(x=>x.turnIndex===s);if(!c)return null;let d=e.filter(x=>x.role!=="agent"||typeof x.turnIndex!="number"||x.turnIndex<=s),m=oe(d),u=oe(e.filter(x=>x.role!=="agent"||typeof x.turnIndex!="number"||x.turnIndex<s)),g=[],h=new Map,I=new Map,b=new Map,w=new Set;for(let x of c.items){let R=Ht(x);if(w.has(R))continue;w.add(R);let L=u.byRef.get(R),S=x.changed===!0,B=m.byRef.get(R).num,f=ot(x);if(L&&!S&&L.fingerprint===Xt(x)){h.set(f,(h.get(f)??0)+1);continue}let U=!!L||S,O=U?b:I;O.set(f,(O.get(f)??0)+1),g.push({item:x,num:B,updated:U})}let D=[...h.entries()].map(([x,R])=>({label:ne(x),count:R})),C=[...[...I.entries()].map(([x,R])=>`${R} new ${R===1?Qt(x):ne(x)}`),...[...b.entries()].map(([x,R])=>`${R} updated ${R===1?Qt(x):ne(x)}`)].join(" \xB7 ");return{fresh:g,unchanged:D,headerStats:C}}function lt(e,s){let o=e.entries.filter(m=>m.turnIndex===s);if(o.length===0)return e;let c=new Map(o.map(m=>[m.ref,m])),d=[];for(let m of o){let u=d.find(g=>g.kind===m.kind);u?u.count+=1:d.push({kind:m.kind,label:ne(m.kind),count:1})}return{entries:o,byRef:c,counts:d}}var y=V(Q(),1);function Xn(e){let s=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",o=e.note?` \u2014 ${e.note}`:"";return e.form==="deferred"?`\u21B3 deferred q${e.qNum} ${e.stub}${o}`:e.form==="changed"?`\u21B3 changed q${e.qNum} ${e.stub}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${s}${o}`:`\u21B3 ${e.form} q${e.qNum} ${e.stub}: ${e.choice??"?"}${s}${o}`}var zn=Math.min(process.stdout?.columns??100,120)-2;function Jt({block:e,annotations:s}){switch(e.kind){case"banner":return(0,y.jsx)(T,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2500\u2500 ${e.text} \u2500\u2500`})});case"user":return(0,y.jsxs)(T,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:e.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${e.text}`});case"agent":return(0,y.jsx)(T,{marginTop:1,children:(0,y.jsx)(Ot,{text:e.text,accent:r.assuranceAccent})});case"thinking":return(0,y.jsx)(T,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` thought for ${(e.tookMs/1e3).toFixed(1)}s`})});case"tool":return(0,y.jsx)(n,{color:r.dim,children:` ${Pt({name:e.name,status:e.status==="ok"?"done":e.status,detail:e.detail})}`});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let o=s??null,c=o?o.fresh:e.items.map((b,w)=>({item:b,num:w+1,updated:!1})),d={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},m=b=>b.kind??"use-case",u=new Map;for(let b of c){let w=b.item,D=m(b.item),C=w.risk==="high"||w.risk==="med"||w.risk==="low"?w.risk:void 0,x={id:w.logical_id??"",staged:!w.logical_id,title:w.title,badge:w.badge??w.risk??"",summary:w.why??w.summary??w.description??"",...C?{risk:C}:{},...b.updated?{marker:"\u21B3 changed"}:{}},R=u.get(D)??[];R.push(x),u.set(D,R)}let g=c.some(b=>!!b.item.kind),h=(o?.unchanged??[]).reduce((b,w)=>b+w.count,0),I=o?.headerStats?` \u2014 ${o.headerStats}${h>0?` (${h} unchanged)`:""}`:"";return(0,y.jsxs)(T,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[g?"design":e.heading,I?(0,y.jsx)(n,{bold:!1,color:r.dim,children:I}):null]}),[...u.entries()].map(([b,w])=>(0,y.jsxs)(T,{flexDirection:"column",children:[u.size>1?(0,y.jsx)(n,{color:r.dim,children:`${ne(b)} \xB7 ${w.length}`}):null,(0,y.jsx)(Kt,{rows:w,width:zn,badgeHeader:d[b]??"info"})]},b)),o&&o.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${o.unchanged.map(b=>`${b.count} ${b.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Xn(e.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"commit":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{color:e.ok?r.green:r.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),(e.warnings??[]).map((o,c)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${o}`},`w-${c}`))]});case"error":return(0,y.jsxs)(Lt,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:e.title}),e.detail.map((o,c)=>(0,y.jsx)(n,{color:r.dim,children:o},`d-${c}`))]});case"interrupted":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{color:r.red,children:"interrupted \u2014 session not saved"}),e.detail?(0,y.jsx)(n,{color:r.dim,children:e.detail}):null]});case"pause":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{children:`paused: session ${e.sid} saved`}),e.expires_at?(0,y.jsx)(n,{color:r.dim,children:`expires: ${e.expires_at}`}):null,(0,y.jsx)(n,{children:`resume: ${e.resume}`}),e.messageForm?(0,y.jsx)(n,{children:`or say something on the way in: ${e.messageForm}`}):null]});case"summary":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{bold:!0,children:"session summary"}),e.lines.map((o,c)=>(0,y.jsx)(n,{children:` ${o}`},`s-${c}`))]})}}var xe=V(Q(),1);function Yt({item:e}){return(0,xe.jsxs)(T,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,o)=>(0,xe.jsx)(n,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${o}`)),(e.depends_on_hint??[]).length>0&&(0,xe.jsx)(n,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,o])=>(0,xe.jsx)(n,{dimColor:!0,children:`${s}: ${o}`},`extra-${s}`))]})}var v=V(Q(),1),at=(e,s)=>Math.max(0,Math.min(s,e));function Ue(e,s,o){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:at(e.cursor+s.delta,Math.max(0,o-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var en={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function tn(e,s){if(e.level==="detail")return{level:"detail",cursor:at(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let o=s.entries.findIndex(c=>en[c.kind]===e.section);if(o>=0)return{level:"list",cursor:o}}return{level:"list",cursor:0}}function Gn(e){let s=[];for(let o of e.entries){let c=s.find(d=>d.kind===o.kind);c?c.entries.push(o):s.push({kind:o.kind,entries:[o]})}return s}var Zt=3;function Jn({items:e,cursor:s,verb:o,more:c}){let d=`view \xB7 ${o} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,m=e.entries[s];return(0,v.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,v.jsx)(n,{bold:!0,children:d}),Gn(e).map(({kind:u,entries:g})=>{let h=m?.kind===u,I=h?g.findIndex(C=>C.ref===m.ref):-1,b=h?at(I-1,Math.max(0,g.length-Zt)):0,w=g.slice(b,b+(h?Zt:1)),D=g.length-w.length;return(0,v.jsxs)(T,{flexDirection:"column",children:[(0,v.jsx)(n,{color:r.dim,children:`${en[u]??ne(u)} \xB7 ${g.length}`}),w.map(C=>{let x=h&&C.ref===m.ref,R=C.item.badge;return(0,v.jsxs)(n,{children:[(0,v.jsx)(n,{color:r.assuranceAccent,children:x?"\u203A ":" "}),(0,v.jsx)(n,{children:`${C.num} \xB7 ${C.item.title}`}),R?(0,v.jsx)(n,{color:r.dim,children:` \xB7 ${R}`}):null]},`${C.kind}:${C.ref}`)}),D>0&&(0,v.jsx)(n,{color:r.dim,children:` \u22EE ${D} more`})]},u)}),c?(0,v.jsxs)(n,{children:[(0,v.jsx)(n,{color:r.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,v.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${c.hidden} more from earlier turns`})]}):null,(0,v.jsx)(n,{color:r.dim,children:"\u2191\u2193 move \xB7 \u21B5 detail \xB7 esc back"})]})}var Ne=14;function Yn({items:e,cursor:s,explain:o,grandTotal:c,dossier:d,scroll:m=0}){let u=e.entries[s];if(!u)return(0,v.jsx)(n,{color:r.dim,children:"nothing to show"});if(d){let h=Math.max(0,Math.min(m,Math.max(0,d.lines.length-Ne))),I=d.lines.slice(h,h+Ne);return(0,v.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,v.jsxs)(n,{bold:!0,children:[`view \xB7 ${d.id}`,d.id.toLowerCase()!==d.rawId?(0,v.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${d.rawId}`}):null]}),(0,v.jsx)(n,{bold:!0,children:d.title}),h>0?(0,v.jsx)(n,{color:r.muted,children:`\u22EE ${h} above`}):null,I.map((b,w)=>(0,v.jsx)(n,{color:b.dim?r.dim:void 0,children:b.text},`dl-${w}`)),d.lines.length>h+Ne?(0,v.jsx)(n,{color:r.muted,children:`\u22EE ${d.lines.length-h-Ne} more`}):null,(0,v.jsx)(n,{color:r.dim,children:"\u2191\u2193 scroll \xB7 esc back"})]})}let g=u.item;return(0,v.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,v.jsx)(n,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${c??e.entries.length}`}),(0,v.jsx)(n,{children:u.item.title}),g.badge?(0,v.jsx)(n,{color:r.dim,children:`kind: ${g.badge}`}):null,g.why?(0,v.jsx)(n,{color:r.dim,children:g.why}):null,(0,v.jsx)(Yt,{item:u.item}),o?.map((h,I)=>(0,v.jsx)(n,{color:r.dim,children:h},`ex-${I}`)),(0,v.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"}),(0,v.jsx)(n,{color:r.dim,children:"\u2191\u2193 prev/next \xB7 esc back to list"})]})}function nn({items:e,state:s,verb:o,more:c,explain:d,grandTotal:m,dossier:u=null}){return s.level==="list"?(0,v.jsx)(Jn,{items:e,cursor:s.cursor,verb:o,more:c}):(0,v.jsx)(Yn,{items:e,cursor:s.cursor,explain:d,grandTotal:m,dossier:u,scroll:s.scroll??0})}var Zn={"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 rn(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let c=parseInt(s,10);return c>=1?{level:"detail",num:c}:{error:"items are numbered from 1 \u2014 /view 1"}}let o=Zn[s];return o?{level:"list",section:o}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var A=V(Q(),1),er=6,sn=12;function tr(e,s,o){let c=Math.max(20,s),d=[];for(let u of e.split(`
3
+ `)){if(u.length<=c){d.push(u);continue}let g="";for(let h of u.split(" "))g&&g.length+1+h.length>c?(d.push(g),g=h):g=g?`${g} ${h}`:h;d.push(g)}let m=Math.max(0,d.length-o);return{body:d.slice(-o).join(`
4
+ `),hidden:m}}var je=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function on(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},o={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},o]:[o,s]}function Kr({controller:e,verb:s="extract",onCtrlC:o,chain:c=null,inspect:d=null}){let[,m]=(0,p.useState)(0),[u,g]=(0,p.useState)(!1),[h,I]=(0,p.useState)(null),[b,w]=(0,p.useState)(null),D=(0,p.useRef)(null),[C,x]=(0,p.useState)(null),R=(0,p.useRef)(null),L=t=>{R.current=t,x(t)},S=t=>{D.current=t,w(t),t===null&&L(null)},B=(0,p.useRef)([]),[f,U]=(0,p.useState)(null),O=(0,p.useRef)(null),q=t=>{O.current=t,U(t)},le=Mt(),{stdout:ae}=qe(),Ae=ae?.columns??80,be=(0,p.useRef)(0),ke=(0,p.useRef)(0);(0,p.useEffect)(()=>{let t=()=>{let i=e.state.ledger;for(let k=be.current;k<i.length;k++){let $=i[k],_=$.kind==="turn"?Gt(e.state.turns,$.turnIndex):void 0;le.append((0,A.jsx)(Jt,{block:$,annotations:_},`lg-${k}`))}be.current=i.length};t();let a=e.subscribe(()=>{t();let i=e.state;D.current&&(i.pending||i.status==="pausing")&&(S(null),i.pending&&I("questions arrived \u2014 back to chat")),m(k=>k+1)});return m(i=>i+1),a},[e,le]);let{thinking:re,status:Z,pending:M,confirm:ce,ledger:j,activeTurn:ee,stream:F,notice:P}=e.state,X=(F?.text??"").trimEnd(),ye=X.length>0,ln=u&&(re.liveThinking.length>0||re.thinkingLog.length>0),an=tr(re.liveThinking||re.thinkingLog.map(t=>t.text).join(`
5
+ `),Ae-6,sn),ct=ye?X.split(`
6
+ `).slice(-er):[];ee&&(ke.current=ee.turnIndex);let cn=M?M.resolution.filter(t=>!t).length:0,ut;for(let t=j.length-1;t>=0;t--){if(B.current.some(i=>i.end!=null&&t>=i.start&&t<i.end))continue;let a=j[t];if(a.kind==="banner"&&!a.text.startsWith("kane")){ut=a.text;break}}let Te=re.activity[re.activity.length-1],Ve=Te?Te.status==="decision"?Te.label:Ft({name:Te.name,status:Te.status}):void 0,dt=Z==="streaming"||Z==="working",[mt,un]=(0,p.useState)(0);Et(()=>un(t=>t+1),dt||f?.kind==="running"?120:null);let dn=e.state.busySince?Math.floor((Date.now()-e.state.busySince)/1e3):0,mn=ye?"Writing\u2026":Ve?`${Ve.charAt(0).toUpperCase()}${Ve.slice(1)}\u2026`:e.state.workingLabel??(s==="design"?"Designing\u2026":"Thinking\u2026"),gn=e.state.turns.some(t=>t.role==="agent"),[fn,pn]=(0,p.useState)(0),[hn,xn]=(0,p.useState)(!1),[gt,bn]=(0,p.useState)(null),ue=(0,p.useRef)(0),ft=(0,p.useRef)(!1),pt=(0,p.useRef)(null),we=t=>{ue.current=t,pn(t)},ht=t=>{ft.current=t,xn(t)},de=t=>{pt.current=t,bn(t)},[Be,kn]=(0,p.useState)(null),Ke=(0,p.useRef)(null),me=t=>{Ke.current=t,kn(t)},[xt,yn]=(0,p.useState)(null),bt=(0,p.useRef)(null),$e=t=>{bt.current=t,yn(t)},[Qe,Tn]=(0,p.useState)(0),K=(0,p.useRef)(0),ve=t=>{K.current=t,Tn(t)},kt=M?M.questions[0]?.id??"b":null;(0,p.useEffect)(()=>{M&&ve(M.cursor<0?0:M.cursor)},[kt,M?.cursor]);let De=()=>{let t=H.current;if(!t)return;let a=t.questions.length;for(let i=1;i<=a;i++){let k=(K.current+i)%a;if(!t.resolution[k]){ve(k);return}}},yt=M?M.questions[Math.max(0,Math.min(M.questions.length-1,Qe))]:void 0,z=(0,p.useRef)(yt);z.current=yt;let H=(0,p.useRef)(M);H.current=M;let wn=M?`${kt}:${Qe}`:null;(0,p.useEffect)(()=>{if(de(null),me(null),$e(null),z.current){ht(!0);let t=H.current?.resolution[K.current]?.selected_index;we(t??z.current.recommended_index??0)}else ht(!1)},[wn]);let Ee=t=>{let a=H.current;return it(t,a?Fe(a)!=="":!1)},$n={isFocused:()=>ft.current&&z.current!=null&&pt.current==null&&Ke.current==null&&bt.current==null||O.current!=null&&O.current.kind!=="running"||G.current&&Bt.current==null,onMove:t=>{let a=z.current;if(a){we(Math.max(0,Math.min(Ee(a).maxSel,ue.current+t)));return}let i=O.current;if(i?.kind==="picker"){q({...i,sel:Math.max(0,Math.min(i.items.length-1,i.sel+t))});return}if(i?.kind==="ask"||i?.kind==="confirm"||i?.kind==="failed"){let k=(i.kind==="ask"?Me.current.length:i.kind==="failed"?_e.current.length:2)-1;q({...i,sel:Math.max(0,Math.min(k,i.sel+t))});return}i&&!G.current||G.current&&fe(Math.max(0,Math.min(Re.current.length-1,nt.current+t)))},onSelect:()=>{let t=z.current,a=H.current;if(!t||!a){let $=O.current;if($?.kind==="picker"){let W=$.items[$.sel];W&&(W.designed?q({kind:"confirm",item:W,sel:0}):Ye(W,!1));return}if($?.kind==="confirm"){on($.item)[$.sel]?.key==="redesign"?Ye($.item,!0):Je();return}if($?.kind==="ask"){let W=Me.current[$.sel]?.key;W==="another"?Je():W==="view"?rt(""):q(null);return}if($?.kind==="failed"){let W=_e.current[$.sel]?.key;W==="retry"?Ye($.item,$.force):W==="view"?rt(""):q(null);return}if($&&!G.current||!G.current)return;switch(Re.current[nt.current]?.key){case"finish":e.completeSession();return;case"continue":e.continueParked();return;case"design-chain":Je();return;case"view":rt("",ke.current);return;case"free":pe("");return}return}let i=Ee(t),k=ue.current;if(i.batchIdx!=null&&k===i.batchIdx){e.goWithRecommendations();return}if(i.freeIdx!=null&&k===i.freeIdx){de("");return}if(i.doneIdx!=null&&k===i.doneIdx){e.confirmMulti(K.current),De();return}if(t.multi_select){e.toggleOption(K.current,k);return}if(t.options[k]?.input===!0){me({opt:k,value:""});return}e.submitAnswer(K.current,k),De()},onLeft:()=>{H.current&&ve(Math.max(0,K.current-1))},onRight:()=>{let t=H.current;t&&ve(Math.min(t.questions.length-1,K.current+1))},onDigit:t=>{let a=z.current;if(a){t-1<a.options.length&&we(t-1);return}let i=O.current;if(i?.kind==="picker"){t-1<i.items.length&&q({...i,sel:t-1});return}if(i?.kind==="ask"){t-1<Me.current.length&&q({...i,sel:t-1});return}if(i?.kind==="failed"){t-1<_e.current.length&&q({...i,sel:t-1});return}if(i?.kind==="confirm"){t-1<2&&q({...i,sel:t-1});return}if(!(i&&!G.current)&&G.current){let k=Re.current,$=0;for(let _=0;_<k.length;_++)if(!k[_].free&&($+=1,$===t)){fe(_);return}}},isMulti:()=>{let t=z.current;return!!t?.multi_select&&ue.current<(t?.options.length??0)},onSpace:()=>{H.current&&e.toggleOption(K.current,ue.current)},onTab:()=>{let t=z.current;if(!t)return;let a=Ee(t);a.batchIdx!=null&&we(a.batchIdx)},onType:t=>{let a=z.current;if(a){if(t==="@"&&e.canIngest()){$e("");return}let i=ue.current;if(a.options[i]?.input===!0){me({opt:i,value:t});return}if(!a.allow_free_text)return;let k=Ee(a);we(k.freeIdx??0),de(t);return}if(!(O.current&&!G.current)&&G.current){let i=Wt(Re.current);if(i==null)return;fe(i),pe(t)}},onBack:()=>{let t=O.current;if(t&&t.kind!=="running"){q(null);return}let a=H.current;if(a){for(let i=K.current-1;i>=0;i--)if(a.resolution[i]){ve(i);return}}}},vn=gt!=null?{value:gt,onChange:t=>de(t),onSubmit:t=>{de(null),t.trim()&&H.current&&(e.submitFreeText(K.current,t),De())},onCancel:()=>de(null)}:null,Sn=xt!=null?{value:xt,onChange:t=>$e(t),onSubmit:t=>{$e(null),t.trim()&&e.ingestAttach(t)},onCancel:()=>$e(null)}:null,In=Be!=null?{optionIndex:Be.opt,value:Be.value,onChange:t=>me({opt:Be.opt,value:t}),onSubmit:t=>{let a=Ke.current?.opt;me(null),a!=null&&H.current&&(e.submitAnswerWithText(K.current,a,t),De())},onCancel:()=>me(null)}:null,Tt=o??(()=>e.requestPause()),ie=e.state.checkpoint,Se=f?.kind==="running"&&Z==="idle",Ie=Z==="idle"&&gn&&!M&&!b&&(!f||Se),G=(0,p.useRef)(!1);G.current=Ie;let J=oe(e.state.turns).entries.length,Ce,Y;for(let t=j.length-1;t>=0;t--){if(B.current.some(i=>i.end!=null&&t>=i.start&&t<i.end))continue;let a=j[t];if(!Ce&&a.kind==="commit"&&a.ok&&(Ce=a.line),!Y&&a.kind==="banner"&&a.text.startsWith("designing: ")&&(Y=a.text.slice(11)),Ce&&Y)break}let He;for(let t=j.length-1;t>=0;t--){let a=j[t];if(a.kind==="user")break;if(a.kind==="commit"&&a.ok&&/\bapplied\b/.test(a.line)){He=a.line;break}}let te=Y?{"acceptance criteria":"scenarios",scenarios:"acceptance criteria + exercises","acceptance criteria + exercises":"tests + gaps"}[Y]:void 0,wt={"acceptance criteria":"the promises every path of this use-case must keep",scenarios:"the concrete user journeys that exercise those promises","acceptance criteria + exercises":"the wiring pass \u2014 per-journey checks, tied to the promises each journey exercises","tests + gaps":"runnable browser tests \u2014 anything unautomatable is recorded as a gap"},$t=Y?wt[Y]:void 0,vt=te?wt[te]:void 0,Cn="phases: acceptance criteria \u2192 scenarios \u2192 wiring \u2192 tests \xB7 stop anytime with finish",Rn=(()=>{for(let t=j.length-1;t>=0;t--){let a=j[t];if(a.kind==="agent")return a.text}return null})(),ge=/\?\s*$/.test((Rn??"").trimEnd()),St=s==="design"&&!ie&&(ge||te!==void 0),It=Y==="tests + gaps",Le=f?.kind==="running"?f.title:"the design",Ct=!!e.state.error&&!e.senderAlive(),An=ce?"the agent needs a clarification before it can apply that":Se&&!ie?ge?`${Le} \u2014 the agent asked a question`:He?`${Le} \u2014 ${He}`:It?`${Le} \u2014 design complete`:`${Le} \u2014 the agent is waiting on you`:ie?Y?`${Y} done${te?` \u2014 next: ${te}`:""}`:Ce??"phase done":Ct?"the agent stopped \u2014 the session is view-only":St?ge?"the agent asked a question \u2014 answer or continue":`design incomplete \u2014 ${te} not started`:Ce??"waiting on you",Xe=ce?[{key:"free",label:"clarify \u2014 type which one you meant",free:!0}]:Se&&!ie?It&&!ge?[{key:"finish",label:"finish this design"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:[{key:"continue",label:ge?"continue \u2014 go with your suggestion":"continue designing"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish this design"},{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:ie?[{key:"continue",label:te?`continue to ${te}`:"continue"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish here"},{key:"free",label:"adjust \u2014 tell me what to change",free:!0}]:Ct?[...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"tell me what to change",free:!0}]:St?[{key:"continue",label:ge?"continue \u2014 go with your suggestion":`continue \u2014 ${te} next`},...J>0?[{key:"view",label:"view the design"}]:[],{key:"finish",label:"finish anyway"},{key:"free",label:"reply \u2014 answer and continue",free:!0}]:[{key:"finish",label:s==="design"?"finish":"looks good \u2014 finish the session"},...c?[{key:"design-chain",label:"design tests for a use-case\u2026"}]:[],...J>0?[{key:"view",label:s==="design"?"view the design":`view the ${J} draft${J===1?"":"s"}`}]:[],{key:"free",label:s==="design"?"keep adjusting \u2014 tell me what to change":"tell me what to change",free:!0}],ze=[{key:"another",label:"design another use-case\u2026"},...J>0?[{key:"view",label:"view what was designed"}]:[],{key:"back",label:"done \u2014 back"}],Me=(0,p.useRef)(ze);Me.current=ze;let Ge=[{key:"retry",label:"try again"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"back",label:"back"}],_e=(0,p.useRef)(Ge);_e.current=Ge;let Je=()=>{let t=c?.listUcs()??[];if(t.length===0){I("no use-cases to design yet");return}q({kind:"picker",items:t,sel:0})},Ye=(t,a)=>{let i={start:e.state.ledger.length,end:null};B.current.push(i);let k=()=>{i.end=e.state.ledger.length};q({kind:"running",title:t.title,item:t,force:a,startedAt:Date.now()}),c.runDesignChild(t.key,a).then($=>{k(),$===0?(e.ledger({kind:"commit",ok:!0,line:`designed ${t.title}`}),q({kind:"ask",title:t.title,sel:0})):(e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 child exited ${$}`}),q({kind:"failed",item:t,force:a,detail:`child exited ${$}`,sel:0}))}).catch($=>{k();let _=$ instanceof Error?$.message:String($);e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 ${_}`}),q({kind:"failed",item:t,force:a,detail:_,sel:0})})},Re=(0,p.useRef)(Xe);Re.current=Xe;let Ze=Ie&&ie&&$t!==void 0,et=B.current.find(t=>t.end==null)?.start??"top",Rt=(0,p.useRef)(new Set),[Bn,At]=(0,p.useState)(!1);(0,p.useEffect)(()=>{Ze?Rt.current.has(et)||(Rt.current.add(et),At(!0)):At(!1)},[Ze,et]);let Dn=Ze?[...Bn?[Cn]:[],`${$t}${vt?` \xB7 next: ${vt}`:""}`]:[],[En,Ln]=(0,p.useState)(0),[tt,Mn]=(0,p.useState)(null),nt=(0,p.useRef)(0),Bt=(0,p.useRef)(null),fe=t=>{nt.current=t,Ln(t)},pe=t=>{Bt.current=t,Mn(t)},_n=`${Ie}:${ie}:${ke.current}`;(0,p.useEffect)(()=>{fe(0),pe(null)},[_n]);let On=tt!=null?{value:tt,onChange:t=>pe(t),onSubmit:t=>{pe(null),fe(0);let a=t.trim();a&&(I(null),e.submit(a))},onCancel:()=>{pe(null),fe(0)}}:null,rt=(t,a)=>{if(/^(uc|sc|ac|t|gap|sty)-\d+$/i.test(t.trim())){let _=t.trim().toLowerCase(),Oe=oe(e.state.turns).entries.findIndex(N=>(N.item.logical_id??"").toLowerCase()===_);if(Oe<0){I(`${t.trim().toUpperCase()} isn't in this session's items \u2014 view lists what this session minted`);return}S({level:"detail",cursor:Oe,scroll:0}),L(null);return}let i=rn(t);if("error"in i){I(i.error);return}let k=oe(e.state.turns);if(k.entries.length===0){I("nothing proposed yet \u2014 the first turn is still coming");return}if(i.level==="detail"&&i.num>k.entries.length){I(`no item ${i.num} \u2014 the set has ${k.entries.length} item${k.entries.length===1?"":"s"}`);return}let $=a!=null?lt(k,a):k;S(tn(i,$)),L(a!=null&&$.entries.length<k.entries.length?a:null)},Dt=(0,A.jsx)(Ut,{verb:s,subject:ut,pendingCount:cn,creditsTotal:e.state.credits?.total,state:Se?"waiting on you":M||Ie||b||f&&f.kind!=="running"?"idle":void 0});if(b){let t=oe(e.state.turns),a=C!=null?lt(t,C):t,i=t.entries.length-a.entries.length,k=b.level==="list"&&i>0,$=a.entries.length+(k?1:0),_=a.entries[b.cursor],W=b.level==="detail"&&_?e.explainLines(_.item.slug??_.item.temp_ref):null,Oe=b.level==="detail"&&_&&d?d(_.item.logical_id??e.aliasOf(_.item.temp_ref)??_.item.temp_ref):null;return(0,A.jsxs)(T,{flexDirection:"column",children:[(0,A.jsx)(st,{onToggleThinking:()=>g(N=>!N),onCtrlC:Tt,explorer:{isOpen:()=>D.current!==null,onMove:N=>S(D.current&&Ue(D.current,{type:"move",delta:N},$)),onEnter:()=>{let N=D.current;if(N){if(N.level==="list"&&k&&N.cursor===a.entries.length){L(null);return}S(Ue(N,{type:"enter"},$))}},onBack:()=>{S(D.current&&Ue(D.current,{type:"back"},$)),setTimeout(()=>m(N=>N+1),0)}}}),(0,A.jsx)(nn,{items:a,state:b,verb:s,more:k?{hidden:i}:null,explain:W,grandTotal:t.entries.length,dossier:Oe}),(P??h)&&(P??h).split(`
7
+ `).map((N,qn)=>(0,A.jsx)(n,{color:r.orange,children:N},`nt-${qn}`)),Dt]})}return(0,A.jsxs)(T,{flexDirection:"column",children:[(0,A.jsx)(st,{onToggleThinking:()=>g(t=>!t),onCtrlC:Tt,panel:$n}),ln&&(0,A.jsx)(qt,{thinking:an.body,expanded:!0,thinkingDone:Z!=="streaming",maxLines:sn+1}),ct.length>0&&(0,A.jsx)(T,{flexDirection:"column",children:ct.map((t,a)=>(0,A.jsx)(n,{children:_t(t).map((i,k)=>(0,A.jsx)(n,{bold:i.bold,italic:i.italic,color:i.code?r.dim:void 0,children:i.text},k))},`st-${a}`))}),M&&(0,A.jsx)(jt,{batch:M,qView:Qe,sel:fn,focused:hn,freeText:vn,optionText:In,attach:Sn,canAttach:e.canIngest(),multiSelFor:t=>e.multiSelection(t)}),ce&&(0,A.jsx)(n,{color:"yellow",children:ce.prompt}),(P??h)&&(P??h).split(`
8
+ `).map((t,a)=>(0,A.jsx)(n,{color:r.orange,children:t},`nt-${a}`)),dt&&!M&&(0,A.jsxs)(n,{color:r.assuranceAccent,children:[`${je[mt%je.length]} ${mn} `,(0,A.jsx)(n,{color:r.dim,children:`(${dn}s)`})]}),Ie&&(0,A.jsx)(he,{headline:An,rows:Xe,sel:En,focused:tt==null,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 type = your own words",freeText:On,sublines:Dn}),f?.kind==="picker"&&(0,A.jsx)(he,{ask:!0,headline:"design tests for which use-case?",rows:f.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),f?.kind==="confirm"&&(0,A.jsx)(he,{ask:!0,headline:`${f.item.title} is already designed${f.item.designed==="stale"?" \u2014 and the use-case has changed since":""}`,rows:on(f.item).map(t=>({key:t.key,label:t.label,detail:t.detail})),sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),f?.kind==="running"&&!Se&&(0,A.jsxs)(n,{color:r.assuranceAccent,children:[`${je[mt%je.length]} Designing ${f.title}\u2026 `,(0,A.jsx)(n,{color:r.dim,children:`(${Math.floor((Date.now()-f.startedAt)/1e3)}s)`})]}),f?.kind==="ask"&&(0,A.jsx)(he,{headline:`designed ${f.title}`,rows:ze,sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),f?.kind==="failed"&&(0,A.jsx)(he,{headline:`design failed \u2014 ${f.item.title} (${f.detail})`,rows:Ge,sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),Z==="pausing"&&(0,A.jsx)(n,{color:r.dim,children:"pausing \u2014 saving session\u2026 (ctrl+c again = force quit)"}),Dt]})}export{Kr as ChatSurface,tr as tailVisualRows};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-EAUUULJQ.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.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-LR5XO2KD.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.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-FSB3FTIQ.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.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-L7VREJTG.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.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-MRP54NCJ.js";import"./chunk-XXMNUJX4.js";import"./chunk-5Y2G4NC7.js";import"./chunk-MMPFU2YC.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-LQZ2BU7Q.js";import"./chunk-R2RGSO4B.js";import"./chunk-5Y2G4NC7.js";import"./chunk-C4G7RVJ6.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 p,b as l,c as n}from"./chunk-QJIJC3KC.js";import{y as o}from"./chunk-MMPFU2YC.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
2
+ import{a as p,b as l,c as n}from"./chunk-73C4PRYU.js";import{y as o}from"./chunk-C4G7RVJ6.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-2KBD6JZX.js";import"./chunk-DQ54MH7F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-RFHMDQXZ.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-SURF5Z7Y.js";import"./chunk-YCCUBQY4.js";import"./chunk-GIMTSDNC.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
2
+ import{a,b}from"./chunk-323MLBYA.js";import"./chunk-YCCUBQY4.js";import"./chunk-KNDSQ4PS.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.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 as f,b as r,y as t}from"./chunk-MMPFU2YC.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as s,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as v}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(v(),1);var e=h(T(),1),b="https://www.testmuai.com/support/docs/kane-cli-introduction",S="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:a}=p(),l=a?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>c(),50);return()=>clearTimeout(m)},[c]),(0,e.jsxs)(s,{flexDirection:"column",children:[(0,e.jsxs)(s,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:r}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(g,{cmd:`${r}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${r} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${r} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${r} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${r} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${r} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{cmd:`${r} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(s,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,children:["Terminal tab-completion is a shell feature; ",r," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",r,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(i,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(i,{cmd:"testrun",args:"run",desc:"Run M *_test.md files as one sealed execution"}),(0,e.jsx)(i,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(i,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(i,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(i,{cmd:"config",args:"show|set-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(0,e.jsx)(i,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(i,{cmd:"evidence",args:"validate|serve|merge",desc:"Validate, serve (viewer) or merge evidence packs"}),(0,e.jsx)(i,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"}),(0,e.jsx)(i,{cmd:"context",args:"ingest|extract|list|review|sessions|\u2026",desc:"Build & manage the assurance context store"}),(0,e.jsx)(i,{cmd:"design",args:"tests --use-case <ref>",desc:"Design tests from the context store"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(i,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(i,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(i,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(i,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(n,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(n,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(n,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(n,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(n,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(n,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(n,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(n,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(n,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(n,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(n,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(n,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(n,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(n,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(n,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(n,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(n,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(n,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(n,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(n,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${r} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${r} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${r} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${r} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[r," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",r," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(s,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(l-2,70))}),(0,e.jsxs)(s,{gap:3,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:b})]}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:c,children:a}){return(0,e.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(s,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dim,children:c})}),a]})}function g({cmd:c,desc:a,highlight:l}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:l?t.orange:t.orange,children:c})]}),(0,e.jsx)(o,{color:t.dim,children:a})]})}function i({cmd:c,args:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsx)(s,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:c})}),(0,e.jsx)(s,{width:32,children:a?(0,e.jsx)(o,{color:t.dim,children:a}):null}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function n({long:c,arg:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:c}),a&&(0,e.jsxs)(o,{color:t.dim,children:[" ",a]})]}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function u({label:c,cmd:a}){return(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",c]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",a]})]})}export{L as HelpView};
2
+ import{a as f,b as r,y as t}from"./chunk-C4G7RVJ6.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as s,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as v}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(v(),1);var e=h(T(),1),b="https://www.testmuai.com/support/docs/kane-cli-introduction",S="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:a}=p(),l=a?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>c(),50);return()=>clearTimeout(m)},[c]),(0,e.jsxs)(s,{flexDirection:"column",children:[(0,e.jsxs)(s,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:r}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(g,{cmd:`${r}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${r} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${r} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${r} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${r} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${r} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{cmd:`${r} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(s,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,children:["Terminal tab-completion is a shell feature; ",r," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",r,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(i,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(i,{cmd:"testrun",args:"run",desc:"Run M *_test.md files as one sealed execution"}),(0,e.jsx)(i,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(i,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(i,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(i,{cmd:"config",args:"show|set-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(0,e.jsx)(i,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(i,{cmd:"evidence",args:"validate|serve|merge",desc:"Validate, serve (viewer) or merge evidence packs"}),(0,e.jsx)(i,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"}),(0,e.jsx)(i,{cmd:"context",args:"ingest|extract|list|review|sessions|\u2026",desc:"Build & manage the assurance context store"}),(0,e.jsx)(i,{cmd:"design",args:"tests --use-case <ref>",desc:"Design tests from the context store"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(i,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(i,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(i,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(i,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(n,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(n,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(n,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(n,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(n,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(n,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(n,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(n,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(n,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(n,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(n,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(n,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(n,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(n,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(n,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(n,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(n,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(n,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(n,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(n,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${r} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${r} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${r} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${r} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[r," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",r," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(s,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(l-2,70))}),(0,e.jsxs)(s,{gap:3,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:b})]}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:c,children:a}){return(0,e.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(s,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dim,children:c})}),a]})}function g({cmd:c,desc:a,highlight:l}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:l?t.orange:t.orange,children:c})]}),(0,e.jsx)(o,{color:t.dim,children:a})]})}function i({cmd:c,args:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsx)(s,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:c})}),(0,e.jsx)(s,{width:32,children:a?(0,e.jsx)(o,{color:t.dim,children:a}):null}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function n({long:c,arg:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:c}),a&&(0,e.jsxs)(o,{color:t.dim,children:[" ",a]})]}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function u({label:c,cmd:a}){return(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",c]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",a]})]})}export{L as HelpView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-MMPFU2YC.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-APAIWBIH.js";import"./chunk-73C4PRYU.js";import"./chunk-C4G7RVJ6.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-KSZ72BSC.js";import"./chunk-MMPFU2YC.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-CSQ46PJ7.js";import"./chunk-C4G7RVJ6.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-NTGYFYBP.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.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-CDQX6HGJ.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.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-GLA6QL3T.js";import"./chunk-YCCUBQY4.js";import"./chunk-GIMTSDNC.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.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-JKTFTF24.js";import"./chunk-YCCUBQY4.js";import"./chunk-KNDSQ4PS.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.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-7NLQ3QQD.js";import"./chunk-S3DAAAE5.js";import"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-MMPFU2YC.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-NJPTOKW5.js";import"./chunk-S3DAAAE5.js";import"./chunk-APAIWBIH.js";import"./chunk-73C4PRYU.js";import"./chunk-C4G7RVJ6.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-SRDHPKJT.js";import"./chunk-RNSSM2BK.js";import"./chunk-3FN5VJMV.js";import"./chunk-L5LI2JF4.js";import"./chunk-TDPWFYTJ.js";import"./chunk-DXV6MBTD.js";import"./chunk-KT6G7AF2.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-JKTFTF24.js";import"./chunk-323MLBYA.js";import"./chunk-YCCUBQY4.js";import"./chunk-KNDSQ4PS.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-VE3SUJMA.js";import"./chunk-F6ZOJXYU.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.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-2WKX3RMA.js";import"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-MMPFU2YC.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-XVDJ423L.js";import"./chunk-APAIWBIH.js";import"./chunk-73C4PRYU.js";import"./chunk-C4G7RVJ6.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-NBKQT7LJ.js";import"./chunk-IXVOXJP6.js";import"./chunk-UI7KULSI.js";import"./chunk-TDPWFYTJ.js";import"./chunk-DXV6MBTD.js";import"./chunk-R2RGSO4B.js";import"./chunk-5Y2G4NC7.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-JRMDGLLT.js";import"./chunk-APAIWBIH.js";import"./chunk-73C4PRYU.js";import"./chunk-DFS4RMVP.js";import"./chunk-C4G7RVJ6.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 as b,b as r}from"./chunk-QJIJC3KC.js";import{y as o}from"./chunk-MMPFU2YC.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-73C4PRYU.js";import{y as o}from"./chunk-C4G7RVJ6.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"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-OGLK7MPV.js"),import("./resolver-IDCGRPFJ.js"),import("./config-QISRENF5.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-7KXVKAD5.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-XN4ROCQ3.js"),import("./resolver-IDCGRPFJ.js"),import("./config-R3GF2FZA.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-AH5FTUYU.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};
@@ -0,0 +1,12 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b}from"./chunk-HJERKSBK.js";import"./chunk-IBNC444G.js";import"./chunk-KHU7C6EE.js";import"./chunk-KVQOBPAZ.js";import"./chunk-AM5S4KG4.js";import"./chunk-5JTUL6XL.js";import"./chunk-O56PUUNL.js";import"./chunk-NRC2G4Y5.js";import"./chunk-BQHKBOSF.js";import"./chunk-2XGDWUJ5.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-5KFS3GAZ.js";import"./chunk-EV3EHXEI.js";import"./chunk-F7WKDMX7.js";import"./chunk-VOHQA2SP.js";import"./chunk-XDHZMCTA.js";import"./chunk-AAONIIQV.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-ZLCZDAEX.js";import"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-GVIPTX6T.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as g}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-5EOX4MEY.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";import{existsSync as N}from"fs";var O=new Set(["interactive","agent","ci","override"]);function Y(e){return e.mode!=null&&!O.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 l=async(t,n)=>{if(process.stderr.write(t+`
3
+ `),e.mode!=="agent")return 2;let{makeHeadlessIO:s,agentRefusal:d}=await import("./headless-io-BL3TEAX5.js");return d(s("ndjson","design"),t,n)},h=Y(e);if("error"in h)return l(h.error);let i=h;{let{validateResumeMessage:t}=await import("./headless-io-BL3TEAX5.js"),n=t(i,"design");if(n)return l(n)}{let{gateStructuredFlags:t}=await import("./structured-answers-QHFGZPSS.js"),n=t(e,"design");if(n)return l(n,"STRUCTURED_FLAGS_USAGE")}if(!N(g(process.cwd())))return l("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let v=!!i.resume;if(i.useCase&&i.resume&&!e.allowUnreviewed)try{let{peekSession:t}=await import("./sessions-BLXZVK5U.js"),n=t(g(process.cwd()),i.resume);v=!!(n&&n.use_case===i.useCase)}catch{v=!1}if(i.useCase&&!v&&!e.allowUnreviewed)try{let[{openGraph:t},{designEntryCheck:n}]=await Promise.all([import("./readmodel-X7L7W2BA.js"),import("./trust-gate-EX7R2P4Y.js")]),s=n(t(g(process.cwd())),i.useCase);if(!s.ok&&(s.code==="UC_UNREVIEWED"||s.code==="UC_ARCHIVED"))if((i.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:m}=await import("readline/promises"),c=m({input:process.stdin,output:process.stderr}),p=(await c.question(`design: ${s.detail}
4
+ Design against it anyway? (y/N) `)).trim().toLowerCase();if(c.close(),p!=="y"&&p!=="yes")return process.stderr.write(`aborted \u2014 approve it first: ${s.reviewCmd}
5
+ `),2}else if(e.mode==="agent"){let{makeHeadlessIO:m}=await import("./headless-io-BL3TEAX5.js"),c=m("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 ${i.useCase} --mode agent --allow-unreviewed`]}),2}else return process.stderr.write(`design: ${s.detail} (${s.reviewCmd})
6
+ `),2}catch(t){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(t)}
7
+ `)}let r=null,y=null;try{if(!i.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
8
+ `),2;let t=i.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:o}=await import("./interactive-bind-43HGDF5K.js");return await o(i)}let{resolveAgentAuthEnv:n}=await import("./spawner-AH5FTUYU.js"),{runAgent:s}=await import("./bridge-T4HL4TG7.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:m}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:p,resolveEncoding:k,guardedChannels:S}=await import("./headless-io-BL3TEAX5.js"),{withStructuredNext:_,prepareStructuredResume:A}=await import("./structured-answers-QHFGZPSS.js");r=_(p(k(t),"design"));let{telemetryBootstrap:R,telemetryEnvName:U}=await import("./bootstrap-CNOZ5VRB.js"),u=R({verb:"design",mode:t,contextRoot:g(process.cwd()),env:U(),resumeSid:i.resume,write:!0,longSession:!0});y=o=>u.end(o);let x={...await n(),...u.spawnEnv()},a=A({opts:e,contextDir:g(process.cwd()),verb:"design"});if(a.kind==="refuse")return r.out(a.error),t==="agent"&&r.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?r.done(2,"refused"):2;let T;if(a.kind==="apply"){for(let o of a.notes)r.out(o);if(a.matchedQids.length>0){r.out(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let o of a.matchedQids)r.event({type:"panel_resolved",id:o,by:"user",via:"flag"})}a.statement&&(T=[i.message,a.statement].filter(Boolean).join(`
10
+
11
+ `))}let E=c();E&&r.out(E);let f=m(s,o=>r.out(o)),C=S(r,()=>f.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let o=t==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async $=>{let{createInterface:I}=await import("readline/promises"),D=I({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await D.question(`${$} [y/N] `)).trim())}finally{D.close()}}:void 0,w=await b({...i,mode:t,...T!==void 0?{message:T}:{},...o?{confirmRetarget:o}:{}},{contextDir:g(process.cwd()),agent:f.agent,preflightTurn:()=>d(x),ask:async()=>[],out:C.out,emit:C.emit,progress:r.progress,isTTY:!1,auth:x,telemetry:u});return f.interrupted()&&w!==3?(r.out("interrupted \u2014 no session saved"),await u.end({exit_code:130}),r.done(130)):(w===1&&r.out(u.supportFooter()),await u.end({exit_code:w}),r.done(w))}finally{f.dispose()}}catch(t){y&&await y({exit_code:1}).catch(()=>{});let n=t instanceof Error?t.message:String(t);r?.event({type:"error",message:`error: design failed: ${n}`});let s=r?d=>r.out(d):d=>process.stderr.write(d+`
12
+ `);return s(`error: design failed: ${n}`),(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'),r?r.done(1):1}}export{B as designTestsCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-IQDWBTRJ.js";import"./chunk-GVIPTX6T.js";import"./chunk-BKM2LWU2.js";import"./chunk-2XMJ6YAE.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-C4G7RVJ6.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-WJ5HDEVH.js";import"./chunk-UX2B7L6K.js";import"./chunk-XDHZMCTA.js";import"./chunk-C4G7RVJ6.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{c as i,g as c}from"./chunk-MMPFU2YC.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{c as i,g as c}from"./chunk-C4G7RVJ6.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};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as V,c as te}from"./chunk-JFAFKHDX.js";import{a as k,b as ee}from"./chunk-5KFS3GAZ.js";import{a as ne}from"./chunk-427OQS2N.js";import{d as Z}from"./chunk-NVGBE2DR.js";import{a as X}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import{e as Y,f as z,w as Q}from"./chunk-3STZLM5J.js";import{a as j,b as F}from"./chunk-L4JIMNKW.js";import{f as J,i as W}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import{e as L,f as A,g as P,h as x}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var de=new Set(["approve","edit","reject"]);function ye(m){let{contextDir:f,graph:s,ops:oe,by:l}=m,N=m.mintable??ne(),T=J(f);if(s.latestHash!==T)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]};let C=[],h=[],M=new Set;for(let e of oe){if(s.appliedEvents.has(e.eventId)||M.has(e.eventId)){C.push(e.eventId);continue}M.add(e.eventId),h.push(e)}if(h.length===0)return{record:null,errors:null,applied:[],skipped:C,minted:[],staleDelta:[]};let o=[],$=[],I=[],v=[],b=[],O=[],_=[...m.judgements??[]],D=[],q=new Map,B=new Set,G=[],E=new Set,se=new Set(N),H=new Set;for(let e of h){if(!de.has(e.kind))continue;let n=e.target,t=s.resolve(n)?.cid??n;H.has(t)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),H.add(t)}let S=(e,n,t)=>{let r=s.resolve(n);if(!r)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let p=s.tipOf(r.cid);return p!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:p}}),null):t};for(let e of h)if(e.kind==="approve"){let n=S("approve",e.target,e.expectedCid);n&&v.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l})}else if(e.kind==="reject"){let n=S("reject",e.target,e.expectedCid);if(!n)continue;if(v.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:l}),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}b.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:l})}}else if(e.kind==="edit"){let n=S("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 r={...t.content};for(let[c,u]of Object.entries(e.edit))u!==void 0&&(r[c]=u);if(typeof r.title=="string"&&!r.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let p=A(t.label,r);if(p.length>0){for(let c of p)o.push({code:c.code,detail:`edit ${e.target}: ${c.detail}`});continue}let d=j(t.label,r);if(d===n){v.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l});continue}$.push({cid:d,label:t.label,content:r}),b.push({kind:"node",old:n,new:d,reason:e.reason??"edited in chat",by:l}),v.push({id:d,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:l})}else if(e.kind==="enhance"){if(!S("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let r=s.nodeLabel.get(t.src)??"(unknown)",p=s.nodeLabel.get(t.dst)??"(unknown)";for(let i of x(t.type,r,p,t.props))o.push({code:i.code,detail:`enhance ${e.target}: ${i.detail}`});let d=F(t.type,t.src,t.dst,t.props);if(s.edgesFrom(t.src).some(i=>i.ecid===d)||I.some(i=>i.ecid===d))continue;let c=Y(s,t.type,t.src,t.dst,G);c&&o.push(c);let u=z(s,t.type,t.src,t.dst);u&&o.push(u);let a=P(t.type)?.cardinality;if(a==="one-live-per-src"||a==="one-live-per-src-and-dst"){let i=`${t.type}|${t.src}`;E.has(i)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${t.src}: two one-live edges in one turn`}),E.add(i)}if(a==="one-live-per-src-and-dst"){let i=`${t.type}|dst|${t.dst}`;E.has(i)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${t.dst}: two one-live edges in one turn (strict 1:1)`}),E.add(i)}I.push({ecid:d,type:t.type,src:t.src,dst:t.dst,props:t.props}),G.push({src:t.src,dst:t.dst,type:t.type})}}else if(e.kind==="add"){if(!se.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${N.join("|")})`,data:{gate:[...N]}});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 r=s.getNode(n)?.content?.blob,p=typeof r=="string"?Z(f,r)?.toString("utf8")??"":"",d=ee(p,e.cite.turn);if(d===null){o.push({code:"BAD_ANCHOR",detail:`add: ${k(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!d.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${k(e.cite.turn)}`});continue}let c={...e.content,derived:!0},u=A(e.label,c);if(u.length>0){for(let g of u)o.push({code:g.code,detail:`add: ${g.detail}`});continue}let a=j(e.label,c),i={source_id:e.convSourceId,source_cid:n,anchor:k(e.cite.turn),quote:e.cite.quote};for(let g of x(L.DERIVES,"source",e.label,i))o.push({code:g.code,detail:`add: ${g.detail}`});$.push({cid:a,label:e.label,content:c}),I.push({ecid:F("DERIVES",n,a,i),type:L.DERIVES,src:n,dst:a,props:i}),e.rationale&&_.push({about:a,rationale:e.rationale,by:l});let y=Q(e.label,g=>B.has(g),s.names.keys());y!==null&&(B.add(y),O.push({cid:a,slug:y,by:l})),D.push({cid:a,...y!==null?{slug:y}:{}}),q.set(e.eventId,a)}if(o.length)return{record:null,errors:o};let U=new Date().toISOString();for(let e of h){if(e.kind==="add"){let n=q.get(e.eventId);n&&V(f,{ts:U,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:l,event_id:e.eventId,target:n});continue}for(let n of te(e,{ts:U,command:"extract-chat",by:l}))V(f,n)}let K=h.map(e=>e.eventId).sort(),ie=W(f,{ts:new Date().toISOString(),proposal_id:null,nodes:$,edges:I,review:v,supersessions:b,...O.length>0?{names:O}:{},..._.length>0?{judgements:_}:{},event_ids:K,...m.sid?{sid:m.sid}:{},source_head_moves:{}},{expectPrev:T}),R=X(f),w=new Set;for(let e of b)if(e.kind==="node"){w.add(e.old);for(let n of R.edgesInto(e.old))w.add(n.src)}for(let e of D)w.add(e.cid);let re=[...w].map(e=>({cid:e,state:R.stale(R.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:ie.record,errors:null,applied:K,skipped:C,minted:D,staleDelta:re}}export{ye as commitChatTurn};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-SY3HLQMV.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-5KFS3GAZ.js";import"./chunk-NVGBE2DR.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as L}from"./chunk-RFHMDQXZ.js";import{Q as O,S}from"./chunk-JXKRO2ZJ.js";import{m as P,n as R}from"./chunk-Y5RNCJAN.js";import{y as s}from"./chunk-MMPFU2YC.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
2
+ import{Q as O,S}from"./chunk-DQ54MH7F.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{m as P,n as R}from"./chunk-W6VD2XFO.js";import{y as s}from"./chunk-C4G7RVJ6.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as o,b as i}from"./chunk-IQDWBTRJ.js";import{resolve as c}from"path";async function w(n,s,r={}){let e=i({verb:n,mode:"cli",contextRoot:c(process.cwd(),".context"),env:o(),write:r.write});try{let t=await s();return r.write&&t===0&&await e.lateBindContext(c(process.cwd(),".context")),t===1&&process.stderr.write(e.supportFooter()+`
3
+ `),await e.end({exit_code:t}),t}catch(t){throw e.error("cli_crash"),process.stderr.write(e.supportFooter()+`
4
+ `),await e.end({exit_code:1}),t}}export{w as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as N}from"./chunk-L2TV4G56.js";import{b as y,c as E,d as $,f as O,g as A,h as V,i as I,j as T}from"./chunk-AAONIIQV.js";import{c as P}from"./chunk-GVIPTX6T.js";import{a as x,f as C}from"./chunk-M7WQM4UA.js";var G={extract:e=>`kane-cli context extract --resume ${e}`,design:e=>`kane-cli design tests --resume ${e}`};function Q(e,n,s){if(e===void 0||e===n)return null;if(e==="extract"||e==="design"){let a=G[e](s);return{code:"WRONG_VERB",message:`error: session ${s} is a ${e} session \u2014 resume it with ${a}`,next:[{cmd:a,why:`this session belongs to a ${e} run`}]}}return{code:"WRONG_VERB",message:`error: session ${s} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}import{existsSync as K}from"fs";import{join as M}from"path";function ne(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function B(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,s)=>({id:`o${s}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function se(e,n){e.save({agent_state:n.agent_state,pending:{questions:n.pending.questions.map(B),proposals:n.pending.proposals??[]},assumed:n.assumed.map(s=>({questionId:s.question_id,optionId:s.option_id,flagged:!0,eventId:`assumed:${n.sid}:${s.question_id}`}))}),e.release(),$(e.state.sid)}function te(e){return{persist(n){let s=e.seqBase(),a={seq:n.seq+s,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},l={applied_events:[...new Set([...e.handle.state.applied_events,...V(e.contextDir,e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(B):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:C(e.contextDir),...(()=>{let o=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],p=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...o.length?{ingest_registry:o}:{},...p.length?{ingest_schedule:p}:{}}})()};return O(e.contextDir,e.handle,a,l,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}var m=class extends Error{constructor(s,a,l=[]){super(`${s}: ${a}`);this.code=s;this.next=l}};async function ie(e,n,s,a={}){let l=a.deps??{},o=P(e,n);try{let p=o.state.checkpoint??null,w=K(M(e,"sessions",n,y,E)),j=!p&&o.state.agent_state.items.length>0;if(!p&&!w||j)throw new m("SESSION_V1",`session ${n} predates durable checkpoints \u2014 this build cannot resume it; abandon it with kane-cli context sessions clean ${n} and start a fresh run (committed work is untouched)`,[{cmd:`kane-cli context sessions clean ${n}`,why:"abandon the pre-checkpoint session, then start a fresh run"}]);!p&&w&&l.onWarn?.(`session ${n}: checkpoint chain present with no pointer \u2014 recovering from the chain`);let c=A(e,n);c.orphans.length>0&&T(e,n,c.orphans),c.fallback&&l.onWarn?.(`session ${n}: chain truncated to checkpoint ${c.fallback.resumableAt} \u2014 ${c.fallback.turnsLost} turn(s) lost to a corrupt record`);let r=c.base;if(a.verb){let i=Q(r.verb,a.verb,n);if(i)throw new m("WRONG_VERB",i.message,i.next)}if(a.useCase!==void 0&&a.useCase!==r.use_case&&!await(l.confirmRetarget?.(r.use_case,a.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",r.use_case?`session ${n} was designing ${r.use_case}; resuming onto ${a.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${a.useCase} needs an explicit retarget`,r.use_case?[{cmd:`kane-cli design tests --resume ${n}`,why:`continue on ${r.use_case} (the session's own subject)`}]:[]);let d=c.kane,f=[],H=d?.read_basis??Object.fromEntries(Object.entries(o.state.read_basis));for(let[i,t]of Object.entries(H)){let u=s.heads.get(i)??null;u!==t&&f.push({subject:i,pinned:t,live:u})}r.uc_tip!==void 0&&l.liveUcTip!==void 0&&l.liveUcTip!==r.uc_tip&&f.push({subject:r.use_case??"use-case",pinned:r.uc_tip,live:l.liveUcTip}),l.locks?.reacquire?.(n);let _={...r.run_config,checkpoints:!0};delete _.resume;let R;if(c.pointer===null||c.agent===null)R=_;else{if(!c.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);R={..._,resume:{schema:2,binding:c.agent.binding,base_fingerprint:c.agent.base_fingerprint,delta_items:c.agent.delta_items,last_seq:c.pointer.seq}}}let S=d?.pending.questions??[],b=i=>{let t=`resolveq:${n}:${i}`,u=`assumed:${n}:${i}`;return s.appliedEvents.has(t)||s.appliedEvents.has(u)||o.isApplied(t)||o.isApplied(u)},W=d&&S.length>0?S.filter(i=>!b(i.id)):o.state.pending.questions.filter(i=>!b(i.id)),v={redeliverReceipts:[],recommit:[]},h,k;if(d){let i={...d,applied_events:[...new Set([...d.applied_events,...o.state.applied_events])].sort()},t;try{t=I(e,n,i,s,{verb:r.verb==="design"?"design":"extract",...r.use_case?{ucRef:r.use_case}:{},composeReceipt:(g,q,D)=>N(g,q,D),onNote:l.onWarn})}catch(g){throw g instanceof x?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${g.message}`,[{cmd:`kane-cli context sessions clean ${n}`,why:"abandon the session if the store was rebuilt"}]):g}v={redeliverReceipts:t.redeliverReceipts,recommit:t.recommit},k=t.prunedPending;let u=d.pending.proposals??[];h=(u.length>0?u:o.state.pending.proposals).filter(g=>!(typeof g.event_id=="string"&&s.appliedEvents.has(g.event_id))),(t.newlyApplied.length>0||t.prunedPending.length>0)&&o.reconcileSave({appliedEvents:t.newlyApplied,heldReceipts:[...o.state.held_receipts??[],...t.redeliverReceipts],pending:{questions:o.state.pending.questions,proposals:h}})}else{let i=o.state.pending.proposals;k=i.filter(t=>typeof t.event_id=="string"&&s.appliedEvents.has(t.event_id)),h=i.filter(t=>!(typeof t.event_id=="string"&&s.appliedEvents.has(t.event_id)))}return{kind:"v2",handle:o,base:r,view:c,kane:d,spawnConfig:R,drift:f,reconcile:v,questions:W,represent:h,prunedPending:k}}catch(p){throw o.release(),p}}export{Q as a,ne as b,se as c,te as d,m as e,ie as f};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,f as o}from"./chunk-MMPFU2YC.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,f as o}from"./chunk-C4G7RVJ6.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-GIMTSDNC.js";import{a as k}from"./chunk-2WVKOZ6W.js";import{a as B}from"./chunk-KHJXOFDM.js";import{a as R}from"./chunk-KXUSG5ZI.js";import{y as c}from"./chunk-MMPFU2YC.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
2
+ import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-KNDSQ4PS.js";import{a as k}from"./chunk-2WVKOZ6W.js";import{a as B}from"./chunk-JRMDGLLT.js";import{a as R}from"./chunk-4OPQJ7PE.js";import{y as c}from"./chunk-C4G7RVJ6.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-3AZTXJY4.js";import{p as R,q as k}from"./chunk-Y5RNCJAN.js";import{a as P}from"./chunk-MMPFU2YC.js";import{e as q}from"./chunk-UR6MHSHU.js";import{existsSync as f,mkdirSync as V,readFileSync as Z,renameSync as N,writeFileSync as K}from"fs";import{join as Q}from"path";function fe(e){D(p(e));let t=p(e);if(!f(t))return;let n=Q(t,"meta.json"),r=y(e);if(f(n)&&!f(r))try{V(j(e),{recursive:!0}),N(n,r)}catch(o){process.stderr.write(`warn: meta.json migration failed: ${o.message}
2
+ import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{a as B}from"./chunk-DXV6MBTD.js";import{p as R,q as k}from"./chunk-W6VD2XFO.js";import{a as P}from"./chunk-C4G7RVJ6.js";import{e as q}from"./chunk-UR6MHSHU.js";import{existsSync as f,mkdirSync as V,readFileSync as Z,renameSync as N,writeFileSync as K}from"fs";import{join as Q}from"path";function fe(e){D(p(e));let t=p(e);if(!f(t))return;let n=Q(t,"meta.json"),r=y(e);if(f(n)&&!f(r))try{V(j(e),{recursive:!0}),N(n,r)}catch(o){process.stderr.write(`warn: meta.json migration failed: ${o.message}
3
3
  `)}let i=C(e);if(f(i)){let o="python";try{let c=new B().load();c.code_export?.language&&(o=c.code_export.language)}catch{}let a=M(e,"playwright",o);if(!f(a))try{N(i,a)}catch(c){process.stderr.write(`warn: generated-code migration failed: ${c.message}
4
4
  `)}}if(f(r))try{let o=JSON.parse(Z(r,"utf8"));"md5sum"in o&&(delete o.md5sum,K(r,JSON.stringify(o,null,2)+`
5
5
  `,"utf8"))}catch(o){process.stderr.write(`warn: meta.json md5sum strip failed: ${o.message}
6
- `)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-A6PCNPLM.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:r}=await import("./build-JIKYOZUH.js"),i=await import("./react-QWOAB3TB.js"),o={current:null},a={current:!1},{waitUntilExit:c,unmount:l}=r(i.default.createElement(n,null,i.default.createElement(t,{resultRef:o,mode:"login",loginCompleteRef:a})),{exitOnCtrlC:!1});k(()=>l()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),a.current?{recovered:!0}:(R(0,"Startup gate cancelled"),{recovered:!1})}function W(e){let t=e.getActiveProfile(),n=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,n)||e.loadCredentials(t,n)))return!1;let i=e.loadProfileConfig(t,n)??{};return!!i.project_id&&!!i.folder_id}var J=q(H(),1);import{existsSync as v,readFileSync as U,readdirSync as X,statSync as Y}from"fs";import{dirname as ee,isAbsolute as te,join as g,relative as x,resolve as re,sep as h}from"path";import{createHash as ne}from"crypto";var S="testmd-bundle.json",d=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},_=e=>e.split(h).join("/");function I(e){if(!v(e))return[];let t=[];for(let n of X(e).sort()){let r=g(e,n);Y(r).isDirectory()?t.push(...I(r)):t.push(r)}return t}function se(e){let t=e.map(r=>ee(r).split(h)),n=t[0];for(let r of t.slice(1)){let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;n=n.slice(0,i)}return n.join(h)||h}function ie(e){for(let t of e){let n=F(t,U(t,"utf8"));for(let r of n.steps)if(r.body.kind==="import_ref"&&te(r.body.path))throw new d(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function G(e){let t=re(e),n=T(t);if(!n?.commit_id||!n?.test_id)throw new d(`bundle sync: ${t} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let r;try{r=O(t)}catch(s){throw s instanceof $?new d(`bundle sync: ${s.message}`):s}let i=[t];for(let s of r.steps)for(let u of s.trace.slice(1))i.includes(u.file)||i.push(u.file);ie(i);let o=[];for(let s of r.unitFiles){if(s.file===t)continue;let u=p(s.file);o.includes(u)||o.push(u)}let a=[...i],c=s=>{v(s)&&a.push(s)};c(E(t)),a.push(y(t)),c(g(p(t),".internal","execution.json")),a.push(...I(A(t)));for(let s of o)c(g(s,"Result.md")),a.push(...I(g(s,".internal","steps")));let l=se(a);if(v(g(l,S)))throw new d(`bundle sync: a real file named ${S} exists at the zip root (${l}) \u2014 it would collide with the generated manifest`);let b=a.map(s=>{let u=U(s);return{abs:s,rel:_(x(l,s)),sha256:ne("sha256").update(u).digest("hex"),bytes:u.length}}).sort((s,u)=>s.rel<u.rel?-1:1),m=_(x(l,t)),L={schema_version:2,entry:m,commit_id:n.commit_id,test_id:n.test_id,testcase_id:n.testcase_id??null,project_id:n.project_id??null,folder_id:n.folder_id??null,org_id:n.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:P},files:b.map(s=>({path:s.rel,sha256:s.sha256,bytes:s.bytes})),units:r.unitFiles.filter(s=>s.file!==t).map(s=>({path:_(x(l,s.file)),kind:s.kind}))};return{zipRoot:l,entry:m,files:b,manifest:L}}var w=e=>e instanceof Error?e.message:String(e);function oe(e){return new Promise((t,n)=>{let r=(0,J.default)("zip",{zlib:{level:6}}),i=[];r.on("data",o=>i.push(o)),r.on("error",n),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
6
+ `)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-SMCAIKCE.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:r}=await import("./build-JIKYOZUH.js"),i=await import("./react-QWOAB3TB.js"),o={current:null},a={current:!1},{waitUntilExit:c,unmount:l}=r(i.default.createElement(n,null,i.default.createElement(t,{resultRef:o,mode:"login",loginCompleteRef:a})),{exitOnCtrlC:!1});k(()=>l()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),a.current?{recovered:!0}:(R(0,"Startup gate cancelled"),{recovered:!1})}function W(e){let t=e.getActiveProfile(),n=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,n)||e.loadCredentials(t,n)))return!1;let i=e.loadProfileConfig(t,n)??{};return!!i.project_id&&!!i.folder_id}var J=q(H(),1);import{existsSync as v,readFileSync as U,readdirSync as X,statSync as Y}from"fs";import{dirname as ee,isAbsolute as te,join as g,relative as x,resolve as re,sep as h}from"path";import{createHash as ne}from"crypto";var S="testmd-bundle.json",d=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},_=e=>e.split(h).join("/");function I(e){if(!v(e))return[];let t=[];for(let n of X(e).sort()){let r=g(e,n);Y(r).isDirectory()?t.push(...I(r)):t.push(r)}return t}function se(e){let t=e.map(r=>ee(r).split(h)),n=t[0];for(let r of t.slice(1)){let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;n=n.slice(0,i)}return n.join(h)||h}function ie(e){for(let t of e){let n=F(t,U(t,"utf8"));for(let r of n.steps)if(r.body.kind==="import_ref"&&te(r.body.path))throw new d(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function G(e){let t=re(e),n=T(t);if(!n?.commit_id||!n?.test_id)throw new d(`bundle sync: ${t} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let r;try{r=O(t)}catch(s){throw s instanceof $?new d(`bundle sync: ${s.message}`):s}let i=[t];for(let s of r.steps)for(let u of s.trace.slice(1))i.includes(u.file)||i.push(u.file);ie(i);let o=[];for(let s of r.unitFiles){if(s.file===t)continue;let u=p(s.file);o.includes(u)||o.push(u)}let a=[...i],c=s=>{v(s)&&a.push(s)};c(E(t)),a.push(y(t)),c(g(p(t),".internal","execution.json")),a.push(...I(A(t)));for(let s of o)c(g(s,"Result.md")),a.push(...I(g(s,".internal","steps")));let l=se(a);if(v(g(l,S)))throw new d(`bundle sync: a real file named ${S} exists at the zip root (${l}) \u2014 it would collide with the generated manifest`);let b=a.map(s=>{let u=U(s);return{abs:s,rel:_(x(l,s)),sha256:ne("sha256").update(u).digest("hex"),bytes:u.length}}).sort((s,u)=>s.rel<u.rel?-1:1),m=_(x(l,t)),L={schema_version:2,entry:m,commit_id:n.commit_id,test_id:n.test_id,testcase_id:n.testcase_id??null,project_id:n.project_id??null,folder_id:n.folder_id??null,org_id:n.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:P},files:b.map(s=>({path:s.rel,sha256:s.sha256,bytes:s.bytes})),units:r.unitFiles.filter(s=>s.file!==t).map(s=>({path:_(x(l,s.file)),kind:s.kind}))};return{zipRoot:l,entry:m,files:b,manifest:L}}var w=e=>e instanceof Error?e.message:String(e);function oe(e){return new Promise((t,n)=>{let r=(0,J.default)("zip",{zlib:{level:6}}),i=[];r.on("data",o=>i.push(o)),r.on("error",n),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
7
7
  `,{name:S});for(let o of e.files)r.file(o.abs,{name:o.rel});r.finalize()})}async function ae(e){let{plan:t,controller:n,testId:r,sessionId:i,commitId:o}=e,a;try{a=await oe(t)}catch(l){return{ok:!1,stage:"zip",error:w(l)}}let c;try{let l={key:"testmd",content_type:"application/zip",filename:`${o}-testmd.zip`},m=(await n.getPresignedUrls(r,i,[l])).urls?.testmd?.upload_url;if(!m)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};c=m}catch(l){return{ok:!1,stage:"presign",error:w(l)}}try{await z(c,a,"application/zip")}catch(l){return{ok:!1,stage:"upload",error:w(l)}}return{ok:!0,bytes:a.length}}async function Ee(e){let t;try{t=G(e.sourcePath)}catch(n){return n instanceof d?{ok:!1,stage:"collect",error:n.message}:{ok:!1,stage:"collect",error:w(n)}}return ae({...e,plan:t})}function je(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}export{fe as a,ye as b,Ee as c,je as d};
@@ -3,4 +3,4 @@ import{closeSync as A,existsSync as $,mkdirSync as h,openSync as k,readFileSync
3
3
  `),t}function y(e,n){let r=n;if(r===void 0){let o=d(e),c=[];try{c=w(o).filter(P=>P.endsWith(".json")).sort()}catch{}if(c.length===0)return{error:`no stored plans under ${o} \u2014 run reconcile --plan first`};r=l(o,c[c.length-1])}if(!$(r))return{error:`no such plan file: ${r}`};let t;try{t=p(r,"utf8")}catch(o){return{error:`cannot read plan ${r}: ${o instanceof Error?o.message:String(o)}`}}let i;try{i=JSON.parse(t)}catch(o){return{error:`corrupted plan ${r}: ${o instanceof Error?o.message:String(o)}`}}let s=i?.version;return s===1?{error:`plan predates the vocabulary change \u2014 recompute with --from <file> --source-id <id> (${r})`}:s!==2?{error:`unsupported plan version ${String(s)} in ${r} (expected 2)`}:Array.isArray(i.rows)?{plan:i,path:r}:{error:`not a reconcile plan \u2014 ${r} has no rows[] (hand-edited?)`}}function S(e){let n=e.archive_state??{};return(e.changeset??[]).filter(r=>r.kind==="ARCHIVE"&&n[r.ref]===void 0).map(r=>r.ref)}function D(e,n,r){let t=y("",e);if("error"in t)throw new a("PLAN_UNREADABLE",t.error);let i=t.plan,s=i.archive_state??{};if(s[n]!==void 0)throw new a("ROW_ALREADY_APPLIED",`archive ${n} already ${s[n].outcome}`);s[n]={at:new Date().toISOString(),outcome:r},i.archive_state=s,u(e,JSON.stringify(i,null,2)+`
4
4
  `)}function R(e,n){let r=d(e),t=[];try{t=w(r).filter(i=>i.endsWith(`-${n}.json`)).sort()}catch{}return t.length===0?null:y(e,l(r,t[t.length-1]))}function O(e,n){let r=R(e,n);if(r===null||"error"in r)return null;let t=r.plan.rows.filter(i=>i.applied===void 0).length+S(r.plan).length;return t>0?{path:r.path,created:r.plan.created,pending:t}:null}function I(e,n,r){let t;try{t=JSON.parse(p(e,"utf8"))}catch(s){throw new a("PLAN_UNREADABLE",`${e}: ${s instanceof Error?s.message:String(s)}`)}let i=t.rows?.[n];if(!i)throw new a("ROW_MISSING",`${e} has no row ${n}`);if(i.applied)throw new a("ROW_ALREADY_APPLIED",`row ${n} of ${e} was already applied (${i.applied.outcome} at ${i.applied.at})`);i.applied={at:new Date().toISOString(),outcome:r},u(e,JSON.stringify(t,null,2)+`
5
5
  `)}function x(e){let n=d(e);h(n,{recursive:!0});let r=l(n,".walk-lock");for(let t=0;t<2;t++)try{let i=k(r,"wx");return m(i,`${process.pid}
6
- `),A(i),()=>{try{g(r)}catch{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=f(r);if(!Number.isFinite(s)){let c=Date.now()+50;for(;Date.now()<c;);s=f(r)}if(Number.isFinite(s)&&v(s))throw new a("WALK_LOCKED",`another reconcile walk is running (pid ${s}) \u2014 remove ${r} if that process is gone`);try{g(r)}catch{}}throw new a("WALK_LOCKED",`could not take the walk lock at ${l(n,".walk-lock")}`)}function f(e){try{return parseInt(p(e,"utf8").trim(),10)}catch{return NaN}}function v(e){try{return process.kill(e,0),!0}catch{return!1}}export{N as a,y as b,S as c,D as d,R as e,O as f,I as g,x as h};
6
+ `),A(i),()=>{try{g(r)}catch{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=f(r);if(!Number.isFinite(s)){let c=Date.now()+50;for(;Date.now()<c;);s=f(r)}if(Number.isFinite(s)&&E(s))throw new a("WALK_LOCKED",`another reconciliation is already running (pid ${s}) \u2014 wait for it to finish; if it appears stuck, stop that process before retrying`);try{g(r)}catch{}}throw new a("WALK_LOCKED",`could not take the walk lock at ${l(n,".walk-lock")}`)}function f(e){try{return parseInt(p(e,"utf8").trim(),10)}catch{return NaN}}function E(e){try{return process.kill(e,0),!0}catch{return!1}}export{N as a,y as b,S as c,D as d,R as e,O as f,I as g,x as h};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as _}from"./chunk-TDPWFYTJ.js";import{b as m}from"./chunk-L5LI2JF4.js";import{c as h}from"./chunk-MMPFU2YC.js";import{randomUUID as F}from"crypto";import{mkdirSync as A,writeFileSync as v,appendFileSync as O,existsSync as b}from"fs";import{join as u}from"path";import{writeFileSync as x,mkdirSync as I,existsSync as j}from"fs";import{join as p,relative as L}from"path";function f(n){let t=Object.keys(n.frontmatter).length>0?m(n.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${n.heading}`,""),n.steps.forEach((i,r)=>{s.push(`## Step ${r+1}`,i,"")}),s.join(`
2
+ import{b as m}from"./chunk-L5LI2JF4.js";import{a as _}from"./chunk-TDPWFYTJ.js";import{c as h}from"./chunk-C4G7RVJ6.js";import{randomUUID as F}from"crypto";import{mkdirSync as A,writeFileSync as v,appendFileSync as O,existsSync as b}from"fs";import{join as u}from"path";import{writeFileSync as x,mkdirSync as I,existsSync as j}from"fs";import{join as p,relative as L}from"path";function f(n){let t=Object.keys(n.frontmatter).length>0?m(n.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${n.heading}`,""),n.steps.forEach((i,r)=>{s.push(`## Step ${r+1}`,i,"")}),s.join(`
3
3
  `)}function T(n,e){let t={},s={},i=e;for(let[r,l]of Object.entries(n)){if(r.startsWith("global.")||r.startsWith("secrets.user.")||r.startsWith("environment.")){let o=r.startsWith("secrets.user.");t[r]={value:l.value,secret:o,syntax:`{{${r}}}`,type:o?"secret":r.startsWith("environment.")?"environment":"global"},s[r]=r;continue}if(l.secret){let o=`secrets.user.${r}`;t[o]={value:l.value,secret:!0,syntax:`{{secrets.user.${r}}}`,type:"secret"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{secrets.user.${r}}}`)}else{let o=`global.${r}`;t[o]={value:l.value,secret:!1,syntax:`{{global.${r}}}`,type:"global"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{global.${r}}}`)}}return{variables:t,objective:i,keyMap:s}}var w=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function c(n){return typeof n!="string"||!n.includes("{{")?n:n.replace(w,"{{$1}}")}function d(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(e=>d(e));if(n&&typeof n=="object"){let e={};for(let[t,s]of Object.entries(n))e[t]=d(s);return e}return n}var N=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["model","env"]),g=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=p(this.opts.cwd,".testmuai","tests");try{I(t,{recursive:!0})}catch(a){process.stderr.write(`
4
4
  \u26A0 Failed to create ${L(this.opts.cwd,t)}/
5
5
  ${a.message}
@@ -12,6 +12,6 @@ import{a as _}from"./chunk-TDPWFYTJ.js";import{b as m}from"./chunk-L5LI2JF4.js";
12
12
 
13
13
  `);return}this.lastWrittenPath=s,this.lastCollisionSuffixed=r}};function E(n){let e={};for(let[t,s]of Object.entries(n))N.has(t)||$.has(t)||(e[t]=s);return e}var D=u(h,"sessions"),R=class{sessionId;sessionDir;runs=[];_flows=[];_nextIndex=0;_started=!1;_testId=null;_testcaseId=null;_projectId=null;_orgId=null;_userName=null;_userEmail=null;_uploadStatus="pending";_uploadAttempts=0;_uploadError=null;_firstObjective=null;_firstUrl=null;_auteurVariables={};_screenshotSas=null;_model="";_environment="";_profile=null;_plan=null;_startedAt="";_remoteLogger=null;_earlyLogBuffer=[];_recorder=null;_resolvedGlobal={};_sessionName=null;_recordingEnabled=!0;_stepRunRecords=[];constructor(e){this.sessionId=F();let t=e?.baseDir?u(e.baseDir,"sessions"):D;this.sessionDir=u(t,this.sessionId)}setResolvedGlobal(e){this._resolvedGlobal={...this._resolvedGlobal,...e}}setSessionName(e){this._sessionName=e}get sessionName(){return this._sessionName}setRecordingEnabled(e){this._recordingEnabled=e}get recorder(){return this._recorder}flushRecorder(){try{this._recorder?.flush()}catch(e){process.stderr.write(`[recorder] flush failed: ${e.message}
14
14
  `)}}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{A(this.sessionDir,{recursive:!0}),this._recorder=new g({cwd:process.cwd(),getResolvedGlobal:()=>this._resolvedGlobal,getName:()=>this._sessionName});let t={session_id:this.sessionId,started_at:this._startedAt,model:e.model,environment:e.environment,profile:e.profile,plan:this._plan,objectives:[],runs:[],status:"in_progress"};v(u(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
15
- `)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}get apMode(){return _()}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,i){if(t===void 0){this._log(e);let o=e.indexOf(" "),a=o>0?e.slice(0,o):e,S=o>0?e.slice(o+1):"",y=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(y,a,S||e);return}let r=e,l=s;this._log(`${t} ${l}`,i),this._remoteLogger?.log(r,t,l,i)}logStep(e,t,s){this._log(`${e} ${t}`,s);let i=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(i,e,t,s)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,s){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${s}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:s})}logRunEnd(e,t,s,i,r){let l=(s??0).toFixed(1),o=(i??"").slice(0,100),a=r==null||r===""||Number.isNaN(Number(r))?null:Number(r);this._log(`RUN ${e} END status=${t} duration=${l}s summary="${o}"`,a!=null?{result_code:a}:void 0),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:i??"",result_code:a}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let t={session_id:this.sessionId,started_at:this._startedAt,ended_at:new Date().toISOString(),model:this._model,environment:this._environment,profile:this._profile,plan:this._plan,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(s=>({index:s.index,objective:s.objective,status:s.status,summary:s.summary,run_dir:s.run_dir}))};b(this.sessionDir)&&v(u(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
15
+ `)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}get apMode(){return _()??"v2"}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,i){if(t===void 0){this._log(e);let o=e.indexOf(" "),a=o>0?e.slice(0,o):e,S=o>0?e.slice(o+1):"",y=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(y,a,S||e);return}let r=e,l=s;this._log(`${t} ${l}`,i),this._remoteLogger?.log(r,t,l,i)}logStep(e,t,s){this._log(`${e} ${t}`,s);let i=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(i,e,t,s)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,s){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${s}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:s})}logRunEnd(e,t,s,i,r){let l=(s??0).toFixed(1),o=(i??"").slice(0,100),a=r==null||r===""||Number.isNaN(Number(r))?null:Number(r);this._log(`RUN ${e} END status=${t} duration=${l}s summary="${o}"`,a!=null?{result_code:a}:void 0),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:i??"",result_code:a}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let t={session_id:this.sessionId,started_at:this._startedAt,ended_at:new Date().toISOString(),model:this._model,environment:this._environment,profile:this._profile,plan:this._plan,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(s=>({index:s.index,objective:s.objective,status:s.status,summary:s.summary,run_dir:s.run_dir}))};b(this.sessionDir)&&v(u(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
16
16
  `),this.flushRecorder(),this._recorder=null}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setUserIdentity(e,t){e&&(this._userName=e),t&&(this._userEmail=t)}get userName(){return this._userName}get userEmail(){return this._userEmail}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},i=t.run_dirs?.length??1;for(let r=0;r<i;r++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e,t){if(!(!this._started||!b(this.sessionDir)))try{let s=new Date().toISOString().slice(0,19).replace("T"," "),i=u(this.sessionDir,"tui.log"),r=t&&Object.keys(t).length>0?` ${JSON.stringify(t)}`:"";O(i,`[${s}] ${e}${r}
17
17
  `)}catch{}}};export{f as a,T as b,R as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as v,b as w,d as C}from"./chunk-QROUKGKU.js";import{b as k}from"./chunk-OHRS3H7Z.js";import{a as E}from"./chunk-5JTUL6XL.js";import{a as T}from"./chunk-JFAFKHDX.js";import{a as y,b as O}from"./chunk-GW5DWAXY.js";import{d,e as g}from"./chunk-5YPBPZUR.js";var D=new Set([d.USECASE,d.SCENARIO,d.AC,d.TEST]);function p(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function b(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function S(e,t,n){if(n===d.USECASE)return t;if(n===d.SCENARIO)return b(e,t,g.BELONGS_TO);if(n===d.AC){let o=b(e,t,g.SCOPED_TO);return o?e.nodeLabel.get(o)===d.USECASE?o:b(e,o,g.BELONGS_TO):null}if(n===d.TEST){let o=b(e,t,g.AUTOMATES);return o?b(e,o,g.BELONGS_TO):null}return null}function A(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function G(e,t){return{ucTip:t,display:A(e,t),seamRef:e.nameOf.get(t)??t}}function L(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!D.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let a=S(e,o,s);return!a||e.nodeLabel.get(a)!==d.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(a)?{ok:!1,message:`use-case ${A(e,a)} was removed \u2014 nothing to evolve`}:{ok:!0,target:G(e,a)}}function z(e,t){return h(e,t)}function h(e,t){let n=[];for(let{cid:s}of e.byLabel(d.SCENARIO)){if(!p(e,s)||!e.edgesFrom(s).some(r=>r.type===g.BELONGS_TO&&e.tipOf(r.dst)===t))continue;let a=e.edgesInto(s).filter(r=>r.type===g.AUTOMATES&&p(e,r.src));if(a.length===0)n.push({scenario:s,test:null});else for(let r of a)n.push({scenario:s,test:r.src})}let o=new Map;for(let{cid:s}of e.byLabel(d.AC)){if(!p(e,s)||S(e,s,d.AC)!==t)continue;let a=e.edgesInto(s).filter(r=>r.type===g.VERIFIES&&p(e,r.src)).map(r=>r.src).sort();o.set(s,a)}return{pairs:n,verifies:o}}function x(e,t){let n=r=>`${r.scenario}\0${r.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),a=[];for(let[r,i]of e.verifies){let u=t.verifies.get(r);u&&(i.length===u.length&&i.every((l,f)=>l===u[f])||a.push({ac:r,before:i,after:u}))}return{superseded:e.pairs.filter(r=>!s.has(n(r))),minted:t.pairs.filter(r=>!o.has(n(r))),retained:t.pairs.filter(r=>o.has(n(r))),moves:a}}function P(e,t,n,o,s){let a=i=>t.nameOf.get(i)??i,r=i=>` - ${a(i.scenario)} \xB7 ${i.test?a(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(r(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(r(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(r(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=l=>l.length>0?l.map(a).join(" + "):"(none)";e.out(` - ${a(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function U(e,t,n,o,s,a){let r=y(e),i=E(r,t.ucTip);if(!i)return a==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(v(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=h(r,t.ucTip),l=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(l);else if(!await o.confirm(`${l} \u2014 proceed?`))return o.out(a==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let f=k(e,r,t.ucTip,n.because),c=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...f!==void 0?{changeDelta:f.change_delta,priorDesign:f.prior_design}:{}});if(c===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:c,outcome:"paused"};if(c!==0)return v(o,`design run for ${t.display} ended with exit code ${c} \u2014 no diff to report`),{code:c,outcome:"failed"};let m=y(e),$=m.tipOf(t.ucTip),R=E(m,$)?.seq;return P(o,m,t.display,{before:i.seq,after:R??"?"},x(u,h(m,$))),{code:0,outcome:"evolved"}}function F(e){let t=new Map,n=0;for(let{cid:s,state:a}of e.staleList()){if(a==="superseded")continue;let r=e.nodeLabel.get(s);if(!r||!D.has(r)||!p(e,s)||!O(e,s))continue;let i=S(e,s,r);!i||e.nodeLabel.get(i)!==d.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,G(e,i)))}return{targets:[...t.values()].sort((s,a)=>s.display<a.display?-1:s.display>a.display?1:0),staleCount:n}}function I(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!D.has(s)||!p(e,n))&&O(e,n)&&S(e,n,s)===t)return!0}return!1}async function N(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;let a=w(s,n);if(!a)return 2;let r=o.runDesignForUc??_;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=y(a),u,l=null;if(e){let c=L(i,e);if(!c.ok)return v(n,c.message),2;if(!t.because&&E(i,c.target.ucTip)&&!I(i,c.target.ucTip))return v(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[c.target]}else{let{targets:c,staleCount:m}=F(i);if(c.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;l=`from-stale: ${m} stale node(s) \u2192 ${c.length} use-case(s)`,u=c}if(!t.yes&&!n.isTTY)return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(l&&n.out(l),e){let c=await U(a,u[0],t,n,r,"single");return c.outcome==="evolved"&&t.because&&T(a,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),c.code}let f=0;for(let c of u){let{code:m}=await U(a,c,t,n,r,"batch");m!==0&&f===0&&(f=m)}return f}var _=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-AACBTSAA.js"),o=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return o();let s=process.stdout.write;process.stdout.write=((...a)=>!0);try{return await o()}finally{process.stdout.write=s}};async function J(e,t){return N(e,t,C(),{})}export{L as a,z as b,U as c,F as d,N as e,_ as f,J as g};