sootsim 0.1.41 → 0.1.42

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 (136) hide show
  1. package/dist-cli/bin.js +4 -4
  2. package/dist-cli/chunks/{agent-7BJ2ZP22.js → agent-4BBZUWD2.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-OXBYRJVT.js → agent-wrapper-TA5GG3MV.js} +2 -2
  4. package/dist-cli/chunks/{assert-NZTYFTTT.js → assert-7GHUOGLI.js} +2 -2
  5. package/dist-cli/chunks/auto-bootstrap-7BJDOYUU.js +2 -0
  6. package/dist-cli/chunks/beta-2LIEPFEJ.js +2 -0
  7. package/dist-cli/chunks/{chunk-ANDSHXLU.js → chunk-2GKZS2ZZ.js} +2 -2
  8. package/dist-cli/chunks/chunk-2XCCV7J3.js +2 -0
  9. package/dist-cli/chunks/{chunk-LX6KS6TL.js → chunk-3PN6HIAM.js} +1 -1
  10. package/dist-cli/chunks/{chunk-OPDPXAYA.js → chunk-4574AJAK.js} +2 -2
  11. package/dist-cli/chunks/{chunk-AOYBIMKL.js → chunk-543BSGQG.js} +1 -1
  12. package/dist-cli/chunks/{chunk-GB3G5LVB.js → chunk-5EBERDK7.js} +1 -1
  13. package/dist-cli/chunks/{chunk-GI7FXE7J.js → chunk-5PZPKGUJ.js} +2 -2
  14. package/dist-cli/chunks/{chunk-SHHUVGL2.js → chunk-5TRJK5SO.js} +1 -1
  15. package/dist-cli/chunks/chunk-64AKKWVB.js +1 -0
  16. package/dist-cli/chunks/{chunk-J3JJRXIP.js → chunk-6MYXKMLG.js} +1 -1
  17. package/dist-cli/chunks/{chunk-7YZJHZ7X.js → chunk-6R3CVNXC.js} +1 -1
  18. package/dist-cli/chunks/chunk-76WF7UIG.js +17 -0
  19. package/dist-cli/chunks/{chunk-IP2MARRU.js → chunk-A2R42ONP.js} +2 -2
  20. package/dist-cli/chunks/{chunk-Y2YNXUBT.js → chunk-BBRAYGDX.js} +2 -2
  21. package/dist-cli/chunks/{chunk-IF33CQL4.js → chunk-BVCZIJ2X.js} +2 -2
  22. package/dist-cli/chunks/{chunk-NZ5O2OEL.js → chunk-BZFKV7CT.js} +2 -2
  23. package/dist-cli/chunks/{chunk-HAVQS3PI.js → chunk-CZZDYQBA.js} +1 -1
  24. package/dist-cli/chunks/{chunk-SWHWVYZS.js → chunk-D5TKAFJ3.js} +1 -1
  25. package/dist-cli/chunks/{chunk-LMNB7NYI.js → chunk-DNSKIJSB.js} +2 -2
  26. package/dist-cli/chunks/{chunk-C4AMFYK3.js → chunk-DUVJOJTP.js} +1 -1
  27. package/dist-cli/chunks/{chunk-GOFKXREQ.js → chunk-DXQKMDX2.js} +2 -2
  28. package/dist-cli/chunks/{chunk-WZDE344I.js → chunk-EDXBJUHH.js} +3 -3
  29. package/dist-cli/chunks/chunk-EZGUKWD5.js +1 -0
  30. package/dist-cli/chunks/{chunk-2T6UOHPO.js → chunk-FDB3P2GV.js} +1 -1
  31. package/dist-cli/chunks/{chunk-FZB4W23Y.js → chunk-I4LBW6ED.js} +2 -2
  32. package/dist-cli/chunks/chunk-IFY75LQ3.js +1 -0
  33. package/dist-cli/chunks/{chunk-S3SQITOO.js → chunk-ITQGNQE3.js} +2 -2
  34. package/dist-cli/chunks/{chunk-TBIGAH3T.js → chunk-J6HT2ZJW.js} +1 -1
  35. package/dist-cli/chunks/{chunk-Q6DGMQ2V.js → chunk-KQN7OUQ6.js} +2 -2
  36. package/dist-cli/chunks/{chunk-33R6QMNO.js → chunk-L53QRCQZ.js} +1 -1
  37. package/dist-cli/chunks/{chunk-MBGNDWGV.js → chunk-LAOTVMTO.js} +2 -2
  38. package/dist-cli/chunks/chunk-LJLRHMLK.js +1 -0
  39. package/dist-cli/chunks/{chunk-5JOYGXCS.js → chunk-LXZK2TIS.js} +2 -2
  40. package/dist-cli/chunks/{chunk-HZVPHAJX.js → chunk-MQOJIYEY.js} +9 -9
  41. package/dist-cli/chunks/{chunk-UNJTJDZZ.js → chunk-NLYIKZIF.js} +2 -2
  42. package/dist-cli/chunks/{chunk-4UA6P3T2.js → chunk-Q26NNL4G.js} +1 -1
  43. package/dist-cli/chunks/{chunk-BR6QRN7U.js → chunk-QLGR4M5H.js} +2 -2
  44. package/dist-cli/chunks/{chunk-OXTFYLZJ.js → chunk-QWGMNIWG.js} +2 -2
  45. package/dist-cli/chunks/chunk-R3KU3IBN.js +117 -0
  46. package/dist-cli/chunks/{chunk-I5Y4IECP.js → chunk-SGBD3EAX.js} +3 -3
  47. package/dist-cli/chunks/{chunk-N7DDNZTO.js → chunk-UY6HKNEV.js} +1 -1
  48. package/dist-cli/chunks/{chunk-OJFHAMXD.js → chunk-WSISSPE3.js} +2 -2
  49. package/dist-cli/chunks/{chunk-G2QUPNHI.js → chunk-WW4G4D4A.js} +2 -2
  50. package/dist-cli/chunks/{chunk-ECIRRKKE.js → chunk-Y4ENWAOJ.js} +2 -2
  51. package/dist-cli/chunks/{compat-BA6HDW3Q.js → compat-GWIATWPP.js} +3 -3
  52. package/dist-cli/chunks/{config-QQ63IS5P.js → config-OXHJXY6N.js} +2 -2
  53. package/dist-cli/chunks/control-HJ2RPHYO.js +2 -0
  54. package/dist-cli/chunks/{cpu-profile-3DDV2SYN.js → cpu-profile-MBYPGUJH.js} +2 -2
  55. package/dist-cli/chunks/{daemon-RYSVONEV.js → daemon-3N3QWMFU.js} +2 -2
  56. package/dist-cli/chunks/{debug-YXE4XZLP.js → debug-POCRM56I.js} +3 -3
  57. package/dist-cli/chunks/demo-app-registry-XABEINTD.js +2 -0
  58. package/dist-cli/chunks/{detox-2UI3EAXA.js → detox-4NXKQ2CS.js} +2 -2
  59. package/dist-cli/chunks/{device-UGDJBZKD.js → device-DURJHKK5.js} +2 -2
  60. package/dist-cli/chunks/{diagnose-IRDRYKYZ.js → diagnose-IMXDGRVA.js} +2 -2
  61. package/dist-cli/chunks/drivers-VXSNI7K2.js +2 -0
  62. package/dist-cli/chunks/{electron-ZCYWIZAE.js → electron-NGWA52N6.js} +3 -3
  63. package/dist-cli/chunks/flow-TCG5XPDK.js +2 -0
  64. package/dist-cli/chunks/{hints-OWOBCWJH.js → hints-5UNZ7BR2.js} +2 -2
  65. package/dist-cli/chunks/{home-paths-5QMCFTBP.js → home-paths-TENEFM4L.js} +2 -2
  66. package/dist-cli/chunks/{inspect-K4VXPM5J.js → inspect-IWMH6MUT.js} +3 -3
  67. package/dist-cli/chunks/install-IKBAY4PQ.js +2 -0
  68. package/dist-cli/chunks/{install-desktop-U3723T63.js → install-desktop-ABAWCLFJ.js} +3 -3
  69. package/dist-cli/chunks/{keys-IFVXJ7C2.js → keys-NET26VLH.js} +2 -2
  70. package/dist-cli/chunks/{launch-NDGFTRZ5.js → launch-TKIA4RC4.js} +3 -3
  71. package/dist-cli/chunks/{login-KEU6RAV3.js → login-AWT3GU5M.js} +4 -4
  72. package/dist-cli/chunks/{logout-KNFLP5OQ.js → logout-R2RUNXHO.js} +2 -2
  73. package/dist-cli/chunks/{maestro-GBUBLS6L.js → maestro-552237HC.js} +2 -2
  74. package/dist-cli/chunks/{preview-7OKMPPMN.js → preview-GKIGPZUO.js} +2 -2
  75. package/dist-cli/chunks/{profile-CHKDPGJF.js → profile-U64JPCPD.js} +2 -2
  76. package/dist-cli/chunks/{react-GYI5VITJ.js → react-FWSV5JH2.js} +2 -2
  77. package/dist-cli/chunks/record-FLWDPJIP.js +7 -0
  78. package/dist-cli/chunks/runtime-AGNC2TK6.js +2 -0
  79. package/dist-cli/chunks/{runtime-delivery-JCAY2QVQ.js → runtime-delivery-22PV7UED.js} +2 -2
  80. package/dist-cli/chunks/{screenshot-3T6MNPH7.js → screenshot-4P3TL7CN.js} +2 -2
  81. package/dist-cli/chunks/{screenshot-mode-BUGXY7SQ.js → screenshot-mode-GX3Q3IZ6.js} +2 -2
  82. package/dist-cli/chunks/{screenshots-EMTXGI2Q.js → screenshots-5HSLPDWZ.js} +2 -2
  83. package/dist-cli/chunks/{server-46H2M4TF.js → server-Q3ZD4BEF.js} +2 -2
  84. package/dist-cli/chunks/setup-repo-NQVN5PK7.js +2 -0
  85. package/dist-cli/chunks/{skills-2RP2CFPD.js → skills-M2CWX5ZC.js} +2 -2
  86. package/dist-cli/chunks/{start-QFREXALP.js → start-24EAF2KS.js} +4 -4
  87. package/dist-cli/chunks/store-GI3SJOKH.js +2 -0
  88. package/dist-cli/chunks/telemetry-73Z4FAUH.js +2 -0
  89. package/dist-cli/chunks/{test-LI4PGGTE.js → test-AJBULIVR.js} +3 -3
  90. package/dist-cli/chunks/{three-mode-PKINB46T.js → three-mode-JBZSQQIQ.js} +2 -2
  91. package/dist-cli/chunks/{timeline-5AREJDL5.js → timeline-VVGWQSVU.js} +2 -2
  92. package/dist-cli/chunks/{upgrade-W2AGIOSC.js → upgrade-IOGHQT7J.js} +2 -2
  93. package/dist-cli/chunks/upload-Z4PPGOX6.js +2 -0
  94. package/dist-cli/chunks/{web-JM6WDSZQ.js → web-XIMVN6KZ.js} +2 -2
  95. package/dist-cli/chunks/{what-happened-SVCASJKT.js → what-happened-STVD3KZ2.js} +2 -2
  96. package/dist-cli/chunks/{whoami-5NJ6IPLT.js → whoami-L62IGS4U.js} +2 -2
  97. package/dist-lib/agent-daemon-client.cjs +1 -1
  98. package/dist-lib/agent-events.cjs +1 -1
  99. package/dist-lib/agent-sessions.cjs +1 -1
  100. package/dist-lib/attached-projects.cjs +1 -1
  101. package/dist-lib/auth/shared-session.cjs +1 -1
  102. package/dist-lib/backend-origin.cjs +1 -1
  103. package/dist-lib/bridge-constants.cjs +1 -1
  104. package/dist-lib/cli-constants.cjs +1 -1
  105. package/dist-lib/config.cjs +1 -1
  106. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  107. package/dist-lib/home-paths.cjs +1 -1
  108. package/dist-lib/host/bridge-host.cjs +1 -1
  109. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  110. package/dist-lib/index.cjs +1 -1
  111. package/dist-lib/metro.cjs +1 -1
  112. package/dist-lib/profiles.cjs +1 -1
  113. package/dist-lib/render-mode.cjs +1 -1
  114. package/dist-lib/vite-base.cjs +1 -1
  115. package/dist-lib/vite.cjs +1 -1
  116. package/package.json +1 -1
  117. package/dist-cli/chunks/auto-bootstrap-4KQT4TCR.js +0 -2
  118. package/dist-cli/chunks/beta-3S56PNSS.js +0 -2
  119. package/dist-cli/chunks/chunk-334L67M2.js +0 -2
  120. package/dist-cli/chunks/chunk-6PLNIOJP.js +0 -17
  121. package/dist-cli/chunks/chunk-ASSV2FFC.js +0 -1
  122. package/dist-cli/chunks/chunk-WN6YFWS5.js +0 -117
  123. package/dist-cli/chunks/chunk-YFX2XIR4.js +0 -1
  124. package/dist-cli/chunks/chunk-YKFRPIVC.js +0 -1
  125. package/dist-cli/chunks/chunk-ZPURE62G.js +0 -1
  126. package/dist-cli/chunks/control-GNJNC524.js +0 -2
  127. package/dist-cli/chunks/demo-app-registry-3VFEW4NV.js +0 -2
  128. package/dist-cli/chunks/drivers-EAONIWG3.js +0 -2
  129. package/dist-cli/chunks/flow-ECSMFTKS.js +0 -2
  130. package/dist-cli/chunks/install-YFE7C2NU.js +0 -2
  131. package/dist-cli/chunks/record-DQR2TEIF.js +0 -45
  132. package/dist-cli/chunks/runtime-XXNKSGFE.js +0 -2
  133. package/dist-cli/chunks/setup-repo-P4LCPAF6.js +0 -2
  134. package/dist-cli/chunks/store-GH77HGEB.js +0 -2
  135. package/dist-cli/chunks/telemetry-WC5J4TE5.js +0 -2
  136. package/dist-cli/chunks/upload-RLS6KTG6.js +0 -2
package/dist-cli/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
- import{a as E}from"./chunks/chunk-HAVQS3PI.js";import{a as l}from"./chunks/chunk-5JOYGXCS.js";import{a as A,b as k,c as S,d as C,e as u,f as T}from"./chunks/chunk-WN6YFWS5.js";import{a as p}from"./chunks/chunk-334L67M2.js";import{a as v,d as _}from"./chunks/chunk-TBIGAH3T.js";import"./chunks/chunk-33R6QMNO.js";import"./chunks/chunk-ASSV2FFC.js";import{z as L}from"./chunks/chunk-J3JJRXIP.js";import"./chunks/chunk-N7DDNZTO.js";function R(){let t=L();return`sootsim CLI v${E()} \xB7 runtime ${t?`v${t}`:"not installed"}`}function g(){let t=k({bridgePort:7668,defaultShellUrl:p},l()),e=`
2
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
+ import{a as E}from"./chunks/chunk-CZZDYQBA.js";import{a as l}from"./chunks/chunk-LXZK2TIS.js";import{a as A,b as k,c as S,d as C,e as u,f as T}from"./chunks/chunk-R3KU3IBN.js";import{a as p}from"./chunks/chunk-2XCCV7J3.js";import{a as v,d as _}from"./chunks/chunk-J6HT2ZJW.js";import"./chunks/chunk-L53QRCQZ.js";import"./chunks/chunk-EZGUKWD5.js";import{z as L}from"./chunks/chunk-6MYXKMLG.js";import"./chunks/chunk-UY6HKNEV.js";function R(){let t=L();return`sootsim CLI v${E()} \xB7 runtime ${t?`v${t}`:"not installed"}`}function g(){let t=k({bridgePort:7668,defaultShellUrl:p},l()),e=`
4
4
  ${_}
5
5
  `;console.log(`${R()}
6
6
  ${e}${t}
@@ -21,11 +21,11 @@ clear the shared desktop session used by the CLI and electron.
21
21
 
22
22
  show the current shared desktop account used by the CLI and electron.
23
23
  `);return}let e=S(t,{bridgePort:7668,defaultShellUrl:p});if(!e){console.log(`unknown command: ${t}`);return}console.log(`${e}
24
- `)}function x(t){let e=t instanceof Error?t.message:String(t);(/^command timed out after \d+s$/.test(e)||e.startsWith("sim disconnected:")||e.startsWith("bridge never reconnected")||e.startsWith("no sim connected with id ")||e.startsWith("sootsim bridge daemon is not running")||e.startsWith("refusing to install the persistent sootsim daemon"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${e}
24
+ `)}function x(t){let e=t instanceof Error?t.message:String(t);(/^command timed out after \d+s$/.test(e)||e.startsWith("sim disconnected:")||e.startsWith("bridge never reconnected")||e.startsWith("no sim connected with id ")||e.startsWith("could not connect to ws://")||e.startsWith("sootsim bridge daemon is not running")||e.startsWith("refusing to install the persistent sootsim daemon"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${e}
25
25
  `),process.exit(1)),t instanceof Error&&t.stack?process.stderr.write(`${t.stack}
26
26
  `):process.stderr.write(`${e}
27
27
  `),process.exit(1)}process.on("unhandledRejection",x);process.on("uncaughtException",x);var M=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,P=new Set(["preview","electron","install-desktop"]);function F(t){!M||!P.has(t)||(process.stderr.write(` sootsim ${t} isn't available in the standalone binary \u2014
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-WC5J4TE5.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-WC5J4TE5.js");await e(),process.exit(t)}if(o.version){let{readFileSync:t}=await import("fs"),{fileURLToPath:e}=await import("url"),i=e(import.meta.resolve("sootsim/package.json")),m=JSON.parse(t(i,"utf8")),{IS_BETA:I,BETA_LABEL:y}=await import("./chunks/beta-3S56PNSS.js"),D=I?` \xB7 ${y}`:"";console.log(`sootsim v${m.version}${D}`);let{readActiveRuntime:N}=await import("./chunks/home-paths-5QMCFTBP.js"),b=N();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,s=o.verbose,d=o.globalFlags.device,f=o.globalFlags.theme,H=o.globalFlags.driver,Q=o.globalFlags.headless===!0,$=o.globalFlags.sim,n=$?["--sim",$,...o.commandArgs]:o.commandArgs;if(d||f){let{settingsStore:t}=await import("./chunks/store-GH77HGEB.js"),e={};d&&(e.deviceModel=d),f&&(e.colorScheme=f),t.apply(e)}if(!o.command&&o.commandArgs.length===0){let{runStart:t}=await import("./chunks/start-QFREXALP.js");await t([],{port:a}),await c(0)}var r=o.command??"";r||(g(),await c(o.commandArgs.length>0?1: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?O(r)&&await c(0):(h(t&&e?e:r),await c(0)))}F(r);if(C.has(r)){let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-4KQT4TCR.js"),i=e(n,a);await t(i);let{runInspect:m}=await import("./chunks/inspect-K4VXPM5J.js");await m([r,...n],{port:i,verbose:s})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-NZTYFTTT.js");await t(o.commandArgs);break}case"flow":{let{runFlow:t}=await import("./chunks/flow-ECSMFTKS.js"),e=await t(n);process.exit(typeof e=="number"?e:0)}case"test":{let{runTest:t}=await import("./chunks/test-LI4PGGTE.js");await t(o.commandArgs,{port:a,verbose:s});break}case"detox":{let{runDetox:t}=await import("./chunks/detox-2UI3EAXA.js");await t(o.commandArgs,{port:a,verbose:s});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-GBUBLS6L.js"),e=await t(o.commandArgs,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"preview":{let{runPreview:t}=await import("./chunks/preview-7OKMPPMN.js");await t(o.commandArgs,{port:a,verbose:s});break}case"record":{let{runRecord:t}=await import("./chunks/record-DQR2TEIF.js");await t(n,{port:a,verbose:s});break}case"profile":{let{runProfile:t}=await import("./chunks/profile-CHKDPGJF.js"),e=await t(o.commandArgs,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"cpu-profile":{let{runCpuProfile:t}=await import("./chunks/cpu-profile-3DDV2SYN.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"react":{let{runReact:t}=await import("./chunks/react-GYI5VITJ.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"screenshot":{let{runScreenshot:t}=await import("./chunks/screenshot-3T6MNPH7.js");await t(n,{port:a,verbose:s});break}case"screenshots":{let{runScreenshots:t}=await import("./chunks/screenshots-EMTXGI2Q.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"screenshot-mode":{let{runScreenshotMode:t}=await import("./chunks/screenshot-mode-BUGXY7SQ.js");await t(o.commandArgs,{port:a,verbose:s});break}case"three-mode":case"3d-mode":{let{runThreeMode:t}=await import("./chunks/three-mode-PKINB46T.js");await t(o.commandArgs,{port:a,verbose:s});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-K4VXPM5J.js");await t(n,{port:a,verbose:s});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-YXE4XZLP.js");await t(n,{port:a,verbose:s});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-5AREJDL5.js");await t(n,{port:a,verbose:s});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-SVCASJKT.js");await t(n,{port:a,verbose:s});break}case"diagnose":{let{runDiagnose:t}=await import("./chunks/diagnose-IRDRYKYZ.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"open":{let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-4KQT4TCR.js"),i=e(n,a);await t(i);let{runOpenCommand:m}=await import("./chunks/control-GNJNC524.js");await m(n,{port:i});break}case"use":case"focus":{let{runUseCommand:t}=await import("./chunks/control-GNJNC524.js");await t(n,{port:a});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-GNJNC524.js");await t(n,{port:a});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-GNJNC524.js");await t(n,{port:a});break}case"config":{let{runConfig:t}=await import("./chunks/config-QQ63IS5P.js");await t(o.commandArgs);break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-UGDJBZKD.js");await t(n,{port:a});break}case"scan":case"compat":{let{runCompat:t}=await import("./chunks/compat-BA6HDW3Q.js");await t(o.commandArgs);break}case"electron":{let{runElectron:t}=await import("./chunks/electron-ZCYWIZAE.js");await t(o.commandArgs,{port:a,device:d,driver:H});break}case"login":{let{runLogin:t}=await import("./chunks/login-KEU6RAV3.js");await t(o.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-KNFLP5OQ.js");await t();break}case"whoami":{let{runWhoami:t}=await import("./chunks/whoami-5NJ6IPLT.js");await t();break}case"keys":{let{runKeys:t}=await import("./chunks/keys-IFVXJ7C2.js");await t(o.commandArgs);break}case"setup-repo":{let{runSetupRepo:t}=await import("./chunks/setup-repo-P4LCPAF6.js");await t(o.commandArgs);break}case"install":{let{runInstall:t}=await import("./chunks/install-YFE7C2NU.js");await t(o.commandArgs);break}case"install-desktop":{let{runInstallDesktop:t}=await import("./chunks/install-desktop-U3723T63.js");await t(o.commandArgs);break}case"server":{let{runServer:t}=await import("./chunks/server-46H2M4TF.js");await t(o.commandArgs,{port:a});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-RYSVONEV.js");await t(o.commandArgs,{port:a});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-XXNKSGFE.js");await t(o.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-W2AGIOSC.js");await t(o.commandArgs);break}case"launch":{let{runLaunch:t}=await import("./chunks/launch-NDGFTRZ5.js");await t(o.commandArgs);break}case"start":{let{runStart:t}=await import("./chunks/start-QFREXALP.js");await t(o.commandArgs,{port:a});break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-7BJ2ZP22.js"),e=await t(o.commandArgs);process.exit(e)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-OXBYRJVT.js"),e=await t(o.commandArgs);process.exit(e)}case"skills":{let{runSkills:t}=await import("./chunks/skills-2RP2CFPD.js");await t(o.commandArgs);break}case"upload":{let{runUpload:t}=await import("./chunks/upload-RLS6KTG6.js");await t(o.commandArgs,{port:a,verbose:s});break}case"hints":{let{runHints:t}=await import("./chunks/hints-OWOBCWJH.js");t(o.commandArgs);break}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
31
+ `),process.exit(1))}var o=T(process.argv);{let{trackCliEvent:t}=await import("./chunks/telemetry-73Z4FAUH.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-73Z4FAUH.js");await e(),process.exit(t)}if(o.version){let{readFileSync:t}=await import("fs"),{fileURLToPath:e}=await import("url"),i=e(import.meta.resolve("sootsim/package.json")),m=JSON.parse(t(i,"utf8")),{IS_BETA:I,BETA_LABEL:y}=await import("./chunks/beta-2LIEPFEJ.js"),D=I?` \xB7 ${y}`:"";console.log(`sootsim v${m.version}${D}`);let{readActiveRuntime:N}=await import("./chunks/home-paths-TENEFM4L.js"),b=N();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,s=o.verbose,d=o.globalFlags.device,f=o.globalFlags.theme,H=o.globalFlags.driver,Q=o.globalFlags.headless===!0,$=o.globalFlags.sim,n=$?["--sim",$,...o.commandArgs]:o.commandArgs;if(d||f){let{settingsStore:t}=await import("./chunks/store-GI3SJOKH.js"),e={};d&&(e.deviceModel=d),f&&(e.colorScheme=f),t.apply(e)}if(!o.command&&o.commandArgs.length===0){let{runStart:t}=await import("./chunks/start-24EAF2KS.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?O(r)&&await c(0):(h(t&&e?e:r),await c(0)))}F(r);if(C.has(r)){let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-7BJDOYUU.js"),i=e(n,a);await t(i);let{runInspect:m}=await import("./chunks/inspect-IWMH6MUT.js");await m([r,...n],{port:i,verbose:s})}else switch(r){case"assert":{let{runAssert:t}=await import("./chunks/assert-7GHUOGLI.js");await t(o.commandArgs);break}case"flow":{let{runFlow:t}=await import("./chunks/flow-TCG5XPDK.js"),e=await t(n);process.exit(typeof e=="number"?e:0)}case"test":{let{runTest:t}=await import("./chunks/test-AJBULIVR.js");await t(o.commandArgs,{port:a,verbose:s});break}case"detox":{let{runDetox:t}=await import("./chunks/detox-4NXKQ2CS.js");await t(o.commandArgs,{port:a,verbose:s});break}case"maestro":{let{runMaestro:t}=await import("./chunks/maestro-552237HC.js"),e=await t(o.commandArgs,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"preview":{let{runPreview:t}=await import("./chunks/preview-GKIGPZUO.js");await t(o.commandArgs,{port:a,verbose:s});break}case"record":{let{runRecord:t}=await import("./chunks/record-FLWDPJIP.js");await t(n,{port:a,verbose:s});break}case"profile":{let{runProfile:t}=await import("./chunks/profile-U64JPCPD.js"),e=await t(o.commandArgs,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"cpu-profile":{let{runCpuProfile:t}=await import("./chunks/cpu-profile-MBYPGUJH.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"react":{let{runReact:t}=await import("./chunks/react-FWSV5JH2.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"screenshot":{let{runScreenshot:t}=await import("./chunks/screenshot-4P3TL7CN.js");await t(n,{port:a,verbose:s});break}case"screenshots":{let{runScreenshots:t}=await import("./chunks/screenshots-5HSLPDWZ.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"screenshot-mode":{let{runScreenshotMode:t}=await import("./chunks/screenshot-mode-GX3Q3IZ6.js");await t(o.commandArgs,{port:a,verbose:s});break}case"three-mode":case"3d-mode":{let{runThreeMode:t}=await import("./chunks/three-mode-JBZSQQIQ.js");await t(o.commandArgs,{port:a,verbose:s});break}case"inspect":{let{runInspect:t}=await import("./chunks/inspect-IWMH6MUT.js");await t(n,{port:a,verbose:s});break}case"debug":{let{runDebug:t}=await import("./chunks/debug-POCRM56I.js");await t(n,{port:a,verbose:s});break}case"timeline":{let{runTimeline:t}=await import("./chunks/timeline-VVGWQSVU.js");await t(n,{port:a,verbose:s});break}case"what-happened":{let{runWhatHappened:t}=await import("./chunks/what-happened-STVD3KZ2.js");await t(n,{port:a,verbose:s});break}case"diagnose":{let{runDiagnose:t}=await import("./chunks/diagnose-IMXDGRVA.js"),e=await t(n,{port:a,verbose:s});process.exit(typeof e=="number"?e:0)}case"open":{let{ensureSootsimReady:t,resolveBootstrapPort:e}=await import("./chunks/auto-bootstrap-7BJDOYUU.js"),i=e(n,a);await t(i);let{runOpenCommand:m}=await import("./chunks/control-HJ2RPHYO.js");await m(n,{port:i});break}case"use":case"focus":{let{runUseCommand:t}=await import("./chunks/control-HJ2RPHYO.js");await t(n,{port:a});break}case"claim":{let{runClaimCommand:t}=await import("./chunks/control-HJ2RPHYO.js");await t(n,{port:a});break}case"close":{let{runCloseCommand:t}=await import("./chunks/control-HJ2RPHYO.js");await t(n,{port:a});break}case"config":{let{runConfig:t}=await import("./chunks/config-OXHJXY6N.js");await t(o.commandArgs);break}case"device":{let{runDeviceCommand:t}=await import("./chunks/device-DURJHKK5.js");await t(n,{port:a});break}case"scan":case"compat":{let{runCompat:t}=await import("./chunks/compat-GWIATWPP.js");await t(o.commandArgs);break}case"electron":{let{runElectron:t}=await import("./chunks/electron-NGWA52N6.js");await t(o.commandArgs,{port:a,device:d,driver:H});break}case"login":{let{runLogin:t}=await import("./chunks/login-AWT3GU5M.js");await t(o.commandArgs);break}case"logout":{let{runLogout:t}=await import("./chunks/logout-R2RUNXHO.js");await t();break}case"whoami":{let{runWhoami:t}=await import("./chunks/whoami-L62IGS4U.js");await t();break}case"keys":{let{runKeys:t}=await import("./chunks/keys-NET26VLH.js");await t(o.commandArgs);break}case"setup-repo":{let{runSetupRepo:t}=await import("./chunks/setup-repo-NQVN5PK7.js");await t(o.commandArgs);break}case"install":{let{runInstall:t}=await import("./chunks/install-IKBAY4PQ.js");await t(o.commandArgs);break}case"install-desktop":{let{runInstallDesktop:t}=await import("./chunks/install-desktop-ABAWCLFJ.js");await t(o.commandArgs);break}case"server":{let{runServer:t}=await import("./chunks/server-Q3ZD4BEF.js");await t(o.commandArgs,{port:a});break}case"daemon":{let{runDaemon:t}=await import("./chunks/daemon-3N3QWMFU.js");await t(o.commandArgs,{port:a});break}case"runtime":{let{runRuntime:t}=await import("./chunks/runtime-AGNC2TK6.js");await t(o.commandArgs);break}case"upgrade":{let{runUpgrade:t}=await import("./chunks/upgrade-IOGHQT7J.js");await t(o.commandArgs);break}case"launch":{let{runLaunch:t}=await import("./chunks/launch-TKIA4RC4.js");await t(o.commandArgs);break}case"start":{let{runStart:t}=await import("./chunks/start-24EAF2KS.js");await t(o.commandArgs,{port:a});break}case"agent":{let{runAgentCommand:t}=await import("./chunks/agent-4BBZUWD2.js"),e=await t(o.commandArgs);process.exit(e)}case"agent-wrapper":{let{runAgentWrapper:t}=await import("./chunks/agent-wrapper-TA5GG3MV.js"),e=await t(o.commandArgs);process.exit(e)}case"skills":{let{runSkills:t}=await import("./chunks/skills-M2CWX5ZC.js");await t(o.commandArgs);break}case"upload":{let{runUpload:t}=await import("./chunks/upload-Z4PPGOX6.js");await t(o.commandArgs,{port:a,verbose:s});break}case"hints":{let{runHints:t}=await import("./chunks/hints-5UNZ7BR2.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.41 | (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-LMNB7NYI.js";import"./chunk-2T6UOHPO.js";import"./chunk-ASSV2FFC.js";import"./chunk-J3JJRXIP.js";import"./chunk-N7DDNZTO.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}
1
+ /*! sootsim v0.1.42 | (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-DNSKIJSB.js";import"./chunk-FDB3P2GV.js";import"./chunk-EZGUKWD5.js";import"./chunk-6MYXKMLG.js";import"./chunk-UY6HKNEV.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.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as M}from"./chunk-2T6UOHPO.js";import"./chunk-N7DDNZTO.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)+`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as M}from"./chunk-FDB3P2GV.js";import"./chunk-UY6HKNEV.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.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-N7DDNZTO.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(`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-UY6HKNEV.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.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c,d}from"./chunk-EDXBJUHH.js";import"./chunk-76WF7UIG.js";import"./chunk-D5TKAFJ3.js";import"./chunk-EZGUKWD5.js";import"./chunk-6MYXKMLG.js";import"./chunk-UY6HKNEV.js";export{c as ensureDaemonRunning,a as ensureRuntimeInstalled,d as ensureSootsimReady,b as resolveBootstrapPort};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c,d,e}from"./chunk-J6HT2ZJW.js";import"./chunk-UY6HKNEV.js";export{e as BETA_ASK_HEADLINE,c as BETA_LABEL,d as BETA_TAGLINE,b as BETA_VERSION_TARGET,a as IS_BETA};
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as o}from"./chunk-S3SQITOO.js";import{l as s}from"./chunk-J3JJRXIP.js";import{chmodSync as c,existsSync as a,mkdirSync as l,readFileSync as d,rmSync as p,writeFileSync as h}from"node:fs";import{dirname as g,join as f,resolve as k}from"node:path";function i(){return f(s(),"credentials.json")}function _(){let t=i();if(!a(t))return null;try{let e=JSON.parse(d(t,"utf8"));return e.version!==1||typeof e.apiKey!="string"||!e.apiKey.startsWith("sk_sootsim_")?null:e.apiKey}catch{return null}}function T(t){if(!t.startsWith("sk_sootsim_"))throw new Error("api key must start with sk_sootsim_");let e=i();l(g(k(e)),{recursive:!0}),h(e,JSON.stringify({version:1,apiKey:t,savedAt:new Date().toISOString()},null,2)+`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as o}from"./chunk-ITQGNQE3.js";import{l as s}from"./chunk-6MYXKMLG.js";import{chmodSync as c,existsSync as a,mkdirSync as l,readFileSync as d,rmSync as p,writeFileSync as h}from"node:fs";import{dirname as g,join as f,resolve as k}from"node:path";function i(){return f(s(),"credentials.json")}function _(){let t=i();if(!a(t))return null;try{let e=JSON.parse(d(t,"utf8"));return e.version!==1||typeof e.apiKey!="string"||!e.apiKey.startsWith("sk_sootsim_")?null:e.apiKey}catch{return null}}function T(t){if(!t.startsWith("sk_sootsim_"))throw new Error("api key must start with sk_sootsim_");let e=i();l(g(k(e)),{recursive:!0}),h(e,JSON.stringify({version:1,apiKey:t,savedAt:new Date().toISOString()},null,2)+`
3
3
  `);try{c(e,384)}catch{}}function K(){p(i(),{force:!0})}var m=["ghs_","ghp_","gho_","ghu_","github_pat_"];function y(t){return!!(t&&t.length>=20&&t.length<=256&&m.some(e=>t.startsWith(e)))}function S(){let t=process.env.SOOT_INSTALLATION_TOKEN?.trim(),e=process.env.GITHUB_TOKEN?.trim(),r=t||e;if(!y(r))return null;let n=(process.env.SOOT_REPO||process.env.GITHUB_REPOSITORY||"").trim();if(!n)return null;let u=(process.env.SOOT_INSTALLATION_ID||process.env.GITHUB_APP_INSTALLATION_ID||"").trim();return{kind:"github",token:r,repoId:n,installationId:u||null,source:t?"soot-runner":"github-actions"}}function b(){let t=process.env.SOOTSIM_API_KEY?.trim();if(t&&t.startsWith("sk_sootsim_"))return{kind:"api-key",secret:t,source:"env"};let e=S();if(e)return e;let r=_();if(r)return{kind:"api-key",secret:r,source:"file"};let n=o();return n?.token?{kind:"session",token:n.token,origin:n.origin}:null}function E(t){return t.kind==="api-key"?`Bearer ${t.secret}`:`Bearer ${t.token}`}export{_ as a,T as b,K as c,b as d,E as e};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ var t="http://localhost:5173/";export{t as a};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var i="sootsimConfig";function e(n){return!!n&&Object.keys(n).length>0}function s(n){return n?e(n.modules)||e(n.turboModules)||e(n.nativeModules)||e(n.env)||e(n.settings)||e(n.initialState):!1}function u(n,o){let t=new URL(n);return s(o)?t.searchParams.set(i,JSON.stringify(o)):t.searchParams.delete(i),t.toString()}var g="/index.bundle?platform=ios&dev=true&hot=true&minify=false";function r(n){return/^https?:\/\//i.test(n)}function a(n){return n.endsWith(".bundle")}function l(n){try{let o=r(n),t=new URL(n,"http://soot.local");return t.pathname=t.pathname.replace(/\.\.bundle$/,".bundle"),a(t.pathname)?(t.searchParams.delete("transform.bytecode"),o?t.toString():`${t.pathname}${t.search}${t.hash}`):n}catch{return n}}export{u as a,g as b,l as c};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as s}from"./chunk-S3SQITOO.js";import{w as o}from"./chunk-J3JJRXIP.js";function u(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!o()}function a(){if(u())return null;let e=process.env.SOOT_POSTHOG_API_KEY||process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let t=process.env.SOOT_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:t.replace(/\/+$/,"")}}function c(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:"anonymous-cli":"anonymous-cli"}function p(e){let t=e.identity??{},n={$lib:"soot-cli",source:t.source??"cli",...e.properties};return t.userId&&(n.userId=t.userId),t.repoId&&(n.repoId=t.repoId),t.installationId!=null&&(n.installationId=String(t.installationId)),t.shareId&&(n.shareId=t.shareId),t.plan&&(n.plan=t.plan),{event:e.event,distinct_id:c(t),properties:n,timestamp:new Date().toISOString()}}var r=[],l=!1;async function i(){if(r.length===0)return;let e=a();if(!e){r.length=0;return}let t=r.splice(0,r.length).map(p);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:t}),signal:AbortSignal.timeout(2e3)})}catch{}}function d(){l||(l=!0,process.on("beforeExit",()=>{i()}),process.on("exit",()=>{i()}))}function h(e){if(u())return;d();let t=null;try{t=s()?.user?.id??null}catch{t=null}r.push({...e,identity:{source:"cli",userId:t,...e.identity}})}async function g(){await i()}export{h as a,g as b};
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as s}from"./chunk-ITQGNQE3.js";import{w as o}from"./chunk-6MYXKMLG.js";function u(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!o()}function a(){if(u())return null;let e=process.env.SOOT_POSTHOG_API_KEY||process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let t=process.env.SOOT_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:t.replace(/\/+$/,"")}}function c(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:"anonymous-cli":"anonymous-cli"}function p(e){let t=e.identity??{},n={$lib:"soot-cli",source:t.source??"cli",...e.properties};return t.userId&&(n.userId=t.userId),t.repoId&&(n.repoId=t.repoId),t.installationId!=null&&(n.installationId=String(t.installationId)),t.shareId&&(n.shareId=t.shareId),t.plan&&(n.plan=t.plan),{event:e.event,distinct_id:c(t),properties:n,timestamp:new Date().toISOString()}}var r=[],l=!1;async function i(){if(r.length===0)return;let e=a();if(!e){r.length=0;return}let t=r.splice(0,r.length).map(p);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:t}),signal:AbortSignal.timeout(2e3)})}catch{}}function d(){l||(l=!0,process.on("beforeExit",()=>{i()}),process.on("exit",()=>{i()}))}function h(e){if(u())return;d();let t=null;try{t=s()?.user?.id??null}catch{t=null}r.push({...e,identity:{source:"cli",userId:t,...e.identity}})}async function g(){await i()}export{h as a,g as b};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{createInterface as i}from"readline";var c=()=>i({input:process.stdin,output:process.stdout});function s(o){return new Promise(n=>{let r=c();r.question(o,t=>{r.close(),n(t.trim())})})}async function u(o,n=!0){let r=n?"[Y/n]":"[y/N]";if(!process.stdin.isTTY)return console.log(` ${o} ${r} ${n?"y":"n"} (non-interactive)`),n;let t=await s(` ${o} ${r} `);return t===""?n:t.toLowerCase().startsWith("y")}async function a(o,n){console.log(`
3
3
  ${o}
4
4
  `);for(let e=0;e<n.length;e++)console.log(` ${e+1}. ${n[e]}`);if(console.log(),!process.stdin.isTTY)return console.log(` choose [1-${n.length}]: 1 (non-interactive)`),0;let r=await s(` choose [1-${n.length}]: `),t=parseInt(r,10);return t>=1&&t<=n.length?t-1:0}export{u as a,a as b};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  async function y(e){let t=await e.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof t=="number"?t:0}}async function p(e,t=5){let n=await e.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${t}))()`});return{depth:t,tree:n}}async function m(e){let t=await e.send({type:"evaluate",code:"window.location.href"});return{url:typeof t=="string"?t:""}}async function g(e,t){let n=`(async () => {
3
3
  const t = window.__sootsimTest
4
4
  const mainShell = window.SootSim?.bridges?.mainShell
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as bs}from"./chunk-N7DDNZTO.js";var oi=`(async () => {
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as bs}from"./chunk-UY6HKNEV.js";var oi=`(async () => {
3
3
  try { localStorage.clear() } catch {}
4
4
  try { sessionStorage.clear() } catch {}
5
5
  try {
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  function d(t){let e=t.displayUrl||t.url;return t.status!=null?`${t.method} ${e} -> ${t.status}${t.statusText?` ${t.statusText}`:""}`:t.error?`${t.method} ${e} -> ${t.error}`:`${t.method} ${e}`}async function u(t,e,...o){return t.send({type:"call",path:`__sootsimTest.${e}`,args:o})}async function g(t,e={}){let o=await t.send({type:"evaluate",code:"window.__sootsimConsole?.count?.() || { errors: 0, warnings: 0, total: 0 }"});if(!o||typeof o!="object")return;let n=Math.max(0,Number(o.errors)||0),s=Math.max(0,Number(o.warnings)||0);if(n===0&&s===0)return;let r=[];if(n>0&&r.push(`${n} console error${n===1?"":"s"}`),s>0&&r.push(`${s} console warning${s===1?"":"s"}`),console.log(`
3
3
  console: ${r.join(", ")}`),e.errorsCommand&&console.log(` inspect: ${e.errorsCommand}`),s>0&&e.warningsCommand&&console.log(` inspect: ${e.warningsCommand}`),!e.includeTail||n===0)return;let i=await t.send({type:"evaluate",code:"window.__sootsimConsole?.getErrors?.(5) || []"});if(!(!Array.isArray(i)||i.length===0)){console.log(`
4
4
  recent console errors:
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import r from"node:fs";import{homedir as O}from"node:os";import n from"node:path";var L="SOOTSIM_HOME",E="active",A="daemon.json",j="config.json",I=3e4;function c(){let e=process.env[L];return e&&e.length>0?n.resolve(e):n.join(O(),".sootsim")}function K(){if(process.env.SOOTSIM_FORCE_DAEMON_INSTALL==="1")return!1;let e=process.env.SOOTSIM_DEV;if(e==="1"||e==="true")return!0;if(e==="0"||e==="false")return!1;let t=process.argv[1];if(!t)return!1;try{return r.realpathSync(t).includes(`${n.sep}packages${n.sep}sootsim${n.sep}`)}catch{return!1}}function f(){return n.join(c(),"runtimes")}function _(e){return n.join(f(),e)}function D(){return n.join(f(),E)}function S(){return n.join(c(),"electron")}function U(){return n.join(S(),"userData")}function Y(e){return n.join(S(),e)}function N(){return n.join(c(),"profiles")}function F(){return n.join(c(),"daemon-app")}function T(){return n.join(F(),"SootSim Daemon.app")}function G(){return n.join(T(),"Contents","MacOS","sootsim-daemon")}function C(){return n.join(c(),"cache")}function p(){return n.join(c(),A)}function d(){return n.join(c(),j)}function v(){try{let e=r.readFileSync(d(),"utf8"),t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function M(e){y();let t=v(),s={...t,...e};e.settings&&typeof e.settings=="object"&&(s.settings={...t.settings&&typeof t.settings=="object"?t.settings:{},...e.settings});let u=`${d()}.tmp`;return r.writeFileSync(u,`${JSON.stringify(s,null,2)}
3
3
  `,"utf8"),r.renameSync(u,d()),s}function X(){return v().telemetry!==!1}function q(e){M({telemetry:e})}function y(){r.mkdirSync(c(),{recursive:!0}),r.mkdirSync(f(),{recursive:!0}),r.mkdirSync(S(),{recursive:!0}),r.mkdirSync(N(),{recursive:!0}),r.mkdirSync(C(),{recursive:!0})}function w(){try{let e=r.readFileSync(D(),"utf8").trim();return e.length>0?e:null}catch{return null}}function z(e){r.mkdirSync(f(),{recursive:!0}),r.writeFileSync(D(),`${e}
4
4
  `,"utf8")}function Q(){try{return r.readdirSync(f(),{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort(P)}catch{return[]}}function P(e,t){let s=i=>{let a=i.indexOf("-"),l=a>=0?i.slice(0,a):i,k=a>=0?i.slice(a+1):"",b=l.split(".").map(g=>Number.parseInt(g,10));return b.some(g=>!Number.isFinite(g))?[[Number.POSITIVE_INFINITY],i]:[b,k]},[u,o]=s(e),[x,m]=s(t);for(let i=0;i<Math.max(u.length,x.length);i++){let a=u[i]??0,l=x[i]??0;if(a!==l)return a-l}return o===m?0:o?m?o<m?-1:1:-1:1}function W(){let e=w();if(!e)return null;let t=_(e);try{if(r.statSync(t).isDirectory())return t}catch{}return null}var h=16*1024;function R(){try{let e=r.openSync(p(),"r");try{let t=Buffer.alloc(h),s=r.readSync(e,t,0,h,0),u=t.subarray(0,s).toString("utf8"),o=JSON.parse(u);return o&&o.schema===1&&typeof o.pid=="number"&&typeof o.bridgePort=="number"&&typeof o.runtimePort=="number"&&typeof o.startedAt=="number"&&typeof o.heartbeatAt=="number"?o:null}finally{r.closeSync(e)}}catch{return null}}function $(e,t=Date.now()){if(!e||t-e.heartbeatAt>I)return!1;try{return process.kill(e.pid,0),!0}catch{return!1}}function H(e){y();let t=`${p()}.tmp`;r.writeFileSync(t,`${JSON.stringify(e,null,2)}
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{execFileSync as h,spawn as g}from"child_process";import{existsSync as s,readdirSync as k}from"fs";import{dirname as m,join as l,resolve as a}from"path";import{fileURLToPath as v}from"url";var c;function p(){if(c!==void 0)return c;try{c=m(v(import.meta.resolve("sootsim-engine/package.json")))}catch{c=null}return c}var I="dev.sootsim.simulator";function x(){let n=p();if(!n)return null;let e=l(n,"dist-electron/main.cjs");if(!s(e))return null;let i=D(n);return i?{path:i,platform:process.platform,kind:"dev-electron",engineDir:n}:null}function b(){let n=p();return n?s(l(n,"src-electron/main.ts")):!1}function D(n){let e=n;for(let i=0;i<6;i++){let t=l(e,"node_modules/.bin/electron");if(s(t))return t;let r=m(e);if(r===e)break;e=r}return null}function C(){let n=p(),i=["/Applications/sootsim.app",a(process.env.HOME||"","Applications/sootsim.app"),...n?[a(n,"app/sootsim.app")]:[]].find(t=>s(t));if(i)return{path:i,platform:"darwin",kind:"mac-app"};try{let t=h("mdfind",[`kMDItemCFBundleIdentifier == "${I}"`],{encoding:"utf8",timeout:3e3}).trim();if(t)return{path:t.split(`
3
3
  `)[0],platform:"darwin",kind:"mac-app"}}catch{}return null}function f(n){if(!s(n))return null;let e=k(n).filter(i=>i.startsWith("sootsim")&&i.endsWith(".AppImage")).sort().reverse()[0];return e?l(n,e):null}function w(){let n=p(),i=[a(process.env.HOME||"","Applications/sootsim.AppImage"),a(process.env.HOME||"",".local/bin/sootsim.AppImage"),"/opt/sootsim/sootsim.AppImage","/opt/sootsim/sootsim",...n?[a(n,"app/sootsim.AppImage"),a(n,"release/linux-unpacked/sootsim")]:[]].find(r=>s(r));if(i)return{path:i,platform:"linux",kind:i.endsWith(".AppImage")?"linux-appimage":"linux-binary"};let t=n?f(a(n,"app"))||f(a(n,"release")):null;return t?{path:t,platform:"linux",kind:"linux-appimage"}:null}function A(){let n=x();if(n)return n;if(b()){let e=p(),i=l(e,"dist-electron/main.cjs");return s(i)?console.error(` no node_modules/.bin/electron found near ${e}. run \`bun install\`.`):console.error(` dist-electron/main.cjs missing in ${e}.
4
4
  run: bun run --cwd packages/sootsim-engine build:electron-main
@@ -0,0 +1,17 @@
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as P,c as v,e as A}from"./chunk-D5TKAFJ3.js";import{E as k,F as T}from"./chunk-6MYXKMLG.js";import{WebSocket as w}from"ws";function M(){let e=k();return e&&T(e)?e.bridgePort:7668}var h=class extends Error{lock;constructor(t,s){super(t),this.name="BridgeSimLockedError",this.lock=s}};function O(e){return e==="flag"?"via --sim":e==="saved"?"saved via `sootsim use`":"primary fallback \u2014 no sim pinned"}function N(e,t={}){let s=new Set,l=t.port??M(),c=t.commandTimeoutMs??15e3,o,g="none",b=new Set(t.stripBooleanFlags??[]),p=new Set(t.stripValueFlags??[]);for(let i=0;i<e.length;i++){let a=e[i];if(a==="--port"||a==="-p"){s.add(i),i+1<e.length&&(s.add(i+1),l=Number(e[i+1])),i++;continue}if(a.startsWith("--port=")){s.add(i),l=Number(a.slice(7));continue}if(a==="--timeout"){s.add(i),i+1<e.length&&(s.add(i+1),c=Number(e[i+1])),i++;continue}if(a==="--sim"){s.add(i),i+1<e.length&&(s.add(i+1),o=e[i+1]?.trim()||void 0,g="flag"),i++;continue}if(b.has(a)){s.add(i);continue}p.has(a)&&(s.add(i),i+1<e.length&&s.add(i+1),i++)}if(!o){let i=v();i&&(o=i.trim()||void 0,g="saved")}return{positional:e.filter((i,a)=>!s.has(a)),wsPort:l,simId:o,simIdSource:g,commandTimeoutMs:c}}function W(e,t={}){let s=1,l=t.commandTimeoutMs??15e3,c=new Map,o=new w(`ws://localhost:${e}`),g=t.simId?{key:`sim:${t.simId}`,source:"explicit-sim-id",stable:!0}:P(),b=new Promise((n,r)=>{o.on("open",()=>{try{o.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:g.key,cliIdentitySource:g.source,cliLabel:t.cliLabel}))}catch{}n()}),o.on("error",d=>{let u=d.message?`: ${d.message}`:"";r(new Error(`could not connect to ws://localhost:${e}${u}`))})}),p=!1,i=!1;function a(n,r){if(i||process.env.SOOTSIM_QUIET_TARGET_NOTICE==="1"||n.startsWith("bridge:")||n==="focus"||n==="close")return;i=!0;let d=r??"primary",u=O(r?t.simIdSource:"none");process.stderr.write(` \u2192 ${d} (${u})
3
+ `)}return o.on("message",n=>{let r;try{r=JSON.parse(n.toString())}catch{return}if(r.id===0)return;let d=c.get(r.id);d&&(c.delete(r.id),r.i>0&&!p&&(p=!0,process.stderr.write(`
4
+ \u26A0 ${r.i} other CLI identity/identities are driving this sim
5
+ taps, scrolls, and keyboard input from multiple agents will collide on
6
+ the same screen state (this is not a bridge throughput limit).
7
+ use \`sootsim open --new\` for an isolated sim per agent.
8
+
9
+ `)),r.error?r.o?d.reject(new h(r.error,r.o)):d.reject(new Error(r.error)):d.resolve(r.result))}),o.on("close",(n,r)=>{let d=r?.toString()||"connection closed";for(let[u,m]of c)c.delete(u),m.reject(new Error(`sim disconnected: ${d} (code ${n})`))}),{async send(n,r){let d=r?.timeoutMs??l,u=async m=>{await b;let f=s++;return new Promise((C,S)=>{let B=setTimeout(()=>{c.delete(f),S(new Error(`command timed out after ${Math.round(d/1e3)}s`))},d);c.set(f,{resolve:I=>{clearTimeout(B),C(I)},reject:I=>{clearTimeout(B),S(I)}});let y={...n,id:f};y.simId===void 0&&m&&(y.simId=m),a(n.type??"",y.simId),o.send(JSON.stringify(y))})};try{return await u(t.simId)}catch(m){let f=m instanceof Error?m.message:String(m);if(t.fallbackOnMissingSimId&&t.simId&&n.simId===void 0&&f===`no sim connected with id ${t.simId}`)return A(),process.stderr.write(` \u26A0 saved sim ${t.simId} is gone \u2014 falling back to primary
10
+ pin a sim with: sootsim use <sim>
11
+ `),i=!1,u(void 0);throw m}},async listSims(){let n=await this.send({type:"bridge:list-sims"});return Array.isArray(n)?n:[]},async openUrl(n,r={}){return this.send({type:"bridge:open",url:n,newWindow:r.newWindow===!0})},async focusSim(n){return this.send({type:"focus",simId:n})},async closeSim(n){return this.send({type:"close",simId:n})},async claim(n,r={}){return await this.send({type:"bridge:claim",simId:n,force:r.force===!0})},close(){try{o.readyState===w.OPEN&&o.send(JSON.stringify({type:"bridge:bye",id:0}))}catch{}o.close();let n=setTimeout(()=>{o.readyState!==w.CLOSED&&o.terminate()},250)}}}function R(e){return W(e.wsPort,{commandTimeoutMs:e.commandTimeoutMs,simId:e.simId,fallbackOnMissingSimId:e.simIdSource==="saved",simIdSource:e.simIdSource})}async function _(e){try{return await e.send({type:"evaluate",code:"document.hidden"})===!0?(process.stderr.write(`
12
+ \u26A0 target sim is hidden (document.hidden = true)
13
+ animations and rAF callbacks are throttled \u2014 coordinates may be wrong
14
+ and launch/transition animations will not complete.
15
+ bring the sim to the foreground or use: sootsim debug eval "window.focus()"
16
+
17
+ `),{hidden:!0,warned:!0}):{hidden:!1,warned:!1}}catch{return{hidden:!1,warned:!1}}}async function D(e,t,s={}){let l={type:"evaluate",code:t};return s.acquireLock&&(l.acquireLock=!0),e.send(l)}async function j(e,t,...s){return e.send({type:"call",path:t,args:s})}async function q(e,t,...s){return e.send({type:"call",path:t,args:s,acquireLock:!0})}export{M as a,h as b,N as c,W as d,R as e,_ as f,D as g,j as h,q as i};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as p}from"./chunk-Y2YNXUBT.js";import{d as c,e as l}from"./chunk-ANDSHXLU.js";import{a}from"./chunk-S3SQITOO.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as p}from"./chunk-BBRAYGDX.js";import{d as c,e as l}from"./chunk-2GKZS2ZZ.js";import{a}from"./chunk-ITQGNQE3.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
3
3
  sootsim ${e} needs auth before it can check recording access.
4
4
 
5
5
  pick one:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{d as Q,e as X}from"./chunk-ANDSHXLU.js";import{d as J}from"./chunk-C4AMFYK3.js";import{c as q,e as Y,g as w}from"./chunk-6PLNIOJP.js";import{a as D,b}from"./chunk-OPDPXAYA.js";import{a as K}from"./chunk-S3SQITOO.js";import{createHash as Te}from"crypto";import{readFileSync as te}from"fs";import{gzipSync as ne}from"zlib";function Z(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}function H(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(s)}}async function be(e){let t=H(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`PUT ${r.status}: ${s.slice(0,200)}`)}}async function we(e,t=8,r){let s=0,o=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;s<a;){let u=e[s++];await be(u),o++,r?.(o,a)}}))}function ve(e,t,r,s){let o=[];o.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let u=r.get(a.urlhash);u&&o.push({url:a.putUrl,contentType:a.contentType,bytes:u})}return e.events&&s?.eventsBytes&&o.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.flowVideo&&s?.videoBytes&&o.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&o.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),o}function Be(e){return e.replace(/\/+$/,"")}var _=class extends Error{constructor(r,s,o){super(r);this.status=s;this.phase=o;this.name="PresignedUploadError"}};async function ee(e){let t=Be(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-soot-admin-upload-bypass"]=e.adminBypassToken);let s=H(3e4,"init"),o;try{o=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!o.ok){let B=await o.text().catch(()=>"");throw new _(`init failed: ${o.status} ${B.slice(0,200)}`,o.status,"init")}let a=await o.json(),u=ve(a,e.bundleBytes,e.filesByHash,e.extras);await we(u,e.concurrency??8,e.onPutProgress);let y=H(3e4,"finalize"),p;try{p=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:y.signal})}finally{y.cancel()}if(!p.ok){let B=await p.text().catch(()=>"");throw new _(`finalize failed: ${p.status} ${B.slice(0,200)}`,p.status,"finalize")}let P=await p.json();return{init:a,finalize:P}}var ie=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",ae=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",M="http://localhost:3000";async function Ie(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${M}/api/preview/upload/init`,{method:"OPTIONS"});if(t.ok||t.status===204||t.status===405)return M}catch{}return ie}function v(e){return e.replace(/\/$/,"")}function Ue(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function Pe(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function Se(e,t){return t?v(t):process.env.SOOTSIM_PREVIEW_ORIGIN?v(process.env.SOOTSIM_PREVIEW_ORIGIN):Ue(e)?v(e):Pe(e)?v(ae):v(e)}function xe(){console.log(`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as Q,e as X}from"./chunk-2GKZS2ZZ.js";import{d as J}from"./chunk-DUVJOJTP.js";import{c as q,e as Y,g as w}from"./chunk-76WF7UIG.js";import{a as D,b}from"./chunk-4574AJAK.js";import{a as K}from"./chunk-ITQGNQE3.js";import{createHash as Te}from"crypto";import{readFileSync as te}from"fs";import{gzipSync as ne}from"zlib";function Z(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}function H(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(s)}}async function be(e){let t=H(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`PUT ${r.status}: ${s.slice(0,200)}`)}}async function we(e,t=8,r){let s=0,o=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;s<a;){let u=e[s++];await be(u),o++,r?.(o,a)}}))}function ve(e,t,r,s){let o=[];o.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let u=r.get(a.urlhash);u&&o.push({url:a.putUrl,contentType:a.contentType,bytes:u})}return e.events&&s?.eventsBytes&&o.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.flowVideo&&s?.videoBytes&&o.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&o.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),o}function Be(e){return e.replace(/\/+$/,"")}var _=class extends Error{constructor(r,s,o){super(r);this.status=s;this.phase=o;this.name="PresignedUploadError"}};async function ee(e){let t=Be(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-soot-admin-upload-bypass"]=e.adminBypassToken);let s=H(3e4,"init"),o;try{o=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!o.ok){let B=await o.text().catch(()=>"");throw new _(`init failed: ${o.status} ${B.slice(0,200)}`,o.status,"init")}let a=await o.json(),u=ve(a,e.bundleBytes,e.filesByHash,e.extras);await we(u,e.concurrency??8,e.onPutProgress);let y=H(3e4,"finalize"),p;try{p=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:y.signal})}finally{y.cancel()}if(!p.ok){let B=await p.text().catch(()=>"");throw new _(`finalize failed: ${p.status} ${B.slice(0,200)}`,p.status,"finalize")}let P=await p.json();return{init:a,finalize:P}}var ie=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",ae=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",M="http://localhost:3000";async function Ie(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${M}/api/preview/upload/init`,{method:"OPTIONS"});if(t.ok||t.status===204||t.status===405)return M}catch{}return ie}function v(e){return e.replace(/\/$/,"")}function Ue(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function Pe(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function Se(e,t){return t?v(t):process.env.SOOTSIM_PREVIEW_ORIGIN?v(process.env.SOOTSIM_PREVIEW_ORIGIN):Ue(e)?v(e):Pe(e)?v(ae):v(e)}function xe(){console.log(`
3
3
  sootsim upload \u2014 publish the current bundle as a /preview/<id> link
4
4
 
5
5
  usage:
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as d}from"./chunk-SWHWVYZS.js";import{existsSync as S,mkdirSync as h,readFileSync as b,writeFileSync as H,rmSync as m}from"fs";import{tmpdir as w}from"os";import{dirname as v,join as p}from"path";var y=new Map;function i(e,r){y.set(e,r)}var a=1;function s(){return p(w(),`sootsim-cli-hints-${d()}.json`)}function l(){return p(w(),"sootsim-cli-hints-global.json")}function u(e){if(!S(e))return{version:a,shown:{}};try{let r=JSON.parse(b(e,"utf8"));return r?.version!==a||!r?.shown?{version:a,shown:{}}:r}catch{return{version:a,shown:{}}}}function f(e,r){try{h(v(e),{recursive:!0}),H(e,JSON.stringify(r)+`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as d}from"./chunk-D5TKAFJ3.js";import{existsSync as S,mkdirSync as h,readFileSync as b,writeFileSync as H,rmSync as m}from"fs";import{tmpdir as w}from"os";import{dirname as v,join as p}from"path";var y=new Map;function i(e,r){y.set(e,r)}var a=1;function s(){return p(w(),`sootsim-cli-hints-${d()}.json`)}function l(){return p(w(),"sootsim-cli-hints-global.json")}function u(e){if(!S(e))return{version:a,shown:{}};try{let r=JSON.parse(b(e,"utf8"));return r?.version!==a||!r?.shown?{version:a,shown:{}}:r}catch{return{version:a,shown:{}}}}function f(e,r){try{h(v(e),{recursive:!0}),H(e,JSON.stringify(r)+`
3
3
  `)}catch{}}function F(){let e=(process.env.SOOTSIM_HINTS||"").toLowerCase();return e==="off"||e==="0"||e==="false"?"off":e==="always"||e==="verbose"?"always":"normal"}function x(e,r){let o=F();if(o==="off")return!1;if(o==="always"||r==="always")return!0;let n=Date.now();if(r==="once-per-identity"){let t=u(s());return t.shown[e]?!1:(t.shown[e]=n,f(s(),t),!0)}if(r==="once-ever"){let t=u(l());return t.shown[e]?!1:(t.shown[e]=n,f(l(),t),!0)}if(typeof r=="object"&&"cooldownMs"in r){let t=u(s()),c=t.shown[e]??0;return n-c<r.cooldownMs?!1:(t.shown[e]=n,f(s(),t),!0)}return!0}function M(e,...r){let o=y.get(e);if(!o)return process.env.SOOTSIM_HINTS_DEBUG&&console.error(` [hints] no hint registered for id "${e}"`),!1;if(!x(e,o.frequency))return!1;let n=o.render(...r);if(n==null)return!1;let t=Array.isArray(n)?n:[n],c=o.stream==="error"?console.error:console.log;for(let g of t)c(` hint: ${g}`);return!0}function O(){m(s(),{force:!0})}function k(){m(l(),{force:!0})}function T(){return Array.from(y.entries()).map(([e,r])=>({id:e,frequency:r.frequency}))}i("app-still-loading",{frequency:{cooldownMs:6e4},render:e=>`app may still be loading (${e} nodes). run \`sootsim wait ready\` first.`});i("wait-selector-for-missing-testid",{frequency:"once-per-identity",render:e=>`sootsim wait selector ${e}`,stream:"error"});i("prefer-cli-over-eval",{frequency:"once-per-identity",render:e=>e.length?["try the CLI shortcut instead:",...e.map(r=>` ${r}`)]:null,stream:"error"});i("describe-use-filters",{frequency:"once-per-identity",render:()=>["describe output is long. narrow it with:"," sootsim describe --only '*Bottom Sheet*'"," sootsim describe --testid-like 'swap-*'"," sootsim describe --subtree <testID>"]});i("subtree-root-not-found",{frequency:"always",render:e=>`no node with testID/id "${e}" \u2014 try \`sootsim find --testid ${e}\` to discover available ids.`,stream:"error"});export{M as a,O as b,k as c,T as d};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as c,b as p}from"./chunk-7YZJHZ7X.js";import{a as m,c as h}from"./chunk-Q6DGMQ2V.js";import{a as l,b as u,c as d}from"./chunk-C4AMFYK3.js";function L(){let e=l();return e?{available:!0,reason:null,detail:e}:{available:!1,reason:"no chromium-family browser found (chrome, chromium, edge, brave, arc)"}}async function O(e){if(e.headless)return{launched:!1,message:"the chromium driver launches a visible browser window and cannot run headless \u2014 a headless `chrome --headless=new` process exits immediately and the sim never connects. for headless automation use `--driver playwright`."};let r=l();if(!r)return{launched:!1,message:"chromium not found \u2014 install chrome or run `sootsim list --drivers`"};if(!e.url)return{launched:!1,message:"chromium driver requires a target url"};if(e.profileId||e.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current Chrome profile"};try{let i=await d(e.url,{detached:e.detached??!0});return{launched:!0,message:`chromium launched \u2192 ${e.url}`,pid:i.pid,target:i.target??r,attachUrl:e.url}}catch(i){return{launched:!1,message:`chromium spawn failed: ${i instanceof Error?i.message:String(i)}`}}}var f={id:"chromium",name:"chromium",description:"system chrome / chromium / edge \u2014 visible window (headless: use playwright)",kind:"browser",availability:L,launch:O};function k(){let e=c();return e?{available:!0,reason:null,detail:`${e.kind} @ ${e.path}`}:{available:!1,reason:"sootsim desktop app not installed (run `sootsim install-desktop`)"}}async function x(e){let r=c();if(!r)return{launched:!1,message:"sootsim desktop app not installed"};try{let i=await p(e.url,r,{device:e.device,profileId:e.profileId,ephemeralProfile:e.ephemeralProfile});return i.launched?{launched:!0,message:e.url?`electron launched via ${i.via} \u2192 ${e.url}`:`electron launched via ${i.via}`,target:i.target,attachUrl:e.url}:{launched:!1,message:"desktop companion failed to start"}}catch(i){return{launched:!1,message:`electron launch failed: ${i instanceof Error?i.message:String(i)}`}}}var v={id:"electron",name:"electron",description:"sootsim desktop companion app (native window, menu bar)",kind:"native",availability:k,launch:x};import{spawn as I}from"child_process";import{closeSync as R,mkdtempSync as A,openSync as $,readFileSync as _,rmSync as U}from"fs";import{createRequire as T}from"module";import{tmpdir as g}from"os";import{join as w}from"path";var E=`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as c,b as p}from"./chunk-6R3CVNXC.js";import{a as m,c as h}from"./chunk-KQN7OUQ6.js";import{a as l,b as u,c as d}from"./chunk-DUVJOJTP.js";function L(){let e=l();return e?{available:!0,reason:null,detail:e}:{available:!1,reason:"no chromium-family browser found (chrome, chromium, edge, brave, arc)"}}async function O(e){if(e.headless)return{launched:!1,message:"the chromium driver launches a visible browser window and cannot run headless \u2014 a headless `chrome --headless=new` process exits immediately and the sim never connects. for headless automation use `--driver playwright`."};let r=l();if(!r)return{launched:!1,message:"chromium not found \u2014 install chrome or run `sootsim list --drivers`"};if(!e.url)return{launched:!1,message:"chromium driver requires a target url"};if(e.profileId||e.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current Chrome profile"};try{let i=await d(e.url,{detached:e.detached??!0});return{launched:!0,message:`chromium launched \u2192 ${e.url}`,pid:i.pid,target:i.target??r,attachUrl:e.url}}catch(i){return{launched:!1,message:`chromium spawn failed: ${i instanceof Error?i.message:String(i)}`}}}var f={id:"chromium",name:"chromium",description:"system chrome / chromium / edge \u2014 visible window (headless: use playwright)",kind:"browser",availability:L,launch:O};function k(){let e=c();return e?{available:!0,reason:null,detail:`${e.kind} @ ${e.path}`}:{available:!1,reason:"sootsim desktop app not installed (run `sootsim install-desktop`)"}}async function x(e){let r=c();if(!r)return{launched:!1,message:"sootsim desktop app not installed"};try{let i=await p(e.url,r,{device:e.device,profileId:e.profileId,ephemeralProfile:e.ephemeralProfile});return i.launched?{launched:!0,message:e.url?`electron launched via ${i.via} \u2192 ${e.url}`:`electron launched via ${i.via}`,target:i.target,attachUrl:e.url}:{launched:!1,message:"desktop companion failed to start"}}catch(i){return{launched:!1,message:`electron launch failed: ${i instanceof Error?i.message:String(i)}`}}}var v={id:"electron",name:"electron",description:"sootsim desktop companion app (native window, menu bar)",kind:"native",availability:k,launch:x};import{spawn as I}from"child_process";import{closeSync as R,mkdtempSync as A,openSync as $,readFileSync as _,rmSync as U}from"fs";import{createRequire as T}from"module";import{tmpdir as g}from"os";import{join as w}from"path";var E=`
3
3
  const modulePath = process.env.SOOTSIM_PW_MODULE;
4
4
  const url = process.env.SOOTSIM_PW_URL;
5
5
  const headless = process.env.SOOTSIM_PW_HEADLESS === '1';
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{readFileSync as i}from"node:fs";import{fileURLToPath as e}from"node:url";var r=null;function l(){if(r!=null)return r;let o=[()=>e(import.meta.resolve("sootsim/package.json")),()=>e(new URL("../package.json",import.meta.url))];for(let n of o)try{let t=JSON.parse(i(n(),"utf8")).version;if(typeof t=="string"&&t)return r=t,r}catch{}return r="0.0.0",r}export{l as a};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{existsSync as C,mkdirSync as D,readFileSync as O,rmSync as s,writeFileSync as g}from"fs";import{tmpdir as P}from"os";import{dirname as R,join as A,resolve as x}from"path";import{execFileSync as a}from"child_process";import{readFileSync as I}from"fs";import{createRequire as S}from"module";var o=null;function u(r){o||(o=_());try{return o(r)}catch{return null}}function _(){let r=Number(process.env.PPID);if(Number.isFinite(r)&&r>1&&r!==process.ppid)return()=>r;if(process.platform==="linux")return y();if(process.platform==="darwin"){let n=E();return n||T()}return()=>null}function y(){return r=>{try{let n=I(`/proc/${r}/stat`,"utf8"),t=n.lastIndexOf(")");if(t<0)return null;let i=n.slice(t+1).trim().split(/\s+/),e=Number(i[1]);return Number.isFinite(e)&&e>0?e:null}catch{return null}}}var N=3,d=216,b=16;function E(){if(!process.versions?.bun)return null;try{let r=S(import.meta.url),{dlopen:n,FFIType:t}=r("bun:ffi"),i=n("/usr/lib/libproc.dylib",{proc_pidinfo:{args:[t.i32,t.i32,t.u64,t.ptr,t.i32],returns:t.i32}}),e=Buffer.alloc(d);return m=>{if(Number(i.symbols.proc_pidinfo(m,N,0n,e,d))<=0)return null;let p=e.readUInt32LE(b);return p>0?p:null}}catch{return null}}function T(){return r=>{try{let t=a("lsof",["-R","-p",String(r),"-d","cwd","-a"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).split(`
3
3
  `)[1];if(!t)return null;let i=t.trim().split(/\s+/),e=Number(i[2]);return Number.isFinite(e)&&e>1?e:null}catch{return null}}}var c=1,f="SOOTSIM_CLI_CURRENT_SIM_PATH",v=["SOOTSIM_CLI_IDENTITY","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","TERM_SESSION_ID","ITERM_SESSION_ID","TMUX_PANE","STY","KITTY_WINDOW_ID","WEZTERM_PANE","ALACRITTY_WINDOW_ID","WINDOWID","VSCODE_INJECTION"];function F(r,n=20){let t=u(r);if(!t||t<=1)return null;for(let i=0;i<n;i++){let e=u(t);if(!e||e<=1)return t;t=e}return t}function k(){for(let n of v){let t=process.env[n];if(t&&t.trim())return{key:`${n}:${t.trim()}`,source:n,stable:!0}}let r=F(process.ppid);return r&&r>1?{key:`gppid-${r}`,source:"grand-ppid",stable:!0}:{key:`pid-${process.ppid}`,source:"ppid",stable:!1}}function L(){return k().key}function l(){if(process.env[f])return x(process.env[f]);let r=L();return A(P(),`sootsim-current-sim-${r}.json`)}function h(){let r=l();if(!C(r))return null;try{let n=JSON.parse(O(r,"utf8"));return n.version!==c||typeof n.simId!="string"||!n.simId.trim()||typeof n.updatedAt!="string"?(s(r,{force:!0}),null):{version:c,simId:n.simId.trim(),updatedAt:n.updatedAt}}catch{return s(r,{force:!0}),null}}function J(){return h()?.simId||null}function j(r){let n=r.trim();if(!n)return;let t=l();D(R(t),{recursive:!0}),g(t,JSON.stringify({version:c,simId:n,updatedAt:new Date().toISOString()},null,2)+`
4
4
  `)}function K(){s(l(),{force:!0})}export{k as a,L as b,J as c,j as d,K as e};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as R}from"./chunk-2T6UOHPO.js";import{l as D}from"./chunk-J3JJRXIP.js";import{a as T}from"./chunk-N7DDNZTO.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(y.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??y.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let t;try{t=(await import("./demo-app-registry-3VFEW4NV.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(h(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(h(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(h(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as R}from"./chunk-FDB3P2GV.js";import{l as D}from"./chunk-6MYXKMLG.js";import{a as T}from"./chunk-UY6HKNEV.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(y.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??y.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let t;try{t=(await import("./demo-app-registry-XABEINTD.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(h(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(h(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(h(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
3
3
  `)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Re(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=j(e),n=h();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ne(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,f.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ee.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let c=I(d);c&&t(c)});let a=!1;return()=>{if(!a){a=!0;try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ae(e,t,r){let n=i.openSync(e,f.O_RDWR|f.O_NONBLOCK),o=Buffer.alloc(8192),s="",a=Date.now()+r;try{for(;Date.now()<a;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(c){if(c.code!=="EAGAIN")throw c;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let c;for(;(c=s.indexOf(`
4
4
  `))>=0;){let g=s.slice(0,c);s=s.slice(c+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(c=>setTimeout(c,30))}return null}finally{i.closeSync(n)}}export{I as a,h as b,ge as c,F as d,ye as e,he as f,Se as g,we as h,k as i,C as j,v as k,ve as l,j as m,W as n,J as o,te as p,O as q,re as r,l as s,Te as t,De as u,Re as v,Ne as w};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{execFileSync as p,spawn as l}from"child_process";import{existsSync as s}from"fs";import{homedir as u}from"os";import{join as d}from"path";var g=["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","~/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium","~/Applications/Chromium.app/Contents/MacOS/Chromium","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","~/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","~/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","/Applications/Arc.app/Contents/MacOS/Arc","~/Applications/Arc.app/Contents/MacOS/Arc"],f=["/usr/bin/google-chrome","/usr/bin/chromium","/usr/bin/chromium-browser","/usr/bin/microsoft-edge","/usr/bin/brave-browser","/snap/bin/chromium"],h=["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe","C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe","C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe","C:\\Program Files (x86)\\BraveSoftware\\Brave-Browser\\Application\\brave.exe"],C=["google-chrome","chromium","chromium-browser","microsoft-edge","brave-browser"],O=["chrome","msedge","brave"];function w(r){return r.startsWith("~/")?d(u(),r.slice(2)):r}function a(r){for(let n of r){let o=w(n);if(s(o))return o}return null}function U(r,n){try{let e=p(n==="win32"?"where":"which",[r],{encoding:"utf8",timeout:1500,stdio:["ignore","pipe","ignore"]}).trim();return e?e.split(/\r?\n/)[0]:null}catch{return null}}function M(r=process.platform){let n=process.env.CHROME_PATH||process.env.CHROMIUM_PATH;if(n&&s(n))return n;let o=a(r==="darwin"?g:r==="win32"?h:f);if(o)return o;let e=r==="win32"?O:C;for(let t of e){let i=U(t,r);if(i)return i}return null}function A(r,n={}){if(!r)throw new Error("openUrl requires a url");let o=n.platform??process.platform;return n.newWindow?c(r,{...n,platform:o,newWindow:!0}):o==="darwin"?{command:"open",args:n.background===!1?[r]:["-g",r],via:"system"}:o==="win32"?{command:"cmd",args:["/c","start","",r],via:"system"}:{command:"xdg-open",args:[r],via:"system"}}function c(r,n={}){if(!r)throw new Error("openUrl requires a url");let o=n.platform??process.platform,e="chromiumBinary"in n?n.chromiumBinary:M(o);if(!e)throw new Error("browser launch requires Chrome, Chromium, Edge, Brave, or Arc");let t=[];return n.newWindow!==!1&&t.push("--new-window"),t.push(r),{command:e,args:t,via:"chromium",target:e}}async function m(r,n,o){return new Promise((e,t)=>{let i=l(r,n,{detached:o,stdio:"ignore"});i.once("error",t),i.once("spawn",()=>{o&&i.unref(),e(i.pid)})})}async function x(r,n={}){let o=A(r,n),e=await m(o.command,o.args,n.detached??!0);return{...o,pid:e,attachUrl:r}}async function y(r,n={}){let o=c(r,n),e=await m(o.command,o.args,n.detached??!0);return{...o,pid:e,attachUrl:r}}async function E(r,n={}){await x(r,n)}export{M as a,x as b,y as c,E as d};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as u}from"./chunk-33R6QMNO.js";var S=52,l=18,h=42,x=96,g=54,E=1.5,$="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",w=1;function y(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+x:t.height+28,c=9.5,b=w,p=a+c*2,m=d+w*2,f=c+(o?l:14),B=o?h:14,H=o?S:t.cornerRadius+14,v=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:H,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:$,buttons:v,legacyHomeButton:o?{top:h+t.height+(x-g)/2,left:t.width/2-g/2+l,size:g,ring:E}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function L(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as u}from"./chunk-L53QRCQZ.js";var S=52,l=18,h=42,x=96,g=54,E=1.5,$="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",w=1;function y(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+x:t.height+28,c=9.5,b=w,p=a+c*2,m=d+w*2,f=c+(o?l:14),B=o?h:14,H=o?S:t.cornerRadius+14,v=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:H,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:$,buttons:v,legacyHomeButton:o?{top:h+t.height+(x-g)/2,left:t.width/2-g/2+l,size:g,ring:E}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function L(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
3
3
  <div
4
4
  aria-hidden="true"
5
5
  style="
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as l}from"./chunk-6PLNIOJP.js";import{E as u,F as c,g as p,i as h,z as w}from"./chunk-J3JJRXIP.js";import{closeSync as v,existsSync as f,openSync as P,readSync as S,statSync as g}from"fs";import{homedir as k}from"os";import{resolve as T}from"path";import{WebSocket as D}from"ws";var E=6e4;async function L(){let t=w();if(t&&f(h(t)))return;console.log(" first run \u2014 installing sootsim engine runtime (~6 MB)...");let{runRuntime:e}=await import("./runtime-XXNKSGFE.js");await e(["install"],{})}function I(t,e){return x(t)??e??l()}async function $(t=l(),e=E){if(await m(t,250))return;let n=u();if(n&&c(n)){if(n.bootstrapping===!0&&(await b(e),await m(n.bridgePort,500)))return;throw new Error(`sootsim daemon lockfile is fresh (port ${n.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`)}if(p())throw new Error(`sootsim bridge daemon is not running on port ${t}.
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as l}from"./chunk-76WF7UIG.js";import{E as u,F as c,g as p,i as h,z as w}from"./chunk-6MYXKMLG.js";import{closeSync as v,existsSync as f,openSync as P,readSync as S,statSync as g}from"fs";import{homedir as k}from"os";import{resolve as T}from"path";import{WebSocket as D}from"ws";var E=6e4;async function L(){let t=w();if(t&&f(h(t)))return;console.log(" first run \u2014 installing sootsim engine runtime (~6 MB)...");let{runRuntime:e}=await import("./runtime-AGNC2TK6.js");await e(["install"],{})}function I(t,e){return x(t)??e??l()}async function $(t=l(),e=E){if(await m(t,250))return;let n=u();if(n&&c(n)){if(n.bootstrapping===!0&&(await b(e),await m(n.bridgePort,500)))return;throw new Error(`sootsim daemon lockfile is fresh (port ${n.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`)}if(p())throw new Error(`sootsim bridge daemon is not running on port ${t}.
3
3
  dev checkouts skip the auto-install of the persistent launchd / systemd
4
4
  agent. start the daemon manually in another shell with:
5
5
  bun sootsim server
6
- (set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-RYSVONEV.js");try{await o({port:t,force:!0})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`${s}
6
+ (set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-3N3QWMFU.js");try{await o({port:t,force:!0})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`${s}
7
7
  if this keeps failing, run \`sootsim daemon uninstall\` and retry, or run \`sootsim server\` in a persistent shell as a workaround.`)}console.log(" waiting for runtime to come online...");let i=process.platform==="darwin"?B():null;try{await b(e);let r=Date.now()+5e3;for(;Date.now()<r;){if(await m(t,500))return;await new Promise(s=>setTimeout(s,200))}throw new Error(`daemon registered but the bridge never bound on port ${t} \u2014 see ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}finally{i?.stop()}}async function C(t=l()){await L(),await $(t)}function x(t){for(let e=0;e<t.length;e++){let n=t[e];if((n==="--port"||n==="-p")&&t[e+1]){let o=Number(t[e+1]);return Number.isFinite(o)?o:void 0}if(n.startsWith("--port=")){let o=Number(n.slice(7));return Number.isFinite(o)?o:void 0}}}function m(t,e){return new Promise(n=>{let o=new D(`ws://127.0.0.1:${t}`,{handshakeTimeout:e}),i=!1,r=s=>{if(!i){i=!0;try{o.close()}catch{}n(s)}};o.once("open",()=>r(!0)),o.once("error",()=>r(!1)),setTimeout(()=>r(!1),e)})}async function b(t){let e=Date.now()+t,n;for(;Date.now()<e;){let o=u();if(o&&c(o)){if(o.bootstrapping!==!0)return;o.bootstrapping!==n&&(n=o.bootstrapping)}await new Promise(i=>setTimeout(i,250))}throw new Error(`daemon did not finish bootstrapping within ${Math.round(t/1e3)}s \u2014 check ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}function d(){return T(k(),"Library/Logs/sootsim/server.err.log")}function B(){let t=d(),e=0;try{f(t)&&(e=g(t).size)}catch{}let n=!1,o=()=>{if(!n){try{if(f(t)){let i=g(t).size;if(i>e){let r=Buffer.alloc(i-e),s=P(t,"r");try{S(s,r,0,r.length,e)}finally{v(s)}e=i;for(let y of r.toString("utf8").split(/\r?\n/)){let a=y.trim();a&&(a.startsWith("sootsim:")||a.startsWith("sootsim "))&&console.log(` ${a}`)}}else i<e&&(e=i)}}catch{}setTimeout(o,250)}};return o(),{stop:()=>{n=!0}}}export{L as a,I as b,$ as c,C as d};
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var c="sootsim-agent-prompt-v1";function r(n){return typeof n=="string"?n.trim():""}function m(n){let e=r(n.text);if(!e)return"";let t=r(n.displayText),s=r(n.inspectSummary),o=r(n.inspectTrace);return!!s||!!o||/[\r\n]/.test(e)||!!t&&t!==e?JSON.stringify({__sootsimAgentPrompt:c,text:e,displayText:t,inspectSummary:s,inspectTrace:o}):e}function u(n){let e=r(n);if(!e)return null;try{let t=JSON.parse(e);if(t.__sootsimAgentPrompt!==c)return{text:e};let s=r(typeof t.text=="string"?t.text:void 0);if(!s)return null;let o=r(typeof t.displayText=="string"?t.displayText:void 0),i=r(typeof t.inspectSummary=="string"?t.inspectSummary:void 0),p=r(typeof t.inspectTrace=="string"?t.inspectTrace:void 0);return{text:s,...o?{displayText:o}:{},...i?{inspectSummary:i}:{},...p?{inspectTrace:p}:{}}}catch{return{text:e}}}export{m as a,u as b};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as L}from"./chunk-N7DDNZTO.js";import{existsSync as o,readFileSync as p,writeFileSync as d}from"node:fs";import{homedir as j}from"node:os";import{dirname as $,join as s,resolve as P}from"node:path";var _=j();function Q(e){let t=e;for(;;){if(o(s(t,"pnpm-workspace.yaml"))||o(s(t,"turbo.json"))||o(s(t,"nx.json"))||o(s(t,"lerna.json")))return t;let r=s(t,"package.json");if(o(r))try{if(JSON.parse(p(r,"utf8")).workspaces)return t}catch{}let n=$(t);if(n===t)return null;t=n}}function S(e,t){let r=Q(process.cwd()),n=[r?P(r,e):null,P(process.cwd(),e),P(process.cwd(),t)].filter(a=>!!a);for(let a of n)if(o(a))return a;return n[0]??P(process.cwd(),e)}var X=()=>S("packages/sootsim-engine/scripts/expensify-web-proxy.ts","scripts/expensify-web-proxy.ts"),z=()=>S("packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts","scripts/rainbow-metadata-proxy.ts"),Z=()=>S("packages/compat/src/stubs/mattermost-rnutils-native.ts","../compat/src/stubs/mattermost-rnutils-native.ts"),ee=()=>S("packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts","../compat/src/stubs/native-seams/react-native-keychain-manager.ts"),v=()=>S("packages/compat/src/stubs/mattermost-network-client-native.ts","../compat/src/stubs/mattermost-network-client-native.ts"),D={USE_NGROK:"true",NGROK_URL:"http://localhost:9000/",SECURE_NGROK_URL:"http://localhost:9000/"},te=s(_,"github/mattermost-mobile"),I=s(_,"github/uniswap-interface"),ne=s(I,"apps/mobile"),T=s(I,".env.defaults.local"),re="stored-in-.env.local",W="# sootsim demo env overrides",se=s(I,"packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts"),oe=s(I,"apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts"),M="SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE";function B(e){if(!o(e))return{};let t={},r=p(e,"utf8");for(let n of r.split(/\r?\n/)){let a=n.trim();if(!a||a.startsWith("#"))continue;let u=a.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!u)continue;let i=u[2].trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),t[u[1]]=i}return t}function k(e){if(!e)return!1;let t=e.trim();return!(!t||t.includes(re)||t==="TRADING_API_KEY"||t==="UNISWAP_API_KEY")}function Y(e,t){for(let r of e)for(let n of t){let a=r[n];if(k(a))return a.trim()}}function J(){let e=B(T),t=B(s(I,"apps/web/.env")),r=[process.env,e,t],n={},a=[["AMPLITUDE_PROXY_URL_OVERRIDE",["REACT_APP_AMPLITUDE_PROXY_URL"]],["QUICKNODE_ENDPOINT_NAME",["REACT_APP_QUICKNODE_ENDPOINT_NAME"]],["QUICKNODE_ENDPOINT_TOKEN",["REACT_APP_QUICKNODE_ENDPOINT_TOKEN"]],["INFURA_KEY",["REACT_APP_INFURA_KEY"]],["STATSIG_API_KEY",["REACT_APP_STATSIG_API_KEY"]],["STATSIG_PROXY_URL_OVERRIDE",["REACT_APP_STATSIG_PROXY_URL"]],["WALLETCONNECT_PROJECT_ID",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_BETA",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_DEV",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["TRADING_API_KEY",["REACT_APP_TRADING_API_KEY"]],["UNISWAP_API_KEY",[]]];for(let[i,l]of a){let R=Y(r,[i,...l]);if(R){n[i]=R;for(let m of l)n[m]=R}}if(!(k(n.TRADING_API_KEY)&&k(n.UNISWAP_API_KEY))){let i=Y(r,["GRAPHQL_URL_OVERRIDE","REACT_APP_AWS_API_ENDPOINT"])||"https://interface.gateway.uniswap.org/v1/graphql";n.API_BASE_URL_OVERRIDE="https://interface.gateway.uniswap.org",n.API_BASE_URL_V2_OVERRIDE="https://interface.gateway.uniswap.org/v2",n.GRAPHQL_URL_OVERRIDE=i,n.TRADING_API_URL_OVERRIDE="https://trading-api-labs.interface.gateway.uniswap.org",n.FOR_API_URL_OVERRIDE="https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService"}return n}function ae(){let e=o(T)?p(T,"utf8"):"";if(e&&!e.includes(W))return;let t=J(),r=[W];for(let[n,a]of Object.entries(t).sort(([u],[i])=>u.localeCompare(i)))r.push(`${n}=${JSON.stringify(a)}`);r.push(""),d(T,`${r.join(`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as L}from"./chunk-UY6HKNEV.js";import{existsSync as o,readFileSync as p,writeFileSync as d}from"node:fs";import{homedir as j}from"node:os";import{dirname as $,join as s,resolve as P}from"node:path";var _=j();function Q(e){let t=e;for(;;){if(o(s(t,"pnpm-workspace.yaml"))||o(s(t,"turbo.json"))||o(s(t,"nx.json"))||o(s(t,"lerna.json")))return t;let r=s(t,"package.json");if(o(r))try{if(JSON.parse(p(r,"utf8")).workspaces)return t}catch{}let n=$(t);if(n===t)return null;t=n}}function S(e,t){let r=Q(process.cwd()),n=[r?P(r,e):null,P(process.cwd(),e),P(process.cwd(),t)].filter(a=>!!a);for(let a of n)if(o(a))return a;return n[0]??P(process.cwd(),e)}var X=()=>S("packages/sootsim-engine/scripts/expensify-web-proxy.ts","scripts/expensify-web-proxy.ts"),z=()=>S("packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts","scripts/rainbow-metadata-proxy.ts"),Z=()=>S("packages/compat/src/stubs/mattermost-rnutils-native.ts","../compat/src/stubs/mattermost-rnutils-native.ts"),ee=()=>S("packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts","../compat/src/stubs/native-seams/react-native-keychain-manager.ts"),v=()=>S("packages/compat/src/stubs/mattermost-network-client-native.ts","../compat/src/stubs/mattermost-network-client-native.ts"),D={USE_NGROK:"true",NGROK_URL:"http://localhost:9000/",SECURE_NGROK_URL:"http://localhost:9000/"},te=s(_,"github/mattermost-mobile"),I=s(_,"github/uniswap-interface"),ne=s(I,"apps/mobile"),T=s(I,".env.defaults.local"),re="stored-in-.env.local",W="# sootsim demo env overrides",se=s(I,"packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts"),oe=s(I,"apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts"),M="SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE";function B(e){if(!o(e))return{};let t={},r=p(e,"utf8");for(let n of r.split(/\r?\n/)){let a=n.trim();if(!a||a.startsWith("#"))continue;let u=a.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(!u)continue;let i=u[2].trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),t[u[1]]=i}return t}function k(e){if(!e)return!1;let t=e.trim();return!(!t||t.includes(re)||t==="TRADING_API_KEY"||t==="UNISWAP_API_KEY")}function Y(e,t){for(let r of e)for(let n of t){let a=r[n];if(k(a))return a.trim()}}function J(){let e=B(T),t=B(s(I,"apps/web/.env")),r=[process.env,e,t],n={},a=[["AMPLITUDE_PROXY_URL_OVERRIDE",["REACT_APP_AMPLITUDE_PROXY_URL"]],["QUICKNODE_ENDPOINT_NAME",["REACT_APP_QUICKNODE_ENDPOINT_NAME"]],["QUICKNODE_ENDPOINT_TOKEN",["REACT_APP_QUICKNODE_ENDPOINT_TOKEN"]],["INFURA_KEY",["REACT_APP_INFURA_KEY"]],["STATSIG_API_KEY",["REACT_APP_STATSIG_API_KEY"]],["STATSIG_PROXY_URL_OVERRIDE",["REACT_APP_STATSIG_PROXY_URL"]],["WALLETCONNECT_PROJECT_ID",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_BETA",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["WALLETCONNECT_PROJECT_ID_DEV",["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],["TRADING_API_KEY",["REACT_APP_TRADING_API_KEY"]],["UNISWAP_API_KEY",[]]];for(let[i,l]of a){let R=Y(r,[i,...l]);if(R){n[i]=R;for(let m of l)n[m]=R}}if(!(k(n.TRADING_API_KEY)&&k(n.UNISWAP_API_KEY))){let i=Y(r,["GRAPHQL_URL_OVERRIDE","REACT_APP_AWS_API_ENDPOINT"])||"https://interface.gateway.uniswap.org/v1/graphql";n.API_BASE_URL_OVERRIDE="https://interface.gateway.uniswap.org",n.API_BASE_URL_V2_OVERRIDE="https://interface.gateway.uniswap.org/v2",n.GRAPHQL_URL_OVERRIDE=i,n.TRADING_API_URL_OVERRIDE="https://trading-api-labs.interface.gateway.uniswap.org",n.FOR_API_URL_OVERRIDE="https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService"}return n}function ae(){let e=o(T)?p(T,"utf8"):"";if(e&&!e.includes(W))return;let t=J(),r=[W];for(let[n,a]of Object.entries(t).sort(([u],[i])=>u.localeCompare(i)))r.push(`${n}=${JSON.stringify(a)}`);r.push(""),d(T,`${r.join(`
3
3
  `)}
4
4
  `)}function ie(){let e=`export function useForceUpgradeStatus(): ForceUpgradeStatus {
5
5
  `,t=` // sootsim demo: bypass the force-upgrade gate during local engine demos.
@@ -0,0 +1 @@
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.41 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{l as c}from"./chunk-J3JJRXIP.js";import{chmodSync as m,existsSync as g,mkdirSync as k,readFileSync as A,rmSync as i,writeFileSync as y}from"node:fs";import{dirname as l,join as D,resolve as p}from"node:path";var s=1,S="SOOTSIM_SHARED_AUTH_FILE",u="https://sootbean.com";function v(){let t=process.env[S];return t?.trim()?l(p(t)):c()}function a(){let t=process.env[S];return t?.trim()?p(t):D(v(),"desktop-auth.json")}function f(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0}}function w(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",o=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:f(e.user),origin:r,source:n,updatedAt:o,validatedAt:h}}function O(){let t=a();if(!g(t))return null;try{let e=JSON.parse(A(t,"utf8")),r=w(e);return r||(i(t,{force:!0}),null)}catch{return i(t,{force:!0}),null}}function I(t){let e=a();k(l(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?f(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
1
+ /*! sootsim v0.1.42 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{l as c}from"./chunk-6MYXKMLG.js";import{chmodSync as m,existsSync as g,mkdirSync as k,readFileSync as A,rmSync as i,writeFileSync as y}from"node:fs";import{dirname as l,join as D,resolve as p}from"node:path";var s=1,S="SOOTSIM_SHARED_AUTH_FILE",u="https://sootbean.com";function v(){let t=process.env[S];return t?.trim()?l(p(t)):c()}function a(){let t=process.env[S];return t?.trim()?p(t):D(v(),"desktop-auth.json")}function f(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0}}function w(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",o=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:f(e.user),origin:r,source:n,updatedAt:o,validatedAt:h}}function O(){let t=a();if(!g(t))return null;try{let e=JSON.parse(A(t,"utf8")),r=w(e);return r||(i(t,{force:!0}),null)}catch{return i(t,{force:!0}),null}}function I(t){let e=a();k(l(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?f(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
3
3
  `);try{m(e,384)}catch{}return r}function d(){i(a(),{force:!0})}async function N(t){let e=O();if(!e?.token)return null;let r=t||e.origin||u;try{let n=await fetch(`${r.replace(/\/$/,"")}/api/auth/me`,{headers:{authorization:`Bearer ${e.token}`}});if(n.status===401)return d(),null;if(!n.ok)return e;let o=await n.json();return o.user?.id?I({token:e.token,user:o.user,origin:r,source:e.source,validatedAt:new Date().toISOString()}):(d(),null)}catch{return e}}export{O as a,I as b,d as c,N as d};