sootsim 0.1.216 → 0.1.218
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-cli/bin.js +4 -4
- package/dist-cli/chunks/{agent-RMGUE35J.js → agent-TQJDQNML.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-PNKMWDVX.js → agent-wrapper-OAOFXHX2.js} +2 -2
- package/dist-cli/chunks/{app-fonts-Z6SGSVKJ.js → app-fonts-4VPAP3RZ.js} +2 -2
- package/dist-cli/chunks/{assert-ELIDRXY7.js → assert-DKNRGH4M.js} +2 -2
- package/dist-cli/chunks/{auth-2NJA7QI6.js → auth-ZYOAQEI2.js} +2 -2
- package/dist-cli/chunks/beta-HL46FNX3.js +2 -0
- package/dist-cli/chunks/{camera-XICNRGGO.js → camera-BJCRYG27.js} +2 -2
- package/dist-cli/chunks/{chunk-S3C2S27B.js → chunk-24FHNNST.js} +2 -2
- package/dist-cli/chunks/{chunk-GIZDZKHC.js → chunk-2HJU3NAO.js} +1 -1
- package/dist-cli/chunks/{chunk-URGNAE7V.js → chunk-4DLUGQXQ.js} +21 -21
- package/dist-cli/chunks/{chunk-U7UICUB4.js → chunk-6WWKUDWP.js} +2 -2
- package/dist-cli/chunks/{chunk-CCFLATUR.js → chunk-73WAFGRP.js} +2 -2
- package/dist-cli/chunks/{chunk-G6VHJWGQ.js → chunk-7NP5BWIH.js} +1 -1
- package/dist-cli/chunks/{chunk-SPKRGAWR.js → chunk-AHTGZMT4.js} +2 -2
- package/dist-cli/chunks/{chunk-J4GDWHXE.js → chunk-AK4CONMS.js} +2 -2
- package/dist-cli/chunks/{chunk-4BUASWNE.js → chunk-AY5S4CWZ.js} +1 -1
- package/dist-cli/chunks/{chunk-VDONTXCB.js → chunk-B4KB5TBV.js} +1 -1
- package/dist-cli/chunks/chunk-BZRIJJIK.js +1 -0
- package/dist-cli/chunks/{chunk-YN44PKW5.js → chunk-CJHPCUUV.js} +1 -1
- package/dist-cli/chunks/{chunk-GPLW7IL5.js → chunk-CMGPYPUE.js} +2 -2
- package/dist-cli/chunks/{chunk-UGNYHNBN.js → chunk-CRPOEKYT.js} +3 -3
- package/dist-cli/chunks/{chunk-4XCGYTBN.js → chunk-DVZVP32W.js} +2 -2
- package/dist-cli/chunks/{chunk-J74AW22R.js → chunk-EEUNNW2P.js} +1 -1
- package/dist-cli/chunks/{chunk-2FNN7T63.js → chunk-F5H6XTMN.js} +1 -1
- package/dist-cli/chunks/{chunk-SBP46OOV.js → chunk-FAUOGIHF.js} +1 -1
- package/dist-cli/chunks/{chunk-CQSIRKJ2.js → chunk-FEMAFOUH.js} +2 -2
- package/dist-cli/chunks/{chunk-P5JY275Q.js → chunk-FP3DRAKI.js} +2 -2
- package/dist-cli/chunks/{chunk-DA7KPSMF.js → chunk-IKZ4Z6ND.js} +1 -1
- package/dist-cli/chunks/{chunk-CU3LQUJD.js → chunk-JDCABF7Y.js} +2 -2
- package/dist-cli/chunks/{chunk-HZCW6RRE.js → chunk-KLBOD2JL.js} +2 -2
- package/dist-cli/chunks/{chunk-7SPHDLSB.js → chunk-L5HYRG4P.js} +2 -2
- package/dist-cli/chunks/{chunk-HKKKZRKS.js → chunk-LIR2VPPJ.js} +2 -2
- package/dist-cli/chunks/{chunk-BGDEZZWT.js → chunk-MW3G72KG.js} +2 -2
- package/dist-cli/chunks/{chunk-P735P65P.js → chunk-NN7XOWXY.js} +4 -4
- package/dist-cli/chunks/{chunk-6TZMBHQ5.js → chunk-OTCJCVFR.js} +3 -3
- package/dist-cli/chunks/chunk-OUZAVYUG.js +1 -0
- package/dist-cli/chunks/{chunk-LWECTC6A.js → chunk-Q7K5GJR4.js} +2 -2
- package/dist-cli/chunks/{chunk-VURHG6DO.js → chunk-Q7U5TPQN.js} +1 -1
- package/dist-cli/chunks/{chunk-TNPHXSMV.js → chunk-QWJG2WVA.js} +1 -1
- package/dist-cli/chunks/{chunk-M2DYRSIS.js → chunk-RZMI7IKL.js} +2 -2
- package/dist-cli/chunks/{chunk-DRFWZ74H.js → chunk-SXS5SPIZ.js} +1 -1
- package/dist-cli/chunks/{chunk-HIDDRHAN.js → chunk-T2NAWDMZ.js} +2 -2
- package/dist-cli/chunks/{chunk-CRU7UL5Q.js → chunk-TGXLBFTC.js} +1 -1
- package/dist-cli/chunks/{chunk-AWSL2LAA.js → chunk-TNEHHCMZ.js} +2 -2
- package/dist-cli/chunks/{chunk-HBCEGJQH.js → chunk-V64N734Y.js} +2 -2
- package/dist-cli/chunks/{chunk-SSLFXUZQ.js → chunk-VOZZ62OJ.js} +1 -1
- package/dist-cli/chunks/{chunk-QNRORBZE.js → chunk-XB6FCXX3.js} +2 -2
- package/dist-cli/chunks/{chunk-RESHDGBU.js → chunk-YMFQOXT4.js} +1 -1
- package/dist-cli/chunks/{chunk-VSGSEQE7.js → chunk-Z4QP44SI.js} +2 -2
- package/dist-cli/chunks/{chunk-UPLXEL4D.js → chunk-ZJI2JP7F.js} +1 -1
- package/dist-cli/chunks/cli-version-5FG6LIHX.js +2 -0
- package/dist-cli/chunks/{compat-MF7YZPCS.js → compat-IETPHSZ3.js} +3 -3
- package/dist-cli/chunks/{config-WJSCJ622.js → config-BOOBJ25W.js} +2 -2
- package/dist-cli/chunks/{control-AZFQJXJ5.js → control-U52Q4YES.js} +2 -2
- package/dist-cli/chunks/daemon-EJDBU2UY.js +2 -0
- package/dist-cli/chunks/{debug-LIXGHFHV.js → debug-X4AW6CXJ.js} +3 -3
- package/dist-cli/chunks/{desktop-T7GTXHL4.js → desktop-HHREMDE2.js} +3 -3
- package/dist-cli/chunks/{detox-WV5FD4G6.js → detox-AXETJDTZ.js} +2 -2
- package/dist-cli/chunks/{device-GPHUF3BL.js → device-B7PBIMER.js} +2 -2
- package/dist-cli/chunks/{diagnose-OAXHSPXW.js → diagnose-7YEDF42J.js} +2 -2
- package/dist-cli/chunks/drivers-325S27FC.js +2 -0
- package/dist-cli/chunks/film-XQMAOELQ.js +87 -0
- package/dist-cli/chunks/flow-V2SWGBAR.js +2 -0
- package/dist-cli/chunks/help-F4VH4LXF.js +2 -0
- package/dist-cli/chunks/{home-paths-T3SY5QGR.js → home-paths-I3NOFS6P.js} +2 -2
- package/dist-cli/chunks/inspect-NY5VGZNC.js +2 -0
- package/dist-cli/chunks/install-desktop-X7SXH7IN.js +2 -0
- package/dist-cli/chunks/{login-QS2GVTJJ.js → login-O4ZPWWEU.js} +4 -4
- package/dist-cli/chunks/{logout-I752SSKU.js → logout-REEPRXWZ.js} +2 -2
- package/dist-cli/chunks/{maestro-RDBKRP4O.js → maestro-OCUCS5DY.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-JOTQKAEH.js → maestro-generate-VHUHJFHR.js} +3 -3
- package/dist-cli/chunks/{mode-Z4W3XXXU.js → mode-T24V4RZ4.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-HPLGNZCO.js +2 -0
- package/dist-cli/chunks/{perf-RXXW5GRA.js → perf-ZUER6TVQ.js} +2 -2
- package/dist-cli/chunks/{record-527ZYKHE.js → record-XDKPMUBK.js} +3 -3
- package/dist-cli/chunks/runtime-4A24ALGX.js +2 -0
- package/dist-cli/chunks/screenshot-command-MMUGPJ4I.js +151 -0
- package/dist-cli/chunks/{screenshots-capture-VC752Q3V.js → screenshots-capture-OM6BE572.js} +2 -2
- package/dist-cli/chunks/{serve-NU6WWN2K.js → serve-BCATAS4S.js} +2 -2
- package/dist-cli/chunks/{setup-6BJWI3PC.js → setup-LXPQLQ6I.js} +3 -3
- package/dist-cli/chunks/{skills-L7JPAJEZ.js → skills-OOPLWNI2.js} +2 -2
- package/dist-cli/chunks/{storage-XIZZSPC3.js → storage-E7MGHPIG.js} +2 -2
- package/dist-cli/chunks/store-3DU64I7C.js +2 -0
- package/dist-cli/chunks/telemetry-AKRLP3AR.js +2 -0
- package/dist-cli/chunks/{timeline-3MAGSV2V.js → timeline-4AN6A5CV.js} +2 -2
- package/dist-cli/chunks/{upgrade-YDHOHVYZ.js → upgrade-FRBWFDPI.js} +2 -2
- package/dist-cli/chunks/upload-XGUWNMYV.js +2 -0
- package/dist-cli/chunks/{version-QDGDS5P2.js → version-LI2X5HLA.js} +2 -2
- package/dist-cli/chunks/web-UDCVLGPU.js +2 -0
- package/dist-cli/chunks/{what-happened-4GGACNI4.js → what-happened-2NTKQ4AT.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +13 -11
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/beta-MTYUL7U7.js +0 -2
- package/dist-cli/chunks/chunk-5LT4NR6Y.js +0 -1
- package/dist-cli/chunks/chunk-6KRC622O.js +0 -1
- package/dist-cli/chunks/cli-version-BP5GKAZ6.js +0 -2
- package/dist-cli/chunks/daemon-MU77JEAP.js +0 -2
- package/dist-cli/chunks/drivers-LJAA7XSZ.js +0 -2
- package/dist-cli/chunks/film-ZBYERRWW.js +0 -69
- package/dist-cli/chunks/flow-TXG46ARF.js +0 -2
- package/dist-cli/chunks/help-BVVLN5KL.js +0 -2
- package/dist-cli/chunks/inspect-7SHQVCCL.js +0 -2
- package/dist-cli/chunks/install-desktop-RFGXCZRS.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-JTRVZB45.js +0 -2
- package/dist-cli/chunks/runtime-DOAHJLEK.js +0 -2
- package/dist-cli/chunks/screenshot-command-OBPEZJLR.js +0 -151
- package/dist-cli/chunks/store-3UAGOXD4.js +0 -2
- package/dist-cli/chunks/telemetry-IXCWQVEB.js +0 -2
- package/dist-cli/chunks/upload-YQVEPIO7.js +0 -2
- package/dist-cli/chunks/web-BK6VHH5W.js +0 -2
package/dist-cli/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! sootsim v0.1.
|
|
3
|
-
import{a as w,b as u}from"./chunks/chunk-
|
|
2
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
3
|
+
import{a as w,b as u}from"./chunks/chunk-QWJG2WVA.js";import"./chunks/chunk-EEUNNW2P.js";function f(t){let a=t instanceof Error?t.message:String(t);(/^command timed out after \d+s$/.test(a)||a.startsWith("sim disconnected:")||a.startsWith("bridge never reconnected")||a.startsWith("no sim connected with id ")||a.startsWith("could not connect to ws://")||a.startsWith("sootsim bridge daemon is not running")||a.startsWith("sootsim bridge lockfile is fresh")||a.startsWith("sootsim bridge exited before becoming ready")||a.startsWith("background daemon setup is unavailable")||a.startsWith("sootsim bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${a}
|
|
4
4
|
`),process.exit(1)),t instanceof Error&&t.stack?process.stderr.write(`${t.stack}
|
|
5
5
|
`):process.stderr.write(`${a}
|
|
6
6
|
`),process.exit(1)}process.on("unhandledRejection",f);process.on("uncaughtException",f);var h=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,A=new Set(["desktop"]);function k(t){!h||!A.has(t)||(process.stderr.write(` sootsim ${t} isn't available in the standalone binary \u2014
|
|
7
7
|
it needs vite / electron / playwright from a project's node_modules.
|
|
8
8
|
run the npm package instead:
|
|
9
9
|
sootsim ${t}
|
|
10
|
-
`),process.exit(1))}var e=u(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-
|
|
11
|
-
`)}async function c(t){let{flushCliTelemetry:a}=await import("./chunks/telemetry-
|
|
10
|
+
`),process.exit(1))}var e=u(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-AKRLP3AR.js");t({event:"cli_command_invoked",properties:{command:e.command||(e.version?"version":e.help?"help":"none"),arg_count:e.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:t}=await import("./chunks/home-paths-I3NOFS6P.js"),a=t();a&&process.stderr.write(` SootSim engine upgraded to v${a.to}`+(a.from?` (from v${a.from})`:"")+` \xB7 what's new: https://sootsim.com/changelog
|
|
11
|
+
`)}async function c(t){let{flushCliTelemetry:a}=await import("./chunks/telemetry-AKRLP3AR.js");await a(),process.exit(t)}if(e.version){let{getCliVersion:t}=await import("./chunks/cli-version-5FG6LIHX.js"),{IS_BETA:a,BETA_LABEL:i}=await import("./chunks/beta-HL46FNX3.js"),p=a?` \xB7 ${i}`:"";console.log(`sootsim v${t()}${p}`);let{readActiveRuntime:b}=await import("./chunks/home-paths-I3NOFS6P.js"),l=b();console.log(l?`runtime v${l}`:"runtime not installed"),await c(0)}if(e.help&&!e.command){let{printHelp:t}=await import("./chunks/help-F4VH4LXF.js");t(),await c(0)}var o=e.globalFlags.port,r=e.verbose,m=e.globalFlags.device,d=e.globalFlags.theme,v=e.globalFlags.driver,_=e.globalFlags.headless===!0,g=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,s=g?["--sim",g,...e.commandArgs]:e.commandArgs;if(m||d){let{settingsStore:t}=await import("./chunks/store-3DU64I7C.js"),a={};m&&(a.deviceModel=m),d&&(a.colorScheme=d),t.apply(a)}if(!e.command&&e.commandArgs.length===0){let{runSetup:t,shouldRunSetupForBareCommand:a}=await import("./chunks/setup-LXPQLQ6I.js");a()&&(await t(["--from-welcome"]),await c(0));let{printHelp:i}=await import("./chunks/help-F4VH4LXF.js");i(),await c(0)}var n=e.command??"";if(!n){if(e.commandArgs.length>0){let a=e.commandArgs.find(i=>!i.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${a}`),console.error(" run `sootsim --help` to see the full surface."),await c(1)}let{printHelp:t}=await import("./chunks/help-F4VH4LXF.js");t(),await c(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(n==="skill"){let{runSkill:i}=await import("./chunks/skills-OOPLWNI2.js");await i(e.commandArgs),await c(0)}let t=n==="do"||n==="get"||n==="debug"||n==="shell"||n==="wait",a=e.commandArgs.find(i=>!i.startsWith("-"));if(n!=="shell")if(t&&!a){let{printGroupHelp:i}=await import("./chunks/help-F4VH4LXF.js");i(n)&&await c(0)}else{let{printCommandHelp:i}=await import("./chunks/help-F4VH4LXF.js");i(t&&a?a:n,{prefer:t&&a?"verb":"command",group:t&&a?n:void 0}),await c(0)}}k(n);if(w.has(n)){let{runInspect:t}=await import("./chunks/inspect-NY5VGZNC.js");await t([n,...s],{port:o,verbose:r})}else switch(n){case"assert":{let{runAssert:t}=await import("./chunks/assert-DKNRGH4M.js");await t(e.commandArgs);break}case"detox":{let{runDetox:t}=await import("./chunks/detox-AXETJDTZ.js");await t(e.commandArgs,{port:o,verbose:r});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-OCUCS5DY.js"),a=await t(s,{port:o,verbose:r});process.exit(typeof a=="number"?a:0)}case"record":{let{runRecord:t}=await import("./chunks/record-XDKPMUBK.js");await t(s,{port:o,verbose:r});break}case"film":{let{runFilm:t}=await import("./chunks/film-XQMAOELQ.js"),a=await t(s,{port:o,verbose:r});process.exit(typeof a=="number"?a:0)}case"storage":{let{runStorage:t}=await import("./chunks/storage-E7MGHPIG.js"),a=await t(s,{port:o,verbose:r});process.exit(typeof a=="number"?a:0)}case"perf":{let{runPerf:t}=await import("./chunks/perf-ZUER6TVQ.js"),a=await t(s,{port:o,verbose:r});process.exit(typeof a=="number"?a:0)}case"screenshot":{let{runScreenshotCommand:t}=await import("./chunks/screenshot-command-MMUGPJ4I.js"),a=await t(s,{port:o,verbose:r});process.exit(typeof a=="number"?a:0)}case"mode":{let{runMode:t}=await import("./chunks/mode-T24V4RZ4.js");await t(s,{port:o,verbose:r});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-NY5VGZNC.js");await t(s,{port:o,verbose:r});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-X4AW6CXJ.js");await t(s,{port:o,verbose:r});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-4AN6A5CV.js");await t(s,{port:o,verbose:r});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-2NTKQ4AT.js");await t(s,{port:o,verbose:r});break}case"open":{let{runOpenCommand:t}=await import("./chunks/control-U52Q4YES.js");await t(s,{port:o});break}case"use":{let{runUseCommand:t}=await import("./chunks/control-U52Q4YES.js");await t(s,{port:o});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-U52Q4YES.js");await t(s,{port:o});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-U52Q4YES.js");await t(s,{port:o});break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-B7PBIMER.js");await t(s,{port:o});break}case"compat":{let{runCompat:t}=await import("./chunks/compat-IETPHSZ3.js");await t(e.commandArgs);break}case"desktop":{let{runDesktop:t}=await import("./chunks/desktop-HHREMDE2.js");await t(e.commandArgs,{port:o,device:m,driver:v});break}case"login":{let{runLogin:t}=await import("./chunks/login-O4ZPWWEU.js");await t(e.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-REEPRXWZ.js");await t();break}case"auth":{let{runAuth:t}=await import("./chunks/auth-ZYOAQEI2.js");await t(e.commandArgs);break}case"setup":{let{runSetup:t}=await import("./chunks/setup-LXPQLQ6I.js");await t(e.commandArgs);break}case"serve":{let{runServe:t}=await import("./chunks/serve-BCATAS4S.js");await t(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-EJDBU2UY.js");await t(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-4A24ALGX.js");await t(e.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-FRBWFDPI.js");await t(e.commandArgs);break}case"version":{let{runVersion:t}=await import("./chunks/version-LI2X5HLA.js");await t(e.commandArgs);break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-TQJDQNML.js"),a=await t(e.commandArgs);process.exit(a)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-OAOFXHX2.js"),a=await t(e.commandArgs);process.exit(a)}case"skill":{let{runSkill:t}=await import("./chunks/skills-OOPLWNI2.js");await t(e.commandArgs);break}case"app-fonts":{let{runAppFonts:t}=await import("./chunks/app-fonts-4VPAP3RZ.js");await t(e.commandArgs);break}case"config":{let{runConfig:t}=await import("./chunks/config-BOOBJ25W.js");await t(e.commandArgs);break}default:console.error(` unknown command: ${n}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as b,b as E,c as A,d as l,e as S,g as j,h as T,j as I,m as k,n as D,o as x,p as g,q as O,r as C}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as b,b as E,c as A,d as l,e as S,g as j,h as T,j as I,m as k,n as D,o as x,p as g,q as O,r as C}from"./chunk-KLBOD2JL.js";import"./chunk-VOZZ62OJ.js";import{c as $}from"./chunk-RZMI7IKL.js";import"./chunk-73WAFGRP.js";import"./chunk-FP3DRAKI.js";import"./chunk-XB6FCXX3.js";import"./chunk-Q7U5TPQN.js";import"./chunk-CJHPCUUV.js";import{j as y}from"./chunk-YMFQOXT4.js";import"./chunk-SXS5SPIZ.js";import"./chunk-TGXLBFTC.js";import"./chunk-IKZ4Z6ND.js";import"./chunk-EEUNNW2P.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no sootsim bridge on port ${e}. run \`sootsim setup\` to install the background daemon, or \`sootsim serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
|
|
3
3
|
`),L(),2}}catch(r){if(r instanceof c)return process.stderr.write(`${r.message}
|
|
4
4
|
`),1;throw r}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function L(){$("agent")}function P(n,e){let t={},r=[];for(let s=0;s<n.length;s++){let o=n[s],i=e[o];i==="value"?(t[o]=n[s+1]??"",s++):i==="bool"?t[o]=!0:r.push(o)}return{flags:t,positional:r}}function U(n,e="codex"){return n==="codex"||n==="claude"?n:e}async function W(n){let{flags:e,positional:t}=P(n,{"--name":"value","--provider":"value"}),r=t[0];if(!r)return process.stderr.write(`usage: sootsim agent attach <dir> [--name X] [--provider codex|claude]
|
|
5
5
|
`),2;let s=d.resolve(r);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{b as M}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as M}from"./chunk-VOZZ62OJ.js";import"./chunk-EEUNNW2P.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as I,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,g=!1,a=new Promise(s=>{t.on("exit",(i,e)=>{g=!0;let p=new Error(`codex app-server exited (code=${i}, signal=${e??""})`);for(let{reject:f}of r.values())f(p);r.clear(),s({code:i,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let i=s.trim();if(!i)return;let e;try{e=JSON.parse(i)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,f=p!=null?r.get(p):void 0;if(!f)return;r.delete(p),e.error?f.reject(new b(e.error.message,e.error.code,e.error.data)):f.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let f of p)try{f(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let i=m.get("__stderr__");if(i)for(let e of i)try{e({text:s})}catch{}});function n(s){if(!g)try{t.stdin.write(JSON.stringify(s)+`
|
|
3
3
|
`)}catch{}}return{exited:a,on(s,i){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(i),()=>{e?.delete(i)}},request(s,i){if(g)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,f)=>{r.set(e,{resolve:l=>p(l),reject:f,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:i})})},notify(s,i){n({jsonrpc:"2.0",method:s,params:i})},async shutdown(s=1500){if(g)return;try{t.stdin.end()}catch{}let i=setTimeout(()=>{if(!g)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(i)}},kill(s="SIGTERM"){if(!g)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return I(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let g=t[u];g&&(r[g]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: sootsim agent-wrapper --session-id <id> --project-id <id>
|
|
4
4
|
--provider codex|claude --cwd <path>
|
|
5
5
|
--prompt-in <fifo> --events-out <fifo>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{d as p}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{d as p}from"./chunk-B4KB5TBV.js";import"./chunk-EEUNNW2P.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let i=t.find(r=>r.startsWith(`--${e}=`));return i?i.slice(e.length+3):void 0}async function S(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),i=f(t,"manifest");if((!o||!i)&&(console.error(" usage: sootsim app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let r=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of r){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(i))try{let n=JSON.parse(y(i,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(i,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await S(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-EEUNNW2P.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
|
|
3
3
|
`).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=x("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
|
|
4
4
|
`),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
|
|
5
5
|
supported: ${Array.from(w).sort().join(", ")}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as t}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as t}from"./chunk-AK4CONMS.js";import{d as s}from"./chunk-TNEHHCMZ.js";import"./chunk-YMFQOXT4.js";import"./chunk-EEUNNW2P.js";function i(){console.log(`
|
|
3
3
|
sootsim auth \u2014 inspect CLI auth
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{m as d}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{m as d}from"./chunk-CMGPYPUE.js";import"./chunk-7NP5BWIH.js";import{g as l,i as m,k as p}from"./chunk-AHTGZMT4.js";import"./chunk-Q7U5TPQN.js";import"./chunk-CJHPCUUV.js";import"./chunk-YMFQOXT4.js";import"./chunk-EEUNNW2P.js";function f(){console.log(`
|
|
3
3
|
sootsim do scan \u2014 inject a barcode scan
|
|
4
4
|
|
|
5
5
|
usage:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as R,b as U}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as R,b as U}from"./chunk-Q7K5GJR4.js";import{c as F}from"./chunk-RZMI7IKL.js";import{g as N,j as E,r as _,s as v,t as B}from"./chunk-YMFQOXT4.js";import{a as O}from"./chunk-SXS5SPIZ.js";import{execFileSync as W,spawnSync as s}from"child_process";import{existsSync as a,mkdirSync as x,readFileSync as nt,realpathSync as ot,rmSync as $,writeFileSync as H}from"fs";import{homedir as P}from"os";import{basename as st,dirname as T,resolve as f,sep as Y}from"path";import{execFileSync as X}from"child_process";import{chmodSync as Q,mkdirSync as I,rmSync as z,writeFileSync as A}from"fs";import{dirname as L}from"path";var J="dev.sootsim.daemon",j="SootSim Daemon",M="0.1.36";function V(t,e,r){let n=v(),o=B(),c=L(L(o)),l=L(o),u=`${c}/Resources`;z(n,{recursive:!0,force:!0}),I(_(),{recursive:!0}),I(l,{recursive:!0}),I(u,{recursive:!0}),A(`${c}/Info.plist`,Z()),A(`${c}/PkgInfo`,"APPL????"),A(o,tt(t,e,r)),Q(o,493);try{X("codesign",["--force","--sign","-","--deep",n],{stdio:"pipe"})}catch(i){let p=i instanceof Error?i.message:String(i);console.warn(` warning: ad-hoc codesign of ${n} failed: ${p}
|
|
3
3
|
the daemon will still run, but Login Items may show a generic name.`)}return{bundlePath:n,launcherPath:o}}function Z(){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
5
5
|
<plist version="1.0">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
|
|
3
3
|
`)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
|
|
4
4
|
run: bun run --cwd packages/sootsim-engine build:electron-main
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as me,c as ge,d as we,e as
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as me,c as ge,d as we,e as Qe,f as ye,g as be,h as et,i as Se,j as tt}from"./chunk-NN7XOWXY.js";import{a as Xe}from"./chunk-V64N734Y.js";import{a as it}from"./chunk-JDCABF7Y.js";import{a as rt}from"./chunk-T2NAWDMZ.js";import{h as Ke,p as qe,r as Ye,v as Ze}from"./chunk-L5HYRG4P.js";import{f as He}from"./chunk-FEMAFOUH.js";import{a as Ce}from"./chunk-FAUOGIHF.js";import{h as fe,m as Ge}from"./chunk-CMGPYPUE.js";import{I as J,m as Ue,n as We,o as je,p as Ve}from"./chunk-7NP5BWIH.js";import{g as pe,h as he,i as Je}from"./chunk-AHTGZMT4.js";import{a as ze}from"./chunk-2HJU3NAO.js";import{a as De,b as de}from"./chunk-Q7K5GJR4.js";import{d as ue,e as Ne}from"./chunk-CJHPCUUV.js";import{g as Be,h as Le}from"./chunk-IKZ4Z6ND.js";import*as $ from"fs";import{createHash as Wt,randomUUID as jt}from"node:crypto";import{tmpdir as K}from"os";import*as w from"path";import*as S from"fs";import*as b from"path";var Ft="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",ot=1;function It(n){let e=Le(n),t=e.scale,r=e.statusBarHeight>0&&!e.dynamicIsland&&e.homeIndicatorHeight===0&&e.cornerRadius===0,i=e.width,o=e.height,a=r?e.width+58:e.width+e.bezelWidth*2,s=r?e.height+111+111:e.height+e.bezelWidth*2,l=9.5,u=ot,p=a+l*2,g=s+ot*2,F=l+(r?29:e.bezelWidth),m=r?111:e.bezelWidth,P=r?52:e.cornerRadius+e.bezelWidth,k=[{side:"right",top:e.hardwareButtons.lock.top,height:e.hardwareButtons.lock.height,width:e.hardwareButtons.width},{side:"left",top:e.hardwareButtons.ringToggle.top,height:e.hardwareButtons.ringToggle.height,width:e.hardwareButtons.width},{side:"left",top:e.hardwareButtons.volumeUp.top,height:e.hardwareButtons.volumeUp.height,width:e.hardwareButtons.width},{side:"left",top:e.hardwareButtons.volumeDown.top,height:e.hardwareButtons.volumeDown.height,width:e.hardwareButtons.width}];return{model:n,renderScale:t,outerWidth:Math.round(p*t),outerHeight:Math.round(g*t),logicalOuterWidth:p,logicalOuterHeight:g,logicalFrameWidth:a,logicalFrameHeight:s,logicalFrameLeft:l,logicalFrameTop:u,logicalScreenWidth:i,logicalScreenHeight:o,logicalScreenLeft:F,logicalScreenTop:m,logicalScreenRadius:r?0:e.cornerRadius,logicalFrameRadius:P,frameBackground:r?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:r?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:r?null:Ft,buttons:k,legacyHomeButton:r?{top:111+e.height+47/2,left:e.width/2-64/2+29,size:64,ring:1.5}:null,showHomeIndicator:e.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:e.homeIndicatorHeight}}function $t(n){let e=n.side==="right",t=e?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
|
|
3
3
|
<div
|
|
4
4
|
aria-hidden="true"
|
|
5
5
|
style="
|
|
@@ -24,7 +24,7 @@ import{a as me,c as ge,d as we,e as Xe,f as ye,g as be,h as Qe,i as Se,j as et}f
|
|
|
24
24
|
z-index:2;
|
|
25
25
|
"
|
|
26
26
|
></div>
|
|
27
|
-
`}function
|
|
27
|
+
`}function Pt(n,e){let t=n.buttons.map($t).join(""),r=n.metallicRingShadow?`
|
|
28
28
|
<div
|
|
29
29
|
aria-hidden="true"
|
|
30
30
|
style="
|
|
@@ -177,7 +177,7 @@ import{a as me,c as ge,d as we,e as Xe,f as ye,g as be,h as Qe,i as Se,j as et}f
|
|
|
177
177
|
</div>
|
|
178
178
|
</div>
|
|
179
179
|
</body>
|
|
180
|
-
</html>`}async function
|
|
180
|
+
</html>`}async function st(n,e){let{chromium:t}=await import("playwright"),r=await t.launch({headless:!0});try{let i=await kt(r);try{return await i.compose(n,e)}finally{await i.close()}}finally{await r.close()}}async function kt(n){let e=new Map;async function t(r){let i=e.get(r);if(i)return i;let o=It(r),a=await n.newContext({viewport:{width:o.outerWidth,height:o.outerHeight},deviceScaleFactor:1}),s=await a.newPage(),l={layout:o,context:a,page:s};return e.set(r,l),l}return{async compose(r,i){let o=await t(i),a=`data:image/png;base64,${r.toString("base64")}`;return await o.page.setContent(Pt(o.layout,a),{waitUntil:"load"}),await o.page.waitForTimeout(20),await o.page.screenshot({type:"png",clip:{x:0,y:0,width:o.layout.outerWidth,height:o.layout.outerHeight},omitBackground:!0})},async close(){for(let r of e.values())await r.context.close();e.clear()}}}import{spawnSync as At}from"child_process";import*as N from"vm";var Mt=3e5,Rt=`
|
|
181
181
|
let input = '';
|
|
182
182
|
process.stdin.on('data', (c) => { input += c });
|
|
183
183
|
process.stdin.on('end', async () => {
|
|
@@ -199,7 +199,7 @@ process.stdin.on('end', async () => {
|
|
|
199
199
|
process.exitCode = 1;
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
|
-
`;function G(n,e,t){if(t?.multipartForm)throw new Error("http: multipartForm is not supported by sootsim yet");let r={...process.env};for(let s of Object.keys(r))(s.startsWith("BUN_INSPECT")||s==="NODE_OPTIONS")&&delete r[s];let i=
|
|
202
|
+
`;function G(n,e,t){if(t?.multipartForm)throw new Error("http: multipartForm is not supported by sootsim yet");let r={...process.env};for(let s of Object.keys(r))(s.startsWith("BUN_INSPECT")||s==="NODE_OPTIONS")&&delete r[s];let i=At(process.execPath,["-e",Rt],{input:JSON.stringify({url:n,method:e,headers:t?.headers,body:t?.body}),encoding:"utf8",timeout:Mt,maxBuffer:64*1024*1024,env:r});if(i.error)throw new Error(`http ${e} ${n} failed: ${i.error.message}`);let o;try{o=JSON.parse(i.stdout||"")}catch{throw new Error(`http ${e} ${n} failed: no response (${(i.stderr||"").trim().slice(0,200)})`)}let a=o;if(a.__error)throw new Error(`http ${e} ${n} failed: ${a.__error}`);return a}var Ot=/(?<!\\)\$\{([^$]*)\}/g,_t=/\\(\$\{[^$]*\})/g,Dt=/^[A-Za-z_$][A-Za-z0-9_$]*$/,X=class{context;envBinding=new Map;envScopeStack=[];syncedEnvKeys=new Set;output={};maestro;constructor(e={}){this.maestro={copiedText:null,platform:e.platform??"ios"};let t=e.onLog??(i=>console.log(`[flow] js: ${i}`)),r={output:this.output,maestro:this.maestro,http:{get:(i,o)=>G(i,"GET",o),post:(i,o)=>G(i,"POST",o),put:(i,o)=>G(i,"PUT",o),delete:(i,o)=>G(i,"DELETE",o),request:(i,o)=>G(i,(o?.method??"GET").toUpperCase(),o)},console:{log:(...i)=>t(i.map(o=>typeof o=="string"?o:at(o)).join(" "))}};this.context=N.createContext(r),N.runInContext(`
|
|
203
203
|
globalThis.__maestroScope = new Proxy(globalThis, {
|
|
204
204
|
has() { return true },
|
|
205
205
|
get(target, key) { return target[key] },
|
|
@@ -210,7 +210,7 @@ process.stdin.on('end', async () => {
|
|
|
210
210
|
var yPercent = Math.ceil(y * 100) + '%'
|
|
211
211
|
return xPercent + ',' + yPercent
|
|
212
212
|
}
|
|
213
|
-
`,this.context);for(let[i,o]of Object.entries(process.env))o!==void 0&&this.envBinding.set(i,o)}putEnv(e,t){this.envBinding.set(e,t)}setCopiedText(e){this.maestro.copiedText=e}enterEnvScope(){this.envScopeStack.push(new Map(this.envBinding))}leaveEnvScope(){let e=this.envScopeStack.pop();if(e){this.envBinding.clear();for(let[t,r]of e)this.envBinding.set(t,r)}}evaluate(e,t={}){let r=t.env;if(r&&Object.keys(r).length>0){this.enterEnvScope();try{for(let[i,o]of Object.entries(r))this.envBinding.set(i,o);return this.evalRaw(e)}finally{this.leaveEnvScope()}}return this.evalRaw(e)}evalRaw(e){this.syncEnvToContext();let t=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${");return N.runInContext(`(function(){ with(__maestroScope){ return eval(\`${t}\`) } })()`,this.context)}syncEnvToContext(){let e=N.runInContext("globalThis",this.context);for(let t of this.syncedEnvKeys)this.envBinding.has(t)||delete e[t];this.syncedEnvKeys=new Set;for(let[t,r]of this.envBinding)try{e[t]=r,this.syncedEnvKeys.add(t)}catch{}}evaluateStringTemplate(e){return e.replace(
|
|
213
|
+
`,this.context);for(let[i,o]of Object.entries(process.env))o!==void 0&&this.envBinding.set(i,o)}putEnv(e,t){this.envBinding.set(e,t)}setCopiedText(e){this.maestro.copiedText=e}enterEnvScope(){this.envScopeStack.push(new Map(this.envBinding))}leaveEnvScope(){let e=this.envScopeStack.pop();if(e){this.envBinding.clear();for(let[t,r]of e)this.envBinding.set(t,r)}}evaluate(e,t={}){let r=t.env;if(r&&Object.keys(r).length>0){this.enterEnvScope();try{for(let[i,o]of Object.entries(r))this.envBinding.set(i,o);return this.evalRaw(e)}finally{this.leaveEnvScope()}}return this.evalRaw(e)}evalRaw(e){this.syncEnvToContext();let t=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${");return N.runInContext(`(function(){ with(__maestroScope){ return eval(\`${t}\`) } })()`,this.context)}syncEnvToContext(){let e=N.runInContext("globalThis",this.context);for(let t of this.syncedEnvKeys)this.envBinding.has(t)||delete e[t];this.syncedEnvKeys=new Set;for(let[t,r]of this.envBinding)try{e[t]=r,this.syncedEnvKeys.add(t)}catch{}}evaluateStringTemplate(e){return e.replace(Ot,(r,i)=>{if(i.trim().length===0)return"";let o=this.evaluate(i);if(o===void 0&&Dt.test(i.trim()))throw new Error(`missing variable for flow placeholder: ${i.trim()}`);return at(o)}).replace(_t,(r,i)=>i)}interpolateStep(e){return this.interpolateValue(e,null)}interpolateValue(e,t){return typeof e=="string"?t==="evalScript"?e:this.evaluateStringTemplate(e):Array.isArray(e)?t==="commands"||t==="onFlowStart"||t==="onFlowComplete"?e:e.map(r=>this.interpolateValue(r,t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,i])=>[r,this.interpolateValue(i,r)])):e}};function at(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function lt(n){if(n==null)return!1;if(typeof n=="boolean")return n;let e=String(n);if(e.trim().length===0||e.toLowerCase()==="false"||e==="undefined"||e==="null")return!1;let t=Number(e);return!(!Number.isNaN(t)&&t===0)}var Q=1e4,te=393,C=852;function f(n){return new Promise(e=>setTimeout(e,n))}function Ee(n){return!!(n&&typeof n=="object"&&!Array.isArray(n))}function z(n,e){if(!Ee(n))return null;let t=n[e];return typeof t=="string"&&t.length>0?t:null}function Bt(n,e){return Ee(n)?n[e]===!0:!1}function Lt(n){if(!n)return null;let e=n.recentApps;if(Array.isArray(e))for(let r of e){let i=z(r,"id");if(i)return i}let t=n.surfaceBindings;return z(t,"app:one")||z(t,"app:two")||null}function Nt(n){return n?b.basename(n)===".maestro"?b.dirname(n):n:process.cwd()}function Ct(n,e,t){let r=e.endsWith(".png")?e:`${e}.png`;if(b.isAbsolute(r))return r;if(t.mode==="flow"&&/[\\/]/.test(r)){let i=r.startsWith("./")||r.startsWith("../")?t.flowDir??process.cwd():Nt(t.flowDir);return b.resolve(i,r)}return b.join(n,r)}function Ht(n){if(typeof n=="string")return{path:n,withFrame:!1};let e=n.path?.trim()||n.name?.trim();if(!e)throw new Error("takeScreenshot object form requires path or name");return{path:e,withFrame:n.withFrame===!0,layers:n.layers}}function ee(n,e){let[t,r]=n.split(",").map(s=>s.trim()),i=(s,l)=>s.endsWith("%")?Number.parseFloat(s)/100*l:Number.parseFloat(s),o=e?.x??0,a=e?.y??0;return{x:o+i(t,e?.width??te),y:a+i(r,e?.height??C)}}function ct(n){switch(n){case"back":return{back:!0};case"hideKeyboard":return{hideKeyboard:!0};case"waitForAnimationToEnd":return{waitForAnimationToEnd:!0};case"stopApp":return{stopApp:!0};case"clearState":return{clearState:!0};case"clearKeychain":return{clearKeychain:!0};case"eraseText":return{eraseText:50};case"scroll":case"scrollDown":return{scroll:{direction:"DOWN"}};case"scrollUp":return{scroll:{direction:"UP"}};default:return{[n]:!0}}}function Ut(n){let e=n.split(/^---$/m),t=e.length>1?e[e.length-1]:n,r=Xe.parse(t);return Array.isArray(r)?r:[]}var re=class{constructor(e,t){this.bridge=e;this.opts=t}stepDelay=0;js=new X({platform:"ios",onLog:e=>console.log(`[flow] js: ${e}`)});firstLaunchDone=!1;profilingEnabled=!1;recordingEnabled=!1;recordingAccessChecked=!1;recordingStartedAtMs=null;lastRecordingStartedAtMs=null;lastRecordingDurationMs=null;lastRecordingFrameStats=null;flowTraceSteps=[];lastVisualSettledAtMs=0;simRouteHint=null;lastFailedStep=null;get simId(){return this.opts.simId}setSimRouteHint(e){this.simRouteHint=this.normalizeSimRoute(e)}normalizeSimRoute(e){if(!e)return null;try{let t=new URL(e);t.searchParams.delete("inspectOpen");let r=t.searchParams.toString();return`${t.origin}${t.pathname}${r?`?${r}`:""}`}catch{return e}}async refreshSimId(){if(this.opts.simId)try{let e=await this.bridge.listSims(),t=e.find(l=>l.id===this.opts.simId);if(t&&(this.simRouteHint=this.normalizeSimRoute(t.url||t.origin)),e.find(l=>l.id===this.opts.simId&&l.readyState==="open")||!this.simRouteHint)return;let i=this.simRouteHint&&e.find(l=>l.readyState==="open"&&this.normalizeSimRoute(l.url||l.origin)===this.simRouteHint);if(!i)return;let o=e.find(l=>l.isPrimary&&l.readyState==="open"),a=e.find(l=>l.readyState==="open"),s=i??o??a;s&&(this.opts.simId=s.id,console.log(` [flow] sim rotated to ${s.id}`))}catch{}}async evaluate(e,t){return this.bridge.send({type:"evaluate",simId:this.opts.simId,code:e},t?{timeoutMs:t}:void 0)}async callTest(e,...t){return this.bridge.send({type:"call",simId:this.opts.simId,path:`__sootsimTest.${e}`,args:t})}async waitForTree(e=Q){let t=Date.now()+e,r=Date.now(),i=null,o=0,a=0,s=-1,l=r;for(;Date.now()<t;){try{let p=await this.evaluate(Ue,8e3);if(o=0,p?.externalError)throw new Error(`app failed to load: ${p.externalError}`);if(p){let g=Date.now();p.nodes!==s&&(s=p.nodes,l=g);let F=p.flag===!0&&je(p),m=p.flag!==!0&&Ve(p);if((F||m)&&p.externalReady!==!1&&!p.externalError&&!p.loadingText&&g-l>=We)return}}catch(p){if(i=p instanceof Error?p:new Error(String(p)),i.message.startsWith("app failed to load:"))throw i;if(o++,o>=4)throw new Error(`target sim is not responding to the bridge (${i.message}). it is likely a stale orphan \u2014 run \`sootsim list\`, then close it with \`sootsim close <id>\` or start a fresh one with \`sootsim open --new <port>\`.`);await this.refreshSimId()}let u=Date.now()-r;u-a>=5e3&&(a=u,console.log(` [flow] waiting for app to be ready\u2026 (${Math.round(u/1e3)}s)`)),await f(500)}throw i?.message.startsWith("app failed to load:")?i:new Error(`app not ready after ${e}ms`)}async ensureRecordingStarted(){if(!this.opts.recordingOutputDir)throw new Error("recording output directory not configured");this.recordingAccessChecked||(this.opts.requireRecordingEntitlement&&await it("flow --video",{originOverride:this.opts.billingOriginOverride,allowGitHubAuth:this.opts.allowGitHubRecording}),this.recordingAccessChecked=!0);let e=Date.now(),t=await this.evaluate(`(() => {
|
|
214
214
|
const rec = window.__sootsimRecorder
|
|
215
215
|
if (!rec) return { ok: false, error: 'recorder unavailable on this page' }
|
|
216
216
|
const format = ${JSON.stringify(this.opts.recordingFormat??"webm")}
|
|
@@ -386,7 +386,7 @@ process.stdin.on('end', async () => {
|
|
|
386
386
|
visible: !!keyboard?.isVisible?.(),
|
|
387
387
|
focused: !!test?.isTextInputFocused?.(),
|
|
388
388
|
}
|
|
389
|
-
})()`);if(!t?.visible&&!t?.focused){await f(80);return}await f(80)}}async eraseText(e){for(let t=0;t<e;t++)await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dispatchKey",text:"Backspace"});await f(100)}async waitFor(e){let t=Date.now()+(e.timeout||Q);for(;Date.now()<t;){if(await this.findElement(e))return;await f(200)}let r=await this.findElement(e),i=r?` (matched node y=${Math.round(r.absolutePosition.y)} \u2014 still off-screen at deadline)`:"";throw new Error(`waitFor: ${JSON.stringify(e)} not found after ${e.timeout||Q}ms${i}`)}async takeScreenshot(e){if(!this.hasFreshVisualSettle())try{await this.waitForVisualSettle(),await f(250)}catch{}let t=
|
|
389
|
+
})()`);if(!t?.visible&&!t?.focused){await f(80);return}await f(80)}}async eraseText(e){for(let t=0;t<e;t++)await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dispatchKey",text:"Backspace"});await f(100)}async waitFor(e){let t=Date.now()+(e.timeout||Q);for(;Date.now()<t;){if(await this.findElement(e))return;await f(200)}let r=await this.findElement(e),i=r?` (matched node y=${Math.round(r.absolutePosition.y)} \u2014 still off-screen at deadline)`:"";throw new Error(`waitFor: ${JSON.stringify(e)} not found after ${e.timeout||Q}ms${i}`)}async takeScreenshot(e){if(!this.hasFreshVisualSettle())try{await this.waitForVisualSettle(),await f(250)}catch{}let t=Ht(e),r=Ct(this.opts.screenshotDir,t.path,{mode:this.opts.screenshotPathMode??"dir",flowDir:this.opts.flowDir});S.mkdirSync(b.dirname(r),{recursive:!0});let i=t.layers??this.opts.screenshotLayers,o={type:"screenshot",simId:this.opts.simId};i&&i!=="full"&&(o.layers=i);let s=(await this.bridge.send(o)).replace(/^data:image\/png;base64,/,""),l=Buffer.from(s,"base64");if(t.withFrame){let u=await this.readCurrentDeviceModel();if(!u)throw new Error("could not read current device model for framed screenshot");let p=await st(l,u);return S.writeFileSync(r,p),console.log(`[flow] screenshot: ${r} (frame: ${u})`),r}return S.writeFileSync(r,l),console.log(`[flow] screenshot: ${r}`),r}async readCurrentDeviceModel(){let e=await this.bridge.send({type:"call",simId:this.opts.simId,path:"SootSim.bridges.settings.get",args:[]}),t=e&&typeof e.deviceModel=="string"?e.deviceModel:null;return!t||!(t in Be)?null:t}async captureScreenshot(e){S.mkdirSync(b.dirname(e),{recursive:!0});let r=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");S.writeFileSync(e,Buffer.from(r,"base64"))}async captureFailureBundle(e,t){S.mkdirSync(e,{recursive:!0});let r=(p,g)=>{try{S.writeFileSync(b.join(e,p),g)}catch{}},i=async p=>{try{return await this.bridge.send({type:"evaluate",simId:this.opts.simId,code:p})}catch{return null}},o=await i(`(async () => {
|
|
390
390
|
const out = {
|
|
391
391
|
simId: window.__sootsimBridge?.id ?? window.SootSim?.state?.simId ?? null,
|
|
392
392
|
url: location.href,
|
|
@@ -441,7 +441,7 @@ process.stdin.on('end', async () => {
|
|
|
441
441
|
${e.steps||12}, ${e.stepMs||16}
|
|
442
442
|
)
|
|
443
443
|
return { ok: !!ok, reason: ok ? null : 'pinch returned false' }
|
|
444
|
-
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await f(250)}async dumpTree(e=6){let t=await this.bridge.send({type:"tree",simId:this.opts.simId,depth:e});return console.log("[flow] tree:"),console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),typeof t=="string"?t:JSON.stringify(t)}async assertTreeContains(e){if(!(await this.dumpTree(8)).includes(e))throw new Error(`assertTreeContains: "${e}" not in tree`)}async waitForAnimationToEnd(e=2e3){let t=Math.max(0,Math.round(e));if(t<=0)return;(await Se({bridge:this.bridge,simId:this.opts.simId,maxMs:t,pollMs:32,stablePolls:2,strict:!0})).settled&&this.markVisualSettled()}async back(){try{await this.tapOn("\u2039")}catch{await this.tapOn("<")}}async scrollUntilVisible(e){let t=Date.now()+(e.timeout||15e3),r=e.direction?.toUpperCase()||"DOWN",i=r==="DOWN"?"UP":r==="UP"?"DOWN":r;for(;Date.now()<t;){let o=await this.findElement({text:e.element});if(o&&o.absolutePosition.y>=0&&o.absolutePosition.y+o.layout.height>0&&o.absolutePosition.y<C-50){if(e.centerElement){let a=C/2,s=o.absolutePosition.y-a;if(Math.abs(s)>100){let l=Math.min(150,Math.abs(s)*.5),u=s>0?a-l:a+l;await this.drag(te/2,a,te/2,u,10,16)}}return}await this.swipe(i,250),await f(500)}throw new Error(`scrollUntilVisible: "${e.element}" not found`)}async extendedWaitUntil(e){let t=Date.now()+(e.timeout||Q);for(;Date.now()<t;){let r=e.visible?await this.isElementVisible(typeof e.visible=="string"?{text:e.visible}:e.visible):!0,i=e.notVisible?!await this.isElementVisible(typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible):!0;if(r&&i)return;await f(200)}throw new Error("extendedWaitUntil timed out")}async reloadGuestApp(e){if(e){let i=!1;for(let o=0;o<3&&!i;o++)try{i=await this.evaluate(me(!0),2e4)}catch{await f(1e3)}i||console.warn(" warn: tenant storage clear did not ack \u2014 hard-reloading anyway (worker reset follows)")}await this.evaluate("window.location.reload()").catch(()=>{}),await f(500),await this.refreshSimId()}async softReloadGuestApp(e){if(!await this.evaluate(me(e),12e4))throw new Error("guest app soft reload bridge unavailable")}async rearmCaptureAfterRuntimeReload(){if(!this.recordingEnabled&&!this.profilingEnabled)return;let e=Date.now()+1e4,t=null;for(;Date.now()<e;){await this.refreshSimId();try{this.recordingEnabled&&await this.ensureRecordingStarted(),this.profilingEnabled&&await this.startProfile();return}catch(r){t=r,await f(250)}}throw new Error(`capture re-arm failed after app reload: ${t instanceof Error?t.message:String(t)}`)}async launchApp(e){await this.refreshSimId(),e&&typeof e=="object"&&e.arguments&&console.log("[flow] launchApp.arguments ignored (sootsim has no native process)");let t=!!(e&&typeof e=="object"&&e.clearState),r=
|
|
444
|
+
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await f(250)}async dumpTree(e=6){let t=await this.bridge.send({type:"tree",simId:this.opts.simId,depth:e});return console.log("[flow] tree:"),console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),typeof t=="string"?t:JSON.stringify(t)}async assertTreeContains(e){if(!(await this.dumpTree(8)).includes(e))throw new Error(`assertTreeContains: "${e}" not in tree`)}async waitForAnimationToEnd(e=2e3){let t=Math.max(0,Math.round(e));if(t<=0)return;(await Se({bridge:this.bridge,simId:this.opts.simId,maxMs:t,pollMs:32,stablePolls:2,strict:!0})).settled&&this.markVisualSettled()}async back(){try{await this.tapOn("\u2039")}catch{await this.tapOn("<")}}async scrollUntilVisible(e){let t=Date.now()+(e.timeout||15e3),r=e.direction?.toUpperCase()||"DOWN",i=r==="DOWN"?"UP":r==="UP"?"DOWN":r;for(;Date.now()<t;){let o=await this.findElement({text:e.element});if(o&&o.absolutePosition.y>=0&&o.absolutePosition.y+o.layout.height>0&&o.absolutePosition.y<C-50){if(e.centerElement){let a=C/2,s=o.absolutePosition.y-a;if(Math.abs(s)>100){let l=Math.min(150,Math.abs(s)*.5),u=s>0?a-l:a+l;await this.drag(te/2,a,te/2,u,10,16)}}return}await this.swipe(i,250),await f(500)}throw new Error(`scrollUntilVisible: "${e.element}" not found`)}async extendedWaitUntil(e){let t=Date.now()+(e.timeout||Q);for(;Date.now()<t;){let r=e.visible?await this.isElementVisible(typeof e.visible=="string"?{text:e.visible}:e.visible):!0,i=e.notVisible?!await this.isElementVisible(typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible):!0;if(r&&i)return;await f(200)}throw new Error("extendedWaitUntil timed out")}async reloadGuestApp(e){if(e){let i=!1;for(let o=0;o<3&&!i;o++)try{i=await this.evaluate(me(!0),2e4)}catch{await f(1e3)}i||console.warn(" warn: tenant storage clear did not ack \u2014 hard-reloading anyway (worker reset follows)")}await this.evaluate("window.location.reload()").catch(()=>{}),await f(500),await this.refreshSimId()}async softReloadGuestApp(e){if(!await this.evaluate(me(e),12e4))throw new Error("guest app soft reload bridge unavailable")}async rearmCaptureAfterRuntimeReload(){if(!this.recordingEnabled&&!this.profilingEnabled)return;let e=Date.now()+1e4,t=null;for(;Date.now()<e;){await this.refreshSimId();try{this.recordingEnabled&&await this.ensureRecordingStarted(),this.profilingEnabled&&await this.startProfile();return}catch(r){t=r,await f(250)}}throw new Error(`capture re-arm failed after app reload: ${t instanceof Error?t.message:String(t)}`)}async launchApp(e){await this.refreshSimId(),e&&typeof e=="object"&&e.arguments&&console.log("[flow] launchApp.arguments ignored (sootsim has no native process)");let t=!!(e&&typeof e=="object"&&e.clearState),r=Bt(e,"resetRuntime");if(!this.firstLaunchDone&&!t){if(this.firstLaunchDone=!0,r){let i=await J(this.bridge).catch(()=>null),o=i?.state==="home"&&i.activeApp==null;await this.softReloadGuestApp(!1),await this.waitForTree(12e4),o&&(await fe(this.bridge,"goHome",1e3),await this.waitForShellHome(1e3)),await this.launchShellAppFromHomeIfNeeded(e,o?{...i??{},state:"home",activeApp:null}:null)}else await this.launchShellAppFromHomeIfNeeded(e);await this.waitForTree(3e4)}else if(this.firstLaunchDone=!0,await this.reloadGuestApp(t),await this.waitForTree(12e4),this.opts.onAfterLaunch)try{await this.opts.onAfterLaunch()}catch(i){console.warn(` warn: onAfterLaunch hook threw: ${i instanceof Error?i.message:i}`)}this.profilingEnabled&&await this.startProfile(),this.recordingEnabled&&(await this.waitForVisualSettle(),await this.ensureRecordingStarted())}async waitForVisualSettle(){try{await this.evaluate(`new Promise((resolve) => {
|
|
445
445
|
requestAnimationFrame(() => {
|
|
446
446
|
requestAnimationFrame(() => {
|
|
447
447
|
requestAnimationFrame(() => {
|
|
@@ -449,7 +449,7 @@ process.stdin.on('end', async () => {
|
|
|
449
449
|
})
|
|
450
450
|
})
|
|
451
451
|
})
|
|
452
|
-
})`),this.markVisualSettled()}catch{await f(180),this.markVisualSettled()}}markVisualSettled(){this.lastVisualSettledAtMs=Date.now()}hasFreshVisualSettle(){return Date.now()-this.lastVisualSettledAtMs<750}resolveShellLaunchAppId(e,t){if(typeof e=="string"&&e.length>0)return e;if(Ee(e)){let r=z(e,"appId")||z(e,"id");if(r)return r}return
|
|
452
|
+
})`),this.markVisualSettled()}catch{await f(180),this.markVisualSettled()}}markVisualSettled(){this.lastVisualSettledAtMs=Date.now()}hasFreshVisualSettle(){return Date.now()-this.lastVisualSettledAtMs<750}resolveShellLaunchAppId(e,t){if(typeof e=="string"&&e.length>0)return e;if(Ee(e)){let r=z(e,"appId")||z(e,"id");if(r)return r}return Lt(t)||"connect"}async waitForShellAppLaunched(e,t){let r=Date.now()+t,i=null;for(;Date.now()<r;){try{i=await J(this.bridge)}catch{i=null}if(i?.state==="app"&&i.activeApp===e&&i.showSwitcher===!1&&typeof i.launchProgress=="number"&&i.launchProgress>=.98)return;await f(16)}}async waitForShellHome(e){let t=Date.now()+e;for(;Date.now()<t;){let r=await J(this.bridge).catch(()=>null);if(r?.state==="home"&&r.activeApp==null&&r.showSwitcher===!1)return;await f(16)}}async launchShellAppFromHomeIfNeeded(e,t){let r=null;if(t)r=t;else try{r=await J(this.bridge)}catch{return!1}if(r?.state!=="home"||r.activeApp!=null)return!1;let i=this.resolveShellLaunchAppId(e,r);return this.recordingEnabled&&await this.ensureRecordingStarted(),await fe(this.bridge,"launchApp",1e3,i),await this.waitForShellAppLaunched(i,1e3),!0}async startProfile(){let e=await this.evaluate(`(() => {
|
|
453
453
|
if (!window.__sootsimShellPerf) {
|
|
454
454
|
return { error: "shell frame profile unavailable (__sootsimShellPerf missing on the page)" }
|
|
455
455
|
}
|
|
@@ -460,7 +460,7 @@ process.stdin.on('end', async () => {
|
|
|
460
460
|
return { error: "shell frame profile unavailable (__sootsimShellPerf missing on the page)" }
|
|
461
461
|
}
|
|
462
462
|
return await window.__sootsimShellPerf.stop()
|
|
463
|
-
})()`);if(this.profilingEnabled=!1,e?.error)throw new Error(e.error);return e}async stopApp(){await this.reloadGuestApp(!1),await this.rearmCaptureAfterRuntimeReload()}async clearState(){await this.reloadGuestApp(!0),await this.rearmCaptureAfterRuntimeReload()}clearKeychain(){console.warn("[flow] clearKeychain: sootsim has no keychain surface \u2014 no-op (warning)")}async copyTextFrom(e){let t=typeof e=="string"?{id:e}:e,r=await this.findElement(t);if(!r)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let i=r.text??r.testID??"";this.js.setCopiedText(i),this.js.putEnv("maestroCopiedText",i),console.log(`[flow] copied text: ${JSON.stringify(i)}`)}evalScript(e){let r=/(?<!\\)\$\{[^$]*\}/.test(e)?this.js.evaluateStringTemplate(e):this.js.evaluate(e);r!==void 0&&r!==""&&console.log("[flow] evalScript ->",r)}runScript(e){let t=typeof e=="string"?{file:e}:e;if(!t.file)throw new Error("runScript requires a file");let r=b.resolve(this.opts.flowDir,t.file),i=S.readFileSync(r,"utf8");this.js.evaluate(i,{env:t.env}),console.log(`[flow] runScript: ${t.file} done`)}async openLink(e){let t=typeof e=="string"?e:e.link;if(!t)throw new Error("openLink: missing link");let r=await this.callTest("openDeepLink",t);if(!r?.ok)throw new Error(`openLink failed: ${r?.error||"no test bridge"}`);await f(300)}async evaluateWhen(e){if(e.visible!==void 0){let t=typeof e.visible=="string"?{text:e.visible}:e.visible;return!!await this.findElement(t)}if(e.notVisible!==void 0){let t=typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible;return!await this.findElement(t)}return e.platform!==void 0?e.platform.toLowerCase()===this.js.maestro.platform.toLowerCase():e.true!==void 0?at(e.true):!0}isOptional(e){if(e.optional===!0)return!0;let r=Object.entries(e).find(([o])=>o!=="when"&&o!=="optional"),i=r?r[1]:void 0;return!!(i&&typeof i=="object"&&"optional"in i&&i.optional)}async runStep(e,t){let r=typeof e=="string"?lt(e):e,i=Object.keys(r).find(l=>l!=="when")||Object.keys(r)[0];console.log(`[flow] step ${t+1}: ${i}`);let o=Date.now(),a=this.flowStepTargetLabel(r,i),s;try{s=this.js.interpolateStep(r),a=this.flowStepTargetLabel(s,i)??a}catch(l){if(this.isOptional(r)){console.log(`[flow] (optional, skipped: ${l.message.slice(0,80)})`),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"skipped",error:l});return}throw this.lastFailedStep={index:t,kind:i,target:r[i]},this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"failure",error:l}),l}if(s.when&&!await this.evaluateWhen(s.when)){console.log("[flow] (when: predicate false, skipped)"),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"skipped"});return}try{let l=!!(s.extendedWaitUntil||s.waitFor||s.scrollUntilVisible||s.launchApp||s.runFlow||s.runScript),u=1e4,p=this.runStepInner(s),g;if(l){let m=await p;typeof m=="string"&&(g=m)}else{let m=null,P=new Promise((k,ne)=>{m=setTimeout(()=>{ne(new Error(`step watchdog: ${i} made no progress in ${u}ms \u2014 bridge or bundle probably hung`))},u)});try{let k=await Promise.race([p,P]);typeof k=="string"&&(g=k)}finally{m&&clearTimeout(m)}}let T=!!(s.assertVisible||s.assertNotVisible||s.extendedWaitUntil||s.waitFor);this.stepDelay>0&&!T&&await f(this.stepDelay),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"success",screenshotPath:g})}catch(l){if(this.isOptional(s)){console.log(`[flow] (optional, skipped: ${l.message.slice(0,80)})`),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"skipped",error:l});return}throw this.lastFailedStep={index:t,kind:i,target:s[i]},this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"failure",error:l}),l}}async runStepInner(e){if(e.tapOn)await this.tapOn(e.tapOn);else if(e.longPressOn)await this.longPressOn(e.longPressOn);else if(e.scrollUntilVisible)await this.scrollUntilVisible(e.scrollUntilVisible);else if(e.extendedWaitUntil)await this.extendedWaitUntil(e.extendedWaitUntil);else if(e.assertVisible)await this.assertVisible(e.assertVisible);else if(e.assertNotVisible)await this.assertNotVisible(e.assertNotVisible);else if(e.inputText)await this.inputText(e.inputText);else if(e.pressKey)await this.pressKey(e.pressKey);else if(e.dispatchKey)await this.dispatchKey(e.dispatchKey);else if(e.waitFor)await this.waitFor(e.waitFor);else{if(e.takeScreenshot)return this.takeScreenshot(e.takeScreenshot);if(e.swipe)e.swipe.start&&e.swipe.end?await this.swipeCoords(e.swipe.start,e.swipe.end,e.swipe.duration):e.swipe.from?await this.swipeFrom(e.swipe.from,e.swipe.direction,e.swipe.duration):await this.swipe(e.swipe.direction,e.swipe.duration);else if(e.scroll)await this.swipe(e.scroll.direction==="DOWN"?"UP":"DOWN");else if(e.scrollTo){let t=typeof e.scrollTo.nodeId=="number"?{nodeId:e.scrollTo.nodeId}:e.scrollTo.id;if(!t)throw new Error("scrollTo requires id or nodeId");await this.scrollTo(t,e.scrollTo.x,e.scrollTo.y)}else if(e.pinch)await this.pinch(e.pinch);else if(e.waitForAnimationToEnd){let t=e.waitForAnimationToEnd;await this.waitForAnimationToEnd(typeof t=="number"?t:typeof t=="object"&&typeof t.timeout=="number"?t.timeout:2e3)}else if(e.back)await this.back();else if(e.hideKeyboard)await this.hideKeyboard();else if(e.launchApp)await this.launchApp(e.launchApp);else if(typeof e.wait=="number")await f(e.wait);else if(e.dumpTree)await this.dumpTree(e.dumpTree);else if(e.tapAtCoords)await this.tapAtCoords(e.tapAtCoords.x,e.tapAtCoords.y);else if(e.doubleTapAtCoords)await this.doubleTapAtCoords(e.doubleTapAtCoords.x,e.doubleTapAtCoords.y,e.doubleTapAtCoords.gapMs);else if(e.assertTreeContains)await this.assertTreeContains(e.assertTreeContains);else if(typeof e.eraseText=="number")await this.eraseText(e.eraseText);else if(e.repeat&&Array.isArray(e.repeat.commands)){let t=e.repeat.times,r=t==null||t===""?Number.MAX_SAFE_INTEGER:Number(t);if(!Number.isFinite(r))throw new Error(`repeat.times is not a number: ${t}`);let i=e.repeat.when??e.repeat.condition,o=async()=>i?this.evaluateWhen(i):!0,a=i?r:Math.min(r,1e3),s=0;for(;s<a&&await o();){for(let l=0;l<e.repeat.commands.length;l++)await this.runStep(e.repeat.commands[l],l);s++}}else if(e.stopApp!==void 0)await this.stopApp();else if(e.clearState!==void 0)await this.clearState();else if(e.clearKeychain!==void 0)this.clearKeychain();else if(e.copyTextFrom!==void 0)await this.copyTextFrom(e.copyTextFrom);else if(typeof e.evalScript=="string")this.evalScript(e.evalScript);else if(e.runScript){let t=e.runScript,r=typeof t=="string"?void 0:t.when;if(r&&!await this.evaluateWhen(r)){console.log("[flow] runScript skipped (when predicate false)");return}this.runScript(t)}else if(e.openLink!==void 0)await this.openLink(e.openLink);else if(e.runFlow){let t=e.runFlow,r=typeof t=="string"?t:t.file,i=typeof t=="string"?void 0:t.commands,o=typeof t=="string"?void 0:t.env,a=typeof t=="string"?void 0:t.when;if(a&&!await this.evaluateWhen(a)){console.log(`[flow] runFlow skipped (when predicate false): ${r??"inline commands"}`);return}if(!r&&!i)throw new Error("runFlow requires either file or commands");this.js.enterEnvScope();try{if(o)for(let[s,l]of Object.entries(o))this.js.putEnv(s,l);if(r){let s=b.resolve(this.opts.flowDir,r),l=S.readFileSync(s,"utf8"),u=this.opts.flowDir;this.opts.flowDir=b.dirname(s);try{await this.runFlow(Ht(l))}finally{this.opts.flowDir=u}}else if(i)for(let s=0;s<i.length;s++)await this.runStep(i[s],s)}finally{this.js.leaveEnvScope()}}else throw new Error(`unsupported flow step: ${JSON.stringify(e)}`)}}liveStatus=null;async runFlow(e){let t=[],r=[],i=[];for(let a of e){let s=Object.keys(a);if(s.length===1&&s[0]==="onFlowStart"&&Array.isArray(a.onFlowStart)){t.push(...a.onFlowStart);continue}if(s.length===1&&s[0]==="onFlowComplete"&&Array.isArray(a.onFlowComplete)){r.push(...a.onFlowComplete);continue}i.push(a)}if(this.liveStatus&&await this.liveStatus.plan(i.map((a,s)=>{let l=typeof a=="string"?lt(a):a,u=Object.keys(l).find(p=>p!=="when")??Object.keys(l)[0];return{index:s,name:u,target:this.flowStepTargetLabel(l,u)}})),t.length>0){console.log(`[flow] onFlowStart (${t.length} steps)`);for(let a=0;a<t.length;a++)await this.runStep(t[a],a)}let o=null;try{await this.runFlowBody(i)}catch(a){o=a instanceof Error?a:new Error(String(a))}if(r.length>0){console.log(`[flow] onFlowComplete (${r.length} steps)`);for(let a=0;a<r.length;a++)try{await this.runStep(r[a],a)}catch(s){console.warn(`[flow] onFlowComplete step ${a+1} failed: ${s instanceof Error?s.message:s}`)}}if(o)throw o}async runFlowBody(e){for(let t=0;t<e.length;t++){let r=e[t],i=typeof r.wait=="number"?r.wait:0,o=typeof r.waitFor?.timeout=="number"?r.waitFor.timeout:0,a=Math.max(6e4,i+15e3,o+15e3);this.liveStatus&&(await this.liveStatus.waitWhilePaused(),await this.liveStatus.step(t,"running"));let s=Date.now(),l=async(u,p)=>{if(!this.liveStatus)return;let g=this.flowTraceSteps[this.flowTraceSteps.length-1],T=g&&g.stepIndex===t&&g.startedAtMs>=s;await this.liveStatus.step(t,u?"failure":T&&g.status==="skipped"?"skipped":"success",{durationMs:Date.now()-s,error:u?p instanceof Error?p.message.slice(0,300):String(p).slice(0,300):T&&g.error||void 0})};try{r.runFlow||r.launchApp?await this.runStep(r,t):await Promise.race([this.runStep(r,t),new Promise((u,p)=>setTimeout(()=>p(new Error(`step ${t+1} (${Object.keys(r)[0]}) exceeded ${a}ms deadline`)),a))])}catch(u){throw await l(!0,u),u}await l(!1)}}};var ie=class{constructor(e,t){this.bridge=e;this.flowName=t}disabled=!1;paused=!1;runId=`flr_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;async push(e){if(!this.disabled)try{let t=await this.bridge.send({type:"flowStatus",status:{runId:this.runId,flowName:this.flowName,...e}});this.paused=t?.control?.paused===!0}catch(t){this.disabled=!0,console.log(`[flow] live status unavailable (${t instanceof Error?t.message.slice(0,120):t}) \u2014 continuing without the devtools rail`)}}async plan(e){await this.push({phase:"plan",state:"running",steps:e})}async step(e,t,r){await this.push({phase:"step",state:"running",step:{index:e,status:t,...r}})}async end(e){await this.push({phase:"end",state:e})}async waitWhilePaused(){if(!this.disabled)for(;this.paused;){for(console.log("[flow] paused from devtools \u2014 waiting\u2026");this.paused&&!this.disabled;)await new Promise(e=>setTimeout(e,400)),await this.push({phase:"heartbeat",state:"paused"});this.disabled||console.log("[flow] resumed")}}};var Fe=null;function Or(){return Fe}var Ie=[];function _r(){return Ie}async function jt(n){if(!n)return"";let e=n.trim();if(!e)return"";if(/^\d+$/.test(e)||e.startsWith("http://")||e.startsWith("https://"))return e;let r=(await Ne()).find(i=>i.name.toLowerCase()===e.toLowerCase());return r?String(r.preferredPort):e}async function Vt(){let n=await Ce(),e=n.find(r=>r.patched);if(e)return`http://localhost:${e.port}/__soot/`;let t=n[0];return t?`http://localhost:${t.port}/__soot/`:null}async function dt(n){Fe=null,Ie=[],(n.length===0||n.includes("--help")||n.includes("-h"))&&(console.log(`
|
|
463
|
+
})()`);if(this.profilingEnabled=!1,e?.error)throw new Error(e.error);return e}async stopApp(){await this.reloadGuestApp(!1),await this.rearmCaptureAfterRuntimeReload()}async clearState(){await this.reloadGuestApp(!0),await this.rearmCaptureAfterRuntimeReload()}clearKeychain(){console.warn("[flow] clearKeychain: sootsim has no keychain surface \u2014 no-op (warning)")}async copyTextFrom(e){let t=typeof e=="string"?{id:e}:e,r=await this.findElement(t);if(!r)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let i=r.text??r.testID??"";this.js.setCopiedText(i),this.js.putEnv("maestroCopiedText",i),console.log(`[flow] copied text: ${JSON.stringify(i)}`)}evalScript(e){let r=/(?<!\\)\$\{[^$]*\}/.test(e)?this.js.evaluateStringTemplate(e):this.js.evaluate(e);r!==void 0&&r!==""&&console.log("[flow] evalScript ->",r)}runScript(e){let t=typeof e=="string"?{file:e}:e;if(!t.file)throw new Error("runScript requires a file");let r=b.resolve(this.opts.flowDir,t.file),i=S.readFileSync(r,"utf8");this.js.evaluate(i,{env:t.env}),console.log(`[flow] runScript: ${t.file} done`)}async openLink(e){let t=typeof e=="string"?e:e.link;if(!t)throw new Error("openLink: missing link");let r=await this.callTest("openDeepLink",t);if(!r?.ok)throw new Error(`openLink failed: ${r?.error||"no test bridge"}`);await f(300)}async evaluateWhen(e){if(e.visible!==void 0){let t=typeof e.visible=="string"?{text:e.visible}:e.visible;return!!await this.findElement(t)}if(e.notVisible!==void 0){let t=typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible;return!await this.findElement(t)}return e.platform!==void 0?e.platform.toLowerCase()===this.js.maestro.platform.toLowerCase():e.true!==void 0?lt(e.true):!0}isOptional(e){if(e.optional===!0)return!0;let r=Object.entries(e).find(([o])=>o!=="when"&&o!=="optional"),i=r?r[1]:void 0;return!!(i&&typeof i=="object"&&"optional"in i&&i.optional)}async runStep(e,t){let r=typeof e=="string"?ct(e):e,i=Object.keys(r).find(l=>l!=="when")||Object.keys(r)[0];console.log(`[flow] step ${t+1}: ${i}`);let o=Date.now(),a=this.flowStepTargetLabel(r,i),s;try{s=this.js.interpolateStep(r),a=this.flowStepTargetLabel(s,i)??a}catch(l){if(this.isOptional(r)){console.log(`[flow] (optional, skipped: ${l.message.slice(0,80)})`),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"skipped",error:l});return}throw this.lastFailedStep={index:t,kind:i,target:r[i]},this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"failure",error:l}),l}if(s.when&&!await this.evaluateWhen(s.when)){console.log("[flow] (when: predicate false, skipped)"),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"skipped"});return}try{let l=!!(s.extendedWaitUntil||s.waitFor||s.scrollUntilVisible||s.launchApp||s.runFlow||s.runScript),u=1e4,p=this.runStepInner(s),g;if(l){let m=await p;typeof m=="string"&&(g=m)}else{let m=null,P=new Promise((k,ne)=>{m=setTimeout(()=>{ne(new Error(`step watchdog: ${i} made no progress in ${u}ms \u2014 bridge or bundle probably hung`))},u)});try{let k=await Promise.race([p,P]);typeof k=="string"&&(g=k)}finally{m&&clearTimeout(m)}}let F=!!(s.assertVisible||s.assertNotVisible||s.extendedWaitUntil||s.waitFor);this.stepDelay>0&&!F&&await f(this.stepDelay),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"success",screenshotPath:g})}catch(l){if(this.isOptional(s)){console.log(`[flow] (optional, skipped: ${l.message.slice(0,80)})`),this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"skipped",error:l});return}throw this.lastFailedStep={index:t,kind:i,target:s[i]},this.recordFlowTraceStep({stepIndex:t,stepName:i,targetLabel:a,startedAtMs:o,status:"failure",error:l}),l}}async runStepInner(e){if(e.tapOn)await this.tapOn(e.tapOn);else if(e.longPressOn)await this.longPressOn(e.longPressOn);else if(e.scrollUntilVisible)await this.scrollUntilVisible(e.scrollUntilVisible);else if(e.extendedWaitUntil)await this.extendedWaitUntil(e.extendedWaitUntil);else if(e.assertVisible)await this.assertVisible(e.assertVisible);else if(e.assertNotVisible)await this.assertNotVisible(e.assertNotVisible);else if(e.inputText)await this.inputText(e.inputText);else if(e.pressKey)await this.pressKey(e.pressKey);else if(e.dispatchKey)await this.dispatchKey(e.dispatchKey);else if(e.waitFor)await this.waitFor(e.waitFor);else{if(e.takeScreenshot)return this.takeScreenshot(e.takeScreenshot);if(e.swipe)e.swipe.start&&e.swipe.end?await this.swipeCoords(e.swipe.start,e.swipe.end,e.swipe.duration):e.swipe.from?await this.swipeFrom(e.swipe.from,e.swipe.direction,e.swipe.duration):await this.swipe(e.swipe.direction,e.swipe.duration);else if(e.scroll)await this.swipe(e.scroll.direction==="DOWN"?"UP":"DOWN");else if(e.scrollTo){let t=typeof e.scrollTo.nodeId=="number"?{nodeId:e.scrollTo.nodeId}:e.scrollTo.id;if(!t)throw new Error("scrollTo requires id or nodeId");await this.scrollTo(t,e.scrollTo.x,e.scrollTo.y)}else if(e.pinch)await this.pinch(e.pinch);else if(e.waitForAnimationToEnd){let t=e.waitForAnimationToEnd;await this.waitForAnimationToEnd(typeof t=="number"?t:typeof t=="object"&&typeof t.timeout=="number"?t.timeout:2e3)}else if(e.back)await this.back();else if(e.hideKeyboard)await this.hideKeyboard();else if(e.launchApp)await this.launchApp(e.launchApp);else if(typeof e.wait=="number")await f(e.wait);else if(e.dumpTree)await this.dumpTree(e.dumpTree);else if(e.tapAtCoords)await this.tapAtCoords(e.tapAtCoords.x,e.tapAtCoords.y);else if(e.doubleTapAtCoords)await this.doubleTapAtCoords(e.doubleTapAtCoords.x,e.doubleTapAtCoords.y,e.doubleTapAtCoords.gapMs);else if(e.assertTreeContains)await this.assertTreeContains(e.assertTreeContains);else if(typeof e.eraseText=="number")await this.eraseText(e.eraseText);else if(e.repeat&&Array.isArray(e.repeat.commands)){let t=e.repeat.times,r=t==null||t===""?Number.MAX_SAFE_INTEGER:Number(t);if(!Number.isFinite(r))throw new Error(`repeat.times is not a number: ${t}`);let i=e.repeat.when??e.repeat.condition,o=async()=>i?this.evaluateWhen(i):!0,a=i?r:Math.min(r,1e3),s=0;for(;s<a&&await o();){for(let l=0;l<e.repeat.commands.length;l++)await this.runStep(e.repeat.commands[l],l);s++}}else if(e.stopApp!==void 0)await this.stopApp();else if(e.clearState!==void 0)await this.clearState();else if(e.clearKeychain!==void 0)this.clearKeychain();else if(e.copyTextFrom!==void 0)await this.copyTextFrom(e.copyTextFrom);else if(typeof e.evalScript=="string")this.evalScript(e.evalScript);else if(e.runScript){let t=e.runScript,r=typeof t=="string"?void 0:t.when;if(r&&!await this.evaluateWhen(r)){console.log("[flow] runScript skipped (when predicate false)");return}this.runScript(t)}else if(e.openLink!==void 0)await this.openLink(e.openLink);else if(e.runFlow){let t=e.runFlow,r=typeof t=="string"?t:t.file,i=typeof t=="string"?void 0:t.commands,o=typeof t=="string"?void 0:t.env,a=typeof t=="string"?void 0:t.when;if(a&&!await this.evaluateWhen(a)){console.log(`[flow] runFlow skipped (when predicate false): ${r??"inline commands"}`);return}if(!r&&!i)throw new Error("runFlow requires either file or commands");this.js.enterEnvScope();try{if(o)for(let[s,l]of Object.entries(o))this.js.putEnv(s,l);if(r){let s=b.resolve(this.opts.flowDir,r),l=S.readFileSync(s,"utf8"),u=this.opts.flowDir;this.opts.flowDir=b.dirname(s);try{await this.runFlow(Ut(l))}finally{this.opts.flowDir=u}}else if(i)for(let s=0;s<i.length;s++)await this.runStep(i[s],s)}finally{this.js.leaveEnvScope()}}else throw new Error(`unsupported flow step: ${JSON.stringify(e)}`)}}liveStatus=null;async runFlow(e){let t=[],r=[],i=[];for(let a of e){let s=Object.keys(a);if(s.length===1&&s[0]==="onFlowStart"&&Array.isArray(a.onFlowStart)){t.push(...a.onFlowStart);continue}if(s.length===1&&s[0]==="onFlowComplete"&&Array.isArray(a.onFlowComplete)){r.push(...a.onFlowComplete);continue}i.push(a)}if(this.liveStatus&&await this.liveStatus.plan(i.map((a,s)=>{let l=typeof a=="string"?ct(a):a,u=Object.keys(l).find(p=>p!=="when")??Object.keys(l)[0];return{index:s,name:u,target:this.flowStepTargetLabel(l,u)}})),t.length>0){console.log(`[flow] onFlowStart (${t.length} steps)`);for(let a=0;a<t.length;a++)await this.runStep(t[a],a)}let o=null;try{await this.runFlowBody(i)}catch(a){o=a instanceof Error?a:new Error(String(a))}if(r.length>0){console.log(`[flow] onFlowComplete (${r.length} steps)`);for(let a=0;a<r.length;a++)try{await this.runStep(r[a],a)}catch(s){console.warn(`[flow] onFlowComplete step ${a+1} failed: ${s instanceof Error?s.message:s}`)}}if(o)throw o}async runFlowBody(e){for(let t=0;t<e.length;t++){let r=e[t],i=typeof r.wait=="number"?r.wait:0,o=typeof r.waitFor?.timeout=="number"?r.waitFor.timeout:0,a=Math.max(6e4,i+15e3,o+15e3);this.liveStatus&&(await this.liveStatus.waitWhilePaused(),await this.liveStatus.step(t,"running"));let s=Date.now(),l=async(u,p)=>{if(!this.liveStatus)return;let g=this.flowTraceSteps[this.flowTraceSteps.length-1],F=g&&g.stepIndex===t&&g.startedAtMs>=s;await this.liveStatus.step(t,u?"failure":F&&g.status==="skipped"?"skipped":"success",{durationMs:Date.now()-s,error:u?p instanceof Error?p.message.slice(0,300):String(p).slice(0,300):F&&g.error||void 0})};try{r.runFlow||r.launchApp?await this.runStep(r,t):await Promise.race([this.runStep(r,t),new Promise((u,p)=>setTimeout(()=>p(new Error(`step ${t+1} (${Object.keys(r)[0]}) exceeded ${a}ms deadline`)),a))])}catch(u){throw await l(!0,u),u}await l(!1)}}};var ie=class{constructor(e,t){this.bridge=e;this.flowName=t}disabled=!1;paused=!1;runId=`flr_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;async push(e){if(!this.disabled)try{let t=await this.bridge.send({type:"flowStatus",status:{runId:this.runId,flowName:this.flowName,...e}});this.paused=t?.control?.paused===!0}catch(t){this.disabled=!0,console.log(`[flow] live status unavailable (${t instanceof Error?t.message.slice(0,120):t}) \u2014 continuing without the devtools rail`)}}async plan(e){await this.push({phase:"plan",state:"running",steps:e})}async step(e,t,r){await this.push({phase:"step",state:"running",step:{index:e,status:t,...r}})}async end(e){await this.push({phase:"end",state:e})}async waitWhilePaused(){if(!this.disabled)for(;this.paused;){for(console.log("[flow] paused from devtools \u2014 waiting\u2026");this.paused&&!this.disabled;)await new Promise(e=>setTimeout(e,400)),await this.push({phase:"heartbeat",state:"paused"});this.disabled||console.log("[flow] resumed")}}};var Fe=null;function _r(){return Fe}var Ie=[];function Dr(){return Ie}async function Vt(n){if(!n)return"";let e=n.trim();if(!e)return"";if(/^\d+$/.test(e)||e.startsWith("http://")||e.startsWith("https://"))return e;let r=(await Ce()).find(i=>i.name.toLowerCase()===e.toLowerCase());return r?String(r.preferredPort):e}async function Jt(){let n=await He(),e=n.find(r=>r.patched);if(e)return`http://localhost:${e.port}/__soot/`;let t=n[0];return t?`http://localhost:${t.port}/__soot/`:null}async function ut(n){Fe=null,Ie=[],(n.length===0||n.includes("--help")||n.includes("-h"))&&(console.log(`
|
|
464
464
|
sootsim maestro \u2014 author and run Maestro YAML flows
|
|
465
465
|
|
|
466
466
|
usage:
|
|
@@ -540,28 +540,28 @@ flow extension:
|
|
|
540
540
|
takeScreenshot:
|
|
541
541
|
path: marketing/hero
|
|
542
542
|
withFrame: true
|
|
543
|
-
`),process.exit(0));let e=n[0];$.existsSync(e)||(console.error(` error: ${e} not found`),process.exit(1));let t=h=>n.find((c,y)=>n[y-1]===h),r=n.includes("--profile"),i=n.includes("--headed"),o=n.includes("--new")||i,a=t("--out")||"/tmp/sootsim-recordings",s=t("--screenshots")||(t("--out")?a:"/tmp/sootsim-flow"),l=t("--screenshot-paths")==="flow"?"flow":"dir",u=n.includes("--no-shell")?"tenant":n.includes("--shell-only")?"shell":void 0,p=t("--device")?.trim()||"",g=n.includes("--slow")?+(t("--slow")||"500"):0,
|
|
543
|
+
`),process.exit(0));let e=n[0];$.existsSync(e)||(console.error(` error: ${e} not found`),process.exit(1));let t=h=>n.find((c,y)=>n[y-1]===h),r=n.includes("--profile"),i=n.includes("--headed"),o=n.includes("--new")||i,a=t("--out")||"/tmp/sootsim-recordings",s=t("--screenshots")||(t("--out")?a:"/tmp/sootsim-flow"),l=t("--screenshot-paths")==="flow"?"flow":"dir",u=n.includes("--no-shell")?"tenant":n.includes("--shell-only")?"shell":void 0,p=t("--device")?.trim()||"",g=n.includes("--slow")?+(t("--slow")||"500"):0,F=n.includes("--electron"),m=n.includes("--preview"),P=await rt(t("--preview-origin")),k=t("--preview-public-origin"),ne=n.includes("--preview-open"),$e=t("--owner")?.trim()||"",Pe=t("--repo")?.trim()||"",H=t("--billing-kind")?.trim()||"",pt=m?`maestro:${process.env.GITHUB_RUN_ID?`github:${process.env.GITHUB_RUN_ID}:attempt:${process.env.GITHUB_RUN_ATTEMPT||"1"}:job:${process.env.GITHUB_JOB||"preview"}`:`local:${jt()}`}:flow:${Wt("sha256").update(w.relative(process.cwd(),w.resolve(e))).digest("hex").slice(0,16)}`:"";H&&H!=="test_run"&&(console.error(` error: invalid --billing-kind: ${H}`),process.exit(1));let ht=n.flatMap((h,c)=>n[c-1]==="--replace"?["--replace",h]:[]),ft=n.flatMap((h,c)=>n[c-1]==="--remap"?["--remap",h]:[]),M=n.includes("--record")||m,mt=n.includes("--tail-wait")?Math.max(0,+(t("--tail-wait")||"2000")):M?m?6e3:2e3:0,gt=$.readFileSync(e,"utf8"),{frontmatter:x,steps:R}=ge(gt);R.length===0&&(console.error(" error: flow file must contain a YAML array of steps"),process.exit(1));let U=p||x.device||"",ke=x.theme||"",q=F||x.electron===!0,wt=x.app===void 0||x.app===null?"":typeof x.app=="number"?String(x.app):x.app,oe=await Vt(wt),Ae={stripBooleanFlags:["--record","--profile","--electron","--new","--preview","--preview-open","--headless","--headed"],stripValueFlags:["--out","--device","--slow","--tail-wait","--url","--replace","--remap","--screenshots","--screenshot-paths","--preview-origin","--preview-public-origin","--driver","--billing-kind","--owner","--repo"]},v=pe(n,Ae),yt=t("--url")||"";q&&!ze()&&(console.error(" error: desktop companion not found. install or build it first with `bun run build:electron`"),process.exit(1));let Me=q?"desktop companion":"bridge",bt=oe?` | target: ${oe}`:"";console.log(`
|
|
544
544
|
sootsim maestro \u2014 ${w.basename(e)}
|
|
545
|
-
${R.length} steps | ${
|
|
546
|
-
`),m&&
|
|
545
|
+
${R.length} steps | ${Me}${bt}${M?" | recording":""}${r?" | profiling":""}${g?` | ${g}ms delay`:""}
|
|
546
|
+
`),m&&De({event:"preview_flow_started",properties:{flowName:w.basename(e),stepCount:R.length,mode:Me,electron:q,record:M,profile:r,previewOrigin:P}});let A=yt||oe||"",se=o||q&&v.simIdSource!=="flag",Re=t("--driver")||"",ae=!1,le=new Set,Oe=!1;if(!A&&!se&&v.simIdSource==="none"){let h=Je(v);try{let c=await h.listSims(),y=c.find(D=>D.isPrimary&&D.readyState==="open"),I=c.find(D=>D.readyState==="open"),V=y??I;V&&(Oe=!0,console.log(` reusing active sim: ${V.id}`))}catch{}finally{h.close()}}if(!A&&!Oe&&(se||v.simIdSource==="none")){let h=await Jt();h||(console.error(" error: no current sim and no sootsim target found"),await de(),process.exit(1)),A=h}if(A&&U){let h=new URL(await Ke(A));h.searchParams.set("device",U),A=h.toString()}if(A){let h=[A];if(h.push(...ht),h.push(...ft),se&&h.push("--new"),h.push("--no-describe"),v.simIdSource==="flag"&&v.simId&&h.push("--sim",v.simId),Re&&(h.push("--driver",Re),ae=!0),n.includes("--headless")&&!i&&h.push("--headless"),await Ye(h,{port:v.wsPort,timeoutMs:v.commandTimeoutMs}),ae){let c=ue();c&&le.add(c)}}let B=pe(n,Ae),Y=B.simIdSource==="flag"?B.simId:ue()||B.simId,St=B.simIdSource==="flag"?"flag":Y?"saved":"none",T=he(B.wsPort,{commandTimeoutMs:B.commandTimeoutMs,simId:Y,simIdSource:St}),d,_e=async()=>{if(ke&&await T.send({type:"call",simId:d.simId,path:"SootSim.bridges.settings.set",args:["colorScheme",ke]}),!U)return!1;let h=await T.send({type:"evaluate",simId:d.simId,code:"window.location.href"});if(typeof h=="string"&&h.length>0){let c=new URL(h);c.searchParams.set("device",U),d.setSimRouteHint(c.toString())}return!!await T.send({type:"call",simId:d.simId,path:"SootSim.bridges.settings.set",args:["deviceModel",U]})};if(d=new re(T,{screenshotDir:s,flowDir:w.dirname(w.resolve(e)),screenshotPathMode:l,screenshotLayers:u,simId:Y,recordingOutputDir:M?a:void 0,recordingFormat:m?"mp4":"webm",billingOriginOverride:m?P:void 0,allowGitHubRecording:m,requireRecordingEntitlement:m,onAfterLaunch:async()=>{await _e()&&await d.waitForTree(12e4),m&&await T.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
547
547
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
548
548
|
return r?.start?.() ?? false
|
|
549
|
-
})()`})}}),g&&(d.stepDelay=g),d.liveStatus=new ie(
|
|
549
|
+
})()`})}}),g&&(d.stepDelay=g),d.liveStatus=new ie(T,w.basename(e)),d.js.putEnv("MAESTRO_FILENAME",w.basename(e,w.extname(e))),x.env&&typeof x.env=="object")for(let[h,c]of Object.entries(x.env))d.js.putEnv(h,c);let O=null,E=null,L=null,_=null,W=null,ce=null,j=0,Z=!!R[0]?.launchApp;try{Z||await d.waitForTree(12e4),await _e()&&!Z&&await d.waitForTree(12e4),m&&!Z&&!process.env.SOOTSIM_PREVIEW_RESET_DONE&&await d.launchApp({clearState:!0}),M&&(Z?d.prepareRecording():await d.startRecording()),r&&await d.startProfile(),m&&(await T.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
550
550
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
551
551
|
return r?.start?.() ?? false
|
|
552
|
-
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await d.runFlow(R),r&&(O=await d.stopProfile()),await d.waitForRecordingTail({maxMs:
|
|
552
|
+
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await d.runFlow(R),r&&(O=await d.stopProfile()),await d.waitForRecordingTail({maxMs:mt,smart:m}),M&&(E=await d.stopRecording(),L=d.getLastRecordingDurationMs()),m&&(_=await T.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
553
553
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
554
554
|
return r?.stop?.() ?? []
|
|
555
555
|
})()`}),console.log(` captured ${_.length} replay events`),W=w.join(s,"preview-final.png"),await d.captureScreenshot(W),console.log(` final screenshot: ${W}`));let c=R.filter(y=>y&&typeof y=="object"&&"takeScreenshot"in y).length;console.log(`
|
|
556
|
-
+ completed (${R.length} steps)`),c>0&&console.log(` screenshots: ${c} \u2192 ${s}`),O&&
|
|
556
|
+
+ completed (${R.length} steps)`),c>0&&console.log(` screenshots: ${c} \u2192 ${s}`),O&&dt(O),E&&console.log(` video: ${E}`),console.log()}catch(h){if(r&&!O)try{O=await d.stopProfile()}catch{}if(M&&!E)try{E=await d.stopRecording(),L=d.getLastRecordingDurationMs()}catch(c){console.warn(` recording stop failed: ${c?.message||String(c)}`)}if(m&&!_)try{_=await T.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
557
557
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
558
558
|
return r?.stop?.() ?? []
|
|
559
559
|
})()`}),console.log(` captured ${_.length} partial replay events`)}catch(c){console.warn(` event recorder stop failed: ${c?.message||String(c)}`)}console.error(`
|
|
560
560
|
x failed: ${h.message}
|
|
561
|
-
`),O&&(console.log(" partial profile:"),
|
|
562
|
-
preparing preview upload\u2026`);let I=d.getFlowTraceSteps();I.length>0&&c.push("--timeline-events",await
|
|
561
|
+
`),O&&(console.log(" partial profile:"),dt(O)),E&&console.log(` partial video: ${E}`);try{let c=d.lastFailedStep,y=c?`step-${String(c.index+1).padStart(2,"0")}-${c.kind}`:"unstaged",I=w.join(s,y);await d.captureFailureBundle(I,{error:h,stepIndex:c?.index,stepKind:c?.kind,stepTarget:c?.target}),ce=I,console.log(` failure bundle: ${I}`),console.log(" (contents: screenshot.png, describe.json, a11y.txt, tree.txt, console.json, error.json)")}catch(c){try{let y=w.join(s,"error.png");await d.captureScreenshot(y),console.log(` error screenshot: ${y}`)}catch{}console.log(` (failure bundle capture failed: ${c instanceof Error?c.message:String(c)})`)}await Ge(T,{errorsCommand:`sootsim get errors 5${d.simId?` --sim ${d.simId}`:""}`,warningsCommand:`sootsim get warnings 5${d.simId?` --sim ${d.simId}`:""}`,requestsCommand:`sootsim get requests 5${d.simId?` --sim ${d.simId}`:""}`}),j=1}if(await d.liveStatus?.end(j===0?"passed":"failed"),m&&(j===0||E||_))try{let h=await zt(_??[]),c=["--origin",P,"--events",h];k&&c.push("--public-origin",k),E&&c.push("--video",E),W&&c.push("--screenshot",W),E&&L&&Number.isFinite(L)&&(c.push("--video-duration-ms",String(Math.round(L))),c.push("--recorded-duration-ms",String(Math.round(L))));let y=d.getLastRecordingStartedAtMs();y&&Number.isFinite(y)&&c.push("--recording-started-at-ms",String(Math.round(y))),v.wsPort&&c.push("--port",String(v.wsPort)),d.simId&&c.push("--sim",d.simId),ne&&c.push("--open"),$e&&c.push("--owner",$e),Pe&&c.push("--repo",Pe),c.push("--run-scope",pt),H&&c.push("--billing-kind",H),console.log(`
|
|
562
|
+
preparing preview upload\u2026`);let I=d.getFlowTraceSteps();I.length>0&&c.push("--timeline-events",await Kt(I));let V=await qt(I,y);V&&c.push("--snapshot-manifest",V),ce&&c.push("--failure-bundle",ce);let D=d.getLastRecordingFrameStats();D&&c.push("--trace-frame-stats",await Yt(D));let{runUpload:vt}=await import("./upload-XGUWNMYV.js");Fe=await vt(c,{})}catch(h){console.error(` preview upload failed: ${h?.message||h}`),j=1}return Ie=d.getFlowTraceSteps(),T.close(),ae?(d.simId&&le.add(d.simId),await Gt(v.wsPort,v.commandTimeoutMs,[...le])):d.simId&&d.simId!==Y&&Ne(d.simId),await de(),j}async function Gt(n,e,t){let r=[...new Set(t.filter(Boolean))];if(r.length===0)return;let i=he(n,{commandTimeoutMs:e});try{let o=await i.listSims(),a=r.filter(l=>o.some(u=>u.id===l&&u.readyState==="open"));if(a.length===0)return;let s=await Ze(i,n,e,a);await qe(o,a),s.closed.length>0&&console.log(` closed flow sim(s): ${s.closed.join(", ")}`),s.remaining.length>0&&console.warn(` warn: flow sim(s) still connected after close: ${s.remaining.join(", ")}`)}catch(o){console.warn(` warn: failed to close flow sim(s): ${o instanceof Error?o.message:String(o)}`)}finally{i.close()}}async function zt(n){let{gzipSync:e}=await import("zlib"),t=n.map(o=>JSON.stringify(o)).join(`
|
|
563
563
|
`)+(n.length?`
|
|
564
|
-
`:""),r=e(Buffer.from(t,"utf8")),i=w.join(K(),`sootsim-events-${Date.now()}.jsonl.gz`);return $.writeFileSync(i,r),console.log(` events: ${n.length} written to ${i} (${r.length} bytes gz)`),i}async function
|
|
564
|
+
`:""),r=e(Buffer.from(t,"utf8")),i=w.join(K(),`sootsim-events-${Date.now()}.jsonl.gz`);return $.writeFileSync(i,r),console.log(` events: ${n.length} written to ${i} (${r.length} bytes gz)`),i}async function Kt(n){let{gzipSync:e}=await import("zlib"),t=n.map((a,s)=>({schemaVersion:1,t:a.endedAtMs,seq:1e6+s,context:"host",kind:"flow-step",id:`flow-step-${a.stepIndex}`,data:{stepIndex:a.stepIndex,stepNumber:a.stepIndex+1,stepName:a.stepName,...a.targetLabel?{targetLabel:a.targetLabel}:{},status:a.status,durationMs:a.durationMs,startedAtMs:a.startedAtMs,endedAtMs:a.endedAtMs,...a.error?{error:a.error}:{}}})),r=t.map(a=>JSON.stringify(a)).join(`
|
|
565
565
|
`)+`
|
|
566
|
-
`,i=e(Buffer.from(r,"utf8")),o=w.join(K(),`sootsim-flow-steps-${Date.now()}.jsonl.gz`);return $.writeFileSync(o,i),console.log(` flow trace: ${t.length} step events written to ${o} (${i.length} bytes gz)`),o}async function
|
|
567
|
-
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=u;return}ye(),console.log(` flow draft validated (${s.stepCount} step${s.stepCount===1?"":"s"})`),s.outputPath&&console.log(` saved: ${s.outputPath}`),o&&console.log(" video: recorded during validation run");return}if(ye(),console.log(` flow draft ended (${s.stepCount} step${s.stepCount===1?"":"s"})`),s.outputPath){console.log(` saved: ${s.outputPath}`),console.log(` next: sootsim maestro test ${s.outputPath} --record`);return}console.log(""),process.stdout.write(s.yaml);return}case"validate":{let r=n[1];(!r||r.startsWith("-"))&&(console.error(" usage: sootsim maestro validate <path>"),process.exit(1));let i=we(r);if(i.length>0){console.error(` x ${r} failed validation:`);for(let o of i)console.error(` - ${o}`);process.exit(1)}console.log(` + ${r} looks valid`);return}}}function
|
|
566
|
+
`,i=e(Buffer.from(r,"utf8")),o=w.join(K(),`sootsim-flow-steps-${Date.now()}.jsonl.gz`);return $.writeFileSync(o,i),console.log(` flow trace: ${t.length} step events written to ${o} (${i.length} bytes gz)`),o}async function qt(n,e){if(!e)return null;let t=n.flatMap(i=>i.screenshotPath?[{id:`flow-step-${i.stepIndex}`,label:i.targetLabel??`Step ${i.stepIndex+1}`,kind:"interaction",t:Math.max(0,i.endedAtMs-e),path:i.screenshotPath}]:[]);if(t.length===0)return null;let r=w.join(K(),`sootsim-flow-snapshots-${Date.now()}.json`);return $.writeFileSync(r,JSON.stringify(t)),console.log(` flow snapshots: ${t.length} written to ${r}`),r}async function Yt(n){let e=w.join(K(),`sootsim-frame-stats-${Date.now()}.json`);return $.writeFileSync(e,JSON.stringify(n)),console.log(` frame stats: written to ${e}`),e}async function Zt(n){let e=n[0],t=r=>n.find((i,o)=>n[o-1]===r);switch(e){case"start":{let{path:r,state:i}=Qe();console.log(" flow draft started"),console.log(` session: ${r}`),console.log(` steps: ${i.steps.length}`);return}case"keep":case"good":{let r=be();if(r.active||(console.error(" no active flow draft \u2014 run `sootsim maestro start` first"),process.exit(1)),!r.kept){console.log(" no pending action to keep");return}console.log(` kept: ${r.candidate.summary}`),console.log(` steps: ${r.stepCount}`);return}case"end":{let r=t("--output")||(n[1]&&!n[1].startsWith("-")?n[1]:void 0),i=n.includes("--validate")||n.includes("--video"),o=n.includes("--video"),a=be();a.active&&a.kept&&console.log(` auto-kept trailing action: ${a.candidate.summary}`);let s=et(r||(i?Qt():void 0));if(s.active||(console.error(" no active flow draft \u2014 run `sootsim maestro start` first"),process.exit(1)),!s.valid){console.error(" flow draft is not valid:");for(let l of s.issues)console.error(` - ${l}`);console.error(" draft preserved \u2014 keep at least one real interaction or run `sootsim maestro start` to reset"),process.exit(1)}if(i){let l=er(n,s.outputPath),u=await ut(l);if(u!==0){console.error(`
|
|
567
|
+
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=u;return}ye(),console.log(` flow draft validated (${s.stepCount} step${s.stepCount===1?"":"s"})`),s.outputPath&&console.log(` saved: ${s.outputPath}`),o&&console.log(" video: recorded during validation run");return}if(ye(),console.log(` flow draft ended (${s.stepCount} step${s.stepCount===1?"":"s"})`),s.outputPath){console.log(` saved: ${s.outputPath}`),console.log(` next: sootsim maestro test ${s.outputPath} --record`);return}console.log(""),process.stdout.write(s.yaml);return}case"validate":{let r=n[1];(!r||r.startsWith("-"))&&(console.error(" usage: sootsim maestro validate <path>"),process.exit(1));let i=we(r);if(i.length>0){console.error(` x ${r} failed validation:`);for(let o of i)console.error(` - ${o}`);process.exit(1)}console.log(` + ${r} looks valid`);return}}}function Xt(n){return n[0]==="--sim"&&n.length>=2?[...n.slice(2),"--sim",n[1]]:n}async function Br(n){let e=Xt(n),t=e[0];if(t==="start"||t==="keep"||t==="good"||t==="end"||t==="validate")return await Zt(e),0;let r=await ut(e);return r!==0&&(process.exitCode=r),r}function dt(n){console.log(""),tt(n)}function Qt(){return w.join(K(),`sootsim-flow-draft-${Date.now()}.yaml`)}function er(n,e){if(!e)throw new Error("validated flow draft requires an output path");let t=[e];for(let r=1;r<n.length;r++){let i=n[r];if(!(i==="--validate"||i==="--video")){if(i==="--output"){r+=1;continue}r===1&&!i.startsWith("-")||t.push(i)}}return!t.includes("--record")&&n.includes("--video")&&t.push("--record"),t}export{st as a,kt as b,_r as c,Dr as d,Jt as e,ut as f,Xt as g,Br as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{h as w,j as u,k as m,l}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{h as w,j as u,k as m,l}from"./chunk-IKZ4Z6ND.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","alwaysShowLiveWebViews","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function g(e){let t={};for(let n of v){if(!(n in e))continue;let r=e[n],o=u[n];o.validate&&!o.validate(r)||o.options&&!o.options.includes(r)||(t[n]=r)}return t}function h(e){let t={};for(let n of v)t[n]=e[n];return t}function _(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?g(JSON.parse(e)):{}}catch{return{}}}function V(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function E(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:g(t)}function K(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function b(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=b()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!b())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function k(){let e=_(),t=j(),n=E();return{...e,...t,...n}}function R(e){V(e),K(e),D(e)}function C(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(g(JSON.parse(i.newValue)))}catch{}};window.addEventListener("storage",t);let n=S(),r;n?.onSharedConfigChanged&&(r=n.onSharedConfigChanged(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var M=l(),P=k();for(let e of Object.keys(m()))delete P[e];var s={...M,...P},f=[],a=null;function y(){for(let e of f)e();R(s)}C(e=>{let t={...s},n=!1;for(let[r,o]of Object.entries(e)){let c=r;t[c]!==o&&(t[c]=o,n=!0)}if(n){s=t,a=null;for(let r of f)r()}});var L={get(e){return s[e]},set(e,t){let n=u[e];n.validate&&!n.validate(t)||n.options&&!n.options.includes(t)||s[e]!==t&&(s={...s,[e]:t},e==="deviceModel"&&(a=null),y())},getAll(){return s},apply(e){let t=!1,n={...s};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;let c=r,i=u[c];i&&(i.validate&&!i.validate(o)||i.options&&!i.options.includes(o)||n[c]!==o&&(n[c]=o,t=!0))}t&&(s=n,a=null,y())},reset(){s=l(),a=null,y()},subscribe(e){return f.push(e),()=>{f=f.filter(t=>t!==e)}},getDeviceSpec(){return a||(a=w(s.deviceModel)),a},getA11yMode(){return s.a11yMode},setA11yMode(e){this.set("a11yMode",e)},getInspectMode(){return s.inspectMode},setInspectMode(e){this.set("inspectMode",e)}};export{L as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{H as t,N as n,P as l,j as r}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.218 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{H as t,N as n,P as l,j as r}from"./chunk-YMFQOXT4.js";function m(){let e=t(),i=r()?n():null;return i&&l(i)?{primary:`engine dev source (:${i.bridgePort})`,installedRuntime:e?`installed runtime v${e}`:null,isDevBridge:!0}:{primary:e?`runtime v${e}`:"runtime not installed",installedRuntime:null,isDevBridge:!1}}export{m as a};
|