sootsim 0.1.302 → 0.1.304
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 +5 -5
- package/dist-cli/chunks/{agent-QM5DJK6B.js → agent-EK355OQM.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-HDOQKZ2C.js → agent-wrapper-LCJJWHZE.js} +2 -2
- package/dist-cli/chunks/app-fonts-LIPU2DLT.js +4 -0
- package/dist-cli/chunks/{assert-URPY7JOQ.js → assert-OASKCPBX.js} +2 -2
- package/dist-cli/chunks/{auth-LDIGTG4T.js → auth-XYYKD33F.js} +2 -2
- package/dist-cli/chunks/{beta-7X7SMIUJ.js → beta-TOL55XPM.js} +2 -2
- package/dist-cli/chunks/{camera-44FBN2AD.js → camera-PHKVEQHR.js} +2 -2
- package/dist-cli/chunks/{chunk-47FKMZKZ.js → chunk-2MEUZOSD.js} +1 -1
- package/dist-cli/chunks/{chunk-N53HDXGW.js → chunk-2RLFUM3C.js} +8 -8
- package/dist-cli/chunks/{chunk-YY54A626.js → chunk-3UUHIHA6.js} +2 -2
- package/dist-cli/chunks/{chunk-QNA5RNYZ.js → chunk-5NJTX5OP.js} +2 -2
- package/dist-cli/chunks/{chunk-YY27LKQF.js → chunk-76OLOD2G.js} +2 -2
- package/dist-cli/chunks/{chunk-UEFW7TPW.js → chunk-7RFXZXKH.js} +1 -1
- package/dist-cli/chunks/{chunk-2BQCOQBK.js → chunk-A4UYZTV7.js} +2 -2
- package/dist-cli/chunks/{chunk-T3UJXMFJ.js → chunk-ABHNOM2C.js} +1 -1
- package/dist-cli/chunks/{chunk-PDB5OX3V.js → chunk-AJYA6R3N.js} +2 -2
- package/dist-cli/chunks/{chunk-TWOBAP7S.js → chunk-BJOT2LL6.js} +2 -2
- package/dist-cli/chunks/{chunk-UNDGU5PA.js → chunk-BPRMA4IC.js} +2 -2
- package/dist-cli/chunks/{chunk-QN5DSQNG.js → chunk-CMYVGJBQ.js} +1 -1
- package/dist-cli/chunks/{chunk-ZORZTTQL.js → chunk-ENXLKDQ6.js} +3 -3
- package/dist-cli/chunks/{chunk-WQWYWERD.js → chunk-EXW6TH3O.js} +2 -2
- package/dist-cli/chunks/{chunk-QOS3GSOM.js → chunk-FNI75AD7.js} +1 -1
- package/dist-cli/chunks/{chunk-KNBZZC7R.js → chunk-G4R7CPCY.js} +2 -2
- package/dist-cli/chunks/{chunk-XLAZCK5H.js → chunk-GF3LDVWF.js} +2 -2
- package/dist-cli/chunks/{chunk-ZADSXYX7.js → chunk-GMILMS7P.js} +2 -2
- package/dist-cli/chunks/{chunk-IJKBAKAA.js → chunk-HFA5ZACE.js} +21 -10
- package/dist-cli/chunks/{chunk-XRRW4YFF.js → chunk-HFKQUS4I.js} +3 -3
- package/dist-cli/chunks/{chunk-SMBMOSXY.js → chunk-INBBOCU4.js} +2 -2
- package/dist-cli/chunks/chunk-ITDTSNN2.js +4 -0
- package/dist-cli/chunks/{chunk-ZQLQVJUB.js → chunk-IWRRIQDJ.js} +2 -2
- package/dist-cli/chunks/{chunk-7F57RUPB.js → chunk-JDKWIB6V.js} +1 -1
- package/dist-cli/chunks/{chunk-XKUUILJ2.js → chunk-LRXSLMX4.js} +1 -1
- package/dist-cli/chunks/{chunk-H7J7U34H.js → chunk-M3ETYVNL.js} +1 -1
- package/dist-cli/chunks/{chunk-2AD7UVSQ.js → chunk-MSYPDBFG.js} +2 -2
- package/dist-cli/chunks/{chunk-LLCCT4VC.js → chunk-NXYKNKNL.js} +2 -2
- package/dist-cli/chunks/{chunk-NFC3BJMX.js → chunk-OSH6526H.js} +1 -1
- package/dist-cli/chunks/{chunk-HFHHYL3K.js → chunk-QWQHSUZC.js} +2 -2
- package/dist-cli/chunks/chunk-RJWQ3VAD.js +14 -0
- package/dist-cli/chunks/{chunk-VEOPRCNX.js → chunk-RQJDIDJ3.js} +1 -1
- package/dist-cli/chunks/{chunk-FNJ2IEDC.js → chunk-RT7TUHH7.js} +2 -2
- package/dist-cli/chunks/{chunk-W6XC5TUY.js → chunk-RYQUO6LT.js} +1 -1
- package/dist-cli/chunks/{chunk-N7ATA44P.js → chunk-SN6ARNCL.js} +2 -2
- package/dist-cli/chunks/{chunk-BJDIJYWM.js → chunk-SVFN66PF.js} +2 -2
- package/dist-cli/chunks/{chunk-5CWTAN4D.js → chunk-UB3OWUVK.js} +1 -1
- package/dist-cli/chunks/{chunk-D4BPRTTD.js → chunk-V6JDDX4B.js} +2 -2
- package/dist-cli/chunks/{chunk-RZLCDDE2.js → chunk-VUR5QXVX.js} +2 -2
- package/dist-cli/chunks/{chunk-BVUQ2PVZ.js → chunk-W3CSYOSQ.js} +1 -1
- package/dist-cli/chunks/{chunk-7UIDSSWQ.js → chunk-WNDYTKLC.js} +1 -1
- package/dist-cli/chunks/{chunk-2ELPPBLQ.js → chunk-XCVSB47R.js} +2 -2
- package/dist-cli/chunks/{chunk-C36FJ7OB.js → chunk-XHYSASAX.js} +1 -1
- package/dist-cli/chunks/{chunk-HNYGEEPF.js → chunk-XXS4TCOO.js} +3 -3
- package/dist-cli/chunks/{chunk-OOP74SPV.js → chunk-Y5YM7XHU.js} +1 -1
- package/dist-cli/chunks/{chunk-UJ7P2CWC.js → chunk-YAV6BH3A.js} +2 -2
- package/dist-cli/chunks/{chunk-AHPEOPNQ.js → chunk-YXHO2OUL.js} +1 -1
- package/dist-cli/chunks/chunk-ZDRI2LUG.js +125 -0
- package/dist-cli/chunks/{chunk-REJQMXOG.js → chunk-ZONISYZ5.js} +1 -1
- package/dist-cli/chunks/{cleanup-QTLASIO7.js → cleanup-GCTEGJMP.js} +2 -2
- package/dist-cli/chunks/{cli-version-EUG2MGT7.js → cli-version-G72HUH4E.js} +2 -2
- package/dist-cli/chunks/{compat-DA2Z6HOU.js → compat-IC4JHGBH.js} +2 -2
- package/dist-cli/chunks/{config-U65JAS2W.js → config-C65MZFU3.js} +2 -2
- package/dist-cli/chunks/{control-ZCFRXISU.js → control-RWLYBKQR.js} +2 -2
- package/dist-cli/chunks/daemon-D77E5G6Z.js +4 -0
- package/dist-cli/chunks/{debug-OXP67EDF.js → debug-LEL32PDN.js} +3 -3
- package/dist-cli/chunks/{desktop-ZEQXNFI2.js → desktop-RDSISJH2.js} +3 -3
- package/dist-cli/chunks/{detox-M4JBLH5P.js → detox-SCCWUIKK.js} +2 -2
- package/dist-cli/chunks/{device-ISL5YP5C.js → device-MTDEKDUK.js} +2 -2
- package/dist-cli/chunks/{diagnose-H2TRXSVS.js → diagnose-UZJCKLPZ.js} +2 -2
- package/dist-cli/chunks/disk-cleanup-HLWRVTVW.js +4 -0
- package/dist-cli/chunks/drivers-Q7GMKTBM.js +4 -0
- package/dist-cli/chunks/{film-LKYPZOJD.js → film-YBE544PG.js} +3 -3
- package/dist-cli/chunks/flow-5VOVAVZN.js +4 -0
- package/dist-cli/chunks/help-2PESJ7V2.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-JMWSVMJD.js → hidden-runtime-alias-KJYCJLSR.js} +2 -2
- package/dist-cli/chunks/{home-paths-S66AEW3L.js → home-paths-NSHWNEGK.js} +2 -2
- package/dist-cli/chunks/inspect-OIA3Q5MD.js +4 -0
- package/dist-cli/chunks/install-desktop-7KLACQUW.js +4 -0
- package/dist-cli/chunks/{login-EJEEYZGB.js → login-AEVUU72R.js} +4 -4
- package/dist-cli/chunks/{logout-QCEW2MME.js → logout-72XHF6J2.js} +2 -2
- package/dist-cli/chunks/{maestro-4IKBKIUF.js → maestro-OXSKQJ6B.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-WSYSKMND.js → maestro-generate-AKZFORVJ.js} +3 -3
- package/dist-cli/chunks/{mode-KQ5VDMPP.js → mode-U6KRG2PE.js} +2 -2
- package/dist-cli/chunks/{optional-demo-registry-MMHEMCBJ.js → optional-demo-registry-L3VIWBI2.js} +2 -2
- package/dist-cli/chunks/{perf-LGZDBRUM.js → perf-KF2BJZIN.js} +2 -2
- package/dist-cli/chunks/{permissions-DA4JXY2N.js → permissions-TRJG4QAI.js} +2 -2
- package/dist-cli/chunks/{record-TPU2TOEU.js → record-TICJYZOA.js} +3 -3
- package/dist-cli/chunks/{report-issue-PPUNSEEQ.js → report-issue-OQPLBQMJ.js} +2 -2
- package/dist-cli/chunks/runtime-HDMLWNXW.js +4 -0
- package/dist-cli/chunks/screenshot-command-XLERKHVW.js +159 -0
- package/dist-cli/chunks/{screenshots-capture-AG2TIYLG.js → screenshots-capture-B6OORSD4.js} +2 -2
- package/dist-cli/chunks/{serve-C3WLV2OX.js → serve-5M7MIPWF.js} +2 -2
- package/dist-cli/chunks/{setup-4KZKLDZV.js → setup-HJZDC4PK.js} +2 -2
- package/dist-cli/chunks/{skills-65XCNSNM.js → skills-RXHLMGGL.js} +2 -2
- package/dist-cli/chunks/{storage-ADWG4UT7.js → storage-MMPD2XBS.js} +2 -2
- package/dist-cli/chunks/store-APKY72ZY.js +4 -0
- package/dist-cli/chunks/telemetry-W3YRHE67.js +4 -0
- package/dist-cli/chunks/{timeline-BRHYLQTW.js → timeline-6PF5BZ37.js} +2 -2
- package/dist-cli/chunks/{upgrade-AEJNAP6O.js → upgrade-QSMIK3RC.js} +2 -2
- package/dist-cli/chunks/upload-HQEOYILQ.js +4 -0
- package/dist-cli/chunks/{version-HZWBK4KJ.js → version-WLTFXEDC.js} +2 -2
- package/dist-cli/chunks/{web-LCSSJCZ4.js → web-DI73LQ7N.js} +2 -2
- package/dist-cli/chunks/{what-happened-GWA24LHG.js → what-happened-4SAMGZWR.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 +17 -8
- 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 +58 -3
- package/dist-lib/sdk.cjs +18 -6
- package/dist-lib/sdk.mjs +18 -6
- package/dist-lib/skills.cjs +26 -12
- package/dist-lib/vite.cjs +1 -1
- package/package.json +2 -2
- package/scripts/dev-server-scanner.ts +95 -9
- package/skills/sootsim-debug/SKILL.md +6 -0
- package/skills/sootsim-setup/SKILL.md +38 -0
- package/src/attached-projects.ts +2 -2
- package/src/host/bridge-host.ts +2 -2
- package/src/runtime-assets.ts +1 -1
- package/src/runtime-delivery.ts +1 -1
- package/src/vite-plugin.ts +1 -1
- package/dist-cli/chunks/app-fonts-VPJDIM5M.js +0 -4
- package/dist-cli/chunks/chunk-5TWYZNIF.js +0 -125
- package/dist-cli/chunks/chunk-GRMK3BZY.js +0 -4
- package/dist-cli/chunks/chunk-I4NP3TJR.js +0 -12
- package/dist-cli/chunks/daemon-S25HJFIG.js +0 -4
- package/dist-cli/chunks/disk-cleanup-DY6JAHH3.js +0 -4
- package/dist-cli/chunks/drivers-EE4LTPSZ.js +0 -4
- package/dist-cli/chunks/flow-WGICJ5KS.js +0 -4
- package/dist-cli/chunks/help-YQ63GAW6.js +0 -4
- package/dist-cli/chunks/inspect-VKVWW64M.js +0 -4
- package/dist-cli/chunks/install-desktop-CH27FTQI.js +0 -4
- package/dist-cli/chunks/runtime-7MZZR6SC.js +0 -4
- package/dist-cli/chunks/screenshot-command-2YSWGL4X.js +0 -156
- package/dist-cli/chunks/store-FEQIGIYH.js +0 -4
- package/dist-cli/chunks/telemetry-KBOJKIRS.js +0 -4
- package/dist-cli/chunks/upload-QKJRNNL3.js +0 -4
package/dist-cli/bin.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! sootsim v0.1.
|
|
2
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
3
3
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
4
4
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
5
|
-
import{a as w,b as g}from"./chunks/chunk-
|
|
5
|
+
import{a as w,b as g}from"./chunks/chunk-2MEUZOSD.js";import"./chunks/chunk-XHYSASAX.js";function b(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("multiple sims are connected:")||a.startsWith("saved sim ")||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}
|
|
6
6
|
`),process.exit(1)),t instanceof Error&&t.stack?process.stderr.write(`${t.stack}
|
|
7
7
|
`):process.stderr.write(`${a}
|
|
8
8
|
`),process.exit(1)}process.on("unhandledRejection",b);process.on("uncaughtException",b);var A=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,k=new Set(["desktop"]);function S(t){!A||!k.has(t)||(process.stderr.write(` sootsim ${t} isn't available in the standalone binary \u2014
|
|
9
9
|
it needs vite / electron / playwright from a project's node_modules.
|
|
10
10
|
run the npm package instead:
|
|
11
11
|
sootsim ${t}
|
|
12
|
-
`),process.exit(1))}var e=g(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:t}=await import("./chunks/hidden-runtime-alias-
|
|
13
|
-
`)}var f=!1;async function v(){if(!f&&(f=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:t}=await import("./chunks/disk-cleanup-
|
|
12
|
+
`),process.exit(1))}var e=g(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:t}=await import("./chunks/hidden-runtime-alias-KJYCJLSR.js");e=t(e)}var _=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker";if(!_){let{trackCliEvent:t}=await import("./chunks/telemetry-W3YRHE67.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-NSHWNEGK.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
|
|
13
|
+
`)}var f=!1;async function v(){if(!f&&(f=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:t}=await import("./chunks/disk-cleanup-HLWRVTVW.js");if(t())return;let{spawn:a}=await import("node:child_process"),s=["cleanup","--automatic-worker"],m=process.argv[1],d=A?a(process.execPath,s,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):m?a(process.execPath,[m,...s],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):a("sootsim",s,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});d.once("error",p=>{process.stderr.write(` SootSim automatic cleanup will retry on the next run: ${p.message}
|
|
14
14
|
`)}),d.unref()}catch(t){process.stderr.write(` SootSim automatic cleanup will retry on the next run: ${t instanceof Error?t.message:String(t)}
|
|
15
|
-
`)}}async function n(t){let{flushCliTelemetry:a}=await import("./chunks/telemetry-
|
|
15
|
+
`)}}async function n(t){let{flushCliTelemetry:a}=await import("./chunks/telemetry-W3YRHE67.js");await a(),await v(),process.exit(t)}if(e.version){let{getCliVersion:t}=await import("./chunks/cli-version-G72HUH4E.js"),{IS_BETA:a,BETA_LABEL:s}=await import("./chunks/beta-TOL55XPM.js"),m=a?` \xB7 ${s}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:d}=await import("./chunks/home-paths-NSHWNEGK.js"),p=d();console.log(p?`runtime v${p}`:"runtime not installed"),await n(0)}if(e.help&&!e.command){let{printHelp:t}=await import("./chunks/help-2PESJ7V2.js");t(),await n(0)}var o=e.globalFlags.port,c=e.verbose,u=e.globalFlags.device,l=e.globalFlags.theme,C=e.globalFlags.driver,O=e.globalFlags.headless===!0,h=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,i=h?["--sim",h,...e.commandArgs]:e.commandArgs;if(u||l){let{settingsStore:t}=await import("./chunks/store-APKY72ZY.js"),a={};u&&(a.deviceModel=u),l&&(a.colorScheme=l),t.apply(a)}if(!e.command&&e.commandArgs.length===0){let{runSetup:t,shouldRunSetupForBareCommand:a}=await import("./chunks/setup-HJZDC4PK.js");a()&&(await t(["--from-welcome"]),await n(0));let{printHelp:s}=await import("./chunks/help-2PESJ7V2.js");s(),await n(0)}var r=e.command??"";if(!r){if(e.commandArgs.length>0){let a=e.commandArgs.find(s=>!s.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${a}`),console.error(" run `sootsim --help` to see the full surface."),await n(1)}let{printHelp:t}=await import("./chunks/help-2PESJ7V2.js");t(),await n(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(r==="skill"){let{runSkill:s}=await import("./chunks/skills-RXHLMGGL.js");await s(e.commandArgs),await n(0)}let t=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="perf"||r==="wait",a=e.commandArgs.find(s=>!s.startsWith("-"));if(!(r==="shell"||r==="perf"))if(t&&!a){let{printGroupHelp:s}=await import("./chunks/help-2PESJ7V2.js");s(r)&&await n(0)}else{let{printCommandHelp:s}=await import("./chunks/help-2PESJ7V2.js");s(t&&a?a:r,{prefer:t&&a?"verb":"command",group:t&&a?r:void 0}),await n(0)}}S(r);if(w.has(r)){let{runInspect:t}=await import("./chunks/inspect-OIA3Q5MD.js");await t([r,...i],{port:o,verbose:c})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-OASKCPBX.js");await t(e.commandArgs);break}case"detox":{let{runDetox:t}=await import("./chunks/detox-SCCWUIKK.js");await t(e.commandArgs,{port:o,verbose:c});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-OXSKQJ6B.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"record":{let{runRecord:t}=await import("./chunks/record-TICJYZOA.js");await t(i,{port:o,verbose:c});break}case"film":{let{runFilm:t}=await import("./chunks/film-YBE544PG.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"storage":{let{runStorage:t}=await import("./chunks/storage-MMPD2XBS.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"perf":{let{runPerf:t}=await import("./chunks/perf-KF2BJZIN.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"screenshot":{let{runScreenshotCommand:t}=await import("./chunks/screenshot-command-XLERKHVW.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"mode":{let{runMode:t}=await import("./chunks/mode-U6KRG2PE.js");await t(i,{port:o,verbose:c});break}case"permissions":{let{runPermissions:t}=await import("./chunks/permissions-TRJG4QAI.js"),a=await t(i,{port:o,verbose:c});await n(a)}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-OIA3Q5MD.js");await t(i,{port:o,verbose:c});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-LEL32PDN.js");await t(i,{port:o,verbose:c});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-6PF5BZ37.js");await t(i,{port:o,verbose:c});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-4SAMGZWR.js");await t(i,{port:o,verbose:c});break}case"open":{let{runOpenCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"use":{let{runUseCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-MTDEKDUK.js");await t(i,{port:o});break}case"compat":{let{runCompat:t}=await import("./chunks/compat-IC4JHGBH.js");await t(e.commandArgs);break}case"report-issue":{let{runReportIssue:t}=await import("./chunks/report-issue-OQPLBQMJ.js"),a=await t(e.commandArgs);await n(a)}case"desktop":{let{runDesktop:t}=await import("./chunks/desktop-RDSISJH2.js");await t(e.commandArgs,{port:o,device:u,driver:C});break}case"login":{let{runLogin:t}=await import("./chunks/login-AEVUU72R.js");await t(e.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-72XHF6J2.js");await t();break}case"auth":{let{runAuth:t}=await import("./chunks/auth-XYYKD33F.js");await t(e.commandArgs);break}case"setup":{let{runSetup:t}=await import("./chunks/setup-HJZDC4PK.js");await t(e.commandArgs);break}case"serve":{let{runServe:t}=await import("./chunks/serve-5M7MIPWF.js");await t(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-D77E5G6Z.js");await t(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-HDMLWNXW.js");await t(e.commandArgs);break}case"upgrade":case"update":{let{runUpgrade:t}=await import("./chunks/upgrade-QSMIK3RC.js");await t(e.commandArgs);break}case"version":{let{runVersion:t}=await import("./chunks/version-WLTFXEDC.js");await t(e.commandArgs);break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-EK355OQM.js"),a=await t(e.commandArgs);await n(a)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-LCJJWHZE.js"),a=await t(e.commandArgs);await n(a)}case"skill":{let{runSkill:t}=await import("./chunks/skills-RXHLMGGL.js");await t(e.commandArgs);break}case"app-fonts":{let{runAppFonts:t}=await import("./chunks/app-fonts-LIPU2DLT.js");await t(e.commandArgs);break}case"config":{let{runConfig:t}=await import("./chunks/config-C65MZFU3.js");await t(e.commandArgs);break}case"cleanup":{let{runCleanup:t}=await import("./chunks/cleanup-GCTEGJMP.js"),a=await t(e.commandArgs);await n(a)}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),await n(1)}await v();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
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,n as k,o as D,p as x,q as g,r as O,s as C}from"./chunk-
|
|
4
|
+
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,n as k,o as D,p as x,q as g,r as O,s as C}from"./chunk-YAV6BH3A.js";import"./chunk-RYQUO6LT.js";import{c as $}from"./chunk-GF3LDVWF.js";import"./chunk-3UUHIHA6.js";import"./chunk-VUR5QXVX.js";import"./chunk-G4R7CPCY.js";import"./chunk-RT7TUHH7.js";import"./chunk-ABHNOM2C.js";import"./chunk-YXHO2OUL.js";import"./chunk-ZDRI2LUG.js";import{j as y}from"./chunk-7RFXZXKH.js";import"./chunk-ZONISYZ5.js";import"./chunk-OSH6526H.js";import"./chunk-XHYSASAX.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}
|
|
5
5
|
`),L(),2}}catch(r){if(r instanceof c)return process.stderr.write(`${r.message}
|
|
6
6
|
`),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]
|
|
7
7
|
`),2;let s=d.resolve(r);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{b as M}from"./chunk-
|
|
4
|
+
import{b as M}from"./chunk-RYQUO6LT.js";import"./chunk-XHYSASAX.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 C,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,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}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,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(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 o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
|
|
5
5
|
`)}catch{}}return{exited:a,on(s,o){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(o),()=>{e?.delete(o)}},request(s,o){if(f)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,y)=>{r.set(e,{resolve:l=>p(l),reject:y,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:o})})},notify(s,o){n({jsonrpc:"2.0",method:s,params:o})},async shutdown(s=1500){if(f)return;try{t.stdin.end()}catch{}let o=setTimeout(()=>{if(!f)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(o)}},kill(s="SIGTERM"){if(!f)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 C(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 f=t[u];f&&(r[f]=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>
|
|
6
6
|
--provider codex|claude --cwd <path>
|
|
7
7
|
--prompt-in <fifo> --events-out <fifo>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{k as p}from"./chunk-RJWQ3VAD.js";import"./chunk-M3ETYVNL.js";import"./chunk-RQJDIDJ3.js";import"./chunk-XHYSASAX.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,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import"./chunk-
|
|
4
|
+
import"./chunk-XHYSASAX.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(`
|
|
5
5
|
`).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}
|
|
6
6
|
`),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(" ")}
|
|
7
7
|
supported: ${Array.from(w).sort().join(", ")}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as t}from"./chunk-
|
|
4
|
+
import{a as t}from"./chunk-EXW6TH3O.js";import{d as s}from"./chunk-MSYPDBFG.js";import"./chunk-7RFXZXKH.js";import"./chunk-XHYSASAX.js";function i(){console.log(`
|
|
5
5
|
sootsim auth \u2014 inspect CLI auth
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a,b,c,d}from"./chunk-
|
|
4
|
+
import{a,b,c,d}from"./chunk-OSH6526H.js";import"./chunk-XHYSASAX.js";export{d as BETA_ASK_HEADLINE,b as BETA_LABEL,c as BETA_TAGLINE,a as IS_BETA};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{m as d}from"./chunk-
|
|
4
|
+
import{m as d}from"./chunk-NXYKNKNL.js";import"./chunk-HFA5ZACE.js";import{h as l,j as m,l as p}from"./chunk-V6JDDX4B.js";import"./chunk-ABHNOM2C.js";import"./chunk-YXHO2OUL.js";import"./chunk-7RFXZXKH.js";import"./chunk-XHYSASAX.js";function f(){console.log(`
|
|
5
5
|
sootsim do scan \u2014 inject a barcode scan
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
4
|
var p={"--help":{type:"boolean",short:"-h"},"--version":{type:"boolean",short:"-V"},"--verbose":{type:"boolean",short:"-v"},"--port":{type:"number",short:"-p"},"--device":{type:"string",short:"-d"},"--theme":{type:"string",short:"-t"},"--headless":{type:"boolean"},"--driver":{type:"string"},"--sim":{type:"string"},"--session":{type:"string"},"--tab":{type:"string"}},m=new Set(["list","describe","find","get","do","wait","network","logs","shell"]),d=new Set(["do","get","wait","shell","debug"]),b=new Set(["detox","maestro","record","film","storage","permissions","perf","screenshot","mode","inspect","debug","timeline","what-happened","shell","assert","device","open","list","use","claim","close","compat","report-issue","desktop","login","logout","auth","setup","serve","daemon","runtime","upgrade","update","version","skill","config","cleanup","app-fonts","agent-wrapper","agent",...m]);function u(c){let r=c.slice(2),e={command:null,commandArgs:[],globalFlags:{},help:!1,version:!1,verbose:!1},s=0;for(;s<r.length;){let o=r[s];if(o==="--"){e.commandArgs.push(...r.slice(s+1));break}let i=Object.entries(p).find(([a,t])=>a===o||t.short===o);if(i){let[a,t]=i,l=a.replace(/^--/,"");if(t.type==="boolean")e.globalFlags[l]=!0,s++;else{let n=r[s+1];if(n===void 0||n.startsWith("-")){console.error(` warning: ${o} requires a value`),s++;continue}if(t.type==="number"){let g=Number(n);if(Number.isNaN(g)){console.error(` warning: ${o} requires a number, got "${n}"`),s+=2;continue}e.globalFlags[l]=g}else e.globalFlags[l]=n;s+=2}continue}if(!e.command&&!o.startsWith("-")){let a=o.indexOf("-");if(a>0){let t=o.slice(0,a),l=o.slice(a+1);if(d.has(t)&&l.length>0){e.command=t;let n=r.slice(s+1);e.commandArgs=[l,...n[0]==="--"?n.slice(1):n];break}}if(b.has(o)){e.command=o;let t=r.slice(s+1);e.commandArgs=t[0]==="--"?t.slice(1):t;break}e.commandArgs=r.slice(s);break}e.commandArgs.push(o),s++}return e.help=!!e.globalFlags.help,e.version=!!e.globalFlags.version,e.verbose=!!e.globalFlags.verbose,e}export{m as a,u as b};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as de}from"./chunk-
|
|
4
|
+
import{a as de}from"./chunk-INBBOCU4.js";import{b as Et,c as Pt,l as At}from"./chunk-76OLOD2G.js";import{a as oe,b as D,c as A,d as Ie,e as ae,f as X,g as pe,h as ye,i as Ft,j as Ot,k as Te,l as Rt}from"./chunk-NXYKNKNL.js";import{A as wt,B as $t,C as xt,F as St,H as vt,J as ue,K as kt,Q as Le,a as ke,b as rt,c as it,d as at,e as lt,f as ct,g as dt,h as ut,i as pt,j as mt,k as Be,l as Ce,r as je,s as ft,t as gt,u as ge,v as yt,w as _e,x as qe,y as ht,z as bt}from"./chunk-HFA5ZACE.js";import{a as nt,f as _t,h as It,j as Tt,k as Mt,l as Nt,m as ce}from"./chunk-V6JDDX4B.js";import{a as ot}from"./chunk-2MEUZOSD.js";import{a as Q}from"./chunk-VUR5QXVX.js";import{c as st}from"./chunk-YXHO2OUL.js";import{c as Ae,e as De}from"./chunk-ZDRI2LUG.js";function We(e){return`(async () => {
|
|
5
5
|
const bridge = globalThis.SootSim && globalThis.SootSim.bridges && globalThis.SootSim.bridges.hotRemount
|
|
6
6
|
if (!bridge || typeof bridge.reloadExternalApp !== 'function') return false
|
|
7
7
|
await bridge.reloadExternalApp({ resetStorage: ${e?"true":"false"} })
|
|
@@ -459,7 +459,7 @@ import{a as de}from"./chunk-SMBMOSXY.js";import{b as Et,c as Pt,l as At}from"./c
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
return { strategy: 'none' }
|
|
462
|
-
})()`});if(!c||!("node"in c))return c;let l=c.node,f=l.absolutePosition.x+l.layout.width/2,p=l.absolutePosition.y+l.layout.height/2,h=c.screen??null,$=!!h&&(f<0||p<0||f>h.width||p>h.height);return{...c,cx:f,cy:p,...$?{offscreen:!0,screen:h}:{},target:{id:l.id,testID:l.testID,text:c.strategy==="text"?t:l.text,type:l.type}}}})}async function zt(e,t={args:[]}){let s=await it(e);if(D(t.args)){A(s);return}console.log(` nodes: ${s.nodes}`)}function ze(e,t){let s=e.indexOf(t);return s>=0&&s+1<e.length?e[s+1]:null}async function Xt(e){let{bridge:t,args:s,positional:i}=e,c=s.includes("--verbose")||s.includes("-v"),l=D(s),f=c&&!l,p=s.includes("--watch")||s.includes("-w"),h=1e3,$=s.includes("--compact"),b=s.includes("--no-xy"),k=s.includes("--no-clipped"),N=s.includes("--include-occluded"),M=ze(s,"--testid-like"),j=ze(s,"--only"),O=ze(s,"--subtree"),d=i[1]&&!i[1].startsWith("-")?i[1]:void 0,q=d?/[*?]/.test(d):!1,R=!q&&!j?d:void 0,P=j??(q?d:void 0),J=async()=>{await pe(t,{verbose:f});let _=await ct(t,{describe:!0,verbose:c,filter:R||"",testIdLike:M||void 0,onlyGlob:P||void 0,subtreeRoot:O||void 0,compact:$,hideXy:b,includeOccluded:N}),F=_?.tree,H=_?.shell,K=_?.keyboard;if(l){A({shell:H,tree:F??"",keyboard:K});return}if(H&&typeof H=="object"){let C=[H.state?`state=${H.state}`:null,H.activeApp?`app=${H.activeApp}`:null,H.showSwitcher?"switcher":null,H.switcherPhase&&H.switcherPhase!=="idle"?`phase=${H.switcherPhase}`:null].filter(Boolean);C.length>0&&console.log(` shell: ${C.join(" ")}`)}if(typeof F=="string"&&F.startsWith("__SUBTREE_NOT_FOUND__:")){let C=F.slice(22);console.log(` subtree root not found: ${C}`),Q("subtree-root-not-found",C);return}if(!F){let C=_?.nodeCount??0;console.log(" no matching nodes found"),!(R||M||P||O)&&C<10&&Q("app-still-loading",C);return}let ee=F,te=0;if(k&&typeof ee=="string"){let C=ee.split(`
|
|
462
|
+
})()`});if(!c||!("node"in c))return c;let l=c.node,f=l.absolutePosition.x+l.layout.width/2,p=l.absolutePosition.y+l.layout.height/2,h=c.screen??null,$=!!h&&(f<0||p<0||f>h.width||p>h.height);return{...c,cx:f,cy:p,...$?{offscreen:!0,screen:h}:{},target:{id:l.id,testID:l.testID,text:c.strategy==="text"?t:l.text,type:l.type}}}})}async function zt(e,t={args:[]}){let s=await it(e);if(D(t.args)){A(s);return}console.log(` nodes: ${s.nodes}`)}function ze(e,t){let s=e.indexOf(t);return s>=0&&s+1<e.length?e[s+1]:null}async function Xt(e){let{bridge:t,args:s,positional:i}=e,c=s.includes("--verbose")||s.includes("-v"),l=D(s),f=c&&!l,p=s.includes("--watch")||s.includes("-w"),h=1e3,$=s.includes("--compact"),b=s.includes("--no-xy"),k=s.includes("--no-clipped"),N=s.includes("--include-occluded"),M=ze(s,"--testid-like"),j=ze(s,"--only"),O=ze(s,"--subtree"),d=i[1]&&!i[1].startsWith("-")?i[1]:void 0,q=d?/[*?]/.test(d):!1,R=!q&&!j?d:void 0,P=j??(q?d:void 0),J=async()=>{await pe(t,{verbose:f});let _=await ct(t,{describe:!0,verbose:c,filter:R||"",testIdLike:M||void 0,onlyGlob:P||void 0,subtreeRoot:O||void 0,compact:$,hideXy:b,includeOccluded:N,fullText:l}),F=_?.tree,H=_?.shell,K=_?.keyboard;if(l){A({shell:H,tree:F??"",keyboard:K});return}if(H&&typeof H=="object"){let C=[H.state?`state=${H.state}`:null,H.activeApp?`app=${H.activeApp}`:null,H.showSwitcher?"switcher":null,H.switcherPhase&&H.switcherPhase!=="idle"?`phase=${H.switcherPhase}`:null].filter(Boolean);C.length>0&&console.log(` shell: ${C.join(" ")}`)}if(typeof F=="string"&&F.startsWith("__SUBTREE_NOT_FOUND__:")){let C=F.slice(22);console.log(` subtree root not found: ${C}`),Q("subtree-root-not-found",C);return}if(!F){let C=_?.nodeCount??0;console.log(" no matching nodes found"),!(R||M||P||O)&&C<10&&Q("app-still-loading",C);return}let ee=F,te=0;if(k&&typeof ee=="string"){let C=ee.split(`
|
|
463
463
|
`),le=[];for(let Se of C){if(Se.includes("(clipped:")){te+=1;continue}le.push(Se)}ee=le.join(`
|
|
464
464
|
`)}console.log(ee),te>0&&console.log(` ${te} clipped row(s) hidden (omit --no-clipped to see)`);let ie=R||M||P||O;if((R||M||P)&&!p&&Q("describe-filter-context"),!ie&&!p&&F.split(`
|
|
465
465
|
`).length>=80&&Q("describe-use-filters"),K&&K.visible){let C=K.spec,le=[C?.keyboardType?`type=${C.keyboardType}`:null,C?.returnKeyType&&C.returnKeyType!=="default"?`return=${C.returnKeyType}`:null,K.mode!=="letters"?`mode=${K.mode}`:null,K.shifted?"shift":null,K.capsLock?"caps":null,C?.autoCapitalize&&C.autoCapitalize!=="sentences"?`autoCap=${C.autoCapitalize}`:null,K.accessoryBarId?`accessory=${K.accessoryBarId}`:null].filter(Boolean);console.log(`
|
|
@@ -469,7 +469,7 @@ import{a as de}from"./chunk-SMBMOSXY.js";import{b as Et,c as Pt,l as At}from"./c
|
|
|
469
469
|
`)}async function Qt(e){let{bridge:t,args:s}=e,i=D(s);await pe(t,{verbose:!i});let c=s.includes("--styling"),l=s.indexOf("--filter"),f=l>=0?s[l+1]:void 0,p=await dt(t,{styling:c,filter:f});if(i){A({count:p.length,elements:p});return}console.log(` layout (${p.length} element${p.length===1?"":"s"}):
|
|
470
470
|
`),console.log(ut(p,{styling:c}))}async function Zt(e,t={}){let s=await vt(e);if("error"in s&&(console.error(s.error),process.exit(1)),t.json){console.log(JSON.stringify(s,null,2));return}let{visible:i,spec:c,mode:l,shifted:f,capsLock:p,accessoryBarId:h}=s,$=[];$.push(`keyboard: ${i?"visible":"hidden"}`),c?($.push(` type: ${c.keyboardType}`),$.push(` returnKey: ${c.returnKeyType}`),$.push(` autoCap: ${c.autoCapitalize}`),$.push(` autoCorrect: ${c.autoCorrect?"on":"off"}`),$.push(` appearance: ${c.keyboardAppearance}`),c.secureTextEntry&&$.push(" secureTextEntry: true"),c.enablesReturnKeyAutomatically&&$.push(` return: ${c.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):$.push(" spec: <none> (shown via dev-tools with no TextInput)"),$.push(` mode: ${l}${f?" (shifted)":""}${p?" (caps)":""}`),h&&$.push(` accessoryBar: ${h}`),console.log($.join(`
|
|
471
471
|
`))}async function eo(e){let t=await e.bridge.listSims(),s=e.args.includes("--all"),i=e.args.find((p,h)=>e.args[h-1]==="--bundle"),c=e.args.find((p,h)=>e.args[h-1]==="--app-port"),l=e.args.includes("--primary"),f=t.filter(p=>!(l&&!p.isPrimary||i&&!(p.url??"").includes(i)||c&&!(p.url??"").includes(`/rn/${c}`)||!s&&!i&&!c&&!l&&!(p.url&&(p.url.includes("bundle=")||p.url.includes("/index.bundle")))&&p.id!==e.simId));if(D(e.args)){A(f.map(p=>({...p,active:p.id===e.simId})));return}At(f,e.simId),f.length<t.length&&!D(e.args)&&console.log(` (${t.length-f.length} more hidden \u2014 pass --all to show)`)}function re(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function is(e,t){return t<=0?"?":`${(e/t*100).toFixed(0)}%`}function as(e){let t={},s=(i,c)=>{c&&(c.nodesRegistered!=null&&(t[`${i}.nodes`]=c.nodesRegistered),c.nodesDetached!=null&&(t[`${i}.detached`]=c.nodesDetached),c.objects&&(t[`${i}.paragraphs`]=c.objects.paragraphs,t[`${i}.yogaNodes`]=c.objects.yogaNodes,t[`${i}.pictures`]=c.objects.pictures,t[`${i}.rasterImages`]=c.objects.rasterImages),c.imageLoader&&(t[`${i}.imageCacheEntries`]=c.imageLoader.cacheEntries,t[`${i}.imagePixelBytes`]=c.imageLoader.cachePixelBytes),c.workerHeap&&(t[`${i}.heapBytes`]=c.workerHeap.usedJSHeapSize),c.wasmHeapBytes!=null&&(t[`${i}.wasmHeapBytes`]=c.wasmHeapBytes))};return s("tenant",e.tenant),s("shell",e.shell),s("compositor",e.compositor),e.hostHeap&&(t["host.heapBytes"]=e.hostHeap.usedJSHeapSize),t}function to(e,t){return e.endsWith("Bytes")?re(t):String(t)}function Ve(e,t){if(!t){console.log(` ${e}: not available`);return}let s=t.objects;if(console.log(` ${e}`),t.nodesRegistered!=null&&console.log(` nodes registered: ${t.nodesRegistered}`),t.nodesDetached!=null){let i=Object.entries(t.detachedTypes??{}).map(([c,l])=>`${c}:${l}`).join(" ");console.log(` nodes detached: ${t.nodesDetached}${i?` (${i})`:""}`)}if(s&&(console.log(` paragraphs: ${s.paragraphs}`),console.log(` yoga nodes: ${s.yogaNodes}`),console.log(` pictures: ${s.pictures}`),console.log(` raster images: ${s.rasterImages}`)),t.activeNativeAnimations!=null&&console.log(` native anims: ${t.activeNativeAnimations}`),t.imageLoader){let i=t.imageLoader;console.log(` image cache: ${i.cacheEntries}/${i.cacheMaxEntries} entries, ${re(i.cachePixelBytes)}/${re(i.cachePixelBudget)} (${is(i.cachePixelBytes,i.cachePixelBudget)})`)}t.workerHeap&&console.log(` js heap: ${re(t.workerHeap.usedJSHeapSize)} used / ${re(t.workerHeap.totalJSHeapSize)} total`),t.wasmHeapBytes!=null&&console.log(` canvaskit wasm: ${re(t.wasmHeapBytes)}`)}function ls(e){console.log(" memory:"),Ve("tenant worker",e.tenant),Ve("shell worker",e.shell),Ve("compositor worker",e.compositor),e.hostHeap?(console.log(" host"),console.log(` js heap: ${re(e.hostHeap.usedJSHeapSize)} used / ${re(e.hostHeap.totalJSHeapSize)} total`)):console.log(" host js heap: not available (chrome only)")}function cs(e,t,s){let i=e.indexOf(t);if(i===-1)return s;let c=Number(e[i+1]);return Number.isFinite(c)&&c>0?c:s}async function oo(e,t={args:[]}){let s=D(t.args),i=t.args.indexOf("--watch");if(i===-1){let O=await Le(e);if(s){A(O);return}ls(O);return}let c=Number(t.args[i+1]),l=Number.isFinite(c)&&c>0?c:60,f=cs(t.args,"--interval",5),p=[],h=Date.now(),$=null;for(s||console.log(` sampling every ${f}s for ${l}s \u2014 deltas per tick:`);;){let O=await Le(e),d=(Date.now()-h)/1e3,q=as(O);if(p.push({tSec:d,counters:q}),!s){let R=[];for(let[P,J]of Object.entries(q)){let U=$&&P in $?J-$[P]:null;if(U===null||U===0)continue;let _=U>0?"+":"-",F=P.endsWith("Bytes")?`${_}${re(Math.abs(U))}`:`${_}${Math.abs(U)}`;R.push(`${P} ${to(P,J)} (${F})`)}console.log(` t+${d.toFixed(0)}s ${R.length?R.join(" "):$?"no change":Object.entries(q).map(([P,J])=>`${P} ${to(P,J)}`).join(" ")}`)}if($=q,d>=l)break;await new Promise(R=>setTimeout(R,f*1e3))}let b=p[0],k=p[p.length-1],N=Math.max(k.tSec-b.tSec,.001),M={};for(let O of Object.keys(k.counters))O in b.counters&&(M[O]=(k.counters[O]-b.counters[O])/N);if(s){A({samples:p,perSecond:M,elapsedSec:N});return}console.log(`
|
|
472
|
-
slope over ${N.toFixed(0)}s:`);let j=Object.entries(M).filter(([,O])=>O!==0).sort((O,d)=>Math.abs(d[1])-Math.abs(O[1]));if(j.length===0){console.log(" all counters flat");return}for(let[O,d]of j){let q=O.endsWith("Bytes")?`${re(Math.abs(d))}/s${d<0?" (shrinking)":""}`:`${d>0?"+":""}${d.toFixed(2)}/s`;console.log(` ${O.padEnd(28)}${q}`)}}var Z="<redacted secure text>";function we(e){let t=e?.layout?.spec??e?.spec??null;return!!t?.secureTextEntry&&t.keyboardType!=="visible-password"}function Qe(e,t){return we(t)?Z:e}function Ze(e){if(!e||!we(e))return e;let t=e.focusedInput;return!t||typeof t!="object"?e:{...e,focusedInput:{...t,secureTextEntry:!0,text:typeof t.text=="string"?Z:t.text}}}function $e(e){let
|
|
472
|
+
slope over ${N.toFixed(0)}s:`);let j=Object.entries(M).filter(([,O])=>O!==0).sort((O,d)=>Math.abs(d[1])-Math.abs(O[1]));if(j.length===0){console.log(" all counters flat");return}for(let[O,d]of j){let q=O.endsWith("Bytes")?`${re(Math.abs(d))}/s${d<0?" (shrinking)":""}`:`${d>0?"+":""}${d.toFixed(2)}/s`;console.log(` ${O.padEnd(28)}${q}`)}}var Z="<redacted secure text>";function we(e){let t=e?.layout?.spec??e?.spec??null;return!!t?.secureTextEntry&&t.keyboardType!=="visible-password"}function Qe(e,t){return we(t)?Z:e}function Ze(e){if(!e||!we(e))return e;let t=e.focusedInput;return!t||typeof t!="object"?e:{...e,focusedInput:{...t,secureTextEntry:!0,text:typeof t.text=="string"?Z:t.text}}}function $e(e,t){let s=e.indexOf("--testid");if(s>=0&&e[s+1])return{mode:"testid",value:e[s+1]};let i=e.indexOf("--test-id");if(i>=0&&e[i+1])return{mode:"testid",value:e[i+1]};let c=e.indexOf("--text");if(c>=0&&e[c+1])return{mode:"text",value:e[c+1]};let l=t?.[1];return l&&!l.startsWith("-")&&!Number.isFinite(Number(l))?{mode:"testid",value:l}:null}async function Oe(e,t){let s=JSON.stringify(t.value),i=t.mode==="testid"?`(await t.findByTestId(${s})) || (await t.findById(${s}))`:`await t.findByText(${s})`;return await e.send({type:"evaluate",code:`(async () => {
|
|
473
473
|
const t = window.__sootsimTest
|
|
474
474
|
if (!t) return null
|
|
475
475
|
const n = ${i}
|
|
@@ -590,7 +590,7 @@ import{a as de}from"./chunk-SMBMOSXY.js";import{b as Et,c as Pt,l as At}from"./c
|
|
|
590
590
|
`);console.log(`${o??""}
|
|
591
591
|
|
|
592
592
|
${n}
|
|
593
|
-
`),process.exit(0)}let N=c.wsPort,M=c.simId,j=c.simIdSource,O=c.commandTimeoutMs;if(p==="get"&&f==="diagnosis"){let x=i.indexOf("diagnosis"),o=x>=0?[...i.slice(0,x),...i.slice(x+1)]:i,{runDiagnose:n}=await import("./diagnose-
|
|
593
|
+
`),process.exit(0)}let N=c.wsPort,M=c.simId,j=c.simIdSource,O=c.commandTimeoutMs;if(p==="get"&&f==="diagnosis"){let x=i.indexOf("diagnosis"),o=x>=0?[...i.slice(0,x),...i.slice(x+1)]:i,{runDiagnose:n}=await import("./diagnose-UZJCKLPZ.js"),r=await n(["recent",...o],t);process.exitCode=r;return}if(p==="do"&&f==="scan"){let{runCamera:x}=await import("./camera-PHKVEQHR.js");await x(i,{port:t.port});return}if(f==="list"&&i.some(x=>x==="--drivers"||x==="-D")){let{buildDriverListRows:x}=await import("./drivers-Q7GMKTBM.js"),o=x();console.log(` available drivers (${o.length}):
|
|
594
594
|
`);let n=Math.max(...o.map(a=>a.id.length),6),r=Math.max(...o.map(a=>a.kind.length),4);for(let a of o){let u=a.available?"\u2713":"\u2717",m=a.id.padEnd(n),g=a.kind.padEnd(r);console.log(` ${u} ${m} ${g} ${a.description}`),a.available&&a.detail?console.log(` ${a.detail}`):!a.available&&a.reason&&console.log(` unavailable: ${a.reason}`)}return}let d=Tt(c),q=M||"default",R=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),P=200;function J(x){let o=x.replace(/\s+/g," ").trim();if(!o)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(o)){let r=/<title[^>]*>([^<]+)<\/title>/i.exec(x)?.[1]?.trim(),a=/<body[^>]*>([\s\S]*?)<\//i.exec(x)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),u=r||a||"html error page";return`<html ${x.length}B> "${u}" (body elided \u2014 add --json for the full payload)`}return o.length<=P?o:`${o.slice(0,P)}\u2026 (+${o.length-P} more bytes)`}function U(x){let o=x.displayUrl||x.url;return x.status!=null?`${x.method} ${o} -> ${x.status}${x.statusText?` ${x.statusText}`:""}`:x.error?`${x.method} ${o} -> ${x.error}`:`${x.method} ${o}`}async function _(x){let o=fe()?400:200;try{let{settled:n,elapsed:r}=await se({bridge:x,maxMs:o,pollMs:32,stablePolls:2});n||process.stderr.write(` \u26A0 auto-wait timed out after ${r??o}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
|
|
595
595
|
`)}catch{}}function F(x,o){if(o.result?.reason==="offscreen"){let{x:n,y:r,screen:a}=o.result;console.error(` tap failed: ${x} resolved to (${Math.round(n)},${Math.round(r)}), outside the ${a?.width}x${a?.height} screen`),console.error(" the node exists but is scrolled out of view \u2014 scroll it on-screen first (sootsim do scroll / swipe), then tap.");return}console.error(` tap failed: ${x} stayed visible but did not receive a hittable press after ${o.attempts} attempt${o.attempts===1?"":"s"}`),o.result&&console.error(` last result: ${JSON.stringify(o.result)}`)}async function H(){try{return await d.send({type:"evaluate",code:`(() => ({
|
|
596
596
|
console: ${_e},
|
|
@@ -676,7 +676,7 @@ ${n}
|
|
|
676
676
|
transform,
|
|
677
677
|
parentChain,
|
|
678
678
|
}
|
|
679
|
-
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(l[1]),n=Number(l[2]),r=$e(e);if(r){let m=await be(d,{agent:fe(),textFallback:r.mode==="text"?r.value:void 0,resolve:async()=>{let y=await Oe(d,r);return y?{cx:y.x,cy:y.y,match:{id:r.mode==="testid"?r.value:y.id??null,testID:r.mode==="testid"?r.value:y.testID??null,text:r.mode==="text"?r.value:y.text??null,type:y.type??null},target:{id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}:null}}),g=m.payload;(!g||typeof g.cx!="number")&&(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),me(m.result)||(F(`${r.mode} "${r.value}"`,m),process.exit(1));let w=ko(g.cx,g.cy,m.result);w&&await W("inspect tap",w.step,w.summary),console.log(JSON.stringify({...m.attempts>1?{attempts:m.attempts}:{},...m.result},null,2));break}(!Number.isFinite(o)||!Number.isFinite(n))&&(console.error(k("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let a=await Kt(d,o,n),u=ko(o,n,a);u&&await W("inspect tap",u.step,u.summary),console.log(JSON.stringify(a,null,2));break}case"drag":case"swipe":{let o=Number(l[1]),n=Number(l[2]),r=Number(l[3]),a=Number(l[4]),u=f==="swipe"?10:12,m=f==="swipe"?8:16,g=l[5]?Number(l[5]):u,w=l[6]?Number(l[6]):m;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(g)||!Number.isFinite(w))&&(console.error(k(f,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let y=await d.send({type:"evaluate",code:`(async () => {
|
|
679
|
+
})()`});console.log(JSON.stringify(n,null,2));break}case"tap":{let o=Number(l[1]),n=Number(l[2]),r=$e(e,l);if(r){let m=await be(d,{agent:fe(),textFallback:r.mode==="text"?r.value:void 0,resolve:async()=>{let y=await Oe(d,r);return y?{cx:y.x,cy:y.y,match:{id:r.mode==="testid"?r.value:y.id??null,testID:r.mode==="testid"?r.value:y.testID??null,text:r.mode==="text"?r.value:y.text??null,type:y.type??null},target:{id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}:null}}),g=m.payload;(!g||typeof g.cx!="number")&&(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),me(m.result)||(F(`${r.mode} "${r.value}"`,m),process.exit(1));let w=ko(g.cx,g.cy,m.result);w&&await W("inspect tap",w.step,w.summary),console.log(JSON.stringify({...m.attempts>1?{attempts:m.attempts}:{},...m.result},null,2));break}(!Number.isFinite(o)||!Number.isFinite(n))&&(console.error(k("tap","<testid> | <x> <y> | --testid <id> | --text <t>")),process.exit(1));let a=await Kt(d,o,n),u=ko(o,n,a);u&&await W("inspect tap",u.step,u.summary),console.log(JSON.stringify(a,null,2));break}case"drag":case"swipe":{let o=Number(l[1]),n=Number(l[2]),r=Number(l[3]),a=Number(l[4]),u=f==="swipe"?10:12,m=f==="swipe"?8:16,g=l[5]?Number(l[5]):u,w=l[6]?Number(l[6]):m;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(g)||!Number.isFinite(w))&&(console.error(k(f,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let y=await d.send({type:"evaluate",code:`(async () => {
|
|
680
680
|
const interact = window.__sootsimInteract
|
|
681
681
|
if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
|
|
682
682
|
const value = await interact.drag(${o}, ${n}, ${r}, ${a}, ${Math.max(1,Math.round(g))}, ${Math.max(0,Math.round(w))})
|
|
@@ -701,7 +701,7 @@ ${n}
|
|
|
701
701
|
secureTextEntry: !!n.secureTextEntry,
|
|
702
702
|
placeholder: n.placeholder || null,
|
|
703
703
|
}
|
|
704
|
-
})()`});(!a||typeof a.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),a.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let u=await d.send({type:"tap",x:a.cx,y:a.cy,target:{id:a.id??o,testID:a.testID??o,text:null,type:a.type??null}}),m=a.secureTextEntry===!0,g=await Ss(d,1e3,{targetId:o,secureTextEntry:m});g.visible||(console.error(` keyboard did not open after tapping ${o}`),process.exit(1));let w=g.focusedInput;w&&(w.testID===o||w.id===o||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(o)} but focus is on ${JSON.stringify(w.testID??w.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await d.send({type:"keyboard",action:"type",text:n});let y=m||we(g),v=y?Z:Qe(n,g),L=y&&g.focusedInput?{...g.focusedInput,secureTextEntry:!0,text:typeof g.focusedInput.text=="string"?Z:g.focusedInput.text}:g.focusedInput??null;await W("inspect type-into",{tapOn:{id:o},inputText:v},v===Z?`type-into #${o} ${Z}`:`type-into #${o} ${JSON.stringify(n)}`),console.log(JSON.stringify({target:o,isTextInput:a.isTextInput,secureTextEntry:y,keyboardOpened:g.visible??u?.keyboardOpened??!1,focusedInput:L,typed:v},null,2));break}case"type":{let o=l.slice(1).join(" ");o||(console.error(k("type","<text>")),process.exit(1));let n=await Pe(d,"type");await d.send({type:"keyboard",action:"type",text:o});let r=Qe(o,n);await W("inspect type",{inputText:r},r===Z?`type ${Z}`:`type ${JSON.stringify(o)}`),console.log(r===Z?` typed: ${Z}`:` typed: ${JSON.stringify(o)}`);break}case"key":{let o=l[1];o||(console.error(k("key","<name>")),process.exit(1)),await Pe(d,"key"),await d.send({type:"keyboard",action:"press",text:o}),await W("inspect key",{pressKey:o},`key ${o}`),console.log(` pressed: ${o}`);break}case"key-sequence":{let o=l.slice(1);o.length===0&&(console.error(k("key-sequence","<key> [<key> ...]")),process.exit(1)),await Pe(d,"key-sequence");for(let n of o)await d.send({type:"keyboard",action:"press",text:n});await W("inspect key-sequence",{pressKey:o.join(" ")},`key-sequence ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"keycode":{let o=l.slice(1);o.length===0&&(console.error(k("keycode","<code> [<code> ...]")),process.exit(1));let n=o.map(a=>({code:a,key:vs(a)})),r=n.filter(a=>!a.key);r.length>0&&(console.error(` unsupported keycode(s): ${r.map(a=>a.code).join(", ")}`),process.exit(1)),await Pe(d,"keycode");for(let a of n)await d.send({type:"keyboard",action:"press",text:a.key});await W("inspect keycode",{pressKey:n.map(a=>a.key).join(" ")},`keycode ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"dispatch":{let o=l[1];o||(console.error(k("dispatch","<char>")),process.exit(1)),await d.send({type:"keyboard",action:"dispatchKey",text:o}),await W("inspect dispatch",{dispatchKey:o},`dispatch ${JSON.stringify(o)}`),console.log(` dispatched: ${o}`);break}case"dismiss":{await d.send({type:"keyboard",action:"dismiss"}),await W("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let o=Number(l[1]),n=Number(l[2]),r=$e(e);if(r){let g=await Oe(d,r);g||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=g.x,n=g.y}let a=l[3]?Number(l[3]):80;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(a))&&(console.error(k("double-tap","<x> <y> [gapMs] | --testid <id>")),process.exit(1));let u=Math.max(0,Math.round(a)),m=await d.send({type:"evaluate",code:`(async () => {
|
|
704
|
+
})()`});(!a||typeof a.cx!="number")&&(console.error(` not found: ${o}`),process.exit(1)),a.isTextInput||console.error(` warning: ${o} is not a text input (isTextInput: false)`);let u=await d.send({type:"tap",x:a.cx,y:a.cy,target:{id:a.id??o,testID:a.testID??o,text:null,type:a.type??null}}),m=a.secureTextEntry===!0,g=await Ss(d,1e3,{targetId:o,secureTextEntry:m});g.visible||(console.error(` keyboard did not open after tapping ${o}`),process.exit(1));let w=g.focusedInput;w&&(w.testID===o||w.id===o||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(o)} but focus is on ${JSON.stringify(w.testID??w.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await d.send({type:"keyboard",action:"type",text:n});let y=m||we(g),v=y?Z:Qe(n,g),L=y&&g.focusedInput?{...g.focusedInput,secureTextEntry:!0,text:typeof g.focusedInput.text=="string"?Z:g.focusedInput.text}:g.focusedInput??null;await W("inspect type-into",{tapOn:{id:o},inputText:v},v===Z?`type-into #${o} ${Z}`:`type-into #${o} ${JSON.stringify(n)}`),console.log(JSON.stringify({target:o,isTextInput:a.isTextInput,secureTextEntry:y,keyboardOpened:g.visible??u?.keyboardOpened??!1,focusedInput:L,typed:v},null,2));break}case"type":{let o=l.slice(1).join(" ");o||(console.error(k("type","<text>")),process.exit(1));let n=await Pe(d,"type");await d.send({type:"keyboard",action:"type",text:o});let r=Qe(o,n);await W("inspect type",{inputText:r},r===Z?`type ${Z}`:`type ${JSON.stringify(o)}`),console.log(r===Z?` typed: ${Z}`:` typed: ${JSON.stringify(o)}`);break}case"key":{let o=l[1];o||(console.error(k("key","<name>")),process.exit(1)),await Pe(d,"key"),await d.send({type:"keyboard",action:"press",text:o}),await W("inspect key",{pressKey:o},`key ${o}`),console.log(` pressed: ${o}`);break}case"key-sequence":{let o=l.slice(1);o.length===0&&(console.error(k("key-sequence","<key> [<key> ...]")),process.exit(1)),await Pe(d,"key-sequence");for(let n of o)await d.send({type:"keyboard",action:"press",text:n});await W("inspect key-sequence",{pressKey:o.join(" ")},`key-sequence ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"keycode":{let o=l.slice(1);o.length===0&&(console.error(k("keycode","<code> [<code> ...]")),process.exit(1));let n=o.map(a=>({code:a,key:vs(a)})),r=n.filter(a=>!a.key);r.length>0&&(console.error(` unsupported keycode(s): ${r.map(a=>a.code).join(", ")}`),process.exit(1)),await Pe(d,"keycode");for(let a of n)await d.send({type:"keyboard",action:"press",text:a.key});await W("inspect keycode",{pressKey:n.map(a=>a.key).join(" ")},`keycode ${o.join(" ")}`),console.log(` pressed: ${o.join(", ")}`);break}case"dispatch":{let o=l[1];o||(console.error(k("dispatch","<char>")),process.exit(1)),await d.send({type:"keyboard",action:"dispatchKey",text:o}),await W("inspect dispatch",{dispatchKey:o},`dispatch ${JSON.stringify(o)}`),console.log(` dispatched: ${o}`);break}case"dismiss":{await d.send({type:"keyboard",action:"dismiss"}),await W("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let o=Number(l[1]),n=Number(l[2]),r=$e(e,l);if(r){let g=await Oe(d,r);g||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=g.x,n=g.y}let a=l[3]?Number(l[3]):80;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(a))&&(console.error(k("double-tap","<testid> | <x> <y> [gapMs] | --testid <id>")),process.exit(1));let u=Math.max(0,Math.round(a)),m=await d.send({type:"evaluate",code:`(async () => {
|
|
705
705
|
const interact = window.__sootsimInteract
|
|
706
706
|
if (interact?.doubleTap) {
|
|
707
707
|
return {
|
|
@@ -724,7 +724,7 @@ ${n}
|
|
|
724
724
|
first,
|
|
725
725
|
second,
|
|
726
726
|
}
|
|
727
|
-
})()`});m?.ok&&await W("inspect double-tap",{doubleTapAtCoords:{x:o,y:n,gapMs:u}},`double-tap @${o},${n}`),console.log(JSON.stringify(m,null,2));break}case"long-press":{let o=Number(l[1]),n=Number(l[2]),r=$e(e),a=null;if(r){let y=await Oe(d,r);y||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=y.x,n=y.y,a={id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}let u=r?l[1]:l[3],m=u?Number(u):600;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(m))&&(console.error(k("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let g=Math.max(0,Math.round(m)),w=await d.send({type:"longPress",x:o,y:n,durationMs:g,target:a});w?.ok&&await W("inspect long-press",{tapAtCoords:{x:o,y:n}},`long-press @${o},${n}`),console.log(JSON.stringify(w,null,2));break}case"touch":{let o=l[1],n=Number(l[2]),r=Number(l[3]),a=l[4]?Number(l[4]):999,u=o==="down"?"touchDown":o==="move"?"touchMove":o==="up"?"touchUp":o==="cancel"?"touchCancel":null;u||(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),o!=="cancel"&&(!Number.isFinite(n)||!Number.isFinite(r))&&(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let m=o==="down"?"tap":o==="move"?"move":null,g=m&&Number.isFinite(n)&&Number.isFinite(r)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${m}', x: ${n}, y: ${r} } }));`:"",w=await d.send({type:"evaluate",code:`(async () => {
|
|
727
|
+
})()`});m?.ok&&await W("inspect double-tap",{doubleTapAtCoords:{x:o,y:n,gapMs:u}},`double-tap @${o},${n}`),console.log(JSON.stringify(m,null,2));break}case"long-press":{let o=Number(l[1]),n=Number(l[2]),r=$e(e,l),a=null;if(r){let y=await Oe(d,r);y||(console.error(` not found: ${r.value}`),r.mode==="testid"&&Q("wait-selector-for-missing-testid",r.value),process.exit(1)),o=y.x,n=y.y,a={id:y.id??null,testID:y.testID??null,text:y.text??null,type:y.type??null}}let u=r?l[1]:l[3],m=u?Number(u):600;(!Number.isFinite(o)||!Number.isFinite(n)||!Number.isFinite(m))&&(console.error(k("long-press","<testid> | <x> <y> [durationMs] | --testid <id>")),process.exit(1));let g=Math.max(0,Math.round(m)),w=await d.send({type:"longPress",x:o,y:n,durationMs:g,target:a});w?.ok&&await W("inspect long-press",{tapAtCoords:{x:o,y:n}},`long-press @${o},${n}`),console.log(JSON.stringify(w,null,2));break}case"touch":{let o=l[1],n=Number(l[2]),r=Number(l[3]),a=l[4]?Number(l[4]):999,u=o==="down"?"touchDown":o==="move"?"touchMove":o==="up"?"touchUp":o==="cancel"?"touchCancel":null;u||(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),o!=="cancel"&&(!Number.isFinite(n)||!Number.isFinite(r))&&(console.error(k("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let m=o==="down"?"tap":o==="move"?"move":null,g=m&&Number.isFinite(n)&&Number.isFinite(r)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${m}', x: ${n}, y: ${r} } }));`:"",w=await d.send({type:"evaluate",code:`(async () => {
|
|
728
728
|
${g}
|
|
729
729
|
const interact = window.__sootsimInteract
|
|
730
730
|
if (!interact?.${u}) return { ok: false, reason: 'no interact.${u}' }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{H as t,L as n,N as l,j as r}from"./chunk-
|
|
4
|
+
import{H as t,L as n,N as l,j as r}from"./chunk-7RFXZXKH.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};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{b as C}from"./chunk-
|
|
4
|
+
import{b as C}from"./chunk-FNI75AD7.js";import{f as h}from"./chunk-A4UYZTV7.js";import{G as B,O as b,g as S}from"./chunk-7RFXZXKH.js";import a from"node:fs";import c from"node:path";var g=1,k=`automatic-cleanup-v${g}.json`,A=`automatic-cleanup-v${g}.lock`,P=360*60*1e3;function w(){let i=c.join(S(),k);try{return JSON.parse(a.readFileSync(i,"utf8")).generation===g}catch{return!1}}function N(i){if(i<1024)return`${i} B`;let e=["KiB","MiB","GiB","TiB"],n=i/1024,s=e[0];for(let r=1;r<e.length&&n>=1024;r++)n/=1024,s=e[r];return`${n.toFixed(n>=10?1:2)} ${s}`}function p(i){let e;try{e=a.lstatSync(i)}catch{return 0}let n=e.blocks>0?e.blocks*512:e.size;if(!e.isDirectory()||e.isSymbolicLink())return n;let s=n;try{for(let r of a.readdirSync(i))s+=p(c.join(i,r))}catch{}return s}function E(i){for(let e of["SingletonLock","SingletonSocket","lockfile"])try{if(a.lstatSync(c.join(i,e)))return!0}catch{}return!1}function v(i,e){let n;try{n=a.readdirSync(i,{withFileTypes:!0})}catch{return[]}let s=E(e),r=[];for(let t of n){if(!t.isDirectory()||t.isSymbolicLink())continue;let o=c.join(i,t.name);if(C(t.name)){r.push({path:o,bytes:p(o),kind:"browser-cache",state:s?"in-use":"safe",selected:!s,detail:s?"browser profile is open; close it before cleanup":"disposable browser HTTP, bytecode, or GPU cache"});continue}r.push(...v(o,e))}return r}function L(i){let e=c.join(i,"profiles","playwright"),n;try{n=a.readdirSync(e,{withFileTypes:!0})}catch{return[]}return n.flatMap(s=>{if(!s.isDirectory()||s.isSymbolicLink())return[];let r=c.join(e,s.name);return v(r,r)})}function R(i){let e=c.join(i,"electron","userData");return v(e,e)}function U(i,e){let n=c.join(i,"recordings"),s;try{s=a.readdirSync(n,{withFileTypes:!0})}catch{return[]}return s.map(r=>{let t=c.join(n,r.name);return{path:t,bytes:p(t),kind:"recording",state:"aggressive",selected:e,detail:"user-created recording or captured-frame output"}})}function x(i){let e=new Set(b()),n=[...e],s=h.planLocalRetention({retainVersions:2,protectVersions:n}),r=h.planLocalRetention({retainVersions:1,protectVersions:n}),t=new Set(s.removeVersions),o=new Set(r.removeVersions),l=new Set([...s.keepVersions,...s.removeVersions,...r.keepVersions,...r.removeVersions]),m=[];for(let u of[...l].sort()){let d=h.product.runtimeDir(u),y="retained",f="retained runtime";e.has(u)&&u!==s.activeVersion?(y="in-use",f="runtime is serving a connected simulator"):t.has(u)?(y="safe",f="inactive runtime outside the two-version rollback window"):o.has(u)?(y="aggressive",f="most recent rollback runtime"):u===s.activeVersion&&(f="active runtime; always protected"),m.push({path:d,bytes:p(d),kind:"runtime-version",state:y,selected:y==="safe"||y==="aggressive"&&i,detail:f})}for(let u of s.removeCacheFiles)m.push({path:u,bytes:p(u),kind:"runtime-archive",state:"safe",selected:!0,detail:"downloaded archive is unnecessary after successful extraction"});return{activeRuntime:s.activeVersion,entries:m}}function T(i={}){let e=i.aggressive===!0,n=S(),s=x(e),r=[...s.entries,...L(n),...R(n),...U(n,e)].sort((t,o)=>o.bytes-t.bytes||t.path.localeCompare(o.path));return{home:n,activeRuntime:s.activeRuntime,entries:r,reclaimableBytes:r.reduce((t,o)=>t+(o.selected?o.bytes:0),0),protectedBytes:r.reduce((t,o)=>t+(o.selected?0:o.bytes),0),totalBytes:p(n)}}function D(i,e){let n=c.relative(i,e);if(!n||n.startsWith("..")||c.isAbsolute(n))throw new Error(`refusing cleanup target outside the SootSim home: ${e}`)}function I(i={}){let e=T(i),n=i.aggressive===!0?1:2;h.pruneLocalRetention({retainVersions:n,protectVersions:b()});for(let t of e.entries)if(t.selected&&!(t.kind==="runtime-archive"||t.kind==="runtime-version")){if(t.kind==="browser-cache"){let l=c.relative(e.home,t.path).split(c.sep),m=l[0]==="profiles"&&l[1]==="playwright"&&l[2]?c.join(e.home,"profiles","playwright",l[2]):l[0]==="electron"&&l[1]==="userData"?c.join(e.home,"electron","userData"):null;if(m&&E(m)){t.state="in-use",t.selected=!1,t.detail="browser profile opened while cleanup was starting";continue}}D(e.home,t.path),a.rmSync(t.path,{recursive:!0,force:!0})}let s=e.entries.filter(t=>t.selected&&!a.existsSync(t.path)).map(t=>t.path),r=p(e.home);return{...e,removedPaths:s,reclaimedBytes:Math.max(0,e.totalBytes-r),remainingBytes:r}}function $(){B();let i=S(),e=c.join(i,k),n=c.join(i,A);if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let s=null;for(let r=0;r<2&&s===null;r++)try{let t=a.openSync(n,"wx");try{a.writeFileSync(t,`${JSON.stringify({pid:process.pid,startedAt:Date.now()})}
|
|
5
5
|
`,"utf8"),s=t}catch(o){a.closeSync(t);try{a.unlinkSync(n)}catch{}throw o}}catch(t){if((t instanceof Error&&"code"in t?t.code:null)!=="EEXIST")throw t;let l=0,m=0,u=null;try{u=a.lstatSync(n);let d=JSON.parse(a.readFileSync(n,"utf8"));l=typeof d.pid=="number"?d.pid:0,m=typeof d.startedAt=="number"?d.startedAt:0}catch{}if(l>0&&m>0&&Date.now()-m<P)try{return process.kill(l,0),{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0}}catch{}if(!u)continue;try{let d=a.lstatSync(n);if(d.dev!==u.dev||d.ino!==u.ino)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};a.unlinkSync(n)}catch{}}if(s===null)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};try{if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let r=I(),t=r.entries.reduce((l,m)=>l+(m.state==="in-use"?m.bytes:0),0);if(t>0)return{status:"deferred",reclaimedBytes:r.reclaimedBytes,remainingBytes:r.remainingBytes,deferredInUseBytes:t};let o=`${e}.${process.pid}.tmp`;return a.writeFileSync(o,`${JSON.stringify({generation:g,completedAt:Date.now(),reclaimedBytes:r.reclaimedBytes})}
|
|
6
6
|
`,"utf8"),a.renameSync(o,e),{status:"complete",reclaimedBytes:r.reclaimedBytes,remainingBytes:r.remainingBytes,deferredInUseBytes:0}}finally{a.closeSync(s);try{a.unlinkSync(n)}catch{}}}export{w as a,N as b,T as c,I as d,$ as e};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{a as Ne,b as q,c as de,d as ue,e as Fe,f as je,h as x,i as We,j as Ke}from"./chunk-I4NP3TJR.js";import{m as O}from"./chunk-LLCCT4VC.js";import{m as _e,p as Oe}from"./chunk-IJKBAKAA.js";import{b as He,l as he}from"./chunk-BJDIJYWM.js";import{a as B,b as pe}from"./chunk-7F57RUPB.js";import{a as Ge,b as Je}from"./chunk-UNDGU5PA.js";import{a as qe,b as z,c as ze}from"./chunk-GRMK3BZY.js";import{d as fe}from"./chunk-BVUQ2PVZ.js";import{a as Ve}from"./chunk-N7ATA44P.js";import{a as me}from"./chunk-VEOPRCNX.js";import{b as Be,c as De,d as ce,f as Ae,g as Le,h as M,i as v,j as E}from"./chunk-D4BPRTTD.js";import{f as Ee}from"./chunk-2BQCOQBK.js";import{b as le,d as Ue}from"./chunk-FNJ2IEDC.js";import{d as Te,e as T,f as b,g as _}from"./chunk-AHPEOPNQ.js";import{H as Re,K as ae,M as V,O as Me,l as ie}from"./chunk-UEFW7TPW.js";import{spawn as ot,spawnSync as nt}from"node:child_process";import U from"node:fs";import Ct from"node:os";import C from"node:path";import{WebSocket as Rt}from"ws";function Qe(e){return new Error(`could not resolve a native bundle for ${e}. pass an explicit bundle URL or open Connect and choose the app there.`)}function vt(e,o){return e?.includes("/one/metro-entry.bundle")?"one":typeof o=="string"&&o?"expo":"unknown"}function Ze(e,o,t){return`${e}//${o}:${t}`}function St(e){if(typeof window>"u")return!1;try{let o=new URL(e);return x(o.hostname)&&x(window.location.hostname)&&o.origin!==window.location.origin}catch{return!1}}async function Ye(e,o){let t={...o,cache:o?.cache??"no-store"};return St(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,t):fetch(e,t)}function $t(e){return e==="https:"?443:80}function xt(e){let o=e.pathname||"/";return(o==="/"||o==="")&&!e.search&&!e.hash}async function Pt(e){try{let o=await fetch("/__server-scan",{cache:"no-store"});if(!o.ok||!(o.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let t=await o.json();if(!Array.isArray(t))return null;let n=t.find(r=>!!r&&typeof r=="object"&&r.port===e&&typeof r.bundleUrl=="string");return n?{bundleUrl:ue(n.bundleUrl),port:e,framework:typeof n.framework=="string"?n.framework:"unknown",projectName:typeof n.projectName=="string"?n.projectName:void 0}:null}catch{return null}}async function Xe(e,o){let t=e.replace(/\/+$/,"");try{if(x(new URL(t).hostname)){let n=await Pt(o);if(n)return n}}catch{}try{let n=await Ye(`${t}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},i=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:ue(i||`${t}${de}`),port:o,framework:vt(i,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await Ye(`${t}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${t}${de}`,port:o,framework:"metro"}}catch{}return null}async function kt(e){return Xe(Ze("http:","localhost",e),e)}async function et(e){let o=e.trim();if(/^\d+$/.test(o)){let a=parseInt(o,10),l=await kt(a);if(l)return l;throw Qe(`localhost:${a}`)}let t=o.startsWith("http")?o:`http://${o}`,n;try{n=new URL(t)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):$t(r),i=Ze(r,n.hostname,s);if(xt(n)){let a=await Xe(i,s);if(a)return a;throw Qe(i)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function Po(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim desktop install"),console.error(""),console.error(" or run setup to install the background daemon:"),console.error(" sootsim setup"),console.error("")}function tt(e){let o=B();if(console.log(` note: no sootsim bridge detected on port ${e}`),o){console.log(" launch the installed companion with:"),console.log(" sootsim desktop");return}console.log(""),console.log(" run `sootsim setup` to install the background daemon,"),console.log(" or run `sootsim serve` in another shell for a foreground bridge.")}function It(e){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${e}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function ko(e,o,t){let n=[];try{n=await e.listSims()}catch{}if(console.error(""),n.length===0){It(o);return}console.error(` no sim with id "${t}" is connected to the bridge on port ${o}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState,r.userVisible===!1?"hidden":r.userVisible===!0?"visible":null,r.userFocused?"focused":null].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var Mt=12e4,rt=100,Et=5e3,st=1e4,Ut={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(e){return new Promise(o=>setTimeout(o,e))}function it(e){let o=process.env[e]?.trim();if(!o)return null;let t=Number(o);return Number.isInteger(t)&&t>0?t:null}function Tt(){let e=it("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??it("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??Mt;return{timeoutMs:e,hostTimeoutMs:e+Et,intervalMs:rt,attempts:Math.max(1,Math.ceil(e/rt))}}function _t(e){return e==="chromium"||e==="electron"||e==="playwright"||e==="system"}function Ot(e,o){return e.includes("--headless")?!0:e.includes("--headed")?!1:o==="playwright"&&process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY?(console.error(" no display detected \u2192 running playwright headless (override with --headed)"),!0):!1}function Q(e){return e.trim()}var dt=/^[A-Za-z][A-Za-z0-9+.-]*:/;function Bt(e){let o=e.trim();if(!o)throw new Error("expected <url-or-route>");return dt.test(o)||o.startsWith("/")?o:`/${o}`}function Dt(e){return e!==null&&typeof e=="object"}function At(e){let o=e.trim();return o?o.startsWith("/")?!0:dt.test(o)?!/^https?:\/\//i.test(o):!1:!1}async function Lt(e){if(await G(e,250))return e;let o=ae();if(o&&V(o)&&await G(o.bridgePort,500))return o.bridgePort;if(o&&V(o))throw new Error(`sootsim bridge lockfile is fresh (port ${o.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await Nt();let t=Ft(["serve","--quiet","--port",String(e)]),n=null;t.once("exit",(s,i)=>{n=String(s??i??"unknown")}),t.unref();let r=Date.now()+st;for(;Date.now()<r;){let s=ae();if(s&&V(s)&&await G(s.bridgePort,250))return console.error(` started local bridge on port ${s.bridgePort}; run \`sootsim setup\` to install the background daemon`),s.bridgePort;if(await G(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(n)throw new Error(`sootsim bridge exited before becoming ready (exit ${n})`);await $(150)}throw new Error(`sootsim bridge did not start within ${Math.round(st/1e3)}s`)}async function Nt(){let e=Re();if(e&&U.existsSync(ie(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:o}=await import("./runtime-7MZZR6SC.js");await o(["install"],{})}function Ft(e){let o=process.argv[1];return o&&U.existsSync(o)?ot(process.execPath,[o,...e],{detached:!0,stdio:"ignore",env:process.env}):ot("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function G(e,o){return new Promise(t=>{let n=new Rt(`ws://127.0.0.1:${e}`,{handshakeTimeout:o}),r=!1,s=i=>{if(!r){r=!0;try{n.close()}catch{}t(i)}};n.once("open",()=>s(!0)),n.once("error",()=>s(!1)),setTimeout(()=>s(!1),o)})}function be(e){try{let o=new URL(e),t=o.pathname.replace(/\/+$/,"")||"/";return o.searchParams.has("open")||o.searchParams.has("port")||o.searchParams.has("bundle")||o.searchParams.has("demo")||o.pathname.includes("/sootsim/index.html")||t==="/sootsim"||o.pathname==="/__soot"||o.pathname==="/__soot/"||t==="/rn"||/^\/rn\/[^/]+$/i.test(t)||/^\/app\/[^/]+$/i.test(t)||t==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(t)||/^\/__soot\/app\/[^/]+$/i.test(t)}catch{return!1}}function jt(e){try{let o=new URL(e,"http://sootsim.local");if(o.origin!=="http://sootsim.local")return!1;let t=o.pathname.replace(/\/+$/,"")||"/";return t==="/rn"||/^\/rn\/[^/]+$/i.test(t)||/^\/app\/[^/]+$/i.test(t)||t==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(t)||/^\/__soot\/app\/[^/]+$/i.test(t)}catch{return!1}}function Ht(e,o){let t=new URL(e,"http://sootsim.local"),n=new URL(o),r=Y(n.pathname),s=t.pathname.startsWith("/__soot/")?t.pathname.slice(7):t.pathname;return n.pathname=`${r}${s}`,n.search=t.search,n.hash=t.hash,n.toString()}function Wt(e){try{let o=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(o)||/^\/build\/.+/.test(o)}catch{return!1}}async function en(e){let o=Q(e);return(await ve(o)).bundleUrl}function Kt(e){try{let o=new URL(e.startsWith("http")?e:`http://${e}`),t=o.pathname||"/";if(t!=="/"&&t!==""||o.search||o.hash||!x(o.hostname))return null;let n=o.port?Number(o.port):o.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function ve(e){let o=Q(e),t=/^\d+$/.test(o)?Number(o):Kt(o);if(t&&t>0){let n=await je(t);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return et(o)}function Y(e){let o=e.replace(/\/+$/,"")||"/";return o==="/__soot"||o.startsWith("/__soot/")?"/__soot":""}function Vt(e,o){let t=Q(e),n=new URL(o),r=Y(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(t)?n.pathname=`${r}/rn/${t}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",t)),n.toString()}function ut(e){let o=Q(e);return/^\d+$/.test(o)||/^https?:\/\//i.test(o)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(o)}async function qt(e,o,t={}){let n=t.resolvedBundle??await ve(e),r=new URL(o),s=Y(r.pathname);r.pathname=`${s}/rn`,r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("demo"),r.searchParams.delete("app");let i=t.hot===void 0?n.bundleUrl:Fe(n.bundleUrl,t.hot);return r.searchParams.set("bundle",i),r.toString()}function zt(e){return e.startsWith("~/")?C.join(Ct.homedir(),e.slice(2)):C.isAbsolute(e)?e:C.resolve(process.cwd(),e)}function Gt(e){let o={},t={};for(let r=0;r<e.length;r++){if(e[r]==="--replace"){let s=e[r+1];s||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let i=s.indexOf("=");(i<=0||i===s.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let a=s.slice(0,i).trim(),l=zt(s.slice(i+1).trim());U.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),o[a]={file:l},r++;continue}if(e[r]==="--remap"){let s=e[r+1],i=s?s.indexOf("="):-1;(!s||i<=0||i===s.length-1)&&(console.error(" sootsim open: --remap expects <host:port>=<host:port>"),process.exit(1)),t[s.slice(0,i).trim()]=s.slice(i+1).trim(),r++;continue}}let n={};return Object.keys(o).length>0&&(n.modules=o),Object.keys(t).length>0&&(n.network={remap:t}),n.modules||n.network?n:void 0}async function Jt(e){if(e){let o=await z(e.bundleUrl);if(o)return me(o,{trustStart:!0})}return me(process.env.CONTRAST_REPO_DIR||process.cwd())}async function Qt(e){if(U.existsSync(C.join(ie(e),"index.html")))return;console.error(` installing configured engine runtime ${e}...`);let o=await Ee.install({version:e,setActive:!1,protectVersions:Me()});console.error(` installed engine runtime ${o.version}`)}function Yt(e,o){if(!o)return e;let t=new URL(e);if(!x(t.hostname))throw new Error(`runtimeVersion ${o} requires a local SootSim host; got ${t.origin}`);return t.hostname=Ke(o),t.toString()}function mt(){return Be().shellBaseUrl}async function Zt(e,o){try{let t=new URL(e),n=t.searchParams.get("bundle")||"";if(!n)return e;let r=o?.appDir??await z(n)??void 0,s=qe({bundleUrl:n,repoDir:r,exactProjectDir:!!o||!!r});if(s.length===0)return e;let i=await Xt(s);return i.length===0?e:(t.searchParams.set("appFonts",ze(i)),t.toString())}catch{return e}}async function Xt(e){let o=await Promise.all(e.map(async n=>{let r=new AbortController,s=setTimeout(()=>r.abort(),1500);try{let i=await fetch(n.url,{method:"HEAD",signal:r.signal});return i.status>=200&&i.status<400?n:null}catch{return null}finally{clearTimeout(s)}})),t=[];for(let n of o)n!==null&&t.push(n);return t}async function eo(e,o,t={}){if(!e)return new URL(o).toString();if(be(e))return new URL(e).toString();if(jt(e))return Ht(e,o);let n=Ut[e.toLowerCase()];if(n){let r=new URL(o),s=Y(r.pathname);return r.pathname=`${s}${n}`,r.toString()}return ut(e)?qt(e,o,t):Vt(e,o)}async function to(e,o){try{let t=new URL(e),n=t.searchParams.get("bundle")||"";if(!n)return e;let r=o?.appDir??await z(n)??void 0,s=Ge({bundleUrl:n,repoDir:r,exactProjectDir:!!o||!!r});return!s||s.imageUrl&&!await oo(s.imageUrl)?e:(t.searchParams.set("appSplash",Je(s)),t.toString())}catch{return e}}async function oo(e){let o=new AbortController,t=setTimeout(()=>o.abort(),1500);try{let n=await fetch(e,{method:"HEAD",signal:o.signal});return n.status>=200&&n.status<400}catch{return!1}finally{clearTimeout(t)}}async function J(e,o=mt(),t={}){let n=await eo(e,o,t),r=await to(await Zt(n,t.project),t.project);if(!t.device)return r;let s=new URL(r);return s.searchParams.set("device",t.device),s.toString()}function at(e,o){let t=e?.url||e?.origin||o;try{let n=new URL(t);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.searchParams.delete("appFonts"),n.searchParams.delete("appSplash"),n.toString()}catch{return o}}async function no(e,o,t,n={}){let r=new URL(await J(e,o,n));return r.searchParams.set("inspectOpen",t),r.toString()}async function ro(e,o,t,n={}){let r=n.attempts??30,s=n.intervalMs??500,i=n.minNodeCount??10;for(let a=0;a<r;a++){let l=v(e,{commandTimeoutMs:o,simId:t,simIdSource:"flag"});try{let d=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof d=="number"&&d>i)return{bridge:l,count:d}}catch{}l.close(),await $(s)}return null}function so(e){if(!e)return null;try{let o=new URL(e);if(o.searchParams.has("bundle")){let t=o.searchParams.get("bundle")||"";try{let n=new URL(t),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return o.searchParams.has("port")?`connect :${o.searchParams.get("port")||""}`:o.searchParams.has("open")?`connect ${o.searchParams.get("open")||""}`:o.searchParams.has("demo")?`demo ${o.searchParams.get("demo")||"default"}`:o.pathname.includes("/sootsim/index.html")||o.pathname==="/sootsim/"||o.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function io(e){let o=e.indexOf(":");if(o<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let t=e.slice(0,o),n=e.slice(o+1),r=n.length>12?`${n.slice(0,8)}\u2026`:n;return t==="TM_SESSION"||t==="CLAUDE_CODE_SESSION_ID"||t==="CODEX_THREAD_ID"?`agent ${r}`:`${t} ${r}`}function tn(e,o){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
|
|
4
|
+
import{a as x,b as We,c as Ke}from"./chunk-ITDTSNN2.js";import{m as O}from"./chunk-NXYKNKNL.js";import{m as _e,p as Oe}from"./chunk-HFA5ZACE.js";import{b as He,l as he}from"./chunk-SVFN66PF.js";import{a as B,b as pe}from"./chunk-JDKWIB6V.js";import{a as Ge,b as Je}from"./chunk-BPRMA4IC.js";import{a as Ne,b as q,c as de,d as ue,e as Fe,f as je,h as qe,i as z,j as ze}from"./chunk-RJWQ3VAD.js";import{d as fe}from"./chunk-W3CSYOSQ.js";import{a as Ve}from"./chunk-SN6ARNCL.js";import{a as me}from"./chunk-RQJDIDJ3.js";import{b as Be,c as De,d as ce,f as Ae,g as Le,h as M,i as v,j as E}from"./chunk-V6JDDX4B.js";import{f as Ee}from"./chunk-A4UYZTV7.js";import{b as le,d as Ue}from"./chunk-RT7TUHH7.js";import{d as Te,e as T,f as b,g as _}from"./chunk-YXHO2OUL.js";import{H as Re,K as ae,M as V,O as Me,l as ie}from"./chunk-7RFXZXKH.js";import{spawn as ot,spawnSync as nt}from"node:child_process";import U from"node:fs";import Ct from"node:os";import C from"node:path";import{WebSocket as Rt}from"ws";function Qe(e){return new Error(`could not resolve a native bundle for ${e}. pass an explicit bundle URL or open Connect and choose the app there.`)}function vt(e,o){return e?.includes("/one/metro-entry.bundle")?"one":typeof o=="string"&&o?"expo":"unknown"}function Ze(e,o,t){return`${e}//${o}:${t}`}function St(e){if(typeof window>"u")return!1;try{let o=new URL(e);return x(o.hostname)&&x(window.location.hostname)&&o.origin!==window.location.origin}catch{return!1}}async function Ye(e,o){let t={...o,cache:o?.cache??"no-store"};return St(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,t):fetch(e,t)}function $t(e){return e==="https:"?443:80}function xt(e){let o=e.pathname||"/";return(o==="/"||o==="")&&!e.search&&!e.hash}async function Pt(e){try{let o=await fetch("/__server-scan",{cache:"no-store"});if(!o.ok||!(o.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let t=await o.json();if(!Array.isArray(t))return null;let n=t.find(r=>!!r&&typeof r=="object"&&r.port===e&&typeof r.bundleUrl=="string");return n?{bundleUrl:ue(n.bundleUrl),port:e,framework:typeof n.framework=="string"?n.framework:"unknown",projectName:typeof n.projectName=="string"?n.projectName:void 0}:null}catch{return null}}async function Xe(e,o){let t=e.replace(/\/+$/,"");try{if(x(new URL(t).hostname)){let n=await Pt(o);if(n)return n}}catch{}try{let n=await Ye(`${t}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},i=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:ue(i||`${t}${de}`),port:o,framework:vt(i,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await Ye(`${t}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${t}${de}`,port:o,framework:"metro"}}catch{}return null}async function kt(e){return Xe(Ze("http:","localhost",e),e)}async function et(e){let o=e.trim();if(/^\d+$/.test(o)){let a=parseInt(o,10),l=await kt(a);if(l)return l;throw Qe(`localhost:${a}`)}let t=o.startsWith("http")?o:`http://${o}`,n;try{n=new URL(t)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):$t(r),i=Ze(r,n.hostname,s);if(xt(n)){let a=await Xe(i,s);if(a)return a;throw Qe(i)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function Po(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim desktop install"),console.error(""),console.error(" or run setup to install the background daemon:"),console.error(" sootsim setup"),console.error("")}function tt(e){let o=B();if(console.log(` note: no sootsim bridge detected on port ${e}`),o){console.log(" launch the installed companion with:"),console.log(" sootsim desktop");return}console.log(""),console.log(" run `sootsim setup` to install the background daemon,"),console.log(" or run `sootsim serve` in another shell for a foreground bridge.")}function It(e){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${e}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function ko(e,o,t){let n=[];try{n=await e.listSims()}catch{}if(console.error(""),n.length===0){It(o);return}console.error(` no sim with id "${t}" is connected to the bridge on port ${o}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState,r.userVisible===!1?"hidden":r.userVisible===!0?"visible":null,r.userFocused?"focused":null].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var Mt=12e4,rt=100,Et=5e3,st=1e4,Ut={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(e){return new Promise(o=>setTimeout(o,e))}function it(e){let o=process.env[e]?.trim();if(!o)return null;let t=Number(o);return Number.isInteger(t)&&t>0?t:null}function Tt(){let e=it("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??it("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??Mt;return{timeoutMs:e,hostTimeoutMs:e+Et,intervalMs:rt,attempts:Math.max(1,Math.ceil(e/rt))}}function _t(e){return e==="chromium"||e==="electron"||e==="playwright"||e==="system"}function Ot(e,o){return e.includes("--headless")?!0:e.includes("--headed")?!1:o==="playwright"&&process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY?(console.error(" no display detected \u2192 running playwright headless (override with --headed)"),!0):!1}function Q(e){return e.trim()}var dt=/^[A-Za-z][A-Za-z0-9+.-]*:/;function Bt(e){let o=e.trim();if(!o)throw new Error("expected <url-or-route>");return dt.test(o)||o.startsWith("/")?o:`/${o}`}function Dt(e){return e!==null&&typeof e=="object"}function At(e){let o=e.trim();return o?o.startsWith("/")?!0:dt.test(o)?!/^https?:\/\//i.test(o):!1:!1}async function Lt(e){if(await G(e,250))return e;let o=ae();if(o&&V(o)&&await G(o.bridgePort,500))return o.bridgePort;if(o&&V(o))throw new Error(`sootsim bridge lockfile is fresh (port ${o.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await Nt();let t=Ft(["serve","--quiet","--port",String(e)]),n=null;t.once("exit",(s,i)=>{n=String(s??i??"unknown")}),t.unref();let r=Date.now()+st;for(;Date.now()<r;){let s=ae();if(s&&V(s)&&await G(s.bridgePort,250))return console.error(` started local bridge on port ${s.bridgePort}; run \`sootsim setup\` to install the background daemon`),s.bridgePort;if(await G(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(n)throw new Error(`sootsim bridge exited before becoming ready (exit ${n})`);await $(150)}throw new Error(`sootsim bridge did not start within ${Math.round(st/1e3)}s`)}async function Nt(){let e=Re();if(e&&U.existsSync(ie(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:o}=await import("./runtime-HDMLWNXW.js");await o(["install"],{})}function Ft(e){let o=process.argv[1];return o&&U.existsSync(o)?ot(process.execPath,[o,...e],{detached:!0,stdio:"ignore",env:process.env}):ot("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function G(e,o){return new Promise(t=>{let n=new Rt(`ws://127.0.0.1:${e}`,{handshakeTimeout:o}),r=!1,s=i=>{if(!r){r=!0;try{n.close()}catch{}t(i)}};n.once("open",()=>s(!0)),n.once("error",()=>s(!1)),setTimeout(()=>s(!1),o)})}function be(e){try{let o=new URL(e),t=o.pathname.replace(/\/+$/,"")||"/";return o.searchParams.has("open")||o.searchParams.has("port")||o.searchParams.has("bundle")||o.searchParams.has("demo")||o.pathname.includes("/sootsim/index.html")||t==="/sootsim"||o.pathname==="/__soot"||o.pathname==="/__soot/"||t==="/rn"||/^\/rn\/[^/]+$/i.test(t)||/^\/app\/[^/]+$/i.test(t)||t==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(t)||/^\/__soot\/app\/[^/]+$/i.test(t)}catch{return!1}}function jt(e){try{let o=new URL(e,"http://sootsim.local");if(o.origin!=="http://sootsim.local")return!1;let t=o.pathname.replace(/\/+$/,"")||"/";return t==="/rn"||/^\/rn\/[^/]+$/i.test(t)||/^\/app\/[^/]+$/i.test(t)||t==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(t)||/^\/__soot\/app\/[^/]+$/i.test(t)}catch{return!1}}function Ht(e,o){let t=new URL(e,"http://sootsim.local"),n=new URL(o),r=Y(n.pathname),s=t.pathname.startsWith("/__soot/")?t.pathname.slice(7):t.pathname;return n.pathname=`${r}${s}`,n.search=t.search,n.hash=t.hash,n.toString()}function Wt(e){try{let o=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(o)||/^\/build\/.+/.test(o)}catch{return!1}}async function en(e){let o=Q(e);return(await ve(o)).bundleUrl}function Kt(e){try{let o=new URL(e.startsWith("http")?e:`http://${e}`),t=o.pathname||"/";if(t!=="/"&&t!==""||o.search||o.hash||!x(o.hostname))return null;let n=o.port?Number(o.port):o.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function ve(e){let o=Q(e),t=/^\d+$/.test(o)?Number(o):Kt(o);if(t&&t>0){let n=await je(t);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return et(o)}function Y(e){let o=e.replace(/\/+$/,"")||"/";return o==="/__soot"||o.startsWith("/__soot/")?"/__soot":""}function Vt(e,o){let t=Q(e),n=new URL(o),r=Y(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(t)?n.pathname=`${r}/rn/${t}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",t)),n.toString()}function ut(e){let o=Q(e);return/^\d+$/.test(o)||/^https?:\/\//i.test(o)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(o)}async function qt(e,o,t={}){let n=t.resolvedBundle??await ve(e),r=new URL(o),s=Y(r.pathname);r.pathname=`${s}/rn`,r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("demo"),r.searchParams.delete("app");let i=t.hot===void 0?n.bundleUrl:Fe(n.bundleUrl,t.hot);return r.searchParams.set("bundle",i),r.toString()}function zt(e){return e.startsWith("~/")?C.join(Ct.homedir(),e.slice(2)):C.isAbsolute(e)?e:C.resolve(process.cwd(),e)}function Gt(e){let o={},t={};for(let r=0;r<e.length;r++){if(e[r]==="--replace"){let s=e[r+1];s||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let i=s.indexOf("=");(i<=0||i===s.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let a=s.slice(0,i).trim(),l=zt(s.slice(i+1).trim());U.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),o[a]={file:l},r++;continue}if(e[r]==="--remap"){let s=e[r+1],i=s?s.indexOf("="):-1;(!s||i<=0||i===s.length-1)&&(console.error(" sootsim open: --remap expects <host:port>=<host:port>"),process.exit(1)),t[s.slice(0,i).trim()]=s.slice(i+1).trim(),r++;continue}}let n={};return Object.keys(o).length>0&&(n.modules=o),Object.keys(t).length>0&&(n.network={remap:t}),n.modules||n.network?n:void 0}async function Jt(e){if(e){let o=await z(e.bundleUrl);if(o)return me(o,{trustStart:!0})}return me(process.env.CONTRAST_REPO_DIR||process.cwd())}async function Qt(e){if(U.existsSync(C.join(ie(e),"index.html")))return;console.error(` installing configured engine runtime ${e}...`);let o=await Ee.install({version:e,setActive:!1,protectVersions:Me()});console.error(` installed engine runtime ${o.version}`)}function Yt(e,o){if(!o)return e;let t=new URL(e);if(!x(t.hostname))throw new Error(`runtimeVersion ${o} requires a local SootSim host; got ${t.origin}`);return t.hostname=Ke(o),t.toString()}function mt(){return Be().shellBaseUrl}async function Zt(e,o){try{let t=new URL(e),n=t.searchParams.get("bundle")||"";if(!n)return e;let r=o?.appDir??await z(n)??void 0,s=qe({bundleUrl:n,repoDir:r,exactProjectDir:!!o||!!r});if(s.length===0)return e;let i=await Xt(s);return i.length===0?e:(t.searchParams.set("appFonts",ze(i)),t.toString())}catch{return e}}async function Xt(e){let o=await Promise.all(e.map(async n=>{let r=new AbortController,s=setTimeout(()=>r.abort(),1500);try{let i=await fetch(n.url,{method:"HEAD",signal:r.signal});return i.status>=200&&i.status<400?n:null}catch{return null}finally{clearTimeout(s)}})),t=[];for(let n of o)n!==null&&t.push(n);return t}async function eo(e,o,t={}){if(!e)return new URL(o).toString();if(be(e))return new URL(e).toString();if(jt(e))return Ht(e,o);let n=Ut[e.toLowerCase()];if(n){let r=new URL(o),s=Y(r.pathname);return r.pathname=`${s}${n}`,r.toString()}return ut(e)?qt(e,o,t):Vt(e,o)}async function to(e,o){try{let t=new URL(e),n=t.searchParams.get("bundle")||"";if(!n)return e;let r=o?.appDir??await z(n)??void 0,s=Ge({bundleUrl:n,repoDir:r,exactProjectDir:!!o||!!r});return!s||s.imageUrl&&!await oo(s.imageUrl)?e:(t.searchParams.set("appSplash",Je(s)),t.toString())}catch{return e}}async function oo(e){let o=new AbortController,t=setTimeout(()=>o.abort(),1500);try{let n=await fetch(e,{method:"HEAD",signal:o.signal});return n.status>=200&&n.status<400}catch{return!1}finally{clearTimeout(t)}}async function J(e,o=mt(),t={}){let n=await eo(e,o,t),r=await to(await Zt(n,t.project),t.project);if(!t.device)return r;let s=new URL(r);return s.searchParams.set("device",t.device),s.toString()}function at(e,o){let t=e?.url||e?.origin||o;try{let n=new URL(t);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.searchParams.delete("appFonts"),n.searchParams.delete("appSplash"),n.toString()}catch{return o}}async function no(e,o,t,n={}){let r=new URL(await J(e,o,n));return r.searchParams.set("inspectOpen",t),r.toString()}async function ro(e,o,t,n={}){let r=n.attempts??30,s=n.intervalMs??500,i=n.minNodeCount??10;for(let a=0;a<r;a++){let l=v(e,{commandTimeoutMs:o,simId:t,simIdSource:"flag"});try{let d=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof d=="number"&&d>i)return{bridge:l,count:d}}catch{}l.close(),await $(s)}return null}function so(e){if(!e)return null;try{let o=new URL(e);if(o.searchParams.has("bundle")){let t=o.searchParams.get("bundle")||"";try{let n=new URL(t),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return o.searchParams.has("port")?`connect :${o.searchParams.get("port")||""}`:o.searchParams.has("open")?`connect ${o.searchParams.get("open")||""}`:o.searchParams.has("demo")?`demo ${o.searchParams.get("demo")||"default"}`:o.pathname.includes("/sootsim/index.html")||o.pathname==="/sootsim/"||o.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function io(e){let o=e.indexOf(":");if(o<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let t=e.slice(0,o),n=e.slice(o+1),r=n.length>12?`${n.slice(0,8)}\u2026`:n;return t==="TM_SESSION"||t==="CLAUDE_CODE_SESSION_ID"||t==="CODEX_THREAD_ID"?`agent ${r}`:`${t} ${r}`}function tn(e,o){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
|
|
5
5
|
`);for(let t of e){let n=t.lockedBy&&t.lockExpiresAt?`locked by ${io(t.lockedBy)} (${Math.max(0,Math.round((t.lockExpiresAt-Date.now())/1e3))}s)`:"",r=[t.isPrimary?"primary":"",t.id===o?"selected":"",t.readyState,t.userVisible===!1?"hidden":t.userVisible===!0?"visible":"",t.attachedCliCount&&t.attachedCliCount>0?"in use":"",t.userFocused?"focused":"",n].filter(Boolean);console.log(` ${t.id}${r.length?` [${r.join(", ")}]`:""}`);let s=so(t.url);if(s)console.log(` loaded: ${s}`);else if(t.url){let a=t.url.length>96?`${t.url.slice(0,93)}\u2026`:t.url;console.log(` url: ${a}`)}else t.origin&&console.log(` origin: ${t.origin}`);let i=ao(t);i&&console.log(` engine: ${i}`),t.title&&console.log(` title: ${t.title}`),t.visibilityState&&t.visibilityState!=="visible"&&console.log(` visibility: ${t.visibilityState}`),console.log(` connected: ${lt(Date.now()-t.connectedAt)}`),t.lastActiveAt&&t.lastActiveAt>0&&console.log(` last active: ${lt(Date.now()-t.lastActiveAt)}`)}}function ao(e){let o=e.url||e.origin||"";if(!o)return null;try{let t=new URL(o).port;return t==="5173"?"dev \u2014 local source (:5173)":t==="3000"?"Contrast app embedded (:3000)":We()?`dev \u2014 local build (:${t||"?"})`:`runtime \u2014 published engine (:${t||"?"})`}catch{return null}}function lt(e){let o=Math.max(0,Math.round(e/1e3));return o<60?`${o}s ago`:o<3600?`${Math.round(o/60)}m ago`:o<86400?`${Math.round(o/3600)}h ago`:`${Math.round(o/86400)}d ago`}async function ge(e,o,t,n={}){let r=n.attempts??30,s=n.intervalMs??500;for(let i=0;i<r;i++){let a=v(e,{commandTimeoutMs:o});try{let d=(await a.listSims()).find(t);if(d)return d}catch{}finally{a.close()}await $(s)}return null}async function lo(e,o,t,n,r={}){let s=r.attempts??30,i=r.intervalMs??500,a=!!n&&Number.isInteger(n)&&n>1,l=()=>a&&n!==void 0&&!ye(n);for(let d=0;d<s;d++){if(l())return{kind:"host-exit"};let p=v(e,{commandTimeoutMs:o});try{let w=(await p.listSims()).find(t);if(w)return l()?{kind:"host-exit"}:{kind:"match",sim:w}}catch{}finally{p.close()}if(l())return{kind:"host-exit"};await $(i)}return{kind:"timeout"}}async function co(e,o,t,n={}){let r=n.attempts??20,s=n.intervalMs??250;for(let i=0;i<r;i++){let a=v(e,{commandTimeoutMs:o});try{let d=(await a.listSims()).find(p=>p.id===t);if(!d||d.readyState!=="open")return!0}catch{return!0}finally{a.close()}await $(s)}return!1}function uo(e){let o=e.meta;if(!o||o.sootsimHostDriver!=="playwright")return null;let t=Number(o.sootsimHostPid);return!Number.isInteger(t)||t<=1||t===process.pid?null:t}function mo(e){if(!e.connectAckFile)return!1;try{return U.writeFileSync(e.connectAckFile,`${JSON.stringify({connectedAt:Date.now(),pid:e.pid??null})}
|
|
6
6
|
`,{flag:"w"}),!0}catch{return!1}}function ct(e){if(e.diagnosticLogPath)try{let o=U.readFileSync(e.diagnosticLogPath,"utf8").trim();if(!o){console.error(` ${C.basename(e.diagnosticLogPath)} was empty`);return}let t=o.length>4e3?`\u2026
|
|
7
7
|
${o.slice(-4e3)}`:o;console.error(` ${C.basename(e.diagnosticLogPath)}:`),console.error(t)}catch(o){let t=o instanceof Error?o.message:String(o);console.error(` failed to read ${C.basename(e.diagnosticLogPath)}: ${t}`)}}function ye(e){try{return process.kill(e,0),!0}catch(o){return o?.code==="EPERM"}}async function po(e,o=2500){let t=Date.now()+o;for(;Date.now()<t;){if(!ye(e))return!0;await $(100)}return!ye(e)}function fo(e){let o=nt("ps",["-o","command=","-p",String(e)],{encoding:"utf8",stdio:["ignore","pipe","pipe"]}),t=nt("ps",["eww","-o","command=","-p",String(e)],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(o.status!==0||t.status!==0)return!1;let n=(o.stdout||"").trimEnd(),r=(t.stdout||"").trimEnd();return(r.startsWith(n)?r.slice(n.length):r).includes("SOOTSIM_PW_URL=")}async function we(e,o){let t=new Set(o),n=new Set;for(let r of e){if(!t.has(r.id))continue;let s=uo(r);s&&n.add(s)}for(let r of n){if(!fo(r)){console.log(` skipped pid ${r}: not a sootsim playwright host (stale sim record)`);continue}try{process.kill(r,"SIGTERM")}catch{}if(await po(r)){console.log(` closed playwright host process ${r}`);continue}try{process.kill(r,"SIGKILL"),console.log(` force-closed playwright host process ${r}`)}catch{}}}function Z(e,o){if(o){let r=o.trim(),s=e.find(i=>i.id===r);if(!s)throw new Error(`no sim connected with id ${r}`);return s}let t=e.find(r=>r.isPrimary&&r.readyState==="open");if(t)return t;let n=e.find(r=>r.readyState==="open");if(n)return n;throw new Error("no sim connected")}function D(e,o,t){console.log(` ${t==="current sim"?"loaded":"opened"}: ${e} [${t}]`),console.log(` current sim: ${o.id}`),console.log(JSON.stringify({simId:o.id,url:o.url},null,2))}async function A(e,o,t){if(t.includes("--no-describe"))return;let n=process.env.SOOTSIM_QUIET_TARGET_NOTICE;process.env.SOOTSIM_QUIET_TARGET_NOTICE="1";try{await ho(e,o,{stableMs:150,maxMs:400});let r=v(e,{commandTimeoutMs:3e3,simId:o,cliLabel:"open --describe",simIdSource:"flag"});try{let s=null;try{s=await r.send({type:"evaluate",code:_e})}catch{}if(s&&!(s.flag===!0&&!s.loadingText&&Oe(s))){let p=s.loadingText?`still showing "${s.loadingText}"`:s.flag!==!0?"guest ready event has not fired":s.targets<=0?"no visible app content is inspectable yet":"app tree is still stabilizing";console.log(` app still loading: ${p} (nodes: ${s.nodes}, targets: ${s.targets})`),console.log(" before interacting, run: sootsim wait ready --max-ms 120000")}let a=`(async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
4
|
import{randomUUID as k}from"node:crypto";import r from"node:fs";import{homedir as A}from"node:os";import o from"node:path";var L="SOOTSIM_HOME",R="active",P="daemon.json",O="dev-bridge.json",N="config.json",S=3e4;function c(){let e=process.env[L];return e&&e.length>0?o.resolve(e):o.join(A(),".sootsim")}function E(){if(process.env.SOOTSIM_FORCE_DAEMON_INSTALL==="1")return!1;let e=process.env.SOOTSIM_DEV;if(e==="1"||e==="true")return!0;if(e==="0"||e==="false")return!1;let t=process.argv[1];if(!t)return!1;try{return r.realpathSync(t).includes(`${o.sep}packages${o.sep}sootsim${o.sep}`)}catch{return!1}}function _(){return process.env.SOOTSIM_FORCE_DAEMON_INSTALL==="1"?!1:process.env.IS_TAMAGUI_DEV==="1"}function G(){return E()||_()}function d(){return o.join(c(),"runtimes")}function j(e){return o.join(d(),e)}function b(){return o.join(d(),R)}function y(){return o.join(c(),"electron")}function K(){return o.join(y(),"userData")}function W(e){return o.join(y(),e)}function w(){return o.join(c(),"profiles")}function I(){return o.join(c(),"daemon-app")}function F(){return o.join(I(),"SootSim Daemon.app")}function X(){return o.join(F(),"Contents","MacOS","sootsim-daemon")}function B(){return o.join(c(),"cache")}function a(){return o.join(c(),P)}function f(){return o.join(c(),O)}function g(){return o.join(c(),N)}function v(){try{let e=r.readFileSync(g(),"utf8"),t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function h(e){u();let t=v(),i={...t,...e};e.settings&&typeof e.settings=="object"&&(i.settings={...t.settings&&typeof t.settings=="object"?t.settings:{},...e.settings});let s=`${g()}.tmp`;return r.writeFileSync(s,`${JSON.stringify(i,null,2)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{G as E,H as F,I as j,k as L,l as N,u as U,x as _}from"./chunk-
|
|
4
|
+
import{G as E,H as F,I as j,k as L,l as N,u as U,x as _}from"./chunk-7RFXZXKH.js";import z from"node:fs";import G from"node:path";function A(e){return e.length<=100&&/^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(e)}function M(e){try{return z.readdirSync(e.runtimesDir(),{withFileTypes:!0}).filter(c=>c.isDirectory()).map(c=>c.name).sort(k)}catch{return[]}}function T(e,c){return G.posix.basename(e.tarballPath(c))}function k(e,c){let l=f=>{let v=f.indexOf("-"),V=v>=0?f.slice(0,v):f,$=v>=0?f.slice(v+1):"",D=V.split(".").map(I=>Number.parseInt(I,10));return D.some(I=>!Number.isFinite(I))?[[Number.POSITIVE_INFINITY],f]:[D,$]},[m,u]=l(e),[R,x]=l(c);for(let f=0;f<Math.max(m.length,R.length);f++){let v=m[f]??0,V=R[f]??0;if(v!==V)return v-V}return u===x?0:u?x?u<x?-1:1:-1:1}import{spawn as Z}from"node:child_process";import J from"node:crypto";import o from"node:fs";import Y from"node:os";import y from"node:path";import{Readable as q}from"node:stream";import{pipeline as B}from"node:stream/promises";var K=2;function H(e){function c(){try{let n=JSON.parse(o.readFileSync(e.configFile(),"utf8"));return n&&typeof n=="object"?n:{}}catch{return{}}}function l(n){let t=c();return(n||process.env[e.env.cdnOrigin]||t.cdnOrigin||e.defaultCdnOrigin).replace(/\/+$/,"")}function m(n){let t=c();return n||process.env[e.env.channel]||t.runtimeChannel||"stable"}function u(){if(!e.env.pin)return null;let n=process.env[e.env.pin];if(n&&n.trim())return n.trim();let t=c();return typeof t.runtimeVersion=="string"&&t.runtimeVersion.trim()?t.runtimeVersion.trim():null}function R(n){let t=new URL(`${l(n)}${e.manifestPath}`);return t.searchParams.set("t",String(Date.now())),t.toString()}function x(n,t){return`${l(t)}${e.tarballPath(n)}`}async function f(n){let t=R(n),r=await fetch(t,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`manifest fetch failed: ${r.status} ${r.statusText} (${t})`);return await r.json()}function v(n,t={}){let r=m(t.channel),i=t.version||u()||n.channels[r]?.latest;if(!i)throw new Error(`no version specified and channel '${r}' has no latest entry in the manifest`);if(!A(i))throw new Error(`invalid runtime version: ${i}`);let h=n.versions[i];if(!h)throw new Error(`version ${i} not found in manifest; available: ${Object.keys(n.versions).slice(-10).join(", ")||"(none)"}`);return{version:i,channel:r,entry:h}}async function V(n={}){e.ensureHome();let t=l(n.cdnOrigin),r=await f(t),{version:i,channel:h,entry:a}=v(r,n),d=e.runtimeDir(i),g=n.setActive!==!1,O=[i,...n.protectVersions??[]];if(b({protectVersions:O}),!n.force&&o.existsSync(y.join(d,e.installedMarker)))return g&&e.writeActiveRuntime(i),b({protectVersions:O}),{version:i,channel:h,cdnOrigin:t,runtimeDir:d,installed:!1,activated:g,manifest:r};let P=a.tarball||x(i,t),S=o.mkdtempSync(y.join(Y.tmpdir(),`${e.id}-runtime-download-`)),w=y.join(S,T(e,i)),p=y.join(y.dirname(d),`.installing-${i}-${process.pid}`);o.rmSync(p,{recursive:!0,force:!0});try{process.stderr.write(`${e.id}: downloading runtime ${i}\u2026
|
|
5
5
|
`),await Q(P,w),process.stderr.write(`${e.id}: extracting runtime ${i}\u2026
|
|
6
6
|
`);let s=await X(w);if(s!==a.sha256)throw new Error(`sha256 mismatch for runtime ${i}: expected ${a.sha256}, actual ${s}`);if(o.mkdirSync(p,{recursive:!0}),await ee(w,p),!o.existsSync(y.join(p,e.installedMarker)))throw new Error(`extracted tarball for runtime ${i} is missing ${e.installedMarker}`);o.rmSync(d,{recursive:!0,force:!0}),o.renameSync(p,d)}catch(s){throw o.rmSync(p,{recursive:!0,force:!0}),s}finally{o.rmSync(S,{recursive:!0,force:!0})}return g&&e.writeActiveRuntime(i),b({protectVersions:O}),{version:i,channel:h,cdnOrigin:t,runtimeDir:d,installed:!0,activated:g,manifest:r}}async function $(n={}){e.ensureHome(),b({protectVersions:n.protectVersions});let t=l(n.cdnOrigin),r=m(n.channel),i=u();if(i){let p=e.readActiveRuntime(),s=o.existsSync(y.join(e.runtimeDir(i),e.installedMarker));if(p===i&&s)return{checked:!0,updated:!1,reason:`runtime is pinned to ${i}`,activeVersion:p,latestVersion:i};let C=await V({version:i,channel:r,cdnOrigin:t,setActive:!1,protectVersions:n.protectVersions});return{checked:!0,updated:!0,reason:`runtime is pinned to ${i}`,activeVersion:i,latestVersion:i,install:C}}let h=await f(t),a=h.channels[r]?.latest;if(!a)return{checked:!0,updated:!1,reason:`channel '${r}' has no latest runtime`,activeVersion:e.readActiveRuntime()};if(!h.versions[a])return{checked:!0,updated:!1,reason:`manifest is missing version ${a}`,activeVersion:e.readActiveRuntime(),latestVersion:a};let g=e.readActiveRuntime(),O=g?e.runtimeDir(g):null,P=O?o.existsSync(y.join(O,e.installedMarker)):!1;if(!(!g||!P||k(a,g)>0))return{checked:!0,updated:!1,reason:"active runtime is current",activeVersion:g,latestVersion:a};let w=await V({version:a,channel:r,cdnOrigin:t,setActive:!1,protectVersions:n.protectVersions});return{checked:!0,updated:!0,activeVersion:a,latestVersion:a,install:w}}async function D(n={}){let t=e.readActiveRuntime(),r=u();if(r)return{active:t,latest:r,pinned:r,outdated:t!==r};try{let i=await f(l(n.cdnOrigin)),h=m(n.channel),a=i.channels[h]?.latest??null,d=!!(a&&(!t||k(a,t)>0));return{active:t,latest:a,pinned:null,outdated:d}}catch{return{active:t,latest:null,pinned:null,outdated:!1}}}function I(n={}){e.ensureHome();let t=Math.max(1,Math.floor(n.retainVersions??K)),r=M(e),i=new Set(r),h=e.readActiveRuntime(),a=u(),d=new Set;for(let s of[h,a,...n.protectVersions??[]])s&&i.has(s)&&d.add(s);for(let s of[...r].reverse()){if(d.size>=t)break;d.add(s)}let g="__RUNTIME_VERSION__",O=T(e,g),P=O.indexOf(g),S=O.slice(0,P),w=O.slice(P+g.length),p=[];if(P>=0)try{p=o.readdirSync(e.cacheDir(),{withFileTypes:!0}).filter(s=>{if(!s.isFile())return!1;let C=s.name.startsWith(S)&&s.name.endsWith(w),W=s.name.startsWith(S)&&s.name.endsWith(`${w}.partial`);return C||W}).map(s=>y.join(e.cacheDir(),s.name)).sort()}catch{}return{activeVersion:h,pinnedVersion:a,keepVersions:r.filter(s=>d.has(s)),removeVersions:r.filter(s=>!d.has(s)),removeCacheFiles:p}}function b(n={}){let t=I(n);for(let r of t.removeVersions)o.rmSync(e.runtimeDir(r),{recursive:!0,force:!0});for(let r of t.removeCacheFiles)o.rmSync(r,{force:!0});return t}return{product:e,resolveCdnOrigin:l,resolveChannel:m,resolvePin:u,manifestUrl:R,tarballUrl:x,fetchManifest:f,resolveVersion:v,install:V,updateToLatest:$,checkUpToDate:D,planLocalRetention:I,pruneLocalRetention:b,listInstalled:()=>M(e)}}async function Q(e,c){let l=await fetch(e);if(!l.ok||!l.body)throw new Error(`download failed: ${l.status} ${l.statusText} (${e})`);o.mkdirSync(y.dirname(c),{recursive:!0});let m=`${c}.partial`;try{await B(q.fromWeb(l.body),o.createWriteStream(m)),o.renameSync(m,c)}catch(u){try{o.unlinkSync(m)}catch{}throw u}}function X(e){return new Promise((c,l)=>{let m=J.createHash("sha256"),u=o.createReadStream(e);u.on("data",R=>m.update(R)),u.on("error",l),u.on("end",()=>c(m.digest("hex")))})}function ee(e,c){return new Promise((l,m)=>{let u=Z("tar",["-xzf",e,"-C",c],{stdio:["ignore","inherit","inherit"]});u.on("error",m),u.on("exit",R=>{R===0?l():m(new Error(`tar exited with code ${R}`))})})}var ne="https://contrast.dev",ve="https://sootsim.com/changelog",Oe="https://contrast.dev/api/changelog/sootsim",te={id:"sootsim",defaultCdnOrigin:ne,manifestPath:"/runtimes/manifest.json",tarballPath:e=>`/runtimes/sootsim-runtime-${e}.tar.gz`,installedMarker:"index.html",env:{cdnOrigin:"SOOTSIM_CDN_ORIGIN",channel:"SOOTSIM_RUNTIME_CHANNEL"},ensureHome:E,configFile:_,runtimesDir:L,runtimeDir:N,cacheDir:U,readActiveRuntime:F,writeActiveRuntime:j},ye=H(te);export{A as a,k as b,ne as c,ve as d,Oe as e,ye as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
3
|
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
4
|
var t="http://localhost:7668/";var r=4001,o="sootsim close";export{t as a,r as b,o as c};
|