sootsim 0.1.184 → 0.1.186

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 (157) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-KSX5D27X.js → agent-HOCS7BA7.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-MS6TJF5Y.js → agent-wrapper-OFIKO65K.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-HHN6X2VJ.js → app-fonts-PXVMBZZ7.js} +2 -2
  5. package/dist-cli/chunks/{assert-XHVSQZOE.js → assert-OZS6AXZE.js} +2 -2
  6. package/dist-cli/chunks/beta-LUMNYREE.js +2 -0
  7. package/dist-cli/chunks/{camera-7L7D4XUO.js → camera-QJ2PKIJB.js} +2 -2
  8. package/dist-cli/chunks/{chunk-C3WRMMUM.js → chunk-2B2D2EBR.js} +2 -2
  9. package/dist-cli/chunks/{chunk-NBF2SXAH.js → chunk-353E6UCU.js} +2 -2
  10. package/dist-cli/chunks/chunk-3ISH4ZRW.js +1 -0
  11. package/dist-cli/chunks/{chunk-6MPD3QXA.js → chunk-4HVMPXJZ.js} +1 -1
  12. package/dist-cli/chunks/chunk-5TTEOJ4A.js +1 -0
  13. package/dist-cli/chunks/chunk-5XIRXMOS.js +971 -0
  14. package/dist-cli/chunks/chunk-6MJVRIUP.js +118 -0
  15. package/dist-cli/chunks/{chunk-S5XWFD5C.js → chunk-6OQVIQY7.js} +2 -2
  16. package/dist-cli/chunks/chunk-BU5CRHHR.js +24 -0
  17. package/dist-cli/chunks/{chunk-T4XAQ7VQ.js → chunk-DPXVA7ZF.js} +2 -2
  18. package/dist-cli/chunks/{chunk-WAZCQ5UO.js → chunk-FN64EREO.js} +2 -2
  19. package/dist-cli/chunks/{chunk-53KKDNCU.js → chunk-FUHNIWFL.js} +4 -4
  20. package/dist-cli/chunks/{chunk-QQ4JDVR6.js → chunk-GNGEYMS3.js} +2 -2
  21. package/dist-cli/chunks/{chunk-FAB5CDE7.js → chunk-I65LTDPY.js} +3 -3
  22. package/dist-cli/chunks/{chunk-JFCJIRX6.js → chunk-INIASYOZ.js} +1 -1
  23. package/dist-cli/chunks/{chunk-OGLOOKK6.js → chunk-KNICGV7H.js} +1 -1
  24. package/dist-cli/chunks/{chunk-V36X7TNR.js → chunk-LV7DFIBL.js} +1 -1
  25. package/dist-cli/chunks/{chunk-QZW44BMW.js → chunk-MAGDSBXT.js} +1 -1
  26. package/dist-cli/chunks/chunk-MP4CRGWM.js +2 -0
  27. package/dist-cli/chunks/{chunk-Q6EHTP4Q.js → chunk-MPUCQL3Q.js} +1 -1
  28. package/dist-cli/chunks/{chunk-7DHLNDOA.js → chunk-N3PLEUYD.js} +39 -15
  29. package/dist-cli/chunks/{chunk-U636Z2JZ.js → chunk-NYYP5QQK.js} +2 -2
  30. package/dist-cli/chunks/{chunk-IG7F7DTQ.js → chunk-O2SQQXUO.js} +1 -1
  31. package/dist-cli/chunks/{chunk-YYS2ITHH.js → chunk-OMFESSKA.js} +1 -1
  32. package/dist-cli/chunks/{chunk-XSWATK6S.js → chunk-P5UT637B.js} +2 -2
  33. package/dist-cli/chunks/{chunk-YQNX7JK6.js → chunk-POOE26UD.js} +2 -2
  34. package/dist-cli/chunks/{chunk-IZMNFZXZ.js → chunk-PTUTIFWJ.js} +1 -1
  35. package/dist-cli/chunks/{chunk-ID25RWPE.js → chunk-QBLTH2F6.js} +1 -1
  36. package/dist-cli/chunks/{chunk-N5LA5G7V.js → chunk-RAY2ZSNI.js} +2 -2
  37. package/dist-cli/chunks/{chunk-3KK3YZQ3.js → chunk-RDM3LVH2.js} +2 -2
  38. package/dist-cli/chunks/chunk-RP5CVR6O.js +382 -0
  39. package/dist-cli/chunks/{chunk-6GC57KRY.js → chunk-TYV3FMBE.js} +2 -2
  40. package/dist-cli/chunks/{chunk-AKQWG57K.js → chunk-U3BTJLRM.js} +29 -5
  41. package/dist-cli/chunks/{chunk-MXXD5U6B.js → chunk-UATE6GSA.js} +2 -2
  42. package/dist-cli/chunks/chunk-V434ATFM.js +13 -0
  43. package/dist-cli/chunks/{chunk-IHH3JCV5.js → chunk-VGAD3CMW.js} +1 -1
  44. package/dist-cli/chunks/{chunk-3S5BOWO5.js → chunk-VPUJQTEO.js} +1 -1
  45. package/dist-cli/chunks/chunk-WBPTJ3WC.js +5 -0
  46. package/dist-cli/chunks/{chunk-WSN7MF4E.js → chunk-WFSLSEGX.js} +2 -2
  47. package/dist-cli/chunks/{chunk-M6RZYHFK.js → chunk-XFQOFRYY.js} +1 -1
  48. package/dist-cli/chunks/{chunk-WMLFWLD7.js → chunk-XQ6PPMM6.js} +1 -1
  49. package/dist-cli/chunks/{chunk-7DKGX746.js → chunk-YYZGAZQI.js} +2 -2
  50. package/dist-cli/chunks/{chunk-WNUF6LJX.js → chunk-ZE2O7AA5.js} +2 -2
  51. package/dist-cli/chunks/{chunk-NWNFGZSI.js → chunk-ZJ64K2PL.js} +2 -2
  52. package/dist-cli/chunks/cli-version-474OBNTF.js +2 -0
  53. package/dist-cli/chunks/{compat-EGXOXW5F.js → compat-BNXJOVMU.js} +3 -3
  54. package/dist-cli/chunks/control-6LPRGKTF.js +2 -0
  55. package/dist-cli/chunks/{cpu-profile-7LF5VVWE.js → cpu-profile-3KXOGOJP.js} +2 -2
  56. package/dist-cli/chunks/daemon-OMT3RVU4.js +2 -0
  57. package/dist-cli/chunks/{debug-3J74TASS.js → debug-B3MN6772.js} +11 -10
  58. package/dist-cli/chunks/{detox-PHLGST7G.js → detox-YKSX4DUO.js} +2 -2
  59. package/dist-cli/chunks/{device-CBGLBSS6.js → device-NZX6AKQI.js} +2 -2
  60. package/dist-cli/chunks/{diagnose-BXUHKEVI.js → diagnose-26HE6KS5.js} +2 -2
  61. package/dist-cli/chunks/drivers-2PZC4QA3.js +2 -0
  62. package/dist-cli/chunks/{electron-UYJPUPAG.js → electron-XEUWIM47.js} +3 -3
  63. package/dist-cli/chunks/flow-P22NDT6V.js +2 -0
  64. package/dist-cli/chunks/help-ECGL4JSP.js +2 -0
  65. package/dist-cli/chunks/{hints-7A4UIZZL.js → hints-C56M4PMW.js} +2 -2
  66. package/dist-cli/chunks/{home-paths-THYEF54Y.js → home-paths-EYH3RBPS.js} +2 -2
  67. package/dist-cli/chunks/inspect-LJYG4WC6.js +2 -0
  68. package/dist-cli/chunks/{install-desktop-X7G7VTBV.js → install-desktop-UWHLWFKB.js} +3 -3
  69. package/dist-cli/chunks/{keys-JLP4YC4T.js → keys-Q37NM52E.js} +2 -2
  70. package/dist-cli/chunks/{login-VB4HG5WR.js → login-6E6ZEJRF.js} +4 -4
  71. package/dist-cli/chunks/{logout-TIVYUTTD.js → logout-A7QHH6DQ.js} +2 -2
  72. package/dist-cli/chunks/{maestro-C2WVLDFM.js → maestro-YJRGFGDQ.js} +8 -6
  73. package/dist-cli/chunks/optional-demo-registry-OVWOHGTW.js +2 -0
  74. package/dist-cli/chunks/{preview-YBV54B2S.js → preview-3OYFVL4A.js} +2 -2
  75. package/dist-cli/chunks/{profile-67C256LQ.js → profile-5Z2YGBCJ.js} +2 -2
  76. package/dist-cli/chunks/{react-HJ3WPDNO.js → react-ZNFFE3VQ.js} +2 -2
  77. package/dist-cli/chunks/{record-FD4QYCBW.js → record-V4CBW3GG.js} +2 -2
  78. package/dist-cli/chunks/runtime-OC6S2C22.js +2 -0
  79. package/dist-cli/chunks/{screenshot-UTVYF7F4.js → screenshot-QWMRWTIQ.js} +2 -2
  80. package/dist-cli/chunks/{screenshot-mode-WPSK6REL.js → screenshot-mode-36EUFBF5.js} +2 -2
  81. package/dist-cli/chunks/{screenshots-OXRAQXWN.js → screenshots-LOS6WHZN.js} +2 -2
  82. package/dist-cli/chunks/{screenshots-capture-KDNNRKDL.js → screenshots-capture-6D6TBI6A.js} +8 -8
  83. package/dist-cli/chunks/{serve-ZKEXM2U5.js → serve-YWGZ2JSI.js} +16 -16
  84. package/dist-cli/chunks/{setup-A5RLMR3I.js → setup-JS35KZ6P.js} +3 -3
  85. package/dist-cli/chunks/{skills-FSJFEKNP.js → skills-2TRDAXNC.js} +2 -2
  86. package/dist-cli/chunks/{slides-UU3DFZDY.js → slides-AO5MBP5Q.js} +2 -2
  87. package/dist-cli/chunks/store-HQKPCA6W.js +2 -0
  88. package/dist-cli/chunks/telemetry-I2H25VVF.js +2 -0
  89. package/dist-cli/chunks/{telemetry-TOTJDY6O.js → telemetry-MBWJUKBU.js} +2 -2
  90. package/dist-cli/chunks/{test-D6T7Z4XS.js → test-TRP2O6AP.js} +3 -3
  91. package/dist-cli/chunks/{three-mode-CAKEPRJQ.js → three-mode-VVNOGAZT.js} +2 -2
  92. package/dist-cli/chunks/{timeline-D6NKNKNS.js → timeline-4WDFXUXB.js} +2 -2
  93. package/dist-cli/chunks/{upgrade-DBT6E6DD.js → upgrade-NHQRFD4J.js} +2 -2
  94. package/dist-cli/chunks/upload-6C2EC56N.js +2 -0
  95. package/dist-cli/chunks/{version-4PLJ73Q3.js → version-T7O46MZL.js} +2 -2
  96. package/dist-cli/chunks/{web-O6QWIX3V.js → web-7YW2ISLF.js} +2 -2
  97. package/dist-cli/chunks/{what-happened-67DBMM4S.js → what-happened-IDOUXSFI.js} +2 -2
  98. package/dist-cli/chunks/{whoami-PSQRCMUL.js → whoami-DQBR3UTO.js} +2 -2
  99. package/dist-lib/agent-daemon-client.cjs +1 -1
  100. package/dist-lib/agent-events.cjs +1 -1
  101. package/dist-lib/agent-sessions.cjs +1 -1
  102. package/dist-lib/attached-projects.cjs +1 -1
  103. package/dist-lib/auth/shared-session.cjs +1 -1
  104. package/dist-lib/backend-origin.cjs +1 -1
  105. package/dist-lib/beta.cjs +1 -1
  106. package/dist-lib/beta.mjs +1 -1
  107. package/dist-lib/bridge-constants.cjs +1 -1
  108. package/dist-lib/cli-constants.cjs +1 -1
  109. package/dist-lib/config.cjs +1 -1
  110. package/dist-lib/detox/index.cjs +1 -1
  111. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  112. package/dist-lib/home-paths.cjs +2 -2
  113. package/dist-lib/host/bridge-host.cjs +77 -44
  114. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  115. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  116. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  117. package/dist-lib/host/websocket-proxy.cjs +1 -1
  118. package/dist-lib/index.cjs +28 -1
  119. package/dist-lib/jump-to-source-babel.cjs +1 -1
  120. package/dist-lib/menu.cjs +1 -1
  121. package/dist-lib/menu.mjs +1 -1
  122. package/dist-lib/metro.cjs +28 -1
  123. package/dist-lib/profiles.cjs +1 -1
  124. package/dist-lib/render-mode.cjs +1 -1
  125. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  126. package/dist-lib/sdk.cjs +38 -10
  127. package/dist-lib/sdk.mjs +38 -10
  128. package/dist-lib/skills.cjs +500 -300
  129. package/dist-lib/vite.cjs +28 -1
  130. package/package.json +1 -1
  131. package/src/home-paths.ts +8 -1
  132. package/src/host/bridge-host.ts +15 -1
  133. package/src/runtime-assets.ts +70 -0
  134. package/src/vite-plugin.ts +9 -0
  135. package/dist-cli/chunks/beta-JS4JTDFC.js +0 -2
  136. package/dist-cli/chunks/chunk-7C6RC3BU.js +0 -23
  137. package/dist-cli/chunks/chunk-BB432MX4.js +0 -1
  138. package/dist-cli/chunks/chunk-FD4BKULK.js +0 -5
  139. package/dist-cli/chunks/chunk-MFL73VJG.js +0 -2
  140. package/dist-cli/chunks/chunk-Q2S6VBXK.js +0 -2
  141. package/dist-cli/chunks/chunk-T5YWTSGG.js +0 -264
  142. package/dist-cli/chunks/chunk-VGTPGXKM.js +0 -1
  143. package/dist-cli/chunks/chunk-VVACMCCE.js +0 -118
  144. package/dist-cli/chunks/chunk-WDMIABUY.js +0 -463
  145. package/dist-cli/chunks/chunk-WLDAMCQK.js +0 -13
  146. package/dist-cli/chunks/cli-version-L6NDSEVW.js +0 -2
  147. package/dist-cli/chunks/control-LUH3EQQG.js +0 -2
  148. package/dist-cli/chunks/daemon-NGDXMG6R.js +0 -2
  149. package/dist-cli/chunks/drivers-QX77DPCG.js +0 -2
  150. package/dist-cli/chunks/flow-KDVDRUEN.js +0 -2
  151. package/dist-cli/chunks/help-4L6UVSAZ.js +0 -2
  152. package/dist-cli/chunks/inspect-QULPTQ5V.js +0 -987
  153. package/dist-cli/chunks/optional-demo-registry-WV2BZJ5T.js +0 -2
  154. package/dist-cli/chunks/runtime-BY3EB4G7.js +0 -2
  155. package/dist-cli/chunks/store-TZH6LKFH.js +0 -2
  156. package/dist-cli/chunks/telemetry-AHIQ3SS5.js +0 -2
  157. package/dist-cli/chunks/upload-JR2B3YT7.js +0 -2
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as g,d as m}from"./chunk-N5LA5G7V.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.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.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as g,d as m}from"./chunk-RAY2ZSNI.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.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 desktop 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-AHIQ3SS5.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-I2H25VVF.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-AHIQ3SS5.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-AHIQ3SS5.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-I2H25VVF.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-I2H25VVF.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.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as r,b as i}from"./chunk-YQNX7JK6.js";import{a as t,c as o}from"./chunk-N5LA5G7V.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.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.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as r,b as i}from"./chunk-POOE26UD.js";import{a as t,c as o}from"./chunk-RAY2ZSNI.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.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.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as y,c as v}from"./chunk-WDMIABUY.js";import"./chunk-C3WRMMUM.js";import"./chunk-VGTPGXKM.js";import"./chunk-MXXD5U6B.js";import"./chunk-NBF2SXAH.js";import"./chunk-6GC57KRY.js";import{b as h,c as w}from"./chunk-T5YWTSGG.js";import"./chunk-WLDAMCQK.js";import"./chunk-FD4BKULK.js";import"./chunk-7DKGX746.js";import"./chunk-7DHLNDOA.js";import"./chunk-WMLFWLD7.js";import"./chunk-ID25RWPE.js";import"./chunk-YYS2ITHH.js";import"./chunk-7C6RC3BU.js";import"./chunk-AKQWG57K.js";import"./chunk-JFCJIRX6.js";import"./chunk-IZMNFZXZ.js";import"./chunk-WNUF6LJX.js";import"./chunk-WSN7MF4E.js";import"./chunk-YQNX7JK6.js";import"./chunk-N5LA5G7V.js";import"./chunk-T4XAQ7VQ.js";import"./chunk-MFL73VJG.js";import"./chunk-Q2S6VBXK.js";import"./chunk-V36X7TNR.js";import"./chunk-53KKDNCU.js";import"./chunk-OGLOOKK6.js";import"./chunk-IHH3JCV5.js";import*as n from"fs";import*as a from"path";var S=[".maestro","maestro"];function k(){console.log(`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as w,c as v}from"./chunk-RP5CVR6O.js";import"./chunk-2B2D2EBR.js";import"./chunk-UATE6GSA.js";import"./chunk-353E6UCU.js";import"./chunk-TYV3FMBE.js";import{b as h,c as y}from"./chunk-5XIRXMOS.js";import"./chunk-MPUCQL3Q.js";import"./chunk-V434ATFM.js";import"./chunk-WBPTJ3WC.js";import"./chunk-YYZGAZQI.js";import"./chunk-N3PLEUYD.js";import"./chunk-5TTEOJ4A.js";import"./chunk-XQ6PPMM6.js";import"./chunk-QBLTH2F6.js";import"./chunk-OMFESSKA.js";import"./chunk-BU5CRHHR.js";import"./chunk-U3BTJLRM.js";import"./chunk-INIASYOZ.js";import"./chunk-PTUTIFWJ.js";import"./chunk-ZE2O7AA5.js";import"./chunk-XFQOFRYY.js";import"./chunk-WFSLSEGX.js";import"./chunk-POOE26UD.js";import"./chunk-RAY2ZSNI.js";import"./chunk-6MJVRIUP.js";import"./chunk-FN64EREO.js";import"./chunk-DPXVA7ZF.js";import"./chunk-MP4CRGWM.js";import"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import"./chunk-KNICGV7H.js";import"./chunk-VGAD3CMW.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:
@@ -58,6 +58,8 @@ partial:
58
58
  openLink \u2014 dispatched into the app via the Linking emulation
59
59
  (react-navigation deep links work); no OS-level Safari fallback.
60
60
  launchApp.arguments \u2014 ignored; sootsim has no native process.
61
+ launchApp.resetRuntime \u2014 sootsim-only extension for recorded benchmarks:
62
+ keep tenant storage/auth, but soft-reload the guest app inside launchApp.
61
63
  takeScreenshot \u2014 maestro string form works unchanged; sootsim also accepts
62
64
  { path, withFrame } for framed export.
63
65
  env \u2014 sootsim seeds the JS env from the full shell environment, not just
@@ -68,7 +70,7 @@ not yet implemented (will throw "unsupported maestro verb"):
68
70
  travel, setLocation, setAirplaneMode, killApp, faker,
69
71
  addMedia, startRecording, stopRecording (use --record flag),
70
72
  repeat.while (only repeat.times is supported).
71
- `)}function b(o){return o.startsWith("-")}function $(o){let i=[];for(let e=0;e<o.length;e++){if(o[e]==="--env"||o[e]==="-e"){let s=o[e+1];if(!s||!s.includes("="))throw new Error(`--env expects KEY=VALUE (got ${JSON.stringify(s??"")})`);let p=s.indexOf("="),l=s.slice(0,p),f=s.slice(p+1);process.env[l]=f,e+=1;continue}i.push(o[e])}return i}function T(o){let i=[];for(let e=0;e<o.length;e++){let s=o[e];if(s==="--format"||s==="--output"||s==="--device"||s==="-d"){e+=1;continue}if(s==="--continuous"){console.warn(" warn: --continuous is not yet implemented in sootsim \u2014 running once");continue}i.push(s)}return i}function x(o){for(let i of S){let e=a.join(o,i);if(n.existsSync(e)&&n.statSync(e).isDirectory())return e}return null}function F(o){let i=n.statSync(o);if(i.isFile())return[o];if(!i.isDirectory())throw new Error(`not a file or directory: ${o}`);let e={},s=["config.yaml","config.yml"].map(t=>a.join(o,t)).find(t=>n.existsSync(t));if(s){let t=h.parse(n.readFileSync(s,"utf8"));t&&typeof t=="object"&&(e=t)}let p=Array.isArray(e.flows)&&e.flows.length>0?e.flows:["*"],l=t=>{let r=a.basename(t);return!(r.startsWith(".")||!r.endsWith(".yaml")&&!r.endsWith(".yml")||r==="config.yaml"||r==="config.yml")},f=new Set;for(let t of p)for(let r of n.globSync(t,{cwd:o})){if(!l(r))continue;let c=a.join(o,r);n.existsSync(c)&&n.statSync(c).isFile()&&f.add(c)}let m=[...f].sort(),u=Array.isArray(e.includeTags)?e.includeTags:[],d=Array.isArray(e.excludeTags)?e.excludeTags:[];return(u.length>0||d.length>0)&&(m=m.filter(t=>{let{frontmatter:r}=w(n.readFileSync(t,"utf8")),c=Array.isArray(r.tags)?r.tags:[];return!(u.length>0&&!c.some(g=>u.includes(g))||c.some(g=>d.includes(g)))})),m}async function E(o){let i=a.join(o,".maestro");n.mkdirSync(i,{recursive:!0});let e=a.join(i,"login.yaml");return n.existsSync(e)?(console.error(` error: ${e} already exists`),1):(n.writeFileSync(e,`# sootsim maestro starter flow \u2014 drop-in compatible with the maestro cli.
73
+ `)}function b(o){return o.startsWith("-")}function $(o){let i=[];for(let e=0;e<o.length;e++){if(o[e]==="--env"||o[e]==="-e"){let s=o[e+1];if(!s||!s.includes("="))throw new Error(`--env expects KEY=VALUE (got ${JSON.stringify(s??"")})`);let f=s.indexOf("="),l=s.slice(0,f),p=s.slice(f+1);process.env[l]=p,e+=1;continue}i.push(o[e])}return i}function T(o){let i=[];for(let e=0;e<o.length;e++){let s=o[e];if(s==="--format"||s==="--output"||s==="--device"||s==="-d"){e+=1;continue}if(s==="--continuous"){console.warn(" warn: --continuous is not yet implemented in sootsim \u2014 running once");continue}i.push(s)}return i}function x(o){for(let i of S){let e=a.join(o,i);if(n.existsSync(e)&&n.statSync(e).isDirectory())return e}return null}function F(o){let i=n.statSync(o);if(i.isFile())return[o];if(!i.isDirectory())throw new Error(`not a file or directory: ${o}`);let e={},s=["config.yaml","config.yml"].map(t=>a.join(o,t)).find(t=>n.existsSync(t));if(s){let t=h.parse(n.readFileSync(s,"utf8"));t&&typeof t=="object"&&(e=t)}let f=Array.isArray(e.flows)&&e.flows.length>0?e.flows:["*"],l=t=>{let r=a.basename(t);return!(r.startsWith(".")||!r.endsWith(".yaml")&&!r.endsWith(".yml")||r==="config.yaml"||r==="config.yml")},p=new Set;for(let t of f)for(let r of n.globSync(t,{cwd:o})){if(!l(r))continue;let c=a.join(o,r);n.existsSync(c)&&n.statSync(c).isFile()&&p.add(c)}let m=[...p].sort(),u=Array.isArray(e.includeTags)?e.includeTags:[],d=Array.isArray(e.excludeTags)?e.excludeTags:[];return(u.length>0||d.length>0)&&(m=m.filter(t=>{let{frontmatter:r}=y(n.readFileSync(t,"utf8")),c=Array.isArray(r.tags)?r.tags:[];return!(u.length>0&&!c.some(g=>u.includes(g))||c.some(g=>d.includes(g)))})),m}async function E(o){let i=a.join(o,".maestro");n.mkdirSync(i,{recursive:!0});let e=a.join(i,"login.yaml");return n.existsSync(e)?(console.error(` error: ${e} already exists`),1):(n.writeFileSync(e,`# sootsim maestro starter flow \u2014 drop-in compatible with the maestro cli.
72
74
  # run: sootsim maestro test .maestro/login.yaml
73
75
  appId: com.example.app
74
76
  ---
@@ -81,7 +83,7 @@ appId: com.example.app
81
83
  - inputText: "secret123"
82
84
  - tapOn: "Sign in"
83
85
  - assertVisible: "Welcome"
84
- `,"utf8"),console.log(` + wrote ${e}`),console.log(" next: sootsim maestro test .maestro/login.yaml"),0)}async function j(o,i={}){if(o.includes("--help")||o.includes("-h"))return k(),0;if(o.includes("--list-compat"))return A(),0;let e;try{e=$(o)}catch(t){return console.error(` error: ${t.message}`),1}e=T(e),e=v(e);let s=process.cwd(),p=e[0];if(p==="init")return E(s);let l=null,f;if(p==="test"){let t=e.slice(1).find(r=>!b(r));t?(l=a.resolve(s,t),f=e.slice(1).filter(r=>r!==t)):(l=x(s),f=e.slice(1))}else p&&!b(p)?(l=a.resolve(s,p),f=e.slice(1)):(l=x(s),f=e);if(!l)return console.error(`
86
+ `,"utf8"),console.log(` + wrote ${e}`),console.log(" next: sootsim maestro test .maestro/login.yaml"),0)}async function R(o,i={}){if(o.includes("--help")||o.includes("-h"))return k(),0;if(o.includes("--list-compat"))return A(),0;let e;try{e=$(o)}catch(t){return console.error(` error: ${t.message}`),1}e=T(e),e=v(e);let s=process.cwd(),f=e[0];if(f==="init")return E(s);let l=null,p;if(f==="test"){let t=e.slice(1).find(r=>!b(r));t?(l=a.resolve(s,t),p=e.slice(1).filter(r=>r!==t)):(l=x(s),p=e.slice(1))}else f&&!b(f)?(l=a.resolve(s,f),p=e.slice(1)):(l=x(s),p=e);if(!l)return console.error(`
85
87
  error: no maestro flows found.
86
88
  expected one of: ${S.map(t=>`./${t}/`).join(", ")}
87
89
  or pass a flow explicitly: sootsim maestro test path/to/flow.yaml
@@ -90,5 +92,5 @@ appId: com.example.app
90
92
  sootsim maestro \u2014 ${m.length} flow${m.length===1?"":"s"}
91
93
  root: ${a.relative(s,l)||"."}
92
94
  `);let u=0,d=[];for(let t of m){console.log(`
93
- \u25B6 ${a.relative(s,t)}`);let r=[t,...f];i.port&&!f.includes("--url")&&r.push("--url",String(i.port));let c=0;try{c=await y(r)}catch(g){console.error(` x ${g.message}`),c=1}d.push({file:t,exit:c}),c!==0&&u===0&&(u=c)}if(m.length>1){console.log(`
94
- maestro summary:`);for(let r of d){let c=r.exit===0?"pass":"fail";console.log(` ${c} ${a.relative(s,r.file)}`)}let t=d.filter(r=>r.exit===0).length;console.log(` ${t}/${d.length} passed`)}return u}export{F as collectFlowFiles,j as runMaestro};
95
+ \u25B6 ${a.relative(s,t)}`);let r=[t,...p];i.port&&!p.includes("--url")&&r.push("--url",String(i.port));let c=0;try{c=await w(r)}catch(g){console.error(` x ${g.message}`),c=1}d.push({file:t,exit:c}),c!==0&&u===0&&(u=c)}if(m.length>1){console.log(`
96
+ maestro summary:`);for(let r of d){let c=r.exit===0?"pass":"fail";console.log(` ${c} ${a.relative(s,r.file)}`)}let t=d.filter(r=>r.exit===0).length;console.log(` ${t}/${d.length} passed`)}return u}export{F as collectFlowFiles,R as runMaestro};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b}from"./chunk-OMFESSKA.js";import"./chunk-VGAD3CMW.js";export{a as loadOptionalDemoApps,b as optionalDemoAppsSync};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-IHH3JCV5.js";import{resolve as c,dirname as m}from"path";import{fileURLToPath as a}from"url";var t=m(a(import.meta.resolve("sootsim-engine/package.json")));async function g(o,r){(o.includes("--help")||o.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-VGAD3CMW.js";import{resolve as c,dirname as m}from"path";import{fileURLToPath as a}from"url";var t=m(a(import.meta.resolve("sootsim-engine/package.json")));async function g(o,r){(o.includes("--help")||o.includes("-h"))&&(console.log(`
3
3
  sootsim preview \u2014 production-like preview
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as s,c as i,d as t,e as n,f as c}from"./chunk-WNUF6LJX.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.js";function f(){console.log(`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as s,c as i,d as t,e as n,f as c}from"./chunk-ZE2O7AA5.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.js";function f(){console.log(`
3
3
  sootsim profile \u2014 manage isolated storage profiles
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{c as w,e as b,h as m,i as f}from"./chunk-7C6RC3BU.js";import"./chunk-Q2S6VBXK.js";import"./chunk-V36X7TNR.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.js";function h(){console.log(`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as w,i as b,l as m,m as f}from"./chunk-BU5CRHHR.js";import"./chunk-MP4CRGWM.js";import"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.js";function h(){console.log(`
3
3
  sootsim react \u2014 inspect React component render cost in the tenant worker
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as P}from"./chunk-MXXD5U6B.js";import"./chunk-NBF2SXAH.js";import{d as Z,f as ee}from"./chunk-6GC57KRY.js";import"./chunk-WMLFWLD7.js";import"./chunk-ID25RWPE.js";import{c as b,e as v,f as Q}from"./chunk-7C6RC3BU.js";import{d as Y}from"./chunk-IZMNFZXZ.js";import"./chunk-YQNX7JK6.js";import"./chunk-N5LA5G7V.js";import"./chunk-Q2S6VBXK.js";import{b as X}from"./chunk-V36X7TNR.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.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.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as P}from"./chunk-UATE6GSA.js";import"./chunk-353E6UCU.js";import{d as Z,f as ee}from"./chunk-TYV3FMBE.js";import"./chunk-XQ6PPMM6.js";import"./chunk-QBLTH2F6.js";import{g as b,i as v,j as Q}from"./chunk-BU5CRHHR.js";import{d as Y}from"./chunk-PTUTIFWJ.js";import"./chunk-POOE26UD.js";import"./chunk-RAY2ZSNI.js";import"./chunk-MP4CRGWM.js";import{b as X}from"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.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
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a}from"./chunk-I65LTDPY.js";import"./chunk-P5UT637B.js";import"./chunk-BU5CRHHR.js";import"./chunk-MP4CRGWM.js";import"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.js";export{a as runRuntime};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as E}from"./chunk-C3WRMMUM.js";import"./chunk-VGTPGXKM.js";import{a as R}from"./chunk-Q6EHTP4Q.js";import{r as y}from"./chunk-7DHLNDOA.js";import{c as x,d as v,e as S,f as b,h as _}from"./chunk-7C6RC3BU.js";import"./chunk-WSN7MF4E.js";import"./chunk-T4XAQ7VQ.js";import"./chunk-Q2S6VBXK.js";import"./chunk-V36X7TNR.js";import"./chunk-53KKDNCU.js";import{g as w}from"./chunk-OGLOOKK6.js";import"./chunk-IHH3JCV5.js";import{mkdirSync as $,writeFileSync as A}from"fs";import{dirname as M,resolve as F}from"path";async function Q(t,o){let e=q(t);(e.includes("--help")||e.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as E}from"./chunk-2B2D2EBR.js";import{a as R}from"./chunk-MPUCQL3Q.js";import{r as y}from"./chunk-N3PLEUYD.js";import"./chunk-5TTEOJ4A.js";import{g as x,h as v,i as S,j as b,l as _}from"./chunk-BU5CRHHR.js";import"./chunk-WFSLSEGX.js";import"./chunk-DPXVA7ZF.js";import"./chunk-MP4CRGWM.js";import"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import{g as w}from"./chunk-KNICGV7H.js";import"./chunk-VGAD3CMW.js";import{mkdirSync as $,writeFileSync as A}from"fs";import{dirname as M,resolve as F}from"path";async function Q(t,o){let e=q(t);(e.includes("--help")||e.includes("-h"))&&(console.log(`
3
3
  sootsim screenshot \u2014 capture the canvas as a PNG
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as o}from"./chunk-U636Z2JZ.js";import"./chunk-7C6RC3BU.js";import"./chunk-Q2S6VBXK.js";import"./chunk-V36X7TNR.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.js";async function n(e,s){(e.includes("--help")||e.includes("-h"))&&(console.log(`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as o}from"./chunk-NYYP5QQK.js";import"./chunk-BU5CRHHR.js";import"./chunk-MP4CRGWM.js";import"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.js";async function n(e,s){(e.includes("--help")||e.includes("-h"))&&(console.log(`
3
3
  sootsim screenshot-mode \u2014 toggle the screenshot-mode chrome overlay
4
4
 
5
5
  usage:
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as q}from"./chunk-WDMIABUY.js";import{b as L}from"./chunk-C3WRMMUM.js";import"./chunk-VGTPGXKM.js";import"./chunk-MXXD5U6B.js";import"./chunk-NBF2SXAH.js";import{d as U,e as K}from"./chunk-6GC57KRY.js";import{b as H}from"./chunk-T5YWTSGG.js";import"./chunk-WLDAMCQK.js";import"./chunk-FD4BKULK.js";import"./chunk-7DKGX746.js";import"./chunk-7DHLNDOA.js";import"./chunk-WMLFWLD7.js";import"./chunk-ID25RWPE.js";import"./chunk-YYS2ITHH.js";import"./chunk-7C6RC3BU.js";import"./chunk-AKQWG57K.js";import"./chunk-JFCJIRX6.js";import"./chunk-IZMNFZXZ.js";import"./chunk-WNUF6LJX.js";import"./chunk-WSN7MF4E.js";import"./chunk-YQNX7JK6.js";import"./chunk-N5LA5G7V.js";import"./chunk-T4XAQ7VQ.js";import"./chunk-MFL73VJG.js";import"./chunk-Q2S6VBXK.js";import"./chunk-V36X7TNR.js";import"./chunk-53KKDNCU.js";import{a as y,b as A,c as v,d as E,e as O,f as C,g as _}from"./chunk-OGLOOKK6.js";import"./chunk-IHH3JCV5.js";import{mkdirSync as I,readFileSync as ye,writeFileSync as se}from"fs";import{tmpdir as We}from"os";import F from"path";import{mkdirSync as W,readFileSync as ae,writeFileSync as X}from"fs";import B from"path";function V(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function T(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function ce(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function D(e,t){let o=ce(e),i=Math.max(0,Math.min(1,t)),n=o.match(/^#([0-9a-f]{6})$/i);if(n){let s=n[1],r=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),c=Number.parseInt(s.slice(4,6),16);return`rgba(${r}, ${a}, ${c}, ${i})`}return o.startsWith("rgb(")?o.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):o}function le(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,o=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${o})`}function pe(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${D(t,.46)} 0%, ${D(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function R(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";case"straight":default:return"none"}}function G(...e){let t=e.map(o=>o.trim()).filter(o=>o.length>0&&o!=="none");return t.length>0?t.join(" "):"none"}function j(e){let t=D(e.color,e.opacity),o=D(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${o}) drop-shadow(0 0 ${e.blur}px ${t})`}function Y(e,t){return!t.glow||e.color&&e.color!==y.color?e:{...e,color:t.glow}}function ue(e,t){if(e==="editorial-left"){let n=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(r,a,c)=>{let p=Math.round(t.width*.68*(a.scale??r.scale)),l=Math.round(t.height*(.03+r.offsetY+(a.offsetY??0))),m=a.pose||r.pose||"tilted-right",h=Y(r.shadow,c);return["position:absolute",`top:${Math.round(t.height*.18)+l}px`,`left:${Math.round(t.width*.56)}px`,`width:${p}px`,"transform-origin:center center",`transform:${R(m)}`,`filter:${j(h)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let n=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(r,a,c)=>{let p=Math.round(t.width*.84*(a.scale??r.scale)),l=Math.round(t.height*(r.offsetY+(a.offsetY??0))),m=a.pose||r.pose,h=Y(r.shadow,c);return["position:absolute",`top:${Math.round(t.height*.075)+l}px`,"left:50%",`width:${p}px`,"transform-origin:center center",`transform:${G("translateX(-50%)",R(m))}`,`filter:${j(h)}`,"z-index:2"].join(";")}}}let o=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,s,r)=>{let a=Math.round(t.width*.64*(s.scale??n.scale)),c=Math.round(t.height*(n.offsetY+(s.offsetY??0))),p=s.pose||n.pose,l=Y(n.shadow,r);return["position:absolute",`top:${Math.round(t.height*.28)+c}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${G("translateX(-50%)",R(p))}`,`filter:${j(l)}`,"z-index:2"].join(";")}}}function de({canvas:e,compose:t,slide:o,imageDataUrl:i}){let n=o.background??t.background,s=ue(t.text.preset,e),r=t.text.preset!=="none"&&!!(o.eyebrow||o.headline||o.subheadline),a=s.deviceStyle(t.frame,o,n),c=o.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${T(o.headline)}</div>`:"",p=o.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${T(o.subheadline)}</div>`:"",l=o.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${T(o.eyebrow)}</div></div>`:"";return`<!doctype html>
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as q}from"./chunk-RP5CVR6O.js";import{b as L}from"./chunk-2B2D2EBR.js";import"./chunk-UATE6GSA.js";import"./chunk-353E6UCU.js";import{d as U,e as K}from"./chunk-TYV3FMBE.js";import{b as H}from"./chunk-5XIRXMOS.js";import"./chunk-MPUCQL3Q.js";import"./chunk-V434ATFM.js";import"./chunk-WBPTJ3WC.js";import"./chunk-YYZGAZQI.js";import"./chunk-N3PLEUYD.js";import"./chunk-5TTEOJ4A.js";import"./chunk-XQ6PPMM6.js";import"./chunk-QBLTH2F6.js";import"./chunk-OMFESSKA.js";import"./chunk-BU5CRHHR.js";import"./chunk-U3BTJLRM.js";import"./chunk-INIASYOZ.js";import"./chunk-PTUTIFWJ.js";import"./chunk-ZE2O7AA5.js";import"./chunk-XFQOFRYY.js";import"./chunk-WFSLSEGX.js";import"./chunk-POOE26UD.js";import"./chunk-RAY2ZSNI.js";import"./chunk-6MJVRIUP.js";import"./chunk-FN64EREO.js";import"./chunk-DPXVA7ZF.js";import"./chunk-MP4CRGWM.js";import"./chunk-LV7DFIBL.js";import"./chunk-FUHNIWFL.js";import{a as y,b as A,c as v,d as E,e as O,f as C,g as _}from"./chunk-KNICGV7H.js";import"./chunk-VGAD3CMW.js";import{mkdirSync as I,readFileSync as ye,writeFileSync as se}from"fs";import{tmpdir as We}from"os";import F from"path";import{mkdirSync as W,readFileSync as ae,writeFileSync as X}from"fs";import B from"path";function V(e){return e.replace(/\\/g,"/").replace(/\.png$/i,"").trim().split("/").filter(Boolean).join("--").replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"slide"}function T(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function ce(e){let t=e.trim();return/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function D(e,t){let o=ce(e),i=Math.max(0,Math.min(1,t)),n=o.match(/^#([0-9a-f]{6})$/i);if(n){let s=n[1],r=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),c=Number.parseInt(s.slice(4,6),16);return`rgba(${r}, ${a}, ${c}, ${i})`}return o.startsWith("rgb(")?o.replace(/^rgb\((.+)\)$/i,`rgba($1, ${i})`):o}function le(e){if(e.type==="solid")return e.color||"#000000";let t=e.direction??180,o=e.stops?.map(i=>`${i.color} ${i.offset}%`).join(", ")||"#000000 0%, #111111 100%";return`linear-gradient(${t}deg, ${o})`}function pe(e){let t=e.glow;return t?`radial-gradient(circle at 50% 24%, ${D(t,.46)} 0%, ${D(t,.2)} 24%, rgba(0,0,0,0) 62%)`:"none"}function R(e){switch(e){case"tilted-left":return"perspective(2400px) rotateY(10deg) rotateZ(-2deg)";case"tilted-right":return"perspective(2400px) rotateY(-10deg) rotateZ(2deg)";case"cut-bottom":return"translateY(10%) scale(1.08)";case"cut-top":return"translateY(-16%) scale(1.08)";case"straight":default:return"none"}}function G(...e){let t=e.map(o=>o.trim()).filter(o=>o.length>0&&o!=="none");return t.length>0?t.join(" "):"none"}function j(e){let t=D(e.color,e.opacity),o=D(e.color,e.opacity*.52);return`drop-shadow(0 34px ${e.spread}px ${o}) drop-shadow(0 0 ${e.blur}px ${t})`}function Y(e,t){return!t.glow||e.color&&e.color!==y.color?e:{...e,color:t.glow}}function ue(e,t){if(e==="editorial-left"){let n=Math.round(t.height*.056),s=Math.round(t.height*.022);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.12)}px`,`left:${Math.round(t.width*.085)}px`,`width:${Math.round(t.width*.42)}px`,"text-align:left","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.92;`,subStyle:`font-size:${s}px;line-height:1.36;max-width:${Math.round(t.width*.36)}px;`,eyebrowStyle:"align-items:flex-start;",deviceStyle:(r,a,c)=>{let p=Math.round(t.width*.68*(a.scale??r.scale)),l=Math.round(t.height*(.03+r.offsetY+(a.offsetY??0))),m=a.pose||r.pose||"tilted-right",h=Y(r.shadow,c);return["position:absolute",`top:${Math.round(t.height*.18)+l}px`,`left:${Math.round(t.width*.56)}px`,`width:${p}px`,"transform-origin:center center",`transform:${R(m)}`,`filter:${j(h)}`,"z-index:2"].join(";")}}}if(e==="minimal-bottom"){let n=Math.round(t.height*.041),s=Math.round(t.height*.019);return{copyStyle:["position:absolute",`left:${Math.round(t.width*.12)}px`,`right:${Math.round(t.width*.12)}px`,`bottom:${Math.round(t.height*.085)}px`,"text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${n}px;line-height:0.96;`,subStyle:`font-size:${s}px;line-height:1.34;max-width:${Math.round(t.width*.56)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(r,a,c)=>{let p=Math.round(t.width*.84*(a.scale??r.scale)),l=Math.round(t.height*(r.offsetY+(a.offsetY??0))),m=a.pose||r.pose,h=Y(r.shadow,c);return["position:absolute",`top:${Math.round(t.height*.075)+l}px`,"left:50%",`width:${p}px`,"transform-origin:center center",`transform:${G("translateX(-50%)",R(m))}`,`filter:${j(h)}`,"z-index:2"].join(";")}}}let o=Math.round(t.height*.04),i=Math.round(t.height*.019);return{copyStyle:["position:absolute",`top:${Math.round(t.height*.084)}px`,"left:50%",`width:${Math.round(t.width*.88)}px`,"transform:translateX(-50%)","text-align:center","z-index:3"].join(";"),titleStyle:`font-size:${o}px;line-height:0.92;`,subStyle:`font-size:${i}px;line-height:1.34;max-width:${Math.round(t.width*.6)}px;margin:0 auto;`,eyebrowStyle:"align-items:center;",deviceStyle:(n,s,r)=>{let a=Math.round(t.width*.64*(s.scale??n.scale)),c=Math.round(t.height*(n.offsetY+(s.offsetY??0))),p=s.pose||n.pose,l=Y(n.shadow,r);return["position:absolute",`top:${Math.round(t.height*.28)+c}px`,"left:50%",`width:${a}px`,"transform-origin:center top",`transform:${G("translateX(-50%)",R(p))}`,`filter:${j(l)}`,"z-index:2"].join(";")}}}function de({canvas:e,compose:t,slide:o,imageDataUrl:i}){let n=o.background??t.background,s=ue(t.text.preset,e),r=t.text.preset!=="none"&&!!(o.eyebrow||o.headline||o.subheadline),a=s.deviceStyle(t.frame,o,n),c=o.headline?`<div style="font-weight:780;white-space:pre-line;text-wrap:balance;${s.titleStyle}">${T(o.headline)}</div>`:"",p=o.subheadline?`<div style="margin-top:${Math.round(e.height*.018)}px;color:${t.text.subColor};white-space:pre-line;text-wrap:balance;${s.subStyle}">${T(o.subheadline)}</div>`:"",l=o.eyebrow?`<div style="display:flex;${s.eyebrowStyle}margin-bottom:${Math.round(e.height*.016)}px;"><div style="font-size:${Math.round(e.height*.014)}px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;color:${t.text.eyebrowColor};">${T(o.eyebrow)}</div></div>`:"";return`<!doctype html>
3
3
  <html>
4
4
  <head>
5
5
  <meta charset="utf-8" />
@@ -1,6 +1,6 @@
1
- /*! sootsim v0.1.184 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{d as I}from"./chunk-6GC57KRY.js";import"./chunk-N5LA5G7V.js";import"./chunk-53KKDNCU.js";import"./chunk-IHH3JCV5.js";import{execSync as E}from"node:child_process";import{mkdirSync as L,mkdtempSync as W,rmSync as q,writeFileSync as z}from"node:fs";import{tmpdir as H}from"node:os";import{dirname as J,isAbsolute as K,join as A,resolve as V}from"node:path";import{chromium as Y}from"playwright-core";import{execSync as j}from"node:child_process";function N(o){let e=o;if(e&&typeof e.process=="function")try{let t=e.process();if(t&&typeof t.pid=="number"&&t.pid>0)return t.pid}catch{}if(e&&typeof e.browser=="function")try{let t=e.browser();if(t)return N(t)}catch{}return null}function x(o){let e=[];try{e=j(`pgrep -P ${o} || true`).toString().split(`
3
- `).filter(Boolean)}catch{}for(let t of e)x(Number(t));try{process.kill(o,"SIGKILL")}catch{}}var C=new Set,M=!1;function B(){if(M)return;M=!0;let o=()=>{for(let e of C)x(e)};process.on("SIGTERM",()=>{o(),process.exit(0)}),process.on("SIGINT",()=>{o(),process.exit(0)}),process.on("exit",o)}async function U(o){let e=await o(),t=N(e),n=new Set;t!=null&&(n.add(t),C.add(t),B());let i=e;return typeof i.on=="function"&&i.on("disconnected",()=>{for(let c of n)C.delete(c)}),{browser:e,reapNow:()=>{for(let c of n)x(c),C.delete(c);n.clear()}}}var Q=`
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as N}from"./chunk-TYV3FMBE.js";import"./chunk-RAY2ZSNI.js";import"./chunk-FUHNIWFL.js";import"./chunk-VGAD3CMW.js";import{execSync as D}from"node:child_process";import{mkdirSync as L,mkdtempSync as W,rmSync as q,writeFileSync as z}from"node:fs";import{tmpdir as H}from"node:os";import{dirname as J,isAbsolute as K,join as B,resolve as V}from"node:path";import{chromium as Y}from"playwright-core";import{execSync as O}from"node:child_process";function M(o){let e=o;if(e&&typeof e.process=="function")try{let t=e.process();if(t&&typeof t.pid=="number"&&t.pid>0)return t.pid}catch{}if(e&&typeof e.browser=="function")try{let t=e.browser();if(t)return M(t)}catch{}return null}function x(o){let e=[];try{e=O(`pgrep -P ${o} || true`).toString().split(`
3
+ `).filter(Boolean)}catch{}for(let t of e)x(Number(t));try{process.kill(o,"SIGKILL")}catch{}}var C=new Set,I=!1;function j(){if(I)return;I=!0;let o=()=>{for(let e of C)x(e)};process.on("SIGTERM",()=>{o(),process.exit(0)}),process.on("SIGINT",()=>{o(),process.exit(0)}),process.on("exit",o)}async function U(o){let e=await o(),t=M(e),n=new Set;t!=null&&(n.add(t),C.add(t),j());let i=e;return typeof i.on=="function"&&i.on("disconnected",()=>{for(let c of n)C.delete(c)}),{browser:e,reapNow:()=>{for(let c of n)x(c),C.delete(c);n.clear()}}}var Q=`
4
4
  sootsim screenshots capture \u2014 headlessly capture + upload App Store slides
5
5
 
6
6
  usage:
@@ -29,13 +29,13 @@ options:
29
29
  examples:
30
30
  sootsim screenshots capture --org acme --repo my-app --dry-run
31
31
  sootsim screenshots capture --org acme --repo my-app --branch main --force
32
- `;function X(o){let e=a=>{let c=o.indexOf(a);return c>=0?o[c+1]:void 0},t=a=>o.includes(a),n=e("--slides"),i=n?n.split(",").map(a=>Number(a.trim())).filter(a=>Number.isInteger(a)&&a>0):null;return{org:e("--org")??"",repo:e("--repo")??"",branch:e("--branch")??"main",platform:e("--platform")??"ios",slides:i&&i.length?i:null,dryRun:t("--dry-run"),force:t("--force"),out:e("--out")??null,shellOrigin:e("--shell-origin")??null,apiOrigin:e("--api-origin")??null,timeoutMs:Number(e("--timeout")??"45000")||45e3,json:t("--json")}}function Z(){let o=I();if(o&&o.kind==="session")return{token:o.token,origin:o.origin};process.stderr.write(`
32
+ `;function X(o){let e=a=>{let c=o.indexOf(a);return c>=0?o[c+1]:void 0},t=a=>o.includes(a),n=e("--slides"),i=n?n.split(",").map(a=>Number(a.trim())).filter(a=>Number.isInteger(a)&&a>0):null;return{org:e("--org")??"",repo:e("--repo")??"",branch:e("--branch")??"main",platform:e("--platform")??"ios",slides:i&&i.length?i:null,dryRun:t("--dry-run"),force:t("--force"),out:e("--out")??null,shellOrigin:e("--shell-origin")??null,apiOrigin:e("--api-origin")??null,timeoutMs:Number(e("--timeout")??"45000")||45e3,json:t("--json")}}function Z(){let o=N();if(o&&o.kind==="session")return{token:o.token,origin:o.origin};process.stderr.write(`
33
33
  sootsim screenshots capture needs a logged-in session.
34
34
  run \`sootsim login\` first (the captured slides upload to that account).
35
35
 
36
- `),process.exit(1)}function _(o){let e=o.replace(/^\[|\]$/g,"").toLowerCase();return e==="localhost"||e.endsWith(".localhost")||e==="::1"||/^127(?:\.\d{1,3}){3}$/.test(e)}function ee(o){let e=new URL(o);if(_(e.hostname)){let n=(Number(e.port)||3e3)-3e3;if(n>=0&&n<=1e3)return e.port=String(5173+n),e.origin}return e.hostname==="sootbean.com"||e.hostname.endsWith(".sootbean.com")?"https://sootsim.com":o}function oe(){try{return Number(E("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function te(o,e,t,n){let i=await fetch(`${o}/api/sootsim/screenshot-decks?org=${encodeURIComponent(t)}&repo=${encodeURIComponent(n)}`,{headers:{authorization:`Bearer ${e}`}});if(!i.ok)return[];let a=await i.json().catch(()=>null),c=[];for(let m of a?.decks??[])Array.isArray(m.config?.frames)&&c.push(...m.config.frames);return c}async function re(o,e,t,n){let i=await fetch(`${o}/api/sootsim/screenshot-capture?ref=${encodeURIComponent(n)}&org=${encodeURIComponent(t)}`,{headers:{authorization:`Bearer ${e}`}});return i.ok?`data:image/png;base64,${Buffer.from(await i.arrayBuffer()).toString("base64")}`:null}async function ne(o,e){let t=Date.now()+e;for(;Date.now()<t;){for(let n of o.frames())if(await n.evaluate(()=>!!globalThis.SootSim?.bridges?.screenshotControl).catch(()=>!1))return n;await o.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 D(o){return o.evaluate(async()=>{let t=globalThis.SootSim?.bridges?.screenshotControl;if(!t)throw new Error("screenshotControl missing");return t.getState()})}async function se(o){await o.evaluate(async()=>{let e=globalThis.SootSim?.bridges?.settings,t=Date.now()+3e3;for(;Date.now()<t;){if(e?.get?.()?.screenshotMode)return;await new Promise(n=>setTimeout(n,50))}e&&!e.get().screenshotMode&&(e.set("screenshotMode",!0),e.get().showFrame||e.set("showFrame",!0))})}async function ie(o,e,t,n){await o.evaluate(async([i,a,c])=>{let m=globalThis.SootSim,h=m?.bridges?.screenshotControl;if(!h)throw new Error("screenshotControl missing");let w=b=>new Promise(d=>setTimeout(d,b));if(a){h.focusSlide(i);let b=Date.now()+3e4,d=m?.bridges?.threeMode;for(;Date.now()<b&&(d=m?.bridges?.threeMode,!(d?.setScreenImage&&d?.captureStage&&d?.getState?.()?.ready));)await w(150);await w(1e3);let l=a;d?.configure?.({colorway:l.colorway,background:l.background,...l.customGradient?{customGradient:l.customGradient}:{},room:!!l.room,bokeh:!!l.bokeh,environment:l.environmentActive?{pins:l.environmentPins??{},effects:l.environmentEffects??{}}:!1,pose:{phonePosition:l.phonePosition,phoneRotation:l.phoneRotation,cameraPosition:l.cameraPosition,target:l.target}}),await w(900),c&&d?.setScreenImage&&(d.setScreenImage(c),await w(1200))}await h.capture(i)},[e,t,n])}async function be(o){if(o.includes("--help")||o.includes("-h"))return console.log(Q),0;let e=X(o);if(!e.org||!e.repo)return process.stderr.write(` --org and --repo are required (see --help)
36
+ `),process.exit(1)}function _(o){let e=o.replace(/^\[|\]$/g,"").toLowerCase();return e==="localhost"||e.endsWith(".localhost")||e==="::1"||/^127(?:\.\d{1,3}){3}$/.test(e)}function ee(o){let e=new URL(o);if(_(e.hostname)){let n=(Number(e.port)||3e3)-3e3;if(n>=0&&n<=1e3)return e.port=String(5173+n),e.origin}return e.hostname==="sootbean.com"||e.hostname.endsWith(".sootbean.com")?"https://sootsim.com":o}function oe(){try{return Number(D("sysctl -n vm.loadavg").toString().trim().split(/\s+/)[1])||0}catch{return 0}}async function te(o,e,t,n){let i=await fetch(`${o}/api/sootsim/screenshot-decks?org=${encodeURIComponent(t)}&repo=${encodeURIComponent(n)}`,{headers:{authorization:`Bearer ${e}`}});if(!i.ok)return[];let a=await i.json().catch(()=>null),c=[];for(let m of a?.decks??[])Array.isArray(m.config?.frames)&&c.push(...m.config.frames);return c}async function re(o,e,t,n){let i=await fetch(`${o}/api/sootsim/screenshot-capture?ref=${encodeURIComponent(n)}&org=${encodeURIComponent(t)}`,{headers:{authorization:`Bearer ${e}`}});return i.ok?`data:image/png;base64,${Buffer.from(await i.arrayBuffer()).toString("base64")}`:null}async function ne(o,e){let t=Date.now()+e;for(;Date.now()<t;){for(let n of o.frames())if(await n.evaluate(()=>!!globalThis.SootSim?.bridges?.screenshotControl).catch(()=>!1))return n;await o.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 A(o){return o.evaluate(async()=>{let t=globalThis.SootSim?.bridges?.screenshotControl;if(!t)throw new Error("screenshotControl missing");return t.getState()})}async function se(o){await o.evaluate(async()=>{let e=globalThis.SootSim?.bridges?.settings,t=Date.now()+3e3;for(;Date.now()<t;){if(e?.get?.()?.screenshotMode)return;await new Promise(n=>setTimeout(n,50))}e&&!e.get().screenshotMode&&(e.set("screenshotMode",!0),e.get().showFrame||e.set("showFrame",!0))})}async function ie(o,e,t,n){await o.evaluate(async([i,a,c])=>{let m=globalThis.SootSim,h=m?.bridges?.screenshotControl;if(!h)throw new Error("screenshotControl missing");let w=b=>new Promise(d=>setTimeout(d,b));if(a){h.focusSlide(i);let b=Date.now()+3e4,d=m?.bridges?.threeMode;for(;Date.now()<b&&(d=m?.bridges?.threeMode,!(d?.setScreenImage&&d?.captureStage&&d?.getState?.()?.ready));)await w(150);await w(1e3);let l=a;d?.configure?.({colorway:l.colorway,background:l.background,...l.customGradient?{customGradient:l.customGradient}:{},room:!!l.room,bokeh:!!l.bokeh,environment:l.environmentActive?{pins:l.environmentPins??{},effects:l.environmentEffects??{}}:!1,pose:{phonePosition:l.phonePosition,phoneRotation:l.phoneRotation,cameraPosition:l.cameraPosition,target:l.target}}),await w(900),c&&d?.setScreenImage&&(d.setScreenImage(c),await w(1200))}await h.capture(i)},[e,t,n])}async function be(o){if(o.includes("--help")||o.includes("-h"))return console.log(Q),0;let e=X(o);if(!e.org||!e.repo)return process.stderr.write(` --org and --repo are required (see --help)
37
37
  `),1;let{token:t,origin:n}=Z(),i=(e.apiOrigin??n).replace(/\/$/,""),a=(e.shellOrigin??ee(i)).replace(/\/$/,""),c=await te(i,t,e.org,e.repo);if(!e.dryRun&&!e.force&&c.length>0)return process.stderr.write(` refusing to overwrite the existing ${e.org}/${e.repo} deck (${c.length} slide(s)). re-run with --force to replace it, or --dry-run to preview.
38
- `),1;let m=oe(),h=Number(E("sysctl -n hw.ncpu").toString().trim())||8;if(m>h)return process.stderr.write(` load average ${m.toFixed(1)} exceeds ${h} cores \u2014 tear down other work first.
39
- `),1;let w=`${a}/build/${encodeURIComponent(e.org)}/${encodeURIComponent(e.repo)}/${encodeURIComponent(e.branch)}?platform=${encodeURIComponent(e.platform)}&ssMode=1`,b=W(A(H(),"sootsim-capture-")),{browser:d,reapNow:l}=await U(()=>Y.launchPersistentContext(b,{headless:!0,channel:"chrome",viewport:{width:393,height:852},deviceScaleFactor:3,args:["--enable-unsafe-webgpu","--enable-features=Vulkan,WebGPU","--hide-scrollbars"]}));await d.addInitScript(s=>{try{localStorage.setItem("sootsim.session.token",s)}catch{}},t);let y=[],g=d.pages()[0]??await d.newPage();e.dryRun?await g.route(/\/api\/sootsim\/screenshot-(decks|capture)/,s=>s.request().method()==="PUT"?s.abort():s.continue()):g.on("response",s=>{let p=s.url();s.request().method()==="PUT"&&(p.includes("/api/sootsim/screenshot-decks")?y.push({kind:"deck",status:s.status()}):p.includes("/api/sootsim/screenshot-capture")&&y.push({kind:"capture",status:s.status()}))});let R=[];g.on("pageerror",s=>R.push(s.message));let G=g.waitForResponse(s=>s.url().includes("/api/sootsim/screenshot-decks")&&s.request().method()==="GET",{timeout:e.timeoutMs}).catch(()=>null);try{await g.goto(w,{waitUntil:"domcontentloaded",timeout:e.timeoutMs});let s=await ne(g,e.timeoutMs);await se(s),await G,await g.waitForTimeout(800);let p=await D(s);if(p.slides.length===0)return process.stderr.write(` the deck has no slides to capture \u2014 add slides in the composer first.
40
- `),1;let P=e.slides?p.slides.filter(r=>e.slides.includes(r.index)):p.slides;console.log(` ${p.projectName} on ${p.deviceModel} \u2014 capturing ${P.length}/${p.slides.length} slide(s)${e.dryRun?" (dry-run, no upload)":""}`);for(let r of P)try{let u=c[r.index-1],f=u?.threeScene??null,$=f&&u?.screenRef?await re(i,t,e.org,u.screenRef):null;await ie(s,r.index,f,$),console.log(` \u2713 slide ${r.index} "${r.title.slice(0,40)}"`)}catch(u){console.log(` \u2717 slide ${r.index} "${r.title.slice(0,40)}" \u2014 ${u.message}`)}e.dryRun||await g.waitForTimeout(2500);let S=(await D(s)).slides.filter(r=>P.some(u=>u.id===r.id)),v=[];if(e.out){let r=K(e.out)?e.out:V(process.cwd(),e.out);for(let u of S){if(!u.captureRef)continue;let f=await s.evaluate(async k=>{let T=globalThis.SootSim?.bridges?.screenshotControl;if(!T)throw new Error("screenshotControl missing");return T.exportSlide(k)},u.index),$=f.dataUrl.match(/^data:[^;]+;base64,(.+)$/);if($){let k=A(r,f.name);L(J(k),{recursive:!0}),z(k,Buffer.from($[1],"base64")),v.push(k)}}}let F=S.filter(r=>r.captureRef&&r.cleanRef),O={org:e.org,repo:e.repo,branch:e.branch,dryRun:e.dryRun,slides:S.map(r=>({index:r.index,title:r.title,captureRef:!!r.captureRef,cleanRef:!!r.cleanRef,screenRef:!!r.screenRef,captureMode:r.captureMode})),editableCount:F.length,uploads:e.dryRun?"skipped (dry-run)":y,written:v,pageErrors:R.slice(0,5)};if(e.json)console.log(JSON.stringify(O,null,2));else{console.log(`
38
+ `),1;let m=oe(),h=Number(D("sysctl -n hw.ncpu").toString().trim())||8;if(m>h)return process.stderr.write(` load average ${m.toFixed(1)} exceeds ${h} cores \u2014 tear down other work first.
39
+ `),1;let w=`${a}/build/${encodeURIComponent(e.org)}/${encodeURIComponent(e.repo)}/${encodeURIComponent(e.branch)}?platform=${encodeURIComponent(e.platform)}&ssMode=1`,b=W(B(H(),"sootsim-capture-")),{browser:d,reapNow:l}=await U(()=>Y.launchPersistentContext(b,{headless:!0,channel:"chrome",viewport:{width:393,height:852},deviceScaleFactor:3,args:["--enable-unsafe-webgpu","--enable-features=Vulkan,WebGPU","--hide-scrollbars"]}));await d.addInitScript(s=>{try{localStorage.setItem("sootsim.session.token",s)}catch{}},t);let y=[],g=d.pages()[0]??await d.newPage();e.dryRun?await g.route(/\/api\/sootsim\/screenshot-(decks|capture)/,s=>s.request().method()==="PUT"?s.abort():s.continue()):g.on("response",s=>{let p=s.url();s.request().method()==="PUT"&&(p.includes("/api/sootsim/screenshot-decks")?y.push({kind:"deck",status:s.status()}):p.includes("/api/sootsim/screenshot-capture")&&y.push({kind:"capture",status:s.status()}))});let R=[];g.on("pageerror",s=>R.push(s.message));let E=g.waitForResponse(s=>s.url().includes("/api/sootsim/screenshot-decks")&&s.request().method()==="GET",{timeout:e.timeoutMs}).catch(()=>null);try{await g.goto(w,{waitUntil:"domcontentloaded",timeout:e.timeoutMs});let s=await ne(g,e.timeoutMs);await se(s),await E,await g.waitForTimeout(800);let p=await A(s);if(p.slides.length===0)return process.stderr.write(` the deck has no slides to capture \u2014 add slides in the composer first.
40
+ `),1;let P=e.slides?p.slides.filter(r=>e.slides.includes(r.index)):p.slides;console.log(` ${p.projectName} on ${p.deviceModel} \u2014 capturing ${P.length}/${p.slides.length} slide(s)${e.dryRun?" (dry-run, no upload)":""}`);for(let r of P)try{let u=c[r.index-1],f=u?.threeScene??null,$=f&&u?.screenRef?await re(i,t,e.org,u.screenRef):null;await ie(s,r.index,f,$),console.log(` \u2713 slide ${r.index} "${r.title.slice(0,40)}"`)}catch(u){console.log(` \u2717 slide ${r.index} "${r.title.slice(0,40)}" \u2014 ${u.message}`)}e.dryRun||await g.waitForTimeout(2500);let S=(await A(s)).slides.filter(r=>P.some(u=>u.id===r.id)),v=[];if(e.out){let r=K(e.out)?e.out:V(process.cwd(),e.out);for(let u of S){if(!u.captureRef)continue;let f=await s.evaluate(async k=>{let T=globalThis.SootSim?.bridges?.screenshotControl;if(!T)throw new Error("screenshotControl missing");return T.exportSlide(k)},u.index),$=f.dataUrl.match(/^data:[^;]+;base64,(.+)$/);if($){let k=B(r,f.name);L(J(k),{recursive:!0}),z(k,Buffer.from($[1],"base64")),v.push(k)}}}let F=S.filter(r=>r.captureRef&&r.cleanRef),G={org:e.org,repo:e.repo,branch:e.branch,dryRun:e.dryRun,slides:S.map(r=>({index:r.index,title:r.title,captureRef:!!r.captureRef,cleanRef:!!r.cleanRef,screenRef:!!r.screenRef,captureMode:r.captureMode})),editableCount:F.length,uploads:e.dryRun?"skipped (dry-run)":y,written:v,pageErrors:R.slice(0,5)};if(e.json)console.log(JSON.stringify(G,null,2));else{console.log(`
41
41
  ${F.length}/${S.length} slide(s) now have editable layers (captureRef + cleanRef)`);let r=S.filter(u=>u.captureRef&&!u.cleanRef);if(r.length&&console.log(` \u26A0 ${r.length} slide(s) baked a flat capture only (no cleanRef) \u2014 typically 3d slides whose scene didn't restore for a re-bake.`),!e.dryRun){let u=y.filter(f=>f.status>=200&&f.status<300).length;console.log(` uploads: ${u}/${y.length} PUT(s) succeeded`)}v.length&&console.log(` wrote ${v.length} local PNG(s) to ${e.out}`),R.length&&console.log(` \u26A0 ${R.length} page error(s) during capture`)}return 0}finally{await d.close().catch(()=>{}),l(),q(b,{recursive:!0,force:!0})}}export{be as runScreenshotsCapture};