@testmuai/kane-cli 0.8.4 → 0.8.6
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/{ChatSurface-H26E7DM6.js → ChatSurface-S2P7WMBI.js} +1 -1
- package/dist/{ChromeProfilePicker-USUPENU2.js → ChromeProfilePicker-7DTJK2QW.js} +1 -1
- package/dist/{CliFeedbackPrompt-ZIAZ2M2U.js → CliFeedbackPrompt-Y3OYZX54.js} +1 -1
- package/dist/{CliUploadProgress-LEOJTXHT.js → CliUploadProgress-I3N5WDNJ.js} +1 -1
- package/dist/{ConfigView-JBIQPG7O.js → ConfigView-EOYCKYJS.js} +1 -1
- package/dist/{EvidenceViewOffer-IWQ6Q2CI.js → EvidenceViewOffer-AQ3KB3EN.js} +1 -1
- package/dist/FolderPicker-RCHRYYC4.js +2 -0
- package/dist/{InfoBox-ORHNXPET.js → InfoBox-QBXPPMM2.js} +1 -1
- package/dist/{LinksBox-6SKDUB5T.js → LinksBox-L24KON4U.js} +1 -1
- package/dist/{ProfilesView-Y5GTLDJY.js → ProfilesView-H6XCTIXI.js} +1 -1
- package/dist/{ProjectPicker-WDCMKWNQ.js → ProjectPicker-F6JGF2B3.js} +1 -1
- package/dist/{SaveSessionPrompt-I4KLFESC.js → SaveSessionPrompt-QGO65DZN.js} +1 -1
- package/dist/SingleShotApp-AY3XFEYT.js +2 -0
- package/dist/{SummaryBox-QWKW5FHK.js → SummaryBox-OZIZQY4B.js} +1 -1
- package/dist/TestMdRunView-RPW4MIJA.js +2 -0
- package/dist/{TestrunEvidenceTable-ENJJ2GIW.js → TestrunEvidenceTable-A7WTTKTV.js} +1 -1
- package/dist/{WhoamiView-H6M536AY.js → WhoamiView-EB5AV27X.js} +1 -1
- package/dist/{app-download-PSRQWDVW.js → app-download-SQ4RDY3E.js} +1 -1
- package/dist/{auth-JVH2EHK2.js → auth-TW24FZQF.js} +1 -1
- package/dist/{binary-YTQJP2FG.js → binary-5LMQJ3CZ.js} +1 -1
- package/dist/{bind-OUXCFLSE.js → bind-SJ6DOVQ4.js} +2 -2
- package/dist/{bootstrap-3NEI7O6I.js → bootstrap-BTEXO6HX.js} +1 -1
- package/dist/bridge-GQJ35GTL.js +2 -0
- package/dist/{changelog-WDKG4WCV.js → changelog-JLSLSA3Y.js} +1 -1
- package/dist/chunk-2DCNCH32.js +4 -0
- package/dist/{chunk-ZI6W65E3.js → chunk-2R7KL7YG.js} +1 -1
- package/dist/{chunk-ZK57J37M.js → chunk-3LEVCW6R.js} +1 -1
- package/dist/{chunk-KUYJ6FEN.js → chunk-3UUPP5W3.js} +1 -1
- package/dist/{chunk-YBX2SQ5R.js → chunk-4NSP2NPT.js} +2 -2
- package/dist/{chunk-SFXQFUM6.js → chunk-4ONGF4NT.js} +1 -1
- package/dist/{chunk-JRADU3PO.js → chunk-5COGCNED.js} +1 -1
- package/dist/{chunk-QWDFFEEJ.js → chunk-7VZCXW74.js} +1 -1
- package/dist/{chunk-UONRTWLU.js → chunk-A44G533S.js} +1 -1
- package/dist/{chunk-7VTYRTEJ.js → chunk-AO3PBE2V.js} +1 -1
- package/dist/{chunk-RN3YHD4S.js → chunk-ATWDQCDA.js} +1 -1
- package/dist/{chunk-DZJQNL66.js → chunk-AWD56KGX.js} +1 -1
- package/dist/{chunk-SIH6JG7S.js → chunk-B4Q6FMIP.js} +3 -3
- package/dist/chunk-B5QGIUJA.js +26 -0
- package/dist/chunk-BN6AHQL7.js +17 -0
- package/dist/chunk-BRTARADN.js +4 -0
- package/dist/{chunk-A6TJUSOS.js → chunk-C4WTZSX4.js} +1 -1
- package/dist/{chunk-L77ZOU4N.js → chunk-CLLQQPBZ.js} +1 -1
- package/dist/{chunk-BCCWICSS.js → chunk-CZUOGGUK.js} +1 -1
- package/dist/chunk-D4SRHIJ5.js +2 -0
- package/dist/{chunk-JCILRPOM.js → chunk-DN3E6RT6.js} +2 -2
- package/dist/chunk-DZCG7FFP.js +2 -0
- package/dist/{chunk-7LP4X25A.js → chunk-E5S4BASB.js} +1 -1
- package/dist/chunk-EKCGZXZE.js +2 -0
- package/dist/{chunk-YB73T7QH.js → chunk-ESC7AOCX.js} +1 -1
- package/dist/{chunk-J27JJWMT.js → chunk-EXERQHXV.js} +1 -1
- package/dist/{chunk-4CHO7SAT.js → chunk-FJYDEWOA.js} +1 -1
- package/dist/{chunk-TXH2KG7U.js → chunk-FMUCZWS3.js} +1 -1
- package/dist/{chunk-A3PGLDQY.js → chunk-FUNKVREV.js} +1 -1
- package/dist/{chunk-DWWAIXVZ.js → chunk-FYS5VIOG.js} +2 -2
- package/dist/{chunk-PQWSHTSH.js → chunk-GC5U55MW.js} +1 -1
- package/dist/{chunk-A4XJUWAQ.js → chunk-GELPKSLC.js} +1 -1
- package/dist/{chunk-BWSL2KQQ.js → chunk-IGJIDN4U.js} +1 -1
- package/dist/{chunk-IXTFWIQ6.js → chunk-INK66XQS.js} +1 -1
- package/dist/{chunk-U55NUF4E.js → chunk-IWM5EZC3.js} +2 -2
- package/dist/chunk-JCD6FP7A.js +5 -0
- package/dist/{chunk-N7N222VC.js → chunk-JN44V63O.js} +2 -2
- package/dist/{chunk-L4EDLDLZ.js → chunk-KDXQNLVV.js} +2 -2
- package/dist/{chunk-DXJKMZEC.js → chunk-KLTKEGDH.js} +1 -1
- package/dist/{chunk-HHHNQW5Z.js → chunk-KQ2MYMOS.js} +1 -1
- package/dist/chunk-LN7233E2.js +20 -0
- package/dist/{chunk-35L2QXWP.js → chunk-MKSTP2XN.js} +2 -2
- package/dist/{chunk-HXSEA7JS.js → chunk-NT3UETTV.js} +1 -1
- package/dist/chunk-OFW3ZVTP.js +2 -0
- package/dist/{chunk-JT7I6OST.js → chunk-OYJBABRV.js} +1 -1
- package/dist/{chunk-KAMJ7U4M.js → chunk-P3RKXL3V.js} +1 -1
- package/dist/{chunk-NEAMQMYH.js → chunk-PT7V5WDQ.js} +1 -1
- package/dist/chunk-Q4V2GK5U.js +2 -0
- package/dist/{chunk-NEHX45NQ.js → chunk-QBG7XEGQ.js} +11 -11
- package/dist/{chunk-PRLTUEKP.js → chunk-QISE272H.js} +1 -1
- package/dist/{chunk-62WYSEAT.js → chunk-QQAAPFIR.js} +1 -1
- package/dist/{chunk-PSWB3BWQ.js → chunk-RDNKYRKY.js} +1 -1
- package/dist/{chunk-5HYXTFGB.js → chunk-RX5TZZNQ.js} +1 -1
- package/dist/{chunk-GSYJUHRK.js → chunk-RZLD7TPG.js} +1 -1
- package/dist/{chunk-PWFZZWYU.js → chunk-S66MCU2Y.js} +1 -1
- package/dist/{chunk-6CR2HTIM.js → chunk-SORVX3KI.js} +1 -1
- package/dist/{chunk-52GWEKFD.js → chunk-SQC4P2Q7.js} +2 -2
- package/dist/{chunk-VYYTENPY.js → chunk-SQGBFCFO.js} +1 -1
- package/dist/{chunk-N5JHMCRU.js → chunk-SS5TOK2J.js} +1 -1
- package/dist/{chunk-2HT3RYKJ.js → chunk-TDS6LG6T.js} +1 -1
- package/dist/{chunk-NDAAY2RL.js → chunk-TKYJTXWL.js} +1 -1
- package/dist/{chunk-OVLCJ2VX.js → chunk-TQKIE7AX.js} +1 -1
- package/dist/{chunk-GJED4QGF.js → chunk-TZFT7R7B.js} +1 -1
- package/dist/{chunk-DYGUHGZ6.js → chunk-USI2WMAK.js} +1 -1
- package/dist/{chunk-7HPEHQHH.js → chunk-VMCSRLRC.js} +1 -1
- package/dist/chunk-VOBXYDJW.js +71 -0
- package/dist/{chunk-JR46A564.js → chunk-WMQJBEQP.js} +1 -1
- package/dist/{chunk-OSB32HJE.js → chunk-XJILZ2WN.js} +1 -1
- package/dist/{chunk-BXRZGISN.js → chunk-XQFITNA3.js} +1 -1
- package/dist/{chunk-66RJPH73.js → chunk-XY325HDJ.js} +1 -1
- package/dist/{chunk-VBCIDWSK.js → chunk-YEQVJWEF.js} +1 -1
- package/dist/{chunk-UTIGOLON.js → chunk-YHTYPTDD.js} +1 -1
- package/dist/{chunk-W75AVBFG.js → chunk-YZ45OEH3.js} +1 -1
- package/dist/{chunk-QBF5FJVL.js → chunk-Z35BUPZT.js} +1 -1
- package/dist/{chunk-XHNPNYJP.js → chunk-ZLSWHCWO.js} +1 -1
- package/dist/{chunk-BGMI5PH4.js → chunk-ZRKPZLLG.js} +1 -1
- package/dist/{config-SFM45WCV.js → config-6TQIMTNB.js} +1 -1
- package/dist/{credentials-3CENDBPH.js → credentials-ZSNM4BTD.js} +1 -1
- package/dist/{deps-bundle-P37ZJDXC.js → deps-bundle-D2ZC2SPT.js} +1 -1
- package/dist/{deps-resolve-VSICFRWU.js → deps-resolve-VRBMFUTX.js} +1 -1
- package/dist/{dispatch-HDGQAEWN.js → dispatch-2PBSJ7YW.js} +1 -1
- package/dist/doctor-OWRRDA4Z.js +2 -0
- package/dist/{evidence-ABYJOIV2.js → evidence-NDAKCCHQ.js} +1 -1
- package/dist/{evolve-cmd-MROTNJIV.js → evolve-cmd-DIA5EWUT.js} +1 -1
- package/dist/{extract-bind-LBZMEDUK.js → extract-bind-TJ2STXV5.js} +2 -2
- package/dist/{extract-cmd-K4KBPMB7.js → extract-cmd-FLOYO6HL.js} +1 -1
- package/dist/{generate-headless-EBMWSLTR.js → generate-headless-DBT4MKQT.js} +2 -2
- package/dist/index.js +164 -146
- package/dist/{ingest-4447MYLF.js → ingest-JO5NJENZ.js} +1 -1
- package/dist/{ingest-cmd-ULEWNGCI.js → ingest-cmd-T6HM3AHK.js} +1 -1
- package/dist/install-NIVU4XVS.js +2 -0
- package/dist/{interactive-bind-IYAJN45L.js → interactive-bind-7UDJY4CF.js} +3 -3
- package/dist/{list-commands-YPBJNGCE.js → list-commands-DA4ZXOPJ.js} +1 -1
- package/dist/login-flow-NHBJVDW6.js +2 -0
- package/dist/{mobile-prompts-LHUYRSV7.js → mobile-prompts-JS7GPVKS.js} +1 -1
- package/dist/{persist-recorded-session-KCXYXSQG.js → persist-recorded-session-LE3LGFOS.js} +1 -1
- package/dist/pipeline-MTAZDCZR.js +2 -0
- package/dist/prepare-target-YK2DLDWB.js +2 -0
- package/dist/{reconcile-cmd-TSQDYEUT.js → reconcile-cmd-CYRYVS5B.js} +1 -1
- package/dist/{reconcile-deps-ETMGIQNM.js → reconcile-deps-FYXRAMF2.js} +2 -2
- package/dist/{reconcile-engine-TLFTAOTZ.js → reconcile-engine-6AT6EVGS.js} +1 -1
- package/dist/{recording-banner-ACOLKL4K.js → recording-banner-YMKWR3M3.js} +1 -1
- package/dist/{registry-3Q6PNWCK.js → registry-V45ZQ6Q5.js} +1 -1
- package/dist/replay-policy-CVQ6OJX5.js +2 -0
- package/dist/{require-project-folder-5KWTJAXN.js → require-project-folder-3KS7KTME.js} +1 -1
- package/dist/resolve-run-intent-W32G6WM6.js +2 -0
- package/dist/{resolver-NRU6HGTL.js → resolver-V5VP5FLT.js} +1 -1
- package/dist/{run-RHLRZCV5.js → run-26IR3CKX.js} +1 -1
- package/dist/{run-T53Z5TCY.js → run-5IYI2TJI.js} +1 -1
- package/dist/{run-test-md-JYDYT3XF.js → run-test-md-FO2RNNOD.js} +2 -2
- package/dist/{skill-installer-NWF53JAB.js → skill-installer-W4TT5MST.js} +1 -1
- package/dist/{spawner-LKYUMXSO.js → spawner-ZSYJQGQW.js} +1 -1
- package/dist/tcg-generate-ONLV5GXG.js +2 -0
- package/dist/{testmd-actions-CRRUXYOP.js → testmd-actions-NPILETCQ.js} +1 -1
- package/dist/token-refresh-G2CSTY4B.js +2 -0
- package/dist/{types-VYEOJ6U2.js → types-O23GN2YM.js} +1 -1
- package/dist/{validate-basic-X2XPEBFD.js → validate-basic-727KRHX6.js} +1 -1
- package/dist/{verdicts-J2SDU4MW.js → verdicts-TDJLJJ3F.js} +1 -1
- package/dist/{version-check-DAWGRSJ5.js → version-check-A2JQYRI2.js} +1 -1
- package/dist/{walk-session-D6TCM33V.js → walk-session-HB3OOWVR.js} +1 -1
- package/dist/{with-telemetry-RXLIXUMR.js → with-telemetry-HSD6CXDS.js} +1 -1
- package/package.json +11 -11
- package/dist/FolderPicker-G4DT3OEZ.js +0 -2
- package/dist/HelpView-I27LWSL5.js +0 -2
- package/dist/SingleShotApp-Y77CNTSO.js +0 -2
- package/dist/TestMdRunView-PPM6LD3I.js +0 -2
- package/dist/bridge-AFQTFWCU.js +0 -2
- package/dist/chunk-2PH43Z3P.js +0 -69
- package/dist/chunk-3JLWPEQW.js +0 -2
- package/dist/chunk-55NSNWM5.js +0 -26
- package/dist/chunk-7HXZZ3VA.js +0 -19
- package/dist/chunk-BDUCWZYO.js +0 -4
- package/dist/chunk-BSCMUMSV.js +0 -10
- package/dist/chunk-C5UNZ6ZY.js +0 -2
- package/dist/chunk-EQSE6NIB.js +0 -5
- package/dist/chunk-PH22FRN5.js +0 -2
- package/dist/chunk-QDIZQ3ZF.js +0 -2
- package/dist/chunk-UOMRMCMI.js +0 -2
- package/dist/chunk-X2FM67OM.js +0 -4
- package/dist/doctor-CPMWU5TL.js +0 -2
- package/dist/install-YDH2CORO.js +0 -2
- package/dist/login-flow-W5SAB7NN.js +0 -2
- package/dist/pipeline-ELIXCTFZ.js +0 -2
- package/dist/prepare-target-OU2DQXSW.js +0 -2
- package/dist/replay-policy-6USQBT3E.js +0 -2
- package/dist/resolve-run-intent-L2I7G55O.js +0 -2
- package/dist/tcg-generate-2PHA7VNL.js +0 -2
- package/dist/token-refresh-XKXPM6H3.js +0 -2
package/dist/chunk-7HXZZ3VA.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as G}from"./chunk-MMBBQ4OZ.js";import{j as O}from"./chunk-JCILRPOM.js";import{d as E,e as z}from"./chunk-4JOD47QI.js";import{a as X}from"./chunk-RZ4F3BHX.js";import{spawn as _e}from"child_process";import{existsSync as Ie,readFileSync as $e}from"fs";import{homedir as Ne}from"os";import{dirname as Q,join as k}from"path";import{access as ve,mkdir as W,readFile as we}from"fs/promises";import{homedir as be}from"os";import{arch as ye,platform as Ae}from"process";import{join as M}from"path";var xe=35,Se="google_apis",ke="KaneCLI_Pixel_API35",Te="KaneAI_Pixel_API35";function bt(t){return t===Te?ke:t}var De=1;function Pe(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Me(){return{home:be(),os:Ae,arch:ye}}async function Y(t){try{return await ve(t),!0}catch{return!1}}var H=class{deps;constructor(e={}){this.deps={...Me(),...e}}paths(){let e=M(this.deps.home,".testmuai","kaneai","mobile"),r=M(e,"android-sdk");return{root:r,emulatorDir:M(r,"emulator"),systemImageDir:M(r,"system-images",`android-${xe}`,Se,Pe(this.deps.os,this.deps.arch)),avdHome:M(e,"avd"),manifest:M(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await W(M(e,"platforms"),{recursive:!0}),await W(M(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await we(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==De)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await Y(M(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await Y(M(e.systemImageDir,"system.img"))}}},Z;function L(){return Z??=new H,Z}var V="android",Ee="http://127.0.0.1:4723/status",Oe=2e3,ee=12e4,Re=1e3,Ce=3e5;var Le=5,te="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",Fe={device:"ready",unauthorized:"unauthorized",offline:"offline"};function Be(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function Ue(t){let e=[];for(let r of t.split(`
|
|
3
|
-
`)){let o=r.trim();if(!o||o.startsWith("*"))continue;let m=o.toLowerCase();if(m.startsWith("list of devices")||m.startsWith("adb server"))continue;let f=o.split(/\s+/),p=f[0],v=f[1];if(!p||!v||!p.startsWith("emulator-"))continue;let h=Be(f.slice(2)),b=h.model?h.model.replace(/_/g," "):void 0;e.push({platform:V,kind:"emulator",id:p,displayName:b??p,state:Fe[v]??"offline"})}return e}function ie(t){let e=[];for(let r of t.split(`
|
|
4
|
-
`)){let o=r.trim();o&&/^[A-Za-z0-9._-]+$/.test(o)&&(e.includes(o)||e.push(o))}return e}function qe(t){for(let e of t.split(`
|
|
5
|
-
`)){let r=e.trim();if(!(!r||r==="OK"))return r}}function He(t){let e=/^Version\s+(\S+)/m.exec(t);return e?.[1]?e[1].split("-")[0]:/Android Debug Bridge version\s+(\S+)/.exec(t)?.[1]}function Ve(t){let e=[];for(let r of t.split(`
|
|
6
|
-
`)){let o=r.trim();if(!o.startsWith("package:"))continue;let m=o.slice(8).trim();m&&!e.includes(m)&&e.push(m)}return e.sort()}function je(t){let e=Number(t.trim());return Number.isInteger(e)&&e>0?e:void 0}function Je(t){return[...new Set(t.split(",").map(e=>e.trim()).filter(Boolean))]}var Ke=[{match:/INSTALL_FAILED_VERIFICATION|verif(?:ier|ication)/i,hint:`Package verification blocked the install. Disable it for adb installs:
|
|
7
|
-
adb -s <device> shell settings put global verifier_verify_adb_installs 0`},{match:/INSTALL_FAILED_UPDATE_INCOMPATIBLE|INSTALL_FAILED_VERSION_DOWNGRADE|signatures do not match/i,hint:`A different build of this package is already installed. Uninstall it first:
|
|
8
|
-
adb -s <device> uninstall <package>`},{match:/INSUFFICIENT_STORAGE/i,hint:"The device is out of storage. Free space on the device and retry."}];function Xe(t){for(let{match:e,hint:r}of Ke)if(e.test(t))return r}function j(t,e,r=Le){let o=t.toLowerCase(),m=e.filter(v=>v.toLowerCase().includes(o)),f=Math.max(6,Math.floor(o.length/2)),p=e.filter(v=>!m.includes(v)&&ze(v.toLowerCase(),o)>=f);return[...m,...p].slice(0,r)}function ze(t,e){let r=Math.min(t.length,e.length),o=0;for(;o<r&&t[o]===e[o];)o++;return o}function ne(t){return t&&/^hw\.device\.name\s*=\s*(.+)\s*$/m.exec(t)?.[1]?.trim()||void 0}function Ge(){return X(Ee,{signal:AbortSignal.timeout(Oe)}).then(t=>t.ok,()=>!1)}function We(t,e,r){_e(t,e,{stdio:"ignore",detached:!0,...r?{env:{...process.env,...r}}:{}}).unref()}function Ye(){return{exec:E,spawnDetached:We,fileExists:Ie,env:process.env,home:Ne(),os:process.platform,probeAppiumServer:Ge,now:()=>Date.now(),sleep:z,mobileDeps:{status:t=>O().status(t),environment:t=>O().environment(t)},sdkSuite:{status:()=>L().status(),environment:()=>L().environment(),emulatorPath:()=>{let t=L().paths().emulatorDir;return k(t,process.platform==="win32"?"emulator.exe":"emulator")},ensureSdkRootMarkers:()=>L().ensureSdkRootMarkers()}}}function re(t={}){let e={...Ye(),...t},r={},o=new Set;function m(i){return e.os==="win32"?`${i}.exe`:i}function f(i){if(e.readAvdConfig)return e.readAvdConfig(i);let n=[e.env.ANDROID_AVD_HOME,k(e.home,".android","avd"),e.sdkSuite.environment().ANDROID_AVD_HOME];for(let s of n){if(!s)continue;let a=k(s,`${i}.avd`,"config.ini");try{if(e.fileExists(a))return $e(a,"utf8")}catch{}}}function p(){return e.os==="win32"?"appium.cmd":"appium"}function v(){let i=[];for(let n of["ANDROID_HOME","ANDROID_SDK_ROOT"]){let s=e.env[n];s&&s.trim()!==""&&i.push(s.trim())}return e.os==="darwin"?i.push(k(e.home,"Library","Android","sdk")):e.os==="win32"?i.push(k(e.home,"AppData","Local","Android","Sdk")):i.push(k(e.home,"Android","Sdk")),i}function h(i){let n=i==="adb"?"platform-tools":"emulator";return v().map(s=>k(s,n,m(i)))}async function b(i){let n=e.os==="win32"?"where":"which",s=await e.exec(n,[m(i)],{timeoutMs:5e3});if(s.code!==0)return null;let a=s.stdout.split(`
|
|
9
|
-
`)[0]?.trim();return a&&a!==""?a:null}async function S(i){if(i==="adb"){let s=G(e.env);if(s){let u=k(s.platformToolsDir,m("adb"));if(e.fileExists(u)){let c={path:u,source:"sdk"};return r[i]=c,c}return delete r[i],null}if((await e.mobileDeps.status("emulator")).installed){let u=await e.mobileDeps.environment("emulator");if(u.platformToolsDir){let c={path:k(u.platformToolsDir,m("adb")),source:"local"};return r[i]=c,c}}return delete r[i],null}if(i==="emulator"&&(await e.sdkSuite.status()).emulator){let a={path:e.sdkSuite.emulatorPath(),source:"local"};return r[i]=a,a}let n=await b(i);if(n){let s={path:n,source:"sdk"};return r[i]=s,s}for(let s of h(i))if(e.fileExists(s)){let a={path:s,source:"sdk"};return r[i]=a,a}return delete r[i],null}async function $(){let i=await S("adb");if(!i)throw new Error("Managed adb is not installed.\nRun `kane-cli doctor --target emulator --install` to install the pinned Android platform-tools.");return i.path}async function d(i){let n=await e.exec(i,["devices","-l"],{timeoutMs:2e4});return Ue(n.stdout)}async function l(i,n){let s=await e.exec(i,["-s",n,"shell","getprop","ro.boot.qemu.avd_name"],{timeoutMs:1e4});if(s.code===0){let u=s.stdout.split(`
|
|
10
|
-
`)[0]?.trim();if(u)return u}let a=await e.exec(i,["-s",n,"emu","avd","name"],{timeoutMs:1e4});if(a.code===0)return qe(a.stdout)}async function g(i){let n=await S("emulator");if(!n)return[];let s=await e.exec(n.path,["-list-avds"],{timeoutMs:2e4}),a=s.code===0?ie(s.stdout):[];if(o.clear(),(await e.sdkSuite.status()).emulator){let c=await e.exec(n.path,["-list-avds"],{timeoutMs:2e4,env:{...e.env,...e.sdkSuite.environment()}});if(c.code===0)for(let w of ie(c.stdout))o.add(w),a.includes(w)||a.push(w)}return a.filter(c=>!i.has(c)).map(c=>{let w=ne(f(c));return{platform:V,kind:"emulator",id:c,displayName:c,state:"stopped",virtualName:c,...w?{modelIdentifier:w}:{}}})}async function y(){let i=await S("adb");if(!i)return[];let n=await d(i.path),s=new Set;for(let u of n){if(u.kind!=="emulator"||u.state!=="ready")continue;let c=await l(i.path,u.id);if(!c)continue;u.virtualName=c,u.displayName=c;let w=ne(f(c));w&&(u.modelIdentifier=w),s.add(c)}let a=await g(s);return[...n,...a]}function T(i,n){return[`${i} did not finish booting within ${ee/1e3}s.`,n?`It attached as ${n} but never reported sys.boot_completed=1.`:"It never attached to adb.","The emulator process is still running \u2014 check its window for errors.","Common causes: no hardware acceleration (install the Android Emulator","hypervisor driver / enable KVM), or a corrupt AVD (recreate it in","Android Studio's Device Manager)."].join(`
|
|
11
|
-
`)}async function A(i,n,s){let a=await S("emulator");if(!a)throw new Error("The Android `emulator` binary was not found, so AVDs cannot be booted.\nInstall it via Android Studio's SDK Manager (Android Emulator) and set ANDROID_HOME.");let u=new Set((await d(i)).map(F=>F.id)),c=o.has(n);c&&await e.sdkSuite.ensureSdkRootMarkers();let w=c?{...e.env,...e.sdkSuite.environment()}:void 0;e.spawnDetached(a.path,["-avd",n],w),s?.(`booting ${n}\u2026`);let P=e.now()+ee,x;for(;e.now()<P;){if(await e.sleep(Re),!x){let I=(await d(i)).find(C=>C.kind==="emulator"&&!u.has(C.id));I&&(x=I.id,s?.(`${n} attached as ${x}, waiting for boot\u2026`));continue}if((await e.exec(i,["-s",x,"shell","getprop","sys.boot_completed"],{timeoutMs:1e4})).stdout.trim()==="1")return x}throw new Error(T(n,x))}async function _(i,n){let s=await $();if(i.state==="ready")return D(i,s);if(i.state==="unauthorized")throw new Error(`${i.displayName} (${i.id}) is UNAUTHORIZED. Accept the USB-debugging prompt on the device, then retry.`);if(i.state==="offline")throw new Error(`${i.displayName} (${i.id}) is offline. Reconnect it (USB) or re-run \`adb connect ${i.id}\` (wireless), then retry.`);let a=i.virtualName??i.id,u=await A(s,a,n);return D({...i,kind:"emulator",id:u,displayName:a,state:"ready",virtualName:a},s)}async function D(i,n){let[s,a,u,c]=await Promise.all([e.exec(n,["-s",i.id,"shell","getprop","ro.build.version.sdk"],{timeoutMs:1e4}),e.exec(n,["-s",i.id,"shell","getprop","ro.build.version.release"],{timeoutMs:1e4}),e.exec(n,["-s",i.id,"shell","getprop","ro.product.cpu.abilist"],{timeoutMs:1e4}),e.exec(n,["-s",i.id,"shell","getprop","ro.product.cpu.abi"],{timeoutMs:1e4})]),w=s.code===0?je(s.stdout):void 0,P=a.code===0?a.stdout.trim():"",x=Je(u.code===0&&u.stdout.trim()!==""?u.stdout:c.stdout);return{...i,...w!==void 0?{androidApiLevel:w}:{},...P!==""?{osVersion:P}:{},...x.length>0?{androidAbis:x}:{}}}async function N(i){let n=await $(),s=await e.exec(n,["-s",i.id,"shell","pm","list","packages","-3"],{timeoutMs:3e4});if(s.code!==0)throw new Error(`Could not list installed packages on ${i.id}: ${s.stderr.trim()||`adb exited ${s.code}`}`);return Ve(s.stdout)}async function U(i){let n;try{let{default:s}=await import("./adbkit-apkreader-ORZBGCJQ.js");n=(await(await s.open(i)).readManifest())?.package}catch(s){let a=s instanceof Error?s.message:String(s);throw new Error(`Could not read the package name from ${i} (${a}).
|
|
12
|
-
Pass the package name explicitly with --app <package>.`)}if(typeof n!="string"||n.trim()==="")throw new Error(`${i} has no package name in its manifest.
|
|
13
|
-
Pass the package name explicitly with --app <package>.`);return n.trim()}async function ce(i,n,s){let a=await $();s?.(`installing ${n} on ${i.id}\u2026`);let u=await e.exec(a,["-s",i.id,"install","-r",n],{timeoutMs:Ce}),c=`${u.stdout}
|
|
14
|
-
${u.stderr}`;if(u.code===0&&!/\bFailure\b/i.test(c))return;let w=Xe(c),P=[`Installing ${n} on ${i.id} failed (adb exited ${u.code}).`,c.trim()];throw w&&P.push("",w),new Error(P.filter(x=>x!=="").join(`
|
|
15
|
-
`))}async function me(i,n,s){if(n.kind==="package"){let a=await N(i);if(a.includes(n.value))return n.value;let u=j(n.value,a),c=[`${n.value} is not installed on ${i.displayName} (${i.id}).`];throw u.length>0?c.push("Close matches:",...u.map(w=>` ${w}`)):c.push("Pass a local .apk path to --app to install it instead."),new Error(c.join(`
|
|
16
|
-
`))}if(n.kind!=="apk"){let a=n.kind==="aab"?"Android app bundles are not directly installable; build an APK first.":n.kind==="apks"?"Split bundles are not supported yet.":`${n.kind} artifacts are not installable on Android.`;throw new Error(a)}return await ce(i,n.value,s),U(n.value)}async function pe(){let i=await e.mobileDeps.status("emulator");return i.installed?{status:i,env:await e.mobileDeps.environment("emulator")}:null}async function fe(i={}){let n=[],s=await pe(),a=await e.mobileDeps.status("emulator"),u=await S("adb");if(u){let I=await e.exec(u.path,["version"],{timeoutMs:1e4}),C=He(I.stdout);n.push({id:"android.adb",fixedByBundle:!0,label:"adb",required:!0,status:"pass",detail:C?`platform-tools ${C} \xB7 ${u.path}`:u.path})}else n.push({id:"android.adb",fixedByBundle:!0,label:"adb",required:!0,status:"fail",detail:a.corrupt??"managed mobile dependencies are not installed",fixText:"Run `kane-cli doctor --target emulator --install` to download the managed mobile deps bundle under ~/.testmuai/kaneai/mobile."});let c=!i.appiumUrl;s?.env.appiumHome?n.push({id:"android.appium",fixedByBundle:!0,label:"Appium",required:c,status:"pass",detail:k(Q(s.env.appiumHome),"appium","node_modules",".bin",p())}):n.push({id:"android.appium",fixedByBundle:!0,label:"Appium",required:c,status:c?"fail":"info",detail:i.appiumUrl?`managed Appium not required because --appium-url is set (${i.appiumUrl})`:a.corrupt??"managed Appium is not installed",...c?{fixText:te}:{}}),n.push({id:"android.uiautomator2",fixedByBundle:!0,label:"uiautomator2 driver",required:c,status:s?"pass":c?"fail":"info",detail:s?"bundled in the managed mobile deps":i.appiumUrl?"managed driver not required because --appium-url is set":"not installed in the managed deps tree",...s||!c?{}:{fixText:te}});let w=k(e.home,".testmuai","kaneai","mobile","trees");e.fileExists(w)&&n.push({id:"android.legacy-trees",label:"legacy toolchain trees",required:!1,status:"info",detail:`${w} predates the deps bundle \u2014 removed automatically by the next bundle install`});let P=await b("adb");P&&n.push({id:"android.system-adb",label:"system adb",required:!1,status:"info",detail:`${P} (ignored; managed adb always wins and may restart its server)`});let x=await b("appium");x&&n.push({id:"android.system-appium",label:"system Appium",required:!1,status:"info",detail:`${x} (ignored; managed Appium always wins)`});let F=await e.sdkSuite.status(),q=await S("emulator");if(F.emulator?n.push({id:"android.emulator",label:"emulator",required:!1,status:"pass",detail:`managed emulator \xB7 ${e.sdkSuite.emulatorPath()}`}):q?n.push({id:"android.emulator",label:"emulator",required:!1,status:"info",detail:`${q.path} (system install)`}):n.push({id:"android.emulator",label:"emulator",required:!1,status:"info",detail:"not installed, so stopped AVDs are not listed. Install it with the Android SDK (Android Studio \u2192 SDK Manager \u2192 Android Emulator)."}),e.os==="darwin"){let I=await e.exec("sysctl",["-n","kern.hv_support"],{timeoutMs:5e3});n.push({id:"android.virtualization",label:"virtualization",required:!1,status:"info",detail:I.code===0&&I.stdout.trim()==="1"?"Hypervisor.framework available":"Hypervisor.framework not reported \u2014 emulator boots may hang"})}else e.os==="linux"?n.push({id:"android.virtualization",label:"virtualization",required:!1,status:"info",detail:e.fileExists("/dev/kvm")?"/dev/kvm present":"/dev/kvm missing \u2014 enable KVM or emulator boots will hang"}):n.push({id:"android.virtualization",label:"virtualization",required:!1,status:"info",detail:"not checked on this host"});return n}async function ge(i){let n=await e.mobileDeps.environment("emulator"),s=[...n.dirs],a=r.emulator,u=a?.source==="sdk"?Q(a.path):void 0;return u&&!s.includes(u)&&s.push(u),{...n,dirs:s}}async function he(i,n){let s=await $(),a=[];return n.appPackage&&a.push({label:`closing ${n.appPackage}`,file:s,args:["-s",i.id,"shell","am","force-stop",n.appPackage]}),n.shutdown&&a.push({label:`shutting down ${i.displayName}`,file:s,args:["-s",i.id,"emu","kill"]}),a}return{platform:V,available:()=>!0,checks:fe,discover:y,prepare:_,listApps:N,ensureApp:me,teardownPlan:he,toolEnv:ge}}import{mkdtemp as se,readdir as Ze,rm as oe,writeFile as Qe}from"fs/promises";import{tmpdir as ae}from"os";import{join as R}from"path";var de="ios",et=12e4,tt=3e5,it="an .ipa cannot be installed on a simulator \u2014 use a .zip of the .app build";function nt(t){let e=/\.iOS-(\d+)-(\d+)$/.exec(t);return e?`${e[1]}.${e[2]}`:void 0}function rt(t){let e;try{e=JSON.parse(t)}catch{return[]}let r=[];for(let[o,m]of Object.entries(e.devices??{})){let f=nt(o);for(let p of m??[]){let v=typeof p.udid=="string"?p.udid:void 0,h=typeof p.name=="string"?p.name:void 0;if(!v||!h)continue;let b=p.state==="Booted"?"ready":p.state==="Shutdown"?"stopped":"offline",S=typeof p.deviceTypeIdentifier=="string"?p.deviceTypeIdentifier.replace(/^com\.apple\.CoreSimulator\.SimDeviceType\./,""):void 0;r.push({platform:de,kind:"simulator",id:v,displayName:f?`${h} (iOS ${f})`:h,state:b,virtualName:h,...f?{osVersion:f}:{},...S?{modelIdentifier:S}:{}})}}return r}function st(t){let e;try{e=JSON.parse(t)}catch{return[]}let r=[];for(let[o,m]of Object.entries(e)){if(m?.ApplicationType!=="User")continue;let f=m.CFBundleIdentifier??o;r.includes(f)||r.push(f)}return r.sort()}function ot(t){let e;try{e=JSON.parse(t)}catch{return[]}let r=[];for(let[o,m]of Object.entries(e)){let f=m?.CFBundleIdentifier??o;f&&!r.includes(f)&&r.push(f)}return r.sort()}var J=16;function at(t){return/^Xcode (\d+(?:\.\d+)*)/m.exec(t)?.[1]}async function dt(t){let e=await se(R(ae(),"kane-app-unzip-")),r=()=>oe(e,{recursive:!0,force:!0}),o=await E("unzip",["-q",t,"-d",e],{timeoutMs:10*6e4});if(o.code!==0)throw await r(),new Error(`Could not unpack ${t}: ${o.stderr.trim()||`unzip exited ${o.code}`}`);for(let m of[e,R(e,"Payload")]){let f;try{f=await Ze(m)}catch{continue}let p=f.find(v=>v.toLowerCase().endsWith(".app"));if(p)return{appPath:R(m,p),cleanup:r}}throw await r(),new Error(`${t} does not contain a .app bundle.`)}async function lt(t){let e=await se(R(ae(),"kane-plist-"));try{let r=R(e,"input.plist");await Qe(r,t);let o=await E("plutil",["-convert","json","-o","-",r],{timeoutMs:15e3});if(o.code!==0)throw new Error(`plutil could not convert simctl output: ${o.stderr.trim()}`);return o.stdout}finally{await oe(e,{recursive:!0,force:!0})}}function ut(){return{exec:E,os:process.platform,convertPlistToJson:lt,mobileDeps:{status:()=>O().status("simulator"),environment:()=>O().environment("simulator")}}}function le(t={}){let e={...ut(),...t};async function r(d,l=3e4){return e.exec("xcrun",["simctl",...d],{timeoutMs:l})}async function o(){let d=await r(["list","devices","available","--json"]);return d.code!==0?[]:rt(d.stdout)}async function m(){return o()}async function f(d,l){let g=await e.exec("open",["-a","Simulator","--args","-CurrentDeviceUDID",d],{timeoutMs:15e3});g.code!==0&&l?.(`could not open Simulator.app (${g.stderr.trim()||`exit ${g.code}`}); the device is booted and the run continues headless`)}async function p(d,l){if(d.state!=="ready"&&d.state!=="stopped")throw new Error(`${d.displayName} (${d.id}) is ${d.state}; open Simulator.app to inspect it, then retry.`);d.kind==="simulator"&&await f(d.id,l),d.state==="stopped"&&l?.(`booting ${d.displayName}\u2026`);let g=await r(["bootstatus",d.id,"-b"],et);if(g.code!==0)throw new Error(`Could not boot ${d.displayName}: ${g.stderr.trim()||g.stdout.trim()||`simctl bootstatus exited ${g.code}`}`);let y=(await o()).find(T=>T.id===d.id);if(y?.state==="ready")return y;throw new Error(`${d.displayName} finished booting but simctl still reports it as ${y?.state??"missing"}.`)}async function v(d){let l=await r(["listapps",d.id]);if(l.code!==0)throw new Error(`Could not list apps on ${d.displayName}: ${l.stderr.trim()||`simctl exited ${l.code}`}`);return st(await e.convertPlistToJson(l.stdout))}async function h(d){let l=R(d,"Info.plist"),g=await e.exec("plutil",["-convert","json","-o","-",l],{timeoutMs:15e3});if(g.code!==0)throw new Error(`${d} Info.plist could not be read: ${g.stderr.trim()||`plutil exited ${g.code}`}`);let y;try{y=JSON.parse(g.stdout)}catch{throw new Error(`${d} Info.plist did not contain valid JSON from plutil.`)}if(!y.CFBundleIdentifier)throw new Error(`${d} has no CFBundleIdentifier in its Info.plist.`);return y.CFBundleIdentifier}async function b(d,l,g){if(l.kind==="package"){let A=await r(["listapps",d.id]);if(A.code!==0)throw new Error(`Could not list apps on ${d.displayName}: ${A.stderr.trim()||`simctl exited ${A.code}`}`);let _=ot(await e.convertPlistToJson(A.stdout));if(_.includes(l.value))return l.value;let D=j(l.value,_),N=[`${l.value} is not installed on ${d.displayName} (${d.id}).`];throw D.length>0?N.push("Close matches:",...D.map(U=>` ${U}`)):N.push("Pass a .zip of the .app bundle to install it instead."),new Error(N.join(`
|
|
17
|
-
`))}if(l.kind==="ipa")throw new Error(`${it}.`);if(l.kind!=="app"&&l.kind!=="zip")throw new Error(`${l.kind} artifacts are Android-only and not installable on iOS.`);let y=l.value,T;if(l.kind==="zip"){g?.(`unpacking ${l.value}\u2026`);let A=await dt(l.value);y=A.appPath,T=A.cleanup}g?.(`installing ${y} on ${d.displayName}\u2026`);try{let A=await r(["install",d.id,y],tt);if(A.code!==0)throw new Error(`Installing ${l.value} on ${d.displayName} failed: ${A.stderr.trim()||A.stdout.trim()}`);return await h(y)}finally{await T?.()}}async function S(d={}){let l=[],g=await e.exec("xcode-select",["-p"],{timeoutMs:1e4});if(g.code===0&&g.stdout.trim()!==""){let _=await e.exec("xcodebuild",["-version"],{timeoutMs:3e4}),D=_.code===0?at(_.stdout):void 0;D?Number(D.split(".")[0])<J?l.push({id:"ios.xcode",label:"Xcode",required:!0,status:"fail",detail:`Xcode ${D} is older than the required Xcode ${J}`,fixText:`Update Xcode to ${J} or newer from the App Store.`}):l.push({id:"ios.xcode",label:"Xcode",required:!0,status:"pass",detail:`Xcode ${D} \xB7 ${g.stdout.trim()}`}):l.push({id:"ios.xcode",label:"Xcode",required:!0,status:"fail",detail:`${g.stdout.trim()} has no usable xcodebuild (Command Line Tools only?)`,fixText:"Install full Xcode from the App Store, then run `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer`."})}else l.push({id:"ios.xcode",label:"Xcode",required:!0,status:"fail",detail:"xcode-select reports no developer directory",fixText:"Install Xcode from the App Store, then run `xcode-select --install`."});let y=await e.exec("xcrun",["simctl","help"],{timeoutMs:15e3});l.push(y.code===0?{id:"ios.xcrun",label:"xcrun",required:!0,status:"pass",detail:"simctl reachable"}:{id:"ios.xcrun",label:"xcrun",required:!0,status:"fail",detail:`xcrun cannot run simctl: ${y.stderr.trim()||y.stdout.trim()||`exit ${y.code}`}`,fixText:"Run `xcode-select --install`, then confirm with `xcrun simctl list devices`. If Xcode is installed, `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer` repoints it."});let T=!d.appiumUrl,A=await e.mobileDeps.status();return l.push({id:"ios.xcuitest",fixedByBundle:!0,label:"xcuitest driver",required:T,status:A.installed?"pass":T?"fail":"info",detail:A.installed?"bundled in the managed mobile deps (with prebuilt WDA)":d.appiumUrl?"managed driver not required because --appium-url is set":A.corrupt??"the simulator deps bundle is not installed",...A.installed||!T?{}:{fixText:"Run `kane-cli doctor --target simulator --install` to download the simulator deps bundle."}}),l}async function $(d,l){let g=[];return l.appPackage&&g.push({label:`closing ${l.appPackage}`,file:"xcrun",args:["simctl","terminate",d.id,l.appPackage]}),l.shutdown&&g.push({label:`shutting down ${d.displayName}`,file:"xcrun",args:["simctl","shutdown",d.id]}),g}return{platform:de,available:()=>e.os==="darwin",checks:S,discover:m,prepare:p,listApps:v,ensureApp:b,teardownPlan:$,toolEnv:()=>e.mobileDeps.environment()}}var ue=[re(),le()];function B(){return ue.filter(t=>t.available())}function qt(){return B().map(t=>t.platform)}function Ht(){return ue.map(t=>t.platform)}function ct(t){let e=t.toLowerCase();return B().find(r=>r.platform.toLowerCase()===e)}async function mt(t){let e=t?B().filter(o=>o.platform.toLowerCase()===t.toLowerCase()):B(),r=[];for(let o of e)try{r.push(...await o.discover())}catch{}return r}function pt(t,e){let r=e.toLowerCase();return t.id.toLowerCase()===r||t.virtualName?.toLowerCase()===r}function ft(t){let e=t.virtualName&&t.virtualName!==t.id?`${t.displayName} (${t.virtualName})`:t.displayName;return`${t.id} \u2014 ${e} [${t.platform} \xB7 ${t.kind} \xB7 ${t.state}]`}function K(t){return t.length===0?"":`
|
|
18
|
-
${t.map(e=>` ${ft(e)}`).join(`
|
|
19
|
-
`)}`}async function Vt(t,e={}){let r=e.discover??mt,o=e.providerFor??ct,m=await r(t.platform),f=h=>{let b=o(h.platform);return b?{ok:!0,target:h,provider:b}:{ok:!1,reason:"not-found",candidates:m,message:`No provider is registered for platform '${h.platform}'.`}};if(t.device){let h=m.filter(b=>pt(b,t.device));return h.length===0?{ok:!1,reason:"not-found",candidates:m,message:`No target matches --device '${t.device}'.`+(m.length>0?` Available:${K(m)}`:" No targets were found \u2014 run `kane-cli doctor --target <emulator|simulator>`.")}:f(h.find(b=>b.state==="ready")??h[0])}let p=t.defaultTarget;if(p&&(!t.platform||t.platform.toLowerCase()===p.platform.toLowerCase())){let h=m.find(b=>b.platform===p.platform&&b.kind===p.kind&&(b.id===p.id||b.virtualName===p.id));return h?f(h):{ok:!1,reason:t.interactive?"needs-picker":"not-found",candidates:m,message:`The saved default target '${p.id}' (${p.platform} \xB7 ${p.kind}) is not connected. `+(t.interactive?"Pick a target to bind this run.":"Pass --device <id> explicitly \u2014 kane-cli never binds a different device on its own.")+(m.length>0?` Available:${K(m)}`:"")}}if(m.length===0)return{ok:!1,reason:"none-found",candidates:[],message:"No emulator or simulator found. Start an Android emulator or boot an iOS simulator, then run `kane-cli devices list --target <emulator|simulator>`."};let v=m.filter(h=>h.state==="ready");return v.length===1?f(v[0]):t.interactive?{ok:!1,reason:"needs-picker",candidates:m,message:v.length===0?"No target is ready \u2014 pick one to prepare it.":"More than one target is ready \u2014 pick one."}:{ok:!1,reason:"ambiguous",candidates:m,message:(v.length===0?"No target is ready.":`${v.length} targets are ready.`)+` Pass --device <id>:${K(m)}`}}export{bt as a,qt as b,Ht as c,ct as d,mt as e,Vt as f};
|
package/dist/chunk-BDUCWZYO.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f,c as u}from"./chunk-EYOCNMUM.js";import{d as g,k as p}from"./chunk-PH22FRN5.js";import{readFileSync as _,writeFileSync as m,mkdirSync as b,existsSync as h}from"fs";import{dirname as v}from"path";var s={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:p,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0};function w(o){let{mobile:e,...i}=o,t={...i};delete t.target,delete t.device,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let r=n.default_target?.id?.trim();r&&(t.device=r),n.default_app&&(t.app=n.default_app);let a={};return n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url),Object.keys(a).length>0&&(t.mobile=a),t}function C(o){let e=o.mobile??{},i=typeof o.target=="string"?o.target:void 0,t=typeof o.device=="string"&&o.device.trim()!==""?o.device.trim():void 0,n=typeof o.app=="string"&&o.app!==""?o.app:void 0,r={},a=i??e.tui_target;if(a&&(r.tui_target=a),t){let d=f(a,void 0);(d.kind==="emulator"||d.kind==="simulator")&&(r.default_target={platform:u(d.kind),kind:d.kind,id:t})}else e.default_target?.id?.trim()&&(r.default_target=e.default_target);let l=n??e.default_app;return l&&(r.default_app=l),e.no_reset!==void 0&&(r.no_reset=e.no_reset),e.appium_url!==void 0&&(r.appium_url=e.appium_url),Object.keys(r).length>0?r:void 0}var c=class{constructor(e=g){this.path=e}exists(){return h(this.path)}load(){try{let e=_(this.path,"utf-8"),i=JSON.parse(e),t=C(i),{target:n,device:r,app:a,...l}=i;return{...s,...l,...t?{mobile:t}:{},code_export:{...s.code_export,...i.code_export??{}},generate:{...s.generate,...i.generate??{}}}}catch{return{...s,code_export:{...s.code_export},generate:{...s.generate}}}}write(e){try{b(v(this.path),{recursive:!0}),m(this.path,JSON.stringify(w(e),null,2)+`
|
|
3
|
-
`)}catch(i){let t=i instanceof Error?i.message:String(i);process.stderr.write(`[config] Failed to save config: ${t}
|
|
4
|
-
`)}}set(e,i){let t=this.load();t[e]=i,this.write(t)}save(e){this.write({...this.load(),...e})}getMobile(){return this.load().mobile??{}}setMobile(e){let i={...this.getMobile()};for(let t of Object.keys(e)){let n=e[t];n===void 0?delete i[t]:i[t]=n}this.set("mobile",Object.keys(i).length>0?i:void 0)}writeRaw(e){this.write(e)}};export{c as a};
|
package/dist/chunk-BSCMUMSV.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as D,b as F}from"./chunk-2UIHS2FH.js";import{a as ce}from"./chunk-YKTYVJBN.js";import{a as k,b as se,c as ie,d as ae,k as P}from"./chunk-X2FM67OM.js";import{a as J}from"./chunk-N2P4MI32.js";import{b as B,d as M}from"./chunk-NVGBE2DR.js";import{A as x}from"./chunk-TH47OOBV.js";import{x as oe}from"./chunk-PH22FRN5.js";var v="https://integrations.lambdatest.com",b=class extends Error{constructor(e,r){super(r);this.code=e;this.name="LisError"}};function Re(t){let n=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${oe[n].shareApiBaseUrl}/lis/api/v1`}function $e(t){let n=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let r=t.auth?.TESTMUAI_API_KEY||n.TESTMUAI_API_KEY;return r?{authorization:`Bearer ${r}`}:{}}function $(t){let n=t.split(`
|
|
3
|
-
`,1)[0].replace(/[\u0000-\u001f\u007f-\u009f]/g,"");return n.length>200?`${n.slice(0,200)}\u2026`:n}function Te(t,n,e="the issue"){return t===401||t===403?new b("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new b("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${$(n)||`HTTP ${t}`}`)}function j(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new b("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}function ee(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{return{}}}function ue(t){return ee(t).code}function C(t,n="the issue"){let e=ee(t);switch(e.code){case"TOKEN_EXPIRED":return new b("LIS_SETUP",`your Atlassian connection needs a resync \u2014 reconnect at ${v} and retry`);case"NOT_INSTALLED":return new b("LIS_SETUP",`no Atlassian connection for this account \u2014 create one at ${v} and retry`);case"SCOPE_MISSING":return new b("LIS_SETUP",`the connection has no Confluence access \u2014 reconnect with Confluence at ${v} and retry`);case"FORBIDDEN":return new b("LIS_FORBIDDEN",`you don't have access to ${n}`);case"NOT_FOUND":return new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${n}: ${$(e.message??"")||"not found"}`);case"PAYLOAD_TOO_LARGE":return new b("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");case"INVALID_PAYLOAD":return new b("LIS_UNAVAILABLE",`the integrations service rejected the request (${$(e.message??"")||"invalid payload"}) \u2014 retry later`);case"NOT_SUPPORTED":return new b("LIS_UNAVAILABLE","the integrations service does not support this operation yet");case"UPSTREAM_ERROR":case"UPSTREAM_TIMEOUT":return new b("LIS_UNAVAILABLE","Atlassian is not responding through the integrations service \u2014 retry later");default:return Te(t.status,e.message??"",n)}}var Ce=3e4,Oe=5;async function O(t,n,e){let r=e.env??process.env,l=e.fetchImpl??fetch;for(let o=0;;o++){let d=new AbortController,f=setTimeout(()=>d.abort(),Ce);try{let i=await l(`${Re(r)}${t}`,{...n,headers:{"content-type":"application/json",...$e(e),...n.headers??{}},signal:d.signal}),c=await Promise.race([i.arrayBuffer(),new Promise((a,s)=>{d.signal.addEventListener("abort",()=>s(new DOMException("aborted","AbortError")),{once:!0})})]),u={status:i.status,ok:i.ok,headers:i.headers,bytes:Buffer.from(c)};if(u.status===429){if(o>0)throw new b("LIS_RATE_LIMITED","the integrations service is busy \u2014 try again in a moment");let a=ee(u).data?.retry_after_sec,s=Math.min(Math.max(typeof a=="number"&&Number.isFinite(a)?a:1,0),Oe);clearTimeout(f),await new Promise(y=>setTimeout(y,s*1e3));continue}return u}catch(i){throw i instanceof b?i:d.signal.aborted?new b("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new b("LIS_UNAVAILABLE",`could not reach the integrations service (${$(i instanceof Error?i.message:String(i))}) \u2014 check your connection and retry`)}finally{clearTimeout(f)}}}function K(t){let n=t.headers.get("content-type")??"application/octet-stream";if(n.includes("json"))try{let e=JSON.parse(t.bytes.toString("utf8")),r=e.content??e.data?.content;if(typeof r=="string")return{bytes:Buffer.from(r,"base64"),mediaType:e.mime_type??e.data?.mime_type??"application/octet-stream"}}catch{}return{bytes:t.bytes,mediaType:n}}async function V(t={}){let n=await O("/jira/info",{method:"GET"},t);if(!n.ok)throw C(n);let e=j(n),r=(e.data?.SELECTED_PROJECTS??[]).map(l=>l?.key).filter(l=>typeof l=="string"&&l.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:r,capabilities:{document:e.data?.capabilities?.document===!0,comments:e.data?.capabilities?.comments===!0}}}async function W(t,n={}){let e=await O("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},n);if(!e.ok)throw C(e);let r=j(e);if(r.type==="error"||!r.data)throw new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${$(r.message??"")||"issue not found or not accessible"}`);return r.data}var le=100,Ne=5e3,ke=60;async function G(t,n={}){let e=[],r=new Set,l=null,o=0;for(let d=0;;d++){if(d>=ke)throw new b("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let f=await O("/jira/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:le,cursor:l,start_at:o,order_by:"created",fetch_all:!1})},n);if(!f.ok)throw C(f,"the issue's comments");let i=j(f);if(i.type==="error"||!i.data)throw new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${$(i.message??"")||"unavailable"}`);for(let L of i.data.comments??[]){let m=String(L.id);r.has(m)||(r.add(m),e.push(L))}let c=i.data.pagination;if(!c?.has_more)return e;if(e.length>=Ne)throw new b("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let u=c.next_cursor??null,a=c.next_start_at!=null,s=a?c.next_start_at:o+le;if(!(u!=null&&u!==l||u==null&&a&&s!==o))throw new b("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");l=u,o=s}}async function Y(t,n={}){let e=await O("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok){if(ue(e)===void 0){if(e.status===413)throw new b("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new b("JIRA_NOT_CONNECTED",`Jira is not connected for this account \u2014 connect it at ${v} and retry`)}throw C(e,`attachment ${t}`)}return K(e)}var H="kane.source.jira/2";function pe(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let n=t.map(pe).filter(e=>e!==null);return n.length===0?null:n.join(", ")}if(t!==null&&typeof t=="object"){let n=t;for(let e of["name","value","displayName"])if(typeof n[e]=="string")return n[e];return null}return null}function de(t,n,e){let r=[],l={},o=t.additional_fields??{};for(let u of Object.keys(o).sort()){let a=pe(o[u]);if(a===null){r.push(`field "${u}" has no stable text form \u2014 dropped from the envelope`);continue}l[u]=a}let d=[...t.attachments??[]].map(u=>({id:String(u.id),filename:u.filename??"",media_type:u.mime_type??"application/octet-stream",size:u.size??0})).sort((u,a)=>{let s=Number(u.id),y=Number(a.id);return Number.isFinite(s)&&Number.isFinite(y)?s-y:u.id<a.id?-1:u.id>a.id?1:0}),f=e.map(u=>({id:String(u.id),author:u.author?.display_name??"",body:u.body??"",created:u.created??""})).sort((u,a)=>{if(u.created!==a.created)return u.created<a.created?-1:1;let s=Number(u.id),y=Number(a.id);return Number.isFinite(s)&&Number.isFinite(y)&&s!==y?s-y:u.id<a.id?-1:u.id>a.id?1:0}),i=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(i))throw new Error(`cannot build a stable identity for issue key "${i}" \u2014 expected a PROJECT-NUMBER key`);let c={schema:H,site:n,project:i.slice(0,i.lastIndexOf("-")),issue:{id:t.id,key:i},content:{summary:t.summary??"",description:t.description??"",fields:l},attachments:d,comments:f};return{bytes:Buffer.from(JSON.stringify(c),"utf8"),envelope:c,warnings:r}}var me=64,Pe=16,je=6e6,Ue=5e7,xe=12e6,Be={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Me=new Set(["png","jpeg","webp"]);function fe(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==H)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${H}`);let r=[],l=new Map,o=[],d=0,f=new Map,i=[];for(let a=0;a<e.attachments.length;a++){let s=e.attachments[a],y=`i${a+1}`,L=`attachment:${s.filename}`,m=I=>`[img#${y}] ${s.filename} (${s.media_type}, ${s.size} bytes${I?"":" \u2014 not delivered"})`,g=(I,A,T)=>{r.push({ref:y,loc:L,media_type:I,...T?.blob?{blob:T.blob}:{},...T?.appearance?{appearance:T.appearance}:{},delivery:A,...T?.duplicate_of?{duplicate_of:T.duplicate_of}:{}})};if(!s.media_type.startsWith("image/")){g(s.media_type,"unsupported-vision-media-type"),i.push(m(!1));continue}let S;try{S=await t.fetchAttachment(s.id)}catch{g(s.media_type,"external-image-not-fetched"),i.push(m(!1));continue}let h=S.bytes,p=D(h),_=Be[p.format],E=B(h);if(l.set(E,h),!Me.has(p.format)){let I=p.format==="gif"||p.format==="bmp"||p.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";g(_,I,{blob:E}),i.push(m(!1));continue}if(p.width===void 0||p.height===void 0||p.width*p.height>Ue){g(_,"undecodable",{blob:E}),i.push(m(!1));continue}let w;if(p.format==="png"||p.format==="jpeg"){let I=F(h,p.format);if(I===null){g(_,"undecodable",{blob:E}),i.push(m(!1));continue}w=J(I.data,{width:I.width,height:I.height,channels:I.channels})}if(p.width<me||p.height<me){g(_,"below-dimension-floor",{blob:E,appearance:w}),i.push(m(!1));continue}let R=f.get(E);if(R!==void 0){g(_,"duplicate",{blob:E,appearance:w,duplicate_of:R}),i.push(m(!1));continue}if(h.byteLength>je){g(_,"image-too-large",{blob:E,appearance:w}),i.push(m(!1));continue}if(d+h.byteLength>xe){g(_,"vision-byte-budget-reached",{blob:E,appearance:w}),i.push(m(!1));continue}if(o.length>=Pe){g(_,"image-cap-reached",{blob:E,appearance:w}),i.push(m(!1));continue}f.set(E,y),d+=h.byteLength,o.push(y),g(_,"selected",{blob:E,appearance:w}),i.push(m(!0))}let c=[];c.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&c.push("",...e.content.description.split(`
|
|
4
|
-
`));let u=Object.keys(e.content.fields);return u.length>0&&c.push("","--- fields ---",...u.map(a=>`${a}: ${e.content.fields[a]}`)),i.length>0&&c.push("","--- attachments ---",...i),e.comments.length>0&&(c.push("","--- comments ---"),e.comments.forEach((a,s)=>{s>0&&c.push(""),c.push(`[${s+1}] ${a.author} \xB7 ${a.created}`,...a.body.split(`
|
|
5
|
-
`))})),{projection:c.join(`
|
|
6
|
-
`)+`
|
|
7
|
-
`,inventory:r,blobs:l,delivered:o,converter:{name:"jira-convert",version:"2",policy:"v1"}}}}var Je=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function z(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.lastIndexOf("browse");if(r===-1||r+1>=e.length)return null;let l=e[r+1];return Je.test(l)?{site:n.hostname,issueKey:l.toUpperCase()}:null}function X(t,n){let e=x(t),r=e.heads.get(n);if(r==null)return null;let l=e.getNode(r)?.content?.blob;if(typeof l!="string")return null;let o=M(t,l);if(o===null)return null;try{let d=JSON.parse(o.toString("utf8"));return typeof d.site=="string"&&d.site.length>0?d.site:null}catch{return null}}async function De(t,n,e,r,l){let o=z(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let d=l?.lis??{jiraInfo:V,jiraIssue:W,jiraAttachment:Y,jiraComments:G};try{let i={auth:await(l?.authEnv??(await import("./auth-JVH2EHK2.js")).resolveLisAuthEnv)(),env:process.env},c=await d.jiraInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${v} and retry`),{code:1};if(c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issue comments yet \u2014 resync it at ${v} and retry`),{code:1};let u=o.issueKey.slice(0,o.issueKey.lastIndexOf("-"));if(!c.selectAll&&c.selectedProjects.length>0&&!c.selectedProjects.includes(u))return(e.err??e.out)(`error: ${t}: project ${u} is not in the integration's selected projects (${c.selectedProjects.join(", ")}) \u2014 add it at ${v}`),{code:1};let a=await d.jiraIssue(o.issueKey,i),s=await d.jiraComments(o.issueKey,i),y=o.site;if(a.host)try{y=new URL(a.host).hostname}catch{y=a.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:L,warnings:m}=de(a,y,s),g=n??o.issueKey.toLowerCase();k(g);let S=X(r,g);if(S!==null&&S!==y)return(e.err??e.out)(`error: ${t}: source '${g}' was ingested from ${S}, but this read serves ${y} \u2014 retire it first (kane-cli context retire ${g}) or ingest under a different id with --as`),{code:1};let h=await P({contextDir:r,bytes:L,media:se,sourceId:g,label:t,confirmSameSource:e.isTTY?p=>e.confirm(`identical content already ingested as ${p} \u2014 treat as the same source?`):void 0,converters:{jira:fe({fetchAttachment:p=>d.jiraAttachment(p,i)})}});e.out(U(e.isTTY,h,o.issueKey));for(let p of m)e.out(`warning: ${p}`);for(let p of h.warnings??[])e.out(`warning: ${p}`);if(h.composite){let p=h.composite.delivered+h.composite.omitted;e.out(`${h.source_id}: jira, ${p} attachments, ${h.composite.delivered} images delivered (${h.composite.omitted} omitted)`)}return{code:0,result:{status:h.status,source_id:h.source_id,source_cid:h.cid}}}catch(f){return f instanceof b?((e.err??e.out)(`error: ${t}: ${f.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${Fe(f instanceof Error?f.message:String(f))}`),{code:1})}}function Fe(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the issue's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var ge={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>z(t)!==null,ingest:De,sourceIdFor:t=>{let n=z(t);return n?n.issueKey.toLowerCase():null}};async function he(t,n={}){let e=await O("/jira/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw C(e,"the page");let r=j(e);if(r.type==="error"||!r.data)throw new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch the page: ${$(r.message??"")||"page not found or not accessible"}`);return r.data}async function ye(t,n={}){let e=await O("/jira/attachment",{method:"POST",body:JSON.stringify({source:"confluence",download:t})},n);if(!e.ok)throw C(e,"the page's attachment");return{bytes:K(e).bytes}}var q="kane.source.confluence/1";function be(t,n){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this page \u2014 the integrations service returned no page id");let e=[...t.labels??[]].filter(o=>typeof o=="string").sort(),r=[...t.attachments??[]].map(o=>({id:String(o.id),filename:o.filename??"",media_type:o.mime_type??"application/octet-stream",size:o.size??0})).sort((o,d)=>o.id<d.id?-1:o.id>d.id?1:0),l={schema:q,site:n,page:{id:t.id},space:{key:t.space?.key??""},title:t.title??"",labels:e,content:{body:t.body??""},attachments:r};return{bytes:Buffer.from(JSON.stringify(l),"utf8"),envelope:l,warnings:[]}}var _e=64,Ke=16,Ve=6e6,We=5e7,Ge=12e6,Ye={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},He=new Set(["png","jpeg","webp"]);function Ee(t){let n=new Map(Object.entries(t.downloads));return async e=>{let r;try{r=JSON.parse(e.toString("utf8"))}catch{throw new Error("CONFLUENCE_ENVELOPE_SCHEMA: source bytes are not a kane confluence envelope")}if(r.schema!==q)throw new Error(`CONFLUENCE_ENVELOPE_SCHEMA: unknown envelope schema "${r.schema}" \u2014 this CLI understands ${q}`);let l=[],o=new Map,d=[],f=0,i=new Map,c=[];for(let a=0;a<r.attachments.length;a++){let s=r.attachments[a],y=`i${a+1}`,L=`attachment:${s.filename}`,m=A=>`[img#${y}] ${s.filename} (${s.media_type}, ${s.size} bytes${A?"":" \u2014 not delivered"})`,g=(A,T,N)=>{l.push({ref:y,loc:L,media_type:A,...N?.blob?{blob:N.blob}:{},...N?.appearance?{appearance:N.appearance}:{},delivery:T,...N?.duplicate_of?{duplicate_of:N.duplicate_of}:{}})};if(!s.media_type.startsWith("image/")){g(s.media_type,"unsupported-vision-media-type"),c.push(m(!1));continue}let S=n.get(s.id);if(!S){g(s.media_type,"external-image-not-fetched"),c.push(m(!1));continue}let h;try{h=await t.fetchAttachment({id:s.id,download:S})}catch{g(s.media_type,"external-image-not-fetched"),c.push(m(!1));continue}let p=h.bytes,_=D(p),E=Ye[_.format],w=B(p);if(o.set(w,p),!He.has(_.format)){let A=_.format==="gif"||_.format==="bmp"||_.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";g(E,A,{blob:w}),c.push(m(!1));continue}if(_.width===void 0||_.height===void 0||_.width*_.height>We){g(E,"undecodable",{blob:w}),c.push(m(!1));continue}let R;if(_.format==="png"||_.format==="jpeg"){let A=F(p,_.format);if(A===null){g(E,"undecodable",{blob:w}),c.push(m(!1));continue}R=J(A.data,{width:A.width,height:A.height,channels:A.channels})}if(_.width<_e||_.height<_e){g(E,"below-dimension-floor",{blob:w,appearance:R}),c.push(m(!1));continue}let I=i.get(w);if(I!==void 0){g(E,"duplicate",{blob:w,appearance:R,duplicate_of:I}),c.push(m(!1));continue}if(p.byteLength>Ve){g(E,"image-too-large",{blob:w,appearance:R}),c.push(m(!1));continue}if(f+p.byteLength>Ge){g(E,"vision-byte-budget-reached",{blob:w,appearance:R}),c.push(m(!1));continue}if(d.length>=Ke){g(E,"image-cap-reached",{blob:w,appearance:R}),c.push(m(!1));continue}i.set(w,y),f+=p.byteLength,d.push(y),g(E,"selected",{blob:w,appearance:R}),c.push(m(!0))}let u=[];return u.push(`${r.title} \xB7 ${r.site} \xB7 ${r.space.key}`),r.labels.length>0&&u.push(`labels: ${r.labels.join(", ")}`),r.content.body!==""&&u.push("",...r.content.body.split(`
|
|
8
|
-
`)),c.length>0&&u.push("","--- attachments ---",...c),{projection:u.join(`
|
|
9
|
-
`)+`
|
|
10
|
-
`,inventory:l,blobs:o,delivered:d,converter:{name:"confluence-convert",version:"1",policy:"v1"}}}}var ze=/^[A-Za-z0-9~][A-Za-z0-9._~-]*$/;function Z(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.indexOf("wiki");if(r===-1||e[r+1]!=="spaces"||e[r+3]!=="pages")return null;let l=e[r+2],o=e[r+4];return l===void 0||o===void 0||!ze.test(l)||!/^\d+$/.test(o)?null:{site:n.hostname,spaceKey:l,pageId:o}}async function Xe(t,n,e,r,l){let o=Z(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Confluence page URL (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)`),{code:1};let d=l?.lis??{jiraInfo:V,jiraIssue:W,jiraAttachment:Y,jiraComments:G},f=l?.confluence??{confluenceDocument:he,confluenceAttachment:ye};try{let c={auth:await(l?.authEnv??(await import("./auth-JVH2EHK2.js")).resolveLisAuthEnv)(),env:process.env},u=await d.jiraInfo(c);if(!u.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${v} and retry`),{code:1};if(u.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection has no Confluence access \u2014 reconnect with Confluence at ${v} and retry`),{code:1};let a=await f.confluenceDocument(o.pageId,c),s=o.site;if(a.url)try{s=new URL(a.url).hostname}catch{}let{bytes:y,warnings:L}=be(a,s),m=n??`page-${o.pageId}`;k(m);let g=X(r,m);if(g!==null&&g!==s)return(e.err??e.out)(`error: ${t}: source '${m}' was ingested from ${g}, but this read serves ${s} \u2014 retire it first (kane-cli context retire ${m}) or ingest under a different id with --as`),{code:1};let S=Object.fromEntries((a.attachments??[]).filter(p=>typeof p.download=="string"&&p.download.length>0).map(p=>[String(p.id),p.download])),h=await P({contextDir:r,bytes:y,media:ie,sourceId:m,label:t,confirmSameSource:e.isTTY?p=>e.confirm(`identical content already ingested as ${p} \u2014 treat as the same source?`):void 0,converters:{confluence:Ee({downloads:S,fetchAttachment:p=>f.confluenceAttachment(p.download,c)})}});e.out(U(e.isTTY,h,`${o.spaceKey}/${o.pageId}`));for(let p of L)e.out(`warning: ${p}`);for(let p of h.warnings??[])e.out(`warning: ${p}`);if(h.composite){let p=h.composite.delivered+h.composite.omitted;e.out(`${h.source_id}: confluence, ${p} attachments, ${h.composite.delivered} images delivered (${h.composite.omitted} omitted)`)}return{code:0,result:{status:h.status,source_id:h.source_id,source_cid:h.cid}}}catch(i){return i instanceof b?((e.err??e.out)(`error: ${t}: ${i.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${qe(i instanceof Error?i.message:String(i))}`),{code:1})}}function qe(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the page in Confluence and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page's text is too large to ingest \u2014 trim the page in Confluence and retry":t}var we={name:"confluence",hint:"Confluence page URLs (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)",match:t=>Z(t)!==null,ingest:Xe,sourceIdFor:t=>{let n=Z(t);return n?`page-${n.pageId}`:null}};var Ze=new Set(["invalid_url","target_disallowed","page_not_found","page_access_blocked","page_paywalled","unsupported_content_type","page_too_large","page_timeout","scrape_unavailable","scrape_rate_limited","internal_error","credit_denied"]);async function Ie(t,n){let e=n.env??process.env,r=n.fetchImpl??fetch,l=ce(e),o={"Content-Type":"application/json"},d=await n.authEnv(),f=d.TESTMUAI_BASIC_AUTH??e.TESTMUAI_BASIC_AUTH,i=d.TESTMUAI_API_KEY??e.TESTMUAI_API_KEY;f?o.Authorization=`Basic ${f}`:i&&(o.Authorization=`Bearer ${i}`);let c;try{c=await r(`${l}/assurance/web/scrape`,{method:"POST",headers:o,body:JSON.stringify({url:t}),signal:AbortSignal.timeout(n.timeoutMs??55e3)})}catch{return{ok:!1,kind:"transport_unreachable"}}if(c.status===401)return{ok:!1,kind:"auth_rejected"};let u;try{u=await c.json()}catch{return{ok:!1,kind:c.status===404?"route_missing":"malformed_response"}}if(c.ok){let s=u.page;return s===void 0||typeof s.markdown!="string"||s.markdown===""||typeof s.final_url!="string"||s.final_url===""||typeof s.projection?.kind!="string"||typeof s.projection?.version!="string"?{ok:!1,kind:"malformed_response"}:{ok:!0,page:s}}let a=u.code;return typeof a=="string"&&Ze.has(a)?{ok:!1,kind:a}:c.status===404?{ok:!1,kind:"route_missing"}:c.status===403?{ok:!1,kind:"auth_rejected"}:{ok:!1,kind:"malformed_response"}}var te="kane.source.web/1";function Ae(t,n,e){if(e==="")throw new Error("cannot build a web source from an empty page projection");if(n.kind===""||n.version==="")throw new Error("cannot build a stable identity without a server-reported projection kind/version");let r={schema:te,url:t,projection:{kind:n.kind,version:n.version},content:{markdown:e}};return{bytes:Buffer.from(JSON.stringify(r),"utf8"),envelope:r}}var Qe=new Set(["markdown"]);function Le(){return async t=>{let n;try{n=JSON.parse(t.toString("utf8"))}catch{throw new Error("this web source's stored envelope is not readable \u2014 re-ingest the page")}if(n.schema!==te)throw new Error(`unknown web envelope schema '${String(n.schema)}' \u2014 re-ingest the page with this CLI version`);if(!Qe.has(n.projection?.kind??""))throw new Error(`unknown web projection kind '${String(n.projection?.kind)}' \u2014 update kane-cli to read this source`);if(typeof n.content?.markdown!="string"||n.content.markdown==="")throw new Error("this web source's stored envelope carries no content \u2014 re-ingest the page");return{projection:n.content.markdown,inventory:[],blobs:new Map,delivered:[],converter:{name:"web-convert",version:"1",policy:"markdown-passthrough"}}}}import{createHash as et}from"crypto";function ve(t){return Q(t)!==null}function Q(t){if(!/^https?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname===""?null:(n.hash="",n.username="",n.password="",n.toString())}function ne(t){let n=Q(t);if(n===null)return null;let e=new URL(n),r=(e.hostname+e.pathname).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40).replace(/-+$/,""),l=et("sha256").update(n,"utf8").digest("hex").slice(0,8);return`${r||"page"}-${l}`}function tt(t,n){let e=x(t),r=e.heads.get(n);if(r==null)return null;let l=e.getNode(r)?.content?.blob;if(typeof l!="string")return null;let o=M(t,l);if(o===null)return null;try{let d=JSON.parse(o.toString("utf8"));return d.schema!=="kane.source.web/1"?null:typeof d.url=="string"&&d.url.length>0?d.url:null}catch{return null}}function re(t){switch(t){case"invalid_url":return"this is not a valid public HTTP or HTTPS page URL \u2014 check the address and try again";case"target_disallowed":return"that address cannot be fetched because it does not point to an allowed public web page";case"page_not_found":return"the page could not be found \u2014 check that the URL is correct and that the page still exists";case"page_access_blocked":return"the page refused automated access, so its contents could not be ingested \u2014 use a publicly accessible version of the page";case"page_paywalled":return"the page is behind a paywall or sign-in screen, so its full contents could not be ingested \u2014 use a publicly accessible copy";case"unsupported_content_type":return"the URL does not point to an HTML web page \u2014 download the document and ingest the supported file instead";case"page_too_large":return"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first";case"page_timeout":return"the page took too long to load \u2014 try again later";case"scrape_unavailable":case"scrape_rate_limited":case"internal_error":return"the page ingest service is temporarily unavailable \u2014 try again later";case"credit_denied":return"the page could not be ingested \u2014 your organization is out of credits";case"auth_rejected":return"your credentials were rejected \u2014 run `kane-cli login` and retry";case"route_missing":return"ingesting web pages is not available in your environment yet \u2014 nothing is wrong with the URL; try again later";case"transport_unreachable":return"the page ingest service could not be reached \u2014 check your connection and try again";case"malformed_response":return"the page ingest service returned a response that could not be read safely \u2014 try again later"}}function nt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page contains too much text to ingest as a single source (${n[1]}; the limit is ${n[2]}) \u2014 use a narrower page or trim the content first`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first":t}async function rt(t,n,e,r,l){let o=Q(t);if(o===null)return(e.err??e.out)(`error: ${t}: ${re("invalid_url")}`),{code:1};let d=ne(t),f=n??d;if(f===null)return(e.err??e.out)(`error: ${t}: ${re("invalid_url")}`),{code:1};try{k(f)}catch(s){return(e.err??e.out)(`error: ${t}: ${s instanceof Error?s.message:String(s)}`),{code:1}}let i=tt(r,f);if(i!==null&&i!==o){if(!e.isTTY)return(e.err??e.out)(`error: ${t}: source '${f}' was ingested from ${i} \u2014 re-run on a TTY to adopt the new URL as its next version, or ingest under a different id with --as`),{code:1};if(!await e.confirm(`source '${f}' was ingested from ${i} \u2014 treat ${o} as its new version (replaces the current version; items built on it go stale)?`))return e.out(`skipped ${t} \u2014 ingest under a different id with --as to keep both pages`),{code:1}}let c=l?.web?.scrape??Ie,u=l?.authEnv??(async()=>(await import("./spawner-LKYUMXSO.js")).resolveAgentAuthEnv()),a=await c(o,{authEnv:u});if(!a.ok)return(e.err??e.out)(`error: ${t}: ${re(a.kind)}`),{code:1};try{let{bytes:s}=Ae(o,a.page.projection,a.page.markdown),y=await P({contextDir:r,bytes:s,media:ae,sourceId:f,label:o,confirmSameSource:e.isTTY?m=>e.confirm(`identical content already ingested as ${m} \u2014 treat as the same source?`):void 0,converters:{web:Le()}}),L=new URL(o).hostname+new URL(o).pathname;e.out(U(e.isTTY,y,L));for(let m of y.warnings??[])e.out(`warning: ${m}`);return e.isTTY&&a.page.title&&e.out(` title: ${a.page.title}`),{code:0,result:{status:y.status,source_id:y.source_id,source_cid:y.cid}}}catch(s){return(e.err??e.out)(`error: ${t}: ${nt(s instanceof Error?s.message:String(s))}`),{code:1}}}var Se={name:"web",hint:"any public web page URL (https://\u2026)",match:ve,ingest:rt,sourceIdFor:ne};function U(t,n,e){return t?n.status==="created"?`landed ${n.source_id} (${e}) \u2014 new source`:n.status==="versioned"?`landed ${n.source_id} (${e}) \u2014 new version; dependents go stale`:`${n.source_id} unchanged \u2014 already landed`:`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`}var ot=[ge,we,Se];function _n(t){return/^https?:\/\/.+/i.test(t)}function En(t){return ot.find(n=>n.match(t))??null}export{U as a,ot as b,_n as c,En as d};
|
package/dist/chunk-C5UNZ6ZY.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var r={maxShrinks:3};function n(e){return e.hasRetry?e.shrinkCount>=e.maxShrinks?{kind:"complete-reauthor"}:{kind:"retry",newAuthorBoundary:e.failedAt}:{kind:"fail"}}export{r as a,n as b};
|
package/dist/chunk-EQSE6NIB.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as V,b as $,c as ce,d as R}from"./chunk-2YQ6TW77.js";import{b as z}from"./chunk-5GUD3CIH.js";import{a as B}from"./chunk-BPMSNGXQ.js";import{a as M}from"./chunk-DPUV6OSP.js";import{a as F}from"./chunk-NLCCBXXV.js";import{a as x}from"./chunk-RZ4F3BHX.js";import{e as le}from"./chunk-UR6MHSHU.js";import{readFileSync as oe,existsSync as j,readdirSync as Se,mkdirSync as U,writeFileSync as O}from"fs";import{readFile as ae,unlink as Te}from"fs/promises";import{join as E}from"path";import{existsSync as ye,mkdirSync as Ae,readdirSync as ee,writeFileSync as Re}from"fs";import{join as N}from"path";import{randomUUID as P}from"crypto";var ue="/home/kaneai/Downloads";function w(t){return`${ue}/${t}`}function K(t){return"FILE__"+t.replace(/[^A-Za-z0-9]/g,"_")}function C(t){let e=t?.media;return!e||!e.name||!e.media_url?null:{media_id:e.media_id??"",name:e.name,media_url:e.media_url,type:e.type??"doc"}}function H(t){return t?t.includes(`
|
|
3
|
-
`)?t.split(`
|
|
4
|
-
`).map(e=>e.trim()).filter(Boolean):t.split(". ").map(e=>e.trim()).filter(Boolean).map(e=>e.endsWith(".")?e:e+"."):[]}function T(t,e){return!t||!e?t:t.replace(/\{\{(.+?)\}\}/g,(s,i)=>{let n=e[i];return n?n.value:s}).replace(/\$\{(.+?)\}/g,(s,i)=>{let n=e[i];return n?n.value:s})}var de={click:"CLICK",double_click:"CLICK",type:"TYPE",fill:"TYPE",clear:"CLEAR",select:"SELECT",hover:"HOVER",drag:"DRAG_DROP",upload_files:"UPLOAD_FILE",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",api:"API",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",set_cookies:"SET_COOKIES",delete_cookies:"DELETE_COOKIES",clear_cookies:"CLEAR_COOKIES",set_local_storage:"SET_LOCAL_STORAGE",delete_local_storage:"DELETE_LOCAL_STORAGE",clear_local_storage:"CLEAR_LOCAL_STORAGE",set_clipboard:"SET_CLIPBOARD",paste_clipboard:"PASTE_CLIPBOARD",clear_clipboard:"CLEAR_CLIPBOARD"},X={literal:"SET_VARIABLE",condition:"SET_VARIABLE",visual:"VISION_QUERY",dom:"TEXTUAL_QUERY",url:"GET_URL",title:"GET_TITLE",devtool_network:"DEVTOOLS_NETWORK_QUERY",devtool_console:"DEVTOOLS_CONSOLE_QUERY",devtool_cookies:"DEVTOOLS_COOKIES_QUERY",devtool_storage:"DEVTOOLS_STORAGE_QUERY",devtool_performance:"DEVTOOLS_PERFORMANCE",api_response:"API_CALLS_QUERY",textual_visual:"TEXTUAL_ANALYZER"},_e=new Set(["CLICK","TYPE","FILL","HOVER","SCROLL_UNTIL_ELEMENT","UPLOAD_FILE","VISION_QUERY","DRAG_DROP","SELECT"]);function W(t,e){if(t==="analyze"){let i=e?.action_params?.analyzer_type??"";return X[i]}if(t==="scroll"&&e?.action_params?.into_view===!0)return"SCROLL_UNTIL_ELEMENT";let s=de[t];return s||console.warn(`[migrator] UNKNOWN action_type "${t}" \u2014 falling back to "${t.toUpperCase()}"; explicit mapping required`),s??t.toUpperCase()}function Y(t,e){if(!t||!e)return"";try{let s=new Date(t);return isNaN(s.getTime())?"":new Date(s.getTime()+e).toISOString()}catch{return""}}function J(t){try{return JSON.parse(t.output_value??"{}")}catch{return{}}}function pe(t){let e=t.output_variable??"";if(!e)return"[]";let i={...J(t)};return delete i.body,JSON.stringify([{name:e,unique_key:(t.action_id??"").replace(/-/g,"").slice(0,8)||P().replace(/-/g,"").slice(0,8),value:i,variable_description:"API Response"}])}function ge(t,e,s){let i=t.action_params??{},n=_e.has(e)?"Vision Agent":"Operation Agent",r={operation_type:e};if(e==="OPEN"&&(r.url=i.url??""),e==="SET_VARIABLE"&&(r.variable_name=t.output_variable??i.key??"",r.variable_value=t.output_value??""),e==="UPLOAD_FILE"){let m=C(i);m&&(r.value=w(m.name))}let o={},l={},a=t.action_instruction??"",c=i.text??"",u=i.url??"",p=[["intent",a],["value",c],["url",u]];for(let[m,h]of Object.entries(s)){let I=String(h);if(m.startsWith("secrets."))for(let[b,v]of p)v.includes(I)&&(l[b]=m);for(let[b,v]of p)v.includes(I)&&!(b in o)&&(o[b]=v)}let d=t.action_type,_={operation:t.action_instruction??"",agent:n,operation_dict:r,reasoning:d==="analyze"?i.query??"":t.intent??t.action_instruction??"",variable:o,secrets:l,params:{}};d==="analyze"&&typeof i.code=="string"&&i.code&&(_.code=i.code),d==="analyze"&&typeof i.code_js=="string"&&i.code_js&&(_.code_js=i.code_js),d==="analyze"&&typeof i.condition_expression=="string"&&i.condition_expression&&(_.condition_expression=i.condition_expression),i.uses_websocket===!0&&(_.uses_websocket=!0),i.uses_sse===!0&&(_.uses_sse=!0),d==="analyze"&&i.analyzer_type==="textual_visual"&&(typeof i.wrapped_js=="string"&&(_.wrapped_js=i.wrapped_js),Array.isArray(i.locators)&&(_.locators=i.locators),typeof i.operator=="string"&&(_.operator=i.operator),Array.isArray(i.transforms)&&(_.transforms=i.transforms),typeof i.query=="string"&&(_.query=i.query),typeof i.expected_value=="string"&&(_.expected_value=i.expected_value),typeof i.needs_unit_conversion=="boolean"&&(_.needs_unit_conversion=i.needs_unit_conversion),typeof i.condition=="string"&&(_.condition=i.condition));let f={set_cookies:"cookies",set_clipboard:"text",delete_cookies:"names",set_local_storage:"items",delete_local_storage:"keys"}[d];return f&&i[f]!==void 0&&(_[f]=i[f]),d==="set_clipboard"&&typeof i.html=="string"&&i.html&&(_.html=i.html),_}function fe(t){let e=t.assertion_tree??{};if(typeof e.passed=="boolean")return e.passed;let s=e.sub_results??[];return s.length===0?e.status==="passed":(e.composite_operator??"and")==="or"?s.some(n=>n.passed===!0):s.every(n=>n.passed===!0)}function Z(t){return t.map(e=>({description:e.description??"",store_key:e.store_key??"",expected_value:e.expected??"",extracted_value:e.extracted_value??"",operator:e.operator??"equals",transforms:e.transforms??[]}))}function me(t){let e=t.assertion_tree??{},s=e.sub_results??[],i=Z(s);return{operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[],sub_results:s,sub_checks:i,composite_operator:e.composite_operator??"and",verification:e.verification??"",claim:e.description??""}}function he(t){let s=(t.action_params??{}).assertion_tree??{},i=s.sub_results??[],n=Z(i);return[{operation:t.action_instruction??"",agent:"Operation Agent",operation_dict:{operation_type:"ASSERTION",assertion_tree:{sub_results:i,sub_checks:n,composite_operator:s.composite_operator??"and",verification:"",claim:s.description??t.action_instruction??"",operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[]}},variable:{},secrets:{},params:{}}]}function Ee(t,e,s,i){let n=t.visual_data;if(!n||n.x==null||n.y==null)return null;let r=e?`${e}/test_screenshots`:"";return{x:n.x,y:n.y,confidence:0,bbox:n.bbox??null,bbox_source:n.bbox?"accessibility_tree":"fallback",viewport_width:n.viewport_width??1280,viewport_height:n.viewport_height??800,scale_factor:null,raw_image_url:r?`${r}/untagged_screenshot/${s}.${i?.get(s)??"png"}`:"",raw_image_sas_url:"",annotated_image_url:"",annotated_image_sas_url:""}}function be(t){if(!t)return"";let e=t;return typeof t=="object"&&!Array.isArray(t)&&Array.isArray(t.frameInfo)&&(e=t.frameInfo),!Array.isArray(e)||e.length===0?"":JSON.stringify(e)}function Ie(t){return/^(android|ios)_native$/i.test(t.platform??"")}function q(t,e={},s="",i){let n=t.action_type,r=W(n,t),o=t.action_params??{},l=t.coordinates??null,a=t.selectors??null,c=!!(a&&a.length>0),u=Ie(t),p=t.timestamp??"",d=t.duration_ms??0,_=t.variables_used??{},g=t.action_id??P(),f=P(),m=Y(p,d),h="",I="";if(n==="navigate")I=o.url??"",h=I;else if(n==="type"||n==="fill")h=o.text??"";else if(n==="press_key")h=o.key??"";else if(n==="wait")h=String(o.ms??o.timeout_ms??"");else if(n==="evaluate_js")h=o.script??"";else if(n==="upload_files"){let A=C(o);A&&(h=w(A.name))}else n==="analyze"&&r==="SET_VARIABLE"&&(h=t.output_value??"");let b="";n==="go_back"?b="back":n==="go_forward"&&(b="forward");let v=T(h,e),k=T(I,e),y=T(t.action_instruction??"",e),S=ge(t,r,_);return{operation_id:g,instruction_id:f,instruction:y,intent:y,operation_start:p,operation_end:m,status:t.status??"",command:r,name:"",target:"",value:v,message:"",operation_dict:"",frame:be(t.frame_info),error_message:t.error??"",code_snippet:"",sub_instruction_obj:JSON.stringify(S),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:s?`${s}/test_screenshots/untagged_screenshot/${g}.${i?.get(g)??"png"}`:"",alternative_xpaths:[],attribute:"",value_description:"",url:k,navigation_direction:b,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:r==="ASSERTION"?fe(o):"",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(o.tab_index??""),tab_identifier:String(o.tab_identifier??""),scroll_value:o.amount??1,scroll_direction:o.direction??"",mi_scroll_payload:{},sleep_duration:0,app_id:"",manual_interaction_tag:"",string_to_float_list:[],js_snippet:n==="evaluate_js"?o.script??"":"",code_error:"",hide:!1,dismiss_dialog:!1,use_v2_mobile_tagging:u,multiple_inputs:!1,dialog_action:"",dialog_type:"",is_coordinates_used_for_interaction:l!==null&&!c,element_coordinates_ratio:[],element_bounds_ratio:[],x_coord:c?null:l?.x??null,y_coord:c?null:l?.y??null,target_x_coord:o.target_x??null,target_y_coord:o.target_y??null,source_description:o.source_description??null,target_description:o.target_description??null,use_coordinates:l!==null&&!c,kaneaiMobileTaggingImageLimit:1,clicks_order_code:"se_js_ac",selector:c?a.map(A=>({...A,type:u?A.strategy??A.type??"native":A.isXPath?"xpath":"css"})):"",selector_target:"",math_result_variable_name:"",math_result_variable_value:"",expression_tree:r==="ASSERTION"?me(o):o.expression_tree??{},assertion_tree:o.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:r==="ASSERTION"?"Fail test immediately":"",screenshot_command:"",smartui_contents:{},smartui_results:{},result_type:"",result_hint:"",drag_offset:{},start_coordinates:o.source_coordinates?{x:o.source_coordinates[0],y:o.source_coordinates[1]}:{},end_coordinates:o.target_coordinates?{x:o.target_coordinates[0],y:o.target_coordinates[1]}:{},element_rect:null,is_canvas:!1,until_condition:"",until_max_retries:0,until_settle_ms:0,api_data:n==="api"?{request:t.action_params?.api_data?.request??{}}:{},output_variables:n==="api"?t.output_variable?{[t.output_variable]:null}:{}:t.output_variable?{[t.output_variable]:t.output_value??""}:{},visual_context:Ee(t,s,g,i),reasoning:n==="analyze"?o.query??"":t.intent??t.action_instruction??""}}function G(t,e,s={}){let i=t.action_type,n=W(i,t),r=t.timestamp??"",o=t.duration_ms??0,l=Y(r,o),a=n==="ASSERTION"||n==="MATHEMATICAL_OPERATION";return{instruction_id:e.instruction_id,instruction_class:a?"non_driver_action":"driver_action",module_id:"",instruction:T(t.action_instruction??"",s),command:n,error:null,parent_instruction_id:"",classification_layer_resp:n==="ASSERTION"?he(t):[],classification_error:{},operations:[e],status:t.status??"",start_timestamp:r,end_timestamp:l,type:"agent_generated",tags:[],html_paths:[],optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,content_type:i==="api"?"api":i==="analyze"&&t.action_params?.analyzer_type==="api_response"?"api_calls_query":i==="analyze"&&t.action_params?.analyzer_type?.startsWith("devtool_")?t.action_params.analyzer_type.replace("devtool_","devtools_"):"instruction",js_snippet:i==="evaluate_js"?t.action_params?.script??"":"",user_variables:i==="api"?pe(t):"[]",api_data:i==="api"?{request:t.action_params?.api_data?.request??{},response:J(t)}:{},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 ve(t,e=[]){let s=t.action_params??{},i=s.branches??[],n=s.winning_index??-1,r=s.sub_results??[],o={};for(let a of r){let c=a.sub_results;if(c)for(let u of c){let p=u.store_key;p&&(o[p]=u)}}let l=i.map((a,c)=>{let u=c===n,p=(a.sub_checks??[]).map(d=>{let _=o[d.store_key];return{description:d.description,store_key:d.store_key,expected_value:d.expected_value,stored_value:_?.extracted_value??d.stored_value,operator:d.operator??_?.operator??"equals",transforms:d.transforms??_?.transforms??[]}});if(p.length===0&&a.condition&&r.length>0){let _=r.find(g=>g.branch_index===c)?.sub_results??[];_.length>0&&(p=_.map(g=>({description:g.description??a.condition,store_key:g.store_key??"",expected_value:g.expected??"true",stored_value:g.extracted_value??void 0,operator:g.operator??"equals",transforms:g.transforms??[]})))}return{branch_index:c,condition:a.condition??null,branch_type:a.branch_type??"sub_objective",passed:u,sub_objective:null,custom_event:a.custom_event??null,children:u?e:[],sub_checks:a.condition?p:[],composite_operator:a.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:`if_else_${P().slice(0,8)}`,instruction:t.action_instruction??"",instruction_class:"driver_action",command:"",status:t.status??"success",resolved_branch_index:n,branches:l,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 Q(t,e,s){for(let i of t)i.content_type==="instruction"&&"generative_id"in i&&(i.generative_id=e,i.generative_objective=s)}function D(t,e={},s="",i,n){let r=[],o=0;for(;o<t.length;){let l=t[o],a=l.action_type;if(!n?.keepFailedActions&&l.status==="error"&&a!=="assert"&&a!=="if_else"&&a!=="child_agent_start"&&a!=="child_agent_end"&&!(l.until_condition&&!l.error)){o+=1;continue}if(a==="analyze"&&!X[l.action_params?.analyzer_type??""]){o+=1;continue}if(a==="child_agent_start"){let c=l.action_params?.child_id??"",u=l.action_params?.objective??"",p=[];o+=1;let d=1,_="error",g;for(;o<t.length&&d>0;){let y=t[o],S=y.action_type;if(S==="child_agent_start")d+=1;else if(S==="child_agent_end"&&(d-=1,d===0)){_=y.status??"success",g=y,o+=1;break}d>0&&p.push(y),o+=1}let f=D(p,e,s,i);Q(f,c,u);let m=g?.action_params?.result_code??null,h=g?.action_params?.reason_code??null,I=g?.action_params?.error_message??null,b=g?.action_params?.summary??null,v=g?.action_params?.one_liner??null,k=_==="error";r.push({content_type:"generative_block",instruction_id:`generative_block_${c}`,generative_id:c,objective:u,status:_,children:f,error_message:k?I??null:null,error_code:k?h??null:null,result_code:m??null,bifurcation_context:[],approach_reason:H(b),one_liner:v??null});continue}else if(a==="child_agent_end"){o+=1;continue}else if(a==="if_else"){o+=1;let c=[];for(;o<t.length&&t[o].action_type==="child_agent_start";){let u=t[o],p=u.action_params?.child_id??"",d=u.action_params?.objective??"",_=[];o+=1;let g=1,f="error";for(;o<t.length&&g>0;){let h=t[o];if(h.action_type==="child_agent_start")g+=1;else if(h.action_type==="child_agent_end"&&(g-=1,g===0)){f=h.status??"success",o+=1;break}g>0&&_.push(h),o+=1}let m=D(_,e,s,i);c.push(...m)}r.push(ve(l,c));continue}else if(a==="query_tool"){o+=1;continue}else if(l.until_condition){let c=q(l,e,s,i),u=G(l,c,e),p=typeof l.until_condition_met=="boolean"?l.until_condition_met:l.status==="success";r.push({content_type:"until_block",instruction_id:`until_${P().slice(0,8)}`,condition:l.until_condition,max_retries:l.until_max_retries??10,settle_ms:l.until_settle_ms??500,current_count:0,condition_met:p,children:[u],generative_id:"",generative_objective:"",variables_used:{},status:l.status??"success"})}else{let c=q(l,e,s,i),u=G(l,c,e);r.push(u)}o+=1}return r}function L(t,e={},s="",i,n){let r=[];for(let o of t){let l=D(o.records,e,s,i,n);if(l.length===0)continue;let a=P().replace(/-/g,"");Q(l,a,o.objective);let c=l.some(_=>"status"in _&&typeof _.status=="string"?_.status==="error"||_.status==="failed":!1),u=o.resultCode?parseInt(o.resultCode,10):null,p=u!==null&&!isNaN(u)&&u>=200,d=c||p?"error":"success";r.push({content_type:"generative_block",instruction_id:`generative_block_${a}`,generative_id:a,objective:o.objective,status:d,children:l,error_message:d==="error"?o.errorMessage??null:null,error_code:d==="error"?o.reasonCode??null:null,result_code:o.resultCode??null,bifurcation_context:[],approach_reason:H(o.summary),one_liner:o.oneLiner??null})}return{instructions:r}}function te(t,e){let s;try{s=ee(t)}catch{return 0}let i=0,n=s.filter(r=>/^\d+$/.test(r)).sort((r,o)=>Number(r)-Number(o));for(let r of n){let o=N(t,r),l=N(o,"logs");if(!ye(l))continue;let a;try{a=ee(l)}catch{continue}let c=a.filter(d=>d.endsWith("-actions.ndjson")).sort((d,_)=>(parseInt(d,10)||0)-(parseInt(_,10)||0)),u=[];for(let d of c){let _=e.readActions(N(l,d));_.length&&u.push({objective:e.objective??"",records:_})}if(u.length===0)continue;let{instructions:p}=L(u,e.vars??{},e.screenshotBaseUrl??"",e.extMap,{keepFailedActions:!0});if(p.length!==0)try{let d=N(o,"auteur");Ae(d,{recursive:!0}),Re(N(d,"execution.json"),JSON.stringify(e.buildBlob(p),null,2)),i++,e.log?.("info","EVIDENCE_ARCHIVED_ATTEMPT_BLOB","Derived nested attempt blob",{attempt:r,instructions:p.length})}catch(d){e.log?.("debug","EVIDENCE_ARCHIVED_ATTEMPT_BLOB_FAILED","Nested attempt blob derivation failed",{attempt:r,error:d instanceof Error?d.message:String(d)})}}return i}var ie=le(ce(),1);import{createWriteStream as Pe}from"fs";import{readFile as xe}from"fs/promises";import{join as Le,basename as Ne}from"path";import{tmpdir as Oe}from"os";var ke=["**/screenshots/**","**/annotated/**","**/tcg/**","**/bifurcation/**"];async function ne(t){let e=Le(Oe(),`${Ne(t)}_artifacts.zip`);return new Promise((s,i)=>{let n=Pe(e),r=(0,ie.default)("zip",{zlib:{level:6}});n.on("close",()=>s(e)),r.on("error",i),r.pipe(n),r.glob("**/*",{cwd:t,ignore:ke}),r.finalize()})}async function se(t){return xe(t)}async function we(t,e){return ae(z(t,e))}function Ce(t){return{key:"artifacts",content_type:"application/zip",filename:`${t}.evidence`}}var re=class{config;controller;testId;constructor(e){this.config=e,this.controller=new M(e.controllerBaseUrl,e.auth),this.testId=e.testId}log(e,s,i,n){this.config.log?.(e,s,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"};let s=this.config.evidence,i=null;if(this.config.shouldUploadArtifacts!==!1){e("convert","running");let l=this.collectNdjsonPerRun(),a=l.reduce((f,m)=>f+m.records.length,0);this.log("info","PIPELINE_CONVERT","Collected NDJSON records",{total_records:a,run_groups:l.length});let c=this.config.variables??{};this.log("info","PIPELINE_CONVERT_VARS","Variables for template resolution",{keys:Object.keys(c)});let{instructions:u}=l.length>0?L(l,c,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap):{instructions:[]};this.log("info","PIPELINE_CONVERT_INSTRUCTIONS","Auteur instructions produced",{count:u.length});let p=this.buildExecutionEnvelope(u),d=Buffer.from(JSON.stringify(p));this.log("info","PIPELINE_CONVERT_BLOB","Blob created",{size_kb:+(d.length/1024).toFixed(1)});let _=E(this.config.sessionDir,"execution.json");O(_,JSON.stringify(p,null,2)),this.log("info","PIPELINE_CONVERT_LOCAL_SAVE","Execution blob saved locally",{path:_});let g=s?.packTestDir??this.config.evidenceRead?.packTestDir;if(g){let f=E(g,"auteur");U(f,{recursive:!0}),O(E(f,"execution.json"),JSON.stringify(p,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack",{path:E(f,"execution.json")}),this.deriveArchivedAttemptBlobs(g,c)}if(e("convert","done"),s)i=d;else{e("zip","running"),this.log("info","PIPELINE_ZIP_START","Zipping session",{session_dir:this.config.sessionDir});let f=null,m;try{f=await ne(this.config.sessionDir),m=await se(f),this.log("info","PIPELINE_ZIP_DONE","Zip complete",{size_mb:+(m.length/1024/1024).toFixed(1),path:f}),e("zip","done",`${(m.length/1024/1024).toFixed(1)}MB`)}finally{f&&await Te(f).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 h=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:h.urls.artifacts?.blob_url,blob_url:h.urls.blob?.blob_url}),e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading artifacts and blob",{artifact_size_mb:+(m.length/1024/1024).toFixed(1),blob_size_kb:+(d.length/1024).toFixed(1)}),await Promise.all([R(h.urls.artifacts.upload_url,m,"application/zip"),R(h.urls.blob.upload_url,d,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),e("upload","done")}}else{let l=this.collectNdjsonPerRun(),a=this.config.variables??{},{instructions:c}=l.length>0?L(l,a,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap,{keepFailedActions:!0}):{instructions:[]},u=this.buildExecutionEnvelope(c),p=E(this.config.sessionDir,"execution.json");O(p,JSON.stringify(u,null,2)),this.log("info","PIPELINE_LOCAL_SAVE","Execution blob saved locally (no upload)",{path:p});let d=this.config.evidence?.packTestDir??this.config.evidenceRead?.packTestDir;if(d){let _=E(d,"auteur");U(_,{recursive:!0});let g=this.readAuthoredExecution();O(E(_,"execution.json"),g??JSON.stringify(u,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack (gated)",{path:E(_,"execution.json"),source:g?"authored":"run_envelope"}),this.deriveArchivedAttemptBlobs(d,a)}e("convert","skipped"),e("zip","skipped"),e("presign","skipped"),e("upload","skipped"),this.log("info","PIPELINE_UPLOAD_SKIPPED","Upload steps skipped (gate disabled)")}if(this.config.shouldReplaceLocalOutput&&this.config.onAtomicReplace){e("atomic_replace","running");try{await this.config.onAtomicReplace(),this.log("info","PIPELINE_ATOMIC_REPLACE_OK","Local output replaced"),e("atomic_replace","done")}catch(l){let a=l instanceof Error?l.message:String(l);throw this.log("error","PIPELINE_ATOMIC_REPLACE_FAILED","Atomic-replace failed",{error:a}),e("atomic_replace","failed",a),l}}else e("atomic_replace","skipped");let n,r;if(this.config.shouldCommit&&!this.config.isFirstRun&&this.config.onCommitLock){e("commit_lock","running");let l=await this.config.onCommitLock();if(l.ok)n=l.testcaseId,this.log("info","PIPELINE_COMMIT_LOCK_OK","Commit lock acquired",{testcase_id:n??"none"}),e("commit_lock","done");else return this.log("error","PIPELINE_COMMIT_LOCK_FAILED","Commit lock failed",{reason:l.reason,message:l.message}),e("commit_lock","failed",`${l.reason??"unknown"}: ${l.message??""}`),{success:!1,testId:this.testId,error:`commit-lock failed: ${l.reason??"unknown"}`}}else e("commit_lock","skipped");if(this.config.isFirstRun&&!this.config.skipTmsFinalize){e("finalize","running"),this.log("info","PIPELINE_FINALIZE_START","Finalizing test (first-run)",{test_id:this.testId,commit_id:this.config.commitId});let l=new B(this.config.tmsBaseUrl,this.config.tmsUsername,this.config.tmsAccessKey),a=this.config.runObjectives&&this.config.runObjectives.length>0?this.config.runObjectives:[this.config.firstObjective];if(n=(await l.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:a})).testcase_id||void 0,this.log("info","PIPELINE_FINALIZE_OK","Test finalized",{testcase_id:n??"none"}),this.config.onFinalizeSuccess)try{await this.config.onFinalizeSuccess(n)}catch(u){this.log("warn","PIPELINE_FINALIZE_META_FAILED","Meta-rewrite after endTest failed",{error:String(u)})}e("finalize","done")}else e("finalize","skipped"),this.log("info","PIPELINE_FINALIZE_SKIPPED","Finalize skipped (evolve flow or first-run disabled)");if(n&&this.config.shareApiBaseUrl)try{r=await this.generateShareLink(n),this.log("info","PIPELINE_SHARE_OK","Share link generated",{share_id:r})}catch(l){this.log("warn","PIPELINE_SHARE_FAILED","Share link failed",{error:String(l)})}if(s&&i){let l=null;e("zip","running");try{await s.sealFn({testcaseId:n,shareId:r}),l=s.sealedPackPath?await ae(s.sealedPackPath):await we(s.executionId,s.cwd),this.log("info","PIPELINE_EVIDENCE_SEALED","Evidence pack sealed",{execution_id:s.executionId}),this.log("info","PIPELINE_PACK_READ","Sealed pack read",{size_mb:+(l.length/1024/1024).toFixed(1)})}catch(a){let c=a instanceof Error?a.message:String(a);this.log("warn","PIPELINE_EVIDENCE_UPLOAD_SKIPPED","Evidence seal/read failed \u2014 uploading blob only",{execution_id:s.executionId,error:c})}if(l){e("zip","done",`${(l.length/1024/1024).toFixed(1)}MB`),e("presign","running");let a=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[Ce(s.executionId),{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:a.urls.artifacts?.blob_url,blob_url:a.urls.blob?.blob_url}),e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading pack and blob",{artifact_size_mb:+(l.length/1024/1024).toFixed(1),blob_size_kb:+(i.length/1024).toFixed(1)}),await Promise.all([R(a.urls.artifacts.upload_url,l,"application/zip"),R(a.urls.blob.upload_url,i,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),e("upload","done")}else{e("zip","skipped"),e("presign","running");let a=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading blob only (evidence skipped)",{blob_size_kb:+(i.length/1024).toFixed(1)}),await R(a.urls.blob.upload_url,i,"application/json"),this.log("info","PIPELINE_UPLOAD_OK","Blob upload complete (pack skipped)"),e("upload","done")}}let o;if(this.config.mobile&&this.config.codeExport?.enabled)this.log("info","PIPELINE_CODE_EXPORT_SKIPPED","Code export is not supported for device runs"),e("code_export","skipped","not supported on mobile yet");else if(this.config.codeExport?.enabled&&n){let l=!1;try{await this.triggerCodeExport(n),this.log("info","PIPELINE_CODE_EXPORT_START","Code export triggered"),l=!0}catch(a){let c=a instanceof Error?a.message:String(a);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export trigger failed; skipping poll",{error:c}),e("code_export","failed",`trigger failed: ${c}`)}if(l){e("code_export","running","Waiting for code generation\u2026");try{o=await this.pollAndDownloadCode(n,e),this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:o}),e("code_export","done",o)}catch(a){let c=a instanceof Error?a.message:String(a);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:c}),e("code_export","failed",c)}}}else e("code_export","skipped");return this.log("info","PIPELINE_COMPLETE","Pipeline complete"),{success:!0,testId:this.testId,testcaseId:n,shareId:r,codeExportDir:o}}catch(s){return{success:!1,testId:this.testId,error:s instanceof Error?s.message:String(s)}}}async runCodeExport(e,s){let i=s??this.config.onProgress,n=!1;try{await this.triggerCodeExport(e),this.log("info","PIPELINE_CODE_EXPORT_TRIGGER","Code export triggered",{testcase_id:e}),n=!0}catch(r){let o=r instanceof Error?r.message:String(r);this.log("error","PIPELINE_CODE_EXPORT_TRIGGER_FAILED","Code export trigger failed; skipping poll",{error:o}),i("code_export","failed",`trigger failed: ${o}`)}if(n){i("code_export","running","Waiting for code generation\u2026");try{let r=await this.pollAndDownloadCode(e,i);return this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:r}),i("code_export","done",r),r}catch(r){let o=r instanceof Error?r.message:String(r);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:o}),i("code_export","failed",o);return}}}deriveArchivedAttemptBlobs(e,s){try{let i=te(e,{readActions:n=>this.readNdjsonFromFile(n),buildBlob:n=>this.buildExecutionEnvelope(n),objective:this.config.firstObjective,vars:s,screenshotBaseUrl:this.config.screenshotBaseUrl??"",extMap:this.config.screenshotExtMap,log:(n,r,o,l)=>this.log(n,r,o,l)});i>0&&this.log("info","PIPELINE_ARCHIVED_ATTEMPTS","Nested retry-attempt blobs derived",{count:i})}catch(i){this.log("debug","PIPELINE_ARCHIVED_ATTEMPTS_FAILED","Nested attempt blob pass failed",{error:i instanceof Error?i.message:String(i)})}}collectNdjsonPerRun(){let e=[],s=this.config.runObjectives??[],i=this.config.runMetadata??[],n=this.config.evidence??this.config.evidenceRead;for(let r=0;r<this.config.runDirs.length;r++){let o=this.config.runDirs[r],l=s[r]||this.config.firstObjective,a=i[r],c=n?this.readNdjsonFromFile(E(n.packTestDir,"logs",`${n.runIndices?.[r]??r}-actions.ndjson`)):this.readNdjsonFromDir(o);c.length>0&&e.push({objective:l,records:c,resultCode:a?.resultCode,reasonCode:a?.reasonCode,errorMessage:a?.errorMessage,summary:a?.summary,oneLiner:a?.oneLiner})}if(e.length===0){let r=E(this.config.sessionDir,"runs");if(j(r))try{let l=Se(r,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name).sort();for(let a of l){let c=E(r,a),u=this.readNdjsonFromDir(c);u.length>0&&e.push({objective:this.config.firstObjective,records:u})}}catch{}}return e}readNdjsonFromDir(e){let s=[E(e,"run-test","actions.ndjson"),E(e,"actions.ndjson")];for(let i of s)if(j(i))return this.readNdjsonFromFile(i);return[]}readNdjsonFromFile(e){let s=[];if(!j(e))return s;this.log("debug","PIPELINE_COLLECT_READ","Reading NDJSON file",{path:e});let i=oe(e,"utf-8");for(let n of i.split(`
|
|
5
|
-
`)){let r=n.trim();if(r)try{s.push(JSON.parse(r))}catch{}}return s}async generateShareLink(e){let s=`${this.config.shareApiBaseUrl}/lshs/api/v1.0/share-item/generate-sharable-link`;this.log("info","PIPELINE_SHARE_START","Requesting share link",{url:s,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 r=n?await this.config.authResolver.fetch(s,i):await x(s,{...i,headers:{...i.headers,Authorization:this.buildAuthHeader()}});if(!r.ok)throw new Error(`Share link API failed: ${r.status} ${await r.text()}`);let o=await r.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:s,body:i}=V({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:e,codeExport:this.config.codeExport});this.log("info","PIPELINE_CODE_EXPORT_POST","Triggering code export",{url:s});let n={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(i)},r=this.config.authResolver?await this.config.authResolver.fetch(s,n):await x(s,{...n,headers:{...n.headers,Authorization:this.buildAuthHeader()}});if(!r.ok)throw new Error(`Code export failed: ${r.status} ${await r.text()}`)}async pollAndDownloadCode(e,s){let i=$({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:e}),n=this.config.exitTimeoutMs??3e5,r=5e3,o=Date.now()+n;this.log("info","PIPELINE_CODE_EXPORT_POLL","Polling for code export",{url:i,timeout_ms:n});let l=(a,c)=>this.config.authResolver?this.config.authResolver.fetch(a,c):x(a,{...c,headers:{...c?.headers,Authorization:this.buildAuthHeader()}});for(;Date.now()<o;){let a=await l(i,{method:"GET",headers:{Accept:"application/json"}});if(!a.ok){let _=await a.text().catch(()=>"");throw this.log("warn","PIPELINE_CODE_EXPORT_POLL_FAILED","Code export poll non-200; skipping",{status:a.status,body:_.slice(0,200)}),new Error(`code export poll skipped: HTTP ${a.status}`)}let u=(await a.json()).data?.find(_=>_.code_name==="kane-cli-trigger");if(!u){this.log("debug","PIPELINE_CODE_EXPORT_WAITING","No kane-cli-trigger entry yet"),s("code_export","running","Waiting for code generation\u2026"),await this.sleep(r);continue}let p=u.status.toLowerCase();if(p==="in progress"||p==="in_progress"||p==="pending"){this.log("debug","PIPELINE_CODE_EXPORT_IN_PROGRESS","Code export in progress",{status:u.status}),s("code_export","running","Generating code\u2026"),await this.sleep(r);continue}if(!u.url||u.url.length===0)throw new Error(`Code export status=${u.status} but no files returned`);let d=this.config.codeExportDir??E(this.config.sessionDir,"code-export");U(d,{recursive:!0}),this.log("info","PIPELINE_CODE_EXPORT_DOWNLOAD","Downloading code files",{file_count:u.url.length,dir:d}),s("code_export","running",`Downloading ${u.url.length} files\u2026`);for(let _ of u.url){let g=E(d,_.file_name),f=await x(_.file_url);if(!f.ok){this.log("warn","PIPELINE_CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:_.file_name,status:f.status});continue}let m=await f.text();O(g,m,"utf-8"),this.log("info","PIPELINE_CODE_EXPORT_FILE_SAVED","File saved",{file_name:_.file_name,size_bytes:m.length})}return d}throw new Error("Code export timed out")}sleep(e){return new Promise(s=>setTimeout(s,e))}buildAuthHeader(){return typeof this.config.auth=="string"?`Bearer ${this.config.auth}`:F(this.config.auth.username,this.config.auth.accessKey)}readAuthoredExecution(){let e=this.config.authoredExecutionPath;if(!e)return null;try{let s=oe(e,"utf8");return JSON.parse(s),s}catch{return this.log("warn","PIPELINE_AUTHORED_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 pack gets this run's envelope",{path:e}),null}}buildExecutionEnvelope(e){let s=this.config.runStatuses.every(a=>a==="passed")?"success":"error",i=this.config.variableIds??{},n=[];if(this.config.variables)for(let[a,c]of Object.entries(this.config.variables)){if(c.secret)continue;let u=a.startsWith("global.")?a.slice(7):a;n.push({id:i[u]??0,name:u,value:c.value,session_value:c.value,is_persist:!1,environment_id:0,environment_name:"No Env"})}let r=[],o=[],l=new Set;for(let a of this.collectNdjsonPerRun())for(let c of a.records)if(c.output_variable&&c.output_value!=null&&r.push({name:c.output_variable,value:String(c.output_value),value_type:"test_level",variable_description:"ANALYZE result"}),c.action_type==="upload_files"){let u=C(c.action_params);if(u){let p=u.media_id||u.media_url;if(!l.has(p)){l.add(p),o.push({media_url:u.media_url,media_id:u.media_id,name:u.name,type:u.type});let d=w(u.name);r.push({name:K(u.name),value:d,value_type:"string",variable_description:`variable for ${d}`})}}}return{test_id:this.testId,version:"v4",auto_heal_version:this.config.apMode==="v2"?"AH2":"",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:s,commit_id:this.config.commitId,instructions:e,modules:[],uploaded_files:o,test_params:[],test_level_variables:JSON.stringify(r),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{we as a,Ce as b,re as c};
|
package/dist/chunk-PH22FRN5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{homedir as a}from"os";import{join as t}from"path";var m="0.8.4",d="kane-cli",e=t(a(),".testmuai","kaneai"),g=t(e,"profiles"),h=t(e,"tui-config.json"),b=t(e,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",_="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",L=`https://registry.npmjs.org/${n}`,r="kane-cli",x=[{dir:t(a(),".claude","skills",r),agent:"Claude Code"},{dir:t(a(),".agents","skills",r),agent:"Codex CLI"},{dir:t(a(),".gemini","skills",r),agent:"Gemini CLI"}],U="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",R=9222,I=9230,E=t(e,"chrome-profiles"),o=t(e,"hints"),C=t(o,"state.json");function T(s){return t(o,`catalog-${s}.json`)}var c="127.0.0.1",S=18392,f=18400,i="/callback";function B(s){return`http://${c}:${s}${i}`}var N="KANE CLI",P="*",O={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com",mobileAppBaseUrl:"https://api.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com",mobileAppBaseUrl:"https://stage-api.lambdatestinternal.com"}},k={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444",amber:"#fbbf24"};export{m as a,d as b,e as c,h as d,b as e,A as f,_ as g,n as h,x as i,U as j,u as k,R as l,I as m,E as n,C as o,T as p,c as q,S as r,f as s,i as t,B as u,N as v,P as w,O as x,k as y};
|
package/dist/chunk-QDIZQ3ZF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-HXSEA7JS.js";import{y as o}from"./chunk-PH22FRN5.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as y,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var k=b(w(),1);var i=b(R(),1);function A(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,d=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let s=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${d} failed, ${f} skipped)`,T=`${t} replay \xB7 ${l} author`,C=e.retryTriggered,_="yes \u2014 run recovered after a replay miss",u,h=o.dim;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",h=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let r=e.uploadResult?.testcaseId;u=r?`\u2713 pushed (testcase=${r})`:"\u2713 pushed",h=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",g=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:s},breakdown:T,showRetries:C,retriesText:_,commitText:u,commitColor:h,artifactsText:v,uploadText:m,uploadColor:g}}function O(e){let t=e.decisions.filter(s=>s.kind==="replay").length,l=e.decisions.filter(s=>s.kind==="author").length,p=e.outcomes.filter(s=>s.status==="passed").length,d=e.outcomes.filter(s=>s.status==="failed").length,f=e.outcomes.filter(s=>s.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:d,skipped:f,replay_decisions:t,author_decisions:l},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function D({data:e}){let t=A(e),l=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"retries",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function I({data:e}){let{exit:t}=x();return(0,k.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,i.jsx)(y,{flexDirection:"column",children:(0,i.jsx)(D,{data:e})})}export{A as a,O as b,D as c,I as d};
|
package/dist/chunk-UOMRMCMI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
function o(e){return e.kind==="simulator"?e.id:e.virtualName??e.id}function n(e,i,r={}){let t={platform:e.platform,udid:e.id,target_kind:e.kind};return i&&(t.app_package=i),r.noReset!==void 0&&(t.no_reset=r.noReset),r.appiumUrl&&(t.appium_url=r.appiumUrl),t}export{o as a,n as b};
|
package/dist/chunk-X2FM67OM.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as I,c as b}from"./chunk-NVGBE2DR.js";import{A as T}from"./chunk-TH47OOBV.js";import{a as L,c as F}from"./chunk-CUM23TLF.js";import{b as P,i as j}from"./chunk-DUAXZYAD.js";import{a as R,d as $,f as D}from"./chunk-WXHQYYD5.js";import{existsSync as ie,mkdirSync as oe,readFileSync as re,writeFileSync as se}from"fs";import{basename as S,extname as H,join as ae}from"path";var K=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function Z(e){return typeof e=="string"&&e!=="."&&e!==".."&&K.test(e)}function k(e){if(!Z(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(K)} (no path separators)`)}import{extname as q}from"path";var Q={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ee={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},fe={kind:"web",media_type:"application/x-kane-web-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},z=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(te)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Q,ee],te=Buffer.from([208,207,17,224,161,177,26,225]),M={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence",web:"web"},ue=new Set(Object.keys(M));function J(e){let n=q(e).toLowerCase(),t=z.find(i=>i.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:z.flatMap(i=>i.extensions)}}function v(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function de(e,n,t){return G({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:n,numbered_text:U(t)})}var Y=2e3;function ce(e){let t=S(e,H(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return k(t),t}function Me(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function W(e){let n=ae(e,"meta.json");ie(n)||(oe(e,{recursive:!0}),se(n,JSON.stringify({schema:R,canonicalizer:"v1"},null,2)+`
|
|
3
|
-
`))}async function Se(e){let{contextDir:n,filePath:t,asId:i,confirmSameSource:_,converters:h}=e;W(n);let o=re(t),s=J(t);if(!s.ok)throw new Error(`${S(t)} is a file type kane can't ingest (${H(t)||"no extension"}) \u2014 supported: ${s.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(o.byteLength>s.media.maxBytes)throw new Error(`${S(t)} is too large \u2014 ${v(o.byteLength)}, the limit for ${s.media.media_type} is ${v(s.media.maxBytes)} [FILE_TOO_LARGE]`);if(s.media.sniff&&!s.media.sniff(o)){let m=s.media.sniffFail?.(o);throw new Error(m??`MEDIA_SNIFF_MISMATCH: ${t} does not look like ${s.media.media_type}`)}let l;return i!==void 0?(k(i),l=i):l=ce(t),le({contextDir:n,bytes:o,media:s.media,sourceId:l,label:t,confirmSameSource:_,converters:h})}async function le(e){let{contextDir:n,bytes:t,media:i,confirmSameSource:_,converters:h}=e,o=e.sourceId,s=e.label??o;if(W(n),t.byteLength>i.maxBytes)throw new Error(`the content is too large \u2014 ${v(t.byteLength)}, the limit for ${i.media_type} is ${v(i.maxBytes)} [FILE_TOO_LARGE]`);let l=[],m=M[i.kind];if(i.cite==="verbatim"&&!m){try{new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${s} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}t.toString("utf8").split(`
|
|
4
|
-
`).some(f=>f.length>Y)&&l.push(`long line detected (> ${Y} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let p=I(t),y=new Map,c=null,C=!1;for(let f=0;;f++){let x=T(n),u=x.heads.get(o),X=u!=null?x.getNode(u)?.content:void 0;if(u!=null&&X?.blob===p)return{status:"unchanged",source_id:o,cid:u,blob:p};if(u==null){for(let[r,g]of x.heads.entries())if(!(r===o||g==null)&&x.getNode(g)?.content.blob===p){let a;if(y.has(r)?a=y.get(r):f===0&&_?(a=await _(r),y.set(r,a)):(a=!1,y.set(r,a),f>0&&l.push(`same bytes already ingested as '${r}' \u2014 minted under '${o}' anyway (the twin appeared mid-commit; not prompted)`)),a)return{status:"unchanged",source_id:r,cid:g,blob:p};break}}if(c===null){let r={},g,a=null,A=null;if(m){let O=h?.[m];if(!O)throw new Error(`${m.toUpperCase()}_CONVERTER_MISSING: ${m} ingestion requires the converter \u2014 the command layer wires it`);let d=await O(t);a=Buffer.from(d.projection,"utf8");let N=de(o,i.kind,a);if(N>4e5)throw new Error(`PROJECTION_TOO_LARGE: serialized source payload ${N} bytes > ${4e5} \u2014 split the document and re-ingest`);r={text_blob:I(a),...d.inventory.length>0?{images:d.inventory}:{},converter:d.converter},A=d.blobs,g={kind:i.kind,...d.pages!==void 0?{pages:d.pages}:{},delivered:d.delivered.length,omitted:d.inventory.length-d.delivered.length}}c={derived:r,composite:g,projBytes:a,derivedBlobs:A}}if(!C){if(b(n,t),c.projBytes!==null&&b(n,c.projBytes),c.derivedBlobs!==null)for(let[,r]of c.derivedBlobs)b(n,r);C=!0}let w=F(o,p),E=D("source",w);if(E.length>0)throw new Error(`source node fails ${E[0].code}: ${E[0].detail}`);let B=L("source",w);try{j(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:B,label:$.SOURCE,content:w}],edges:[],review:[],supersessions:[],media:{[o]:{format:i.kind,media_type:i.media_type,anchors_supported:m?["L-L","img#ref"]:i.cite==="verbatim"?["L-L"]:[],...c.derived}},...e.eventIds&&e.eventIds.length>0?{event_ids:e.eventIds}:{},source_head_moves:{[o]:B}},{expectPrev:x.latestHash})}catch(r){if(r instanceof P&&f<3)continue;throw r}return{status:u!=null?"versioned":"created",source_id:o,cid:B,blob:p,...l.length?{warnings:l}:{},...c.composite?{composite:c.composite}:{}}}}export{k as a,Q as b,ee as c,fe as d,ue as e,J as f,de as g,ce as h,Me as i,Se as j,le as k};
|
package/dist/doctor-CPMWU5TL.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-TXH2KG7U.js";import"./chunk-7HXZZ3VA.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JCILRPOM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-PH22FRN5.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
|
package/dist/install-YDH2CORO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-BGMI5PH4.js";import"./chunk-RFHMDQXZ.js";import"./chunk-A3PGLDQY.js";import"./chunk-JT7I6OST.js";import"./chunk-RZ4F3BHX.js";import"./chunk-XHNPNYJP.js";import"./chunk-PH22FRN5.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-EQSE6NIB.js";import"./chunk-2YQ6TW77.js";import"./chunk-NEHX45NQ.js";import"./chunk-5DBK6QNS.js";import"./chunk-GSYJUHRK.js";import"./chunk-5GUD3CIH.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZSXDZI56.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-52GWEKFD.js";import"./chunk-BPMSNGXQ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JCILRPOM.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-JT7I6OST.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-PH22FRN5.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as a,d as b,e as c,f as d,g as e,h as f}from"./chunk-BXRZGISN.js";import"./chunk-52GWEKFD.js";import"./chunk-TXH2KG7U.js";import"./chunk-7HXZZ3VA.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JCILRPOM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-66RJPH73.js";import"./chunk-TAOHYWEO.js";import"./chunk-UOMRMCMI.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-PH22FRN5.js";import"./chunk-UR6MHSHU.js";export{a as MobileHostUnsupportedError,b as MobilePreflightError,c as PACKAGE_ID_REJECTED,e as isInstallablePath,f as prepareTarget,d as toAppSpec};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h}from"./chunk-6CR2HTIM.js";import"./chunk-BXRZGISN.js";import"./chunk-52GWEKFD.js";import"./chunk-TXH2KG7U.js";import"./chunk-7HXZZ3VA.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JCILRPOM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-66RJPH73.js";import"./chunk-TAOHYWEO.js";import"./chunk-UOMRMCMI.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-PH22FRN5.js";import"./chunk-UR6MHSHU.js";export{h as CHOOSE_MOBILE_KIND_MESSAGE,a as appSuitsTarget,d as formatRunningOn,e as missingPieceMessage,b as resolveRunIntent,c as resolveTestmdIntent,g as staleAppMessage,f as staleDeviceMessage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{f as a}from"./chunk-55NSNWM5.js";import"./chunk-3MSXQU2C.js";import"./chunk-62WYSEAT.js";import"./chunk-UTIGOLON.js";import"./chunk-N5JHMCRU.js";import"./chunk-ZK57J37M.js";import"./chunk-2PH43Z3P.js";import"./chunk-35L2QXWP.js";import"./chunk-L4EDLDLZ.js";import"./chunk-NEAMQMYH.js";import"./chunk-A4XJUWAQ.js";import"./chunk-TYI4MLFJ.js";import"./chunk-DEZ7CXGM.js";import"./chunk-QDIZQ3ZF.js";import"./chunk-A6TJUSOS.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-6CR2HTIM.js";import"./chunk-EQSE6NIB.js";import"./chunk-2YQ6TW77.js";import"./chunk-5DT7PIGB.js";import"./chunk-IXTFWIQ6.js";import"./chunk-NEHX45NQ.js";import"./chunk-5DBK6QNS.js";import"./chunk-GSYJUHRK.js";import"./chunk-5GUD3CIH.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZSXDZI56.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-4CHO7SAT.js";import"./chunk-L77ZOU4N.js";import"./chunk-UONRTWLU.js";import"./chunk-VZ7KXRXB.js";import"./chunk-KAMJ7U4M.js";import"./chunk-OSB32HJE.js";import"./chunk-DYGUHGZ6.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-BDUCWZYO.js";import"./chunk-KUYJ6FEN.js";import"./chunk-5HYXTFGB.js";import"./chunk-5Y2G4NC7.js";import"./chunk-R5T4RLF5.js";import"./chunk-2YEHV2CX.js";import"./chunk-VYYTENPY.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-BXRZGISN.js";import"./chunk-52GWEKFD.js";import"./chunk-GJED4QGF.js";import"./chunk-PRLTUEKP.js";import"./chunk-YCCUBQY4.js";import"./chunk-BCCWICSS.js";import"./chunk-SFXQFUM6.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-BGMI5PH4.js";import"./chunk-RFHMDQXZ.js";import"./chunk-TXH2KG7U.js";import"./chunk-7HXZZ3VA.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JCILRPOM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-66RJPH73.js";import"./chunk-TAOHYWEO.js";import"./chunk-7HPEHQHH.js";import"./chunk-HHHNQW5Z.js";import"./chunk-7VTYRTEJ.js";import"./chunk-UOMRMCMI.js";import"./chunk-4JOD47QI.js";import"./chunk-JRADU3PO.js";import"./chunk-A3PGLDQY.js";import"./chunk-JT7I6OST.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-EYOCNMUM.js";import"./chunk-XHNPNYJP.js";import"./chunk-HXSEA7JS.js";import"./chunk-PSWB3BWQ.js";import"./chunk-PH22FRN5.js";import{a as o}from"./chunk-DFS4RMVP.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-JRADU3PO.js";import"./chunk-A3PGLDQY.js";import"./chunk-JT7I6OST.js";import"./chunk-RZ4F3BHX.js";import"./chunk-PH22FRN5.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|