sootsim 0.1.304 → 0.1.306

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.
Files changed (171) hide show
  1. package/README.md +10 -4
  2. package/dist-cli/bin.js +5 -5
  3. package/dist-cli/chunks/{agent-EK355OQM.js → agent-43LRLQBS.js} +2 -2
  4. package/dist-cli/chunks/{agent-wrapper-LCJJWHZE.js → agent-wrapper-QYKQDC2Y.js} +2 -2
  5. package/dist-cli/chunks/{app-fonts-LIPU2DLT.js → app-fonts-IHE34DCY.js} +2 -2
  6. package/dist-cli/chunks/{assert-OASKCPBX.js → assert-LAXNLFZ6.js} +2 -2
  7. package/dist-cli/chunks/{auth-XYYKD33F.js → auth-CFTFPYKX.js} +2 -2
  8. package/dist-cli/chunks/{beta-TOL55XPM.js → beta-YPZFX3DF.js} +2 -2
  9. package/dist-cli/chunks/{camera-PHKVEQHR.js → camera-FHHHH6GY.js} +2 -2
  10. package/dist-cli/chunks/{chunk-XHYSASAX.js → chunk-2UC72ZR6.js} +1 -1
  11. package/dist-cli/chunks/{chunk-BJOT2LL6.js → chunk-3XUXMKKJ.js} +2 -2
  12. package/dist-cli/chunks/{chunk-HFA5ZACE.js → chunk-4735ZG3S.js} +1 -1
  13. package/dist-cli/chunks/{chunk-5NJTX5OP.js → chunk-4KABOHME.js} +2 -2
  14. package/dist-cli/chunks/chunk-4MLH5CMV.js +125 -0
  15. package/dist-cli/chunks/chunk-4TN4CD7M.js +15 -0
  16. package/dist-cli/chunks/{chunk-ITDTSNN2.js → chunk-4XGRVAXA.js} +2 -2
  17. package/dist-cli/chunks/{chunk-2MEUZOSD.js → chunk-6PIGQNS4.js} +1 -1
  18. package/dist-cli/chunks/{chunk-INBBOCU4.js → chunk-6SBFFSXO.js} +2 -2
  19. package/dist-cli/chunks/chunk-6SIWYEK5.js +4 -0
  20. package/dist-cli/chunks/{chunk-YAV6BH3A.js → chunk-6WCW6PES.js} +2 -2
  21. package/dist-cli/chunks/{chunk-2RLFUM3C.js → chunk-74Z7ENQL.js} +104 -127
  22. package/dist-cli/chunks/{chunk-RQJDIDJ3.js → chunk-7RZYUZEK.js} +1 -1
  23. package/dist-cli/chunks/{chunk-GF3LDVWF.js → chunk-7VVWOKJE.js} +2 -2
  24. package/dist-cli/chunks/chunk-B3CXF3EF.js +5 -0
  25. package/dist-cli/chunks/{chunk-RT7TUHH7.js → chunk-BPNVJLGT.js} +2 -2
  26. package/dist-cli/chunks/{chunk-3UUHIHA6.js → chunk-C6TKPNCZ.js} +2 -2
  27. package/dist-cli/chunks/{chunk-IWRRIQDJ.js → chunk-CLN6VD2I.js} +2 -2
  28. package/dist-cli/chunks/{chunk-FNI75AD7.js → chunk-FXC6BYKX.js} +1 -1
  29. package/dist-cli/chunks/{chunk-RJWQ3VAD.js → chunk-G73JPCHX.js} +11 -11
  30. package/dist-cli/chunks/{chunk-AJYA6R3N.js → chunk-HMW7QKJV.js} +2 -2
  31. package/dist-cli/chunks/{chunk-NXYKNKNL.js → chunk-HPCKCWSQ.js} +2 -2
  32. package/dist-cli/chunks/{chunk-EXW6TH3O.js → chunk-HTR4DSA5.js} +2 -2
  33. package/dist-cli/chunks/{chunk-RYQUO6LT.js → chunk-IGKZOI2V.js} +1 -1
  34. package/dist-cli/chunks/{chunk-VUR5QXVX.js → chunk-IXPUTLYO.js} +2 -2
  35. package/dist-cli/chunks/{chunk-GMILMS7P.js → chunk-JPQSUHXW.js} +2 -2
  36. package/dist-cli/chunks/chunk-KNPXTXMI.js +4 -0
  37. package/dist-cli/chunks/{chunk-Y5YM7XHU.js → chunk-LHCC656T.js} +1 -1
  38. package/dist-cli/chunks/{chunk-A4UYZTV7.js → chunk-LOXCEKKF.js} +2 -2
  39. package/dist-cli/chunks/{chunk-CMYVGJBQ.js → chunk-MBF4LLVB.js} +1 -1
  40. package/dist-cli/chunks/{chunk-V6JDDX4B.js → chunk-MCGRZYAP.js} +7 -7
  41. package/dist-cli/chunks/chunk-NH2KYSY7.js +4 -0
  42. package/dist-cli/chunks/{chunk-QWQHSUZC.js → chunk-NOLQ4UEP.js} +2 -2
  43. package/dist-cli/chunks/chunk-NQ56D5JF.js +4 -0
  44. package/dist-cli/chunks/{chunk-G4R7CPCY.js → chunk-OYFRTYRJ.js} +2 -2
  45. package/dist-cli/chunks/{chunk-ENXLKDQ6.js → chunk-QHGQTHHD.js} +3 -3
  46. package/dist-cli/chunks/{chunk-SVFN66PF.js → chunk-RYXC27XV.js} +15 -12
  47. package/dist-cli/chunks/{chunk-ZONISYZ5.js → chunk-TCB56ABT.js} +1 -1
  48. package/dist-cli/chunks/{chunk-UB3OWUVK.js → chunk-TR4FKAKQ.js} +1 -1
  49. package/dist-cli/chunks/{chunk-XXS4TCOO.js → chunk-U6NDLMBM.js} +24 -25
  50. package/dist-cli/chunks/{chunk-SN6ARNCL.js → chunk-UAYFVJ7N.js} +2 -2
  51. package/dist-cli/chunks/{chunk-HFKQUS4I.js → chunk-UBLLWSSF.js} +3 -3
  52. package/dist-cli/chunks/{chunk-MSYPDBFG.js → chunk-UTE2W4WC.js} +2 -2
  53. package/dist-cli/chunks/{chunk-XCVSB47R.js → chunk-UTHRVXG5.js} +2 -2
  54. package/dist-cli/chunks/{chunk-LRXSLMX4.js → chunk-V5PJXD2O.js} +1 -1
  55. package/dist-cli/chunks/{chunk-JDKWIB6V.js → chunk-VLKENZFJ.js} +1 -1
  56. package/dist-cli/chunks/{chunk-7RFXZXKH.js → chunk-VTPICQDM.js} +1 -1
  57. package/dist-cli/chunks/chunk-XZSXFV33.js +71 -0
  58. package/dist-cli/chunks/chunk-YBO7SFWN.js +6 -0
  59. package/dist-cli/chunks/{chunk-OSH6526H.js → chunk-YVWYARHY.js} +1 -1
  60. package/dist-cli/chunks/{cleanup-GCTEGJMP.js → cleanup-GYDCGNEJ.js} +2 -2
  61. package/dist-cli/chunks/{cli-version-G72HUH4E.js → cli-version-3HG7ILRV.js} +2 -2
  62. package/dist-cli/chunks/{compat-IC4JHGBH.js → compat-GS3SVTB4.js} +2 -2
  63. package/dist-cli/chunks/{config-C65MZFU3.js → config-W5LN7HWO.js} +2 -2
  64. package/dist-cli/chunks/control-BE55SA2W.js +4 -0
  65. package/dist-cli/chunks/daemon-3YMH272E.js +4 -0
  66. package/dist-cli/chunks/{debug-LEL32PDN.js → debug-2BBR66MJ.js} +3 -3
  67. package/dist-cli/chunks/desktop-PPB66SZO.js +31 -0
  68. package/dist-cli/chunks/{detox-SCCWUIKK.js → detox-P7SDHLB4.js} +2 -2
  69. package/dist-cli/chunks/{device-MTDEKDUK.js → device-JB4NSOZV.js} +2 -2
  70. package/dist-cli/chunks/{diagnose-UZJCKLPZ.js → diagnose-M662DIPM.js} +2 -2
  71. package/dist-cli/chunks/disk-cleanup-HN662P2U.js +4 -0
  72. package/dist-cli/chunks/drivers-ALHRJJGF.js +4 -0
  73. package/dist-cli/chunks/{film-YBE544PG.js → film-QZMDVCZI.js} +3 -3
  74. package/dist-cli/chunks/flow-BHSACBQ5.js +4 -0
  75. package/dist-cli/chunks/help-V2KS2AUT.js +4 -0
  76. package/dist-cli/chunks/{hidden-runtime-alias-KJYCJLSR.js → hidden-runtime-alias-LJXH6WPY.js} +2 -2
  77. package/dist-cli/chunks/{home-paths-NSHWNEGK.js → home-paths-TQ53NFW3.js} +2 -2
  78. package/dist-cli/chunks/inspect-6PW37GVK.js +4 -0
  79. package/dist-cli/chunks/install-desktop-VMVPZSXF.js +4 -0
  80. package/dist-cli/chunks/{login-AEVUU72R.js → login-7XXY5JP4.js} +4 -4
  81. package/dist-cli/chunks/{logout-72XHF6J2.js → logout-UNARNKTJ.js} +2 -2
  82. package/dist-cli/chunks/{maestro-OXSKQJ6B.js → maestro-66RNLMLU.js} +3 -3
  83. package/dist-cli/chunks/{maestro-generate-AKZFORVJ.js → maestro-generate-IO25AY3E.js} +3 -3
  84. package/dist-cli/chunks/{mode-U6KRG2PE.js → mode-DPGASAG4.js} +2 -2
  85. package/dist-cli/chunks/optional-demo-registry-O5GGFNAI.js +4 -0
  86. package/dist-cli/chunks/{perf-KF2BJZIN.js → perf-CBUP2ERS.js} +2 -2
  87. package/dist-cli/chunks/{permissions-TRJG4QAI.js → permissions-3AOMCAT3.js} +2 -2
  88. package/dist-cli/chunks/{record-TICJYZOA.js → record-Q7VRLH7A.js} +3 -3
  89. package/dist-cli/chunks/{report-issue-OQPLBQMJ.js → report-issue-DTWZECYM.js} +2 -2
  90. package/dist-cli/chunks/runtime-VGYKLLTE.js +4 -0
  91. package/dist-cli/chunks/{screenshot-command-XLERKHVW.js → screenshot-command-SSWKZ4U3.js} +6 -6
  92. package/dist-cli/chunks/screenshot-layers-2ABSTF2O.js +20 -0
  93. package/dist-cli/chunks/{screenshots-capture-B6OORSD4.js → screenshots-capture-QA7T5DED.js} +2 -2
  94. package/dist-cli/chunks/{serve-5M7MIPWF.js → serve-T4EQBJM6.js} +3 -3
  95. package/dist-cli/chunks/{setup-HJZDC4PK.js → setup-BXQI3YT4.js} +2 -2
  96. package/dist-cli/chunks/{skills-RXHLMGGL.js → skills-AYSO5FJB.js} +2 -2
  97. package/dist-cli/chunks/{storage-MMPD2XBS.js → storage-KBHG5M5F.js} +2 -2
  98. package/dist-cli/chunks/store-GUNEQ4EC.js +4 -0
  99. package/dist-cli/chunks/telemetry-4VZ43AHH.js +4 -0
  100. package/dist-cli/chunks/{timeline-6PF5BZ37.js → timeline-AB2R26RE.js} +2 -2
  101. package/dist-cli/chunks/{upgrade-QSMIK3RC.js → upgrade-5XXQ7OCE.js} +2 -2
  102. package/dist-cli/chunks/upload-M55IQQHQ.js +4 -0
  103. package/dist-cli/chunks/{version-WLTFXEDC.js → version-PH3OUNPP.js} +2 -2
  104. package/dist-cli/chunks/{web-DI73LQ7N.js → web-XTOGNFZ7.js} +2 -2
  105. package/dist-cli/chunks/{what-happened-4SAMGZWR.js → what-happened-JLI3NTEU.js} +2 -2
  106. package/dist-lib/agent-daemon-client.cjs +1 -1
  107. package/dist-lib/agent-events.cjs +1 -1
  108. package/dist-lib/agent-identity.cjs +1 -1
  109. package/dist-lib/agent-sessions.cjs +1 -1
  110. package/dist-lib/attached-projects.cjs +43 -21
  111. package/dist-lib/auth/shared-session.cjs +1 -1
  112. package/dist-lib/backend-origin.cjs +1 -1
  113. package/dist-lib/beta.cjs +1 -1
  114. package/dist-lib/beta.mjs +1 -1
  115. package/dist-lib/bridge-constants.cjs +8 -1
  116. package/dist-lib/cli-constants.cjs +1 -1
  117. package/dist-lib/config.cjs +1 -1
  118. package/dist-lib/detox/index.cjs +1 -1
  119. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  120. package/dist-lib/home-paths.cjs +1 -1
  121. package/dist-lib/host/bridge-host.cjs +222 -302
  122. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  123. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  124. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  125. package/dist-lib/host/websocket-proxy.cjs +1 -1
  126. package/dist-lib/index.cjs +1 -1
  127. package/dist-lib/jump-to-source-babel.cjs +1 -1
  128. package/dist-lib/menu.cjs +1 -1
  129. package/dist-lib/menu.mjs +1 -1
  130. package/dist-lib/metro.cjs +1 -1
  131. package/dist-lib/profiles.cjs +1 -1
  132. package/dist-lib/render-mode.cjs +1 -1
  133. package/dist-lib/scripts/dev-server-scanner.cjs +43 -13
  134. package/dist-lib/sdk.cjs +47 -10
  135. package/dist-lib/sdk.mjs +47 -10
  136. package/dist-lib/skills.cjs +5708 -1217
  137. package/dist-lib/vite.cjs +1 -1
  138. package/package.json +1 -1
  139. package/scripts/dev-server-scanner.ts +9 -15
  140. package/scripts/optional-demo-registry.ts +52 -10
  141. package/skills/sootsim-debug/SKILL.md +4 -5
  142. package/skills/sootsim-setup/SKILL.md +29 -49
  143. package/src/bridge-constants.ts +15 -0
  144. package/src/host/bridge-host.ts +0 -16
  145. package/src/host/open-url.ts +2 -147
  146. package/src/plist.ts +27 -0
  147. package/src/settings-bundle.ts +2 -23
  148. package/src/skills/builtin/maestro-test.ts +4 -1
  149. package/src/vite-plugin.ts +2 -1
  150. package/dist-cli/chunks/chunk-76OLOD2G.js +0 -15
  151. package/dist-cli/chunks/chunk-ABHNOM2C.js +0 -4
  152. package/dist-cli/chunks/chunk-BPRMA4IC.js +0 -4
  153. package/dist-cli/chunks/chunk-M3ETYVNL.js +0 -4
  154. package/dist-cli/chunks/chunk-W3CSYOSQ.js +0 -4
  155. package/dist-cli/chunks/chunk-WNDYTKLC.js +0 -4
  156. package/dist-cli/chunks/chunk-YXHO2OUL.js +0 -7
  157. package/dist-cli/chunks/chunk-ZDRI2LUG.js +0 -125
  158. package/dist-cli/chunks/control-RWLYBKQR.js +0 -4
  159. package/dist-cli/chunks/daemon-D77E5G6Z.js +0 -4
  160. package/dist-cli/chunks/desktop-RDSISJH2.js +0 -34
  161. package/dist-cli/chunks/disk-cleanup-HLWRVTVW.js +0 -4
  162. package/dist-cli/chunks/drivers-Q7GMKTBM.js +0 -4
  163. package/dist-cli/chunks/flow-5VOVAVZN.js +0 -4
  164. package/dist-cli/chunks/help-2PESJ7V2.js +0 -4
  165. package/dist-cli/chunks/inspect-OIA3Q5MD.js +0 -4
  166. package/dist-cli/chunks/install-desktop-7KLACQUW.js +0 -4
  167. package/dist-cli/chunks/optional-demo-registry-L3VIWBI2.js +0 -4
  168. package/dist-cli/chunks/runtime-HDMLWNXW.js +0 -4
  169. package/dist-cli/chunks/store-APKY72ZY.js +0 -4
  170. package/dist-cli/chunks/telemetry-W3YRHE67.js +0 -4
  171. package/dist-cli/chunks/upload-HQEOYILQ.js +0 -4
package/README.md CHANGED
@@ -142,9 +142,9 @@ daemon is reachable, then opens a `WsBridge` (`cli/ws-bridge.ts`) on **port
142
142
  7668** and sends JSON commands. Inspection/interaction verbs live in
143
143
  `cli/commands/inspect/*` and are re-exported as the programmatic `sootsim/sdk`;
144
144
  the Maestro runner is `cli/bridge-flow-runner.ts`; the Detox compat driver
145
- is in `detox/`. Test and screenshot paths additionally use `cli/drivers/*`
146
- (chromium, electron, playwright, system) to launch or attach the sim page before
147
- driving it.
145
+ is in `detox/`. Test and screenshot paths additionally use `cli/drivers/*`.
146
+ Browser sims launch in an isolated Playwright Chrome for Testing profile;
147
+ Electron is the native desktop surface.
148
148
 
149
149
  **The daemon is one process** — `SootSimBridgeHost` (`src/host/bridge-host.ts`).
150
150
  `sootsim serve` runs it in the foreground; the background daemon is the *same
@@ -184,7 +184,7 @@ bridge always addresses the **shell worker**, never an undifferentiated sim.
184
184
  | WsBridge client | Client side of the CLI→daemon link. Resolves the daemon port from the lockfile, opens a WS to `:7668`, sends JSON commands and awaits `{id,result}`/`{id,error}`. Used by every interactive command. | `cli/ws-bridge.ts`, `src/bridge-constants.ts`, `cli/current-sim.ts` |
185
185
  | inspect / SDK command surface | Runtime inspection + interaction verbs (describe, find, do tap, get errors, wait, layout, settle). Re-exported as `sootsim/sdk` so programmatic callers drive a sim the same way the CLI does. | `cli/commands/inspect/core.ts`, `cli/commands/inspect/actions.ts`, `cli/commands/inspect.ts`, `src/sdk.ts` |
186
186
  | Maestro / Detox runners | Drop-in test compatibility. `bridge-flow-runner.ts` runs Maestro YAML and recorded flows over the bridge; `detox/` provides a `by`/`element`/`expect`/`device` driver + jest preset so existing Detox suites run unchanged. | `cli/bridge-flow-runner.ts`, `cli/commands/maestro.ts`, `cli/commands/detox.ts`, `detox/index.ts`, `detox/jest-preset.cjs` |
187
- | sim drivers | Launch/attach the actual sim page. The registry resolves a driver (chromium, electron, playwright, system browser) which opens the shell URL; used by detox/preview/screenshot paths to bring a sim online for the bridge. | `cli/drivers/index.ts`, `cli/drivers/registry.ts`, `cli/drivers/chromium.ts`, `cli/drivers/electron.ts`, `cli/drivers/playwright.ts` |
187
+ | sim drivers | Launch or attach the actual sim page. Playwright owns isolated browser profiles; Electron owns the native desktop surface. The current sim is reused unless `--new`, `--profile`, or `--ephemeral` requests a separate one. | `cli/drivers/index.ts`, `cli/drivers/registry.ts`, `cli/drivers/electron.ts`, `cli/drivers/playwright.ts` |
188
188
  | SootSimBridgeHost (serve/daemon) | The bridge process (`sootsim serve`, or autostarted as the daemon via launchd/systemd). HTTP+WS hub on `:7668`: relays commands between CLI clients and registered sims; also serves runtime HTTP, `/__server-scan`, and fetch/WS proxies. | `src/host/bridge-host.ts`, `cli/commands/serve.ts`, `cli/commands/daemon.ts`, `src/home-paths.ts` |
189
189
  | AgentHost + sessions | Agent-routing extension of the host: owns the single FIFO reader per agent session and fans `agent:event`/`session-status` pushes to every WS subscriber. Backed by agent-sessions + attached-projects stores. | `src/host/agent-host.ts`, `src/agent-sessions.ts`, `src/attached-projects.ts`, `src/agent-daemon-client.ts` |
190
190
  | host proxies + dev-server scan | Host-side helpers so a cross-origin tenant worker can reach local dev servers and same-origin APIs: `/__server-scan` discovers running metro/expo/vxrn/one servers; fetch + websocket proxies relay guest-app network through the daemon. | `src/host/fetch-proxy-handler.ts`, `src/host/websocket-proxy.ts`, `scripts/dev-server-scanner.ts`, `src/dev-bundle-resolution.ts` |
@@ -202,6 +202,12 @@ sootsim open 8081 # load a running metro/expo dev server
202
202
  sootsim open /settings # dispatch a React Native deep link into that app
203
203
  ```
204
204
 
205
+ The first `sootsim open` launches an isolated Chrome for Testing sim. Later
206
+ opens reuse that sim and reload it at the requested target. Use `sootsim do
207
+ reload` when the target has not changed. Reserve `--new` for a genuinely
208
+ concurrent sim; repeated new browser trees consume memory and CPU on shared
209
+ machines.
210
+
205
211
  The public shell script is the recommended, inspectable bootstrap path;
206
212
  `sootsim` is the normal path afterward. Manual installs can use `npm install
207
213
  --global sootsim`, `bun add --global sootsim`, or `pnpm add --global sootsim`,
package/dist-cli/bin.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
3
  import { createRequire as __sootsimCreateRequire } from 'node:module'
4
4
  var require = __sootsimCreateRequire(import.meta.url)
5
- import{a as w,b as g}from"./chunks/chunk-2MEUZOSD.js";import"./chunks/chunk-XHYSASAX.js";function b(t){let a=t instanceof Error?t.message:String(t);(/^command timed out after \d+s$/.test(a)||a.startsWith("sim disconnected:")||a.startsWith("bridge never reconnected")||a.startsWith("multiple sims are connected:")||a.startsWith("saved sim ")||a.startsWith("no sim connected with id ")||a.startsWith("could not connect to ws://")||a.startsWith("sootsim bridge daemon is not running")||a.startsWith("sootsim bridge lockfile is fresh")||a.startsWith("sootsim bridge exited before becoming ready")||a.startsWith("background daemon setup is unavailable")||a.startsWith("sootsim bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${a}
5
+ import{a as w,b as g}from"./chunks/chunk-6PIGQNS4.js";import"./chunks/chunk-2UC72ZR6.js";function b(t){let a=t instanceof Error?t.message:String(t);(/^command timed out after \d+s$/.test(a)||a.startsWith("sim disconnected:")||a.startsWith("bridge never reconnected")||a.startsWith("multiple sims are connected:")||a.startsWith("saved sim ")||a.startsWith("no sim connected with id ")||a.startsWith("could not connect to ws://")||a.startsWith("sootsim bridge daemon is not running")||a.startsWith("sootsim bridge lockfile is fresh")||a.startsWith("sootsim bridge exited before becoming ready")||a.startsWith("background daemon setup is unavailable")||a.startsWith("sootsim bridge did not start within"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${a}
6
6
  `),process.exit(1)),t instanceof Error&&t.stack?process.stderr.write(`${t.stack}
7
7
  `):process.stderr.write(`${a}
8
8
  `),process.exit(1)}process.on("unhandledRejection",b);process.on("uncaughtException",b);var A=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,k=new Set(["desktop"]);function S(t){!A||!k.has(t)||(process.stderr.write(` sootsim ${t} isn't available in the standalone binary \u2014
9
9
  it needs vite / electron / playwright from a project's node_modules.
10
10
  run the npm package instead:
11
11
  sootsim ${t}
12
- `),process.exit(1))}var e=g(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:t}=await import("./chunks/hidden-runtime-alias-KJYCJLSR.js");e=t(e)}var _=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker";if(!_){let{trackCliEvent:t}=await import("./chunks/telemetry-W3YRHE67.js");t({event:"cli_command_invoked",properties:{command:e.command||(e.version?"version":e.help?"help":"none"),arg_count:e.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:t}=await import("./chunks/home-paths-NSHWNEGK.js"),a=t();a&&process.stderr.write(` SootSim engine upgraded to v${a.to}`+(a.from?` (from v${a.from})`:"")+` \xB7 what's new: https://sootsim.com/changelog
13
- `)}var f=!1;async function v(){if(!f&&(f=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:t}=await import("./chunks/disk-cleanup-HLWRVTVW.js");if(t())return;let{spawn:a}=await import("node:child_process"),s=["cleanup","--automatic-worker"],m=process.argv[1],d=A?a(process.execPath,s,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):m?a(process.execPath,[m,...s],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):a("sootsim",s,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});d.once("error",p=>{process.stderr.write(` SootSim automatic cleanup will retry on the next run: ${p.message}
12
+ `),process.exit(1))}var e=g(process.argv);if(!e.command&&e.commandArgs.length>0){let{resolveHiddenRuntimeAlias:t}=await import("./chunks/hidden-runtime-alias-LJXH6WPY.js");e=t(e)}var _=e.command==="cleanup"&&e.commandArgs.length===1&&e.commandArgs[0]==="--automatic-worker";if(!_){let{trackCliEvent:t}=await import("./chunks/telemetry-4VZ43AHH.js");t({event:"cli_command_invoked",properties:{command:e.command||(e.version?"version":e.help?"help":"none"),arg_count:e.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}if(e.command!=="serve"&&e.command!=="daemon"){let{consumeRuntimeUpgradeNotice:t}=await import("./chunks/home-paths-TQ53NFW3.js"),a=t();a&&process.stderr.write(` SootSim engine upgraded to v${a.to}`+(a.from?` (from v${a.from})`:"")+` \xB7 what's new: https://sootsim.com/changelog
13
+ `)}var f=!1;async function v(){if(!f&&(f=!0,!(e.command==="cleanup"||e.command==="serve"||e.command==="agent-wrapper"||e.command==="daemon"&&e.commandArgs[0]==="uninstall")))try{let{isAutomaticSootsimCleanupComplete:t}=await import("./chunks/disk-cleanup-HN662P2U.js");if(t())return;let{spawn:a}=await import("node:child_process"),s=["cleanup","--automatic-worker"],m=process.argv[1],d=A?a(process.execPath,s,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):m?a(process.execPath,[m,...s],{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env}):a("sootsim",s,{detached:!0,stdio:["ignore","ignore","inherit"],env:process.env});d.once("error",p=>{process.stderr.write(` SootSim automatic cleanup will retry on the next run: ${p.message}
14
14
  `)}),d.unref()}catch(t){process.stderr.write(` SootSim automatic cleanup will retry on the next run: ${t instanceof Error?t.message:String(t)}
15
- `)}}async function n(t){let{flushCliTelemetry:a}=await import("./chunks/telemetry-W3YRHE67.js");await a(),await v(),process.exit(t)}if(e.version){let{getCliVersion:t}=await import("./chunks/cli-version-G72HUH4E.js"),{IS_BETA:a,BETA_LABEL:s}=await import("./chunks/beta-TOL55XPM.js"),m=a?` \xB7 ${s}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:d}=await import("./chunks/home-paths-NSHWNEGK.js"),p=d();console.log(p?`runtime v${p}`:"runtime not installed"),await n(0)}if(e.help&&!e.command){let{printHelp:t}=await import("./chunks/help-2PESJ7V2.js");t(),await n(0)}var o=e.globalFlags.port,c=e.verbose,u=e.globalFlags.device,l=e.globalFlags.theme,C=e.globalFlags.driver,O=e.globalFlags.headless===!0,h=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,i=h?["--sim",h,...e.commandArgs]:e.commandArgs;if(u||l){let{settingsStore:t}=await import("./chunks/store-APKY72ZY.js"),a={};u&&(a.deviceModel=u),l&&(a.colorScheme=l),t.apply(a)}if(!e.command&&e.commandArgs.length===0){let{runSetup:t,shouldRunSetupForBareCommand:a}=await import("./chunks/setup-HJZDC4PK.js");a()&&(await t(["--from-welcome"]),await n(0));let{printHelp:s}=await import("./chunks/help-2PESJ7V2.js");s(),await n(0)}var r=e.command??"";if(!r){if(e.commandArgs.length>0){let a=e.commandArgs.find(s=>!s.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${a}`),console.error(" run `sootsim --help` to see the full surface."),await n(1)}let{printHelp:t}=await import("./chunks/help-2PESJ7V2.js");t(),await n(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(r==="skill"){let{runSkill:s}=await import("./chunks/skills-RXHLMGGL.js");await s(e.commandArgs),await n(0)}let t=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="perf"||r==="wait",a=e.commandArgs.find(s=>!s.startsWith("-"));if(!(r==="shell"||r==="perf"))if(t&&!a){let{printGroupHelp:s}=await import("./chunks/help-2PESJ7V2.js");s(r)&&await n(0)}else{let{printCommandHelp:s}=await import("./chunks/help-2PESJ7V2.js");s(t&&a?a:r,{prefer:t&&a?"verb":"command",group:t&&a?r:void 0}),await n(0)}}S(r);if(w.has(r)){let{runInspect:t}=await import("./chunks/inspect-OIA3Q5MD.js");await t([r,...i],{port:o,verbose:c})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-OASKCPBX.js");await t(e.commandArgs);break}case"detox":{let{runDetox:t}=await import("./chunks/detox-SCCWUIKK.js");await t(e.commandArgs,{port:o,verbose:c});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-OXSKQJ6B.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"record":{let{runRecord:t}=await import("./chunks/record-TICJYZOA.js");await t(i,{port:o,verbose:c});break}case"film":{let{runFilm:t}=await import("./chunks/film-YBE544PG.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"storage":{let{runStorage:t}=await import("./chunks/storage-MMPD2XBS.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"perf":{let{runPerf:t}=await import("./chunks/perf-KF2BJZIN.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"screenshot":{let{runScreenshotCommand:t}=await import("./chunks/screenshot-command-XLERKHVW.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"mode":{let{runMode:t}=await import("./chunks/mode-U6KRG2PE.js");await t(i,{port:o,verbose:c});break}case"permissions":{let{runPermissions:t}=await import("./chunks/permissions-TRJG4QAI.js"),a=await t(i,{port:o,verbose:c});await n(a)}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-OIA3Q5MD.js");await t(i,{port:o,verbose:c});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-LEL32PDN.js");await t(i,{port:o,verbose:c});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-6PF5BZ37.js");await t(i,{port:o,verbose:c});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-4SAMGZWR.js");await t(i,{port:o,verbose:c});break}case"open":{let{runOpenCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"use":{let{runUseCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-RWLYBKQR.js");await t(i,{port:o});break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-MTDEKDUK.js");await t(i,{port:o});break}case"compat":{let{runCompat:t}=await import("./chunks/compat-IC4JHGBH.js");await t(e.commandArgs);break}case"report-issue":{let{runReportIssue:t}=await import("./chunks/report-issue-OQPLBQMJ.js"),a=await t(e.commandArgs);await n(a)}case"desktop":{let{runDesktop:t}=await import("./chunks/desktop-RDSISJH2.js");await t(e.commandArgs,{port:o,device:u,driver:C});break}case"login":{let{runLogin:t}=await import("./chunks/login-AEVUU72R.js");await t(e.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-72XHF6J2.js");await t();break}case"auth":{let{runAuth:t}=await import("./chunks/auth-XYYKD33F.js");await t(e.commandArgs);break}case"setup":{let{runSetup:t}=await import("./chunks/setup-HJZDC4PK.js");await t(e.commandArgs);break}case"serve":{let{runServe:t}=await import("./chunks/serve-5M7MIPWF.js");await t(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-D77E5G6Z.js");await t(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-HDMLWNXW.js");await t(e.commandArgs);break}case"upgrade":case"update":{let{runUpgrade:t}=await import("./chunks/upgrade-QSMIK3RC.js");await t(e.commandArgs);break}case"version":{let{runVersion:t}=await import("./chunks/version-WLTFXEDC.js");await t(e.commandArgs);break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-EK355OQM.js"),a=await t(e.commandArgs);await n(a)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-LCJJWHZE.js"),a=await t(e.commandArgs);await n(a)}case"skill":{let{runSkill:t}=await import("./chunks/skills-RXHLMGGL.js");await t(e.commandArgs);break}case"app-fonts":{let{runAppFonts:t}=await import("./chunks/app-fonts-LIPU2DLT.js");await t(e.commandArgs);break}case"config":{let{runConfig:t}=await import("./chunks/config-C65MZFU3.js");await t(e.commandArgs);break}case"cleanup":{let{runCleanup:t}=await import("./chunks/cleanup-GCTEGJMP.js"),a=await t(e.commandArgs);await n(a)}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),await n(1)}await v();
15
+ `)}}async function n(t){let{flushCliTelemetry:a}=await import("./chunks/telemetry-4VZ43AHH.js");await a(),await v(),process.exit(t)}if(e.version){let{getCliVersion:t}=await import("./chunks/cli-version-3HG7ILRV.js"),{IS_BETA:a,BETA_LABEL:s}=await import("./chunks/beta-YPZFX3DF.js"),m=a?` \xB7 ${s}`:"";console.log(`sootsim v${t()}${m}`);let{readActiveRuntime:d}=await import("./chunks/home-paths-TQ53NFW3.js"),p=d();console.log(p?`runtime v${p}`:"runtime not installed"),await n(0)}if(e.help&&!e.command){let{printHelp:t}=await import("./chunks/help-V2KS2AUT.js");t(),await n(0)}var o=e.globalFlags.port,c=e.verbose,u=e.globalFlags.device,l=e.globalFlags.theme,E=e.globalFlags.driver,O=e.globalFlags.headless===!0,h=e.globalFlags.sim??e.globalFlags.session??e.globalFlags.tab,i=h?["--sim",h,...e.commandArgs]:e.commandArgs;if(u||l){let{settingsStore:t}=await import("./chunks/store-GUNEQ4EC.js"),a={};u&&(a.deviceModel=u),l&&(a.colorScheme=l),t.apply(a)}if(!e.command&&e.commandArgs.length===0){let{runSetup:t,shouldRunSetupForBareCommand:a}=await import("./chunks/setup-BXQI3YT4.js");a()&&(await t(["--from-welcome"]),await n(0));let{printHelp:s}=await import("./chunks/help-V2KS2AUT.js");s(),await n(0)}var r=e.command??"";if(!r){if(e.commandArgs.length>0){let a=e.commandArgs.find(s=>!s.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${a}`),console.error(" run `sootsim --help` to see the full surface."),await n(1)}let{printHelp:t}=await import("./chunks/help-V2KS2AUT.js");t(),await n(0)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){if(r==="skill"){let{runSkill:s}=await import("./chunks/skills-AYSO5FJB.js");await s(e.commandArgs),await n(0)}let t=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="perf"||r==="wait",a=e.commandArgs.find(s=>!s.startsWith("-"));if(!(r==="shell"||r==="perf"))if(t&&!a){let{printGroupHelp:s}=await import("./chunks/help-V2KS2AUT.js");s(r)&&await n(0)}else{let{printCommandHelp:s}=await import("./chunks/help-V2KS2AUT.js");s(t&&a?a:r,{prefer:t&&a?"verb":"command",group:t&&a?r:void 0}),await n(0)}}S(r);if(w.has(r)){let{runInspect:t}=await import("./chunks/inspect-6PW37GVK.js");await t([r,...i],{port:o,verbose:c})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-LAXNLFZ6.js");await t(e.commandArgs);break}case"detox":{let{runDetox:t}=await import("./chunks/detox-P7SDHLB4.js");await t(e.commandArgs,{port:o,verbose:c});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-66RNLMLU.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"record":{let{runRecord:t}=await import("./chunks/record-Q7VRLH7A.js");await t(i,{port:o,verbose:c});break}case"film":{let{runFilm:t}=await import("./chunks/film-QZMDVCZI.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"storage":{let{runStorage:t}=await import("./chunks/storage-KBHG5M5F.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"perf":{let{runPerf:t}=await import("./chunks/perf-CBUP2ERS.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"screenshot":{let{runScreenshotCommand:t}=await import("./chunks/screenshot-command-SSWKZ4U3.js"),a=await t(i,{port:o,verbose:c});await n(typeof a=="number"?a:0)}case"mode":{let{runMode:t}=await import("./chunks/mode-DPGASAG4.js");await t(i,{port:o,verbose:c});break}case"permissions":{let{runPermissions:t}=await import("./chunks/permissions-3AOMCAT3.js"),a=await t(i,{port:o,verbose:c});await n(a)}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-6PW37GVK.js");await t(i,{port:o,verbose:c});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-2BBR66MJ.js");await t(i,{port:o,verbose:c});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-AB2R26RE.js");await t(i,{port:o,verbose:c});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-JLI3NTEU.js");await t(i,{port:o,verbose:c});break}case"open":{let{runOpenCommand:t}=await import("./chunks/control-BE55SA2W.js");await t(i,{port:o});break}case"use":{let{runUseCommand:t}=await import("./chunks/control-BE55SA2W.js");await t(i,{port:o});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-BE55SA2W.js");await t(i,{port:o});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-BE55SA2W.js");await t(i,{port:o});break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-JB4NSOZV.js");await t(i,{port:o});break}case"compat":{let{runCompat:t}=await import("./chunks/compat-GS3SVTB4.js");await t(e.commandArgs);break}case"report-issue":{let{runReportIssue:t}=await import("./chunks/report-issue-DTWZECYM.js"),a=await t(e.commandArgs);await n(a)}case"desktop":{let{runDesktop:t}=await import("./chunks/desktop-PPB66SZO.js");await t(e.commandArgs,{port:o,device:u});break}case"login":{let{runLogin:t}=await import("./chunks/login-7XXY5JP4.js");await t(e.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-UNARNKTJ.js");await t();break}case"auth":{let{runAuth:t}=await import("./chunks/auth-CFTFPYKX.js");await t(e.commandArgs);break}case"setup":{let{runSetup:t}=await import("./chunks/setup-BXQI3YT4.js");await t(e.commandArgs);break}case"serve":{let{runServe:t}=await import("./chunks/serve-T4EQBJM6.js");await t(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-3YMH272E.js");await t(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-VGYKLLTE.js");await t(e.commandArgs);break}case"upgrade":case"update":{let{runUpgrade:t}=await import("./chunks/upgrade-5XXQ7OCE.js");await t(e.commandArgs);break}case"version":{let{runVersion:t}=await import("./chunks/version-PH3OUNPP.js");await t(e.commandArgs);break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-43LRLQBS.js"),a=await t(e.commandArgs);await n(a)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-QYKQDC2Y.js"),a=await t(e.commandArgs);await n(a)}case"skill":{let{runSkill:t}=await import("./chunks/skills-AYSO5FJB.js");await t(e.commandArgs);break}case"app-fonts":{let{runAppFonts:t}=await import("./chunks/app-fonts-IHE34DCY.js");await t(e.commandArgs);break}case"config":{let{runConfig:t}=await import("./chunks/config-W5LN7HWO.js");await t(e.commandArgs);break}case"cleanup":{let{runCleanup:t}=await import("./chunks/cleanup-GYDCGNEJ.js"),a=await t(e.commandArgs);await n(a)}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),await n(1)}await v();
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as b,b as E,c as A,d as l,e as S,g as j,h as T,j as I,n as k,o as D,p as x,q as g,r as O,s as C}from"./chunk-YAV6BH3A.js";import"./chunk-RYQUO6LT.js";import{c as $}from"./chunk-GF3LDVWF.js";import"./chunk-3UUHIHA6.js";import"./chunk-VUR5QXVX.js";import"./chunk-G4R7CPCY.js";import"./chunk-RT7TUHH7.js";import"./chunk-ABHNOM2C.js";import"./chunk-YXHO2OUL.js";import"./chunk-ZDRI2LUG.js";import{j as y}from"./chunk-7RFXZXKH.js";import"./chunk-ZONISYZ5.js";import"./chunk-OSH6526H.js";import"./chunk-XHYSASAX.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no sootsim bridge on port ${e}. run \`sootsim setup\` to install the background daemon, or \`sootsim serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
4
+ import{a as b,b as E,c as A,d as l,e as S,g as j,h as T,j as I,n as k,o as D,p as x,q as g,r as O,s as C}from"./chunk-6WCW6PES.js";import"./chunk-IGKZOI2V.js";import{c as $}from"./chunk-7VVWOKJE.js";import"./chunk-C6TKPNCZ.js";import"./chunk-IXPUTLYO.js";import"./chunk-OYFRTYRJ.js";import"./chunk-BPNVJLGT.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-4MLH5CMV.js";import{j as y}from"./chunk-VTPICQDM.js";import"./chunk-TCB56ABT.js";import"./chunk-YVWYARHY.js";import"./chunk-2UC72ZR6.js";import w from"node:fs";import d from"node:path";import{spawn as _}from"node:child_process";import F from"node:net";import{WebSocket as R}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new R(`ws://localhost:${this.port}`),this.ready=new Promise((t,r)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),r(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async sendClaimedPrompt(e,t){return this.send("agent:send-claimed-prompt",{simId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==R.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let r=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(r),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(r,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:r,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(r),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new c(t.error,t.code)):r.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function M(n=7668,e=400){return new Promise(t=>{let r=new F.Socket,s=!1,o=i=>{s||(s=!0,r.destroy(),t(i))};r.setTimeout(e),r.once("connect",()=>o(!0)),r.once("timeout",()=>o(!1)),r.once("error",()=>o(!1)),r.connect(n,"127.0.0.1")})}async function B(n={}){let e=n.port??7668;if(await M(e))return{alreadyRunning:!0};if(y())throw new c(`no sootsim bridge on port ${e}. run \`sootsim setup\` to install the background daemon, or \`sootsim serve\` in another shell.`,"DEV_HOST_REFUSED");let{cmd:t,prefixArgs:r}=C(),s=[...r,"serve","--quiet"];e!==7668&&s.push("--port",String(e));let o=_(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(n.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await M(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim serve\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(n={}){await B({port:n.port,startupTimeoutMs:n.startupTimeoutMs});let e=new f(n);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function ge(n){let[e,...t]=n;try{switch(e){case void 0:case"--help":case"-h":case"help":return L(),0;case"attach":return await W(t);case"projects":return await J();case"project":return await V(t);case"sessions":return await H(t);case"start":return await G(t);case"prompt":return await q(t);case"watch":return await K(t);case"transcript":return await z(t);case"end":return await Q(t);case"paths":return await Y();default:return process.stderr.write(`unknown agent subcommand: ${e}
5
5
  `),L(),2}}catch(r){if(r instanceof c)return process.stderr.write(`${r.message}
6
6
  `),1;throw r}}async function v(n){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await n(e)}finally{e.close()}}function L(){$("agent")}function P(n,e){let t={},r=[];for(let s=0;s<n.length;s++){let o=n[s],i=e[o];i==="value"?(t[o]=n[s+1]??"",s++):i==="bool"?t[o]=!0:r.push(o)}return{flags:t,positional:r}}function U(n,e="codex"){return n==="codex"||n==="claude"?n:e}async function W(n){let{flags:e,positional:t}=P(n,{"--name":"value","--provider":"value"}),r=t[0];if(!r)return process.stderr.write(`usage: sootsim agent attach <dir> [--name X] [--provider codex|claude]
7
7
  `),2;let s=d.resolve(r);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as M}from"./chunk-RYQUO6LT.js";import"./chunk-XHYSASAX.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
4
+ import{b as M}from"./chunk-IGKZOI2V.js";import"./chunk-2UC72ZR6.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as C,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,f=!1,a=new Promise(s=>{t.on("exit",(o,e)=>{f=!0;let p=new Error(`codex app-server exited (code=${o}, signal=${e??""})`);for(let{reject:y}of r.values())y(p);r.clear(),s({code:o,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let o=s.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,y=p!=null?r.get(p):void 0;if(!y)return;r.delete(p),e.error?y.reject(new b(e.error.message,e.error.code,e.error.data)):y.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let y of p)try{y(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let o=m.get("__stderr__");if(o)for(let e of o)try{e({text:s})}catch{}});function n(s){if(!f)try{t.stdin.write(JSON.stringify(s)+`
5
5
  `)}catch{}}return{exited:a,on(s,o){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(o),()=>{e?.delete(o)}},request(s,o){if(f)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,y)=>{r.set(e,{resolve:l=>p(l),reject:y,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:o})})},notify(s,o){n({jsonrpc:"2.0",method:s,params:o})},async shutdown(s=1500){if(f)return;try{t.stdin.end()}catch{}let o=setTimeout(()=>{if(!f)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(o)}},kill(s="SIGTERM"){if(!f)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return C(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let f=t[u];f&&(r[f]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: sootsim agent-wrapper --session-id <id> --project-id <id>
6
6
  --provider codex|claude --cwd <path>
7
7
  --prompt-in <fifo> --events-out <fifo>
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{k as p}from"./chunk-RJWQ3VAD.js";import"./chunk-M3ETYVNL.js";import"./chunk-RQJDIDJ3.js";import"./chunk-XHYSASAX.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let i=t.find(r=>r.startsWith(`--${e}=`));return i?i.slice(e.length+3):void 0}async function S(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),i=f(t,"manifest");if((!o||!i)&&(console.error(" usage: sootsim app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let r=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of r){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(i))try{let n=JSON.parse(y(i,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(i,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await S(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
4
+ import{k as p}from"./chunk-G73JPCHX.js";import"./chunk-NQ56D5JF.js";import"./chunk-7RZYUZEK.js";import"./chunk-2UC72ZR6.js";import{existsSync as h,mkdirSync as d,readFileSync as y,writeFileSync as g}from"node:fs";import{join as m}from"node:path";import{gzipSync as w}from"node:zlib";function f(t,e){let o=t.indexOf(`--${e}`);if(o!==-1&&o+1<t.length)return t[o+1];let i=t.find(r=>r.startsWith(`--${e}=`));return i?i.slice(e.length+3):void 0}async function S(t){let e=f(t,"wire")||"",o=f(t,"out-dir"),i=f(t,"manifest");if((!o||!i)&&(console.error(" usage: sootsim app-fonts stage --wire <wire> --out-dir <dir> --manifest <path>"),process.exit(1)),!e.trim()){console.log("no app fonts declared \u2014 nothing to stage");return}d(o,{recursive:!0});let r=await p(e,{onStaged:({url:n,byteLength:s})=>console.log(` staged app font: ${n} (${(s/1024).toFixed(1)} KiB)`),onError:(n,s)=>console.error(` warning: failed to fetch app font ${n}: ${s instanceof Error?s.message:s}`)}),a=[];for(let n of r){let s=w(n.bytes);g(m(o,n.urlhash),s),a.push({url:n.url,urlhash:n.urlhash,contentType:n.contentType,encoding:"gzip",sizeBytes:s.length,rawBytes:n.bytes.byteLength})}let c=[];if(h(i))try{let n=JSON.parse(y(i,"utf8"));Array.isArray(n)&&(c=n)}catch{}let u=new Set(c.map(n=>n.urlhash)),l=[...c,...a.filter(n=>!u.has(n.urlhash))];g(i,JSON.stringify(l)),console.log(`staged ${a.length} app font(s); manifest now has ${l.length} file(s)`)}async function E(t){let e=t[0];if(e==="stage"){await S(t.slice(1));return}console.error(` unknown app-fonts subcommand: ${e??"(none)"}`),console.error(" available: stage"),process.exit(1)}export{E as runAppFonts};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import"./chunk-XHYSASAX.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
4
+ import"./chunk-2UC72ZR6.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
5
5
  `).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=x("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
6
6
  `),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
7
7
  supported: ${Array.from(w).sort().join(", ")}
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as t}from"./chunk-EXW6TH3O.js";import{d as s}from"./chunk-MSYPDBFG.js";import"./chunk-7RFXZXKH.js";import"./chunk-XHYSASAX.js";function i(){console.log(`
4
+ import{a as t}from"./chunk-HTR4DSA5.js";import{d as s}from"./chunk-UTE2W4WC.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";function i(){console.log(`
5
5
  sootsim auth \u2014 inspect CLI auth
6
6
 
7
7
  usage:
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a,b,c,d}from"./chunk-OSH6526H.js";import"./chunk-XHYSASAX.js";export{d as BETA_ASK_HEADLINE,b as BETA_LABEL,c as BETA_TAGLINE,a as IS_BETA};
4
+ import{a,b,c,d}from"./chunk-YVWYARHY.js";import"./chunk-2UC72ZR6.js";export{d as BETA_ASK_HEADLINE,b as BETA_LABEL,c as BETA_TAGLINE,a as IS_BETA};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{m as d}from"./chunk-NXYKNKNL.js";import"./chunk-HFA5ZACE.js";import{h as l,j as m,l as p}from"./chunk-V6JDDX4B.js";import"./chunk-ABHNOM2C.js";import"./chunk-YXHO2OUL.js";import"./chunk-7RFXZXKH.js";import"./chunk-XHYSASAX.js";function f(){console.log(`
4
+ import{m as d}from"./chunk-HPCKCWSQ.js";import"./chunk-4735ZG3S.js";import{h as l,j as m,l as p}from"./chunk-MCGRZYAP.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";function f(){console.log(`
5
5
  sootsim do scan \u2014 inject a barcode scan
6
6
 
7
7
  usage:
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
4
  var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),o=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},l=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=h(b,d))||f.enumerable});return a};var p=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c,p as d};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{c as j,d as H}from"./chunk-AJYA6R3N.js";import{c as Y}from"./chunk-GF3LDVWF.js";import{K as F,M,g as R,j as E,r as O,s as x,t as U}from"./chunk-7RFXZXKH.js";import{a as V}from"./chunk-ZONISYZ5.js";import{execFileSync as Z,spawnSync as c}from"child_process";import{existsSync as n,mkdirSync as L,readFileSync as le,realpathSync as ue,rmSync as h,writeFileSync as K}from"fs";import{homedir as v}from"os";import{basename as pe,dirname as C,resolve as u,sep as X}from"path";import{execFileSync as re}from"child_process";import{chmodSync as oe,mkdirSync as A,rmSync as se,writeFileSync as I}from"fs";import{dirname as T}from"path";var ne="dev.sootsim.daemon",G="SootSim Daemon",q="0.1.36";function W(e,t,r){let s=x(),o=U(),a=T(T(o)),l=T(o),p=`${a}/Resources`;se(s,{recursive:!0,force:!0}),A(O(),{recursive:!0}),A(l,{recursive:!0}),A(p,{recursive:!0}),I(`${a}/Info.plist`,ie()),I(`${a}/PkgInfo`,"APPL????"),I(o,ae(e,t,r)),oe(o,493);try{re("codesign",["--force","--sign","-","--deep",s],{stdio:"pipe"})}catch(i){let f=i instanceof Error?i.message:String(i);console.warn(` warning: ad-hoc codesign of ${s} failed: ${f}
4
+ import{c as j,d as H}from"./chunk-HMW7QKJV.js";import{c as Y}from"./chunk-7VVWOKJE.js";import{K as F,M,g as R,j as E,r as O,s as x,t as U}from"./chunk-VTPICQDM.js";import{a as V}from"./chunk-TCB56ABT.js";import{execFileSync as Z,spawnSync as c}from"child_process";import{existsSync as n,mkdirSync as L,readFileSync as le,realpathSync as ue,rmSync as h,writeFileSync as K}from"fs";import{homedir as v}from"os";import{basename as pe,dirname as C,resolve as u,sep as X}from"path";import{execFileSync as re}from"child_process";import{chmodSync as oe,mkdirSync as A,rmSync as se,writeFileSync as I}from"fs";import{dirname as T}from"path";var ne="dev.sootsim.daemon",G="SootSim Daemon",q="0.1.36";function W(e,t,r){let s=x(),o=U(),a=T(T(o)),l=T(o),p=`${a}/Resources`;se(s,{recursive:!0,force:!0}),A(O(),{recursive:!0}),A(l,{recursive:!0}),A(p,{recursive:!0}),I(`${a}/Info.plist`,ie()),I(`${a}/PkgInfo`,"APPL????"),I(o,ae(e,t,r)),oe(o,493);try{re("codesign",["--force","--sign","-","--deep",s],{stdio:"pipe"})}catch(i){let f=i instanceof Error?i.message:String(i);console.warn(` warning: ad-hoc codesign of ${s} failed: ${f}
5
5
  the daemon will still run, but Login Items may show a generic name.`)}return{bundlePath:s,launcherPath:o}}function ie(){return`<?xml version="1.0" encoding="UTF-8"?>
6
6
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
7
7
  <plist version="1.0">
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
4
  function Q(t,e){let r=["--max-ms","--maxMs","--maxms","--max_ms"];for(let n of r){let o=t.indexOf(n);if(o>=0&&t[o+1]){let s=Number(t[o+1]);if(Number.isFinite(s))return Math.max(100,s)}}return e}var N=new Set(["tap","double-tap","tap-text","tap-id","long-press","touch"]);function P(t){return typeof t=="string"&&N.has(t)}async function M(t){return await t.send({type:"evaluate",code:"window.__sootsimEngineState?.inspectActive === true"})===!0}async function X(t,e){if(!P(e))return!1;try{return await M(t)}catch{return!1}}async function Z(t){let e=await t.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof e=="number"?e:0}}async function ee(t,e=5,r){let n=r?.format?`, ${JSON.stringify(r)}`:"",o=await t.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${e}${n}))()`});if(r?.format==="boxes"&&typeof o=="string")try{return{depth:e,tree:JSON.parse(o)}}catch{return{depth:e,tree:o}}return{depth:e,tree:o}}async function te(t){let e=await t.send({type:"evaluate",code:"window.location.href"});return{url:typeof e=="string"?e:""}}async function ne(t,e){let r=`(async () => {
@@ -1,6 +1,6 @@
1
- /*! sootsim v0.1.304 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as C}from"./chunk-FNI75AD7.js";import{f as h}from"./chunk-A4UYZTV7.js";import{G as B,O as b,g as S}from"./chunk-7RFXZXKH.js";import a from"node:fs";import c from"node:path";var g=1,k=`automatic-cleanup-v${g}.json`,A=`automatic-cleanup-v${g}.lock`,P=360*60*1e3;function w(){let i=c.join(S(),k);try{return JSON.parse(a.readFileSync(i,"utf8")).generation===g}catch{return!1}}function N(i){if(i<1024)return`${i} B`;let e=["KiB","MiB","GiB","TiB"],n=i/1024,s=e[0];for(let r=1;r<e.length&&n>=1024;r++)n/=1024,s=e[r];return`${n.toFixed(n>=10?1:2)} ${s}`}function p(i){let e;try{e=a.lstatSync(i)}catch{return 0}let n=e.blocks>0?e.blocks*512:e.size;if(!e.isDirectory()||e.isSymbolicLink())return n;let s=n;try{for(let r of a.readdirSync(i))s+=p(c.join(i,r))}catch{}return s}function E(i){for(let e of["SingletonLock","SingletonSocket","lockfile"])try{if(a.lstatSync(c.join(i,e)))return!0}catch{}return!1}function v(i,e){let n;try{n=a.readdirSync(i,{withFileTypes:!0})}catch{return[]}let s=E(e),r=[];for(let t of n){if(!t.isDirectory()||t.isSymbolicLink())continue;let o=c.join(i,t.name);if(C(t.name)){r.push({path:o,bytes:p(o),kind:"browser-cache",state:s?"in-use":"safe",selected:!s,detail:s?"browser profile is open; close it before cleanup":"disposable browser HTTP, bytecode, or GPU cache"});continue}r.push(...v(o,e))}return r}function L(i){let e=c.join(i,"profiles","playwright"),n;try{n=a.readdirSync(e,{withFileTypes:!0})}catch{return[]}return n.flatMap(s=>{if(!s.isDirectory()||s.isSymbolicLink())return[];let r=c.join(e,s.name);return v(r,r)})}function R(i){let e=c.join(i,"electron","userData");return v(e,e)}function U(i,e){let n=c.join(i,"recordings"),s;try{s=a.readdirSync(n,{withFileTypes:!0})}catch{return[]}return s.map(r=>{let t=c.join(n,r.name);return{path:t,bytes:p(t),kind:"recording",state:"aggressive",selected:e,detail:"user-created recording or captured-frame output"}})}function x(i){let e=new Set(b()),n=[...e],s=h.planLocalRetention({retainVersions:2,protectVersions:n}),r=h.planLocalRetention({retainVersions:1,protectVersions:n}),t=new Set(s.removeVersions),o=new Set(r.removeVersions),l=new Set([...s.keepVersions,...s.removeVersions,...r.keepVersions,...r.removeVersions]),m=[];for(let u of[...l].sort()){let d=h.product.runtimeDir(u),y="retained",f="retained runtime";e.has(u)&&u!==s.activeVersion?(y="in-use",f="runtime is serving a connected simulator"):t.has(u)?(y="safe",f="inactive runtime outside the two-version rollback window"):o.has(u)?(y="aggressive",f="most recent rollback runtime"):u===s.activeVersion&&(f="active runtime; always protected"),m.push({path:d,bytes:p(d),kind:"runtime-version",state:y,selected:y==="safe"||y==="aggressive"&&i,detail:f})}for(let u of s.removeCacheFiles)m.push({path:u,bytes:p(u),kind:"runtime-archive",state:"safe",selected:!0,detail:"downloaded archive is unnecessary after successful extraction"});return{activeRuntime:s.activeVersion,entries:m}}function T(i={}){let e=i.aggressive===!0,n=S(),s=x(e),r=[...s.entries,...L(n),...R(n),...U(n,e)].sort((t,o)=>o.bytes-t.bytes||t.path.localeCompare(o.path));return{home:n,activeRuntime:s.activeRuntime,entries:r,reclaimableBytes:r.reduce((t,o)=>t+(o.selected?o.bytes:0),0),protectedBytes:r.reduce((t,o)=>t+(o.selected?0:o.bytes),0),totalBytes:p(n)}}function D(i,e){let n=c.relative(i,e);if(!n||n.startsWith("..")||c.isAbsolute(n))throw new Error(`refusing cleanup target outside the SootSim home: ${e}`)}function I(i={}){let e=T(i),n=i.aggressive===!0?1:2;h.pruneLocalRetention({retainVersions:n,protectVersions:b()});for(let t of e.entries)if(t.selected&&!(t.kind==="runtime-archive"||t.kind==="runtime-version")){if(t.kind==="browser-cache"){let l=c.relative(e.home,t.path).split(c.sep),m=l[0]==="profiles"&&l[1]==="playwright"&&l[2]?c.join(e.home,"profiles","playwright",l[2]):l[0]==="electron"&&l[1]==="userData"?c.join(e.home,"electron","userData"):null;if(m&&E(m)){t.state="in-use",t.selected=!1,t.detail="browser profile opened while cleanup was starting";continue}}D(e.home,t.path),a.rmSync(t.path,{recursive:!0,force:!0})}let s=e.entries.filter(t=>t.selected&&!a.existsSync(t.path)).map(t=>t.path),r=p(e.home);return{...e,removedPaths:s,reclaimedBytes:Math.max(0,e.totalBytes-r),remainingBytes:r}}function $(){B();let i=S(),e=c.join(i,k),n=c.join(i,A);if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let s=null;for(let r=0;r<2&&s===null;r++)try{let t=a.openSync(n,"wx");try{a.writeFileSync(t,`${JSON.stringify({pid:process.pid,startedAt:Date.now()})}
4
+ import{b as C}from"./chunk-FXC6BYKX.js";import{f as h}from"./chunk-LOXCEKKF.js";import{G as B,O as b,g as S}from"./chunk-VTPICQDM.js";import a from"node:fs";import c from"node:path";var g=1,k=`automatic-cleanup-v${g}.json`,A=`automatic-cleanup-v${g}.lock`,P=360*60*1e3;function w(){let i=c.join(S(),k);try{return JSON.parse(a.readFileSync(i,"utf8")).generation===g}catch{return!1}}function N(i){if(i<1024)return`${i} B`;let e=["KiB","MiB","GiB","TiB"],n=i/1024,s=e[0];for(let r=1;r<e.length&&n>=1024;r++)n/=1024,s=e[r];return`${n.toFixed(n>=10?1:2)} ${s}`}function p(i){let e;try{e=a.lstatSync(i)}catch{return 0}let n=e.blocks>0?e.blocks*512:e.size;if(!e.isDirectory()||e.isSymbolicLink())return n;let s=n;try{for(let r of a.readdirSync(i))s+=p(c.join(i,r))}catch{}return s}function E(i){for(let e of["SingletonLock","SingletonSocket","lockfile"])try{if(a.lstatSync(c.join(i,e)))return!0}catch{}return!1}function v(i,e){let n;try{n=a.readdirSync(i,{withFileTypes:!0})}catch{return[]}let s=E(e),r=[];for(let t of n){if(!t.isDirectory()||t.isSymbolicLink())continue;let o=c.join(i,t.name);if(C(t.name)){r.push({path:o,bytes:p(o),kind:"browser-cache",state:s?"in-use":"safe",selected:!s,detail:s?"browser profile is open; close it before cleanup":"disposable browser HTTP, bytecode, or GPU cache"});continue}r.push(...v(o,e))}return r}function L(i){let e=c.join(i,"profiles","playwright"),n;try{n=a.readdirSync(e,{withFileTypes:!0})}catch{return[]}return n.flatMap(s=>{if(!s.isDirectory()||s.isSymbolicLink())return[];let r=c.join(e,s.name);return v(r,r)})}function R(i){let e=c.join(i,"electron","userData");return v(e,e)}function U(i,e){let n=c.join(i,"recordings"),s;try{s=a.readdirSync(n,{withFileTypes:!0})}catch{return[]}return s.map(r=>{let t=c.join(n,r.name);return{path:t,bytes:p(t),kind:"recording",state:"aggressive",selected:e,detail:"user-created recording or captured-frame output"}})}function x(i){let e=new Set(b()),n=[...e],s=h.planLocalRetention({retainVersions:2,protectVersions:n}),r=h.planLocalRetention({retainVersions:1,protectVersions:n}),t=new Set(s.removeVersions),o=new Set(r.removeVersions),l=new Set([...s.keepVersions,...s.removeVersions,...r.keepVersions,...r.removeVersions]),m=[];for(let u of[...l].sort()){let d=h.product.runtimeDir(u),y="retained",f="retained runtime";e.has(u)&&u!==s.activeVersion?(y="in-use",f="runtime is serving a connected simulator"):t.has(u)?(y="safe",f="inactive runtime outside the two-version rollback window"):o.has(u)?(y="aggressive",f="most recent rollback runtime"):u===s.activeVersion&&(f="active runtime; always protected"),m.push({path:d,bytes:p(d),kind:"runtime-version",state:y,selected:y==="safe"||y==="aggressive"&&i,detail:f})}for(let u of s.removeCacheFiles)m.push({path:u,bytes:p(u),kind:"runtime-archive",state:"safe",selected:!0,detail:"downloaded archive is unnecessary after successful extraction"});return{activeRuntime:s.activeVersion,entries:m}}function T(i={}){let e=i.aggressive===!0,n=S(),s=x(e),r=[...s.entries,...L(n),...R(n),...U(n,e)].sort((t,o)=>o.bytes-t.bytes||t.path.localeCompare(o.path));return{home:n,activeRuntime:s.activeRuntime,entries:r,reclaimableBytes:r.reduce((t,o)=>t+(o.selected?o.bytes:0),0),protectedBytes:r.reduce((t,o)=>t+(o.selected?0:o.bytes),0),totalBytes:p(n)}}function D(i,e){let n=c.relative(i,e);if(!n||n.startsWith("..")||c.isAbsolute(n))throw new Error(`refusing cleanup target outside the SootSim home: ${e}`)}function I(i={}){let e=T(i),n=i.aggressive===!0?1:2;h.pruneLocalRetention({retainVersions:n,protectVersions:b()});for(let t of e.entries)if(t.selected&&!(t.kind==="runtime-archive"||t.kind==="runtime-version")){if(t.kind==="browser-cache"){let l=c.relative(e.home,t.path).split(c.sep),m=l[0]==="profiles"&&l[1]==="playwright"&&l[2]?c.join(e.home,"profiles","playwright",l[2]):l[0]==="electron"&&l[1]==="userData"?c.join(e.home,"electron","userData"):null;if(m&&E(m)){t.state="in-use",t.selected=!1,t.detail="browser profile opened while cleanup was starting";continue}}D(e.home,t.path),a.rmSync(t.path,{recursive:!0,force:!0})}let s=e.entries.filter(t=>t.selected&&!a.existsSync(t.path)).map(t=>t.path),r=p(e.home);return{...e,removedPaths:s,reclaimedBytes:Math.max(0,e.totalBytes-r),remainingBytes:r}}function $(){B();let i=S(),e=c.join(i,k),n=c.join(i,A);if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let s=null;for(let r=0;r<2&&s===null;r++)try{let t=a.openSync(n,"wx");try{a.writeFileSync(t,`${JSON.stringify({pid:process.pid,startedAt:Date.now()})}
5
5
  `,"utf8"),s=t}catch(o){a.closeSync(t);try{a.unlinkSync(n)}catch{}throw o}}catch(t){if((t instanceof Error&&"code"in t?t.code:null)!=="EEXIST")throw t;let l=0,m=0,u=null;try{u=a.lstatSync(n);let d=JSON.parse(a.readFileSync(n,"utf8"));l=typeof d.pid=="number"?d.pid:0,m=typeof d.startedAt=="number"?d.startedAt:0}catch{}if(l>0&&m>0&&Date.now()-m<P)try{return process.kill(l,0),{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0}}catch{}if(!u)continue;try{let d=a.lstatSync(n);if(d.dev!==u.dev||d.ino!==u.ino)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};a.unlinkSync(n)}catch{}}if(s===null)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};try{if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let r=I(),t=r.entries.reduce((l,m)=>l+(m.state==="in-use"?m.bytes:0),0);if(t>0)return{status:"deferred",reclaimedBytes:r.reclaimedBytes,remainingBytes:r.remainingBytes,deferredInUseBytes:t};let o=`${e}.${process.pid}.tmp`;return a.writeFileSync(o,`${JSON.stringify({generation:g,completedAt:Date.now(),reclaimedBytes:r.reclaimedBytes})}
6
6
  `,"utf8"),a.renameSync(o,e),{status:"complete",reclaimedBytes:r.reclaimedBytes,remainingBytes:r.remainingBytes,deferredInUseBytes:0}}finally{a.closeSync(s);try{a.unlinkSync(n)}catch{}}}export{w as a,N as b,T as c,I as d,$ as e};