sootsim 0.1.305 → 0.1.306

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +10 -4
  2. package/dist-cli/bin.js +5 -5
  3. package/dist-cli/chunks/{agent-OJP4VF2K.js → agent-43LRLQBS.js} +2 -2
  4. package/dist-cli/chunks/{agent-wrapper-HMVFZKH3.js → agent-wrapper-QYKQDC2Y.js} +2 -2
  5. package/dist-cli/chunks/{app-fonts-INFYQMIN.js → app-fonts-IHE34DCY.js} +2 -2
  6. package/dist-cli/chunks/{assert-YSFBCP5P.js → assert-LAXNLFZ6.js} +2 -2
  7. package/dist-cli/chunks/{auth-M7RKDYQV.js → auth-CFTFPYKX.js} +2 -2
  8. package/dist-cli/chunks/{beta-4NRMM37T.js → beta-YPZFX3DF.js} +2 -2
  9. package/dist-cli/chunks/{camera-MHLM35MB.js → camera-FHHHH6GY.js} +2 -2
  10. package/dist-cli/chunks/{chunk-LOF3WUKB.js → chunk-2UC72ZR6.js} +1 -1
  11. package/dist-cli/chunks/{chunk-SLCYXISJ.js → chunk-3XUXMKKJ.js} +2 -2
  12. package/dist-cli/chunks/{chunk-R6MBDR56.js → chunk-4735ZG3S.js} +1 -1
  13. package/dist-cli/chunks/{chunk-AJCL7DHI.js → chunk-4KABOHME.js} +2 -2
  14. package/dist-cli/chunks/chunk-4MLH5CMV.js +125 -0
  15. package/dist-cli/chunks/chunk-4TN4CD7M.js +15 -0
  16. package/dist-cli/chunks/{chunk-H5D6E3DR.js → chunk-4XGRVAXA.js} +2 -2
  17. package/dist-cli/chunks/{chunk-R5TBMYGH.js → chunk-6PIGQNS4.js} +1 -1
  18. package/dist-cli/chunks/{chunk-BDNZULU7.js → chunk-6SBFFSXO.js} +2 -2
  19. package/dist-cli/chunks/chunk-6SIWYEK5.js +4 -0
  20. package/dist-cli/chunks/{chunk-54AINFEF.js → chunk-6WCW6PES.js} +2 -2
  21. package/dist-cli/chunks/{chunk-EWVEUNRO.js → chunk-74Z7ENQL.js} +81 -37
  22. package/dist-cli/chunks/{chunk-TRV5K6D2.js → chunk-7RZYUZEK.js} +1 -1
  23. package/dist-cli/chunks/{chunk-J653UMCU.js → chunk-7VVWOKJE.js} +2 -2
  24. package/dist-cli/chunks/chunk-B3CXF3EF.js +5 -0
  25. package/dist-cli/chunks/{chunk-6EXIYEOQ.js → chunk-BPNVJLGT.js} +2 -2
  26. package/dist-cli/chunks/{chunk-4Q42Y64Y.js → chunk-C6TKPNCZ.js} +2 -2
  27. package/dist-cli/chunks/{chunk-HMOYEM6V.js → chunk-CLN6VD2I.js} +2 -2
  28. package/dist-cli/chunks/{chunk-XI6CPN53.js → chunk-FXC6BYKX.js} +1 -1
  29. package/dist-cli/chunks/{chunk-UUKUKTV3.js → chunk-G73JPCHX.js} +11 -11
  30. package/dist-cli/chunks/{chunk-3PREBGTH.js → chunk-HMW7QKJV.js} +2 -2
  31. package/dist-cli/chunks/{chunk-IJ64Z77P.js → chunk-HPCKCWSQ.js} +2 -2
  32. package/dist-cli/chunks/{chunk-WQYUHDBU.js → chunk-HTR4DSA5.js} +2 -2
  33. package/dist-cli/chunks/{chunk-HHLH4TWF.js → chunk-IGKZOI2V.js} +1 -1
  34. package/dist-cli/chunks/{chunk-POIK3AHY.js → chunk-IXPUTLYO.js} +2 -2
  35. package/dist-cli/chunks/{chunk-2D7NF3XK.js → chunk-JPQSUHXW.js} +2 -2
  36. package/dist-cli/chunks/chunk-KNPXTXMI.js +4 -0
  37. package/dist-cli/chunks/{chunk-JQRRJIMT.js → chunk-LHCC656T.js} +1 -1
  38. package/dist-cli/chunks/{chunk-SWBTXTEO.js → chunk-LOXCEKKF.js} +2 -2
  39. package/dist-cli/chunks/{chunk-2UKSI3VX.js → chunk-MBF4LLVB.js} +1 -1
  40. package/dist-cli/chunks/{chunk-NNR3BU5O.js → chunk-MCGRZYAP.js} +7 -7
  41. package/dist-cli/chunks/chunk-NH2KYSY7.js +4 -0
  42. package/dist-cli/chunks/{chunk-KSZRLJPA.js → chunk-NOLQ4UEP.js} +2 -2
  43. package/dist-cli/chunks/chunk-NQ56D5JF.js +4 -0
  44. package/dist-cli/chunks/{chunk-KG2WUKD2.js → chunk-OYFRTYRJ.js} +2 -2
  45. package/dist-cli/chunks/{chunk-6YE25EJB.js → chunk-QHGQTHHD.js} +3 -3
  46. package/dist-cli/chunks/{chunk-HKPJYMJC.js → chunk-RYXC27XV.js} +15 -12
  47. package/dist-cli/chunks/{chunk-CWDEDUOZ.js → chunk-TCB56ABT.js} +1 -1
  48. package/dist-cli/chunks/{chunk-QVH276LI.js → chunk-TR4FKAKQ.js} +1 -1
  49. package/dist-cli/chunks/{chunk-JKIPNRAK.js → chunk-U6NDLMBM.js} +24 -25
  50. package/dist-cli/chunks/{chunk-VKBCGFOU.js → chunk-UAYFVJ7N.js} +2 -2
  51. package/dist-cli/chunks/{chunk-W3M4676V.js → chunk-UBLLWSSF.js} +3 -3
  52. package/dist-cli/chunks/{chunk-KVLXMWV5.js → chunk-UTE2W4WC.js} +2 -2
  53. package/dist-cli/chunks/{chunk-DTHOMSAA.js → chunk-UTHRVXG5.js} +2 -2
  54. package/dist-cli/chunks/{chunk-EPZG2F4I.js → chunk-V5PJXD2O.js} +1 -1
  55. package/dist-cli/chunks/{chunk-43SNLCXR.js → chunk-VLKENZFJ.js} +1 -1
  56. package/dist-cli/chunks/{chunk-EBCXFB3K.js → chunk-VTPICQDM.js} +1 -1
  57. package/dist-cli/chunks/{chunk-B65RMI7A.js → chunk-XZSXFV33.js} +1 -1
  58. package/dist-cli/chunks/chunk-YBO7SFWN.js +6 -0
  59. package/dist-cli/chunks/{chunk-DHDSGBZB.js → chunk-YVWYARHY.js} +1 -1
  60. package/dist-cli/chunks/{cleanup-ZJ7FQKED.js → cleanup-GYDCGNEJ.js} +2 -2
  61. package/dist-cli/chunks/{cli-version-5LGCFOAC.js → cli-version-3HG7ILRV.js} +2 -2
  62. package/dist-cli/chunks/{compat-EQACACVP.js → compat-GS3SVTB4.js} +2 -2
  63. package/dist-cli/chunks/{config-ADGNCDG5.js → config-W5LN7HWO.js} +2 -2
  64. package/dist-cli/chunks/control-BE55SA2W.js +4 -0
  65. package/dist-cli/chunks/daemon-3YMH272E.js +4 -0
  66. package/dist-cli/chunks/{debug-PU73W33T.js → debug-2BBR66MJ.js} +3 -3
  67. package/dist-cli/chunks/desktop-PPB66SZO.js +31 -0
  68. package/dist-cli/chunks/{detox-SHVVEPPX.js → detox-P7SDHLB4.js} +2 -2
  69. package/dist-cli/chunks/{device-NMRUACB4.js → device-JB4NSOZV.js} +2 -2
  70. package/dist-cli/chunks/{diagnose-S2AVGABT.js → diagnose-M662DIPM.js} +2 -2
  71. package/dist-cli/chunks/disk-cleanup-HN662P2U.js +4 -0
  72. package/dist-cli/chunks/drivers-ALHRJJGF.js +4 -0
  73. package/dist-cli/chunks/{film-UB7N4EKB.js → film-QZMDVCZI.js} +3 -3
  74. package/dist-cli/chunks/flow-BHSACBQ5.js +4 -0
  75. package/dist-cli/chunks/help-V2KS2AUT.js +4 -0
  76. package/dist-cli/chunks/{hidden-runtime-alias-M44SGZLM.js → hidden-runtime-alias-LJXH6WPY.js} +2 -2
  77. package/dist-cli/chunks/{home-paths-ZTEBHBUO.js → home-paths-TQ53NFW3.js} +2 -2
  78. package/dist-cli/chunks/inspect-6PW37GVK.js +4 -0
  79. package/dist-cli/chunks/install-desktop-VMVPZSXF.js +4 -0
  80. package/dist-cli/chunks/{login-YQ3HRPPS.js → login-7XXY5JP4.js} +4 -4
  81. package/dist-cli/chunks/{logout-XGBDWO4J.js → logout-UNARNKTJ.js} +2 -2
  82. package/dist-cli/chunks/{maestro-CESBE2SF.js → maestro-66RNLMLU.js} +3 -3
  83. package/dist-cli/chunks/{maestro-generate-4IHISKJL.js → maestro-generate-IO25AY3E.js} +3 -3
  84. package/dist-cli/chunks/{mode-BQGGZ737.js → mode-DPGASAG4.js} +2 -2
  85. package/dist-cli/chunks/optional-demo-registry-O5GGFNAI.js +4 -0
  86. package/dist-cli/chunks/{perf-TUR22UTE.js → perf-CBUP2ERS.js} +2 -2
  87. package/dist-cli/chunks/{permissions-POJIVSRV.js → permissions-3AOMCAT3.js} +2 -2
  88. package/dist-cli/chunks/{record-Q55SGXLU.js → record-Q7VRLH7A.js} +3 -3
  89. package/dist-cli/chunks/{report-issue-LRRX7VJV.js → report-issue-DTWZECYM.js} +2 -2
  90. package/dist-cli/chunks/runtime-VGYKLLTE.js +4 -0
  91. package/dist-cli/chunks/{screenshot-command-C7EU43J3.js → screenshot-command-SSWKZ4U3.js} +3 -3
  92. package/dist-cli/chunks/{screenshot-layers-NYVOJYUU.js → screenshot-layers-2ABSTF2O.js} +2 -2
  93. package/dist-cli/chunks/{screenshots-capture-AYKJKBLR.js → screenshots-capture-QA7T5DED.js} +2 -2
  94. package/dist-cli/chunks/{serve-EN3ZPJSA.js → serve-T4EQBJM6.js} +3 -3
  95. package/dist-cli/chunks/{setup-KKMKLJZE.js → setup-BXQI3YT4.js} +2 -2
  96. package/dist-cli/chunks/{skills-DR5DG2SK.js → skills-AYSO5FJB.js} +2 -2
  97. package/dist-cli/chunks/{storage-GMDBVTQ5.js → storage-KBHG5M5F.js} +2 -2
  98. package/dist-cli/chunks/store-GUNEQ4EC.js +4 -0
  99. package/dist-cli/chunks/telemetry-4VZ43AHH.js +4 -0
  100. package/dist-cli/chunks/{timeline-VY3444AZ.js → timeline-AB2R26RE.js} +2 -2
  101. package/dist-cli/chunks/{upgrade-EUYCW55F.js → upgrade-5XXQ7OCE.js} +2 -2
  102. package/dist-cli/chunks/upload-M55IQQHQ.js +4 -0
  103. package/dist-cli/chunks/{version-TEGM4WRU.js → version-PH3OUNPP.js} +2 -2
  104. package/dist-cli/chunks/{web-QF7LF4VB.js → web-XTOGNFZ7.js} +2 -2
  105. package/dist-cli/chunks/{what-happened-HDTJGNND.js → what-happened-JLI3NTEU.js} +2 -2
  106. package/dist-lib/agent-daemon-client.cjs +1 -1
  107. package/dist-lib/agent-events.cjs +1 -1
  108. package/dist-lib/agent-identity.cjs +1 -1
  109. package/dist-lib/agent-sessions.cjs +1 -1
  110. package/dist-lib/attached-projects.cjs +43 -21
  111. package/dist-lib/auth/shared-session.cjs +1 -1
  112. package/dist-lib/backend-origin.cjs +1 -1
  113. package/dist-lib/beta.cjs +1 -1
  114. package/dist-lib/beta.mjs +1 -1
  115. package/dist-lib/bridge-constants.cjs +8 -1
  116. package/dist-lib/cli-constants.cjs +1 -1
  117. package/dist-lib/config.cjs +1 -1
  118. package/dist-lib/detox/index.cjs +1 -1
  119. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  120. package/dist-lib/home-paths.cjs +1 -1
  121. package/dist-lib/host/bridge-host.cjs +222 -302
  122. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  123. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  124. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  125. package/dist-lib/host/websocket-proxy.cjs +1 -1
  126. package/dist-lib/index.cjs +1 -1
  127. package/dist-lib/jump-to-source-babel.cjs +1 -1
  128. package/dist-lib/menu.cjs +1 -1
  129. package/dist-lib/menu.mjs +1 -1
  130. package/dist-lib/metro.cjs +1 -1
  131. package/dist-lib/profiles.cjs +1 -1
  132. package/dist-lib/render-mode.cjs +1 -1
  133. package/dist-lib/scripts/dev-server-scanner.cjs +43 -13
  134. package/dist-lib/sdk.cjs +47 -10
  135. package/dist-lib/sdk.mjs +47 -10
  136. package/dist-lib/skills.cjs +5708 -1217
  137. package/dist-lib/vite.cjs +1 -1
  138. package/package.json +1 -1
  139. package/scripts/dev-server-scanner.ts +9 -15
  140. package/scripts/optional-demo-registry.ts +52 -10
  141. package/skills/sootsim-debug/SKILL.md +4 -5
  142. package/skills/sootsim-setup/SKILL.md +29 -49
  143. package/src/bridge-constants.ts +15 -0
  144. package/src/host/bridge-host.ts +0 -16
  145. package/src/host/open-url.ts +2 -147
  146. package/src/plist.ts +27 -0
  147. package/src/settings-bundle.ts +2 -23
  148. package/src/skills/builtin/maestro-test.ts +4 -1
  149. package/src/vite-plugin.ts +2 -1
  150. package/dist-cli/chunks/chunk-COD6QGS2.js +0 -125
  151. package/dist-cli/chunks/chunk-KVOY4Z2X.js +0 -4
  152. package/dist-cli/chunks/chunk-OCRL2VU4.js +0 -4
  153. package/dist-cli/chunks/chunk-PELXRGDN.js +0 -4
  154. package/dist-cli/chunks/chunk-QJUKXBH5.js +0 -15
  155. package/dist-cli/chunks/chunk-WIRBJTTU.js +0 -7
  156. package/dist-cli/chunks/chunk-XWMTLVCE.js +0 -4
  157. package/dist-cli/chunks/chunk-ZRQFYMTL.js +0 -4
  158. package/dist-cli/chunks/control-Y3E5IIMO.js +0 -4
  159. package/dist-cli/chunks/daemon-A6CWUYMR.js +0 -4
  160. package/dist-cli/chunks/desktop-V675PYF4.js +0 -34
  161. package/dist-cli/chunks/disk-cleanup-EJEZIIT4.js +0 -4
  162. package/dist-cli/chunks/drivers-PM4PVYHY.js +0 -4
  163. package/dist-cli/chunks/flow-XJRNL25V.js +0 -4
  164. package/dist-cli/chunks/help-2ZJHCVUZ.js +0 -4
  165. package/dist-cli/chunks/inspect-L76RUF62.js +0 -4
  166. package/dist-cli/chunks/install-desktop-UIXKNXKF.js +0 -4
  167. package/dist-cli/chunks/optional-demo-registry-LWYRXVIE.js +0 -4
  168. package/dist-cli/chunks/runtime-NHDHZJJN.js +0 -4
  169. package/dist-cli/chunks/store-QZEMKQDC.js +0 -4
  170. package/dist-cli/chunks/telemetry-TNX72J2B.js +0 -4
  171. package/dist-cli/chunks/upload-D43U7RGT.js +0 -4
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as ne,b as se,f as ie}from"./chunk-JKIPNRAK.js";import"./chunk-2D7NF3XK.js";import{a as v}from"./chunk-QVH276LI.js";import"./chunk-EWVEUNRO.js";import{a as te}from"./chunk-BDNZULU7.js";import{a as ee}from"./chunk-B65RMI7A.js";import"./chunk-KSZRLJPA.js";import{a as oe,b as re}from"./chunk-WQYUHDBU.js";import"./chunk-QJUKXBH5.js";import"./chunk-H5D6E3DR.js";import"./chunk-EPZG2F4I.js";import"./chunk-IJ64Z77P.js";import{r as K,s as X}from"./chunk-R6MBDR56.js";import"./chunk-HKPJYMJC.js";import"./chunk-43SNLCXR.js";import"./chunk-PELXRGDN.js";import"./chunk-UUKUKTV3.js";import"./chunk-ZRQFYMTL.js";import"./chunk-DTHOMSAA.js";import"./chunk-XWMTLVCE.js";import"./chunk-VKBCGFOU.js";import"./chunk-TRV5K6D2.js";import{h as R,i as J,j as B,k as Z,l as Q,m as M,n as $}from"./chunk-NNR3BU5O.js";import"./chunk-R5TBMYGH.js";import"./chunk-3PREBGTH.js";import"./chunk-KVLXMWV5.js";import"./chunk-XI6CPN53.js";import"./chunk-SWBTXTEO.js";import"./chunk-POIK3AHY.js";import"./chunk-KG2WUKD2.js";import{b as F,e as P,f as j,g as I,h as L,i as U,j as A}from"./chunk-6EXIYEOQ.js";import"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import"./chunk-COD6QGS2.js";import"./chunk-EBCXFB3K.js";import"./chunk-LOF3WUKB.js";import{mkdirSync as ce,writeFileSync as ae}from"fs";import{dirname as ue,resolve as de}from"path";async function pe(e,t){let o=Le(e);(o.includes("--help")||o.includes("-h"))&&(console.log(`
4
+ import{a as ne,b as se,f as ie}from"./chunk-U6NDLMBM.js";import"./chunk-JPQSUHXW.js";import{a as v}from"./chunk-TR4FKAKQ.js";import"./chunk-74Z7ENQL.js";import"./chunk-KNPXTXMI.js";import{a as te}from"./chunk-6SBFFSXO.js";import{a as ee}from"./chunk-XZSXFV33.js";import"./chunk-NOLQ4UEP.js";import{a as oe,b as re}from"./chunk-HTR4DSA5.js";import"./chunk-4TN4CD7M.js";import"./chunk-4XGRVAXA.js";import"./chunk-V5PJXD2O.js";import"./chunk-HPCKCWSQ.js";import{r as K,s as X}from"./chunk-4735ZG3S.js";import"./chunk-RYXC27XV.js";import"./chunk-VLKENZFJ.js";import"./chunk-6SIWYEK5.js";import"./chunk-G73JPCHX.js";import"./chunk-UTHRVXG5.js";import"./chunk-NQ56D5JF.js";import"./chunk-UAYFVJ7N.js";import"./chunk-7RZYUZEK.js";import{h as R,i as J,j as B,k as Z,l as Q,m as M,n as $}from"./chunk-MCGRZYAP.js";import"./chunk-6PIGQNS4.js";import"./chunk-HMW7QKJV.js";import"./chunk-UTE2W4WC.js";import"./chunk-FXC6BYKX.js";import"./chunk-LOXCEKKF.js";import"./chunk-IXPUTLYO.js";import"./chunk-OYFRTYRJ.js";import{b as F,e as P,f as j,g as I,h as L,i as U,j as A}from"./chunk-BPNVJLGT.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-4MLH5CMV.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";import{mkdirSync as ce,writeFileSync as ae}from"fs";import{dirname as ue,resolve as de}from"path";async function pe(e,t){let o=Le(e);(o.includes("--help")||o.includes("-h"))&&(console.log(`
5
5
  sootsim screenshot \u2014 capture the canvas as a PNG
6
6
 
7
7
  usage:
@@ -156,4 +156,4 @@ examples:
156
156
  await new Promise((r) => setTimeout(r, 40))
157
157
  }
158
158
  return false
159
- })()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function yt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let o=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",r=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${r} [${o}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function bt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:o,values:i,json:r}=ft(e),s=R(o,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{r?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: sootsim screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: sootsim screenshot slides remove <n>");u(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: sootsim screenshot slides move <n> <position>");u(await $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: sootsim screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}r&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see sootsim screenshot slides --help`)}}finally{c.close()}}var St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Ae(e){for(let t=0;t<e.length;t++){let o=e[t];if(o.startsWith("-")){St.has(o)&&t++;continue}return xt.has(o)?{name:o,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(e){let t=[];for(let o=0;o<e.length;o++){if(e[o]==="--sim"){o++;continue}t.push(e[o])}return t}async function Po(e,t){let o=Ae(e);if(!o||o.name==="capture"){await pe(o?E(e,o.index):e,t);return}if(o.name==="slides"){await Fe(E(e,o.index),t);return}if(o.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-NYVOJYUU.js");await s(E(e,o.index),t);return}let i=E(e,o.index),r=Ae(i);if(r?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-AYKJKBLR.js");return await s(Pt(E(i,r.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the sootsim workspace (playwright is not shipped with the published CLI)."),1;throw s}return Ne(i,t)}export{Po as runScreenshotCommand};
159
+ })()`,{acquireLock:!0}))throw new Error("could not enable screenshot mode \u2014 is this a browser sim with the screenshot plugin? (electron has no screenshot mode)")}function yt(e){console.log(` ${e.projectName} \u2014 canvas ${e.canvas} (${e.exportSize.width}\xD7${e.exportSize.height}), device ${e.deviceModel}`);for(let t of e.slides){let o=[t.focused?"focused":t.active?"active":null,t.captured?`captured${t.captureMode==="3d"?" 3d":""}`:"no capture"].filter(Boolean).join(", "),i=t.title?`"${t.title}"`:"(no title)",r=[`bg ${t.bgTop}\u2192${t.bgBottom}`,t.titleColor?`color ${t.titleColor}`:null,t.titleSize?`size ${t.titleSize}`:null,t.titleUnderlay?`underlay ${t.titleUnderlay}`:null,t.titleShadow?`shadow ${t.titleShadow}`:null].filter(Boolean).join(", ");console.log(` ${t.index}. ${i} \u2014 ${r} [${o}]`),t.subtitle&&console.log(` ${t.subtitle}`)}}function bt(e){let t=e.match(/^data:[^;]+;base64,(.+)$/);if(!t)throw new Error("export returned an unexpected payload");return Buffer.from(t[1],"base64")}async function Fe(e,t){if(e.includes("--help")||e.includes("-h")){console.log(mt);return}let{rest:o,values:i,json:r}=ft(e),s=R(o,{port:t.port,commandTimeoutMs:45e3}),n=s.positional[0]??"list",a=gt(s.positional[1]),l=Number(s.positional[2]),c=B(s),u=d=>{r?console.log(JSON.stringify(d,null,2)):yt(d)};try{switch(await wt(c),n){case"list":{u(await M(c,"SootSim.bridges.screenshotControl.getState"));break}case"set":{if(a==null)throw new Error("usage: sootsim screenshot slides set <n> --title \u2026 (see --help)");let d={};for(let m of["title","subtitle","bgTop","bgBottom","titleColor","titleSize","titleUnderlay","titleShadow"])i[m]!=null&&(d[m]=i[m]);if(Object.keys(d).length===0)throw new Error("nothing to set \u2014 pass at least one field (see --help)");u(await $(c,"SootSim.bridges.screenshotControl.setSlide",a,d));break}case"add":{u(await $(c,"SootSim.bridges.screenshotControl.addSlide"));break}case"remove":{if(a==null)throw new Error("usage: sootsim screenshot slides remove <n>");u(await $(c,"SootSim.bridges.screenshotControl.removeSlide",a));break}case"move":{if(a==null||!Number.isInteger(l)||l<1)throw new Error("usage: sootsim screenshot slides move <n> <position>");u(await $(c,"SootSim.bridges.screenshotControl.moveSlide",a,l));break}case"focus":{if(a==null)throw new Error("usage: sootsim screenshot slides focus <n>");u(await $(c,"SootSim.bridges.screenshotControl.focusSlide",a));break}case"overview":{u(await $(c,"SootSim.bridges.screenshotControl.overview"));break}case"capture":{let d=await $(c,"SootSim.bridges.screenshotControl.capture",...a!=null?[a]:[]);u(d);break}case"export":{let d=i.out?dt(i.out)?i.out:pt(process.cwd(),i.out):Ee(process.cwd(),"screenshots"),m=await M(c,"SootSim.bridges.screenshotControl.getState"),h=a!=null?m.slides.filter(p=>p.index===a||p.id===a):m.slides.filter(p=>p.captured);if(h.length===0)throw new Error(a!=null?`no slide ${a}`:"no captured slides to export \u2014 capture first");let w=[];for(let p of h){let y=await M(c,"SootSim.bridges.screenshotControl.exportSlide",p.index),f=Ee(d,y.name);lt(ut(f),{recursive:!0}),ct(f,bt(y.dataUrl)),w.push(f),console.log(` saved: ${f} (${y.width}\xD7${y.height})`)}r&&console.log(JSON.stringify({written:w},null,2));break}default:throw new Error(`unknown subcommand "${n}" \u2014 see sootsim screenshot slides --help`)}}finally{c.close()}}var St=new Set(["--sim","--port","-p","--output","-o","--out","--plan","--app","--device","--org","--repo","--api-origin","--branch","--platform","--slides","--shell-origin","--timeout","--ids","--out-dir"]),xt=new Set(["capture","slides","appstore","layers"]);function Ae(e){for(let t=0;t<e.length;t++){let o=e[t];if(o.startsWith("-")){St.has(o)&&t++;continue}return xt.has(o)?{name:o,index:t}:null}return null}function E(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function Pt(e){let t=[];for(let o=0;o<e.length;o++){if(e[o]==="--sim"){o++;continue}t.push(e[o])}return t}async function Po(e,t){let o=Ae(e);if(!o||o.name==="capture"){await pe(o?E(e,o.index):e,t);return}if(o.name==="slides"){await Fe(E(e,o.index),t);return}if(o.name==="layers"){let{runScreenshotLayers:s}=await import("./screenshot-layers-2ABSTF2O.js");await s(E(e,o.index),t);return}let i=E(e,o.index),r=Ae(i);if(r?.name==="capture")try{let{runScreenshotsCapture:s}=await import("./screenshots-capture-QA7T5DED.js");return await s(Pt(E(i,r.index)))}catch(s){if(s instanceof Error&&"code"in s&&s.code==="ERR_MODULE_NOT_FOUND")return console.error("screenshot appstore capture is repo-only tooling \u2014 it needs the sootsim workspace (playwright is not shipped with the published CLI)."),1;throw s}return Ne(i,t)}export{Po as runScreenshotCommand};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as S}from"./chunk-B65RMI7A.js";import"./chunk-EPZG2F4I.js";import{r as y,s as v}from"./chunk-R6MBDR56.js";import"./chunk-DTHOMSAA.js";import{h as w,j as b,m as I}from"./chunk-NNR3BU5O.js";import"./chunk-KG2WUKD2.js";import{b as m}from"./chunk-6EXIYEOQ.js";import"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import"./chunk-EBCXFB3K.js";import"./chunk-LOF3WUKB.js";import{mkdirSync as B,writeFileSync as R}from"fs";import{resolve as f}from"path";async function L(s,$){(s.includes("--help")||s.includes("-h"))&&(console.log(`
4
+ import{a as S}from"./chunk-XZSXFV33.js";import"./chunk-V5PJXD2O.js";import{r as y,s as v}from"./chunk-4735ZG3S.js";import"./chunk-UTHRVXG5.js";import{h as w,j as b,m as I}from"./chunk-MCGRZYAP.js";import"./chunk-OYFRTYRJ.js";import{b as m}from"./chunk-BPNVJLGT.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";import{mkdirSync as B,writeFileSync as R}from"fs";import{resolve as f}from"path";async function L(s,$){(s.includes("--help")||s.includes("-h"))&&(console.log(`
5
5
  sootsim screenshot layers \u2014 export a screen as engine-isolated layers
6
6
 
7
7
  usage:
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as M}from"./chunk-QVH276LI.js";import{a as x}from"./chunk-WQYUHDBU.js";import"./chunk-KVLXMWV5.js";import"./chunk-EBCXFB3K.js";import"./chunk-LOF3WUKB.js";import{execSync as T}from"node:child_process";import{mkdirSync as D,mkdtempSync as O,rmSync as E,writeFileSync as j}from"node:fs";import{tmpdir as G}from"node:os";import{dirname as q,isAbsolute as B,join as U,resolve as L}from"node:path";import{chromium as W}from"playwright-core";var z=`
4
+ import{b as M}from"./chunk-TR4FKAKQ.js";import{a as x}from"./chunk-HTR4DSA5.js";import"./chunk-UTE2W4WC.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";import{execSync as T}from"node:child_process";import{mkdirSync as D,mkdtempSync as O,rmSync as E,writeFileSync as j}from"node:fs";import{tmpdir as G}from"node:os";import{dirname as q,isAbsolute as B,join as U,resolve as L}from"node:path";import{chromium as W}from"playwright-core";var z=`
5
5
  sootsim screenshot appstore capture \u2014 headlessly capture + upload App Store slides
6
6
 
7
7
  usage:
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as ge,c as J,d as Se,e as K,f as ye,h as ve,i as E,j as be,k as we,l as Ae,m as ke,q as Te,t as k,u as Ce,v as Ie,w as Ee,x as Pe}from"./chunk-54AINFEF.js";import"./chunk-HHLH4TWF.js";import{e as fe}from"./chunk-KSZRLJPA.js";import"./chunk-WQYUHDBU.js";import{a as ue,b as pe,d as L,e as me}from"./chunk-H5D6E3DR.js";import"./chunk-PELXRGDN.js";import{g as _}from"./chunk-UUKUKTV3.js";import{d as he}from"./chunk-ZRQFYMTL.js";import"./chunk-XWMTLVCE.js";import"./chunk-TRV5K6D2.js";import"./chunk-NNR3BU5O.js";import{a as F,b as G,c as oe,d as ae}from"./chunk-3PREBGTH.js";import"./chunk-KVLXMWV5.js";import{f as x}from"./chunk-SWBTXTEO.js";import{b as de,c as le}from"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import{E as Y,G as O,H as j,I as Z,J as Q,K as ee,M as te,P as ie,Q as re,R as ne,S as $,T as se,g as q,h as z,y as W,z as X}from"./chunk-EBCXFB3K.js";import{a as ce}from"./chunk-CWDEDUOZ.js";import"./chunk-LOF3WUKB.js";import{spawn as gt}from"child_process";import C from"fs";import{createServer as St}from"http";import w from"path";import{WebSocket as g,WebSocketServer as yt}from"ws";import Oe from"node:fs";import B from"node:path";import{spawn as Je}from"node:child_process";function Ke(o){return typeof o.text=="string"?o.text.trim():""}function Ve(o){let e=o?.trim();return e||"tm"}async function Re(o){let e=o.sessionId.trim();if(!G(e))throw new Error(`invalid Team Machine session id: ${e||"<empty>"}`);let t=Ke(o.prompt);if(!t)throw new Error("prompt text is empty");let i=Ve(o.command),s=o.timeoutMs??15e3;await new Promise((n,c)=>{let r=Je(i,["send",e,t],{stdio:["ignore","ignore","pipe"],env:process.env}),a="",l=setTimeout(()=>{try{r.kill("SIGTERM")}catch{}c(new Error(`tm send timed out after ${Math.round(s/1e3)}s`))},s);r.stderr?.setEncoding("utf8"),r.stderr?.on("data",d=>{a.length<4e3&&(a+=String(d))}),r.on("error",d=>{clearTimeout(l),c(d)}),r.on("exit",(d,p)=>{if(clearTimeout(l),d===0){n();return}let u=a.trim();c(new Error(u||`tm send exited with ${p?`signal ${p}`:`code ${d??"unknown"}`}`))})})}var M=1,Ge=25;function qe(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_R2||9500)].filter(o=>Number.isFinite(o)&&o>0)}var D=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;pendingSessionStates=new Map;pendingSessionPatches=new Map;sessionStatusPersistTimer=null;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 k?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 ke()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
4
+ import{b as ge,c as J,d as Se,e as K,f as ye,h as ve,i as E,j as be,k as we,l as Ae,m as ke,q as Te,t as k,u as Ce,v as Ie,w as Ee,x as Pe}from"./chunk-6WCW6PES.js";import"./chunk-IGKZOI2V.js";import{e as fe}from"./chunk-NOLQ4UEP.js";import"./chunk-HTR4DSA5.js";import{a as ue,b as pe,d as L,e as me}from"./chunk-4XGRVAXA.js";import{d as he}from"./chunk-6SIWYEK5.js";import{g as _}from"./chunk-G73JPCHX.js";import"./chunk-NQ56D5JF.js";import"./chunk-7RZYUZEK.js";import"./chunk-MCGRZYAP.js";import{a as F,b as G,c as oe,d as ae}from"./chunk-HMW7QKJV.js";import"./chunk-UTE2W4WC.js";import{f as x}from"./chunk-LOXCEKKF.js";import{c as de,d as le}from"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import{E as Y,G as O,H as j,I as Z,J as Q,K as ee,M as te,P as ie,Q as re,R as ne,S as $,T as se,g as q,h as z,y as W,z as X}from"./chunk-VTPICQDM.js";import{a as ce}from"./chunk-TCB56ABT.js";import"./chunk-2UC72ZR6.js";import{spawn as gt}from"child_process";import C from"fs";import{createServer as St}from"http";import w from"path";import{WebSocket as g,WebSocketServer as yt}from"ws";import Oe from"node:fs";import B from"node:path";import{spawn as Je}from"node:child_process";function Ke(o){return typeof o.text=="string"?o.text.trim():""}function Ve(o){let e=o?.trim();return e||"tm"}async function Re(o){let e=o.sessionId.trim();if(!G(e))throw new Error(`invalid Team Machine session id: ${e||"<empty>"}`);let t=Ke(o.prompt);if(!t)throw new Error("prompt text is empty");let i=Ve(o.command),s=o.timeoutMs??15e3;await new Promise((n,c)=>{let r=Je(i,["send",e,t],{stdio:["ignore","ignore","pipe"],env:process.env}),a="",l=setTimeout(()=>{try{r.kill("SIGTERM")}catch{}c(new Error(`tm send timed out after ${Math.round(s/1e3)}s`))},s);r.stderr?.setEncoding("utf8"),r.stderr?.on("data",d=>{a.length<4e3&&(a+=String(d))}),r.on("error",d=>{clearTimeout(l),c(d)}),r.on("exit",(d,p)=>{if(clearTimeout(l),d===0){n();return}let u=a.trim();c(new Error(u||`tm send exited with ${p?`signal ${p}`:`code ${d??"unknown"}`}`))})})}var M=1,Ge=25;function qe(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_R2||9500)].filter(o=>Number.isFinite(o)&&o>0)}var D=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;pendingSessionStates=new Map;pendingSessionPatches=new Map;sessionStatusPersistTimer=null;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 k?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 ke()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
5
5
  `)}}close(){this.sessionStatusPersistTimer&&(clearTimeout(this.sessionStatusPersistTimer),this.sessionStatusPersistTimer=null),this.flushSessionStatuses();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 K();case"agent:upsert-project":return J(i.input??{});case"agent:delete-project":return ve(String(i.projectId)),{ok:!0};case"agent:auto-attach-for-url":return this.autoAttachForUrl(i.input??{});case"agent:list-sessions":return be(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),c=E(n);if(!c)throw new k("NO_SESSION",`no session: ${n}`);let r=this.normalizePromptEnvelope(i);return await Ie(n,r),this.notePromptAccepted(n,r,c.status==="working")}case"agent:end-session":this.dropSessionFanout(String(i.sessionId)),await Ee(String(i.sessionId));let s=E(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 k("UNKNOWN_AGENT_MSG",`unknown agent message: ${t}`)}}async sendClaimedPrompt(e){let t=typeof e.simId=="string"?e.simId.trim():"";if(!t)throw new k("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 k("NO_CLAIM",`sim ${t} has no active CLI claim`);let s=F(i.cliIdentityKey);if(!s)throw new k("UNSUPPORTED_CLAIM",`sim ${t} is claimed by a CLI identity that is not promptable`);return await Re({sessionId:s,prompt:this.normalizePromptEnvelope(e)}),{ok:!0,routed:"team-machine",sessionId:s}}async doStartSession(e){if(!Se(e.projectId))throw new k("NO_PROJECT",`no project: ${e.projectId}`);let i=await Ce(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?.()??qe(),c=(await _({excludePorts:s})).find(d=>String(d.port)===i);if(!c||!c.cwd)return{project:null};let r=K().find(d=>d.cwd===c.cwd)??null,a=Array.from(new Set([...r?.knownBundleUrls??[],c.bundleUrl,t]));return{project:J({cwd:c.cwd,name:c.projectName??B.basename(c.cwd),preferredProvider:e.provider??r?.preferredProvider,sourceRoots:r?.sourceRoots??[c.cwd],knownBundleUrls:a,framework:r?.framework??ze(c.framework),bundleId:c.bundleId??r?.bundleId})}}getTranscript(e){let t=Te(e);return Oe.existsSync(t)?Oe.readFileSync(t,"utf8"):{error:"transcript not found",code:"NO_TRANSCRIPT"}}getPaths(){let e=ge();return{userDataDir:e,storeFile:B.join(e,"attached-projects.json"),sessionsDir:B.join(e,"sessions"),transcriptsDir:B.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=Pe(t,c=>{let r=this.coalescePromptEcho(t,c);if(r&&(this.applySessionEvent(t,r),this.fanOutEvent(t,r)),c.type==="turn-completed"){let a=E(t);if(a)try{ye(a.projectId,{usd:c.costUsd,ts:c.ts})}catch(l){process.stderr.write(`[sootsim-agent] recordTurnTelemetry failed: ${l instanceof Error?l.message:String(l)}
6
6
  `)}}});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 c=Math.max(this.pendingTurns.get(e)??0,i?1:0)+1;this.pendingTurns.set(e,c);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:c>1,pendingTurns:c,queueDepth:Math.max(0,c-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){let i=this.pendingSessionStates.get(e)??E(e);if(!i)return;let s=we(i,t);this.pendingSessionStates.set(e,s),this.pendingSessionPatches.set(e,{...this.pendingSessionPatches.get(e),...t}),this.broadcastSessionStatus(s),!this.sessionStatusPersistTimer&&(this.sessionStatusPersistTimer=setTimeout(()=>{this.sessionStatusPersistTimer=null,this.flushSessionStatuses()},Ge))}flushSessionStatuses(){if(this.pendingSessionPatches.size===0)return;let e=this.pendingSessionStates,t=this.pendingSessionPatches;this.pendingSessionStates=new Map,this.pendingSessionPatches=new Map;try{Ae([...t].map(([i,s])=>({id:i,patch:s})))}catch(i){for(let[s,n]of e)this.pendingSessionStates.has(s)||this.pendingSessionStates.set(s,n);for(let[s,n]of t)this.pendingSessionPatches.set(s,{...n,...this.pendingSessionPatches.get(s)});process.stderr.write(`[sootsim-agent] session status persistence failed: ${i instanceof Error?i.message:String(i)}
7
7
  `)}}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===M)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===M)try{i.send(t)}catch{}}respond(e,t,i){if(e.readyState===M)try{e.send(JSON.stringify({id:t,result:i}))}catch{}}respondError(e,t,i,s){if(e.readyState===M)try{e.send(JSON.stringify({id:t,error:i,...s?{code:s}:{}}))}catch{}}};function ze(o){return o==="expo"?"expo":o==="one"||o==="vxrn"?"one":"unknown"}import _e from"http";import Le from"https";import{finished as Ze,pipeline as Qe}from"stream/promises";var V="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",Xe=[{hostSuffix:"uniswap.org",headers:{origin:"https://app.uniswap.org",referer:"https://app.uniswap.org/"},suppressBrowserUserAgent:!0}];function Ye(o){let e=o.toLowerCase();for(let t of Xe)if(e===t.hostSuffix||e.endsWith(`.${t.hostSuffix}`))return t}function xe(o){let e=Ye(o.hostname);return{"accept-encoding":"identity",...e?.suppressBrowserUserAgent?{}:{"user-agent":V},...e?.headers}}var et=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"]),tt={"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"},it=new Set(["host","origin","referer","sec-fetch-site","sec-fetch-mode","sec-fetch-dest"]);function Be(o){return o.protocol!=="https:"?{}:ue(o.hostname)?{rejectUnauthorized:!1}:{}}function P(o){for(let[e,t]of Object.entries(tt))o.setHeader(e,t)}function rt(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 nt(o,e){let t={};for(let[i,s]of Object.entries(o))s&&(et.has(i.toLowerCase())||(t[i]=Array.isArray(s)?s.join(", "):s));return Object.assign(t,e?xe(e):{"user-agent":V}),t}function st(o,e){let t={};for(let[i,s]of Object.entries(o))s&&(it.has(i.toLowerCase())||(t[i]=s));return t.host=e.host,t.origin=e.origin,t.referer=`${e.origin}/`,t}function Me(o){return o?.startsWith("/__fetch-proxy?")||o?.startsWith("/__proxy?")||!1}function De(o){return o?!!(o.startsWith("/__app-api?")||o.startsWith("/__app-api/")):!1}async function Ne(o,e){if(o.method==="OPTIONS"){P(e),e.writeHead(204),e.end();return}let i=new URLSearchParams((o.url||"").split("?")[1]||"").get("url");if(!i){P(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("missing url param");return}let s;try{s=new URL(i)}catch{P(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("invalid url param");return}let n;if(o.method!=="GET"&&o.method!=="HEAD"){let a=[];for await(let l of o)a.push(Buffer.isBuffer(l)?l:Buffer.from(l));a.length>0&&(n=Buffer.concat(a))}let c=o.method||"GET",r=async(a,l,d,p)=>{let u=a.protocol==="https:"?Le:_e,h=nt(o.headers,a);a.origin!==s.origin&&(delete h.authorization,delete h["proxy-authorization"]),l==="GET"||l==="HEAD"?(delete h["content-length"],delete h["content-type"]):d&&(h["content-length"]=String(d.byteLength));let m=await new Promise((b,v)=>{let y=u.request({hostname:a.hostname,port:a.port||(a.protocol==="https:"?443:80),path:a.pathname+a.search,method:l,headers:h,...Be(a)},b),R=()=>y.destroy(new Error("fetch proxy client disconnected"));o.once("aborted",R),y.once("close",()=>o.off("aborted",R)),y.once("error",v),d===void 0?y.end():y.end(d)}),f=m.statusCode??502,S=m.headers.location;if(S&&(f===301||f===302||f===303||f===307||f===308)){if(p>=10)throw m.destroy(),new Error("too many redirects");let b=(f===301||f===302)&&l==="POST"||f===303&&l!=="GET"&&l!=="HEAD",v=new URL(S,a);m.resume(),await Ze(m),await r(v,b?"GET":l,b?void 0:d,p+1);return}for(let[b,v]of Object.entries(m.headers)){let y=b.toLowerCase();v===void 0||y==="set-cookie"||y==="connection"||y==="keep-alive"||y==="proxy-authenticate"||y==="proxy-authorization"||y==="te"||y==="trailer"||y==="transfer-encoding"||y==="upgrade"||y.startsWith("access-control-")||e.setHeader(b,v)}P(e);let A=m.headers["set-cookie"]??[];A.length>0&&e.setHeader("x-sootsim-set-cookie",(Array.isArray(A)?A:[A]).join(", ")),e.statusCode=f,await Qe(m,e)};try{await r(s,c,n,0)}catch(a){if(e.headersSent){e.destroy(a instanceof Error?a:new Error(String(a)));return}P(e),e.writeHead(502,{"Content-Type":"text/plain"}),e.end(`fetch proxy error: ${rt(s.href,a)}`)}}function He(o,e){let t=o.url||"",i="",s="";if(t.startsWith("/__app-api?")){let l=new URL(t,"http://sootsim.local");i=l.searchParams.get("path")||"",s=l.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 c=n.protocol==="https:"?Le:_e,r=st(o.headers,n),a=c.request({hostname:n.hostname,port:n.port||(n.protocol==="https:"?443:80),path:n.pathname+n.search,method:o.method,headers:r,...Be(n)},l=>{let d=Object.keys(l.headers).filter(p=>{let u=p.toLowerCase();return!u.startsWith("access-control-")&&u!=="set-cookie"}).join(", ");e.writeHead(l.statusCode??502,{...l.headers,"access-control-allow-origin":o.headers.origin||"*","access-control-allow-credentials":"true","access-control-expose-headers":d}),l.pipe(e)});return a.on("error",l=>{e.statusCode=502,e.end(`app proxy error: ${l.message}`)}),o.pipe(a),!0}import{WebSocket as T,WebSocketServer as ot}from"ws";var at="/__websocket-proxy",ct=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 I(o,e,t){try{o.write(`HTTP/1.1 ${e} ${t}\r
@@ -14,7 +14,7 @@ ${t}`)}catch{}o.destroy()}function dt(o){let e=o.headers.origin,t=o.headers.host
14
14
  `)}}throw new Error(`could not bind ws bridge after ${this.portFallbackCount} attempts starting at ${this.preferredPort}`)}bindOnce(e,t){return new Promise((i,s)=>{let n=St((a,l)=>this.handleHttpRequest(a,l)),c=!1,r=a=>{if(!c){c=!0;try{n.close()}catch{}this.httpServer=null,this.wss=null,s(a)}};n.once("error",r),n.listen(e,"127.0.0.1",()=>{c||(c=!0,n.removeListener("error",r),n.on("error",a=>{process.stderr.write(`ws bridge http error: ${String(a)}
15
15
  `)}),this.httpServer=n,this.wss=new yt({noServer:!0}),this.wireWebSocketServer(),n.on("upgrade",(a,l,d)=>{Ue(a,l,d)||this.wss?.handleUpgrade(a,l,d,p=>{this.wss?.emit("connection",p,a)})}),i())})})}wireWebSocketServer(){this.wss&&this.wss.on("connection",(e,t)=>{let i=t.headers.origin,s=i?"sim":"cli",n=null;if(e.on("error",()=>{}),this.wsIsAlive.set(e,!0),e.on("pong",()=>{this.wsIsAlive.set(e,!0)}),this.agentHost.registerSocket(e),s==="sim")n={id:this.allocateSimId(),ws:e,origin:i,connectedAt:Date.now(),lastSeenAt:Date.now(),lastActiveAt:0,recentActions:[]},this.sims.set(n.id,n),this.writeConnectedRuntimeSnapshot(),this.shouldPromoteSim(n)&&(this.primarySimId=n.id),this.broadcastSimAssignments(),this.broadcastSimClientStates();else{let c=`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,c)}e.on("message",c=>{let r;try{r=JSON.parse(c.toString())}catch{return}if(!(!r||typeof r!="object")){if(typeof r.type=="string"&&r.type.startsWith("agent:")){this.agentHost.handleMessage(e,r);return}if(r.type==="runtime:list"){let a=x.listInstalled(),l=this.getActiveRuntime(),d={type:"runtime:list:ok",id:r.id,installed:a,active:l.version,activeRuntimeDir:l.runtimeDir};try{e.send(JSON.stringify(d))}catch{}return}if(r.type==="runtime:use"){let a=typeof r.version=="string"?r.version:"";if(!x.listInstalled().includes(a)){try{e.send(JSON.stringify({type:"runtime:use:error",id:r.id,error:`runtime ${a||"(missing)"} is not installed`}))}catch{}return}let d=this.setActiveRuntime(a);try{e.send(JSON.stringify({type:"runtime:use:ok",id:r.id,version:d.version,runtimeDir:d.runtimeDir}))}catch{}return}if(r.type==="runtime:get"){let a=this.getActiveRuntime();try{e.send(JSON.stringify({type:"runtime:get:ok",id:r.id,active:a.version,activeRuntimeDir:a.runtimeDir}))}catch{}return}if(s==="sim"&&r.type==="bridge:hello"&&n&&!n.url){let a=n.id;this.sims.delete(a),this.primarySimId===a&&(this.primarySimId=this.getOpenSim()?.id??null),n=null,s="cli",this.cliIdentityKeyBySocket.set(e,`ws-${this.nextCliFallbackId++}`),this.writeConnectedRuntimeSnapshot(),this.broadcastSimAssignments(),this.broadcastSimClientStates()}if(s==="sim"){if(n&&(n.lastSeenAt=Date.now()),r.type==="bridge:register"&&n){let d=r,p=this.tryRestoreSimId(n,d.simId);n.url=d.url,n.title=d.title,n.userAgent=d.userAgent,this.writeConnectedRuntimeSnapshot(),typeof d.kind=="string"&&d.kind.trim()&&(n.kind=d.kind.trim()),d.meta&&typeof d.meta=="object"&&(n.meta=d.meta);let u=this.primarySimId!==n.id&&this.shouldPromoteSim(n);u&&(this.primarySimId=n.id),(p||u)&&(this.broadcastSimAssignments(),this.broadcastSimClientStates());return}if(r.type==="bridge:user-focus-state"&&n){let d=r;this.updateUserFocusLease(n,d);return}if(r.type==="bridge:user-interact"&&n){this.updateUserActivity(n);return}if(r.type==="bridge:write-shared-config"){if(!r.patch||typeof r.patch!="object"||Array.isArray(r.patch))return;let d=Object.fromEntries(Object.entries(r.patch));try{this.writeAndBroadcastSharedConfig(d)}catch(p){process.stderr.write(`sootsim: bridge:write-shared-config failed: ${p instanceof Error?p.message:String(p)}
16
16
  `);return}return}if(r.type==="bridge:open-path"){let d=typeof r.path=="string"?r.path:"",p=typeof r.line=="number"&&Number.isFinite(r.line)?r.line:void 0,u=typeof r.column=="number"&&Number.isFinite(r.column)?r.column:void 0;d&&this.openPathInEditor(d,p,u);return}if(r.type==="bridge:boot-clients"&&n){let d=[];for(let[u,h]of this.cliSimBySocket)h===n.id&&d.push(u);for(let u of d){this.cliSimBySocket.delete(u);try{u.close(1e3,"booted by sim")}catch{}}let p=!!n.cliLease;n.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:Date.now()+o.USER_BOOT_LEASE_TTL_MS},process.stderr.write(`sootsim booted ${d.length} cli client(s)${p?" (overrode prior lease)":""}; held sim for user [${n.id}]
17
- `),this.recordSimAction(n.id,"sim booted cli clients"),this.broadcastSimClientStates();return}let a=this.pendingCommands.get(r.id);if(a){this.pendingCommands.delete(r.id),r.error?a.reject(new Error(r.error)):a.resolve(r.result);return}let l=this.cliBySentId.get(r.id);if(l&&(this.cliBySentId.delete(r.id),l.ws.readyState===g.OPEN)){let d=this.getOtherCliIdentityCount(l.ws,l.simId),p=d>0?{...r,id:l.originalId,_otherCliCount:d}:{...r,id:l.originalId};l.ws.send(JSON.stringify(p))}return}(async()=>{this.cliLastCommandAt.set(e,Date.now());try{if(r.type==="bridge:bye"){let u=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[h,m]of this.cliBySentId)m.ws===e&&this.cliBySentId.delete(h);u&&this.broadcastSimClientStates();return}if(r.type==="bridge:hello"){let u=typeof r.cliIdentityKey=="string"&&r.cliIdentityKey.trim()?r.cliIdentityKey.trim():this.cliIdentityKeyBySocket.get(e)||`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,u),typeof r.cliLabel=="string"&&r.cliLabel.trim()&&this.cliLabelBySocket.set(e,r.cliLabel.trim()),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{cliIdentityKey:u,leaseTtlMs:o.CLI_LEASE_TTL_MS,leasing:!0}}));return}if(r.type==="bridge:list-sims"){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:this.listSims()}));return}if(r.type==="bridge:open"){if(typeof r.url!="string"||!r.url)throw new Error("bridge:open requires a url");await this.openUrl(r.url,{newWindow:r.newWindow===!0}),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{ok:!0,url:r.url}}));return}if(r.type==="bridge:claim"){let u=await this.waitForSim(r.simId),h=this.tryAcquireLease(e,u,{force:r.force===!0});if(!h.granted){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${u.id} is locked by another cli`,_locked:h.lock}));return}this.setCliSimTarget(e,u.id),this.recordSimAction(u.id,h.bootedCount>0?`cli force-claimed sim (booted ${h.bootedCount})`:"cli claimed sim"),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{simId:u.id,lockedBy:h.lease.cliIdentityKey,lockExpiresAt:h.lease.expiresAt,bootedCount:h.bootedCount}}));return}let a=await this.waitForSim(r.simId);if(kt(r)){let u=this.tryAcquireLease(e,a);if(!u.granted){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${a.id} is locked by another cli \u2014 use \`sootsim claim ${a.id} --force\` or \`sootsim open --new\``,_locked:u.lock}));return}}else this.ensureCliIdentityKey(e);this.setCliSimTarget(e,a.id),this.recordSimAction(a.id,this.describeForwardedCommand(r));let l=this.nextCommandId++;this.cliBySentId.set(l,{simId:a.id,ws:e,originalId:r.id});let{simId:d,...p}=r;if(a.ws.send(JSON.stringify({...p,id:l})),p.type==="close"){this.cliBySentId.delete(l),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{requested:!0,simId:a.id}}));let u=a.ws,h=setTimeout(()=>{this.closeSimSocketFromHost(u)},wt);je(h)}}catch(a){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,error:a instanceof Error?a.message:String(a)}))}})()}}),e.on("close",()=>{if(this.agentHost.unregisterSocket(e),s==="sim"&&n){this.rememberDisconnectedSim(n),this.primarySimId===n.id&&(this.primarySimId=this.getOpenSim()?.id??null);for(let[c,r]of this.pendingCommands)r.simId===n.id&&(r.reject(new Error("sim disconnected")),this.pendingCommands.delete(c));for(let[c,r]of this.cliBySentId)r.simId===n.id&&(r.ws.readyState===g.OPEN&&r.ws.send(JSON.stringify({id:r.originalId,error:"sim disconnected before responding"})),this.cliBySentId.delete(c));this.broadcastSimAssignments(),this.broadcastSimClientStates()}else if(s==="cli"){let c=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[r,a]of this.cliBySentId)a.ws===e&&this.cliBySentId.delete(r);c&&this.broadcastSimClientStates()}})})}afterBind(){if(process.stderr.write(`ws bridge listening on port ${this.port}
17
+ `),this.recordSimAction(n.id,"sim booted cli clients"),this.broadcastSimClientStates();return}let a=this.pendingCommands.get(r.id);if(a){this.pendingCommands.delete(r.id),r.error?a.reject(new Error(r.error)):a.resolve(r.result);return}let l=this.cliBySentId.get(r.id);if(l&&(this.cliBySentId.delete(r.id),l.ws.readyState===g.OPEN)){let d=this.getOtherCliIdentityCount(l.ws,l.simId),p=d>0?{...r,id:l.originalId,_otherCliCount:d}:{...r,id:l.originalId};l.ws.send(JSON.stringify(p))}return}(async()=>{this.cliLastCommandAt.set(e,Date.now());try{if(r.type==="bridge:bye"){let u=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[h,m]of this.cliBySentId)m.ws===e&&this.cliBySentId.delete(h);u&&this.broadcastSimClientStates();return}if(r.type==="bridge:hello"){let u=typeof r.cliIdentityKey=="string"&&r.cliIdentityKey.trim()?r.cliIdentityKey.trim():this.cliIdentityKeyBySocket.get(e)||`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,u),typeof r.cliLabel=="string"&&r.cliLabel.trim()&&this.cliLabelBySocket.set(e,r.cliLabel.trim()),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{cliIdentityKey:u,leaseTtlMs:o.CLI_LEASE_TTL_MS,leasing:!0}}));return}if(r.type==="bridge:list-sims"){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:this.listSims()}));return}if(r.type==="bridge:claim"){let u=await this.waitForSim(r.simId),h=this.tryAcquireLease(e,u,{force:r.force===!0});if(!h.granted){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${u.id} is locked by another cli`,_locked:h.lock}));return}this.setCliSimTarget(e,u.id),this.recordSimAction(u.id,h.bootedCount>0?`cli force-claimed sim (booted ${h.bootedCount})`:"cli claimed sim"),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{simId:u.id,lockedBy:h.lease.cliIdentityKey,lockExpiresAt:h.lease.expiresAt,bootedCount:h.bootedCount}}));return}let a=await this.waitForSim(r.simId);if(kt(r)){let u=this.tryAcquireLease(e,a);if(!u.granted){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${a.id} is locked by another cli \u2014 use \`sootsim claim ${a.id} --force\` or \`sootsim open --new\``,_locked:u.lock}));return}}else this.ensureCliIdentityKey(e);this.setCliSimTarget(e,a.id),this.recordSimAction(a.id,this.describeForwardedCommand(r));let l=this.nextCommandId++;this.cliBySentId.set(l,{simId:a.id,ws:e,originalId:r.id});let{simId:d,...p}=r;if(a.ws.send(JSON.stringify({...p,id:l})),p.type==="close"){this.cliBySentId.delete(l),e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,result:{requested:!0,simId:a.id}}));let u=a.ws,h=setTimeout(()=>{this.closeSimSocketFromHost(u)},wt);je(h)}}catch(a){e.readyState===g.OPEN&&e.send(JSON.stringify({id:r.id,error:a instanceof Error?a.message:String(a)}))}})()}}),e.on("close",()=>{if(this.agentHost.unregisterSocket(e),s==="sim"&&n){this.rememberDisconnectedSim(n),this.primarySimId===n.id&&(this.primarySimId=this.getOpenSim()?.id??null);for(let[c,r]of this.pendingCommands)r.simId===n.id&&(r.reject(new Error("sim disconnected")),this.pendingCommands.delete(c));for(let[c,r]of this.cliBySentId)r.simId===n.id&&(r.ws.readyState===g.OPEN&&r.ws.send(JSON.stringify({id:r.originalId,error:"sim disconnected before responding"})),this.cliBySentId.delete(c));this.broadcastSimAssignments(),this.broadcastSimClientStates()}else if(s==="cli"){let c=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[r,a]of this.cliBySentId)a.ws===e&&this.cliBySentId.delete(r);c&&this.broadcastSimClientStates()}})})}afterBind(){if(process.stderr.write(`ws bridge listening on port ${this.port}
18
18
  `),this.cliIdleTimer=setInterval(()=>this.sweepIdleCliClients(),3e4),this.cliIdleTimer.unref(),this.wsHeartbeatTimer=setInterval(()=>this.sweepDeadWebSockets(),o.WS_HEARTBEAT_INTERVAL_MS),this.wsHeartbeatTimer.unref(),this.shouldWriteLockfile){try{if(O(),!ne(this.buildLockfileSnapshot()))throw new Error("another sootsim daemon wrote the lockfile during startup \u2014 aborting")}catch(e){throw process.stderr.write(`ws bridge failed to claim daemon lockfile: ${String(e)}
19
19
  `),e}this.heartbeatTimer=setInterval(()=>{try{this.writeLockfileSnapshot()}catch{}},Fe),this.heartbeatTimer.unref(),this.startRuntimeUpdater()}if(this.shouldWriteDevLockfile){try{this.writeDevLockfileSnapshot()}catch(e){process.stderr.write(`ws bridge failed to write dev bridge lockfile: ${String(e)}
20
20
  `)}this.devHeartbeatTimer=setInterval(()=>{try{this.writeDevLockfileSnapshot()}catch{}},Fe),this.devHeartbeatTimer.unref()}this.agentHost.seedOnBoot()}bootstrapping=!0;connectedRuntimeVersions(){let e=new Set;for(let t of this.sims.values())try{let i=new URL(t.url||t.origin||"http://localhost"),s=L(i.hostname);s&&e.add(s)}catch{}return[...e].sort()}buildLockfileSnapshot(){return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,activeRuntimeDir:this.activeRuntimeDirPath,servedRuntimes:this.connectedRuntimeVersions(),startedAt:this.startedAt,heartbeatAt:Date.now(),bootstrapping:this.bootstrapping}}buildDevLockfileSnapshot(){let e=this.getShellPort?.()??null;return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,...e&&e>0?{shellPort:e}:{},cwd:process.cwd(),startedAt:this.startedAt,heartbeatAt:Date.now(),source:"vite-dev",servedRuntimes:this.connectedRuntimeVersions()}}writeLockfileSnapshot(){ie(this.buildLockfileSnapshot())}writeDevLockfileSnapshot(){re(this.buildDevLockfileSnapshot())}writeConnectedRuntimeSnapshot(){if(this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}if(this.shouldWriteDevLockfile&&this.httpServer)try{this.writeDevLockfileSnapshot()}catch{}}refreshActiveRuntime(){this.activeRuntimeVersion=j(),this.activeRuntimeDirPath=pe()??Q()}runServerScan(){if(this.inflightScan)return this.inflightScan;let e=this.effectivePort>0?[this.effectivePort]:[];return this.inflightScan=_({excludePorts:e,buildIconProxyUrl:t=>`/__bundle-proxy?url=${encodeURIComponent(t)}`}).then(t=>(this.scanCache=t,this.scanCacheAt=Date.now(),t)).catch(t=>{let i=t instanceof Error?t.message:String(t);return console.error("[sootsim] /__server-scan failed:",i),this.scanCache??[]}).finally(()=>{this.inflightScan=null}),this.inflightScan}handleServerScan(e){let t=s=>{e.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),e.end(JSON.stringify(s))},i=Date.now()-this.scanCacheAt;if(this.scanCache&&i<o.SCAN_FRESH_MS){t(this.scanCache);return}if(this.scanCache){t(this.scanCache),this.runServerScan().catch(()=>{});return}this.runServerScan().then(s=>t(s))}resolveRuntimeUpdateIntervalMs(){let e=Number(process.env[Ct]);return Number.isFinite(e)&&e>0?Math.max(100,Math.round(e)):Tt}startRuntimeUpdater(){if(!this.shouldWriteLockfile||this.runtimeUpdateTimer||C.existsSync(w.join(q(),"runtime-update-disabled"))||process.env.SOOTSIM_HOME&&z()&&!j())return;this.runRuntimeUpdate("startup");let e=this.resolveRuntimeUpdateIntervalMs();this.runtimeUpdateTimer=setInterval(()=>{this.runRuntimeUpdate("periodic")},e),this.runtimeUpdateTimer.unref()}runRuntimeUpdate(e){return this.runtimeUpdateInFlight?this.runtimeUpdateInFlight:(this.runtimeUpdateInFlight=(async()=>{try{e==="startup"&&process.stderr.write(`sootsim: checking for runtime updates\u2026
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as l}from"./chunk-2UKSI3VX.js";import{d as V,f as q,g as J,i as N,j as F}from"./chunk-KVOY4Z2X.js";import{b as k,c as L}from"./chunk-SLCYXISJ.js";import{c as w}from"./chunk-3PREBGTH.js";import"./chunk-KVLXMWV5.js";import{f as m}from"./chunk-SWBTXTEO.js";import"./chunk-J653UMCU.js";import"./chunk-4Q42Y64Y.js";import"./chunk-POIK3AHY.js";import"./chunk-KG2WUKD2.js";import"./chunk-6EXIYEOQ.js";import"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import"./chunk-COD6QGS2.js";import{A as v,B as E,H as R,K as C,M as I,l as b}from"./chunk-EBCXFB3K.js";import{a as T}from"./chunk-CWDEDUOZ.js";import"./chunk-DHDSGBZB.js";import"./chunk-LOF3WUKB.js";import P from"node:fs";import U from"node:os";import $ from"node:path";import{spawn as ne}from"node:child_process";import u from"node:fs";import s from"node:path";function B(e){let n=s.resolve(e);for(;;){if(u.existsSync(s.join(n,"package.json")))return n;let o=s.dirname(n);if(o===n)return null;n=o}}function j(e){let n=s.resolve(e);for(;;){if(u.existsSync(s.join(n,"bun.lock"))||u.existsSync(s.join(n,"bun.lockb")))return"bun";if(u.existsSync(s.join(n,"pnpm-lock.yaml")))return"pnpm";if(u.existsSync(s.join(n,"package-lock.json")))return"npm";let o=s.dirname(n);if(o===n)return"npm";n=o}}function Y(e){let n=s.resolve(e.appDir),o=oe(s.join(n,"package.json")),t=o.scripts?.sootsim;if(t&&t!=="sootsim open")throw new Error(`package.json already defines scripts.sootsim as ${JSON.stringify(t)}; resolve that conflict before setup`);let r=j(n),i=[];return o.devDependencies?.sootsim!==e.cliVersion&&i.push(te(r,e.cliVersion)),t!=="sootsim open"&&i.push(se(r)),{appDir:n,packageManager:r,operations:i}}async function H(e,n){for(let o of e.operations)n.dryRun||await ie(o,e.appDir,n.json)}function O(e){return e.operations.map(n=>`${n.command} ${n.args.map(re).join(" ")}`)}function oe(e){let n;try{n=JSON.parse(u.readFileSync(e,"utf8"))}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(`could not read ${e}: ${i}`)}if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${e} must contain a JSON object`);let o=W(Reflect.get(n,"scripts")),t=W(Reflect.get(n,"devDependencies"));return{...o?{scripts:o}:{},...t?{devDependencies:t}:{}}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=Object.entries(e).filter(o=>typeof o[1]=="string");return Object.fromEntries(n)}function te(e,n){let o=`sootsim@${n}`;switch(e){case"bun":return{command:"bun",args:["add","--dev","--exact",o],description:`install ${o} as an exact dev dependency`};case"pnpm":return{command:"pnpm",args:["add","--save-dev","--save-exact",o],description:`install ${o} as an exact dev dependency`};case"npm":return{command:"npm",args:["install","--save-dev","--save-exact",o],description:`install ${o} as an exact dev dependency`}}}function re(e){return/^[a-zA-Z0-9_./@=-]+$/.test(e)?e:JSON.stringify(e)}function ie(e,n,o){return new Promise((t,r)=>{let i=ne(e.command,e.args,{cwd:n,stdio:o?["ignore",2,"inherit"]:"inherit"});i.once("error",r),i.once("exit",c=>{c===0?t():r(new Error(`${e.command} exited with code ${c??"unknown"}`))})})}function se(e){return{command:e,args:e==="bun"?["pm","pkg","set","scripts.sootsim=sootsim open"]:["pkg","set","scripts.sootsim=sootsim open"],description:"add the `sootsim` package script"}}async function We(e){if(e.includes("--help")||e.includes("-h")){je();return}let n=pe(e),o="decisions";try{let t=B(n.appDir),r=k(),i=v(),c=await ue(n,r),Q=await le(n,t),y=await Z(n,"productAnalytics",i.productAnalytics,i.configured),g=await Z(n,"crashReports",i.crashReports,i.configured),X=await m.fetchManifest(),d=m.resolveVersion(X,{channel:"stable"}).version,D=T();if(D==="0.0.0")throw new Error("could not resolve the installed SootSim CLI version");let a=null;Q&&t&&(a=Y({appDir:t,cliVersion:D})),Se(n),he(n,r,c,d),be(n,t,a),ve(n,y,g),o="runtime";let A=!1;if(!n.dryRun){let _=R();A=(await m.install({version:d,channel:"stable",setActive:!0,protectVersions:_?[_]:[]})).installed}o="repository",a&&await H(a,{dryRun:n.dryRun,json:n.json}),o="service";let S=r.installed;c&&!r.installed&&!n.dryRun&&(await L({port:7668,force:!1}),S=!0),o="privacy",n.dryRun||E({productAnalytics:y,crashReports:g}),o="compatibility";let p=t?fe(t):null,h=await de(n,p);h&&p&&t&&!n.dryRun&&await me(t,p),Re(n,p,h);let M={runtimeVersion:d,serviceInstalled:S,repositoryPrepared:a!==null,compatibilityShared:h&&!n.dryRun},ee=ge(d);n.json?console.log(JSON.stringify({...M,runtimeInstalled:n.dryRun?!1:A,dryRun:n.dryRun,cache:ee,repositoryOperations:a?O(a):[]},null,2)):we(a);let f=p?q(p):null;return w({event:"cli_setup_completed",properties:{service_installed:S,repository_prepared:a!==null,product_analytics:y,crash_reports:g,compat_supported:f?.supported??0,compat_partial:f?.partial??0,compat_unsupported:f?.unsupported??0,compat_not_yet_verified:f?.notYetVerified??0,from_welcome:n.fromWelcome,ci:n.ci,dry_run:n.dryRun}}),M}catch(t){let r=ke(t);throw w({event:"cli_setup_failed",properties:{stage:o,message:r}}),t}}function ce(){let e=k(),n=C(),o=R();return{daemonSupported:e.supported,daemonInstalled:e.installed,daemonRunning:!!(n&&I(n)),runtimeInstalled:!!(o&&P.existsSync(b(o))),privacyConfigured:v().configured}}function Be(e=ce()){return!e.runtimeInstalled||!e.privacyConfigured}function pe(e){let n=e.indexOf("--app"),o=n>=0?e[n+1]:void 0;if(n>=0&&(!o||o.startsWith("-")))throw new Error("--app requires a directory");let t=z(e,"--service","--no-service"),r=z(e,"--repo","--no-repo");return{appDir:$.resolve(o??process.cwd()),ci:e.includes("--ci"),dryRun:e.includes("--dry-run"),fromWelcome:e.includes("--from-welcome"),json:e.includes("--json"),yes:e.includes("--yes")||e.includes("-y"),service:t,repository:r,productAnalytics:G(e,"--analytics"),crashReports:G(e,"--crash-reports"),shareCompatibility:e.includes("--share-compat")}}function z(e,n,o){if(e.includes(n)&&e.includes(o))throw new Error(`${n} and ${o} cannot be used together`);if(e.includes(n))return!0;if(e.includes(o))return!1}function G(e,n){let o=e.find(i=>i.startsWith(`${n}=`)),t=e.indexOf(n),r=o?.slice(n.length+1)??(t>=0?e[t+1]:void 0);if(r!==void 0){if(r==="on"||r==="yes"||r==="true")return!0;if(r==="off"||r==="no"||r==="false")return!1;throw new Error(`${n} must be on or off`)}}async function ue(e,n){if(e.ci){if(e.service===!0)throw new Error("--ci cannot install a machine service");return!1}return n.supported?n.installed&&e.service===void 0?!0:e.service!==void 0?e.service:e.yes?!0:(x(e,"--service or --no-service"),l("Install the background service and shared managed runtime?",!0)):!1}async function le(e,n){if(!n){if(e.repository===!0)throw new Error("--repo requires a package.json");return!1}return e.repository!==void 0?e.repository:e.yes?!0:(x(e,"--repo or --no-repo"),l(`Prepare ${n} for reproducible SootSim runs?`,!0))}async function Z(e,n,o,t){let r=n==="productAnalytics"?e.productAnalytics:e.crashReports;return r!==void 0?r:t?o:e.yes?!0:(x(e,n==="productAnalytics"?"--analytics on|off":"--crash-reports on|off"),l(n==="productAnalytics"?"Share bounded product analytics?":"Send bounded crash reports?",!0))}async function de(e,n){return n?e.shareCompatibility?!0:e.yes||!process.stdin.isTTY?!1:l("Share dependency names, requested versions, framework, and this compatibility result?",!1):!1}function x(e,n){if(!(process.stdin.isTTY&&!e.ci))throw new Error(`non-interactive setup requires ${n}, or --yes to accept defaults`)}function fe(e){let n=JSON.parse(P.readFileSync($.join(e,"package.json"),"utf8"));if(!n||typeof n!="object")throw new Error("package.json must contain an object");return V(n)}async function me(e,n){let o=JSON.parse(P.readFileSync($.join(e,"package.json"),"utf8"));if(!o||typeof o!="object")throw new Error("package.json must be an object");let t=await fetch("https://contrast.dev/api/scan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ye(o,n)),signal:AbortSignal.timeout(1e4)});if(!t.ok)throw new Error(`compatibility sharing failed with HTTP ${t.status}`)}function ye(e,n){return{dependencies:K(Reflect.get(e,"dependencies")),devDependencies:K(Reflect.get(e,"devDependencies")),framework:n.framework,result:{framework:n.framework,rnVersion:n.rnVersion,packages:n.packages.slice(0,200)},source:"desktop",shared:!0}}function K(e){if(!e||typeof e!="object")return{};let n={};for(let[o,t]of Object.entries(e).slice(0,200))typeof t=="string"&&(n[o.slice(0,160)]=t.slice(0,80));return n}function ge(e){let n=U.platform(),o=U.arch();return{path:b(e),key:`sootsim-runtime-${n}-${o}-${e}`,inputs:{platform:n,arch:o,runtimeVersion:e}}}function Se(e){e.json||console.log(`
4
+ import{a as l}from"./chunk-MBF4LLVB.js";import{d as V,f as q,g as J,i as N,j as F}from"./chunk-NH2KYSY7.js";import{b as k,c as L}from"./chunk-3XUXMKKJ.js";import{c as w}from"./chunk-HMW7QKJV.js";import"./chunk-UTE2W4WC.js";import{f as m}from"./chunk-LOXCEKKF.js";import"./chunk-7VVWOKJE.js";import"./chunk-C6TKPNCZ.js";import"./chunk-IXPUTLYO.js";import"./chunk-OYFRTYRJ.js";import"./chunk-BPNVJLGT.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-4MLH5CMV.js";import{A as v,B as E,H as R,K as C,M as I,l as b}from"./chunk-VTPICQDM.js";import{a as T}from"./chunk-TCB56ABT.js";import"./chunk-YVWYARHY.js";import"./chunk-2UC72ZR6.js";import P from"node:fs";import U from"node:os";import $ from"node:path";import{spawn as ne}from"node:child_process";import u from"node:fs";import s from"node:path";function B(e){let n=s.resolve(e);for(;;){if(u.existsSync(s.join(n,"package.json")))return n;let o=s.dirname(n);if(o===n)return null;n=o}}function j(e){let n=s.resolve(e);for(;;){if(u.existsSync(s.join(n,"bun.lock"))||u.existsSync(s.join(n,"bun.lockb")))return"bun";if(u.existsSync(s.join(n,"pnpm-lock.yaml")))return"pnpm";if(u.existsSync(s.join(n,"package-lock.json")))return"npm";let o=s.dirname(n);if(o===n)return"npm";n=o}}function Y(e){let n=s.resolve(e.appDir),o=oe(s.join(n,"package.json")),t=o.scripts?.sootsim;if(t&&t!=="sootsim open")throw new Error(`package.json already defines scripts.sootsim as ${JSON.stringify(t)}; resolve that conflict before setup`);let r=j(n),i=[];return o.devDependencies?.sootsim!==e.cliVersion&&i.push(te(r,e.cliVersion)),t!=="sootsim open"&&i.push(se(r)),{appDir:n,packageManager:r,operations:i}}async function H(e,n){for(let o of e.operations)n.dryRun||await ie(o,e.appDir,n.json)}function O(e){return e.operations.map(n=>`${n.command} ${n.args.map(re).join(" ")}`)}function oe(e){let n;try{n=JSON.parse(u.readFileSync(e,"utf8"))}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(`could not read ${e}: ${i}`)}if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${e} must contain a JSON object`);let o=W(Reflect.get(n,"scripts")),t=W(Reflect.get(n,"devDependencies"));return{...o?{scripts:o}:{},...t?{devDependencies:t}:{}}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=Object.entries(e).filter(o=>typeof o[1]=="string");return Object.fromEntries(n)}function te(e,n){let o=`sootsim@${n}`;switch(e){case"bun":return{command:"bun",args:["add","--dev","--exact",o],description:`install ${o} as an exact dev dependency`};case"pnpm":return{command:"pnpm",args:["add","--save-dev","--save-exact",o],description:`install ${o} as an exact dev dependency`};case"npm":return{command:"npm",args:["install","--save-dev","--save-exact",o],description:`install ${o} as an exact dev dependency`}}}function re(e){return/^[a-zA-Z0-9_./@=-]+$/.test(e)?e:JSON.stringify(e)}function ie(e,n,o){return new Promise((t,r)=>{let i=ne(e.command,e.args,{cwd:n,stdio:o?["ignore",2,"inherit"]:"inherit"});i.once("error",r),i.once("exit",c=>{c===0?t():r(new Error(`${e.command} exited with code ${c??"unknown"}`))})})}function se(e){return{command:e,args:e==="bun"?["pm","pkg","set","scripts.sootsim=sootsim open"]:["pkg","set","scripts.sootsim=sootsim open"],description:"add the `sootsim` package script"}}async function We(e){if(e.includes("--help")||e.includes("-h")){je();return}let n=pe(e),o="decisions";try{let t=B(n.appDir),r=k(),i=v(),c=await ue(n,r),Q=await le(n,t),y=await Z(n,"productAnalytics",i.productAnalytics,i.configured),g=await Z(n,"crashReports",i.crashReports,i.configured),X=await m.fetchManifest(),d=m.resolveVersion(X,{channel:"stable"}).version,D=T();if(D==="0.0.0")throw new Error("could not resolve the installed SootSim CLI version");let a=null;Q&&t&&(a=Y({appDir:t,cliVersion:D})),Se(n),he(n,r,c,d),be(n,t,a),ve(n,y,g),o="runtime";let A=!1;if(!n.dryRun){let _=R();A=(await m.install({version:d,channel:"stable",setActive:!0,protectVersions:_?[_]:[]})).installed}o="repository",a&&await H(a,{dryRun:n.dryRun,json:n.json}),o="service";let S=r.installed;c&&!r.installed&&!n.dryRun&&(await L({port:7668,force:!1}),S=!0),o="privacy",n.dryRun||E({productAnalytics:y,crashReports:g}),o="compatibility";let p=t?fe(t):null,h=await de(n,p);h&&p&&t&&!n.dryRun&&await me(t,p),Re(n,p,h);let M={runtimeVersion:d,serviceInstalled:S,repositoryPrepared:a!==null,compatibilityShared:h&&!n.dryRun},ee=ge(d);n.json?console.log(JSON.stringify({...M,runtimeInstalled:n.dryRun?!1:A,dryRun:n.dryRun,cache:ee,repositoryOperations:a?O(a):[]},null,2)):we(a);let f=p?q(p):null;return w({event:"cli_setup_completed",properties:{service_installed:S,repository_prepared:a!==null,product_analytics:y,crash_reports:g,compat_supported:f?.supported??0,compat_partial:f?.partial??0,compat_unsupported:f?.unsupported??0,compat_not_yet_verified:f?.notYetVerified??0,from_welcome:n.fromWelcome,ci:n.ci,dry_run:n.dryRun}}),M}catch(t){let r=ke(t);throw w({event:"cli_setup_failed",properties:{stage:o,message:r}}),t}}function ce(){let e=k(),n=C(),o=R();return{daemonSupported:e.supported,daemonInstalled:e.installed,daemonRunning:!!(n&&I(n)),runtimeInstalled:!!(o&&P.existsSync(b(o))),privacyConfigured:v().configured}}function Be(e=ce()){return!e.runtimeInstalled||!e.privacyConfigured}function pe(e){let n=e.indexOf("--app"),o=n>=0?e[n+1]:void 0;if(n>=0&&(!o||o.startsWith("-")))throw new Error("--app requires a directory");let t=z(e,"--service","--no-service"),r=z(e,"--repo","--no-repo");return{appDir:$.resolve(o??process.cwd()),ci:e.includes("--ci"),dryRun:e.includes("--dry-run"),fromWelcome:e.includes("--from-welcome"),json:e.includes("--json"),yes:e.includes("--yes")||e.includes("-y"),service:t,repository:r,productAnalytics:G(e,"--analytics"),crashReports:G(e,"--crash-reports"),shareCompatibility:e.includes("--share-compat")}}function z(e,n,o){if(e.includes(n)&&e.includes(o))throw new Error(`${n} and ${o} cannot be used together`);if(e.includes(n))return!0;if(e.includes(o))return!1}function G(e,n){let o=e.find(i=>i.startsWith(`${n}=`)),t=e.indexOf(n),r=o?.slice(n.length+1)??(t>=0?e[t+1]:void 0);if(r!==void 0){if(r==="on"||r==="yes"||r==="true")return!0;if(r==="off"||r==="no"||r==="false")return!1;throw new Error(`${n} must be on or off`)}}async function ue(e,n){if(e.ci){if(e.service===!0)throw new Error("--ci cannot install a machine service");return!1}return n.supported?n.installed&&e.service===void 0?!0:e.service!==void 0?e.service:e.yes?!0:(x(e,"--service or --no-service"),l("Install the background service and shared managed runtime?",!0)):!1}async function le(e,n){if(!n){if(e.repository===!0)throw new Error("--repo requires a package.json");return!1}return e.repository!==void 0?e.repository:e.yes?!0:(x(e,"--repo or --no-repo"),l(`Prepare ${n} for reproducible SootSim runs?`,!0))}async function Z(e,n,o,t){let r=n==="productAnalytics"?e.productAnalytics:e.crashReports;return r!==void 0?r:t?o:e.yes?!0:(x(e,n==="productAnalytics"?"--analytics on|off":"--crash-reports on|off"),l(n==="productAnalytics"?"Share bounded product analytics?":"Send bounded crash reports?",!0))}async function de(e,n){return n?e.shareCompatibility?!0:e.yes||!process.stdin.isTTY?!1:l("Share dependency names, requested versions, framework, and this compatibility result?",!1):!1}function x(e,n){if(!(process.stdin.isTTY&&!e.ci))throw new Error(`non-interactive setup requires ${n}, or --yes to accept defaults`)}function fe(e){let n=JSON.parse(P.readFileSync($.join(e,"package.json"),"utf8"));if(!n||typeof n!="object")throw new Error("package.json must contain an object");return V(n)}async function me(e,n){let o=JSON.parse(P.readFileSync($.join(e,"package.json"),"utf8"));if(!o||typeof o!="object")throw new Error("package.json must be an object");let t=await fetch("https://contrast.dev/api/scan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ye(o,n)),signal:AbortSignal.timeout(1e4)});if(!t.ok)throw new Error(`compatibility sharing failed with HTTP ${t.status}`)}function ye(e,n){return{dependencies:K(Reflect.get(e,"dependencies")),devDependencies:K(Reflect.get(e,"devDependencies")),framework:n.framework,result:{framework:n.framework,rnVersion:n.rnVersion,packages:n.packages.slice(0,200)},source:"desktop",shared:!0}}function K(e){if(!e||typeof e!="object")return{};let n={};for(let[o,t]of Object.entries(e).slice(0,200))typeof t=="string"&&(n[o.slice(0,160)]=t.slice(0,80));return n}function ge(e){let n=U.platform(),o=U.arch();return{path:b(e),key:`sootsim-runtime-${n}-${o}-${e}`,inputs:{platform:n,arch:o,runtimeVersion:e}}}function Se(e){e.json||console.log(`
5
5
  ${e.fromWelcome?"welcome to sootsim":"sootsim setup"}`)}function he(e,n,o,t){e.json||(console.log(`
6
6
  1. machine`),console.log(` stable runtime: ${t}`),console.log(` background service: ${n.supported?o?"install":"skip":"unsupported on this platform"}`))}function be(e,n,o){if(!e.json){if(console.log(`
7
7
  2. repository`),!n){console.log(" no package.json found; repository preparation skipped");return}if(!o){console.log(` skipped for ${n}`);return}console.log(` package manager: ${j(n)}`);for(let t of O(o))console.log(` ${e.dryRun?"would run":"run"}: ${t}`)}}function ve(e,n,o){e.json||(console.log(`
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import"./chunk-LOF3WUKB.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
4
+ import"./chunk-2UC72ZR6.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
5
5
 
6
6
  install and inspect bundled SootSim agent skills.
7
7
 
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{j as f}from"./chunk-EWVEUNRO.js";import"./chunk-BDNZULU7.js";import"./chunk-B65RMI7A.js";import"./chunk-QJUKXBH5.js";import"./chunk-H5D6E3DR.js";import"./chunk-EPZG2F4I.js";import"./chunk-IJ64Z77P.js";import"./chunk-R6MBDR56.js";import{a as t,b as n,c as l,d as c,e as a}from"./chunk-HKPJYMJC.js";import"./chunk-43SNLCXR.js";import"./chunk-PELXRGDN.js";import"./chunk-UUKUKTV3.js";import"./chunk-ZRQFYMTL.js";import"./chunk-DTHOMSAA.js";import"./chunk-XWMTLVCE.js";import"./chunk-VKBCGFOU.js";import"./chunk-TRV5K6D2.js";import"./chunk-NNR3BU5O.js";import"./chunk-R5TBMYGH.js";import"./chunk-XI6CPN53.js";import"./chunk-SWBTXTEO.js";import"./chunk-POIK3AHY.js";import"./chunk-KG2WUKD2.js";import"./chunk-6EXIYEOQ.js";import"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import"./chunk-COD6QGS2.js";import"./chunk-EBCXFB3K.js";import"./chunk-LOF3WUKB.js";function p(){console.log(`
4
+ import{j as f}from"./chunk-74Z7ENQL.js";import"./chunk-KNPXTXMI.js";import"./chunk-6SBFFSXO.js";import"./chunk-XZSXFV33.js";import"./chunk-4TN4CD7M.js";import"./chunk-4XGRVAXA.js";import"./chunk-V5PJXD2O.js";import"./chunk-HPCKCWSQ.js";import"./chunk-4735ZG3S.js";import{a as t,b as n,c as l,d as c,e as a}from"./chunk-RYXC27XV.js";import"./chunk-VLKENZFJ.js";import"./chunk-6SIWYEK5.js";import"./chunk-G73JPCHX.js";import"./chunk-UTHRVXG5.js";import"./chunk-NQ56D5JF.js";import"./chunk-UAYFVJ7N.js";import"./chunk-7RZYUZEK.js";import"./chunk-MCGRZYAP.js";import"./chunk-6PIGQNS4.js";import"./chunk-FXC6BYKX.js";import"./chunk-LOXCEKKF.js";import"./chunk-IXPUTLYO.js";import"./chunk-OYFRTYRJ.js";import"./chunk-BPNVJLGT.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-4MLH5CMV.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";function p(){console.log(`
5
5
  sootsim storage profile \u2014 manage isolated storage profiles
6
6
 
7
7
  usage:
@@ -0,0 +1,4 @@
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{a}from"./chunk-UTHRVXG5.js";import"./chunk-BPNVJLGT.js";import"./chunk-2UC72ZR6.js";export{a as settingsStore};
@@ -0,0 +1,4 @@
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{c as a,d as b}from"./chunk-HMW7QKJV.js";import"./chunk-UTE2W4WC.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";export{b as flushCliTelemetry,a as trackCliEvent};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{h as m,j as d,m as s}from"./chunk-NNR3BU5O.js";import"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import"./chunk-EBCXFB3K.js";import"./chunk-LOF3WUKB.js";import{writeFileSync as g}from"fs";function u(){console.log(`
4
+ import{h as m,j as d,m as s}from"./chunk-MCGRZYAP.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";import{writeFileSync as g}from"fs";function u(){console.log(`
5
5
  sootsim timeline \u2014 control the semantic event timeline
6
6
 
7
7
  usage:
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as h,b as v,c as $}from"./chunk-W3M4676V.js";import{b as p}from"./chunk-VKBCGFOU.js";import"./chunk-TRV5K6D2.js";import"./chunk-NNR3BU5O.js";import{b as g}from"./chunk-SWBTXTEO.js";import"./chunk-OCRL2VU4.js";import"./chunk-WIRBJTTU.js";import{H as a,g as m,h as u,l as d}from"./chunk-EBCXFB3K.js";import{a as f}from"./chunk-CWDEDUOZ.js";import"./chunk-LOF3WUKB.js";import{spawn as y}from"node:child_process";import k from"node:fs";import R from"node:os";import r from"node:path";var b="https://registry.npmjs.org/sootsim/latest";async function W(o){let n=o.indexOf("--channel"),t=n>=0&&o[n+1]?o[n+1]:void 0;console.log(`sootsim upgrade
4
+ import{a as h,b as v,c as $}from"./chunk-UBLLWSSF.js";import{b as p}from"./chunk-UAYFVJ7N.js";import"./chunk-7RZYUZEK.js";import"./chunk-MCGRZYAP.js";import{b as g}from"./chunk-LOXCEKKF.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import{H as a,g as m,h as u,l as d}from"./chunk-VTPICQDM.js";import{a as f}from"./chunk-TCB56ABT.js";import"./chunk-2UC72ZR6.js";import{spawn as y}from"node:child_process";import k from"node:fs";import R from"node:os";import r from"node:path";var b="https://registry.npmjs.org/sootsim/latest";async function W(o){let n=o.indexOf("--channel"),t=n>=0&&o[n+1]?o[n+1]:void 0;console.log(`sootsim upgrade
5
5
  `),console.log("runtime:");let e=a(),{config:l}=await p(),s=l?.runtimeVersion,c=s?k.existsSync(r.join(d(s),"index.html")):!1;s&&console.log(` project config: v${s}`);let i=(s&&c?null:await $(["install",...s?[s,"--set-active=false"]:[],...t?["--channel",t]:[]],{}))?.version??s??a();i&&console.log(s?c?` result: v${i} already installed for this project`:` result: not installed \u2192 v${i} for this project`:e&&e!==i?` result: v${e} \u2192 v${i}`:e?` result: v${i} already current`:` result: not installed \u2192 v${i}`);let x=i?await h(i):null;console.log(`
6
6
  cli:`),await j(),i&&console.log(`
7
7
  ${v(i,x)}`)}function w(){if(u())return{kind:"dev"};let o=process.argv[1]??"";try{o=k.realpathSync(o)}catch{}let n=r.sep;if(o.includes(`${n}_npx${n}`)||o.includes(`${n}.bunx${n}`))return{kind:"npx"};if(o.includes(`${n}.bun${n}`))return{kind:"global",command:"bun",args:["add","-g","sootsim@latest"]};if(o.includes(`${n}pnpm${n}`))return{kind:"global",command:"pnpm",args:["add","-g","sootsim@latest"]};let t=r.join(m(),"cli");if(o.startsWith(`${t}${n}`))return{kind:"global",command:"npm",args:["i","-g","--prefix",t,"sootsim@latest"]};let e=r.resolve(process.env.SOOTSIM_CLI_PREFIX||r.join(R.homedir(),".local"));return o.startsWith(`${e}${n}`)?{kind:"global",command:"npm",args:["i","-g","--prefix",e,"sootsim@latest"]}:{kind:"global",command:"npm",args:["i","-g","sootsim@latest"]}}async function j(){let o=f(),n=await C();if(!n){console.log(` v${o} \u2014 couldn't reach the npm registry, skipped`);return}if(g(n,o)<=0){console.log(` v${o} (latest)`);return}let t=w();if(console.log(` v${o} \u2192 v${n}`),t.kind==="dev"){console.log(" running from the Contrast dev checkout \u2014 pull instead of upgrading");return}if(t.kind==="npx"){console.log(" running from the npx cache \u2014 get the latest with:"),console.log(" npx sootsim@latest");return}let e=`${t.command} ${t.args.join(" ")}`;console.log(` updating global install (${e})\u2026`),await S(t.command,t.args)?console.log(` updated to v${n}`):(console.log(" update failed \u2014 run it yourself:"),console.log(` ${e}`))}function S(o,n){return new Promise(t=>{let e=y(o,n,{stdio:"inherit"});e.on("error",()=>t(!1)),e.on("exit",l=>t(l===0))})}async function C(){try{let o=await fetch(b,{headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});if(!o.ok)return null;let n=await o.json();return typeof n.version=="string"&&n.version?n.version:null}catch{return null}}export{W as runUpgrade};
@@ -0,0 +1,4 @@
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import { createRequire as __sootsimCreateRequire } from 'node:module'
3
+ var require = __sootsimCreateRequire(import.meta.url)
4
+ import{e as a,f as b,g as c}from"./chunk-NOLQ4UEP.js";import"./chunk-HTR4DSA5.js";import"./chunk-6SIWYEK5.js";import"./chunk-G73JPCHX.js";import"./chunk-NQ56D5JF.js";import"./chunk-7RZYUZEK.js";import"./chunk-MCGRZYAP.js";import"./chunk-HMW7QKJV.js";import"./chunk-UTE2W4WC.js";import"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
@@ -1,6 +1,6 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{b as a}from"./chunk-VKBCGFOU.js";import"./chunk-TRV5K6D2.js";import{d as r,f as e}from"./chunk-SWBTXTEO.js";import{a as m}from"./chunk-4Q42Y64Y.js";import{l as s}from"./chunk-EBCXFB3K.js";import{a as l}from"./chunk-CWDEDUOZ.js";import"./chunk-LOF3WUKB.js";import g from"node:fs";import d from"node:path";async function V($){let{IS_BETA:c,BETA_LABEL:u}=await import("./beta-4NRMM37T.js"),f=c?` \xB7 ${u}`:"";console.log(`sootsim v${l()}${f}`);let o=m(),i=e.resolveChannel();o.isDevBridge?(console.log(o.primary),o.installedRuntime&&console.log(`${o.installedRuntime} \xB7 ${i}`)):o.primary==="runtime not installed"?console.log("runtime not installed \u2014 run `sootsim runtime install`"):console.log(`${o.primary} \xB7 ${i}`);let{config:n}=await a();if(n?.runtimeVersion){let p=g.existsSync(d.join(s(n.runtimeVersion),"index.html"));console.log(`project runtime v${n.runtimeVersion} \xB7 configured \xB7 ${p?"installed":"installs on open"}`)}let t=await e.checkUpToDate({channel:i});t.outdated&&t.latest&&console.log(`
4
+ import{b as a}from"./chunk-UAYFVJ7N.js";import"./chunk-7RZYUZEK.js";import{d as r,f as e}from"./chunk-LOXCEKKF.js";import{a as m}from"./chunk-C6TKPNCZ.js";import{l as s}from"./chunk-VTPICQDM.js";import{a as l}from"./chunk-TCB56ABT.js";import"./chunk-2UC72ZR6.js";import g from"node:fs";import d from"node:path";async function V($){let{IS_BETA:c,BETA_LABEL:u}=await import("./beta-YPZFX3DF.js"),f=c?` \xB7 ${u}`:"";console.log(`sootsim v${l()}${f}`);let o=m(),i=e.resolveChannel();o.isDevBridge?(console.log(o.primary),o.installedRuntime&&console.log(`${o.installedRuntime} \xB7 ${i}`)):o.primary==="runtime not installed"?console.log("runtime not installed \u2014 run `sootsim runtime install`"):console.log(`${o.primary} \xB7 ${i}`);let{config:n}=await a();if(n?.runtimeVersion){let p=g.existsSync(d.join(s(n.runtimeVersion),"index.html"));console.log(`project runtime v${n.runtimeVersion} \xB7 configured \xB7 ${p?"installed":"installs on open"}`)}let t=await e.checkUpToDate({channel:i});t.outdated&&t.latest&&console.log(`
5
5
  \u2191 default runtime v${t.latest} available; run \`sootsim upgrade\``),console.log(`
6
6
  what's new: ${r}`)}export{V as runVersion};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-KVOY4Z2X.js";import"./chunk-LOF3WUKB.js";export{b as COMPAT_CATEGORIES,j as COMPAT_RESULT_CAVEAT,c as POLYFILL_REGISTRY,a as UNSUPPORTABLE,f as countScanResults,i as formatDetailedScanLines,h as formatPackageStatus,g as formatScanCounts,d as scanDeps,e as scanDepsWithData};
4
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-NH2KYSY7.js";import"./chunk-2UC72ZR6.js";export{b as COMPAT_CATEGORIES,j as COMPAT_RESULT_CAVEAT,c as POLYFILL_REGISTRY,a as UNSUPPORTABLE,f as countScanResults,i as formatDetailedScanLines,h as formatPackageStatus,g as formatScanCounts,d as scanDeps,e as scanDepsWithData};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{D as N,E as F,G as y,R as T,S as b,T as S}from"./chunk-R6MBDR56.js";import{h as A,j as _}from"./chunk-NNR3BU5O.js";import"./chunk-OCRL2VU4.js";import{c as k}from"./chunk-WIRBJTTU.js";import"./chunk-EBCXFB3K.js";import"./chunk-LOF3WUKB.js";function O(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--since"&&e+1<n.length){t.push(e,e+1);let s=n[e+1].trim(),l=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(s);if(l){let r=Number(l[1]),u=l[2]??"ms",v=u==="s"?r*1e3:u==="m"?r*6e4:r;return{since:Date.now()-v,consumed:t}}let i=Number(s);if(Number.isFinite(i)&&i>1e12)return{since:i,consumed:t}}return{consumed:t}}function B(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--kinds"&&e+1<n.length)return t.push(e,e+1),{kinds:n[e+1].split(",").map(s=>s.trim()).filter(Boolean),consumed:t};return{consumed:t}}function D(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--limit"&&e+1<n.length){t.push(e,e+1);let s=Number(n[e+1]);if(Number.isFinite(s)&&s>0)return{limit:s,consumed:t}}return{consumed:t}}function x(n){let t=[],e={label:"initial state",events:[],startedAt:n[0]?.t??null};t.push(e);for(let s of n)if(e.events.push(s),s.kind==="screen"||s.kind==="route"){let l=s.data,i=l?.phase;if(!i||i==="enter"||i==="appear"||i==="active"){let r=l?.name||l?.activeName||l?.path||l?.pathname||s.kind;t.length===1&&e.events.length===1?e.label=`${s.kind}: ${r}`:(e={label:`${s.kind}: ${r}`,events:[],startedAt:s.t},t.push(e))}}return t}async function J(n,t){let e=A(n,{port:t.port,stripBooleanFlags:["--summary","--all","--json","--no-advance","--help","-h","--flow","--noisy"],stripValueFlags:["--since","--kinds","--limit"]});(n.includes("--help")||n.includes("-h"))&&(console.log(`
4
+ import{D as N,E as F,G as y,R as T,S as b,T as S}from"./chunk-4735ZG3S.js";import{h as A,j as _}from"./chunk-MCGRZYAP.js";import{f as k}from"./chunk-B3CXF3EF.js";import"./chunk-YBO7SFWN.js";import"./chunk-VTPICQDM.js";import"./chunk-2UC72ZR6.js";function O(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--since"&&e+1<n.length){t.push(e,e+1);let s=n[e+1].trim(),l=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(s);if(l){let r=Number(l[1]),u=l[2]??"ms",v=u==="s"?r*1e3:u==="m"?r*6e4:r;return{since:Date.now()-v,consumed:t}}let i=Number(s);if(Number.isFinite(i)&&i>1e12)return{since:i,consumed:t}}return{consumed:t}}function B(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--kinds"&&e+1<n.length)return t.push(e,e+1),{kinds:n[e+1].split(",").map(s=>s.trim()).filter(Boolean),consumed:t};return{consumed:t}}function D(n){let t=[];for(let e=0;e<n.length;e++)if(n[e]==="--limit"&&e+1<n.length){t.push(e,e+1);let s=Number(n[e+1]);if(Number.isFinite(s)&&s>0)return{limit:s,consumed:t}}return{consumed:t}}function x(n){let t=[],e={label:"initial state",events:[],startedAt:n[0]?.t??null};t.push(e);for(let s of n)if(e.events.push(s),s.kind==="screen"||s.kind==="route"){let l=s.data,i=l?.phase;if(!i||i==="enter"||i==="appear"||i==="active"){let r=l?.name||l?.activeName||l?.path||l?.pathname||s.kind;t.length===1&&e.events.length===1?e.label=`${s.kind}: ${r}`:(e={label:`${s.kind}: ${r}`,events:[],startedAt:s.t},t.push(e))}}return t}async function J(n,t){let e=A(n,{port:t.port,stripBooleanFlags:["--summary","--all","--json","--no-advance","--help","-h","--flow","--noisy"],stripValueFlags:["--since","--kinds","--limit"]});(n.includes("--help")||n.includes("-h"))&&(console.log(`
5
5
  sootsim what-happened \u2014 show recent events from the semantic timeline
6
6
 
7
7
  usage:
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -36,15 +36,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
36
36
  var optional_demo_registry_exports = {};
37
37
  __export(optional_demo_registry_exports, {
38
38
  __withOptionalDemoAppsForTests: () => __withOptionalDemoAppsForTests,
39
+ findInternalDemoRegistry: () => findInternalDemoRegistry,
39
40
  loadOptionalDemoApps: () => loadOptionalDemoApps,
40
41
  optionalDemoAppsSync: () => optionalDemoAppsSync
41
42
  });
43
+ function findInternalDemoRegistry(startDir) {
44
+ let dir = startDir;
45
+ for (let step = 0; step < MAX_ANCESTOR_STEPS; step++) {
46
+ if ((0, import_node_path2.basename)(dir) === "node_modules") return null;
47
+ const candidate = (0, import_node_path2.join)(dir, REGISTRY_REPO_PATH);
48
+ if ((0, import_node_fs.existsSync)(candidate)) return candidate;
49
+ const parent = (0, import_node_path2.dirname)(dir);
50
+ if (parent === dir) return null;
51
+ dir = parent;
52
+ }
53
+ return null;
54
+ }
42
55
  async function loadOptionalDemoApps() {
43
56
  if (cached) return cached;
57
+ const registryPath = findInternalDemoRegistry((0, import_node_path2.dirname)((0, import_node_url.fileURLToPath)(__sootsim_import_meta_url)));
58
+ if (!registryPath) {
59
+ cached = [];
60
+ return cached;
61
+ }
44
62
  try {
45
63
  const mod = await import(
46
64
  /* @vite-ignore */
47
- REGISTRY_SPECIFIER
65
+ (0, import_node_url.pathToFileURL)(registryPath).href
48
66
  );
49
67
  cached = Array.isArray(mod.APPS) ? mod.APPS : [];
50
68
  } catch {
@@ -64,11 +82,15 @@ function __withOptionalDemoAppsForTests(apps) {
64
82
  }
65
83
  };
66
84
  }
67
- var REGISTRY_SPECIFIER, cached;
85
+ var import_node_fs, import_node_path2, import_node_url, REGISTRY_REPO_PATH, MAX_ANCESTOR_STEPS, cached;
68
86
  var init_optional_demo_registry = __esm({
69
87
  "scripts/optional-demo-registry.ts"() {
70
88
  "use strict";
71
- REGISTRY_SPECIFIER = "./demo-app-registry.ts";
89
+ import_node_fs = require("node:fs");
90
+ import_node_path2 = require("node:path");
91
+ import_node_url = require("node:url");
92
+ REGISTRY_REPO_PATH = "packages/sootsim/scripts/demo-app-registry.ts";
93
+ MAX_ANCESTOR_STEPS = 8;
72
94
  cached = null;
73
95
  }
74
96
  });
@@ -104,8 +126,8 @@ __export(attached_projects_exports, {
104
126
  });
105
127
  module.exports = __toCommonJS(attached_projects_exports);
106
128
  var import_node_crypto = require("node:crypto");
107
- var import_node_fs = __toESM(require("node:fs"), 1);
108
- var import_node_path2 = __toESM(require("node:path"), 1);
129
+ var import_node_fs2 = __toESM(require("node:fs"), 1);
130
+ var import_node_path3 = __toESM(require("node:path"), 1);
109
131
 
110
132
  // src/home-paths.ts
111
133
  var import_node_os = require("node:os");
@@ -140,7 +162,7 @@ function getUserDataDir() {
140
162
  return userDataDir();
141
163
  }
142
164
  function storeFile() {
143
- return import_node_path2.default.join(userDataDir(), "attached-projects.json");
165
+ return import_node_path3.default.join(userDataDir(), "attached-projects.json");
144
166
  }
145
167
  function cloneEmpty() {
146
168
  return {
@@ -154,7 +176,7 @@ function loadStore() {
154
176
  const file = storeFile();
155
177
  let raw;
156
178
  try {
157
- raw = import_node_fs.default.readFileSync(file, "utf8");
179
+ raw = import_node_fs2.default.readFileSync(file, "utf8");
158
180
  } catch (err) {
159
181
  if (err.code === "ENOENT") return cloneEmpty();
160
182
  throw err;
@@ -171,7 +193,7 @@ function loadStore() {
171
193
  } catch (err) {
172
194
  const quarantine = `${file}.corrupt-${Date.now()}`;
173
195
  try {
174
- import_node_fs.default.renameSync(file, quarantine);
196
+ import_node_fs2.default.renameSync(file, quarantine);
175
197
  console.warn(
176
198
  `[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
177
199
  );
@@ -182,16 +204,16 @@ function loadStore() {
182
204
  }
183
205
  function writeStore(store) {
184
206
  const file = storeFile();
185
- import_node_fs.default.mkdirSync(import_node_path2.default.dirname(file), { recursive: true });
207
+ import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(file), { recursive: true });
186
208
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
187
- const fd = import_node_fs.default.openSync(tmp, "w", 384);
209
+ const fd = import_node_fs2.default.openSync(tmp, "w", 384);
188
210
  try {
189
- import_node_fs.default.writeFileSync(fd, JSON.stringify(store, null, 2));
190
- import_node_fs.default.fsyncSync(fd);
211
+ import_node_fs2.default.writeFileSync(fd, JSON.stringify(store, null, 2));
212
+ import_node_fs2.default.fsyncSync(fd);
191
213
  } finally {
192
- import_node_fs.default.closeSync(fd);
214
+ import_node_fs2.default.closeSync(fd);
193
215
  }
194
- import_node_fs.default.renameSync(tmp, file);
216
+ import_node_fs2.default.renameSync(tmp, file);
195
217
  }
196
218
  function mutateStore(fn) {
197
219
  const store = loadStore();
@@ -200,7 +222,7 @@ function mutateStore(fn) {
200
222
  return store;
201
223
  }
202
224
  function projectIdForCwd(cwd) {
203
- return (0, import_node_crypto.createHash)("sha256").update(import_node_path2.default.resolve(cwd)).digest("hex").slice(0, 16);
225
+ return (0, import_node_crypto.createHash)("sha256").update(import_node_path3.default.resolve(cwd)).digest("hex").slice(0, 16);
204
226
  }
205
227
  function newSessionId() {
206
228
  return `s_${(0, import_node_crypto.randomBytes)(10).toString("hex")}`;
@@ -209,7 +231,7 @@ function newPreviewId() {
209
231
  return `pa_${(0, import_node_crypto.randomBytes)(10).toString("hex")}`;
210
232
  }
211
233
  function upsertProject(input) {
212
- const cwd = import_node_path2.default.resolve(input.cwd);
234
+ const cwd = import_node_path3.default.resolve(input.cwd);
213
235
  const id = projectIdForCwd(cwd);
214
236
  let result;
215
237
  mutateStore((store) => {
@@ -235,7 +257,7 @@ function upsertProject(input) {
235
257
  const now = Date.now();
236
258
  const created = {
237
259
  id,
238
- name: input.name ?? import_node_path2.default.basename(cwd),
260
+ name: input.name ?? import_node_path3.default.basename(cwd),
239
261
  cwd,
240
262
  repoRoot: input.repoRoot,
241
263
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -262,7 +284,7 @@ function findProjectById(id) {
262
284
  return loadStore().attachedProjects.find((p) => p.id === id) ?? null;
263
285
  }
264
286
  function findProjectByCwd(cwd) {
265
- const resolved = import_node_path2.default.resolve(cwd);
287
+ const resolved = import_node_path3.default.resolve(cwd);
266
288
  return loadStore().attachedProjects.find((p) => p.cwd === resolved) ?? null;
267
289
  }
268
290
  function findProjectByBundleUrl(bundleUrl) {
@@ -452,8 +474,8 @@ async function seedFromDemoAppRegistry() {
452
474
  if (apps.length === 0) return;
453
475
  mutateStore((store) => {
454
476
  for (const app of apps) {
455
- if (!import_node_fs.default.existsSync(app.dir)) continue;
456
- const cwd = import_node_path2.default.resolve(app.dir);
477
+ if (!import_node_fs2.default.existsSync(app.dir)) continue;
478
+ const cwd = import_node_path3.default.resolve(app.dir);
457
479
  const id = projectIdForCwd(cwd);
458
480
  if (store.attachedProjects.some((p) => p.id === id)) continue;
459
481
  const now = Date.now();
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.305 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.306 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/beta.ts
4
4
  var IS_BETA = true;