@testmuai/kane-cli 0.3.2 → 0.3.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 (56) hide show
  1. package/dist/{ChromeProfilePicker-ETBZA64A.js → ChromeProfilePicker-J6QIIHIE.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-S7RZGMBQ.js → CliFeedbackPrompt-SEH4MXTF.js} +1 -1
  3. package/dist/{CliUploadProgress-TPWX5ARU.js → CliUploadProgress-U6QLD76Y.js} +1 -1
  4. package/dist/{ConfigView-BSIS2LOH.js → ConfigView-5ZCHVYM2.js} +1 -1
  5. package/dist/FolderPicker-VYJDEDN7.js +2 -0
  6. package/dist/{HelpView-MUIOT5UN.js → HelpView-3ESCWBPB.js} +1 -1
  7. package/dist/{InfoBox-3EY4ARJG.js → InfoBox-OVAOOQHC.js} +1 -1
  8. package/dist/{LinksBox-UD364LBX.js → LinksBox-P3VETMP6.js} +1 -1
  9. package/dist/{ProfilesView-UOJP2KA2.js → ProfilesView-UBVNEYVE.js} +1 -1
  10. package/dist/{ProjectPicker-5ZPZNRSS.js → ProjectPicker-NJKUWRET.js} +1 -1
  11. package/dist/{SaveSessionPrompt-D4PETK7B.js → SaveSessionPrompt-S5RCU5DX.js} +1 -1
  12. package/dist/SingleShotApp-WOJWOQSV.js +2 -0
  13. package/dist/{SummaryBox-L4ZXY4S4.js → SummaryBox-M4UFKKMD.js} +1 -1
  14. package/dist/{TestMdRunView-YD3Z6MCR.js → TestMdRunView-PI433EGP.js} +1 -1
  15. package/dist/{WhoamiView-ZZUFXKDU.js → WhoamiView-VJBEYTCF.js} +1 -1
  16. package/dist/{changelog-H2RXH4LH.js → changelog-EFAQANXW.js} +1 -1
  17. package/dist/{chunk-477FDDDW.js → chunk-4QLJMIBA.js} +1 -1
  18. package/dist/{chunk-BSHGW3QM.js → chunk-53K3BK7I.js} +1 -1
  19. package/dist/{chunk-E7QWDV7M.js → chunk-D4P6GLSX.js} +1 -1
  20. package/dist/{chunk-V4S5H6O2.js → chunk-FAPS5ACQ.js} +2 -2
  21. package/dist/{chunk-7JB4RPI2.js → chunk-FSIJOBVB.js} +1 -1
  22. package/dist/{chunk-FMMDLDDI.js → chunk-G5HHHYH7.js} +1 -1
  23. package/dist/{chunk-3YGQYJ3D.js → chunk-H33BV5YV.js} +1 -1
  24. package/dist/{chunk-PAQGYV5G.js → chunk-HNIH3GSQ.js} +1 -1
  25. package/dist/{chunk-MVX3N7GI.js → chunk-IROWNPDG.js} +1 -1
  26. package/dist/{chunk-ZB72T6HB.js → chunk-IXWVTWOR.js} +1 -1
  27. package/dist/{chunk-AH7HH3OE.js → chunk-J3SCNSXX.js} +1 -1
  28. package/dist/{chunk-7ECMUWV2.js → chunk-JPEICMHK.js} +1 -1
  29. package/dist/{chunk-EZJNX4VE.js → chunk-L3MOXBKE.js} +1 -1
  30. package/dist/{chunk-AMCAQCEV.js → chunk-N7YALZKA.js} +1 -1
  31. package/dist/{chunk-RVQBAKOK.js → chunk-NOQKUOEK.js} +1 -1
  32. package/dist/{chunk-KGZATJQN.js → chunk-PNQ5YMED.js} +1 -1
  33. package/dist/{chunk-3UDKGPAS.js → chunk-RHXWME7G.js} +1 -1
  34. package/dist/{chunk-OQ64GUQE.js → chunk-RURXFEOD.js} +1 -1
  35. package/dist/{chunk-HXIGYD2T.js → chunk-SR5UDUMJ.js} +1 -1
  36. package/dist/{chunk-XUDEM7I6.js → chunk-TEH6AVF4.js} +1 -1
  37. package/dist/{chunk-2FCAWRCU.js → chunk-TL4SB7MQ.js} +1 -1
  38. package/dist/{chunk-RBED7RVV.js → chunk-U4QMSR5Z.js} +1 -1
  39. package/dist/{chunk-O22K3JLR.js → chunk-WM6GZFTC.js} +1 -1
  40. package/dist/{chunk-WCRLZETG.js → chunk-XM4H4TJD.js} +1 -1
  41. package/dist/{chunk-RDJPZQBU.js → chunk-YF4OL463.js} +1 -1
  42. package/dist/{chunk-XK33C64U.js → chunk-YVLFHMUW.js} +1 -1
  43. package/dist/{chunk-4GQZBMTW.js → chunk-ZYVYAIBS.js} +1 -1
  44. package/dist/index.js +7 -7
  45. package/dist/{logging-RMC6R23F.js → logging-AIQHWRNQ.js} +1 -1
  46. package/dist/{login-flow-NL3LNSP5.js → login-flow-E6WMJ25A.js} +1 -1
  47. package/dist/{persist-recorded-session-GG732QRB.js → persist-recorded-session-V5DXMRKC.js} +1 -1
  48. package/dist/{recording-banner-LAAAMKIM.js → recording-banner-7ZKIORL5.js} +1 -1
  49. package/dist/run-test-md-BQS5SZ7E.js +65 -0
  50. package/dist/{testmd-actions-5O7F22EC.js → testmd-actions-322GQYAH.js} +2 -2
  51. package/dist/{validate-basic-NIEIKFGP.js → validate-basic-XKTSGLFO.js} +1 -1
  52. package/dist/{version-check-WHWTPX6C.js → version-check-LUCKH72U.js} +1 -1
  53. package/package.json +5 -5
  54. package/dist/FolderPicker-7FXP3PIM.js +0 -2
  55. package/dist/SingleShotApp-N4AGSAPW.js +0 -2
  56. package/dist/run-test-md-IAEJXIVK.js +0 -65
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as v}from"./chunk-PAQGYV5G.js";import{spawn as x,execSync as b}from"child_process";import{existsSync as g}from"fs";import{resolve as e,dirname as h}from"path";import{fileURLToPath as N}from"url";import{createInterface as S}from"readline";async function*E(i){let n=S({input:i,crlfDelay:1/0});for await(let l of n){let r=l.trim();if(r)try{let d=JSON.parse(r);d&&typeof d.type=="string"&&(yield d)}catch{}}}function w(i){return i==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS"]}}var c=h(N(import.meta.url));function O(){for(let i of["python3","python"])try{return b(`${i} --version`,{stdio:"ignore"}),i}catch{}return null}function C(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",l={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,d=l[r];if(d)for(let t of d){let a=[e(c,"..","node_modules",t,"bin",n),e(c,"..","..","node_modules",t,"bin",n),e(c,"..","..","..","node_modules",t,"bin",n),e(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(g(u))return{cmd:u,args:[]}}let p=[e(c,"bin",n),e(c,"..","bin",n),e(c,"..","..","..","..","v16-runner","dist",n),e(c,"..","..","..","v16-runner","dist",n),e(process.cwd(),"v16-runner","dist",n),e(process.cwd(),"..","v16-runner","dist",n)];for(let t of p)if(g(t))return{cmd:t,args:[]};let s=[e(c,"..","..","..","..","v16-runner"),e(c,"..","..","..","v16-runner"),e(process.cwd(),"v16-runner"),e(process.cwd(),"..","v16-runner")];for(let t of s)if(g(e(t,"main.py"))){for(let u of[e(t,".venv","bin","python"),e(t,"..","browser-agent",".venv","bin","python")])if(g(u))return{cmd:u,args:["main.py"],cwd:t};let a=O();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function G(i,n){let l=C();if(!l)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");let r={...process.env};n?.environment&&(r.TESTMUAI_ENV=n.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let d=v(n?.environment);r.V16_SERVER_API_HOST=d.v16ServerHost,r.ATMS_URL=d.tmsBaseUrl.replace(/\/api\/?$/,""),i.username&&i.access_key&&(r.LT_USERNAME=i.username,r.LT_ACCESS_KEY=i.access_key),i.session_id&&(r.TESTMUAI_SESSION_ID=i.session_id);let p=w(n?.mode??"testing");Object.assign(r,p.set);for(let o of p.unset)delete r[o];let s=x(l.cmd,l.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:l.cwd});s.stdin.on("error",()=>{}),s.stdin.write(JSON.stringify(i)+`
2
+ import{a as v}from"./chunk-HNIH3GSQ.js";import{spawn as x,execSync as b}from"child_process";import{existsSync as g}from"fs";import{resolve as e,dirname as h}from"path";import{fileURLToPath as N}from"url";import{createInterface as S}from"readline";async function*E(i){let n=S({input:i,crlfDelay:1/0});for await(let l of n){let r=l.trim();if(r)try{let d=JSON.parse(r);d&&typeof d.type=="string"&&(yield d)}catch{}}}function w(i){return i==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS"]}}var c=h(N(import.meta.url));function O(){for(let i of["python3","python"])try{return b(`${i} --version`,{stdio:"ignore"}),i}catch{}return null}function C(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",l={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,d=l[r];if(d)for(let t of d){let a=[e(c,"..","node_modules",t,"bin",n),e(c,"..","..","node_modules",t,"bin",n),e(c,"..","..","..","node_modules",t,"bin",n),e(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(g(u))return{cmd:u,args:[]}}let p=[e(c,"bin",n),e(c,"..","bin",n),e(c,"..","..","..","..","v16-runner","dist",n),e(c,"..","..","..","v16-runner","dist",n),e(process.cwd(),"v16-runner","dist",n),e(process.cwd(),"..","v16-runner","dist",n)];for(let t of p)if(g(t))return{cmd:t,args:[]};let s=[e(c,"..","..","..","..","v16-runner"),e(c,"..","..","..","v16-runner"),e(process.cwd(),"v16-runner"),e(process.cwd(),"..","v16-runner")];for(let t of s)if(g(e(t,"main.py"))){for(let u of[e(t,".venv","bin","python"),e(t,"..","browser-agent",".venv","bin","python")])if(g(u))return{cmd:u,args:["main.py"],cwd:t};let a=O();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function G(i,n){let l=C();if(!l)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");let r={...process.env};n?.environment&&(r.TESTMUAI_ENV=n.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let d=v(n?.environment);r.V16_SERVER_API_HOST=d.v16ServerHost,r.ATMS_URL=d.tmsBaseUrl.replace(/\/api\/?$/,""),i.username&&i.access_key&&(r.LT_USERNAME=i.username,r.LT_ACCESS_KEY=i.access_key),i.session_id&&(r.TESTMUAI_SESSION_ID=i.session_id);let p=w(n?.mode??"testing");Object.assign(r,p.set);for(let o of p.unset)delete r[o];let s=x(l.cmd,l.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:l.cwd});s.stdin.on("error",()=>{}),s.stdin.write(JSON.stringify(i)+`
3
3
  `);let t=1e5,a="";s.stderr.on("data",o=>{a+=o.toString(),a.length>t&&(a=a.slice(-t))}),s.on("error",o=>{n?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:o.message})});let u=null,f=null,R=new Promise(o=>{s.on("close",(m,y)=>{u=m,f=y?String(y):null,n?.log?.("info","RUNNER_EXIT","Runner exited",{code:m,signal:f??"none"}),o({code:m,signal:f})})}),_=E(s.stdout);return{child:s,events:_,sendUserResponse(o){let m=JSON.stringify({type:"user_response",answer:o});try{s.stdin.write(m+`
4
4
  `)}catch{}},sendCancel(o){let m=JSON.stringify({type:"cancel",reason:o});try{s.stdin.write(m+`
5
5
  `)}catch{}},cancel(){s.kill("SIGTERM")},get stderr(){return a},get exitCode(){return u},get exitSignal(){return f},exited:R}}export{C as a,G as b};
@@ -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{c as p}from"./chunk-2FCAWRCU.js";import{randomUUID as L}from"crypto";import{mkdirSync as j,writeFileSync as _,appendFileSync as $,existsSync as f}from"fs";import{join as a}from"path";import{writeFileSync as R,mkdirSync as S,existsSync as b}from"fs";import{join as h,relative as w}from"path";var I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),x=new Set(["model","env"]),d=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=h(this.opts.cwd,".testmuai","tests");try{S(t,{recursive:!0})}catch(l){process.stderr.write(`
2
+ import{b as m}from"./chunk-L5LI2JF4.js";import{c as p}from"./chunk-TL4SB7MQ.js";import{randomUUID as L}from"crypto";import{mkdirSync as j,writeFileSync as _,appendFileSync as $,existsSync as f}from"fs";import{join as a}from"path";import{writeFileSync as R,mkdirSync as S,existsSync as b}from"fs";import{join as h,relative as w}from"path";var I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),x=new Set(["model","env"]),d=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=h(this.opts.cwd,".testmuai","tests");try{S(t,{recursive:!0})}catch(l){process.stderr.write(`
3
3
  \u26A0 Failed to create ${w(this.opts.cwd,t)}/
4
4
  ${l.message}
5
5
  Your test recording was NOT saved.
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-XK33C64U.js";import{a as A}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-2FCAWRCU.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as y}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(y(),1);var r=x(A(),1);function B(i,d,l,u,p){let g=l==="basic"&&u?`basic (${u})`:l,n=20,s=`${i} [${d}]`,m="\xB7".repeat(Math.max(2,n-s.length+3));return{label:`${s} ${m} ${g}`,profile:i,env:d,isActive:p}}function I({creds:i,onSwitch:d,onCancel:l}){let u=i.listProfiles(),p=i.getActiveProfile(),g=i.getDefaultEnv(),n=u.map(e=>{let t=i.loadBasicAuth(e.profile,e.env),o=i.loadCredentials(e.profile,e.env)!==null,v=t?"basic":o?"oauth":"none",b=t?t.username:null,w=e.profile===p&&e.env===g;return B(e.profile,e.env,v,b,w)}),[s,m]=(0,L.useState)(()=>{let e=n.findIndex(t=>t.isActive);return e>=0?e:0});return P((e,t)=>{if(t.escape){l();return}if(t.upArrow){m(o=>Math.max(0,o-1));return}if(t.downArrow){m(o=>Math.min(n.length-1,o+1));return}if(t.return&&n[s]){let o=n[s];o.isActive||d(o.profile,o.env),l();return}}),n.length===0?(0,r.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:a.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(f,{color:a.primary,bold:!0,children:"Profiles"}),(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(f,{color:a.dim,children:"No profiles \u2014 use Login to create one"})}),(0,r.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,r.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:a.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(f,{color:a.primary,bold:!0,children:"Profiles"}),(0,r.jsx)(c,{flexDirection:"column",marginTop:1,children:n.map((e,t)=>{let o=t===s,v=o?"\u276F ":" ",b=e.isActive?a.statusPass:o?a.primary:void 0;return(0,r.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,r.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{B as a,I as b};
2
+ import{a as h}from"./chunk-YVLFHMUW.js";import{a as A}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-TL4SB7MQ.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as y}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(y(),1);var r=x(A(),1);function B(i,d,l,u,p){let g=l==="basic"&&u?`basic (${u})`:l,n=20,s=`${i} [${d}]`,m="\xB7".repeat(Math.max(2,n-s.length+3));return{label:`${s} ${m} ${g}`,profile:i,env:d,isActive:p}}function I({creds:i,onSwitch:d,onCancel:l}){let u=i.listProfiles(),p=i.getActiveProfile(),g=i.getDefaultEnv(),n=u.map(e=>{let t=i.loadBasicAuth(e.profile,e.env),o=i.loadCredentials(e.profile,e.env)!==null,v=t?"basic":o?"oauth":"none",b=t?t.username:null,w=e.profile===p&&e.env===g;return B(e.profile,e.env,v,b,w)}),[s,m]=(0,L.useState)(()=>{let e=n.findIndex(t=>t.isActive);return e>=0?e:0});return P((e,t)=>{if(t.escape){l();return}if(t.upArrow){m(o=>Math.max(0,o-1));return}if(t.downArrow){m(o=>Math.min(n.length-1,o+1));return}if(t.return&&n[s]){let o=n[s];o.isActive||d(o.profile,o.env),l();return}}),n.length===0?(0,r.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:a.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(f,{color:a.primary,bold:!0,children:"Profiles"}),(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(f,{color:a.dim,children:"No profiles \u2014 use Login to create one"})}),(0,r.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,r.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:a.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(f,{color:a.primary,bold:!0,children:"Profiles"}),(0,r.jsx)(c,{flexDirection:"column",marginTop:1,children:n.map((e,t)=>{let o=t===s,v=o?"\u276F ":" ",b=e.isActive?a.statusPass:o?a.primary:void 0;return(0,r.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,r.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{B as a,I as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as a,h as c}from"./chunk-2FCAWRCU.js";import{readFileSync as g,writeFileSync as n,mkdirSync as i,existsSync as p}from"fs";import{dirname as s}from"path";var o={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:c,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",code_export:{enabled:!0,language:"python",skip_validation:!0},last_seen_version:""},l=class{constructor(r=a){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...o,...e,code_export:{...o.code_export,...e.code_export??{}}}}catch{return{...o,code_export:{...o.code_export}}}}set(r,e){try{let t=this.load();t[r]=e,i(s(this.path),{recursive:!0}),n(this.path,JSON.stringify(t,null,2)+`
2
+ import{d as a,h as c}from"./chunk-TL4SB7MQ.js";import{readFileSync as g,writeFileSync as n,mkdirSync as i,existsSync as p}from"fs";import{dirname as s}from"path";var o={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:c,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",code_export:{enabled:!0,language:"python",skip_validation:!0},last_seen_version:""},l=class{constructor(r=a){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...o,...e,code_export:{...o.code_export,...e.code_export??{}}}}catch{return{...o,code_export:{...o.code_export}}}}set(r,e){try{let t=this.load();t[r]=e,i(s(this.path),{recursive:!0}),n(this.path,JSON.stringify(t,null,2)+`
3
3
  `)}catch(t){let d=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${d}
4
4
  `)}}save(r){try{let t={...this.load(),...r};i(s(this.path),{recursive:!0}),n(this.path,JSON.stringify(t,null,2)+`
5
5
  `)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-XK33C64U.js";import{a as p}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-2FCAWRCU.js";import{a,b as o,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 T({onSubmit:l}){let[r,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(r===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)(o,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(o,{color:r===0?t.primary:t.dim,children:r===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(o,{color:r===1?t.primary:t.dim,children:r===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{T as a};
2
+ import{a as m}from"./chunk-YVLFHMUW.js";import{a as p}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-TL4SB7MQ.js";import{a,b as o,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 T({onSubmit:l}){let[r,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(r===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)(o,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(o,{color:r===0?t.primary:t.dim,children:r===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(o,{color:r===1?t.primary:t.dim,children:r===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{T as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as f}from"./chunk-WCRLZETG.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-2FCAWRCU.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(B(),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,a){return s.map(l=>l.name===o?{...l,status:d,detail:a}:l)}function R(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),a=Math.round(o%60);return`${d}m ${a}s`}function D(s){let[o,d]=(0,p.useState)(0),a=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;a.current=Date.now();let l=setInterval(()=>{d(Date.now()-a.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:a}){let l=D(o==="uploading");return o==="uploading"?(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",R(l)]})]}),(0,e.jsx)(r,{flexDirection:"column",marginTop:1,children:s.filter(i=>i.status!=="skipped").map((i,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",m=i.status==="done",u=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:u?(0,e.jsx)(f,{}):m?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:m?t.dim:u?t.base:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",i.detail]})]},i.name)})}),(0,e.jsx)(r,{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)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),a&&(0,e.jsxs)(r,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}export{v as a,U as b,h as c};
2
+ import{b as f}from"./chunk-XM4H4TJD.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-TL4SB7MQ.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(B(),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,a){return s.map(l=>l.name===o?{...l,status:d,detail:a}:l)}function R(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),a=Math.round(o%60);return`${d}m ${a}s`}function D(s){let[o,d]=(0,p.useState)(0),a=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;a.current=Date.now();let l=setInterval(()=>{d(Date.now()-a.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:a}){let l=D(o==="uploading");return o==="uploading"?(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",R(l)]})]}),(0,e.jsx)(r,{flexDirection:"column",marginTop:1,children:s.filter(i=>i.status!=="skipped").map((i,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",m=i.status==="done",u=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:u?(0,e.jsx)(f,{}):m?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:m?t.dim:u?t.base:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",i.detail]})]},i.name)})}),(0,e.jsx)(r,{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)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),a&&(0,e.jsxs)(r,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}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{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-2FCAWRCU.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
2
+ import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-TL4SB7MQ.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-XK33C64U.js";import{a as A}from"./chunk-HCBYKLMW.js";import{k as p,t as i}from"./chunk-2FCAWRCU.js";import{a as u,b as a,i as S}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var g=h(D(),1);import{readdirSync as N,mkdirSync as L,statSync as k}from"fs";import{join as P}from"path";var r=h(A(),1);function O(n){try{return N(n).filter(s=>{try{return k(P(n,s)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,s,m,v){return{name:n,path:s,label:n,isActive:v}}function H({currentPath:n,onSelect:s,onCancel:m}){let l=O(p).map(o=>{let e=P(p,o);return E(o,e,n,e===n)}),d=!n,B=l.length+2,[c,C]=(0,g.useState)(()=>{if(d)return 0;let o=l.findIndex(e=>e.isActive);return o>=0?o+1:0}),[y,T]=(0,g.useState)(!1),[I,x]=(0,g.useState)("");return S((o,e)=>{if(y){if(e.escape){T(!1),x("");return}if(e.return){let t=I.trim();if(t){let f=P(p,t);L(f,{recursive:!0}),s(f),m()}return}if(e.backspace||e.delete){x(t=>t.slice(0,-1));return}o&&!e.ctrl&&!e.meta&&x(t=>t+o);return}if(e.escape){m();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(B-1,t+1));return}if(e.return){if(c===0){d||s(""),m();return}if(c===l.length+1){L(p,{recursive:!0}),T(!0),x("");return}let t=l[c-1];t&&!t.isActive&&s(t.path),m();return}}),y?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(a,{color:i.primary,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(a,{color:i.secondary,children:"Name: "}),(0,r.jsx)(a,{children:I}),(0,r.jsx)(a,{color:i.dimmed,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(a,{color:i.primary,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(a,{color:d?i.statusPass:c===0?i.primary:i.dim,children:[c===0?"\u276F ":" ","Use temporary (no profile)",d?" \u25CF active":""]}),l.map((o,e)=>{let f=e+1===c,R=f?"\u276F ":" ",w=o.isActive?i.statusPass:f?i.primary:void 0;return(0,r.jsxs)(a,{color:w,children:[R,o.label,o.isActive?" \u25CF active":""]},o.name)}),(0,r.jsxs)(a,{color:c===l.length+1?i.primary:i.dim,children:[c===l.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
2
+ import{a as b}from"./chunk-YVLFHMUW.js";import{a as A}from"./chunk-HCBYKLMW.js";import{k as p,t as i}from"./chunk-TL4SB7MQ.js";import{a as u,b as a,i as S}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var g=h(D(),1);import{readdirSync as N,mkdirSync as L,statSync as k}from"fs";import{join as P}from"path";var r=h(A(),1);function O(n){try{return N(n).filter(s=>{try{return k(P(n,s)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,s,m,v){return{name:n,path:s,label:n,isActive:v}}function H({currentPath:n,onSelect:s,onCancel:m}){let l=O(p).map(o=>{let e=P(p,o);return E(o,e,n,e===n)}),d=!n,B=l.length+2,[c,C]=(0,g.useState)(()=>{if(d)return 0;let o=l.findIndex(e=>e.isActive);return o>=0?o+1:0}),[y,T]=(0,g.useState)(!1),[I,x]=(0,g.useState)("");return S((o,e)=>{if(y){if(e.escape){T(!1),x("");return}if(e.return){let t=I.trim();if(t){let f=P(p,t);L(f,{recursive:!0}),s(f),m()}return}if(e.backspace||e.delete){x(t=>t.slice(0,-1));return}o&&!e.ctrl&&!e.meta&&x(t=>t+o);return}if(e.escape){m();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(B-1,t+1));return}if(e.return){if(c===0){d||s(""),m();return}if(c===l.length+1){L(p,{recursive:!0}),T(!0),x("");return}let t=l[c-1];t&&!t.isActive&&s(t.path),m();return}}),y?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(a,{color:i.primary,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(a,{color:i.secondary,children:"Name: "}),(0,r.jsx)(a,{children:I}),(0,r.jsx)(a,{color:i.dimmed,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.primary,paddingX:2,paddingY:1,children:[(0,r.jsx)(a,{color:i.primary,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(a,{color:d?i.statusPass:c===0?i.primary:i.dim,children:[c===0?"\u276F ":" ","Use temporary (no profile)",d?" \u25CF active":""]}),l.map((o,e)=>{let f=e+1===c,R=f?"\u276F ":" ",w=o.isActive?i.statusPass:f?i.primary:void 0;return(0,r.jsxs)(a,{color:w,children:[R,o.label,o.isActive?" \u25CF active":""]},o.name)}),(0,r.jsxs)(a,{color:c===l.length+1?i.primary:i.dim,children:[c===l.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var c="0.3.2",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
2
+ import{homedir as s}from"os";import{join as t}from"path";var c="0.3.3",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as se,b as Te}from"./chunk-WCRLZETG.js";import{b as ke}from"./chunk-EZJNX4VE.js";import{d as Be,e as ae}from"./chunk-G7VF5SDK.js";import{a as Re}from"./chunk-HXIGYD2T.js";import{a as N}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-2FCAWRCU.js";import{a as c,b as o,d as ye,k as ue}from"./chunk-C44QQJR4.js";import{a as le}from"./chunk-6YGTRKDT.js";import{e as j}from"./chunk-UR6MHSHU.js";var G=j(N(),1),Le=64;function Pe(t){return t.split(`
2
+ import{a as se,b as Te}from"./chunk-XM4H4TJD.js";import{b as ke}from"./chunk-L3MOXBKE.js";import{d as Be,e as ae}from"./chunk-G7VF5SDK.js";import{a as Re}from"./chunk-SR5UDUMJ.js";import{a as N}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-TL4SB7MQ.js";import{a as c,b as o,d as ye,k as ue}from"./chunk-C44QQJR4.js";import{a as le}from"./chunk-6YGTRKDT.js";import{e as j}from"./chunk-UR6MHSHU.js";var G=j(N(),1),Le=64;function Pe(t){return t.split(`
3
3
  `).map(i=>i.replace(/^[-–•]\s*/,"").trim()).filter(i=>i.length>0)}function Ge({status:t,summary:i,duration:l,steps:u,stepsPassed:S,stepsFailed:f,reason:x,creditsConsumed:d}){let D=t==="passed",E=D?s.green:s.red,P=D?"\u2713":"\u2717",F=t.toUpperCase(),H=S??(D?u:Math.max(0,u-1)),I=f??(D?0:1),M=I>0?`${u} steps (${H} passed, ${I} failed)`:`${u} steps`,Q=l<60?`${l.toFixed(1)}s`:`${Math.floor(l/60)}m ${Math.round(l%60)}s`,V=Pe(i);return(0,G.jsx)(c,{flexDirection:"column",marginTop:1,children:(0,G.jsxs)(c,{borderStyle:"round",borderColor:E,flexDirection:"column",paddingX:2,paddingY:1,width:Le+6,children:[(0,G.jsxs)(c,{flexDirection:"column",children:[(0,G.jsxs)(o,{bold:!0,color:E,children:[P," ",F]}),(0,G.jsxs)(o,{color:s.dimmed,wrap:"wrap",children:[M," \xB7 ",Q,typeof d=="number"&&d>0?` \xB7 ${parseFloat(d.toFixed(4))} credits`:""]})]}),V.length>0&&(0,G.jsx)(c,{flexDirection:"column",marginTop:1,marginLeft:1,children:V.map((Z,W)=>(0,G.jsxs)(c,{marginBottom:W<V.length-1?1:0,children:[(0,G.jsx)(o,{color:s.primary,children:"\u25CF "}),(0,G.jsx)(c,{flexShrink:1,children:(0,G.jsx)(o,{wrap:"wrap",children:Z})})]},W))}),x&&!D&&(0,G.jsx)(c,{marginTop:1,children:(0,G.jsxs)(o,{color:s.red,wrap:"wrap",children:["Reason: ",x]})})]})})}var A=j(N(),1);function Ke({message:t,code:i,remediation:l,docsUrl:u}){return(0,A.jsx)(Re,{title:"Error",variant:"error",children:(0,A.jsxs)(c,{flexDirection:"column",paddingY:1,children:[(0,A.jsxs)(o,{color:s.red,bold:!0,children:[" \u2717 ",t]}),i&&(0,A.jsxs)(c,{marginTop:0,marginLeft:5,children:[(0,A.jsx)(o,{color:s.muted,children:"Code: "}),(0,A.jsx)(o,{color:s.dimmed,children:i})]}),l&&(0,A.jsxs)(c,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,A.jsx)(o,{color:s.green,bold:!0,children:"Fix:"}),(0,A.jsxs)(o,{color:s.cyan,children:["$ ",l]})]}),u&&(0,A.jsxs)(c,{marginTop:1,marginLeft:5,children:[(0,A.jsx)(o,{color:s.muted,children:"Docs: "}),(0,A.jsx)(o,{color:s.cyan,underline:!0,children:u})]})]})})}var $=j(le(),1);var we=j(le(),1);var de=j(N(),1),De="#ffc580",Fe="#ffd9a8",ve="#ffffff";function _e({text:t,active:i=!0}){let[l,u]=(0,we.useState)(0),S=4;if(se(()=>{u(x=>(x+1)%(t.length+S*2))},i?80:null),!i)return(0,de.jsx)(o,{color:ve,children:t});let f=t.split("").map((x,d)=>{let D=l-S,E=Math.abs(d-D-S/2),P;return E<=S/2?P=De:E<=S?P=Fe:P=ve,(0,de.jsx)(o,{color:P,children:x},d)});return(0,de.jsx)(o,{children:f})}var O=j(N(),1),Oe={starting:s.cyan,running:s.purple,passed:s.green,failed:s.red,cancelled:s.dimmed,timed_out:s.yellow};function fe({currentStep:t,maxSteps:i,elapsed:l,status:u}){let{stdout:S}=ue(),f=S?.columns??80,x=Oe[u]??s.purple,d=l<60?`${l.toFixed(1)}s`:`${Math.floor(l/60)}m ${Math.round(l%60)}s`;return(0,O.jsxs)(c,{flexDirection:"column",marginTop:1,children:[(0,O.jsx)(o,{color:s.muted,children:"\u2500".repeat(Math.min(f,60))}),(0,O.jsxs)(c,{children:[(0,O.jsx)(o,{children:" "}),(0,O.jsx)(o,{color:s.dimmed,children:"Steps "}),(0,O.jsx)(o,{bold:!0,children:t}),(0,O.jsxs)(o,{color:s.dimmed,children:["/",i]}),(0,O.jsx)(o,{children:" "}),(0,O.jsx)(o,{color:s.dimmed,children:"Elapsed "}),(0,O.jsx)(o,{bold:!0,children:d}),(0,O.jsx)(o,{children:" "}),(0,O.jsx)(o,{color:s.dimmed,children:"Status "}),(0,O.jsx)(o,{bold:!0,color:x,children:u})]})]})}var Me={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function $e(t){return Me[t]??"\u25CF"}var ne=j(N(),1);function xe({steps:t,flows:i,cmInitCounts:l,renderStep:u}){return(0,ne.jsxs)(c,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,ne.jsxs)(o,{color:s.dimmed,children:["\u2501\u2501 Bifurcated into ",i?.length??t.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),t.map((S,f)=>(0,ne.jsxs)(c,{flexDirection:"column",marginTop:f>0?1:0,children:[(0,ne.jsxs)(o,{color:s.purple,children:["Flow ",f+1,": ",i?.[f]??S.objective]}),l&&l[f]!=null&&(0,ne.jsxs)(o,{color:s.dimmed,children:[" \u25AA Generated task with ",l[f]," checkpoints"]}),S.children&&S.children.length>0?S.children.map(x=>u(x,`f${f}-${x.index}`)):S.status==="pending"&&(0,ne.jsx)(o,{color:s.dimmed,children:" \u25CB Waiting..."})]},f))]})}var r=j(N(),1);function U({step:t,indent:i=2}){let l=t.actionType?$e(t.actionType):null,u=t.status==="running",S=t.status==="passed",f=t.status==="failed",x=t.status==="pending"||t.status==="stopped",{stdout:d}=ue(),D=d?.columns??80,E=Math.max(20,D-i-21),P=t.objective??"",F=P.length>E?P.slice(0,E-1)+"\u2026":P,H=(t.duration??0)*1e3,I=t.duration!=null?H<1e3?`${Math.round(H)}ms`:`${(H/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsxs)(c,{marginLeft:i,children:[(0,r.jsx)(c,{width:4,children:(0,r.jsxs)(o,{color:s.muted,children:[String(t.index).padStart(2," ")," "]})}),(0,r.jsx)(c,{width:3,children:u?(0,r.jsx)(Te,{}):S?(0,r.jsx)(o,{color:s.green,bold:!0,children:"\u2713"}):f?(0,r.jsx)(o,{color:s.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:s.muted,children:"\u25CB"})}),(0,r.jsx)(c,{flexGrow:1,children:u?(0,r.jsx)(_e,{text:F,active:!0}):f?(0,r.jsx)(o,{color:s.red,children:F}):x?(0,r.jsx)(o,{color:s.dimmed,children:F}):(0,r.jsx)(o,{color:s.greenDim,children:F})}),(S||f)&&l?(0,r.jsx)(c,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:s.muted,children:l})}):(0,r.jsx)(c,{width:3,marginLeft:1}),(0,r.jsx)(c,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:s.dimmed,children:I})})]}),t.children&&t.children.length>0&&(0,r.jsx)(c,{flexDirection:"column",children:t.children.map((M,Q)=>(0,r.jsx)(U,{step:M,indent:i+2},`child-${Q}`))})]})}function ft({steps:t,bifurcated:i,flows:l,cmInitCounts:u,maxSteps:S=50,staticSteps:f=!1,onStepCommit:x}){let d=(0,$.useRef)(new Set),D=(0,$.useRef)(!1),E=(0,$.useRef)(new Set),P=(0,$.useRef)(!1),F=(0,$.useRef)(new Set),H=(0,$.useRef)(0);(0,$.useEffect)(()=>{t.length===0&&H.current>0&&(d.current.clear(),D.current=!1,E.current.clear(),P.current=!1,F.current.clear()),H.current=t.length},[t.length]);let I=t.flatMap(n=>[n,...n.children??[]]),M=I.some(n=>n.status==="running"),Q=I.some(n=>n.status==="failed"),V=I.length===0||I.every(n=>n.status==="pending"),Z=I.filter(n=>n.status==="passed"||n.status==="failed").length,W;V?W="starting":M?W="running":Q?W="failed":W="passed";let ee=(0,$.useRef)(null),[ie,ce]=(0,$.useState)(0);(0,$.useEffect)(()=>{I.length===0||V?(ee.current=null,ce(0)):M&&ee.current==null&&(ee.current=Date.now())},[M,V,I.length]),(0,$.useEffect)(()=>{if(!M)return;let n=setInterval(()=>{ee.current!=null&&ce((Date.now()-ee.current)/1e3)},500);return()=>clearInterval(n)},[M]);let v=(0,$.useRef)(new Set),[C,K]=(0,$.useState)([]),re=(0,$.useRef)(!1);(0,$.useEffect)(()=>{if(!f||i)return;let n=[];if(!i&&!re.current&&u&&u[0]!=null&&(re.current=!0,u[0]>0&&n.push({key:"cm_init_0",type:"cm_init",count:u[0]})),i){!v.current.has(-1)&&t.length>0&&(v.current.add(-1),n.push({key:"bif_header",type:"bifurcation_header",flowCount:l?.length??t.length}));for(let p=0;p<t.length;p++){let a=t[p],y=-(p+10);v.current.has(y)||(v.current.add(y),n.push({key:`flow_header_${p}`,type:"flow_header",flowIdx:p,label:l?.[p]??a.objective,cmCount:u?.[p]}));for(let B of a.children??[])(B.status==="passed"||B.status==="failed")&&!v.current.has(B.index)&&(v.current.add(B.index),n.push({key:`step_f${p}_${B.index}`,type:"step",step:{...B}}))}}else for(let p of t)(p.status==="passed"||p.status==="failed")&&!v.current.has(p.index)&&(v.current.add(p.index),n.push({key:`step_${p.index}`,type:"step",step:{...p,children:p.children?[...p.children]:void 0}}));n.length>0&&K(p=>[...p,...n])},[t,i,l,u,f]),(0,$.useEffect)(()=>{if(x)if(!i&&!P.current&&u&&u[0]!=null&&(P.current=!0,u[0]>0&&x((0,r.jsx)(c,{marginLeft:2,children:(0,r.jsxs)(o,{color:s.dimmed,children:["\u25A0 Generated task with ",u[0]," checkpoints"]})}))),i&&l&&!D.current&&(D.current=!0,x((0,r.jsx)(o,{color:"#b388ff",children:"\u2501\u2501 Bifurcated into "+l.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),i){let n=t.flatMap((p,a)=>{let y=p.children??[];return!E.current.has(a)&&y.length>0&&(E.current.add(a),x((0,r.jsx)(o,{color:"#b388ff",children:" Flow "+(a+1)+": "+(l?.[a]??"")})),u?.[a]!=null&&u[a]>0&&!F.current.has(a)&&(F.current.add(a),x((0,r.jsx)(c,{marginLeft:2,children:(0,r.jsxs)(o,{color:s.dimmed,children:[" \u25AA Generated task with ",u[a]," checkpoints"]})})))),u?.[a]!=null&&u[a]>0&&E.current.has(a)&&!F.current.has(a)&&(F.current.add(a),x((0,r.jsx)(c,{marginLeft:2,children:(0,r.jsxs)(o,{color:s.dimmed,children:[" \u25AA Generated task with ",u[a]," checkpoints"]})}))),y});for(let p of n){let a=`${p.index}-${p.objective}`;d.current.has(a)||(p.status==="passed"||p.status==="failed"||p.status==="stopped")&&(d.current.add(a),x((0,r.jsx)(c,{marginLeft:2,children:(0,r.jsx)(U,{step:p})})))}}else for(let n of t){let p=`${n.index}-${n.objective}`,a=!!n.branchObjective;a&&!d.current.has(p)&&(d.current.add(p),x((0,r.jsx)(c,{marginLeft:2,children:(0,r.jsx)(U,{step:{...n,children:void 0}})})));for(let y of n.children??[]){let B=`child-${n.index}-${y.index}-${y.objective}`;d.current.has(B)||(y.status==="passed"||y.status==="failed"||y.status==="stopped")&&(d.current.add(B),x((0,r.jsx)(c,{marginLeft:4,children:(0,r.jsx)(U,{step:y})})))}!a&&!d.current.has(p)&&(n.status==="passed"||n.status==="failed"||n.status==="stopped")&&(d.current.add(p),x((0,r.jsx)(c,{marginLeft:2,children:(0,r.jsx)(U,{step:{...n,children:void 0}})})))}},[t,x,i,l,u]);let Y=[];if(x)if(i)for(let n of t){let a=(n.children??[]).filter(y=>{let B=`${y.index}-${y.objective}`;return!d.current.has(B)});a.length>0&&Y.push({...n,children:a})}else for(let n of t){let p=`${n.index}-${n.objective}`,a=d.current.has(p),y=(n.children??[]).filter(B=>{let L=`child-${n.index}-${B.index}-${B.objective}`;return!d.current.has(L)});a?y.length>0&&Y.push({...n,children:y}):Y.push({...n,children:y})}else if(f){if(!i)for(let n of t)v.current.has(n.index)||Y.push(n)}if(!f){let n=x?Y:t;return(0,r.jsxs)(c,{flexDirection:"column",children:[i?x?n.length>0?(0,r.jsx)(c,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:n.map((a,y)=>(0,r.jsx)(c,{flexDirection:"column",marginTop:y>0?1:0,children:a.children&&a.children.length>0?a.children.map(B=>(0,r.jsx)(U,{step:B},`f${y}-${B.index}`)):a.status==="pending"&&(0,r.jsx)(o,{color:s.dimmed,children:" \u25CB Waiting..."})},y))}):null:(0,r.jsx)(xe,{steps:t,flows:l,cmInitCounts:u,renderStep:(a,y)=>(0,r.jsx)(U,{step:a},y)}):(0,r.jsxs)(c,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!x&&u&&u[0]!=null&&(0,r.jsxs)(o,{color:s.dimmed,children:["\u25AA Generated task with ",u[0]," checkpoints"]}),n.map(a=>{let y=`${a.index}-${a.objective}`;return x&&d.current.has(y)?(0,r.jsx)(c,{flexDirection:"column",children:(a.children??[]).map(B=>(0,r.jsx)(c,{marginLeft:2,children:(0,r.jsx)(U,{step:B})},B.index))},`branch-children-${a.index}`):(0,r.jsx)(U,{step:a},a.index)})]}),M&&(0,r.jsx)(fe,{currentStep:Z,maxSteps:S,elapsed:ie,status:W})]})}return i?(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(xe,{steps:t,flows:l,cmInitCounts:u,renderStep:(n,p)=>(0,r.jsx)(U,{step:n},p)}),M&&(0,r.jsx)(fe,{currentStep:Z,maxSteps:S,elapsed:ie,status:W})]}):(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(ye,{items:C,children:n=>n.type==="cm_init"?(0,r.jsx)(c,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:s.dimmed,children:["\u25AA Generated task with ",n.count," checkpoints"]})},n.key):n.type==="bifurcation_header"?(0,r.jsx)(c,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:s.dimmed,children:["\u2501\u2501 Bifurcated into ",n.flowCount," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]})},n.key):n.type==="flow_header"?(0,r.jsxs)(c,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,r.jsxs)(o,{color:s.purple,children:["Flow ",n.flowIdx+1,": ",n.label]}),n.cmCount!=null&&(0,r.jsxs)(o,{color:s.dimmed,children:[" \u25AA Generated task with ",n.cmCount," checkpoints"]})]},n.key):(0,r.jsx)(c,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(U,{step:n.step})},n.key)}),Y.length>0&&(0,r.jsx)(c,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Y.map(n=>(0,r.jsx)(U,{step:n},n.index))}),M&&(0,r.jsx)(fe,{currentStep:Z,maxSteps:S,elapsed:ie,status:W})]})}var ge=j(le(),1);var pe=j(N(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function bt({label:t,hasBifurcation:i=!1}){let[l,u]=(0,ge.useState)(0),[S,f]=(0,ge.useState)(0);se(()=>{u(d=>(d+1)%Ee.length)},80),se(()=>{f(d=>(d+1)%4)},400);let x=t??(i?"Planning approach":"Analyzing objective");return(0,pe.jsxs)(c,{marginLeft:1,children:[(0,pe.jsxs)(o,{color:s.primary,children:[Ee[l]," "]}),(0,pe.jsxs)(o,{color:s.dim,children:[x,".".repeat(S+1)]})]})}function yt(t){if(!t.isRunning||t.replayInfo)return null;let i=t.bifurcationInfo;if(i&&!i.isSingleFlow){let l=t.steps.findIndex(S=>S.status==="running");return(l===-1?t.cmInitCounts.length===0:l>=t.cmInitCounts.length)?{label:l>0?`Planning flow ${l+1}`:void 0,hasBifurcation:!0}:null}return t.cmInitCounts.length>0||t.steps.some(l=>l.children?.length)?null:{hasBifurcation:!!i}}var _=j(le(),1);function be(t){let i=t.indexOf(": ");return i>0&&i<15?t.slice(i+2):t}function Se(t){return t.map(i=>{let l=i.children?Se(i.children):i.children;return i.status==="running"?{...i,status:"stopped",phase:void 0,children:l}:l!==i.children?{...i,children:l}:i})}function kt(t,i,l,u){let[S,f]=(0,_.useState)(!1),[x,d]=(0,_.useState)([]),[D,E]=(0,_.useState)(null),[P,F]=(0,_.useState)(null),[H,I]=(0,_.useState)(null),[M,Q]=(0,_.useState)(null),[V,Z]=(0,_.useState)([]),[W,ee]=(0,_.useState)(null),[ie,ce]=(0,_.useState)(void 0),v=(0,_.useRef)(null),C=(0,_.useRef)(null),K=(0,_.useRef)(0),re=(0,_.useRef)(!1),Y=(0,_.useCallback)(async(a,y)=>{let B=v.current;if(B){try{await B.exited}catch{}v.current=null}d([]),E(null),F(null),I(null),Q(null),Z([]),ee(null),ce(a.max_steps),f(!0),C.current=null,K.current=0;let L;try{L=ke(a,y)}catch(te){I(te instanceof Error?te.message:String(te)),f(!1);return}v.current=L,Be("runner",()=>L.cancel()),(async()=>{re.current=!1;let te=!1;for await(let e of L.events){if(re.current)break;switch(e.type){case"run_start":if(C.current&&!C.current.isSingleFlow){let R=K.current;K.current++,d(T=>T.map((h,b)=>b===R?{...h,status:"running"}:h.status==="running"&&!h.children?.some(m=>m.status==="running")?{...h,status:h.children?.some(m=>m.status==="failed")?"failed":"passed"}:h))}break;case"bifurcation":{let R=e.flows??[],T=e.count??R.length,h={flows:R,isSingleFlow:e.is_single_flow??T<=1};Q(h),C.current=h,K.current=0,d(R.map((b,m)=>({index:m+1,objective:b??`Flow ${m+1}`,status:"pending"})));break}case"step_start":{i?.("STEP_START",`Step ${e.index} started`,{index:e.index,objective:e.objective,child_id:e.child_id});let R=e.index,T=e.objective??`Step ${R}`,h=e.child_id,b=C.current&&!C.current.isSingleFlow;if(h)d(m=>{let g=m.findIndex(z=>z.status==="running"||z.children?.some(je=>je.status==="running"));if(g===-1)return m;let k=[...m],w={...k[g]},J=[...w.children??[]].map(z=>z.status==="running"?{...z,status:"stopped",phase:void 0}:z);return J.push({index:R,objective:T,status:"running"}),w.children=J,k[g]=w,k});else if(b){let m=Math.max(0,K.current-1);d(g=>{let k=[...g];if(m>=k.length)return g;let w={...k[m]},J=[...w.children??[]].map(z=>z.status==="running"?{...z,status:"stopped",phase:void 0}:z);return J.push({index:R,objective:T,status:"running"}),w.children=J,w.status="running",k[m]=w,k})}else d(m=>{let g=Se(m);return g.some(w=>w.index===R)?g.map(w=>w.index===R?{...w,status:"running",objective:T}:w):[...g,{index:R,objective:T,status:"running"}]});break}case"step_event":{i?.("STEP_EVENT",`Step ${e.index} ${e.event}`,{index:e.index,phase:e.event,action_type:e.action_type,detail:e.detail,child_id:e.child_id});let R=e.child_id,T=C.current&&!C.current.isSingleFlow;if(e.event==="cm_init"&&e.checkpoint_count!=null){Z(h=>[...h,e.checkpoint_count]);break}if(e.event==="replay_started"){ee({recordingLength:e.recording_length??0});break}if(e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&l?.(e.detail),R)d(h=>h.map(b=>{if(!b.children)return b;let m=b.children.map(g=>{if(g.index!==e.index)return g;let k={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(k.objective=e.detail),e.action_type&&(k.actionType=e.action_type),{...g,...k}});return{...b,children:m}}));else if(T){let h=Math.max(0,K.current-1);d(b=>{let m=[...b];if(h>=m.length)return b;let g={...m[h]},k=[...g.children??[]];if(!k.some(X=>X.index===e.index))k.push({index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type});else for(let X=0;X<k.length;X++){if(k[X].index!==e.index)continue;let J={phase:e.event};e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(J.objective=e.detail),e.action_type&&(J.actionType=e.action_type),k[X]={...k[X],...J}}return g.children=k,m[h]=g,m})}else d(h=>h.some(m=>m.index===e.index)?h.map(m=>{if(m.index!==e.index)return m;let g={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(g.objective=e.detail),e.action_type&&(g.actionType=e.action_type),{...m,...g}}):[...Se(h),{index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type}]);break}case"step_end":{i?.("STEP_END",`Step ${e.index} ${e.status}`,{index:e.index,status:e.status,duration:e.duration,summary:e.summary,child_id:e.child_id}),u?.();let R=e.child_id,T=C.current&&!C.current.isSingleFlow;if(R)d(h=>h.map(b=>{if(!b.children)return b;let m=b.children.map(g=>g.index===e.index?{...g,status:e.status,duration:e.duration,phase:void 0,objective:g.objective.startsWith("Step ")?be(e.summary||g.objective):g.objective}:g);return{...b,children:m}}));else if(T){let h=Math.max(0,K.current-1);d(b=>{let m=[...b];if(h>=m.length)return b;let g={...m[h]},k=(g.children??[]).map(w=>w.index===e.index?{...w,status:e.status,duration:e.duration,phase:void 0,objective:w.objective.startsWith("Step ")?be(e.summary||w.objective):w.objective}:w);return g.children=k,m[h]=g,m})}else d(h=>h.map(b=>b.index===e.index?{...b,status:e.status,duration:e.duration,phase:void 0,objective:b.objective.startsWith("Step ")?be(e.summary||b.objective):b.objective}:b));{let b=C.current&&!C.current.isSingleFlow?Math.max(0,K.current-1):0;t?.(e.index,b,e.child_id)}break}case"child_agent_start":{let R=e.objective??"";d(T=>T.map(h=>h.status==="running"?{...h,objective:`${R} (branch)`,phase:`child: ${R.slice(0,50)}`,branchObjective:R}:h));break}case"child_agent_end":d(R=>R.map(T=>T.phase?.startsWith("child:")?{...T,phase:`child ${e.success?"done":"failed"}`}:T));break;case"ask_user":E(e.question??"");break;case"run_end":d(R=>R.map(T=>T.status==="running"?{...T,status:e.status,phase:void 0}:T)),f(!1),F(e),te=!0;break;case"error":f(!1),I(e.message??"Runner error"),d(R=>R.map(T=>T.status==="running"?{...T,status:"failed",phase:void 0}:T));break}}let{code:q,signal:me}=await L.exited,he=L.stderr,Ie=q===0&&!me,oe=[];q!==null&&q!==0&&oe.push(`Runner exited with code ${q}`),me&&oe.push(`Runner killed by signal ${me}`),he&&(!Ie||!te?oe.push(he):y?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:he})),v.current===L&&(oe.length>0&&I(oe.join(`
4
4
  `)),f(!1),ae("runner","Event stream ended"),v.current=null)})().catch(te=>{let q=[`Runner event loop error: ${te}`];L.exitCode!==null&&L.exitCode!==0&&q.push(`Exit code: ${L.exitCode}`),L.exitSignal&&q.push(`Signal: ${L.exitSignal}`),L.stderr&&q.push(L.stderr),v.current===L&&(I(q.join(`
5
5
  `)),f(!1),ae("runner","Event loop error"),v.current=null)})},[t,i,l,u]),n=(0,_.useCallback)(a=>{v.current?.sendUserResponse(a),E(null)},[]),p=(0,_.useCallback)(()=>{let a=v.current;a&&(a.sendCancel("user"),f(!1),E(null),setTimeout(()=>{v.current===a&&(ae("runner","User cancelled run"),v.current=null)},5e3))},[]);return(0,_.useEffect)(()=>()=>{re.current=!0,ae("runner","Component unmounted"),v.current=null},[]),{isRunning:S,steps:x,askingUser:D,lastRunEnd:P,runError:H,bifurcationInfo:M,cmInitCounts:V,replayInfo:W,maxSteps:ie,startRun:Y,sendAnswer:n,cancelRun:p}}function wt(t){let i=t.flatMap(f=>[f,...f.children??[]]),l=i.filter(f=>f.status==="passed").length,u=i.filter(f=>f.status==="failed").length,S=i.filter(f=>f.status==="passed"||f.status==="failed").length;return{passed:l,failed:u,total:S}}export{ft as a,bt as b,yt as c,kt as d,wt as e,Ge as f,Ke as g};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as D,b as A}from"./chunk-ZB72T6HB.js";import{l as S,m as C,n as P,o as U,p as N}from"./chunk-2FCAWRCU.js";import{createServer as Oe}from"http";import{randomBytes as He}from"crypto";import{URL as $e}from"url";import Z from"process";import{Buffer as ee}from"buffer";import re from"path";import{fileURLToPath as ke}from"url";import{promisify as Le}from"util";import te from"child_process";import Me,{constants as Ie}from"fs/promises";import Y from"process";import G,{constants as me}from"fs/promises";import j from"process";import le from"os";import L from"fs";import se from"fs";import z from"fs";var E;function ie(){try{return z.statSync("/.dockerenv"),!0}catch{return!1}}function ae(){try{return z.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function B(){return E===void 0&&(E=ie()||ae()),E}var k,ce=()=>{try{return se.statSync("/run/.containerenv"),!0}catch{return!1}};function u(){return k===void 0&&(k=ce()||B()),k}var K=()=>{if(j.platform!=="linux")return!1;if(le.release().toLowerCase().includes("microsoft"))return!u();try{if(L.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!u()}catch{}return L.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||L.existsSync("/run/WSL")?!u():!1},d=j.env.__IS_WSL_TEST__?K:K();var de=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",n=!1;try{await G.access(t,me.F_OK),n=!0}catch{}if(!n)return e;let o=await G.readFile(t,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),fe=async()=>`${await de()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,M=async()=>d?fe():`${Y.env.SYSTEMROOT||Y.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function f(e,r,t){let n=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let o=t();return n(o),o},set(o){n(o)}}),e}import{promisify as Pe}from"util";import O from"process";import{execFile as Ae}from"child_process";import{promisify as pe}from"util";import ue from"process";import{execFile as ge}from"child_process";var he=pe(ge);async function I(){if(ue.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await he("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";return t==="com.apple.safari"?"com.apple.Safari":t}import we from"process";import{promisify as xe}from"util";import{execFile as ye,execFileSync as cr}from"child_process";var ve=xe(ye);async function X(e,{humanReadableOutput:r=!0,signal:t}={}){if(we.platform!=="darwin")throw new Error("macOS only");let n=r?[]:["-ss"],o={};t&&(o.signal=t);let{stdout:i}=await ve("osascript",["-e",e,n],o);return i.trim()}async function T(e){return X(`tell application "Finder" to set app_path to application file id "${e}" as string
2
+ import{a as D,b as A}from"./chunk-IXWVTWOR.js";import{l as S,m as C,n as P,o as U,p as N}from"./chunk-TL4SB7MQ.js";import{createServer as Oe}from"http";import{randomBytes as He}from"crypto";import{URL as $e}from"url";import Z from"process";import{Buffer as ee}from"buffer";import re from"path";import{fileURLToPath as ke}from"url";import{promisify as Le}from"util";import te from"child_process";import Me,{constants as Ie}from"fs/promises";import Y from"process";import G,{constants as me}from"fs/promises";import j from"process";import le from"os";import L from"fs";import se from"fs";import z from"fs";var E;function ie(){try{return z.statSync("/.dockerenv"),!0}catch{return!1}}function ae(){try{return z.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function B(){return E===void 0&&(E=ie()||ae()),E}var k,ce=()=>{try{return se.statSync("/run/.containerenv"),!0}catch{return!1}};function u(){return k===void 0&&(k=ce()||B()),k}var K=()=>{if(j.platform!=="linux")return!1;if(le.release().toLowerCase().includes("microsoft"))return!u();try{if(L.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!u()}catch{}return L.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||L.existsSync("/run/WSL")?!u():!1},d=j.env.__IS_WSL_TEST__?K:K();var de=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",n=!1;try{await G.access(t,me.F_OK),n=!0}catch{}if(!n)return e;let o=await G.readFile(t,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),fe=async()=>`${await de()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,M=async()=>d?fe():`${Y.env.SYSTEMROOT||Y.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function f(e,r,t){let n=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let o=t();return n(o),o},set(o){n(o)}}),e}import{promisify as Pe}from"util";import O from"process";import{execFile as Ae}from"child_process";import{promisify as pe}from"util";import ue from"process";import{execFile as ge}from"child_process";var he=pe(ge);async function I(){if(ue.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await he("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";return t==="com.apple.safari"?"com.apple.Safari":t}import we from"process";import{promisify as xe}from"util";import{execFile as ye,execFileSync as cr}from"child_process";var ve=xe(ye);async function X(e,{humanReadableOutput:r=!0,signal:t}={}){if(we.platform!=="darwin")throw new Error("macOS only");let n=r?[]:["-ss"],o={};t&&(o.signal=t);let{stdout:i}=await ve("osascript",["-e",e,n],o);return i.trim()}async function T(e){return X(`tell application "Finder" to set app_path to application file id "${e}" as string
3
3
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as be}from"util";import{execFile as Se}from"child_process";var Ce=be(Se),y={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},ur=new Map(Object.entries(y)),F=class extends Error{};async function _(e=Ce){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new F(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:n}=t.groups,o=n.lastIndexOf("."),i=n.lastIndexOf("-"),c=o===-1?void 0:n.slice(0,o),a=i===-1?void 0:n.slice(0,i);return y[n]??y[c]??y[a]??{name:n,id:n}}var Ee=Pe(Ae),Be=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,r=>r.toUpperCase());async function H(){if(O.platform==="darwin"){let e=await I();return{name:await T(e),id:e}}if(O.platform==="linux"){let{stdout:e}=await Ee("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:Be(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(O.platform==="win32")return _();throw new Error("Only macOS, Linux, and Windows are supported")}var Te=Le(te.execFile),$=re.dirname(ke(import.meta.url)),q=re.join($,"xdg-open"),{platform:w,arch:V}=Z;async function Fe(){let e=await M(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,t=ee.from(r,"utf16le").toString("base64"),{stdout:n}=await Te(e,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",t],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}var J=async(e,r)=>{let t;for(let n of e)try{return await r(n)}catch(o){t=o}throw t},v=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return J(e.app,a=>v({...e,app:a}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return J(r,a=>v({...e,app:{name:a,arguments:t}}));if(r==="browser"||r==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},s=d?await Fe():await H();if(s.id in a){let m=a[s.id];return r==="browserPrivate"&&t.push(l[m]),v({...e,app:{name:g[m],arguments:t}})}throw new Error(`${s.name} is not supported as a default browser`)}let n,o=[],i={};if(w==="darwin")n="open",e.wait&&o.push("--wait-apps"),e.background&&o.push("--background"),e.newInstance&&o.push("--new"),r&&o.push("-a",r);else if(w==="win32"||d&&!u()&&!r){n=await M(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),d||(i.windowsVerbatimArguments=!0);let a=["Start"];e.wait&&a.push("-Wait"),r?(a.push(`"\`"${r}\`""`),e.target&&t.push(e.target)):e.target&&a.push(`"${e.target}"`),t.length>0&&(t=t.map(l=>`"\`"${l}\`""`),a.push("-ArgumentList",t.join(","))),e.target=ee.from(a.join(" "),"utf16le").toString("base64")}else{if(r)n=r;else{let a=!$||$==="/",l=!1;try{await Me.access(q,Ie.X_OK),l=!0}catch{}n=Z.versions.electron??(w==="android"||a||!l)?"xdg-open":q}t.length>0&&o.push(...t),e.wait||(i.stdio="ignore",i.detached=!0)}w==="darwin"&&t.length>0&&o.push("--args",...t),e.target&&o.push(e.target);let c=te.spawn(n,o,i);return e.wait?new Promise((a,l)=>{c.once("error",l),c.once("close",s=>{if(!e.allowNonzeroExitCode&&s>0){l(new Error(`Exited with code ${s}`));return}a(c)})}):(c.unref(),c)},_e=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return v({...r,target:e})};function Q(e){if(typeof e=="string"||Array.isArray(e))return e;let{[V]:r}=e;if(!r)throw new Error(`${V} is not supported`);return r}function b({[w]:e},{wsl:r}){if(r&&d)return Q(r);if(!e)throw new Error(`${w} is not supported`);return Q(e)}var g={};f(g,"chrome",()=>b({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));f(g,"brave",()=>b({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));f(g,"firefox",()=>b({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));f(g,"edge",()=>b({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));f(g,"browser",()=>"browser");f(g,"browserPrivate",()=>"browserPrivate");var oe=_e;var ne=class{profile;environment;creds;oauth;constructor(r="default",t="prod",n){this.profile=r,this.environment=t,this.creds=n??new D,this.oauth=new A(t)}async login(){let{server:r,port:t}=await this.startCallbackServer(),n=N(t);try{let o=this.creds.loadClient(this.profile,this.environment),i=o?.redirect_uris;(!o||!i?.includes(n))&&(o=await this.oauth.registerClient(n),this.creds.saveClient(this.profile,this.environment,o));let c=o.client_id,[a,l]=A.generatePkce(),s=He(32).toString("hex"),m=this.oauth.buildAuthorizationUrl(c,l,s,n),p=await this.waitForCallback(r,t,m,s);if(!p)throw new Error("Login cancelled or timed out");let h=await this.oauth.exchangeCode(p,c,a,n),x={access_token:h.access_token,refresh_token:h.refresh_token,expires_at:Math.floor(Date.now()/1e3)+h.expires_in,scope:h.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,x),this.creds.setActiveProfile(this.profile),x}catch(o){throw r.close(),o}}startCallbackServer(){return new Promise((r,t)=>{let n=C,o=()=>{let i=Oe();i.on("error",c=>{c.code==="EADDRINUSE"&&n<P?(n++,o()):t(new Error(`Failed to start callback server: ${c.message}. Ports ${C}-${P} are all in use.`))}),i.listen(n,S,()=>{r({server:i,port:n})})};o()})}waitForCallback(r,t,n,o){return new Promise(i=>{let c=!1,a=setTimeout(()=>l(null),12e4),l=s=>{c||(c=!0,clearTimeout(a),r.close(),i(s))};r.on("request",(s,m)=>{let p=new $e(s.url??"/",`http://${S}:${t}`);if(p.pathname!==U){m.writeHead(404),m.end();return}let h=p.searchParams.get("state"),x=p.searchParams.get("code");if(p.searchParams.get("error")){m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),l(null);return}if(h!==o){m.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),l(null);return}m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),l(x)}),oe(n).catch(s=>{let m=s instanceof Error?s.message:String(s);process.stderr.write(`[auth] Could not open browser: ${m}
4
4
  Please open this URL manually: ${n}
5
5
  `)})})}};function R(e){let r=e.state==="success",t=r?"#22c55e":"#ef4444",n=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",o=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=e.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-2FCAWRCU.js";import{b as u}from"./chunk-C44QQJR4.js";import{a as l}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var m=n(l(),1);var o=n(l(),1);function c(r,e){let t=(0,o.useRef)(r);t.current=r,(0,o.useEffect)(()=>{if(e===null)return;let i=setInterval(()=>t.current(),e);return()=>clearInterval(i)},[e])}var s=n(p(),1),f=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function I({active:r=!0}){let[e,t]=(0,m.useState)(0);return c(()=>{t(i=>(i+1)%f.length)},r?80:null),(0,s.jsx)(u,{color:a.purple,children:r?f[e]:"\u25CF"})}export{c as a,I as b};
2
+ import{a as p}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-TL4SB7MQ.js";import{b as u}from"./chunk-C44QQJR4.js";import{a as l}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var m=n(l(),1);var o=n(l(),1);function c(r,e){let t=(0,o.useRef)(r);t.current=r,(0,o.useEffect)(()=>{if(e===null)return;let i=setInterval(()=>t.current(),e);return()=>clearInterval(i)},[e])}var s=n(p(),1),f=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function I({active:r=!0}){let[e,t]=(0,m.useState)(0);return c(()=>{t(i=>(i+1)%f.length)},r?80:null),(0,s.jsx)(u,{color:a.purple,children:r?f[e]:"\u25CF"})}export{c as a,I as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-7ECMUWV2.js";import{a as B}from"./chunk-PAQGYV5G.js";import{a as R}from"./chunk-XK33C64U.js";import{a as P}from"./chunk-HCBYKLMW.js";import{t as c}from"./chunk-2FCAWRCU.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as k}from"./chunk-YZTCCQHR.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,s,y,m){return{id:n,label:`${s} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:s,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let i=await T.listFolders(s);yield{page:1,folders:i,totalLoaded:i.length,done:!0}})();for await(let i of F){if(d(!1),i.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(i.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),i.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,s,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!s){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),i=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(s,r);x(i.id,i.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,s,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.primary,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
2
+ import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-JPEICMHK.js";import{a as B}from"./chunk-HNIH3GSQ.js";import{a as R}from"./chunk-YVLFHMUW.js";import{a as P}from"./chunk-HCBYKLMW.js";import{t as c}from"./chunk-TL4SB7MQ.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as k}from"./chunk-YZTCCQHR.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,s,y,m){return{id:n,label:`${s} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:s,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let i=await T.listFolders(s);yield{page:1,folders:i,totalLoaded:i.length,done:!0}})();for await(let i of F){if(d(!1),i.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(i.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),i.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,s,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!s){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),i=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(s,r);x(i.id,i.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,s,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.primary,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as s}from"./chunk-HCBYKLMW.js";import{t as n}from"./chunk-2FCAWRCU.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
2
+ import{a as s}from"./chunk-HCBYKLMW.js";import{t as n}from"./chunk-TL4SB7MQ.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as B}from"./chunk-S3DAAAE5.js";import{a as h}from"./chunk-MVX3N7GI.js";import{a as w}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-2FCAWRCU.js";import{a as x,b as t,c as g,i as P,j as S}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[m,a]=(0,o.useState)(""),[f,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>m.trim()||i,[m,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.cyan,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dimmed,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dimmed,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.cyan,children:m}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[f&&(0,e.jsx)(t,{color:s.red,children:f}),(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[f,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(f){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[f,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:m}=g((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{m()}catch{}})})}export{D as a,V as b,Y as c};
2
+ import{b as B}from"./chunk-S3DAAAE5.js";import{a as h}from"./chunk-IROWNPDG.js";import{a as w}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-TL4SB7MQ.js";import{a as x,b as t,c as g,i as P,j as S}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[m,a]=(0,o.useState)(""),[f,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>m.trim()||i,[m,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.cyan,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dimmed,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dimmed,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.cyan,children:m}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[f&&(0,e.jsx)(t,{color:s.red,children:f}),(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[f,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(f){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[f,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:m}=g((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{m()}catch{}})})}export{D as a,V as b,Y as c};