@testmuai/kane-cli 0.2.9 → 0.2.11
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-YIDCOJVA.js +2 -0
- package/dist/CliFeedbackPrompt-T5LVDBVG.js +2 -0
- package/dist/{CliUploadProgress-BSXWFIP5.js → CliUploadProgress-YJW7DHBT.js} +1 -1
- package/dist/{ConfigView-53QUJ3UT.js → ConfigView-5L75H3A6.js} +1 -1
- package/dist/FolderPicker-LEE4Y5JF.js +2 -0
- package/dist/{HelpView-ZR5EXR7F.js → HelpView-SIIWVMWF.js} +1 -1
- package/dist/{LinksBox-6CLSLM2A.js → LinksBox-M72NCTRJ.js} +1 -1
- package/dist/ProfilesView-6MW5P6M4.js +2 -0
- package/dist/ProjectPicker-57G2ILEN.js +2 -0
- package/dist/SingleShotApp-UD4M2CZC.js +2 -0
- package/dist/{WhoamiView-AXPRRGNG.js → WhoamiView-ZKNSYOLI.js} +1 -1
- package/dist/{changelog-L2FNAYGV.js → changelog-TWE6QJ5S.js} +1 -1
- package/dist/{chunk-CUBXICTI.js → chunk-2O7RIXHD.js} +1 -1
- package/dist/{chunk-56DFEK7K.js → chunk-55EYPGTJ.js} +1 -1
- package/dist/chunk-7ONI2K3S.js +2 -0
- package/dist/{chunk-EOOULVWR.js → chunk-C4KI7FLV.js} +1 -1
- package/dist/chunk-CKMDFVL6.js +5 -0
- package/dist/{chunk-RFGE6ULZ.js → chunk-D3YS6JDD.js} +2 -2
- package/dist/{chunk-4HQOC372.js → chunk-HHNLJWO5.js} +1 -1
- package/dist/{chunk-QX4WHNRG.js → chunk-ID77BNBM.js} +1 -1
- package/dist/chunk-IQYKSZAW.js +20 -0
- package/dist/chunk-J3ZXTHAH.js +103 -0
- package/dist/chunk-LBW6EFWN.js +2 -0
- package/dist/chunk-M5TQDTQN.js +2 -0
- package/dist/{chunk-GIXIZJ6Y.js → chunk-NDMXYUJM.js} +1 -1
- package/dist/chunk-TMTSY6CU.js +2 -0
- package/dist/chunk-XQL5WHKR.js +2 -0
- package/dist/chunk-Y3MXIITZ.js +2 -0
- package/dist/chunk-Y4AOKSSQ.js +2 -0
- package/dist/chunk-YUUZDFT7.js +2 -0
- package/dist/chunk-Z3JYUFJ4.js +2 -0
- package/dist/index.js +46 -57
- package/dist/{logging-R5263ZJZ.js → logging-JWPN5HMJ.js} +1 -1
- package/dist/login-flow-WXMKYI5G.js +2 -0
- package/dist/{pipeline-QHJGNZ7H.js → pipeline-6DGALO2W.js} +1 -1
- package/dist/{tms-client-VH42IFUF.js → tms-client-CTH4NVFM.js} +1 -1
- package/dist/validate-basic-RV5TSUKJ.js +2 -0
- package/dist/{version-check-NUVM7TOP.js → version-check-FOMPCS47.js} +1 -1
- package/package.json +5 -5
- package/dist/ChromeProfilePicker-ZDIWVMLR.js +0 -2
- package/dist/CliFeedbackPrompt-V6X2IESW.js +0 -2
- package/dist/FolderPicker-BHEDYLKA.js +0 -2
- package/dist/LoginWizard-NJA5AAYO.js +0 -2
- package/dist/ProfilesView-HEUHISRN.js +0 -2
- package/dist/ProjectPicker-YZZUJDOQ.js +0 -2
- package/dist/chunk-2ATFRKHW.js +0 -2
- package/dist/chunk-4RVMT7O2.js +0 -106
- package/dist/chunk-BTLH2ZWO.js +0 -2
- package/dist/chunk-BXWE7UO7.js +0 -2
- package/dist/chunk-C7FS7B4O.js +0 -2
- package/dist/chunk-DGFG2WJH.js +0 -2
- package/dist/chunk-HFQ7T5KT.js +0 -2
- package/dist/chunk-RTOXLI4C.js +0 -2
- package/dist/chunk-TV6MHKZV.js +0 -2
- package/dist/chunk-YLC6PSJZ.js +0 -2
- package/dist/login-flow-J5AIWRWS.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c}from"./chunk-Y4AOKSSQ.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as r}from"./chunk-Z3JYUFJ4.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as P,d as g,e as f}from"./chunk-
|
|
2
|
+
import{c as P,d as g,e as f}from"./chunk-ID77BNBM.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d,b as l,c as r}from"./chunk-
|
|
2
|
+
import{a as d,b as l,c as r}from"./chunk-HHNLJWO5.js";import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-7ONI2K3S.js";import{a as t,j as u}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var f=n(h(),1);var e=n(m(),1);function S({model:c,mode:s,authLabel:g,profile:b,env:p,defaultUrl:i,projectId:v,folderId:x,windowSize:w,chromeProfile:B}){let{exit:a}=u();return(0,f.useEffect)(()=>{let C=setTimeout(()=>a(),50);return()=>clearTimeout(C)},[a]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(d,{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:g}),(0,e.jsx)(l,{label:" profile",value:b}),(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.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:c}),(0,e.jsx)(l,{label:" mode",value:s}),(0,e.jsx)(l,{label:" window",value:w}),(0,e.jsx)(l,{label:" project",value:v??"(none)"}),(0,e.jsx)(l,{label:" folder",value:x??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:B,valueColor:o.dimmed})]})})})}export{S as ConfigView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-LBW6EFWN.js";import"./chunk-Y3MXIITZ.js";import"./chunk-2O7RIXHD.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-HCBYKLMW.js";import{a as h,b as l,t}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-HCBYKLMW.js";import{a as h,b as l,t}from"./chunk-7ONI2K3S.js";import{a as n,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var b=u(T(),1);var e=u(f(),1),w="https://www.testmuai.com/support/docs/kane-cli-introduction",B="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:i}=p(),s=i?.columns??80;return(0,b.useEffect)(()=>{let d=setTimeout(()=>c(),50);return()=>clearTimeout(d)},[c]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.purple,bold:!0,children:l}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",h]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(m,{title:"USAGE",children:(0,e.jsxs)(o,{color:t.cyan,children:[" $ ",l," ","<command>"," [flags]"]})}),(0,e.jsxs)(m,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run a browser automation task",highlight:!0}),(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.jsxs)(m,{title:"RUN FLAGS",children:[(0,e.jsx)(r,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(r,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(r,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(r,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(r,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(r,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(r,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(r,{long:"--cft",desc:"Use Playwright Chromium instead of managed Chrome"}),(0,e.jsx)(r,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(r,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(r,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(r,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(r,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(r,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(m,{title:"EXAMPLES",children:[(0,e.jsx)(g,{label:"Search",cmd:`${l} run "Search for laptop"`}),(0,e.jsx)(g,{label:"Headless",cmd:`${l} run "Verify login" --headless`}),(0,e.jsx)(g,{label:"Variables",cmd:`${l} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(g,{label:"Agent",cmd:`${l} run "Add to cart" --agent | jq .status`})]}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(s-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Docs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:w})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Bugs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:B})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function m({title:c,children:i}){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.dimmed,children:c})}),i]})}function a({cmd:c,args:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:12,children:(0,e.jsx)(o,{color:d?t.purple:t.green,bold:!0,children:c})}),(0,e.jsx)(n,{width:28,children:i?(0,e.jsx)(o,{color:t.dimmed,children:i}):null}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function r({long:c,arg:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:26,children:[(0,e.jsx)(o,{color:d?t.purple:t.cyan,children:c}),i&&(0,e.jsxs)(o,{color:t.dimmed,children:[" ",i]})]}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function g({label:c,cmd:i}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["# ",c]}),(0,e.jsxs)(o,{color:t.cyan,children:["$ ",i]})]})}export{L as HelpView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-NDMXYUJM.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-TMTSY6CU.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-M5TQDTQN.js";import"./chunk-Y3MXIITZ.js";import"./chunk-2O7RIXHD.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{t as a}from"./chunk-IQYKSZAW.js";import"./chunk-LBW6EFWN.js";import"./chunk-CKMDFVL6.js";import"./chunk-PWGEMRBD.js";import"./chunk-L5Y2GUO6.js";import"./chunk-M5TQDTQN.js";import"./chunk-Y3MXIITZ.js";import"./chunk-2O7RIXHD.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s,b as o}from"./chunk-
|
|
2
|
+
import{a as s,b as o}from"./chunk-HHNLJWO5.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-7ONI2K3S.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:m,tokenStatus:l,expiresAt:c}){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.yellow,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}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as i,f as c}from"./chunk-
|
|
2
|
+
import{c as i,f as c}from"./chunk-7ONI2K3S.js";import"./chunk-UR6MHSHU.js";import{readFileSync as h,writeFileSync as g,mkdirSync as u}from"fs";import{join as d}from"path";var l=d(i,"changelog-cache.json"),f=3600*1e3;function p(){try{let e=JSON.parse(h(l,"utf-8"));if(Date.now()-e.cachedAt<f)return e}catch{}return null}function y(e){try{u(i,{recursive:!0}),g(l,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function E(e){try{let t=p();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await fetch(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return y(s),e?.all?s:s.slice(0,5)}catch{return[]}}function A(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
|
|
3
3
|
`).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
|
|
4
4
|
`)}export{E as fetchChangelog,A as formatChangelog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{s}from"./chunk-
|
|
2
|
+
import{s}from"./chunk-7ONI2K3S.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost}}export{n as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as u,g as f}from"./chunk-
|
|
2
|
+
import{a as u,g as f}from"./chunk-7ONI2K3S.js";var n=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,i,s={}){if(this.stopped)return;let r=this.buildEntry(e,t,i,s);this.buffer.push(r)}logStep(e,t,i,s={}){if(this.stopped)return;let r=this.buildEntry("debug",t,i,s);r.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(r)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let i={"Content-Type":"application/json"};t&&(i.Authorization=`Bearer ${t}`);let s=JSON.stringify(e);for(let r=0;r<3;r++){try{let h=new AbortController,p=setTimeout(()=>h.abort(),1e4),d=await fetch(this.config.proxyUrl,{method:"POST",headers:i,body:s,signal:h.signal});if(clearTimeout(p),d.ok)return}catch{}r<2&&await new Promise(h=>setTimeout(h,1e3*Math.pow(2,r)))}this._droppedBatches++,this._droppedEntries+=e.length}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,i,s){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:e,event:t,message:i,session_id:this.config.sessionId,run_index:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:s,timestamp:new Date().toISOString()}}};import{platform as l,arch as g}from"os";function v(o){let e={proxyUrl:f,sessionId:o.sessionId,identity:o.identity,device:{cli_version:u,platform:l(),arch:g()},getToken:o.getToken};return new n(e)}export{n as a,v as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
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.2.11",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,c,e as o}from"./chunk-
|
|
2
|
+
import{a,c,e as o}from"./chunk-7ONI2K3S.js";import{readFileSync as m,writeFileSync as f,mkdirSync as d,realpathSync as h}from"fs";import{join as g}from"path";var y="npm install -g @testmuai/kane-cli@latest",C="brew upgrade lambdatest/kane/kane-cli";function N(){try{let t=process.argv[1];if(t&&h(t).includes("/Cellar/"))return C}catch{}return y}var p=g(c,"version-check.json"),b=1440*60*1e3;function S(){try{let t=JSON.parse(m(p,"utf-8"));if(Date.now()-t.checkedAt<b)return t}catch{}return null}function k(t){try{d(c,{recursive:!0}),f(p,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function l(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function v(){try{let t=S();if(t)return l(a,t.latest)>0?{current:a,latest:t.latest,severity:u(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await fetch(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(k(e),l(a,e)>0?{current:a,latest:e,severity:u(a,e)}:null):null}catch{return null}}export{N as a,l as b,u as c,v as d};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as d}from"./chunk-2O7RIXHD.js";import{c as h,q as g,r as u}from"./chunk-7ONI2K3S.js";import{readFileSync as a,writeFileSync as f,mkdirSync as p,readdirSync as c,unlinkSync as s,existsSync as l,chmodSync as y}from"fs";import{join as n,dirname as C}from"path";var v=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(a(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){p(this.baseDir,{recursive:!0,mode:448}),f(this.configFile,JSON.stringify(t,null,2)+`
|
|
3
|
+
`),y(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(a(this.profileConfigPath(t,r),"utf-8"))}catch{return null}}writeSecure(t,r){try{p(C(t),{recursive:!0,mode:448}),f(t,JSON.stringify(r,null,2)+`
|
|
4
|
+
`),y(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(a(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(a(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(a(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 c(this.profilesDir)){let e=n(this.profilesDir,r);try{for(let i of c(e)){let o=n(e,i),P=l(n(o,"credentials")),w=l(n(o,"client.json")),k=l(n(o,"basic-auth"));(P||w||k)&&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 c(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 S,randomBytes as A}from"crypto";var m=class{authBaseUrl;consentUrl;constructor(t="prod"){let r=d(t);this.authBaseUrl=r.authBaseUrl,this.consentUrl=r.consentUrl}static generatePkce(){let t=A(96).toString("base64url").slice(0,128),r=S("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:u,code_challenge:r,code_challenge_method:"S256",state:e});return`${this.consentUrl}/oauth2?${o.toString()}`}async registerClient(t){let r=await fetch(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:g,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 fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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{v as a,m as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Tc}from"./chunk-L5Y2GUO6.js";import{a as xc}from"./chunk-
|
|
2
|
+
import{a as Tc}from"./chunk-L5Y2GUO6.js";import{a as xc}from"./chunk-YUUZDFT7.js";import{a as vc}from"./chunk-DXKKUGFG.js";import{a as P,b as ZE,c as g,d as QE,e as XE,f as JE}from"./chunk-UR6MHSHU.js";var kc=g((XB,Cc)=>{"use strict";var uv=typeof process=="object"&&process&&process.platform==="win32";Cc.exports=uv?{sep:"\\"}:{sep:"/"}});var Bc=g((JB,jc)=>{"use strict";jc.exports=qc;function qc(t,e,r){t instanceof RegExp&&(t=Mc(t,r)),e instanceof RegExp&&(e=Mc(e,r));var i=Fc(t,e,r);return i&&{start:i[0],end:i[1],pre:r.slice(0,i[0]),body:r.slice(i[0]+t.length,i[1]),post:r.slice(i[1]+e.length)}}function Mc(t,e){var r=e.match(t);return r?r[0]:null}qc.range=Fc;function Fc(t,e,r){var i,n,s,o,a,l=r.indexOf(t),u=r.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],s=r.length;f>=0&&!a;)f==l?(i.push(f),l=r.indexOf(t,f+1)):i.length==1?a=[i.pop(),u]:(n=i.pop(),n<s&&(s=n,o=u),u=r.indexOf(e,f+1)),f=l<u&&l>=0?l:u;i.length&&(a=[s,o])}return a}});var na=g((e3,Vc)=>{"use strict";var Uc=Bc();Vc.exports=hv;var Wc="\0SLASH"+Math.random()+"\0",Gc="\0OPEN"+Math.random()+"\0",ia="\0CLOSE"+Math.random()+"\0",zc="\0COMMA"+Math.random()+"\0",$c="\0PERIOD"+Math.random()+"\0";function ra(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function fv(t){return t.split("\\\\").join(Wc).split("\\{").join(Gc).split("\\}").join(ia).split("\\,").join(zc).split("\\.").join($c)}function cv(t){return t.split(Wc).join("\\").split(Gc).join("{").split(ia).join("}").split(zc).join(",").split($c).join(".")}function Hc(t){if(!t)return[""];var e=[],r=Uc("{","}",t);if(!r)return t.split(",");var i=r.pre,n=r.body,s=r.post,o=i.split(",");o[o.length-1]+="{"+n+"}";var a=Hc(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function hv(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),gi(fv(t),!0).map(cv)):[]}function dv(t){return"{"+t+"}"}function pv(t){return/^-?0\d/.test(t)}function gv(t,e){return t<=e}function _v(t,e){return t>=e}function gi(t,e){var r=[],i=Uc("{","}",t);if(!i)return[t];var n=i.pre,s=i.post.length?gi(i.post,!1):[""];if(/\$$/.test(i.pre))for(var o=0;o<s.length;o++){var a=n+"{"+i.body+"}"+s[o];r.push(a)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),f=l||u,c=i.body.indexOf(",")>=0;if(!f&&!c)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+ia+i.post,gi(t)):[t];var h;if(f)h=i.body.split(/\.\./);else if(h=Hc(i.body),h.length===1&&(h=gi(h[0],!1).map(dv),h.length===1))return s.map(function(R){return i.pre+h[0]+R});var d;if(f){var m=ra(h[0]),p=ra(h[1]),E=Math.max(h[0].length,h[1].length),y=h.length==3?Math.max(Math.abs(ra(h[2])),1):1,b=gv,v=p<m;v&&(y*=-1,b=_v);var S=h.some(pv);d=[];for(var T=m;b(T,p);T+=y){var D;if(u)D=String.fromCharCode(T),D==="\\"&&(D="");else if(D=String(T),S){var x=E-D.length;if(x>0){var O=new Array(x+1).join("0");T<0?D="-"+O+D.slice(1):D=O+D}}d.push(D)}}else{d=[];for(var w=0;w<h.length;w++)d.push.apply(d,gi(h[w],!1))}for(var w=0;w<d.length;w++)for(var o=0;o<s.length;o++){var a=n+d[w]+s[o];(!e||f||a)&&r.push(a)}}return r}});var Jc=g((r3,ua)=>{"use strict";var Ne=ua.exports=(t,e,r={})=>(Mn(e),!r.nocomment&&e.charAt(0)==="#"?!1:new wr(e,r).match(t));ua.exports=Ne;var aa=kc();Ne.sep=aa.sep;var Ae=Symbol("globstar **");Ne.GLOBSTAR=Ae;var yv=na(),Yc={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},la="[^/]",sa=la+"*?",mv="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",bv="(?:(?!(?:\\/|^)\\.).)*?",Qc=t=>t.split("").reduce((e,r)=>(e[r]=!0,e),{}),Kc=Qc("().*{}+?[]^$\\!"),wv=Qc("[.("),Zc=/\/+/;Ne.filter=(t,e={})=>(r,i,n)=>Ne(r,t,e);var Rt=(t,e={})=>{let r={};return Object.keys(t).forEach(i=>r[i]=t[i]),Object.keys(e).forEach(i=>r[i]=e[i]),r};Ne.defaults=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Ne;let e=Ne,r=(i,n,s)=>e(i,n,Rt(t,s));return r.Minimatch=class extends e.Minimatch{constructor(n,s){super(n,Rt(t,s))}},r.Minimatch.defaults=i=>e.defaults(Rt(t,i)).Minimatch,r.filter=(i,n)=>e.filter(i,Rt(t,n)),r.defaults=i=>e.defaults(Rt(t,i)),r.makeRe=(i,n)=>e.makeRe(i,Rt(t,n)),r.braceExpand=(i,n)=>e.braceExpand(i,Rt(t,n)),r.match=(i,n,s)=>e.match(i,n,Rt(t,s)),r};Ne.braceExpand=(t,e)=>Xc(t,e);var Xc=(t,e={})=>(Mn(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:yv(t)),Sv=1024*64,Mn=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>Sv)throw new TypeError("pattern is too long")},oa=Symbol("subparse");Ne.makeRe=(t,e)=>new wr(t,e||{}).makeRe();Ne.match=(t,e,r={})=>{let i=new wr(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};var Ev=t=>t.replace(/\\(.)/g,"$1"),vv=t=>t.replace(/\\([^-\]])/g,"$1"),xv=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Tv=t=>t.replace(/[[\]\\]/g,"\\$&"),wr=class{constructor(e,r){Mn(e),r||(r={}),this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion!==void 0?r.maxGlobstarRecursion:200,this.set=[],this.pattern=e,this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}debug(){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();let i=this.globSet=this.braceExpand();r.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,i),i=this.globParts=i.map(n=>n.split(Zc)),this.debug(this.pattern,i),i=i.map((n,s,o)=>n.map(this.parse,this)),this.debug(this.pattern,i),i=i.filter(n=>n.indexOf(!1)===-1),this.debug(this.pattern,i),this.set=i}parseNegate(){if(this.options.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i){return r.indexOf(Ae)!==-1?this._matchGlobstar(e,r,i,0,0):this._matchOne(e,r,i,0,0)}_matchGlobstar(e,r,i,n,s){let o=-1;for(let b=s;b<r.length;b++)if(r[b]===Ae){o=b;break}let a=-1;for(let b=r.length-1;b>=0;b--)if(r[b]===Ae){a=b;break}let l=r.slice(s,o),u=i?r.slice(o+1):r.slice(o+1,a),f=i?[]:r.slice(a+1);if(l.length){let b=e.slice(n,n+l.length);if(!this._matchOne(b,l,i,0,0))return!1;n+=l.length}let c=0;if(f.length){if(f.length+n>e.length)return!1;let b=e.length-f.length;if(this._matchOne(e,f,i,b,0))c=f.length;else{if(e[e.length-1]!==""||n+f.length===e.length||!this._matchOne(e,f,i,b-1,0))return!1;c=f.length+1}}if(!u.length){let b=!!c;for(let v=n;v<e.length-c;v++){let S=String(e[v]);if(b=!0,S==="."||S===".."||!this.options.dot&&S.charAt(0)===".")return!1}return i||b}let h=[[[],0]],d=h[0],m=0,p=[0];for(let b of u)b===Ae?(p.push(m),d=[[],0],h.push(d)):(d[0].push(b),m++);let E=h.length-1,y=e.length-c;for(let b of h)b[1]=y-(p[E--]+b[0].length);return!!this._matchGlobStarBodySections(e,h,n,0,i,0,!!c)}_matchGlobStarBodySections(e,r,i,n,s,o,a){let l=r[n];if(!l){for(let c=i;c<e.length;c++){a=!0;let h=e[c];if(h==="."||h===".."||!this.options.dot&&h.charAt(0)===".")return!1}return a}let[u,f]=l;for(;i<=f;){if(this._matchOne(e.slice(0,i+u.length),u,s,i,0)&&o<this.maxGlobstarRecursion){let d=this._matchGlobStarBodySections(e,r,i+u.length,n+1,s,o+1,a);if(d!==!1)return d}let h=e[i];if(h==="."||h===".."||!this.options.dot&&h.charAt(0)===".")return!1;i++}return s||null}_matchOne(e,r,i,n,s){let o,a,l,u;for(o=n,a=s,l=e.length,u=r.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let f=r[a],c=e[o];if(this.debug(r,f,c),f===!1||f===Ae)return!1;let h;if(typeof f=="string"?(h=c===f,this.debug("string match",f,c,h)):(h=c.match(f),this.debug("pattern match",f,c,h)),!h)return!1}if(o===l&&a===u)return!0;if(o===l)return i;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Xc(this.pattern,this.options)}parse(e,r){Mn(e);let i=this.options;if(e==="**")if(i.noglobstar)e="*";else return Ae;if(e==="")return"";let n="",s=!1,o=!1,a=[],l=[],u,f=!1,c=-1,h=-1,d,m,p,E=e.charAt(0)===".",y=i.dot||E,b=()=>E?"":y?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",v=x=>x.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",S=()=>{if(u){switch(u){case"*":n+=sa,s=!0;break;case"?":n+=la,s=!0;break;default:n+="\\"+u;break}this.debug("clearStateChar %j %j",u,n),u=!1}};for(let x=0,O;x<e.length&&(O=e.charAt(x));x++){if(this.debug("%s %s %s %j",e,x,n,O),o){if(O==="/")return!1;Kc[O]&&(n+="\\"),n+=O,o=!1;continue}switch(O){case"/":return!1;case"\\":if(f&&e.charAt(x+1)==="-"){n+=O;continue}S(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,x,n,O),f){this.debug(" in class"),O==="!"&&x===h+1&&(O="^"),n+=O;continue}if(O==="*"&&u==="*")continue;this.debug("call clearStateChar %j",u),S(),u=O,i.noext&&S();continue;case"(":{if(f){n+="(";continue}if(!u){n+="\\(";continue}let w={type:u,start:x-1,reStart:n.length,open:Yc[u].open,close:Yc[u].close};this.debug(this.pattern," ",w),a.push(w),n+=w.open,w.start===0&&w.type!=="!"&&(E=!0,n+=v(e.slice(x+1))),this.debug("plType %j %j",u,n),u=!1;continue}case")":{let w=a[a.length-1];if(f||!w){n+="\\)";continue}a.pop(),S(),s=!0,m=w,n+=m.close,m.type==="!"&&l.push(Object.assign(m,{reEnd:n.length}));continue}case"|":{let w=a[a.length-1];if(f||!w){n+="\\|";continue}S(),n+="|",w.start===0&&w.type!=="!"&&(E=!0,n+=v(e.slice(x+1)));continue}case"[":if(S(),f){n+="\\"+O;continue}f=!0,h=x,c=n.length,n+=O;continue;case"]":if(x===h+1||!f){n+="\\"+O;continue}d=e.substring(h+1,x);try{RegExp("["+Tv(vv(d))+"]"),n+=O}catch{n=n.substring(0,c)+"(?:$.)"}s=!0,f=!1;continue;default:S(),Kc[O]&&!(O==="^"&&f)&&(n+="\\"),n+=O;break}}for(f&&(d=e.slice(h+1),p=this.parse(d,oa),n=n.substring(0,c)+"\\["+p[0],s=s||p[1]),m=a.pop();m;m=a.pop()){let x;x=n.slice(m.reStart+m.open.length),this.debug("setting tail",n,m),x=x.replace(/((?:\\{2}){0,64})(\\?)\|/g,(w,R,A)=>(A||(A="\\"),R+R+A+"|")),this.debug(`tail=%j
|
|
3
3
|
%s`,x,x,m,n);let O=m.type==="*"?sa:m.type==="?"?la:"\\"+m.type;s=!0,n=n.slice(0,m.reStart)+O+"\\("+x}S(),o&&(n+="\\\\");let T=wv[n.charAt(0)];for(let x=l.length-1;x>-1;x--){let O=l[x],w=n.slice(0,O.reStart),R=n.slice(O.reStart,O.reEnd-8),A=n.slice(O.reEnd),N=n.slice(O.reEnd-8,O.reEnd)+A,G=w.split(")").length,ue=w.split("(").length-G,Z=A;for(let V=0;V<ue;V++)Z=Z.replace(/\)[+*?]?/,"");A=Z;let te=A===""&&r!==oa?"(?:$|\\/)":"";n=w+R+A+te+N}if(n!==""&&s&&(n="(?=.)"+n),T&&(n=b()+n),r===oa)return[n,s];if(i.nocase&&!s&&(s=e.toUpperCase()!==e.toLowerCase()),!s)return Ev(e);let D=i.nocase?"i":"";try{return Object.assign(new RegExp("^"+n+"$",D),{_glob:e,_src:n})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?sa:r.dot?mv:bv,n=r.nocase?"i":"",s=e.map(o=>(o=o.map(a=>typeof a=="string"?xv(a):a===Ae?Ae:a._src).reduce((a,l)=>(a[a.length-1]===Ae&&l===Ae||a.push(l),a),[]),o.forEach((a,l)=>{a!==Ae||o[l-1]===Ae||(l===0?o.length>1?o[l+1]="(?:\\/|"+i+"\\/)?"+o[l+1]:o[l]=i:l===o.length-1?o[l-1]+="(?:\\/|"+i+")?":(o[l-1]+="(?:\\/|\\/"+i+"\\/)"+o[l+1],o[l+1]=Ae))}),o.filter(a=>a!==Ae).join("/"))).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,n)}catch{this.regexp=!1}return this.regexp}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;aa.sep!=="/"&&(e=e.split(aa.sep).join("/")),e=e.split(Zc),this.debug(this.pattern,"split",e);let n=this.set;this.debug(this.pattern,"set",n);let s;for(let o=e.length-1;o>=0&&(s=e[o],!s);o--);for(let o=0;o<n.length;o++){let a=n[o],l=e;if(i.matchBase&&a.length===1&&(l=[s]),this.matchOne(l,a,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return Ne.defaults(e).Minimatch}};Ne.Minimatch=wr});var nh=g((i3,ih)=>{"use strict";ih.exports=rh;var ca=P("fs"),{EventEmitter:Rv}=P("events"),{Minimatch:fa}=Jc(),{resolve:Av}=P("path");function Ov(t,e){return new Promise((r,i)=>{ca.readdir(t,{withFileTypes:!0},(n,s)=>{if(n)switch(n.code){case"ENOTDIR":e?i(n):r([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":r([]);break;default:i(n);break}else r(s)})})}function eh(t,e){return new Promise((r,i)=>{(e?ca.stat:ca.lstat)(t,(s,o)=>{s?s.code==="ENOENT"?r(e?eh(t,!1):null):r(null):r(o)})})}async function*th(t,e,r,i,n,s){let o=await Ov(e+t,s);for(let a of o){let l=a.name;l===void 0&&(l=a,i=!0);let u=t+"/"+l,f=u.slice(1),c=e+"/"+f,h=null;(i||r)&&(h=await eh(c,r)),!h&&a.name!==void 0&&(h=a),h===null&&(h={isDirectory:()=>!1}),h.isDirectory()?n(f)||(yield{relative:f,absolute:c,stats:h},yield*th(u,e,r,i,n,!1)):yield{relative:f,absolute:c,stats:h}}}async function*Iv(t,e,r,i){yield*th("",t,e,r,i,!0)}function Dv(t){return{pattern:t.pattern,dot:!!t.dot,noglobstar:!!t.noglobstar,matchBase:!!t.matchBase,nocase:!!t.nocase,ignore:t.ignore,skip:t.skip,follow:!!t.follow,stat:!!t.stat,nodir:!!t.nodir,mark:!!t.mark,silent:!!t.silent,absolute:!!t.absolute}}var qn=class extends Rv{constructor(e,r,i){if(super(),typeof r=="function"&&(i=r,r=null),this.options=Dv(r||{}),this.matchers=[],this.options.pattern){let n=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=n.map(s=>new fa(s,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let n=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=n.map(s=>new fa(s,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let n=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=n.map(s=>new fa(s,{dot:!0}))}this.iterator=Iv(Av(e||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,i&&(this._matches=[],this.on("match",n=>this._matches.push(this.options.absolute?n.absolute:n.relative)),this.on("error",n=>i(n)),this.on("end",()=>i(null,this._matches))),setTimeout(()=>this._next(),0)}_shouldSkipDirectory(e){return this.skipMatchers.some(r=>r.match(e))}_fileMatches(e,r){let i=e+(r?"/":"");return(this.matchers.length===0||this.matchers.some(n=>n.match(i)))&&!this.ignoreMatchers.some(n=>n.match(i))&&(!this.options.nodir||!r)}_next(){!this.paused&&!this.aborted?this.iterator.next().then(e=>{if(e.done)this.emit("end");else{let r=e.value.stats.isDirectory();if(this._fileMatches(e.value.relative,r)){let i=e.value.relative,n=e.value.absolute;this.options.mark&&r&&(i+="/",n+="/"),this.options.stat?this.emit("match",{relative:i,absolute:n,stat:e.value.stats}):this.emit("match",{relative:i,absolute:n})}this._next(this.iterator)}}).catch(e=>{this.abort(),this.emit("error",e),!e.code&&!this.options.silent&&console.error(e)}):this.inactive=!0}abort(){this.aborted=!0}pause(){this.paused=!0}resume(){this.paused=!1,this.inactive&&(this.inactive=!1,this._next())}};function rh(t,e,r){return new qn(t,e,r)}rh.ReaddirGlob=qn});var rd={};QE(rd,{all:()=>wa,allLimit:()=>Sa,allSeries:()=>Ea,any:()=>Ia,anyLimit:()=>Da,anySeries:()=>Pa,apply:()=>fh,applyEach:()=>_h,applyEachSeries:()=>yh,asyncify:()=>jn,auto:()=>Ca,autoInject:()=>mh,cargo:()=>bh,cargoQueue:()=>wh,compose:()=>Sh,concat:()=>pa,concatLimit:()=>mi,concatSeries:()=>ga,constant:()=>Eh,default:()=>kx,detect:()=>_a,detectLimit:()=>ya,detectSeries:()=>ma,dir:()=>xh,doDuring:()=>Bn,doUntil:()=>Th,doWhilst:()=>Bn,during:()=>$n,each:()=>ba,eachLimit:()=>Un,eachOf:()=>Fe,eachOfLimit:()=>yi,eachOfSeries:()=>Xe,eachSeries:()=>Wn,ensureAsync:()=>qa,every:()=>wa,everyLimit:()=>Sa,everySeries:()=>Ea,filter:()=>va,filterLimit:()=>xa,filterSeries:()=>Ta,find:()=>_a,findLimit:()=>ya,findSeries:()=>ma,flatMap:()=>pa,flatMapLimit:()=>mi,flatMapSeries:()=>ga,foldl:()=>Sr,foldr:()=>Aa,forEach:()=>ba,forEachLimit:()=>Un,forEachOf:()=>Fe,forEachOfLimit:()=>yi,forEachOfSeries:()=>Xe,forEachSeries:()=>Wn,forever:()=>Ah,groupBy:()=>Oh,groupByLimit:()=>Zn,groupBySeries:()=>Ih,inject:()=>Sr,log:()=>Dh,map:()=>Yn,mapLimit:()=>Si,mapSeries:()=>Na,mapValues:()=>Ph,mapValuesLimit:()=>Qn,mapValuesSeries:()=>Lh,memoize:()=>Nh,nextTick:()=>Ch,parallel:()=>kh,parallelLimit:()=>Mh,priorityQueue:()=>qh,queue:()=>ja,race:()=>Fh,reduce:()=>Sr,reduceRight:()=>Aa,reflect:()=>Gn,reflectAll:()=>jh,reject:()=>Bh,rejectLimit:()=>Uh,rejectSeries:()=>Wh,retry:()=>zn,retryable:()=>$h,select:()=>va,selectLimit:()=>xa,selectSeries:()=>Ta,seq:()=>Ma,series:()=>Hh,setImmediate:()=>At,some:()=>Ia,someLimit:()=>Da,someSeries:()=>Pa,sortBy:()=>Vh,timeout:()=>Yh,times:()=>Kh,timesLimit:()=>Xn,timesSeries:()=>Zh,transform:()=>Qh,tryEach:()=>Xh,unmemoize:()=>Jh,until:()=>ed,waterfall:()=>td,whilst:()=>$n,wrapSync:()=>jn});function fh(t,...e){return(...r)=>t(...e,...r)}function bi(t){return function(...e){var r=e.pop();return t.call(this,e,r)}}function dh(t){setTimeout(t,0)}function ph(t){return(e,...r)=>t(()=>e(...r))}function jn(t){return wi(t)?function(...e){let r=e.pop(),i=t.apply(this,e);return sh(i,r)}:bi(function(e,r){var i;try{i=t.apply(this,e)}catch(n){return r(n)}if(i&&typeof i.then=="function")return sh(i,r);r(null,i)})}function sh(t,e){return t.then(r=>{oh(e,null,r)},r=>{oh(e,r&&(r instanceof Error||r.message)?r:new Error(r))})}function oh(t,e,r){try{t(e,r)}catch(i){At(n=>{throw n},i)}}function wi(t){return t[Symbol.toStringTag]==="AsyncFunction"}function Lv(t){return t[Symbol.toStringTag]==="AsyncGenerator"}function Nv(t){return typeof t[Symbol.asyncIterator]=="function"}function q(t){if(typeof t!="function")throw new Error("expected a function");return wi(t)?jn(t):t}function M(t,e){if(e||(e=t.length),!e)throw new Error("arity is undefined");function r(...i){return typeof i[e-1]=="function"?t.apply(this,i):new Promise((n,s)=>{i[e-1]=(o,...a)=>{if(o)return s(o);n(a.length>1?a:a[0])},t.apply(this,i)})}return r}function gh(t){return function(r,...i){return M(function(s){var o=this;return t(r,(a,l)=>{q(a).apply(o,i.concat(l))},s)})}}function La(t,e,r,i){e=e||[];var n=[],s=0,o=q(r);return t(e,(a,l,u)=>{var f=s++;o(a,(c,h)=>{n[f]=h,u(c)})},a=>{i(a,n)})}function Hn(t){return t&&typeof t.length=="number"&&t.length>=0&&t.length%1===0}function Ot(t){function e(...r){if(t!==null){var i=t;t=null,i.apply(this,r)}}return Object.assign(e,t),e}function Cv(t){return t[Symbol.iterator]&&t[Symbol.iterator]()}function kv(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}function Mv(t){var e=-1;return function(){var i=t.next();return i.done?null:(e++,{value:i.value,key:e})}}function qv(t){var e=t?Object.keys(t):[],r=-1,i=e.length;return function n(){var s=e[++r];return s==="__proto__"?n():r<i?{value:t[s],key:s}:null}}function Fv(t){if(Hn(t))return kv(t);var e=Cv(t);return e?Mv(e):qv(t)}function It(t){return function(...e){if(t===null)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}}function ah(t,e,r,i){let n=!1,s=!1,o=!1,a=0,l=0;function u(){a>=e||o||n||(o=!0,t.next().then(({value:h,done:d})=>{if(!(s||n)){if(o=!1,d){n=!0,a<=0&&i(null);return}a++,r(h,l,f),l++,u()}}).catch(c))}function f(h,d){if(a-=1,!s){if(h)return c(h);if(h===!1){n=!0,s=!0;return}if(d===Vn||n&&a<=0)return n=!0,i(null);u()}}function c(h){s||(o=!1,n=!0,i(h))}u()}function jv(t,e,r,i){return $e(e)(t,q(r),i)}function Bv(t,e,r){r=Ot(r);var i=0,n=0,{length:s}=t,o=!1;s===0&&r(null);function a(l,u){l===!1&&(o=!0),o!==!0&&(l?r(l):(++n===s||u===Vn)&&r(null))}for(;i<s;i++)e(t[i],i,It(a))}function Uv(t,e,r){return yi(t,1/0,e,r)}function Wv(t,e,r){var i=Hn(t)?Bv:Uv;return i(t,q(e),r)}function Gv(t,e,r){return La(Fe,t,e,r)}function zv(t,e,r){return yi(t,1,e,r)}function $v(t,e,r){return La(Xe,t,e,r)}function Er(){let t,e;function r(i,...n){if(i)return e(i);t(n.length>1?n:n[0])}return r[vr]=new Promise((i,n)=>{t=i,e=n}),r}function Ca(t,e,r){typeof e!="number"&&(r=e,e=null),r=Ot(r||Er());var i=Object.keys(t).length;if(!i)return r(null);e||(e=i);var n={},s=0,o=!1,a=!1,l=Object.create(null),u=[],f=[],c={};Object.keys(t).forEach(v=>{var S=t[v];if(!Array.isArray(S)){h(v,[S]),f.push(v);return}var T=S.slice(0,S.length-1),D=T.length;if(D===0){h(v,S),f.push(v);return}c[v]=D,T.forEach(x=>{if(!t[x])throw new Error("async.auto task `"+v+"` has a non-existent dependency `"+x+"` in "+T.join(", "));m(x,()=>{D--,D===0&&h(v,S)})})}),y(),d();function h(v,S){u.push(()=>E(v,S))}function d(){if(!o){if(u.length===0&&s===0)return r(null,n);for(;u.length&&s<e;){var v=u.shift();v()}}}function m(v,S){var T=l[v];T||(T=l[v]=[]),T.push(S)}function p(v){var S=l[v]||[];S.forEach(T=>T()),d()}function E(v,S){if(!a){var T=It((x,...O)=>{if(s--,x===!1){o=!0;return}if(O.length<2&&([O]=O),x){var w={};if(Object.keys(n).forEach(R=>{w[R]=n[R]}),w[v]=O,a=!0,l=Object.create(null),o)return;r(x,w)}else n[v]=O,p(v)});s++;var D=q(S[S.length-1]);S.length>1?D(n,T):D(T)}}function y(){for(var v,S=0;f.length;)v=f.pop(),S++,b(v).forEach(T=>{--c[T]===0&&f.push(T)});if(S!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function b(v){var S=[];return Object.keys(t).forEach(T=>{let D=t[T];Array.isArray(D)&&D.indexOf(v)>=0&&S.push(T)}),S}return r[vr]}function Zv(t){let e="",r=0,i=t.indexOf("*/");for(;r<t.length;)if(t[r]==="/"&&t[r+1]==="/"){let n=t.indexOf(`
|
|
4
4
|
`,r);r=n===-1?t.length:n}else if(i!==-1&&t[r]==="/"&&t[r+1]==="*"){let n=t.indexOf("*/",r);n!==-1?(r=n+2,i=t.indexOf("*/",r)):(e+=t[r],r++)}else e+=t[r],r++;return e}function Qv(t){let e=Zv(t.toString()),r=e.match(Hv);if(r||(r=e.match(Vv)),!r)throw new Error(`could not parse args in autoInject
|
|
5
5
|
Source:
|
|
@@ -10,7 +10,7 @@ GFS4: `),console.error(t)});ne[me]||(cd=global[me]||[],dd(ne,cd),ne.close=(funct
|
|
|
10
10
|
`));let i=e.pax;if(i)for(let n in i)r+=ac(" "+n+"="+i[n]+`
|
|
11
11
|
`);return W.from(r)};fi.decodePax=function(e){let r={};for(;e.length;){let i=0;for(;i<e.length&&e[i]!==32;)i++;let n=parseInt(W.toString(e.subarray(0,i)),10);if(!n)return r;let s=W.toString(e.subarray(i+1,n-1)),o=s.indexOf("=");if(o===-1)return r;r[s.slice(0,o)]=s.slice(o+1),e=e.subarray(n)}return r};fi.encode=function(e){let r=W.alloc(512),i=e.name,n="";if(e.typeflag===5&&i[i.length-1]!=="/"&&(i+="/"),W.byteLength(i)!==i.length)return null;for(;W.byteLength(i)>100;){let s=i.indexOf("/");if(s===-1)return null;n+=n?"/"+i.slice(0,s):i.slice(0,s),i=i.slice(s+1)}return W.byteLength(i)>100||W.byteLength(n)>155||e.linkname&&W.byteLength(e.linkname)>100?null:(W.write(r,i),W.write(r,Yt(e.mode&uB,6),100),W.write(r,Yt(e.uid,6),108),W.write(r,Yt(e.gid,6),116),_B(e.size,r,124),W.write(r,Yt(e.mtime.getTime()/1e3|0,11),136),r[156]=Jo+pB(e.type),e.linkname&&W.write(r,e.linkname,157),W.copy(gE,r,Nn),W.copy(oB,r,lc),e.uname&&W.write(r,e.uname,265),e.gname&&W.write(r,e.gname,297),W.write(r,Yt(e.devmajor||0,6),329),W.write(r,Yt(e.devminor||0,6),337),n&&W.write(r,n,345),W.write(r,Yt(yE(r),6),148),r)};fi.decode=function(e,r,i){let n=e[156]===0?0:e[156]-Jo,s=ui(e,0,100,r),o=Vt(e,100,8),a=Vt(e,108,8),l=Vt(e,116,8),u=Vt(e,124,12),f=Vt(e,136,12),c=dB(n),h=e[157]===0?null:ui(e,157,100,r),d=ui(e,265,32),m=ui(e,297,32),p=Vt(e,329,8),E=Vt(e,337,8),y=yE(e);if(y===256)return null;if(y!==Vt(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(fB(e))e[345]&&(s=ui(e,345,155,r)+"/"+s);else if(!cB(e)){if(!i)throw new Error("Invalid tar header: unknown format.")}return n===0&&s&&s[s.length-1]==="/"&&(n=5),{name:s,mode:o,uid:a,gid:l,size:u,mtime:new Date(1e3*f),type:c,linkname:h,uname:d,gname:m,devmajor:p,devminor:E,pax:null}};function fB(t){return W.equals(gE,t.subarray(Nn,Nn+6))}function cB(t){return W.equals(aB,t.subarray(Nn,Nn+6))&&W.equals(lB,t.subarray(lc,lc+2))}function hB(t,e,r){return typeof t!="number"?r:(t=~~t,t>=e?e:t>=0||(t+=e,t>=0)?t:0)}function dB(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function pB(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function _E(t,e,r,i){for(;r<i;r++)if(t[r]===e)return r;return i}function yE(t){let e=256;for(let r=0;r<148;r++)e+=t[r];for(let r=156;r<512;r++)e+=t[r];return e}function Yt(t,e){return t=t.toString(8),t.length>e?sB.slice(0,e)+" ":nB.slice(0,e-t.length)+t+" "}function gB(t,e,r){e[r]=128;for(let i=11;i>0;i--)e[r+i]=t&255,t=Math.floor(t/256)}function _B(t,e,r){t.toString(8).length>11?gB(t,e,r):W.write(e,Yt(t,11),r)}function yB(t){let e;if(t[0]===128)e=!0;else if(t[0]===255)e=!1;else return null;let r=[],i;for(i=t.length-1;i>0;i--){let o=t[i];e?r.push(o):r.push(255-o)}let n=0,s=r.length;for(i=0;i<s;i++)n+=r[i]*Math.pow(256,i);return e?n:-1*n}function Vt(t,e,r){if(t=t.subarray(e,e+r),e=0,t[e]&128)return yB(t);{for(;e<t.length&&t[e]===32;)e++;let i=hB(_E(t,32,e,t.length),t.length,t.length);for(;e<i&&t[e]===0;)e++;return i===e?0:parseInt(W.toString(t.subarray(e,i)),8)}}function ui(t,e,r,i){return W.toString(t.subarray(e,_E(t,0,e,e+r)),i)}function ac(t){let e=W.byteLength(t),r=Math.floor(Math.log(e)/Math.log(10))+1;return e+r>=Math.pow(10,r)&&r++,e+r+t}});var EE=g((HU,SE)=>{"use strict";var{Writable:mB,Readable:bB,getStreamError:mE}=oc(),wB=Gf(),bE=Xo(),ci=uc(),SB=bE.alloc(0),cc=class{constructor(){this.buffered=0,this.shifted=0,this.queue=new wB,this._offset=0}push(e){this.buffered+=e.byteLength,this.queue.push(e)}shiftFirst(e){return this._buffered===0?null:this._next(e)}shift(e){if(e>this.buffered)return null;if(e===0)return SB;let r=this._next(e);if(e===r.byteLength)return r;let i=[r];for(;(e-=r.byteLength)>0;)r=this._next(e),i.push(r);return bE.concat(i)}_next(e){let r=this.queue.peek(),i=r.byteLength-this._offset;if(e>=i){let n=this._offset?r.subarray(this._offset,r.byteLength):r;return this.queue.shift(),this._offset=0,this.buffered-=i,this.shifted+=i,n}return this.buffered-=e,this.shifted+=e,r.subarray(this._offset,this._offset+=e)}},hc=class extends bB{constructor(e,r,i){super(),this.header=r,this.offset=i,this._parent=e}_read(e){this.header.size===0&&this.push(null),this._parent._stream===this&&this._parent._update(),e(null)}_predestroy(){this._parent.destroy(mE(this))}_detach(){this._parent._stream===this&&(this._parent._stream=null,this._parent._missing=wE(this.header.size),this._parent._update())}_destroy(e){this._detach(),e(null)}},dc=class extends mB{constructor(e){super(e),e||(e={}),this._buffer=new cc,this._offset=0,this._header=null,this._stream=null,this._missing=0,this._longHeader=!1,this._callback=fc,this._locked=!1,this._finished=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null,this._filenameEncoding=e.filenameEncoding||"utf-8",this._allowUnknownFormat=!!e.allowUnknownFormat,this._unlockBound=this._unlock.bind(this)}_unlock(e){if(this._locked=!1,e){this.destroy(e),this._continueWrite(e);return}this._update()}_consumeHeader(){if(this._locked)return!1;this._offset=this._buffer.shifted;try{this._header=ci.decode(this._buffer.shift(512),this._filenameEncoding,this._allowUnknownFormat)}catch(e){return this._continueWrite(e),!1}if(!this._header)return!0;switch(this._header.type){case"gnu-long-path":case"gnu-long-link-path":case"pax-global-header":case"pax-header":return this._longHeader=!0,this._missing=this._header.size,!0}return this._locked=!0,this._applyLongHeaders(),this._header.size===0||this._header.type==="directory"?(this.emit("entry",this._header,this._createStream(),this._unlockBound),!0):(this._stream=this._createStream(),this._missing=this._header.size,this.emit("entry",this._header,this._stream,this._unlockBound),!0)}_applyLongHeaders(){this._gnuLongPath&&(this._header.name=this._gnuLongPath,this._gnuLongPath=null),this._gnuLongLinkPath&&(this._header.linkname=this._gnuLongLinkPath,this._gnuLongLinkPath=null),this._pax&&(this._pax.path&&(this._header.name=this._pax.path),this._pax.linkpath&&(this._header.linkname=this._pax.linkpath),this._pax.size&&(this._header.size=parseInt(this._pax.size,10)),this._header.pax=this._pax,this._pax=null)}_decodeLongHeader(e){switch(this._header.type){case"gnu-long-path":this._gnuLongPath=ci.decodeLongPath(e,this._filenameEncoding);break;case"gnu-long-link-path":this._gnuLongLinkPath=ci.decodeLongPath(e,this._filenameEncoding);break;case"pax-global-header":this._paxGlobal=ci.decodePax(e);break;case"pax-header":this._pax=this._paxGlobal===null?ci.decodePax(e):Object.assign({},this._paxGlobal,ci.decodePax(e));break}}_consumeLongHeader(){this._longHeader=!1,this._missing=wE(this._header.size);let e=this._buffer.shift(this._header.size);try{this._decodeLongHeader(e)}catch(r){return this._continueWrite(r),!1}return!0}_consumeStream(){let e=this._buffer.shiftFirst(this._missing);if(e===null)return!1;this._missing-=e.byteLength;let r=this._stream.push(e);return this._missing===0?(this._stream.push(null),r&&this._stream._detach(),r&&this._locked===!1):r}_createStream(){return new hc(this,this._header,this._offset)}_update(){for(;this._buffer.buffered>0&&!this.destroying;){if(this._missing>0){if(this._stream!==null){if(this._consumeStream()===!1)return;continue}if(this._longHeader===!0){if(this._missing>this._buffer.buffered)break;if(this._consumeLongHeader()===!1)return!1;continue}let e=this._buffer.shiftFirst(this._missing);e!==null&&(this._missing-=e.byteLength);continue}if(this._buffer.buffered<512)break;if(this._stream!==null||this._consumeHeader()===!1)return}this._continueWrite(null)}_continueWrite(e){let r=this._callback;this._callback=fc,r(e)}_write(e,r){this._callback=r,this._buffer.push(e),this._update()}_final(e){this._finished=this._missing===0&&this._buffer.buffered===0,e(this._finished?null:new Error("Unexpected end of data"))}_predestroy(){this._continueWrite(null)}_destroy(e){this._stream&&this._stream.destroy(mE(this)),e(null)}[Symbol.asyncIterator](){let e=null,r=null,i=null,n=null,s=null,o=this;return this.on("entry",u),this.on("error",h=>{e=h}),this.on("close",f),{[Symbol.asyncIterator](){return this},next(){return new Promise(l)},return(){return c(null)},throw(h){return c(h)}};function a(h){if(!s)return;let d=s;s=null,d(h)}function l(h,d){if(e)return d(e);if(n){h({value:n,done:!1}),n=null;return}r=h,i=d,a(null),o._finished&&r&&(r({value:void 0,done:!0}),r=i=null)}function u(h,d,m){s=m,d.on("error",fc),r?(r({value:d,done:!1}),r=i=null):n=d}function f(){a(e),r&&(e?i(e):r({value:void 0,done:!0}),r=i=null)}function c(h){return o.destroy(h),a(h),new Promise((d,m)=>{if(o.destroyed)return d({value:void 0,done:!0});o.once("close",function(){h?m(h):d({value:void 0,done:!0})})})}}};SE.exports=function(e){return new dc(e)};function fc(){}function wE(t){return t&=511,t&&512-t}});var xE=g((VU,pc)=>{"use strict";var vE={S_IFMT:61440,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960};try{pc.exports=P("fs").constants||vE}catch{pc.exports=vE}});var IE=g((YU,OE)=>{"use strict";var{Readable:EB,Writable:vB,getStreamError:TE}=oc(),br=Xo(),hi=xE(),ea=uc(),xB=493,TB=420,RE=br.alloc(1024),_c=class extends vB{constructor(e,r,i){super({mapWritable:AB,eagerOpen:!0}),this.written=0,this.header=r,this._callback=i,this._linkname=null,this._isLinkname=r.type==="symlink"&&!r.linkname,this._isVoid=r.type!=="file"&&r.type!=="contiguous-file",this._finished=!1,this._pack=e,this._openCallback=null,this._pack._stream===null?this._pack._stream=this:this._pack._pending.push(this)}_open(e){this._openCallback=e,this._pack._stream===this&&this._continueOpen()}_continuePack(e){if(this._callback===null)return;let r=this._callback;this._callback=null,r(e)}_continueOpen(){this._pack._stream===null&&(this._pack._stream=this);let e=this._openCallback;if(this._openCallback=null,e!==null){if(this._pack.destroying)return e(new Error("pack stream destroyed"));if(this._pack._finalized)return e(new Error("pack stream is already finalized"));this._pack._stream=this,this._isLinkname||this._pack._encode(this.header),this._isVoid&&(this._finish(),this._continuePack(null)),e(null)}}_write(e,r){if(this._isLinkname)return this._linkname=this._linkname?br.concat([this._linkname,e]):e,r(null);if(this._isVoid)return e.byteLength>0?r(new Error("No body allowed for this entry")):r();if(this.written+=e.byteLength,this._pack.push(e))return r();this._pack._drain=r}_finish(){this._finished||(this._finished=!0,this._isLinkname&&(this.header.linkname=this._linkname?br.toString(this._linkname,"utf-8"):"",this._pack._encode(this.header)),AE(this._pack,this.header.size),this._pack._done(this))}_final(e){if(this.written!==this.header.size)return e(new Error("Size mismatch"));this._finish(),e(null)}_getError(){return TE(this)||new Error("tar entry destroyed")}_predestroy(){this._pack.destroy(this._getError())}_destroy(e){this._pack._done(this),this._continuePack(this._finished?null:this._getError()),e()}},yc=class extends EB{constructor(e){super(e),this._drain=gc,this._finalized=!1,this._finalizing=!1,this._pending=[],this._stream=null}entry(e,r,i){if(this._finalized||this.destroying)throw new Error("already finalized or destroyed");typeof r=="function"&&(i=r,r=null),i||(i=gc),(!e.size||e.type==="symlink")&&(e.size=0),e.type||(e.type=RB(e.mode)),e.mode||(e.mode=e.type==="directory"?xB:TB),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),typeof r=="string"&&(r=br.from(r));let n=new _c(this,e,i);return br.isBuffer(r)?(e.size=r.byteLength,n.write(r),n.end(),n):(n._isVoid,n)}finalize(){if(this._stream||this._pending.length>0){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(RE),this.push(null))}_done(e){e===this._stream&&(this._stream=null,this._finalizing&&this.finalize(),this._pending.length&&this._pending.shift()._continueOpen())}_encode(e){if(!e.pax){let r=ea.encode(e);if(r){this.push(r);return}}this._encodePax(e)}_encodePax(e){let r=ea.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),i={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:r.byteLength,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(ea.encode(i)),this.push(r),AE(this,r.byteLength),i.size=e.size,i.type=e.type,this.push(ea.encode(i))}_doDrain(){let e=this._drain;this._drain=gc,e()}_predestroy(){let e=TE(this);for(this._stream&&this._stream.destroy(e);this._pending.length;){let r=this._pending.shift();r.destroy(e),r._continueOpen()}this._doDrain()}_read(e){this._doDrain(),e()}};OE.exports=function(e){return new yc(e)};function RB(t){switch(t&hi.S_IFMT){case hi.S_IFBLK:return"block-device";case hi.S_IFCHR:return"character-device";case hi.S_IFDIR:return"directory";case hi.S_IFIFO:return"fifo";case hi.S_IFLNK:return"symlink"}return"file"}function gc(){}function AE(t,e){e&=511,e&&t.push(RE.subarray(0,512-e))}function AB(t){return br.isBuffer(t)?t:br.from(t)}});var DE=g(mc=>{"use strict";mc.extract=EE();mc.pack=IE()});var NE=g((ZU,LE)=>{"use strict";var OB=P("zlib"),IB=DE(),PE=ii(),Tt=function(t){if(!(this instanceof Tt))return new Tt(t);t=this.options=PE.defaults(t,{gzip:!1}),typeof t.gzipOptions!="object"&&(t.gzipOptions={}),this.supports={directory:!0,symlink:!0},this.engine=IB.pack(t),this.compressor=!1,t.gzip&&(this.compressor=OB.createGzip(t.gzipOptions),this.compressor.on("error",this._onCompressorError.bind(this)))};Tt.prototype._onCompressorError=function(t){this.engine.emit("error",t)};Tt.prototype.append=function(t,e,r){var i=this;e.mtime=e.date;function n(o,a){if(o){r(o);return}i.engine.entry(e,a,function(l){r(l,e)})}if(e.sourceType==="buffer")n(null,t);else if(e.sourceType==="stream"&&e.stats){e.size=e.stats.size;var s=i.engine.entry(e,function(o){r(o,e)});t.pipe(s)}else e.sourceType==="stream"&&PE.collectStream(t,n)};Tt.prototype.finalize=function(){this.engine.finalize()};Tt.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};Tt.prototype.pipe=function(t,e){return this.compressor?this.engine.pipe.apply(this.engine,[this.compressor]).pipe(t,e):this.engine.pipe.apply(this.engine,arguments)};Tt.prototype.unpipe=function(){return this.compressor?this.compressor.unpipe.apply(this.compressor,arguments):this.engine.unpipe.apply(this.engine,arguments)};LE.exports=Tt});var ME=g((QU,kE)=>{"use strict";function DB(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var PB=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function CE(t){if(Buffer.isBuffer(t))return t;if(typeof t=="number")return Buffer.alloc(t);if(typeof t=="string")return Buffer.from(t);throw new Error("input must be buffer, number, or string, received "+typeof t)}function LB(t){let e=CE(4);return e.writeInt32BE(t,0),e}function bc(t,e){t=CE(t),Buffer.isBuffer(e)&&(e=e.readUInt32BE(0));let r=~~e^-1;for(var i=0;i<t.length;i++)r=PB[(r^t[i])&255]^r>>>8;return r^-1}function wc(){return LB(bc.apply(null,arguments))}wc.signed=function(){return bc.apply(null,arguments)};wc.unsigned=function(){return bc.apply(null,arguments)>>>0};var NB=wc,CB=DB(NB);kE.exports=CB});var BE=g((XU,jE)=>{"use strict";var kB=P("util").inherits,qE=cr().Transform,MB=ME(),FE=ii(),Kt=function(t){if(!(this instanceof Kt))return new Kt(t);t=this.options=FE.defaults(t,{}),qE.call(this,t),this.supports={directory:!0,symlink:!0},this.files=[]};kB(Kt,qE);Kt.prototype._transform=function(t,e,r){r(null,t)};Kt.prototype._writeStringified=function(){var t=JSON.stringify(this.files);this.write(t)};Kt.prototype.append=function(t,e,r){var i=this;e.crc32=0;function n(s,o){if(s){r(s);return}e.size=o.length||0,e.crc32=MB.unsigned(o),i.files.push(e),r(null,e)}e.sourceType==="buffer"?n(null,t):e.sourceType==="stream"&&FE.collectStream(t,n)};Kt.prototype.finalize=function(){this._writeStringified(),this.end()};jE.exports=Kt});var WE=g((JU,UE)=>{"use strict";var qB=Q0(),Cn={},Zt=function(t,e){return Zt.create(t,e)};Zt.create=function(t,e){if(Cn[t]){var r=new qB(t,e);return r.setFormat(t),r.setModule(new Cn[t](e)),r}else throw new Error("create("+t+"): format not registered")};Zt.registerFormat=function(t,e){if(Cn[t])throw new Error("register("+t+"): format already registered");if(typeof e!="function")throw new Error("register("+t+"): format module invalid");if(typeof e.prototype.append!="function"||typeof e.prototype.finalize!="function")throw new Error("register("+t+"): format module missing methods");Cn[t]=e};Zt.isRegisteredFormat=function(t){return!!Cn[t]};Zt.registerFormat("zip",IS());Zt.registerFormat("tar",NE());Zt.registerFormat("json",BE());UE.exports=Zt});import{readFileSync as zB,existsSync as YE,readdirSync as $B,mkdirSync as HB,writeFileSync as VB}from"fs";import{unlink as YB}from"fs/promises";import{join as di}from"path";import{randomUUID as pi}from"crypto";function Oc(t){return t?t.includes(`
|
|
12
12
|
`)?t.split(`
|
|
13
|
-
`).map(e=>e.trim()).filter(Boolean):t.split(". ").map(e=>e.trim()).filter(Boolean).map(e=>e.endsWith(".")?e:e+"."):[]}function kn(t,e){return!t||!e?t:t.replace(/\{\{(.+?)\}\}/g,(r,i)=>{let n=e[i];return n?n.value:r}).replace(/\$\{(.+?)\}/g,(r,i)=>{let n=e[i];return n?n.value:r})}var ev={click:"CLICK",double_click:"CLICK",type:"TYPE",fill:"TYPE",select:"SELECT",hover:"HOVER",drag:"DRAG_DROP",upload_files:"UPLOAD",navigate:"OPEN",go_back:"NAVIGATE",go_forward:"NAVIGATE",refresh:"REFRESH",press_key:"SENDKEYS",scroll:"SCROLL_PIXELS",scroll_into_view:"SCROLL_UNTIL_ELEMENT",wait:"WAIT",wait_until:"WAIT_UNTIL",wait_for_load:"WAIT_FOR_LOAD",switch_tab:"SWITCH_TAB",new_tab:"NEW_TAB",close_tab:"CLOSE_TAB",evaluate_js:"EVALUATE_JS",vision_query:"VISION_QUERY",textual_query:"TEXTUAL_QUERY",get_url:"GET_URL",get_title:"GET_TITLE",assert:"ASSERTION",math:"MATHEMATICAL_OPERATION"},tv={literal:"SET_VARIABLE",visual:"VISION_QUERY",dom:"TEXTUAL_QUERY",url:"GET_URL",title:"GET_TITLE"},rv=new Set(["CLICK","TYPE","FILL","HOVER","SCROLL_UNTIL_ELEMENT","UPLOAD","VISION_QUERY","DRAG_DROP","SELECT"]);function Ic(t,e){if(t==="analyze"){let r=e?.action_params?.analyzer_type??"";return tv[r]??"VISION_QUERY"}return ev[t]??t.toUpperCase()}function Dc(t,e){if(!t||!e)return"";try{let r=new Date(t);return isNaN(r.getTime())?"":new Date(r.getTime()+e).toISOString()}catch{return""}}function iv(t,e,r){let i=t.action_params??{},n=rv.has(e)?"Vision Agent":"Operation Agent",s={operation_type:e};e==="OPEN"&&(s.url=i.url??""),e==="SET_VARIABLE"&&(s.variable_name=t.output_variable??i.key??"",s.variable_value=t.output_value??"");let o={},a={},l=t.action_instruction??"",u=i.text??"",f=i.url??"",c=[["intent",l],["value",u],["url",f]];for(let[d,m]of Object.entries(r)){let p=String(m);if(d.startsWith("secrets."))for(let[E,y]of c)y.includes(p)&&(a[E]=d);for(let[E,y]of c)y.includes(p)&&!(E in o)&&(o[E]=y)}let h=t.action_type;return{operation:t.action_instruction??"",agent:n,operation_dict:s,reasoning:t.rationale??(h==="analyze"?i.query??"":""),variable:o,secrets:a,params:{}}}function nv(t){let e=t.assertion_tree??{};if(typeof e.passed=="boolean")return e.passed;let r=e.sub_results??[];return r.length===0?e.status==="passed":(e.composite_operator??"and")==="or"?r.some(n=>n.passed===!0):r.every(n=>n.passed===!0)}function Pc(t){return t.map(e=>({description:e.description??"",store_key:e.store_key??"",expected_value:e.expected??"",stored_value:e.extracted_value??"",operator:e.operator??"equals",transforms:e.transforms??[]}))}function sv(t){let e=t.assertion_tree??{},r=e.sub_results??[],i=Pc(r);return{operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[],sub_results:r,sub_checks:i,composite_operator:e.composite_operator??"and",verification:e.verification??"",claim:e.description??""}}function ov(t){let r=(t.action_params??{}).assertion_tree??{},i=r.sub_results??[],n=Pc(i);return[{operation:t.action_instruction??"",agent:"Operation Agent",operation_dict:{operation_type:"ASSERTION",assertion_tree:{sub_results:i,sub_checks:n,composite_operator:r.composite_operator??"and",verification:"",claim:r.description??t.action_instruction??"",operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[]}},variable:{},secrets:{},params:{}}]}function av(t,e,r){let i=t.visual_data;if(!i||i.x==null||i.y==null)return null;let n=e?`${e}/test_screenshots`:"";return{x:i.x,y:i.y,confidence:0,bbox:i.bbox??null,bbox_source:i.bbox?"accessibility_tree":"fallback",viewport_width:i.viewport_width??1280,viewport_height:i.viewport_height??800,scale_factor:null,raw_image_url:n?`${n}/untagged_screenshot/${r}.webp`:"",raw_image_sas_url:"",annotated_image_url:"",annotated_image_sas_url:""}}function Rc(t,e={},r=""){let i=t.action_type,n=Ic(i,t),s=t.action_params??{},o=t.coordinates??null,a=t.selectors??null,l=!!(a&&a.length>0),u=t.timestamp??"",f=t.duration_ms??0,c=t.variables_used??{},h=t.action_id??pi(),d=pi(),m=Dc(u,f),p="",E="";i==="navigate"?(E=s.url??"",p=E):i==="type"||i==="fill"?p=s.text??"":i==="press_key"?p=s.key??"":i==="wait"?p=String(s.ms??s.timeout_ms??""):i==="evaluate_js"?p=s.script??"":i==="analyze"&&(s.analyzer_type??"")==="literal"&&(p=t.output_value??"");let y="";i==="go_back"?y="back":i==="go_forward"&&(y="forward");let b=kn(p,e),v=kn(E,e),S=kn(t.action_instruction??"",e),T=iv(t,n,c);return{operation_id:h,instruction_id:d,instruction:S,intent:S,operation_start:u,operation_end:m,status:t.status??"",command:n,name:"",target:"",value:b,message:"",operation_dict:"",frame:t.frame_info?JSON.stringify(t.frame_info):"",error_message:t.error??"",code_snippet:"",sub_instruction_obj:JSON.stringify(T),test_id:"",test_version:"",action:"",string_to_float:!1,feedback_msg:"",time_taken:"",create_time_stamp:"",update_time_stamp:"",locator_variable:"",locator_variable_name:"",image_url:r?`${r}/test_screenshots/untagged_screenshot/${h}.webp`:"",alternative_xpaths:[],attribute:"",value_description:"",url:v,navigation_direction:y,tagified_image_url:"",query_variable_name:t.output_variable??"",query_variable_value:t.output_value??"",query_variable_type:"",expected_value:"",queried_value:"",operator:"",assertion_status:n==="ASSERTION"?nv(s):"",query_info_dict:{},query_content_confidence:"none",debugging_logs:[],locator_index:0,query_html:"",user_variables:"[]",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,tab_index:String(s.tab_index??""),tab_identifier:String(s.tab_identifier??""),scroll_value:s.amount??1,scroll_direction:s.direction??"",mi_scroll_payload:{},sleep_duration:0,app_id:"",manual_interaction_tag:"",string_to_float_list:[],js_snippet:i==="evaluate_js"?s.script??"":"",code_error:"",hide:!1,dismiss_dialog:!1,use_v2_mobile_tagging:!1,multiple_inputs:!1,dialog_action:"",dialog_type:"",is_coordinates_used_for_interaction:o!==null&&!l,element_coordinates_ratio:[],element_bounds_ratio:[],x_coord:l?null:o?.x??null,y_coord:l?null:o?.y??null,target_x_coord:s.target_x??null,target_y_coord:s.target_y??null,source_description:s.source_description??null,target_description:s.target_description??null,use_coordinates:o!==null&&!l,kaneaiMobileTaggingImageLimit:1,clicks_order_code:"se_js_ac",selector:l?a.map(D=>({type:D.isXPath?"xpath":"css",...D})):"",selector_target:"",math_result_variable_name:"",math_result_variable_value:"",expression_tree:n==="ASSERTION"?sv(s):s.expression_tree??{},assertion_tree:s.assertion_tree??{},assertion_tree_simplified:{},network_throttle:{},is_mobile_offline:!1,autoheal:!1,db_query:"",db_details:{},db_query_decoded:"",is_global_variable:!1,is_global_variable_persist:!1,global_variable_id:"",wait_for_element_timeout:0,failure_condition:n==="ASSERTION"?"Fail test immediately":"",screenshot_command:"",smartui_contents:{},smartui_results:{},result_type:"",result_hint:"",drag_offset:{},start_coordinates:s.source_coordinates?{x:s.source_coordinates[0],y:s.source_coordinates[1]}:{},end_coordinates:s.target_coordinates?{x:s.target_coordinates[0],y:s.target_coordinates[1]}:{},element_rect:null,is_canvas:!1,until_condition:"",until_max_retries:0,until_settle_ms:0,api_data:{},output_variables:t.output_variable?{[t.output_variable]:t.output_value??""}:{},visual_context:av(t,r,h),reasoning:t.rationale??(i==="analyze"?s.query??"":"")}}function Ac(t,e,r={}){let i=t.action_type,n=Ic(i,t),s=t.timestamp??"",o=t.duration_ms??0,a=Dc(s,o),l=n==="ASSERTION"||n==="MATHEMATICAL_OPERATION";return{instruction_id:e.instruction_id,instruction_class:l?"non_driver_action":"driver_action",module_id:"",instruction:kn(t.action_instruction??"",r),command:n,error:null,parent_instruction_id:"",classification_layer_resp:n==="ASSERTION"?ov(t):[],classification_error:{},operations:[e],status:t.status??"",start_timestamp:s,end_timestamp:a,type:"agent_generated",tags:[],html_paths:[],optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,content_type:"instruction",js_snippet:i==="evaluate_js"?t.action_params?.script??"":"",user_variables:"[]",api_data:{},params_used:!1,hard_assertion:n==="ASSERTION"?t.action_params?.failure_condition==="hard":!1,expected_outcome:"",module_execution_index:0,module_version:null,network_throttle:{},isEdited:!1,use_query_assertion_v2:!1,db_query:"",db_details:{},network_assertion_content:{},screenshot_command:"",smartui_contents:{},generative_id:"",plan_id:"",generative_objective:"",error_message:"",error_code:"",reason:"",title:"",used_variables:[],reasoning:t.rationale??(i==="analyze"?t.action_params?.query??"":"")}}function lv(t,e=[]){let r=t.action_params??{},i=r.branches??[],n=r.winning_index??-1,s=r.sub_results??[],o={};for(let l of s){let u=l.sub_results;if(u)for(let f of u){let c=f.store_key;c&&(o[c]=f)}}let a=i.map((l,u)=>{let f=u===n,c=(l.sub_checks??[]).map(h=>{let d=o[h.store_key];return{description:h.description,store_key:h.store_key,expected_value:h.expected_value,stored_value:d?.extracted_value??h.stored_value,operator:h.operator??d?.operator??"equals",transforms:h.transforms??d?.transforms??[]}});if(c.length===0&&l.condition&&s.length>0){let d=s.find(m=>m.branch_index===u)?.sub_results??[];d.length>0&&(c=d.map(m=>({description:m.description??l.condition,store_key:m.store_key??"",expected_value:m.expected??"true",stored_value:m.extracted_value??void 0,operator:m.operator??"equals",transforms:m.transforms??[]})))}return{branch_index:u,condition:l.condition??null,branch_type:l.branch_type??"sub_objective",passed:f,sub_objective:null,custom_event:l.custom_event??null,children:f?e:[],sub_checks:l.condition?c:[],composite_operator:l.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:`if_else_${pi().slice(0,8)}`,instruction:t.action_instruction??"",instruction_class:"driver_action",command:"",status:t.status??"success",resolved_branch_index:n,branches:a,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:"",error_code:"",reason:"",start_timestamp:t.timestamp??"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function Lc(t,e,r){for(let i of t)i.content_type==="instruction"&&"generative_id"in i&&(i.generative_id=e,i.generative_objective=r)}function ta(t,e={},r=""){let i=[],n=0;for(;n<t.length;){let s=t[n],o=s.action_type;if(s.status==="error"&&o!=="assert"&&o!=="if_else"&&o!=="child_agent_start"&&o!=="child_agent_end"&&!(s.until_condition&&!s.error)){n+=1;continue}if(o==="child_agent_start"){let a=s.action_params?.child_id??"",l=s.action_params?.objective??"",u=[];n+=1;let f=1,c="error",h;for(;n<t.length&&f>0;){let S=t[n],T=S.action_type;if(T==="child_agent_start")f+=1;else if(T==="child_agent_end"&&(f-=1,f===0)){c=S.status??"success",h=S,n+=1;break}f>0&&u.push(S),n+=1}let d=ta(u,e,r);Lc(d,a,l);let m=h?.action_params?.result_code??null,p=h?.action_params?.reason_code??null,E=h?.action_params?.error_message??null,y=h?.action_params?.summary??null,b=h?.action_params?.one_liner??null,v=c==="error";i.push({content_type:"generative_block",instruction_id:`generative_block_${a}`,generative_id:a,objective:l,status:c,children:d,error_message:v?E??null:null,error_code:v?p??null:null,result_code:m??null,bifurcation_context:[],approach_reason:Oc(y),one_liner:b??null});continue}else if(o==="child_agent_end"){n+=1;continue}else if(o==="if_else"){n+=1;let a=[];for(;n<t.length&&t[n].action_type==="child_agent_start";){let l=t[n],u=l.action_params?.child_id??"",f=l.action_params?.objective??"",c=[];n+=1;let h=1,d="error";for(;n<t.length&&h>0;){let p=t[n];if(p.action_type==="child_agent_start")h+=1;else if(p.action_type==="child_agent_end"&&(h-=1,h===0)){d=p.status??"success",n+=1;break}h>0&&c.push(p),n+=1}let m=ta(c,e,r);a.push(...m)}i.push(lv(s,a));continue}else if(o==="query_tool"){n+=1;continue}else if(s.until_condition){let a=Rc(s,e,r),l=Ac(s,a,e),u=typeof s.until_condition_met=="boolean"?s.until_condition_met:s.status==="success";i.push({content_type:"until_block",instruction_id:`until_${pi().slice(0,8)}`,condition:s.until_condition,max_retries:s.until_max_retries??10,settle_ms:s.until_settle_ms??500,current_count:0,condition_met:u,children:[l],generative_id:"",generative_objective:"",variables_used:{},status:s.status??"success"})}else{let a=Rc(s,e,r),l=Ac(s,a,e);i.push(l)}n+=1}return i}function Nc(t,e={},r=""){let i=[];for(let n of t){let s=ta(n.records,e,r);if(s.length===0)continue;let o=pi().replace(/-/g,"");Lc(s,o,n.objective);let a=s.some(c=>"status"in c&&typeof c.status=="string"?c.status==="error"||c.status==="failed":!1),l=n.resultCode?parseInt(n.resultCode,10):null,u=l!==null&&!isNaN(l)&&l>=200,f=a||u?"error":"success";i.push({content_type:"generative_block",instruction_id:`generative_block_${o}`,generative_id:o,objective:n.objective,status:f,children:s,error_message:f==="error"?n.errorMessage??null:null,error_code:f==="error"?n.reasonCode??null:null,result_code:n.resultCode??null,bifurcation_context:[],approach_reason:Oc(n.summary),one_liner:n.oneLiner??null})}return{instructions:i}}var GE=XE(WE(),1);import{createWriteStream as FB,readdirSync as jB,statSync as BB}from"fs";import{readFile as UB}from"fs/promises";import{join as Sc,basename as WB}from"path";import{tmpdir as GB}from"os";async function zE(t){let e=Sc(t,"runs"),r=Sc(GB(),`${WB(t)}_artifacts.zip`);return new Promise((i,n)=>{let s=FB(r),o=(0,GE.default)("zip",{zlib:{level:6}});s.on("close",()=>i(r)),o.on("error",n),o.pipe(s);try{let a=jB(e);for(let l of a){let u=Sc(e,l);BB(u).isDirectory()&&o.glob("**/*",{cwd:u,ignore:["**/screenshots/**","**/annotated/**"]},{prefix:l})}}catch{}o.finalize()})}async function $E(t){return UB(t)}async function Ec(t,e,r){let i=await fetch(t,{method:"PUT",headers:{"Content-Type":r,"x-ms-blob-type":"BlockBlob"},body:new Uint8Array(e)});if(!i.ok)throw new Error(`Azure upload failed: ${i.status} ${await i.text()}`)}function HE(t){return{url:`${t.tmsBaseUrl}/kane-cli/v1/test-case/${t.testcaseId}/code`,body:{code_name:"kane-cli-trigger",language:t.codeExport.language,framework:"playwright",folder_name:"",accessibility:"false",skipCodeValidation:t.codeExport.skipValidation}}}function VE(t){return`${t.tmsBaseUrl}/kane-cli/v1/test-case/${t.testcaseId}/codes?page=1&per_page=10`}var KE=class{config;controller;testId;constructor(e){this.config=e,this.controller=new Tc(e.controllerBaseUrl,e.auth),this.testId=e.testId}log(e,r,i,n){this.config.log?.(e,r,i,n)}async execute(){let{onProgress:e}=this.config;try{if(!this.testId)return this.log("error","PIPELINE_ABORT","No test_id available"),{success:!1,testId:null,error:"No test_id available"};e("convert","running");let r=this.collectNdjsonPerRun(),i=r.reduce((y,b)=>y+b.records.length,0);this.log("info","PIPELINE_CONVERT","Collected NDJSON records",{total_records:i,run_groups:r.length});let n=this.config.variables??{};this.log("info","PIPELINE_CONVERT_VARS","Variables for template resolution",{keys:Object.keys(n)});let{instructions:s}=r.length>0?Nc(r,n,this.config.screenshotBaseUrl??""):{instructions:[]};this.log("info","PIPELINE_CONVERT_INSTRUCTIONS","Auteur instructions produced",{count:s.length});let o=this.buildExecutionEnvelope(s),a=Buffer.from(JSON.stringify(o));this.log("info","PIPELINE_CONVERT_BLOB","Blob created",{size_kb:+(a.length/1024).toFixed(1)}),e("convert","done"),e("zip","running"),this.log("info","PIPELINE_ZIP_START","Zipping session",{session_dir:this.config.sessionDir});let l=null,u;try{l=await zE(this.config.sessionDir),u=await $E(l),this.log("info","PIPELINE_ZIP_DONE","Zip complete",{size_mb:+(u.length/1024/1024).toFixed(1),path:l}),e("zip","done",`${(u.length/1024/1024).toFixed(1)}MB`)}finally{l&&await YB(l).catch(()=>{})}e("presign","running"),this.log("info","PIPELINE_PRESIGN_START","Requesting presigned URLs",{url:`${this.config.controllerBaseUrl}/upload/presign`,test_id:this.testId,session_id:this.config.sessionId});let f=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"artifacts",content_type:"application/zip",filename:`${this.config.sessionId}_artifacts.zip`},{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:f.urls.artifacts?.blob_url,blob_url:f.urls.blob?.blob_url}),e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading artifacts and blob",{artifact_size_mb:+(u.length/1024/1024).toFixed(1),blob_size_kb:+(a.length/1024).toFixed(1)}),await Promise.all([Ec(f.urls.artifacts.upload_url,u,"application/zip"),Ec(f.urls.blob.upload_url,a,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),e("upload","done"),e("finalize","running"),this.log("info","PIPELINE_FINALIZE_START","Finalizing test",{test_id:this.testId,commit_id:this.config.commitId});let c=new xc(this.config.tmsBaseUrl,this.config.tmsUsername,this.config.tmsAccessKey),h=this.config.runObjectives&&this.config.runObjectives.length>0?this.config.runObjectives:[this.config.firstObjective],m=(await c.endTest(this.testId,{commit_id:this.config.commitId,time_taken:Math.round(this.config.totalDuration),steps_count:this.config.totalSteps,commit_message:this.config.firstObjective.slice(0,255),objectives:h})).testcase_id||void 0;this.log("info","PIPELINE_FINALIZE_OK","Test finalized",{testcase_id:m??"none"});let p;if(m&&this.config.shareApiBaseUrl)try{p=await this.generateShareLink(m),this.log("info","PIPELINE_SHARE_OK","Share link generated",{share_id:p})}catch(y){this.log("warn","PIPELINE_SHARE_FAILED","Share link failed",{error:String(y)})}e("finalize","done");let E;if(this.config.codeExport?.enabled&&m){try{await this.triggerCodeExport(m),this.log("info","PIPELINE_CODE_EXPORT_START","Code export triggered")}catch(y){this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:String(y)})}e("code_export","running","Waiting for code generation\u2026");try{E=await this.pollAndDownloadCode(m,e),this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:E}),e("code_export","done",E)}catch(y){let b=y instanceof Error?y.message:String(y);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:b}),e("code_export","failed",b)}}else e("code_export","skipped");return this.log("info","PIPELINE_COMPLETE","Pipeline complete"),{success:!0,testId:this.testId,testcaseId:m,shareId:p,codeExportDir:E}}catch(r){return{success:!1,testId:this.testId,error:r instanceof Error?r.message:String(r)}}}async runCodeExport(e,r){let i=r??this.config.onProgress;try{await this.triggerCodeExport(e),this.log("info","PIPELINE_CODE_EXPORT_TRIGGER","Code export triggered",{testcase_id:e})}catch(n){this.log("error","PIPELINE_CODE_EXPORT_TRIGGER_FAILED","Code export trigger failed",{error:String(n)})}i("code_export","running","Waiting for code generation\u2026");try{let n=await this.pollAndDownloadCode(e,i);return this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:n}),i("code_export","done",n),n}catch(n){let s=n instanceof Error?n.message:String(n);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:s}),i("code_export","failed",s);return}}collectNdjsonPerRun(){let e=[],r=this.config.runObjectives??[],i=this.config.runMetadata??[];for(let n=0;n<this.config.runDirs.length;n++){let s=this.config.runDirs[n],o=r[n]||this.config.firstObjective,a=i[n],l=this.readNdjsonFromDir(s);l.length>0&&e.push({objective:o,records:l,resultCode:a?.resultCode,reasonCode:a?.reasonCode,errorMessage:a?.errorMessage,summary:a?.summary,oneLiner:a?.oneLiner})}if(e.length===0){let n=di(this.config.sessionDir,"runs");if(YE(n))try{let o=$B(n,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name).sort();for(let a of o){let l=di(n,a),u=this.readNdjsonFromDir(l);u.length>0&&e.push({objective:this.config.firstObjective,records:u})}}catch{}}return e}readNdjsonFromDir(e){let r=[],i=[di(e,"run-test","actions.ndjson"),di(e,"actions.ndjson")];for(let n of i){if(!YE(n))continue;this.log("debug","PIPELINE_COLLECT_READ","Reading NDJSON file",{path:n});let s=zB(n,"utf-8");for(let o of s.split(`
|
|
13
|
+
`).map(e=>e.trim()).filter(Boolean):t.split(". ").map(e=>e.trim()).filter(Boolean).map(e=>e.endsWith(".")?e:e+"."):[]}function kn(t,e){return!t||!e?t:t.replace(/\{\{(.+?)\}\}/g,(r,i)=>{let n=e[i];return n?n.value:r}).replace(/\$\{(.+?)\}/g,(r,i)=>{let n=e[i];return n?n.value:r})}var ev={click:"CLICK",double_click:"CLICK",type:"TYPE",fill:"TYPE",select:"SELECT",hover:"HOVER",drag:"DRAG_DROP",upload_files:"UPLOAD",navigate:"OPEN",go_back:"NAVIGATE",go_forward:"NAVIGATE",refresh:"REFRESH",press_key:"SENDKEYS",scroll:"SCROLL_PIXELS",scroll_into_view:"SCROLL_UNTIL_ELEMENT",wait:"WAIT",wait_until:"WAIT_UNTIL",wait_for_load:"WAIT_FOR_LOAD",switch_tab:"SWITCH_TAB",new_tab:"NEW_TAB",close_tab:"CLOSE_TAB",evaluate_js:"EVALUATE_JS",vision_query:"VISION_QUERY",textual_query:"TEXTUAL_QUERY",get_url:"GET_URL",get_title:"GET_TITLE",assert:"ASSERTION",math:"MATHEMATICAL_OPERATION"},tv={literal:"SET_VARIABLE",visual:"VISION_QUERY",dom:"TEXTUAL_QUERY",url:"GET_URL",title:"GET_TITLE"},rv=new Set(["CLICK","TYPE","FILL","HOVER","SCROLL_UNTIL_ELEMENT","UPLOAD","VISION_QUERY","DRAG_DROP","SELECT"]);function Ic(t,e){if(t==="analyze"){let r=e?.action_params?.analyzer_type??"";return tv[r]??"VISION_QUERY"}return ev[t]??t.toUpperCase()}function Dc(t,e){if(!t||!e)return"";try{let r=new Date(t);return isNaN(r.getTime())?"":new Date(r.getTime()+e).toISOString()}catch{return""}}function iv(t,e,r){let i=t.action_params??{},n=rv.has(e)?"Vision Agent":"Operation Agent",s={operation_type:e};e==="OPEN"&&(s.url=i.url??""),e==="SET_VARIABLE"&&(s.variable_name=t.output_variable??i.key??"",s.variable_value=t.output_value??"");let o={},a={},l=t.action_instruction??"",u=i.text??"",f=i.url??"",c=[["intent",l],["value",u],["url",f]];for(let[d,m]of Object.entries(r)){let p=String(m);if(d.startsWith("secrets."))for(let[E,y]of c)y.includes(p)&&(a[E]=d);for(let[E,y]of c)y.includes(p)&&!(E in o)&&(o[E]=y)}let h=t.action_type;return{operation:t.action_instruction??"",agent:n,operation_dict:s,reasoning:h==="analyze"?i.query??"":t.intent??t.action_instruction??"",variable:o,secrets:a,params:{}}}function nv(t){let e=t.assertion_tree??{};if(typeof e.passed=="boolean")return e.passed;let r=e.sub_results??[];return r.length===0?e.status==="passed":(e.composite_operator??"and")==="or"?r.some(n=>n.passed===!0):r.every(n=>n.passed===!0)}function Pc(t){return t.map(e=>({description:e.description??"",store_key:e.store_key??"",expected_value:e.expected??"",stored_value:e.extracted_value??"",operator:e.operator??"equals",transforms:e.transforms??[]}))}function sv(t){let e=t.assertion_tree??{},r=e.sub_results??[],i=Pc(r);return{operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[],sub_results:r,sub_checks:i,composite_operator:e.composite_operator??"and",verification:e.verification??"",claim:e.description??""}}function ov(t){let r=(t.action_params??{}).assertion_tree??{},i=r.sub_results??[],n=Pc(i);return[{operation:t.action_instruction??"",agent:"Operation Agent",operation_dict:{operation_type:"ASSERTION",assertion_tree:{sub_results:i,sub_checks:n,composite_operator:r.composite_operator??"and",verification:"",claim:r.description??t.action_instruction??"",operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[]}},variable:{},secrets:{},params:{}}]}function av(t,e,r){let i=t.visual_data;if(!i||i.x==null||i.y==null)return null;let n=e?`${e}/test_screenshots`:"";return{x:i.x,y:i.y,confidence:0,bbox:i.bbox??null,bbox_source:i.bbox?"accessibility_tree":"fallback",viewport_width:i.viewport_width??1280,viewport_height:i.viewport_height??800,scale_factor:null,raw_image_url:n?`${n}/untagged_screenshot/${r}.webp`:"",raw_image_sas_url:"",annotated_image_url:"",annotated_image_sas_url:""}}function Rc(t,e={},r=""){let i=t.action_type,n=Ic(i,t),s=t.action_params??{},o=t.coordinates??null,a=t.selectors??null,l=!!(a&&a.length>0),u=t.timestamp??"",f=t.duration_ms??0,c=t.variables_used??{},h=t.action_id??pi(),d=pi(),m=Dc(u,f),p="",E="";i==="navigate"?(E=s.url??"",p=E):i==="type"||i==="fill"?p=s.text??"":i==="press_key"?p=s.key??"":i==="wait"?p=String(s.ms??s.timeout_ms??""):i==="evaluate_js"?p=s.script??"":i==="analyze"&&(s.analyzer_type??"")==="literal"&&(p=t.output_value??"");let y="";i==="go_back"?y="back":i==="go_forward"&&(y="forward");let b=kn(p,e),v=kn(E,e),S=kn(t.action_instruction??"",e),T=iv(t,n,c);return{operation_id:h,instruction_id:d,instruction:S,intent:S,operation_start:u,operation_end:m,status:t.status??"",command:n,name:"",target:"",value:b,message:"",operation_dict:"",frame:t.frame_info?JSON.stringify(t.frame_info):"",error_message:t.error??"",code_snippet:"",sub_instruction_obj:JSON.stringify(T),test_id:"",test_version:"",action:"",string_to_float:!1,feedback_msg:"",time_taken:"",create_time_stamp:"",update_time_stamp:"",locator_variable:"",locator_variable_name:"",image_url:r?`${r}/test_screenshots/untagged_screenshot/${h}.webp`:"",alternative_xpaths:[],attribute:"",value_description:"",url:v,navigation_direction:y,tagified_image_url:"",query_variable_name:t.output_variable??"",query_variable_value:t.output_value??"",query_variable_type:"",expected_value:"",queried_value:"",operator:"",assertion_status:n==="ASSERTION"?nv(s):"",query_info_dict:{},query_content_confidence:"none",debugging_logs:[],locator_index:0,query_html:"",user_variables:"[]",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,tab_index:String(s.tab_index??""),tab_identifier:String(s.tab_identifier??""),scroll_value:s.amount??1,scroll_direction:s.direction??"",mi_scroll_payload:{},sleep_duration:0,app_id:"",manual_interaction_tag:"",string_to_float_list:[],js_snippet:i==="evaluate_js"?s.script??"":"",code_error:"",hide:!1,dismiss_dialog:!1,use_v2_mobile_tagging:!1,multiple_inputs:!1,dialog_action:"",dialog_type:"",is_coordinates_used_for_interaction:o!==null&&!l,element_coordinates_ratio:[],element_bounds_ratio:[],x_coord:l?null:o?.x??null,y_coord:l?null:o?.y??null,target_x_coord:s.target_x??null,target_y_coord:s.target_y??null,source_description:s.source_description??null,target_description:s.target_description??null,use_coordinates:o!==null&&!l,kaneaiMobileTaggingImageLimit:1,clicks_order_code:"se_js_ac",selector:l?a.map(D=>({type:D.isXPath?"xpath":"css",...D})):"",selector_target:"",math_result_variable_name:"",math_result_variable_value:"",expression_tree:n==="ASSERTION"?sv(s):s.expression_tree??{},assertion_tree:s.assertion_tree??{},assertion_tree_simplified:{},network_throttle:{},is_mobile_offline:!1,autoheal:!1,db_query:"",db_details:{},db_query_decoded:"",is_global_variable:!1,is_global_variable_persist:!1,global_variable_id:"",wait_for_element_timeout:0,failure_condition:n==="ASSERTION"?"Fail test immediately":"",screenshot_command:"",smartui_contents:{},smartui_results:{},result_type:"",result_hint:"",drag_offset:{},start_coordinates:s.source_coordinates?{x:s.source_coordinates[0],y:s.source_coordinates[1]}:{},end_coordinates:s.target_coordinates?{x:s.target_coordinates[0],y:s.target_coordinates[1]}:{},element_rect:null,is_canvas:!1,until_condition:"",until_max_retries:0,until_settle_ms:0,api_data:{},output_variables:t.output_variable?{[t.output_variable]:t.output_value??""}:{},visual_context:av(t,r,h),reasoning:i==="analyze"?s.query??"":t.intent??t.action_instruction??""}}function Ac(t,e,r={}){let i=t.action_type,n=Ic(i,t),s=t.timestamp??"",o=t.duration_ms??0,a=Dc(s,o),l=n==="ASSERTION"||n==="MATHEMATICAL_OPERATION";return{instruction_id:e.instruction_id,instruction_class:l?"non_driver_action":"driver_action",module_id:"",instruction:kn(t.action_instruction??"",r),command:n,error:null,parent_instruction_id:"",classification_layer_resp:n==="ASSERTION"?ov(t):[],classification_error:{},operations:[e],status:t.status??"",start_timestamp:s,end_timestamp:a,type:"agent_generated",tags:[],html_paths:[],optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,content_type:"instruction",js_snippet:i==="evaluate_js"?t.action_params?.script??"":"",user_variables:"[]",api_data:{},params_used:!1,hard_assertion:n==="ASSERTION"?t.action_params?.failure_condition==="hard":!1,expected_outcome:"",module_execution_index:0,module_version:null,network_throttle:{},isEdited:!1,use_query_assertion_v2:!1,db_query:"",db_details:{},network_assertion_content:{},screenshot_command:"",smartui_contents:{},generative_id:"",plan_id:"",generative_objective:"",error_message:"",error_code:"",reason:"",title:"",used_variables:[],reasoning:i==="analyze"?t.action_params?.query??"":t.intent??t.action_instruction??""}}function lv(t,e=[]){let r=t.action_params??{},i=r.branches??[],n=r.winning_index??-1,s=r.sub_results??[],o={};for(let l of s){let u=l.sub_results;if(u)for(let f of u){let c=f.store_key;c&&(o[c]=f)}}let a=i.map((l,u)=>{let f=u===n,c=(l.sub_checks??[]).map(h=>{let d=o[h.store_key];return{description:h.description,store_key:h.store_key,expected_value:h.expected_value,stored_value:d?.extracted_value??h.stored_value,operator:h.operator??d?.operator??"equals",transforms:h.transforms??d?.transforms??[]}});if(c.length===0&&l.condition&&s.length>0){let d=s.find(m=>m.branch_index===u)?.sub_results??[];d.length>0&&(c=d.map(m=>({description:m.description??l.condition,store_key:m.store_key??"",expected_value:m.expected??"true",stored_value:m.extracted_value??void 0,operator:m.operator??"equals",transforms:m.transforms??[]})))}return{branch_index:u,condition:l.condition??null,branch_type:l.branch_type??"sub_objective",passed:f,sub_objective:null,custom_event:l.custom_event??null,children:f?e:[],sub_checks:l.condition?c:[],composite_operator:l.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:`if_else_${pi().slice(0,8)}`,instruction:t.action_instruction??"",instruction_class:"driver_action",command:"",status:t.status??"success",resolved_branch_index:n,branches:a,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:"",error_code:"",reason:"",start_timestamp:t.timestamp??"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function Lc(t,e,r){for(let i of t)i.content_type==="instruction"&&"generative_id"in i&&(i.generative_id=e,i.generative_objective=r)}function ta(t,e={},r=""){let i=[],n=0;for(;n<t.length;){let s=t[n],o=s.action_type;if(s.status==="error"&&o!=="assert"&&o!=="if_else"&&o!=="child_agent_start"&&o!=="child_agent_end"&&!(s.until_condition&&!s.error)){n+=1;continue}if(o==="child_agent_start"){let a=s.action_params?.child_id??"",l=s.action_params?.objective??"",u=[];n+=1;let f=1,c="error",h;for(;n<t.length&&f>0;){let S=t[n],T=S.action_type;if(T==="child_agent_start")f+=1;else if(T==="child_agent_end"&&(f-=1,f===0)){c=S.status??"success",h=S,n+=1;break}f>0&&u.push(S),n+=1}let d=ta(u,e,r);Lc(d,a,l);let m=h?.action_params?.result_code??null,p=h?.action_params?.reason_code??null,E=h?.action_params?.error_message??null,y=h?.action_params?.summary??null,b=h?.action_params?.one_liner??null,v=c==="error";i.push({content_type:"generative_block",instruction_id:`generative_block_${a}`,generative_id:a,objective:l,status:c,children:d,error_message:v?E??null:null,error_code:v?p??null:null,result_code:m??null,bifurcation_context:[],approach_reason:Oc(y),one_liner:b??null});continue}else if(o==="child_agent_end"){n+=1;continue}else if(o==="if_else"){n+=1;let a=[];for(;n<t.length&&t[n].action_type==="child_agent_start";){let l=t[n],u=l.action_params?.child_id??"",f=l.action_params?.objective??"",c=[];n+=1;let h=1,d="error";for(;n<t.length&&h>0;){let p=t[n];if(p.action_type==="child_agent_start")h+=1;else if(p.action_type==="child_agent_end"&&(h-=1,h===0)){d=p.status??"success",n+=1;break}h>0&&c.push(p),n+=1}let m=ta(c,e,r);a.push(...m)}i.push(lv(s,a));continue}else if(o==="query_tool"){n+=1;continue}else if(s.until_condition){let a=Rc(s,e,r),l=Ac(s,a,e),u=typeof s.until_condition_met=="boolean"?s.until_condition_met:s.status==="success";i.push({content_type:"until_block",instruction_id:`until_${pi().slice(0,8)}`,condition:s.until_condition,max_retries:s.until_max_retries??10,settle_ms:s.until_settle_ms??500,current_count:0,condition_met:u,children:[l],generative_id:"",generative_objective:"",variables_used:{},status:s.status??"success"})}else{let a=Rc(s,e,r),l=Ac(s,a,e);i.push(l)}n+=1}return i}function Nc(t,e={},r=""){let i=[];for(let n of t){let s=ta(n.records,e,r);if(s.length===0)continue;let o=pi().replace(/-/g,"");Lc(s,o,n.objective);let a=s.some(c=>"status"in c&&typeof c.status=="string"?c.status==="error"||c.status==="failed":!1),l=n.resultCode?parseInt(n.resultCode,10):null,u=l!==null&&!isNaN(l)&&l>=200,f=a||u?"error":"success";i.push({content_type:"generative_block",instruction_id:`generative_block_${o}`,generative_id:o,objective:n.objective,status:f,children:s,error_message:f==="error"?n.errorMessage??null:null,error_code:f==="error"?n.reasonCode??null:null,result_code:n.resultCode??null,bifurcation_context:[],approach_reason:Oc(n.summary),one_liner:n.oneLiner??null})}return{instructions:i}}var GE=XE(WE(),1);import{createWriteStream as FB,readdirSync as jB,statSync as BB}from"fs";import{readFile as UB}from"fs/promises";import{join as Sc,basename as WB}from"path";import{tmpdir as GB}from"os";async function zE(t){let e=Sc(t,"runs"),r=Sc(GB(),`${WB(t)}_artifacts.zip`);return new Promise((i,n)=>{let s=FB(r),o=(0,GE.default)("zip",{zlib:{level:6}});s.on("close",()=>i(r)),o.on("error",n),o.pipe(s);try{let a=jB(e);for(let l of a){let u=Sc(e,l);BB(u).isDirectory()&&o.glob("**/*",{cwd:u,ignore:["**/screenshots/**","**/annotated/**"]},{prefix:l})}}catch{}o.finalize()})}async function $E(t){return UB(t)}async function Ec(t,e,r){let i=await fetch(t,{method:"PUT",headers:{"Content-Type":r,"x-ms-blob-type":"BlockBlob"},body:new Uint8Array(e)});if(!i.ok)throw new Error(`Azure upload failed: ${i.status} ${await i.text()}`)}function HE(t){return{url:`${t.tmsBaseUrl}/kane-cli/v1/test-case/${t.testcaseId}/code`,body:{code_name:"kane-cli-trigger",language:t.codeExport.language,framework:"playwright",folder_name:"",accessibility:"false",skipCodeValidation:t.codeExport.skipValidation}}}function VE(t){return`${t.tmsBaseUrl}/kane-cli/v1/test-case/${t.testcaseId}/codes?page=1&per_page=10`}var KE=class{config;controller;testId;constructor(e){this.config=e,this.controller=new Tc(e.controllerBaseUrl,e.auth),this.testId=e.testId}log(e,r,i,n){this.config.log?.(e,r,i,n)}async execute(){let{onProgress:e}=this.config;try{if(!this.testId)return this.log("error","PIPELINE_ABORT","No test_id available"),{success:!1,testId:null,error:"No test_id available"};e("convert","running");let r=this.collectNdjsonPerRun(),i=r.reduce((y,b)=>y+b.records.length,0);this.log("info","PIPELINE_CONVERT","Collected NDJSON records",{total_records:i,run_groups:r.length});let n=this.config.variables??{};this.log("info","PIPELINE_CONVERT_VARS","Variables for template resolution",{keys:Object.keys(n)});let{instructions:s}=r.length>0?Nc(r,n,this.config.screenshotBaseUrl??""):{instructions:[]};this.log("info","PIPELINE_CONVERT_INSTRUCTIONS","Auteur instructions produced",{count:s.length});let o=this.buildExecutionEnvelope(s),a=Buffer.from(JSON.stringify(o));this.log("info","PIPELINE_CONVERT_BLOB","Blob created",{size_kb:+(a.length/1024).toFixed(1)}),e("convert","done"),e("zip","running"),this.log("info","PIPELINE_ZIP_START","Zipping session",{session_dir:this.config.sessionDir});let l=null,u;try{l=await zE(this.config.sessionDir),u=await $E(l),this.log("info","PIPELINE_ZIP_DONE","Zip complete",{size_mb:+(u.length/1024/1024).toFixed(1),path:l}),e("zip","done",`${(u.length/1024/1024).toFixed(1)}MB`)}finally{l&&await YB(l).catch(()=>{})}e("presign","running"),this.log("info","PIPELINE_PRESIGN_START","Requesting presigned URLs",{url:`${this.config.controllerBaseUrl}/upload/presign`,test_id:this.testId,session_id:this.config.sessionId});let f=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"artifacts",content_type:"application/zip",filename:`${this.config.sessionId}_artifacts.zip`},{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:f.urls.artifacts?.blob_url,blob_url:f.urls.blob?.blob_url}),e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading artifacts and blob",{artifact_size_mb:+(u.length/1024/1024).toFixed(1),blob_size_kb:+(a.length/1024).toFixed(1)}),await Promise.all([Ec(f.urls.artifacts.upload_url,u,"application/zip"),Ec(f.urls.blob.upload_url,a,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),e("upload","done"),e("finalize","running"),this.log("info","PIPELINE_FINALIZE_START","Finalizing test",{test_id:this.testId,commit_id:this.config.commitId});let c=new xc(this.config.tmsBaseUrl,this.config.tmsUsername,this.config.tmsAccessKey),h=this.config.runObjectives&&this.config.runObjectives.length>0?this.config.runObjectives:[this.config.firstObjective],m=(await c.endTest(this.testId,{commit_id:this.config.commitId,time_taken:Math.round(this.config.totalDuration),steps_count:this.config.totalSteps,commit_message:this.config.firstObjective.slice(0,255),objectives:h})).testcase_id||void 0;this.log("info","PIPELINE_FINALIZE_OK","Test finalized",{testcase_id:m??"none"});let p;if(m&&this.config.shareApiBaseUrl)try{p=await this.generateShareLink(m),this.log("info","PIPELINE_SHARE_OK","Share link generated",{share_id:p})}catch(y){this.log("warn","PIPELINE_SHARE_FAILED","Share link failed",{error:String(y)})}e("finalize","done");let E;if(this.config.codeExport?.enabled&&m){try{await this.triggerCodeExport(m),this.log("info","PIPELINE_CODE_EXPORT_START","Code export triggered")}catch(y){this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:String(y)})}e("code_export","running","Waiting for code generation\u2026");try{E=await this.pollAndDownloadCode(m,e),this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:E}),e("code_export","done",E)}catch(y){let b=y instanceof Error?y.message:String(y);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:b}),e("code_export","failed",b)}}else e("code_export","skipped");return this.log("info","PIPELINE_COMPLETE","Pipeline complete"),{success:!0,testId:this.testId,testcaseId:m,shareId:p,codeExportDir:E}}catch(r){return{success:!1,testId:this.testId,error:r instanceof Error?r.message:String(r)}}}async runCodeExport(e,r){let i=r??this.config.onProgress;try{await this.triggerCodeExport(e),this.log("info","PIPELINE_CODE_EXPORT_TRIGGER","Code export triggered",{testcase_id:e})}catch(n){this.log("error","PIPELINE_CODE_EXPORT_TRIGGER_FAILED","Code export trigger failed",{error:String(n)})}i("code_export","running","Waiting for code generation\u2026");try{let n=await this.pollAndDownloadCode(e,i);return this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:n}),i("code_export","done",n),n}catch(n){let s=n instanceof Error?n.message:String(n);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:s}),i("code_export","failed",s);return}}collectNdjsonPerRun(){let e=[],r=this.config.runObjectives??[],i=this.config.runMetadata??[];for(let n=0;n<this.config.runDirs.length;n++){let s=this.config.runDirs[n],o=r[n]||this.config.firstObjective,a=i[n],l=this.readNdjsonFromDir(s);l.length>0&&e.push({objective:o,records:l,resultCode:a?.resultCode,reasonCode:a?.reasonCode,errorMessage:a?.errorMessage,summary:a?.summary,oneLiner:a?.oneLiner})}if(e.length===0){let n=di(this.config.sessionDir,"runs");if(YE(n))try{let o=$B(n,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name).sort();for(let a of o){let l=di(n,a),u=this.readNdjsonFromDir(l);u.length>0&&e.push({objective:this.config.firstObjective,records:u})}}catch{}}return e}readNdjsonFromDir(e){let r=[],i=[di(e,"run-test","actions.ndjson"),di(e,"actions.ndjson")];for(let n of i){if(!YE(n))continue;this.log("debug","PIPELINE_COLLECT_READ","Reading NDJSON file",{path:n});let s=zB(n,"utf-8");for(let o of s.split(`
|
|
14
14
|
`)){let a=o.trim();if(a)try{r.push(JSON.parse(a))}catch{}}return r}return r}async generateShareLink(e){let r=`${this.config.shareApiBaseUrl}/lshs/api/v1.0/share-item/generate-sharable-link`;this.log("info","PIPELINE_SHARE_START","Requesting share link",{url:r,testcase_id:e});let i={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({entityIds:[e],entityType:"Test Case Details",expiresAt:7})},n=!!this.config.authResolver;this.log("debug","PIPELINE_SHARE_AUTH","Share link auth config",{resolver:n,fallback_auth_type:typeof this.config.auth=="string"?"bearer":"basic",tms_user:this.config.tmsUsername});let s=n?await this.config.authResolver.fetch(r,i):await fetch(r,{...i,headers:{...i.headers,Authorization:this.buildAuthHeader()}});if(!s.ok)throw new Error(`Share link API failed: ${s.status} ${await s.text()}`);let o=await s.json();if(!o.shareId)throw new Error("Share link API returned no shareId");return o.shareId}async triggerCodeExport(e){if(!this.config.codeExport)throw new Error("triggerCodeExport called without resolved codeExport config");let{url:r,body:i}=HE({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:e,codeExport:this.config.codeExport});this.log("info","PIPELINE_CODE_EXPORT_POST","Triggering code export",{url:r});let n={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(i)},s=this.config.authResolver?await this.config.authResolver.fetch(r,n):await fetch(r,{...n,headers:{...n.headers,Authorization:this.buildAuthHeader()}});if(!s.ok)throw new Error(`Code export failed: ${s.status} ${await s.text()}`)}async pollAndDownloadCode(e,r){let i=VE({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:e}),n=this.config.exitTimeoutMs??3e5,s=5e3,o=Date.now()+n;this.log("info","PIPELINE_CODE_EXPORT_POLL","Polling for code export",{url:i,timeout_ms:n});let a=(l,u)=>this.config.authResolver?this.config.authResolver.fetch(l,u):fetch(l,{...u,headers:{...u?.headers,Authorization:this.buildAuthHeader()}});for(;Date.now()<o;){let l=await a(i,{method:"GET",headers:{Accept:"application/json"}});if(!l.ok){this.log("warn","PIPELINE_CODE_EXPORT_POLL_FAILED","Code export poll failed",{status:l.status}),await this.sleep(s);continue}let f=(await l.json()).data?.find(d=>d.code_name==="kane-cli-trigger");if(!f){this.log("debug","PIPELINE_CODE_EXPORT_WAITING","No kane-cli-trigger entry yet"),r("code_export","running","Waiting for code generation\u2026"),await this.sleep(s);continue}let c=f.status.toLowerCase();if(c==="in progress"||c==="in_progress"||c==="pending"){this.log("debug","PIPELINE_CODE_EXPORT_IN_PROGRESS","Code export in progress",{status:f.status}),r("code_export","running","Generating code\u2026"),await this.sleep(s);continue}if(!f.url||f.url.length===0)throw new Error(`Code export status=${f.status} but no files returned`);let h=this.config.codeExportDir??di(this.config.sessionDir,"code-export");HB(h,{recursive:!0}),this.log("info","PIPELINE_CODE_EXPORT_DOWNLOAD","Downloading code files",{file_count:f.url.length,dir:h}),r("code_export","running",`Downloading ${f.url.length} files\u2026`);for(let d of f.url){let m=di(h,d.file_name),p=await fetch(d.file_url);if(!p.ok){this.log("warn","PIPELINE_CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:d.file_name,status:p.status});continue}let E=await p.text();VB(m,E,"utf-8"),this.log("info","PIPELINE_CODE_EXPORT_FILE_SAVED","File saved",{file_name:d.file_name,size_bytes:E.length})}return h}throw new Error("Code export timed out")}sleep(e){return new Promise(r=>setTimeout(r,e))}buildAuthHeader(){return typeof this.config.auth=="string"?`Bearer ${this.config.auth}`:vc(this.config.auth.username,this.config.auth.accessKey)}buildExecutionEnvelope(e){let r=this.config.runStatuses.every(o=>o==="passed")?"success":"error",i=this.config.variableIds??{},n=[];if(this.config.variables)for(let[o,a]of Object.entries(this.config.variables)){if(a.secret)continue;let l=o.startsWith("global.")?o.slice(7):o;n.push({id:i[l]??0,name:l,value:a.value,session_value:a.value,is_persist:!1,environment_id:0,environment_name:"No Env"})}let s=[];for(let o of this.collectNdjsonPerRun())for(let a of o.records)a.output_variable&&a.output_value!=null&&s.push({name:a.output_variable,value:String(a.output_value),value_type:"test_level",variable_description:"ANALYZE result"});return{test_id:this.testId,version:"v4",session_id:this.config.sessionId,org_id:String(this.config.orgId),user_id:String(this.config.userId),url:this.config.firstUrl??"",start_timestamp:this.config.startedAt,end_timestamp:this.config.endedAt,status:r,commit_id:this.config.commitId,instructions:e,modules:[],uploaded_files:[],test_params:[],test_level_variables:JSON.stringify(s),test_global_variables:n,max_network_wait:0,wait_buffer:0,network_throttle:{},secrets:this.config.secrets??[],totp:[],environment_id:0,environment:"",mobile_browser:!1,native_popups:[],smartui:{},module_index:0}}};export{KE as a};
|
|
15
15
|
/*! Bundled license information:
|
|
16
16
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-
|
|
2
|
+
import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-7ONI2K3S.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-
|
|
2
|
+
import{a as d}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-7ONI2K3S.js";import{a as s,b as n}from"./chunk-C44QQJR4.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var c=u(f(),1);var R=u(f(),1);var m=u(f(),1);function b(o,r){let a=(0,m.useRef)(o);a.current=o,(0,m.useEffect)(()=>{if(r===null)return;let i=setInterval(()=>a.current(),r);return()=>clearInterval(i)},[r])}var B=u(d(),1),T=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function v({active:o=!0}){let[r,a]=(0,R.useState)(0);return b(()=>{a(i=>(i+1)%T.length)},o?80:null),(0,B.jsx)(n,{color:t.purple,children:o?T[r]:"\u25CF"})}var e=u(d(),1);function $(){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:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function k(o,r,a,i){return o.map(p=>p.name===r?{...p,status:a,detail:i}:p)}function I(o){let r=o/1e3;if(r<60)return`${r.toFixed(1)}s`;let a=Math.floor(r/60),i=Math.round(r%60);return`${a}m ${i}s`}function O(o){let[r,a]=(0,c.useState)(0),i=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!o)return;i.current=Date.now();let p=setInterval(()=>{a(Date.now()-i.current)},100);return()=>clearInterval(p)},[o]),r}function y({steps:o,status:r,testUrl:a,error:i}){let p=O(r==="uploading");return r==="uploading"?(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",I(p)]})]}),(0,e.jsx)(s,{flexDirection:"column",marginTop:1,children:o.filter(l=>l.status!=="skipped").map((l,E,P)=>{let D=E===P.length-1?"\u2514\u2500":"\u251C\u2500",g=l.status==="done",x=l.status==="running",S=l.status==="failed";return(0,e.jsxs)(s,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",D," "]}),(0,e.jsx)(s,{width:3,children:x?(0,e.jsx)(v,{}):g?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):S?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:g?t.dim:x?t.base:S?t.red:t.muted,children:l.label}),l.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",l.detail]})]},l.name)})}),(0,e.jsx)(s,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):r==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(s,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{b as a,v as b,$ as c,k as d,y as e};
|