sootsim 0.1.60 → 0.1.62
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 +3 -3
- package/dist-cli/chunks/{agent-3QM476OM.js → agent-VKARDTF5.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-ZGA3WMEQ.js → agent-wrapper-6QDQ77TJ.js} +2 -2
- package/dist-cli/chunks/{assert-7LOZ3UZU.js → assert-PYSEWHJK.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-SUDPJ45T.js +2 -0
- package/dist-cli/chunks/beta-3HRWHUIR.js +2 -0
- package/dist-cli/chunks/{chunk-PIV6WQG4.js → chunk-2JSZSUTN.js} +2 -2
- package/dist-cli/chunks/{chunk-2367OT3T.js → chunk-35UHLN73.js} +2 -2
- package/dist-cli/chunks/{chunk-GZQHWPLT.js → chunk-3BWDOYAV.js} +3 -3
- package/dist-cli/chunks/{chunk-TNN7OYGT.js → chunk-3N6CKIJG.js} +2 -2
- package/dist-cli/chunks/{chunk-WY7EM456.js → chunk-3VE2XCQM.js} +29 -29
- package/dist-cli/chunks/{chunk-IDNLH47C.js → chunk-3WZ7ZTIA.js} +1 -1
- package/dist-cli/chunks/{chunk-PDC6SIIZ.js → chunk-4JXE3ZUG.js} +1 -1
- package/dist-cli/chunks/{chunk-7K3CWKDO.js → chunk-4MZLNYBR.js} +1 -1
- package/dist-cli/chunks/{chunk-LYEPRAQA.js → chunk-5POON745.js} +2 -2
- package/dist-cli/chunks/{chunk-32X2Q5FN.js → chunk-63NGN7QH.js} +2 -2
- package/dist-cli/chunks/{chunk-OXLLV636.js → chunk-66KS2T62.js} +2 -2
- package/dist-cli/chunks/{chunk-NRYQ2JZJ.js → chunk-6EUVCG33.js} +1 -1
- package/dist-cli/chunks/{chunk-QJBS67HI.js → chunk-6RJRJRAW.js} +1 -1
- package/dist-cli/chunks/{chunk-EJYB47BH.js → chunk-6TJONB3X.js} +1 -1
- package/dist-cli/chunks/{chunk-FVH44DUL.js → chunk-6XLG7CQG.js} +1 -1
- package/dist-cli/chunks/{chunk-QOWJXECZ.js → chunk-BIZ4APXE.js} +57 -57
- package/dist-cli/chunks/{chunk-I7FBCRYN.js → chunk-C6LE22VK.js} +2 -2
- package/dist-cli/chunks/{chunk-HJEHZSNV.js → chunk-CEOCVI4R.js} +12 -4
- package/dist-cli/chunks/{chunk-BXZN6LGB.js → chunk-DN47N6UL.js} +3 -3
- package/dist-cli/chunks/{chunk-4V7H5CSS.js → chunk-DNAVJIEL.js} +2 -2
- package/dist-cli/chunks/{chunk-A33UZUKE.js → chunk-DV4MSLJL.js} +2 -2
- package/dist-cli/chunks/chunk-DYYNEGJV.js +2 -0
- package/dist-cli/chunks/chunk-EIXXQDAI.js +11 -0
- package/dist-cli/chunks/{chunk-XNZIAKU5.js → chunk-H2QWYBE2.js} +2 -2
- package/dist-cli/chunks/{chunk-YQT3TRJ5.js → chunk-J5RNZMJJ.js} +2 -2
- package/dist-cli/chunks/{chunk-N7VXONQG.js → chunk-JIEJ2O4W.js} +1 -1
- package/dist-cli/chunks/{chunk-YKLWG4AA.js → chunk-ND2UZFA4.js} +1 -1
- package/dist-cli/chunks/{chunk-S4LMLA46.js → chunk-NXFXTJSP.js} +2 -2
- package/dist-cli/chunks/{chunk-NH6WDZCD.js → chunk-OMSSLTQC.js} +1 -1
- package/dist-cli/chunks/{chunk-2X5KYBDL.js → chunk-Q5EKBSA2.js} +2 -2
- package/dist-cli/chunks/{chunk-RDCLJUAL.js → chunk-RIYRSTXD.js} +2 -2
- package/dist-cli/chunks/chunk-S2RNIQCY.js +1 -0
- package/dist-cli/chunks/chunk-T6IRZEOS.js +1 -0
- package/dist-cli/chunks/{chunk-LKHZHA2M.js → chunk-TALVQX2P.js} +2 -2
- package/dist-cli/chunks/{chunk-S75CWUM2.js → chunk-TIUEUINU.js} +1 -1
- package/dist-cli/chunks/chunk-TSGJJFFO.js +1 -0
- package/dist-cli/chunks/{chunk-RFSQAGQM.js → chunk-UEF3ZIEI.js} +2 -2
- package/dist-cli/chunks/{chunk-ARKBI7JL.js → chunk-V3TU7DR4.js} +1 -1
- package/dist-cli/chunks/{chunk-LO7IVLWX.js → chunk-VBA6DIBD.js} +2 -2
- package/dist-cli/chunks/{chunk-BOVJRVYZ.js → chunk-WN2ATVFO.js} +2 -2
- package/dist-cli/chunks/chunk-XTR4CILB.js +2 -0
- package/dist-cli/chunks/{chunk-DMLDEQSS.js → chunk-YAKDXQA7.js} +2 -2
- package/dist-cli/chunks/{chunk-VTLZR3XL.js → chunk-YRKWTQ66.js} +1 -1
- package/dist-cli/chunks/cli-version-INI6PYTD.js +2 -0
- package/dist-cli/chunks/{compat-4TESUCFM.js → compat-GO5ZKWUL.js} +3 -3
- package/dist-cli/chunks/{config-GKXIKKRU.js → config-GWDGFFIB.js} +2 -2
- package/dist-cli/chunks/control-GMAG2HKS.js +2 -0
- package/dist-cli/chunks/{cpu-profile-2F4C2O7S.js → cpu-profile-TQRN7NFF.js} +2 -2
- package/dist-cli/chunks/{daemon-FMZ7MNVI.js → daemon-XLTCNIET.js} +2 -2
- package/dist-cli/chunks/{debug-IJCU56E5.js → debug-324KIABR.js} +3 -3
- package/dist-cli/chunks/demo-app-registry-OEAV2G5S.js +2 -0
- package/dist-cli/chunks/{detox-5UFOIOLZ.js → detox-QGITZG47.js} +2 -2
- package/dist-cli/chunks/{device-AE6AZUWE.js → device-6WFYBS5R.js} +2 -2
- package/dist-cli/chunks/{diagnose-FE27W2WT.js → diagnose-HBDMYEKJ.js} +2 -2
- package/dist-cli/chunks/drivers-TJSMGOQQ.js +2 -0
- package/dist-cli/chunks/{electron-FFIZI3WU.js → electron-5DX3DITH.js} +3 -3
- package/dist-cli/chunks/flow-HNHYMZO6.js +2 -0
- package/dist-cli/chunks/{hints-AVO3XSF2.js → hints-CJ3ETNUR.js} +2 -2
- package/dist-cli/chunks/{home-paths-XCSL4IZG.js → home-paths-OCOWHSRV.js} +2 -2
- package/dist-cli/chunks/{inspect-SEWOLKW2.js → inspect-QPZXN3IK.js} +3 -3
- package/dist-cli/chunks/install-OVCWRSPD.js +2 -0
- package/dist-cli/chunks/{install-desktop-ZVPLNWWN.js → install-desktop-RB3JNYHC.js} +3 -3
- package/dist-cli/chunks/{keys-2ANCWIJR.js → keys-HFOS3J5A.js} +2 -2
- package/dist-cli/chunks/{launch-QBCI6F33.js → launch-XQGAPI6Q.js} +3 -3
- package/dist-cli/chunks/{login-MPEC3IQC.js → login-U6ZPN4IL.js} +4 -4
- package/dist-cli/chunks/{logout-FHKV7PVB.js → logout-VY2F5T4J.js} +2 -2
- package/dist-cli/chunks/{maestro-HEPFHHZM.js → maestro-32UN2FHS.js} +2 -2
- package/dist-cli/chunks/{preview-SAM2AO6M.js → preview-AJWIS25K.js} +2 -2
- package/dist-cli/chunks/{profile-CW3WET2M.js → profile-4XPDQIQY.js} +2 -2
- package/dist-cli/chunks/{react-LFKI73YH.js → react-VSZ2RQEC.js} +2 -2
- package/dist-cli/chunks/{record-CM3G44PK.js → record-W6ZTLQTB.js} +3 -3
- package/dist-cli/chunks/runtime-6UMHX7N7.js +2 -0
- package/dist-cli/chunks/{runtime-delivery-MSETJQQ6.js → runtime-delivery-O7G4Y6GE.js} +2 -2
- package/dist-cli/chunks/{screenshot-D77TOEEP.js → screenshot-ALDT4B77.js} +3 -3
- package/dist-cli/chunks/{screenshot-mode-2YPUHGUB.js → screenshot-mode-5VYUB7G6.js} +2 -2
- package/dist-cli/chunks/{screenshots-RKWVNLEI.js → screenshots-TYQ4EVJR.js} +2 -2
- package/dist-cli/chunks/{server-GDOHSZQ3.js → server-X2GDTWC6.js} +2 -2
- package/dist-cli/chunks/setup-repo-Q7SMPBCH.js +2 -0
- package/dist-cli/chunks/{skills-2KROZMJJ.js → skills-C6RSSO4R.js} +2 -2
- package/dist-cli/chunks/{start-RTIULO26.js → start-Y2S3LSL5.js} +4 -4
- package/dist-cli/chunks/store-ABVWLB26.js +2 -0
- package/dist-cli/chunks/telemetry-2LWDURQ5.js +2 -0
- package/dist-cli/chunks/{test-WIBWT3SJ.js → test-IAHTJWBS.js} +3 -3
- package/dist-cli/chunks/{three-mode-XMBKE6NN.js → three-mode-ZCZXY47S.js} +2 -2
- package/dist-cli/chunks/{timeline-3RHZIXQV.js → timeline-KZHGTPDV.js} +2 -2
- package/dist-cli/chunks/{upgrade-MLQ3YZEU.js → upgrade-47JCBCFB.js} +2 -2
- package/dist-cli/chunks/upload-PNZ3UEOL.js +2 -0
- package/dist-cli/chunks/web-N6G3E6EE.js +2 -0
- package/dist-cli/chunks/{what-happened-FK6I5XEC.js → what-happened-FULTHMRQ.js} +2 -2
- package/dist-cli/chunks/{whoami-ZVUQ4ICS.js → whoami-3KUBLDUA.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.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/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.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/index.cjs +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/vite-base.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/auto-bootstrap-5SEVYWHQ.js +0 -2
- package/dist-cli/chunks/beta-WS6QLCUE.js +0 -2
- package/dist-cli/chunks/chunk-4LRESDDC.js +0 -11
- package/dist-cli/chunks/chunk-C6YD4Y7P.js +0 -1
- package/dist-cli/chunks/chunk-IKICAURU.js +0 -1
- package/dist-cli/chunks/chunk-UW4IDGIR.js +0 -2
- package/dist-cli/chunks/chunk-W7X3YMV3.js +0 -1
- package/dist-cli/chunks/chunk-YN2754CX.js +0 -2
- package/dist-cli/chunks/cli-version-ARDD24DZ.js +0 -2
- package/dist-cli/chunks/control-NKGES73S.js +0 -2
- package/dist-cli/chunks/demo-app-registry-B2GQWZAE.js +0 -2
- package/dist-cli/chunks/drivers-EQGVLU5S.js +0 -2
- package/dist-cli/chunks/flow-DKRIB4D4.js +0 -2
- package/dist-cli/chunks/install-5SPPQPBO.js +0 -2
- package/dist-cli/chunks/runtime-JUMLSSWP.js +0 -2
- package/dist-cli/chunks/setup-repo-GGNBHKN6.js +0 -2
- package/dist-cli/chunks/store-XAQEN3N3.js +0 -2
- package/dist-cli/chunks/telemetry-GIZM7C4U.js +0 -2
- package/dist-cli/chunks/upload-K36QDGWB.js +0 -2
- package/dist-cli/chunks/web-6SI6NZ22.js +0 -2
package/dist-cli/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! sootsim v0.1.
|
|
3
|
-
import{a as l}from"./chunks/chunk-
|
|
2
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
3
|
+
import{a as l}from"./chunks/chunk-VBA6DIBD.js";import{a as A,b as k,c as S,d as L,e as u,f as T}from"./chunks/chunk-ND2UZFA4.js";import{a as d}from"./chunks/chunk-XTR4CILB.js";import{a as v,d as _}from"./chunks/chunk-OMSSLTQC.js";import{a as E}from"./chunks/chunk-JIEJ2O4W.js";import"./chunks/chunk-TALVQX2P.js";import"./chunks/chunk-DYYNEGJV.js";import{z as C}from"./chunks/chunk-6EUVCG33.js";import"./chunks/chunk-6XLG7CQG.js";function y(){let t=C();return`sootsim CLI v${E()} \xB7 runtime ${t?`v${t}`:"not installed"}`}function g(){let t=k({bridgePort:7668,defaultShellUrl:d},l()),e=`
|
|
4
4
|
${_}
|
|
5
5
|
`;console.log(`${y()}
|
|
6
6
|
${e}${t}
|
|
@@ -28,4 +28,4 @@ show the current shared desktop account used by the CLI and electron.
|
|
|
28
28
|
it needs vite / electron / playwright from a project's node_modules.
|
|
29
29
|
install the npm package and run via bun or node instead:
|
|
30
30
|
npm i -g sootsim && sootsim ${t}
|
|
31
|
-
`),process.exit(1))}var o=T(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-
|
|
31
|
+
`),process.exit(1))}var o=T(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-2LWDURQ5.js");t({event:"cli_command_invoked",properties:{command:o.command||(o.version?"version":o.help?"help":"none"),arg_count:o.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}async function c(t){let{flushCliTelemetry:e}=await import("./chunks/telemetry-2LWDURQ5.js");await e(),process.exit(t)}if(o.version){let{getCliVersion:t}=await import("./chunks/cli-version-INI6PYTD.js"),{IS_BETA:e,BETA_LABEL:i}=await import("./chunks/beta-3HRWHUIR.js"),m=e?` \xB7 ${i}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:I}=await import("./chunks/home-paths-OCOWHSRV.js"),b=I();console.log(b?`runtime v${b}`:"runtime not installed"),await c(0)}o.help&&!o.command&&(g(),await c(0));var a=o.globalFlags.port,n=o.verbose,p=o.globalFlags.device,f=o.globalFlags.theme,R=o.globalFlags.driver,q=o.globalFlags.headless===!0,O=o.globalFlags.sim,s=O?["--sim",O,...o.commandArgs]:o.commandArgs;if(p||f){let{settingsStore:t}=await import("./chunks/store-ABVWLB26.js"),e={};p&&(e.deviceModel=p),f&&(e.colorScheme=f),t.apply(e)}if(!o.command&&o.commandArgs.length===0){let{runStart:t}=await import("./chunks/start-Y2S3LSL5.js");await t([],{port:a}),await c(0)}var r=o.command??"";if(!r){if(o.commandArgs.length>0){let t=o.commandArgs.find(e=>!e.startsWith("-"))??o.commandArgs[0];console.error(` unknown command: ${t}`),console.error(" run `sootsim --help` to see the full surface."),await c(1)}g(),await c(0)}if(r in u){let t=u[r],e=o.commandArgs.length>0?` ${o.commandArgs.join(" ")}`:"";console.error(` \`sootsim ${r}\` was removed. use \`${t}\` instead.`),e&&console.error(` \u2192 ${t}${e}`),console.error(" run `sootsim --help` to see the new verb groups."),await c(1)}if(o.help||o.commandArgs.includes("--help")||o.commandArgs.includes("-h")){let t=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="wait",e=o.commandArgs.find(i=>!i.startsWith("-"));r==="shell"||(t&&!e?$(r)&&await c(0):(h(t&&e?e:r),await c(0)))}N(r);if(L.has(r)){let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-SUDPJ45T.js"),i=e(s,a);await t(i);let{runInspect:m}=await import("./chunks/inspect-QPZXN3IK.js");await m([r,...s],{port:i,verbose:n})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-PYSEWHJK.js");await t(o.commandArgs);break}case"flow":{let{runFlow:t}=await import("./chunks/flow-HNHYMZO6.js"),e=await t(s);process.exit(typeof e=="number"?e:0)}case"test":{let{runTest:t}=await import("./chunks/test-IAHTJWBS.js");await t(o.commandArgs,{port:a,verbose:n});break}case"detox":{let{runDetox:t}=await import("./chunks/detox-QGITZG47.js");await t(o.commandArgs,{port:a,verbose:n});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-32UN2FHS.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"preview":{let{runPreview:t}=await import("./chunks/preview-AJWIS25K.js");await t(o.commandArgs,{port:a,verbose:n});break}case"record":{let{runRecord:t}=await import("./chunks/record-W6ZTLQTB.js");await t(s,{port:a,verbose:n});break}case"profile":{let{runProfile:t}=await import("./chunks/profile-4XPDQIQY.js"),e=await t(o.commandArgs,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"cpu-profile":{let{runCpuProfile:t}=await import("./chunks/cpu-profile-TQRN7NFF.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"react":{let{runReact:t}=await import("./chunks/react-VSZ2RQEC.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"screenshot":{let{runScreenshot:t}=await import("./chunks/screenshot-ALDT4B77.js");await t(s,{port:a,verbose:n});break}case"screenshots":{let{runScreenshots:t}=await import("./chunks/screenshots-TYQ4EVJR.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"screenshot-mode":{let{runScreenshotMode:t}=await import("./chunks/screenshot-mode-5VYUB7G6.js");await t(o.commandArgs,{port:a,verbose:n});break}case"three-mode":case"3d-mode":{let{runThreeMode:t}=await import("./chunks/three-mode-ZCZXY47S.js");await t(o.commandArgs,{port:a,verbose:n});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-QPZXN3IK.js");await t(s,{port:a,verbose:n});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-324KIABR.js");await t(s,{port:a,verbose:n});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-KZHGTPDV.js");await t(s,{port:a,verbose:n});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-FULTHMRQ.js");await t(s,{port:a,verbose:n});break}case"diagnose":{let{runDiagnose:t}=await import("./chunks/diagnose-HBDMYEKJ.js"),e=await t(s,{port:a,verbose:n});process.exit(typeof e=="number"?e:0)}case"open":{let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-SUDPJ45T.js"),i=e(s,a);await t(i);let{runOpenCommand:m}=await import("./chunks/control-GMAG2HKS.js");await m(s,{port:i});break}case"use":case"focus":{let{runUseCommand:t}=await import("./chunks/control-GMAG2HKS.js");await t(s,{port:a});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-GMAG2HKS.js");await t(s,{port:a});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-GMAG2HKS.js");await t(s,{port:a});break}case"config":{let{runConfig:t}=await import("./chunks/config-GWDGFFIB.js");await t(o.commandArgs);break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-6WFYBS5R.js");await t(s,{port:a});break}case"scan":case"compat":{let{runCompat:t}=await import("./chunks/compat-GO5ZKWUL.js");await t(o.commandArgs);break}case"electron":{let{runElectron:t}=await import("./chunks/electron-5DX3DITH.js");await t(o.commandArgs,{port:a,device:p,driver:R});break}case"login":{let{runLogin:t}=await import("./chunks/login-U6ZPN4IL.js");await t(o.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-VY2F5T4J.js");await t();break}case"whoami":{let{runWhoami:t}=await import("./chunks/whoami-3KUBLDUA.js");await t();break}case"keys":{let{runKeys:t}=await import("./chunks/keys-HFOS3J5A.js");await t(o.commandArgs);break}case"setup-repo":{let{runSetupRepo:t}=await import("./chunks/setup-repo-Q7SMPBCH.js");await t(o.commandArgs);break}case"install":{let{runInstall:t}=await import("./chunks/install-OVCWRSPD.js");await t(o.commandArgs);break}case"install-desktop":{let{runInstallDesktop:t}=await import("./chunks/install-desktop-RB3JNYHC.js");await t(o.commandArgs);break}case"server":{let{runServer:t}=await import("./chunks/server-X2GDTWC6.js");await t(o.commandArgs,{port:a});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-XLTCNIET.js");await t(o.commandArgs,{port:a});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-6UMHX7N7.js");await t(o.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-47JCBCFB.js");await t(o.commandArgs);break}case"launch":{let{runLaunch:t}=await import("./chunks/launch-XQGAPI6Q.js");await t(o.commandArgs);break}case"start":{let{runStart:t}=await import("./chunks/start-Y2S3LSL5.js");await t(o.commandArgs,{port:a});break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-VKARDTF5.js"),e=await t(o.commandArgs);process.exit(e)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-6QDQ77TJ.js"),e=await t(o.commandArgs);process.exit(e)}case"skills":{let{runSkills:t}=await import("./chunks/skills-C6RSSO4R.js");await t(o.commandArgs);break}case"upload":{let{runUpload:t}=await import("./chunks/upload-PNZ3UEOL.js");await t(o.commandArgs,{port:a,verbose:n});break}case"hints":{let{runHints:t}=await import("./chunks/hints-CJ3ETNUR.js");t(o.commandArgs);break}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as y,b as $,c as b,d as l,e as E,g as A,h as j,j as S,m as I,n as T,o as x,p as g,q as k,r as D}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as y,b as $,c as b,d as l,e as E,g as A,h as j,j as S,m as I,n as T,o as x,p as g,q as k,r as D}from"./chunk-66KS2T62.js";import"./chunk-TIUEUINU.js";import"./chunk-DYYNEGJV.js";import"./chunk-6EUVCG33.js";import"./chunk-6XLG7CQG.js";import w from"node:fs";import d from"node:path";import{spawn as N}from"node:child_process";import U from"node:net";import{WebSocket as O}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 O(`ws://localhost:${this.port}`),this.ready=new Promise((t,s)=>{let r=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",r),s(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",r),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 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!==O.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let s=this.nextId++;return new Promise((r,o)=>{let i=setTimeout(()=>{this.pending.delete(s),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(s,{resolve:r,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:s,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(s),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 r of this.eventListeners)try{r({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let r of this.statusListeners)try{r(t.session)}catch{}return}if(typeof t.id!="number")return;let s=this.pending.get(t.id);s&&(this.pending.delete(t.id),clearTimeout(s.timer),t.error?s.reject(new c(t.error,t.code)):s.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 R(n=7668,e=400){return new Promise(t=>{let s=new U.Socket,r=!1,o=i=>{r||(r=!0,s.destroy(),t(i))};s.setTimeout(e),s.once("connect",()=>o(!0)),s.once("timeout",()=>o(!1)),s.once("error",()=>o(!1)),s.connect(n,"127.0.0.1")})}async function _(n={}){let e=n.port??7668;if(await R(e))return{alreadyRunning:!0};let{cmd:t,prefixArgs:s}=D(),r=[...s,"server","--quiet"];e!==7668&&r.push("--port",String(e));let o=N(t,r,{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 R(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 server\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await _({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 ue(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return C(),0;case"attach":return await F(t);case"projects":return await B();case"project":return await W(t);case"sessions":return await J(t);case"start":return await V(t);case"prompt":return await q(t);case"watch":return await G(t);case"transcript":return await H(t);case"end":return await K(t);case"paths":return await z();default:return process.stderr.write(`unknown agent subcommand: ${e}
|
|
3
3
|
`),C(),2}}catch(s){if(s instanceof c)return process.stderr.write(`${s.message}
|
|
4
4
|
`),1;throw s}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function C(){process.stdout.write(`sootsim agent \u2014 attached projects + local agent sessions
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{b as M}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as M}from"./chunk-TIUEUINU.js";import"./chunk-6XLG7CQG.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as I,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,g=!1,a=new Promise(s=>{t.on("exit",(i,e)=>{g=!0;let p=new Error(`codex app-server exited (code=${i}, signal=${e??""})`);for(let{reject:f}of r.values())f(p);r.clear(),s({code:i,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let i=s.trim();if(!i)return;let e;try{e=JSON.parse(i)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,f=p!=null?r.get(p):void 0;if(!f)return;r.delete(p),e.error?f.reject(new b(e.error.message,e.error.code,e.error.data)):f.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let f of p)try{f(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let i=m.get("__stderr__");if(i)for(let e of i)try{e({text:s})}catch{}});function n(s){if(!g)try{t.stdin.write(JSON.stringify(s)+`
|
|
3
3
|
`)}catch{}}return{exited:a,on(s,i){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(i),()=>{e?.delete(i)}},request(s,i){if(g)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,f)=>{r.set(e,{resolve:l=>p(l),reject:f,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:i})})},notify(s,i){n({jsonrpc:"2.0",method:s,params:i})},async shutdown(s=1500){if(g)return;try{t.stdin.end()}catch{}let i=setTimeout(()=>{if(!g)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(i)}},kill(s="SIGTERM"){if(!g)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return I(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let g=t[u];g&&(r[g]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: sootsim agent-wrapper --session-id <id> --project-id <id>
|
|
4
4
|
--provider codex|claude --cwd <path>
|
|
5
5
|
--prompt-in <fifo> --events-out <fifo>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-6XLG7CQG.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
|
|
3
3
|
`).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=x("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
|
|
4
4
|
`),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
|
|
5
5
|
supported: ${Array.from(w).sort().join(", ")}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a,b,c,d}from"./chunk-3BWDOYAV.js";import"./chunk-C6LE22VK.js";import"./chunk-4JXE3ZUG.js";import"./chunk-DYYNEGJV.js";import"./chunk-6EUVCG33.js";import"./chunk-6XLG7CQG.js";export{c as ensureDaemonRunning,a as ensureRuntimeInstalled,d as ensureSootsimReady,b as resolveBootstrapPort};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as p}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as p}from"./chunk-DNAVJIEL.js";import{d as c,e as l}from"./chunk-J5RNZMJJ.js";import{a}from"./chunk-WN2ATVFO.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(`
|
|
3
3
|
sootsim ${e} needs auth before it can check recording access.
|
|
4
4
|
|
|
5
5
|
pick one:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{l as P,n as a,y as m}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{l as P,n as a,y as m}from"./chunk-6EUVCG33.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
|
|
3
3
|
`,"utf8"),l.renameSync(t,d()),r}function y(){return g(u()).profiles}function E(e){let r=o(e);return y().find(t=>t.id===r)??null}function _(e=s){let r=o(e),t=E(r);return t||D(r)}function D(e){let r=o(e),t=p(u());if(t.profiles.some(w=>w.id===r))throw new Error(`profile already exists: ${r}`);let f=new Date().toISOString(),n={id:r,createdAt:f,updatedAt:f};return g({version:i,profiles:[...t.profiles,n]}),n}function F(e){let r=o(e);if(r===s)throw new Error("the default profile cannot be deleted; clear it instead");let t=p(u()),f=t.profiles.find(n=>n.id===r);if(!f)throw new Error(`profile not found: ${r}`);return g({version:i,profiles:t.profiles.filter(n=>n.id!==r)}),v(r),f}function v(e){let r=o(e);for(let t of[h(r),A(r)])try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}export{A as a,y as b,_ as c,D as d,F as e,v as f};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as l}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as l}from"./chunk-C6LE22VK.js";import{E as c,F as m,g as p,i as h,z as w}from"./chunk-6EUVCG33.js";import{closeSync as v,existsSync as f,openSync as P,readSync as S,statSync as g}from"fs";import{homedir as k}from"os";import{resolve as T}from"path";import{WebSocket as D}from"ws";var E=6e4;async function L(){let t=w();if(t&&f(h(t)))return;console.log(" first run \u2014 installing sootsim engine runtime (~6 MB)...");let{runRuntime:e}=await import("./runtime-6UMHX7N7.js");await e(["install"],{})}function I(t,e){return x(t)??e??l()}async function $(t=l(),e=E){if(await u(t,250)||await u(t,1500))return;let n=c();if(n&&m(n)){if(n.bootstrapping===!0&&(await b(e),await u(n.bridgePort,500)))return;throw new Error(`sootsim daemon lockfile is fresh (port ${n.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`)}if(p())throw new Error(`sootsim bridge daemon is not running on port ${t}.
|
|
3
3
|
dev checkouts skip the auto-install of the persistent launchd / systemd
|
|
4
4
|
agent. start the daemon manually in another shell with:
|
|
5
5
|
bun sootsim server
|
|
6
|
-
(set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-
|
|
6
|
+
(set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-XLTCNIET.js");try{await o({port:t,force:!0})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`${s}
|
|
7
7
|
if this keeps failing, run \`sootsim daemon uninstall\` and retry, or run \`sootsim server\` in a persistent shell as a workaround.`)}console.log(" waiting for runtime to come online...");let i=process.platform==="darwin"?B():null;try{await b(e);let r=Date.now()+5e3;for(;Date.now()<r;){if(await u(t,500))return;await new Promise(s=>setTimeout(s,200))}throw new Error(`daemon registered but the bridge never bound on port ${t} \u2014 see ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}finally{i?.stop()}}async function C(t=l()){await L(),await $(t)}function x(t){for(let e=0;e<t.length;e++){let n=t[e];if((n==="--port"||n==="-p")&&t[e+1]){let o=Number(t[e+1]);return Number.isFinite(o)?o:void 0}if(n.startsWith("--port=")){let o=Number(n.slice(7));return Number.isFinite(o)?o:void 0}}}function u(t,e){return new Promise(n=>{let o=new D(`ws://127.0.0.1:${t}`,{handshakeTimeout:e}),i=!1,r=s=>{if(!i){i=!0;try{o.close()}catch{}n(s)}};o.once("open",()=>r(!0)),o.once("error",()=>r(!1)),setTimeout(()=>r(!1),e)})}async function b(t){let e=Date.now()+t,n;for(;Date.now()<e;){let o=c();if(o&&m(o)){if(o.bootstrapping!==!0)return;o.bootstrapping!==n&&(n=o.bootstrapping)}await new Promise(i=>setTimeout(i,250))}throw new Error(`daemon did not finish bootstrapping within ${Math.round(t/1e3)}s \u2014 check ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}function d(){return T(k(),"Library/Logs/sootsim/server.err.log")}function B(){let t=d(),e=0;try{f(t)&&(e=g(t).size)}catch{}let n=!1,o=()=>{if(!n){try{if(f(t)){let i=g(t).size;if(i>e){let r=Buffer.alloc(i-e),s=P(t,"r");try{S(s,r,0,r.length,e)}finally{v(s)}e=i;for(let y of r.toString("utf8").split(/\r?\n/)){let a=y.trim();a&&(a.startsWith("sootsim:")||a.startsWith("sootsim "))&&console.log(` ${a}`)}}else i<e&&(e=i)}}catch{}setTimeout(o,250)}};return o(),{stop:()=>{n=!0}}}export{L as a,I as b,$ as c,C as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as L}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as L}from"./chunk-6XLG7CQG.js";import{existsSync as o,readFileSync as p,writeFileSync as d}from"node:fs";import{homedir as j}from"node:os";import{dirname as $,join as s,resolve as P}from"node:path";var _=j();function Q(e){let t=e;for(;;){if(o(s(t,"pnpm-workspace.yaml"))||o(s(t,"turbo.json"))||o(s(t,"nx.json"))||o(s(t,"lerna.json")))return t;let r=s(t,"package.json");if(o(r))try{if(JSON.parse(p(r,"utf8")).workspaces)return t}catch{}let n=$(t);if(n===t)return null;t=n}}function S(e,t){let r=Q(process.cwd()),n=[r?P(r,e):null,P(process.cwd(),e),P(process.cwd(),t)].filter(a=>!!a);for(let a of n)if(o(a))return a;return n[0]??P(process.cwd(),e)}var X=()=>S("packages/sootsim-engine/scripts/expensify-web-proxy.ts","scripts/expensify-web-proxy.ts"),z=()=>S("packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts","scripts/rainbow-metadata-proxy.ts"),Z=()=>S("packages/compat/src/stubs/mattermost-rnutils-native.ts","../compat/src/stubs/mattermost-rnutils-native.ts"),ee=()=>S("packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts","../compat/src/stubs/native-seams/react-native-keychain-manager.ts"),v=()=>S("packages/compat/src/stubs/mattermost-network-client-native.ts","../compat/src/stubs/mattermost-network-client-native.ts"),D={USE_NGROK:"true",NGROK_URL:"http://localhost:9000/",SECURE_NGROK_URL:"http://localhost:9000/"},te=s(_,"github/mattermost-mobile"),I=s(_,"github/uniswap-interface"),ne=s(I,"apps/mobile"),T=s(I,".env.defaults.local"),re="stored-in-.env.local",W="# sootsim demo env overrides",se=s(I,"packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts"),oe=s(I,"apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts"),M="SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE";function B(e){if(!o(e))return{};let t={},r=p(e,"utf8");for(let n of r.split(/\r?\n/)){let a=n.trim();if(!a||a.startsWith("#"))continue;let u=a.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!u)continue;let i=u[2].trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),t[u[1]]=i}return t}function k(e){if(!e)return!1;let t=e.trim();return!(!t||t.includes(re)||t==="TRADING_API_KEY"||t==="UNISWAP_API_KEY")}function Y(e,t){for(let r of e)for(let n of t){let a=r[n];if(k(a))return a.trim()}}function J(){let e=B(T),t=B(s(I,"apps/web/.env")),r=[process.env,e,t],n={},a=[["AMPLITUDE_PROXY_URL_OVERRIDE",["REACT_APP_AMPLITUDE_PROXY_URL"]],["QUICKNODE_ENDPOINT_NAME",["REACT_APP_QUICKNODE_ENDPOINT_NAME"]],["QUICKNODE_ENDPOINT_TOKEN",["REACT_APP_QUICKNODE_ENDPOINT_TOKEN"]],["INFURA_KEY",["REACT_APP_INFURA_KEY"]],["STATSIG_API_KEY",["REACT_APP_STATSIG_API_KEY"]],["STATSIG_PROXY_URL_OVERRIDE",["REACT_APP_STATSIG_PROXY_URL"]],["WALLETCONNECT_PROJECT_ID",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_BETA",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_DEV",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["TRADING_API_KEY",["REACT_APP_TRADING_API_KEY"]],["UNISWAP_API_KEY",[]]];for(let[i,l]of a){let R=Y(r,[i,...l]);if(R){n[i]=R;for(let m of l)n[m]=R}}if(!(k(n.TRADING_API_KEY)&&k(n.UNISWAP_API_KEY))){let i=Y(r,["GRAPHQL_URL_OVERRIDE","REACT_APP_AWS_API_ENDPOINT"])||"https://interface.gateway.uniswap.org/v1/graphql";n.API_BASE_URL_OVERRIDE="https://interface.gateway.uniswap.org",n.API_BASE_URL_V2_OVERRIDE="https://interface.gateway.uniswap.org/v2",n.GRAPHQL_URL_OVERRIDE=i,n.TRADING_API_URL_OVERRIDE="https://trading-api-labs.interface.gateway.uniswap.org",n.FOR_API_URL_OVERRIDE="https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService"}return n}function ae(){let e=o(T)?p(T,"utf8"):"";if(e&&!e.includes(W))return;let t=J(),r=[W];for(let[n,a]of Object.entries(t).sort(([u],[i])=>u.localeCompare(i)))r.push(`${n}=${JSON.stringify(a)}`);r.push(""),d(T,`${r.join(`
|
|
3
3
|
`)}
|
|
4
4
|
`)}function ie(){let e=`export function useForceUpgradeStatus(): ForceUpgradeStatus {
|
|
5
5
|
`,t=` // sootsim demo: bypass the force-upgrade gate during local engine demos.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as Se}from"./chunk-YAKDXQA7.js";import{a as Te}from"./chunk-2JSZSUTN.js";import{a as xe}from"./chunk-DNAVJIEL.js";import{a as R,b as pe,c as fe,d as q,e as G,f as we,g as Y,i as X,j as ge}from"./chunk-BIZ4APXE.js";import{f as be,m as ve}from"./chunk-EIXXQDAI.js";import{e as he}from"./chunk-NXFXTJSP.js";import{b as me}from"./chunk-6RJRJRAW.js";import{a as ye}from"./chunk-4MZLNYBR.js";import{a as le,b as H}from"./chunk-5POON745.js";import{f as ae}from"./chunk-TALVQX2P.js";import{c as z,d as ce,e as ue}from"./chunk-C6LE22VK.js";import{c as de}from"./chunk-4JXE3ZUG.js";import*as A from"fs";import{tmpdir as Me}from"os";import*as h from"path";import*as w from"fs";import*as f from"path";var V=1e4,B=393,_=852,Fe="__sootsimCliPerf",Oe="maestroCopiedText",$e=new Map;function p(o){return new Promise(e=>setTimeout(e,o))}function Ne(o){return o?f.basename(o)===".maestro"?f.dirname(o):o:process.cwd()}function Re(o,e,t){let r=e.endsWith(".png")?e:`${e}.png`;if(f.isAbsolute(r))return r;if(t.mode==="flow"&&/[\\/]/.test(r)){let i=r.startsWith("./")||r.startsWith("../")?t.flowDir??process.cwd():Ne(t.flowDir);return f.resolve(i,r)}return f.join(o,r)}function Ve(o){if(typeof o=="string")return{path:o,withFrame:!1};let e=o.path?.trim()||o.name?.trim();if(!e)throw new Error("takeScreenshot object form requires path or name");return{path:e,withFrame:o.withFrame===!0}}function Q(o){let[e,t]=o.split(",").map(i=>i.trim()),r=(i,s)=>i.endsWith("%")?Number.parseFloat(i)/100*s:Number.parseFloat(i);return{x:r(e,B),y:r(t,_)}}function Be(o){let e=o.split(/^---$/m),t=e.length>1?e[e.length-1]:o,r=fe(pe.parse(t),$e);return Array.isArray(r)?r:[]}var U=class{constructor(e,t){this.bridge=e;this.opts=t}stepDelay=0;firstLaunchDone=!1;profilingEnabled=!1;recordingEnabled=!1;recordingAccessChecked=!1;recordingStartedAtMs=null;lastRecordingDurationMs=null;simRouteHint=null;lastFailedStep=null;get simId(){return this.opts.simId}setSimRouteHint(e){this.simRouteHint=this.normalizeSimRoute(e)}normalizeSimRoute(e){if(!e)return null;try{let t=new URL(e);t.searchParams.delete("inspectOpen");let r=t.searchParams.toString();return`${t.origin}${t.pathname}${r?`?${r}`:""}`}catch{return e}}async refreshSimId(){if(this.opts.simId)try{let e=await this.bridge.listSims(),t=e.find(a=>a.id===this.opts.simId);if(t&&(this.simRouteHint=this.normalizeSimRoute(t.url||t.origin)),e.find(a=>a.id===this.opts.simId&&a.readyState==="open")||!this.simRouteHint)return;let i=this.simRouteHint&&e.find(a=>a.readyState==="open"&&this.normalizeSimRoute(a.url||a.origin)===this.simRouteHint);if(!i)return;let s=e.find(a=>a.isPrimary&&a.readyState==="open"),n=e.find(a=>a.readyState==="open"),l=i??s??n;l&&(this.opts.simId=l.id,console.log(` [flow] sim rotated to ${l.id}`))}catch{}}async evaluate(e,t){return this.bridge.send({type:"evaluate",simId:this.opts.simId,code:e},t?{timeoutMs:t}:void 0)}async callTest(e,...t){return this.bridge.send({type:"call",simId:this.opts.simId,path:`__sootsimTest.${e}`,args:t})}async waitForTree(e=V){let t=Date.now()+e,r=Date.now(),i=null,s=0,n=0;for(;Date.now()<t;){try{let a=await this.evaluate(`(async () => {
|
|
3
3
|
const test = window.__sootsimTest
|
|
4
4
|
if (!test) return { count: 0, loading: true }
|
|
5
5
|
const count = (await test.getNodeCount?.()) || 0
|
|
@@ -19,12 +19,12 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
19
19
|
const openingAppNode = await test.findByText?.('opening app')
|
|
20
20
|
const isLoading = !!loadingNode || !!capturingNode || !!openingAppNode || count < 5
|
|
21
21
|
return { count, loading: isLoading, error: null }
|
|
22
|
-
})()`,8e3);if(s=0,a?.error)throw new Error(`app failed to load: ${a.error}`);if(a&&a.count>10&&!a.loading)return}catch(a){if(
|
|
22
|
+
})()`,8e3);if(s=0,a?.error)throw new Error(`app failed to load: ${a.error}`);if(a&&a.count>10&&!a.loading)return}catch(a){if(i=a instanceof Error?a:new Error(String(a)),i.message.startsWith("app failed to load:"))throw i;if(s++,s>=4)throw new Error(`target sim is not responding to the bridge (${i.message}). it is likely a stale orphan \u2014 run \`sootsim list\`, then close it with \`sootsim close <id>\` or start a fresh one with \`sootsim open --new <port>\`.`);await this.refreshSimId()}let l=Date.now()-r;l-n>=5e3&&(n=l,console.log(` [flow] waiting for app to be ready\u2026 (${Math.round(l/1e3)}s)`)),await p(500)}throw i?.message.startsWith("app failed to load:")?i:new Error(`app not ready after ${e}ms`)}async ensureRecordingStarted(){if(!this.opts.recordingOutputDir)throw new Error("recording output directory not configured");this.recordingAccessChecked||(await Te("flow --video",{originOverride:this.opts.billingOriginOverride,allowGitHubAuth:this.opts.allowGitHubRecording}),this.recordingAccessChecked=!0);let e=Date.now(),t=await this.evaluate(`(() => {
|
|
23
23
|
const rec = window.__sootsimRecorder
|
|
24
24
|
if (!rec) return { ok: false, error: 'recorder unavailable on this page' }
|
|
25
25
|
if (rec.state() === 'recording') return { ok: true, format: 'webm' }
|
|
26
26
|
return rec.start({ format: 'webm', fps: 24 })
|
|
27
|
-
})()`);if(!t?.ok)throw new Error(t?.error||"recording unavailable on this page");this.recordingStartedAtMs||(this.recordingStartedAtMs=e)}async startRecording(){this.recordingEnabled=!0,await this.ensureRecordingStarted()}prepareRecording(){this.recordingEnabled=!0}getLastRecordingDurationMs(){return this.lastRecordingDurationMs}async stopRecording(){if(!this.recordingEnabled||!this.opts.recordingOutputDir)return null;this.recordingEnabled=!1;let e=Date.now(),t=await this.evaluate("window.__sootsimRecorder.stop()");if(!t?.ok)throw this.recordingStartedAtMs=null,new Error(t?.error||"recording stop failed");this.lastRecordingDurationMs=this.recordingStartedAtMs?Math.max(1,e-this.recordingStartedAtMs):null,this.recordingStartedAtMs=null;let r=[],
|
|
27
|
+
})()`);if(!t?.ok)throw new Error(t?.error||"recording unavailable on this page");this.recordingStartedAtMs||(this.recordingStartedAtMs=e)}async startRecording(){this.recordingEnabled=!0,await this.ensureRecordingStarted()}prepareRecording(){this.recordingEnabled=!0}getLastRecordingDurationMs(){return this.lastRecordingDurationMs}async stopRecording(){if(!this.recordingEnabled||!this.opts.recordingOutputDir)return null;this.recordingEnabled=!1;let e=Date.now(),t=await this.evaluate("window.__sootsimRecorder.stop()");if(!t?.ok)throw this.recordingStartedAtMs=null,new Error(t?.error||"recording stop failed");this.lastRecordingDurationMs=this.recordingStartedAtMs?Math.max(1,e-this.recordingStartedAtMs):null,this.recordingStartedAtMs=null;let r=[],i=0;for(;;){let n=await this.evaluate(`window.__sootsimRecorder.getBlobBase64({ offset: ${i}, chunk: 2097152 })`);if(!n||(r.push(Buffer.from(n.data,"base64")),i=n.offset,n.done))break}if(r.length===0)throw new Error("recording requested but no video buffer was produced");w.mkdirSync(this.opts.recordingOutputDir,{recursive:!0});let s=f.join(this.opts.recordingOutputDir,`sootsim-${Date.now()}.webm`);return w.writeFileSync(s,Buffer.concat(r)),s}async findElement(e){return this.evaluate(`(async () => {
|
|
28
28
|
const test = window.__sootsimTest
|
|
29
29
|
if (!test) return null
|
|
30
30
|
let node = null
|
|
@@ -88,15 +88,15 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
88
88
|
)
|
|
89
89
|
}
|
|
90
90
|
return direct
|
|
91
|
-
})()`)}async tap(e,t,r){return await this.bridge.send({type:"tap",simId:this.opts.simId,x:e,y:t,target:r})}async tapOn(e){let t=typeof e=="string"?{text:e}:e;if(t.point){let a=
|
|
91
|
+
})()`)}async tap(e,t,r){return await this.bridge.send({type:"tap",simId:this.opts.simId,x:e,y:t,target:r})}async tapOn(e){let t=typeof e=="string"?{text:e}:e;if(t.point){let a=Q(t.point);(await this.activatePressAt(a.x,a.y))?.ok||await this.tap(a.x,a.y),await p(300);return}let r=5e3,i=150,s=Date.now()+r,n=await this.findElement({text:t.text,id:t.id});for(;!n&&Date.now()<s;)await p(i),n=await this.findElement({text:t.text,id:t.id});if(n){let a=typeof n.nodeId=="number"?await this.resolveTapTarget(n.nodeId):null,m=a?.cx??n.absolutePosition.x+n.layout.width/2,g=a?.cy??n.absolutePosition.y+n.layout.height/2;if((await this.tap(m,g,{id:t.id??a?.target?.id??n.id??null,testID:t.id??a?.target?.testID??n.testID??null,text:t.text??a?.target?.text??a?.target?.accessibilityLabel??n.text??n.accessibilityLabel??null,type:a?.target?.type??n.type??null}))?.hit===!0){await p(300);return}}if((await this.activatePressTarget(t))?.ok){await p(300);return}throw new Error(`tapOn: element not found: ${JSON.stringify(t)}`)}async tapAtCoords(e,t){await this.tap(e,t),await p(300)}async doubleTapAtCoords(e,t,r=80){let i=Math.max(0,Math.round(r));if(!await this.evaluate(`(async () => {
|
|
92
92
|
const interact = window.__sootsimInteract
|
|
93
93
|
if (interact?.doubleTap) {
|
|
94
|
-
return !!(await interact.doubleTap(${e}, ${t}, ${
|
|
94
|
+
return !!(await interact.doubleTap(${e}, ${t}, ${i}))
|
|
95
95
|
}
|
|
96
96
|
if (!interact?.tap) return false
|
|
97
97
|
const first = await interact.tap(${e}, ${t})
|
|
98
98
|
if (!first || first.hit === false) return false
|
|
99
|
-
await new Promise((resolve) => setTimeout(resolve, ${
|
|
99
|
+
await new Promise((resolve) => setTimeout(resolve, ${i}))
|
|
100
100
|
const second = await interact.tap(${e}, ${t})
|
|
101
101
|
return !!second && second.hit !== false
|
|
102
102
|
})()`))throw new Error(`doubleTapAtCoords failed at (${e}, ${t})`);await p(300)}async assertVisible(e){let t=typeof e=="string"?{text:e}:e;for(let r=0;r<15;r++){if(await this.isElementVisible(t))return;await p(200)}throw new Error(`assertVisible: ${JSON.stringify(t)} not found or off-screen`)}async assertNotVisible(e){let t=typeof e=="string"?{text:e}:e;if(await this.isElementVisible(t))throw new Error(`assertNotVisible: ${JSON.stringify(t)} IS visible`)}async isElementVisible(e){let t=await this.findElement(e);return!!(t&&t.absolutePosition.y+t.layout.height>0&&t.absolutePosition.y<_)}async inputText(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"type",text:e}),await p(200)}async pressKey(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"press",text:e}),await p(120)}async dispatchKey(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dispatchKey",text:e}),await p(120)}async hideKeyboard(){try{await this.callTest("blurFocusedTextInput")}catch{}await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dismiss"});let e=Date.now()+3e3;for(;Date.now()<e;){let t=await this.evaluate(`(() => {
|
|
@@ -109,7 +109,7 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
109
109
|
visible: !!keyboard?.isVisible?.(),
|
|
110
110
|
focused: !!test?.isTextInputFocused?.(),
|
|
111
111
|
}
|
|
112
|
-
})()`);if(!t?.visible&&!t?.focused){await p(80);return}await p(80)}}async eraseText(e){for(let t=0;t<e;t++)await this.pressKey("Backspace");await p(100)}async waitFor(e){let t=Date.now()+(e.timeout||V);for(;Date.now()<t;){if(await this.findElement(e))return;await p(200)}throw new Error(`waitFor: ${JSON.stringify(e)} not found after ${e.timeout||V}ms`)}async takeScreenshot(e){await p(250);let t=Ve(e),r=Re(this.opts.screenshotDir,t.path,{mode:this.opts.screenshotPathMode??"dir",flowDir:this.opts.flowDir});w.mkdirSync(f.dirname(r),{recursive:!0});let s=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,""),n=Buffer.from(s,"base64");if(t.withFrame){let l=await this.readCurrentDeviceModel();if(!l)throw new Error("could not read current device model for framed screenshot");let a=await
|
|
112
|
+
})()`);if(!t?.visible&&!t?.focused){await p(80);return}await p(80)}}async eraseText(e){for(let t=0;t<e;t++)await this.pressKey("Backspace");await p(100)}async waitFor(e){let t=Date.now()+(e.timeout||V);for(;Date.now()<t;){if(await this.findElement(e))return;await p(200)}throw new Error(`waitFor: ${JSON.stringify(e)} not found after ${e.timeout||V}ms`)}async takeScreenshot(e){await p(250);let t=Ve(e),r=Re(this.opts.screenshotDir,t.path,{mode:this.opts.screenshotPathMode??"dir",flowDir:this.opts.flowDir});w.mkdirSync(f.dirname(r),{recursive:!0});let s=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,""),n=Buffer.from(s,"base64");if(t.withFrame){let l=await this.readCurrentDeviceModel();if(!l)throw new Error("could not read current device model for framed screenshot");let a=await Se(n,l);w.writeFileSync(r,a),console.log(`[flow] screenshot: ${r} (frame: ${l})`);return}w.writeFileSync(r,n),console.log(`[flow] screenshot: ${r}`)}async readCurrentDeviceModel(){let e=await this.bridge.send({type:"call",simId:this.opts.simId,path:"SootSim.bridges.settings.get",args:[]}),t=e&&typeof e.deviceModel=="string"?e.deviceModel:null;return!t||!(t in ae)?null:t}async captureFailureScreenshot(e){w.mkdirSync(f.dirname(e),{recursive:!0});let r=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");w.writeFileSync(e,Buffer.from(r,"base64"))}async captureFailureBundle(e,t){w.mkdirSync(e,{recursive:!0});let r=(m,g)=>{try{w.writeFileSync(f.join(e,m),g)}catch{}},i=async m=>{try{return await this.bridge.send({type:"evaluate",simId:this.opts.simId,code:m})}catch{return null}};r("error.json",JSON.stringify({message:t.error.message,stack:t.error.stack,stepIndex:t.stepIndex,stepKind:t.stepKind,stepTarget:t.stepTarget,capturedAt:new Date().toISOString()},null,2));try{let g=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");r("screenshot.png",Buffer.from(g,"base64"))}catch{}let s=await i(`(async () => {
|
|
113
113
|
const t = window.__sootsimTest
|
|
114
114
|
const mainShell = window.SootSim?.bridges?.mainShell
|
|
115
115
|
if (!t) return { error: 'no test bridge' }
|
|
@@ -119,19 +119,19 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
119
119
|
} catch {}
|
|
120
120
|
const all = await t.queryAll({ pruneHidden: true })
|
|
121
121
|
return { shell, nodes: all, url: location.href, title: document.title }
|
|
122
|
-
})()`);s&&r("describe.json",JSON.stringify(s,null,2));let n=await
|
|
122
|
+
})()`);s&&r("describe.json",JSON.stringify(s,null,2));let n=await i("(async () => await window.__sootsimTest?.dumpAccessibilityTree?.(20))()");typeof n=="string"&&r("a11y.txt",n);let l=await i("(async () => await window.__sootsimTest?.dumpTree?.(15))()");typeof l=="string"&&r("tree.txt",l);let a=await i(`(() => {
|
|
123
123
|
const c = window.__sootsimConsole
|
|
124
124
|
return {
|
|
125
125
|
errors: c?.getErrors?.() ?? [],
|
|
126
126
|
warnings: c?.getWarnings?.() ?? [],
|
|
127
127
|
requests: (window.__sootsimGetFailedRequests?.() ?? []),
|
|
128
128
|
}
|
|
129
|
-
})()`);return a&&r("console.json",JSON.stringify(a,null,2)),e}async swipe(e="UP",t=300){let r=B/2,
|
|
129
|
+
})()`);return a&&r("console.json",JSON.stringify(a,null,2)),e}async swipe(e="UP",t=300){let r=B/2,i=_/2,s=200,n=r,l=i,a=r,m=i;switch(e.toUpperCase()){case"UP":l+=s,m-=s;break;case"DOWN":l-=s,m+=s;break;case"LEFT":n+=s,a-=s;break;case"RIGHT":n-=s,a+=s;break}let g=Math.max(10,Math.round(t/16));await this.drag(n,l,a,m,g,16)}async drag(e,t,r,i,s=12,n=16){if(!(await this.evaluate(`(async () => {
|
|
130
130
|
const interact = window.__sootsimInteract
|
|
131
131
|
if (!interact?.drag) return { ok: false }
|
|
132
|
-
const value = await interact.drag(${e}, ${t}, ${r}, ${
|
|
132
|
+
const value = await interact.drag(${e}, ${t}, ${r}, ${i}, ${Math.max(1,Math.round(s))}, ${Math.max(0,Math.round(n))})
|
|
133
133
|
return { ok: !!value, value }
|
|
134
|
-
})()`))?.ok)throw new Error("drag failed");await p(300)}async swipeCoords(e,t,r=300){let
|
|
134
|
+
})()`))?.ok)throw new Error("drag failed");await p(300)}async swipeCoords(e,t,r=300){let i=Q(e),s=Q(t),n=Math.max(10,Math.round(r/16));await this.drag(i.x,i.y,s.x,s.y,n,16)}async swipeFrom(e,t="UP",r=300){let i=await this.findElement(e);if(!i)throw new Error(`swipeFrom: element not found: ${JSON.stringify(e)}`);let s=i.absolutePosition.x+i.layout.width/2,n=i.absolutePosition.y+i.layout.height/2,l=180,a=s,m=n;switch(t.toUpperCase()){case"UP":m-=l;break;case"DOWN":m+=l;break;case"LEFT":a-=l;break;case"RIGHT":a+=l;break}let g=Math.max(10,Math.round(r/16));await this.drag(s,n,a,m,g,16)}async scrollTo(e,t,r){let i=await this.callTest("scrollTo",e,t,r,!1);if(!i?.ok)throw new Error(`scrollTo failed: ${i?.reason||"unknown error"}`);await p(250)}async pinch(e){let t=await this.evaluate(`(async () => {
|
|
135
135
|
const interact = window.__sootsimInteract
|
|
136
136
|
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
137
137
|
const ok = await interact.pinch(
|
|
@@ -140,7 +140,7 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
140
140
|
${e.steps||12}, ${e.stepMs||16}
|
|
141
141
|
)
|
|
142
142
|
return { ok: !!ok, reason: ok ? null : 'pinch returned false' }
|
|
143
|
-
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await p(250)}async dumpTree(e=6){let t=await this.bridge.send({type:"tree",simId:this.opts.simId,depth:e});return console.log("[flow] tree:"),console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),typeof t=="string"?t:JSON.stringify(t)}async assertTreeContains(e){if(!(await this.dumpTree(8)).includes(e))throw new Error(`assertTreeContains: "${e}" not in tree`)}async waitForAnimationToEnd(e=2e3){await p(e)}async back(){try{await this.tapOn("\u2039")}catch{await this.tapOn("<")}}async scrollUntilVisible(e){let t=Date.now()+(e.timeout||15e3),r=e.direction?.toUpperCase()||"DOWN",
|
|
143
|
+
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await p(250)}async dumpTree(e=6){let t=await this.bridge.send({type:"tree",simId:this.opts.simId,depth:e});return console.log("[flow] tree:"),console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),typeof t=="string"?t:JSON.stringify(t)}async assertTreeContains(e){if(!(await this.dumpTree(8)).includes(e))throw new Error(`assertTreeContains: "${e}" not in tree`)}async waitForAnimationToEnd(e=2e3){await p(e)}async back(){try{await this.tapOn("\u2039")}catch{await this.tapOn("<")}}async scrollUntilVisible(e){let t=Date.now()+(e.timeout||15e3),r=e.direction?.toUpperCase()||"DOWN",i=r==="DOWN"?"UP":r==="UP"?"DOWN":r;for(;Date.now()<t;){let s=await this.findElement({text:e.element});if(s&&s.absolutePosition.y>=0&&s.absolutePosition.y+s.layout.height>0&&s.absolutePosition.y<_-50){if(e.centerElement){let n=_/2,l=s.absolutePosition.y-n;if(Math.abs(l)>100){let a=Math.min(150,Math.abs(l)*.5),m=l>0?n-a:n+a;await this.drag(B/2,n,B/2,m,10,16)}}return}await this.swipe(i,250),await p(500)}throw new Error(`scrollUntilVisible: "${e.element}" not found`)}async extendedWaitUntil(e){let t=Date.now()+(e.timeout||V);for(;Date.now()<t;){let r=e.visible?await this.isElementVisible(typeof e.visible=="string"?{text:e.visible}:e.visible):!0,i=e.notVisible?!await this.isElementVisible(typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible):!0;if(r&&i)return;await p(200)}throw new Error("extendedWaitUntil timed out")}async launchApp(e){await this.refreshSimId();let t=!!(e&&typeof e=="object"&&e.clearState);if(t&&await this.evaluate(`(async () => {
|
|
144
144
|
await (${R})
|
|
145
145
|
try {
|
|
146
146
|
const regs = await navigator.serviceWorker?.getRegistrations?.()
|
|
@@ -176,7 +176,7 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
176
176
|
mode: 'main-thread',
|
|
177
177
|
startedAt: performance.now(),
|
|
178
178
|
}
|
|
179
|
-
})(${JSON.stringify(
|
|
179
|
+
})(${JSON.stringify(Fe)})`),this.profilingEnabled=!0}async stopProfile(){let e=await this.evaluate(`(async (sessionKey) => {
|
|
180
180
|
const host = window.__sootsimRenderHost
|
|
181
181
|
if (host?.stopPerfSession) {
|
|
182
182
|
const stopped = await host.stopPerfSession(sessionKey)
|
|
@@ -243,7 +243,7 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
243
243
|
sampleCount: recent.length,
|
|
244
244
|
worstFrames: recent.slice().sort((a, b) => b - a).slice(0, 10),
|
|
245
245
|
}
|
|
246
|
-
})(${JSON.stringify(
|
|
246
|
+
})(${JSON.stringify(Fe)})`);if(this.profilingEnabled=!1,e?.error)throw new Error(e.error);return e}async stopApp(){await this.evaluate(`(async () => {
|
|
247
247
|
try { await (${R}) } catch {}
|
|
248
248
|
try {
|
|
249
249
|
const regs = await navigator.serviceWorker?.getRegistrations?.()
|
|
@@ -251,13 +251,13 @@ import{a as xe}from"./chunk-DMLDEQSS.js";import{a as Fe}from"./chunk-PIV6WQG4.js
|
|
|
251
251
|
} catch {}
|
|
252
252
|
})()`)}async clearState(){await this.evaluate(`(async () => {
|
|
253
253
|
await (${R})
|
|
254
|
-
})()`)}clearKeychain(){console.warn("[flow] clearKeychain: sootsim has no keychain surface \u2014 no-op (warning)")}async copyTextFrom(e){let t=typeof e=="string"?{id:e}:e,r=await this.findElement(t);if(!r)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let
|
|
254
|
+
})()`)}clearKeychain(){console.warn("[flow] clearKeychain: sootsim has no keychain surface \u2014 no-op (warning)")}async copyTextFrom(e){let t=typeof e=="string"?{id:e}:e,r=await this.findElement(t);if(!r)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let i=r.text??r.testID??"";$e.set(Oe,i),console.log(`[flow] copied text: ${JSON.stringify(i)}`)}async evalScript(e){let r=await this.evaluate(`(async () => {
|
|
255
255
|
try {
|
|
256
256
|
return { ok: true, value: await (async () => { ${e} })() }
|
|
257
257
|
} catch (err) {
|
|
258
258
|
return { ok: false, error: err && err.message ? err.message : String(err) }
|
|
259
259
|
}
|
|
260
|
-
})()`);if(!r.ok)throw new Error(`evalScript failed: ${r.error}`);r.value!==void 0&&console.log("[flow] evalScript ->",r.value)}async openLink(e){let t=typeof e=="string"?e:e.link;if(!t)throw new Error("openLink: missing link");await this.evaluate(`window.location.href = ${JSON.stringify(t)}`),await p(300),await this.refreshSimId(),await this.waitForTree(3e4)}async evaluateWhen(e){if(e.visible!==void 0){let t=typeof e.visible=="string"?{text:e.visible}:e.visible;return!!await this.findElement(t)}if(e.notVisible!==void 0){let t=typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible;return!await this.findElement(t)}return e.platform!==void 0?e.platform.toLowerCase()==="ios":e.true!==void 0?e.true.toLowerCase()!=="false":!0}isOptional(e){if(e.optional===!0)return!0;let r=Object.entries(e).find(([s])=>s!=="when"&&s!=="optional"),
|
|
260
|
+
})()`);if(!r.ok)throw new Error(`evalScript failed: ${r.error}`);r.value!==void 0&&console.log("[flow] evalScript ->",r.value)}async openLink(e){let t=typeof e=="string"?e:e.link;if(!t)throw new Error("openLink: missing link");await this.evaluate(`window.location.href = ${JSON.stringify(t)}`),await p(300),await this.refreshSimId(),await this.waitForTree(3e4)}async evaluateWhen(e){if(e.visible!==void 0){let t=typeof e.visible=="string"?{text:e.visible}:e.visible;return!!await this.findElement(t)}if(e.notVisible!==void 0){let t=typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible;return!await this.findElement(t)}return e.platform!==void 0?e.platform.toLowerCase()==="ios":e.true!==void 0?e.true.toLowerCase()!=="false":!0}isOptional(e){if(e.optional===!0)return!0;let r=Object.entries(e).find(([s])=>s!=="when"&&s!=="optional"),i=r?r[1]:void 0;return!!(i&&typeof i=="object"&&"optional"in i&&i.optional)}async runStep(e,t){let r=Object.keys(e).find(i=>i!=="when")||Object.keys(e)[0];if(console.log(`[flow] step ${t+1}: ${r}`),e.when&&!await this.evaluateWhen(e.when)){console.log("[flow] (when: predicate false, skipped)");return}try{let i=!!(e.extendedWaitUntil||e.waitFor||e.scrollUntilVisible||e.launchApp||e.runFlow),s=1e4,n=this.runStepInner(e);if(i)await n;else{let a=null,m=new Promise((g,y)=>{a=setTimeout(()=>{y(new Error(`step watchdog: ${r} made no progress in ${s}ms \u2014 bridge or bundle probably hung`))},s)});try{await Promise.race([n,m])}finally{a&&clearTimeout(a)}}let l=!!(e.assertVisible||e.assertNotVisible||e.extendedWaitUntil||e.waitFor);this.stepDelay>0&&!l&&await p(this.stepDelay)}catch(i){if(this.isOptional(e)){console.log(`[flow] (optional, skipped: ${i.message.slice(0,80)})`);return}throw this.lastFailedStep={index:t,kind:r,target:e[r]},i}}async runStepInner(e){if(e.tapOn)await this.tapOn(e.tapOn);else if(e.scrollUntilVisible)await this.scrollUntilVisible(e.scrollUntilVisible);else if(e.extendedWaitUntil)await this.extendedWaitUntil(e.extendedWaitUntil);else if(e.assertVisible)await this.assertVisible(e.assertVisible);else if(e.assertNotVisible)await this.assertNotVisible(e.assertNotVisible);else if(e.inputText)await this.inputText(e.inputText);else if(e.pressKey)await this.pressKey(e.pressKey);else if(e.dispatchKey)await this.dispatchKey(e.dispatchKey);else if(e.waitFor)await this.waitFor(e.waitFor);else if(e.takeScreenshot)await this.takeScreenshot(e.takeScreenshot);else if(e.swipe)e.swipe.start&&e.swipe.end?await this.swipeCoords(e.swipe.start,e.swipe.end,e.swipe.duration):e.swipe.from?await this.swipeFrom(e.swipe.from,e.swipe.direction,e.swipe.duration):await this.swipe(e.swipe.direction,e.swipe.duration);else if(e.scroll)await this.swipe(e.scroll.direction==="DOWN"?"UP":"DOWN");else if(e.scrollTo){let t=typeof e.scrollTo.nodeId=="number"?{nodeId:e.scrollTo.nodeId}:e.scrollTo.id;if(!t)throw new Error("scrollTo requires id or nodeId");await this.scrollTo(t,e.scrollTo.x,e.scrollTo.y)}else if(e.pinch)await this.pinch(e.pinch);else if(e.waitForAnimationToEnd)await this.waitForAnimationToEnd(typeof e.waitForAnimationToEnd=="number"?e.waitForAnimationToEnd:2e3);else if(e.back)await this.back();else if(e.hideKeyboard)await this.hideKeyboard();else if(e.launchApp)await this.launchApp(e.launchApp);else if(typeof e.wait=="number")await p(e.wait);else if(e.dumpTree)await this.dumpTree(e.dumpTree);else if(e.tapAtCoords)await this.tapAtCoords(e.tapAtCoords.x,e.tapAtCoords.y);else if(e.doubleTapAtCoords)await this.doubleTapAtCoords(e.doubleTapAtCoords.x,e.doubleTapAtCoords.y,e.doubleTapAtCoords.gapMs);else if(e.assertTreeContains)await this.assertTreeContains(e.assertTreeContains);else if(typeof e.eraseText=="number")await this.eraseText(e.eraseText);else if(e.repeat)for(let t=0;t<e.repeat.times;t++)for(let r=0;r<e.repeat.commands.length;r++)await this.runStep(e.repeat.commands[r],r);else if(e.stopApp!==void 0)await this.stopApp();else if(e.clearState!==void 0)await this.clearState();else if(e.clearKeychain!==void 0)this.clearKeychain();else if(e.copyTextFrom!==void 0)await this.copyTextFrom(e.copyTextFrom);else if(typeof e.evalScript=="string")await this.evalScript(e.evalScript);else if(e.openLink!==void 0)await this.openLink(e.openLink);else if(e.runFlow){let t=e.runFlow,r=typeof t=="string"?t:t.file,i=typeof t=="string"?void 0:t.when;if(i&&!await this.evaluateWhen(i)){console.log(`[flow] runFlow skipped (when predicate false): ${r}`);return}let s=f.resolve(this.opts.flowDir,r),n=w.readFileSync(s,"utf8"),l=this.opts.flowDir;this.opts.flowDir=f.dirname(s),await this.runFlow(Be(n)),this.opts.flowDir=l}else throw new Error(`unsupported flow step: ${JSON.stringify(e)}`)}async runFlow(e){let t=[],r=[],i=[];for(let n of e){let l=Object.keys(n);if(l.length===1&&l[0]==="onFlowStart"&&Array.isArray(n.onFlowStart)){t.push(...n.onFlowStart);continue}if(l.length===1&&l[0]==="onFlowComplete"&&Array.isArray(n.onFlowComplete)){r.push(...n.onFlowComplete);continue}i.push(n)}if(t.length>0){console.log(`[flow] onFlowStart (${t.length} steps)`);for(let n=0;n<t.length;n++)await this.runStep(t[n],n)}let s=null;try{await this.runFlowBody(i)}catch(n){s=n instanceof Error?n:new Error(String(n))}if(r.length>0){console.log(`[flow] onFlowComplete (${r.length} steps)`);for(let n=0;n<r.length;n++)try{await this.runStep(r[n],n)}catch(l){console.warn(`[flow] onFlowComplete step ${n+1} failed: ${l instanceof Error?l.message:l}`)}}if(s)throw s}async runFlowBody(e){for(let t=0;t<e.length;t++){let r=e[t],i=typeof r.wait=="number"?r.wait:0,s=typeof r.waitFor?.timeout=="number"?r.waitFor.timeout:0,n=Math.max(6e4,i+15e3,s+15e3);if(r.runFlow){await this.runStep(r,t);continue}await Promise.race([this.runStep(r,t),new Promise((l,a)=>setTimeout(()=>a(new Error(`step ${t+1} (${Object.keys(r)[0]}) exceeded ${n}ms deadline`)),n))])}}};async function Ue(){let o=await he(),e=o.find(r=>r.patched);if(e)return`http://localhost:${e.port}/__soot/`;let t=o[0];return t?`http://localhost:${t.port}/__soot/`:null}async function Ie(o){(o.length===0||o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
261
261
|
sootsim flow \u2014 run flows or manage a draft
|
|
262
262
|
|
|
263
263
|
usage:
|
|
@@ -324,25 +324,25 @@ flow extension:
|
|
|
324
324
|
takeScreenshot:
|
|
325
325
|
path: marketing/hero
|
|
326
326
|
withFrame: true
|
|
327
|
-
`),process.exit(0));let e=
|
|
327
|
+
`),process.exit(0));let e=o[0];A.existsSync(e)||(console.error(` error: ${e} not found`),process.exit(1));let t=u=>o.find((d,v)=>o[v-1]===u),r=o.includes("--profile"),i=o.includes("--new"),s=t("--out")||"/tmp/sootsim-recordings",n=t("--screenshots")||"/tmp/sootsim-flow",l=t("--screenshot-paths")==="flow"?"flow":"dir",a=t("--device")?.trim()||"",m=o.includes("--slow")?+(t("--slow")||"500"):0,g=o.includes("--electron"),y=o.includes("--preview"),W=await xe(t("--preview-origin")),Z=t("--preview-public-origin"),Ae=o.includes("--preview-open"),Pe=o.flatMap((u,d)=>o[d-1]==="--replace"?["--replace",u]:[]),S=o.includes("--record")||y,ee=o.includes("--tail-wait")?Math.max(0,+(t("--tail-wait")||"2000")):S?2e3:0,Ee=A.readFileSync(e,"utf8"),{frontmatter:$,steps:M}=q(Ee,{resolveEnv:!0});M.length===0&&(console.error(" error: flow file must contain a YAML array of steps"),process.exit(1));let P=a||$.device||"",C=g||$.electron===!0,L=$.app===void 0||$.app===null?"":typeof $.app=="number"?String($.app):$.app,te={stripBooleanFlags:["--record","--profile","--electron","--new","--preview","--preview-open","--headless"],stripValueFlags:["--out","--device","--slow","--tail-wait","--url","--replace","--screenshots","--screenshot-paths","--preview-origin","--preview-public-origin","--driver"]},x=z(o,te),_e=t("--url")||"";C&&!ye()&&(console.error(" error: desktop companion not found. install or build it first with `bun run build:electron`"),process.exit(1));let re=C?"desktop companion":"bridge",Ce=L?` | target: ${L}`:"";console.log(`
|
|
328
328
|
sootsim flow \u2014 ${h.basename(e)}
|
|
329
|
-
${M.length} steps | ${
|
|
330
|
-
`),y&&
|
|
329
|
+
${M.length} steps | ${re}${Ce}${S?" | recording":""}${r?" | profiling":""}${m?` | ${m}ms delay`:""}
|
|
330
|
+
`),y&&le({event:"preview_flow_started",properties:{flowName:h.basename(e),stepCount:M.length,mode:re,electron:C,record:S,profile:r,previewOrigin:W}});let T=_e||L||"",j=i||C&&x.simIdSource!=="flag",ie=!1;if(!T&&!j&&x.simIdSource==="none"){let u=ue(x);try{let d=await u.listSims(),v=d.find(N=>N.isPrimary&&N.readyState==="open"),O=d.find(N=>N.readyState==="open"),se=v??O;se&&(ie=!0,console.log(` reusing active sim: ${se.id}`))}catch{}finally{u.close()}}if(!T&&!ie&&(j||x.simIdSource==="none")){let u=await Ue();u||(console.error(" error: no current sim and no sootsim target found"),await H(),process.exit(1)),T=u}if(T&&P){let u=new URL(await be(T));u.searchParams.set("device",P),T=u.toString()}if(T){let u=[T];u.push(...Pe),j&&u.push("--new"),x.simIdSource==="flag"&&x.simId&&u.push("--sim",x.simId);let d=t("--driver");d&&u.push("--driver",d),o.includes("--headless")&&u.push("--headless"),await ve(u,{port:x.wsPort,timeoutMs:x.commandTimeoutMs})}let I=z(o,te),K=I.simIdSource==="flag"?I.simId:de()||I.simId,De=I.simIdSource==="flag"?"flag":K?"saved":"none",F=ce(I.wsPort,{commandTimeoutMs:I.commandTimeoutMs,simId:K,simIdSource:De,fallbackOnMissingSimId:!1}),c,oe=async()=>{if(!P)return!1;let u=await F.send({type:"evaluate",simId:c.simId,code:"window.location.href"});if(typeof u=="string"&&u.length>0){let d=new URL(u);d.searchParams.set("device",P),c.setSimRouteHint(d.toString())}return!!await F.send({type:"call",simId:c.simId,path:"SootSim.bridges.settings.set",args:["deviceModel",P]})};c=new U(F,{screenshotDir:n,flowDir:h.dirname(h.resolve(e)),screenshotPathMode:l,simId:K,recordingOutputDir:S?s:void 0,billingOriginOverride:y?W:void 0,allowGitHubRecording:S,onAfterLaunch:async()=>{await oe()&&await c.waitForTree(12e4),y&&await F.send({type:"evaluate",simId:c.simId,code:`(() => {
|
|
331
331
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
332
332
|
return r?.start?.() ?? false
|
|
333
|
-
})()`})}}),m&&(c.stepDelay=m);let k=null,b=null,E=null,J=null,
|
|
333
|
+
})()`})}}),m&&(c.stepDelay=m);let k=null,b=null,E=null,J=null,D=0,ne=!!M[0]?.launchApp;try{await c.waitForTree(12e4),await oe()&&await c.waitForTree(12e4),y&&!ne&&!process.env.SOOTSIM_PREVIEW_RESET_DONE&&await c.launchApp({clearState:!0}),S&&(ne?c.prepareRecording():await c.startRecording()),r&&await c.startProfile(),y&&(await F.send({type:"evaluate",simId:c.simId,code:`(() => {
|
|
334
334
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
335
335
|
return r?.start?.() ?? false
|
|
336
|
-
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await c.runFlow(M),r&&(k=await c.stopProfile()),S&&
|
|
336
|
+
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await c.runFlow(M),r&&(k=await c.stopProfile()),S&&ee>0&&await new Promise(d=>setTimeout(d,ee)),S&&(b=await c.stopRecording(),E=c.getLastRecordingDurationMs()),y&&(J=await F.send({type:"evaluate",simId:c.simId,code:`(() => {
|
|
337
337
|
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
338
338
|
return r?.stop?.() ?? []
|
|
339
339
|
})()`}),console.log(` captured ${J.length} replay events`)),console.log(`
|
|
340
340
|
+ completed (${M.length} steps)`),k&&ke(k),b&&console.log(` video: ${b}`),console.log()}catch(u){if(r&&!k)try{k=await c.stopProfile()}catch{}if(S&&!b)try{b=await c.stopRecording(),E=c.getLastRecordingDurationMs()}catch(d){console.warn(` recording stop failed: ${d?.message||String(d)}`)}console.error(`
|
|
341
341
|
x failed: ${u.message}
|
|
342
|
-
`),k&&(console.log(" partial profile:"),ke(k)),b&&console.log(` partial video: ${b}`);try{let d=c.lastFailedStep,v=d?`step-${String(d.index+1).padStart(2,"0")}-${d.kind}`:"unstaged",
|
|
343
|
-
preparing preview upload\u2026`);let{runUpload:v}=await import("./upload-
|
|
344
|
-
`)+(
|
|
345
|
-
`:""),r=e(Buffer.from(t,"utf8")),
|
|
346
|
-
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=m;return}Y(),console.log(` flow draft validated (${l.stepCount} step${l.stepCount===1?"":"s"})`),l.outputPath&&console.log(` saved: ${l.outputPath}`),s&&console.log(" video: recorded during validation run");return}if(Y(),console.log(` flow draft ended (${l.stepCount} step${l.stepCount===1?"":"s"})`),l.outputPath){console.log(` saved: ${l.outputPath}`),console.log(` next: sootsim flow ${l.outputPath} --record`);return}console.log(""),process.stdout.write(l.yaml);return}case"validate":{let r=
|
|
347
|
-
profile:`),console.log(` frames: ${
|
|
348
|
-
worst frames:`),
|
|
342
|
+
`),k&&(console.log(" partial profile:"),ke(k)),b&&console.log(` partial video: ${b}`);try{let d=c.lastFailedStep,v=d?`step-${String(d.index+1).padStart(2,"0")}-${d.kind}`:"unstaged",O=h.join(n,v);await c.captureFailureBundle(O,{error:u,stepIndex:d?.index,stepKind:d?.kind,stepTarget:d?.target}),console.log(` failure bundle: ${O}`),console.log(" (contents: screenshot.png, describe.json, a11y.txt, tree.txt, console.json, error.json)")}catch(d){try{let v=h.join(n,"error.png");await c.captureFailureScreenshot(v),console.log(` error screenshot: ${v}`)}catch{}console.log(` (failure bundle capture failed: ${d instanceof Error?d.message:String(d)})`)}await me(F,{errorsCommand:`sootsim get errors 5${c.simId?` --sim ${c.simId}`:""}`,warningsCommand:`sootsim get warnings 5${c.simId?` --sim ${c.simId}`:""}`,requestsCommand:`sootsim get requests 5${c.simId?` --sim ${c.simId}`:""}`}),D=1}finally{F.close()}if(D===0&&y)try{let u=await We(J??[]),d=["--origin",W,"--events",u];Z&&d.push("--public-origin",Z),b&&d.push("--video",b),b&&E&&Number.isFinite(E)&&d.push("--video-duration-ms",String(Math.round(E))),c.simId&&d.push("--sim",c.simId),Ae&&d.push("--open"),console.log(`
|
|
343
|
+
preparing preview upload\u2026`);let{runUpload:v}=await import("./upload-PNZ3UEOL.js");await v(d,{})}catch(u){console.error(` preview upload failed: ${u?.message||u}`),D=1}return await H(),D}async function We(o){let{gzipSync:e}=await import("zlib"),t=o.map(s=>JSON.stringify(s)).join(`
|
|
344
|
+
`)+(o.length?`
|
|
345
|
+
`:""),r=e(Buffer.from(t,"utf8")),i=h.join(Me(),`sootsim-events-${Date.now()}.jsonl.gz`);return A.writeFileSync(i,r),console.log(` events: ${o.length} written to ${i} (${r.length} bytes gz)`),i}async function Le(o){let e=o[0],t=r=>o.find((i,s)=>o[s-1]===r);switch(e){case"start":{let{path:r,state:i}=we();console.log(" flow draft started"),console.log(` session: ${r}`),console.log(` steps: ${i.steps.length}`);return}case"keep":case"good":{let r=X();if(r.active||(console.error(" no active flow draft \u2014 run `sootsim flow start` first"),process.exit(1)),!r.kept){console.log(" no pending action to keep");return}console.log(` kept: ${r.candidate.summary}`),console.log(` steps: ${r.stepCount}`);return}case"end":{let r=t("--output")||(o[1]&&!o[1].startsWith("-")?o[1]:void 0),i=o.includes("--validate")||o.includes("--video"),s=o.includes("--video"),n=X();n.active&&n.kept&&console.log(` auto-kept trailing action: ${n.candidate.summary}`);let l=ge(r||(i?Ke():void 0));if(l.active||(console.error(" no active flow draft \u2014 run `sootsim flow start` first"),process.exit(1)),!l.valid){console.error(" flow draft is not valid:");for(let a of l.issues)console.error(` - ${a}`);console.error(" draft preserved \u2014 keep at least one real interaction or run `sootsim flow start` to reset"),process.exit(1)}if(i){let a=Je(o,l.outputPath),m=await Ie(a);if(m!==0){console.error(`
|
|
346
|
+
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=m;return}Y(),console.log(` flow draft validated (${l.stepCount} step${l.stepCount===1?"":"s"})`),l.outputPath&&console.log(` saved: ${l.outputPath}`),s&&console.log(" video: recorded during validation run");return}if(Y(),console.log(` flow draft ended (${l.stepCount} step${l.stepCount===1?"":"s"})`),l.outputPath){console.log(` saved: ${l.outputPath}`),console.log(` next: sootsim flow ${l.outputPath} --record`);return}console.log(""),process.stdout.write(l.yaml);return}case"validate":{let r=o[1];(!r||r.startsWith("-"))&&(console.error(" usage: sootsim flow validate <path>"),process.exit(1));let i=G(r);if(i.length>0){console.error(` x ${r} failed validation:`);for(let s of i)console.error(` - ${s}`);process.exit(1)}console.log(` + ${r} looks valid`);return}}}function je(o){return o[0]==="--sim"&&o.length>=2?[...o.slice(2),"--sim",o[1]]:o}async function ut(o){let e=je(o),t=e[0];if(t==="start"||t==="keep"||t==="good"||t==="end"||t==="validate")return await Le(e),0;let r=await Ie(e);return r!==0&&(process.exitCode=r),r}function ke(o){let e=o.avgMs>0?(1e3/o.avgMs).toFixed(1):"?",t=o.sampleCount>0?(o.jankFrames/o.sampleCount*100).toFixed(1):"0";console.log(`
|
|
347
|
+
profile:`),console.log(` frames: ${o.frames}`),console.log(` total: ${o.totalMs.toFixed(1)}ms`),console.log(` avg: ${o.avgMs.toFixed(2)}ms (${e} fps)`),console.log(` max: ${o.maxMs.toFixed(2)}ms`),o.layoutAvgMs!==void 0&&console.log(` breakdown: layout ${o.layoutAvgMs.toFixed(2)}ms | render ${o.renderAvgMs?.toFixed(2)||"0.00"}ms | copy ${o.copyAvgMs?.toFixed(2)||"0.00"}ms`),console.log(` p95: ${o.p95.toFixed(2)}ms`),console.log(` p99: ${o.p99.toFixed(2)}ms`),console.log(` jank: ${o.jankFrames}/${o.sampleCount} (${t}%) >16.67ms`);let r=Array.isArray(o.worstFrames)?o.worstFrames:[];if(r.length!==0){if(console.log(`
|
|
348
|
+
worst frames:`),o.mode==="render-worker"){console.log(" total layout render copy t+");for(let i of r){let[s,n,l,a,m]=i;console.log(` ${n.toFixed(2).padStart(7)} ${l.toFixed(2).padStart(7)} ${a.toFixed(2).padStart(7)} ${m.toFixed(2).padStart(7)} ${String(s).padStart(5)}`)}return}console.log(` ${r.map(i=>i.toFixed(2)).join(", ")}`)}}function Ke(){return h.join(Me(),`sootsim-flow-draft-${Date.now()}.yaml`)}function Je(o,e){if(!e)throw new Error("validated flow draft requires an output path");let t=[e];for(let r=1;r<o.length;r++){let i=o[r];if(!(i==="--validate"||i==="--video")){if(i==="--output"){r+=1;continue}r===1&&!i.startsWith("-")||t.push(i)}}return!t.includes("--record")&&o.includes("--video")&&t.push("--record"),t}export{Ue as a,Ie as b,je as c,ut as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
function t(_){return`(async () => {
|
|
3
3
|
const __t = window.__sootsimTest
|
|
4
4
|
if (!__t) throw new Error('__sootsimTest not available')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{existsSync as C,mkdirSync as D,readFileSync as O,rmSync as s,writeFileSync as g}from"fs";import{tmpdir as P}from"os";import{dirname as R,join as A,resolve as x}from"path";import{execFileSync as a}from"child_process";import{readFileSync as I}from"fs";import{createRequire as S}from"module";var o=null;function u(r){o||(o=_());try{return o(r)}catch{return null}}function _(){let r=Number(process.env.PPID);if(Number.isFinite(r)&&r>1&&r!==process.ppid)return()=>r;if(process.platform==="linux")return y();if(process.platform==="darwin"){let n=E();return n||T()}return()=>null}function y(){return r=>{try{let n=I(`/proc/${r}/stat`,"utf8"),t=n.lastIndexOf(")");if(t<0)return null;let i=n.slice(t+1).trim().split(/\s+/),e=Number(i[1]);return Number.isFinite(e)&&e>0?e:null}catch{return null}}}var N=3,d=216,b=16;function E(){if(!process.versions?.bun)return null;try{let r=S(import.meta.url),{dlopen:n,FFIType:t}=r("bun:ffi"),i=n("/usr/lib/libproc.dylib",{proc_pidinfo:{args:[t.i32,t.i32,t.u64,t.ptr,t.i32],returns:t.i32}}),e=Buffer.alloc(d);return m=>{if(Number(i.symbols.proc_pidinfo(m,N,0n,e,d))<=0)return null;let p=e.readUInt32LE(b);return p>0?p:null}}catch{return null}}function T(){return r=>{try{let t=a("lsof",["-R","-p",String(r),"-d","cwd","-a"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
3
|
`)[1];if(!t)return null;let i=t.trim().split(/\s+/),e=Number(i[2]);return Number.isFinite(e)&&e>1?e:null}catch{return null}}}var c=1,f="SOOTSIM_CLI_CURRENT_SIM_PATH",v=["SOOTSIM_CLI_IDENTITY","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","TERM_SESSION_ID","ITERM_SESSION_ID","TMUX_PANE","STY","KITTY_WINDOW_ID","WEZTERM_PANE","ALACRITTY_WINDOW_ID","WINDOWID","VSCODE_INJECTION"];function F(r,n=20){let t=u(r);if(!t||t<=1)return null;for(let i=0;i<n;i++){let e=u(t);if(!e||e<=1)return t;t=e}return t}function k(){for(let n of v){let t=process.env[n];if(t&&t.trim())return{key:`${n}:${t.trim()}`,source:n,stable:!0}}let r=F(process.ppid);return r&&r>1?{key:`gppid-${r}`,source:"grand-ppid",stable:!0}:{key:`pid-${process.ppid}`,source:"ppid",stable:!1}}function L(){return k().key}function l(){if(process.env[f])return x(process.env[f]);let r=L();return A(P(),`sootsim-current-sim-${r}.json`)}function h(){let r=l();if(!C(r))return null;try{let n=JSON.parse(O(r,"utf8"));return n.version!==c||typeof n.simId!="string"||!n.simId.trim()||typeof n.updatedAt!="string"?(s(r,{force:!0}),null):{version:c,simId:n.simId.trim(),updatedAt:n.updatedAt}}catch{return s(r,{force:!0}),null}}function J(){return h()?.simId||null}function j(r){let n=r.trim();if(!n)return;let t=l();D(R(t),{recursive:!0}),g(t,JSON.stringify({version:c,simId:n,updatedAt:new Date().toISOString()},null,2)+`
|
|
4
4
|
`)}function K(){s(l(),{force:!0})}export{k as a,L as b,J as c,j as d,K as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.62 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
|
|
3
3
|
`)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
|
|
4
4
|
run: bun run --cwd packages/sootsim-engine build:electron-main
|