sootsim 0.1.191 → 0.1.193

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 (137) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-YS7SPS6Z.js → agent-USE53A6G.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-MHH4YKJE.js → agent-wrapper-NNPLVD2D.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-PZNPXQAI.js → app-fonts-K6BJQ5PV.js} +2 -2
  5. package/dist-cli/chunks/{assert-XVKXT3KE.js → assert-OBYCJT6E.js} +2 -2
  6. package/dist-cli/chunks/{auth-DUCWOBV3.js → auth-QAZ3NU2P.js} +2 -2
  7. package/dist-cli/chunks/beta-XH6NPFJL.js +2 -0
  8. package/dist-cli/chunks/{camera-XVZUX6Q2.js → camera-ND7VAW2Z.js} +2 -2
  9. package/dist-cli/chunks/chunk-2G4WS3NS.js +119 -0
  10. package/dist-cli/chunks/{chunk-M6GIXT25.js → chunk-2H5WTYZB.js} +1 -1
  11. package/dist-cli/chunks/{chunk-KITHQVX5.js → chunk-2OCQ4XLZ.js} +2 -2
  12. package/dist-cli/chunks/{chunk-O7QYV2FI.js → chunk-2YZKJ3ZJ.js} +1 -1
  13. package/dist-cli/chunks/{chunk-TE4UPZY2.js → chunk-32JBVYL5.js} +1 -1
  14. package/dist-cli/chunks/{chunk-NX2QM2BE.js → chunk-3FZ2YUUP.js} +2 -2
  15. package/dist-cli/chunks/{chunk-BYZ5SCMD.js → chunk-3HBRJVSY.js} +1 -1
  16. package/dist-cli/chunks/{chunk-EXC6INU6.js → chunk-3HZLGWTB.js} +3 -3
  17. package/dist-cli/chunks/{chunk-R7AEJR2M.js → chunk-3RKAEUTW.js} +2 -2
  18. package/dist-cli/chunks/{chunk-2QAG5IPN.js → chunk-6WL7GBOW.js} +1 -1
  19. package/dist-cli/chunks/{chunk-2ZZIXID6.js → chunk-73RUAURY.js} +2 -2
  20. package/dist-cli/chunks/{chunk-6PJLFYJT.js → chunk-7LAHDYZ3.js} +1 -1
  21. package/dist-cli/chunks/{chunk-O2X7YSAD.js → chunk-BQSG37WI.js} +12 -12
  22. package/dist-cli/chunks/{chunk-JYRWIES4.js → chunk-EBRAQH3D.js} +3 -3
  23. package/dist-cli/chunks/{chunk-5N2BFB4I.js → chunk-EYUZLNLC.js} +1 -1
  24. package/dist-cli/chunks/{chunk-R6YZNTVX.js → chunk-HFKXGD6F.js} +1 -1
  25. package/dist-cli/chunks/{chunk-LJ4CQHHZ.js → chunk-HNBFCX26.js} +2 -2
  26. package/dist-cli/chunks/{chunk-RINOK2FV.js → chunk-HRH5AL5T.js} +2 -2
  27. package/dist-cli/chunks/{chunk-A46MWTJB.js → chunk-I25N6TF4.js} +2 -2
  28. package/dist-cli/chunks/{chunk-UZDH32UA.js → chunk-ICI5UOHJ.js} +1 -1
  29. package/dist-cli/chunks/{chunk-WUV6QJJU.js → chunk-JFURKF6W.js} +2 -2
  30. package/dist-cli/chunks/{chunk-FWZQSSEJ.js → chunk-KNPIQNLB.js} +2 -2
  31. package/dist-cli/chunks/chunk-ODWHC4OS.js +1 -0
  32. package/dist-cli/chunks/{chunk-JALTULVB.js → chunk-OOGJDQMT.js} +1 -1
  33. package/dist-cli/chunks/{chunk-BORW7JE4.js → chunk-PSP2WT3K.js} +1 -1
  34. package/dist-cli/chunks/{chunk-SQ2MTGDQ.js → chunk-QS73KI7T.js} +2 -2
  35. package/dist-cli/chunks/{chunk-WSF2QLMD.js → chunk-R62P6SPR.js} +2 -2
  36. package/dist-cli/chunks/{chunk-QLZSJLM4.js → chunk-RHKQEMHY.js} +2 -2
  37. package/dist-cli/chunks/{chunk-64GTYKIF.js → chunk-TYYWETOW.js} +2 -2
  38. package/dist-cli/chunks/{chunk-6YV6WW5Q.js → chunk-U2QSYQUZ.js} +1 -1
  39. package/dist-cli/chunks/{chunk-WXMGGTWH.js → chunk-UG44WJ5U.js} +2 -2
  40. package/dist-cli/chunks/{chunk-WXN3JD2J.js → chunk-UPP423YA.js} +2 -2
  41. package/dist-cli/chunks/chunk-VA6U55D3.js +1 -0
  42. package/dist-cli/chunks/{chunk-UKKQXZFZ.js → chunk-VGICXM2C.js} +2 -2
  43. package/dist-cli/chunks/{chunk-6XAGMAP7.js → chunk-WS4H3OTZ.js} +3 -3
  44. package/dist-cli/chunks/{chunk-XJHF3OFF.js → chunk-WT4SBY54.js} +3 -3
  45. package/dist-cli/chunks/{chunk-5XMJFP54.js → chunk-XNCFZ4UT.js} +2 -2
  46. package/dist-cli/chunks/{chunk-UYNPUHMD.js → chunk-XX5ABTZE.js} +1 -1
  47. package/dist-cli/chunks/{chunk-S6L32ZQF.js → chunk-ZMYHC2GZ.js} +1 -1
  48. package/dist-cli/chunks/{chunk-S23R7GAE.js → chunk-ZUV7FVK5.js} +2 -2
  49. package/dist-cli/chunks/{chunk-JCXQE5XP.js → chunk-ZWFFRBAR.js} +2 -2
  50. package/dist-cli/chunks/cli-version-NE74BKVQ.js +2 -0
  51. package/dist-cli/chunks/{compat-ZKG2T55R.js → compat-FFXRTXLA.js} +3 -3
  52. package/dist-cli/chunks/{config-RWZGJPQB.js → config-DSWOQ6FW.js} +2 -2
  53. package/dist-cli/chunks/{control-6PTTSYCT.js → control-CWME7T7P.js} +2 -2
  54. package/dist-cli/chunks/daemon-ZCLZ7Q2G.js +2 -0
  55. package/dist-cli/chunks/{debug-WMJUSORS.js → debug-4TEW5NVC.js} +3 -3
  56. package/dist-cli/chunks/{desktop-B4IZ3JSC.js → desktop-UTUIQSY5.js} +3 -3
  57. package/dist-cli/chunks/{detox-GL2W7X6M.js → detox-QKN3QWEU.js} +2 -2
  58. package/dist-cli/chunks/{device-ID3KADOW.js → device-FIUY3FPI.js} +2 -2
  59. package/dist-cli/chunks/{diagnose-SNSGBFUR.js → diagnose-2SB3E6PB.js} +2 -2
  60. package/dist-cli/chunks/drivers-ZMTRO2H7.js +2 -0
  61. package/dist-cli/chunks/flow-YUB6NHPN.js +2 -0
  62. package/dist-cli/chunks/help-2RQGMWFZ.js +2 -0
  63. package/dist-cli/chunks/{home-paths-QGNZG3YG.js → home-paths-KMZQH425.js} +2 -2
  64. package/dist-cli/chunks/inspect-XIR5LHB4.js +2 -0
  65. package/dist-cli/chunks/install-desktop-RQ6PDFCW.js +2 -0
  66. package/dist-cli/chunks/{login-GDTYJBVI.js → login-PYS2PAFC.js} +4 -4
  67. package/dist-cli/chunks/{logout-VE4INQI4.js → logout-IUYFHCSL.js} +2 -2
  68. package/dist-cli/chunks/{maestro-XBBDWQQU.js → maestro-PXDF2QPV.js} +2 -2
  69. package/dist-cli/chunks/mode-D2UYKUXM.js +99 -0
  70. package/dist-cli/chunks/optional-demo-registry-DINFQX6N.js +2 -0
  71. package/dist-cli/chunks/{perf-ROSEJBSJ.js → perf-6TPVXFHZ.js} +2 -2
  72. package/dist-cli/chunks/{record-UT47RU34.js → record-BGGZBLUP.js} +3 -3
  73. package/dist-cli/chunks/runtime-7DFYO5OG.js +2 -0
  74. package/dist-cli/chunks/{screenshot-command-LXG5T54F.js → screenshot-command-UIF7HN7F.js} +3 -3
  75. package/dist-cli/chunks/{serve-UHVABXXQ.js → serve-AGSFVT5G.js} +2 -2
  76. package/dist-cli/chunks/{setup-RP4ZZNHU.js → setup-4CZ54EJ6.js} +3 -3
  77. package/dist-cli/chunks/{skills-IGB4LGQE.js → skills-VYTEBBCP.js} +2 -2
  78. package/dist-cli/chunks/{storage-WIZD4QJO.js → storage-ZXVK3T5Y.js} +2 -2
  79. package/dist-cli/chunks/store-A5FTY6OM.js +2 -0
  80. package/dist-cli/chunks/telemetry-C2D5VTOD.js +2 -0
  81. package/dist-cli/chunks/{test-6O3VSW7H.js → test-JOX7MZ67.js} +5 -5
  82. package/dist-cli/chunks/{timeline-J6JK2K5P.js → timeline-M4FXQUII.js} +2 -2
  83. package/dist-cli/chunks/{upgrade-UCL5HS5J.js → upgrade-WS4EUZ5H.js} +2 -2
  84. package/dist-cli/chunks/upload-QIGILLTV.js +2 -0
  85. package/dist-cli/chunks/{version-YHJ4K5CY.js → version-UCCC26QU.js} +2 -2
  86. package/dist-cli/chunks/{web-5UEVEPW2.js → web-OP75SZAL.js} +2 -2
  87. package/dist-cli/chunks/{what-happened-3UE3QORD.js → what-happened-IED7SETG.js} +2 -2
  88. package/dist-lib/agent-daemon-client.cjs +1 -1
  89. package/dist-lib/agent-events.cjs +1 -1
  90. package/dist-lib/agent-identity.cjs +1 -1
  91. package/dist-lib/agent-sessions.cjs +1 -1
  92. package/dist-lib/attached-projects.cjs +1 -1
  93. package/dist-lib/auth/shared-session.cjs +1 -1
  94. package/dist-lib/backend-origin.cjs +1 -1
  95. package/dist-lib/beta.cjs +1 -1
  96. package/dist-lib/beta.mjs +1 -1
  97. package/dist-lib/bridge-constants.cjs +1 -1
  98. package/dist-lib/cli-constants.cjs +1 -1
  99. package/dist-lib/config.cjs +1 -1
  100. package/dist-lib/detox/index.cjs +1 -1
  101. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  102. package/dist-lib/home-paths.cjs +1 -1
  103. package/dist-lib/host/bridge-host.cjs +1 -1
  104. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  105. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  106. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  107. package/dist-lib/host/websocket-proxy.cjs +1 -1
  108. package/dist-lib/index.cjs +1 -1
  109. package/dist-lib/jump-to-source-babel.cjs +1 -1
  110. package/dist-lib/menu.cjs +1 -1
  111. package/dist-lib/menu.mjs +1 -1
  112. package/dist-lib/metro.cjs +1 -1
  113. package/dist-lib/profiles.cjs +1 -1
  114. package/dist-lib/render-mode.cjs +1 -1
  115. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  116. package/dist-lib/sdk.cjs +4 -1
  117. package/dist-lib/sdk.mjs +4 -1
  118. package/dist-lib/skills.cjs +1 -1
  119. package/dist-lib/vite.cjs +1 -1
  120. package/package.json +1 -1
  121. package/dist-cli/chunks/beta-4JXGELJG.js +0 -2
  122. package/dist-cli/chunks/chunk-7NN725AT.js +0 -119
  123. package/dist-cli/chunks/chunk-A4J3ZFTP.js +0 -1
  124. package/dist-cli/chunks/chunk-D3FMK5KM.js +0 -1
  125. package/dist-cli/chunks/cli-version-UOHSVKG2.js +0 -2
  126. package/dist-cli/chunks/daemon-NZA4D5HD.js +0 -2
  127. package/dist-cli/chunks/drivers-SCKKGVU5.js +0 -2
  128. package/dist-cli/chunks/flow-2DURO62S.js +0 -2
  129. package/dist-cli/chunks/help-NVVELOB7.js +0 -2
  130. package/dist-cli/chunks/inspect-5FWMOJ7P.js +0 -2
  131. package/dist-cli/chunks/install-desktop-5Z3S4JTX.js +0 -2
  132. package/dist-cli/chunks/mode-P34QE7AA.js +0 -93
  133. package/dist-cli/chunks/optional-demo-registry-E7K3MGYI.js +0 -2
  134. package/dist-cli/chunks/runtime-HXK427JM.js +0 -2
  135. package/dist-cli/chunks/store-MS3GXV6K.js +0 -2
  136. package/dist-cli/chunks/telemetry-2RQQYIGP.js +0 -2
  137. package/dist-cli/chunks/upload-H53ZS5FN.js +0 -2
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as E,i as R,l as b}from"./chunk-NX2QM2BE.js";import"./chunk-2QAG5IPN.js";import{b as v}from"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";function F(e){return e.ts??e.t??0}function W(e){return typeof e.message=="string"&&e.message.length>0?e.message:Array.isArray(e.args)?e.args.map(s=>typeof s=="string"?s:JSON.stringify(s)).join(" "):""}var B=new Set(["timeline","network","react","console","screen"]);function P(){console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as E,i as R,l as b}from"./chunk-3FZ2YUUP.js";import"./chunk-6WL7GBOW.js";import{b as v}from"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";function F(e){return e.ts??e.t??0}function W(e){return typeof e.message=="string"&&e.message.length>0?e.message:Array.isArray(e.args)?e.args.map(s=>typeof s=="string"?s:JSON.stringify(s)).join(" "):""}var B=new Set(["timeline","network","react","console","screen"]);function P(){console.log(`
3
3
  sootsim get diagnosis \u2014 compact "what just went wrong?" report
4
4
 
5
5
  usage:
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-VA6U55D3.js";import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i}from"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";export{e as ALL_DRIVERS,i as buildDriverListRows,a as chromiumDriver,b as electronDriver,f as getAllDrivers,g as getDriver,c as playwrightDriver,h as resolveDriver,d as systemDriver};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{c,d,e,f,g}from"./chunk-WS4H3OTZ.js";import{c as a,d as b}from"./chunk-WT4SBY54.js";import"./chunk-R62P6SPR.js";import"./chunk-RHKQEMHY.js";import"./chunk-BQSG37WI.js";import"./chunk-ZWFFRBAR.js";import"./chunk-HRH5AL5T.js";import"./chunk-2OCQ4XLZ.js";import"./chunk-ODWHC4OS.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-HNBFCX26.js";import"./chunk-QS73KI7T.js";import"./chunk-3FZ2YUUP.js";import"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-U2QSYQUZ.js";import"./chunk-ZUV7FVK5.js";import"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";export{d as discoverSootsimUrl,c as getLastFlowPreviewUploadResult,f as hoistLeadingSimFlag,a as parseFlowFile,g as runFlow,e as runFlowPlayback,b as validateFlowFile};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c}from"./chunk-I25N6TF4.js";import"./chunk-73RUAURY.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-2H5WTYZB.js";import"./chunk-3HBRJVSY.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";export{c as printCommandHelp,b as printGroupHelp,a as printHelp};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";export{b as ACTIVE_RUNTIME_FILE,e as CONFIG_FILE,f as DAEMON_HEARTBEAT_STALE_MS,c as DAEMON_LOCKFILE,d as DEV_BRIDGE_LOCKFILE,a as SOOTSIM_HOME_ENV,H as activeRuntimeDir,m as activeRuntimeFile,u as cacheDir,O as claimDaemonLockfile,G as compareSemver,x as configFilePath,s as daemonAppBundlePath,r as daemonAppDir,t as daemonAppLauncherPath,v as daemonLockfilePath,w as devBridgeLockfilePath,n as electronDir,o as electronUserDataDir,p as electronVersionDir,C as ensureSootsimHome,K as isDaemonLockfileFresh,L as isDevBridgeLockfileFresh,i as isDevWorkstation,h as isSootsimDevCheckout,F as listInstalledRuntimes,q as profilesDir,D as readActiveRuntime,I as readDaemonLockfile,J as readDevBridgeLockfile,y as readSharedConfig,A as readTelemetryEnabled,P as removeDaemonLockfile,Q as removeDevBridgeLockfile,l as runtimeDir,k as runtimesDir,j as shouldSkipPersistentDaemon,g as sootsimHomeDir,E as writeActiveRuntime,M as writeDaemonLockfile,N as writeDevBridgeLockfile,z as writeSharedConfig,B as writeTelemetryEnabled};
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";export{b as ACTIVE_RUNTIME_FILE,e as CONFIG_FILE,f as DAEMON_HEARTBEAT_STALE_MS,c as DAEMON_LOCKFILE,d as DEV_BRIDGE_LOCKFILE,a as SOOTSIM_HOME_ENV,H as activeRuntimeDir,m as activeRuntimeFile,u as cacheDir,O as claimDaemonLockfile,G as compareSemver,x as configFilePath,s as daemonAppBundlePath,r as daemonAppDir,t as daemonAppLauncherPath,v as daemonLockfilePath,w as devBridgeLockfilePath,n as electronDir,o as electronUserDataDir,p as electronVersionDir,C as ensureSootsimHome,K as isDaemonLockfileFresh,L as isDevBridgeLockfileFresh,i as isDevWorkstation,h as isSootsimDevCheckout,F as listInstalledRuntimes,q as profilesDir,D as readActiveRuntime,I as readDaemonLockfile,J as readDevBridgeLockfile,y as readSharedConfig,A as readTelemetryEnabled,P as removeDaemonLockfile,Q as removeDevBridgeLockfile,l as runtimeDir,k as runtimesDir,j as shouldSkipPersistentDaemon,g as sootsimHomeDir,E as writeActiveRuntime,M as writeDaemonLockfile,N as writeDevBridgeLockfile,z as writeSharedConfig,B as writeTelemetryEnabled};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{j as a,k as b}from"./chunk-WT4SBY54.js";import"./chunk-R62P6SPR.js";import"./chunk-HRH5AL5T.js";import"./chunk-2OCQ4XLZ.js";import"./chunk-ODWHC4OS.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-HNBFCX26.js";import"./chunk-QS73KI7T.js";import"./chunk-3FZ2YUUP.js";import"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-U2QSYQUZ.js";import"./chunk-ZUV7FVK5.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";export{a as printShellPerfReport,b as runInspect};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a}from"./chunk-3HZLGWTB.js";import"./chunk-XX5ABTZE.js";import"./chunk-PSP2WT3K.js";import"./chunk-OOGJDQMT.js";export{a as runInstallDesktop};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as g,d as m}from"./chunk-UKKQXZFZ.js";import"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";import{exec as O}from"node:child_process";import{randomBytes as S}from"node:crypto";import _ from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",h="http://localhost:3000";async function x(r){if(r)return r;if(process.env.SOOTSIM_AUTH_ORIGIN)return process.env.SOOTSIM_AUTH_ORIGIN;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{if((await fetch(`${h}/api/auth/me`)).ok)return h}catch{}return I}function L(){console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as g,d as m}from"./chunk-VGICXM2C.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";import{exec as O}from"node:child_process";import{randomBytes as S}from"node:crypto";import _ from"node:http";var I=process.env.SOOTSIM_AUTH_ORIGIN||"https://sootbean.com",h="http://localhost:3000";async function x(r){if(r)return r;if(process.env.SOOTSIM_AUTH_ORIGIN)return process.env.SOOTSIM_AUTH_ORIGIN;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{if((await fetch(`${h}/api/auth/me`)).ok)return h}catch{}return I}function L(){console.log(`
3
3
  sootsim login \u2014 sign in so uploads can attach to your account
4
4
 
5
5
  usage:
@@ -21,6 +21,6 @@ options:
21
21
  <p style="color:#ccc">${r}</p>
22
22
  </div>
23
23
  </body>
24
- </html>`}async function P(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(e.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!e.ok){let c=await e.text().catch(()=>"");return{ok:!1,error:`dev-login ${e.status}: ${c}`}}let t=await e.json();return t.token?{ok:!0,token:t.token,userId:t.user?.id,email:t.email}:{ok:!1,error:"dev-login response missing token"}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"dev-login fetch failed"}}}function A(r){try{let e=new URL(r).hostname.replace(/^\[|\]$/g,"").toLowerCase();return!!(e==="localhost"||/^127(?:\.\d{1,3}){3}$/.test(e)||e==="::1"||e==="0.0.0.0"||e.endsWith(".local")||e.endsWith(".localhost")||e==="host.containers.internal"||e==="host.docker.internal"||e==="host.orb.internal"||e==="host.lima.internal"||e==="fd07:b51a:cc66:f0::fe"||e==="192.168.5.2"||/^192\.168\.(?:64|139)\.1$/.test(e))}catch{return!1}}async function G(r){(r.includes("--help")||r.includes("-h"))&&(L(),process.exit(0));let e=[...r],t=await x(R(e,"--origin"));if(A(t)){console.log(` detected local origin (${t}) \u2014 signing in as dev user`);let o=await P(t);if(o.ok){g({token:o.token,user:o.userId?{id:o.userId,email:o.email}:null,origin:t,source:"cli"});let s=await m(t),l=s?.user?.email||o.email||s?.user?.id||o.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-2RQQYIGP.js");n({event:"cli_login_succeeded",identity:{userId:o.userId??s?.user?.id??null},properties:{origin:t,mode:"dev"}}),await a(),console.log(` signed in${l?` as ${l}`:""} (dev)`);return}console.log(` dev-login not available (${o.error}); falling back to browser`)}let c=S(16).toString("hex"),i=await new Promise(o=>{let s=_.createServer((l,n)=>{try{let a=new URL(l.url||"/","http://127.0.0.1"),w=a.searchParams.get("state"),k=a.searchParams.get("token"),b=a.searchParams.get("email")||void 0,$=a.searchParams.get("userId")||void 0,f=a.searchParams.get("error");if(n.setHeader("content-type","text/html; charset=utf-8"),f){n.end(u(`sign-in failed: ${f}`)),o({ok:!1,error:f}),s.close();return}if(w!==c){n.end(u("state mismatch. close this tab and retry `sootsim login`.")),o({ok:!1,error:"state mismatch"}),s.close();return}if(!k){n.end(u("missing token. close this tab and retry `sootsim login`.")),o({ok:!1,error:"missing token"}),s.close();return}n.end(u("sign-in complete. you can return to the terminal.")),o({ok:!0,token:k,email:b,userId:$}),s.close()}catch(a){n.statusCode=500,n.end(u("sign-in callback failed. retry `sootsim login`.")),o({ok:!1,error:a instanceof Error?a.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let l=s.address();if(!l||typeof l=="string"){o({ok:!1,error:"failed to bind callback server"}),s.close();return}let n=new URL(`${t.replace(/\/$/,"")}/auth/sootsim-cli`);n.searchParams.set("state",c),n.searchParams.set("port",String(l.port)),n.searchParams.set("sootbean",t),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${l.port}`),console.log(` if nothing opens, visit:
24
+ </html>`}async function P(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/api/dev-login`,{method:"POST"});if(e.status===403)return{ok:!1,error:"dev-login disabled (not in dev mode)"};if(!e.ok){let c=await e.text().catch(()=>"");return{ok:!1,error:`dev-login ${e.status}: ${c}`}}let t=await e.json();return t.token?{ok:!0,token:t.token,userId:t.user?.id,email:t.email}:{ok:!1,error:"dev-login response missing token"}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"dev-login fetch failed"}}}function A(r){try{let e=new URL(r).hostname.replace(/^\[|\]$/g,"").toLowerCase();return!!(e==="localhost"||/^127(?:\.\d{1,3}){3}$/.test(e)||e==="::1"||e==="0.0.0.0"||e.endsWith(".local")||e.endsWith(".localhost")||e==="host.containers.internal"||e==="host.docker.internal"||e==="host.orb.internal"||e==="host.lima.internal"||e==="fd07:b51a:cc66:f0::fe"||e==="192.168.5.2"||/^192\.168\.(?:64|139)\.1$/.test(e))}catch{return!1}}async function G(r){(r.includes("--help")||r.includes("-h"))&&(L(),process.exit(0));let e=[...r],t=await x(R(e,"--origin"));if(A(t)){console.log(` detected local origin (${t}) \u2014 signing in as dev user`);let o=await P(t);if(o.ok){g({token:o.token,user:o.userId?{id:o.userId,email:o.email}:null,origin:t,source:"cli"});let s=await m(t),l=s?.user?.email||o.email||s?.user?.id||o.userId,{trackCliEvent:n,flushCliTelemetry:a}=await import("./telemetry-C2D5VTOD.js");n({event:"cli_login_succeeded",identity:{userId:o.userId??s?.user?.id??null},properties:{origin:t,mode:"dev"}}),await a(),console.log(` signed in${l?` as ${l}`:""} (dev)`);return}console.log(` dev-login not available (${o.error}); falling back to browser`)}let c=S(16).toString("hex"),i=await new Promise(o=>{let s=_.createServer((l,n)=>{try{let a=new URL(l.url||"/","http://127.0.0.1"),w=a.searchParams.get("state"),k=a.searchParams.get("token"),b=a.searchParams.get("email")||void 0,$=a.searchParams.get("userId")||void 0,f=a.searchParams.get("error");if(n.setHeader("content-type","text/html; charset=utf-8"),f){n.end(u(`sign-in failed: ${f}`)),o({ok:!1,error:f}),s.close();return}if(w!==c){n.end(u("state mismatch. close this tab and retry `sootsim login`.")),o({ok:!1,error:"state mismatch"}),s.close();return}if(!k){n.end(u("missing token. close this tab and retry `sootsim login`.")),o({ok:!1,error:"missing token"}),s.close();return}n.end(u("sign-in complete. you can return to the terminal.")),o({ok:!0,token:k,email:b,userId:$}),s.close()}catch(a){n.statusCode=500,n.end(u("sign-in callback failed. retry `sootsim login`.")),o({ok:!1,error:a instanceof Error?a.message:"callback failed"}),s.close()}});s.listen(0,"127.0.0.1",()=>{let l=s.address();if(!l||typeof l=="string"){o({ok:!1,error:"failed to bind callback server"}),s.close();return}let n=new URL(`${t.replace(/\/$/,"")}/auth/sootsim-cli`);n.searchParams.set("state",c),n.searchParams.set("port",String(l.port)),n.searchParams.set("sootbean",t),console.log(" opening browser for sootsim login..."),console.log(` waiting for callback on 127.0.0.1:${l.port}`),console.log(` if nothing opens, visit:
25
25
  ${n.toString()}
26
- `),T(n.toString())})});if(!i.ok){let{trackCliEvent:o,flushCliTelemetry:s}=await import("./telemetry-2RQQYIGP.js");o({event:"cli_login_failed",properties:{origin:t,error:i.error}}),await s(),console.error(` login failed: ${i.error}`),process.exit(1)}g({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:t,source:"cli"});let d=await m(t),p=d?.user?.email||i.email||d?.user?.id||i.userId,{trackCliEvent:y,flushCliTelemetry:v}=await import("./telemetry-2RQQYIGP.js");y({event:"cli_login_succeeded",identity:{userId:i.userId??d?.user?.id??null},properties:{origin:t}}),await v(),console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
26
+ `),T(n.toString())})});if(!i.ok){let{trackCliEvent:o,flushCliTelemetry:s}=await import("./telemetry-C2D5VTOD.js");o({event:"cli_login_failed",properties:{origin:t,error:i.error}}),await s(),console.error(` login failed: ${i.error}`),process.exit(1)}g({token:i.token,user:i.userId?{id:i.userId,email:i.email}:null,origin:t,source:"cli"});let d=await m(t),p=d?.user?.email||i.email||d?.user?.id||i.userId,{trackCliEvent:y,flushCliTelemetry:v}=await import("./telemetry-C2D5VTOD.js");y({event:"cli_login_succeeded",identity:{userId:i.userId??d?.user?.id??null},properties:{origin:t}}),await v(),console.log(` signed in${p?` as ${p}`:""}`)}export{G as runLogin};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as r,b as i}from"./chunk-WUV6QJJU.js";import{a as t,c as o}from"./chunk-UKKQXZFZ.js";import"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";async function s(){let e=t();if(!e?.token){console.log(" not signed in");return}try{await fetch(`${e.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${e.token}`}})}catch{}o(),r({event:"cli_logout",identity:{userId:e.user?.id??null},properties:{origin:e.origin}}),await i(),console.log(" signed out")}export{s as runLogout};
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as r,b as i}from"./chunk-JFURKF6W.js";import{a as t,c as o}from"./chunk-VGICXM2C.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";async function s(){let e=t();if(!e?.token){console.log(" not signed in");return}try{await fetch(`${e.origin.replace(/\/$/,"")}/api/auth/sign-out`,{method:"POST",headers:{authorization:`Bearer ${e.token}`}})}catch{}o(),r({event:"cli_logout",identity:{userId:e.user?.id??null},properties:{origin:e.origin}}),await i(),console.log(" signed out")}export{s as runLogout};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{e as w,f as v}from"./chunk-6XAGMAP7.js";import{c as y}from"./chunk-XJHF3OFF.js";import{a as h}from"./chunk-WSF2QLMD.js";import"./chunk-QLZSJLM4.js";import"./chunk-O2X7YSAD.js";import"./chunk-JCXQE5XP.js";import"./chunk-RINOK2FV.js";import"./chunk-KITHQVX5.js";import"./chunk-A4J3ZFTP.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import"./chunk-5N2BFB4I.js";import"./chunk-LJ4CQHHZ.js";import"./chunk-SQ2MTGDQ.js";import"./chunk-NX2QM2BE.js";import"./chunk-WXN3JD2J.js";import"./chunk-BORW7JE4.js";import"./chunk-O7QYV2FI.js";import"./chunk-6YV6WW5Q.js";import"./chunk-S23R7GAE.js";import"./chunk-WUV6QJJU.js";import"./chunk-UKKQXZFZ.js";import"./chunk-7NN725AT.js";import"./chunk-R7AEJR2M.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-5XMJFP54.js";import"./chunk-JALTULVB.js";import*as n from"fs";import*as a from"path";var S=[".maestro","maestro"];function k(){console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{e as w,f as v}from"./chunk-WS4H3OTZ.js";import{c as y}from"./chunk-WT4SBY54.js";import{a as h}from"./chunk-R62P6SPR.js";import"./chunk-RHKQEMHY.js";import"./chunk-BQSG37WI.js";import"./chunk-ZWFFRBAR.js";import"./chunk-HRH5AL5T.js";import"./chunk-2OCQ4XLZ.js";import"./chunk-ODWHC4OS.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-HNBFCX26.js";import"./chunk-QS73KI7T.js";import"./chunk-3FZ2YUUP.js";import"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-U2QSYQUZ.js";import"./chunk-ZUV7FVK5.js";import"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";import*as n from"fs";import*as a from"path";var S=[".maestro","maestro"];function k(){console.log(`
3
3
  sootsim maestro \u2014 run maestro YAML flows against sootsim (drop-in)
4
4
 
5
5
  usage:
@@ -0,0 +1,99 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g,i as m,l as N,m as R}from"./chunk-3FZ2YUUP.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";function I(o){let e=o[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function h(o,e,n){let r=g(o,{port:e.port}),a=I(r.positional),l=m({...r,commandTimeoutMs:5e3});try{let c=!!(await N(l,"SootSim.bridges.settings.get"))?.[n.modeKey],s=a==="on"?!0:a==="off"?!1:!c;if(c===s)return console.log(` ${n.displayName}: already ${s?"on":"off"}`),{current:c,target:s,changed:!1};if(!await l.send({type:"evaluate",acquireLock:!0,code:`(async () => {
3
+ const modeKey = ${JSON.stringify(n.modeKey)}
4
+ const target = ${JSON.stringify(s)}
5
+ window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
6
+ detail: { type: 'fire-action', id: ${JSON.stringify(n.actionId)} },
7
+ }))
8
+ const deadline = Date.now() + 1200
9
+ while (Date.now() < deadline) {
10
+ if (Boolean(window.SootSim?.bridges?.settings?.get?.()?.[modeKey]) === target) {
11
+ return true
12
+ }
13
+ await new Promise((resolve) => setTimeout(resolve, 40))
14
+ }
15
+ return false
16
+ })()`}))throw new Error(`${n.displayName} did not change to ${s?"on":"off"}; the live shell may not support this mode`);return console.log(` ${n.displayName}: ${c?"on":"off"} -> ${s?"on":"off"}`),{current:c,target:s,changed:!0}}finally{l.close()}}async function E(o,e){(o.includes("--help")||o.includes("-h"))&&(console.log(`
17
+ sootsim mode screenshot \u2014 toggle the screenshot-mode chrome overlay
18
+
19
+ usage:
20
+ sootsim mode screenshot [on|off|toggle]
21
+
22
+ arguments:
23
+ on enable screenshot mode (enables showFrame if needed)
24
+ off disable screenshot mode
25
+ toggle flip the current state (default)
26
+
27
+ examples:
28
+ sootsim mode screenshot
29
+ sootsim mode screenshot on
30
+ sootsim mode screenshot off
31
+ `),process.exit(0)),await h(o,e,{modeKey:"screenshotMode",displayName:"screenshot-mode",actionId:"toggle-screenshot-mode"})}var M=12e3;async function F(o,e){if((o.includes("--help")||o.includes("-h"))&&(console.log(`
32
+ sootsim mode three \u2014 toggle the 3d device stage
33
+
34
+ usage:
35
+ sootsim mode three [on|off|toggle]
36
+ sootsim mode three configure [options]
37
+
38
+ arguments:
39
+ on enable 3d mode
40
+ off disable 3d mode
41
+ toggle flip the current state (default)
42
+
43
+ configure options:
44
+ --background <id> set the 3d background
45
+ --gradient <stops> custom gradient bg: comma-separated css hex stops,
46
+ e.g. "#0a0e1a,#16243f,#05080f" (overrides --background;
47
+ evenly spaced, or use "color@offset" for explicit %)
48
+ --gradient-angle <deg> custom gradient angle (default 180 = top\u2192bottom)
49
+ --colorway <id> set the phone colorway
50
+ --script <id> apply a camera preset pose
51
+ --progress <0..1> script progress to sample (default: 1)
52
+ --animate run the script instead of sampling one frame
53
+ --slow run the script slowly when --animate is set
54
+ --environment on|off enable or disable environment objects
55
+ --env-shape <id> orb | pill | diamond | pane
56
+ --env-spread <id> tight | medium | wide
57
+ --env-size <id> small | medium | large
58
+ --env-color <id> peach | gold | mint | sky | violet
59
+ --env-glow on|off enable or disable environment glow
60
+ --env-plastic on|off enable or disable environment plastic material
61
+ --room on|off enable or disable the room effect
62
+ --focus on|off enable or disable Focus depth of field
63
+ --focus-amount <id> soft | medium | strong
64
+ --focus-band <id> thin | natural | wide
65
+ --focus-foreground <id> gentle | portrait | heavy
66
+ --focus-background <id> soft | natural | deep
67
+ --focus-optics <id> clean | lens | aperture
68
+ --bokeh on|off legacy alias for --focus on|off
69
+ --reset-pose return to the default hero pose before other changes
70
+
71
+ examples:
72
+ sootsim mode three
73
+ sootsim mode three on
74
+ sootsim mode three configure --script hero-arc --background gradient-neon
75
+ sootsim mode three configure --environment on --env-shape pane --room on
76
+ sootsim mode three off
77
+ `),process.exit(0)),z(o)){await K(o,e);return}(await h(o,e,{modeKey:"threeMode",displayName:"three-mode",actionId:"toggle-three-mode"})).target&&await P(o,e)}function z(o){return o[0]==="configure"||o.some(e=>["--background","--gradient","--gradient-angle","--colorway","--script","--progress","--animate","--slow","--environment","--env-shape","--env-spread","--env-size","--env-color","--env-glow","--env-plastic","--room","--focus","--focus-amount","--focus-band","--focus-foreground","--focus-background","--focus-optics","--bokeh","--reset-pose"].includes(e))}async function K(o,e){let n=g(o,{port:e.port,stripBooleanFlags:["--animate","--slow","--reset-pose"],stripValueFlags:["--background","--gradient","--gradient-angle","--colorway","--script","--progress","--environment","--env-shape","--env-spread","--env-size","--env-color","--env-glow","--env-plastic","--room","--focus","--focus-amount","--focus-band","--focus-foreground","--focus-background","--focus-optics","--bokeh"]}),r=_(o),a=m({...n,commandTimeoutMs:M+1e3});try{await C(a);let l=await R(a,"SootSim.bridges.threeMode.configure",r);console.log(` three-mode: configured (${j(l)})`)}finally{a.close()}}async function P(o,e){let n=g(o,{port:e.port}),r=m({...n,commandTimeoutMs:M+1e3});try{await C(r)}finally{r.close()}}async function C(o){let e=await o.send({type:"evaluate",code:`(async () => {
78
+ const deadline = Date.now() + ${M}
79
+ while (Date.now() < deadline) {
80
+ const settings = window.SootSim?.bridges?.settings?.get?.()
81
+ if (settings && settings.threeMode !== true) {
82
+ return { ready: false, disabled: true }
83
+ }
84
+ const bridge = window.SootSim?.bridges?.threeMode
85
+ const state = typeof bridge?.getState === 'function' ? bridge.getState() : null
86
+ if (state?.ready === true) return state
87
+ await new Promise((resolve) => setTimeout(resolve, 50))
88
+ }
89
+ const bridge = window.SootSim?.bridges?.threeMode
90
+ const state = typeof bridge?.getState === 'function' ? bridge.getState() : null
91
+ return state || { ready: false }
92
+ })()`});if(e?.ready===!0)return e;throw e?.disabled?new Error("3d mode is off; run `sootsim mode three on` before configure"):new Error("3d mode runtime did not become ready")}function _(o){let e=t=>o.find((d,i)=>o[i-1]===t),n={},r=e("--colorway");r&&(n.colorway=r);let a=e("--background");a&&(n.background=a);let l=e("--gradient");if(l){let t=l.split(",").map(S=>S.trim()).filter(Boolean),d=t.map((S,O)=>{let[D,T]=S.split("@"),f=T!==void 0?Number.parseFloat(T):t.length>1?O/(t.length-1):0;return f>1&&(f=f/100),Number.isFinite(f)||(f=t.length>1?O/(t.length-1):0),{color:D.trim(),offset:f}}),i=e("--gradient-angle"),v=i===void 0?void 0:Number.parseFloat(i);if(i!==void 0&&!Number.isFinite(v))throw new Error(`--gradient-angle expects a number, got "${i}"`);n.customGradient={stops:d,...v!==void 0?{angleDeg:v}:{}}}let b=u(e("--room"),"--room");b!==void 0&&(n.room=b);let c=u(e("--bokeh"),"--bokeh");c!==void 0&&(n.bokeh=c);let s={},w=u(e("--focus"),"--focus");w!==void 0&&(s.enabled=w);for(let[t,d]of[["--focus-amount","amount"],["--focus-band","band"],["--focus-foreground","foreground"],["--focus-background","background"],["--focus-optics","optics"]]){let i=e(t);i&&(s[d]=i)}Object.keys(s).length>0&&(n.focus=s),o.includes("--reset-pose")&&(n.resetPose=!0);let k=u(e("--environment"),"--environment"),y={},p={};for(let[t,d]of[["--env-shape","shape"],["--env-spread","spread"],["--env-size","size"],["--env-color","color"]]){let i=e(t);i&&(y[d]=i)}let B=u(e("--env-glow"),"--env-glow");B!==void 0&&(p.glow=B);let x=u(e("--env-plastic"),"--env-plastic");x!==void 0&&(p.plastic=x),(k!==void 0||Object.keys(y).length>0||Object.keys(p).length>0)&&(n.environment=k===!1?!1:{pins:y,effects:p});let $=e("--script");if($){let t=e("--progress"),d=t===void 0?1:Number.parseFloat(t);if(!Number.isFinite(d))throw new Error(`--progress expects a number from 0 to 1, got "${t}"`);n.script={id:$,progress:d,animate:o.includes("--animate"),slow:o.includes("--slow")}}return n}function u(o,e){if(o===void 0)return;let n=o.toLowerCase();if(["on","true","yes","1"].includes(n))return!0;if(["off","false","no","0"].includes(n))return!1;throw new Error(`${e} expects on or off, got "${o}"`)}function j(o){return[`ready=${!!o.ready}`,`background=${String(o.background??"unknown")}`,`colorway=${String(o.colorway??"unknown")}`,`environment=${o.environmentActive?"on":"off"}`,`room=${o.room?"on":"off"}`,`focus=${o.bokeh?"on":"off"}`].join(", ")}var L=new Set(["--sim","--port","-p"]),V=new Set(["screenshot","three"]);function W(o){for(let e=0;e<o.length;e++){let n=o[e];if(n.startsWith("-")){L.has(n)&&e++;continue}return V.has(n)?{name:n,index:e}:null}return null}function J(o,e){return[...o.slice(0,e),...o.slice(e+1)]}function A(){console.log(`
93
+ sootsim mode \u2014 toggle live display modes
94
+
95
+ usage:
96
+ sootsim mode screenshot [on|off|toggle]
97
+ sootsim mode three [on|off|toggle]
98
+ sootsim mode three configure [options]
99
+ `)}async function oe(o,e){if(o.includes("--help")||o.includes("-h")){A();return}let n=W(o);n||(A(),process.exit(1));let r=J(o,n.index);if(n.name==="screenshot"){await E(r,e);return}await F(r,e)}export{oe as runMode};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b}from"./chunk-EYUZLNLC.js";import"./chunk-OOGJDQMT.js";export{a as loadOptionalDemoApps,b as optionalDemoAppsSync};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{k as x}from"./chunk-XJHF3OFF.js";import"./chunk-WSF2QLMD.js";import"./chunk-RINOK2FV.js";import"./chunk-KITHQVX5.js";import"./chunk-A4J3ZFTP.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import"./chunk-5N2BFB4I.js";import"./chunk-LJ4CQHHZ.js";import"./chunk-SQ2MTGDQ.js";import{g as R,i as N,l as d,m as S}from"./chunk-NX2QM2BE.js";import"./chunk-WXN3JD2J.js";import"./chunk-BORW7JE4.js";import"./chunk-O7QYV2FI.js";import"./chunk-6YV6WW5Q.js";import"./chunk-S23R7GAE.js";import"./chunk-7NN725AT.js";import"./chunk-R7AEJR2M.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-5XMJFP54.js";import"./chunk-JALTULVB.js";import{mkdirSync as W,writeFileSync as A}from"fs";import{dirname as J,resolve as B}from"path";import{WebSocket as E}from"ws";var C=e=>new Promise(o=>setTimeout(o,e)),v=class{ws;nextId=1;pending=new Map;listeners=new Set;ready;constructor(o){this.ws=new E(o,{maxPayload:1<<28}),this.ready=new Promise((r,t)=>{this.ws.once("open",()=>r()),this.ws.once("error",t)}),this.ws.on("message",r=>{let t=JSON.parse(r.toString());if(t.id&&this.pending.has(t.id)){let{res:n,rej:s}=this.pending.get(t.id);this.pending.delete(t.id),t.error?s(new Error(JSON.stringify(t.error))):n(t.result)}else if(t.method)for(let n of this.listeners)n(t.method,t.params)})}waitOpen(){return this.ready}on(o){this.listeners.add(o)}send(o,r={},t){let n=this.nextId++;return new Promise((s,l)=>{this.pending.set(n,{res:s,rej:l}),this.ws.send(JSON.stringify({id:n,method:o,params:r,...t?{sessionId:t}:{}}))})}close(){try{this.ws.close()}catch{}}};async function O(e,o){let r=Number(w(e,"--duration")??"5");if(!Number.isFinite(r)||r<=0)return console.error(" --duration must be a positive number (seconds)"),1;let t=Number(w(e,"--sample-interval")??"0.1"),n=Number(w(e,"--cdp-port")??process.env.SOOTSIM_CDP_PORT??"9222"),s=w(e,"--match")??"/rn/",l=w(e,"--output")??w(e,"-o"),i=B(process.cwd(),l??"/tmp/sootsim.cpuprofile"),a=[];try{a=await(await fetch(`http://localhost:${n}/json/list`)).json()}catch{return U(n),1}let f=a.find(m=>m.type==="page"&&m.url.includes(s));if(!f)return console.error(` no page target matching "${s}" on CDP :${n}`),console.error(` open targets: ${a.map(m=>m.url).join(", ")||"(none)"}`),1;let u=new v(f.webSocketDebuggerUrl);await u.waitOpen();try{let m=new Map;if(u.on((c,p)=>{c==="Target.attachedToTarget"&&p.targetInfo?.type==="worker"&&m.set(p.sessionId,p.targetInfo.url),c==="Target.detachedFromTarget"&&m.delete(p.sessionId)}),await u.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),await C(500),m.size===0)return console.error(" no worker targets attached \u2014 is the app loaded in this tab?"),1;for(let c of m.keys())await u.send("Profiler.enable",{},c),await u.send("Profiler.setSamplingInterval",{interval:t*1e3},c),await u.send("Profiler.start",{},c);console.log(` recording ${r}s across ${m.size} worker(s) \u2014 interact now\u2026`),await C(r*1e3);let b=[];for(let[c,p]of m){let{profile:y}=await u.send("Profiler.stop",{},c);b.push({url:p,profile:y})}return b.sort((c,p)=>p.profile.samples.length-c.profile.samples.length),W(J(i),{recursive:!0}),b.forEach((c,p)=>{let y=p===0?i:i.replace(/(\.[^.]+)?$/,`.worker${p}$1`);if(A(y,JSON.stringify(c.profile)),console.log(` ${P(c.url)}: ${c.profile.samples.length} samples \u2192 ${y}`),o.verbose&&c.profile.samples.length>0)for(let $ of _(c.profile,12))console.log(` ${$.pct.toFixed(1).padStart(5)}% ${$.name} ${$.url}`)}),console.log(" open in chrome devtools \u2192 Performance \u2192 Load profile to inspect."),0}finally{u.close()}}function U(e){console.error(` perf cpu needs a CDP-enabled browser on :${e}.`),console.error(" the tenant worker can't be profiled via the JS Self-Profiler API (F28),"),console.error(" so the sim must expose Chrome remote debugging. easiest path \u2014"),console.error(" open the sim with a CDP port (it stays driveable over the bridge,"),console.error(" so you can scroll/navigate while profiling):"),console.error(""),console.error(` sootsim open <metro-port> --new --driver playwright --cdp-port ${e}`),console.error(` sootsim perf cpu --cdp-port ${e} --match <metro-port>`),console.error(""),console.error(" or launch a standalone CDP Chrome (not bridge-driveable):"),console.error(""),console.error(' "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \\'),console.error(` --remote-debugging-port=${e} --user-data-dir=/tmp/sootsim-cdp \\`),console.error(" --no-sandbox --disable-gpu-sandbox --in-process-gpu \\"),console.error(" --use-gl=angle --use-angle=swiftshader --enable-unsafe-swiftshader \\"),console.error(' "http://localhost:5173/rn/<metro-port>" &'),console.error(""),console.error(" override the port with --cdp-port or $SOOTSIM_CDP_PORT.")}function P(e){return e?e.replace(/^https?:\/\/[^/]+/,"").replace(/\?.*$/,"").slice(-50):"(native)"}function _(e,o){let r=e.samples.length||1,t=new Map;for(let n of e.nodes){let s=n.callFrame,l=`${s.functionName||"(anonymous)"}@${P(s.url)}:${s.lineNumber}`,i=t.get(l)??{self:0,name:s.functionName||"(anonymous)",url:`${P(s.url)}:${s.lineNumber}`};i.self+=n.hitCount??0,t.set(l,i)}return[...t.values()].map(n=>({...n,pct:n.self/r*100})).sort((n,s)=>s.self-n.self).slice(0,o)}function w(e,o){let r=e.indexOf(o);if(!(r<0||r===e.length-1))return e[r+1]}function j(){console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{k as x}from"./chunk-WT4SBY54.js";import"./chunk-R62P6SPR.js";import"./chunk-HRH5AL5T.js";import"./chunk-2OCQ4XLZ.js";import"./chunk-ODWHC4OS.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-HNBFCX26.js";import"./chunk-QS73KI7T.js";import{g as R,i as N,l as d,m as S}from"./chunk-3FZ2YUUP.js";import"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-U2QSYQUZ.js";import"./chunk-ZUV7FVK5.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";import{mkdirSync as W,writeFileSync as A}from"fs";import{dirname as J,resolve as B}from"path";import{WebSocket as E}from"ws";var C=e=>new Promise(o=>setTimeout(o,e)),v=class{ws;nextId=1;pending=new Map;listeners=new Set;ready;constructor(o){this.ws=new E(o,{maxPayload:1<<28}),this.ready=new Promise((r,t)=>{this.ws.once("open",()=>r()),this.ws.once("error",t)}),this.ws.on("message",r=>{let t=JSON.parse(r.toString());if(t.id&&this.pending.has(t.id)){let{res:n,rej:s}=this.pending.get(t.id);this.pending.delete(t.id),t.error?s(new Error(JSON.stringify(t.error))):n(t.result)}else if(t.method)for(let n of this.listeners)n(t.method,t.params)})}waitOpen(){return this.ready}on(o){this.listeners.add(o)}send(o,r={},t){let n=this.nextId++;return new Promise((s,l)=>{this.pending.set(n,{res:s,rej:l}),this.ws.send(JSON.stringify({id:n,method:o,params:r,...t?{sessionId:t}:{}}))})}close(){try{this.ws.close()}catch{}}};async function O(e,o){let r=Number(w(e,"--duration")??"5");if(!Number.isFinite(r)||r<=0)return console.error(" --duration must be a positive number (seconds)"),1;let t=Number(w(e,"--sample-interval")??"0.1"),n=Number(w(e,"--cdp-port")??process.env.SOOTSIM_CDP_PORT??"9222"),s=w(e,"--match")??"/rn/",l=w(e,"--output")??w(e,"-o"),i=B(process.cwd(),l??"/tmp/sootsim.cpuprofile"),a=[];try{a=await(await fetch(`http://localhost:${n}/json/list`)).json()}catch{return U(n),1}let f=a.find(m=>m.type==="page"&&m.url.includes(s));if(!f)return console.error(` no page target matching "${s}" on CDP :${n}`),console.error(` open targets: ${a.map(m=>m.url).join(", ")||"(none)"}`),1;let u=new v(f.webSocketDebuggerUrl);await u.waitOpen();try{let m=new Map;if(u.on((c,p)=>{c==="Target.attachedToTarget"&&p.targetInfo?.type==="worker"&&m.set(p.sessionId,p.targetInfo.url),c==="Target.detachedFromTarget"&&m.delete(p.sessionId)}),await u.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),await C(500),m.size===0)return console.error(" no worker targets attached \u2014 is the app loaded in this tab?"),1;for(let c of m.keys())await u.send("Profiler.enable",{},c),await u.send("Profiler.setSamplingInterval",{interval:t*1e3},c),await u.send("Profiler.start",{},c);console.log(` recording ${r}s across ${m.size} worker(s) \u2014 interact now\u2026`),await C(r*1e3);let b=[];for(let[c,p]of m){let{profile:y}=await u.send("Profiler.stop",{},c);b.push({url:p,profile:y})}return b.sort((c,p)=>p.profile.samples.length-c.profile.samples.length),W(J(i),{recursive:!0}),b.forEach((c,p)=>{let y=p===0?i:i.replace(/(\.[^.]+)?$/,`.worker${p}$1`);if(A(y,JSON.stringify(c.profile)),console.log(` ${P(c.url)}: ${c.profile.samples.length} samples \u2192 ${y}`),o.verbose&&c.profile.samples.length>0)for(let $ of _(c.profile,12))console.log(` ${$.pct.toFixed(1).padStart(5)}% ${$.name} ${$.url}`)}),console.log(" open in chrome devtools \u2192 Performance \u2192 Load profile to inspect."),0}finally{u.close()}}function U(e){console.error(` perf cpu needs a CDP-enabled browser on :${e}.`),console.error(" the tenant worker can't be profiled via the JS Self-Profiler API (F28),"),console.error(" so the sim must expose Chrome remote debugging. easiest path \u2014"),console.error(" open the sim with a CDP port (it stays driveable over the bridge,"),console.error(" so you can scroll/navigate while profiling):"),console.error(""),console.error(` sootsim open <metro-port> --new --driver playwright --cdp-port ${e}`),console.error(` sootsim perf cpu --cdp-port ${e} --match <metro-port>`),console.error(""),console.error(" or launch a standalone CDP Chrome (not bridge-driveable):"),console.error(""),console.error(' "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \\'),console.error(` --remote-debugging-port=${e} --user-data-dir=/tmp/sootsim-cdp \\`),console.error(" --no-sandbox --disable-gpu-sandbox --in-process-gpu \\"),console.error(" --use-gl=angle --use-angle=swiftshader --enable-unsafe-swiftshader \\"),console.error(' "http://localhost:5173/rn/<metro-port>" &'),console.error(""),console.error(" override the port with --cdp-port or $SOOTSIM_CDP_PORT.")}function P(e){return e?e.replace(/^https?:\/\/[^/]+/,"").replace(/\?.*$/,"").slice(-50):"(native)"}function _(e,o){let r=e.samples.length||1,t=new Map;for(let n of e.nodes){let s=n.callFrame,l=`${s.functionName||"(anonymous)"}@${P(s.url)}:${s.lineNumber}`,i=t.get(l)??{self:0,name:s.functionName||"(anonymous)",url:`${P(s.url)}:${s.lineNumber}`};i.self+=n.hitCount??0,t.set(l,i)}return[...t.values()].map(n=>({...n,pct:n.self/r*100})).sort((n,s)=>s.self-n.self).slice(0,o)}function w(e,o){let r=e.indexOf(o);if(!(r<0||r===e.length-1))return e[r+1]}function j(){console.log(`
3
3
  sootsim perf react \u2014 inspect React component render cost in the tenant worker
4
4
 
5
5
  usage:
@@ -1,10 +1,10 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as P}from"./chunk-QLZSJLM4.js";import"./chunk-O2X7YSAD.js";import{a as Z,c as ee}from"./chunk-JCXQE5XP.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import{g as b,i as v,j as Q}from"./chunk-NX2QM2BE.js";import{d as Y}from"./chunk-O7QYV2FI.js";import"./chunk-WUV6QJJU.js";import"./chunk-UKKQXZFZ.js";import"./chunk-2QAG5IPN.js";import{b as X}from"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";import{existsSync as we,mkdirSync as E,readdirSync as he,readFileSync as be,rmSync as J,writeFileSync as I}from"fs";import{homedir as ve,tmpdir as ye}from"os";import{dirname as W,extname as oe,join as N,resolve as Se}from"path";var z=24e4,Re=9e4,$e=3e4;async function D(e,r,o,i){let t=Math.max(2e4,i+$e);try{return await e.send({type:"evaluate",code:r},{timeoutMs:t})}catch(n){let s=n instanceof Error?n.message:String(n);/^command timed out after \d+s$/.test(s)&&(console.error(` ${o} stalled \u2014 the render host did not finish within ${Math.round(t/1e3)}s; it is likely contended or wedged.
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as P}from"./chunk-RHKQEMHY.js";import"./chunk-BQSG37WI.js";import{a as Z,c as ee}from"./chunk-ZWFFRBAR.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import{g as b,i as v,j as Q}from"./chunk-3FZ2YUUP.js";import{d as Y}from"./chunk-2YZKJ3ZJ.js";import"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-6WL7GBOW.js";import{b as X}from"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";import{existsSync as we,mkdirSync as E,readdirSync as he,readFileSync as be,rmSync as J,writeFileSync as I}from"fs";import{homedir as ve,tmpdir as ye}from"os";import{dirname as W,extname as oe,join as N,resolve as Se}from"path";var z=24e4,Re=9e4,$e=3e4;async function D(e,r,o,i){let t=Math.max(2e4,i+$e);try{return await e.send({type:"evaluate",code:r},{timeoutMs:t})}catch(n){let s=n instanceof Error?n.message:String(n);/^command timed out after \d+s$/.test(s)&&(console.error(` ${o} stalled \u2014 the render host did not finish within ${Math.round(t/1e3)}s; it is likely contended or wedged.
3
3
  the capture lock auto-releases, so simply retry the recording.
4
4
  if it persists, recover the sim with \`sootsim close --sim <id>\`.`),process.exit(1)),/render host not available|already streaming|already recording|lock already held/i.test(s)&&(console.error(` ${o} failed: ${s}
5
5
  a prior recording was abandoned and its capture is still
6
6
  releasing. the lock self-heals in ~${Math.round((i+2e4)/1e3)}s \u2014 retry then, or recover now with
7
- \`sootsim close --sim <id>\` and reopen the sim.`),process.exit(1)),console.error(` ${o} failed: ${s}`),process.exit(1)}}var _e=new Set(["--sim","--port","-p","--mode","--duration","--fps","--format","--output","-o","--frames","--max-width","--origin","--owner","--repo"]),xe=new Set(["start","stop","cancel","status","prelude-start","upload"]);function Oe(e){for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("-")){_e.has(o)&&r++;continue}return xe.has(o)?{name:o,index:r}:null}return null}function ke(){let e=process.env,r=(e.SOOT_BRANCH||e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME||"").trim(),o=(e.SOOT_SHA||e.GITHUB_SHA||"").trim(),i=(e.SOOT_PR_NUMBER||"").trim(),t=i?Number.parseInt(i,10):Number.NaN,n=(e.SOOT_PR_TITLE||"").trim();return{branch:r||void 0,commitSha:o||void 0,pullRequestNumber:Number.isFinite(t)&&t>0?t:void 0,pullRequestTitle:n||void 0}}function re(e){let r=l(e,"--owner")?.trim(),o=l(e,"--repo")?.trim();return(r&&!o||!r&&o)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),r&&o?{owner:r,repo:o}:null}async function qe(e,r){let o=Oe(e);if(o){let d=[...e.slice(0,o.index),...e.slice(o.index+1)];if(o.name==="start"){await Ie(d,r);return}if(o.name==="prelude-start"){await Ne(d,r);return}if(o.name==="upload"){let{runUpload:y}=await import("./upload-H53ZS5FN.js");await y(d,r);return}if(o.name==="stop"){await Pe(d,r);return}if(o.name==="cancel"){await Fe(d,r);return}await Ae(d,r);return}let i=b(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width","--origin","--owner","--repo"]}),t=ie(l(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=l(e,"--format");s&&!["webm","mp4","gif","png"].includes(s)&&(console.error(` invalid --format "${s}" \u2014 expected webm | mp4 | gif | png`),process.exit(1));let c=l(e,"--output"),a=Number(l(e,"--duration")??"10");(!Number.isFinite(a)||a<=0)&&(console.error(` invalid --duration "${l(e,"--duration")}" \u2014 expected a positive number of seconds`),process.exit(1));let m=600;a>m&&(console.error(` invalid --duration "${l(e,"--duration")}" \u2014 exceeds the ${m}s (10m) maximum`),process.exit(1));let u=Number(l(e,"--fps")??"30"),p=l(e,"--frames");if(p!==void 0){let d=Number(p);(!Number.isInteger(d)||d<=0)&&(console.error(` invalid --frames "${p}" \u2014 expected a positive integer count`),process.exit(1))}let x=e.includes("--open"),j=l(e,"--max-width")?Number(l(e,"--max-width")):void 0,g=Math.max(100,Math.round(a*1e3)),K=l(e,"--origin"),pe=re(e);if(t==="live"||t==="combined"){c&&console.log(` note: --output is ignored for --mode ${t} \u2014 the recording uploads to /preview/<id>`),n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await P("record",{originOverride:K,allowGitHubAuth:!0});let d=v({...i,commandTimeoutMs:6e4});try{await q(d),await ae(d,t),t==="combined"&&await B(d),await de(d,K,pe);let y=await ce(d,t,t==="combined"?n:void 0);y.ok||(console.error(` start failed: recording store refused to start (${t})`+(y.error?`: ${y.error}`:"")),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(_=>setTimeout(_,g)),await le(d);let O=await ue(d);me(O,x,t)}finally{d.close()}return}let C=p?Number(p):null,R=Te(s,c,C);x&&console.log(" note: --open is ignored for local-file capture \u2014 it applies to --mode live/combined");let h=v({...i,commandTimeoutMs:6e4});try{if(await te(h),await B(h),R==="png"){let $=C??10,w=U(c,`sootsim-frames-${M()}`);c&&oe(c)&&console.log(` note: --frames writes multiple pngs, so --output "${c}" is a directory \u2014 frame-NNN.png files land inside it`),E(w,{recursive:!0});for(let f of he(w))/^frame-\d+\.png$/.test(f)&&J(N(w,f),{force:!0});console.log(` sampling ${$} frames over ${a}s \u2192 ${w}`);let S=await h.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${$}, durationMs: ${g}${n?`, layers: ${JSON.stringify(n)}`:""} })`});(!S.ok||!S.requestId)&&(console.error(` frame capture start failed: ${S.error??"unknown error"}`),process.exit(1)),await new Promise(f=>setTimeout(f,g));let fe=Date.now()+Math.max(5e3,g),A=null;for(;;){let f=await h.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${S.requestId})`});if(f||(console.error(" frame capture result missing"),process.exit(1)),f.done){f.ok||(console.error(` frame capture failed: ${f.error??"unknown error"}`),process.exit(1)),A=f.frames??[];break}Date.now()>=fe&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(F=>setTimeout(F,100))}A.forEach((f,F)=>{let ge=`${w}/frame-${String(F+1).padStart(3,"0")}.png`;I(ge,Buffer.from(f.data,"base64"))}),console.log(` saved ${A.length} frames`);return}if(R==="gif"){let $=C??Math.max(10,Math.round(a*u/3)),w=U(c,`sootsim-${M()}.gif`);E(W(w),{recursive:!0}),console.log(` encoding gif: ${$} frames over ${a}s \u2192 ${w}`);let S=await D(h,`window.__sootsimRecorder.captureGif({ frames: ${$}, durationMs: ${g}${j?`, maxWidth: ${j}`:""}${n?`, layers: ${JSON.stringify(n)}`:""} })`,"gif encode",g);S||(console.error(" gif capture returned no frames"),process.exit(1)),I(w,Buffer.from(S.data,"base64")),console.log(` saved: ${w} (${G(S.size)})`);return}let d=U(c,`sootsim-${M()}.${R}`);E(W(d),{recursive:!0});let y={format:R,fps:u,durationMs:g};n&&(y.layers=n);let O=await D(h,`window.__sootsimRecorder.start(${JSON.stringify(y)})`,`${R} start`,g);O.ok||(console.error(` start failed: ${O.error??"unknown error"}`),/render host not available|already streaming|already recording|lock already held/i.test(O.error??"")&&console.error(" a prior recording was abandoned and its capture is still\n releasing. retry in ~20s, or recover now with\n `sootsim close --sim <id>` then reopen the sim."),process.exit(1)),console.log(` recording ${R} for ${a}s \u2192 ${d}`),await new Promise($=>setTimeout($,g));let _=await D(h,"window.__sootsimRecorder.stop()",`${R} encode/flush`,g);_.ok||(console.error(` stop failed: ${_.error??"unknown error"}`),process.exit(1)),_.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await ne(h,d),console.log(` saved: ${d} (${G(_.size)})`)}finally{h.close()}}var Ee=6e3;async function L(e,r){try{return await e.send({type:"evaluate",code:r},{timeoutMs:Ee})}catch(o){let i=o instanceof Error?o.message:String(o);throw/^command timed out after \d+s$/.test(i)&&(console.error(" sim did not respond \u2014 it is connected to the bridge but has not\n loaded an app (or its page is unresponsive). run `sootsim list`\n and target a sim with a loaded app via --sim <id>."),process.exit(1)),o}}async function te(e){await L(e,'typeof window.__sootsimRecorder !== "undefined"')||(console.error(" window.__sootsimRecorder missing \u2014 is sootsim engine running in this sim?"),process.exit(1))}async function B(e){let{hidden:r}=await Q(e);r&&(console.error(` refusing to record: the sootsim tab is hidden, so frame capture
7
+ \`sootsim close --sim <id>\` and reopen the sim.`),process.exit(1)),console.error(` ${o} failed: ${s}`),process.exit(1)}}var _e=new Set(["--sim","--port","-p","--mode","--duration","--fps","--format","--output","-o","--frames","--max-width","--origin","--owner","--repo"]),xe=new Set(["start","stop","cancel","status","prelude-start","upload"]);function Oe(e){for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("-")){_e.has(o)&&r++;continue}return xe.has(o)?{name:o,index:r}:null}return null}function ke(){let e=process.env,r=(e.SOOT_BRANCH||e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME||"").trim(),o=(e.SOOT_SHA||e.GITHUB_SHA||"").trim(),i=(e.SOOT_PR_NUMBER||"").trim(),t=i?Number.parseInt(i,10):Number.NaN,n=(e.SOOT_PR_TITLE||"").trim();return{branch:r||void 0,commitSha:o||void 0,pullRequestNumber:Number.isFinite(t)&&t>0?t:void 0,pullRequestTitle:n||void 0}}function re(e){let r=l(e,"--owner")?.trim(),o=l(e,"--repo")?.trim();return(r&&!o||!r&&o)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),r&&o?{owner:r,repo:o}:null}async function qe(e,r){let o=Oe(e);if(o){let d=[...e.slice(0,o.index),...e.slice(o.index+1)];if(o.name==="start"){await Ie(d,r);return}if(o.name==="prelude-start"){await Ne(d,r);return}if(o.name==="upload"){let{runUpload:y}=await import("./upload-QIGILLTV.js");await y(d,r);return}if(o.name==="stop"){await Pe(d,r);return}if(o.name==="cancel"){await Fe(d,r);return}await Ae(d,r);return}let i=b(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width","--origin","--owner","--repo"]}),t=ie(l(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=l(e,"--format");s&&!["webm","mp4","gif","png"].includes(s)&&(console.error(` invalid --format "${s}" \u2014 expected webm | mp4 | gif | png`),process.exit(1));let c=l(e,"--output"),a=Number(l(e,"--duration")??"10");(!Number.isFinite(a)||a<=0)&&(console.error(` invalid --duration "${l(e,"--duration")}" \u2014 expected a positive number of seconds`),process.exit(1));let m=600;a>m&&(console.error(` invalid --duration "${l(e,"--duration")}" \u2014 exceeds the ${m}s (10m) maximum`),process.exit(1));let u=Number(l(e,"--fps")??"30"),p=l(e,"--frames");if(p!==void 0){let d=Number(p);(!Number.isInteger(d)||d<=0)&&(console.error(` invalid --frames "${p}" \u2014 expected a positive integer count`),process.exit(1))}let x=e.includes("--open"),j=l(e,"--max-width")?Number(l(e,"--max-width")):void 0,g=Math.max(100,Math.round(a*1e3)),K=l(e,"--origin"),pe=re(e);if(t==="live"||t==="combined"){c&&console.log(` note: --output is ignored for --mode ${t} \u2014 the recording uploads to /preview/<id>`),n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await P("record",{originOverride:K,allowGitHubAuth:!0});let d=v({...i,commandTimeoutMs:6e4});try{await q(d),await ae(d,t),t==="combined"&&await B(d),await de(d,K,pe);let y=await ce(d,t,t==="combined"?n:void 0);y.ok||(console.error(` start failed: recording store refused to start (${t})`+(y.error?`: ${y.error}`:"")),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(_=>setTimeout(_,g)),await le(d);let O=await ue(d);me(O,x,t)}finally{d.close()}return}let C=p?Number(p):null,R=Te(s,c,C);x&&console.log(" note: --open is ignored for local-file capture \u2014 it applies to --mode live/combined");let h=v({...i,commandTimeoutMs:6e4});try{if(await te(h),await B(h),R==="png"){let $=C??10,w=U(c,`sootsim-frames-${M()}`);c&&oe(c)&&console.log(` note: --frames writes multiple pngs, so --output "${c}" is a directory \u2014 frame-NNN.png files land inside it`),E(w,{recursive:!0});for(let f of he(w))/^frame-\d+\.png$/.test(f)&&J(N(w,f),{force:!0});console.log(` sampling ${$} frames over ${a}s \u2192 ${w}`);let S=await h.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${$}, durationMs: ${g}${n?`, layers: ${JSON.stringify(n)}`:""} })`});(!S.ok||!S.requestId)&&(console.error(` frame capture start failed: ${S.error??"unknown error"}`),process.exit(1)),await new Promise(f=>setTimeout(f,g));let fe=Date.now()+Math.max(5e3,g),A=null;for(;;){let f=await h.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${S.requestId})`});if(f||(console.error(" frame capture result missing"),process.exit(1)),f.done){f.ok||(console.error(` frame capture failed: ${f.error??"unknown error"}`),process.exit(1)),A=f.frames??[];break}Date.now()>=fe&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(F=>setTimeout(F,100))}A.forEach((f,F)=>{let ge=`${w}/frame-${String(F+1).padStart(3,"0")}.png`;I(ge,Buffer.from(f.data,"base64"))}),console.log(` saved ${A.length} frames`);return}if(R==="gif"){let $=C??Math.max(10,Math.round(a*u/3)),w=U(c,`sootsim-${M()}.gif`);E(W(w),{recursive:!0}),console.log(` encoding gif: ${$} frames over ${a}s \u2192 ${w}`);let S=await D(h,`window.__sootsimRecorder.captureGif({ frames: ${$}, durationMs: ${g}${j?`, maxWidth: ${j}`:""}${n?`, layers: ${JSON.stringify(n)}`:""} })`,"gif encode",g);S||(console.error(" gif capture returned no frames"),process.exit(1)),I(w,Buffer.from(S.data,"base64")),console.log(` saved: ${w} (${G(S.size)})`);return}let d=U(c,`sootsim-${M()}.${R}`);E(W(d),{recursive:!0});let y={format:R,fps:u,durationMs:g};n&&(y.layers=n);let O=await D(h,`window.__sootsimRecorder.start(${JSON.stringify(y)})`,`${R} start`,g);O.ok||(console.error(` start failed: ${O.error??"unknown error"}`),/render host not available|already streaming|already recording|lock already held/i.test(O.error??"")&&console.error(" a prior recording was abandoned and its capture is still\n releasing. retry in ~20s, or recover now with\n `sootsim close --sim <id>` then reopen the sim."),process.exit(1)),console.log(` recording ${R} for ${a}s \u2192 ${d}`),await new Promise($=>setTimeout($,g));let _=await D(h,"window.__sootsimRecorder.stop()",`${R} encode/flush`,g);_.ok||(console.error(` stop failed: ${_.error??"unknown error"}`),process.exit(1)),_.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await ne(h,d),console.log(` saved: ${d} (${G(_.size)})`)}finally{h.close()}}var Ee=6e3;async function L(e,r){try{return await e.send({type:"evaluate",code:r},{timeoutMs:Ee})}catch(o){let i=o instanceof Error?o.message:String(o);throw/^command timed out after \d+s$/.test(i)&&(console.error(" sim did not respond \u2014 it is connected to the bridge but has not\n loaded an app (or its page is unresponsive). run `sootsim list`\n and target a sim with a loaded app via --sim <id>."),process.exit(1)),o}}async function te(e){await L(e,'typeof window.__sootsimRecorder !== "undefined"')||(console.error(" window.__sootsimRecorder missing \u2014 is sootsim engine running in this sim?"),process.exit(1))}async function B(e){let{hidden:r}=await Q(e);r&&(console.error(` refusing to record: the sootsim tab is hidden, so frame capture
8
8
  would be throttled to ~1fps and produce a frozen-looking file.
9
9
  bring the chrome window to the foreground (un-minimize / switch to
10
10
  its tab) or run the recording in headless playwright, then retry.`),process.exit(1))}async function ne(e,r){let o=[],i=0;for(;;){let t=await e.send({type:"evaluate",code:`window.__sootsimRecorder.getBlobBase64({ offset: ${i}, chunk: 2097152 })`});if(!t)throw new Error("no blob available on recorder");if(o.push(Buffer.from(t.data,"base64")),i=t.offset,t.done)break}I(r,Buffer.concat(o))}function l(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function Be(e){if(!e)return;let r=oe(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function Te(e,r,o){return e||(o!=null?"png":Be(r)??"webm")}function M(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function Me(){let e=N(ve(),".sootsim","recordings");return E(e,{recursive:!0}),e}function U(e,r){return e?Se(process.cwd(),e):N(Me(),r)}function G(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function ie(e){if(!e)return"video";if(e==="video"||e==="live"||e==="combined")return e;console.error(` invalid --mode "${e}" \u2014 expected video | live | combined`),process.exit(1)}function H(){return N(ye(),`sootsim-recording-${X()}.json`)}function T(){let e=H();if(!we(e))return null;try{return{mode:"video",...JSON.parse(be(e,"utf8"))}}catch{return J(e,{force:!0}),null}}function Ue(e){I(H(),JSON.stringify(e,null,2))}function k(){J(H(),{force:!0})}function V(e,r){e&&r.simId&&e!==r.simId&&console.log(` note: the tracked recording session is on sim ${r.simId}, not the
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a}from"./chunk-EBRAQH3D.js";import"./chunk-TYYWETOW.js";import"./chunk-3FZ2YUUP.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";export{a as runRuntime};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as me,b as he,e as ge}from"./chunk-6XAGMAP7.js";import{b as de}from"./chunk-XJHF3OFF.js";import{a as pe}from"./chunk-WSF2QLMD.js";import"./chunk-QLZSJLM4.js";import"./chunk-O2X7YSAD.js";import{a as j,b as fe}from"./chunk-JCXQE5XP.js";import"./chunk-RINOK2FV.js";import"./chunk-KITHQVX5.js";import"./chunk-A4J3ZFTP.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import"./chunk-5N2BFB4I.js";import"./chunk-LJ4CQHHZ.js";import{r as ae}from"./chunk-SQ2MTGDQ.js";import{g as _,h as ce,i as U,j as le,k as ue,l as F,m as M}from"./chunk-NX2QM2BE.js";import"./chunk-WXN3JD2J.js";import"./chunk-BORW7JE4.js";import"./chunk-O7QYV2FI.js";import"./chunk-6YV6WW5Q.js";import"./chunk-S23R7GAE.js";import"./chunk-WUV6QJJU.js";import"./chunk-UKKQXZFZ.js";import"./chunk-7NN725AT.js";import"./chunk-R7AEJR2M.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import{a as v,b as V,c as K,d as X,e as J,f as z,g as I}from"./chunk-5XMJFP54.js";import"./chunk-JALTULVB.js";import{mkdirSync as be,writeFileSync as we}from"fs";import{dirname as Se,resolve as xe}from"path";async function ke(e,t){let o=st(e);(o.includes("--help")||o.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as me,b as he,e as ge}from"./chunk-WS4H3OTZ.js";import{b as de}from"./chunk-WT4SBY54.js";import{a as pe}from"./chunk-R62P6SPR.js";import"./chunk-RHKQEMHY.js";import"./chunk-BQSG37WI.js";import{a as j,b as fe}from"./chunk-ZWFFRBAR.js";import"./chunk-HRH5AL5T.js";import"./chunk-2OCQ4XLZ.js";import"./chunk-ODWHC4OS.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-HNBFCX26.js";import{r as ae}from"./chunk-QS73KI7T.js";import{g as _,h as ce,i as U,j as le,k as ue,l as F,m as M}from"./chunk-3FZ2YUUP.js";import"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-U2QSYQUZ.js";import"./chunk-ZUV7FVK5.js";import"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import{a as v,b as V,c as K,d as X,e as J,f as z,g as I}from"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";import{mkdirSync as be,writeFileSync as we}from"fs";import{dirname as Se,resolve as xe}from"path";async function ke(e,t){let o=st(e);(o.includes("--help")||o.includes("-h"))&&(console.log(`
3
3
  sootsim screenshot \u2014 capture the canvas as a PNG
4
4
 
5
5
  usage:
@@ -138,7 +138,7 @@ examples:
138
138
  sootsim screenshot appstore capture needs a logged-in session.
139
139
  run \`sootsim login\` first (the captured slides upload to that account).
140
140
 
141
- `),process.exit(1)}function Ut(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function jt(e){let t=new URL(e);if(Ut(t.hostname)){let s=(Number(t.port)||3e3)-3e3;if(s>=0&&s<=1e3)return t.port=String(5173+s),t.origin}return t.hostname==="sootbean.com"||t.hostname.endsWith(".sootbean.com")?"https://sootsim.com":e}function Lt(){try{return Number(Ye("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function Gt(e,t,o,s){let r=await fetch(`${e}/api/sootsim/screenshot-decks?org=${encodeURIComponent(o)}&repo=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${t}`}});if(!r.ok)return[];let i=await r.json().catch(()=>null),n=[];for(let a of i?.decks??[])Array.isArray(a.config?.frames)&&n.push(...a.config.frames);return n}async function Ht(e,t,o,s){let r=await fetch(`${e}/api/sootsim/screenshot-capture?ref=${encodeURIComponent(s)}&org=${encodeURIComponent(o)}`,{headers:{authorization:`Bearer ${t}`}});return r.ok?`data:image/png;base64,${Buffer.from(await r.arrayBuffer()).toString("base64")}`:null}async function Yt(e,t){let o=Date.now()+t;for(;Date.now()<o;){for(let s of e.frames())if(await s.evaluate(()=>!!globalThis.SootSim?.bridges?.screenshotControl).catch(()=>!1))return s;await e.waitForTimeout(250)}throw new Error("screenshot bridge never appeared \u2014 the build shell did not boot screenshot mode (check --branch/--platform has a ready build, and you are logged in)")}async function He(e){return e.evaluate(async()=>{let o=globalThis.SootSim?.bridges?.screenshotControl;if(!o)throw new Error("screenshotControl missing");return o.getState()})}async function Wt(e){await e.evaluate(async()=>{let t=globalThis.SootSim?.bridges?.settings,o=Date.now()+3e3;for(;Date.now()<o;){if(t?.get?.()?.screenshotMode)return;await new Promise(s=>setTimeout(s,50))}t&&!t.get().screenshotMode&&(t.set("screenshotMode",!0),t.get().showFrame||t.set("showFrame",!0))})}async function qt(e,t,o,s){await e.evaluate(async([r,i,n])=>{let a=globalThis.SootSim,c=a?.bridges?.screenshotControl;if(!c)throw new Error("screenshotControl missing");let l=u=>new Promise(d=>setTimeout(d,u));if(i){c.focusSlide(r);let u=Date.now()+3e4,d=a?.bridges?.threeMode;for(;Date.now()<u&&(d=a?.bridges?.threeMode,!(d?.setScreenImage&&d?.captureStage&&d?.getState?.()?.ready));)await l(150);await l(1e3);let p=i;d?.configure?.({colorway:p.colorway,background:p.background,...p.customGradient?{customGradient:p.customGradient}:{},room:!!p.room,bokeh:!!p.bokeh,environment:p.environmentActive?{pins:p.environmentPins??{},effects:p.environmentEffects??{}}:!1,pose:{phonePosition:p.phonePosition,phoneRotation:p.phoneRotation,cameraPosition:p.cameraPosition,target:p.target}}),await l(900),n&&d?.setScreenImage&&(d.setScreenImage(n),await l(1200))}await c.capture(r)},[t,o,s])}async function We(e){if(e.includes("--help")||e.includes("-h"))return console.log(zt),0;let t=It(e);if(!t.org||!t.repo)return process.stderr.write(` --org and --repo are required (see --help)
141
+ `),process.exit(1)}function Ut(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function jt(e){let t=new URL(e);if(Ut(t.hostname)){let s=(Number(t.port)||3e3)-3e3;if(s>=0&&s<=1e3)return t.port=String(5173+s),t.origin}return t.hostname==="sootbean.com"||t.hostname.endsWith(".sootbean.com")?"https://sootsim.com":e}function Lt(){try{return Number(Ye("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function Gt(e,t,o,s){let r=await fetch(`${e}/api/sootsim/screenshot-decks?org=${encodeURIComponent(o)}&repo=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${t}`}});if(!r.ok)return[];let i=await r.json().catch(()=>null),n=[];for(let a of i?.decks??[])Array.isArray(a.config?.frames)&&n.push(...a.config.frames);return n}async function Ht(e,t,o,s){let r=await fetch(`${e}/api/sootsim/screenshot-capture?ref=${encodeURIComponent(s)}&org=${encodeURIComponent(o)}`,{headers:{authorization:`Bearer ${t}`}});return r.ok?`data:image/png;base64,${Buffer.from(await r.arrayBuffer()).toString("base64")}`:null}async function Yt(e,t){let o=Date.now()+t;for(;Date.now()<o;){for(let s of e.frames())if(await s.evaluate(()=>!!globalThis.SootSim?.bridges?.screenshotControl).catch(()=>!1))return s;await e.waitForTimeout(250)}throw new Error("screenshot bridge never appeared \u2014 the build shell did not boot screenshot mode (check --branch/--platform has a ready build, and you are logged in)")}async function He(e){return e.evaluate(async()=>{let o=globalThis.SootSim?.bridges?.screenshotControl;if(!o)throw new Error("screenshotControl missing");return o.getState()})}async function Wt(e){await e.evaluate(async()=>{let t=globalThis.SootSim?.bridges?.settings,o=Date.now()+3e3;for(;Date.now()<o;){if(t?.get?.()?.screenshotMode)return;await new Promise(s=>setTimeout(s,50))}t&&!t.get().screenshotMode&&(t.set("screenshotMode",!0),t.get().showFrame||t.set("showFrame",!0))})}async function qt(e,t,o,s){await e.evaluate(async([r,i,n])=>{let a=globalThis.SootSim,c=a?.bridges?.screenshotControl;if(!c)throw new Error("screenshotControl missing");let l=u=>new Promise(d=>setTimeout(d,u));if(i){c.focusSlide(r);let u=Date.now()+3e4,d=a?.bridges?.threeMode;for(;Date.now()<u&&(d=a?.bridges?.threeMode,!(d?.setScreenImage&&d?.captureStage&&d?.getState?.()?.ready));)await l(150);await l(1e3);let p=i;d?.configure?.({colorway:p.colorway,background:p.background,...p.customGradient?{customGradient:p.customGradient}:{},room:!!p.room,bokeh:!!p.bokeh,focus:p.focus,environment:p.environmentActive?{pins:p.environmentPins??{},effects:p.environmentEffects??{}}:!1,pose:{phonePosition:p.phonePosition,phoneRotation:p.phoneRotation,cameraPosition:p.cameraPosition,target:p.target}}),await l(900),n&&d?.setScreenImage&&(d.setScreenImage(n),await l(1200))}await c.capture(r)},[t,o,s])}async function We(e){if(e.includes("--help")||e.includes("-h"))return console.log(zt),0;let t=It(e);if(!t.org||!t.repo)return process.stderr.write(` --org and --repo are required (see --help)
142
142
  `),1;let{token:o,origin:s}=_t(),r=(t.apiOrigin??s).replace(/\/$/,""),i=(t.shellOrigin??jt(r)).replace(/\/$/,""),n=await Gt(r,o,t.org,t.repo);if(!t.dryRun&&!t.force&&n.length>0)return process.stderr.write(` refusing to overwrite the existing ${t.org}/${t.repo} deck (${n.length} slide(s)). re-run with --force to replace it, or --dry-run to preview.
143
143
  `),1;let a=Lt(),c=Number(Ye("sysctl -n hw.ncpu").toString().trim())||8;if(a>c)return process.stderr.write(` load average ${a.toFixed(1)} exceeds ${c} cores \u2014 tear down other work first.
144
144
  `),1;let l=`${i}/build/${encodeURIComponent(t.org)}/${encodeURIComponent(t.repo)}/${encodeURIComponent(t.branch)}?platform=${encodeURIComponent(t.platform)}&ssMode=1`,u=Ft(Ge(At(),"sootsim-capture-")),{browser:d,reapNow:p}=await Le(()=>Ot.launchPersistentContext(u,{headless:!0,channel:"chrome",viewport:{width:393,height:852},deviceScaleFactor:3,args:["--enable-unsafe-webgpu","--enable-features=Vulkan,WebGPU","--hide-scrollbars"]}));await d.addInitScript(m=>{try{localStorage.setItem("sootsim.session.token",m)}catch{}},o);let y=[],f=d.pages()[0]??await d.newPage();t.dryRun?await f.route(/\/api\/sootsim\/screenshot-(decks|capture)/,m=>m.request().method()==="PUT"?m.abort():m.continue()):f.on("response",m=>{let x=m.url();m.request().method()==="PUT"&&(x.includes("/api/sootsim/screenshot-decks")?y.push({kind:"deck",status:m.status()}):x.includes("/api/sootsim/screenshot-capture")&&y.push({kind:"capture",status:m.status()}))});let h=[];f.on("pageerror",m=>h.push(m.message));let S=f.waitForResponse(m=>m.url().includes("/api/sootsim/screenshot-decks")&&m.request().method()==="GET",{timeout:t.timeoutMs}).catch(()=>null);try{await f.goto(l,{waitUntil:"domcontentloaded",timeout:t.timeoutMs});let m=await Yt(f,t.timeoutMs);await Wt(m),await S,await f.waitForTimeout(800);let x=await He(m);if(x.slides.length===0)return process.stderr.write(` the deck has no slides to capture \u2014 add slides in the composer first.
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as ce,c as H,d as le,e as F,f as de,h as ue,i as C,j as pe,k as me,l as he,p as fe,s as v,t as ge,u as Se,v as ye,w as ve}from"./chunk-FWZQSSEJ.js";import"./chunk-UZDH32UA.js";import{a as ae}from"./chunk-O2X7YSAD.js";import"./chunk-JCXQE5XP.js";import{g as oe}from"./chunk-64GTYKIF.js";import{f as P,g as ne}from"./chunk-KITHQVX5.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import"./chunk-5N2BFB4I.js";import"./chunk-NX2QM2BE.js";import{d as se}from"./chunk-O7QYV2FI.js";import{a as Q,b as ee}from"./chunk-WUV6QJJU.js";import"./chunk-UKKQXZFZ.js";import{a as ie,b as re}from"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import{C as E,D as J,E as K,F as D,H as V,I as G,K as q,M as z,N as X,O as Y,P as U,Q as Z,y as M,z as j}from"./chunk-TE4UPZY2.js";import{a as te}from"./chunk-M6GIXT25.js";import"./chunk-JALTULVB.js";import{spawn as dt}from"child_process";import I from"fs";import{createServer as ut}from"http";import S from"path";import{WebSocket as h,WebSocketServer as pt}from"ws";import ke from"node:fs";import _ from"node:path";import{spawn as Ne}from"node:child_process";import Me from"node:fs";import De from"node:os";import Ue from"node:path";var be=/^[A-Za-z0-9._:-]{1,160}$/;function W(o){if(!o?.startsWith("AGENTBUS_SESSION:"))return null;let e=o.slice(17).trim();return be.test(e)?e:null}function we(o){return be.test(o)}function He(o){return typeof o.text=="string"?o.text.trim():""}function Fe(o){let e=o?.trim();if(e)return e;let t=process.env.AGENTBUS_COMMAND?.trim();if(t)return t;let i=Ue.join(De.homedir(),".local","bin","agentbus");return Me.existsSync(i)?i:"agentbus"}async function Ae(o){let e=o.sessionId.trim();if(!we(e))throw new Error(`invalid agentbus session id: ${e||"<empty>"}`);let t=He(o.prompt);if(!t)throw new Error("prompt text is empty");let i=Fe(o.command),s=o.timeoutMs??15e3;await new Promise((n,a)=>{let r=Ne(i,["send",e,t],{stdio:["ignore","ignore","pipe"],env:process.env}),c="",d=setTimeout(()=>{try{r.kill("SIGTERM")}catch{}a(new Error(`agentbus send timed out after ${Math.round(s/1e3)}s`))},s);r.stderr?.setEncoding("utf8"),r.stderr?.on("data",l=>{c.length<4e3&&(c+=String(l))}),r.on("error",l=>{clearTimeout(d),a(l)}),r.on("exit",(l,u)=>{if(clearTimeout(d),l===0){n();return}let p=c.trim();a(new Error(p||`agentbus send exited with ${u?`signal ${u}`:`code ${l??"unknown"}`}`))})})}var R=1;function We(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_POSTGRES||7432),Number(process.env.VITE_PORT_R2||9500)].filter(o=>Number.isFinite(o)&&o>0)}var x=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;opts;constructor(e={}){this.opts=e}registerSocket(e){this.allSockets.add(e)}unregisterSocket(e){let t=this.sessionsBySocket.get(e);if(t){for(let i of t)this.decrementSubscription(i);this.sessionsBySocket.delete(e)}this.allSockets.delete(e)}async handleMessage(e,t){let i=t?.type;if(typeof i!="string"||!i.startsWith("agent:"))return!1;let s=t.id;try{let n=await this.dispatch(e,i,t);this.respond(e,s,n)}catch(n){n instanceof v?this.respondError(e,s,n.message,n.code):this.respondError(e,s,n instanceof Error?n.message:String(n))}return!0}async seedOnBoot(){try{await he()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as ce,c as H,d as le,e as F,f as de,h as ue,i as C,j as pe,k as me,l as he,p as fe,s as v,t as ge,u as Se,v as ye,w as ve}from"./chunk-KNPIQNLB.js";import"./chunk-ICI5UOHJ.js";import{a as ae}from"./chunk-BQSG37WI.js";import"./chunk-ZWFFRBAR.js";import{g as oe}from"./chunk-TYYWETOW.js";import{f as P,g as ne}from"./chunk-2OCQ4XLZ.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-3FZ2YUUP.js";import{d as se}from"./chunk-2YZKJ3ZJ.js";import{a as Q,b as ee}from"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import{a as ie,b as re}from"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import{C as E,D as J,E as K,F as D,H as V,I as G,K as q,M as z,N as X,O as Y,P as U,Q as Z,y as M,z as j}from"./chunk-32JBVYL5.js";import{a as te}from"./chunk-2H5WTYZB.js";import"./chunk-OOGJDQMT.js";import{spawn as dt}from"child_process";import I from"fs";import{createServer as ut}from"http";import S from"path";import{WebSocket as h,WebSocketServer as pt}from"ws";import ke from"node:fs";import _ from"node:path";import{spawn as Ne}from"node:child_process";import Me from"node:fs";import De from"node:os";import Ue from"node:path";var be=/^[A-Za-z0-9._:-]{1,160}$/;function W(o){if(!o?.startsWith("AGENTBUS_SESSION:"))return null;let e=o.slice(17).trim();return be.test(e)?e:null}function we(o){return be.test(o)}function He(o){return typeof o.text=="string"?o.text.trim():""}function Fe(o){let e=o?.trim();if(e)return e;let t=process.env.AGENTBUS_COMMAND?.trim();if(t)return t;let i=Ue.join(De.homedir(),".local","bin","agentbus");return Me.existsSync(i)?i:"agentbus"}async function Ae(o){let e=o.sessionId.trim();if(!we(e))throw new Error(`invalid agentbus session id: ${e||"<empty>"}`);let t=He(o.prompt);if(!t)throw new Error("prompt text is empty");let i=Fe(o.command),s=o.timeoutMs??15e3;await new Promise((n,a)=>{let r=Ne(i,["send",e,t],{stdio:["ignore","ignore","pipe"],env:process.env}),c="",d=setTimeout(()=>{try{r.kill("SIGTERM")}catch{}a(new Error(`agentbus send timed out after ${Math.round(s/1e3)}s`))},s);r.stderr?.setEncoding("utf8"),r.stderr?.on("data",l=>{c.length<4e3&&(c+=String(l))}),r.on("error",l=>{clearTimeout(d),a(l)}),r.on("exit",(l,u)=>{if(clearTimeout(d),l===0){n();return}let p=c.trim();a(new Error(p||`agentbus send exited with ${u?`signal ${u}`:`code ${l??"unknown"}`}`))})})}var R=1;function We(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_POSTGRES||7432),Number(process.env.VITE_PORT_R2||9500)].filter(o=>Number.isFinite(o)&&o>0)}var x=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;opts;constructor(e={}){this.opts=e}registerSocket(e){this.allSockets.add(e)}unregisterSocket(e){let t=this.sessionsBySocket.get(e);if(t){for(let i of t)this.decrementSubscription(i);this.sessionsBySocket.delete(e)}this.allSockets.delete(e)}async handleMessage(e,t){let i=t?.type;if(typeof i!="string"||!i.startsWith("agent:"))return!1;let s=t.id;try{let n=await this.dispatch(e,i,t);this.respond(e,s,n)}catch(n){n instanceof v?this.respondError(e,s,n.message,n.code):this.respondError(e,s,n instanceof Error?n.message:String(n))}return!0}async seedOnBoot(){try{await he()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
3
3
  `)}}close(){for(let e of this.subscriptions.values())try{e.unsubscribe()}catch{}this.subscriptions.clear(),this.sessionsBySocket.clear(),this.allSockets.clear()}async dispatch(e,t,i){switch(t){case"agent:list-projects":return F();case"agent:upsert-project":return H(i.input??{});case"agent:delete-project":return ue(String(i.projectId)),{ok:!0};case"agent:auto-attach-for-url":return this.autoAttachForUrl(i.input??{});case"agent:list-sessions":return pe(i.projectId?String(i.projectId):void 0);case"agent:start-session":return this.doStartSession(i.input??{});case"agent:send-claimed-prompt":return this.sendClaimedPrompt(i);case"agent:send-prompt":{let n=String(i.sessionId),a=C(n);if(!a)throw new v("NO_SESSION",`no session: ${n}`);let r=this.normalizePromptEnvelope(i);return await Se(n,r),this.notePromptAccepted(n,r,a.status==="working")}case"agent:end-session":this.dropSessionFanout(String(i.sessionId)),await ye(String(i.sessionId));let s=C(String(i.sessionId));return s&&this.broadcastSessionStatus(s),{ok:!0};case"agent:get-transcript":return this.getTranscript(String(i.sessionId));case"agent:get-paths":return this.getPaths();case"agent:subscribe-events":return this.subscribeSocket(e,String(i.sessionId));case"agent:unsubscribe-events":return this.unsubscribeSocket(e,String(i.sessionId));default:throw new v("UNKNOWN_AGENT_MSG",`unknown agent message: ${t}`)}}async sendClaimedPrompt(e){let t=typeof e.simId=="string"?e.simId.trim():"";if(!t)throw new v("NO_SIM","agent:send-claimed-prompt requires simId");let i=this.opts.resolveCliLease?.(t)??null;if(!i||i.kind!=="cli"||i.expiresAt<=Date.now())throw new v("NO_CLAIM",`sim ${t} has no active CLI claim`);let s=W(i.cliIdentityKey);if(!s)throw new v("UNSUPPORTED_CLAIM",`sim ${t} is claimed by a CLI identity that is not promptable`);return await Ae({sessionId:s,prompt:this.normalizePromptEnvelope(e)}),{ok:!0,routed:"agentbus",sessionId:s}}async doStartSession(e){if(!le(e.projectId))throw new v("NO_PROJECT",`no project: ${e.projectId}`);let i=await ge(e);return this.broadcastSessionStatus(i.session),i}async autoAttachForUrl(e){let t=e.bundleUrl??"",i=(()=>{try{return new URL(t).port||null}catch{return null}})();if(!i)return{project:null};let s=this.opts.getExcludePorts?.()??We(),a=(await P({excludePorts:s})).find(l=>String(l.port)===i);if(!a||!a.cwd)return{project:null};let r=F().find(l=>l.cwd===a.cwd)??null,c=Array.from(new Set([...r?.knownBundleUrls??[],a.bundleUrl,t]));return{project:H({cwd:a.cwd,name:a.projectName??_.basename(a.cwd),preferredProvider:e.provider??r?.preferredProvider,sourceRoots:r?.sourceRoots??[a.cwd],knownBundleUrls:c,framework:r?.framework??$e(a.framework),bundleId:a.bundleId??r?.bundleId})}}getTranscript(e){let t=fe(e);return ke.existsSync(t)?ke.readFileSync(t,"utf8"):{error:"transcript not found",code:"NO_TRANSCRIPT"}}getPaths(){let e=ce();return{userDataDir:e,storeFile:_.join(e,"attached-projects.json"),sessionsDir:_.join(e,"sessions"),transcriptsDir:_.join(e,"transcripts")}}subscribeSocket(e,t){let i=this.sessionsBySocket.get(e);if(i||(i=new Set,this.sessionsBySocket.set(e,i)),i.has(t))return{ok:!0,refCount:this.subscriptions.get(t)?.refCount??1};i.add(t);let s=this.subscriptions.get(t);if(s)return s.refCount++,{ok:!0,refCount:s.refCount};let n=ve(t,a=>{let r=this.coalescePromptEcho(t,a);if(r&&(this.applySessionEvent(t,r),this.fanOutEvent(t,r)),a.type==="turn-completed"){let c=C(t);if(c)try{de(c.projectId,{usd:a.costUsd,ts:a.ts})}catch(d){process.stderr.write(`[sootsim-agent] recordTurnTelemetry failed: ${d instanceof Error?d.message:String(d)}
4
4
  `)}}});return this.subscriptions.set(t,{unsubscribe:n,refCount:1}),{ok:!0,refCount:1}}unsubscribeSocket(e,t){let i=this.sessionsBySocket.get(e);return!i||!i.has(t)?{ok:!0,refCount:0}:(i.delete(t),this.decrementSubscription(t))}decrementSubscription(e){let t=this.subscriptions.get(e);if(!t)return{ok:!0,refCount:0};if(t.refCount--,t.refCount<=0){try{t.unsubscribe()}catch{}return this.subscriptions.delete(e),{ok:!0,refCount:0}}return{ok:!0,refCount:t.refCount}}dropSessionFanout(e){let t=this.subscriptions.get(e);if(t){try{t.unsubscribe()}catch{}this.subscriptions.delete(e)}for(let i of this.sessionsBySocket.values())i.delete(e);this.clearPromptTracking(e)}normalizePromptEnvelope(e){if(e?.prompt&&typeof e.prompt=="object"){let t=e.prompt;return{text:String(t.text??""),...typeof t.displayText=="string"?{displayText:t.displayText}:{},...typeof t.inspectSummary=="string"?{inspectSummary:t.inspectSummary}:{},...typeof t.inspectTrace=="string"?{inspectTrace:t.inspectTrace}:{}}}return{text:String(e?.text??""),...typeof e?.displayText=="string"?{displayText:e.displayText}:{},...typeof e?.inspectSummary=="string"?{inspectSummary:e.inspectSummary}:{},...typeof e?.inspectTrace=="string"?{inspectTrace:e.inspectTrace}:{}}}notePromptAccepted(e,t,i){let s=Date.now(),n=this.pendingPromptEchoes.get(e)??[];n.push({sentAt:s}),this.pendingPromptEchoes.set(e,n);let a=Math.max(this.pendingTurns.get(e)??0,i?1:0)+1;this.pendingTurns.set(e,a);let r=t.displayText??t.text;return this.patchSession(e,{lastPrompt:r,status:"working",needsAttention:!1}),this.fanOutEvent(e,{type:"prompt-received",text:r,...t.inspectSummary?{inspectSummary:t.inspectSummary}:{},...t.inspectTrace?{inspectTrace:t.inspectTrace}:{},ts:s}),{ok:!0,queued:a>1,pendingTurns:a,queueDepth:Math.max(0,a-1)}}applySessionEvent(e,t){switch(t.type){case"prompt-received":case"turn-started":this.patchSession(e,{status:"working",needsAttention:!1});return;case"turn-completed":{let i=this.consumeSettledTurn(e);this.patchSession(e,{status:i>0?"working":"idle",needsAttention:!1,lastTurnFiles:t.filesTouched,currentlyEditing:void 0});return}case"approval-needed":this.patchSession(e,{status:"needs-attention",needsAttention:!0});return;case"error":{let i=this.consumeSettledTurn(e);this.patchSession(e,{status:i>0?"working":"needs-attention",needsAttention:i<=0,currentlyEditing:void 0});return}case"exited":this.clearPromptTracking(e),this.patchSession(e,{status:"ended",needsAttention:!1,wrapperPid:void 0,currentlyEditing:void 0});return;case"ready":case"turn-reasoning":case"turn-message":case"turn-plan":case"tool-call":case"file-edited":case"file-diff-delta":return}}patchSession(e,t){me(e,t);let i=C(e);i&&this.broadcastSessionStatus(i)}coalescePromptEcho(e,t){if(t.type!=="prompt-received")return t;let i=this.pendingPromptEchoes.get(e);if(!i||i.length===0)return t;for(;i.length>0&&Date.now()-i[0].sentAt>15e3;)i.shift();return i.length===0?(this.pendingPromptEchoes.delete(e),t):(i.shift(),i.length===0?this.pendingPromptEchoes.delete(e):this.pendingPromptEchoes.set(e,i),null)}consumeSettledTurn(e){let t=Math.max(0,(this.pendingTurns.get(e)??1)-1);return t>0?this.pendingTurns.set(e,t):this.pendingTurns.delete(e),t}clearPromptTracking(e){this.pendingPromptEchoes.delete(e),this.pendingTurns.delete(e)}fanOutEvent(e,t){let i=JSON.stringify({type:"agent:event",sessionId:e,event:t});for(let[s,n]of this.sessionsBySocket)if(n.has(e)&&s.readyState===R)try{s.send(i)}catch{}}broadcastSessionStatus(e){let t=JSON.stringify({type:"agent:session-status",session:e});for(let i of this.allSockets)if(i.readyState===R)try{i.send(t)}catch{}}respond(e,t,i){if(e.readyState===R)try{e.send(JSON.stringify({id:t,result:i}))}catch{}}respondError(e,t,i,s){if(e.readyState===R)try{e.send(JSON.stringify({id:t,error:i,...s?{code:s}:{}}))}catch{}}};function $e(o){return o==="expo"?"expo":o==="one"||o==="vxrn"?"one":"unknown"}import Ke from"http";import Ve from"https";var $="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36",je=[{hostSuffix:"uniswap.org",headers:{origin:"https://app.uniswap.org",referer:"https://app.uniswap.org/"},suppressBrowserUserAgent:!0}];function Je(o){let e=o.toLowerCase();for(let t of je)if(e===t.hostSuffix||e.endsWith(`.${t.hostSuffix}`))return t}function Ie(o){let e=Je(o.hostname);return{"accept-encoding":"identity",...e?.suppressBrowserUserAgent?{}:{"user-agent":$},...e?.headers}}var Ge=new Set(["host","origin","referer","user-agent","accept-encoding","cookie","connection","keep-alive","transfer-encoding","upgrade","content-length","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","sec-ch-ua","sec-ch-ua-mobile","sec-ch-ua-platform"]),qe={"access-control-allow-origin":"*","access-control-allow-methods":"GET,POST,PUT,DELETE,PATCH,OPTIONS","access-control-allow-headers":"*","access-control-expose-headers":"*","access-control-max-age":"3600"},ze=new Set(["host","origin","referer","sec-fetch-site","sec-fetch-mode","sec-fetch-dest"]);function T(o){for(let[e,t]of Object.entries(qe))o.setHeader(e,t)}function Xe(o,e){let t=[],i=e;i?.code&&t.push(i.code),i?.message&&t.push(i.message),i?.cause?.code&&t.push(i.cause.code),i?.cause?.message&&t.push(i.cause.message);let n=[...new Set(t.filter(Boolean))].join(" | ")||String(e);return o.includes("stored-in-.env.local")?`${n} | upstream url still contains placeholder env values`:n}function Ye(o){let t=(Array.isArray(o)?o[0]:o)?.split(";",1)[0]?.trim().toLowerCase();return t?t.startsWith("text/")||t==="application/json"||t.endsWith("+json")||t==="application/x-www-form-urlencoded"||t==="application/xml"||t.endsWith("+xml")||t==="application/javascript"||t==="application/graphql":!1}function Ze(o,e){let t={};for(let[i,s]of Object.entries(o))s&&(Ge.has(i.toLowerCase())||(t[i]=Array.isArray(s)?s.join(", "):s));return Object.assign(t,e?Ie(e):{"user-agent":$}),t}function Qe(o,e){let t={};for(let[i,s]of Object.entries(o))s&&(ze.has(i.toLowerCase())||(t[i]=s));return t.host=e.host,t.origin=e.origin,t.referer=`${e.origin}/`,t}function Ce(o){return o?.startsWith("/__fetch-proxy?")||o?.startsWith("/__proxy?")||!1}function Te(o){return o?!!(o.startsWith("/__app-api?")||o.startsWith("/__app-api/")):!1}async function Ee(o,e){if(o.method==="OPTIONS"){T(e),e.writeHead(204),e.end();return}let i=new URLSearchParams((o.url||"").split("?")[1]||"").get("url");if(!i){T(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("missing url param");return}let s;try{s=new URL(i)}catch{T(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("invalid url param");return}let n=Ze(o.headers,s),a;if(o.method!=="GET"&&o.method!=="HEAD"){let l=[];for await(let u of o)l.push(Buffer.isBuffer(u)?u:Buffer.from(u));if(l.length>0){let u=Buffer.concat(l);a=Ye(o.headers["content-type"])?u.toString("utf8"):u}}let r;try{r=await fetch(s.href,{method:o.method,headers:n,body:a,redirect:"follow"})}catch(l){T(e),e.writeHead(502,{"Content-Type":"text/plain"}),e.end(`fetch proxy error: ${Xe(s.href,l)}`);return}r.headers.forEach((l,u)=>{let p=u.toLowerCase();p==="content-encoding"||p==="transfer-encoding"||p==="content-length"||p==="set-cookie"||p.startsWith("access-control-")||e.setHeader(u,l)}),T(e);let c=r.headers.getSetCookie?.()??[];c.length>0&&e.setHeader("x-sootsim-set-cookie",c.join(", ")),e.statusCode=r.status;let d=Buffer.from(await r.arrayBuffer());e.end(d)}function Pe(o,e){let t=o.url||"",i="",s="";if(t.startsWith("/__app-api?")){let d=new URL(t,"http://sootsim.local");i=d.searchParams.get("path")||"",s=d.searchParams.get("origin")?.trim()||""}else if(t.startsWith("/__app-api/"))i=t.slice(10);else return!1;if(!s)return e.writeHead(400,{"Content-Type":"text/plain"}),e.end("app-api: missing origin query param"),!0;if(o.method==="OPTIONS")return e.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin||"*","Access-Control-Allow-Methods":"GET,POST,PUT,PATCH,DELETE,OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]||"*","Access-Control-Allow-Credentials":"true","Access-Control-Max-Age":"86400"}),e.end(),!0;let n;try{n=new URL(i,s)}catch{return e.writeHead(400,{"Content-Type":"text/plain"}),e.end("app-api: invalid origin or path"),!0}let a=n.protocol==="https:"?Ve:Ke,r=Qe(o.headers,n),c=a.request({hostname:n.hostname,port:n.port||(n.protocol==="https:"?443:80),path:n.pathname+n.search,method:o.method,headers:r},d=>{let l=Object.keys(d.headers).filter(u=>{let p=u.toLowerCase();return!p.startsWith("access-control-")&&p!=="set-cookie"}).join(", ");e.writeHead(d.statusCode??502,{...d.headers,"access-control-allow-origin":o.headers.origin||"*","access-control-allow-credentials":"true","access-control-expose-headers":l}),d.pipe(e)});return c.on("error",d=>{e.statusCode=502,e.end(`app proxy error: ${d.message}`)}),o.pipe(c),!0}import{WebSocket as k,WebSocketServer as et}from"ws";var tt="/__websocket-proxy",it=new Set(["host","connection","upgrade","transfer-encoding","content-length","sec-websocket-accept","sec-websocket-extensions","sec-websocket-key","sec-websocket-protocol","sec-websocket-version"]);function A(o,e,t){try{o.write(`HTTP/1.1 ${e} ${t}\r
5
5
  Connection: close\r
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as g,b as k}from"./chunk-UYNPUHMD.js";import{b as S,c as x}from"./chunk-WXMGGTWH.js";import{a as w}from"./chunk-WUV6QJJU.js";import"./chunk-UKKQXZFZ.js";import"./chunk-A46MWTJB.js";import"./chunk-2ZZIXID6.js";import"./chunk-7NN725AT.js";import"./chunk-R7AEJR2M.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import{D as v,I as f,K as m,l as b}from"./chunk-TE4UPZY2.js";import"./chunk-M6GIXT25.js";import"./chunk-BYZ5SCMD.js";import"./chunk-5XMJFP54.js";import"./chunk-JALTULVB.js";import{existsSync as r,mkdirSync as j,readFileSync as d,readdirSync as I,writeFileSync as D}from"fs";import{basename as p,dirname as y,join as i,relative as c,resolve as h}from"path";var T=["bun","pnpm","npm"];async function pe(n){(n.includes("--help")||n.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as g,b as k}from"./chunk-XX5ABTZE.js";import{b as S,c as x}from"./chunk-UG44WJ5U.js";import{a as w}from"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-I25N6TF4.js";import"./chunk-73RUAURY.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import{D as v,I as f,K as m,l as b}from"./chunk-32JBVYL5.js";import"./chunk-2H5WTYZB.js";import"./chunk-3HBRJVSY.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";import{existsSync as r,mkdirSync as j,readFileSync as d,readdirSync as I,writeFileSync as D}from"fs";import{basename as p,dirname as y,join as i,relative as c,resolve as h}from"path";var T=["bun","pnpm","npm"];async function pe(n){(n.includes("--help")||n.includes("-h"))&&(console.log(`
3
3
  sootsim setup \u2014 set up this machine for SootSim
4
4
 
5
5
  usage:
@@ -94,4 +94,4 @@ module.exports = {
94
94
  4. inspect and drive it:
95
95
  sootsim describe
96
96
  sootsim do tap-text "Sign in"
97
- `)}function N(n,e){switch(n){case"bun":return`bunx ${e}`;case"pnpm":return`pnpm exec ${e}`;case"npm":return`npx ${e}`}}function ne(n,e){switch(n){case"bun":return`bun run ${e}`;case"pnpm":return`pnpm run ${e}`;case"npm":return`npm run ${e}`}}function oe(n){switch(n){case"bun":return"bun add -g sootsim";case"pnpm":return"pnpm add -g sootsim";case"npm":return"npm i -g sootsim"}}async function te(n,e){if(!e||n.dryRun)return;if(console.log(" last step:"),!process.stdin.isTTY){console.log(" run `sootsim open` after your Metro/Expo/One server is up");return}if(!await g("I'll run `sootsim open` for you now?",!0)){console.log(" later: sootsim open");return}let{runOpenCommand:o}=await import("./control-6PTTSYCT.js");await o([],{port:7668})}async function R(n,e,o){return o.yes?!0:process.stdin.isTTY?g(n,e):(console.log(` ${n} ${e?"[Y/n]":"[y/N]"} n (non-interactive; pass --yes to accept)`),!1)}export{J as detectConfigScaffoldExt,M as detectNodeVersionPins,W as detectPreferredPackageManager,E as readMachineSetupStatus,pe as runSetup,de as shouldRunSetupForBareCommand};
97
+ `)}function N(n,e){switch(n){case"bun":return`bunx ${e}`;case"pnpm":return`pnpm exec ${e}`;case"npm":return`npx ${e}`}}function ne(n,e){switch(n){case"bun":return`bun run ${e}`;case"pnpm":return`pnpm run ${e}`;case"npm":return`npm run ${e}`}}function oe(n){switch(n){case"bun":return"bun add -g sootsim";case"pnpm":return"pnpm add -g sootsim";case"npm":return"npm i -g sootsim"}}async function te(n,e){if(!e||n.dryRun)return;if(console.log(" last step:"),!process.stdin.isTTY){console.log(" run `sootsim open` after your Metro/Expo/One server is up");return}if(!await g("I'll run `sootsim open` for you now?",!0)){console.log(" later: sootsim open");return}let{runOpenCommand:o}=await import("./control-CWME7T7P.js");await o([],{port:7668})}async function R(n,e,o){return o.yes?!0:process.stdin.isTTY?g(n,e):(console.log(` ${n} ${e?"[Y/n]":"[y/N]"} n (non-interactive; pass --yes to accept)`),!1)}export{J as detectConfigScaffoldExt,M as detectNodeVersionPins,W as detectPreferredPackageManager,E as readMachineSetupStatus,pe as runSetup,de as shouldRunSetupForBareCommand};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-JALTULVB.js";import*as i from"fs";import*as I from"os";import*as a from"path";import{fileURLToPath as h}from"url";function $(){try{let t=h(import.meta.resolve("sootsim/package.json"));return a.join(a.dirname(t),"skills")}catch{let t=a.dirname(h(import.meta.url));return a.resolve(t,"../../skills")}}var d=$(),w=new Set(["all","codex","claude"]);function S(){console.log(`sootsim skill
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-OOGJDQMT.js";import*as i from"fs";import*as I from"os";import*as a from"path";import{fileURLToPath as h}from"url";function $(){try{let t=h(import.meta.resolve("sootsim/package.json"));return a.join(a.dirname(t),"skills")}catch{let t=a.dirname(h(import.meta.url));return a.resolve(t,"../../skills")}}var d=$(),w=new Set(["all","codex","claude"]);function S(){console.log(`sootsim skill
3
3
 
4
4
  install and inspect bundled SootSim agent skills.
5
5
 
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{k as f}from"./chunk-XJHF3OFF.js";import"./chunk-WSF2QLMD.js";import"./chunk-RINOK2FV.js";import"./chunk-KITHQVX5.js";import"./chunk-A4J3ZFTP.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import"./chunk-5N2BFB4I.js";import"./chunk-LJ4CQHHZ.js";import"./chunk-SQ2MTGDQ.js";import"./chunk-NX2QM2BE.js";import{a as t,b as n,c as l,d as c,e as a}from"./chunk-WXN3JD2J.js";import"./chunk-BORW7JE4.js";import"./chunk-O7QYV2FI.js";import"./chunk-6YV6WW5Q.js";import"./chunk-S23R7GAE.js";import"./chunk-7NN725AT.js";import"./chunk-R7AEJR2M.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-5XMJFP54.js";import"./chunk-JALTULVB.js";function p(){console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{k as f}from"./chunk-WT4SBY54.js";import"./chunk-R62P6SPR.js";import"./chunk-HRH5AL5T.js";import"./chunk-2OCQ4XLZ.js";import"./chunk-ODWHC4OS.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import"./chunk-EYUZLNLC.js";import"./chunk-HNBFCX26.js";import"./chunk-QS73KI7T.js";import"./chunk-3FZ2YUUP.js";import{a as t,b as n,c as l,d as c,e as a}from"./chunk-UPP423YA.js";import"./chunk-PSP2WT3K.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-U2QSYQUZ.js";import"./chunk-ZUV7FVK5.js";import"./chunk-2G4WS3NS.js";import"./chunk-3RKAEUTW.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";function p(){console.log(`
3
3
  sootsim storage profile \u2014 manage isolated storage profiles
4
4
 
5
5
  usage:
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a}from"./chunk-ZUV7FVK5.js";import"./chunk-XNCFZ4UT.js";import"./chunk-OOGJDQMT.js";export{a as settingsStore};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b}from"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";export{b as flushCliTelemetry,a as trackCliEvent};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as T}from"./chunk-WSF2QLMD.js";import{a as P}from"./chunk-O2X7YSAD.js";import{a as O,b as k}from"./chunk-JCXQE5XP.js";import"./chunk-6PJLFYJT.js";import"./chunk-R6YZNTVX.js";import{f as x}from"./chunk-SQ2MTGDQ.js";import{g as S,i as v}from"./chunk-NX2QM2BE.js";import"./chunk-O7QYV2FI.js";import"./chunk-WUV6QJJU.js";import"./chunk-UKKQXZFZ.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";import{spawn as B}from"child_process";import{existsSync as g,mkdtempSync as R,readdirSync as $,writeFileSync as C}from"fs";import{tmpdir as J}from"os";import{resolve as d,dirname as Y,join as _}from"path";import{fileURLToPath as V}from"url";var h=Y(V(import.meta.resolve("sootsim-engine/package.json"))),H=process.env.SOOTSIM_TEST_MODEL||"deepseek-v4-flash",A=18e3,W=18e4;async function he(e,t){let n=e.includes("--flows"),c=e.includes("--detox"),a=e.includes("--parallel"),i=e.includes("--watch"),u=e.find((l,o)=>e[o-1]==="--reporter")||"console",r=G(e);if((e.includes("--help")||e.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as T}from"./chunk-R62P6SPR.js";import{a as P}from"./chunk-BQSG37WI.js";import{a as O,b as k}from"./chunk-ZWFFRBAR.js";import"./chunk-7LAHDYZ3.js";import"./chunk-HFKXGD6F.js";import{f as x}from"./chunk-QS73KI7T.js";import{g as S,i as v}from"./chunk-3FZ2YUUP.js";import"./chunk-2YZKJ3ZJ.js";import"./chunk-JFURKF6W.js";import"./chunk-VGICXM2C.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";import{spawn as B}from"child_process";import{existsSync as g,mkdtempSync as R,readdirSync as $,writeFileSync as C}from"fs";import{tmpdir as J}from"os";import{resolve as d,dirname as Y,join as _}from"path";import{fileURLToPath as V}from"url";var h=Y(V(import.meta.resolve("sootsim-engine/package.json"))),H=process.env.SOOTSIM_TEST_MODEL||"deepseek-v4-flash",A=18e3,W=18e4;async function he(e,t){let n=e.includes("--flows"),c=e.includes("--detox"),a=e.includes("--parallel"),i=e.includes("--watch"),u=e.find((l,o)=>e[o-1]==="--reporter")||"console",r=G(e);if((e.includes("--help")||e.includes("-h"))&&(console.log(`
3
3
  sootsim test \u2014 run tests against sootsim
4
4
 
5
5
  usage:
@@ -32,7 +32,7 @@ examples:
32
32
  notes:
33
33
  playwright is best for smoke and package-local debugging
34
34
  --detox is the preferred parity lane for behavior that should match real RN
35
- `),process.exit(0)),r&&!n&&!c)await oe(r.prompt,r.index,e,t);else if(n)await ie(e,t,a,u);else if(c){let{runDetox:l}=await import("./detox-GL2W7X6M.js");await l(e.filter(o=>o!=="--detox"),t)}else await se(e,t)}function y(e,t){let n=e.indexOf(t);return n>=0?e[n+1]:void 0}function z(e,t){for(let n of t){let c=y(e,n);if(c)return c}}var F=new Set(["--reporter","-t","--testNamePattern","--grep","--origin","--preview-origin","--public-origin","--preview-public-origin","--owner","--repo","--url","--driver","--sim","--device","--slow","--tail-wait","--remap","--replace"]);function G(e){for(let t=0;t<e.length;t++){let n=e[t];if(n){if(F.has(n)){t+=1;continue}if(!n.startsWith("-"))return g(n)||/\.(?:[cm]?[jt]sx?|ya?ml|json)$/i.test(n)||!/\s/.test(n)&&n.length<16?null:{prompt:n,index:t}}}return null}function K(e,t){return e.filter((n,c)=>c!==t)}async function X(e,t){let n=K(e,t),c=S(n,{stripBooleanFlags:["--parallel","--watch","--flows","--detox","--new","--headless","--headed","--electron","--preview-open"],stripValueFlags:[...F]}),a=v(c);try{let i=await x(a,{describe:!0,verbose:!1,filter:"",compact:!0,hideXy:!0}),r=[i.shell?`shell: ${JSON.stringify(i.shell)}`:"",i.keyboard?`keyboard: ${JSON.stringify(i.keyboard)}`:"",typeof i.nodeCount=="number"?`nodes: ${i.nodeCount}`:"",i.tree||""].filter(Boolean).join(`
35
+ `),process.exit(0)),r&&!n&&!c)await oe(r.prompt,r.index,e,t);else if(n)await ie(e,t,a,u);else if(c){let{runDetox:l}=await import("./detox-QKN3QWEU.js");await l(e.filter(o=>o!=="--detox"),t)}else await se(e,t)}function y(e,t){let n=e.indexOf(t);return n>=0?e[n+1]:void 0}function z(e,t){for(let n of t){let c=y(e,n);if(c)return c}}var F=new Set(["--reporter","-t","--testNamePattern","--grep","--origin","--preview-origin","--public-origin","--preview-public-origin","--owner","--repo","--url","--driver","--sim","--device","--slow","--tail-wait","--remap","--replace"]);function G(e){for(let t=0;t<e.length;t++){let n=e[t];if(n){if(F.has(n)){t+=1;continue}if(!n.startsWith("-"))return g(n)||/\.(?:[cm]?[jt]sx?|ya?ml|json)$/i.test(n)||!/\s/.test(n)&&n.length<16?null:{prompt:n,index:t}}}return null}function K(e,t){return e.filter((n,c)=>c!==t)}async function X(e,t){let n=K(e,t),c=S(n,{stripBooleanFlags:["--parallel","--watch","--flows","--detox","--new","--headless","--headed","--electron","--preview-open"],stripValueFlags:[...F]}),a=v(c);try{let i=await x(a,{describe:!0,verbose:!1,filter:"",compact:!0,hideXy:!0}),r=[i.shell?`shell: ${JSON.stringify(i.shell)}`:"",i.keyboard?`keyboard: ${JSON.stringify(i.keyboard)}`:"",typeof i.nodeCount=="number"?`nodes: ${i.nodeCount}`:"",i.tree||""].filter(Boolean).join(`
36
36
  `);return r.length>A?r.slice(0,A)+`
37
37
  [tree truncated]`:r}finally{a.close()}}var q=`
38
38
  You write SootSim YAML flows from a user's natural-language test goal.
@@ -63,7 +63,7 @@ ${t||"[no tree available]"}
63
63
 
64
64
  Generate the shortest replayable flow that verifies the goal from this current state.
65
65
  `.trim()}function M(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&t.type==="text"?String(t.text??""):"").join(""):""}async function Z(e){let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/llm`,{method:"POST",headers:{"content-type":"application/json",authorization:e.authHeader},body:JSON.stringify({modelId:H,context:{systemPrompt:q,messages:[{role:"user",content:Q(e.prompt,e.describe),timestamp:Date.now()}]},options:{maxTokens:1800,temperature:.2},threadId:null}),signal:AbortSignal.timeout(W)});if(!t.ok||!t.body){let o=await t.text().catch(()=>"");throw new Error(`/api/llm ${t.status}${o?`: ${o}`:""}`)}let n=t.body.getReader(),c=new TextDecoder,a=[],i="",u="",r=o=>{let p=o.trim();if(!p)return;let s=JSON.parse(p);if(s.type==="text_delta"&&s.delta)a.push(s.delta);else if(s.type==="text_end"&&s.content)i=s.content;else if(s.type==="done")i=M(s.message?.content);else if(s.type==="error")throw new Error(s.error?.errorMessage||M(s.error?.content)||"llm error")};for(;;){let{value:o,done:p}=await n.read();if(p)break;u+=c.decode(o,{stream:!0});let s;for(;(s=u.indexOf(`
66
- `))>=0;)r(u.slice(0,s)),u=u.slice(s+1)}u+=c.decode(),u.trim()&&r(u);let l=(i||a.join("")).trim();if(!l)throw new Error("llm returned an empty test flow");return l}function ee(e){let t=e.match(/```(?:json)?\s*([\s\S]*?)```/i),n=t?t[1]:e.slice(e.indexOf("{"),e.lastIndexOf("}")+1);return JSON.parse(n)}function E(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function te(e){let t=ee(e);if(!E(t))throw new Error("llm did not return a JSON object");let n=typeof t.summary=="string"&&t.summary.trim()?t.summary.trim().slice(0,500):"SootSim generated test",c=t.steps;if(!Array.isArray(c)||c.length===0)throw new Error("llm returned no flow steps");let a=c.map((i,u)=>{if(!E(i))throw new Error(`flow step ${u+1} is not an object`);return i});return{summary:n,steps:a,yamlText:T.stringify(a)}}function ne(e,t,n,c){let a=[n,"--preview","--preview-origin",c,"--billing-kind","test_run"],i=new Set(["--public-origin","--preview-public-origin","--owner","--repo","--url","--driver","--sim","--device","--slow","--tail-wait","--remap","--replace"]),u=new Set(["--new","--headless","--headed","--electron","--preview-open","--no-shell","--shell-only"]);for(let r=0;r<e.length;r++){if(r===t)continue;let l=e[r];if(l==="--origin"||l==="--preview-origin"){r+=1;continue}if(l==="--public-origin"){let o=e[r+1];o&&a.push("--preview-public-origin",o),r+=1;continue}if(i.has(l)){let o=e[r+1];o&&a.push(l,o),r+=1;continue}u.has(l)&&a.push(l)}return a}async function re(e){let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:e.authHeader},body:JSON.stringify({prompt:e.prompt,summary:e.summary,status:e.status,failureMessage:e.failureMessage,previewShareId:e.previewShareId,owner:e.owner,repo:e.repo,durationMs:e.durationMs,flowYamlSizeBytes:e.flowYamlSizeBytes})});if(!t.ok){let a=await t.text().catch(()=>"");throw new Error(`/api/sootsim/test-runs ${t.status}${a?`: ${a}`:""}`)}let n=await t.json(),c=n.run?.id;if(!c)throw new Error("test run registration returned no id");return{id:c,traceUrl:n.run?.traceUrl??null,previewUrl:n.run?.previewUrl??null}}async function oe(e,t,n,c){let a=O();(!a||a.kind==="github")&&(console.error(' sootsim test "<prompt>" needs a login or SOOTSIM_API_KEY.'),console.error(" API keys must include preview_upload and llm scopes."),process.exit(1));let i=k(a),u=await P(z(n,["--origin","--preview-origin"]));console.log(" inspecting current sim\u2026");let r=await X(n,t);console.log(" generating flow\u2026");let l=await Z({prompt:e,describe:r,origin:u,authHeader:i}),o=te(l),p=R(_(J(),"sootsim-test-")),s=_(p,"flow.yaml");C(s,o.yamlText),console.log(` flow: ${s}`);let U=Date.now(),{runFlowPlayback:D,getLastFlowPreviewUploadResult:N}=await import("./flow-2DURO62S.js"),I=ne(n,t,s,u),b=await D(I),f=N(),m=b===0?"passed":"failed",L=y(n,"--owner"),j=y(n,"--repo"),w=await re({origin:u,authHeader:i,prompt:e,summary:o.summary,status:m,failureMessage:m==="failed"?"flow playback failed":void 0,previewShareId:f?.shareId??null,owner:L,repo:j,durationMs:Date.now()-U,flowYamlSizeBytes:Buffer.byteLength(o.yamlText,"utf8")});console.log(`
67
- result: ${m}`),console.log(` run: ${w.id}`),f?.previewUrl&&console.log(` preview: ${f.previewUrl}`),w.traceUrl&&console.log(` replay: ${w.traceUrl}`),process.exit(b)}async function se(e,t){let n=["playwright","test"],c=e.find((r,l)=>e[l-1]==="-t")||e.find((r,l)=>e[l-1]==="--testNamePattern")||e.find((r,l)=>e[l-1]==="--grep");c&&n.push("-g",c),e.includes("--watch")&&n.push("--ui");let a=new Set(["--flows","--detox","--parallel","--watch","--reporter","-t","--testNamePattern","--grep"]);for(let r=0;r<e.length;r++){if(a.has(e[r])){(e[r]==="-t"||e[r]==="--testNamePattern"||e[r]==="--grep"||e[r]==="--reporter")&&r++;continue}n.push(e[r])}console.log(` running: npx ${n.join(" ")}`);let i=B("npx",n,{cwd:h,stdio:"inherit",env:{...process.env}}),u=await new Promise(r=>{i.on("exit",l=>r(l||0))});process.exit(u)}async function ie(e,t,n,c){let a=["flows","test/flows","e2e/flows",".maestro","maestro"],i=[];for(let l of a){let o=d(h,l);if(g(o)){let p=$(o).filter(s=>s.endsWith(".yaml")||s.endsWith(".yml"));for(let s of p)i.push(d(o,s))}}for(let l of a){let o=d(process.cwd(),l);if(!o.startsWith(h)&&g(o)){let p=$(o).filter(s=>s.endsWith(".yaml")||s.endsWith(".yml"));for(let s of p)i.push(d(o,s))}}i.length===0&&(console.log(" no flow files found in flows/, test/flows/, or e2e/flows/"),process.exit(0)),console.log(` found ${i.length} flow(s)`);let u=0,r=0;for(let l of i)try{let{runFlowPlayback:o}=await import("./flow-2DURO62S.js"),p=t.port?`http://localhost:${t.port}`:"http://localhost:5173";if(await o([l,"--url",p,"--new"])!==0){r++;continue}u++}catch{r++}console.log(`
66
+ `))>=0;)r(u.slice(0,s)),u=u.slice(s+1)}u+=c.decode(),u.trim()&&r(u);let l=(i||a.join("")).trim();if(!l)throw new Error("llm returned an empty test flow");return l}function ee(e){let t=e.match(/```(?:json)?\s*([\s\S]*?)```/i),n=t?t[1]:e.slice(e.indexOf("{"),e.lastIndexOf("}")+1);return JSON.parse(n)}function E(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function te(e){let t=ee(e);if(!E(t))throw new Error("llm did not return a JSON object");let n=typeof t.summary=="string"&&t.summary.trim()?t.summary.trim().slice(0,500):"SootSim generated test",c=t.steps;if(!Array.isArray(c)||c.length===0)throw new Error("llm returned no flow steps");let a=c.map((i,u)=>{if(!E(i))throw new Error(`flow step ${u+1} is not an object`);return i});return{summary:n,steps:a,yamlText:T.stringify(a)}}function ne(e,t,n,c){let a=[n,"--preview","--preview-origin",c,"--billing-kind","test_run"],i=new Set(["--public-origin","--preview-public-origin","--owner","--repo","--url","--driver","--sim","--device","--slow","--tail-wait","--remap","--replace"]),u=new Set(["--new","--headless","--headed","--electron","--preview-open","--no-shell","--shell-only"]);for(let r=0;r<e.length;r++){if(r===t)continue;let l=e[r];if(l==="--origin"||l==="--preview-origin"){r+=1;continue}if(l==="--public-origin"){let o=e[r+1];o&&a.push("--preview-public-origin",o),r+=1;continue}if(i.has(l)){let o=e[r+1];o&&a.push(l,o),r+=1;continue}u.has(l)&&a.push(l)}return a}async function re(e){let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:e.authHeader},body:JSON.stringify({prompt:e.prompt,summary:e.summary,status:e.status,failureMessage:e.failureMessage,previewShareId:e.previewShareId,owner:e.owner,repo:e.repo,durationMs:e.durationMs,flowYamlSizeBytes:e.flowYamlSizeBytes})});if(!t.ok){let a=await t.text().catch(()=>"");throw new Error(`/api/sootsim/test-runs ${t.status}${a?`: ${a}`:""}`)}let n=await t.json(),c=n.run?.id;if(!c)throw new Error("test run registration returned no id");return{id:c,traceUrl:n.run?.traceUrl??null,previewUrl:n.run?.previewUrl??null}}async function oe(e,t,n,c){let a=O();(!a||a.kind==="github")&&(console.error(' sootsim test "<prompt>" needs a login or SOOTSIM_API_KEY.'),console.error(" API keys must include preview_upload and llm scopes."),process.exit(1));let i=k(a),u=await P(z(n,["--origin","--preview-origin"]));console.log(" inspecting current sim\u2026");let r=await X(n,t);console.log(" generating flow\u2026");let l=await Z({prompt:e,describe:r,origin:u,authHeader:i}),o=te(l),p=R(_(J(),"sootsim-test-")),s=_(p,"flow.yaml");C(s,o.yamlText),console.log(` flow: ${s}`);let U=Date.now(),{runFlowPlayback:D,getLastFlowPreviewUploadResult:N}=await import("./flow-YUB6NHPN.js"),I=ne(n,t,s,u),b=await D(I),f=N(),m=b===0?"passed":"failed",L=y(n,"--owner"),j=y(n,"--repo"),w=await re({origin:u,authHeader:i,prompt:e,summary:o.summary,status:m,failureMessage:m==="failed"?"flow playback failed":void 0,previewShareId:f?.shareId??null,owner:L,repo:j,durationMs:Date.now()-U,flowYamlSizeBytes:Buffer.byteLength(o.yamlText,"utf8")});console.log(`
67
+ result: ${m}`),console.log(` run: ${w.id}`),f?.previewUrl&&console.log(` preview: ${f.previewUrl}`),w.traceUrl&&console.log(` replay: ${w.traceUrl}`),process.exit(b)}async function se(e,t){let n=["playwright","test"],c=e.find((r,l)=>e[l-1]==="-t")||e.find((r,l)=>e[l-1]==="--testNamePattern")||e.find((r,l)=>e[l-1]==="--grep");c&&n.push("-g",c),e.includes("--watch")&&n.push("--ui");let a=new Set(["--flows","--detox","--parallel","--watch","--reporter","-t","--testNamePattern","--grep"]);for(let r=0;r<e.length;r++){if(a.has(e[r])){(e[r]==="-t"||e[r]==="--testNamePattern"||e[r]==="--grep"||e[r]==="--reporter")&&r++;continue}n.push(e[r])}console.log(` running: npx ${n.join(" ")}`);let i=B("npx",n,{cwd:h,stdio:"inherit",env:{...process.env}}),u=await new Promise(r=>{i.on("exit",l=>r(l||0))});process.exit(u)}async function ie(e,t,n,c){let a=["flows","test/flows","e2e/flows",".maestro","maestro"],i=[];for(let l of a){let o=d(h,l);if(g(o)){let p=$(o).filter(s=>s.endsWith(".yaml")||s.endsWith(".yml"));for(let s of p)i.push(d(o,s))}}for(let l of a){let o=d(process.cwd(),l);if(!o.startsWith(h)&&g(o)){let p=$(o).filter(s=>s.endsWith(".yaml")||s.endsWith(".yml"));for(let s of p)i.push(d(o,s))}}i.length===0&&(console.log(" no flow files found in flows/, test/flows/, or e2e/flows/"),process.exit(0)),console.log(` found ${i.length} flow(s)`);let u=0,r=0;for(let l of i)try{let{runFlowPlayback:o}=await import("./flow-YUB6NHPN.js"),p=t.port?`http://localhost:${t.port}`:"http://localhost:5173";if(await o([l,"--url",p,"--new"])!==0){r++;continue}u++}catch{r++}console.log(`
68
68
  results: ${u} passed, ${r} failed (${i.length} total)
69
69
  `),process.exit(r>0?1:0)}export{he as runTest};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.191 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as m,i as d,l as s}from"./chunk-NX2QM2BE.js";import"./chunk-2QAG5IPN.js";import"./chunk-S6L32ZQF.js";import"./chunk-TE4UPZY2.js";import"./chunk-JALTULVB.js";import{writeFileSync as g}from"fs";function u(){console.log(`
1
+ /*! sootsim v0.1.193 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as m,i as d,l as s}from"./chunk-3FZ2YUUP.js";import"./chunk-6WL7GBOW.js";import"./chunk-ZMYHC2GZ.js";import"./chunk-32JBVYL5.js";import"./chunk-OOGJDQMT.js";import{writeFileSync as g}from"fs";function u(){console.log(`
3
3
  sootsim timeline \u2014 control the semantic event timeline
4
4
 
5
5
  usage: