@testmuai/kane-cli 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/bin/kane-cli.cjs +1 -1
  2. package/bin/resolve-runtime.cjs +8 -0
  3. package/dist/ChatSurface-FJSO3IKR.js +8 -0
  4. package/dist/{ChromeProfilePicker-AUU7JF6F.js → ChromeProfilePicker-NTZ2RN3L.js} +1 -1
  5. package/dist/{CliFeedbackPrompt-4W74Y3UF.js → CliFeedbackPrompt-BCHUH24C.js} +1 -1
  6. package/dist/{CliUploadProgress-6HL7WTEX.js → CliUploadProgress-QVAJJRUW.js} +1 -1
  7. package/dist/{ConfigView-6BSCZP5Y.js → ConfigView-LAKAQN7O.js} +1 -1
  8. package/dist/EvidenceViewOffer-POKUWAPS.js +2 -0
  9. package/dist/FolderPicker-GR6FZMUJ.js +2 -0
  10. package/dist/{HelpView-TU7ED43J.js → HelpView-JFFVHQAW.js} +1 -1
  11. package/dist/{InfoBox-JLTMKVDE.js → InfoBox-46C7AHDE.js} +1 -1
  12. package/dist/{LinksBox-LREUUJDV.js → LinksBox-KFJXZDUJ.js} +1 -1
  13. package/dist/{ProfilesView-W3GX2N2E.js → ProfilesView-FV3KFVBX.js} +1 -1
  14. package/dist/{ProjectPicker-SYQUJK2J.js → ProjectPicker-MCH35VEF.js} +1 -1
  15. package/dist/{SaveSessionPrompt-MR5NJMRP.js → SaveSessionPrompt-RXHP3YW6.js} +1 -1
  16. package/dist/SingleShotApp-BK5QNXGG.js +2 -0
  17. package/dist/{SummaryBox-UAYSVFB7.js → SummaryBox-33K2MMUW.js} +1 -1
  18. package/dist/TestMdRunView-AT26LOSG.js +2 -0
  19. package/dist/{WhoamiView-2YU76ASQ.js → WhoamiView-HUPBB5AQ.js} +1 -1
  20. package/dist/app-client-ZCCNE3RV.js +2 -0
  21. package/dist/{app-download-AEEFQ63M.js → app-download-3O7NJNGG.js} +1 -1
  22. package/dist/{auth-HET3TBRI.js → auth-OMWFVDL2.js} +1 -1
  23. package/dist/{bind-STKXOUYI.js → bind-NXXKFJMA.js} +2 -2
  24. package/dist/bootstrap-MMRPAHWE.js +2 -0
  25. package/dist/bridge-UH32UGR5.js +2 -0
  26. package/dist/{changelog-7OWRHFHZ.js → changelog-VZ5HFHYM.js} +1 -1
  27. package/dist/{chat-controller-T2FAI55V.js → chat-controller-R4THYYPU.js} +1 -1
  28. package/dist/{chunk-HMYMSRA4.js → chunk-2ERQYYSJ.js} +1 -1
  29. package/dist/{chunk-DCY6R5DP.js → chunk-2N4SZOWN.js} +1 -1
  30. package/dist/{chunk-FMRSMN34.js → chunk-2ZDXNTZT.js} +1 -1
  31. package/dist/{chunk-OTTGS2TE.js → chunk-37ZWKLEN.js} +1 -1
  32. package/dist/{chunk-UV462FZR.js → chunk-3MFTTLOF.js} +1 -1
  33. package/dist/{chunk-DO5HAO3H.js → chunk-3S5DDQLP.js} +1 -1
  34. package/dist/{chunk-BRHNRCEZ.js → chunk-4FQI643D.js} +1 -1
  35. package/dist/chunk-4G4RWARU.js +2 -0
  36. package/dist/{chunk-GZPK6FRP.js → chunk-5BVOF4UW.js} +1 -1
  37. package/dist/{chunk-C7HSWZP6.js → chunk-5CKQTZMG.js} +1 -1
  38. package/dist/{chunk-ZVHCQMJ6.js → chunk-5NQ3TI4S.js} +2 -2
  39. package/dist/{chunk-6O3DDOP2.js → chunk-5OVEBP4D.js} +1 -1
  40. package/dist/{chunk-FQLIW3LM.js → chunk-6G5YKTVN.js} +1 -1
  41. package/dist/chunk-6J5T5FEY.js +2 -0
  42. package/dist/{chunk-QRZRSAZH.js → chunk-7YZMUTJA.js} +1 -1
  43. package/dist/chunk-A2SQD2AY.js +4 -0
  44. package/dist/chunk-A5FFLJVL.js +26 -0
  45. package/dist/{chunk-RFR4ZKIC.js → chunk-AF572MQG.js} +2 -2
  46. package/dist/{chunk-HCKH44I2.js → chunk-APETOVZK.js} +1 -1
  47. package/dist/{chunk-AW2XUHH4.js → chunk-AVH3BEEU.js} +1 -1
  48. package/dist/chunk-AXTPNZPX.js +2 -0
  49. package/dist/{chunk-2WVKOZ6W.js → chunk-BPMSNGXQ.js} +1 -1
  50. package/dist/{chunk-EDSZJZFG.js → chunk-CDB3SYZG.js} +1 -1
  51. package/dist/{chunk-T5Y6MOLM.js → chunk-CJP7RX3E.js} +1 -1
  52. package/dist/{chunk-G7VQCS4J.js → chunk-CVCVBQP6.js} +1 -1
  53. package/dist/{chunk-YFYCCTSL.js → chunk-D5VYMHSO.js} +1 -1
  54. package/dist/chunk-D6FYCAIA.js +2 -0
  55. package/dist/{chunk-ZIUAOEUC.js → chunk-DJR3M7XO.js} +1 -1
  56. package/dist/{chunk-65ZTD5SJ.js → chunk-DN42IM2Z.js} +2 -2
  57. package/dist/{chunk-TKGUT425.js → chunk-DOG7S7R6.js} +1 -1
  58. package/dist/chunk-DSXSU5MH.js +10 -0
  59. package/dist/{chunk-QSDH5P7C.js → chunk-DVYO4CR2.js} +1 -1
  60. package/dist/chunk-DXI5TXNL.js +19 -0
  61. package/dist/{chunk-JJHG3BWO.js → chunk-EBJD2V4Z.js} +1 -1
  62. package/dist/chunk-FPAJURPL.js +2 -0
  63. package/dist/{chunk-3LJWYRAA.js → chunk-GIQURCTO.js} +1 -1
  64. package/dist/{chunk-2BGUUWNF.js → chunk-GR35ZFM2.js} +2 -2
  65. package/dist/chunk-HJ6AXOCR.js +2 -0
  66. package/dist/{chunk-6XX4LEVJ.js → chunk-IEOHAHZO.js} +1 -1
  67. package/dist/{chunk-QW6EZC53.js → chunk-IFIXY3YG.js} +1 -1
  68. package/dist/{chunk-XO5ZH3ZR.js → chunk-IHAHCFFG.js} +1 -1
  69. package/dist/chunk-ITTZYA2G.js +4 -0
  70. package/dist/chunk-IVYXXZEE.js +6 -0
  71. package/dist/chunk-IWWQTXGK.js +11 -0
  72. package/dist/{chunk-GCBKDX2J.js → chunk-JANVTG62.js} +1 -1
  73. package/dist/{chunk-IOFZSQAA.js → chunk-KGSVOTLG.js} +1 -1
  74. package/dist/{chunk-L7MXYCD7.js → chunk-KOMKHFC4.js} +1 -1
  75. package/dist/{chunk-EWCAFKLX.js → chunk-KZVEFBH5.js} +1 -1
  76. package/dist/{chunk-FEJXWJ3L.js → chunk-LCU2P3CH.js} +1 -1
  77. package/dist/{chunk-RC52N7PC.js → chunk-LNQCZ5DS.js} +1 -1
  78. package/dist/{chunk-IP2O264K.js → chunk-LP3BSP74.js} +1 -1
  79. package/dist/chunk-LQQXPY5B.js +4 -0
  80. package/dist/{chunk-3POR47RC.js → chunk-LSZVSYAP.js} +2 -2
  81. package/dist/chunk-MMBBQ4OZ.js +2 -0
  82. package/dist/chunk-NNCMMV6P.js +349 -0
  83. package/dist/{chunk-YJELGSKJ.js → chunk-NVGM5ISX.js} +1 -1
  84. package/dist/{chunk-GKYPNSQP.js → chunk-NWJOPZ7P.js} +2 -2
  85. package/dist/{chunk-ELM6MXGJ.js → chunk-NXXJ56QA.js} +1 -1
  86. package/dist/{chunk-NX7TM662.js → chunk-QJTXNQV5.js} +1 -1
  87. package/dist/chunk-RKXHVP2Z.js +2 -0
  88. package/dist/chunk-RUCSRS4C.js +5 -0
  89. package/dist/{chunk-TFPPEOAK.js → chunk-SA2LQSYP.js} +1 -1
  90. package/dist/chunk-SPQPOUUR.js +11 -0
  91. package/dist/chunk-SQDKYSWT.js +12 -0
  92. package/dist/chunk-TAOHYWEO.js +2 -0
  93. package/dist/{chunk-UXDL4XDL.js → chunk-TRVB7RSW.js} +1 -1
  94. package/dist/{chunk-SDPRO2LE.js → chunk-TUTDSX7T.js} +1 -1
  95. package/dist/{chunk-766WGMBU.js → chunk-UBTNWAKK.js} +1 -1
  96. package/dist/chunk-UJZZDPDY.js +2 -0
  97. package/dist/chunk-VK3NU742.js +21 -0
  98. package/dist/{chunk-DZGCXKKI.js → chunk-WCF2Z4SE.js} +1 -1
  99. package/dist/{chunk-KU6IXFGZ.js → chunk-WMMJXI5O.js} +1 -1
  100. package/dist/chunk-X2FM67OM.js +4 -0
  101. package/dist/chunk-XMYCRE5K.js +4 -0
  102. package/dist/chunk-XO45NGSN.js +2 -0
  103. package/dist/chunk-YJNGBZ42.js +4 -0
  104. package/dist/{chunk-7JWKHKFU.js → chunk-ZH64GOBG.js} +1 -1
  105. package/dist/{chunk-UDIQOJEL.js → chunk-ZNNRCUHH.js} +1 -1
  106. package/dist/{chunk-KFSUPQAG.js → chunk-ZUYPPPC5.js} +43 -43
  107. package/dist/{config-RS47F5SC.js → config-OTUKOTHM.js} +1 -1
  108. package/dist/{credentials-OH6AVI6N.js → credentials-A3RU25MJ.js} +1 -1
  109. package/dist/deps-bundle-RIBEQC2R.js +2 -0
  110. package/dist/{deps-resolve-XC5S53DG.js → deps-resolve-7SWSUDRX.js} +1 -1
  111. package/dist/dispatch-RHSWJJLC.js +2 -0
  112. package/dist/doctor-XP7YDE3J.js +2 -0
  113. package/dist/evidence-K7R7OG2K.js +2 -0
  114. package/dist/evolve-cmd-FFF3F3HO.js +2 -0
  115. package/dist/extract-bind-VIPNGK2H.js +10 -0
  116. package/dist/{extract-cmd-UZMEZMGP.js → extract-cmd-5J47Q4XU.js} +1 -1
  117. package/dist/gaps-cmd-WPCJPLGB.js +3 -0
  118. package/dist/{generate-headless-D3SVQ2AI.js → generate-headless-AJI2OVRG.js} +2 -2
  119. package/dist/index.js +61 -60
  120. package/dist/{ingest-EX72IEQT.js → ingest-4447MYLF.js} +1 -1
  121. package/dist/ingest-cmd-2LK7DWDW.js +2 -0
  122. package/dist/interactive-bind-PI3HY623.js +25 -0
  123. package/dist/{list-commands-MRXL5HGS.js → list-commands-7Y5XV5FK.js} +1 -1
  124. package/dist/login-flow-Z45G34DM.js +2 -0
  125. package/dist/mobile-prompts-O5ALU3QU.js +2 -0
  126. package/dist/{persist-recorded-session-TLDQ5HKP.js → persist-recorded-session-TKSU4HOA.js} +1 -1
  127. package/dist/{phase-seed-VFHIH6FL.js → phase-seed-DIRETNU6.js} +1 -1
  128. package/dist/{pipeline-UOM4LNAI.js → pipeline-HZUV7IMT.js} +1 -1
  129. package/dist/prepare-target-DBYKQ7HW.js +2 -0
  130. package/dist/reconcile-cmd-VHEW2DY5.js +2 -0
  131. package/dist/reconcile-deps-UJ6KVUIS.js +4 -0
  132. package/dist/reconcile-engine-NUQJSIFX.js +2 -0
  133. package/dist/{recording-banner-4M7XHVGI.js → recording-banner-GO2PP53Y.js} +1 -1
  134. package/dist/registry-KYPVINS2.js +2 -0
  135. package/dist/{require-project-folder-4UPQNEBJ.js → require-project-folder-NUQMH224.js} +1 -1
  136. package/dist/resolve-run-intent-H3HX5KUC.js +7 -0
  137. package/dist/{resolver-UBOZLFFE.js → resolver-HHLYRR5W.js} +1 -1
  138. package/dist/run-67ONKMGR.js +2 -0
  139. package/dist/{run-URPGHOQM.js → run-OPLOL3PZ.js} +1 -1
  140. package/dist/{run-test-md-76ZPKXO6.js → run-test-md-3BA56ZYF.js} +2 -2
  141. package/dist/session-items-2ATN7VXG.js +2 -0
  142. package/dist/{skill-installer-CIS6GAYF.js → skill-installer-O7JYVZXD.js} +1 -1
  143. package/dist/{spawner-J67QR4QP.js → spawner-OZ4OE44T.js} +1 -1
  144. package/dist/tcg-generate-EG2MXRJ7.js +2 -0
  145. package/dist/{testmd-actions-77ELR5UU.js → testmd-actions-YJ7O43Z6.js} +1 -1
  146. package/dist/{tms-client-VD3B3SMU.js → tms-client-V3TR4QW3.js} +1 -1
  147. package/dist/token-refresh-K7CANKFQ.js +2 -0
  148. package/dist/{validate-basic-2GVSQ2R5.js → validate-basic-HWYK3CU6.js} +1 -1
  149. package/dist/{verdicts-TRSTJLCL.js → verdicts-KFPMRADV.js} +1 -1
  150. package/dist/{version-check-O6PYTI4T.js → version-check-3ECNG5V2.js} +1 -1
  151. package/dist/walk-session-MZCMXVZB.js +2 -0
  152. package/dist/with-telemetry-Q6V6THIF.js +2 -0
  153. package/package.json +12 -12
  154. package/dist/ChatSurface-U37VZDCW.js +0 -8
  155. package/dist/EvidenceViewOffer-62XHEEGW.js +0 -2
  156. package/dist/FolderPicker-S7U2EN2M.js +0 -2
  157. package/dist/SingleShotApp-XOKVOM7C.js +0 -2
  158. package/dist/TestMdRunView-7UVSDAF4.js +0 -2
  159. package/dist/app-client-OEXESV4U.js +0 -2
  160. package/dist/bootstrap-44YKVWWE.js +0 -2
  161. package/dist/bridge-5Z3BIB77.js +0 -2
  162. package/dist/chunk-27U4PLPX.js +0 -2
  163. package/dist/chunk-2KDGIZED.js +0 -4
  164. package/dist/chunk-3PECJD6S.js +0 -11
  165. package/dist/chunk-7BZSCUPP.js +0 -10
  166. package/dist/chunk-7Q6M6P4X.js +0 -26
  167. package/dist/chunk-CTW2VQKS.js +0 -6
  168. package/dist/chunk-FNH55WSR.js +0 -19
  169. package/dist/chunk-GPG3FIN3.js +0 -21
  170. package/dist/chunk-HEAIJCGZ.js +0 -2
  171. package/dist/chunk-KCCSWEGA.js +0 -4
  172. package/dist/chunk-MA34UWKX.js +0 -4
  173. package/dist/chunk-MBF3FP5P.js +0 -5
  174. package/dist/chunk-MXHHMIO2.js +0 -349
  175. package/dist/chunk-OMQCD3KR.js +0 -2
  176. package/dist/chunk-QGKPLOUI.js +0 -2
  177. package/dist/chunk-RLRNLIRS.js +0 -2
  178. package/dist/chunk-TYLYFERW.js +0 -10
  179. package/dist/chunk-V2R3LCA3.js +0 -12
  180. package/dist/chunk-VGFTNLQQ.js +0 -2
  181. package/dist/chunk-W2JFDDIB.js +0 -2
  182. package/dist/chunk-W4B5LOEX.js +0 -4
  183. package/dist/chunk-YRFMPIU2.js +0 -4
  184. package/dist/dispatch-SE5GY3Z2.js +0 -2
  185. package/dist/doctor-FSECFZUU.js +0 -2
  186. package/dist/evidence-OYPHZUKI.js +0 -2
  187. package/dist/evolve-cmd-BCPNXAMV.js +0 -2
  188. package/dist/extract-bind-LLEASZAK.js +0 -10
  189. package/dist/gaps-cmd-IVXFPFAQ.js +0 -3
  190. package/dist/ingest-cmd-EAE7N5RC.js +0 -2
  191. package/dist/interactive-bind-ORMN2REX.js +0 -25
  192. package/dist/login-flow-QJQM3RHT.js +0 -2
  193. package/dist/mobile-prompts-TOX35ER6.js +0 -2
  194. package/dist/prepare-target-QYWIJIVQ.js +0 -2
  195. package/dist/reconcile-cmd-3H34KVVD.js +0 -2
  196. package/dist/reconcile-deps-XIH75ZLY.js +0 -4
  197. package/dist/reconcile-engine-UKWPG2LV.js +0 -2
  198. package/dist/registry-PYOTKZYZ.js +0 -2
  199. package/dist/resolve-run-intent-X72V3KJA.js +0 -7
  200. package/dist/run-2COODVX2.js +0 -2
  201. package/dist/tcg-generate-BDTRKY2A.js +0 -2
  202. package/dist/token-refresh-4BPAPXKK.js +0 -2
  203. package/dist/walk-session-CHJXHZMO.js +0 -2
  204. package/dist/with-telemetry-CQCWLVOC.js +0 -2
  205. /package/dist/{lifecycle-cmd-O2324GN6.js → lifecycle-cmd-HO5VL7AM.js} +0 -0
package/bin/kane-cli.cjs CHANGED
@@ -7,7 +7,7 @@
7
7
  // would parse as ESM where `require` is undefined.)
8
8
  // Escape hatch: KANE_CLI_SYSTEM_NODE=1 forces the system node, silently.
9
9
  "use strict";
10
- var MIN_MAJOR = 18; // lockstep with package.json "engines"
10
+ var MIN_MAJOR = 20; // lockstep with package.json "engines"
11
11
  var path = require("path");
12
12
  var entry = path.join(__dirname, "..", "dist", "index.js");
13
13
 
@@ -41,5 +41,13 @@ module.exports = function resolveRuntime(baseDir) {
41
41
  if (fs.existsSync(flat)) return flat;
42
42
  }
43
43
  }
44
+ // Tier 3 (last): embedded in the package's own dist/bin. The legacy Azure /
45
+ // HyperExecute tarball is a bare `npm i -g <tgz>` that resolves NO optional
46
+ // deps, so it carries no kane-cli-node package — the runtime is packed
47
+ // straight into dist/bin (mirroring how v16-runner is embedded there). Kept
48
+ // last so a real kane-cli-node package, whose pin every release bumps, always
49
+ // wins on the npm/brew channels where both could coexist.
50
+ var embedded = path.join(pkgRoot, "dist", "bin", binName);
51
+ if (fs.existsSync(embedded)) return embedded;
44
52
  return null;
45
53
  };
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as wn,b as me,c as It,d as $n,e as Dt,g as rt,h as it,i as Cn,j as Rn,l as Sn,m as Bt,n as In}from"./chunk-HJ6AXOCR.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as yn}from"./chunk-CLGC7VEO.js";import{a as tt}from"./chunk-LQQXPY5B.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as xn,b as kn,c as bn}from"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-6KPPGMO2.js";import{a as gn,b as hn,c as pn}from"./chunk-GIQURCTO.js";import"./chunk-NVGBE2DR.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-LCU2P3CH.js";import{y as r}from"./chunk-D6FYCAIA.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(hn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${bn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[kn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
3
+ `)){if(f.length<=u){g.push(f);continue}let p="";for(let C of f.split(" "))p&&p.length+1+C.length>u?(g.push(p),p=C):p=p?`${p} ${C}`:C;g.push(p)}let x=Math.max(0,g.length-l);return{body:g.slice(-l).join(`
4
+ `),hidden:x}}function Wn(t){let o={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},l={key:"keep",label:"keep the existing design",detail:"back to the list"};return t.designed==="stale"?[{...o,detail:"the use-case changed since it was designed"},l]:[l,o]}function Xi({controller:t,verb:o="extract",onCtrlC:l,chain:u=null,inspect:g=null,reconcile:x=null,autoReview:f=!1,onReviewExit:p,meta:C=null}){let[,M]=(0,m.useState)(0),[v,T]=(0,m.useState)(!1),[W,$]=(0,m.useState)(null),[I,N]=(0,m.useState)(null),L=(0,m.useRef)(null),[B,P]=(0,m.useState)(null),O=(0,m.useRef)(null),H=e=>{O.current=e,P(e)},K=e=>{L.current=e,N(e),e===null&&H(null)},re=(0,m.useRef)([]),[S,$e]=(0,m.useState)(null),z=(0,m.useRef)(null),j=e=>{z.current=e,$e(e)},[h,ce]=(0,m.useState)(null),D=(0,m.useRef)(null),w=e=>{D.current=e,ce(e)},[X,Pe]=(0,m.useState)(null),Lt=(0,m.useRef)(null),he=e=>{Lt.current=e,Pe(e)},lt=(0,m.useRef)({approved:0,rejected:0,deferred:0}),Ce=(0,m.useRef)(!1),ae=(0,m.useRef)(null),Ot=fn(),{stdout:Vn}=Ze(),Nn=Vn?.columns??80,_t=(0,m.useRef)(0),ct=(0,m.useRef)(0);(0,m.useEffect)(()=>{let e=()=>{let i=t.state.ledger;for(let c=_t.current;c<i.length;c++){let d=i[c],b=d.kind==="turn"?Tn(t.state.turns,d.turnIndex):void 0;Ot.append((0,E.jsx)(Mn,{block:d,annotations:b},`lg-${c}`))}_t.current=i.length};e();let s=t.subscribe(()=>{e();let i=t.state;L.current&&(i.pending||i.status==="pausing")&&(K(null),i.pending&&$("questions arrived \u2014 back to chat")),M(c=>c+1)});return M(i=>i+1),s},[t,Ot]);let{thinking:ue,status:de,pending:_,confirm:qe,ledger:ie,activeTurn:Pt,stream:Kn,notice:je}=t.state,qt=(Kn?.text??"").trimEnd(),jt=qt.length>0,Un=v&&(ue.liveThinking.length>0||ue.thinkingLog.length>0),Qn=Gr(ue.liveThinking||ue.thinkingLog.map(e=>e.text).join(`
5
+ `),Nn-6,Fn),Ft=jt?qt.split(`
6
+ `).slice(-Xr):[];Pt&&(ct.current=Pt.turnIndex);let Hn=_?_.resolution.filter(e=>!e).length:0,at;for(let e=ie.length-1;e>=0;e--){if(re.current.some(i=>i.end!=null&&e>=i.start&&e<i.end))continue;let s=ie[e];if(s.kind==="banner"&&!s.text.startsWith("kane")){at=s.text;break}}let Re=ue.activity[ue.activity.length-1],zn=Re?Re.status==="decision"?Re.label:xn({name:Re.name,status:Re.status}):void 0,Wt=de==="streaming"||de==="working",[,Xn]=(0,m.useState)(0);dn(()=>Xn(e=>e+1),Wt||S?.kind==="running"||h?.st.kind==="running"?120:null);let Gn=t.state.busySince?Math.floor((Date.now()-t.state.busySince)/1e3):0,Yn=t.state.turns.some(e=>e.role==="agent"),[Jn,Zn]=(0,m.useState)(0),[er,tr]=(0,m.useState)(!1),[ut,nr]=(0,m.useState)(null),pe=(0,m.useRef)(0),Vt=(0,m.useRef)(!1),Nt=(0,m.useRef)(null),Se=e=>{pe.current=e,Zn(e)},Kt=e=>{Vt.current=e,tr(e)},xe=e=>{Nt.current=e,nr(e)},[Ie,rr]=(0,m.useState)(null),dt=(0,m.useRef)(null),ke=e=>{dt.current=e,rr(e)},[mt,ir]=(0,m.useState)(null),Ut=(0,m.useRef)(null),De=e=>{Ut.current=e,ir(e)},[Fe,sr]=(0,m.useState)(0),G=(0,m.useRef)(0),Be=e=>{G.current=e,sr(e)},Qt=_?_.questions[0]?.id??"b":null;(0,m.useEffect)(()=>{_&&Be(_.cursor<0?0:_.cursor)},[Qt,_?.cursor]);let We=()=>{let e=Z.current;if(!e)return;let s=e.questions.length;for(let i=1;i<=s;i++){let c=(G.current+i)%s;if(!e.resolution[c]){Be(c);return}}},Ve=_?_.questions[Math.max(0,Math.min(_.questions.length-1,Fe))]:void 0,te=(0,m.useRef)(Ve);te.current=Ve;let Z=(0,m.useRef)(_);Z.current=_;let or=_?`${Qt}:${Fe}`:null;(0,m.useEffect)(()=>{if(xe(null),ke(null),De(null),te.current){Kt(!0);let e=Z.current?.resolution[G.current]?.selected_index;Se(e??te.current.recommended_index??0)}else Kt(!1)},[or]);let Ne=e=>{let s=Z.current;return Et(e,s?tt(s)!=="":!1)},lr={isFocused:()=>Vt.current&&te.current!=null&&Nt.current==null&&dt.current==null&&Ut.current==null||D.current!=null&&D.current.st.kind!=="running"&&Lt.current==null||z.current!=null&&z.current.kind!=="running"||U.current&&cn.current==null,onMove:e=>{let s=te.current;if(s){Se(Math.max(0,Math.min(Ne(s).maxSel,pe.current+e)));return}let i=D.current;if(i){let d=i.items[i.i];if(i.st.kind==="card"&&d){let b=it(d.card)??rt(d.card).length-1;w({...i,st:{kind:"card",sel:Math.max(0,Math.min(b,i.st.sel+e))}});return}if(i.st.kind==="view"&&d){w({...i,st:{kind:"view",offset:Math.max(0,i.st.offset+e)}});return}if(i.st.kind==="offer"||i.st.kind==="done"){let b=i.st.kind==="offer"?1:Ge.current.length-1;w({...i,st:{...i.st,sel:Math.max(0,Math.min(b,i.st.sel+e))}});return}if(i.st.kind==="running"&&!U.current)return}let c=z.current;if(c?.kind==="picker"){j({...c,sel:Math.max(0,Math.min(c.items.length-1,c.sel+e))});return}if(c?.kind==="ask"||c?.kind==="confirm"||c?.kind==="failed"){let d=(c.kind==="ask"?He.current.length:c.kind==="failed"?ze.current.length:2)-1;j({...c,sel:Math.max(0,Math.min(d,c.sel+e))});return}c&&!U.current||U.current&&ye(Math.max(0,Math.min(Le.current.length-1,vt.current+e)))},onSelect:()=>{let e=te.current,s=Z.current;if(!e||!s){let d=D.current;if(d&&d.st.kind!=="running"){let q=d.items[d.i];if(d.st.kind==="card"&&q){let F=d.st.sel;if(F===it(q.card)){he("");return}let ge=rt(q.card)[F];if(!ge)return;if(ge.v==="view_diff"){w({...d,st:{kind:"view",offset:0}});return}let Er=ge.v==="approve"||ge.v==="archive"?"approve":ge.v==="skip"?"reject":"defer";xr(d,Er);return}if(d.st.kind==="view"){w({...d,st:{kind:"card",sel:0}});return}if(d.st.kind==="offer"){d.st.sel===0?rn(d,d.st.offer):we(d);return}if(d.st.kind==="done"){Ge.current[d.st.sel]?.key==="view"?Je(""):(w(null),p?.());return}return}if(d&&!U.current)return;let b=z.current;if(b?.kind==="picker"){let q=b.items[b.sel];q&&(q.designed?j({kind:"confirm",item:q,sel:0}):bt(q,!1));return}if(b?.kind==="confirm"){Wn(b.item)[b.sel]?.key==="redesign"?bt(b.item,!0):kt();return}if(b?.kind==="ask"){let q=He.current[b.sel]?.key;q==="another"?kt():q==="view"?Je(""):j(null);return}if(b?.kind==="failed"){let q=ze.current[b.sel]?.key;q==="retry"?bt(b.item,b.force):q==="view"?Je(""):j(null);return}if(b&&!U.current||!U.current)return;switch(Le.current[vt.current]?.key){case"reconcile-review":tn();return;case"finish":t.completeSession();return;case"continue":t.continueParked();return;case"design-chain":kt();return;case"view":Je("",ct.current);return;case"free":ve("");return}return}let i=Ne(e),c=pe.current;if(i.batchIdx!=null&&c===i.batchIdx){t.goWithRecommendations();return}if(i.freeIdx!=null&&c===i.freeIdx){xe("");return}if(i.doneIdx!=null&&c===i.doneIdx){t.confirmMulti(G.current),We();return}if(e.multi_select){t.toggleOption(G.current,c);return}if(e.options[c]?.input===!0){ke({opt:c,value:""});return}t.submitAnswer(G.current,c),We()},onLeft:()=>{Z.current&&Be(Math.max(0,G.current-1))},onRight:()=>{let e=Z.current;e&&Be(Math.min(e.questions.length-1,G.current+1))},onDigit:e=>{let s=te.current;if(s){e-1<s.options.length&&Se(e-1);return}let i=D.current;if(i){let d=i.items[i.i];if(i.st.kind==="card"&&d){e-1<rt(d.card).length&&w({...i,st:{kind:"card",sel:e-1}});return}if(i.st.kind==="offer"){e-1<2&&w({...i,st:{...i.st,sel:e-1}});return}if(i.st.kind==="done"){e-1<Ge.current.length&&w({...i,st:{...i.st,sel:e-1}});return}if(i.st.kind!=="running"||!U.current)return}let c=z.current;if(c?.kind==="picker"){e-1<c.items.length&&j({...c,sel:e-1});return}if(c?.kind==="ask"){e-1<He.current.length&&j({...c,sel:e-1});return}if(c?.kind==="failed"){e-1<ze.current.length&&j({...c,sel:e-1});return}if(c?.kind==="confirm"){e-1<2&&j({...c,sel:e-1});return}if(!(c&&!U.current)&&U.current){let d=Le.current,b=0;for(let Y=0;Y<d.length;Y++)if(!d[Y].free&&(b+=1,b===e)){ye(Y);return}}},isMulti:()=>{let e=te.current;return!!e?.multi_select&&pe.current<(e?.options.length??0)},onSpace:()=>{Z.current&&t.toggleOption(G.current,pe.current)},onTab:()=>{let e=te.current;if(!e)return;let s=Ne(e);s.batchIdx!=null&&Se(s.batchIdx)},onType:e=>{let s=te.current;if(s){if(e==="@"&&t.canIngest()){De("");return}let c=pe.current;if(s.options[c]?.input===!0){ke({opt:c,value:e});return}if(!s.allow_free_text)return;let d=Ne(s);Se(d.freeIdx??0),xe(e);return}let i=D.current;if(i){if(i.st.kind==="card"){let c=it(i.items[i.i].card);c!=null&&(w({...i,st:{kind:"card",sel:c}}),he(e));return}if(i.st.kind!=="running"||!U.current)return}if(!(z.current&&!U.current)&&U.current){let c=wn(Le.current);if(c==null)return;ye(c),ve(e)}},onBack:()=>{let e=D.current;if(e){e.st.kind==="view"?w({...e,st:{kind:"card",sel:0}}):e.st.kind==="offer"?we(e):e.st.kind==="done"&&(w(null),p?.());return}let s=z.current;if(s&&s.kind!=="running"){j(null);return}let i=Z.current;if(i){for(let c=G.current-1;c>=0;c--)if(i.resolution[c]){Be(c);return}}}},cr=ut!=null?{value:ut,onChange:e=>xe(e),onSubmit:e=>{xe(null),e.trim()&&Z.current&&(t.submitFreeText(G.current,e),We())},onCancel:()=>xe(null)}:null,ar=mt!=null?{value:mt,onChange:e=>De(e),onSubmit:e=>{De(null),e.trim()&&t.ingestAttach(e)},onCancel:()=>De(null)}:null,ur=Ie!=null?{optionIndex:Ie.opt,value:Ie.value,onChange:e=>ke({opt:Ie.opt,value:e}),onSubmit:e=>{let s=dt.current?.opt;ke(null),s!=null&&Z.current&&(t.submitAnswerWithText(G.current,s,e),We())},onCancel:()=>ke(null)}:null,Ke=(0,m.useRef)(!1),ft=l??(()=>t.requestPause()),Ht=()=>{if(Ce.current&&!Ke.current){Ke.current=!0,$("finishing the verdict \u2014 exiting once it lands (ctrl+c again = force)");return}ft()},se=t.state.checkpoint,Ee=S?.kind==="running"&&de==="idle",gt=h?.st.kind==="running"&&de==="idle"&&ae.current!=null,fe=de==="idle"&&Yn&&!_&&!I&&(!S||Ee)&&(!h||gt),U=(0,m.useRef)(!1);U.current=fe;let ee=_e(t.state.turns).entries.length,Me,ne;for(let e=ie.length-1;e>=0;e--){if(re.current.some(i=>i.end!=null&&e>=i.start&&e<i.end))continue;let s=ie[e];if(!Me&&s.kind==="commit"&&s.ok&&(Me=s.line),!ne&&s.kind==="banner"&&s.text.startsWith("designing: ")&&(ne=s.text.slice(11)),Me&&ne)break}let ht;for(let e=ie.length-1;e>=0;e--){let s=ie[e];if(s.kind==="user")break;if(s.kind==="commit"&&s.ok&&/\bapplied\b/.test(s.line)){ht=s.line;break}}let oe=ne?{"acceptance criteria":"scenarios",scenarios:"acceptance criteria + exercises","acceptance criteria + exercises":"tests + gaps"}[ne]:void 0,zt={"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"},Xt=ne?zt[ne]:void 0,Gt=oe?zt[oe]:void 0,dr="phases: acceptance criteria \u2192 scenarios \u2192 wiring \u2192 tests \xB7 stop anytime with finish",mr=(()=>{for(let e=ie.length-1;e>=0;e--){let s=ie[e];if(s.kind==="agent")return s.text}return null})(),be=/\?\s*$/.test((mr??"").trimEnd()),Yt=o==="design"&&!se&&(be||oe!==void 0),Jt=ne==="tests + gaps",Ue=S?.kind==="running"?S.title:"the design",Zt=!!t.state.error&&!t.senderAlive(),fr=Ee?"\u25CF design \xB7 ":gt?`\u25CF ${ae.current??"design"} \xB7 `:"",gr=qe?"the agent needs a clarification before it can apply that":Ee&&!se?be?`${Ue} \u2014 the agent asked a question`:ht?`${Ue} \u2014 ${ht}`:Jt?`${Ue} \u2014 design complete`:`${Ue} \u2014 the agent is waiting on you`:se?ne?`${ne} done${oe?` \u2014 next: ${oe}`:""}`:Me??"phase done":Zt?"the agent stopped \u2014 the session is view-only":Yt?be?"the agent asked a question \u2014 answer or continue":`design incomplete \u2014 ${oe} not started`:Me??"waiting on you",[Ae,hr]=(0,m.useState)(null),pr=(0,m.useRef)(null);(0,m.useEffect)(()=>{if(!x)return;let e=fe||se?x.pending():null;pr.current=e,hr(e)},[fe,se,ie.length,h==null]);let en=Ae?[{key:"reconcile-review",label:Ae.kind==="cards"?`review ${Ae.count} change(s) from ${Ae.source}`:`review change(s) detected in ${Ae.source}`}]:[],Qe=qe?[{key:"free",label:"clarify \u2014 type which one you meant",free:!0}]:Ee&&!se?Jt&&!be?[{key:"finish",label:"finish this design"},...ee>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:[{key:"continue",label:be?"continue \u2014 go with your suggestion":"continue designing"},...ee>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}]:se?[...en,{key:"continue",label:oe?`continue to ${oe}`:"continue"},...ee>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}]:Zt?[...ee>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"tell me what to change",free:!0}]:Yt?[{key:"continue",label:be?"continue \u2014 go with your suggestion":`continue \u2014 ${oe} next`},...ee>0?[{key:"view",label:"view the design"}]:[],{key:"finish",label:"finish anyway"},{key:"free",label:"reply \u2014 answer and continue",free:!0}]:[...en,{key:"finish",label:o==="design"?"finish":"looks good \u2014 finish the session"},...u?[{key:"design-chain",label:"design tests for a use-case\u2026"}]:[],...ee>0?[{key:"view",label:o==="design"?"view the design":`view the ${ee} draft${ee===1?"":"s"}`}]:[],{key:"free",label:o==="design"?"keep adjusting \u2014 tell me what to change":"tell me what to change",free:!0}],pt=[{key:"another",label:"design another use-case\u2026"},...ee>0?[{key:"view",label:"view what was designed"}]:[],{key:"back",label:"done \u2014 back"}],He=(0,m.useRef)(pt);He.current=pt;let xt=[{key:"retry",label:"try again"},...ee>0?[{key:"view",label:"view what's saved"}]:[],{key:"back",label:"back"}],ze=(0,m.useRef)(xt);ze.current=xt;let Xe=[...ee>0?[{key:"view",label:"view what's saved"}]:[],{key:"back",label:"back to the check-in"}],Ge=(0,m.useRef)(Xe);Ge.current=Xe;let kt=()=>{let e=u?.listUcs()??[];if(e.length===0){$("no use-cases to design yet");return}j({kind:"picker",items:e,sel:0})},bt=(e,s)=>{let i={start:t.state.ledger.length,end:null};re.current.push(i);let c=()=>{i.end=t.state.ledger.length};j({kind:"running",title:e.title,item:e,force:s,startedAt:Date.now()}),u.runDesignChild(e.key,s).then(d=>{c(),j(d===0?{kind:"ask",title:e.title,sel:0}:{kind:"failed",item:e,force:s,detail:`child exited ${d}`,sel:0})}).catch(d=>{c();let b=d instanceof Error?d.message:String(d);t.ledger({kind:"childClose",verb:"design",subject:e.title,ok:!1,durS:Math.max(1,Math.round((Date.now()-(z.current?.kind==="running"?z.current.startedAt:Date.now()))/1e3))}),t.note(b),j({kind:"failed",item:e,force:s,detail:b,sel:0})})},tn=()=>{if(D.current?.st.kind==="running")return;let e=x?.pending();if(!e){$("nothing awaiting review");return}if(lt.current={approved:0,rejected:0,deferred:0},e.kind==="needs-run"){w({items:[],i:0,st:{kind:"running",label:`reviewing changes in ${e.source}`,startedAt:Date.now()}}),x.startReview(e.source).then(()=>{let i=x.loadCards();if(i.length===0){t.note("no reviewable changes came back \u2014 the source may be unchanged"),w(null);return}w({items:i,i:0,st:{kind:"card",sel:0}})}).catch(i=>{t.note(`the review run failed \u2014 ${i instanceof Error?i.message:String(i)}`),w(null)});return}let s=x.loadCards();if(s.length===0){$("nothing awaiting review");return}w({items:s,i:0,st:{kind:"card",sel:0}})},nn=e=>{let s=lt.current,i=`${s.approved} approved \xB7 ${s.rejected} rejected \xB7 ${s.deferred} deferred`;w({...e,st:{kind:"done",sel:0,summary:i}})},we=e=>{if(e.i+1<e.items.length){w({...e,i:e.i+1,st:{kind:"card",sel:0}});return}let s=x?.loadCards()??[];s.length===0?nn(e):w({items:s,i:0,st:{kind:"card",sel:0}})},rn=(e,s)=>{if(!u){we(e);return}ae.current=s.kind;let i={start:t.state.ledger.length,end:null};re.current.push(i),w({...e,st:{kind:"running",label:`${s.kind==="evolve"?"Evolving":"Designing"} ${s.title}`,startedAt:Date.now()}}),u.runDesignChild(s.key,s.kind==="evolve",s.kind).then(()=>{ae.current=null,i.end=t.state.ledger.length,we(D.current??e)}).catch(c=>{ae.current=null,i.end=t.state.ledger.length,t.ledger({kind:"childClose",verb:s.kind,subject:s.title,ok:!1,durS:1}),t.note(c instanceof Error?c.message:String(c)),we(D.current??e)})},xr=(e,s,i)=>{let c=e.items[e.i];!c||Ce.current||(Ce.current=!0,x.applyVerdict(c.key,s,i).then(d=>{if(Ce.current=!1,Ke.current){ft();return}let b=D.current??e;if(!d.ok){t.note(d.refusal);let Y=x.loadCards();Y.length===0?nn(b):w({items:Y,i:Math.min(b.i,Y.length-1),st:{kind:"card",sel:0}});return}lt.current[s==="approve"?"approved":s==="reject"?"rejected":"deferred"]+=1,t.ledger({kind:"commit",ok:!0,line:d.line}),d.note&&t.note(d.note),d.offer?rn(b,d.offer):we(b)}).catch(d=>{if(Ce.current=!1,Ke.current){ft();return}t.note(`the verdict did not land \u2014 ${d instanceof Error?d.message:String(d)}; try the card again`)}))},kr=e=>{x?.noteSteer?.(),w(null),he(null),$(null),t.submit(e)},br=X!=null?{value:X,onChange:e=>he(e),onSubmit:e=>{let s=e.trim();s?kr(s):he(null)},onCancel:()=>he(null)}:null,sn=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!f||sn.current||(sn.current=!0,x?.pending()?tn():p?.())},[f]);let Le=(0,m.useRef)(Qe);Le.current=Qe;let wt=fe&&se&&Xt!==void 0,yt=re.current.find(e=>e.end==null)?.start??"top",on=(0,m.useRef)(new Set),[wr,ln]=(0,m.useState)(!1);(0,m.useEffect)(()=>{wt?on.current.has(yt)||(on.current.add(yt),ln(!0)):ln(!1)},[wt,yt]);let yr=wt?[...wr?[dr]:[],`${Xt}${Gt?` \xB7 next: ${Gt}`:""}`]:[],[vr,Tr]=(0,m.useState)(0),[Ye,$r]=(0,m.useState)(null),vt=(0,m.useRef)(0),cn=(0,m.useRef)(null),ye=e=>{vt.current=e,Tr(e)},ve=e=>{cn.current=e,$r(e)},Cr=`${fe}:${se}:${ct.current}`;(0,m.useEffect)(()=>{ye(0),ve(null)},[Cr]);let Rr=Ye!=null?{value:Ye,onChange:e=>ve(e),onSubmit:e=>{ve(null),ye(0);let s=e.trim();s&&($(null),t.submit(s))},onCancel:()=>{ve(null),ye(0)}}:null,Je=(e,s)=>{if(/^(uc|sc|ac|t|gap|sty)-\d+$/i.test(e.trim())){let b=e.trim().toLowerCase(),q=_e(t.state.turns).entries.findIndex(F=>(F.item.logical_id??"").toLowerCase()===b);if(q<0){$(`${e.trim().toUpperCase()} isn't in this session's items \u2014 view lists what this session minted`);return}K({level:"detail",cursor:q,scroll:0}),H(null);return}let i=jn(e);if("error"in i){$(i.error);return}let c=_e(t.state.turns);if(c.entries.length===0){$("nothing proposed yet \u2014 the first turn is still coming");return}if(i.level==="detail"&&i.num>c.entries.length){$(`no item ${i.num} \u2014 the set has ${c.entries.length} item${c.entries.length===1?"":"s"}`);return}let d=s!=null?St(c,s):c;K(_n(i,d)),H(s!=null&&d.entries.length<c.entries.length?s:null)},Tt=jt?"writing":zn??(t.state.workingLabel?It(t.state.workingLabel):o==="design"?"designing":"thinking"),Sr=ue.liveThinking.length>0||ue.thinkingLog.length>0,$t=S?.kind==="running"?{verb:"design"}:h?.st.kind==="running"&&ae.current?{verb:ae.current}:void 0,Ir=_?{kind:"waiting",pending:Hn}:de==="pausing"?{kind:"working",step:"pausing \u2014 saving session"}:S?.kind==="running"?Ee?{kind:"child-waiting"}:{kind:"child-working",step:Tt}:h?.st.kind==="running"?gt?{kind:"child-waiting"}:ae.current?{kind:"child-working",step:Tt}:{kind:"working",step:It(h.st.label)}:h?.st.kind==="card"&&h.items.length>0?{kind:"card",n:h.i+1,m:h.items.length}:S||h?{kind:"idle"}:Wt?{kind:"working",step:Tt,elapsedS:Gn}:{kind:"idle"},Dr=ut!=null||Ie!=null||mt!=null||X!=null||Ye!=null,an=h?h.items[h.i]:void 0,Br=[...Dr?["\u23CE submit","esc back"]:I?I.level==="list"?["\u2191\u2193 move","\u23CE open","esc back"]:["\u2191\u2193 scroll","esc back"]:_&&Ve?Sn(Ve,{batchCount:_.questions.length,canAttach:t.canIngest(),escBack:_.resolution.slice(0,Fe).some(e=>!!e)}).keys:h?.st.kind==="card"&&an?In(an.card).keys:h?.st.kind==="view"?["\u2191\u2193 scroll","esc back"]:h?.st.kind==="offer"?["\u2191\u2193 select","\u23CE confirm","esc later"]:h?.st.kind==="done"?Bt(Xe,{escBack:!0}).keys:S?.kind==="picker"||S?.kind==="confirm"||S?.kind==="ask"||S?.kind==="failed"?["\u2191\u2193 select","\u23CE confirm","esc back"]:fe?Bt(Qe,{escBack:!1}).keys:[],...Sr?["ctrl+t thinking"]:[],de==="pausing"?"ctrl+c force quit":"ctrl+c exit"],Ct=C??{verb:o,sid:"",env:""},un=(0,E.jsx)($n,{status:Ir,meta:{...Ct,...at??Ct.subject?{subject:at??Ct.subject}:{}},tallies:Rn(t.state,o),keys:Br,child:$t});if(I){let e=_e(t.state.turns),s=B!=null?St(e,B):e,i=e.entries.length-s.entries.length,c=I.level==="list"&&i>0,d=s.entries.length+(c?1:0),b=s.entries[I.cursor],Y=I.level==="detail"&&b?t.explainLines(b.item.slug??b.item.temp_ref):null,q=I.level==="detail"&&b&&g?g(b.item.logical_id??t.aliasOf(b.item.temp_ref)??b.item.temp_ref):null;return(0,E.jsxs)(k,{flexDirection:"column",children:[(0,E.jsx)(Dt,{onToggleThinking:()=>T(F=>!F),onCtrlC:Ht,explorer:{isOpen:()=>L.current!==null,onMove:F=>K(L.current&&ot(L.current,{type:"move",delta:F},d)),onEnter:()=>{let F=L.current;if(F){if(F.level==="list"&&c&&F.cursor===s.entries.length){H(null);return}K(ot(F,{type:"enter"},d))}},onBack:()=>{K(L.current&&ot(L.current,{type:"back"},d)),setTimeout(()=>M(F=>F+1),0)}}}),(0,E.jsx)(Pn,{items:s,state:I,verb:o,more:c?{hidden:i}:null,explain:Y,grandTotal:e.entries.length,dossier:q}),(je??W)&&(je??W).split(`
7
+ `).map((F,ge)=>(0,E.jsx)(n,{color:r.orange,children:F},`nt-${ge}`)),un]})}return(0,E.jsxs)(k,{flexDirection:"column",children:[(0,E.jsx)(Dt,{onToggleThinking:()=>T(e=>!e),onCtrlC:Ht,panel:lr}),Un&&(0,E.jsx)(pn,{thinking:Qn.body,expanded:!0,thinkingDone:de!=="streaming",maxLines:Fn+1}),Ft.length>0&&(0,E.jsx)(k,{flexDirection:"column",children:Ft.map((e,s)=>(0,E.jsx)(n,{children:gn(e).map((i,c)=>(0,E.jsx)(n,{bold:i.bold,italic:i.italic,color:i.code?r.dim:void 0,children:i.text},c))},`st-${s}`))}),_&&(0,E.jsx)(Dn,{childPrefix:$t?`${$t.verb} \xB7 `:void 0,batch:_,qView:Fe,sel:Jn,focused:er,freeText:cr,optionText:ur,attach:ar,multiSelFor:e=>t.multiSelection(e)}),qe&&(0,E.jsx)(n,{color:"yellow",children:qe.prompt}),(je??W)&&(je??W).split(`
8
+ `).map((e,s)=>(0,E.jsx)(n,{color:r.orange,children:e},`nt-${s}`)),fe&&(0,E.jsx)(me,{headline:`${fr}${gr}`,rows:Qe,sel:vr,focused:Ye==null,freeText:Rr,sublines:yr}),h?.st.kind==="card"&&h.items[h.i]&&(0,E.jsx)(Cn,{card:h.items[h.i].card,position:{n:h.i+1,of:h.items.length},sel:h.st.sel,focused:X==null,freeText:br,editorIntent:"steer"}),h?.st.kind==="view"&&h.items[h.i]&&(0,E.jsx)(qn,{title:h.items[h.i].card.title,lines:h.items[h.i].viewLines,offset:h.st.offset}),h?.st.kind==="offer"&&(0,E.jsx)(me,{ask:!0,headline:h.st.offer.kind==="evolve"?`approved \u2014 the design for ${h.st.offer.title} should evolve with it`:`approved \u2014 ${h.st.offer.title} has no tests yet`,rows:[{key:"run",label:h.st.offer.kind==="evolve"?"evolve the design now":"design tests now"},{key:"later",label:"later \u2014 next change"}],sel:h.st.sel,focused:!0}),h?.st.kind==="done"&&(0,E.jsx)(me,{headline:`review complete \u2014 ${h.st.summary}`,rows:Xe,sel:h.st.sel,focused:!0}),S?.kind==="picker"&&(0,E.jsx)(me,{ask:!0,headline:"design tests for which use-case?",rows:S.items.map(e=>({key:e.key,label:e.title,detail:e.badge})),sel:S.sel,focused:!0}),S?.kind==="confirm"&&(0,E.jsx)(me,{ask:!0,headline:`${S.item.title} is already designed${S.item.designed==="stale"?" \u2014 and the use-case has changed since":""}`,rows:Wn(S.item).map(e=>({key:e.key,label:e.label,detail:e.detail})),sel:S.sel,focused:!0}),S?.kind==="ask"&&(0,E.jsx)(me,{headline:`designed ${S.title}`,rows:pt,sel:S.sel,focused:!0}),S?.kind==="failed"&&(0,E.jsx)(me,{headline:`design failed \u2014 ${S.item.title} (${S.detail})`,rows:xt,sel:S.sel,focused:!0}),un]})}export{Xi as ChatSurface,Gr 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-RC52N7PC.js";import"./chunk-TFPPEOAK.js";import"./chunk-27U4PLPX.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-LNQCZ5DS.js";import"./chunk-SA2LQSYP.js";import"./chunk-D6FYCAIA.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-DCY6R5DP.js";import"./chunk-TFPPEOAK.js";import"./chunk-27U4PLPX.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-2N4SZOWN.js";import"./chunk-SA2LQSYP.js";import"./chunk-D6FYCAIA.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-UV462FZR.js";import"./chunk-EWCAFKLX.js";import"./chunk-5Y2G4NC7.js";import"./chunk-27U4PLPX.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-3MFTTLOF.js";import"./chunk-KZVEFBH5.js";import"./chunk-5Y2G4NC7.js";import"./chunk-D6FYCAIA.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 b,b as l,c as n}from"./chunk-FEJXWJ3L.js";import{y as o}from"./chunk-27U4PLPX.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as u,j as v}from"./chunk-C44QQJR4.js";import{a as S}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var C=a(S(),1);var e=a(p(),1);function O({model:x,authLabel:w,profile:B,env:h,defaultUrl:s,projectId:i,projectName:d,folderId:t,folderName:f,windowSize:D,chromeProfile:P,target:r,deviceLabel:m,appLabel:g}){let R=i?d?`${d} (${i})`:i:"(none)",V=t?f?`${f} (${t})`:t:"(none)",{exit:c}=v();return(0,C.useEffect)(()=>{let $=setTimeout(()=>c(),50);return()=>clearTimeout($)},[c]),(0,e.jsx)(u,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Configuration",children:(0,e.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:w}),(0,e.jsx)(l,{label:" profile",value:B}),(0,e.jsx)(l,{label:" env",value:h}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:s??"(none)",valueColor:s?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:x}),(0,e.jsx)(l,{label:" window",value:D}),(0,e.jsx)(l,{label:" project",value:R}),(0,e.jsx)(l,{label:" folder",value:V}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device",value:m??"(not set)",valueColor:m?void 0:o.dim}),(0,e.jsx)(l,{label:" app",value:g??"(not set)",valueColor:g?void 0:o.dim})]})]}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:P,valueColor:o.dim})]})})})}export{O as ConfigView};
2
+ import{a as b,b as l,c as n}from"./chunk-LCU2P3CH.js";import{y as o}from"./chunk-D6FYCAIA.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as u,j as v}from"./chunk-C44QQJR4.js";import{a as S}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var C=a(S(),1);var e=a(p(),1);function O({model:x,authLabel:w,profile:B,env:h,defaultUrl:s,projectId:i,projectName:d,folderId:t,folderName:f,windowSize:D,chromeProfile:P,target:r,deviceLabel:m,appLabel:g}){let R=i?d?`${d} (${i})`:i:"(none)",V=t?f?`${f} (${t})`:t:"(none)",{exit:c}=v();return(0,C.useEffect)(()=>{let $=setTimeout(()=>c(),50);return()=>clearTimeout($)},[c]),(0,e.jsx)(u,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Configuration",children:(0,e.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:w}),(0,e.jsx)(l,{label:" profile",value:B}),(0,e.jsx)(l,{label:" env",value:h}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:s??"(none)",valueColor:s?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:x}),(0,e.jsx)(l,{label:" window",value:D}),(0,e.jsx)(l,{label:" project",value:R}),(0,e.jsx)(l,{label:" folder",value:V}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device",value:m??"(not set)",valueColor:m?void 0:o.dim}),(0,e.jsx)(l,{label:" app",value:g??"(not set)",valueColor:g?void 0:o.dim})]})]}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:P,valueColor:o.dim})]})})})}export{O as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-D5VYMHSO.js";import"./chunk-5NQ3TI4S.js";import"./chunk-5DBK6QNS.js";import"./chunk-CJJXT5DO.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-6IA6QMPH.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-YJNGBZ42.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-SPQPOUUR.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-CVCVBQP6.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D6FYCAIA.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-TRVB7RSW.js";import"./chunk-YCCUBQY4.js";import"./chunk-KOMKHFC4.js";import"./chunk-BPMSNGXQ.js";import"./chunk-SA2LQSYP.js";import"./chunk-CVCVBQP6.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D6FYCAIA.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-27U4PLPX.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-D6FYCAIA.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: 50)"}),(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-UDIQOJEL.js";import"./chunk-FEJXWJ3L.js";import"./chunk-27U4PLPX.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-ZNNRCUHH.js";import"./chunk-LCU2P3CH.js";import"./chunk-D6FYCAIA.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-JJHG3BWO.js";import"./chunk-27U4PLPX.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-EBJD2V4Z.js";import"./chunk-D6FYCAIA.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-NX7TM662.js";import"./chunk-TFPPEOAK.js";import"./chunk-27U4PLPX.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-QJTXNQV5.js";import"./chunk-SA2LQSYP.js";import"./chunk-D6FYCAIA.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-QRZRSAZH.js";import"./chunk-YCCUBQY4.js";import"./chunk-L7MXYCD7.js";import"./chunk-2WVKOZ6W.js";import"./chunk-TFPPEOAK.js";import"./chunk-G7VQCS4J.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.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-7YZMUTJA.js";import"./chunk-YCCUBQY4.js";import"./chunk-KOMKHFC4.js";import"./chunk-BPMSNGXQ.js";import"./chunk-SA2LQSYP.js";import"./chunk-CVCVBQP6.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D6FYCAIA.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-C7HSWZP6.js";import"./chunk-S3DAAAE5.js";import"./chunk-UDIQOJEL.js";import"./chunk-FEJXWJ3L.js";import"./chunk-27U4PLPX.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-5CKQTZMG.js";import"./chunk-S3DAAAE5.js";import"./chunk-ZNNRCUHH.js";import"./chunk-LCU2P3CH.js";import"./chunk-D6FYCAIA.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-6G5YKTVN.js";import"./chunk-IWWQTXGK.js";import"./chunk-KGSVOTLG.js";import"./chunk-2ERQYYSJ.js";import"./chunk-L5LI2JF4.js";import"./chunk-TDPWFYTJ.js";import"./chunk-CJP7RX3E.js";import"./chunk-37ZWKLEN.js";import"./chunk-7YZMUTJA.js";import"./chunk-TRVB7RSW.js";import"./chunk-YCCUBQY4.js";import"./chunk-KOMKHFC4.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-AVH3BEEU.js";import"./chunk-TAOHYWEO.js";import"./chunk-SA2LQSYP.js";import"./chunk-UBTNWAKK.js";import"./chunk-CVCVBQP6.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-5OVEBP4D.js";import"./chunk-D6FYCAIA.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-TKGUT425.js";import"./chunk-UDIQOJEL.js";import"./chunk-FEJXWJ3L.js";import"./chunk-27U4PLPX.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-DOG7S7R6.js";import"./chunk-ZNNRCUHH.js";import"./chunk-LCU2P3CH.js";import"./chunk-D6FYCAIA.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-DJR3M7XO.js";import"./chunk-IVYXXZEE.js";import"./chunk-5BVOF4UW.js";import"./chunk-6IA6QMPH.js";import"./chunk-TDPWFYTJ.js";import"./chunk-CJP7RX3E.js";import"./chunk-KZVEFBH5.js";import"./chunk-5Y2G4NC7.js";import"./chunk-DXI5TXNL.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-SPQPOUUR.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-CVCVBQP6.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-ZNNRCUHH.js";import"./chunk-LCU2P3CH.js";import"./chunk-D6FYCAIA.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as r}from"./chunk-FEJXWJ3L.js";import{y as o}from"./chunk-27U4PLPX.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-LCU2P3CH.js";import{y as o}from"./chunk-D6FYCAIA.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};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g,h}from"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{h as AppClient,g as AppUploadError,a as UPLOAD_CONTENT_TYPE,e as parseAppDetails,b as parseAppListPage,d as parseSignedDownload,c as parseUploadResponse,f as transportReason};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b}from"./chunk-AW2XUHH4.js";import"./chunk-HEAIJCGZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
2
+ import{b as a,c as b}from"./chunk-AVH3BEEU.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D6FYCAIA.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-OH6AVI6N.js"),import("./resolver-UBOZLFFE.js"),import("./config-RS47F5SC.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-J67QR4QP.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-A3RU25MJ.js"),import("./resolver-HHLYRR5W.js"),import("./config-OTUKOTHM.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-OZ4OE44T.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
@@ -1,12 +1,12 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as _}from"./chunk-MXHHMIO2.js";import"./chunk-KHU7C6EE.js";import"./chunk-IOD3HQVW.js";import"./chunk-3Q6WAK6P.js";import"./chunk-AFPHLUQ5.js";import"./chunk-KU6IXFGZ.js";import"./chunk-ZGBSGZZM.js";import"./chunk-65ZTD5SJ.js";import"./chunk-BRHNRCEZ.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-7BZSCUPP.js";import"./chunk-GFKCTYCA.js";import"./chunk-YKTYVJBN.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-JZ26R6UL.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-R7QAS6LZ.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-SDPRO2LE.js";import"./chunk-5DT7PIGB.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as m}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-IDX3TOPY.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";import{existsSync as O}from"fs";var P=new Set(["interactive","agent","ci","override"]);function H(e){return e.mode!=null&&!P.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,phase:e.phase,allowUnreviewed:e.allowUnreviewed,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function B(e){let p=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
2
+ import{a as _}from"./chunk-NNCMMV6P.js";import"./chunk-KHU7C6EE.js";import"./chunk-IOD3HQVW.js";import"./chunk-3Q6WAK6P.js";import"./chunk-AFPHLUQ5.js";import"./chunk-JZ26R6UL.js";import"./chunk-WMMJXI5O.js";import"./chunk-DN42IM2Z.js";import"./chunk-ZGBSGZZM.js";import"./chunk-4FQI643D.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-DSXSU5MH.js";import"./chunk-YKTYVJBN.js";import"./chunk-GFKCTYCA.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-TUTDSX7T.js";import"./chunk-X2FM67OM.js";import"./chunk-DNNZ353O.js";import"./chunk-R7QAS6LZ.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-5DT7PIGB.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as m}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-IDX3TOPY.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-D6FYCAIA.js";import"./chunk-UR6MHSHU.js";import{existsSync as O}from"fs";var P=new Set(["interactive","agent","ci","override"]);function H(e){return e.mode!=null&&!P.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,phase:e.phase,allowUnreviewed:e.allowUnreviewed,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function B(e){let p=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
3
3
  `),2;let{makeHeadlessIO:s,agentRefusal:d}=await import("./headless-io-66RG5NN5.js");return d(s("ndjson","design"),t,r)};if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-66RG5NN5.js");return r(t("ndjson","design"),`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let T=H(e);if("error"in T)return p(T.error);let o=T;{let{validateResumeMessage:t}=await import("./headless-io-66RG5NN5.js"),r=t(o,"design");if(r)return p(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-5EY2AZN7.js"),r=t(e,"design");if(r)return p(r,"STRUCTURED_FLAGS_USAGE")}if(!O(m(process.cwd())))return p("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let y=!!o.resume;if(o.useCase&&o.resume&&!e.allowUnreviewed)try{let{peekSession:t}=await import("./sessions-GIEXOCE4.js"),r=t(m(process.cwd()),o.resume);y=!!(r&&r.use_case===o.useCase)}catch{y=!1}if(o.useCase&&!y&&!e.allowUnreviewed)try{let[{openGraph:t},{designEntryCheck:r}]=await Promise.all([import("./readmodel-XOYGGQ3S.js"),import("./trust-gate-EX7R2P4Y.js")]),s=r(t(m(process.cwd())),o.useCase);if(!s.ok&&(s.code==="UC_UNREVIEWED"||s.code==="UC_ARCHIVED"))if((o.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:l}=await import("readline/promises"),c=l({input:process.stdin,output:process.stderr}),f=(await c.question(`design: ${s.detail}
4
4
  Design against it anyway? (y/N) `)).trim().toLowerCase();if(c.close(),f!=="y"&&f!=="yes")return process.stderr.write(`aborted \u2014 approve it first: ${s.reviewCmd}
5
5
  `),2}else if(e.mode==="agent"){let{makeHeadlessIO:l}=await import("./headless-io-66RG5NN5.js"),c=l("ndjson","design");return c.event({type:"error",code:s.code,message:`design: ${s.detail}`,next:[s.reviewCmd]}),c.event({type:"done",status:"refused",exit_code:2,next:[s.reviewCmd,`kane-cli design tests --use-case ${o.useCase} --mode agent --allow-unreviewed`]}),2}else return process.stderr.write(`design: ${s.detail} (${s.reviewCmd})
6
6
  `),2}catch(t){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(t)}
7
7
  `)}let i=null,x=null;try{if(!o.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
8
8
  `),2;let t=o.mode??"interactive";if(t==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
9
- `),2;let{bindDesignInteractive:n}=await import("./interactive-bind-ORMN2REX.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-J67QR4QP.js"),{runAgent:s}=await import("./bridge-5Z3BIB77.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:l}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:f,resolveEncoding:D,guardedChannels:R}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:A,prepareStructuredResume:U}=await import("./structured-answers-5EY2AZN7.js");i=A(f(D(t),"design"));let{runWithChannel:$}=await import("./run-channel-RGH4WIQX.js"),w=i,I=D(t)==="ndjson"?n=>$({event:g=>w.event(g)},n):n=>n(),E=n=>{w.out(n),w.event({type:"note",text:n})},{telemetryBootstrap:N,telemetryEnvName:G}=await import("./bootstrap-44YKVWWE.js"),u=N({verb:"design",mode:t,contextRoot:m(process.cwd()),env:G(),resumeSid:o.resume,write:!0,longSession:!0});x=n=>u.end(n);let a=U({opts:e,contextDir:m(process.cwd()),verb:"design"});if(a.kind==="refuse")return i.out(a.error),t==="agent"&&i.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?i.done(2,"refused"):2;let C;if(a.kind==="apply"){for(let n of a.notes)E(n);if(a.matchedQids.length>0){E(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let n of a.matchedQids)i.event({type:"panel_resolved",id:n,by:"user",via:"flag"})}a.statement&&(C=[o.message,a.statement].filter(Boolean).join(`
9
+ `),2;let{bindDesignInteractive:n}=await import("./interactive-bind-PI3HY623.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-OZ4OE44T.js"),{runAgent:s}=await import("./bridge-UH32UGR5.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:l}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:f,resolveEncoding:D,guardedChannels:R}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:A,prepareStructuredResume:U}=await import("./structured-answers-5EY2AZN7.js");i=A(f(D(t),"design"));let{runWithChannel:$}=await import("./run-channel-RGH4WIQX.js"),w=i,I=D(t)==="ndjson"?n=>$({event:g=>w.event(g)},n):n=>n(),E=n=>{w.out(n),w.event({type:"note",text:n})},{telemetryBootstrap:N,telemetryEnvName:G}=await import("./bootstrap-MMRPAHWE.js"),u=N({verb:"design",mode:t,contextRoot:m(process.cwd()),env:G(),resumeSid:o.resume,write:!0,longSession:!0});x=n=>u.end(n);let a=U({opts:e,contextDir:m(process.cwd()),verb:"design"});if(a.kind==="refuse")return i.out(a.error),t==="agent"&&i.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?i.done(2,"refused"):2;let C;if(a.kind==="apply"){for(let n of a.notes)E(n);if(a.matchedQids.length>0){E(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let n of a.matchedQids)i.event({type:"panel_resolved",id:n,by:"user",via:"flag"})}a.statement&&(C=[o.message,a.statement].filter(Boolean).join(`
10
10
 
11
11
  `))}let b=c();b&&E(b);let v=l(s,n=>i.out(n)),k=R(i,()=>v.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let n=t==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async h=>{let{createInterface:Y}=await import("readline/promises"),S=Y({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await S.question(`${h} [y/N] `)).trim())}finally{S.close()}}:void 0,g=await I(async()=>{let h={...await r(),...u.spawnEnv()};return _({...o,mode:t,...C!==void 0?{message:C}:{},...n?{confirmRetarget:n}:{}},{contextDir:m(process.cwd()),agent:v.agent,preflightTurn:()=>d(h),ask:async()=>[],out:k.out,emit:k.emit,progress:w.progress,isTTY:!1,auth:h,telemetry:u})});return v.interrupted()&&g!==3?(i.out("interrupted \u2014 no session saved"),await u.end({exit_code:130}),i.done(130)):(g===1&&i.out(u.supportFooter()),await u.end({exit_code:g}),i.done(g))}finally{v.dispose()}}catch(t){x&&await x({exit_code:1}).catch(()=>{});let r=t instanceof Error?t.message:String(t);i?.event({type:"error",message:`error: design failed: ${r}`});let s=i?d=>i.out(d):d=>process.stderr.write(d+`
12
12
  `);return s(`error: design failed: ${r}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&t instanceof Error&&t.stack&&s(t.stack),s('hint: the full trace is in the file named on the "trace:" line at the start of this run'),i?i.done(1):1}}export{B as designTestsCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-LP3BSP74.js";import"./chunk-R5T4RLF5.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-D6FYCAIA.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-DVYO4CR2.js";import"./chunk-XO45NGSN.js";import"./chunk-TUTDSX7T.js";import"./chunk-UD7KKHPW.js";import"./chunk-D6FYCAIA.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-27U4PLPX.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-D6FYCAIA.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{A as fetchChangelog,v as formatChangelog};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-KCCSWEGA.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-6KPPGMO2.js";import"./chunk-NVGBE2DR.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
2
+ import{a,b,c}from"./chunk-LQQXPY5B.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-6KPPGMO2.js";import"./chunk-NVGBE2DR.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as m}from"./chunk-L5LI2JF4.js";import{a as _}from"./chunk-TDPWFYTJ.js";import{c as h}from"./chunk-27U4PLPX.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-D6FYCAIA.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}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-TFPPEOAK.js";import{y as t}from"./chunk-27U4PLPX.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-SA2LQSYP.js";import{y as t}from"./chunk-D6FYCAIA.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-766WGMBU.js";import{a as C}from"./chunk-6O3DDOP2.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-27U4PLPX.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
2
+ import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-UBTNWAKK.js";import{a as C}from"./chunk-5OVEBP4D.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-D6FYCAIA.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
3
3
  Please open this URL manually: ${e}
4
4
  `)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
5
5
  <html lang="en">
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-DPUV6OSP.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-ADZ4PAJF.js"),import("./bootstrap-44YKVWWE.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
2
+ import{a as l}from"./chunk-DPUV6OSP.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-ADZ4PAJF.js"),import("./bootstrap-MMRPAHWE.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-EWCAFKLX.js";import{y as t}from"./chunk-27U4PLPX.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as n}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(R(),1);var e=c(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,i){return s.map(l=>l.name===o?{...l,status:d,detail:i}:l)}function D(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),i=Math.round(o%60);return`${d}m ${i}s`}function w(s){let[o,d]=(0,p.useState)(0),i=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;i.current=Date.now();let l=setInterval(()=>{d(Date.now()-i.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:i}){let l=w(o==="uploading");return o==="uploading"?(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",D(l)]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:s.filter(r=>r.status!=="skipped"||r.detail).map((r,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=r.status==="done",m=r.status==="running",g=r.status==="failed",B=r.status==="skipped";return(0,e.jsxs)(a,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(a,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):B?(0,e.jsx)(n,{color:t.muted,children:"\u2013"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:r.label}),r.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",r.detail]})]},r.name)})}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(a,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{v as a,U as b,h as c};
2
+ import{a as f}from"./chunk-KZVEFBH5.js";import{y as t}from"./chunk-D6FYCAIA.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as n}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(R(),1);var e=c(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,i){return s.map(l=>l.name===o?{...l,status:d,detail:i}:l)}function D(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),i=Math.round(o%60);return`${d}m ${i}s`}function w(s){let[o,d]=(0,p.useState)(0),i=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;i.current=Date.now();let l=setInterval(()=>{d(Date.now()-i.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:i}){let l=w(o==="uploading");return o==="uploading"?(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",D(l)]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:s.filter(r=>r.status!=="skipped"||r.detail).map((r,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=r.status==="done",m=r.status==="running",g=r.status==="failed",B=r.status==="skipped";return(0,e.jsxs)(a,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(a,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):B?(0,e.jsx)(n,{color:t.muted,children:"\u2013"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:r.label}),r.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",r.detail]})]},r.name)})}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(a,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{v as a,U as b,h as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-QW6EZC53.js";import{a as m}from"./chunk-G7VQCS4J.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-6O3DDOP2.js";import{a as c,c as s,i as a,x as u}from"./chunk-27U4PLPX.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-IFIXY3YG.js";import{a as m}from"./chunk-CVCVBQP6.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-5OVEBP4D.js";import{a as c,c as s,i as a,x as u}from"./chunk-D6FYCAIA.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as X}from"./chunk-BB2W35TW.js";import{a as $}from"./chunk-YKTYVJBN.js";import{A as T,l as z,m as Y,n as H}from"./chunk-TH47OOBV.js";import{b as q,g as N}from"./chunk-DUAXZYAD.js";import{a as W,d as S,f as L}from"./chunk-DBIBROYW.js";import{c as C}from"./chunk-UD7KKHPW.js";import{a as K,c as J}from"./chunk-27U4PLPX.js";var ce=3,de=1e4,Q=()=>new Promise(r=>setTimeout(r,25+Math.floor(Math.random()*50))),Z=r=>r==="design"||r==="maintain"?"session":r==="revert"||r==="shape-op"?"exclusive":"commit";function le(r,e,o){for(let s of r){for(let t of s.supersessions)if(t.kind==="node"&&(o.has(t.old)||t.new!==null&&o.has(t.new)))return!0;for(let t of s.nodes)if(t.label==="usecase"&&e.newBuCandidates.length>0||o.has(t.cid))return!0;if(s.design_generation&&e.generationTicket&&s.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let t of e.sourcePins)if(Object.prototype.hasOwnProperty.call(s.source_head_moves,t.source_id))return!0}return!1}async function De(r,e,o){let{contextDir:s,locks:t,probe:a}=r,m=r.sid??r.rootSid,f=e.newBuCandidates.map(b=>({tempRef:b.tempRef,probeText:b.probeText})),k=0,g=!0,p={hits:[],degraded:!1,probeBasis:null};for(;;){g&&(f.length>0&&(p=await a.batchSimilar(T(s),f)),g=!1);let b=T(s),_={seq:b.lastSeq,hash:b.latestHash},P=new Map,w=[],v=[],R=new Set;for(let d of e.ucTargets){let c=H(b,d.ref);if(c===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${d.ref}: names no living node (unknown or tombstoned chain)`}]};d.expectedTip!==void 0&&d.expectedTip!==c.cid&&P.set(d.expectedTip,c.cid),R.add(c.cid),v.push(L(b,d.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(v.length=0,v.push({kind:"context",mode:"exclusive"}));let y;try{y=t.acquire(S(v),{hold:Z(e.verb),verb:e.verb})}catch(d){if(d instanceof W&&(d.code==="UC_HELD"||d.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:d};throw d}let V=!1,M=!1;try{let d=await t.withKeySerialized(v,async()=>{let c=T(s),O=_.hash===c.latestHash?[]:N(s,_.seq,_.hash).records;for(let n of e.ucTargets){let i=H(c,n.ref);if(i===null){w.push({kind:"supersession",ref:n.ref,detail:`${n.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let l of R)c.superseded.has(l)&&c.tipOf(l)===i.cid&&P.set(l,i.cid)}for(let n of e.sourcePins){let i=c.heads.get(n.source_id);i!=null&&i!==n.source_cid&&w.push({kind:"pin",ref:n.source_id,detail:`source '${n.source_id}' moved (pinned ${n.source_cid.slice(0,19)}, head ${i.slice(0,19)}) \u2014 re-ground or abandon`})}if(w.length>0)return{ok:!1,kind:"drifted",asks:w};if(e.generationTicket){let n=X(c,e.generationTicket);if(n!==null)return{ok:!1,kind:"validation",errors:[n]}}if(f.length>0&&O.length>0){let n=new Set(p.hits.map(u=>u.candidateCid)),i=a.recheckLocal(c,f,p.probeBasis,O);if(i.hits.some(u=>!n.has(u.candidateCid))||i.uncachedNewNodes.length>0)return M=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let n=S(e.ucTargets.map(u=>L(c,u.ref).key)),i=S(v);if(!(n.length===i.length&&n.every((u,h)=>JSON.stringify(u)===JSON.stringify(i[h]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(n=>c.appliedEvents.has(n)))return{ok:!0,skipped:"already-applied"};let ae=Date.now()+de,j=c.latestHash,E=c;for(;;){let n={graph:E,expectPrev:j,redirects:P,probeHits:p.hits,degradedProbe:p.degraded,sid:m,eventIds:(l,u)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,u);let h=Y(E,r.rootSid,l,u),U=r.reservedEventIds??[];if(U.length===0)return h;let D=`${r.rootSid}:${l}:`,A=0;for(let F of U){if(!F.startsWith(D))continue;let x=F.slice(D.length);/^\d+$/.test(x)&&(A=Math.max(A,Number.parseInt(x,10)))}if(A===0)return h;let G=Number.parseInt(h[0].slice(D.length),10);return!Number.isInteger(G)||G>A?h:Array.from({length:u},(F,x)=>z(r.rootSid,l,A+1+x))},assertLocks:()=>y.assertHeld()};if(r.revalidate){let l=r.revalidate(n);if(l.length>0)return{ok:!1,kind:"validation",errors:l}}y.assertHeld();let i;try{i=o(n)}catch(l){if(l instanceof q){let u=T(s),h=N(s,E.lastSeq,E.latestHash).records;if(!le(h,e,R)&&Date.now()<ae){await Q(),E=u,j=u.latestHash;continue}return"restart"}throw l}return"errors"in i?{ok:!1,kind:"validation",errors:i.errors}:(Z(e.verb)==="session"&&y.touch(),{ok:!0,result:i.result,record:i.record})}});if(d==="restart")V=!0;else return d}finally{y.release()}if(V){if(k+=1,k>=ce)return{ok:!1,kind:"unsettled",attempts:k};M&&(g=!0),await Q();continue}}}import{readFileSync as ue,writeFileSync as fe,renameSync as me,mkdirSync as pe}from"fs";import{dirname as he,join as ge}from"path";var B=1,be=720*60*1e3;function I(r){return ge(J,"embeddings",`alias-${r}.json`)}function ee(r,e=Date.now()){return r!==null&&e-r.fetchedAt<be}function re(r){try{let e=JSON.parse(ue(r,"utf-8"));return e.wrapperVersion!==B||typeof e.purposes!="object"||e.purposes===null?null:{wrapperVersion:B,writtenByVersion:String(e.writtenByVersion??""),purposes:e.purposes}}catch{return null}}function te(r,e,o=I(r)){let t=re(o)?.purposes?.[e];return!t||typeof t.alias!="string"||typeof t.dims!="number"||typeof t.fetchedAt!="number"?null:{alias:t.alias,dims:t.dims,fetchedAt:t.fetchedAt}}function se(r,e,o,s=I(r)){try{pe(he(s),{recursive:!0});let a=re(s)?.purposes??{};a[e]={alias:o.alias,dims:o.dims,fetchedAt:Date.now()};let m={wrapperVersion:B,writtenByVersion:K,purposes:a},f=`${s}.tmp`;fe(f,JSON.stringify(m,null,2)+`
2
+ import{d as X}from"./chunk-BB2W35TW.js";import{a as $}from"./chunk-YKTYVJBN.js";import{A as T,l as z,m as Y,n as H}from"./chunk-TH47OOBV.js";import{b as q,g as N}from"./chunk-DUAXZYAD.js";import{a as W,d as S,f as L}from"./chunk-DBIBROYW.js";import{c as C}from"./chunk-UD7KKHPW.js";import{a as K,c as J}from"./chunk-D6FYCAIA.js";var ce=3,de=1e4,Q=()=>new Promise(r=>setTimeout(r,25+Math.floor(Math.random()*50))),Z=r=>r==="design"||r==="maintain"?"session":r==="revert"||r==="shape-op"?"exclusive":"commit";function le(r,e,o){for(let s of r){for(let t of s.supersessions)if(t.kind==="node"&&(o.has(t.old)||t.new!==null&&o.has(t.new)))return!0;for(let t of s.nodes)if(t.label==="usecase"&&e.newBuCandidates.length>0||o.has(t.cid))return!0;if(s.design_generation&&e.generationTicket&&s.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let t of e.sourcePins)if(Object.prototype.hasOwnProperty.call(s.source_head_moves,t.source_id))return!0}return!1}async function De(r,e,o){let{contextDir:s,locks:t,probe:a}=r,m=r.sid??r.rootSid,f=e.newBuCandidates.map(b=>({tempRef:b.tempRef,probeText:b.probeText})),k=0,g=!0,p={hits:[],degraded:!1,probeBasis:null};for(;;){g&&(f.length>0&&(p=await a.batchSimilar(T(s),f)),g=!1);let b=T(s),_={seq:b.lastSeq,hash:b.latestHash},P=new Map,w=[],v=[],R=new Set;for(let d of e.ucTargets){let c=H(b,d.ref);if(c===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${d.ref}: names no living node (unknown or tombstoned chain)`}]};d.expectedTip!==void 0&&d.expectedTip!==c.cid&&P.set(d.expectedTip,c.cid),R.add(c.cid),v.push(L(b,d.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(v.length=0,v.push({kind:"context",mode:"exclusive"}));let y;try{y=t.acquire(S(v),{hold:Z(e.verb),verb:e.verb})}catch(d){if(d instanceof W&&(d.code==="UC_HELD"||d.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:d};throw d}let V=!1,M=!1;try{let d=await t.withKeySerialized(v,async()=>{let c=T(s),O=_.hash===c.latestHash?[]:N(s,_.seq,_.hash).records;for(let n of e.ucTargets){let i=H(c,n.ref);if(i===null){w.push({kind:"supersession",ref:n.ref,detail:`${n.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let l of R)c.superseded.has(l)&&c.tipOf(l)===i.cid&&P.set(l,i.cid)}for(let n of e.sourcePins){let i=c.heads.get(n.source_id);i!=null&&i!==n.source_cid&&w.push({kind:"pin",ref:n.source_id,detail:`source '${n.source_id}' moved (pinned ${n.source_cid.slice(0,19)}, head ${i.slice(0,19)}) \u2014 re-ground or abandon`})}if(w.length>0)return{ok:!1,kind:"drifted",asks:w};if(e.generationTicket){let n=X(c,e.generationTicket);if(n!==null)return{ok:!1,kind:"validation",errors:[n]}}if(f.length>0&&O.length>0){let n=new Set(p.hits.map(u=>u.candidateCid)),i=a.recheckLocal(c,f,p.probeBasis,O);if(i.hits.some(u=>!n.has(u.candidateCid))||i.uncachedNewNodes.length>0)return M=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let n=S(e.ucTargets.map(u=>L(c,u.ref).key)),i=S(v);if(!(n.length===i.length&&n.every((u,h)=>JSON.stringify(u)===JSON.stringify(i[h]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(n=>c.appliedEvents.has(n)))return{ok:!0,skipped:"already-applied"};let ae=Date.now()+de,j=c.latestHash,E=c;for(;;){let n={graph:E,expectPrev:j,redirects:P,probeHits:p.hits,degradedProbe:p.degraded,sid:m,eventIds:(l,u)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,u);let h=Y(E,r.rootSid,l,u),U=r.reservedEventIds??[];if(U.length===0)return h;let D=`${r.rootSid}:${l}:`,A=0;for(let F of U){if(!F.startsWith(D))continue;let x=F.slice(D.length);/^\d+$/.test(x)&&(A=Math.max(A,Number.parseInt(x,10)))}if(A===0)return h;let G=Number.parseInt(h[0].slice(D.length),10);return!Number.isInteger(G)||G>A?h:Array.from({length:u},(F,x)=>z(r.rootSid,l,A+1+x))},assertLocks:()=>y.assertHeld()};if(r.revalidate){let l=r.revalidate(n);if(l.length>0)return{ok:!1,kind:"validation",errors:l}}y.assertHeld();let i;try{i=o(n)}catch(l){if(l instanceof q){let u=T(s),h=N(s,E.lastSeq,E.latestHash).records;if(!le(h,e,R)&&Date.now()<ae){await Q(),E=u,j=u.latestHash;continue}return"restart"}throw l}return"errors"in i?{ok:!1,kind:"validation",errors:i.errors}:(Z(e.verb)==="session"&&y.touch(),{ok:!0,result:i.result,record:i.record})}});if(d==="restart")V=!0;else return d}finally{y.release()}if(V){if(k+=1,k>=ce)return{ok:!1,kind:"unsettled",attempts:k};M&&(g=!0),await Q();continue}}}import{readFileSync as ue,writeFileSync as fe,renameSync as me,mkdirSync as pe}from"fs";import{dirname as he,join as ge}from"path";var B=1,be=720*60*1e3;function I(r){return ge(J,"embeddings",`alias-${r}.json`)}function ee(r,e=Date.now()){return r!==null&&e-r.fetchedAt<be}function re(r){try{let e=JSON.parse(ue(r,"utf-8"));return e.wrapperVersion!==B||typeof e.purposes!="object"||e.purposes===null?null:{wrapperVersion:B,writtenByVersion:String(e.writtenByVersion??""),purposes:e.purposes}}catch{return null}}function te(r,e,o=I(r)){let t=re(o)?.purposes?.[e];return!t||typeof t.alias!="string"||typeof t.dims!="number"||typeof t.fetchedAt!="number"?null:{alias:t.alias,dims:t.dims,fetchedAt:t.fetchedAt}}function se(r,e,o,s=I(r)){try{pe(he(s),{recursive:!0});let a=re(s)?.purposes??{};a[e]={alias:o.alias,dims:o.dims,fetchedAt:Date.now()};let m={wrapperVersion:B,writtenByVersion:K,purposes:a},f=`${s}.tmp`;fe(f,JSON.stringify(m,null,2)+`
3
3
  `),me(f,s)}catch(t){C(`[embed] Failed to save alias cache: ${t instanceof Error?t.message:String(t)}`,"EMBED_CACHE_WRITE_FAILED")}}function ve(r){return r.TESTMUAI_ENV==="stage"?"stage":"prod"}function oe(r){let e=r.env??process.env,o=r.auth?.TESTMUAI_BASIC_AUTH||e.TESTMUAI_BASIC_AUTH;if(o)return{authorization:`Basic ${o}`};let s=r.auth?.TESTMUAI_API_KEY||e.TESTMUAI_API_KEY;return s?{authorization:`Bearer ${s}`}:{}}async function Oe(r,e={}){let o=e.env??process.env,s=ve(o),t=e.aliasCacheFile??I(s),a=e.now??Date.now,m=te(s,r,t);if(ee(m,a()))return{alias:m.alias,dims:m.dims};let k=`${$(o)}/assurance/embed/alias?purpose=${encodeURIComponent(r)}`,g=await(e.fetchImpl??fetch)(k,{method:"GET",headers:oe(e)});if(!g.ok)throw new Error(`embed alias resolve failed: ${g.status}`);let p=await g.json();return se(s,r,{alias:p.alias,dims:p.dims},t),{alias:p.alias,dims:p.dims}}async function je(r,e,o={}){let s=o.env??process.env,t=$(s),a=await(o.fetchImpl??fetch)(`${t}/assurance/embed`,{method:"POST",headers:{...oe(o),"content-type":"application/json"},body:JSON.stringify({purpose:r,input:e})});if(!a.ok)throw new Error(`embed failed: ${a.status}`);return await a.json()}import{readFileSync as ke,writeFileSync as ye,renameSync as Ee,mkdirSync as Ae}from"fs";import{dirname as Te,join as ne}from"path";function we(r){return ne(r,"embeddings")}function xe(r){let e=r.indexOf(":");return e>=0?r.slice(e+1):r}function ie(r,e,o){let s=xe(o);return ne(we(r),e,s.slice(0,2),`${s.slice(2)}.f32`)}function We(r,e,o){try{let s=ke(ie(r,e,o)),t=new Float32Array(Math.floor(s.length/4));for(let a=0;a<t.length;a++)t[a]=s.readFloatLE(a*4);return t}catch{return null}}function qe(r,e,o,s){try{let t=ie(r,e,o);Ae(Te(t),{recursive:!0});let a=Buffer.alloc(s.length*4);for(let f=0;f<s.length;f++)a.writeFloatLE(s[f],f*4);let m=`${t}.tmp`;ye(m,a),Ee(m,t)}catch(t){C(`[embed] Failed to cache vector: ${t instanceof Error?t.message:String(t)}`,"EMBED_CACHE_WRITE_FAILED")}}export{De as a,Oe as b,je as c,We as d,qe as e};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as Y,f as q,h as H}from"./chunk-YJNGBZ42.js";import{a as O,b as j,c as z}from"./chunk-ITTZYA2G.js";import{d as B,f as R}from"./chunk-DXI5TXNL.js";import{b as N,c as _,j as M}from"./chunk-SPQPOUUR.js";import{a as L}from"./chunk-TZXXJWHA.js";import{m as b}from"./chunk-56PAQAX5.js";import{a as K,b as C,c as G}from"./chunk-AVH3BEEU.js";import{h as J}from"./chunk-TAOHYWEO.js";import{a as F,b as $}from"./chunk-BRIEBB2U.js";import{c as E}from"./chunk-D6FYCAIA.js";import{createHash as be}from"crypto";import{readdir as Ce,stat as Te}from"fs/promises";import{basename as f,extname as Ie,join as Ae,relative as ke}from"path";import{createHash as de}from"crypto";import{createReadStream as le}from"fs";import{mkdir as ce,readFile as ue,rename as fe,writeFile as ge}from"fs/promises";import{dirname as me,join as he}from"path";var we=60,ve=5;function V(){return{entries:[]}}function X(){return he(E,"mobile","app-cache.json")}async function T(e){let r=de("sha256");for await(let t of le(e))r.update(t);return r.digest("hex")}function ye(){return{readFile:e=>ue(e,"utf8"),writeFile:async(e,r)=>{await ce(me(e),{recursive:!0});let t=`${e}.tmp`;await ge(t,r),await fe(t,e)},hashFile:T,now:()=>new Date}}function I(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,o,s]=r,n=new Date(`${t}-${o}-${s}T00:00:00Z`);return Number.isNaN(n.getTime())?void 0:n.toISOString()}function Pe(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=we-ve}var u=class{deps;constructor(r={}){this.deps={...ye(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(X()));if(!r||typeof r!="object")return V();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return V()}}async write(r){await this.deps.writeFile(X(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(o=>o.sha256===r.sha256&&o.env===r.env&&o.orgId===r.orgId&&o.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(o=>!(o.sha256===r.sha256&&o.env===r.env&&o.orgId===r.orgId&&o.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),o=t.entries.length;t.entries=t.entries.filter(s=>!(s.sha256===r.sha256&&s.env===r.env&&s.orgId===r.orgId&&s.type===r.type)),t.entries.length!==o&&await this.write(t)}isNearExpiry(r){return Pe(r,this.deps.now())}};var Z={emulator:[".apk"],simulator:[".zip"]};function Q(e){return e.skipped===!0}function De(e,r){let t=Ie(e).toLowerCase();return t===".ipa"?`${f(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:Z[r].includes(t)?null:`${f(e)} cannot be uploaded for a ${r} run \u2014 expected one of ${Z[r].join(", ")}.`}async function A(e,r){if(!(await Te(e)).isDirectory())return r.hashOf(e);let o=[],s=async i=>{for(let a of await Ce(i,{withFileTypes:!0})){let p=Ae(i,a.name);a.isDirectory()?await s(p):a.isFile()&&o.push(p)}};await s(e),o.sort();let n=be("sha256");for(let i of o)n.update(ke(e,i)),n.update("\0"),n.update(await T(i)),n.update("\0");return n.digest("hex")}async function W(e){let r=De(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new u,o=e.client??new J(e.baseUrl,{...e.auth,orgId:e.orgId}),s;try{s=await A(e.path,t)}catch(a){return{skipped:!0,reason:`could not read ${f(e.path)}: ${a.message}`}}let n={sha256:s,env:e.env,orgId:e.orgId,type:e.type},i=await t.lookup(n);if(i){if(await o.liveness(i.appId)!=="gone")return{appId:i.appId,...i.appUrl?{appUrl:i.appUrl}:{},fromCache:!0};e.onProgress?.(`${i.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(n)}try{e.onProgress?.(`uploading ${f(e.path)}\u2026`);let a=await o.upload(e.path,e.type);return await t.remember({sha256:s,env:e.env,orgId:e.orgId,type:e.type,appId:a.appId,...a.appUrl?{appUrl:a.appUrl}:{},...I(a.url)?{storedAt:I(a.url)}:{},sourcePath:e.path}),e.onProgress?.(a.cached?`${f(e.path)} already in the cloud (${a.appId})`:`${f(e.path)} uploaded (${a.appId})`),{appId:a.appId,...a.appUrl?{appUrl:a.appUrl}:{},fromCache:!1}}catch(a){return{skipped:!0,reason:a.message}}}function h(e){return`${e.platform}|${F(e)}`}var g=new Map,ee=new Set;function re(e){return ee.has(h(e))}function We(e,r,t){r.state==="stopped"&&(g.has(h(r))||oe(e,r,t))}async function te(e,r,t){let o=g.get(h(r));return o?(t?.(`waiting for ${r.displayName} to finish booting\u2026`),o):oe(e,r,t)}function oe(e,r,t){let o=h(r),s=e.prepare(r,t);g.set(o,s),r.state==="stopped"&&s.then(()=>ee.add(o),()=>{});let n=()=>{g.get(o)===s&&g.delete(o)};return s.then(n,n),s.catch(()=>{}),s}import{basename as xe}from"path";import{spawnSync as Ue}from"child_process";async function Se(e,r,t){if(!e.teardownPlan||!t.appPackage&&!t.shutdown)return;let o;try{o=await e.teardownPlan(r,t)}catch{return}o.length!==0&&b(`device:${r.id}`,()=>{Y({udid:r.id,displayName:r.displayName});for(let s of o)try{Ue(s.file,s.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var ae={emulator:[".apk"],simulator:[".zip"]};async function Ee(e,r,t,o){if(e.kind==="package")return e;if(e.kind==="app_id"){let s=r.cloudUpload;if(!s)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let n=await G({appId:e.value,baseUrl:s.baseUrl,auth:s.auth,...ae[t]?{accepts:ae[t]}:{},...o?{onProgress:o}:{}}),i=D(n.path);if(!i||i.kind==="app_id")throw new Error(`${n.name} is not a build this CLI can install (from ${e.value}).`);return i}try{let s=new u,n=await A(e.value,s),i=new K;await i.find(n)||o?.(`copying ${xe(e.value)} into the local app store\u2026`);let p=await i.put({key:n,sourcePath:e.value,source:"local"});return{...e,value:p.path}}catch{return e}}function Fe(e){b(`appium:${e}`,()=>{H({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},w=class extends Error{constructor(t,o){super(t);this.doctorText=o;this.name="MobilePreflightError"}};async function $e(e,r,t){let o=t.cloudUpload,s=await W({path:e,type:r,env:o.env,orgId:o.orgId,userId:o.userId,auth:o.auth,baseUrl:o.baseUrl,...t.onProgress?{onProgress:t.onProgress}:{}});if(Q(s)){t.onProgress?.(`app not uploaded \u2014 ${s.reason}`);return}return s.appId}var Ne="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",se=/\.(apk|zip)$/i;function D(e){let r=e.trim();if(C(r))return{kind:"app_id",value:r};let t=se.exec(r)?.[1]?.toLowerCase();return t?{kind:t,value:r}:null}function _e(e){return!!e&&(se.test(e)||C(e.trim()))}function Me(e){return e.filter(r=>r.required&&r.status==="fail")}function Be(e,r){return!!r&&e.platform===r.platform&&e.kind===r.kind&&(e.id===r.id||e.virtualName===r.id)}async function mr(e){let r=L();if(!r.supported)throw new k(r.reason);let t=e.appiumUrl??e.defaults?.appium_url,o=!!(e.agent||!e.interactive),s=M();o&&e.platform?.toLowerCase()!=="ios"&&((await s.status("emulator")).installed||await s.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let n=await O(e.platform,{appiumUrl:t});if(z(n)){let d=n.sections.flatMap(P=>Me(P.checks)).map(P=>P.label).join(", ");throw new w(`Mobile toolchain not ready (${d}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,j(n))}let i=await R({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),a;if(i.ok)a=i.target;else if(i.reason==="needs-picker"&&e.pickTarget){let d=await e.pickTarget(i.candidates);if(!d)throw new Error("Target selection cancelled");a=d}else throw new Error(i.message);let p=B(a.platform);if(!p)throw new Error(`No provider for platform "${a.platform}"`);let l=N(a);if(!l)throw new Error(`No managed dependencies serve ${a.platform} ${a.kind} targets yet.`);try{await s.ensure(l,{automatic:o,onProgress:e.onProgress})}catch(d){throw d instanceof _?new w(d.message,d.message):d}let ie=a.state!=="ready"||re(a);a=await te(p,a,e.onProgress);let ne=await q(l,{...t?{appiumUrl:t}:{},device:{udid:a.id,displayName:a.displayName},onProgress:e.onProgress});Fe(l);let x=Be(a,e.defaults?.default_target)?e.defaults?.default_app:void 0,m=e.app??(_e(x)?x:void 0);if(e.app&&!D(e.app))throw new Error(`${e.app}: ${Ne}`);let c=m?D(m):null,U=c?await Ee(c,e,l,e.onProgress):null,v=U?await p.ensureApp(a,U,e.onProgress):void 0,y=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&m?await $e(c.value,l,e):void 0;await Se(p,a,{shutdown:ie,...v?{appPackage:v}:{}});let pe=$(a,v,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ne.url}),S=y??m;return{device:pe,target:a,provider:p,...y?{appId:y}:{},...S?{appRef:S}:{}}}export{We as a,te as b,k as c,w as d,Ne as e,D as f,_e as g,mr as h};