sootsim 0.1.308 → 0.1.309
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-FDZTBSVV.js → agent-PJLXWBDD.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-7QJ2JHCB.js → agent-wrapper-3MUIIBXT.js} +2 -2
- package/dist-cli/chunks/{app-fonts-LTJSQALL.js → app-fonts-U64NV2YF.js} +2 -2
- package/dist-cli/chunks/{assert-CIGJGFYB.js → assert-M4P25OHW.js} +2 -2
- package/dist-cli/chunks/{auth-4W5KWNEG.js → auth-4UUAINI4.js} +2 -2
- package/dist-cli/chunks/{beta-27VDK37K.js → beta-AC2BNWOQ.js} +2 -2
- package/dist-cli/chunks/{camera-4KHMJE6X.js → camera-LATKOQVT.js} +2 -2
- package/dist-cli/chunks/{chunk-QNPI3JQT.js → chunk-223S4HOM.js} +2 -2
- package/dist-cli/chunks/{chunk-BMFU7YRS.js → chunk-25GKNYXJ.js} +1 -1
- package/dist-cli/chunks/{chunk-CZJ7EYZZ.js → chunk-26LS4GPM.js} +2 -2
- package/dist-cli/chunks/{chunk-WMRLZLFL.js → chunk-2HUVXSCB.js} +2 -2
- package/dist-cli/chunks/{chunk-77OOHSF3.js → chunk-2LXM5BMK.js} +1 -1
- package/dist-cli/chunks/{chunk-E7BETJML.js → chunk-3BN7ACIG.js} +2 -2
- package/dist-cli/chunks/{chunk-ZDNKCQ3P.js → chunk-3KB6LLD2.js} +2 -2
- package/dist-cli/chunks/{chunk-6NT4NEC5.js → chunk-47AF7DZW.js} +1 -1
- package/dist-cli/chunks/{chunk-QEBKGRKU.js → chunk-5O56UY3I.js} +2 -2
- package/dist-cli/chunks/{chunk-BJZDSMUX.js → chunk-6ZIFXWDJ.js} +1 -1
- package/dist-cli/chunks/{chunk-3MUKJOKU.js → chunk-7BSX3TEH.js} +2 -2
- package/dist-cli/chunks/{chunk-ZBJJNMOY.js → chunk-7QL76I5Z.js} +2 -2
- package/dist-cli/chunks/{chunk-OU4JVY3B.js → chunk-A6FYCXLX.js} +1 -1
- package/dist-cli/chunks/{chunk-JYHLGI32.js → chunk-ASR54LQA.js} +2 -2
- package/dist-cli/chunks/{chunk-FGJ76ALE.js → chunk-BDOGRZ6M.js} +1 -1
- package/dist-cli/chunks/{chunk-IPL6MCSI.js → chunk-DFLNNIMW.js} +3 -3
- package/dist-cli/chunks/{chunk-UA7FUHD7.js → chunk-DLPIGWDZ.js} +2 -2
- package/dist-cli/chunks/{chunk-OJKCJMUA.js → chunk-FAI6B7KM.js} +3 -3
- package/dist-cli/chunks/{chunk-3GLUIZ7Y.js → chunk-FJ5D7KBQ.js} +2 -2
- package/dist-cli/chunks/{chunk-TWDK7ZW6.js → chunk-FOWD7TYC.js} +1 -1
- package/dist-cli/chunks/{chunk-JSXTQEQJ.js → chunk-FSM2WGIT.js} +2 -2
- package/dist-cli/chunks/{chunk-QGVLNNVI.js → chunk-FYVL4NBD.js} +1 -1
- package/dist-cli/chunks/{chunk-RY4GVRWJ.js → chunk-GEXLPJZ6.js} +2 -2
- package/dist-cli/chunks/{chunk-257DT745.js → chunk-GHXN67UJ.js} +2 -2
- package/dist-cli/chunks/{chunk-MFAD2V3C.js → chunk-GVTCP23K.js} +3 -3
- package/dist-cli/chunks/{chunk-WX747PJK.js → chunk-H4F7PJTT.js} +1 -1
- package/dist-cli/chunks/{chunk-FKQAZWL7.js → chunk-HKQURR57.js} +2 -2
- package/dist-cli/chunks/{chunk-RSXS465H.js → chunk-I2RMH3PV.js} +2 -2
- package/dist-cli/chunks/{chunk-F2VITCHS.js → chunk-I5SSRJDW.js} +7 -7
- package/dist-cli/chunks/{chunk-OKZVIP5U.js → chunk-IPNM6NRT.js} +2 -2
- package/dist-cli/chunks/{chunk-IIUOBQNT.js → chunk-ISONHFRC.js} +1 -1
- package/dist-cli/chunks/{chunk-I4AWOWHZ.js → chunk-JVWHA7TR.js} +2 -2
- package/dist-cli/chunks/{chunk-FACSJFMR.js → chunk-LFJQHZGK.js} +2 -2
- package/dist-cli/chunks/{chunk-6A7PEIVI.js → chunk-LR5GL7TZ.js} +1 -1
- package/dist-cli/chunks/{chunk-J35YPP4T.js → chunk-N236X7SZ.js} +1 -1
- package/dist-cli/chunks/{chunk-RJBH7TUF.js → chunk-N4Z7NF3J.js} +3 -3
- package/dist-cli/chunks/{chunk-XU3K3MM4.js → chunk-NMC3E6DO.js} +1 -1
- package/dist-cli/chunks/{chunk-DQQTNI4F.js → chunk-ODFSRDJM.js} +1 -1
- package/dist-cli/chunks/{chunk-TAPL2B2Q.js → chunk-POTUFLUZ.js} +1 -1
- package/dist-cli/chunks/{chunk-2NOXORGK.js → chunk-S3YHQIHR.js} +1 -1
- package/dist-cli/chunks/{chunk-6VE43HZK.js → chunk-S6YNVIOG.js} +2 -2
- package/dist-cli/chunks/{chunk-RDRMZVZN.js → chunk-SJHHKL2L.js} +2 -2
- package/dist-cli/chunks/{chunk-UGHQIRZU.js → chunk-V7MJLIGU.js} +2 -2
- package/dist-cli/chunks/{chunk-3VPI27RB.js → chunk-VK3PJJAQ.js} +1 -1
- package/dist-cli/chunks/{chunk-YYQZKZ4Z.js → chunk-W7C6FSWM.js} +2 -2
- package/dist-cli/chunks/{chunk-RAHHXSBC.js → chunk-WKDTGITC.js} +1 -1
- package/dist-cli/chunks/{chunk-BSLGLHO5.js → chunk-Y2KNXEIX.js} +2 -2
- package/dist-cli/chunks/{chunk-QX3AFGNB.js → chunk-YRNCMR5K.js} +2 -2
- package/dist-cli/chunks/{chunk-VEHRW2TN.js → chunk-ZE3HG74O.js} +2 -2
- package/dist-cli/chunks/{chunk-ACQ77JLG.js → chunk-ZYZVAMKO.js} +1 -1
- package/dist-cli/chunks/{cleanup-ATMBX4WB.js → cleanup-264HUJBQ.js} +2 -2
- package/dist-cli/chunks/{cli-version-X4NT4YIH.js → cli-version-VBD6G5WE.js} +2 -2
- package/dist-cli/chunks/{compat-MEW4UO3U.js → compat-2LLTMAGD.js} +2 -2
- package/dist-cli/chunks/{config-XTNLWH4K.js → config-K67AEQAU.js} +2 -2
- package/dist-cli/chunks/{control-I3UZ6KF5.js → control-3VWXBZ2B.js} +2 -2
- package/dist-cli/chunks/daemon-4EOVMYNW.js +4 -0
- package/dist-cli/chunks/{debug-HT6IURQN.js → debug-JO43E32E.js} +3 -3
- package/dist-cli/chunks/{desktop-JGCOHBSW.js → desktop-ZSEVBLER.js} +3 -3
- package/dist-cli/chunks/{detox-KZUDVA3M.js → detox-KI7MKMXW.js} +2 -2
- package/dist-cli/chunks/{device-OVMSVSTA.js → device-6EWIZV5M.js} +2 -2
- package/dist-cli/chunks/{diagnose-RYNQ42UX.js → diagnose-S3ET3TIZ.js} +2 -2
- package/dist-cli/chunks/disk-cleanup-BSWNZ4AI.js +4 -0
- package/dist-cli/chunks/drivers-AYUTJNIJ.js +4 -0
- package/dist-cli/chunks/{film-Y5BRFAN6.js → film-LMO5IQCB.js} +3 -3
- package/dist-cli/chunks/flow-2QKKLLQM.js +4 -0
- package/dist-cli/chunks/help-SOP6FLQI.js +4 -0
- package/dist-cli/chunks/{hidden-runtime-alias-2XGWMRWQ.js → hidden-runtime-alias-Y6PI4YOZ.js} +2 -2
- package/dist-cli/chunks/{home-paths-3W2XI22W.js → home-paths-YGTX3HLF.js} +2 -2
- package/dist-cli/chunks/inspect-RU5RWMDH.js +4 -0
- package/dist-cli/chunks/install-desktop-AWS5ITUE.js +4 -0
- package/dist-cli/chunks/{login-RAGF6V6I.js → login-WSIJQW3G.js} +4 -4
- package/dist-cli/chunks/{logout-JJ4H76TY.js → logout-WFBUX573.js} +2 -2
- package/dist-cli/chunks/{maestro-VQGVMRFD.js → maestro-PFLRSGR4.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-5WM5DEX6.js → maestro-generate-VS26IJM5.js} +3 -3
- package/dist-cli/chunks/{mode-LJBWSKXM.js → mode-OOTPI3ED.js} +2 -2
- package/dist-cli/chunks/{optional-demo-registry-QPNNLHR5.js → optional-demo-registry-KBMT5UGA.js} +2 -2
- package/dist-cli/chunks/{perf-SLPWARJ7.js → perf-AR6BYBON.js} +2 -2
- package/dist-cli/chunks/{permissions-VSSQI7TS.js → permissions-R3ZC56LP.js} +2 -2
- package/dist-cli/chunks/{record-WQXXQZON.js → record-NUCCKPZD.js} +3 -3
- package/dist-cli/chunks/{report-issue-XE2Y7FM2.js → report-issue-G66JIO6G.js} +2 -2
- package/dist-cli/chunks/runtime-KOIKZGYF.js +4 -0
- package/dist-cli/chunks/{screenshot-command-LELP3QH7.js → screenshot-command-OYQVHOKW.js} +3 -3
- package/dist-cli/chunks/{screenshot-layers-G3DBXZJM.js → screenshot-layers-DNVWS54T.js} +2 -2
- package/dist-cli/chunks/{screenshots-capture-BRY4ZN7N.js → screenshots-capture-LJ6LTZLL.js} +2 -2
- package/dist-cli/chunks/{serve-I6T264VY.js → serve-JOXV5ECW.js} +2 -2
- package/dist-cli/chunks/{setup-WHHD5GUT.js → setup-RTUGZNIA.js} +2 -2
- package/dist-cli/chunks/{skills-RBBS5D6Q.js → skills-ABCIWLFD.js} +2 -2
- package/dist-cli/chunks/{storage-ZZTD3U7X.js → storage-2TXWI3HS.js} +2 -2
- package/dist-cli/chunks/store-NQKZHF7K.js +4 -0
- package/dist-cli/chunks/telemetry-NYAZLCMX.js +4 -0
- package/dist-cli/chunks/{timeline-S3CVUS4X.js → timeline-CNOX2CCQ.js} +2 -2
- package/dist-cli/chunks/{upgrade-CA5P67YG.js → upgrade-CS4AOUGL.js} +2 -2
- package/dist-cli/chunks/upload-3QPV23AA.js +4 -0
- package/dist-cli/chunks/{version-FTPPCAWP.js → version-Q3L5LLSS.js} +2 -2
- package/dist-cli/chunks/{web-XGYSJA6B.js → web-2CGGMN7W.js} +2 -2
- package/dist-cli/chunks/{what-happened-SRB7UKET.js → what-happened-A7SLCHUS.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +10 -6
- package/dist-lib/sdk.mjs +10 -6
- package/dist-lib/skills.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/daemon-GGTZI5IH.js +0 -4
- package/dist-cli/chunks/disk-cleanup-SD6A5U55.js +0 -4
- package/dist-cli/chunks/drivers-GWLETUZ7.js +0 -4
- package/dist-cli/chunks/flow-F6MLTGTC.js +0 -4
- package/dist-cli/chunks/help-DUQVA4XQ.js +0 -4
- package/dist-cli/chunks/inspect-PKY4K7KI.js +0 -4
- package/dist-cli/chunks/install-desktop-667OGRUB.js +0 -4
- package/dist-cli/chunks/runtime-DIVVXWXI.js +0 -4
- package/dist-cli/chunks/store-KVLTCAC5.js +0 -4
- package/dist-cli/chunks/telemetry-QEXFRYZM.js +0 -4
- package/dist-cli/chunks/upload-AADA5IQ3.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.309 | (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-POTUFLUZ.js";import"./chunks/chunk-WKDTGITC.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-Y6PI4YOZ.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-NYAZLCMX.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-YGTX3HLF.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-BSWNZ4AI.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-NYAZLCMX.js");await a(),await v(),process.exit(t)}if(e.version){let{getCliVersion:t}=await import("./chunks/cli-version-VBD6G5WE.js"),{IS_BETA:a,BETA_LABEL:s}=await import("./chunks/beta-AC2BNWOQ.js"),m=a?` \xB7 ${s}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:d}=await import("./chunks/home-paths-YGTX3HLF.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-SOP6FLQI.js");t(),await n(0)}var o=e.globalFlags.port,c=e.verbose,u=e.globalFlags.device,l=e.globalFlags.theme,E=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-NQKZHF7K.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-RTUGZNIA.js");a()&&(await t(["--from-welcome"]),await n(0));let{printHelp:s}=await import("./chunks/help-SOP6FLQI.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-SOP6FLQI.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-ABCIWLFD.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-SOP6FLQI.js");s(r)&&await n(0)}else{let{printCommandHelp:s}=await import("./chunks/help-SOP6FLQI.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-RU5RWMDH.js");await t([r,...i],{port:o,verbose:c})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-M4P25OHW.js");await t(e.commandArgs);break}case"detox":{let{runDetox:t}=await import("./chunks/detox-KI7MKMXW.js");await t(e.commandArgs,{port:o,verbose:c});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-PFLRSGR4.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-NUCCKPZD.js");await t(i,{port:o,verbose:c});break}case"film":{let{runFilm:t}=await import("./chunks/film-LMO5IQCB.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-2TXWI3HS.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-AR6BYBON.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-OYQVHOKW.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-OOTPI3ED.js");await t(i,{port:o,verbose:c});break}case"permissions":{let{runPermissions:t}=await import("./chunks/permissions-R3ZC56LP.js"),a=await t(i,{port:o,verbose:c});await n(a)}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-RU5RWMDH.js");await t(i,{port:o,verbose:c});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-JO43E32E.js");await t(i,{port:o,verbose:c});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-CNOX2CCQ.js");await t(i,{port:o,verbose:c});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-A7SLCHUS.js");await t(i,{port:o,verbose:c});break}case"open":{let{runOpenCommand:t}=await import("./chunks/control-3VWXBZ2B.js");await t(i,{port:o});break}case"use":{let{runUseCommand:t}=await import("./chunks/control-3VWXBZ2B.js");await t(i,{port:o});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-3VWXBZ2B.js");await t(i,{port:o});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-3VWXBZ2B.js");await t(i,{port:o});break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-6EWIZV5M.js");await t(i,{port:o});break}case"compat":{let{runCompat:t}=await import("./chunks/compat-2LLTMAGD.js");await t(e.commandArgs);break}case"report-issue":{let{runReportIssue:t}=await import("./chunks/report-issue-G66JIO6G.js"),a=await t(e.commandArgs);await n(a)}case"desktop":{let{runDesktop:t}=await import("./chunks/desktop-ZSEVBLER.js");await t(e.commandArgs,{port:o,device:u});break}case"login":{let{runLogin:t}=await import("./chunks/login-WSIJQW3G.js");await t(e.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-WFBUX573.js");await t();break}case"auth":{let{runAuth:t}=await import("./chunks/auth-4UUAINI4.js");await t(e.commandArgs);break}case"setup":{let{runSetup:t}=await import("./chunks/setup-RTUGZNIA.js");await t(e.commandArgs);break}case"serve":{let{runServe:t}=await import("./chunks/serve-JOXV5ECW.js");await t(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-4EOVMYNW.js");await t(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-KOIKZGYF.js");await t(e.commandArgs);break}case"upgrade":case"update":{let{runUpgrade:t}=await import("./chunks/upgrade-CS4AOUGL.js");await t(e.commandArgs);break}case"version":{let{runVersion:t}=await import("./chunks/version-Q3L5LLSS.js");await t(e.commandArgs);break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-PJLXWBDD.js"),a=await t(e.commandArgs);await n(a)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-3MUIIBXT.js"),a=await t(e.commandArgs);await n(a)}case"skill":{let{runSkill:t}=await import("./chunks/skills-ABCIWLFD.js");await t(e.commandArgs);break}case"app-fonts":{let{runAppFonts:t}=await import("./chunks/app-fonts-U64NV2YF.js");await t(e.commandArgs);break}case"config":{let{runConfig:t}=await import("./chunks/config-K67AEQAU.js");await t(e.commandArgs);break}case"cleanup":{let{runCleanup:t}=await import("./chunks/cleanup-264HUJBQ.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.309 | (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-26LS4GPM.js";import"./chunk-H4F7PJTT.js";import{c as $}from"./chunk-YRNCMR5K.js";import"./chunk-SJHHKL2L.js";import"./chunk-JVWHA7TR.js";import"./chunk-V7MJLIGU.js";import"./chunk-ZE3HG74O.js";import"./chunk-S6YNVIOG.js";import"./chunk-FYVL4NBD.js";import"./chunk-ODFSRDJM.js";import{j as y}from"./chunk-25GKNYXJ.js";import"./chunk-ISONHFRC.js";import"./chunk-BDOGRZ6M.js";import"./chunk-WKDTGITC.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.309 | (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-H4F7PJTT.js";import"./chunk-WKDTGITC.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>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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{k as p}from"./chunk-
|
|
4
|
+
import{k as p}from"./chunk-7QL76I5Z.js";import"./chunk-A6FYCXLX.js";import"./chunk-LR5GL7TZ.js";import"./chunk-WKDTGITC.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.309 | (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-WKDTGITC.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.309 | (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-IPNM6NRT.js";import{d as s}from"./chunk-HKQURR57.js";import"./chunk-25GKNYXJ.js";import"./chunk-WKDTGITC.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.309 | (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-BDOGRZ6M.js";import"./chunk-WKDTGITC.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.309 | (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-ASR54LQA.js";import"./chunk-I5SSRJDW.js";import{h as l,j as m,l as p}from"./chunk-GHXN67UJ.js";import"./chunk-S6YNVIOG.js";import"./chunk-FYVL4NBD.js";import"./chunk-25GKNYXJ.js";import"./chunk-WKDTGITC.js";function f(){console.log(`
|
|
5
5
|
sootsim do scan \u2014 inject a barcode scan
|
|
6
6
|
|
|
7
7
|
usage:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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 I,b as Le,c as Ne}from"./chunk-E7BETJML.js";import{m as A}from"./chunk-JYHLGI32.js";import{m as Re,p as Ue}from"./chunk-F2VITCHS.js";import{b as Ae,j as qe}from"./chunk-FACSJFMR.js";import{a as We,b as Ke,d as ze}from"./chunk-WMRLZLFL.js";import{a as Oe,b as L,c as ae,d as le,e as De,f as Be,h as je,i as z,j as He}from"./chunk-ZBJJNMOY.js";import{a as Fe}from"./chunk-BSLGLHO5.js";import{a as ce}from"./chunk-6A7PEIVI.js";import{b as Ee,c as _e,d as ie,f as Te,g as Me,h as _,i as P,j as T}from"./chunk-257DT745.js";import{f as Pe}from"./chunk-RY4GVRWJ.js";import{b as se,d as Ie}from"./chunk-VEHRW2TN.js";import{b as ke,g as Ce,h as D,i as x,j as B}from"./chunk-6VE43HZK.js";import{H as $e,K as oe,M as q,O as xe,l as re}from"./chunk-BMFU7YRS.js";import{spawn as Ze,spawnSync as Xe}from"node:child_process";import M from"node:fs";import kt from"node:os";import R from"node:path";import{WebSocket as Ct}from"ws";function Ve(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 yt(e,t){return e?.includes("/one/metro-entry.bundle")?"one":typeof t=="string"&&t?"expo":"unknown"}function Je(e,t,n){return`${e}//${t}:${n}`}function St(e){if(typeof window>"u")return!1;try{let t=new URL(e);return I(t.hostname)&&I(window.location.hostname)&&t.origin!==window.location.origin}catch{return!1}}async function Ge(e,t){let n={...t,cache:t?.cache??"no-store"};return St(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,n):fetch(e,n)}function $t(e){return e==="https:"?443:80}function xt(e){let t=e.pathname||"/";return(t==="/"||t==="")&&!e.search&&!e.hash}async function Pt(e){try{let t=await fetch("/__server-scan",{cache:"no-store"});if(!t.ok||!(t.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let n=await t.json();if(!Array.isArray(n))return null;let r=n.find(o=>!!o&&typeof o=="object"&&o.port===e&&typeof o.bundleUrl=="string");return r?{bundleUrl:le(r.bundleUrl),port:e,framework:typeof r.framework=="string"?r.framework:"unknown",projectName:typeof r.projectName=="string"?r.projectName:void 0}:null}catch{return null}}async function Qe(e,t){let n=e.replace(/\/+$/,"");try{if(I(new URL(n).hostname)){let r=await Pt(t);if(r)return r}}catch{}try{let r=await Ge(`${n}/`,{headers:{"expo-platform":"ios"}});if(r.ok){let o=await r.json(),s=o?.extra?.expoClient||o?.extra||{},i=typeof o?.launchAsset?.url=="string"?o.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:le(i||`${n}${ae}`),port:t,framework:yt(i,s.sdkVersion),projectName:s.name}}}catch{}try{let r=await Ge(`${n}/status`);if(r.ok&&(await r.text()).includes("packager-status:running"))return{bundleUrl:`${n}${ae}`,port:t,framework:"metro"}}catch{}return null}async function It(e){return Qe(Je("http:","localhost",e),e)}async function Ye(e){let t=e.trim();if(/^\d+$/.test(t)){let a=parseInt(t,10),l=await It(a);if(l)return l;throw Ve(`localhost:${a}`)}let n=t.startsWith("http")?t:`http://${t}`,r;try{r=new URL(n)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let o=r.protocol||"http:",s=r.port?parseInt(r.port,10):$t(o),i=Je(o,r.hostname,s);if(xt(r)){let a=await Qe(i,s);if(a)return a;throw Ve(i)}return{bundleUrl:r.toString(),port:s,framework:"unknown"}}var Rt=12e4,et=100,Ut=5e3,tt=1e4,Et={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 S(e){return new Promise(t=>setTimeout(t,e))}function nt(e){let t=process.env[e]?.trim();if(!t)return null;let n=Number(t);return Number.isInteger(n)&&n>0?n:null}function _t(){let e=nt("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??nt("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??Rt;return{timeoutMs:e,hostTimeoutMs:e+Ut,intervalMs:et,attempts:Math.max(1,Math.ceil(e/et))}}function rt(e){return e==="electron"||e==="playwright"}function ue(e,t){return t==="playwright"?e.meta?.sootsimHostDriver==="playwright":e.userAgent?.includes("Electron/")===!0}function Tt(e,t){return e.includes("--headless")?!0:e.includes("--headed")?!1:t==="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 J(e){return e.trim()}var ct=/^[A-Za-z][A-Za-z0-9+.-]*:/;function Mt(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return ct.test(t)||t.startsWith("/")?t:`/${t}`}function Ot(e){return e!==null&&typeof e=="object"}function Dt(e){let t=e.trim();return t?t.startsWith("/")?!0:ct.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function Bt(e){if(await V(e,250))return e;let t=oe();if(t&&q(t)&&await V(t.bridgePort,500))return t.bridgePort;if(t&&q(t))throw new Error(`sootsim bridge lockfile is fresh (port ${t.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await At();let n=Lt(["serve","--quiet","--port",String(e)]),r=null;n.once("exit",(s,i)=>{r=String(s??i??"unknown")}),n.unref();let o=Date.now()+tt;for(;Date.now()<o;){let s=oe();if(s&&q(s)&&await V(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 V(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(r)throw new Error(`sootsim bridge exited before becoming ready (exit ${r})`);await S(150)}throw new Error(`sootsim bridge did not start within ${Math.round(tt/1e3)}s`)}async function At(){let e=$e();if(e&&M.existsSync(re(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:t}=await import("./runtime-DIVVXWXI.js");await t(["install"],{})}function Lt(e){let t=process.argv[1];return t&&M.existsSync(t)?Ze(process.execPath,[t,...e],{detached:!0,stdio:"ignore",env:process.env}):Ze("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function V(e,t){return new Promise(n=>{let r=new Ct(`ws://127.0.0.1:${e}`,{handshakeTimeout:t}),o=!1,s=i=>{if(!o){o=!0;try{r.close()}catch{}n(i)}};r.once("open",()=>s(!0)),r.once("error",()=>s(!1)),setTimeout(()=>s(!1),t)})}function me(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,"")||"/";return t.searchParams.has("open")||t.searchParams.has("port")||t.searchParams.has("bundle")||t.searchParams.has("demo")||t.pathname.includes("/sootsim/index.html")||n==="/sootsim"||t.pathname==="/__soot"||t.pathname==="/__soot/"||n==="/rn"||/^\/rn\/[^/]+$/i.test(n)||/^\/app\/[^/]+$/i.test(n)||n==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(n)||/^\/__soot\/app\/[^/]+$/i.test(n)}catch{return!1}}function Nt(e){try{let t=new URL(e,"http://sootsim.local");if(t.origin!=="http://sootsim.local")return!1;let n=t.pathname.replace(/\/+$/,"")||"/";return n==="/rn"||/^\/rn\/[^/]+$/i.test(n)||/^\/app\/[^/]+$/i.test(n)||n==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(n)||/^\/__soot\/app\/[^/]+$/i.test(n)}catch{return!1}}function Ft(e,t){let n=new URL(e,"http://sootsim.local"),r=new URL(t),o=Q(r.pathname),s=n.pathname.startsWith("/__soot/")?n.pathname.slice(7):n.pathname;return r.pathname=`${o}${s}`,r.search=n.search,r.hash=n.hash,r.toString()}function jt(e){try{let t=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(t)||/^\/build\/.+/.test(t)}catch{return!1}}async function Gn(e){let t=J(e);return(await fe(t)).bundleUrl}function Ht(e){try{let t=new URL(e.startsWith("http")?e:`http://${e}`),n=t.pathname||"/";if(n!=="/"&&n!==""||t.search||t.hash||!I(t.hostname))return null;let r=t.port?Number(t.port):t.protocol==="https:"?443:80;return Number.isFinite(r)&&r>0?r:null}catch{return null}}async function fe(e){let t=J(e),n=/^\d+$/.test(t)?Number(t):Ht(t);if(n&&n>0){let r=await Be(n);if(r)return{bundleUrl:r.bundleUrl,port:r.port,framework:r.framework,projectName:r.projectName}}return Ye(t)}function Q(e){let t=e.replace(/\/+$/,"")||"/";return t==="/__soot"||t.startsWith("/__soot/")?"/__soot":""}function Wt(e,t){let n=J(e),r=new URL(t),o=Q(r.pathname);return r.pathname=`${o}/rn`,r.searchParams.delete("bundle"),r.searchParams.delete("demo"),r.searchParams.delete("app"),r.searchParams.delete("open"),r.searchParams.delete("port"),/^\d+$/.test(n)?r.pathname=`${o}/rn/${n}`:(r.pathname=`${o}/rn`,r.searchParams.set("open",n)),r.toString()}function ut(e){let t=J(e);return/^\d+$/.test(t)||/^https?:\/\//i.test(t)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(t)}async function Kt(e,t,n={}){let r=n.resolvedBundle??await fe(e),o=new URL(t),s=Q(o.pathname);o.pathname=`${s}/rn`,o.searchParams.delete("open"),o.searchParams.delete("port"),o.searchParams.delete("demo"),o.searchParams.delete("app");let i=n.hot===void 0?r.bundleUrl:De(r.bundleUrl,n.hot);return o.searchParams.set("bundle",i),o.toString()}function qt(e){return e.startsWith("~/")?R.join(kt.homedir(),e.slice(2)):R.isAbsolute(e)?e:R.resolve(process.cwd(),e)}function zt(e){let t={},n={};for(let o=0;o<e.length;o++){if(e[o]==="--replace"){let s=e[o+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=qt(s.slice(i+1).trim());M.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),t[a]={file:l},o++;continue}if(e[o]==="--remap"){let s=e[o+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)),n[s.slice(0,i).trim()]=s.slice(i+1).trim(),o++;continue}}let r={};return Object.keys(t).length>0&&(r.modules=t),Object.keys(n).length>0&&(r.network={remap:n}),r.modules||r.network?r:void 0}async function Vt(e){if(e){let t=await z(e.bundleUrl);if(t)return ce(t,{trustStart:!0})}return ce(process.env.CONTRAST_REPO_DIR||process.cwd())}async function Gt(e){if(M.existsSync(R.join(re(e),"index.html")))return;console.error(` installing configured engine runtime ${e}...`);let t=await Pe.install({version:e,setActive:!1,protectVersions:xe()});console.error(` installed engine runtime ${t.version}`)}function Jt(e,t){if(!t)return e;let n=new URL(e);if(!I(n.hostname))throw new Error(`runtimeVersion ${t} requires a local SootSim host; got ${n.origin}`);return n.hostname=Ne(t),n.toString()}function dt(){return Ee().shellBaseUrl}function Qt(e){return _e(e)?.shellBaseUrl??ke(e)??dt()}async function Yt(e,t){try{let n=new URL(e),r=n.searchParams.get("bundle")||"";if(!r)return e;let o=t?.appDir??await z(r)??void 0,s=je({bundleUrl:r,repoDir:o,exactProjectDir:!!t||!!o});if(s.length===0)return e;let i=await Zt(s);return i.length===0?e:(n.searchParams.set("appFonts",He(i)),n.toString())}catch{return e}}async function Zt(e){let t=await Promise.all(e.map(async r=>{let o=new AbortController,s=setTimeout(()=>o.abort(),1500);try{let i=await fetch(r.url,{method:"HEAD",signal:o.signal});return i.status>=200&&i.status<400?r:null}catch{return null}finally{clearTimeout(s)}})),n=[];for(let r of t)r!==null&&n.push(r);return n}async function Xt(e,t,n={}){if(!e)return new URL(t).toString();if(me(e))return new URL(e).toString();if(Nt(e))return Ft(e,t);let r=Et[e.toLowerCase()];if(r){let o=new URL(t),s=Q(o.pathname);return o.pathname=`${s}${r}`,o.toString()}return ut(e)?Kt(e,t,n):Wt(e,t)}async function en(e,t){try{let n=new URL(e),r=n.searchParams.get("bundle")||"";if(!r)return e;let o=t?.appDir??await z(r)??void 0,s=We({bundleUrl:r,repoDir:o,exactProjectDir:!!t||!!o});return!s||s.imageUrl&&!await tn(s.imageUrl)?e:(n.searchParams.set("appSplash",Ke(s)),n.toString())}catch{return e}}async function tn(e){let t=new AbortController,n=setTimeout(()=>t.abort(),1500);try{let r=await fetch(e,{method:"HEAD",signal:t.signal});return r.status>=200&&r.status<400}catch{return!1}finally{clearTimeout(n)}}async function G(e,t=dt(),n={}){let r=await Xt(e,t,n),o=await en(await Yt(r,n.project),n.project);if(!n.device)return o;let s=new URL(o);return s.searchParams.set("device",n.device),s.toString()}function ot(e,t){let n=e?.url||e?.origin||t;try{let r=new URL(n);return r.searchParams.delete("bundle"),r.searchParams.delete("demo"),r.searchParams.delete("app"),r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("inspectOpen"),r.searchParams.delete("appFonts"),r.searchParams.delete("appSplash"),r.toString()}catch{return t}}async function nn(e,t,n,r={}){let o=new URL(await G(e,t,r));return o.searchParams.set("inspectOpen",n),o.toString()}async function rn(e,t,n,r={}){let o=r.attempts??30,s=r.intervalMs??500,i=r.minNodeCount??10;for(let a=0;a<o;a++){let l=P(e,{commandTimeoutMs:t,simId:n,simIdSource:"flag"});try{let u=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>i)return{bridge:l,count:u}}catch{}l.close(),await S(s)}return null}function on(e){if(!e)return null;try{let t=new URL(e);if(t.searchParams.has("bundle")){let n=t.searchParams.get("bundle")||"";try{let r=new URL(n),o=r.pathname.length>36?`...${r.pathname.slice(-36)}`:r.pathname;return`bundle ${r.host}${o}`}catch{return"bundle"}}return t.searchParams.has("port")?`connect :${t.searchParams.get("port")||""}`:t.searchParams.has("open")?`connect ${t.searchParams.get("open")||""}`:t.searchParams.has("demo")?`demo ${t.searchParams.get("demo")||"default"}`:t.pathname.includes("/sootsim/index.html")||t.pathname==="/sootsim/"||t.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function sn(e){let t=e.indexOf(":");if(t<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let n=e.slice(0,t),r=e.slice(t+1),o=r.length>12?`${r.slice(0,8)}\u2026`:r;return n==="TM_SESSION"||n==="CLAUDE_CODE_SESSION_ID"||n==="CODEX_THREAD_ID"?`agent ${o}`:`${n} ${o}`}function Jn(e,t){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
|
|
4
|
+
import{a as I,b as Le,c as Ne}from"./chunk-3BN7ACIG.js";import{m as A}from"./chunk-ASR54LQA.js";import{m as Re,p as Ue}from"./chunk-I5SSRJDW.js";import{b as Ae,j as qe}from"./chunk-LFJQHZGK.js";import{a as We,b as Ke,d as ze}from"./chunk-2HUVXSCB.js";import{a as Oe,b as L,c as ae,d as le,e as De,f as Be,h as je,i as z,j as He}from"./chunk-7QL76I5Z.js";import{a as Fe}from"./chunk-Y2KNXEIX.js";import{a as ce}from"./chunk-LR5GL7TZ.js";import{b as Ee,c as _e,d as ie,f as Te,g as Me,h as _,i as P,j as T}from"./chunk-GHXN67UJ.js";import{f as Pe}from"./chunk-GEXLPJZ6.js";import{b as se,d as Ie}from"./chunk-ZE3HG74O.js";import{b as ke,g as Ce,h as D,i as x,j as B}from"./chunk-S6YNVIOG.js";import{H as $e,K as oe,M as q,O as xe,l as re}from"./chunk-25GKNYXJ.js";import{spawn as Ze,spawnSync as Xe}from"node:child_process";import M from"node:fs";import kt from"node:os";import R from"node:path";import{WebSocket as Ct}from"ws";function Ve(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 yt(e,t){return e?.includes("/one/metro-entry.bundle")?"one":typeof t=="string"&&t?"expo":"unknown"}function Je(e,t,n){return`${e}//${t}:${n}`}function St(e){if(typeof window>"u")return!1;try{let t=new URL(e);return I(t.hostname)&&I(window.location.hostname)&&t.origin!==window.location.origin}catch{return!1}}async function Ge(e,t){let n={...t,cache:t?.cache??"no-store"};return St(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,n):fetch(e,n)}function $t(e){return e==="https:"?443:80}function xt(e){let t=e.pathname||"/";return(t==="/"||t==="")&&!e.search&&!e.hash}async function Pt(e){try{let t=await fetch("/__server-scan",{cache:"no-store"});if(!t.ok||!(t.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let n=await t.json();if(!Array.isArray(n))return null;let r=n.find(o=>!!o&&typeof o=="object"&&o.port===e&&typeof o.bundleUrl=="string");return r?{bundleUrl:le(r.bundleUrl),port:e,framework:typeof r.framework=="string"?r.framework:"unknown",projectName:typeof r.projectName=="string"?r.projectName:void 0}:null}catch{return null}}async function Qe(e,t){let n=e.replace(/\/+$/,"");try{if(I(new URL(n).hostname)){let r=await Pt(t);if(r)return r}}catch{}try{let r=await Ge(`${n}/`,{headers:{"expo-platform":"ios"}});if(r.ok){let o=await r.json(),s=o?.extra?.expoClient||o?.extra||{},i=typeof o?.launchAsset?.url=="string"?o.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:le(i||`${n}${ae}`),port:t,framework:yt(i,s.sdkVersion),projectName:s.name}}}catch{}try{let r=await Ge(`${n}/status`);if(r.ok&&(await r.text()).includes("packager-status:running"))return{bundleUrl:`${n}${ae}`,port:t,framework:"metro"}}catch{}return null}async function It(e){return Qe(Je("http:","localhost",e),e)}async function Ye(e){let t=e.trim();if(/^\d+$/.test(t)){let a=parseInt(t,10),l=await It(a);if(l)return l;throw Ve(`localhost:${a}`)}let n=t.startsWith("http")?t:`http://${t}`,r;try{r=new URL(n)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let o=r.protocol||"http:",s=r.port?parseInt(r.port,10):$t(o),i=Je(o,r.hostname,s);if(xt(r)){let a=await Qe(i,s);if(a)return a;throw Ve(i)}return{bundleUrl:r.toString(),port:s,framework:"unknown"}}var Rt=12e4,et=100,Ut=5e3,tt=1e4,Et={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 S(e){return new Promise(t=>setTimeout(t,e))}function nt(e){let t=process.env[e]?.trim();if(!t)return null;let n=Number(t);return Number.isInteger(n)&&n>0?n:null}function _t(){let e=nt("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??nt("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??Rt;return{timeoutMs:e,hostTimeoutMs:e+Ut,intervalMs:et,attempts:Math.max(1,Math.ceil(e/et))}}function rt(e){return e==="electron"||e==="playwright"}function ue(e,t){return t==="playwright"?e.meta?.sootsimHostDriver==="playwright":e.userAgent?.includes("Electron/")===!0}function Tt(e,t){return e.includes("--headless")?!0:e.includes("--headed")?!1:t==="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 J(e){return e.trim()}var ct=/^[A-Za-z][A-Za-z0-9+.-]*:/;function Mt(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return ct.test(t)||t.startsWith("/")?t:`/${t}`}function Ot(e){return e!==null&&typeof e=="object"}function Dt(e){let t=e.trim();return t?t.startsWith("/")?!0:ct.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function Bt(e){if(await V(e,250))return e;let t=oe();if(t&&q(t)&&await V(t.bridgePort,500))return t.bridgePort;if(t&&q(t))throw new Error(`sootsim bridge lockfile is fresh (port ${t.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await At();let n=Lt(["serve","--quiet","--port",String(e)]),r=null;n.once("exit",(s,i)=>{r=String(s??i??"unknown")}),n.unref();let o=Date.now()+tt;for(;Date.now()<o;){let s=oe();if(s&&q(s)&&await V(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 V(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(r)throw new Error(`sootsim bridge exited before becoming ready (exit ${r})`);await S(150)}throw new Error(`sootsim bridge did not start within ${Math.round(tt/1e3)}s`)}async function At(){let e=$e();if(e&&M.existsSync(re(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:t}=await import("./runtime-KOIKZGYF.js");await t(["install"],{})}function Lt(e){let t=process.argv[1];return t&&M.existsSync(t)?Ze(process.execPath,[t,...e],{detached:!0,stdio:"ignore",env:process.env}):Ze("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function V(e,t){return new Promise(n=>{let r=new Ct(`ws://127.0.0.1:${e}`,{handshakeTimeout:t}),o=!1,s=i=>{if(!o){o=!0;try{r.close()}catch{}n(i)}};r.once("open",()=>s(!0)),r.once("error",()=>s(!1)),setTimeout(()=>s(!1),t)})}function me(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,"")||"/";return t.searchParams.has("open")||t.searchParams.has("port")||t.searchParams.has("bundle")||t.searchParams.has("demo")||t.pathname.includes("/sootsim/index.html")||n==="/sootsim"||t.pathname==="/__soot"||t.pathname==="/__soot/"||n==="/rn"||/^\/rn\/[^/]+$/i.test(n)||/^\/app\/[^/]+$/i.test(n)||n==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(n)||/^\/__soot\/app\/[^/]+$/i.test(n)}catch{return!1}}function Nt(e){try{let t=new URL(e,"http://sootsim.local");if(t.origin!=="http://sootsim.local")return!1;let n=t.pathname.replace(/\/+$/,"")||"/";return n==="/rn"||/^\/rn\/[^/]+$/i.test(n)||/^\/app\/[^/]+$/i.test(n)||n==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(n)||/^\/__soot\/app\/[^/]+$/i.test(n)}catch{return!1}}function Ft(e,t){let n=new URL(e,"http://sootsim.local"),r=new URL(t),o=Q(r.pathname),s=n.pathname.startsWith("/__soot/")?n.pathname.slice(7):n.pathname;return r.pathname=`${o}${s}`,r.search=n.search,r.hash=n.hash,r.toString()}function jt(e){try{let t=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(t)||/^\/build\/.+/.test(t)}catch{return!1}}async function Gn(e){let t=J(e);return(await fe(t)).bundleUrl}function Ht(e){try{let t=new URL(e.startsWith("http")?e:`http://${e}`),n=t.pathname||"/";if(n!=="/"&&n!==""||t.search||t.hash||!I(t.hostname))return null;let r=t.port?Number(t.port):t.protocol==="https:"?443:80;return Number.isFinite(r)&&r>0?r:null}catch{return null}}async function fe(e){let t=J(e),n=/^\d+$/.test(t)?Number(t):Ht(t);if(n&&n>0){let r=await Be(n);if(r)return{bundleUrl:r.bundleUrl,port:r.port,framework:r.framework,projectName:r.projectName}}return Ye(t)}function Q(e){let t=e.replace(/\/+$/,"")||"/";return t==="/__soot"||t.startsWith("/__soot/")?"/__soot":""}function Wt(e,t){let n=J(e),r=new URL(t),o=Q(r.pathname);return r.pathname=`${o}/rn`,r.searchParams.delete("bundle"),r.searchParams.delete("demo"),r.searchParams.delete("app"),r.searchParams.delete("open"),r.searchParams.delete("port"),/^\d+$/.test(n)?r.pathname=`${o}/rn/${n}`:(r.pathname=`${o}/rn`,r.searchParams.set("open",n)),r.toString()}function ut(e){let t=J(e);return/^\d+$/.test(t)||/^https?:\/\//i.test(t)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(t)}async function Kt(e,t,n={}){let r=n.resolvedBundle??await fe(e),o=new URL(t),s=Q(o.pathname);o.pathname=`${s}/rn`,o.searchParams.delete("open"),o.searchParams.delete("port"),o.searchParams.delete("demo"),o.searchParams.delete("app");let i=n.hot===void 0?r.bundleUrl:De(r.bundleUrl,n.hot);return o.searchParams.set("bundle",i),o.toString()}function qt(e){return e.startsWith("~/")?R.join(kt.homedir(),e.slice(2)):R.isAbsolute(e)?e:R.resolve(process.cwd(),e)}function zt(e){let t={},n={};for(let o=0;o<e.length;o++){if(e[o]==="--replace"){let s=e[o+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=qt(s.slice(i+1).trim());M.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),t[a]={file:l},o++;continue}if(e[o]==="--remap"){let s=e[o+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)),n[s.slice(0,i).trim()]=s.slice(i+1).trim(),o++;continue}}let r={};return Object.keys(t).length>0&&(r.modules=t),Object.keys(n).length>0&&(r.network={remap:n}),r.modules||r.network?r:void 0}async function Vt(e){if(e){let t=await z(e.bundleUrl);if(t)return ce(t,{trustStart:!0})}return ce(process.env.CONTRAST_REPO_DIR||process.cwd())}async function Gt(e){if(M.existsSync(R.join(re(e),"index.html")))return;console.error(` installing configured engine runtime ${e}...`);let t=await Pe.install({version:e,setActive:!1,protectVersions:xe()});console.error(` installed engine runtime ${t.version}`)}function Jt(e,t){if(!t)return e;let n=new URL(e);if(!I(n.hostname))throw new Error(`runtimeVersion ${t} requires a local SootSim host; got ${n.origin}`);return n.hostname=Ne(t),n.toString()}function dt(){return Ee().shellBaseUrl}function Qt(e){return _e(e)?.shellBaseUrl??ke(e)??dt()}async function Yt(e,t){try{let n=new URL(e),r=n.searchParams.get("bundle")||"";if(!r)return e;let o=t?.appDir??await z(r)??void 0,s=je({bundleUrl:r,repoDir:o,exactProjectDir:!!t||!!o});if(s.length===0)return e;let i=await Zt(s);return i.length===0?e:(n.searchParams.set("appFonts",He(i)),n.toString())}catch{return e}}async function Zt(e){let t=await Promise.all(e.map(async r=>{let o=new AbortController,s=setTimeout(()=>o.abort(),1500);try{let i=await fetch(r.url,{method:"HEAD",signal:o.signal});return i.status>=200&&i.status<400?r:null}catch{return null}finally{clearTimeout(s)}})),n=[];for(let r of t)r!==null&&n.push(r);return n}async function Xt(e,t,n={}){if(!e)return new URL(t).toString();if(me(e))return new URL(e).toString();if(Nt(e))return Ft(e,t);let r=Et[e.toLowerCase()];if(r){let o=new URL(t),s=Q(o.pathname);return o.pathname=`${s}${r}`,o.toString()}return ut(e)?Kt(e,t,n):Wt(e,t)}async function en(e,t){try{let n=new URL(e),r=n.searchParams.get("bundle")||"";if(!r)return e;let o=t?.appDir??await z(r)??void 0,s=We({bundleUrl:r,repoDir:o,exactProjectDir:!!t||!!o});return!s||s.imageUrl&&!await tn(s.imageUrl)?e:(n.searchParams.set("appSplash",Ke(s)),n.toString())}catch{return e}}async function tn(e){let t=new AbortController,n=setTimeout(()=>t.abort(),1500);try{let r=await fetch(e,{method:"HEAD",signal:t.signal});return r.status>=200&&r.status<400}catch{return!1}finally{clearTimeout(n)}}async function G(e,t=dt(),n={}){let r=await Xt(e,t,n),o=await en(await Yt(r,n.project),n.project);if(!n.device)return o;let s=new URL(o);return s.searchParams.set("device",n.device),s.toString()}function ot(e,t){let n=e?.url||e?.origin||t;try{let r=new URL(n);return r.searchParams.delete("bundle"),r.searchParams.delete("demo"),r.searchParams.delete("app"),r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("inspectOpen"),r.searchParams.delete("appFonts"),r.searchParams.delete("appSplash"),r.toString()}catch{return t}}async function nn(e,t,n,r={}){let o=new URL(await G(e,t,r));return o.searchParams.set("inspectOpen",n),o.toString()}async function rn(e,t,n,r={}){let o=r.attempts??30,s=r.intervalMs??500,i=r.minNodeCount??10;for(let a=0;a<o;a++){let l=P(e,{commandTimeoutMs:t,simId:n,simIdSource:"flag"});try{let u=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>i)return{bridge:l,count:u}}catch{}l.close(),await S(s)}return null}function on(e){if(!e)return null;try{let t=new URL(e);if(t.searchParams.has("bundle")){let n=t.searchParams.get("bundle")||"";try{let r=new URL(n),o=r.pathname.length>36?`...${r.pathname.slice(-36)}`:r.pathname;return`bundle ${r.host}${o}`}catch{return"bundle"}}return t.searchParams.has("port")?`connect :${t.searchParams.get("port")||""}`:t.searchParams.has("open")?`connect ${t.searchParams.get("open")||""}`:t.searchParams.has("demo")?`demo ${t.searchParams.get("demo")||"default"}`:t.pathname.includes("/sootsim/index.html")||t.pathname==="/sootsim/"||t.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function sn(e){let t=e.indexOf(":");if(t<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let n=e.slice(0,t),r=e.slice(t+1),o=r.length>12?`${r.slice(0,8)}\u2026`:r;return n==="TM_SESSION"||n==="CLAUDE_CODE_SESSION_ID"||n==="CODEX_THREAD_ID"?`agent ${o}`:`${n} ${o}`}function Jn(e,t){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
|
|
5
5
|
`);for(let n of e){let r=n.lockedBy&&n.lockExpiresAt?`locked by ${sn(n.lockedBy)} (${Math.max(0,Math.round((n.lockExpiresAt-Date.now())/1e3))}s)`:"",o=[n.isPrimary?"primary":"",n.id===t?"selected":"",n.readyState,n.userVisible===!1?"hidden":n.userVisible===!0?"visible":"",n.attachedCliCount&&n.attachedCliCount>0?"in use":"",n.userFocused?"focused":"",r].filter(Boolean);console.log(` ${n.id}${o.length?` [${o.join(", ")}]`:""}`);let s=on(n.url);if(s)console.log(` loaded: ${s}`);else if(n.url){let a=n.url.length>96?`${n.url.slice(0,93)}\u2026`:n.url;console.log(` url: ${a}`)}else n.origin&&console.log(` origin: ${n.origin}`);let i=an(n);i&&console.log(` engine: ${i}`),n.title&&console.log(` title: ${n.title}`),n.visibilityState&&n.visibilityState!=="visible"&&console.log(` visibility: ${n.visibilityState}`),console.log(` connected: ${st(Date.now()-n.connectedAt)}`),n.lastActiveAt&&n.lastActiveAt>0&&console.log(` last active: ${st(Date.now()-n.lastActiveAt)}`)}}function an(e){let t=e.url||e.origin||"";if(!t)return null;try{let n=new URL(t).port;return n==="5173"?"dev \u2014 local source (:5173)":n==="3000"?"Contrast app embedded (:3000)":Le()?`dev \u2014 local build (:${n||"?"})`:`runtime \u2014 published engine (:${n||"?"})`}catch{return null}}function st(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s ago`:t<3600?`${Math.round(t/60)}m ago`:t<86400?`${Math.round(t/3600)}h ago`:`${Math.round(t/86400)}d ago`}async function Qn(e,t,n,r={}){let o=r.attempts??30,s=r.intervalMs??500;for(let i=0;i<o;i++){let a=P(e,{commandTimeoutMs:t});try{let u=(await a.listSims()).find(n);if(u)return u}catch{}finally{a.close()}await S(s)}return null}async function ln(e,t,n,r,o={}){let s=o.attempts??30,i=o.intervalMs??500,a=!!r&&Number.isInteger(r)&&r>1,l=()=>a&&r!==void 0&&!pe(r);for(let u=0;u<s;u++){if(l())return{kind:"host-exit"};let c=P(e,{commandTimeoutMs:t});try{let g=(await c.listSims()).find(n);if(g)return l()?{kind:"host-exit"}:{kind:"match",sim:g}}catch{}finally{c.close()}if(l())return{kind:"host-exit"};await S(i)}return{kind:"timeout"}}async function cn(e,t,n,r={}){let o=r.attempts??20,s=r.intervalMs??250;for(let i=0;i<o;i++){let a=P(e,{commandTimeoutMs:t});try{let u=(await a.listSims()).find(c=>c.id===n);if(!u||u.readyState!=="open")return!0}catch{return!0}finally{a.close()}await S(s)}return!1}function un(e){let t=e.meta;if(!t||t.sootsimHostDriver!=="playwright")return null;let n=Number(t.sootsimHostPid);return!Number.isInteger(n)||n<=1||n===process.pid?null:n}function dn(e){if(!e.connectAckFile)return!1;try{return M.writeFileSync(e.connectAckFile,`${JSON.stringify({connectedAt:Date.now(),pid:e.pid??null})}
|
|
6
6
|
`,{flag:"w"}),!0}catch{return!1}}function it(e){if(e.diagnosticLogPath)try{let t=M.readFileSync(e.diagnosticLogPath,"utf8").trim();if(!t){console.error(` ${R.basename(e.diagnosticLogPath)} was empty`);return}let n=t.length>4e3?`\u2026
|
|
7
7
|
${t.slice(-4e3)}`:t;console.error(` ${R.basename(e.diagnosticLogPath)}:`),console.error(n)}catch(t){let n=t instanceof Error?t.message:String(t);console.error(` failed to read ${R.basename(e.diagnosticLogPath)}: ${n}`)}}function pe(e){try{return process.kill(e,0),!0}catch(t){return t?.code==="EPERM"}}async function mn(e,t=2500){let n=Date.now()+t;for(;Date.now()<n;){if(!pe(e))return!0;await S(100)}return!pe(e)}function pn(e){let t=Xe("ps",["-o","command=","-p",String(e)],{encoding:"utf8",stdio:["ignore","pipe","pipe"]}),n=Xe("ps",["eww","-o","command=","-p",String(e)],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(t.status!==0||n.status!==0)return!1;let r=(t.stdout||"").trimEnd(),o=(n.stdout||"").trimEnd();return(o.startsWith(r)?o.slice(r.length):o).includes("SOOTSIM_PW_URL=")}async function de(e,t){let n=new Set(t),r=new Set;for(let o of e){if(!n.has(o.id))continue;let s=un(o);s&&r.add(s)}for(let o of r){if(!pn(o)){console.log(` skipped pid ${o}: not a sootsim playwright host (stale sim record)`);continue}try{process.kill(o,"SIGTERM")}catch{}if(await mn(o)){console.log(` closed playwright host process ${o}`);continue}try{process.kill(o,"SIGKILL"),console.log(` force-closed playwright host process ${o}`)}catch{}}}function Y(e,t){if(t){let o=t.trim(),s=e.find(i=>i.id===o);if(!s)throw new Error(`no sim connected with id ${o}`);return s}let n=e.find(o=>o.isPrimary&&o.readyState==="open");if(n)return n;let r=e.find(o=>o.readyState==="open");if(r)return r;throw new Error("no sim connected")}function at(e,t,n){console.log(` ${n==="current sim"?"loaded":"opened"}: ${e} [${n}]`),console.log(` current sim: ${t.id}`),console.log(JSON.stringify({simId:t.id,url:t.url},null,2))}async function lt(e,t,n){if(n.includes("--no-describe"))return;let r=process.env.SOOTSIM_QUIET_TARGET_NOTICE;process.env.SOOTSIM_QUIET_TARGET_NOTICE="1";try{await fn(e,t,{stableMs:150,maxMs:400});let o=P(e,{commandTimeoutMs:3e3,simId:t,cliLabel:"open --describe",simIdSource:"flag"});try{let s=null;try{s=await o.send({type:"evaluate",code:Re})}catch{}if(s&&!(s.flag===!0&&!s.loadingText&&Ue(s))){let c=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: ${c} (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.309 | (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,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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 R}from"./chunk-WX747PJK.js";import{o as T}from"./chunk-BMFU7YRS.js";import{a as D}from"./chunk-RAHHXSBC.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import f from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||T()}function y(){return _()}function B(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=B(),t;try{t=f.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{f.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=B();f.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=f.openSync(r,"w",384);try{f.writeFileSync(n,JSON.stringify(e,null,2)),f.fsyncSync(n)}finally{f.closeSync(n)}f.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function U(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ye(e){let t=h.resolve(e.cwd),r=U(t),n;return w(o=>{let s=o.attachedProjects.find(a=>a.id===r);if(s){let a={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=a,n=a;return}let c=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:c,updatedAt:c};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function Se(){return S().attachedProjects}var Q=336*60*60*1e3;function we(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],c=o-Q,d=s.filter(a=>a.ts>=c);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function ve(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function Ae(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let c=r.agentSessions.find(d=>d.id===e.id);if(c){let d={...c,...e,lastSeenAt:Date.now()},a=r.agentSessions.indexOf(c);r.agentSessions[a]=d,t=d;return}}let n=r.attachedProjects.find(c=>c.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function V(e,t,r=Date.now()){return{...e,...t,id:e.id,projectId:e.projectId,createdAt:e.createdAt,lastSeenAt:r}}function z(e){e.length!==0&&w(t=>{let r=Date.now(),n=new Map(t.agentSessions.map((o,s)=>[o.id,s]));for(let{id:o,patch:s}of e){let c=n.get(o);c!==void 0&&(t.agentSessions[c]=V(t.agentSessions[c],s,r))}})}function v(e,t){z([{id:e,patch:t}])}async function Pe(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-QPNNLHR5.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!f.existsSync(o.dir))continue;let s=h.resolve(o.dir),c=U(s);if(n.attachedProjects.some(a=>a.id===c))continue;let d=Date.now();n.attachedProjects.push({id:c,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as Z,spawnSync as ee}from"node:child_process";import{randomUUID as te}from"node:crypto";import i,{constants as m}from"node:fs";import u from"node:path";import re from"node:readline";function b(e){return u.join(y(),"sessions",e)}function W(e){return u.join(b(e),"prompt.in")}function J(e){return u.join(b(e),"events.out")}function ne(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(b(t)))}function se(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=oe();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function oe(){try{let e=ie();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli`.")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function ie(){try{let r=D.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=ce();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function ce(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ae(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,c=null;for(;c===null;)try{c=i.openSync(o,m.O_WRONLY|m.O_CREAT|m.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let a=Number(i.readFileSync(o,"utf8").trim());if(a&&!de(a)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(a=>setTimeout(a,50))}try{return i.writeFileSync(c,String(process.pid)),await r()}finally{try{i.closeSync(c)}catch{}try{i.unlinkSync(o)}catch{}}}function de(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=ee("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Re(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ae(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?te():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),c=W(s.id),d=J(s.id),a=ne(s.id);L(c),L(d);let g=u.dirname(a);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=se(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",c,"--events-out",d,"--transcript",a];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=Z(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});x.unref();let E=e.readyTimeoutMs??6e3,j=await ue(d,p=>p.type==="ready"||p.type==="error",E);if(!j||j.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(b(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=j&&j.type==="error"?j.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function Ne(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,m.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
4
|
+
import{a as R}from"./chunk-H4F7PJTT.js";import{o as T}from"./chunk-25GKNYXJ.js";import{a as D}from"./chunk-WKDTGITC.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import f from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||T()}function y(){return _()}function B(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=B(),t;try{t=f.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{f.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=B();f.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=f.openSync(r,"w",384);try{f.writeFileSync(n,JSON.stringify(e,null,2)),f.fsyncSync(n)}finally{f.closeSync(n)}f.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function U(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ye(e){let t=h.resolve(e.cwd),r=U(t),n;return w(o=>{let s=o.attachedProjects.find(a=>a.id===r);if(s){let a={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=a,n=a;return}let c=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:c,updatedAt:c};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function Se(){return S().attachedProjects}var Q=336*60*60*1e3;function we(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],c=o-Q,d=s.filter(a=>a.ts>=c);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function ve(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function Ae(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let c=r.agentSessions.find(d=>d.id===e.id);if(c){let d={...c,...e,lastSeenAt:Date.now()},a=r.agentSessions.indexOf(c);r.agentSessions[a]=d,t=d;return}}let n=r.attachedProjects.find(c=>c.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function V(e,t,r=Date.now()){return{...e,...t,id:e.id,projectId:e.projectId,createdAt:e.createdAt,lastSeenAt:r}}function z(e){e.length!==0&&w(t=>{let r=Date.now(),n=new Map(t.agentSessions.map((o,s)=>[o.id,s]));for(let{id:o,patch:s}of e){let c=n.get(o);c!==void 0&&(t.agentSessions[c]=V(t.agentSessions[c],s,r))}})}function v(e,t){z([{id:e,patch:t}])}async function Pe(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-KBMT5UGA.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!f.existsSync(o.dir))continue;let s=h.resolve(o.dir),c=U(s);if(n.attachedProjects.some(a=>a.id===c))continue;let d=Date.now();n.attachedProjects.push({id:c,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as Z,spawnSync as ee}from"node:child_process";import{randomUUID as te}from"node:crypto";import i,{constants as m}from"node:fs";import u from"node:path";import re from"node:readline";function b(e){return u.join(y(),"sessions",e)}function W(e){return u.join(b(e),"prompt.in")}function J(e){return u.join(b(e),"events.out")}function ne(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(b(t)))}function se(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=oe();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function oe(){try{let e=ie();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli`.")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function ie(){try{let r=D.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=ce();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function ce(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ae(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,c=null;for(;c===null;)try{c=i.openSync(o,m.O_WRONLY|m.O_CREAT|m.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let a=Number(i.readFileSync(o,"utf8").trim());if(a&&!de(a)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(a=>setTimeout(a,50))}try{return i.writeFileSync(c,String(process.pid)),await r()}finally{try{i.closeSync(c)}catch{}try{i.unlinkSync(o)}catch{}}}function de(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=ee("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Re(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ae(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?te():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),c=W(s.id),d=J(s.id),a=ne(s.id);L(c),L(d);let g=u.dirname(a);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=se(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",c,"--events-out",d,"--transcript",a];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=Z(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});x.unref();let E=e.readyTimeoutMs??6e3,j=await ue(d,p=>p.type==="ready"||p.type==="error",E);if(!j||j.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(b(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=j&&j.type==="error"?j.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function Ne(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,m.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
5
5
|
`)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function $e(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=b(e),n=y();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function _e(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,m.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=re.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let a=I(d);a&&t(a)});let c=!1;return()=>{if(!c){c=!0;try{i.writeSync(n,`
|
|
6
6
|
`)}catch{}try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ue(e,t,r){let n=i.openSync(e,m.O_RDWR|m.O_NONBLOCK),o=Buffer.alloc(8192),s="",c=Date.now()+r;try{for(;Date.now()<c;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(a){if(a.code!=="EAGAIN")throw a;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let a;for(;(a=s.indexOf(`
|
|
7
7
|
`))>=0;){let g=s.slice(0,a);s=s.slice(a+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(a=>setTimeout(a,30))}return null}finally{i.closeSync(n)}}export{I as a,y as b,ye as c,F as d,Se as e,we as f,ve as g,Ae as h,k as i,C as j,V as k,z as l,Pe as m,b as n,W as o,J as p,ne as q,O as r,se as s,l as t,Re as u,Ne as v,$e as w,_e as x};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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 k}from"./chunk-
|
|
4
|
+
import{a as k}from"./chunk-LR5GL7TZ.js";import{createHash as L}from"node:crypto";import D from"node:fs";import{createRequire as E}from"node:module";import x from"node:path";var w=/(^|\/)expo-splash-screen$/,A=/(^|\/)react-native-bootsplash$/;function R(n,e){let r=e.replace(/\/+$/,""),t=n.replace(/^\.\//,"").replace(/^\/+/,"");if(t)return`${r}/assets/${t}`}function d(n,e,r){return r?r(n):R(n,e)}function y(n){if(n==="cover")return"cover";if(n==="contain"||n==="native")return"contain"}function c(n){return typeof n=="string"&&n.length>0?n:void 0}function S(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function O(n,e,r){if(!n||typeof n!="object")return null;let t=n,o={source:"expo-splash-screen",backgroundColor:c(t.backgroundColor)??"#ffffff"},i=c(t.image);i&&(o.imageUrl=d(i,e,r));let s=S(t.imageWidth);s!=null&&(o.imageWidthPx=s);let l=y(t.resizeMode);l&&(o.resizeMode=l);let a=t.dark;if(a&&typeof a=="object"){let u=a,g=c(u.backgroundColor),f=c(u.image);(g||f)&&(o.dark={},g&&(o.dark.backgroundColor=g),f&&(o.dark.imageUrl=d(f,e,r)))}return o}function v(n,e,r,t){let p=n[e],o=p&&typeof p=="object"?p.splash:void 0,i=n.splash,s=o&&typeof o=="object"?o:i;if(!s||typeof s!="object")return null;let a={source:"expo-legacy",backgroundColor:c(s.backgroundColor)??"#ffffff",imageWidthPx:S(s.imageWidth)??200,resizeMode:y(s.resizeMode)??"contain"},u=c(s.image);u&&(a.imageUrl=d(u,r,t));let g=s.dark;if(g&&typeof g=="object"){let f=g,m=c(f.backgroundColor),h=c(f.image);(m||h)&&(a.dark={},m&&(a.dark.backgroundColor=m),h&&(a.dark.imageUrl=d(h,r,t)))}return a}function j(n,e,r){if(!n||typeof n!="object")return null;let t=n,p=c(t.logo);if(!p)return null;let o={source:"react-native-bootsplash",backgroundColor:c(t.background)??"#fff",imageUrl:d(p,e,r),imageWidthPx:S(t.logoWidth)??100,resizeMode:"contain"},i=c(t.darkBackground),s=c(t.darkLogo);return(i||s)&&(o.dark={},i&&(o.dark.backgroundColor=i),s&&(o.dark.imageUrl=d(s,e,r))),o}function b(n,e,r,t={}){if(!n||typeof n!="object")return null;let p=n,o=p.plugins,i=null,s=null;if(Array.isArray(o))for(let l of o){let a=Array.isArray(l)?l[0]:l;if(typeof a!="string")continue;let u=Array.isArray(l)?l[1]??{}:{};!i&&w.test(a)?i=O(u,r,t.resolveAssetUrl):!s&&A.test(a)&&(s=j(u,r,t.resolveAssetUrl))}return s||i||v(p,e,r,t.resolveAssetUrl)}var C=E(import.meta.url);function I(n){try{let e=new URL(n),r=e.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r))return e.origin}catch{}return null}function z(n){try{return D.statSync(x.join(n,"package.json")).isFile()}catch{return!1}}function K(n){let e=I(n.bundleUrl);if(!e)return null;let r=n.repoDir||process.env.CONTRAST_REPO_DIR,t=r?x.resolve(r):process.cwd();if(!r&&!z(t))return null;let o=k(t,{trustStart:n.exactProjectDir})?.appDir??null;if(!o)return null;let i=(n.platform||process.env.CONTRAST_PLATFORM||"ios").toLowerCase(),s=null;try{let a=C.resolve("@expo/config",{paths:[o,t]}),u=C(a);typeof u.getConfig=="function"&&(s=u.getConfig)}catch{}if(!s)return null;let l;try{let a=s(o,{skipSDKVersionRequirement:!0});a?.exp&&typeof a.exp=="object"&&(l=a.exp)}catch{}return!l||typeof l!="object"?null:b(l,i==="android"?"android":"ios",e)}function X(n){return encodeURIComponent(JSON.stringify(n))}function M(n){if(!n)return null;try{let e=JSON.parse(decodeURIComponent(n));if(!e||typeof e!="object")return null;let r=e;return r.source!=="expo-splash-screen"&&r.source!=="expo-legacy"&&r.source!=="react-native-bootsplash"||typeof r.backgroundColor!="string"?null:e}catch{return null}}function F(n){let e=new Set;return n.imageUrl&&e.add(n.imageUrl),n.dark?.imageUrl&&e.add(n.dark.imageUrl),[...e]}function W(n){let e=(n.split("?")[0].split(".").pop()||"").toLowerCase();return e==="png"?"image/png":e==="jpg"||e==="jpeg"?"image/jpeg":e==="webp"?"image/webp":e==="gif"?"image/gif":e==="svg"?"image/svg+xml":"application/octet-stream"}async function Q(n,e){let r=M(n);if(!r)return[];let t=[],p=new Set;for(let o of F(r)){let i=L("sha256").update(o).digest("hex");if(!p.has(i)){p.add(i);try{let s=await fetch(o);if(!s.ok){e?.onError?.(o,new Error(`${s.status} ${s.statusText}`));continue}let l=new Uint8Array(await s.arrayBuffer());t.push({url:o,urlhash:i,contentType:W(o),bytes:l}),e?.onStaged?.({url:o,byteLength:l.byteLength})}catch(s){e?.onError?.(o,s)}}}return t}import{spawn as T}from"child_process";function U(n,e={}){if(!n)throw new Error("openUrl requires a url");let r=e.platform??process.platform;return r==="darwin"?{command:"open",args:e.background===!1?[n]:["-g",n],via:"system"}:r==="win32"?{command:"cmd",args:["/c","start","",n],via:"system"}:{command:"xdg-open",args:[n],via:"system"}}async function N(n,e,r){return new Promise((t,p)=>{let o=T(n,e,{detached:r,stdio:"ignore"});o.once("error",p),o.once("spawn",()=>{r&&o.unref(),t(o.pid)})})}async function P(n,e={}){let r=U(n,e),t=await N(r.command,r.args,e.detached??!0);return{...r,pid:t,attachUrl:n}}async function $(n,e={}){await P(n,e)}export{K as a,X as b,Q as c,$ as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as w}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(w(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var v="dev.sootsim.simulator";function I(){let e=p();if(!e)return null;let n=l(e,"dist-electron/main.cjs");if(!s(n))return null;let i=P(e);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:e}:null}function x(){let e=p();return e?s(l(e,"src-electron/main.ts")):!1}function P(e){let n=e;for(let i=0;i<6;i++){let t=l(n,"node_modules/.bin/electron");if(s(t))return t;let r=m(n);if(r===n)break;n=r}return null}function b(){let e=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...e?[a(e,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${v}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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 c}from"./chunk-
|
|
4
|
+
import{a as c}from"./chunk-GEXLPJZ6.js";import{H as a,l as u}from"./chunk-25GKNYXJ.js";function f(t){return t.replace(/^\[|\]$/g,"").toLowerCase()}function p(t){let n=f(t);return n==="localhost"||n.endsWith(".localhost")||n==="0.0.0.0"||n==="::1"||/^127(?:\.\d{1,3}){3}$/.test(n)}import o from"fs";import e from"path";import{fileURLToPath as m}from"url";var l;function d(){if(l!==void 0)return l;let t=e.dirname(m(import.meta.url));for(let n=0;n<12&&t!==e.dirname(t);n++){if(o.existsSync(e.join(t,"packages/sootsim-engine/package.json"))&&o.existsSync(e.join(t,"public/sootsim")))return l=t,t;t=e.dirname(t)}return l=null,null}function w(){if(process.env.SOOTSIM_HOME&&a())return null;let t=d();if(!t)return null;let n=e.join(t,"public/sootsim");return o.existsSync(e.join(n,"index.html"))&&o.existsSync(e.join(n,"engine/index.html"))&&o.existsSync(e.join(n,"engine-tenant/worker.js"))?n:null}function R(t){let n=t.trim();if(!c(n))throw new Error(`invalid SootSim runtime version: ${t}`);let i=Buffer.from(n,"utf8").toString("hex").match(/.{1,60}/g);if(!i)throw new Error(`invalid SootSim runtime version: ${t}`);return`${i.join(".")}.runtime.localhost`}function y(t){let n=".runtime.localhost";if(!t.toLowerCase().endsWith(n))return null;let r=t.slice(0,-n.length).split(".");if(r.length===0||r.some(s=>!/^[0-9a-f]{1,60}$/i.test(s)))return null;let i=r.join("");if(i.length%2!==0)return null;try{let s=Buffer.from(i,"hex").toString("utf8");return c(s)?s:null}catch{return null}}function b(t){let n=u(t);return o.existsSync(e.join(n,"index.html"))?n:null}export{p as a,w as b,R as c,y as d,b as e};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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 K,b as V,c as Ne}from"./chunk-
|
|
4
|
+
import{a as K,b as V,c as Ne}from"./chunk-IPNM6NRT.js";import{c as Fe,d as Oe}from"./chunk-2HUVXSCB.js";import{k as $e}from"./chunk-7QL76I5Z.js";import{h as _e,j as Pe,l as B}from"./chunk-GHXN67UJ.js";import{c as Ue,d as E}from"./chunk-5O56UY3I.js";import{a as Ae}from"./chunk-HKQURR57.js";import{createHash as St}from"crypto";import{readFileSync as M}from"fs";import je from"path";import{gzipSync as ge,gunzipSync as vt}from"zlib";function Ce(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}import{brotliCompressSync as ut,constants as ct}from"node:zlib";var dt=9;function Le(e){return ut(e,{params:{[ct.BROTLI_PARAM_QUALITY]:dt}})}function ce(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(s)}}async function pt(e){let t=ce(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${s.slice(0,200)}`)}}async function mt(e,t=8,r){let s=0,o=0,i=e.length;await Promise.all(Array.from({length:Math.min(t,i)},async()=>{for(;s<i;){let l=e[s++];await pt(l),o++,r?.(o,i)}}))}function ft(e,t,r,s){let o=[];o.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let i of e.files){let l=r.get(i.urlhash);l&&o.push({url:i.putUrl,contentType:i.contentType,bytes:l})}e.events&&s?.eventsBytes&&o.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.timeline&&s?.timelineBytes&&o.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:s.timelineBytes}),e.flowVideo&&s?.videoBytes&&o.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&o.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),e.failureBundle&&s?.failureBundleBytes&&o.push({url:e.failureBundle.putUrl,contentType:e.failureBundle.contentType,bytes:s.failureBundleBytes});for(let i of e.snapshots??[]){let l=s?.snapshotBytes?.get(i.id);l&&o.push({url:i.putUrl,contentType:i.contentType,bytes:l})}return o}function gt(e){return e.replace(/\/+$/,"")}var W=class extends Error{constructor(r,s,o,i=""){super(r);this.status=s;this.phase=o;this.responseText=i;this.name="PresignedUploadError"}};async function ze(e){let t=gt(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-contrast-admin-upload-bypass"]=e.adminBypassToken);let s=ce(3e4,"init"),o;try{o=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!o.ok){let T=await o.text().catch(()=>"");throw new W(`init failed: ${o.status} ${T.slice(0,200)}`,o.status,"init",T)}let i=await o.json(),l=ft(i,e.bundleBytes,e.filesByHash,e.extras);await mt(l,e.concurrency??8,e.onPutProgress);let m=ce(3e4,"finalize"),c;try{c=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:i.token}),signal:m.signal})}finally{m.cancel()}if(!c.ok){let T=await c.text().catch(()=>"");throw new W(`finalize failed: ${c.status} ${T.slice(0,200)}`,c.status,"finalize",T)}let h=await c.json();return{init:i,finalize:h}}function ht(e){return e!==null&&typeof e=="object"?e:null}function De(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function de(e){let t=ht(e);return t?t.schemaVersion===1&&De(t.t)!==void 0&&De(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function yt(e,t){let r=[];for(let s of e.split(`
|
|
5
5
|
`)){let o=s.trim();if(o)try{let i=JSON.parse(o);t(i)&&r.push(i)}catch{}}return r}function He(e){return yt(e,de)}import{execSync as bt}from"child_process";function me(e){try{return bt(e,{stdio:["ignore","pipe","ignore"],timeout:3e3,encoding:"utf8"}).trim()||null}catch{return null}}function pe(e){let t=e?.trim();return!t||!/^\d+$/.test(t)?null:Number(t)}function wt(){let e=me("git remote get-url origin");if(!e)return null;let t=e.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);return t?{owner:t[1],repo:t[2]}:null}function fe(){let e=process.env.GITHUB_ACTIONS==="true",t=process.env.CONTRAST_BRANCH?.trim()||null,r=process.env.CONTRAST_SHA?.trim()||null,s=process.env.CONTRAST_PR_TITLE?.trim()||null,o=(process.env.CONTRAST_REPO||process.env.GITHUB_REPOSITORY||"").trim(),[i,l]=o.includes("/")?o.split("/",2):[null,null];if(e){let h=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];return{owner:i,repo:l,branch:t||process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim()||null,commitSha:r||process.env.GITHUB_SHA?.trim()||null,githubUsername:process.env.GITHUB_ACTOR?.trim()||null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER)??pe(h),pullRequestTitle:s,githubRunId:process.env.GITHUB_RUN_ID?.trim()||null,source:"ci"}}let m=t??me("git rev-parse --abbrev-ref HEAD"),c=i?null:wt();return{owner:i??c?.owner??null,repo:l??c?.repo??null,branch:m==="HEAD"?null:m,commitSha:r??me("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER),pullRequestTitle:s,githubRunId:null,source:"cli"}}function Yt(e){if(e.length===0)return{stepCount:null,failedStepIndex:null};let t=e.find(r=>r.status==="failure");return{stepCount:e.length,failedStepIndex:t?t.stepIndex:null}}function Qt(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function Xt(e){let t=e.auth??K();if(!t)return null;let r=fe(),s=e.owner??(t.kind==="github"?t.owner:null)??r.owner,o=e.repo??(t.kind==="github"?t.repo:null)??r.repo;try{let i=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:V(t)},body:JSON.stringify({kind:e.kind,source:r.source,name:e.name??void 0,prompt:e.prompt??void 0,summary:e.summary??void 0,status:e.status,failureMessage:e.failureMessage??void 0,previewShareId:e.previewShareId??void 0,owner:s??void 0,repo:o??void 0,branch:r.branch??void 0,commitSha:r.commitSha??void 0,githubUsername:r.githubUsername??void 0,pullRequestNumber:r.pullRequestNumber??void 0,githubRunId:r.githubRunId??void 0,stepCount:e.stepCount??void 0,failedStepIndex:e.failedStepIndex??void 0,durationMs:e.durationMs??void 0,flowYamlSizeBytes:e.flowYamlSizeBytes??void 0})});if(!i.ok){let m=await i.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${i.status}${m?`: ${m.slice(0,200)}`:""}`),null}let l=await i.json();return l.run?.id?{id:l.run.id,previewUrl:l.run.previewUrl??null,traceUrl:l.run.traceUrl??null}:(console.warn(" warn: run registration returned no id"),null)}catch(i){return console.warn(` warn: run registration failed: ${i instanceof Error?i.message:String(i)}`),null}}function Rt(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.message=="string"&&t.message?t.message:null}catch{return null}}function xt(e){let t=JSON.parse(M(e,"utf8"));if(!Array.isArray(t))throw new Error("snapshot manifest must be an array");let r=new Set;return t.map((s,o)=>{if(s===null||typeof s!="object")throw new Error(`snapshot manifest entry ${o} must be an object`);let i=Reflect.get(s,"id"),l=Reflect.get(s,"label"),m=Reflect.get(s,"path"),c=Reflect.get(s,"t");if(typeof i!="string"||!i||r.has(i))throw new Error(`snapshot manifest entry ${o} has an invalid or duplicate id`);if(typeof m!="string"||!m)throw new Error(`snapshot manifest entry ${o} has no PNG path`);if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new Error(`snapshot manifest entry ${o} has an invalid capture time`);r.add(i);let h=M(m);return{meta:{id:i,label:typeof l=="string"&&l?l:i,kind:"interaction",t:Math.round(c),contentType:"image/png",sizeBytes:h.byteLength},bytes:h}})}var Ve=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://contrast.dev",We=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",ye="https://contrast.localhost:3000",kt=2e3;async function Et(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${ye}/api/preview/upload/init`,{method:"OPTIONS",signal:AbortSignal.timeout(kt)});if(t.ok||t.status===204||t.status===405)return ye}catch{}return Ve}function N(e){return e.replace(/\/$/,"")}function Bt(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function It(e){try{let t=new URL(e).hostname.toLowerCase();return t==="contrast.dev"||t.endsWith(".contrast.dev")}catch{return!1}}function At(e,t){return t?N(t):process.env.SOOTSIM_PREVIEW_ORIGIN?N(process.env.SOOTSIM_PREVIEW_ORIGIN):Bt(e)?N(e):It(e)?N(We):N(e)}function Ut(){console.log(`
|
|
6
6
|
sootsim record upload \u2014 publish the current recorded bundle as a /preview/<id> link
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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
|
function t(_){return`(async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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}from"./chunk-
|
|
4
|
+
import{a}from"./chunk-HKQURR57.js";import{A as l,C as u}from"./chunk-25GKNYXJ.js";var c=/^[A-Za-z0-9._:-]{1,160}$/;function T(e){if(!e?.startsWith("TM_SESSION:"))return null;let n=e.slice(11).trim();return c.test(n)?n:null}function p(e){return c.test(e)}function f(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!l().productAnalytics}function m(){if(f())return null;let e=process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let n=process.env.CONTRAST_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:n.replace(/\/+$/,"")}}function d(){try{return u()}catch{return"anonymous-cli"}}function S(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:d():d()}function h(e){let n=e.identity??{},o=process.env.TM_SESSION,s=o&&p(o)?"team-machine":process.env.CI==="1"||process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true"?"ci":null,t={$lib:"sootsim-cli",source:n.source??"cli",...e.properties,traffic_type:s?"automated":"human",is_automated:s!==null,...s?{automation_source:s}:{}};return n.userId&&(t.userId=n.userId),n.repoId&&(t.repoId=n.repoId),n.installationId!=null&&(t.installationId=String(n.installationId)),n.shareId&&(t.shareId=n.shareId),n.plan&&(t.plan=n.plan),{event:e.event,distinct_id:S(n),properties:t,timestamp:new Date().toISOString()}}var r=[],I=!1;async function i(){if(r.length===0)return;let e=m();if(!e){r.length=0;return}let n=r.splice(0,r.length).map(h);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:n}),signal:AbortSignal.timeout(2e3)})}catch{}}function g(){I||(I=!0,process.on("beforeExit",()=>void i()),process.on("exit",()=>void i()))}function C(e){if(f())return;g();let n=null;try{n=a()?.user?.id??null}catch{n=null}r.push({...e,identity:{source:"cli",userId:n,...e.identity}})}async function E(){await i()}export{T as a,p as b,C as c,E as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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=Object.freeze({id:"ios",displayName:"iOS",isIOS:!0,isAndroid:!1,select:e=>e.ios}),r=Object.freeze({id:"android",displayName:"Android",isIOS:!1,isAndroid:!0,select:e=>e.android}),i=Object.freeze({ios:t,android:r});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.309 | (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{e as p}from"./chunk-
|
|
4
|
+
import{e as p}from"./chunk-3KB6LLD2.js";import{a as c,b as l}from"./chunk-IPNM6NRT.js";import{a}from"./chunk-HKQURR57.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
|
|
5
5
|
sootsim ${e} needs auth before it can check recording access.
|
|
6
6
|
|
|
7
7
|
pick one:
|