@testmuai/kane-cli 0.4.3 → 0.4.5
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.
- package/dist/{ChromeProfilePicker-5ORNSIGU.js → ChromeProfilePicker-DHEEFWVV.js} +1 -1
- package/dist/{CliFeedbackPrompt-FLU2ARNK.js → CliFeedbackPrompt-XVBAXCYR.js} +1 -1
- package/dist/{CliUploadProgress-3XSSNZZC.js → CliUploadProgress-4S3BH3LI.js} +1 -1
- package/dist/{ConfigView-J3U7W5IC.js → ConfigView-Q5NNM5T5.js} +1 -1
- package/dist/FolderPicker-T575L6QE.js +2 -0
- package/dist/{HelpView-QPZCA6E3.js → HelpView-2T36LFLG.js} +1 -1
- package/dist/{InfoBox-2PQE7LQY.js → InfoBox-TBM3RTBH.js} +1 -1
- package/dist/{LinksBox-72DOWBUL.js → LinksBox-WRMIRJLF.js} +1 -1
- package/dist/{ProfilesView-VGHTTDXT.js → ProfilesView-GGYBHIOM.js} +1 -1
- package/dist/{ProjectPicker-WICA5KRO.js → ProjectPicker-UEVYQGLY.js} +1 -1
- package/dist/{SaveSessionPrompt-TH24UGJF.js → SaveSessionPrompt-KYL6AOGP.js} +1 -1
- package/dist/SingleShotApp-DOEY5FTW.js +2 -0
- package/dist/{SummaryBox-P42SBLBH.js → SummaryBox-B4QJDLQD.js} +1 -1
- package/dist/TestMdRunView-J3M33BMA.js +2 -0
- package/dist/{WhoamiView-FVGT4VHK.js → WhoamiView-BY57RUTR.js} +1 -1
- package/dist/{changelog-55BBQLCV.js → changelog-OM726WGL.js} +1 -1
- package/dist/{chunk-IR5EJOWF.js → chunk-4D5Z4OAS.js} +1 -1
- package/dist/chunk-4EDPYAMW.js +60 -0
- package/dist/{chunk-MDUS66QI.js → chunk-5WMT2WVI.js} +1 -1
- package/dist/{chunk-N2DL2XLX.js → chunk-62ZUB3DG.js} +1 -1
- package/dist/{chunk-UMFJNYMK.js → chunk-6GWQ2RA4.js} +1 -1
- package/dist/{chunk-3CKFCRIC.js → chunk-6XWZHEQR.js} +1 -1
- package/dist/{chunk-ZS22QC5H.js → chunk-73TFORTS.js} +1 -1
- package/dist/{chunk-P6ZOLQ6M.js → chunk-7XX4XFCV.js} +1 -1
- package/dist/{chunk-Z36MHRFD.js → chunk-AYWWHMM7.js} +1 -1
- package/dist/{chunk-RVK7MDEV.js → chunk-BDMQY6N6.js} +1 -1
- package/dist/chunk-D2J4EILJ.js +22 -0
- package/dist/{chunk-6YGJHOJJ.js → chunk-DVRZITSK.js} +1 -1
- package/dist/{chunk-DOLZ3HLX.js → chunk-E5WH7UGU.js} +1 -1
- package/dist/{chunk-6YH4L5PD.js → chunk-EQLDX5LN.js} +1 -1
- package/dist/{chunk-D5P5DM3Y.js → chunk-EWID6VQA.js} +1 -1
- package/dist/{chunk-M4JD6FAC.js → chunk-F22NYY2I.js} +1 -1
- package/dist/{chunk-OERW4FRV.js → chunk-FTWHK7PH.js} +1 -1
- package/dist/{chunk-7DLL4WUG.js → chunk-GG73PQBI.js} +2 -2
- package/dist/{chunk-JWZDGFTV.js → chunk-GVXJKQF7.js} +1 -1
- package/dist/{chunk-ARXOHFRQ.js → chunk-HIFHTE2F.js} +2 -2
- package/dist/{chunk-MSIFN664.js → chunk-I5KH34BI.js} +1 -1
- package/dist/chunk-K74XYWPF.js +5 -0
- package/dist/{chunk-7HRF45Q4.js → chunk-K77SVBYU.js} +1 -1
- package/dist/{chunk-QKZTUJUZ.js → chunk-LY2SBSUM.js} +1 -1
- package/dist/{chunk-JOPYH47V.js → chunk-MBK47QLD.js} +1 -1
- package/dist/{chunk-W7K5XSAM.js → chunk-N7OAA2OD.js} +1 -1
- package/dist/{chunk-HN7DVSVI.js → chunk-PUU7A26K.js} +1 -1
- package/dist/{chunk-YO6OTYDJ.js → chunk-Q5XYITHT.js} +1 -1
- package/dist/{chunk-WBYOM6I2.js → chunk-S6DJADYF.js} +1 -1
- package/dist/{chunk-UQLF4H5Z.js → chunk-SDY6K7ZR.js} +1 -1
- package/dist/{chunk-USO6VWOP.js → chunk-SNV7DD5M.js} +1 -1
- package/dist/{chunk-HM2I36RC.js → chunk-T4WDQ7I4.js} +1 -1
- package/dist/{chunk-SP6DPSKB.js → chunk-UJJX2Y5K.js} +2 -2
- package/dist/{chunk-DJZVPHCW.js → chunk-VF6NQFGC.js} +1 -1
- package/dist/{chunk-UN7QP7YJ.js → chunk-WGYUOXJX.js} +1 -1
- package/dist/{chunk-LTEYP6N4.js → chunk-X6FNT3EY.js} +1 -1
- package/dist/{chunk-2EDV5GRD.js → chunk-XT45Z36Q.js} +1 -1
- package/dist/{generate-headless-2AVIJFUR.js → generate-headless-6SH67NQN.js} +2 -2
- package/dist/index.js +36 -36
- package/dist/{list-commands-GI6JUPK2.js → list-commands-4OC75YL3.js} +1 -1
- package/dist/login-flow-GLIUZ3XD.js +2 -0
- package/dist/{persist-recorded-session-L2UJYUMB.js → persist-recorded-session-HXVQRBJV.js} +1 -1
- package/dist/{recording-banner-RVW5S7ET.js → recording-banner-G3BDHTZU.js} +1 -1
- package/dist/{require-project-folder-EGKVA3T3.js → require-project-folder-VSJ3UJL6.js} +1 -1
- package/dist/{run-test-md-B4XEFS35.js → run-test-md-JVYGWYZJ.js} +6 -6
- package/dist/{skill-installer-NDDLIUWA.js → skill-installer-2CMWR2TX.js} +1 -1
- package/dist/tcg-generate-JNA7RLSH.js +2 -0
- package/dist/testmd-actions-3YF6E3W6.js +2 -0
- package/dist/token-refresh-TPRQLK6B.js +2 -0
- package/dist/{validate-basic-36EIJ3ZB.js → validate-basic-F6DP3VUX.js} +1 -1
- package/dist/{version-check-575H4PFY.js → version-check-JHH3FYZ4.js} +1 -1
- package/package.json +6 -5
- package/dist/FolderPicker-63C6BXGW.js +0 -2
- package/dist/SingleShotApp-TFDCDSJ6.js +0 -2
- package/dist/TestMdRunView-HQE6IN2X.js +0 -2
- package/dist/chunk-3OATWGPB.js +0 -22
- package/dist/chunk-EBTYHLMG.js +0 -5
- package/dist/chunk-V45IPWG3.js +0 -60
- package/dist/login-flow-FM7VP76A.js +0 -2
- package/dist/tcg-generate-JQNBXV5P.js +0 -2
- package/dist/testmd-actions-QSLRU3KN.js +0 -2
- package/dist/token-refresh-DKWS73ET.js +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as L,b as et}from"./chunk-
|
|
2
|
+
import{a as L,b as et}from"./chunk-HIFHTE2F.js";import{a as U,b as X}from"./chunk-62ZUB3DG.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-73TFORTS.js";import{a as z}from"./chunk-F22NYY2I.js";import{a as N}from"./chunk-WGYUOXJX.js";import{a as G}from"./chunk-5WMT2WVI.js";import{a as I}from"./chunk-RZ4F3BHX.js";import{x as h}from"./chunk-X6FNT3EY.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
3
|
Switch profiles with \`kane-cli profiles switch\` to act on it.
|
|
4
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
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
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-
|
|
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-JVYGWYZJ.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
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
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
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.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f}from"./chunk-
|
|
2
|
+
import{b as f}from"./chunk-6XWZHEQR.js";import{x as t}from"./chunk-X6FNT3EY.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var c=p(B(),1);var e=p(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,c.useState)(0),a=c.default.useRef(Date.now());return(0,c.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.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,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",u=i.status==="done",m=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dim,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.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}export{v as a,U as b,h as c};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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-
|
|
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-73TFORTS.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
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
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
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-
|
|
6
|
+
`)}}async function O(e){if(!e.isInteractive)return{recovered:!1};if(E(e.creds))return{recovered:!1};let{SingleShotApp:r}=await import("./SingleShotApp-DOEY5FTW.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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as Le}from"./chunk-
|
|
2
|
+
import{b as Le}from"./chunk-K74XYWPF.js";import{a as de,b as je}from"./chunk-6XWZHEQR.js";import{d as Oe,f as pe}from"./chunk-LOIRZFV3.js";import{a as Pe}from"./chunk-7XX4XFCV.js";import{a as Ce}from"./chunk-AYWWHMM7.js";import{b as _e}from"./chunk-C6S4IEBC.js";import{x as l}from"./chunk-X6FNT3EY.js";import{a as N}from"./chunk-HCBYKLMW.js";import{a as u,b as i,i as Ee,j as ke,k as xe}from"./chunk-C44QQJR4.js";import{a as le}from"./chunk-6YGTRKDT.js";import{e as j}from"./chunk-UR6MHSHU.js";var te=j(le(),1);var q=j(le(),1);var D=j(le(),1);function fe(e,n){let s=null,c=(g,p)=>{for(let d=0;d<g.length;d++){let o=g[d],w=[...p,d];n(o)&&(s===null||w.length>s.length)&&(s=w),o.children&&o.children.length>0&&c(o.children,w)}};return c(e,[]),s}function me(e,n,s){if(n.length===0)return[...e];let c=n[0],g=[...e],p=g[c];if(n.length===1)g[c]=s(p);else{let d=n.slice(1),o=me(p.children??[],d,s);g[c]={...p,children:o}}return g}function Te(e){let n=e.indexOf(": ");return n>0&&n<15?e.slice(n+2):e}function Be(e){return e.map(n=>{let s=n.children?Be(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:s}:s!==n.children?{...n,children:s}:n})}function De(e,n,s,c){let[g,p]=(0,D.useState)(!1),[d,o]=(0,D.useState)([]),[w,I]=(0,D.useState)(null),[k,_]=(0,D.useState)(null),[U,S]=(0,D.useState)(null),[v,B]=(0,D.useState)(null),[O,Q]=(0,D.useState)([]),[G,ne]=(0,D.useState)(null),[se,ge]=(0,D.useState)(void 0),K=(0,D.useRef)(null),H=(0,D.useRef)(null),Z=(0,D.useRef)(0),ee=(0,D.useRef)(!1),h=(0,D.useCallback)(async(x,A)=>{let re=K.current;if(re){try{await re.exited}catch{}K.current=null}o([]),I(null),_(null),S(null),B(null),Q([]),ne(null),ge(x.max_steps),p(!0),H.current=null,Z.current=0;let F;try{F=Le(x,A)}catch(X){S(X instanceof Error?X.message:String(X)),p(!1);return}K.current=F,Oe("runner",()=>F.cancel()),(async()=>{ee.current=!1;let X=!1;for await(let t of F.events){if(ee.current)break;switch(t.type){case"run_start":if(t.child_id)break;if(H.current&&!H.current.isSingleFlow){let E=Z.current;Z.current++,o(C=>C.map((b,T)=>T===E?{...b,status:"running"}:b.status==="running"&&!b.children?.some(a=>a.status==="running")?{...b,status:b.children?.some(a=>a.status==="failed")?"failed":"passed"}:b))}break;case"bifurcation":{let E=t.flows??[],C=t.count??E.length,b={flows:E,isSingleFlow:t.is_single_flow??C<=1};B(b),H.current=b,Z.current=0,o(E.map((T,a)=>({index:a+1,objective:T??`Flow ${a+1}`,status:"pending"})));break}case"step_start":{n?.("STEP_START",`Step ${t.index} started`,{index:t.index,objective:t.objective,child_id:t.child_id});let E=t.index,C=t.objective??`Step ${E}`,b=t.child_id,T=H.current&&!H.current.isSingleFlow;if(b)o(a=>{let f=fe(a,$=>$.branchChildId===b)??fe(a,$=>$.status==="running");return f?me(a,f,$=>{let L=($.children??[]).map(V=>V.status==="running"&&V.childId===b?{...V,status:"stopped",phase:void 0}:V);return L.push({index:E,objective:C,status:"running",childId:b}),{...$,children:L}}):a});else if(T){let a=Math.max(0,Z.current-1);o(f=>{let $=[...f];if(a>=$.length)return f;let L={...$[a]},ce=[...L.children??[]].map(he=>he.status==="running"&&he.childId===void 0?{...he,status:"stopped",phase:void 0}:he);return ce.push({index:E,objective:C,status:"running"}),L.children=ce,L.status="running",$[a]=L,$})}else o(a=>{let f=Be(a);return f.some(L=>L.index===E)?f.map(L=>L.index===E?{...L,status:"running",objective:C}:L):[...f,{index:E,objective:C,status:"running"}]});break}case"step_event":{n?.("STEP_EVENT",`Step ${t.index} ${t.event}`,{index:t.index,phase:t.event,action_type:t.action_type,detail:t.detail,child_id:t.child_id});let E=t.child_id,C=H.current&&!H.current.isSingleFlow;if(t.event==="cm_init"&&t.checkpoint_count!=null){Q(b=>[...b,t.checkpoint_count]);break}if(t.event==="replay_started"){ne({recordingLength:t.recording_length??0});break}if(t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&s?.(t.detail),E){let b=a=>{if(a.index!==t.index||a.childId!==E)return a;let f={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(f.objective=t.detail),t.action_type&&(f.actionType=t.action_type),{...a,...f}},T=a=>a.map(f=>{let $=b(f);return $!==f?$:f.children&&f.children.length>0?{...f,children:T(f.children)}:f});o(a=>a.map(f=>f.children?{...f,children:T(f.children)}:f))}else if(C){let b=Math.max(0,Z.current-1);o(T=>{let a=[...T];if(b>=a.length)return T;let f={...a[b]},$=[...f.children??[]];if(!$.some(V=>V.index===t.index&&V.childId===void 0))$.push({index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type});else for(let V=0;V<$.length;V++){if($[V].index!==t.index||$[V].childId!==void 0)continue;let ce={phase:t.event};t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(ce.objective=t.detail),t.action_type&&(ce.actionType=t.action_type),$[V]={...$[V],...ce}}return f.children=$,a[b]=f,a})}else o(b=>b.some(a=>a.index===t.index)?b.map(a=>{if(a.index!==t.index)return a;let f={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(f.objective=t.detail),t.action_type&&(f.actionType=t.action_type),{...a,...f}}):[...Be(b),{index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type}]);break}case"step_end":{n?.("STEP_END",`Step ${t.index} ${t.status}`,{index:t.index,status:t.status,duration:t.duration,summary:t.summary,child_id:t.child_id}),c?.();let E=t.child_id,C=H.current&&!H.current.isSingleFlow;if(E){let b=a=>a.index===t.index&&a.childId===E?{...a,status:t.status,duration:t.duration,phase:void 0,objective:a.objective.startsWith("Step ")?Te(t.summary||a.objective):a.objective}:a,T=a=>a.map(f=>{let $=b(f);return $!==f?$:f.children&&f.children.length>0?{...f,children:T(f.children)}:f});o(a=>a.map(f=>f.children?{...f,children:T(f.children)}:f))}else if(C){let b=Math.max(0,Z.current-1);o(T=>{let a=[...T];if(b>=a.length)return T;let f={...a[b]},$=(f.children??[]).map(L=>L.index===t.index&&L.childId===void 0?{...L,status:t.status,duration:t.duration,phase:void 0,objective:L.objective.startsWith("Step ")?Te(t.summary||L.objective):L.objective}:L);return f.children=$,a[b]=f,a})}else o(b=>b.map(T=>T.index===t.index?{...T,status:t.status,duration:t.duration,phase:void 0,objective:T.objective.startsWith("Step ")?Te(t.summary||T.objective):T.objective}:T));{let T=H.current&&!H.current.isSingleFlow?Math.max(0,Z.current-1):0;e?.(t.index,T,t.child_id)}break}case"child_agent_start":{let E=t.objective??"",C=t.child_id;o(b=>{let T=fe(b,a=>a.status==="running");return T?me(b,T,a=>({...a,objective:`${E} (branch)`,phase:`child: ${E.slice(0,50)}`,branchObjective:E,branchChildId:C})):b});break}case"child_agent_end":{let E=t.child_id,C=`child ${t.success?"done":"failed"}`;o(b=>{let T=fe(b,a=>a.branchChildId===E);return T?me(b,T,a=>({...a,phase:C})):b.map(a=>a.phase?.startsWith("child:")?{...a,phase:C}:a)});break}case"ask_user":I(t.question??"");break;case"run_end":o(E=>E.map(C=>C.status==="running"?{...C,status:t.status,phase:void 0}:C)),p(!1),_(t),X=!0;break;case"error":p(!1),S(t.message??"Runner error"),o(E=>E.map(C=>C.status==="running"?{...C,status:"failed",phase:void 0}:C));break}}let{code:ie,signal:ve}=await F.exited,ye=F.stderr,Xe=ie===0&&!ve,ue=[];ie!==null&&ie!==0&&ue.push(`Runner exited with code ${ie}`),ve&&ue.push(`Runner killed by signal ${ve}`),ye&&(!Xe||!X?ue.push(ye):A?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:ye})),K.current===F&&(ue.length>0&&S(ue.join(`
|
|
3
3
|
`)),p(!1),pe("runner","Event stream ended"),K.current=null)})().catch(X=>{let ie=[`Runner event loop error: ${X}`];F.exitCode!==null&&F.exitCode!==0&&ie.push(`Exit code: ${F.exitCode}`),F.exitSignal&&ie.push(`Signal: ${F.exitSignal}`),F.stderr&&ie.push(F.stderr),K.current===F&&(S(ie.join(`
|
|
4
4
|
`)),p(!1),pe("runner","Event loop error"),K.current=null)})},[e,n,s,c]),y=(0,D.useCallback)(x=>{K.current?.sendUserResponse(x),I(null)},[]),R=(0,D.useCallback)(()=>{let x=K.current;x&&(x.sendCancel("user"),p(!1),I(null),setTimeout(()=>{K.current===x&&(pe("runner","User cancelled run"),K.current=null)},5e3))},[]),m=(0,D.useCallback)(()=>{o([]),_(null),S(null)},[]);return(0,D.useEffect)(()=>()=>{ee.current=!0,pe("runner","Component unmounted"),K.current=null},[]),{isRunning:g,steps:d,askingUser:w,lastRunEnd:k,runError:U,bifurcationInfo:v,cmInitCounts:O,replayInfo:G,maxSteps:se,startRun:h,sendAnswer:y,cancelRun:R,clearLastRun:m}}function we(e){let n=e.flatMap(p=>[p,...p.children??[]]),s=n.filter(p=>p.status==="passed").length,c=n.filter(p=>p.status==="failed").length,g=n.filter(p=>p.status==="passed"||p.status==="failed").length;return{passed:s,failed:c,total:g}}function Fe(e){let n=De(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[s,c]=(0,q.useState)(0),[g,p]=(0,q.useState)("idle"),d=(0,q.useRef)("idle"),o=(0,q.useRef)(0),w=(0,q.useRef)(!1),I=(0,q.useRef)(null),k=(0,q.useRef)(null),_=(0,q.useCallback)(v=>{d.current=v,p(v)},[]),U=(0,q.useCallback)(async v=>{let B=await e.getNextConfig(v);if(!B){_("done"),e.onAllComplete?.();return}let O=v?o.current+1:0;o.current=O,c(O),e.onStepStart?.(B,O),I.current=null,k.current=null,_("running"),await n.startRun(B,e.spawnOpts)},[n,e,_]);(0,q.useEffect)(()=>{w.current||(w.current=!0,U(null))},[]),(0,q.useEffect)(()=>{if(!n.lastRunEnd||n.lastRunEnd===I.current||d.current!=="running")return;I.current=n.lastRunEnd,d.current="transitioning",p("transitioning");let v=n.lastRunEnd,B=we(n.steps),O=n.bifurcationInfo,Q={status:v.status==="passed"?"passed":"failed",duration_s:v.duration??0,reason:v.reason,runEnd:v,hadError:!1,stepsPassed:B.passed,stepsFailed:B.failed,stepsTotal:B.total,bifurcationFlows:O&&!O.isSingleFlow?O.flows:null};if(!(e.onStepEnd?.(Q,o.current)??!0)){_("done"),e.onAllComplete?.();return}U(Q)},[n.lastRunEnd]),(0,q.useEffect)(()=>{if(!n.runError||n.runError===k.current||n.lastRunEnd||d.current!=="running")return;k.current=n.runError,d.current="transitioning",p("transitioning");let v=we(n.steps),B={status:"failed",duration_s:0,reason:n.runError,runEnd:null,hadError:!0,stepsPassed:v.passed,stepsFailed:v.failed,stepsTotal:v.total,bifurcationFlows:null};if(!(e.onStepEnd?.(B,o.current)??!0)){_("done"),e.onAllComplete?.();return}U(B)},[n.runError,n.lastRunEnd]);let S=(0,q.useCallback)(()=>{n.cancelRun()},[n]);return{runner:n,currentStepIndex:s,phase:g,cancel:S}}var Ie=j(le(),1);var be=j(N(),1),Ae=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Me({label:e,hasBifurcation:n=!1}){let[s,c]=(0,Ie.useState)(0),[g,p]=(0,Ie.useState)(0);de(()=>{c(o=>(o+1)%Ae.length)},80),de(()=>{p(o=>(o+1)%4)},400);let d=e??(n?"Planning approach":"Analyzing objective");return(0,be.jsxs)(u,{marginLeft:1,children:[(0,be.jsxs)(i,{color:l.orange,children:[Ae[s]," "]}),(0,be.jsxs)(i,{color:l.dim,children:[d,".".repeat(g+1)]})]})}function Ne(e){if(!e.isRunning||e.replayInfo)return null;let n=e.bifurcationInfo;if(n&&!n.isSingleFlow){let s=e.steps.findIndex(g=>g.status==="running");return(s===-1?e.cmInitCounts.length===0:s>=e.cmInitCounts.length)?{label:s>0?`Planning flow ${s+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(s=>s.children?.length)?null:{hasBifurcation:!!n}}var M=j(le(),1);var Ue=j(le(),1);var Re=j(N(),1),Ye="#ffc580",Je="#ffd9a8",qe="#ffffff";function Ge({text:e,active:n=!0}){let[s,c]=(0,Ue.useState)(0),g=4;if(de(()=>{c(d=>(d+1)%(e.length+g*2))},n?80:null),!n)return(0,Re.jsx)(i,{color:qe,children:e});let p=e.split("").map((d,o)=>{let w=s-g,I=Math.abs(o-w-g/2),k;return I<=g/2?k=Ye:I<=g?k=Je:k=qe,(0,Re.jsx)(i,{color:k,children:d},o)});return(0,Re.jsx)(i,{children:p})}var z=j(N(),1),Qe={starting:l.orange,running:l.orange,passed:l.green,failed:l.red,cancelled:l.dim,timed_out:l.orange};function Se({currentStep:e,maxSteps:n,elapsed:s,status:c}){let{stdout:g}=xe(),p=g?.columns??80,d=Qe[c]??l.orange,o=s<60?`${s.toFixed(1)}s`:`${Math.floor(s/60)}m ${Math.round(s%60)}s`;return(0,z.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,z.jsx)(i,{color:l.muted,children:"\u2500".repeat(Math.min(p,60))}),(0,z.jsxs)(u,{children:[(0,z.jsx)(i,{children:" "}),(0,z.jsx)(i,{color:l.dim,children:"Steps "}),(0,z.jsx)(i,{bold:!0,children:e}),(0,z.jsxs)(i,{color:l.dim,children:["/",n]}),(0,z.jsx)(i,{children:" "}),(0,z.jsx)(i,{color:l.dim,children:"Elapsed "}),(0,z.jsx)(i,{bold:!0,children:o}),(0,z.jsx)(i,{children:" "}),(0,z.jsx)(i,{color:l.dim,children:"Status "}),(0,z.jsx)(i,{bold:!0,color:d,children:c})]})]})}var Ze={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 Ke(e){return Ze[e]??"\u25CF"}var oe=j(N(),1);function $e({steps:e,flows:n,cmInitCounts:s,renderStep:c}){return(0,oe.jsxs)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,oe.jsxs)(i,{color:l.dim,children:["\u2501\u2501 Bifurcated into ",n?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((g,p)=>(0,oe.jsxs)(u,{flexDirection:"column",marginTop:p>0?1:0,children:[(0,oe.jsxs)(i,{color:l.orange,children:["Flow ",p+1,": ",n?.[p]??g.objective]}),s&&s[p]!=null&&(0,oe.jsxs)(i,{color:l.dim,children:[" \u25AA Generated task with ",s[p]," checkpoints"]}),g.children&&g.children.length>0?g.children.map(d=>{let o=!!d.branchObjective,w=`f${p}-${d.childId??"p"}-${d.index}`;return o?(0,oe.jsxs)(u,{flexDirection:"column",children:[c({...d,children:void 0},w),(d.children??[]).map(I=>(0,oe.jsx)(u,{marginLeft:2,children:c(I,`${w}-${I.childId??"p"}-${I.index}`)},`${w}-${I.childId??"p"}-${I.index}`))]},`${w}-host`):c(d,w)}):g.status==="pending"&&(0,oe.jsx)(i,{color:l.dim,children:" \u25CB Waiting..."})]},p))]})}var r=j(N(),1);function W({step:e,indent:n=2}){let s=e.actionType?Ke(e.actionType):null,c=e.status==="running",g=e.status==="passed",p=e.status==="failed",d=e.status==="pending"||e.status==="stopped",{stdout:o}=xe(),w=o?.columns??80,I=Math.max(20,w-n-21),k=e.objective??"",_=k.length>I?k.slice(0,I-1)+"\u2026":k,U=(e.duration??0)*1e3,S=e.duration!=null?U<1e3?`${Math.round(U)}ms`:`${(U/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(u,{flexDirection:"column",children:[(0,r.jsxs)(u,{marginLeft:n,children:[(0,r.jsx)(u,{width:4,children:(0,r.jsxs)(i,{color:l.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(u,{width:3,children:c?(0,r.jsx)(je,{}):g?(0,r.jsx)(i,{color:l.green,bold:!0,children:"\u2713"}):p?(0,r.jsx)(i,{color:l.red,bold:!0,children:"\u2717"}):(0,r.jsx)(i,{color:l.muted,children:"\u25CB"})}),(0,r.jsx)(u,{flexGrow:1,children:c?(0,r.jsx)(Ge,{text:_,active:!0}):p?(0,r.jsx)(i,{color:l.red,children:_}):d?(0,r.jsx)(i,{color:l.dim,children:_}):(0,r.jsx)(i,{color:l.dim,children:_})}),(g||p)&&s?(0,r.jsx)(u,{width:3,marginLeft:1,children:(0,r.jsx)(i,{color:l.muted,children:s})}):(0,r.jsx)(u,{width:3,marginLeft:1}),(0,r.jsx)(u,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(i,{color:l.dim,children:S})})]}),e.children&&e.children.length>0&&(0,r.jsx)(u,{flexDirection:"column",children:e.children.map((v,B)=>(0,r.jsx)(W,{step:v,indent:n+2},`child-${B}`))})]})}function et(e){return e.type==="cm_init"?(0,r.jsx)(u,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(i,{color:l.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(u,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(W,{step:e.step})})}function We({steps:e,bifurcated:n,flows:s,cmInitCounts:c,maxSteps:g=50,staticSteps:p=!1,onStepCommit:d}){let o=(0,M.useRef)(new Set),w=(0,M.useRef)(!1),I=(0,M.useRef)(new Set),k=(0,M.useRef)(!1),_=(0,M.useRef)(new Set),U=(0,M.useRef)(0);(0,M.useEffect)(()=>{e.length===0&&U.current>0&&(o.current.clear(),w.current=!1,I.current.clear(),k.current=!1,_.current.clear()),U.current=e.length},[e.length]);let S=e.flatMap(h=>[h,...h.children??[]]),v=S.some(h=>h.status==="running"),B=S.some(h=>h.status==="failed"),O=S.length===0||S.every(h=>h.status==="pending"),Q=S.filter(h=>h.status==="passed"||h.status==="failed").length,G;O?G="starting":v?G="running":B?G="failed":G="passed";let ne=(0,M.useRef)(null),[se,ge]=(0,M.useState)(0);(0,M.useEffect)(()=>{S.length===0||O?(ne.current=null,ge(0)):v&&ne.current==null&&(ne.current=Date.now())},[v,O,S.length]),(0,M.useEffect)(()=>{if(!v)return;let h=setInterval(()=>{ne.current!=null&&ge((Date.now()-ne.current)/1e3)},500);return()=>clearInterval(h)},[v]);let K=(0,M.useRef)(new Set),[,H]=(0,M.useState)(0),Z=(0,M.useRef)(!1);(0,M.useEffect)(()=>{if(!d||!p||n)return;let h=[];!Z.current&&c&&c[0]!=null&&(Z.current=!0,c[0]>0&&h.push({key:"cm_init_0",type:"cm_init",count:c[0]}));for(let y of e)(y.status==="passed"||y.status==="failed")&&!K.current.has(y.index)&&(K.current.add(y.index),h.push({key:`step_${y.index}`,type:"step",step:{...y,children:y.children?[...y.children]:void 0}}));if(h.length>0){for(let y of h)d(et(y));H(y=>y+1)}},[e,n,c,p,d]),(0,M.useEffect)(()=>{if(!d||p)return;let h=o.current.size;if(!n&&!k.current&&c&&c[0]!=null&&(k.current=!0,c[0]>0&&d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsxs)(i,{color:l.dim,children:["\u25A0 Generated task with ",c[0]," checkpoints"]})}))),n&&s&&!w.current&&(w.current=!0,d((0,r.jsx)(i,{color:l.purple,children:"\u2501\u2501 Bifurcated into "+s.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),n){let y=e.flatMap((R,m)=>{let x=R.children??[];return!I.current.has(m)&&x.length>0&&(I.current.add(m),d((0,r.jsx)(i,{color:l.purple,children:" Flow "+(m+1)+": "+(s?.[m]??"")})),c?.[m]!=null&&c[m]>0&&!_.current.has(m)&&(_.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsxs)(i,{color:l.dim,children:[" \u25AA Generated task with ",c[m]," checkpoints"]})})))),c?.[m]!=null&&c[m]>0&&I.current.has(m)&&!_.current.has(m)&&(_.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsxs)(i,{color:l.dim,children:[" \u25AA Generated task with ",c[m]," checkpoints"]})}))),x});for(let R of y){let m=`${R.childId??"p"}-${R.index}-${R.objective}`;if(!!R.branchObjective){o.current.has(m)||(o.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:{...R,children:void 0}})})));for(let A of R.children??[]){let re=`child-${R.childId??"p"}-${R.index}-${A.childId??"p"}-${A.index}-${A.objective}`;o.current.has(re)||(A.status==="passed"||A.status==="failed"||A.status==="stopped")&&(o.current.add(re),d((0,r.jsx)(u,{marginLeft:4,children:(0,r.jsx)(W,{step:A})})))}continue}o.current.has(m)||(R.status==="passed"||R.status==="failed"||R.status==="stopped")&&(o.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:R})})))}}else for(let y of e){let R=`${y.index}-${y.objective}`,m=!!y.branchObjective;m&&!o.current.has(R)&&(o.current.add(R),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:{...y,children:void 0}})})));for(let x of y.children??[]){let A=`child-${y.index}-${x.childId??"p"}-${x.index}-${x.objective}`;o.current.has(A)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(o.current.add(A),d((0,r.jsx)(u,{marginLeft:4,children:(0,r.jsx)(W,{step:x})})))}!m&&!o.current.has(R)&&(y.status==="passed"||y.status==="failed"||y.status==="stopped")&&(o.current.add(R),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:{...y,children:void 0}})})))}o.current.size>h&&H(y=>y+1)},[e,d,n,s,c]);let ee=[];if(p&&!n)for(let h of e)K.current.has(h.index)||ee.push(h);else if(d&&!p)if(n)for(let h of e){let y=h.children??[],R=[];for(let m of y){let x=`${m.childId??"p"}-${m.index}-${m.objective}`,A=o.current.has(x);if(m.branchObjective){let re=(m.children??[]).filter(F=>{let X=`child-${m.childId??"p"}-${m.index}-${F.childId??"p"}-${F.index}-${F.objective}`;return!o.current.has(X)});(!A||re.length>0)&&R.push({...m,children:re})}else A||R.push(m)}R.length>0&&ee.push({...h,children:R})}else for(let h of e){let y=`${h.index}-${h.objective}`,R=o.current.has(y),m=(h.children??[]).filter(x=>{let A=`child-${h.index}-${x.childId??"p"}-${x.index}-${x.objective}`;return!o.current.has(A)});R?m.length>0&&ee.push({...h,children:m}):ee.push({...h,children:m})}if(!p){let h=d?ee:e;return(0,r.jsxs)(u,{flexDirection:"column",children:[n?d?h.length>0?(0,r.jsx)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:h.map((R,m)=>(0,r.jsx)(u,{flexDirection:"column",marginTop:m>0?1:0,children:R.children&&R.children.length>0?R.children.map(x=>{let A=!!x.branchObjective,re=`${x.childId??"p"}-${x.index}-${x.objective}`,F=o.current.has(re);return A?(0,r.jsxs)(u,{flexDirection:"column",children:[!F&&(0,r.jsx)(W,{step:{...x,children:void 0}}),(x.children??[]).map(X=>(0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:X})},`f${m}-${x.index}-${X.childId??"p"}-${X.index}`))]},`f${m}-host-${x.childId??"p"}-${x.index}`):(0,r.jsx)(W,{step:x},`f${m}-${x.childId??"p"}-${x.index}`)}):R.status==="pending"&&(0,r.jsx)(i,{color:l.dim,children:" \u25CB Waiting..."})},m))}):null:(0,r.jsx)($e,{steps:e,flows:s,cmInitCounts:c,renderStep:(R,m)=>(0,r.jsx)(W,{step:R},m)}):(0,r.jsxs)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!d&&c&&c[0]!=null&&(0,r.jsxs)(i,{color:l.dim,children:["\u25AA Generated task with ",c[0]," checkpoints"]}),h.map(R=>{let m=`${R.index}-${R.objective}`;return d&&o.current.has(m)?(0,r.jsx)(u,{flexDirection:"column",children:(R.children??[]).map(x=>(0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:x})},`${x.childId??"p"}-${x.index}`))},`branch-children-${R.index}`):(0,r.jsx)(W,{step:R},R.index)})]}),v&&(0,r.jsx)(Se,{currentStep:Q,maxSteps:g,elapsed:se,status:G})]})}return n?(0,r.jsxs)(u,{flexDirection:"column",children:[(0,r.jsx)($e,{steps:e,flows:s,cmInitCounts:c,renderStep:(h,y)=>(0,r.jsx)(W,{step:h},y)}),v&&(0,r.jsx)(Se,{currentStep:Q,maxSteps:g,elapsed:se,status:G})]}):(0,r.jsxs)(u,{flexDirection:"column",children:[ee.length>0&&(0,r.jsx)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:ee.map(h=>(0,r.jsx)(W,{step:h},h.index))}),v&&(0,r.jsx)(Se,{currentStep:Q,maxSteps:g,elapsed:se,status:G})]})}var ae=j(N(),1);function He({runner:e,runKey:n,onStepCommit:s}){let c=Ne({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,ae.jsxs)(ae.Fragment,{children:[c&&(0,ae.jsx)(Me,{label:c.label,hasBifurcation:c.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,ae.jsx)(We,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:s},`run-${n}`)]})}var Y=j(N(),1),tt=64;function nt(e){return e.split(`
|
|
5
5
|
`).map(n=>n.replace(/^[-–•]\s*/,"").trim()).filter(n=>n.length>0)}function Ve({status:e,summary:n,duration:s,steps:c,stepsPassed:g,stepsFailed:p,reason:d,creditsConsumed:o}){let w=e==="passed",I=w?l.green:l.red,k=w?"\u2713":"\u2717",_=e.toUpperCase(),U=g??(w?c:Math.max(0,c-1)),S=p??(w?0:1),v=S>0?`${c} steps (${U} passed, ${S} failed)`:`${c} steps`,B=s<60?`${s.toFixed(1)}s`:`${Math.floor(s/60)}m ${Math.round(s%60)}s`,O=nt(n);return(0,Y.jsx)(u,{flexDirection:"column",marginTop:1,children:(0,Y.jsxs)(u,{borderStyle:"round",borderColor:I,flexDirection:"column",paddingX:2,paddingY:1,width:tt+6,children:[(0,Y.jsxs)(u,{flexDirection:"column",children:[(0,Y.jsxs)(i,{bold:!0,color:I,children:[k," ",_]}),(0,Y.jsxs)(i,{color:l.dim,wrap:"wrap",children:[v," \xB7 ",B,typeof o=="number"&&o>0?` \xB7 ${parseFloat(o.toFixed(4))} credits`:""]})]}),O.length>0&&(0,Y.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:O.map((Q,G)=>(0,Y.jsxs)(u,{marginBottom:G<O.length-1?1:0,children:[(0,Y.jsx)(i,{color:l.orange,children:"\u25CF "}),(0,Y.jsx)(u,{flexShrink:1,children:(0,Y.jsx)(i,{wrap:"wrap",children:Q})})]},G))}),d&&!w&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsxs)(i,{color:l.red,wrap:"wrap",children:["Reason: ",d]})})]})})}var J=j(N(),1);function ze({message:e,code:n,remediation:s,docsUrl:c}){return(0,J.jsx)(Ce,{title:"Error",variant:"error",children:(0,J.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,J.jsxs)(i,{color:l.red,bold:!0,children:[" \u2717 ",e]}),n&&(0,J.jsxs)(u,{marginTop:0,marginLeft:5,children:[(0,J.jsx)(i,{color:l.muted,children:"Code: "}),(0,J.jsx)(i,{color:l.dim,children:n})]}),s&&(0,J.jsxs)(u,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,J.jsx)(i,{color:l.green,bold:!0,children:"Fix:"}),(0,J.jsxs)(i,{color:l.orange,children:["$ ",s]})]}),c&&(0,J.jsxs)(u,{marginTop:1,marginLeft:5,children:[(0,J.jsx)(i,{color:l.muted,children:"Docs: "}),(0,J.jsx)(i,{color:l.orange,underline:!0,children:c})]})]})})}var P=j(N(),1);function sn(e){let{exit:n}=ke(),{append:s}=_e(),c=(0,te.useRef)(!1);(0,te.useEffect)(()=>{c.current||(c.current=!0,s((0,P.jsx)(u,{flexDirection:"column",marginBottom:1,children:(0,P.jsxs)(u,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,P.jsx)(i,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,P.jsx)(i,{color:l.dim,children:" \u2502 "}),(0,P.jsx)(i,{color:l.orange,children:e.topBanner.model}),(0,P.jsx)(i,{color:l.dim,children:" \u2502 "}),(0,P.jsx)(i,{color:l.dim,children:e.topBanner.auth})]})})),s((0,P.jsx)(rt,{data:e.globalConfig})),e.priorAttemptRollup&&s((0,P.jsx)(i,{color:l.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let g=(0,te.useRef)(null),p=(0,te.useCallback)(async S=>{let v=await e.getNextStep(S);return v?(g.current=v,v.config):(g.current=null,null)},[e]),d=(0,te.useCallback)((S,v)=>{let B=g.current;if(!B)return;let O=B.mode==="replay"?"cyan":"#dc4e08",Q=B.modeReason?` (${B.modeReason})`:"",G=B.perStepOverrides?Object.entries(B.perStepOverrides):[];s((0,P.jsxs)(u,{flexDirection:"column",marginBottom:0,children:[(0,P.jsxs)(i,{children:[(0,P.jsxs)(i,{color:l.dim,children:[B.banner.stepLabel," "]}),(0,P.jsxs)(i,{color:O,children:["[",B.mode,"]"]}),(0,P.jsx)(i,{color:l.dim,children:Q})]}),(0,P.jsx)(i,{color:l.dim,children:B.banner.objective}),G.length>0&&(0,P.jsxs)(i,{color:l.dim,children:["overrides: ",G.map(([ne,se])=>`${ne}=${se}`).join(", ")]})]}))},[s]),o=(0,te.useRef)(0),w=(0,te.useRef)(!1),I=(0,te.useCallback)((S,v)=>(S.hadError?s((0,P.jsx)(ze,{message:S.reason??"Runner error",code:"RUNNER_ERROR"})):s((0,P.jsx)(u,{flexDirection:"column",marginBottom:1,children:(0,P.jsx)(Ve,{status:S.status,summary:S.runEnd?.summary??"",duration:S.runEnd?.duration??0,steps:S.stepsTotal,stepsPassed:S.stepsPassed,stepsFailed:S.stepsFailed,reason:S.runEnd?.reason,creditsConsumed:S.runEnd?.credits_consumed})})),e.onStepEnd?.(S,v)??!0),[s,e]),k=Fe({getNextConfig:p,onStepStart:d,onStepEnd:I,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>n())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),_=250,U=5e3;return Ee((S,v)=>{if(v.ctrl&&S==="c"){let B=Date.now(),O=B-o.current;if(O<_)return;w.current&&O<U?(k.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>n())):(w.current=!0,s((0,P.jsx)(i,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),o.current=B}}),(0,P.jsx)(u,{flexDirection:"column",children:k.phase!=="done"&&(0,P.jsx)(He,{runner:k.runner,runKey:k.currentStepIndex,onStepCommit:s})})}function rt({data:e}){return(0,P.jsx)(Pe,{title:"test.md run",titleColor:"#ff9500",borderColor:l.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{We as a,Me as b,Ne as c,De as d,we as e,Ve as f,ze as g,sn as h};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as v}from"./chunk-5WMT2WVI.js";import{spawn as x,execSync as b}from"child_process";import{existsSync as g}from"fs";import{resolve as e,dirname as N}from"path";import{fileURLToPath as A}from"url";import{createInterface as w}from"readline";async function*_(i){let n=w({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 E(i){return i==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_AGENT_SKIP_CP_FINAL:"true",V16_BIFURCATION_PHASES:"1"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_AGENT_SKIP_CP_FINAL","V16_BIFURCATION_PHASES"]}}var c=N(A(import.meta.url));function C(){for(let i of["python3","python"])try{return b(`${i} --version`,{stdio:"ignore"}),i}catch{}return null}function h(){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"],"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=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=C();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function G(i,n){let l=h();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=E(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
|
+
`);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,S=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})})}),R=_(s.stdout);return{child:s,events:R,sendUserResponse(o){let m=JSON.stringify({type:"user_response",answer:o});try{s.stdin.write(m+`
|
|
4
|
+
`)}catch{}},sendCancel(o){let m=JSON.stringify({type:"cancel",reason:o});try{s.stdin.write(m+`
|
|
5
|
+
`)}catch{}},cancel(){s.kill("SIGTERM")},get stderr(){return a},get exitCode(){return u},get exitSignal(){return f},exited:S}}export{h as a,G 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-
|
|
2
|
+
import{a as S}from"./chunk-7XX4XFCV.js";import{x as o}from"./chunk-X6FNT3EY.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as x,b as c,j as y}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var T=b(w(),1);var i=b(R(),1);function L(e){let t=e.decisions.filter(l=>l.kind==="replay").length,r=e.decisions.filter(l=>l.kind==="author").length,d=e.outcomes.filter(l=>l.status==="passed").length,p=e.outcomes.filter(l=>l.status==="failed").length,f=e.outcomes.filter(l=>l.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let s=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${d} passed, ${p} failed, ${f} skipped)`,k=`${t} replay \xB7 ${r} author`,C=e.retryTriggered,_="yes \u2014 run recovered after a replay miss",u,g=o.dim;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",g=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let l=e.uploadResult?.testcaseId;u=l?`\u2713 pushed (testcase=${l})`:"\u2713 pushed",g=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,h=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",h=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,h=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:s},breakdown:k,showRetries:C,retriesText:_,commitText:u,commitColor:g,artifactsText:v,uploadText:m,uploadColor:h}}function O(e){let t=e.decisions.filter(s=>s.kind==="replay").length,r=e.decisions.filter(s=>s.kind==="author").length,d=e.outcomes.filter(s=>s.status==="passed").length,p=e.outcomes.filter(s=>s.status==="failed").length,f=e.outcomes.filter(s=>s.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:d,failed:p,skipped:f,replay_decisions:t,author_decisions:r},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled}}function A({data:e}){let t=L(e),r=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&r.push({label:"retries",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),r.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),r.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),r.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:r})}function I({data:e}){let{exit:t}=y();return(0,T.useEffect)(()=>{let r=setTimeout(()=>t(),50);return()=>clearTimeout(r)},[t]),(0,i.jsx)(x,{flexDirection:"column",children:(0,i.jsx)(A,{data:e})})}export{L as a,O as b,A as c,I as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-EWID6VQA.js";import{b as D}from"./chunk-K74XYWPF.js";import{a as E}from"./chunk-NLCCBXXV.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",l=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:l,headline:e.headline,scenarios:e.scenarios}}),l&&U(l)){let r=l.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,l=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),l),h;try{h=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!h.ok){e.signal.removeEventListener("abort",a);let w=await oe(h);if(h.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(h.status,w)}if(!h.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let g=h.body.getReader(),m=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await g.cancel().catch(()=>{});return}let{done:w,value:s}=await g.read();if(w)break;b+=m.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
|
|
3
3
|
|
|
4
4
|
`))>=0;){let u=b.slice(0,f);b=b.slice(f+2);let d=ie(u);d&&(yield d)}}}catch(w){if(e.signal.aborted)return;if(++r>n)throw new k("SSE stream dropped",w);await O(F(r,i));continue}finally{e.signal.removeEventListener("abort",a)}return}}function ie(e){let t="message",n="";for(let i of e.split(`
|
|
5
5
|
`))i.startsWith("event:")?t=i.slice(6).trim():i.startsWith("data:")&&(n+=i.slice(5).trim());if(t!=="message"||!n)return null;try{let i=Buffer.from(n,"base64").toString("utf-8");return JSON.parse(i)}catch{return null}}function F(e,t){return Math.min(t,1e3*2**(e-1))}function O(e){return new Promise(t=>setTimeout(t,e))}async function oe(e){try{return await e.clone().json()}catch{return}}function W(e,t){t?.length&&(e.append("files",t.map(n=>n.fileKey).join(",")),e.append("gemini_metadata",JSON.stringify(t.map(n=>({fileData:{fileUri:n.geminiUri,mimeType:n.mimeType}})))))}function Ue(e,t={}){let n=t.fetchImpl??fetch,i=new Map,l=!0;async function r(){let s=await e.authResolver.resolve();if(!s)throw new v("unauthorized; run `kane-cli login`");return E(s.username,s.access_key)}function o(s){return`${e.baseUrl}${s}`}async function p(s){if(!s.ok){let f;try{f=await s.clone().json()}catch{f=void 0}throw x(s.status,f)}return s.json()}function a(s){let f=s?.data??s;return{request_id:f.request_id??f.id,status:f.status??""}}function c(s,f,u,d){let y=q({requestId:s,objective:f});d&&(y=P(y,{type:"snapshot",data:d}),d.status==="cleaned_up"&&(y={...y,error:"session was reaped (cleaned_up) \u2014 continuing will destructively regenerate"}));let S=new AbortController;u&&(u.aborted?S.abort():u.addEventListener("abort",()=>S.abort(),{once:!0})),i.set(s,S);let A={requestId:s,state:y,events:void 0};return A.events=(async function*(){try{let C=J({url:o(`/requests/${s}/sse`),authHeader:r,signal:S.signal,log:e.log,fetchImpl:n});for await(let L of C)for(let z of H(L,s))A.state=P(A.state,z),yield z}finally{i.delete(s)}})(),A}async function h(s,f){let u=new FormData;u.append("prompt",s.prompt),l=s.memoryEnhancement??!0,u.append("memory_enhancement",String(l)),s.scenarioLimit!==void 0&&u.append("test_scenario_limit",String(s.scenarioLimit)),s.perScenarioLimit!==void 0&&u.append("per_scenario_test_cases_limit",String(s.perScenarioLimit));let d=s.projectId??e.projectId,y=s.folderId??e.folderId;d&&u.append("project_id",d),y&&u.append("folder_id",y),W(u,s.attachments);let S=await n(o("/requests"),{method:"POST",headers:{Authorization:await r()},body:u}),A=await p(S),{request_id:C}=a(A),L=String(C);return c(L,s.prompt,f)}async function g(s,f){let u=await n(o(`/requests/${s}`),{method:"GET",headers:{Authorization:await r()}}),d=await p(u),y=d?.data??d,S={requestId:s,status:y.status??"",headline:y.headline,scenarios:Array.isArray(y.scenarios)?y.scenarios:[]};return c(s,"",f,S)}async function m(s,f,u){let d=new FormData;d.append("prompt",f),d.append("chat_enabled","true"),d.append("memory_enhancement",String(l)),u?.mappings&&d.append("mappings",JSON.stringify(u.mappings)),W(d,u?.attachments);let y=await n(o(`/requests/${s}`),{method:"PUT",headers:{Authorization:await r()},body:d});if(!y.ok){let S;try{S=await y.clone().json()}catch{}throw x(y.status,S)}}async function b(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/stop`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let d;try{d=await u.clone().json()}catch{}throw x(u.status,d)}}async function w(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/end`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let d;try{d=await u.clone().json()}catch{}throw x(u.status,d)}}return{start:h,attach:g,chat:m,cancel:b,end:w}}import{statSync as ae,realpathSync as G,existsSync as ce}from"fs";import{extname as ue,resolve as j,isAbsolute as pe}from"path";import{homedir as V}from"os";var le=new Set([".txt",".json",".xml",".jpg",".jpeg",".png",".gif",".bmp",".webp",".pdf",".docx",".csv",".xlsx",".mp3",".wav",".m4a",".webm",".mpeg",".mpga",".mp4",".mov"]),de=50*1024*1024,X=10;function fe(e){return e==="~"?V():e.startsWith("~/")?j(V(),e.slice(2)):e}function Ge(e,t){let n=[],i=[],l=new Set,r=[],o=(()=>{try{return G(j(t))}catch{return j(t)}})(),p=o.endsWith("/")?o:o+"/";for(let a of e){let c=fe(a),h=pe(c)?c:j(t,c);if(!ce(h)){n.push(`Not found: ${a}`);continue}let g;try{g=G(h)}catch{n.push(`Cannot resolve: ${a}`);continue}if(l.has(g))continue;let m;try{m=ae(g)}catch{n.push(`Cannot read: ${a}`);continue}if(!m.isFile()){n.push(`Not a file: ${a}`);continue}if(m.size===0){n.push(`Empty file: ${a}`);continue}let b=ue(g).toLowerCase();if(!le.has(b)){n.push(`Unsupported type ${b||"(none)"}: ${a}`);continue}if(m.size>de){n.push(`Too large (>50MB): ${a}`);continue}g!==o&&!g.startsWith(p)&&i.push(`Outside working dir: ${a}`),l.add(g),r.push(g)}return r.length>X&&n.push(`Too many files: ${r.length} (max ${X})`),{ok:n.length?[]:r,errors:n,warnings:i}}var B=class extends Error{constructor(n){super(n.join("; "));this.errors=n;this.name="AttachmentValidationError"}};async function Xe(e){let{promptText:t,filePaths:n,cwd:i,scenarios:l,isRefine:r,conn:o,deps:p}=e,{ok:a,errors:c,warnings:h}=p.validate(n,i);if(c.length)throw new B(c);e.onValidated?.();let g=a.length?await p.upload(o,a,p.onUpload):[],m=r?p.buildMappings(t,l):void 0;return{promptText:t,mappings:m,attachments:g,warnings:h}}import{readFile as me}from"fs/promises";import{basename as K}from"path";async function ge(e){let t=await e.authResolver.resolve();if(!t)throw new v("unauthorized; run `kane-cli login`");return E(t.username,t.access_key)}async function he(e,t,n={}){let i=n.fetchImpl??fetch,l=await me(t),r=K(t),o=new FormData;o.append("file",new Blob([l]),r),o.append("source","omniBox"),o.append("geminiFileUpload","true");let p=await i(`${e.tmsBaseUrl}/v1/attachment`,{method:"POST",headers:{Authorization:await ge(e)},body:o,signal:n.signal});if(!p.ok){let m;try{m=await p.clone().json()}catch{}throw x(p.status,m)}let a=await p.json(),c=a?.data??a,h=c?.gemini_response?.uri,g=c?.gemini_response?.mimeType;if(!c?.file_key||!h){let m=c&&typeof c=="object"?Object.keys(c).join(","):typeof c,b=(()=>{try{return JSON.stringify(c).slice(0,500)}catch{return"<unserializable>"}})();throw new Error(`attachment upload for ${r} returned no file_key/gemini uri \u2014 status ${p.status}, body keys: [${m}], raw: ${b}`)}return{fileName:c.file_name??r,fileKey:c.file_key,geminiUri:h,mimeType:g??"application/octet-stream"}}async function tt(e,t,n,i={}){let l=[];for(let r=0;r<t.length;r++){if(i.signal?.aborted)throw Object.assign(new Error("upload aborted"),{name:"AbortError"});let o=K(t[r]);n?.({file:o,index:r+1,total:t.length,status:"uploading"});try{l.push(await he(e,t[r],i)),n?.({file:o,index:r+1,total:t.length,status:"done"})}catch(p){throw n?.({file:o,index:r+1,total:t.length,status:"failed"}),p}}return l}var ye=/@([sS])(\d+)\.([cC])(\d+)/g,be=/@([sS])(\d+)(?!\d)(?!\.[cC]\d)/g;function rt(e,t){let n={},i={};for(let l of e.matchAll(ye)){let r=Number(l[2]),o=Number(l[4]),p=t[r-1];if(!p)continue;n[`s${r}`]=String(p.id);let a=p.test_cases??[];if(a[o-1])for(let c=0;c<o;c++){let h=a[c];h&&(i[`s${r}.c${c+1}`]=String(h.id))}}for(let l of e.matchAll(be)){let r=Number(l[2]),o=t[r-1];o&&(n[`s${r}`]=String(o.id))}if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return{scenario:n,testcase:i}}function R(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(n==null||typeof n!="object")return[];let i=n;if(typeof i.step!="string")return[];let l=typeof i.expected_result=="string"?i.expected_result:typeof i.outcome=="string"?i.outcome:"";t.push({step:i.step,expected:l})}return t}var we=30,Se=300;function Z(){return{mode:"testing",max_steps:we,timeout:Se,variables:{}}}function Q(e){return e.title??`Test case ${e.id}`}function ct(e,t){return $({frontmatter:Z(),heading:Q(t),steps:e.sub_objectives.map(n=>n.objective)})}function Y(e){let t=R(e.manual_steps).map(n=>n.step);return $({frontmatter:Z(),heading:Q(e),steps:t})}import{mkdtempSync as xe,mkdirSync as N,writeFileSync as ee,rmSync as te,renameSync as _e,existsSync as ne,readFileSync as ve}from"fs";import{join as _,resolve as ke}from"path";async function ft(e,t,n,i=Y){(n.redirectBareCwd??!0)&&ke(t)===process.cwd()&&(t=_(t,".testmuai","tests"));let l=T(e.objective)??e.headline,r=T(n.suiteName)??`${T(re(l,4))??"tcg"}-${e.requestId}`,o=r,p=_(t,r);ne(p)&&!Te(p,e.requestId)&&(o=`${r}-${e.requestId}`);let a=_(t,o),c=[],h=new Map;for(let m of e.scenarios){let b=(m.test_cases??[]).filter(Ae);if(b.length===0)continue;let w=T(Ee(m.scode))??T(m.sid)??`s${m.id}`,s=h.get(w)??new Set;h.set(w,s);for(let f of b){let u=T(re(f.title,5))??"case",d=`${u}_test.md`;for(let y=2;s.has(d);y++)d=`${u}-${y}_test.md`;s.add(d),c.push({dir:w,file:d,tc:f})}}if(c.length===0)return{suiteDir:a,paths:[],warning:"no functional test cases generated"};N(t,{recursive:!0});let g=xe(_(t,".tcg-tmp-"));try{N(_(g,"helpers"),{recursive:!0}),ee(_(g,".tcg-suite.json"),JSON.stringify({requestId:e.requestId,suiteName:o}));let m=[],b=new Set;for(let s of c){let f=_(g,s.dir);b.has(f)||(N(f,{recursive:!0}),b.add(f));let u=_(f,s.file);ee(u,i(s.tc)),m.push(u)}ne(a)&&te(a,{recursive:!0,force:!0}),_e(g,a);let w=m.map(s=>s.replace(g,a));return{suiteDir:a,paths:w}}catch(m){try{te(g,{recursive:!0,force:!0})}catch{}throw m}}function Ae(e){return(e.category??"").trim().toLowerCase()==="functional"}function Te(e,t){try{return JSON.parse(ve(_(e,".tcg-suite.json"),"utf-8"))?.requestId===t}catch{return!1}}function T(e){return e&&e.length>0?e:void 0}function re(e,t){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim().split(/\s+/).filter(Boolean).slice(0,t).join("-"):""}function Ee(e){return e?e.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""):""}function ht(e){let t=[];e.title&&t.push(e.title),e.description&&t.push("",e.description);let n=R(e.manual_steps);return n.length>0&&(t.push("","Steps:"),n.forEach((i,l)=>{t.push(`${l+1}. ${i.step}`)})),t.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as l}from"./chunk-
|
|
2
|
+
import{b as l}from"./chunk-E5WH7UGU.js";import{a as f}from"./chunk-WGYUOXJX.js";import{a as m}from"./chunk-5WMT2WVI.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as c,c as s,h as a,w as u}from"./chunk-X6FNT3EY.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-XT45Z36Q.js";import{x as l}from"./chunk-X6FNT3EY.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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","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(`
|
|
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
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
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
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(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{x as m}from"./chunk-
|
|
2
|
+
import{x as m}from"./chunk-X6FNT3EY.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-
|
|
2
|
+
import{a as m}from"./chunk-XT45Z36Q.js";import{x as t}from"./chunk-X6FNT3EY.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $e}from"./chunk-
|
|
2
|
+
import{a as $e}from"./chunk-73TFORTS.js";import{a as Fe}from"./chunk-FPFOW6BS.js";import{a as ke}from"./chunk-YCCUBQY4.js";import{a as Ke}from"./chunk-VE3SUJMA.js";import{a as Ue}from"./chunk-BDMQY6N6.js";import{a as Oe}from"./chunk-5WMT2WVI.js";import{a as de}from"./chunk-XT45Z36Q.js";import{c as Re,x as u}from"./chunk-X6FNT3EY.js";import{a as Z}from"./chunk-HCBYKLMW.js";import{a as x,b as f,h as Le,i as be,k as De}from"./chunk-C44QQJR4.js";import{a as xe}from"./chunk-6YGTRKDT.js";import{e as O}from"./chunk-UR6MHSHU.js";var Ne=O(xe(),1);import{readFileSync as et,writeFileSync as tt,mkdirSync as nt}from"fs";import{dirname as rt,join as We}from"path";var ot=We(Re,"command-history.json"),yt=We(Re,"generate-history.json"),it=200,_e=class{entries;filePath;max;constructor(t=ot,e=it){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),i=[];for(let l=this.entries.length-1;l>=0;l--)this.entries[l].toLowerCase().includes(e)&&i.push(this.entries[l]);return i}_load(){try{let t=et(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){try{nt(rt(this.filePath),{recursive:!0}),tt(this.filePath,JSON.stringify(this.entries)+`
|
|
3
3
|
`)}catch{}}};function At(r){let t=(0,Ne.useRef)(null);return t.current||(t.current=new _e(r)),t.current}var L=O(xe(),1);var Ie=O(xe(),1);var X=O(Z(),1);function He({history:r,onSelect:t,onClose:e}){let[i,l]=(0,Ie.useState)(""),[a,g]=(0,Ie.useState)(0),v=i?r.search(i).slice(0,8):[];return be((T,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[a]?t(v[a]):e();return}if(d.upArrow){g(w=>Math.max(0,w-1));return}if(d.downArrow){g(w=>Math.min(v.length-1,w+1));return}if(d.backspace||d.delete){l(w=>w.slice(0,-1)),g(0);return}T&&!d.ctrl&&!d.meta&&(l(w=>w+T),g(0))}),(0,X.jsxs)(x,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,X.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,X.jsxs)(x,{gap:1,children:[(0,X.jsx)(f,{color:u.dim,children:"search:"}),(0,X.jsx)(f,{children:i}),(0,X.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,X.jsx)(f,{children:" "}),v.map((T,d)=>(0,X.jsx)(x,{marginLeft:2,children:(0,X.jsxs)(f,{color:d===a?u.orange:u.dim,bold:d===a,children:[d===a?"\u25B8 ":" ",T]})},`${d}-${T}`))]})}var ce=O(Z(),1);function Ge({commands:r,selectedIndex:t}){return r.length===0?null:(0,ce.jsx)(x,{flexDirection:"column",marginBottom:0,children:r.map((e,i)=>{let l=i===t;return(0,ce.jsxs)(x,{children:[(0,ce.jsx)(f,{color:l?u.orange:u.dim,children:l?"\u276F ":" "}),(0,ce.jsxs)(f,{color:l?u.orange:void 0,bold:l,children:["/",e.name]}),e.args&&(0,ce.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,ce.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ye=O(xe(),1);var H=O(Z(),1),qe={scenario:"Scenarios",case:"Test Cases",file:"Files"};function Ve(r){let t={scenario:0,case:0,file:0};for(let e of r)t[e.kind]++;return["scenario","case","file"].filter(e=>t[e]>0).map(e=>`${t[e]} ${qe[e]}`).join(" \xB7 ")}var Ee=7;function je({items:r,selectedIndex:t,accent:e=u.orange}){let i=r.length;if(i===0)return null;let l=Math.floor(Ee/2),a=i<=Ee?0:Math.max(0,Math.min(t-l,i-Ee)),g=Math.min(i,a+Ee),v=a,T=i-g;return(0,H.jsxs)(x,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,H.jsx)(x,{children:(0,H.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Ve(r.slice(0,a))}`})}),r.slice(a,g).map((d,w)=>{let K=a+w,D=K===t,C=w===0||r[K-1].kind!==d.kind;return(0,H.jsxs)(Ye.default.Fragment,{children:[C&&(0,H.jsx)(x,{children:(0,H.jsx)(f,{color:u.dim,children:qe[d.kind]})}),(0,H.jsxs)(x,{children:[(0,H.jsx)(f,{color:D?e:u.dim,children:D?"\u276F ":" "}),(0,H.jsx)(f,{color:D?e:void 0,bold:D,children:d.label})]})]},`${d.kind}:${d.value}:${K}`)}),T>0&&(0,H.jsx)(x,{children:(0,H.jsx)(f,{color:u.dim,children:` \u22EF ${T} more \u2014 ${Ve(r.slice(g))}`})})]})}var ye=O(xe(),1);var st=27,lt=127,at=11;function ct(r){return r>=64&&r<=126}function ut(r,t){r===at&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(r)})}function ft(r,t){r===lt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function dt(r,t){let e=r.map(l=>String.fromCharCode(l)).join(""),i=/^\[1;([0-9]+)([A-D])$/.exec(e);if(i){let l=parseInt(i[1],10),a=i[2],g={raw:"\x1B"+e};if(l===2)g.shift=!0;else if(l===3)g.meta=!0;else if(l===5)g.ctrl=!0;else return;a==="A"?g.arrowUp=!0:a==="B"?g.arrowDown=!0:a==="C"?g.arrowRight=!0:a==="D"&&(g.arrowLeft=!0),t(g);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function mt(r,t){r===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(r)}):r===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(r)})}function ht(){let r="IDLE",t=[];function e(){r="IDLE",t=[]}return{feed(i,l){for(let a of i)r==="IDLE"?a===st?(r="ESC",t=[]):ut(a,l):r==="ESC"?a===91?(r="CSI",t=[]):a===79?(r="SS3",t=[]):(ft(a,l),e()):r==="CSI"?(t.push(a),ct(a)&&(dt([91,...t],l),e())):r==="SS3"&&(mt(a,l),e())},flushIdle(i){r==="ESC"&&t.length===0&&i({raw:"\x1B"}),e()}}}function ze(r,t={}){let e=(0,ye.useRef)(r);e.current=r;let{stdin:i}=Le();(0,ye.useEffect)(()=>{if(t.isActive===!1||!i)return;let l=ht(),a=null,g=v=>{a&&(clearTimeout(a),a=null);let T=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");l.feed(T,d=>e.current(d)),a=setTimeout(()=>{l.flushIdle(d=>e.current(d)),a=null},50)};return i.on("data",g),()=>{i.removeListener("data",g),a&&clearTimeout(a)}},[t.isActive,i])}var E=O(Z(),1);function gt(r,t){let e=t-1;for(;e>=0&&r[e]!=="@"&&r[e]!==" "&&r[e]!==`
|
|
4
4
|
`;)e--;return e<0||r[e]!=="@"||e>0&&r[e-1]!==" "&&r[e-1]!==`
|
|
5
5
|
`?null:{at:e,query:r.slice(e+1,t).join("")}}var Pe=10;function pt(r){return r.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as D}from"./chunk-
|
|
2
|
+
import{a as D}from"./chunk-WGYUOXJX.js";import{a as A}from"./chunk-BDMQY6N6.js";import{p as S,q as C,r as P,s as U,t as N}from"./chunk-X6FNT3EY.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 A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-F22NYY2I.js";import{a as k}from"./chunk-LPUQ4HWQ.js";import{a as B}from"./chunk-5WMT2WVI.js";import{a as R}from"./chunk-XT45Z36Q.js";import{x as c}from"./chunk-X6FNT3EY.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-FPFOW6BS.js";import{g as a}from"./chunk-LOIRZFV3.js";import{a as m}from"./chunk-LPUQ4HWQ.js";import{a as h}from"./chunk-
|
|
2
|
+
import{a as k}from"./chunk-FPFOW6BS.js";import{g as a}from"./chunk-LOIRZFV3.js";import{a as m}from"./chunk-LPUQ4HWQ.js";import{a as h}from"./chunk-WGYUOXJX.js";import{a as y}from"./chunk-5WMT2WVI.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
|
|
3
3
|
`)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function b(t,e,r=n=>process.stdout.write(`${n}
|
|
4
|
-
`)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-
|
|
4
|
+
`)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-TPRQLK6B.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
|
|
5
5
|
`,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
|
|
6
6
|
`,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
|
|
7
7
|
`,exitCode:2}}}function O(t){return{id:t.project_id,name:t.name}}function M(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function _(t,e=r=>process.stdout.write(`${r}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as K,c as V,d as z,e as ee,f as te}from"./chunk-
|
|
2
|
+
import{b as K,c as V,d as z,e as ee,f as te}from"./chunk-SDY6K7ZR.js";import{c as J}from"./chunk-EWID6VQA.js";import{a as Q}from"./chunk-73TFORTS.js";import{a as Z}from"./chunk-FPFOW6BS.js";import{b as H}from"./chunk-EQLDX5LN.js";import{b as W}from"./chunk-T4WDQ7I4.js";import{g as E}from"./chunk-LOIRZFV3.js";import{a as O}from"./chunk-LPUQ4HWQ.js";import{a as k,b as A,d as Y}from"./chunk-VE3SUJMA.js";import{a as q}from"./chunk-WGYUOXJX.js";import{a as _}from"./chunk-5WMT2WVI.js";import{a as G}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as X}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var i=F(ue(),1);var r=F(G(),1);function _e({resultRef:h,mode:d="singleshot",loginCompleteRef:f}){let{exit:m}=X(),C=(0,i.useRef)(new q),S=(0,i.useRef)(new Q),v=(0,i.useRef)(new J),t=C.current,l=S.current,$=v.current,ne=K(),[P,g]=(0,i.useState)(d==="login"?"login":"gate"),[L,re]=(0,i.useState)(null),[de,R]=(0,i.useState)(null),[ge,T]=(0,i.useState)(null),[N,oe]=(0,i.useState)(null),[U,B]=(0,i.useState)([]),x=(0,i.useCallback)((e,n,s,o)=>$.log(e,n,s,o),[$]),pe=(0,i.useCallback)((e,n)=>{e?k(t,l,e,n):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[t,l]),y=(0,i.useCallback)(()=>{d==="login"?(f&&(f.current=!0),m()):g("input")},[d,m,f]),D=(0,i.useCallback)((e,n)=>{let s=k(t,l,e,n);if(d==="login"){g("ensure-project");return}Y(s)?y():s.projectId?g("ensure-folder"):g("ensure-project")},[t,l,y,d]);I((e,n)=>{n.ctrl&&e==="c"&&E(0,"Ctrl+C exit")});let M=(0,i.useRef)(!1);i.default.useEffect(()=>{M.current||(M.current=!0,d!=="login"&&te(t,x).then(e=>{re(e),e.status==="authenticated"?D(e.result.profile,e.result.env):e.status==="needs_pick"?g("pick"):(R(e.profile??null),T(e.env??null),g("login"))}).catch(e=>{oe(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[t,x]);let ie=(0,i.useCallback)(e=>{h.current={objective:e},m()},[h,m]),se=(0,i.useCallback)(async(e,n)=>{t.setActiveProfile(e),t.setDefaultEnv(n),(await ee(t,e,n,x)).status==="authenticated"?D(e,n):(R(e),T(n),g("login"))},[t,x,D]),w=(0,i.useCallback)(()=>{let e=t.getActiveProfile(),n=t.getDefaultEnv();if(!e)return null;let s=_(n),o=t.loadBasicAuth(e,n);return new Z(s.controllerBaseUrl,async()=>t.loadCredentials(e,n)?.access_token??null,o,x)},[t,x]),le=(0,i.useCallback)(async()=>{let e=w();if(!e)return null;let n=e.cached??await e.resolve();if(!n)return null;let s=_(t.getDefaultEnv()),o=new O(s.tmsBaseUrl,n.username,n.access_key);try{let p=(await o.listProjects()).find(b=>b.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let j=await o.createProject("KaneAI Generated");return{id:j.id,name:j.name}}catch{return null}},[w,t]),ae=(0,i.useCallback)(async e=>{let n=w();if(!n)return null;let s=n.cached??await n.resolve();if(!s)return null;let o=_(t.getDefaultEnv()),a=new O(o.tmsBaseUrl,s.username,s.access_key);try{let j=(await a.listFolders(e)).find(ce=>ce.name==="Untitled");if(j)return{id:j.id,name:j.name};let b=await a.createFolder(e,"Untitled");return{id:b.id,name:b.name}}catch{return null}},[w,t]);if(P==="gate")return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(N)return(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"red",children:N}),(0,r.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(P==="pick"&&L?.status==="needs_pick")return(0,r.jsx)(fe,{profiles:L.profiles,onSelect:se});if(P==="login")return(0,r.jsx)(z,{devMode:process.env.KANE_DEV_MODE==="1",profiles:t.listProfiles(),onBasicLogin:async(e,n,s,o)=>{let{validateBasicAuth:a}=await import("./validate-basic-F6DP3VUX.js");await a(n,s,o),t.saveBasicAuth(e,n,{username:s,access_key:o}),t.setActiveProfile(e),t.setDefaultEnv(n)},onOAuthLogin:async(e,n)=>{let{LoginFlow:s}=await import("./login-flow-GLIUZ3XD.js");t.setDefaultEnv(n),t.setActiveProfile(e),await new s(e,n,t).login()},onComplete:(e,n)=>{R(e),T(n),t.setActiveProfile(e),t.setDefaultEnv(n),D(e,n)},onCancel:()=>{E(0,"Login cancelled")}});if(P==="ensure-project"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=()=>{if(d==="login"){g("ensure-folder");return}k(t,l,e,n).folderId?y():g("ensure-folder")};return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(H,{resolver:w(),currentProjectId:l.load().project_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{projectId:o,projectName:a}),B(p=>[...p,`\u2713 Project: ${a} (${o})`]),s()},onCancel:async()=>{let o=await le();o&&(A(t,l,e,n,{projectId:o.id,projectName:o.name}),B(a=>[...a,`\u2713 Default project: ${o.name} (${o.id})`]),s())}})]})}if(P==="ensure-folder"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=t.loadProfileConfig(e,n);return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(W,{resolver:w(),projectId:s?.project_id??"",currentFolderId:l.load().folder_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{folderId:o,folderName:a}),B(p=>[...p,`\u2713 Folder: ${a} (${o})`]),y()},onCancel:async()=>{if(!s?.project_id)return;let o=await ae(s.project_id);o&&(A(t,l,e,n,{folderId:o.id,folderName:o.name}),B(a=>[...a,`\u2713 Default folder: ${o.name} (${o.id})`]),y())}})]})}return P==="input"?(0,r.jsxs)(c,{flexDirection:"column",children:[U.length>0&&(0,r.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:U.map((e,n)=>(0,r.jsx)(u,{color:"green",children:e},n))}),(0,r.jsx)(V,{onSubmit:ie,onEscape:()=>E(0,"User pressed Escape"),history:ne,placeholder:"Type an objective..."})]}):(0,r.jsx)(r.Fragment,{})}function fe({profiles:h,onSelect:d}){let[f,m]=(0,i.useState)(0),[C,S]=(0,i.useState)(!1);return I((v,t)=>{if(!C){if(t.escape){E(0,"Profile picker cancelled");return}if(t.upArrow&&f>0&&m(l=>l-1),t.downArrow&&f<h.length-1&&m(l=>l+1),t.return){S(!0);let l=h[f];d(l.profile,l.env).catch(()=>S(!1))}}}),(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,r.jsx)(c,{marginTop:1,flexDirection:"column",children:h.map((v,t)=>(0,r.jsxs)(u,{children:[t===f?"\u276F ":" ",(0,r.jsx)(u,{color:t===f?"#ff9500":"white",bold:t===f,children:v.profile}),(0,r.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),C&&(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{_e as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as g}from"./chunk-
|
|
2
|
+
import{c as g}from"./chunk-X6FNT3EY.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
|
|
3
3
|
`),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
|
|
4
4
|
`),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
|
|
5
5
|
`)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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.
|
|
2
|
+
import{homedir as e}from"os";import{join as t}from"path";var m="0.4.5",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};
|