sootsim 0.1.66 → 0.1.67
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-IW7CCSSI.js → agent-Z45KTLTP.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-5DJBERZP.js → agent-wrapper-EEKVEJOC.js} +2 -2
- package/dist-cli/chunks/{assert-RHILK3WR.js → assert-MDYZKXZ6.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-YZ6C6VYO.js +2 -0
- package/dist-cli/chunks/beta-WXH75XUE.js +2 -0
- package/dist-cli/chunks/chunk-2HKCZLY7.js +372 -0
- package/dist-cli/chunks/{chunk-UMXVWFST.js → chunk-2I535GZU.js} +1 -1
- package/dist-cli/chunks/{chunk-TJEP4DBA.js → chunk-3KVVIZ6M.js} +2 -2
- package/dist-cli/chunks/chunk-42NMKOVE.js +3 -0
- package/dist-cli/chunks/{chunk-WAOLC7WV.js → chunk-4H6LBA4A.js} +1 -1
- package/dist-cli/chunks/{chunk-LVFWALS4.js → chunk-4QSGVTBE.js} +2 -2
- package/dist-cli/chunks/{chunk-T4YLDM5C.js → chunk-52RZ6TSZ.js} +3 -3
- package/dist-cli/chunks/{chunk-AYBGSHQK.js → chunk-5WRBVYML.js} +2 -2
- package/dist-cli/chunks/{chunk-BD76YSRN.js → chunk-67566AJS.js} +2 -2
- package/dist-cli/chunks/chunk-6O64VUC6.js +2 -0
- package/dist-cli/chunks/chunk-7PQHQOCI.js +186 -0
- package/dist-cli/chunks/{chunk-V4SZERWD.js → chunk-AQ7YR4MO.js} +14 -14
- package/dist-cli/chunks/{chunk-6AP6LXVV.js → chunk-ATRGAFJD.js} +1 -1
- package/dist-cli/chunks/{chunk-LRBMW2WC.js → chunk-BCVVANS5.js} +2 -2
- package/dist-cli/chunks/chunk-CUNQTNH4.js +35 -0
- package/dist-cli/chunks/{chunk-DEQ7RED3.js → chunk-DOWYG3HG.js} +2 -2
- package/dist-cli/chunks/{chunk-XZ5SQJM2.js → chunk-EJTXYZEF.js} +128 -36
- package/dist-cli/chunks/{chunk-4NT6VRUU.js → chunk-F23Y4HMT.js} +1 -1
- package/dist-cli/chunks/{chunk-M2Q4FXRE.js → chunk-F4RC4AOY.js} +1 -1
- package/dist-cli/chunks/chunk-GFVC6EEB.js +1 -0
- package/dist-cli/chunks/{chunk-BEQD2DSK.js → chunk-HW5YHSIE.js} +1 -1
- package/dist-cli/chunks/{chunk-VRV2X4X2.js → chunk-IB4BRND4.js} +1 -1
- package/dist-cli/chunks/{chunk-22CO2ZE3.js → chunk-IBWN764Q.js} +2 -2
- package/dist-cli/chunks/chunk-JE4JBSNJ.js +119 -0
- package/dist-cli/chunks/{chunk-HWCZYW6M.js → chunk-K4PKR2EO.js} +2 -2
- package/dist-cli/chunks/chunk-KBJ2WHII.js +73 -0
- package/dist-cli/chunks/chunk-KR36VJSN.js +1 -0
- package/dist-cli/chunks/{chunk-EEMGSSWY.js → chunk-LQ5BA5JU.js} +2 -2
- package/dist-cli/chunks/chunk-MIAAZSSE.js +12 -0
- package/dist-cli/chunks/{chunk-BTHB3PMG.js → chunk-N4JRDJMN.js} +3 -3
- package/dist-cli/chunks/{chunk-FXF2FHPI.js → chunk-NYR3Z44O.js} +2 -2
- package/dist-cli/chunks/{chunk-EIQLQDKX.js → chunk-O624O5MO.js} +2 -2
- package/dist-cli/chunks/{chunk-4LYNJPUM.js → chunk-SH6HMUCY.js} +2 -2
- package/dist-cli/chunks/chunk-SVFSMAZN.js +2 -0
- package/dist-cli/chunks/chunk-TEMZK6Q2.js +1 -0
- package/dist-cli/chunks/{chunk-D4VEI6MI.js → chunk-TLTS533S.js} +1 -1
- package/dist-cli/chunks/chunk-U47AHSGE.js +23 -0
- package/dist-cli/chunks/{chunk-LCKLQSZX.js → chunk-XCRUPKWB.js} +2 -2
- package/dist-cli/chunks/{chunk-NCSGLZRV.js → chunk-YGQV3CUV.js} +2 -2
- package/dist-cli/chunks/{chunk-UNSLXX7V.js → chunk-ZJJKYJMH.js} +2 -2
- package/dist-cli/chunks/{chunk-GDCMTHEU.js → chunk-ZO7SGE65.js} +1 -1
- package/dist-cli/chunks/{chunk-HIN5TAAL.js → chunk-ZP2HMCKS.js} +1 -1
- package/dist-cli/chunks/cli-version-5LGQQE5P.js +2 -0
- package/dist-cli/chunks/{compat-I7JXYUJN.js → compat-5MMZ4R3Q.js} +3 -3
- package/dist-cli/chunks/{config-3HR5RKVH.js → config-YWN44WJQ.js} +2 -2
- package/dist-cli/chunks/control-LUCFDAZI.js +2 -0
- package/dist-cli/chunks/{cpu-profile-ZVHMTVAU.js → cpu-profile-VFGUVXU5.js} +2 -2
- package/dist-cli/chunks/{daemon-VYRTYH55.js → daemon-ONX5ZBXF.js} +2 -2
- package/dist-cli/chunks/{debug-CQ6Y7GJ2.js → debug-CPOG32OT.js} +5 -5
- package/dist-cli/chunks/demo-app-registry-LWT6JLU6.js +2 -0
- package/dist-cli/chunks/{detox-7ZKTGLDR.js → detox-J6NGSZR5.js} +2 -2
- package/dist-cli/chunks/{device-4M6Z7E2N.js → device-QYOQXI2P.js} +2 -2
- package/dist-cli/chunks/{diagnose-SMQLYGNX.js → diagnose-MMW4LJLA.js} +2 -2
- package/dist-cli/chunks/drivers-NRWUJJCD.js +2 -0
- package/dist-cli/chunks/{electron-6N2MIN5W.js → electron-IK3HIZY4.js} +3 -3
- package/dist-cli/chunks/flow-2MB7HINM.js +2 -0
- package/dist-cli/chunks/{hints-RJCZS2E3.js → hints-KZOD56U5.js} +2 -2
- package/dist-cli/chunks/{home-paths-DCUNA3CD.js → home-paths-R2YZZTUM.js} +2 -2
- package/dist-cli/chunks/inspect-ZARO3HQ4.js +970 -0
- package/dist-cli/chunks/install-O67RTYCX.js +2 -0
- package/dist-cli/chunks/{install-desktop-C7424OSW.js → install-desktop-4GH5I7SC.js} +3 -3
- package/dist-cli/chunks/{keys-TXUQOAZ3.js → keys-AXEFZUUI.js} +2 -2
- package/dist-cli/chunks/{launch-MVA44QTC.js → launch-QLE56ON7.js} +3 -3
- package/dist-cli/chunks/{login-NHO2WTHC.js → login-J45NQQM6.js} +4 -4
- package/dist-cli/chunks/{logout-SRRWADCE.js → logout-ZE5OUBB7.js} +2 -2
- package/dist-cli/chunks/{maestro-UHNXEZAN.js → maestro-FS6CAKDD.js} +2 -2
- package/dist-cli/chunks/{preview-ETIUP7KC.js → preview-TSU5IXVR.js} +2 -2
- package/dist-cli/chunks/{profile-MY5JFVIF.js → profile-ZBJ4TYWA.js} +2 -2
- package/dist-cli/chunks/{react-KCMC4GL3.js → react-TGZLTTYN.js} +2 -2
- package/dist-cli/chunks/record-JSBFUNOD.js +54 -0
- package/dist-cli/chunks/runtime-DGDQ7NVY.js +2 -0
- package/dist-cli/chunks/{runtime-delivery-LQZIWQU6.js → runtime-delivery-36UMAXOV.js} +2 -2
- package/dist-cli/chunks/screenshot-3CHMALUJ.js +33 -0
- package/dist-cli/chunks/{screenshot-mode-USPWASI3.js → screenshot-mode-C547UT5H.js} +2 -2
- package/dist-cli/chunks/{screenshots-EPEDNA6H.js → screenshots-XCNGSNYG.js} +2 -2
- package/dist-cli/chunks/{server-222QT33M.js → server-W37X3IW7.js} +6 -6
- package/dist-cli/chunks/setup-repo-DETS5ZJT.js +2 -0
- package/dist-cli/chunks/{skills-6XRREE2M.js → skills-OXZLDNDW.js} +2 -2
- package/dist-cli/chunks/{start-YCAZBZEX.js → start-N6ZQYUBP.js} +4 -4
- package/dist-cli/chunks/store-QOXJKJUZ.js +2 -0
- package/dist-cli/chunks/telemetry-74LX7WG4.js +2 -0
- package/dist-cli/chunks/{test-6TNRHSWC.js → test-DWZ7PRSW.js} +3 -3
- package/dist-cli/chunks/{three-mode-MDOLHGXW.js → three-mode-P2R7KA62.js} +2 -2
- package/dist-cli/chunks/{timeline-72MWE44G.js → timeline-VPES3YCN.js} +3 -3
- package/dist-cli/chunks/{upgrade-IHZ4DFAE.js → upgrade-NYQLA4UJ.js} +2 -2
- package/dist-cli/chunks/upload-YOMMYESV.js +2 -0
- package/dist-cli/chunks/{web-JLJSJUS2.js → web-OTALJKK5.js} +2 -2
- package/dist-cli/chunks/what-happened-GZ73H6KF.js +22 -0
- package/dist-cli/chunks/{whoami-2EYGCRDQ.js → whoami-UDLQK7IY.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 +9 -2
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +23 -7
- 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 +23 -7
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/auto-bootstrap-PS2UDBP7.js +0 -2
- package/dist-cli/chunks/beta-XLYWSKEA.js +0 -2
- package/dist-cli/chunks/chunk-5MVFADNH.js +0 -3
- package/dist-cli/chunks/chunk-7NYW73Q6.js +0 -2
- package/dist-cli/chunks/chunk-EMMX6RF7.js +0 -73
- package/dist-cli/chunks/chunk-FIIBCY5I.js +0 -3
- package/dist-cli/chunks/chunk-G4VWDOWB.js +0 -17
- package/dist-cli/chunks/chunk-GMKGJHVG.js +0 -1
- package/dist-cli/chunks/chunk-M3ZEZHOB.js +0 -34
- package/dist-cli/chunks/chunk-MWTMLNGM.js +0 -348
- package/dist-cli/chunks/chunk-NQKBIKUZ.js +0 -1
- package/dist-cli/chunks/chunk-QMRXLBPN.js +0 -11
- package/dist-cli/chunks/chunk-X4HQLK4V.js +0 -119
- package/dist-cli/chunks/chunk-XOTJSR4T.js +0 -2
- package/dist-cli/chunks/chunk-YSQV4D7P.js +0 -1
- package/dist-cli/chunks/chunk-Z6HSVZIO.js +0 -100
- package/dist-cli/chunks/cli-version-ESQ2S6N5.js +0 -2
- package/dist-cli/chunks/control-TDZXFNVT.js +0 -2
- package/dist-cli/chunks/demo-app-registry-JAYU7BBM.js +0 -2
- package/dist-cli/chunks/drivers-SIY6JBEM.js +0 -2
- package/dist-cli/chunks/flow-BZEWL7UQ.js +0 -2
- package/dist-cli/chunks/inspect-T5NC7HHB.js +0 -1025
- package/dist-cli/chunks/install-YTJI5RS7.js +0 -2
- package/dist-cli/chunks/record-DHDSXC2Y.js +0 -51
- package/dist-cli/chunks/runtime-AJP6V5LM.js +0 -2
- package/dist-cli/chunks/screenshot-4KPEEI6I.js +0 -28
- package/dist-cli/chunks/setup-repo-D56L3CEB.js +0 -2
- package/dist-cli/chunks/store-Z32KZ34K.js +0 -2
- package/dist-cli/chunks/telemetry-RFTX2BZK.js +0 -2
- package/dist-cli/chunks/upload-G5C7LJWG.js +0 -2
- package/dist-cli/chunks/what-happened-BUXSJ3QS.js +0 -15
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.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
3
|
+
import{a as l}from"./chunks/chunk-ZJJKYJMH.js";import{a as A,b as k,c as S,d as L,e as u,f as T}from"./chunks/chunk-JE4JBSNJ.js";import{a as d}from"./chunks/chunk-SVFSMAZN.js";import{a as v,d as _}from"./chunks/chunk-2I535GZU.js";import{a as E}from"./chunks/chunk-F23Y4HMT.js";import"./chunks/chunk-NYR3Z44O.js";import"./chunks/chunk-6O64VUC6.js";import{z as C}from"./chunks/chunk-HW5YHSIE.js";import"./chunks/chunk-TLTS533S.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-74LX7WG4.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-74LX7WG4.js");await e(),process.exit(t)}if(o.version){let{getCliVersion:t}=await import("./chunks/cli-version-5LGQQE5P.js"),{IS_BETA:e,BETA_LABEL:i}=await import("./chunks/beta-WXH75XUE.js"),m=e?` \xB7 ${i}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:I}=await import("./chunks/home-paths-R2YZZTUM.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-QOXJKJUZ.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-N6ZQYUBP.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-YZ6C6VYO.js"),i=e(s,a);await t(i);let{runInspect:m}=await import("./chunks/inspect-ZARO3HQ4.js");await m([r,...s],{port:i,verbose:n})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-MDYZKXZ6.js");await t(o.commandArgs);break}case"flow":{let{runFlow:t}=await import("./chunks/flow-2MB7HINM.js"),e=await t(s);process.exit(typeof e=="number"?e:0)}case"test":{let{runTest:t}=await import("./chunks/test-DWZ7PRSW.js");await t(o.commandArgs,{port:a,verbose:n});break}case"detox":{let{runDetox:t}=await import("./chunks/detox-J6NGSZR5.js");await t(o.commandArgs,{port:a,verbose:n});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-FS6CAKDD.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-TSU5IXVR.js");await t(o.commandArgs,{port:a,verbose:n});break}case"record":{let{runRecord:t}=await import("./chunks/record-JSBFUNOD.js");await t(s,{port:a,verbose:n});break}case"profile":{let{runProfile:t}=await import("./chunks/profile-ZBJ4TYWA.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-VFGUVXU5.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-TGZLTTYN.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-3CHMALUJ.js");await t(s,{port:a,verbose:n});break}case"screenshots":{let{runScreenshots:t}=await import("./chunks/screenshots-XCNGSNYG.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-C547UT5H.js");await t(o.commandArgs,{port:a,verbose:n});break}case"three-mode":case"3d-mode":{let{runThreeMode:t}=await import("./chunks/three-mode-P2R7KA62.js");await t(o.commandArgs,{port:a,verbose:n});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-ZARO3HQ4.js");await t(s,{port:a,verbose:n});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-CPOG32OT.js");await t(s,{port:a,verbose:n});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-VPES3YCN.js");await t(s,{port:a,verbose:n});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-GZ73H6KF.js");await t(s,{port:a,verbose:n});break}case"diagnose":{let{runDiagnose:t}=await import("./chunks/diagnose-MMW4LJLA.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-YZ6C6VYO.js"),i=e(s,a);await t(i);let{runOpenCommand:m}=await import("./chunks/control-LUCFDAZI.js");await m(s,{port:i});break}case"use":case"focus":{let{runUseCommand:t}=await import("./chunks/control-LUCFDAZI.js");await t(s,{port:a});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-LUCFDAZI.js");await t(s,{port:a});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-LUCFDAZI.js");await t(s,{port:a});break}case"config":{let{runConfig:t}=await import("./chunks/config-YWN44WJQ.js");await t(o.commandArgs);break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-QYOQXI2P.js");await t(s,{port:a});break}case"scan":case"compat":{let{runCompat:t}=await import("./chunks/compat-5MMZ4R3Q.js");await t(o.commandArgs);break}case"electron":{let{runElectron:t}=await import("./chunks/electron-IK3HIZY4.js");await t(o.commandArgs,{port:a,device:p,driver:R});break}case"login":{let{runLogin:t}=await import("./chunks/login-J45NQQM6.js");await t(o.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-ZE5OUBB7.js");await t();break}case"whoami":{let{runWhoami:t}=await import("./chunks/whoami-UDLQK7IY.js");await t();break}case"keys":{let{runKeys:t}=await import("./chunks/keys-AXEFZUUI.js");await t(o.commandArgs);break}case"setup-repo":{let{runSetupRepo:t}=await import("./chunks/setup-repo-DETS5ZJT.js");await t(o.commandArgs);break}case"install":{let{runInstall:t}=await import("./chunks/install-O67RTYCX.js");await t(o.commandArgs);break}case"install-desktop":{let{runInstallDesktop:t}=await import("./chunks/install-desktop-4GH5I7SC.js");await t(o.commandArgs);break}case"server":{let{runServer:t}=await import("./chunks/server-W37X3IW7.js");await t(o.commandArgs,{port:a});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-ONX5ZBXF.js");await t(o.commandArgs,{port:a});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-DGDQ7NVY.js");await t(o.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-NYQLA4UJ.js");await t(o.commandArgs);break}case"launch":{let{runLaunch:t}=await import("./chunks/launch-QLE56ON7.js");await t(o.commandArgs);break}case"start":{let{runStart:t}=await import("./chunks/start-N6ZQYUBP.js");await t(o.commandArgs,{port:a});break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-Z45KTLTP.js"),e=await t(o.commandArgs);process.exit(e)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-EEKVEJOC.js"),e=await t(o.commandArgs);process.exit(e)}case"skills":{let{runSkills:t}=await import("./chunks/skills-OXZLDNDW.js");await t(o.commandArgs);break}case"upload":{let{runUpload:t}=await import("./chunks/upload-YOMMYESV.js");await t(o.commandArgs,{port:a,verbose:n});break}case"hints":{let{runHints:t}=await import("./chunks/hints-KZOD56U5.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.67 | (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-67566AJS.js";import"./chunk-F4RC4AOY.js";import"./chunk-6O64VUC6.js";import"./chunk-HW5YHSIE.js";import"./chunk-TLTS533S.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.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as M}from"./chunk-F4RC4AOY.js";import"./chunk-TLTS533S.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.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import"./chunk-TLTS533S.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.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a,b,c,d}from"./chunk-N4JRDJMN.js";import"./chunk-U47AHSGE.js";import"./chunk-IB4BRND4.js";import"./chunk-6O64VUC6.js";import"./chunk-HW5YHSIE.js";import"./chunk-TLTS533S.js";export{c as ensureDaemonRunning,a as ensureRuntimeInstalled,d as ensureSootsimReady,b as resolveBootstrapPort};
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as Me}from"./chunk-4QSGVTBE.js";import{a as Pe}from"./chunk-SH6HMUCY.js";import{a as Ie}from"./chunk-KBJ2WHII.js";import{a as R,b as we,c as he,d as Q,e as Z,f as ge,g as ee,i as te,j as ye,k as ke}from"./chunk-EJTXYZEF.js";import{f as xe,m as Te,o as Fe,s as $e}from"./chunk-MIAAZSSE.js";import{e as ve}from"./chunk-K4PKR2EO.js";import{l as pe}from"./chunk-CUNQTNH4.js";import{a as be}from"./chunk-XCRUPKWB.js";import{a as Se}from"./chunk-ZO7SGE65.js";import{a as me,b as q}from"./chunk-DOWYG3HG.js";import{f as ue}from"./chunk-NYR3Z44O.js";import{c as Y,d as X,e as fe}from"./chunk-U47AHSGE.js";import{c as G}from"./chunk-IB4BRND4.js";import*as P from"fs";import{tmpdir as Ce}from"os";import*as y from"path";import*as g from"fs";import*as w from"path";var V=1e4,B=393,_=852,Ae="__sootsimCliPerf",je="maestroCopiedText",Ee=new Map;function f(o){return new Promise(e=>setTimeout(e,o))}function Ke(o){return o?w.basename(o)===".maestro"?w.dirname(o):o:process.cwd()}function Je(o,e,t){let i=e.endsWith(".png")?e:`${e}.png`;if(w.isAbsolute(i))return i;if(t.mode==="flow"&&/[\\/]/.test(i)){let r=i.startsWith("./")||i.startsWith("../")?t.flowDir??process.cwd():Ke(t.flowDir);return w.resolve(r,i)}return w.join(o,i)}function He(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 ie(o){let[e,t]=o.split(",").map(r=>r.trim()),i=(r,s)=>r.endsWith("%")?Number.parseFloat(r)/100*s:Number.parseFloat(r);return{x:i(e,B),y:i(t,_)}}function ze(o){let e=o.split(/^---$/m),t=e.length>1?e[e.length-1]:o,i=he(we.parse(t),Ee);return Array.isArray(i)?i:[]}var L=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 i=t.searchParams.toString();return`${t.origin}${t.pathname}${i?`?${i}`:""}`}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 r=this.simRouteHint&&e.find(a=>a.readyState==="open"&&this.normalizeSimRoute(a.url||a.origin)===this.simRouteHint);if(!r)return;let s=e.find(a=>a.isPrimary&&a.readyState==="open"),n=e.find(a=>a.readyState==="open"),l=r??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,i=Date.now(),r=null,s=0,n=0;for(;Date.now()<t;){try{let a=await this.evaluate(`(async () => {
|
|
3
|
+
const test = window.__sootsimTest
|
|
4
|
+
if (!test) return { count: 0, loading: true }
|
|
5
|
+
const count = (await test.getNodeCount?.()) || 0
|
|
6
|
+
const external = globalThis.__sootsimExternalAppState
|
|
7
|
+
if (external?.error) {
|
|
8
|
+
return { count, loading: false, error: String(external.error) }
|
|
9
|
+
}
|
|
10
|
+
if (external) {
|
|
11
|
+
return {
|
|
12
|
+
count,
|
|
13
|
+
loading: !external.ready,
|
|
14
|
+
error: null,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const loadingNode = await test.findByText?.('loading')
|
|
18
|
+
const capturingNode = await test.findByText?.('capturing')
|
|
19
|
+
const openingAppNode = await test.findByText?.('opening app')
|
|
20
|
+
const isLoading = !!loadingNode || !!capturingNode || !!openingAppNode || count < 5
|
|
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(r=a instanceof Error?a:new Error(String(a)),r.message.startsWith("app failed to load:"))throw r;if(s++,s>=4)throw new Error(`target sim is not responding to the bridge (${r.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()-i;l-n>=5e3&&(n=l,console.log(` [flow] waiting for app to be ready\u2026 (${Math.round(l/1e3)}s)`)),await f(500)}throw r?.message.startsWith("app failed to load:")?r: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 Pe("flow --video",{originOverride:this.opts.billingOriginOverride,allowGitHubAuth:this.opts.allowGitHubRecording}),this.recordingAccessChecked=!0);let e=Date.now(),t=await this.evaluate(`(() => {
|
|
23
|
+
const rec = window.__sootsimRecorder
|
|
24
|
+
if (!rec) return { ok: false, error: 'recorder unavailable on this page' }
|
|
25
|
+
if (rec.state() === 'recording') return { ok: true, format: 'webm' }
|
|
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 i=[],r=0;for(;;){let n=await this.evaluate(`window.__sootsimRecorder.getBlobBase64({ offset: ${r}, chunk: 2097152 })`);if(!n||(i.push(Buffer.from(n.data,"base64")),r=n.offset,n.done))break}if(i.length===0)throw new Error("recording requested but no video buffer was produced");g.mkdirSync(this.opts.recordingOutputDir,{recursive:!0});let s=w.join(this.opts.recordingOutputDir,`sootsim-${Date.now()}.webm`);return g.writeFileSync(s,Buffer.concat(i)),s}async waitForRecordingTail(e){if(!this.recordingEnabled)return;let t=Math.max(0,Math.round(e.maxMs));if(t<=0)return;if(!e.smart){await f(t);return}let i=await ke({bridge:this.bridge,simId:this.opts.simId,maxMs:t,pollMs:80,stablePolls:6,strict:!0});await this.waitForVisualSettle(),console.log(i.settled?` [flow] recording tail settled in ${i.elapsed}ms`:` [flow] recording tail reached ${i.elapsed}ms budget`)}async findElement(e){return this.evaluate(`(async () => {
|
|
28
|
+
const test = window.__sootsimTest
|
|
29
|
+
if (!test) return null
|
|
30
|
+
let node = null
|
|
31
|
+
if (${JSON.stringify(!!e.text)}) node = await test.findByText(${JSON.stringify(e.text||"")})
|
|
32
|
+
if (!node && ${JSON.stringify(!!e.id)}) {
|
|
33
|
+
node = (await test.findByTestId(${JSON.stringify(e.id||"")})) || (await test.findById(${JSON.stringify(e.id||"")}))
|
|
34
|
+
}
|
|
35
|
+
if (!node || !node.absolutePosition || !node.layout) return null
|
|
36
|
+
return {
|
|
37
|
+
nodeId: typeof node.nodeId === 'number' ? node.nodeId : null,
|
|
38
|
+
id: node.id || null,
|
|
39
|
+
testID: node.testID || null,
|
|
40
|
+
text: node.text || null,
|
|
41
|
+
absolutePosition: node.absolutePosition,
|
|
42
|
+
layout: node.layout,
|
|
43
|
+
isTextInput: !!node.isTextInput,
|
|
44
|
+
}
|
|
45
|
+
})()`)}async resolveTapTarget(e){return this.evaluate(`(async () => {
|
|
46
|
+
const test = window.__sootsimTest
|
|
47
|
+
if (!test?.resolveTapTarget) return null
|
|
48
|
+
return await test.resolveTapTarget(${e})
|
|
49
|
+
})()`)}async activatePressTarget(e){let t=e.id?{id:e.id,testID:e.id,text:null}:{id:null,testID:null,text:e.text??null};return this.evaluate(`(async () => {
|
|
50
|
+
const test = window.__sootsimTest
|
|
51
|
+
if (!test) return null
|
|
52
|
+
const node = ${e.id?`(await test.findByTestId?.(${JSON.stringify(e.id)})) || (await test.findById?.(${JSON.stringify(e.id)}))`:`await test.findByText?.(${JSON.stringify(e.text||"")})`}
|
|
53
|
+
let point = null
|
|
54
|
+
if (node?.absolutePosition && node?.layout) {
|
|
55
|
+
point = {
|
|
56
|
+
x: node.absolutePosition.x + node.layout.width / 2,
|
|
57
|
+
y: node.absolutePosition.y + node.layout.height / 2,
|
|
58
|
+
}
|
|
59
|
+
if (typeof node.nodeId === 'number' && test.resolveTapTarget) {
|
|
60
|
+
const resolved = await test.resolveTapTarget(node.nodeId)
|
|
61
|
+
if (
|
|
62
|
+
resolved &&
|
|
63
|
+
Number.isFinite(resolved.cx) &&
|
|
64
|
+
Number.isFinite(resolved.cy)
|
|
65
|
+
) {
|
|
66
|
+
point = { x: resolved.cx, y: resolved.cy }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
${e.id?`const direct = await test.activatePressById?.(${JSON.stringify(e.id)})`:`const direct = await test.activatePressByText?.(${JSON.stringify(e.text||"")})`}
|
|
71
|
+
if (direct?.ok && point) {
|
|
72
|
+
window.dispatchEvent(
|
|
73
|
+
new CustomEvent('sootsim:agentAction', {
|
|
74
|
+
detail: { type: 'tap', x: point.x, y: point.y, target: ${JSON.stringify(t)} },
|
|
75
|
+
}),
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
return direct || null
|
|
79
|
+
})()`)}async activatePressAt(e,t){return this.evaluate(`(async () => {
|
|
80
|
+
const test = window.__sootsimTest
|
|
81
|
+
if (!test?.activatePressAt) return null
|
|
82
|
+
const direct = await test.activatePressAt(${e}, ${t})
|
|
83
|
+
if (direct?.ok) {
|
|
84
|
+
window.dispatchEvent(
|
|
85
|
+
new CustomEvent('sootsim:agentAction', {
|
|
86
|
+
detail: { type: 'tap', x: ${e}, y: ${t} },
|
|
87
|
+
}),
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
return direct
|
|
91
|
+
})()`)}async tap(e,t,i){return await this.bridge.send({type:"tap",simId:this.opts.simId,x:e,y:t,target:i})}async tapOn(e){let t=typeof e=="string"?{text:e}:e;if(t.point){let a=ie(t.point);(await this.activatePressAt(a.x,a.y))?.ok||await this.tap(a.x,a.y),await f(300);return}let i=5e3,r=150,s=Date.now()+i,n=await this.findElement({text:t.text,id:t.id});for(;!n&&Date.now()<s;)await f(r),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,h=a?.cy??n.absolutePosition.y+n.layout.height/2;if((await this.tap(m,h,{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 f(300);return}}if((await this.activatePressTarget(t))?.ok){await f(300);return}throw new Error(`tapOn: element not found: ${JSON.stringify(t)}`)}async tapAtCoords(e,t){await this.tap(e,t),await f(300)}async doubleTapAtCoords(e,t,i=80){let r=Math.max(0,Math.round(i));if(!await this.evaluate(`(async () => {
|
|
92
|
+
const interact = window.__sootsimInteract
|
|
93
|
+
if (interact?.doubleTap) {
|
|
94
|
+
return !!(await interact.doubleTap(${e}, ${t}, ${r}))
|
|
95
|
+
}
|
|
96
|
+
if (!interact?.tap) return false
|
|
97
|
+
const first = await interact.tap(${e}, ${t})
|
|
98
|
+
if (!first || first.hit === false) return false
|
|
99
|
+
await new Promise((resolve) => setTimeout(resolve, ${r}))
|
|
100
|
+
const second = await interact.tap(${e}, ${t})
|
|
101
|
+
return !!second && second.hit !== false
|
|
102
|
+
})()`))throw new Error(`doubleTapAtCoords failed at (${e}, ${t})`);await f(300)}async assertVisible(e){let t=typeof e=="string"?{text:e}:e;for(let s=0;s<15;s++){if(await this.isElementVisible(t))return;await f(200)}let i=await this.findElement(t),r=i?` (matched node at y=${Math.round(i.absolutePosition.y)} h=${Math.round(i.layout.height)} \u2014 off-screen)`:" (no matching node in tree)";throw new Error(`assertVisible: ${JSON.stringify(t)} not visible${r}`)}async assertNotVisible(e){let t=typeof e=="string"?{text:e}:e;if(await this.isElementVisible(t)){let i=await this.findElement(t),r=i?` at (${Math.round(i.absolutePosition.x)},${Math.round(i.absolutePosition.y)})`:"";throw new Error(`assertNotVisible: ${JSON.stringify(t)} IS visible${r}`)}}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 f(200)}async pressKey(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"press",text:e}),await f(120)}async dispatchKey(e){await this.bridge.send({type:"keyboard",simId:this.opts.simId,action:"dispatchKey",text:e}),await f(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(`(() => {
|
|
103
|
+
const keyboard =
|
|
104
|
+
window.__sootsimKeyboard ??
|
|
105
|
+
window.SootSim?.bridges?.keyboard ??
|
|
106
|
+
null
|
|
107
|
+
const test = window.__sootsimTest
|
|
108
|
+
return {
|
|
109
|
+
visible: !!keyboard?.isVisible?.(),
|
|
110
|
+
focused: !!test?.isTextInputFocused?.(),
|
|
111
|
+
}
|
|
112
|
+
})()`);if(!t?.visible&&!t?.focused){await f(80);return}await f(80)}}async eraseText(e){for(let t=0;t<e;t++)await this.pressKey("Backspace");await f(100)}async waitFor(e){let t=Date.now()+(e.timeout||V);for(;Date.now()<t;){if(await this.findElement(e))return;await f(200)}let i=await this.findElement(e),r=i?` (matched node y=${Math.round(i.absolutePosition.y)} \u2014 still off-screen at deadline)`:"";throw new Error(`waitFor: ${JSON.stringify(e)} not found after ${e.timeout||V}ms${r}`)}async takeScreenshot(e){try{await this.waitForVisualSettle()}catch{}await f(250);let t=He(e),i=Je(this.opts.screenshotDir,t.path,{mode:this.opts.screenshotPathMode??"dir",flowDir:this.opts.flowDir});g.mkdirSync(w.dirname(i),{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 Me(n,l);g.writeFileSync(i,a),console.log(`[flow] screenshot: ${i} (frame: ${l})`);return}g.writeFileSync(i,n),console.log(`[flow] screenshot: ${i}`)}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 ue)?null:t}async captureFailureScreenshot(e){g.mkdirSync(w.dirname(e),{recursive:!0});let i=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");g.writeFileSync(e,Buffer.from(i,"base64"))}async captureFailureBundle(e,t){g.mkdirSync(e,{recursive:!0});let i=(h,p)=>{try{g.writeFileSync(w.join(e,h),p)}catch{}},r=async h=>{try{return await this.bridge.send({type:"evaluate",simId:this.opts.simId,code:h})}catch{return null}},s=await r(`(async () => {
|
|
113
|
+
const out = {
|
|
114
|
+
simId: window.__sootsimBridge?.id ?? window.SootSim?.state?.simId ?? null,
|
|
115
|
+
url: location.href,
|
|
116
|
+
title: document.title,
|
|
117
|
+
hidden: document.hidden,
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const params = new URL(location.href).searchParams
|
|
121
|
+
const bundle = params.get('bundle')
|
|
122
|
+
if (bundle) {
|
|
123
|
+
const baseMatch = bundle.match(/^https?:\\/\\/[^/]+/)
|
|
124
|
+
if (baseMatch) {
|
|
125
|
+
const res = await fetch(baseMatch[0] + '/', {
|
|
126
|
+
headers: { 'expo-platform': 'ios' },
|
|
127
|
+
cache: 'no-store',
|
|
128
|
+
})
|
|
129
|
+
if (res.ok) {
|
|
130
|
+
out.manifest = await res.json().catch(() => null)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
} catch {}
|
|
135
|
+
return out
|
|
136
|
+
})()`);i("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(),sim:s??null},null,2));try{let p=(await this.bridge.send({type:"screenshot",simId:this.opts.simId})).replace(/^data:image\/png;base64,/,"");i("screenshot.png",Buffer.from(p,"base64"))}catch{}let n=await r(`(async () => {
|
|
137
|
+
const t = window.__sootsimTest
|
|
138
|
+
const mainShell = window.SootSim?.bridges?.mainShell
|
|
139
|
+
if (!t) return { error: 'no test bridge' }
|
|
140
|
+
let shell = null
|
|
141
|
+
try {
|
|
142
|
+
shell = typeof mainShell?.getState === 'function' ? await mainShell.getState() : null
|
|
143
|
+
} catch {}
|
|
144
|
+
const all = await t.queryAll({ pruneHidden: true })
|
|
145
|
+
return { shell, nodes: all, url: location.href, title: document.title }
|
|
146
|
+
})()`);n&&i("describe.json",JSON.stringify(n,null,2));let l=await r("(async () => await window.__sootsimTest?.dumpAccessibilityTree?.(20))()");typeof l=="string"&&i("a11y.txt",l);let a=await r("(async () => await window.__sootsimTest?.dumpTree?.(15))()");typeof a=="string"&&i("tree.txt",a);let m=await r(`(() => {
|
|
147
|
+
const c = window.__sootsimConsole
|
|
148
|
+
return {
|
|
149
|
+
errors: c?.getErrors?.() ?? [],
|
|
150
|
+
warnings: c?.getWarnings?.() ?? [],
|
|
151
|
+
requests: (window.__sootsimGetFailedRequests?.() ?? []),
|
|
152
|
+
}
|
|
153
|
+
})()`);return m&&i("console.json",JSON.stringify(m,null,2)),e}async swipe(e="UP",t=300){let i=B/2,r=_/2,s=200,n=i,l=r,a=i,m=r;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 h=Math.max(10,Math.round(t/16));await this.drag(n,l,a,m,h,16)}async drag(e,t,i,r,s=12,n=16){if(!(await this.evaluate(`(async () => {
|
|
154
|
+
const interact = window.__sootsimInteract
|
|
155
|
+
if (!interact?.drag) return { ok: false }
|
|
156
|
+
const value = await interact.drag(${e}, ${t}, ${i}, ${r}, ${Math.max(1,Math.round(s))}, ${Math.max(0,Math.round(n))})
|
|
157
|
+
return { ok: !!value, value }
|
|
158
|
+
})()`))?.ok)throw new Error("drag failed");await f(300)}async swipeCoords(e,t,i=300){let r=ie(e),s=ie(t),n=Math.max(10,Math.round(i/16));await this.drag(r.x,r.y,s.x,s.y,n,16)}async swipeFrom(e,t="UP",i=300){let r=await this.findElement(e);if(!r)throw new Error(`swipeFrom: element not found: ${JSON.stringify(e)}`);let s=r.absolutePosition.x+r.layout.width/2,n=r.absolutePosition.y+r.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 h=Math.max(10,Math.round(i/16));await this.drag(s,n,a,m,h,16)}async scrollTo(e,t,i){let r=await this.callTest("scrollTo",e,t,i,!1);if(!r?.ok)throw new Error(`scrollTo failed: ${r?.reason||"unknown error"}`);await f(250)}async pinch(e){let t=await this.evaluate(`(async () => {
|
|
159
|
+
const interact = window.__sootsimInteract
|
|
160
|
+
if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
|
|
161
|
+
const ok = await interact.pinch(
|
|
162
|
+
${e.from[0]}, ${e.from[1]}, ${e.from[2]}, ${e.from[3]},
|
|
163
|
+
${e.to[0]}, ${e.to[1]}, ${e.to[2]}, ${e.to[3]},
|
|
164
|
+
${e.steps||12}, ${e.stepMs||16}
|
|
165
|
+
)
|
|
166
|
+
return { ok: !!ok, reason: ok ? null : 'pinch returned false' }
|
|
167
|
+
})()`);if(!t?.ok)throw new Error(`pinch failed: ${t?.reason||"unknown error"}`);await f(250)}async dumpTree(e=6){let t=await this.bridge.send({type:"tree",simId:this.opts.simId,depth:e});return console.log("[flow] tree:"),console.log(typeof t=="string"?t:JSON.stringify(t,null,2)),typeof t=="string"?t:JSON.stringify(t)}async assertTreeContains(e){if(!(await this.dumpTree(8)).includes(e))throw new Error(`assertTreeContains: "${e}" not in tree`)}async waitForAnimationToEnd(e=2e3){await f(e)}async back(){try{await this.tapOn("\u2039")}catch{await this.tapOn("<")}}async scrollUntilVisible(e){let t=Date.now()+(e.timeout||15e3),i=e.direction?.toUpperCase()||"DOWN",r=i==="DOWN"?"UP":i==="UP"?"DOWN":i;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(r,250),await f(500)}throw new Error(`scrollUntilVisible: "${e.element}" not found`)}async extendedWaitUntil(e){let t=Date.now()+(e.timeout||V);for(;Date.now()<t;){let i=e.visible?await this.isElementVisible(typeof e.visible=="string"?{text:e.visible}:e.visible):!0,r=e.notVisible?!await this.isElementVisible(typeof e.notVisible=="string"?{text:e.notVisible}:e.notVisible):!0;if(i&&r)return;await f(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 () => {
|
|
168
|
+
await (${R})
|
|
169
|
+
try {
|
|
170
|
+
const regs = await navigator.serviceWorker?.getRegistrations?.()
|
|
171
|
+
await Promise.all((regs || []).map((reg) => reg.unregister()))
|
|
172
|
+
} catch {}
|
|
173
|
+
})()`),!this.firstLaunchDone&&!t)this.firstLaunchDone=!0,await this.waitForTree(3e4);else if(this.firstLaunchDone=!0,await this.evaluate("window.location.reload()").catch(()=>{}),await f(500),await this.refreshSimId(),await this.waitForTree(12e4),this.opts.onAfterLaunch)try{await this.opts.onAfterLaunch()}catch(i){console.warn(` warn: onAfterLaunch hook threw: ${i instanceof Error?i.message:i}`)}this.profilingEnabled&&await this.startProfile(),this.recordingEnabled&&(await this.waitForVisualSettle(),await this.ensureRecordingStarted())}async waitForVisualSettle(){try{await this.evaluate(`new Promise((resolve) => {
|
|
174
|
+
requestAnimationFrame(() => {
|
|
175
|
+
requestAnimationFrame(() => {
|
|
176
|
+
requestAnimationFrame(() => {
|
|
177
|
+
setTimeout(resolve, 180)
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
})`)}catch{await f(180)}}async startProfile(){await this.evaluate(`((sessionKey) => {
|
|
182
|
+
const host = window.__sootsimRenderHost
|
|
183
|
+
if (host?.startPerfSession) {
|
|
184
|
+
host.startPerfSession(sessionKey)
|
|
185
|
+
window[sessionKey] = {
|
|
186
|
+
active: true,
|
|
187
|
+
mode: 'render-worker',
|
|
188
|
+
startedAt: performance.now(),
|
|
189
|
+
}
|
|
190
|
+
return
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const perf = window.__sootsimPerf
|
|
194
|
+
const a11y = window.__sootsimA11y
|
|
195
|
+
perf?.enableFrameStats?.()
|
|
196
|
+
perf?.resetFrameStats?.()
|
|
197
|
+
a11y?.resetProfile?.()
|
|
198
|
+
window[sessionKey] = {
|
|
199
|
+
active: true,
|
|
200
|
+
mode: 'main-thread',
|
|
201
|
+
startedAt: performance.now(),
|
|
202
|
+
}
|
|
203
|
+
})(${JSON.stringify(Ae)})`),this.profilingEnabled=!0}async stopProfile(){let e=await this.evaluate(`(async (sessionKey) => {
|
|
204
|
+
const host = window.__sootsimRenderHost
|
|
205
|
+
if (host?.stopPerfSession) {
|
|
206
|
+
const stopped = await host.stopPerfSession(sessionKey)
|
|
207
|
+
if (!stopped || !Array.isArray(stopped.samples)) {
|
|
208
|
+
return { error: 'no render-worker perf samples available' }
|
|
209
|
+
}
|
|
210
|
+
const samples = stopped.samples
|
|
211
|
+
const frameTimes = samples.map((sample) => Number(sample?.[1]) || 0).filter((value) => value > 0)
|
|
212
|
+
const sorted = [...frameTimes].sort((a, b) => a - b)
|
|
213
|
+
const worstFrames = samples
|
|
214
|
+
.slice()
|
|
215
|
+
.sort((a, b) => (Number(b?.[1]) || 0) - (Number(a?.[1]) || 0))
|
|
216
|
+
.slice(0, 10)
|
|
217
|
+
.map((sample) => [
|
|
218
|
+
Number(sample?.[0]) || 0,
|
|
219
|
+
Number(sample?.[1]) || 0,
|
|
220
|
+
Number(sample?.[2]) || 0,
|
|
221
|
+
Number(sample?.[3]) || 0,
|
|
222
|
+
Number(sample?.[4]) || 0,
|
|
223
|
+
])
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
mode: 'render-worker',
|
|
227
|
+
frames: Number(stopped.frameCount) || frameTimes.length,
|
|
228
|
+
totalMs: Number(stopped.totalMs) || frameTimes.reduce((sum, value) => sum + value, 0),
|
|
229
|
+
avgMs: Number(stopped.avgMs) || (frameTimes.length ? frameTimes.reduce((sum, value) => sum + value, 0) / frameTimes.length : 0),
|
|
230
|
+
maxMs: Number(stopped.maxMs) || (sorted[sorted.length - 1] || 0),
|
|
231
|
+
layoutTotalMs: Number(stopped.layoutTotalMs) || samples.reduce((sum, sample) => sum + (Number(sample?.[2]) || 0), 0),
|
|
232
|
+
renderTotalMs: Number(stopped.renderTotalMs) || samples.reduce((sum, sample) => sum + (Number(sample?.[3]) || 0), 0),
|
|
233
|
+
copyTotalMs: Number(stopped.copyTotalMs) || samples.reduce((sum, sample) => sum + (Number(sample?.[4]) || 0), 0),
|
|
234
|
+
layoutAvgMs: Number(stopped.layoutAvgMs) || 0,
|
|
235
|
+
renderAvgMs: Number(stopped.renderAvgMs) || 0,
|
|
236
|
+
copyAvgMs: Number(stopped.copyAvgMs) || 0,
|
|
237
|
+
p50: sorted[Math.floor(sorted.length * 0.5)] || 0,
|
|
238
|
+
p95: sorted[Math.floor(sorted.length * 0.95)] || 0,
|
|
239
|
+
p99: sorted[Math.floor(sorted.length * 0.99)] || 0,
|
|
240
|
+
jankFrames: frameTimes.filter((value) => value > 16.67).length,
|
|
241
|
+
sampleCount: frameTimes.length,
|
|
242
|
+
worstFrames,
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const perf = window.__sootsimPerf
|
|
247
|
+
const a11y = window.__sootsimA11y
|
|
248
|
+
if (!perf && !a11y) return { error: 'no perf globals available' }
|
|
249
|
+
|
|
250
|
+
const frameStats = perf?.getFrameStats?.() || {}
|
|
251
|
+
const profile = a11y?.profile?.() || {}
|
|
252
|
+
const recent = Array.isArray(frameStats.recentFrames) ? frameStats.recentFrames : []
|
|
253
|
+
const sorted = [...recent].sort((a, b) => a - b)
|
|
254
|
+
perf?.disableFrameStats?.()
|
|
255
|
+
|
|
256
|
+
return {
|
|
257
|
+
mode: 'main-thread',
|
|
258
|
+
frames: frameStats.frames || profile.syncCount || 0,
|
|
259
|
+
totalMs: frameStats.totalMs || 0,
|
|
260
|
+
avgMs: frameStats.totalMs && frameStats.frames ? frameStats.totalMs / frameStats.frames : profile.avgSyncMs || 0,
|
|
261
|
+
maxMs: frameStats.maxMs || profile.maxSyncMs || 0,
|
|
262
|
+
layoutTotalMs: frameStats.layoutTotalMs || 0,
|
|
263
|
+
p50: sorted[Math.floor(sorted.length * 0.5)] || 0,
|
|
264
|
+
p95: sorted[Math.floor(sorted.length * 0.95)] || 0,
|
|
265
|
+
p99: sorted[Math.floor(sorted.length * 0.99)] || 0,
|
|
266
|
+
jankFrames: recent.filter((value) => value > 16.67).length,
|
|
267
|
+
sampleCount: recent.length,
|
|
268
|
+
worstFrames: recent.slice().sort((a, b) => b - a).slice(0, 10),
|
|
269
|
+
}
|
|
270
|
+
})(${JSON.stringify(Ae)})`);if(this.profilingEnabled=!1,e?.error)throw new Error(e.error);return e}async stopApp(){await this.evaluate(`(async () => {
|
|
271
|
+
try { await (${R}) } catch {}
|
|
272
|
+
try {
|
|
273
|
+
const regs = await navigator.serviceWorker?.getRegistrations?.()
|
|
274
|
+
await Promise.all((regs || []).map((reg) => reg.unregister()))
|
|
275
|
+
} catch {}
|
|
276
|
+
})()`)}async clearState(){await this.evaluate(`(async () => {
|
|
277
|
+
await (${R})
|
|
278
|
+
})()`)}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,i=await this.findElement(t);if(!i)throw new Error(`copyTextFrom: element not found: ${JSON.stringify(t)}`);let r=i.text??i.testID??"";Ee.set(je,r),console.log(`[flow] copied text: ${JSON.stringify(r)}`)}async evalScript(e){let i=await this.evaluate(`(async () => {
|
|
279
|
+
try {
|
|
280
|
+
return { ok: true, value: await (async () => { ${e} })() }
|
|
281
|
+
} catch (err) {
|
|
282
|
+
return { ok: false, error: err && err.message ? err.message : String(err) }
|
|
283
|
+
}
|
|
284
|
+
})()`);if(!i.ok)throw new Error(`evalScript failed: ${i.error}`);i.value!==void 0&&console.log("[flow] evalScript ->",i.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 f(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 i=Object.entries(e).find(([s])=>s!=="when"&&s!=="optional"),r=i?i[1]:void 0;return!!(r&&typeof r=="object"&&"optional"in r&&r.optional)}async runStep(e,t){let i=Object.keys(e).find(r=>r!=="when")||Object.keys(e)[0];if(console.log(`[flow] step ${t+1}: ${i}`),e.when&&!await this.evaluateWhen(e.when)){console.log("[flow] (when: predicate false, skipped)");return}try{let r=!!(e.extendedWaitUntil||e.waitFor||e.scrollUntilVisible||e.launchApp||e.runFlow),s=1e4,n=this.runStepInner(e);if(r)await n;else{let a=null,m=new Promise((h,p)=>{a=setTimeout(()=>{p(new Error(`step watchdog: ${i} 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 f(this.stepDelay)}catch(r){if(this.isOptional(e)){console.log(`[flow] (optional, skipped: ${r.message.slice(0,80)})`);return}throw this.lastFailedStep={index:t,kind:i,target:e[i]},r}}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 f(e.wait);else if(e.dumpTree)await this.dumpTree(e.dumpTree);else if(e.tapAtCoords)await this.tapAtCoords(e.tapAtCoords.x,e.tapAtCoords.y);else if(e.doubleTapAtCoords)await this.doubleTapAtCoords(e.doubleTapAtCoords.x,e.doubleTapAtCoords.y,e.doubleTapAtCoords.gapMs);else if(e.assertTreeContains)await this.assertTreeContains(e.assertTreeContains);else if(typeof e.eraseText=="number")await this.eraseText(e.eraseText);else if(e.repeat)for(let t=0;t<e.repeat.times;t++)for(let i=0;i<e.repeat.commands.length;i++)await this.runStep(e.repeat.commands[i],i);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,i=typeof t=="string"?t:t.file,r=typeof t=="string"?void 0:t.when;if(r&&!await this.evaluateWhen(r)){console.log(`[flow] runFlow skipped (when predicate false): ${i}`);return}let s=w.resolve(this.opts.flowDir,i),n=g.readFileSync(s,"utf8"),l=this.opts.flowDir;this.opts.flowDir=w.dirname(s),await this.runFlow(ze(n)),this.opts.flowDir=l}else throw new Error(`unsupported flow step: ${JSON.stringify(e)}`)}async runFlow(e){let t=[],i=[],r=[];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)){i.push(...n.onFlowComplete);continue}r.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(r)}catch(n){s=n instanceof Error?n:new Error(String(n))}if(i.length>0){console.log(`[flow] onFlowComplete (${i.length} steps)`);for(let n=0;n<i.length;n++)try{await this.runStep(i[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 i=e[t],r=typeof i.wait=="number"?i.wait:0,s=typeof i.waitFor?.timeout=="number"?i.waitFor.timeout:0,n=Math.max(6e4,r+15e3,s+15e3);if(i.runFlow){await this.runStep(i,t);continue}await Promise.race([this.runStep(i,t),new Promise((l,a)=>setTimeout(()=>a(new Error(`step ${t+1} (${Object.keys(i)[0]}) exceeded ${n}ms deadline`)),n))])}}};function qe(o){if(!o)return"";let e=o.trim();if(!e)return"";if(/^\d+$/.test(e)||e.startsWith("http://")||e.startsWith("https://"))return e;let t=be.find(i=>i.name.toLowerCase()===e.toLowerCase());return t?String(t.preferredPort):e}async function Ge(){let o=await ve(),e=o.find(i=>i.patched);if(e)return`http://localhost:${e.port}/__soot/`;let t=o[0];return t?`http://localhost:${t.port}/__soot/`:null}async function De(o){(o.length===0||o.includes("--help")||o.includes("-h"))&&(console.log(`
|
|
285
|
+
sootsim flow \u2014 run flows or manage a draft
|
|
286
|
+
|
|
287
|
+
usage:
|
|
288
|
+
sootsim flow <flow.yaml> [options]
|
|
289
|
+
sootsim flow start
|
|
290
|
+
sootsim flow keep
|
|
291
|
+
sootsim flow end [--output <path>] [--validate] [--video]
|
|
292
|
+
sootsim flow validate <path>
|
|
293
|
+
|
|
294
|
+
options:
|
|
295
|
+
--record record a webm artifact while the flow runs
|
|
296
|
+
--profile capture perf stats while the flow runs
|
|
297
|
+
--out <dir> output directory (default: /tmp/sootsim-recordings)
|
|
298
|
+
--device <model> override the flow frontmatter device for this run
|
|
299
|
+
--slow <ms> delay between steps for natural pacing
|
|
300
|
+
--tail-wait <ms> hold the recording open after the last step so the
|
|
301
|
+
final UI state is captured (default: smart idle up to
|
|
302
|
+
6000ms for --preview, fixed 2000ms for --record, 0 otherwise)
|
|
303
|
+
--url <url> load this target before running the flow
|
|
304
|
+
--screenshot-paths <mode>
|
|
305
|
+
screenshot path mode: dir (default) or flow
|
|
306
|
+
--replace <m>=<f> replace a Metro module with a local file for this run
|
|
307
|
+
--new open a fresh sim before running the flow
|
|
308
|
+
--driver <id> when paired with --new, launch through a specific
|
|
309
|
+
driver from the registry (e.g. playwright for
|
|
310
|
+
hermetic CI runs); see 'sootsim list --drivers'
|
|
311
|
+
--headless pass headless=true to the launch driver (useful
|
|
312
|
+
with --driver playwright)
|
|
313
|
+
--electron prefer opening the target in the desktop companion
|
|
314
|
+
--sim <id> target a specific current sim
|
|
315
|
+
--validate replay the drafted flow before clearing it
|
|
316
|
+
--video replay and record the drafted flow before clearing it
|
|
317
|
+
--preview record events+video, upload, and print /preview/<id>
|
|
318
|
+
--preview-open open the uploaded preview link after a successful run
|
|
319
|
+
--preview-origin <url>
|
|
320
|
+
upload target for --preview (default: auto)
|
|
321
|
+
--preview-public-origin <url>
|
|
322
|
+
public link origin for --preview (default: sootsim.com
|
|
323
|
+
for prod uploads)
|
|
324
|
+
|
|
325
|
+
frontmatter (top of flow.yaml between --- markers):
|
|
326
|
+
app: 8081 load this target before the flow starts
|
|
327
|
+
device: iphone-14 set the live device model for this flow run
|
|
328
|
+
electron: true prefer the desktop companion sim for this flow
|
|
329
|
+
|
|
330
|
+
default runtime:
|
|
331
|
+
bridge-backed flow playback against the current sim
|
|
332
|
+
if no current sim exists, flow opens the discovered target first
|
|
333
|
+
recording and profiling both run on the same bridge-backed path
|
|
334
|
+
|
|
335
|
+
examples:
|
|
336
|
+
sootsim flow login.yaml
|
|
337
|
+
sootsim flow demo.yaml --url 8081 --record --slow 500 --out ./recordings
|
|
338
|
+
sootsim flow demo.yaml --sim a2
|
|
339
|
+
sootsim flow start
|
|
340
|
+
sootsim flow keep
|
|
341
|
+
sootsim flow end --output ./flows/draft.yaml
|
|
342
|
+
sootsim flow end --output ./flows/draft.yaml --validate
|
|
343
|
+
sootsim flow end --output ./flows/draft.yaml --video
|
|
344
|
+
sootsim flow validate ./flows/draft.yaml
|
|
345
|
+
|
|
346
|
+
flow extension:
|
|
347
|
+
takeScreenshot: hero
|
|
348
|
+
takeScreenshot:
|
|
349
|
+
path: marketing/hero
|
|
350
|
+
withFrame: true
|
|
351
|
+
`),process.exit(0));let e=o[0];P.existsSync(e)||(console.error(` error: ${e} not found`),process.exit(1));let t=c=>o.find((u,S)=>o[S-1]===c),i=o.includes("--profile"),r=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,h=o.includes("--electron"),p=o.includes("--preview"),W=await Ie(t("--preview-origin")),re=t("--preview-public-origin"),Oe=o.includes("--preview-open"),Ne=o.flatMap((c,u)=>o[u-1]==="--replace"?["--replace",c]:[]),x=o.includes("--record")||p,Re=o.includes("--tail-wait")?Math.max(0,+(t("--tail-wait")||"2000")):x?p?6e3:2e3:0,Ve=P.readFileSync(e,"utf8"),{frontmatter:$,steps:M}=Q(Ve,{resolveEnv:!0});M.length===0&&(console.error(" error: flow file must contain a YAML array of steps"),process.exit(1));let A=a||$.device||"",C=h||$.electron===!0,Be=$.app===void 0||$.app===null?"":typeof $.app=="number"?String($.app):$.app,U=qe(Be),oe={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"]},b=Y(o,oe),Le=t("--url")||"";C&&!Se()&&(console.error(" error: desktop companion not found. install or build it first with `bun run build:electron`"),process.exit(1));let ne=C?"desktop companion":"bridge",We=U?` | target: ${U}`:"";console.log(`
|
|
352
|
+
sootsim flow \u2014 ${y.basename(e)}
|
|
353
|
+
${M.length} steps | ${ne}${We}${x?" | recording":""}${i?" | profiling":""}${m?` | ${m}ms delay`:""}
|
|
354
|
+
`),p&&me({event:"preview_flow_started",properties:{flowName:y.basename(e),stepCount:M.length,mode:ne,electron:C,record:x,profile:i,previewOrigin:W}});let T=Le||U||"",j=r||C&&b.simIdSource!=="flag",se=t("--driver")||"",K=!1,J=new Set,ae=!1;if(!T&&!j&&b.simIdSource==="none"){let c=fe(b);try{let u=await c.listSims(),S=u.find(N=>N.isPrimary&&N.readyState==="open"),O=u.find(N=>N.readyState==="open"),ce=S??O;ce&&(ae=!0,console.log(` reusing active sim: ${ce.id}`))}catch{}finally{c.close()}}if(!T&&!ae&&(j||b.simIdSource==="none")){let c=await Ge();c||(console.error(" error: no current sim and no sootsim target found"),await q(),process.exit(1)),T=c}if(T&&A){let c=new URL(await xe(T));c.searchParams.set("device",A),T=c.toString()}if(T){let c=[T];if(c.push(...Ne),j&&c.push("--new"),b.simIdSource==="flag"&&b.simId&&c.push("--sim",b.simId),se&&(c.push("--driver",se),K=!0),o.includes("--headless")&&c.push("--headless"),await Fe(c,{port:b.wsPort,timeoutMs:b.commandTimeoutMs}),K){let u=G();u&&J.add(u)}}let I=Y(o,oe),H=I.simIdSource==="flag"?I.simId:G()||I.simId,Ue=I.simIdSource==="flag"?"flag":H?"saved":"none",F=X(I.wsPort,{commandTimeoutMs:I.commandTimeoutMs,simId:H,simIdSource:Ue}),d,le=async()=>{if(!A)return!1;let c=await F.send({type:"evaluate",simId:d.simId,code:"window.location.href"});if(typeof c=="string"&&c.length>0){let u=new URL(c);u.searchParams.set("device",A),d.setSimRouteHint(u.toString())}return!!await F.send({type:"call",simId:d.simId,path:"SootSim.bridges.settings.set",args:["deviceModel",A]})};d=new L(F,{screenshotDir:n,flowDir:y.dirname(y.resolve(e)),screenshotPathMode:l,simId:H,recordingOutputDir:x?s:void 0,billingOriginOverride:p?W:void 0,allowGitHubRecording:x,onAfterLaunch:async()=>{await le()&&await d.waitForTree(12e4),p&&await F.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
355
|
+
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
356
|
+
return r?.start?.() ?? false
|
|
357
|
+
})()`})}}),m&&(d.stepDelay=m);let k=null,v=null,E=null,z=null,D=0,de=!!M[0]?.launchApp;try{await d.waitForTree(12e4),await le()&&await d.waitForTree(12e4),p&&!de&&!process.env.SOOTSIM_PREVIEW_RESET_DONE&&await d.launchApp({clearState:!0}),x&&(de?d.prepareRecording():await d.startRecording()),i&&await d.startProfile(),p&&(await F.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
358
|
+
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
359
|
+
return r?.start?.() ?? false
|
|
360
|
+
})()`})||console.warn(" warn: eventRecorder.start() returned false \u2014 preview will upload bundle without replay events")),await d.runFlow(M),i&&(k=await d.stopProfile()),await d.waitForRecordingTail({maxMs:Re,smart:p}),x&&(v=await d.stopRecording(),E=d.getLastRecordingDurationMs()),p&&(z=await F.send({type:"evaluate",simId:d.simId,code:`(() => {
|
|
361
|
+
const r = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder
|
|
362
|
+
return r?.stop?.() ?? []
|
|
363
|
+
})()`}),console.log(` captured ${z.length} replay events`)),console.log(`
|
|
364
|
+
+ completed (${M.length} steps)`),k&&_e(k),v&&console.log(` video: ${v}`),console.log()}catch(c){if(i&&!k)try{k=await d.stopProfile()}catch{}if(x&&!v)try{v=await d.stopRecording(),E=d.getLastRecordingDurationMs()}catch(u){console.warn(` recording stop failed: ${u?.message||String(u)}`)}console.error(`
|
|
365
|
+
x failed: ${c.message}
|
|
366
|
+
`),k&&(console.log(" partial profile:"),_e(k)),v&&console.log(` partial video: ${v}`);try{let u=d.lastFailedStep,S=u?`step-${String(u.index+1).padStart(2,"0")}-${u.kind}`:"unstaged",O=y.join(n,S);await d.captureFailureBundle(O,{error:c,stepIndex:u?.index,stepKind:u?.kind,stepTarget:u?.target}),console.log(` failure bundle: ${O}`),console.log(" (contents: screenshot.png, describe.json, a11y.txt, tree.txt, console.json, error.json)")}catch(u){try{let S=y.join(n,"error.png");await d.captureFailureScreenshot(S),console.log(` error screenshot: ${S}`)}catch{}console.log(` (failure bundle capture failed: ${u instanceof Error?u.message:String(u)})`)}await pe(F,{errorsCommand:`sootsim get errors 5${d.simId?` --sim ${d.simId}`:""}`,warningsCommand:`sootsim get warnings 5${d.simId?` --sim ${d.simId}`:""}`,requestsCommand:`sootsim get requests 5${d.simId?` --sim ${d.simId}`:""}`}),D=1}finally{F.close()}if(D===0&&p)try{let c=await Xe(z??[]),u=["--origin",W,"--events",c];re&&u.push("--public-origin",re),v&&u.push("--video",v),v&&E&&Number.isFinite(E)&&u.push("--video-duration-ms",String(Math.round(E))),d.simId&&u.push("--sim",d.simId),Oe&&u.push("--open"),console.log(`
|
|
367
|
+
preparing preview upload\u2026`);let{runUpload:S}=await import("./upload-YOMMYESV.js");await S(u,{})}catch(c){console.error(` preview upload failed: ${c?.message||c}`),D=1}return K&&(d.simId&&J.add(d.simId),await Ye(b.wsPort,b.commandTimeoutMs,[...J])),await q(),D}async function Ye(o,e,t){let i=[...new Set(t.filter(Boolean))];if(i.length===0)return;let r=X(o,{commandTimeoutMs:e});try{let s=await r.listSims(),n=i.filter(a=>s.some(m=>m.id===a&&m.readyState==="open"));if(n.length===0)return;let l=await $e(r,o,e,n);await Te(s,n),l.closed.length>0&&console.log(` closed flow sim(s): ${l.closed.join(", ")}`),l.remaining.length>0&&console.warn(` warn: flow sim(s) still connected after close: ${l.remaining.join(", ")}`)}catch(s){console.warn(` warn: failed to close flow sim(s): ${s instanceof Error?s.message:String(s)}`)}finally{r.close()}}async function Xe(o){let{gzipSync:e}=await import("zlib"),t=o.map(s=>JSON.stringify(s)).join(`
|
|
368
|
+
`)+(o.length?`
|
|
369
|
+
`:""),i=e(Buffer.from(t,"utf8")),r=y.join(Ce(),`sootsim-events-${Date.now()}.jsonl.gz`);return P.writeFileSync(r,i),console.log(` events: ${o.length} written to ${r} (${i.length} bytes gz)`),r}async function Qe(o){let e=o[0],t=i=>o.find((r,s)=>o[s-1]===i);switch(e){case"start":{let{path:i,state:r}=ge();console.log(" flow draft started"),console.log(` session: ${i}`),console.log(` steps: ${r.steps.length}`);return}case"keep":case"good":{let i=te();if(i.active||(console.error(" no active flow draft \u2014 run `sootsim flow start` first"),process.exit(1)),!i.kept){console.log(" no pending action to keep");return}console.log(` kept: ${i.candidate.summary}`),console.log(` steps: ${i.stepCount}`);return}case"end":{let i=t("--output")||(o[1]&&!o[1].startsWith("-")?o[1]:void 0),r=o.includes("--validate")||o.includes("--video"),s=o.includes("--video"),n=te();n.active&&n.kept&&console.log(` auto-kept trailing action: ${n.candidate.summary}`);let l=ye(i||(r?et():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(r){let a=tt(o,l.outputPath),m=await De(a);if(m!==0){console.error(`
|
|
370
|
+
validation failed \u2014 draft preserved so you can keep iterating`),process.exitCode=m;return}ee(),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(ee(),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 i=o[1];(!i||i.startsWith("-"))&&(console.error(" usage: sootsim flow validate <path>"),process.exit(1));let r=Z(i);if(r.length>0){console.error(` x ${i} failed validation:`);for(let s of r)console.error(` - ${s}`);process.exit(1)}console.log(` + ${i} looks valid`);return}}}function Ze(o){return o[0]==="--sim"&&o.length>=2?[...o.slice(2),"--sim",o[1]]:o}async function Tt(o){let e=Ze(o),t=e[0];if(t==="start"||t==="keep"||t==="good"||t==="end"||t==="validate")return await Qe(e),0;let i=await De(e);return i!==0&&(process.exitCode=i),i}function _e(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(`
|
|
371
|
+
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 i=Array.isArray(o.worstFrames)?o.worstFrames:[];if(i.length!==0){if(console.log(`
|
|
372
|
+
worst frames:`),o.mode==="render-worker"){console.log(" total layout render copy t+");for(let r of i){let[s,n,l,a,m]=r;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(` ${i.map(r=>r.toFixed(2)).join(", ")}`)}}function et(){return y.join(Ce(),`sootsim-flow-draft-${Date.now()}.yaml`)}function tt(o,e){if(!e)throw new Error("validated flow draft requires an output path");let t=[e];for(let i=1;i<o.length;i++){let r=o[i];if(!(r==="--validate"||r==="--video")){if(r==="--output"){i+=1;continue}i===1&&!r.startsWith("-")||t.push(r)}}return!t.includes("--record")&&o.includes("--video")&&t.push("--record"),t}export{Ge as a,De as b,Ze as c,Tt as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
1
|
+
/*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var t=!0,e="1.0.0",o="public beta",n=`${o} \xB7 free until ${e}`,r="free for everyone until 1.0 \u2014 we send anonymous error and dependency data while you use it";export{t as a,e as b,o as c,n as d,r as e};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as P,b as v}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as P,b as v}from"./chunk-ATRGAFJD.js";import{d as j}from"./chunk-N4JRDJMN.js";import{a as b}from"./chunk-DOWYG3HG.js";import{execSync as A}from"child_process";import{existsSync as w,readFileSync as _,writeFileSync as x}from"fs";import{relative as B,resolve as d}from"path";import{existsSync as p,readFileSync as k,readdirSync as O,statSync as R}from"fs";import{basename as L,dirname as T,join as a}from"path";function D(e){let o=e;for(;;){if(p(a(o,"turbo.json"))||p(a(o,"nx.json"))||p(a(o,"lerna.json"))||p(a(o,"pnpm-workspace.yaml")))return o;let i=a(o,"package.json");if(p(i))try{if(JSON.parse(k(i,"utf8")).workspaces)return o}catch{}let r=T(o);if(r===o)break;o=r}return e}function W(e){return p(a(e,"bun.lock"))||p(a(e,"bun.lockb"))?"bun":p(a(e,"pnpm-lock.yaml"))?"pnpm":p(a(e,"yarn.lock"))?"yarn":"npm"}function J(e){if(p(a(e,"turbo.json")))return"turbo";if(p(a(e,"nx.json")))return"nx";if(p(a(e,"pnpm-workspace.yaml")))return"pnpm";let o=a(e,"package.json");if(p(o))try{if(JSON.parse(k(o,"utf8")).workspaces)return"npm-workspaces"}catch{}return"single"}function N(e){return e.one?"one":e.expo?"expo":e["react-native"]?"bare":"unknown"}function y(e){let o=a(e,"package.json");if(!p(o))return null;let i;try{i=JSON.parse(k(o,"utf8"))}catch{return null}let r={...i.dependencies,...i.devDependencies},s=N(r);return s==="unknown"?null:{dir:e,name:i.name||L(e),framework:s,hasViteConfig:p(a(e,"vite.config.ts"))||p(a(e,"vite.config.js")),hasMetroConfig:p(a(e,"metro.config.js"))||p(a(e,"metro.config.ts")),hasSootsimDependency:!!r.sootsim,devCommand:i.scripts?.dev||null}}function V(e){let o=[],i=a(e,"pnpm-workspace.yaml");if(p(i)){let t=k(i,"utf8").match(/packages:\s*\n((?:\s+-\s+.+\n?)+)/);if(t){let c=t[1].split(`
|
|
3
3
|
`).filter(Boolean);for(let n of c){let g=n.replace(/^\s*-\s*['"]?/,"").replace(/['"]?\s*$/,"");g&&o.push(...S(e,g))}}return o}let r=a(e,"package.json");if(p(r))try{let s=JSON.parse(k(r,"utf8")),t=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages||[];for(let c of t)o.push(...S(e,c))}catch{}return o}function S(e,o){let i=o.replace(/\/\*\*?$/,"").replace(/\*$/,""),r=a(e,i);if(!p(r))return[];try{return O(r).map(t=>a(r,t)).filter(t=>{try{return R(t).isDirectory()&&p(a(t,"package.json"))}catch{return!1}})}catch{return[]}}function M(e){let o=J(e),i=W(e);if(o==="single"){let c=y(e);return{root:e,type:o,packageManager:i,apps:c?[c]:[]}}let r=V(e),s=[],t=y(e);t&&s.push(t);for(let c of r){if(c===e)continue;let n=y(c);n&&s.push(n)}return{root:e,type:o,packageManager:i,apps:s}}function $(e){switch(e){case"bun":return"bun add -d sootsim";case"pnpm":return"pnpm add -D sootsim";case"yarn":return"yarn add -D sootsim";case"npm":return"npm install -D sootsim"}}async function ce(e){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
4
4
|
sootsim setup-repo \u2014 set up sootsim in your project
|
|
5
5
|
|