@testmuai/kane-cli 0.4.0 → 0.4.2
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-27QCT4NT.js → ChromeProfilePicker-HNP7QQ4J.js} +1 -1
- package/dist/{CliFeedbackPrompt-LMXDRY5F.js → CliFeedbackPrompt-OSNATI4W.js} +1 -1
- package/dist/{CliUploadProgress-QP5SPC7G.js → CliUploadProgress-7HRWDZ4P.js} +1 -1
- package/dist/ConfigView-PQH67FUK.js +2 -0
- package/dist/FolderPicker-SET7IG6S.js +2 -0
- package/dist/HelpView-HFKFRKG3.js +2 -0
- package/dist/{InfoBox-JELKGWY5.js → InfoBox-3IN3IZ2I.js} +1 -1
- package/dist/{LinksBox-NUSUOUIW.js → LinksBox-DI5QKX6K.js} +1 -1
- package/dist/{ProfilesView-RXYI2IS3.js → ProfilesView-N6XNSUHQ.js} +1 -1
- package/dist/ProjectPicker-6QIVHOO7.js +2 -0
- package/dist/{SaveSessionPrompt-GUBVAQ3O.js → SaveSessionPrompt-7CZHPNYK.js} +1 -1
- package/dist/SingleShotApp-A4VXMXEZ.js +2 -0
- package/dist/{SummaryBox-5Y2YYOUM.js → SummaryBox-7ZK2A6MA.js} +1 -1
- package/dist/TestMdRunView-KGHEZZBK.js +2 -0
- package/dist/WhoamiView-3E447A3G.js +2 -0
- package/dist/{changelog-N4SSER5V.js → changelog-ZBTZCYKI.js} +1 -1
- package/dist/chunk-34YRU7WM.js +6 -0
- package/dist/chunk-3QWAABMG.js +2 -0
- package/dist/{chunk-CKY3UXTY.js → chunk-4UKCDU64.js} +1 -1
- package/dist/{chunk-PWHFNSDC.js → chunk-4ZHU4DLD.js} +1 -1
- package/dist/{chunk-5TOE4RHH.js → chunk-7CBWZLRS.js} +1 -1
- package/dist/{chunk-PKQJHIKJ.js → chunk-AAJSF67A.js} +1 -1
- package/dist/{chunk-JCR3T34A.js → chunk-AKKATURY.js} +2 -2
- package/dist/chunk-BM25JQ3Z.js +17 -0
- package/dist/chunk-C6S4IEBC.js +2 -0
- package/dist/{chunk-TAEW7PXN.js → chunk-CZBHDBID.js} +1 -1
- package/dist/chunk-DGUXTSHM.js +11 -0
- package/dist/chunk-DQASLGFG.js +60 -0
- package/dist/{chunk-6NEJEMA6.js → chunk-EEF6OT52.js} +1 -1
- package/dist/{chunk-LMV2F35W.js → chunk-ELZIC2EH.js} +1 -1
- package/dist/chunk-FFTIDI5K.js +5 -0
- package/dist/chunk-FPFOW6BS.js +2 -0
- package/dist/{chunk-AT2Y5UNP.js → chunk-GNJBT6SS.js} +1 -1
- package/dist/{chunk-UJZCMEEH.js → chunk-H2P7UJAU.js} +1 -1
- package/dist/chunk-K4PLPKPF.js +5 -0
- package/dist/{chunk-7RPMUEEN.js → chunk-KPF3BPJ5.js} +1 -1
- package/dist/chunk-LOIRZFV3.js +10 -0
- package/dist/{chunk-O2UU4TS5.js → chunk-LOSNFBZV.js} +1 -1
- package/dist/chunk-LPUQ4HWQ.js +2 -0
- package/dist/chunk-LY5LHKGG.js +18 -0
- package/dist/chunk-NKFXY5TF.js +22 -0
- package/dist/chunk-OISHNB7D.js +2 -0
- package/dist/chunk-PF7PBYCJ.js +5 -0
- package/dist/{chunk-VS2BXLH4.js → chunk-PQIPYWTP.js} +1 -1
- package/dist/chunk-QXVI3LI4.js +6 -0
- package/dist/{chunk-CGAX3AXA.js → chunk-R7T6Z6QW.js} +1 -1
- package/dist/chunk-RCL22HDJ.js +2 -0
- package/dist/{chunk-XQXSPUIX.js → chunk-RD6G3CMN.js} +1 -1
- package/dist/chunk-RLSBAT6P.js +2 -0
- package/dist/chunk-S7JV4A3U.js +2 -0
- package/dist/{chunk-IH45REQA.js → chunk-TQGNNJX5.js} +1 -1
- package/dist/{chunk-VTDVK3DK.js → chunk-UHGECBEN.js} +1 -1
- package/dist/chunk-VBZIIF5N.js +17 -0
- package/dist/chunk-VL57GII7.js +2 -0
- package/dist/chunk-WFSTRBQF.js +2 -0
- package/dist/chunk-Y6IUJZMV.js +2 -0
- package/dist/{chunk-HYVAYSRZ.js → chunk-YB67GRWE.js} +1 -1
- package/dist/exit-manager-V2NW7A7U.js +2 -0
- package/dist/generate-headless-WL6A6ACX.js +21 -0
- package/dist/index.js +41 -31
- package/dist/list-commands-MK4W3Q7O.js +2 -0
- package/dist/login-flow-CDR6ARK3.js +2 -0
- package/dist/{persist-recorded-session-VEFILVPX.js → persist-recorded-session-A5EJ25AE.js} +1 -1
- package/dist/{pipeline-3GVPCDRE.js → pipeline-L5TDZMLS.js} +1 -1
- package/dist/{recording-banner-WS4Y7LVH.js → recording-banner-6UI6NNRK.js} +1 -1
- package/dist/require-project-folder-J5WZR653.js +2 -0
- package/dist/resolver-IDCGRPFJ.js +2 -0
- package/dist/run-test-md-I76IV7QA.js +14 -0
- package/dist/scrollback-6GINSTL2.js +2 -0
- package/dist/skill-installer-ZLBRT4QP.js +3 -0
- package/dist/tcg-generate-R6P4QUGO.js +2 -0
- package/dist/testmd-actions-W2INQVTH.js +2 -0
- package/dist/{tms-client-R5ZIAOBH.js → tms-client-NNYXLXZK.js} +1 -1
- package/dist/token-refresh-4QLWR5ZI.js +2 -0
- package/dist/validate-basic-QUPVT2EV.js +2 -0
- package/dist/{version-check-LNKXGYZE.js → version-check-RVK5YKDZ.js} +1 -1
- package/package.json +8 -6
- package/dist/ConfigView-RQM2JY4K.js +0 -2
- package/dist/FolderPicker-YN2YQJXI.js +0 -2
- package/dist/HelpView-2IYG5AC3.js +0 -2
- package/dist/ProjectPicker-RUR7HH2P.js +0 -2
- package/dist/SingleShotApp-3XDTU2BU.js +0 -2
- package/dist/TestMdRunView-PPZPUVVZ.js +0 -2
- package/dist/WhoamiView-IJZUFJ7B.js +0 -2
- package/dist/chunk-3C7ATCDM.js +0 -2
- package/dist/chunk-3Z4EHIOW.js +0 -2
- package/dist/chunk-6IQWD272.js +0 -2
- package/dist/chunk-7CLUJYMW.js +0 -2
- package/dist/chunk-7G7ZLAJH.js +0 -5
- package/dist/chunk-BKXTOQWL.js +0 -5
- package/dist/chunk-BPF7TDRU.js +0 -2
- package/dist/chunk-DTFPHZE7.js +0 -62
- package/dist/chunk-H4XV224I.js +0 -6
- package/dist/chunk-H6OVTXJQ.js +0 -2
- package/dist/chunk-J37YPPCD.js +0 -2
- package/dist/chunk-JLOY7SNA.js +0 -14
- package/dist/chunk-L3RTVAPG.js +0 -6
- package/dist/chunk-LRF6UP42.js +0 -10
- package/dist/chunk-M5RHRHFC.js +0 -9
- package/dist/chunk-PN7LNQ7G.js +0 -5
- package/dist/chunk-SJ7VGRQU.js +0 -17
- package/dist/chunk-UVBDUDSL.js +0 -2
- package/dist/generate-headless-7UYAPXE5.js +0 -18
- package/dist/login-flow-LK7GAUCZ.js +0 -2
- package/dist/resolver-OA35IO7J.js +0 -2
- package/dist/run-test-md-SXZUOYSG.js +0 -14
- package/dist/tcg-generate-CEBFKKJE.js +0 -2
- package/dist/testmd-actions-IZPOBSTC.js +0 -2
- package/dist/validate-basic-Y73NBDAD.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk-NKFXY5TF.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-LOIRZFV3.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-PF7PBYCJ.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-LOSNFBZV.js";import"./chunk-PF7PBYCJ.js";import"./chunk-WFSTRBQF.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as _,g as h}from"./chunk-HN7DVSVI.js";import{a as m,b as I,j as S}from"./chunk-AH4AXJML.js";import"./chunk-L5LI2JF4.js";import{a as f}from"./chunk-
|
|
2
|
+
import{a as _,g as h}from"./chunk-HN7DVSVI.js";import{a as m,b as I,j as S}from"./chunk-AH4AXJML.js";import"./chunk-L5LI2JF4.js";import{a as f}from"./chunk-H2P7UJAU.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";function y(e,d={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),R=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:R,duration_s:l.reduce((n,D)=>n+(D.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",E=new f().load().code_export?.language==="javascript"?"javascript":"python",s=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:s,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:d.testcaseId,projectId:d.projectId,folderId:d.folderId,orgId:d.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:d.codeExportDir,codeExportLanguage:E}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:s}),S(s),e.log("info","PERSIST_OK","Persist complete",{output_dir:s})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:s}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
|
|
3
3
|
`)}return{recordedTestPath:o,outputDir:s}}export{y as persistRecordedSession};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-EEF6OT52.js";import"./chunk-MDBXYXSC.js";import"./chunk-WAOCHXJ5.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{a as UploadPipeline};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import{a as n}from"./chunk-3MSXQU2C.js";import"./chunk-UR6MHSHU.js";function p(t){let s=t.sessionName!==null,e={type:"recording_state",enabled:!0,session_id:t.sessionId,persist:s};return t.sessionName&&(e.session_name=t.sessionName),t.testPath&&(e.test_path=t.testPath),t.outputPath&&(e.output_path=t.outputPath),e}async function g(t){if(t.isAgent){process.stdout.write(JSON.stringify(p(t))+`
|
|
3
|
-
`);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-
|
|
3
|
+
`);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-3IN3IZ2I.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f}from"./chunk-VBZIIF5N.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,f as requireProjectFolder};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{a as AuthResolver,b as classifyAuthFailure};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{u as b,v as D,w as U,x as V,y as H}from"./chunk-DQASLGFG.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-EEF6OT52.js";import{a as L,b as T}from"./chunk-34YRU7WM.js";import{a as y,b as _}from"./chunk-RCL22HDJ.js";import"./chunk-MDBXYXSC.js";import"./chunk-S3DAAAE5.js";import{a as P}from"./chunk-HN7DVSVI.js";import"./chunk-AH4AXJML.js";import{c as x}from"./chunk-BM25JQ3Z.js";import"./chunk-L5LI2JF4.js";import{a as S}from"./chunk-H2P7UJAU.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-K4PLPKPF.js";import{d as E,e as C,f as k}from"./chunk-LOIRZFV3.js";import"./chunk-VBZIIF5N.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-Y6IUJZMV.js";import{a as h}from"./chunk-PF7PBYCJ.js";import"./chunk-WFSTRBQF.js";import{a as v}from"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";import{resolve as K}from"path";import{existsSync as $}from"fs";function A(a){let{isAgent:o,log:i}=a,c=e=>{o&&process.stdout.write(JSON.stringify(e)+`
|
|
3
|
+
`)};return{async runSteps(e){let{default:t}=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{TestMdRunView:s}=await import("./TestMdRunView-KGHEZZBK.js"),{ScrollbackProvider:m}=await import("./scrollback-6GINSTL2.js"),{waitUntilExit:l}=n(t.createElement(m,null,t.createElement(s,e)),{stdout:process.stderr,exitOnCtrlC:!1});await l()},async runUpload(e,t){let{renderUploadProgress:n}=await import("./CliUploadProgress-7HRWDZ4P.js");return await n(e,t)},async onSummary(e){try{let{default:t}=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:s}=await import("./SummaryBox-7ZK2A6MA.js"),{waitUntilExit:m}=n(t.createElement(s,{data:e}),{stdout:process.stderr});await m()}catch(t){i("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(t)})}},async onLinks(e){try{let{default:t}=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{LinksBox:s}=await import("./LinksBox-DI5QKX6K.js"),{waitUntilExit:m}=n(t.createElement(s,e),{stdout:process.stderr});await m()}catch(t){i("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(t)})}},onLockState(e){c({type:"test_md_lock_state",...e})},onRetryAttempt(e){c({type:"test_md_retry_attempt",...e})},onAgentEvent(e){c(e)}}}function M(){return{register:(a,o)=>E(a,o),deregister:a=>C(a),cleanup:(a,o)=>k(a,o),remoteLogger:null}}async function le(a,o){let i=K(a);if(!$(i))return process.stderr.write(`error: file not found: ${i}
|
|
4
|
+
`),2;L(i);let c=!process.stdin.isTTY||!!o.agent,e=M(),t;try{t=P(i)}catch(r){return process.stderr.write(`error: ${r.message}
|
|
5
|
+
`),2}if(t.steps.length===0)return process.stderr.write(`info: no steps in ${i}; nothing to run.
|
|
6
|
+
`),0;let n;try{n=Y(o)}catch(r){if(r instanceof d)return process.stderr.write(r.message),r.exitCode;throw r}let s=new h,m=new S,l=!!(o.username&&o.accessKey);await T({isInteractive:!!process.stdin.isTTY&&!o.agent&&!l,creds:s,config:m});let j=s.getActiveProfile()??"default",u=o.env??void 0??s.getDefaultEnv()??"prod",N=v(u),F="v16-alpha",f;try{f=await _({creds:s,env:u,usernameFlag:o.username,accessKeyFlag:o.accessKey,log:()=>{}})}catch(r){return r instanceof y&&r.code==="not_authenticated"?process.stderr.write(`error: Not authenticated. Choose one:
|
|
7
|
+
\u2022 Pass credentials inline: --username <user> --access-key <key>
|
|
8
|
+
\u2022 Run 'kane-cli login --oauth' (browser-based)
|
|
9
|
+
\u2022 Run 'kane-cli login --username <user> --access-key <key>'
|
|
10
|
+
`):r instanceof y&&r.code==="refresh_failed"?process.stderr.write(`error: Token refresh failed. Run 'kane-cli login' to re-authenticate.
|
|
11
|
+
`):process.stderr.write(`error: auth resolution failed: ${r.message}
|
|
12
|
+
`),2}let w=String(f.resolvedCreds?.org_id??"");if(!w)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:r,assertOrgMatchOrExit:g}=await import("./testmd-actions-W2INQVTH.js"),p=g(r(i),w);if(p!==null)return p}let R=new x,I=A({isAgent:c,log:(r,g,p,B)=>R.log(r,g,p,B)}),O={path:i,cwd:process.cwd(),opts:o,isAgent:c,resolved:t,resolvedAuth:f,cliOverrides:n,environment:u,envConfig:N,profile:j,model:F,creds:s,configStore:m,session:R};try{return(await b(O,I,e)).exitCode}catch(r){return process.stderr.write(`error: ${r.message}
|
|
13
|
+
`),2}}var d=class extends Error{constructor(i,c){super(i);this.exitCode=c;this.name="CliArgError"}};function Y(a){let o={mode:"mode",maxSteps:"max_steps",timeout:"timeout",globalContext:"global_context",localContext:"local_context",codeExport:"code_export",codeLanguage:"code_language",headless:"headless",cdpEndpoint:"cdp_endpoint",wsEndpoint:"ws_endpoint"},i=new Set(["max_steps","timeout"]),c={};for(let[e,t]of Object.entries(o)){let n=a[e];if(n===void 0||n==="")continue;let s=n;if(i.has(t)&&(s=Number(n),Number.isNaN(s))){let m="--"+e.replace(/[A-Z]/g,l=>"-"+l.toLowerCase());throw new d(`error: ${m} must be a number
|
|
14
|
+
`,2)}c[t]=s}return c}export{H as applyCliStepConfig,U as buildStepRunVariables,D as buildTestLevelVariables,V as replayVariablesForStep,le as runTestMdFile};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-C6S4IEBC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as ScrollbackProvider,b as useScrollback};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as p,b as g}from"./chunk-RLSBAT6P.js";import{b as m}from"./chunk-KPF3BPJ5.js";import"./chunk-PF7PBYCJ.js";import"./chunk-S7JV4A3U.js";import{a as d}from"./chunk-RZ4F3BHX.js";import{a as f,g as a,h as u}from"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
|
|
3
|
+
`),e++}catch{}return e===0?{status:"failed",version:r,installedTargets:0,error:"Could not write to any agent skill directory"}:{status:"installed",version:r,installedTargets:e}}catch(e){return{status:"failed",version:r,installedTargets:0,error:e instanceof Error?e.message:String(e)}}finally{if(n)try{c(n,{force:!0})}catch{}if(i)try{c(i,{recursive:!0,force:!0})}catch{}}}function D(t){switch(t.status){case"installed":return`Installed kane-cli skill v${t.version} (${t.installedTargets}/${u.length} agent dirs). Restart your AI agent (Claude Code / Codex CLI / Gemini CLI) to load it.`;case"already-installed":return`kane-cli skill v${t.version} already installed.`;case"failed":return`Failed to install kane-cli skill: ${t.error??"unknown error"}`}}export{D as formatInstallResult,W as installSkill,L as targetNeedsInstall};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as a}from"./chunk-LY5LHKGG.js";import"./chunk-QXVI3LI4.js";import"./chunk-3MSXQU2C.js";import"./chunk-OISHNB7D.js";import"./chunk-DQASLGFG.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-EEF6OT52.js";import"./chunk-AKKATURY.js";import"./chunk-34YRU7WM.js";import"./chunk-RCL22HDJ.js";import"./chunk-MDBXYXSC.js";import"./chunk-R7T6Z6QW.js";import"./chunk-S3DAAAE5.js";import"./chunk-HN7DVSVI.js";import"./chunk-AH4AXJML.js";import"./chunk-DGUXTSHM.js";import"./chunk-BM25JQ3Z.js";import"./chunk-L5LI2JF4.js";import"./chunk-H2P7UJAU.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-FFTIDI5K.js";import"./chunk-K4PLPKPF.js";import"./chunk-VL57GII7.js";import"./chunk-PQIPYWTP.js";import"./chunk-TQGNNJX5.js";import"./chunk-RD6G3CMN.js";import"./chunk-4ZHU4DLD.js";import"./chunk-4UKCDU64.js";import"./chunk-YCCUBQY4.js";import"./chunk-CZBHDBID.js";import"./chunk-LOIRZFV3.js";import"./chunk-VBZIIF5N.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-Y6IUJZMV.js";import"./chunk-LOSNFBZV.js";import"./chunk-PF7PBYCJ.js";import"./chunk-WFSTRBQF.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-7CBWZLRS.js";import"./chunk-UHGECBEN.js";import{a as o}from"./chunk-C6S4IEBC.js";import"./chunk-ELZIC2EH.js";import"./chunk-YB67GRWE.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k}from"./chunk-AKKATURY.js";import"./chunk-34YRU7WM.js";import"./chunk-RCL22HDJ.js";import"./chunk-MDBXYXSC.js";import"./chunk-AH4AXJML.js";import"./chunk-H2P7UJAU.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-CZBHDBID.js";import"./chunk-LOIRZFV3.js";import"./chunk-NLCCBXXV.js";import"./chunk-Y6IUJZMV.js";import"./chunk-PF7PBYCJ.js";import"./chunk-WFSTRBQF.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{a as TmsClient};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-Y6IUJZMV.js";import"./chunk-WFSTRBQF.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as t}from"./chunk-S7JV4A3U.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-KPF3BPJ5.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3QWAABMG.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testmuai/kane-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "KaneAI Terminal UI — browser automation testing agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,15 +18,17 @@
|
|
|
18
18
|
"chalk": "^5.3.0",
|
|
19
19
|
"commander": "^12.0.0",
|
|
20
20
|
"ink": "^5.1.0",
|
|
21
|
+
"js-yaml": "^4.1.1",
|
|
21
22
|
"open": "^10.1.0",
|
|
22
23
|
"react": "^18.3.1",
|
|
23
|
-
"
|
|
24
|
+
"ws": "^8.20.0"
|
|
24
25
|
},
|
|
25
26
|
"optionalDependencies": {
|
|
26
|
-
"@testmuai/kane-cli-darwin-arm64": "0.4.
|
|
27
|
-
"@testmuai/kane-cli-darwin-x64": "0.4.
|
|
28
|
-
"@testmuai/kane-cli-linux-x64": "0.4.
|
|
29
|
-
"@testmuai/kane-cli-win-x64": "0.4.
|
|
27
|
+
"@testmuai/kane-cli-darwin-arm64": "0.4.2",
|
|
28
|
+
"@testmuai/kane-cli-darwin-x64": "0.4.2",
|
|
29
|
+
"@testmuai/kane-cli-linux-x64": "0.4.2",
|
|
30
|
+
"@testmuai/kane-cli-win-x64": "0.4.2",
|
|
31
|
+
"sharp": "^0.34.5"
|
|
30
32
|
},
|
|
31
33
|
"publishConfig": {
|
|
32
34
|
"registry": "https://registry.npmjs.org",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m,b as l,c as r}from"./chunk-VTDVK3DK.js";import{a as f}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-3Z4EHIOW.js";import{a as t,j as u}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var d=n(C(),1);var e=n(f(),1);function D({model:c,authLabel:s,profile:g,env:p,defaultUrl:i,projectId:b,folderId:v,windowSize:x,chromeProfile:w}){let{exit:a}=u();return(0,d.useEffect)(()=>{let B=setTimeout(()=>a(),50);return()=>clearTimeout(B)},[a]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(m,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:s}),(0,e.jsx)(l,{label:" profile",value:g}),(0,e.jsx)(l,{label:" env",value:p}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:i??"(none)",valueColor:i?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:c}),(0,e.jsx)(l,{label:" window",value:x}),(0,e.jsx)(l,{label:" project",value:b??"(none)"}),(0,e.jsx)(l,{label:" folder",value:v??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:w,valueColor:o.dim})]})})})}export{D as ConfigView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-CKY3UXTY.js";import"./chunk-YCCUBQY4.js";import"./chunk-TAEW7PXN.js";import"./chunk-J37YPPCD.js";import"./chunk-AT2Y5UNP.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-7CLUJYMW.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as T}from"./chunk-HCBYKLMW.js";import{a as f,b as i,t}from"./chunk-3Z4EHIOW.js";import{a as n,b as o,j as p,k as x}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(b(),1);var e=h(T(),1),S="https://www.testmuai.com/support/docs/kane-cli-introduction",v="https://github.com/LambdaTest/kane-cli/issues";function k(){let{exit:l}=p(),{stdout:r}=x(),c=r?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>l(),50);return()=>clearTimeout(m)},[l]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:i}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dim,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(g,{cmd:`${i}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${i} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${i} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${i} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${i} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${i} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{cmd:`${i} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(n,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,children:["Terminal tab-completion is a shell feature; ",i," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",i,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(a,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(a,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(a,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(a,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(a,{cmd:"config",args:"show|set-\u2026|reset",desc:"Manage configuration"}),(0,e.jsx)(a,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(a,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(a,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(a,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(a,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(a,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(a,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(s,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(s,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(s,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(s,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(s,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(s,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(s,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(s,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(s,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(s,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(s,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(s,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(s,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(s,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(s,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(s,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(s,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(s,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(s,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(s,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${i} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${i} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${i} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${i} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[i," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",i," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(c-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:v})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:l,children:r}){return(0,e.jsxs)(n,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(n,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dim,children:l})}),r]})}function g({cmd:l,desc:r,highlight:c}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:c?t.orange:t.orange,children:l})]}),(0,e.jsx)(o,{color:t.dim,children:r})]})}function a({cmd:l,args:r,desc:c,highlight:m}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:l})}),(0,e.jsx)(n,{width:32,children:r?(0,e.jsx)(o,{color:t.dim,children:r}):null}),(0,e.jsx)(o,{color:t.dim,children:c})]})}function s({long:l,arg:r,desc:c,highlight:m}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:l}),r&&(0,e.jsxs)(o,{color:t.dim,children:[" ",r]})]}),(0,e.jsx)(o,{color:t.dim,children:c})]})}function u({label:l,cmd:r}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",l]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",r]})]})}export{k as HelpView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-PWHFNSDC.js";import"./chunk-YCCUBQY4.js";import"./chunk-TAEW7PXN.js";import"./chunk-J37YPPCD.js";import"./chunk-AT2Y5UNP.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-7CLUJYMW.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-PKQJHIKJ.js";import"./chunk-M5RHRHFC.js";import"./chunk-SJ7VGRQU.js";import"./chunk-L5LI2JF4.js";import"./chunk-UJZCMEEH.js";import"./chunk-LRF6UP42.js";import"./chunk-PWHFNSDC.js";import"./chunk-CKY3UXTY.js";import"./chunk-YCCUBQY4.js";import"./chunk-TAEW7PXN.js";import"./chunk-VE3SUJMA.js";import"./chunk-7G7ZLAJH.js";import"./chunk-BPF7TDRU.js";import"./chunk-WAOCHXJ5.js";import"./chunk-J37YPPCD.js";import"./chunk-AT2Y5UNP.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-7CLUJYMW.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{h as a}from"./chunk-BKXTOQWL.js";import"./chunk-PN7LNQ7G.js";import"./chunk-VS2BXLH4.js";import"./chunk-LRF6UP42.js";import"./chunk-J37YPPCD.js";import"./chunk-5TOE4RHH.js";import"./chunk-VTDVK3DK.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s,b as o}from"./chunk-VTDVK3DK.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-3Z4EHIOW.js";import{a as r,b as n,j as u}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:c,tokenStatus:l,expiresAt:m}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),c&&(0,e.jsx)(o,{label:"User",value:c}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dim}),m&&(0,e.jsx)(o,{label:"Expires",value:m})]})]})})})}export{R as WhoamiView};
|
package/dist/chunk-3C7ATCDM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f}from"./chunk-7G7ZLAJH.js";import{a as h}from"./chunk-BPF7TDRU.js";import{a as d}from"./chunk-J37YPPCD.js";var c=class extends Error{constructor(i,s){super(i);this.code=s;this.name="AuthError"}};async function v(r){let o=r.credentials.expires_at,i=r.thresholdSeconds??300;if(o-Date.now()/1e3>=i)return null;let s=r.creds.loadClient(r.profile,r.env);if(!s)return null;let e=await new f(r.env).refreshToken(r.credentials.refresh_token,s.client_id),t=Math.floor(Date.now()/1e3)+e.expires_in;return r.creds.saveCredentials(r.profile,r.env,{access_token:e.access_token,refresh_token:e.refresh_token,expires_at:t,scope:e.scope}),{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:t,scope:e.scope}}async function j(r){let{creds:o,env:i,usernameFlag:s,accessKeyFlag:m,log:e}=r,t=null,u=null;if(s&&m)t={username:s,access_key:m},e("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:s});else{let n=o.resolveAuth();n?.method==="basic"&&(t={username:n.username,access_key:n.access_key},e("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:n.username}))}if(!t){let{credentials:n,profile:E}=o.getActiveCredentials();if(!n)throw new c("Not authenticated \u2014 no credentials found","not_authenticated");if(u=n.access_token,n.expires_at-Date.now()/1e3<300)try{let a=await v({creds:o,profile:E,env:i,credentials:n});a&&(u=a.accessToken,e("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(a){let g=a instanceof Error?a.message:String(a);throw e("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:g}),new c(`Token refresh failed: ${g}`,"refresh_failed")}}let b=d(i),y=async()=>u,x=t?{username:t.username,access_key:t.access_key}:null,p=new h(b.controllerBaseUrl,y,x,e),l=await p.resolve();return l&&!t&&(t={username:l.username,access_key:l.access_key},e("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:l.username})),{basicAuth:t,token:u,resolver:p,resolvedCreds:l}}export{v as a,c as b,j as c};
|
package/dist/chunk-3Z4EHIOW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{homedir as s}from"os";import{join as t}from"path";var c="0.4.0",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",g="https://dd-proxy.lambdatest.com/intake/kane-cli",U="https://kaneai-playground.lambdatest.io",b=9222,_=9230,u=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,A=18400,o="/callback";function R(a){return`http://${r}:${a}${o}`}var L="KANE CLI",B="*",C={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",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"}},E={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{c as a,l as b,e as c,i as d,d as e,h as f,g,U as h,b as i,_ as j,u as k,r as l,x as m,A as n,o,R as p,L as q,B as r,C as s,E as t};
|
package/dist/chunk-6IQWD272.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f}from"./chunk-VS2BXLH4.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-3Z4EHIOW.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};
|
package/dist/chunk-7CLUJYMW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as h}from"./chunk-NLCCBXXV.js";import{a as n}from"./chunk-RZ4F3BHX.js";var f=class extends h{constructor(e,t,s){super(e,{username:t,accessKey:s})}async listProjects(e){let t=[],s=!1;for await(let r of this.listProjectsStream({log:e})){if(e&&!s&&r.projects.length>0){let o=r.projects[0];e("info","PROJECT_SAMPLE","Project list sample",{project_id:o.project_id,name:o.name}),s=!0}t.push(...r.projects)}return t}async*listProjectsStream(e){let t=e?.perPage??200,s=e?.maxPages??100,r=e?.signal,o=e?.log,c=e?.name?.trim(),i=0;for(let a=1;a<=s;a++){if(r?.aborted)return;let g=`${this.baseUrl}/v1/projects?page=${a}&per_page=${t}&sort=created_at`;c&&(g+=`&filter[name]=${encodeURIComponent(c)}`);let p=AbortSignal.timeout(15e3),b=r?AbortSignal.any([r,p]):p,d;try{d=await n(g,{method:"GET",headers:this.headers(),signal:b})}catch(l){if(r?.aborted)return;if(a===1)throw l;o?.("warn","PROJECTS_STREAM_PARTIAL","stream stopped mid-page",{page:a,total_loaded:i,error:l instanceof Error?l.message:String(l)}),yield{page:a,projects:[],totalLoaded:i,done:!0};return}if(!d.ok){if(a===1)throw new Error(`listProjects ${d.status}: ${await d.text()}`);o?.("warn","PROJECTS_STREAM_PARTIAL","stream stopped on non-OK response",{page:a,status:d.status,total_loaded:i}),yield{page:a,projects:[],totalLoaded:i,done:!0};return}let m=(await d.json()).data??[];i+=m.length;let u=m.length<t;if(yield{page:a,projects:m,totalLoaded:i,done:u},u)return}o?.("warn","PROJECTS_STREAM_MAXPAGES","max pages reached",{max_pages:s,total_loaded:i}),yield{page:s,projects:[],totalLoaded:i,done:!0}}async getDefaultFolder(e){let t=await n(`${this.baseUrl}/v1/projects/${e}/folder/default`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`Get default folder failed: ${t.status} ${await t.text()}`);return(await t.json()).id}async listFolders(e){let t=await n(`${this.baseUrl}/v1/folder/entity/${e}`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`List folders failed: ${t.status} ${await t.text()}`);return(await t.json()).data??[]}async createProject(e){let t=await n(`${this.baseUrl}/v1/projects`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({name:e,description:"",tags:[],source:"KTM"})});if(!t.ok)throw new Error(`Create project failed: ${t.status} ${await t.text()}`);return{id:(await t.json()).id,name:e}}async createFolder(e,t){let s=await n(`${this.baseUrl}/v1/folder`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({folders:[{name:t,description:"",entity_id:e,entity_type:"project"}]})});if(!s.ok)throw new Error(`Create folder failed: ${s.status} ${await s.text()}`);return{id:(await s.json()).id,name:t}}async createAtmTest(e,t){let s=t?`Bearer ${t}`:this.authHeader,r=await n(`${this.baseUrl}/kane-cli/v1/test`,{method:"POST",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Create ATM test failed: ${r.status} ${await r.text()}`);let o=await r.json();if(!o.test_id)throw new Error("Create ATM test returned no test_id");return o.test_id}async endTest(e,t,s){let r=s?`Bearer ${s}`:this.authHeader,o=new URLSearchParams({commit_id:t.commit_id,time_taken:String(t.time_taken),steps_count:String(t.steps_count),commit_message:t.commit_message}),c={};t.objectives&&t.objectives.length>0&&(c.objectives=t.objectives);let i=await n(`${this.baseUrl}/kane-cli/v1/test/${e}?${o.toString()}`,{method:"DELETE",headers:{Authorization:r,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(c)});if(!i.ok)throw new Error(`End test failed: ${i.status} ${await i.text()}`);let a=await i.json();return{testcase_id:a.data?.testcase_id??"",test_id:a.data?.test_id??e,project_id:a.data?.project_id??""}}async submitFeedback(e,t){let s=t?`Bearer ${t}`:this.authHeader,r={instruction_id:e.instruction_id,test_id:e.test_id,feedback_type:e.feedback_type,mode:e.mode??"human"};e.details&&(r.details=e.details);let o=await n(`${this.baseUrl}/atm/v1/generative-feedback`,{method:"POST",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Submit feedback failed: ${o.status} ${await o.text()}`);return await o.json()}};export{f as a};
|
package/dist/chunk-7G7ZLAJH.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-J37YPPCD.js";import{c as h,q as u,r as d}from"./chunk-3Z4EHIOW.js";import{a}from"./chunk-RZ4F3BHX.js";import{readFileSync as c,writeFileSync as p,mkdirSync as y,readdirSync as l,unlinkSync as s,existsSync as g,chmodSync as v}from"fs";import{join as n,dirname as S}from"path";var m=class{baseDir;profilesDir;configFile;constructor(t=h){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(c(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){y(this.baseDir,{recursive:!0,mode:448}),p(this.configFile,JSON.stringify(t,null,2)+`
|
|
3
|
-
`),v(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let r=this.readConfig();r.active_profile=t,this.writeConfig(r)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let r=this.readConfig();r.default_env=t,this.writeConfig(r)}credentialsPath(t,r){return n(this.profilesDir,t,r,"credentials")}clientPath(t,r){return n(this.profilesDir,t,r,"client.json")}basicAuthPath(t,r){return n(this.profilesDir,t,r,"basic-auth")}profileConfigPath(t,r){return n(this.profilesDir,t,r,"profile-config.json")}saveProfileConfig(t,r,e){let i=this.loadProfileConfig(t,r)??{};this.writeSecure(this.profileConfigPath(t,r),{...i,...e})}loadProfileConfig(t,r){try{return JSON.parse(c(this.profileConfigPath(t,r),"utf-8"))}catch{return null}}writeSecure(t,r){try{y(S(t),{recursive:!0,mode:448}),p(t,JSON.stringify(r,null,2)+`
|
|
4
|
-
`),v(t,384)}catch(e){let i=e instanceof Error?e.message:String(e);process.stderr.write(`[auth] Failed to save credentials: ${i}
|
|
5
|
-
`)}}saveCredentials(t,r,e){this.writeSecure(this.credentialsPath(t,r),e)}loadCredentials(t,r){try{return JSON.parse(c(this.credentialsPath(t,r),"utf-8"))}catch{return null}}saveClient(t,r,e){this.writeSecure(this.clientPath(t,r),e)}loadClient(t,r){try{return JSON.parse(c(this.clientPath(t,r),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let r=this.getDefaultEnv();return{credentials:this.loadCredentials(t,r),profile:t,env:r}}saveBasicAuth(t,r,e){this.writeSecure(this.basicAuthPath(t,r),e)}loadBasicAuth(t,r){try{return JSON.parse(c(this.basicAuthPath(t,r),"utf-8"))}catch{return null}}deleteBasicAuth(t,r){try{s(this.basicAuthPath(t,r))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let r=this.getDefaultEnv(),e=this.loadBasicAuth(t,r);return e?{method:"basic",...e,profile:t,env:r}:this.loadCredentials(t,r)?{method:"oauth",profile:t,env:r}:null}listProfiles(){let t=[];try{for(let r of l(this.profilesDir)){let e=n(this.profilesDir,r);try{for(let i of l(e)){let o=n(e,i),w=g(n(o,"credentials")),k=g(n(o,"client.json")),C=g(n(o,"basic-auth"));(w||k||C)&&t.push({profile:r,env:i})}}catch{}}}catch{}return t}deleteProfile(t,r){try{s(this.credentialsPath(t,r))}catch{}if(this.getActiveProfile()===t){let e=this.readConfig();delete e.active_profile,this.writeConfig(e)}}deleteProfileFull(t,r){if(r){try{s(this.credentialsPath(t,r))}catch{}try{s(this.clientPath(t,r))}catch{}try{s(this.basicAuthPath(t,r))}catch{}try{s(this.profileConfigPath(t,r))}catch{}}else try{let e=n(this.profilesDir,t);for(let i of l(e)){try{s(n(e,i,"credentials"))}catch{}try{s(n(e,i,"client.json"))}catch{}try{s(n(e,i,"basic-auth"))}catch{}try{s(n(e,i,"profile-config.json"))}catch{}}}catch{}}};import{createHash as A,randomBytes as b}from"crypto";var _=class{authBaseUrl;consentUrl;constructor(t="prod"){let r=f(t);this.authBaseUrl=r.authBaseUrl,this.consentUrl=r.consentUrl}static generatePkce(){let t=b(96).toString("base64url").slice(0,128),r=A("sha256").update(t).digest("base64url");return[t,r]}buildAuthorizationUrl(t,r,e,i){let o=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:i,scope:d,code_challenge:r,code_challenge_method:"S256",state:e});return`${this.consentUrl}/oauth2?${o.toString()}`}async registerClient(t){let r=await a(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:u,redirect_uris:[t],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!r.ok)throw new Error(`DCR failed: ${r.status} ${await r.text()}`);return r.json()}async exchangeCode(t,r,e,i){let o=await a(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:e})});if(!o.ok)throw new Error(`Token exchange failed: ${o.status}`);return o.json()}async refreshToken(t,r){let e=await a(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:r})});if(!e.ok)throw new Error(`Token refresh failed: ${e.status}`);return e.json()}async revokeToken(t,r,e="access_token"){await a(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,token_type_hint:e,client_id:r})})}async validateToken(t){let r=new AbortController,e=setTimeout(()=>r.abort(),1e4);try{let i=await a(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},signal:r.signal});return clearTimeout(e),i.ok}catch{return clearTimeout(e),!1}}};export{m as a,_ as b};
|
package/dist/chunk-BKXTOQWL.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as je}from"./chunk-PN7LNQ7G.js";import{a as pe,b as $e}from"./chunk-VS2BXLH4.js";import{d as Pe,f as fe}from"./chunk-LRF6UP42.js";import{a as _e}from"./chunk-5TOE4RHH.js";import{a as Ce}from"./chunk-VTDVK3DK.js";import{a as U}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-3Z4EHIOW.js";import{a,b as o,d as ge,i as Ee,j as Ie,k as xe}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var Y=$(ue(),1);var G=$(ue(),1);var F=$(ue(),1);function ve(e){let n=e.indexOf(": ");return n>0&&n<15?e.slice(n+2):e}function Te(e){return e.map(n=>{let l=n.children?Te(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:l}:l!==n.children?{...n,children:l}:n})}function Le(e,n,l,c){let[b,u]=(0,F.useState)(!1),[f,d]=(0,F.useState)([]),[M,I]=(0,F.useState)(null),[P,C]=(0,F.useState)(null),[N,j]=(0,F.useState)(null),[y,g]=(0,F.useState)(null),[T,B]=(0,F.useState)([]),[q,J]=(0,F.useState)(null),[oe,ce]=(0,F.useState)(void 0),_=(0,F.useRef)(null),H=(0,F.useRef)(null),Q=(0,F.useRef)(0),le=(0,F.useRef)(!1),ee=(0,F.useCallback)(async(h,L)=>{let me=_.current;if(me){try{await me.exited}catch{}_.current=null}d([]),I(null),C(null),j(null),g(null),B([]),J(null),ce(h.max_steps),u(!0),H.current=null,Q.current=0;let W;try{W=je(h,L)}catch(ie){j(ie instanceof Error?ie.message:String(ie)),u(!1);return}_.current=W,Pe("runner",()=>W.cancel()),(async()=>{le.current=!1;let ie=!1;for await(let t of W.events){if(le.current)break;switch(t.type){case"run_start":if(H.current&&!H.current.isSingleFlow){let k=Q.current;Q.current++,d(E=>E.map((R,v)=>v===k?{...R,status:"running"}:R.status==="running"&&!R.children?.some(x=>x.status==="running")?{...R,status:R.children?.some(x=>x.status==="failed")?"failed":"passed"}:R))}break;case"bifurcation":{let k=t.flows??[],E=t.count??k.length,R={flows:k,isSingleFlow:t.is_single_flow??E<=1};g(R),H.current=R,Q.current=0,d(k.map((v,x)=>({index:x+1,objective:v??`Flow ${x+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 k=t.index,E=t.objective??`Step ${k}`,R=t.child_id,v=H.current&&!H.current.isSingleFlow;if(R)d(x=>{let S=x.findIndex(Z=>Z.status==="running"||Z.children?.some(ze=>ze.status==="running"));if(S===-1)return x;let O=[...x],D={...O[S]},re=[...D.children??[]].map(Z=>Z.status==="running"?{...Z,status:"stopped",phase:void 0}:Z);return re.push({index:k,objective:E,status:"running"}),D.children=re,O[S]=D,O});else if(v){let x=Math.max(0,Q.current-1);d(S=>{let O=[...S];if(x>=O.length)return S;let D={...O[x]},re=[...D.children??[]].map(Z=>Z.status==="running"?{...Z,status:"stopped",phase:void 0}:Z);return re.push({index:k,objective:E,status:"running"}),D.children=re,D.status="running",O[x]=D,O})}else d(x=>{let S=Te(x);return S.some(D=>D.index===k)?S.map(D=>D.index===k?{...D,status:"running",objective:E}:D):[...S,{index:k,objective:E,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 k=t.child_id,E=H.current&&!H.current.isSingleFlow;if(t.event==="cm_init"&&t.checkpoint_count!=null){B(R=>[...R,t.checkpoint_count]);break}if(t.event==="replay_started"){J({recordingLength:t.recording_length??0});break}if(t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&l?.(t.detail),k)d(R=>R.map(v=>{if(!v.children)return v;let x=v.children.map(S=>{if(S.index!==t.index)return S;let O={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(O.objective=t.detail),t.action_type&&(O.actionType=t.action_type),{...S,...O}});return{...v,children:x}}));else if(E){let R=Math.max(0,Q.current-1);d(v=>{let x=[...v];if(R>=x.length)return v;let S={...x[R]},O=[...S.children??[]];if(!O.some(ne=>ne.index===t.index))O.push({index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type});else for(let ne=0;ne<O.length;ne++){if(O[ne].index!==t.index)continue;let re={phase:t.event};t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(re.objective=t.detail),t.action_type&&(re.actionType=t.action_type),O[ne]={...O[ne],...re}}return S.children=O,x[R]=S,x})}else d(R=>R.some(x=>x.index===t.index)?R.map(x=>{if(x.index!==t.index)return x;let S={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(S.objective=t.detail),t.action_type&&(S.actionType=t.action_type),{...x,...S}}):[...Te(R),{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 k=t.child_id,E=H.current&&!H.current.isSingleFlow;if(k)d(R=>R.map(v=>{if(!v.children)return v;let x=v.children.map(S=>S.index===t.index?{...S,status:t.status,duration:t.duration,phase:void 0,objective:S.objective.startsWith("Step ")?ve(t.summary||S.objective):S.objective}:S);return{...v,children:x}}));else if(E){let R=Math.max(0,Q.current-1);d(v=>{let x=[...v];if(R>=x.length)return v;let S={...x[R]},O=(S.children??[]).map(D=>D.index===t.index?{...D,status:t.status,duration:t.duration,phase:void 0,objective:D.objective.startsWith("Step ")?ve(t.summary||D.objective):D.objective}:D);return S.children=O,x[R]=S,x})}else d(R=>R.map(v=>v.index===t.index?{...v,status:t.status,duration:t.duration,phase:void 0,objective:v.objective.startsWith("Step ")?ve(t.summary||v.objective):v.objective}:v));{let v=H.current&&!H.current.isSingleFlow?Math.max(0,Q.current-1):0;e?.(t.index,v,t.child_id)}break}case"child_agent_start":{let k=t.objective??"";d(E=>E.map(R=>R.status==="running"?{...R,objective:`${k} (branch)`,phase:`child: ${k.slice(0,50)}`,branchObjective:k}:R));break}case"child_agent_end":d(k=>k.map(E=>E.phase?.startsWith("child:")?{...E,phase:`child ${t.success?"done":"failed"}`}:E));break;case"ask_user":I(t.question??"");break;case"run_end":d(k=>k.map(E=>E.status==="running"?{...E,status:t.status,phase:void 0}:E)),u(!1),C(t),ie=!0;break;case"error":u(!1),j(t.message??"Runner error"),d(k=>k.map(E=>E.status==="running"?{...E,status:"failed",phase:void 0}:E));break}}let{code:te,signal:Se}=await W.exited,ye=W.stderr,Ve=te===0&&!Se,de=[];te!==null&&te!==0&&de.push(`Runner exited with code ${te}`),Se&&de.push(`Runner killed by signal ${Se}`),ye&&(!Ve||!ie?de.push(ye):L?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:ye})),_.current===W&&(de.length>0&&j(de.join(`
|
|
3
|
-
`)),u(!1),fe("runner","Event stream ended"),_.current=null)})().catch(ie=>{let te=[`Runner event loop error: ${ie}`];W.exitCode!==null&&W.exitCode!==0&&te.push(`Exit code: ${W.exitCode}`),W.exitSignal&&te.push(`Signal: ${W.exitSignal}`),W.stderr&&te.push(W.stderr),_.current===W&&(j(te.join(`
|
|
4
|
-
`)),u(!1),fe("runner","Event loop error"),_.current=null)})},[e,n,l,c]),r=(0,F.useCallback)(h=>{_.current?.sendUserResponse(h),I(null)},[]),m=(0,F.useCallback)(()=>{let h=_.current;h&&(h.sendCancel("user"),u(!1),I(null),setTimeout(()=>{_.current===h&&(fe("runner","User cancelled run"),_.current=null)},5e3))},[]),p=(0,F.useCallback)(()=>{d([]),C(null),j(null)},[]);return(0,F.useEffect)(()=>()=>{le.current=!0,fe("runner","Component unmounted"),_.current=null},[]),{isRunning:b,steps:f,askingUser:M,lastRunEnd:P,runError:N,bifurcationInfo:y,cmInitCounts:T,replayInfo:q,maxSteps:oe,startRun:ee,sendAnswer:r,cancelRun:m,clearLastRun:p}}function we(e){let n=e.flatMap(u=>[u,...u.children??[]]),l=n.filter(u=>u.status==="passed").length,c=n.filter(u=>u.status==="failed").length,b=n.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:l,failed:c,total:b}}function Oe(e){let n=Le(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[l,c]=(0,G.useState)(0),[b,u]=(0,G.useState)("idle"),f=(0,G.useRef)("idle"),d=(0,G.useRef)(0),M=(0,G.useRef)(!1),I=(0,G.useRef)(null),P=(0,G.useRef)(null),C=(0,G.useCallback)(y=>{f.current=y,u(y)},[]),N=(0,G.useCallback)(async y=>{let g=await e.getNextConfig(y);if(!g){C("done"),e.onAllComplete?.();return}let T=y?d.current+1:0;d.current=T,c(T),e.onStepStart?.(g,T),I.current=null,P.current=null,C("running"),await n.startRun(g,e.spawnOpts)},[n,e,C]);(0,G.useEffect)(()=>{M.current||(M.current=!0,N(null))},[]),(0,G.useEffect)(()=>{if(!n.lastRunEnd||n.lastRunEnd===I.current||f.current!=="running")return;I.current=n.lastRunEnd,f.current="transitioning",u("transitioning");let y=n.lastRunEnd,g=we(n.steps),T=n.bifurcationInfo,B={status:y.status==="passed"?"passed":"failed",duration_s:y.duration??0,reason:y.reason,runEnd:y,hadError:!1,stepsPassed:g.passed,stepsFailed:g.failed,stepsTotal:g.total,bifurcationFlows:T&&!T.isSingleFlow?T.flows:null};if(!(e.onStepEnd?.(B,d.current)??!0)){C("done"),e.onAllComplete?.();return}N(B)},[n.lastRunEnd]),(0,G.useEffect)(()=>{if(!n.runError||n.runError===P.current||n.lastRunEnd||f.current!=="running")return;P.current=n.runError,f.current="transitioning",u("transitioning");let y=we(n.steps),g={status:"failed",duration_s:0,reason:n.runError,runEnd:null,hadError:!0,stepsPassed:y.passed,stepsFailed:y.failed,stepsTotal:y.total,bifurcationFlows:null};if(!(e.onStepEnd?.(g,d.current)??!0)){C("done"),e.onAllComplete?.();return}N(g)},[n.runError,n.lastRunEnd]);let j=(0,G.useCallback)(()=>{n.cancelRun()},[n]);return{runner:n,currentStepIndex:l,phase:b,cancel:j}}var Be=$(ue(),1);var he=$(U(),1),De=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Fe({label:e,hasBifurcation:n=!1}){let[l,c]=(0,Be.useState)(0),[b,u]=(0,Be.useState)(0);pe(()=>{c(d=>(d+1)%De.length)},80),pe(()=>{u(d=>(d+1)%4)},400);let f=e??(n?"Planning approach":"Analyzing objective");return(0,he.jsxs)(a,{marginLeft:1,children:[(0,he.jsxs)(o,{color:s.orange,children:[De[l]," "]}),(0,he.jsxs)(o,{color:s.dim,children:[f,".".repeat(b+1)]})]})}function Me(e){if(!e.isRunning||e.replayInfo)return null;let n=e.bifurcationInfo;if(n&&!n.isSingleFlow){let l=e.steps.findIndex(b=>b.status==="running");return(l===-1?e.cmInitCounts.length===0:l>=e.cmInitCounts.length)?{label:l>0?`Planning flow ${l+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(l=>l.children?.length)?null:{hasBifurcation:!!n}}var A=$(ue(),1);var Ae=$(ue(),1);var Re=$(U(),1),Xe="#ffc580",Ye="#ffd9a8",Ne="#ffffff";function qe({text:e,active:n=!0}){let[l,c]=(0,Ae.useState)(0),b=4;if(pe(()=>{c(f=>(f+1)%(e.length+b*2))},n?80:null),!n)return(0,Re.jsx)(o,{color:Ne,children:e});let u=e.split("").map((f,d)=>{let M=l-b,I=Math.abs(d-M-b/2),P;return I<=b/2?P=Xe:I<=b?P=Ye:P=Ne,(0,Re.jsx)(o,{color:P,children:f},d)});return(0,Re.jsx)(o,{children:u})}var K=$(U(),1),Je={starting:s.orange,running:s.orange,passed:s.green,failed:s.red,cancelled:s.dim,timed_out:s.orange};function be({currentStep:e,maxSteps:n,elapsed:l,status:c}){let{stdout:b}=xe(),u=b?.columns??80,f=Je[c]??s.orange,d=l<60?`${l.toFixed(1)}s`:`${Math.floor(l/60)}m ${Math.round(l%60)}s`;return(0,K.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,K.jsx)(o,{color:s.muted,children:"\u2500".repeat(Math.min(u,60))}),(0,K.jsxs)(a,{children:[(0,K.jsx)(o,{children:" "}),(0,K.jsx)(o,{color:s.dim,children:"Steps "}),(0,K.jsx)(o,{bold:!0,children:e}),(0,K.jsxs)(o,{color:s.dim,children:["/",n]}),(0,K.jsx)(o,{children:" "}),(0,K.jsx)(o,{color:s.dim,children:"Elapsed "}),(0,K.jsx)(o,{bold:!0,children:d}),(0,K.jsx)(o,{children:" "}),(0,K.jsx)(o,{color:s.dim,children:"Status "}),(0,K.jsx)(o,{bold:!0,color:f,children:c})]})]})}var Qe={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 Ue(e){return Qe[e]??"\u25CF"}var se=$(U(),1);function ke({steps:e,flows:n,cmInitCounts:l,renderStep:c}){return(0,se.jsxs)(a,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,se.jsxs)(o,{color:s.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((b,u)=>(0,se.jsxs)(a,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,se.jsxs)(o,{color:s.orange,children:["Flow ",u+1,": ",n?.[u]??b.objective]}),l&&l[u]!=null&&(0,se.jsxs)(o,{color:s.dim,children:[" \u25AA Generated task with ",l[u]," checkpoints"]}),b.children&&b.children.length>0?b.children.map(f=>c(f,`f${u}-${f.index}`)):b.status==="pending"&&(0,se.jsx)(o,{color:s.dim,children:" \u25CB Waiting..."})]},u))]})}var i=$(U(),1);function X({step:e,indent:n=2}){let l=e.actionType?Ue(e.actionType):null,c=e.status==="running",b=e.status==="passed",u=e.status==="failed",f=e.status==="pending"||e.status==="stopped",{stdout:d}=xe(),M=d?.columns??80,I=Math.max(20,M-n-21),P=e.objective??"",C=P.length>I?P.slice(0,I-1)+"\u2026":P,N=(e.duration??0)*1e3,j=e.duration!=null?N<1e3?`${Math.round(N)}ms`:`${(N/1e3).toFixed(1)}s`:"";return(0,i.jsxs)(a,{flexDirection:"column",children:[(0,i.jsxs)(a,{marginLeft:n,children:[(0,i.jsx)(a,{width:4,children:(0,i.jsxs)(o,{color:s.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,i.jsx)(a,{width:3,children:c?(0,i.jsx)($e,{}):b?(0,i.jsx)(o,{color:s.green,bold:!0,children:"\u2713"}):u?(0,i.jsx)(o,{color:s.red,bold:!0,children:"\u2717"}):(0,i.jsx)(o,{color:s.muted,children:"\u25CB"})}),(0,i.jsx)(a,{flexGrow:1,children:c?(0,i.jsx)(qe,{text:C,active:!0}):u?(0,i.jsx)(o,{color:s.red,children:C}):f?(0,i.jsx)(o,{color:s.dim,children:C}):(0,i.jsx)(o,{color:s.dim,children:C})}),(b||u)&&l?(0,i.jsx)(a,{width:3,marginLeft:1,children:(0,i.jsx)(o,{color:s.muted,children:l})}):(0,i.jsx)(a,{width:3,marginLeft:1}),(0,i.jsx)(a,{width:7,justifyContent:"flex-end",children:(0,i.jsx)(o,{color:s.dim,children:j})})]}),e.children&&e.children.length>0&&(0,i.jsx)(a,{flexDirection:"column",children:e.children.map((y,g)=>(0,i.jsx)(X,{step:y,indent:n+2},`child-${g}`))})]})}function Ge({steps:e,bifurcated:n,flows:l,cmInitCounts:c,maxSteps:b=50,staticSteps:u=!1,onStepCommit:f}){let d=(0,A.useRef)(new Set),M=(0,A.useRef)(!1),I=(0,A.useRef)(new Set),P=(0,A.useRef)(!1),C=(0,A.useRef)(new Set),N=(0,A.useRef)(0);(0,A.useEffect)(()=>{e.length===0&&N.current>0&&(d.current.clear(),M.current=!1,I.current.clear(),P.current=!1,C.current.clear()),N.current=e.length},[e.length]);let j=e.flatMap(r=>[r,...r.children??[]]),y=j.some(r=>r.status==="running"),g=j.some(r=>r.status==="failed"),T=j.length===0||j.every(r=>r.status==="pending"),B=j.filter(r=>r.status==="passed"||r.status==="failed").length,q;T?q="starting":y?q="running":g?q="failed":q="passed";let J=(0,A.useRef)(null),[oe,ce]=(0,A.useState)(0);(0,A.useEffect)(()=>{j.length===0||T?(J.current=null,ce(0)):y&&J.current==null&&(J.current=Date.now())},[y,T,j.length]),(0,A.useEffect)(()=>{if(!y)return;let r=setInterval(()=>{J.current!=null&&ce((Date.now()-J.current)/1e3)},500);return()=>clearInterval(r)},[y]);let _=(0,A.useRef)(new Set),[H,Q]=(0,A.useState)([]),le=(0,A.useRef)(!1);(0,A.useEffect)(()=>{if(!u||n)return;let r=[];if(!n&&!le.current&&c&&c[0]!=null&&(le.current=!0,c[0]>0&&r.push({key:"cm_init_0",type:"cm_init",count:c[0]})),n){!_.current.has(-1)&&e.length>0&&(_.current.add(-1),r.push({key:"bif_header",type:"bifurcation_header",flowCount:l?.length??e.length}));for(let m=0;m<e.length;m++){let p=e[m],h=-(m+10);_.current.has(h)||(_.current.add(h),r.push({key:`flow_header_${m}`,type:"flow_header",flowIdx:m,label:l?.[m]??p.objective,cmCount:c?.[m]}));for(let L of p.children??[])(L.status==="passed"||L.status==="failed")&&!_.current.has(L.index)&&(_.current.add(L.index),r.push({key:`step_f${m}_${L.index}`,type:"step",step:{...L}}))}}else for(let m of e)(m.status==="passed"||m.status==="failed")&&!_.current.has(m.index)&&(_.current.add(m.index),r.push({key:`step_${m.index}`,type:"step",step:{...m,children:m.children?[...m.children]:void 0}}));r.length>0&&Q(m=>[...m,...r])},[e,n,l,c,u]),(0,A.useEffect)(()=>{if(f)if(!n&&!P.current&&c&&c[0]!=null&&(P.current=!0,c[0]>0&&f((0,i.jsx)(a,{marginLeft:2,children:(0,i.jsxs)(o,{color:s.dim,children:["\u25A0 Generated task with ",c[0]," checkpoints"]})}))),n&&l&&!M.current&&(M.current=!0,f((0,i.jsx)(o,{color:s.purple,children:"\u2501\u2501 Bifurcated into "+l.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),n){let r=e.flatMap((m,p)=>{let h=m.children??[];return!I.current.has(p)&&h.length>0&&(I.current.add(p),f((0,i.jsx)(o,{color:s.purple,children:" Flow "+(p+1)+": "+(l?.[p]??"")})),c?.[p]!=null&&c[p]>0&&!C.current.has(p)&&(C.current.add(p),f((0,i.jsx)(a,{marginLeft:2,children:(0,i.jsxs)(o,{color:s.dim,children:[" \u25AA Generated task with ",c[p]," checkpoints"]})})))),c?.[p]!=null&&c[p]>0&&I.current.has(p)&&!C.current.has(p)&&(C.current.add(p),f((0,i.jsx)(a,{marginLeft:2,children:(0,i.jsxs)(o,{color:s.dim,children:[" \u25AA Generated task with ",c[p]," checkpoints"]})}))),h});for(let m of r){let p=`${m.index}-${m.objective}`;d.current.has(p)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add(p),f((0,i.jsx)(a,{marginLeft:2,children:(0,i.jsx)(X,{step:m})})))}}else for(let r of e){let m=`${r.index}-${r.objective}`,p=!!r.branchObjective;p&&!d.current.has(m)&&(d.current.add(m),f((0,i.jsx)(a,{marginLeft:2,children:(0,i.jsx)(X,{step:{...r,children:void 0}})})));for(let h of r.children??[]){let L=`child-${r.index}-${h.index}-${h.objective}`;d.current.has(L)||(h.status==="passed"||h.status==="failed"||h.status==="stopped")&&(d.current.add(L),f((0,i.jsx)(a,{marginLeft:4,children:(0,i.jsx)(X,{step:h})})))}!p&&!d.current.has(m)&&(r.status==="passed"||r.status==="failed"||r.status==="stopped")&&(d.current.add(m),f((0,i.jsx)(a,{marginLeft:2,children:(0,i.jsx)(X,{step:{...r,children:void 0}})})))}},[e,f,n,l,c]);let ee=[];if(f)if(n)for(let r of e){let p=(r.children??[]).filter(h=>{let L=`${h.index}-${h.objective}`;return!d.current.has(L)});p.length>0&&ee.push({...r,children:p})}else for(let r of e){let m=`${r.index}-${r.objective}`,p=d.current.has(m),h=(r.children??[]).filter(L=>{let me=`child-${r.index}-${L.index}-${L.objective}`;return!d.current.has(me)});p?h.length>0&&ee.push({...r,children:h}):ee.push({...r,children:h})}else if(u){if(!n)for(let r of e)_.current.has(r.index)||ee.push(r)}if(!u){let r=f?ee:e;return(0,i.jsxs)(a,{flexDirection:"column",children:[n?f?r.length>0?(0,i.jsx)(a,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:r.map((p,h)=>(0,i.jsx)(a,{flexDirection:"column",marginTop:h>0?1:0,children:p.children&&p.children.length>0?p.children.map(L=>(0,i.jsx)(X,{step:L},`f${h}-${L.index}`)):p.status==="pending"&&(0,i.jsx)(o,{color:s.dim,children:" \u25CB Waiting..."})},h))}):null:(0,i.jsx)(ke,{steps:e,flows:l,cmInitCounts:c,renderStep:(p,h)=>(0,i.jsx)(X,{step:p},h)}):(0,i.jsxs)(a,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!f&&c&&c[0]!=null&&(0,i.jsxs)(o,{color:s.dim,children:["\u25AA Generated task with ",c[0]," checkpoints"]}),r.map(p=>{let h=`${p.index}-${p.objective}`;return f&&d.current.has(h)?(0,i.jsx)(a,{flexDirection:"column",children:(p.children??[]).map(L=>(0,i.jsx)(a,{marginLeft:2,children:(0,i.jsx)(X,{step:L})},L.index))},`branch-children-${p.index}`):(0,i.jsx)(X,{step:p},p.index)})]}),y&&(0,i.jsx)(be,{currentStep:B,maxSteps:b,elapsed:oe,status:q})]})}return n?(0,i.jsxs)(a,{flexDirection:"column",children:[(0,i.jsx)(ke,{steps:e,flows:l,cmInitCounts:c,renderStep:(r,m)=>(0,i.jsx)(X,{step:r},m)}),y&&(0,i.jsx)(be,{currentStep:B,maxSteps:b,elapsed:oe,status:q})]}):(0,i.jsxs)(a,{flexDirection:"column",children:[(0,i.jsx)(ge,{items:H,children:r=>r.type==="cm_init"?(0,i.jsx)(a,{marginLeft:2,paddingLeft:1,children:(0,i.jsxs)(o,{color:s.dim,children:["\u25AA Generated task with ",r.count," checkpoints"]})},r.key):r.type==="bifurcation_header"?(0,i.jsx)(a,{marginLeft:2,paddingLeft:1,children:(0,i.jsxs)(o,{color:s.dim,children:["\u2501\u2501 Bifurcated into ",r.flowCount," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]})},r.key):r.type==="flow_header"?(0,i.jsxs)(a,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,i.jsxs)(o,{color:s.orange,children:["Flow ",r.flowIdx+1,": ",r.label]}),r.cmCount!=null&&(0,i.jsxs)(o,{color:s.dim,children:[" \u25AA Generated task with ",r.cmCount," checkpoints"]})]},r.key):(0,i.jsx)(a,{marginLeft:2,paddingLeft:1,children:(0,i.jsx)(X,{step:r.step})},r.key)}),ee.length>0&&(0,i.jsx)(a,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:ee.map(r=>(0,i.jsx)(X,{step:r},r.index))}),y&&(0,i.jsx)(be,{currentStep:B,maxSteps:b,elapsed:oe,status:q})]})}var ae=$(U(),1);function We({runner:e,runKey:n,onStepCommit:l}){let c=Me({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)(Fe,{label:c.label,hasBifurcation:c.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,ae.jsx)(Ge,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:l},`run-${n}`)]})}var V=$(U(),1),Ze=64;function et(e){return e.split(`
|
|
5
|
-
`).map(n=>n.replace(/^[-–•]\s*/,"").trim()).filter(n=>n.length>0)}function Ke({status:e,summary:n,duration:l,steps:c,stepsPassed:b,stepsFailed:u,reason:f,creditsConsumed:d}){let M=e==="passed",I=M?s.green:s.red,P=M?"\u2713":"\u2717",C=e.toUpperCase(),N=b??(M?c:Math.max(0,c-1)),j=u??(M?0:1),y=j>0?`${c} steps (${N} passed, ${j} failed)`:`${c} steps`,g=l<60?`${l.toFixed(1)}s`:`${Math.floor(l/60)}m ${Math.round(l%60)}s`,T=et(n);return(0,V.jsx)(a,{flexDirection:"column",marginTop:1,children:(0,V.jsxs)(a,{borderStyle:"round",borderColor:I,flexDirection:"column",paddingX:2,paddingY:1,width:Ze+6,children:[(0,V.jsxs)(a,{flexDirection:"column",children:[(0,V.jsxs)(o,{bold:!0,color:I,children:[P," ",C]}),(0,V.jsxs)(o,{color:s.dim,wrap:"wrap",children:[y," \xB7 ",g,typeof d=="number"&&d>0?` \xB7 ${parseFloat(d.toFixed(4))} credits`:""]})]}),T.length>0&&(0,V.jsx)(a,{flexDirection:"column",marginTop:1,marginLeft:1,children:T.map((B,q)=>(0,V.jsxs)(a,{marginBottom:q<T.length-1?1:0,children:[(0,V.jsx)(o,{color:s.orange,children:"\u25CF "}),(0,V.jsx)(a,{flexShrink:1,children:(0,V.jsx)(o,{wrap:"wrap",children:B})})]},q))}),f&&!M&&(0,V.jsx)(a,{marginTop:1,children:(0,V.jsxs)(o,{color:s.red,wrap:"wrap",children:["Reason: ",f]})})]})})}var z=$(U(),1);function He({message:e,code:n,remediation:l,docsUrl:c}){return(0,z.jsx)(Ce,{title:"Error",variant:"error",children:(0,z.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,z.jsxs)(o,{color:s.red,bold:!0,children:[" \u2717 ",e]}),n&&(0,z.jsxs)(a,{marginTop:0,marginLeft:5,children:[(0,z.jsx)(o,{color:s.muted,children:"Code: "}),(0,z.jsx)(o,{color:s.dim,children:n})]}),l&&(0,z.jsxs)(a,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,z.jsx)(o,{color:s.green,bold:!0,children:"Fix:"}),(0,z.jsxs)(o,{color:s.orange,children:["$ ",l]})]}),c&&(0,z.jsxs)(a,{marginTop:1,marginLeft:5,children:[(0,z.jsx)(o,{color:s.muted,children:"Docs: "}),(0,z.jsx)(o,{color:s.orange,underline:!0,children:c})]})]})})}var w=$(U(),1);function en(e){let{exit:n}=Ie(),l=(0,Y.useRef)(0),[c,b]=(0,Y.useState)([{id:"top-banner",content:(0,w.jsx)(a,{flexDirection:"column",marginBottom:1,children:(0,w.jsxs)(a,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,w.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,w.jsx)(o,{color:s.dim,children:" \u2502 "}),(0,w.jsx)(o,{color:s.orange,children:e.topBanner.model}),(0,w.jsx)(o,{color:s.dim,children:" \u2502 "}),(0,w.jsx)(o,{color:s.dim,children:e.topBanner.auth})]})})},{id:"global-config",content:(0,w.jsx)(tt,{data:e.globalConfig})},...e.priorAttemptRollup?[{id:"prior-rollup",content:(0,w.jsx)(o,{color:s.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})}]:[]]),u=(0,Y.useCallback)(g=>{let T=`s-${++l.current}`;b(B=>[...B,{id:T,content:g}])},[]),f=(0,Y.useRef)(null),d=(0,Y.useCallback)(async g=>{let T=await e.getNextStep(g);return T?(f.current=T,T.config):(f.current=null,null)},[e]),M=(0,Y.useCallback)((g,T)=>{let B=f.current;if(!B)return;let q=B.mode==="replay"?"cyan":"#dc4e08",J=B.modeReason?` (${B.modeReason})`:"",oe=B.perStepOverrides?Object.entries(B.perStepOverrides):[];u((0,w.jsxs)(a,{flexDirection:"column",marginBottom:0,children:[(0,w.jsxs)(o,{children:[(0,w.jsxs)(o,{color:s.dim,children:[B.banner.stepLabel," "]}),(0,w.jsxs)(o,{color:q,children:["[",B.mode,"]"]}),(0,w.jsx)(o,{color:s.dim,children:J})]}),(0,w.jsx)(o,{color:s.dim,children:B.banner.objective}),oe.length>0&&(0,w.jsxs)(o,{color:s.dim,children:["overrides: ",oe.map(([ce,_])=>`${ce}=${_}`).join(", ")]})]}))},[u]),I=(0,Y.useRef)(0),P=(0,Y.useRef)(!1),C=(0,Y.useCallback)((g,T)=>(g.hadError?u((0,w.jsx)(He,{message:g.reason??"Runner error",code:"RUNNER_ERROR"})):u((0,w.jsx)(a,{flexDirection:"column",marginBottom:1,children:(0,w.jsx)(Ke,{status:g.status,summary:g.runEnd?.summary??"",duration:g.runEnd?.duration??0,steps:g.stepsTotal,stepsPassed:g.stepsPassed,stepsFailed:g.stepsFailed,reason:g.runEnd?.reason,creditsConsumed:g.runEnd?.credits_consumed})})),e.onStepEnd?.(g,T)??!0),[u,e]),N=Oe({getNextConfig:d,onStepStart:M,onStepEnd:C,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>n())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),j=250,y=5e3;return Ee((g,T)=>{if(T.ctrl&&g==="c"){let B=Date.now(),q=B-I.current;if(q<j)return;P.current&&q<y?(N.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>n())):(P.current=!0,u((0,w.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),I.current=B}}),(0,w.jsxs)(a,{flexDirection:"column",children:[(0,w.jsx)(ge,{items:c,children:g=>(0,w.jsx)(a,{children:g.content},g.id)}),N.phase!=="done"&&(0,w.jsx)(We,{runner:N.runner,runKey:N.currentStepIndex,onStepCommit:u})]})}function tt({data:e}){return(0,w.jsx)(_e,{title:"test.md run",titleColor:"#ff9500",borderColor:s.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{Ge as a,Fe as b,Me as c,Le as d,we as e,Ke as f,He as g,en as h};
|
package/dist/chunk-BPF7TDRU.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as o}from"./chunk-WAOCHXJ5.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a as n}from"./chunk-RZ4F3BHX.js";var l=class{constructor(t,e,r,s){this.controllerBaseUrl=t;this.getOAuthToken=e;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;revoke(){this._revoked=!0,this._cached=null}prime(t){this._revoked||(this._cached=t)}get revoked(){return this._revoked}get cached(){return this._cached}async resolve(t=!1){if(this._cached&&!t)return this._cached;try{let e;if(this.directBasicAuth)e=new o(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;e=new o(this.controllerBaseUrl,s)}let r=await e.getTmsCredentials();return this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(e){return this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:e instanceof Error?e.message:String(e)}),null}}async fetch(t,e={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...e,headers:{...e.headers,Authorization:c(i.username,i.access_key)}}),a=await n(t,s(r));if(a.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:t});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return n(t,s(i))}return a}};export{l as a};
|