@testmuai/kane-cli 0.4.10 → 0.5.0

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 (114) hide show
  1. package/dist/{ChromeProfilePicker-EFEVOCWS.js → ChromeProfilePicker-PIWZY4WH.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-PPGJMKHQ.js → CliFeedbackPrompt-URXCHBZ5.js} +1 -1
  3. package/dist/{CliUploadProgress-3GGOTLPQ.js → CliUploadProgress-DMH3C3UZ.js} +1 -1
  4. package/dist/{ConfigView-Y7E4Q647.js → ConfigView-NWNDNTKW.js} +1 -1
  5. package/dist/EvidenceViewOffer-HEBQ7C4H.js +2 -0
  6. package/dist/FolderPicker-5S23OTSY.js +2 -0
  7. package/dist/HelpView-YYKTP4JH.js +2 -0
  8. package/dist/{InfoBox-BQ2QOIUP.js → InfoBox-FPAWQZGQ.js} +1 -1
  9. package/dist/{LinksBox-DX6BJAX5.js → LinksBox-O5ZFYSK2.js} +1 -1
  10. package/dist/{ProfilesView-X35WWM4L.js → ProfilesView-SPECXHZE.js} +1 -1
  11. package/dist/{ProjectPicker-Y4A4UVHA.js → ProjectPicker-ANJ6NGNY.js} +1 -1
  12. package/dist/{SaveSessionPrompt-IS6HZSF4.js → SaveSessionPrompt-W2GWELOP.js} +1 -1
  13. package/dist/SingleShotApp-5TYM356H.js +2 -0
  14. package/dist/{SummaryBox-47MHU37V.js → SummaryBox-DJUDYML7.js} +1 -1
  15. package/dist/TestMdRunView-BIVXQE54.js +2 -0
  16. package/dist/{WhoamiView-KVIQCGRC.js → WhoamiView-DH25ZD4C.js} +1 -1
  17. package/dist/{changelog-S4ZLEQLC.js → changelog-RCKUVBFL.js} +1 -1
  18. package/dist/{chunk-LPUQ4HWQ.js → chunk-2WVKOZ6W.js} +1 -1
  19. package/dist/chunk-2YQ6TW77.js +82 -0
  20. package/dist/chunk-3FN66LTP.js +3 -0
  21. package/dist/{chunk-JKLKZCJS.js → chunk-4IOOBSNB.js} +1 -1
  22. package/dist/chunk-54TKNWXF.js +5 -0
  23. package/dist/{chunk-HPZREZKG.js → chunk-5MTRNUAK.js} +1 -1
  24. package/dist/{chunk-OHT5RY5E.js → chunk-6E5UYAEB.js} +1 -1
  25. package/dist/{chunk-QC73LMAN.js → chunk-7AEC572G.js} +1 -1
  26. package/dist/{chunk-QSXYNJOW.js → chunk-7IBNOVML.js} +1 -1
  27. package/dist/chunk-7KDNH6JP.js +10 -0
  28. package/dist/{chunk-G2GQ67DP.js → chunk-7YRNLGUT.js} +1 -1
  29. package/dist/chunk-AFCEFOIK.js +4 -0
  30. package/dist/{chunk-YAOWO2GE.js → chunk-AM5WZPPY.js} +1 -1
  31. package/dist/{chunk-G3PWEKD7.js → chunk-C4LYBQT3.js} +2 -2
  32. package/dist/chunk-DJL47DYJ.js +8 -0
  33. package/dist/chunk-DTM4ZMMJ.js +102 -0
  34. package/dist/chunk-ELBPBHTE.js +26 -0
  35. package/dist/{chunk-IGZPQQFP.js → chunk-GEAWRRR7.js} +1 -1
  36. package/dist/{chunk-UBN6J3ZA.js → chunk-H6QJ4YU7.js} +1 -1
  37. package/dist/chunk-HFXQU7UZ.js +2 -0
  38. package/dist/{chunk-GF44B552.js → chunk-HZ46P2GR.js} +1 -1
  39. package/dist/chunk-I4B2KY4X.js +3 -0
  40. package/dist/{chunk-RB2YKN77.js → chunk-IECUFWIZ.js} +1 -1
  41. package/dist/{chunk-KJLOYIWT.js → chunk-IU53F4ZV.js} +1 -1
  42. package/dist/chunk-J75KVNX5.js +18 -0
  43. package/dist/{chunk-NUGGT2XH.js → chunk-LOQV5GME.js} +1 -1
  44. package/dist/chunk-MUPHP5W6.js +27 -0
  45. package/dist/chunk-NAYAVVTP.js +6 -0
  46. package/dist/chunk-NFOBDHZK.js +147 -0
  47. package/dist/{chunk-GSKA5DKJ.js → chunk-NLIOFVMP.js} +1 -1
  48. package/dist/chunk-P5XBCJYQ.js +7 -0
  49. package/dist/chunk-PISZLYS5.js +4 -0
  50. package/dist/{chunk-EQC7WE2O.js → chunk-PTP3WS3N.js} +1 -1
  51. package/dist/chunk-Q2I65L2W.js +6 -0
  52. package/dist/chunk-QCEWUUE6.js +55 -0
  53. package/dist/chunk-QO6PAA7Q.js +17 -0
  54. package/dist/{chunk-FKAXPYV7.js → chunk-R5RHRG65.js} +1 -1
  55. package/dist/chunk-T4PKTWZ6.js +17 -0
  56. package/dist/{chunk-RQZCGHG7.js → chunk-THEZSXZM.js} +1 -1
  57. package/dist/{chunk-HUAOH2JK.js → chunk-TJWU7DOO.js} +1 -1
  58. package/dist/{chunk-AKLIPQVR.js → chunk-TPG2T5GH.js} +1 -1
  59. package/dist/{chunk-KKIFXAJY.js → chunk-UOGJUJCF.js} +1 -1
  60. package/dist/{chunk-DMG5QABA.js → chunk-V2GYBVSM.js} +1 -1
  61. package/dist/{chunk-VLWWDXBN.js → chunk-XDERMCAU.js} +1 -1
  62. package/dist/chunk-Y44AETOW.js +2 -0
  63. package/dist/{chunk-53O3GMZR.js → chunk-YCNCW4O4.js} +1 -1
  64. package/dist/{chunk-IT66S24L.js → chunk-YSIYPC4R.js} +1 -1
  65. package/dist/{chunk-6ATKQYAL.js → chunk-ZWAZ4QU4.js} +1 -1
  66. package/dist/credentials-52QRPGET.js +2 -0
  67. package/dist/evidence-O4AON5FU.js +2 -0
  68. package/dist/exit-manager-IUHAXFJ6.js +2 -0
  69. package/dist/{generate-headless-ODYT3HT7.js → generate-headless-WG6ZPINI.js} +2 -2
  70. package/dist/index.js +75 -39
  71. package/dist/list-commands-VJAL4J3O.js +2 -0
  72. package/dist/login-flow-VZ2MITFA.js +2 -0
  73. package/dist/persist-recorded-session-XKPZX7HW.js +3 -0
  74. package/dist/pipeline-CADTHPDV.js +2 -0
  75. package/dist/{recording-banner-3XTXU2VL.js → recording-banner-2TNKQHP2.js} +1 -1
  76. package/dist/require-project-folder-SJG5FQY6.js +2 -0
  77. package/dist/run-test-md-INJKPE2I.js +13 -0
  78. package/dist/{skill-installer-GYYMVNE4.js → skill-installer-M6AREQQW.js} +1 -1
  79. package/dist/tcg-generate-VKFXR5JT.js +2 -0
  80. package/dist/testmd-actions-4QLHD74A.js +2 -0
  81. package/dist/{tms-client-NNYXLXZK.js → tms-client-VD3B3SMU.js} +1 -1
  82. package/dist/token-refresh-2HKIYD4Y.js +2 -0
  83. package/dist/{validate-basic-4YMRWYLS.js → validate-basic-FO7C2URG.js} +1 -1
  84. package/dist/{version-check-GU2LS6NM.js → version-check-PHZX5WS7.js} +1 -1
  85. package/package.json +8 -6
  86. package/dist/FolderPicker-LI5JKG2S.js +0 -2
  87. package/dist/HelpView-KHQYGSD2.js +0 -2
  88. package/dist/SingleShotApp-RO25ZX2E.js +0 -2
  89. package/dist/TestMdRunView-OXVWHOV3.js +0 -2
  90. package/dist/chunk-7GOX44H7.js +0 -103
  91. package/dist/chunk-AH4AXJML.js +0 -2
  92. package/dist/chunk-AT45XB6X.js +0 -60
  93. package/dist/chunk-BH6EP2LD.js +0 -85
  94. package/dist/chunk-BQACGLXW.js +0 -5
  95. package/dist/chunk-IS62CNJW.js +0 -20
  96. package/dist/chunk-LOIRZFV3.js +0 -10
  97. package/dist/chunk-LRKWPAGK.js +0 -2
  98. package/dist/chunk-MDBXYXSC.js +0 -2
  99. package/dist/chunk-NAAPNSZD.js +0 -17
  100. package/dist/chunk-PUU7A26K.js +0 -11
  101. package/dist/chunk-SQOIKS77.js +0 -6
  102. package/dist/chunk-UAYCLUUZ.js +0 -27
  103. package/dist/chunk-XCOU6AYD.js +0 -6
  104. package/dist/chunk-XCYCX4TU.js +0 -17
  105. package/dist/exit-manager-V2NW7A7U.js +0 -2
  106. package/dist/list-commands-PNYMVI6X.js +0 -2
  107. package/dist/login-flow-FIYH6K4A.js +0 -2
  108. package/dist/persist-recorded-session-OJPXI4HP.js +0 -3
  109. package/dist/pipeline-34CX3UBO.js +0 -2
  110. package/dist/require-project-folder-CFX6U6BZ.js +0 -2
  111. package/dist/run-test-md-YWKVMQDJ.js +0 -14
  112. package/dist/tcg-generate-KLY7QZY2.js +0 -2
  113. package/dist/testmd-actions-OUY5BOAV.js +0 -2
  114. package/dist/token-refresh-QCHKMPCM.js +0 -2
@@ -1,5 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as g}from"./chunk-KKIFXAJY.js";import{spawn as N,execSync as O}from"child_process";import{existsSync as v}from"fs";import{resolve as t,dirname as T}from"path";import{fileURLToPath as b}from"url";import{createInterface as A}from"readline";async function*E(s){let e=A({input:s,crlfDelay:1/0});for await(let c of e){let r=c.trim();if(r)try{let d=JSON.parse(r);d&&typeof d.type=="string"&&(yield d)}catch{}}}function S(s){return s==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_AGENT_SKIP_CP_FINAL:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_AGENT_SKIP_CP_FINAL","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function R(s){return s==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var a=T(b(import.meta.url));function C(){for(let s of["python3","python"])try{return O(`${s} --version`,{stdio:"ignore"}),s}catch{}return null}function h(){let e=process.platform==="win32"?"v16-runner.exe":"v16-runner",c={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,d=c[r];if(d)for(let n of d){let l=[t(a,"..","node_modules",n,"bin",e),t(a,"..","..","node_modules",n,"bin",e),t(a,"..","..","..","node_modules",n,"bin",e),t(a,"..","..","..","..","node_modules",n,"bin",e)];for(let o of l)if(v(o))return{cmd:o,args:[]}}let m=[t(a,"bin",e),t(a,"..","bin",e),t(a,"..","..","..","..","v16-runner","dist",e),t(a,"..","..","..","v16-runner","dist",e),t(process.cwd(),"v16-runner","dist",e),t(process.cwd(),"..","v16-runner","dist",e)];for(let n of m)if(v(n))return{cmd:n,args:[]};let p=[t(a,"..","..","v16-runner"),t(a,"..","..","..","..","v16-runner"),t(a,"..","..","..","v16-runner"),t(process.cwd(),"v16-runner"),t(process.cwd(),"..","v16-runner")];for(let n of p)if(v(t(n,"main.py"))){for(let o of[t(n,".venv","bin","python"),t(n,"..","browser-agent",".venv","bin","python")])if(v(o))return{cmd:o,args:["main.py"],cwd:n};let l=C();if(l)return{cmd:l,args:["main.py"],cwd:n}}return null}function W(s,e){let c=h();if(!c)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};e?.environment&&(r.TESTMUAI_ENV=e.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let d=g(e?.environment);r.V16_SERVER_API_HOST=d.v16ServerHost,r.ATMS_URL=d.tmsBaseUrl.replace(/\/api\/?$/,""),s.username&&s.access_key&&(r.LT_USERNAME=s.username,r.LT_ACCESS_KEY=s.access_key),s.session_id&&(r.TESTMUAI_SESSION_ID=s.session_id);let m=S(e?.mode??"testing");Object.assign(r,m.set);for(let i of m.unset)delete r[i];let p=R(e?.assertionMode??"visual");Object.assign(r,p.set);for(let i of p.unset)delete r[i];let n=N(c.cmd,c.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:c.cwd});n.stdin.on("error",()=>{}),n.stdin.write(JSON.stringify(s)+`
3
- `);let l=1e5,o="";n.stderr.on("data",i=>{o+=i.toString(),o.length>l&&(o=o.slice(-l))}),n.on("error",i=>{e?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:i.message})});let _=null,f=null,x=new Promise(i=>{n.on("close",(u,y)=>{_=u,f=y?String(y):null,e?.log?.("info","RUNNER_EXIT","Runner exited",{code:u,signal:f??"none"}),i({code:u,signal:f})})}),w=E(n.stdout);return{child:n,events:w,sendUserResponse(i){let u=JSON.stringify({type:"user_response",answer:i});try{n.stdin.write(u+`
4
- `)}catch{}},sendCancel(i){let u=JSON.stringify({type:"cancel",reason:i});try{n.stdin.write(u+`
5
- `)}catch{}},cancel(){n.kill("SIGTERM")},get stderr(){return o},get exitCode(){return _},get exitSignal(){return f},exited:x}}export{h as a,W as b};
@@ -1,20 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as L,b as et}from"./chunk-SQOIKS77.js";import{a as U,b as X}from"./chunk-AKLIPQVR.js";import{a as Z,b as tt}from"./chunk-MDBXYXSC.js";import{a as C,b as J,e as P,f as Q}from"./chunk-AH4AXJML.js";import{a as W}from"./chunk-53O3GMZR.js";import{a as z}from"./chunk-YAOWO2GE.js";import{a as N}from"./chunk-RB2YKN77.js";import{a as G}from"./chunk-KKIFXAJY.js";import{a as I}from"./chunk-RZ4F3BHX.js";import{x as h}from"./chunk-LRKWPAGK.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as k,b as g,i as K}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(B(),1);import{existsSync as D,readFileSync as jt,rmSync as dt,unlinkSync as Bt}from"fs";import{resolve as Y}from"path";import{promises as rt,realpathSync as _t}from"fs";import{homedir as xt}from"os";import{join as H,parse as wt,relative as nt,resolve as ot}from"path";var it=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),v=class extends Error{constructor(i){super(`refusing to scan '${i}'. Run from your project root, or pass --root <dir>.`);this.cwd=i;this.name="HomeRefusedError"}};function st(t){try{return _t(ot(t))}catch{return ot(t)}}function yt(t){let r=st(t),i=st(xt()),n=wt(r).root;if(process.platform==="win32"){let o=e=>e.toLowerCase();return o(r)===o(i)||o(r)===o(n)}return r===i||r===n}async function A(t){if(yt(t.root))throw new v(t.root);let r=t.maxEntries??5e4,i=t.maxResults??5e3,n=new Set(t.ignore??[]),o=[],e=0,s=0,c=!1,d,l=[t.root];for(;l.length>0&&!c;){let a=l.shift(),m;try{m=await rt.readdir(a,{withFileTypes:!0})}catch{continue}s++;for(let E of m){if(e++,e>r){c=!0,d="max_entries";break}let x=E.name,T=H(a,x);if(E.isDirectory()){if(it.has(x)||x.startsWith(".")||x.startsWith("output-")||n.has(x))continue;l.push(T)}else if(E.isFile()&&x.endsWith("_test.md")&&(o.push({path:T,relPath:nt(t.root,T),source:"cwd"}),o.length>=i)){c=!0,d="max_results";break}}t.onProgress?.(s,o.length)}if(!c){let m=[{dir:H(t.root,".testmuai","tests"),depth:0}];for(;m.length>0&&!c;){let{dir:E,depth:x}=m.shift(),T;try{T=await rt.readdir(E,{withFileTypes:!0})}catch{continue}s++;for(let f of T){if(e++,e>r){c=!0,d="max_entries";break}let w=f.name,y=H(E,w);if(f.isDirectory()){if(x>=20||w.startsWith(".")||w.startsWith("output-")||it.has(w))continue;m.push({dir:y,depth:x+1})}else if(f.isFile()&&w.endsWith("_test.md")&&(o.push({path:y,relPath:nt(t.root,y),source:"tests-dir"}),o.length>=i)){c=!0,d="max_results";break}}}}return{results:o,aborted:c,abortReason:d,dirsScanned:s}}import{mkdirSync as kt,writeFileSync as Et}from"fs";import{join as bt}from"path";function at(t,r){return`Basic ${Buffer.from(`${t}:${r}`).toString("base64")}`}async function Tt(t){let r=Z({tmsBaseUrl:t.tmsBaseUrl,testcaseId:t.testcaseId,codeExport:{enabled:!0,language:t.language,skipValidation:t.skipValidation}}),i=await I(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:at(t.auth.username,t.auth.access_key)},body:JSON.stringify(r.body)});if(!i.ok)throw new Error(`code-export trigger failed: ${i.status} ${await i.text()}`);t.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:t.testcaseId})}async function St(t){let r=tt({tmsBaseUrl:t.tmsBaseUrl,testcaseId:t.testcaseId}),i=t.pollIntervalMs??5e3,n=t.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let e=await I(r,{headers:{authorization:at(t.auth.username,t.auth.access_key),accept:"application/json"}});if(!e.ok){await new Promise(l=>setTimeout(l,i));continue}let c=(await e.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!c){await new Promise(l=>setTimeout(l,i));continue}let d=(c.status??"").toLowerCase();if(d==="in progress"||d==="in_progress"||d==="pending"){await new Promise(l=>setTimeout(l,i));continue}if(!c.url||c.url.length===0)throw new Error(`code-export status=${c.status} but no files returned`);kt(t.outDir,{recursive:!0});for(let l of c.url){let a=bt(t.outDir,l.file_name),m=await I(l.file_url);if(!m.ok){t.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:m.status});continue}let E=await m.text();Et(a,E,"utf-8")}return t.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:t.outDir,file_count:c.url.length}),t.outDir}throw new Error("code-export polling timed out")}async function ct(t){return await Tt(t),await St(t)}var b=R(B(),1);import{existsSync as Rt,readFileSync as vt}from"fs";var p=R($(),1);function Pt(t){L(t);let r=P(t);if(!Rt(r))return null;try{return JSON.parse(vt(r,"utf8"))}catch{return{}}}function Mt(t){return t===null?"never_run":t.testcase_id?"synced":"local_only"}function Dt(t){return t==="synced"?"\u2601":t==="local_only"?"\u25A3":"\u25CB"}function Ct(t){return t==="tests-dir"?"\u2726":" "}function Ot(t,r){return r==="all"?!0:r==="synced"?t.status==="synced":r==="local"?t.status==="local_only":r==="never_run"?t.status==="never_run":r==="cli"?t.source==="tests-dir":r==="hand"?t.source==="cwd":!0}var V=["all","synced","local","never_run","cli","hand"];function Ft(t){let r=V.indexOf(t);return V[(r+1)%V.length]}function lt({root:t,currentOrgId:r,onSelect:i,onCancel:n}){let[o,e]=(0,b.useState)([]),[s,c]=(0,b.useState)(null),[d,l]=(0,b.useState)(!0),[a,m]=(0,b.useState)("all");(0,b.useEffect)(()=>{(async()=>{try{let f=await A({root:t}),w=[];for(let y of f.results){let j=Pt(y.path);j?.org_id!==void 0&&j.org_id!==r||w.push({path:y.path,relPath:y.relPath,name:C(y.path),status:Mt(j),source:y.source})}e(w),l(!1)}catch(f){f instanceof v,c(f.message),l(!1)}})()},[t,r]);let E=(0,b.useMemo)(()=>o.filter(f=>Ot(f,a)).map(f=>({id:f.path,label:`${Dt(f.status)} ${Ct(f.source)} ${f.relPath}`})),[o,a]),x=(0,b.useMemo)(()=>It(a,o),[a,o]);if(s)return(0,p.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.red,paddingX:2,paddingY:1,children:[(0,p.jsx)(g,{color:h.red,bold:!0,children:"testmd"}),(0,p.jsx)(k,{marginTop:1,children:(0,p.jsx)(g,{color:h.red,children:s})})]});let T=a==="all"?"all":$t(a);return(0,p.jsx)(z,{title:`testmd \xB7 filter: ${T}`,items:E,loading:d,itemNoun:"tests",onSelect:f=>{let w=o.find(y=>y.path===f.id);w&&i(w)},onCancel:n,onTab:()=>m(f=>Ft(f)),extraHint:"cycle filter",footer:x})}function $t(t){return t==="synced"?"synced (\u2601)":t==="local"?"local (\u25A3)":t==="never_run"?"never run (\u25CB)":t==="cli"?"cli-generated (\u2726)":t==="hand"?"hand-written":"all"}function It(t,r){let i={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?h.orange:h.dim;return(0,p.jsxs)(k,{flexDirection:"column",children:[(0,p.jsx)(g,{color:h.dim,children:"legend:"}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(t==="synced"),children:` \u2601 synced (${i.synced}) `}),(0,p.jsx)(g,{color:n(t==="local"),children:`\u25A3 local (${i.local}) `}),(0,p.jsx)(g,{color:n(t==="never_run"),children:`\u25CB never run (${i.never})`})]}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(t==="cli"),children:` \u2726 cli-generated (${i.cli}) `}),(0,p.jsx)(g,{color:n(t==="hand"),children:` hand-written (${i.hand})`})]})]})}var O=R(B(),1);import{existsSync as Lt,readFileSync as At}from"fs";var u=R($(),1);function ut({path:t,relPath:r,onAction:i,onBack:n,onView:o}){let[e,s]=(0,O.useState)(null),[c,d]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let a=P(t);if(Lt(a))try{s(JSON.parse(At(a,"utf8")))}catch{s(null)}},[t]),K((a,m)=>{if(m.escape){if(c){d(!1);return}n();return}if(c){a==="y"||a==="Y"?(d(!1),i("delete")):(a==="n"||a==="N")&&d(!1);return}a==="r"&&i("run"),a==="e"&&e?.testcase_id&&i("export"),a==="d"&&d(!0),a==="v"&&o&&o()});let l=({k:a,v:m})=>m?(0,u.jsxs)(g,{children:[(0,u.jsx)(g,{color:h.dim,children:a.padEnd(14)}),m]}):null;return(0,u.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(g,{color:h.orange,bold:!0,children:r}),(0,u.jsx)(k,{marginTop:1,flexDirection:"column",children:e?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l,{k:"test_id",v:e.test_id}),(0,u.jsx)(l,{k:"testcase_id",v:e.testcase_id}),(0,u.jsx)(l,{k:"project_id",v:e.project_id}),(0,u.jsx)(l,{k:"folder_id",v:e.folder_id}),(0,u.jsx)(l,{k:"org_id",v:e.org_id}),(0,u.jsx)(l,{k:"session_name",v:e.session_name}),(0,u.jsx)(l,{k:"commit_id",v:e.commit_id})]}):(0,u.jsx)(g,{color:h.dim,children:"(never run \u2014 no meta.json)"})}),c?(0,u.jsx)(k,{marginTop:1,children:(0,u.jsxs)(g,{color:h.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,u.jsx)(k,{marginTop:1,children:(0,u.jsxs)(g,{color:h.dim,children:["[r] run [e] export",e?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function F(t){L(t);let r=P(t);if(!D(r))return null;try{return JSON.parse(jt(r,"utf8"))}catch{return null}}function ft(t,r){return!t||t.org_id===void 0?!0:t.org_id===r}function q(t,r){return ft(t,r)?null:(process.stderr.write(`error: this test belongs to org ${t.org_id}; you are logged in as org ${r}.
3
- Switch profiles with \`kane-cli profiles switch\` to act on it.
4
- `),2)}async function Me(t={}){let r=!!process.stdin.isTTY&&!t.json,i=new N,n=new W;await et({isInteractive:r,creds:i,config:n});let o=i.getDefaultEnv()??"prod";try{let e=await X({creds:i,env:o,log:()=>{}});return e.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(e.resolvedCreds.org_id)}}catch(e){if(e instanceof U)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw e}}async function De(t,r){if(process.stdin.isTTY&&!t.json)return await Jt(r,t.root);let i=t.root??process.cwd(),n;try{n=await A({root:i,ignore:t.ignore})}catch(o){if(o instanceof v)return process.stderr.write(`error: ${o.message}
5
- `),2;throw o}for(let o of n.results){let e=F(o.path);if(!ft(e,r))continue;let s={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:C(o.path),has_meta:e!==null,source:o.source,synced:!!e?.testcase_id};e&&(e.test_id&&(s.test_id=e.test_id),e.testcase_id&&(s.testcase_id=e.testcase_id),e.org_id&&(s.org_id=e.org_id),e.project_id&&(s.project_id=e.project_id),e.folder_id&&(s.folder_id=e.folder_id)),process.stdout.write(JSON.stringify(s)+`
6
- `)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
7
- `),0}var mt=-1001,gt=-1002,pt=-1003,_={action:null,path:null};function Nt(t,r){return _.action=t,_.path=r,t==="run"?mt:t==="export"?gt:pt}function Wt({root:t,currentOrgId:r,onComplete:i}){let[n,o]=M.default.useState({kind:"list"});return M.default.useEffect(()=>{n.kind==="exiting"&&i(n.code)},[n,i]),n.kind==="list"?M.default.createElement(lt,{root:t,currentOrgId:r,onSelect:e=>o({kind:"inspect",path:e.path,relPath:e.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?M.default.createElement(ut,{path:n.path,relPath:n.relPath,onAction:async e=>{o({kind:"exiting",code:Nt(e,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Jt(t,r){let i=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(e=>{let{unmount:s,waitUntilExit:c}=n(M.default.createElement(Wt,{root:i,currentOrgId:t,onComplete:d=>{s(),e(d)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>e(0)).catch(()=>e(0))});if(o===mt&&_.path){let{runTestMdFile:e}=await import("./run-test-md-YWKVMQDJ.js"),s=await e(_.path,{});return _.action=null,_.path=null,s}if(o===gt&&_.path){let e=await Xt(_.path,{},t);return _.action=null,_.path=null,e}if(o===pt&&_.path){let e=await Ut(_.path,!0,t);return _.action=null,_.path=null,e}return o}async function Ce(t,r){let i=Y(t);if(!D(i))return process.stderr.write(`error: file not found: ${i}
8
- `),2;let n=F(i),o=q(n,r);if(o!==null)return o;let e={path:i,name:C(i),has_meta:n!==null};return n&&(n.commit_id&&(e.commit_id=n.commit_id),n.test_id&&(e.test_id=n.test_id),n.testcase_id&&(e.testcase_id=n.testcase_id),n.project_id&&(e.project_id=n.project_id),n.folder_id&&(e.folder_id=n.folder_id),n.org_id&&(e.org_id=n.org_id),n.session_name&&(e.session_name=n.session_name)),process.stdout.write(JSON.stringify(e)+`
9
- `),0}async function Ut(t,r,i){let n=Y(t);if(!D(n))return process.stderr.write(`error: file not found: ${n}
10
- `),2;let o=F(n),e=q(o,i);if(e!==null)return e;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
11
- This will remove '${n}' and '${J(n)}/'.
12
- `),2;let s=J(n);if(D(s))try{dt(s,{recursive:!0,force:!0})}catch(c){return process.stderr.write(`error: failed to remove ${s}: ${c.message}
13
- `),2}try{Bt(n)}catch(c){return process.stderr.write(`error: failed to remove ${n}: ${c.message}
14
- `),2}return process.stderr.write(`removed ${n} and ${s}/
15
- `),0}var S=class extends Error{kind;constructor(r,i){super(i),this.name="ExportError",this.kind=r}};async function Oe(t,r){let{codeDir:i}=await ht(t,r);return{codeDir:i}}async function ht(t,r){let i=F(t);if(!i?.testcase_id)throw new S("not-synced","this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.");let n=new W().load(),o=r.language??n.code_export?.language;if(!o)throw new S("no-language","--language not provided and no default in tui-config.");let e=r.output??Q(t,"playwright",o),s=D(e);if(s&&!r.force){let a=!1;try{let{readdirSync:m}=await import("fs");a=m(e).length>0}catch{}if(a)return{kind:"reused",codeDir:e}}s&&r.force&&dt(e,{recursive:!0,force:!0});let c=new N,d=r.env??c.getDefaultEnv()??"prod",l;try{l=await X({creds:c,env:d,log:()=>{}})}catch(a){throw a instanceof U?new S("auth-fail","not authenticated. Run `kane-cli login` first."):a}if(!l.basicAuth)throw new S("auth-incomplete","TMS basic auth could not be resolved. Run `kane-cli login` again.");try{let a=G(d);await ct({tmsBaseUrl:a.tmsBaseUrl,testcaseId:i.testcase_id,auth:l.basicAuth,language:o,framework:"playwright",skipValidation:n.code_export?.skip_validation??!0,outDir:e,log:()=>{}})}catch(a){throw new S("export-fail",`code export failed: ${a.message}`)}return{kind:"exported",codeDir:e}}async function Xt(t,r,i){let n=Y(t);if(!D(n))return process.stderr.write(`error: file not found: ${n}
16
- `),2;let o=F(n),e=q(o,i);if(e!==null)return e;try{let s=await ht(n,r);return s.kind==="reused"?process.stderr.write(`reusing existing export at ${s.codeDir}
17
- `):process.stderr.write(`exported to ${s.codeDir}
18
- `),0}catch(s){if(s instanceof S)return s.kind==="not-synced"?(process.stderr.write("error: this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.\n"),2):s.kind==="no-language"?(process.stderr.write(`error: --language not provided and no default in tui-config.
19
- `),2):s.kind==="auth-fail"?(process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),2):s.kind==="auth-incomplete"?(process.stderr.write("error: TMS basic auth could not be resolved. Run `kane-cli login` again.\n"),2):(process.stderr.write(`error: ${s.message}
20
- `),2);throw s}}export{lt as a,ut as b,F as c,ft as d,q as e,Me as f,De as g,Jt as h,Ce as i,Ut as j,S as k,Oe as l,Xt as m};
@@ -1,10 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var v=()=>!!process.env.KANE_DEV_MODE,t=[],u=!1,f=null,c=null,a=null,i=null;function x(e){i=e}function m(){return i}function h(){return u}function y(e,r){t=t.filter(o=>o.name!==e),t.push({name:e,fn:r})}function R(e){t=t.filter(r=>r.name!==e)}function w(e,r){let o=t.find(n=>n.name===e);if(!o)return;t=t.filter(n=>n.name!==e);let s=!0;try{o.fn()}catch(n){s=!1,process.stderr.write(`[exit-manager] cleanup(${e}) failed: ${n instanceof Error?n.message:String(n)}
3
- `)}r&&s&&v()&&process.stderr.write(`[exit-manager] cleanup(${e}): ${r}
4
- `)}function l(e,r,o=!1){if(u){process.exit(f??e);return}if(u=!0,f=e,o&&i)try{i.log("error","CRASH",r),i.shutdownSync()}catch{}let s=[...t].reverse(),n=[];for(let g of s)try{g.fn(),n.push(g.name)}catch(d){process.stderr.write(`[exit-manager] cleanup(${g.name}) failed: ${d instanceof Error?d.message:String(d)}
5
- `)}if(t=[],v()&&(process.stderr.write(`[exit-manager] shutdown(${e}): ${r}
6
- `),n.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${n.join(", ")}
7
- `)),o&&a){try{a()}catch{}process.stderr.write(`
8
- Kane CLI crashed unexpectedly: ${r}
9
- `+(n.length>0?`Resources cleaned up (${n.join(", ")}).
10
- `:"")),process.exit(e);return}if(c&&!o){c();return}process.exit(e)}function E(e){c=e}function $(e){a=e}var p=!1;function S(){p||(p=!0,process.on("SIGINT",()=>{l(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{l(143,"Received SIGTERM",!0)}),process.on("uncaughtException",e=>{l(1,`Uncaught exception: ${e.message}`,!0)}),process.on("unhandledRejection",e=>{l(1,`Unhandled rejection: ${String(e)}`,!0)}))}function L(){t=[],u=!1,f=null,c=null,a=null,i=null,p=!1}export{x as a,m as b,h as c,y as d,R as e,w as f,l as g,E as h,$ as i,S as j,L as k};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as e}from"os";import{join as t}from"path";var m="0.4.10",d="kane-cli",a=t(e(),".testmuai","kaneai"),g=t(a,"profiles"),h=t(a,"tui-config.json"),_="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",x=`https://registry.npmjs.org/${n}`,r="kane-cli",A=[{dir:t(e(),".claude","skills",r),agent:"Claude Code"},{dir:t(e(),".agents","skills",r),agent:"Codex CLI"},{dir:t(e(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",U=9222,b=9230,I=t(a,"chrome-profiles"),o=t(a,"hints"),C=t(o,"state.json");function E(s){return t(o,`catalog-${s}.json`)}var p="127.0.0.1",T=18392,S=18400,c="/callback";function N(s){return`http://${p}:${s}${c}`}var P="KANE CLI",B="*",O={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",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",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",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",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"}},k={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,a as c,h as d,_ as e,L as f,n as g,A as h,u as i,R as j,U as k,b as l,I as m,C as n,E as o,p,T as q,S as r,c as s,N as t,P as u,B as v,O as w,k as x};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- function r(e){return{url:`${e.tmsBaseUrl}/kane-cli/v1/test-case/${e.testcaseId}/code`,body:{code_name:"kane-cli-trigger",language:e.codeExport.language,framework:"playwright",folder_name:"",accessibility:"false",skipCodeValidation:e.codeExport.skipValidation}}}function o(e){return`${e.tmsBaseUrl}/kane-cli/v1/test-case/${e.testcaseId}/codes?page=1&per_page=10`}export{r as a,o as b};
@@ -1,17 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as m}from"./chunk-L5LI2JF4.js";import{c as h}from"./chunk-LRKWPAGK.js";import{randomUUID as N}from"crypto";import{mkdirSync as F,writeFileSync as f,appendFileSync as A,existsSync as v}from"fs";import{join as a}from"path";import{writeFileSync as w,mkdirSync as x,existsSync as I}from"fs";import{join as p,relative as j}from"path";function _(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
- `)}function k(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 y=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function c(n){return typeof n!="string"||!n.includes("{{")?n:n.replace(y,"{{$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 L=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{x(t,{recursive:!0})}catch(u){process.stderr.write(`
4
- \u26A0 Failed to create ${j(this.opts.cwd,t)}/
5
- ${u.message}
6
- Your test recording was NOT saved.
7
-
8
- `);return}let s=p(t,`${e}_test.md`),i=2,r=!1;for(;I(s);)s=p(t,`${e}-${i}_test.md`),i++,r=!0;let l=d(E(this.opts.getResolvedGlobal())),o=_({frontmatter:l,heading:`Session: ${e}`,steps:this.objectives.map(c)});try{w(s,o,"utf8")}catch(u){process.stderr.write(`
9
- \u26A0 Failed to save your test recording.
10
- ${u.message}
11
- Path: ${s}
12
-
13
- `);return}this.lastWrittenPath=s,this.lastCollisionSuffixed=r}};function E(n){let e={};for(let[t,s]of Object.entries(n))L.has(t)||$.has(t)||(e[t]=s);return e}var D=a(h,"sessions"),b=class{sessionId;sessionDir;runs=[];_flows=[];_nextIndex=0;_started=!1;_testId=null;_testcaseId=null;_projectId=null;_orgId=null;_uploadStatus="pending";_uploadAttempts=0;_uploadError=null;_firstObjective=null;_firstUrl=null;_auteurVariables={};_screenshotSas=null;_model="";_environment="";_profile=null;_plan=null;_startedAt="";_remoteLogger=null;_earlyLogBuffer=[];_recorder=null;_resolvedGlobal={};_sessionName=null;_recordingEnabled=!0;_stepRunRecords=[];constructor(e){this.sessionId=N();let t=e?.baseDir?a(e.baseDir,"sessions"):D;this.sessionDir=a(t,this.sessionId)}setResolvedGlobal(e){this._resolvedGlobal={...this._resolvedGlobal,...e}}setSessionName(e){this._sessionName=e}get sessionName(){return this._sessionName}setRecordingEnabled(e){this._recordingEnabled=e}get recorder(){return this._recorder}flushRecorder(){try{this._recorder?.flush()}catch(e){process.stderr.write(`[recorder] flush failed: ${e.message}
14
- `)}}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{F(this.sessionDir,{recursive:!0}),this._recorder=new g({cwd:process.cwd(),getResolvedGlobal:()=>this._resolvedGlobal,getName:()=>this._sessionName});let t={session_id:this.sessionId,started_at:this._startedAt,model:e.model,environment:e.environment,profile:e.profile,plan:this._plan,objectives:[],runs:[],status:"in_progress"};f(a(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
15
- `)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,i){if(t===void 0){this._log(e);let o=e.indexOf(" "),u=o>0?e.slice(0,o):e,R=o>0?e.slice(o+1):"",S=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(S,u,R||e);return}let r=e,l=s;this._log(`${t} ${l}`),this._remoteLogger?.log(r,t,l,i)}logStep(e,t,s){this._log(`${e} ${t}`);let i=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(i,e,t,s)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,s){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${s}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:s})}logRunEnd(e,t,s,i){let r=(s??0).toFixed(1),l=(i??"").slice(0,100);this._log(`RUN ${e} END status=${t} duration=${r}s summary="${l}"`),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:i??""}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let t={session_id:this.sessionId,started_at:this._startedAt,ended_at:new Date().toISOString(),model:this._model,environment:this._environment,profile:this._profile,plan:this._plan,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(s=>({index:s.index,objective:s.objective,status:s.status,summary:s.summary,run_dir:s.run_dir}))};v(this.sessionDir)&&f(a(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
16
- `),this.flushRecorder(),this._recorder=null}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},i=t.run_dirs?.length??1;for(let r=0;r<i;r++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e){if(!(!this._started||!v(this.sessionDir)))try{let t=new Date().toISOString().slice(0,19).replace("T"," "),s=a(this.sessionDir,"tui.log");A(s,`[${t}] ${e}
17
- `)}catch{}}};export{_ as a,k as b,b as c};
@@ -1,11 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as O,h as F}from"./chunk-AH4AXJML.js";import{a as k}from"./chunk-L5LI2JF4.js";import{readFileSync as se,existsSync as ne}from"fs";import{basename as C,dirname as oe,isAbsolute as re,resolve as L}from"path";var u=class extends Error{constructor(s,o,n){super(`[${o}${n!=null?`:${n}`:""}] ${s}`);this.file=o;this.line=n;this.name="TestMdParseError"}},U=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),D=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","on_lock_conflict"]),$=new Set(["optional"]),V=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),Q=new Set(["mode","on_lock_conflict"]);function R(e,t){let s=t.split(`
3
- `),{global:o,bodyStartLine:n}=X(e,s),{title:r,steps:i}=Z(e,s,n);return{path:e,title:r,global:o,steps:i}}function X(e,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let s=-1;for(let r=1;r<t.length;r++)if(t[r].trim()==="---"){s=r;break}if(s===-1)throw new u("frontmatter is missing closing '---'",e,1);let o=t.slice(1,s).join(`
4
- `),n;try{n=k(o)??{}}catch(r){throw new u(`invalid YAML in frontmatter: ${r.message}`,e,1)}if(M(e,n,"frontmatter",1),n.on_lock_conflict!==void 0){let r=n.on_lock_conflict;if(r!=="readonly"&&r!=="fail"&&r!=="wait")throw new u(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(r)}`,e,1)}return E(e,n,1),{global:n,bodyStartLine:s+1}}function Z(e,t,s){let o,n=s;for(;n<t.length&&t[n].trim()==="";)n++;let r=n<t.length?/^#\s+(.+?)\s*$/.exec(t[n]):null;r&&(o=r[1],n++);let i=[];for(let d=n;d<t.length;d++)/^##\s/.test(t[d])&&i.push(d);let a=[];for(let d=0;d<i.length;d++){let c=i[d],p=i[d+1]??t.length,m=t[c].replace(/^##\s+/,"").trim(),g=t.slice(c+1,p),{config:l,body:f,optional:h}=ee(e,c+1,g);a.push({index:d+1,heading:m,config:l,body:f,headingLine:c+1,optional:h})}return{title:o,steps:a}}function ee(e,t,s){let o=0;for(;o<s.length&&s[o].trim()==="";)o++;let n,r=t;if(o<s.length&&/^```yaml\s*$/.test(s[o])){let l=o;r=t+l,o++;let f=-1;for(;o<s.length;){if(/^```\s*$/.test(s[o])){f=o;break}o++}if(f===-1)throw new u("step-config fenced ```yaml block is not closed",e,r);let h=s.slice(l+1,f).join(`
5
- `);try{n=k(h)??{}}catch(I){throw new u(`invalid YAML in step config: ${I.message}`,e,r)}o=f+1}let i=te(s.slice(o)),a=i.filter(l=>l.trim()!=="");if(a.length>0&&/^@session\s+/.test(a[0].trim()))throw new u("@session is no longer supported (iteration 3); use @import instead",e,t);let d=/^@import\s+(\S.*)$/,p=i.filter(l=>d.test(l.trim())).length>0;if(p&&a.length!==1)throw new u("step body must be exactly one of prose / @import",e,t);let m=!1,g;if(n){if(M(e,n,p?"step config (ref)":"step config (objective)",r),p||E(e,n,r),typeof n.optional=="boolean")m=n.optional;else if(n.optional!==void 0)throw new u(`step config 'optional' must be boolean: got ${typeof n.optional}`,e,r);let l={...n};delete l.optional,Object.keys(l).length>0&&(g=l)}return p?{body:{kind:"import_ref",path:d.exec(a[0].trim())[1].trim()},optional:m}:{body:{kind:"objective",text:i.join(`
6
- `).trim()},config:g,optional:m}}function te(e){let t=0,s=e.length;for(;t<s&&e[t].trim()==="";)t++;for(;s>t&&e[s-1].trim()==="";)s--;return e.slice(t,s)}function E(e,t,s){let o=t.variables;if(o==null)return;if(typeof o!="object"||Array.isArray(o))throw new u("variables must be an object map",e,s);let n={};for(let[r,i]of Object.entries(o))if(typeof i=="string")n[r]={value:i};else if(i&&typeof i=="object"&&!Array.isArray(i)&&typeof i.value=="string")n[r]=i;else throw new u(`variable '${r}' must be a string or { value: ... } object`,e,s);t.variables=n}function M(e,t,s,o){for(let n of Object.keys(t)){if(U.has(n))throw new u(`auth/identity keys are CLI-only: ${n}`,e,o);if(s==="frontmatter"){if($.has(n))throw new u(`step-only key in frontmatter: ${n}`,e,o);if(!D.has(n))throw new u(`unknown config key: ${n}`,e,o)}else if(s==="step config (objective)"){if(!D.has(n)&&!$.has(n))throw new u(`unknown config key: ${n}`,e,o);if(V.has(n))throw new u(`chrome config is global-only: ${n}`,e,o);if(Q.has(n))throw new u(`'${n}' is run-level and cannot be set per-step`,e,o)}else if(!$.has(n))throw new u(`step config on @import may only contain 'optional': got ${n}`,e,o)}}var T=["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"],b=class extends Error{constructor(t){super(t),this.name="TestMdResolveError"}};function Be(e){let t=L(e),s=A(t),o=ie(s.global),n=[];return B(s,[],n,[],t),n.forEach((i,a)=>i.flatIndex=a+1),{rootPath:t,rootTitle:s.title,rootGlobal:s.global,rootSteps:s.steps,chrome:o,steps:n}}function A(e){if(!ne(e))throw new b(`@import path not found: ${e}`);let t=se(e,"utf8");return R(e,t)}function B(e,t,s,o,n){if(t.includes(e.path)){let i=[...t,e.path].map(a=>C(a)).join(" \u2192 ");throw new b(`cyclic reference: ${i}`)}t.push(e.path);let r=o.length===0;for(let i of e.steps){let a=i.body.kind!=="objective";if(i.optional&&a&&!r)throw new b(`intermediate-ref 'optional' is not supported in v1: ${e.path}:${i.headingLine}`);let d={file:e.path,stepIndex:i.index,heading:i.heading,optional:i.optional??!1};if(i.body.kind==="objective"){let g=ae(e.global,i.config);s.push({flatIndex:0,objective:i.body.text,sourceFile:e.path,trace:[...o,d],config:g,parsedConfig:i.config,optional:i.optional??!1});continue}let c=oe(e.path),p=re(i.body.path)?i.body.path:L(c,i.body.path);if(C(p).endsWith("_test.md"))throw new b(`cannot @import a test file: only helpers may be imported (got ${p})`);let m=A(p);B(m,t,s,[...o,d],n)}t.pop()}function ie(e){let t={};for(let s of T)e[s]!==void 0&&(t[s]=e[s]);return t}function ae(e,t){let s={};for(let[o,n]of Object.entries(e))T.includes(o)||(s[o]=n);return{...s,...t??{}}}import{mkdirSync as _,writeFileSync as Ee}from"fs";import{join as S}from"path";import{createHash as le}from"crypto";function j(e){if(e==null)return null;if(Array.isArray(e))return e.map(j);if(typeof e=="object"){let t={};for(let s of Object.keys(e).sort()){let o=e[s];o!==void 0&&(t[s]=j(o))}return t}return e}function de(e){if(e.body.kind!=="objective")throw new Error("stepMd5: only objective steps have an md5; @import rows do not");let t={...e.config??{},optional:e.optional??!1},s=JSON.stringify(j(t));return le("md5").update(e.body.text).update(`
7
- `).update(s).digest("hex")}function x(e){return de({index:e.trace[e.trace.length-1].stepIndex,heading:e.trace[e.trace.length-1].heading,body:{kind:"objective",text:e.objective},config:e.parsedConfig,headingLine:1,optional:e.optional})}import{writeFileSync as pe,mkdirSync as ce,readFileSync as fe}from"fs";import{dirname as ue,basename as K}from"path";function w(e){let t=e.outPath??O(e.sourcePath);ce(ue(t),{recursive:!0});let s=[];s.push("---"),s.push(`test: ../${K(e.sourcePath)}`),s.push(`status: ${e.overallStatus}`),s.push(`started: ${e.startedISO}`),s.push(`duration_s: ${e.durationS}`),s.push(`session_id: ${e.sessionId}`),s.push("---",""),s.push(`# ${e.title??K(e.sourcePath)} \u2014 Result`,"");for(let o=0;o<e.rootSteps.length;o++){let n=e.rootSteps[o],r=e.outcomes.find(i=>i.rootStepIndex===o+1);if(s.push(ge(n,r)),n.body.kind==="objective"&&r?.stepMd5&&s.push(`md5: ${r.stepMd5}`),r?.status==="failed"&&r.reason&&s.push(`Reason: ${r.reason}`),r?.softFailures?.length)for(let i of r.softFailures){let a=i.reason?`: ${i.reason}`:"";s.push(`\u26A0 optional sub-step ${i.subStepIndex} failed${a}`)}n.body.kind==="objective"&&r?.status!=="skipped"&&s.push(n.body.text),s.push("")}return pe(t,s.join(`
8
- `),"utf8"),t}function ge(e,t){if(!t)return`## ${e.heading} (no outcome)`;let s=t.duration_s!=null?`${t.duration_s}s`:"\u2014";if(t.status==="skipped")return`## ${e.heading} \u23ED skipped`;let o=t.softFailed?" (optional)":"";if(t.refKind&&t.status==="passed"){let n=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2713 passed (via @${t.refKind} ${t.refLabel} \u2014 ${t.inlinedCount} inlined steps, ${s}${n})`}if(t.refKind&&t.status==="failed"){let n=t.failedSubStepIndex&&t.failedSubStepIndex.length>0?` \u2014 at sub-step ${t.failedSubStepIndex.join(" \u2192 sub-step ")}`:"",r=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2717 failed${o} (via @${t.refKind} ${t.refLabel}${n}, ${s}${r})`}return t.status==="passed"?`## ${e.heading} \u2713 passed (${s})`:`## ${e.heading} \u2717 failed${o} (${s})`}var me=/^##\s+(.+?)\s+(✓ passed|✗ failed(?:\s+\(optional\))?|⏭ skipped)(?:\s+\((.*)\))?\s*$/,he=/via\s+@\w+\s+(\S+).*?(?:→\s+(\S+))?\s*$/,Se=/^md5:\s+([a-f0-9]{32})\s*$/;function Je(e){let s=fe(e,"utf8").split(`
9
- `),o="passed";if(s[0]?.trim()==="---")for(let r=1;r<s.length&&s[r].trim()!=="---";r++){let i=/^status:\s+(passed|failed|interrupted)\s*$/.exec(s[r]);i&&(o=i[1])}let n=[];for(let r=0;r<s.length;r++){let i=me.exec(s[r]);if(!i)continue;let a=i[1],d=i[2],c=i[3]??"",p=d.startsWith("\u2713")?"passed":d.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let g=he.exec(c),l=g?.[1]??"",f=g?.[2]??null;n.push({kind:"import",heading:a,status:p,md5:null,importPath:l,helperResultRelPath:f})}else{let g=null;for(let l=r+1;l<s.length&&!/^##\s/.test(s[l]);l++){if(s[l].trim()==="")continue;let f=Se.exec(s[l]);if(f){g=f[1];break}break}n.push({kind:"objective",heading:a,status:p,md5:g})}}return{overallStatus:o,steps:n}}import{copyFileSync as be,existsSync as ye,mkdirSync as ve,writeFileSync as Re}from"fs";import{join as y}from"path";function H(e){for(let t=0;t<e.totalRunDirs;t++){let s=e.runIndex+t,o=y(e.sessionDir,"runs",String(s)),n=y(e.stagingStepDir,"flows",String(t));ve(n,{recursive:!0});let r=[y(o,"run-test","actions.ndjson"),y(o,"actions.ndjson")],i=y(n,"actions.ndjson"),a=!1;for(let d of r)if(ye(d)){be(d,i),a=!0;break}a||Re(i,"")}}import{basename as xe,dirname as we,join as Ie}from"path";function G(e){let t=xe(e);return t.endsWith("_test.md")?t.slice(0,-8):t.endsWith(".md")?t.slice(0,-3):t}function ke(e){if(e.length<2)throw new Error("helperOutputDirName requires trace length >= 2 (root + at least one helper)");let t=G(e[0].file),s=G(e[e.length-1].file),o=e.slice(0,-1).map(n=>String(n.stepIndex));return`helper-output-${s}-${t}-${o.join("-")}`}function v(e){if(e.length<2)throw new Error("helperOutputDirPath requires trace length >= 2");let t=e[e.length-1].file;return Ie(we(t),ke(e))}import{existsSync as N,mkdirSync as $e,rmSync as je,cpSync as _e}from"fs";function W(e,t){N(e)&&(N(t)&&je(t,{recursive:!0,force:!0}),$e(t,{recursive:!0}),_e(e,t,{recursive:!0}))}import{readFileSync as Pe}from"fs";import{join as Oe,relative as Fe}from"path";function J(e){let t=De(e.resolvedTest,e.runByStep),s=new Map;for(let o of t.values()){let n=s.get(o.helperFile);n||(n=R(o.helperFile,Pe(o.helperFile,"utf8")),s.set(o.helperFile,n));let r=[],i=!1;for(let d of n.steps){let c=d.index,p=o.resolvedSteps.filter(l=>l.trace[o.helperDepth].stepIndex===c);if(p.length===0){r.push({rootStepIndex:c,status:"skipped"});continue}let m=p[0].trace[0].stepIndex,g=e.outcomes.find(l=>l.rootStepIndex===m);if(!g){r.push({rootStepIndex:c,status:"skipped"});continue}if(d.body.kind==="objective"){let l=p[0],f=Y(l,g);f==="failed"&&(i=!0);let h={rootStepIndex:c,status:f};f==="passed"&&(h.stepMd5=x(l)),r.push(h)}else{let l=!1,f=!1;for(let z of p){let P=Y(z,g);P!=="skipped"&&(f=!0),P==="failed"&&(l=!0)}let h=l?"failed":f?"passed":"skipped";h==="failed"&&(i=!0);let I=v(p[0].trace.slice(0,o.helperDepth+2)),q=Fe(o.finalDir,I);r.push({rootStepIndex:c,status:h,refKind:"import",refLabel:d.body.path,inlinedCount:p.length,helperResultRelPath:`${q}/Result.md`})}}let a=i?"failed":"passed";w({sourcePath:o.helperFile,title:n.title,rootSteps:n.steps,outcomes:r,overallStatus:a,startedISO:e.startedISO,durationS:0,sessionId:e.sessionId,outPath:Oe(o.stagingDir,"Result.md")})}}function De(e,t){let s=new Map;for(let o of e.steps)if(t.has(o.flatIndex))for(let n=1;n<o.trace.length;n++){let r=o.trace.slice(0,n+1),i=v(r),a=s.get(i);a||(a={stagingDir:`${i}.staging`,finalDir:i,helperFile:r[n].file,helperDepth:n,resolvedSteps:[]},s.set(i,a)),a.resolvedSteps.push(o)}return s}function Y(e,t){if(t.status==="passed")return"passed";if(t.status==="skipped")return"skipped";let s=e.trace.slice(1).map(r=>r.stepIndex),o=t.failedSubStepIndex??[],n=Math.min(s.length,o.length);for(let r=0;r<n;r++)if(s[r]!==o[r])return s[r]<o[r]?"passed":"skipped";return s.length===o.length?"failed":s.length<o.length?"passed":"skipped"}function St(e){let t=F(e.resolvedTest.rootPath);_(S(t,".internal"),{recursive:!0});let s=new Map;for(let n of e.stepRunRecords)s.set(n.testmdStepIndex,n);for(let n of e.resolvedTest.steps){let r=s.get(n.flatIndex);if(!r)continue;let i=n.trace[n.trace.length-1].stepIndex,a=x(n),d=a.slice(0,8),c;if(n.trace.length===1)c=S(t,".internal","steps",`${i}-${d}`);else{let p=`${v(n.trace)}.staging`;_(S(p,".internal"),{recursive:!0}),c=S(p,".internal","steps",`${i}-${d}`)}if(_(c,{recursive:!0}),H({sessionDir:e.sessionDir,runIndex:r.runIndex,totalRunDirs:r.totalRunDirs,stagingStepDir:c}),n.trace.length===1){let p=n.trace[0].stepIndex,m=e.outcomes.find(g=>g.rootStepIndex===p);m&&m.stepMd5==null&&(m.stepMd5=a)}}J({resolvedTest:e.resolvedTest,outcomes:e.outcomes,startedISO:e.startedISO,sessionId:e.sessionId,runByStep:s}),w({sourcePath:e.resolvedTest.rootPath,title:e.resolvedTest.rootTitle,rootSteps:e.resolvedTest.rootSteps,outcomes:e.outcomes,overallStatus:e.overallStatus,startedISO:e.startedISO,durationS:e.durationS,sessionId:e.sessionId,outPath:S(t,"Result.md")});let o={};if(e.commitId&&(o.commit_id=e.commitId),e.tmsIds.testId&&(o.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(o.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(o.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(o.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(o.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(o.session_name=e.tmsIds.sessionName),Ee(S(t,".internal","meta.json"),JSON.stringify(o,null,2)+`
10
- `,"utf8"),e.codeExportDir){let n=e.codeExportLanguage??"python",r=S(t,`playwright-${n}-code`);try{W(e.codeExportDir,r)}catch(i){process.stderr.write(`warn: codegen copy failed: ${i.message}
11
- `)}}}export{Be as a,x as b,w as c,Je as d,v as e,W as f,St as g};
@@ -1,6 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l,d,e as m,f as g,g as S,k as y}from"./chunk-AH4AXJML.js";import{a as u}from"./chunk-53O3GMZR.js";import{g as p,h as f}from"./chunk-LOIRZFV3.js";import{existsSync as s,mkdirSync as h,readFileSync as C,renameSync as w,writeFileSync as R}from"fs";import{join as x}from"path";function G(e){y(l(e));let r=l(e);if(!s(r))return;let n=x(r,"meta.json"),o=m(e);if(s(n)&&!s(o))try{h(d(e),{recursive:!0}),w(n,o)}catch(t){process.stderr.write(`warn: meta.json migration failed: ${t.message}
3
- `)}let a=S(e);if(s(a)){let t="python";try{let i=new u().load();i.code_export?.language&&(t=i.code_export.language)}catch{}let c=g(e,"playwright",t);if(!s(c))try{w(a,c)}catch(i){process.stderr.write(`warn: generated-code migration failed: ${i.message}
4
- `)}}if(s(o))try{let t=JSON.parse(C(o,"utf8"));"md5sum"in t&&(delete t.md5sum,R(o,JSON.stringify(t,null,2)+`
5
- `,"utf8"))}catch(t){process.stderr.write(`warn: meta.json md5sum strip failed: ${t.message}
6
- `)}}async function O(e){if(!e.isInteractive)return{recovered:!1};if(E(e.creds))return{recovered:!1};let{SingleShotApp:r}=await import("./SingleShotApp-RO25ZX2E.js"),{ScrollbackProvider:n}=await import("./scrollback-6GINSTL2.js"),{render:o}=await import("./build-JIKYOZUH.js"),a=await import("./react-QWOAB3TB.js"),t={current:null},c={current:!1},{waitUntilExit:i,unmount:v}=o(a.default.createElement(n,null,a.default.createElement(r,{resultRef:t,mode:"login",loginCompleteRef:c})),{exitOnCtrlC:!1});f(()=>v()),await i();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),c.current?{recovered:!0}:(p(0,"Startup gate cancelled"),{recovered:!1})}function E(e){let r=e.getActiveProfile(),n=e.getDefaultEnv();if(!r||!!!(e.loadBasicAuth(r,n)||e.loadCredentials(r,n)))return!1;let a=e.loadProfileConfig(r,n)??{};return!!a.project_id&&!!a.folder_id}export{G as a,O as b};