sootsim 0.1.40 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +15 -15
  2. package/dist-cli/bin.js +4 -4
  3. package/dist-cli/chunks/{agent-3F5PO4NL.js → agent-4BBZUWD2.js} +2 -2
  4. package/dist-cli/chunks/{agent-wrapper-LVUUZRWL.js → agent-wrapper-TA5GG3MV.js} +2 -2
  5. package/dist-cli/chunks/{assert-4WMVS3WU.js → assert-7GHUOGLI.js} +2 -2
  6. package/dist-cli/chunks/auto-bootstrap-7BJDOYUU.js +2 -0
  7. package/dist-cli/chunks/beta-2LIEPFEJ.js +2 -0
  8. package/dist-cli/chunks/{chunk-QUULF2II.js → chunk-2GKZS2ZZ.js} +2 -2
  9. package/dist-cli/chunks/chunk-2XCCV7J3.js +2 -0
  10. package/dist-cli/chunks/{chunk-CCZHRBXJ.js → chunk-3PN6HIAM.js} +1 -1
  11. package/dist-cli/chunks/{chunk-W2XRHDQQ.js → chunk-4574AJAK.js} +2 -2
  12. package/dist-cli/chunks/chunk-543BSGQG.js +4 -0
  13. package/dist-cli/chunks/{chunk-FNIL6BYS.js → chunk-5EBERDK7.js} +1 -1
  14. package/dist-cli/chunks/{chunk-KGVH3YAG.js → chunk-5PZPKGUJ.js} +2 -2
  15. package/dist-cli/chunks/{chunk-QMBYRPRK.js → chunk-5TRJK5SO.js} +1 -1
  16. package/dist-cli/chunks/chunk-64AKKWVB.js +1 -0
  17. package/dist-cli/chunks/{chunk-YKEBL6GE.js → chunk-6MYXKMLG.js} +1 -1
  18. package/dist-cli/chunks/{chunk-WZE6T3GT.js → chunk-6R3CVNXC.js} +1 -1
  19. package/dist-cli/chunks/chunk-76WF7UIG.js +17 -0
  20. package/dist-cli/chunks/chunk-A2R42ONP.js +27 -0
  21. package/dist-cli/chunks/{chunk-LXR5EI74.js → chunk-BBRAYGDX.js} +2 -2
  22. package/dist-cli/chunks/{chunk-MLCBIX7O.js → chunk-BVCZIJ2X.js} +2 -2
  23. package/dist-cli/chunks/chunk-BZFKV7CT.js +56 -0
  24. package/dist-cli/chunks/{chunk-YJMXGTP4.js → chunk-CZZDYQBA.js} +1 -1
  25. package/dist-cli/chunks/{chunk-Y66CDFAT.js → chunk-D5TKAFJ3.js} +1 -1
  26. package/dist-cli/chunks/{chunk-OV5TY7M3.js → chunk-DNSKIJSB.js} +2 -2
  27. package/dist-cli/chunks/{chunk-EOWN4ZFJ.js → chunk-DUVJOJTP.js} +2 -2
  28. package/dist-cli/chunks/{chunk-6XI4VHIL.js → chunk-DXQKMDX2.js} +2 -2
  29. package/dist-cli/chunks/{chunk-Z3I2I4IO.js → chunk-EDXBJUHH.js} +3 -3
  30. package/dist-cli/chunks/chunk-EZGUKWD5.js +1 -0
  31. package/dist-cli/chunks/{chunk-DSTHAISO.js → chunk-FDB3P2GV.js} +1 -1
  32. package/dist-cli/chunks/{chunk-LCES5ZJI.js → chunk-I4LBW6ED.js} +2 -2
  33. package/dist-cli/chunks/chunk-IFY75LQ3.js +1 -0
  34. package/dist-cli/chunks/{chunk-553OZX4H.js → chunk-ITQGNQE3.js} +2 -2
  35. package/dist-cli/chunks/{chunk-5GK4YX7O.js → chunk-J6HT2ZJW.js} +1 -1
  36. package/dist-cli/chunks/{chunk-TK2IPNHL.js → chunk-KQN7OUQ6.js} +2 -2
  37. package/dist-cli/chunks/{chunk-Y5CFIRLN.js → chunk-L53QRCQZ.js} +1 -1
  38. package/dist-cli/chunks/{chunk-KVOMVYG6.js → chunk-LAOTVMTO.js} +2 -2
  39. package/dist-cli/chunks/chunk-LJLRHMLK.js +1 -0
  40. package/dist-cli/chunks/{chunk-WQXG4I5N.js → chunk-LXZK2TIS.js} +2 -2
  41. package/dist-cli/chunks/{chunk-6X5NQJT7.js → chunk-MQOJIYEY.js} +20 -20
  42. package/dist-cli/chunks/chunk-NLYIKZIF.js +62 -0
  43. package/dist-cli/chunks/{chunk-WPS3TIOB.js → chunk-Q26NNL4G.js} +1 -1
  44. package/dist-cli/chunks/chunk-QLGR4M5H.js +11 -0
  45. package/dist-cli/chunks/{chunk-U3JD6X75.js → chunk-QWGMNIWG.js} +2 -2
  46. package/dist-cli/chunks/chunk-R3KU3IBN.js +117 -0
  47. package/dist-cli/chunks/{chunk-5IAIIX7B.js → chunk-SGBD3EAX.js} +3 -3
  48. package/dist-cli/chunks/{chunk-DEBXVPIE.js → chunk-UY6HKNEV.js} +1 -1
  49. package/dist-cli/chunks/{chunk-4L45Q3YX.js → chunk-WSISSPE3.js} +2 -2
  50. package/dist-cli/chunks/{chunk-PKB6IEGM.js → chunk-WW4G4D4A.js} +2 -2
  51. package/dist-cli/chunks/{chunk-BZED27B2.js → chunk-Y4ENWAOJ.js} +2 -2
  52. package/dist-cli/chunks/{compat-NBFWHK5S.js → compat-GWIATWPP.js} +5 -5
  53. package/dist-cli/chunks/{config-JEDQ3NHA.js → config-OXHJXY6N.js} +2 -2
  54. package/dist-cli/chunks/control-HJ2RPHYO.js +2 -0
  55. package/dist-cli/chunks/cpu-profile-MBYPGUJH.js +2 -0
  56. package/dist-cli/chunks/{daemon-HOL7J3BI.js → daemon-3N3QWMFU.js} +2 -2
  57. package/dist-cli/chunks/{debug-LNVMIWD6.js → debug-POCRM56I.js} +3 -3
  58. package/dist-cli/chunks/demo-app-registry-XABEINTD.js +2 -0
  59. package/dist-cli/chunks/{detox-EEZPH3DZ.js → detox-4NXKQ2CS.js} +2 -2
  60. package/dist-cli/chunks/{device-GVLYQI7X.js → device-DURJHKK5.js} +2 -2
  61. package/dist-cli/chunks/diagnose-IMXDGRVA.js +41 -0
  62. package/dist-cli/chunks/drivers-VXSNI7K2.js +2 -0
  63. package/dist-cli/chunks/{electron-UDV6K3IH.js → electron-NGWA52N6.js} +3 -3
  64. package/dist-cli/chunks/flow-TCG5XPDK.js +2 -0
  65. package/dist-cli/chunks/{hints-46PJLATZ.js → hints-5UNZ7BR2.js} +2 -2
  66. package/dist-cli/chunks/{home-paths-XD7AOYU7.js → home-paths-TENEFM4L.js} +2 -2
  67. package/dist-cli/chunks/{inspect-EDIKZ6O2.js → inspect-IWMH6MUT.js} +94 -92
  68. package/dist-cli/chunks/install-IKBAY4PQ.js +2 -0
  69. package/dist-cli/chunks/{install-desktop-CX6ATQTR.js → install-desktop-ABAWCLFJ.js} +3 -3
  70. package/dist-cli/chunks/{keys-CXQIYEVW.js → keys-NET26VLH.js} +2 -2
  71. package/dist-cli/chunks/{launch-DCFRKVD3.js → launch-TKIA4RC4.js} +3 -3
  72. package/dist-cli/chunks/{login-HCIZL5GT.js → login-AWT3GU5M.js} +4 -4
  73. package/dist-cli/chunks/{logout-7X2YHJY3.js → logout-R2RUNXHO.js} +2 -2
  74. package/dist-cli/chunks/{maestro-TY622MIW.js → maestro-552237HC.js} +2 -2
  75. package/dist-cli/chunks/{preview-DYI6ESOK.js → preview-GKIGPZUO.js} +2 -2
  76. package/dist-cli/chunks/{profile-7SXJEJTG.js → profile-U64JPCPD.js} +2 -2
  77. package/dist-cli/chunks/{react-VGSDY766.js → react-FWSV5JH2.js} +2 -2
  78. package/dist-cli/chunks/record-FLWDPJIP.js +7 -0
  79. package/dist-cli/chunks/runtime-AGNC2TK6.js +2 -0
  80. package/dist-cli/chunks/{runtime-delivery-PWLODFCY.js → runtime-delivery-22PV7UED.js} +2 -2
  81. package/dist-cli/chunks/{screenshot-PTKY4UU4.js → screenshot-4P3TL7CN.js} +2 -2
  82. package/dist-cli/chunks/{screenshot-mode-HSV7VY4G.js → screenshot-mode-GX3Q3IZ6.js} +2 -2
  83. package/dist-cli/chunks/{screenshots-VY7VAGSV.js → screenshots-5HSLPDWZ.js} +2 -2
  84. package/dist-cli/chunks/server-Q3ZD4BEF.js +35 -0
  85. package/dist-cli/chunks/setup-repo-NQVN5PK7.js +2 -0
  86. package/dist-cli/chunks/{skills-KEPQLCMR.js → skills-M2CWX5ZC.js} +2 -2
  87. package/dist-cli/chunks/{start-5CJTBNRM.js → start-24EAF2KS.js} +4 -4
  88. package/dist-cli/chunks/store-GI3SJOKH.js +2 -0
  89. package/dist-cli/chunks/telemetry-73Z4FAUH.js +2 -0
  90. package/dist-cli/chunks/{test-REKHGKFE.js → test-AJBULIVR.js} +3 -3
  91. package/dist-cli/chunks/{three-mode-FZYHB4ZQ.js → three-mode-JBZSQQIQ.js} +2 -2
  92. package/dist-cli/chunks/{timeline-CWZAY52K.js → timeline-VVGWQSVU.js} +2 -2
  93. package/dist-cli/chunks/{upgrade-AIUJEF5F.js → upgrade-IOGHQT7J.js} +2 -2
  94. package/dist-cli/chunks/upload-Z4PPGOX6.js +2 -0
  95. package/dist-cli/chunks/web-XIMVN6KZ.js +2 -0
  96. package/dist-cli/chunks/{what-happened-JSQQVQGE.js → what-happened-STVD3KZ2.js} +2 -2
  97. package/dist-cli/chunks/whoami-L62IGS4U.js +2 -0
  98. package/dist-lib/agent-daemon-client.cjs +1 -1
  99. package/dist-lib/agent-events.cjs +1 -1
  100. package/dist-lib/agent-sessions.cjs +1 -1
  101. package/dist-lib/attached-projects.cjs +1 -1
  102. package/dist-lib/auth/shared-session.cjs +1 -1
  103. package/dist-lib/backend-origin.cjs +1 -1
  104. package/dist-lib/bridge-constants.cjs +1 -1
  105. package/dist-lib/cli-constants.cjs +1 -1
  106. package/dist-lib/config.cjs +1 -1
  107. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  108. package/dist-lib/home-paths.cjs +1 -1
  109. package/dist-lib/host/bridge-host.cjs +14 -8
  110. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  111. package/dist-lib/index.cjs +1 -1
  112. package/dist-lib/metro.cjs +1 -1
  113. package/dist-lib/profiles.cjs +1 -1
  114. package/dist-lib/render-mode.cjs +1 -1
  115. package/dist-lib/vite-base.cjs +14 -8
  116. package/dist-lib/vite.cjs +1 -1
  117. package/package.json +1 -1
  118. package/dist-cli/chunks/auto-bootstrap-Q4A3PTF5.js +0 -2
  119. package/dist-cli/chunks/beta-CLLKUB5X.js +0 -2
  120. package/dist-cli/chunks/chunk-4IAKB3C4.js +0 -117
  121. package/dist-cli/chunks/chunk-CAJ247SC.js +0 -2
  122. package/dist-cli/chunks/chunk-D2ZMP7G4.js +0 -61
  123. package/dist-cli/chunks/chunk-D4Z7MWQY.js +0 -11
  124. package/dist-cli/chunks/chunk-DHJIXXWG.js +0 -27
  125. package/dist-cli/chunks/chunk-DPZDTJVQ.js +0 -1
  126. package/dist-cli/chunks/chunk-FFR7EA4U.js +0 -1
  127. package/dist-cli/chunks/chunk-I7KXFJDK.js +0 -1
  128. package/dist-cli/chunks/chunk-J6BPROH4.js +0 -4
  129. package/dist-cli/chunks/chunk-PNGBWMQH.js +0 -17
  130. package/dist-cli/chunks/chunk-S4PJMUC7.js +0 -2
  131. package/dist-cli/chunks/chunk-XWXFUFB2.js +0 -1
  132. package/dist-cli/chunks/control-IMWZVYC3.js +0 -2
  133. package/dist-cli/chunks/cpu-profile-MQPUSRHG.js +0 -22
  134. package/dist-cli/chunks/demo-app-registry-4RFMJ4FM.js +0 -2
  135. package/dist-cli/chunks/diagnose-JQ7DPTSL.js +0 -41
  136. package/dist-cli/chunks/drivers-JUW6JBWH.js +0 -2
  137. package/dist-cli/chunks/flow-JOW23WNH.js +0 -2
  138. package/dist-cli/chunks/install-CCC3IF5S.js +0 -2
  139. package/dist-cli/chunks/record-7JX2SMVP.js +0 -37
  140. package/dist-cli/chunks/runtime-FTOQD7QK.js +0 -2
  141. package/dist-cli/chunks/server-EDB3EK4K.js +0 -35
  142. package/dist-cli/chunks/setup-repo-S2GFZR7F.js +0 -2
  143. package/dist-cli/chunks/store-SCRULNVS.js +0 -2
  144. package/dist-cli/chunks/telemetry-RC3OT67I.js +0 -2
  145. package/dist-cli/chunks/upload-UDA5ITTE.js +0 -2
  146. package/dist-cli/chunks/whoami-5WUUPIRN.js +0 -2
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-LCES5ZJI.js";import"./chunk-DEBXVPIE.js";export{a as APPS};
@@ -1,41 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{c as v,e as R,h as b}from"./chunk-PNGBWMQH.js";import{b as $}from"./chunk-Y66CDFAT.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";function j(e){return e.ts??e.t??0}function F(e){return typeof e.message=="string"&&e.message.length>0?e.message:Array.isArray(e.args)?e.args.map(s=>typeof s=="string"?s:JSON.stringify(s)).join(" "):""}var W=new Set(["timeline","network","react","console","screen"]);function A(){console.log(`
3
- sootsim diagnose \u2014 compact "what just went wrong?" report
4
-
5
- usage:
6
- sootsim diagnose recent [--since <duration>] [--include <csv>] [--json]
7
-
8
- options:
9
- --since <d> absolute window for timeline + network (e.g. 90s, 2m, 500ms; default 90s)
10
- --include <csv> comma-separated dimensions: timeline, network, react, console, screen
11
- (default: all)
12
- --slow-threshold <n> network slow-request threshold in ms (default 1000)
13
- --limit <n> rows to print per react table (default 8)
14
- --json emit a single structured JSON document
15
-
16
- the diagnose report runs every dimension in parallel against the same
17
- sim and returns a grouped summary. use \`sootsim what-happened\`
18
- for chronological events, \`sootsim network\` for full request inspection,
19
- \`sootsim react summary\` for the React tables on their own.
20
-
21
- examples:
22
- sootsim diagnose recent
23
- sootsim diagnose recent --since 30s --include network,react
24
- sootsim diagnose recent --json > /tmp/diagnose.json
25
- `)}function D(e,s){if(!e)return s;let o=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(e.trim());if(!o)return s;let r=Number(o[1]),t=o[2]??"ms";return t==="s"?r*1e3:t==="m"?r*6e4:r}function O(e){if(!e)return W;let s=new Set;for(let o of e.split(",")){let r=o.trim().toLowerCase();r&&s.add(r)}return s}function k(e,s){let o=e.indexOf(s);if(o>=0&&o+1<e.length)return e[o+1];let r=`${s}=`;return e.find(t=>t.startsWith(r))?.slice(r.length)}function E(e,s,o){let r=k(e,s);if(r===void 0)return o;let t=Number(r);return Number.isFinite(t)&&t>0?Math.round(t):o}async function P(e,s){let o={limit:500,since:Date.now()-s},t=(await b(e,"SootSim.bridges.timeline.recent",o)).events??[],i={},c=[],m=[],p=[];for(let u of t){i[u.kind]=(i[u.kind]??0)+1;let l=u.data,g=l&&typeof l=="object"?l.level:void 0;u.kind==="console"&&(g==="error"||g==="warn")&&c.push(u),(u.kind==="alert"||u.kind==="actionsheet"||u.kind==="picker")&&m.push(u),(u.kind==="screen"||u.kind==="route")&&p.push(u)}return{events:t,byKind:i,total:t.length,errors:c,alerts:m,screens:p}}async function B(e,s,o){let r=await e.send({type:"evaluate",code:`(() => {
26
- const obs = window.__sootsimObservability;
27
- if (!obs) return { ok: false };
28
- return { ok: true, entries: obs.network.getSnapshot() };
29
- })()`});if(!r||!r.ok)return{error:"observability bridge not installed"};let t=r.entries??[],i=Date.now()-s,c=t.filter(l=>(l.startTs??l.startedAt??0)>=i),m=c.filter(l=>!!l.error||l.status!=null&&l.status>=400),p=c.filter(l=>l.durationMs!=null&&l.durationMs>=o).sort((l,g)=>(g.durationMs??0)-(l.durationMs??0)),u=c.filter(l=>l.durationMs==null).length;return{total:c.length,failed:m,slow:p,inFlight:u,slowThresholdMs:o}}async function L(e,s){let[o,r]=await Promise.all([b(e,"SootSim.bridges.reactProfile.slow",{limit:s}),b(e,"SootSim.bridges.reactProfile.rerenders",{limit:s})]);return{commits:o.commits??r.commits??0,slow:o.rows??[],rerenders:r.rows??[],durationWarning:o.durationWarning,error:o.error??r.error}}async function C(e,s){let o=await e.send({type:"evaluate",code:`(() => {
30
- const obs = window.__sootsimObservability;
31
- if (!obs) return { ok: false };
32
- return { ok: true, entries: obs.logs.getSnapshot() };
33
- })()`});if(!o||!o.ok)return{error:"observability bridge not installed"};let r=Date.now()-s,i=(o.entries??[]).filter(c=>j(c)>=r&&(c.level==="error"||c.level==="warn"));return{entries:i.slice(-20),total:i.length}}function T(e){let s=e.error?"err":e.status!=null?String(e.status):"...",o=(e.method??"GET").padEnd(6),r=e.durationMs!=null?`${e.durationMs.toFixed(0)}ms`:"...",t=e.displayUrl??e.url,i=t.length>96?`${t.slice(0,92)}\u2026`:t;return` ${s.padStart(3)} ${o} ${r.padStart(7)} ${i} (${e.id})`}function N(e,s){let o=((e.t-s)/1e3).toFixed(2),r=e.t>=s?"-":"+",t=e.data,i="";if(t&&typeof t=="object"){let c=(t.message??"").toString().slice(0,120),m=(t.title??t.name??t.path??t.url??"").toString();i=[(t.phase??"").toString(),m,c].filter(Boolean).join(" \xB7 ")}return` -${o.padStart(5)}s [${e.kind}] ${i}`}function M(e,s,o){if(s.length===0)return`${o}(no rows)`;let r=e.map((i,c)=>Math.max(i.length,...s.map(m=>m[c]?.length??0))),t=i=>i.map((c,m)=>c.padEnd(r[m])).join(" ").trimEnd();return[t(e),t(e.map(i=>"-".repeat(i.length))),...s.map(t)].map(i=>`${o}${i}`).join(`
34
- `)}async function q(e,s){if(e.includes("--help")||e.includes("-h"))return A(),0;let o=v(e,{port:s.port,stripBooleanFlags:["--json","--help","-h"],stripValueFlags:["--since","--include","--limit","--slow-threshold"]}),r=o.positional[0]??"recent";if(r!=="recent")return console.error(` unknown subcommand: ${r}`),console.error(" did you mean: sootsim diagnose recent ?"),1;let t=D(k(e,"--since"),9e4),i=O(k(e,"--include")),c=E(e,"--limit",8),m=E(e,"--slow-threshold",1e3),p=e.includes("--json"),u=R(o);try{let l=[],g=[];(i.has("timeline")||i.has("screen")||i.has("alert"))&&(g.push("timeline"),l.push(P(u,t))),(i.has("network")||i.has("fetch"))&&(g.push("network"),l.push(B(u,t,m))),i.has("react")&&(g.push("react"),l.push(L(u,c))),i.has("console")&&(g.push("console"),l.push(C(u,t)));let x=await Promise.all(l),w={};for(let n=0;n<g.length;n++)w[g[n]]=x[n];if(p)return console.log(JSON.stringify({generatedAt:Date.now(),sinceMs:t,include:Array.from(i),slices:w},null,2)),0;let S=Date.now();if(console.log(` diagnose recent (last ${(t/1e3).toFixed(0)}s, include: ${Array.from(i).sort().join(",")}):`),w.timeline){let n=w.timeline;console.log(`
35
- timeline \u2014 ${n.total} event(s) in window`);let f=Object.entries(n.byKind).sort((a,d)=>d[1]-a[1]).map(([a,d])=>`${d} ${a}`).join(" \xB7 ");if(f&&console.log(` summary: ${f}`),n.screens.length){let d=n.screens[n.screens.length-1].data,h=d?d.name??d.activeName??d.path??"?":"?";console.log(` last screen: ${String(h)}`)}if(n.alerts.length){console.log(` alerts (${n.alerts.length}):`);for(let a of n.alerts.slice(-5))console.log(N(a,S))}if(n.errors.length){console.log(` console errors/warns from timeline (${n.errors.length}):`);for(let a of n.errors.slice(-5))console.log(N(a,S))}}if(w.network){let n=w.network;if("error"in n)console.log(`
36
- network \u2014 ${n.error}`);else{if(console.log(`
37
- network \u2014 ${n.total} request(s), ${n.failed.length} failed, ${n.slow.length} slow (>${n.slowThresholdMs}ms), ${n.inFlight} in-flight`),n.failed.length){console.log(" failed:");for(let f of n.failed.slice(-8))console.log(T(f))}if(n.slow.length){console.log(" slowest:");for(let f of n.slow.slice(0,5))console.log(T(f))}}}if(w.react){let n=w.react;console.log(`
38
- react \u2014 ${n.commits} commit(s)`),n.error&&console.log(` warning: ${n.error}`),n.durationWarning&&console.log(` warning: ${n.durationWarning}`),n.slow.length>0&&n.slow.every(a=>a.totalMs<=0&&a.slowestMs<=0)&&!n.durationWarning&&console.log(" warning: every commit reports actualDuration=0ms \u2014 bundle has React profiler timer disabled"),n.slow.length&&(console.log(" slowest:"),console.log(M(["component","total","commits","slowest"],n.slow.slice(0,c).map(a=>[a.displayName,`${a.totalMs.toFixed(2)}ms`,String(a.commitCount),`${a.slowestMs.toFixed(2)}ms`])," "))),n.rerenders.length&&(console.log(" most rerenders:"),console.log(M(["component","renders","top causes"],n.rerenders.slice(0,c).map(a=>{let d=Object.entries(a.causes??{}).filter(([,h])=>h>0).sort((h,y)=>y[1]-h[1]).slice(0,3).map(([h,y])=>`${h}:${y}`).join(", ");return[a.displayName,String(a.renders??a.count??0),d||"-"]})," ")))}if(w.console){let n=w.console;if("error"in n)console.log(`
39
- console \u2014 ${n.error}`);else{console.log(`
40
- console errors/warns \u2014 ${n.total} in window`);for(let f of n.entries.slice(-8)){let a=((j(f)-S)/1e3).toFixed(2),d=F(f).slice(0,160);console.log(` -${a.padStart(5)}s [${f.level}] ${d}`)}}}return $()&&console.log(`
41
- next: sootsim what-happened (cursor advances) \xB7 sootsim network get <id> \xB7 sootsim react why <fiber-id>`),0}finally{u.close()}}export{q as runDiagnose};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-DPZDTJVQ.js";import{a,b,c,d,e,f,g,h,i}from"./chunk-CAJ247SC.js";import"./chunk-WZE6T3GT.js";import"./chunk-TK2IPNHL.js";import"./chunk-I7KXFJDK.js";import"./chunk-EOWN4ZFJ.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";export{e as ALL_DRIVERS,i as buildDriverListRows,a as chromiumDriver,b as electronDriver,f as getAllDrivers,g as getDriver,c as playwrightDriver,h as resolveDriver,d as systemDriver};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b,c,d}from"./chunk-6X5NQJT7.js";import"./chunk-4L45Q3YX.js";import"./chunk-6XI4VHIL.js";import"./chunk-FFR7EA4U.js";import"./chunk-DHJIXXWG.js";import"./chunk-KGVH3YAG.js";import"./chunk-D4Z7MWQY.js";import"./chunk-CCZHRBXJ.js";import"./chunk-QMBYRPRK.js";import"./chunk-CAJ247SC.js";import"./chunk-WZE6T3GT.js";import"./chunk-TK2IPNHL.js";import"./chunk-LCES5ZJI.js";import"./chunk-LXR5EI74.js";import"./chunk-QUULF2II.js";import"./chunk-I7KXFJDK.js";import"./chunk-EOWN4ZFJ.js";import"./chunk-WQXG4I5N.js";import"./chunk-S4PJMUC7.js";import"./chunk-PKB6IEGM.js";import"./chunk-Y5CFIRLN.js";import"./chunk-PNGBWMQH.js";import"./chunk-Y66CDFAT.js";import"./chunk-W2XRHDQQ.js";import"./chunk-553OZX4H.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";export{b as discoverSootsimUrl,a as parseFlowFile,d as runFlow,c as runFlowPlayback};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as o}from"./chunk-D2ZMP7G4.js";import"./chunk-J6BPROH4.js";import"./chunk-Z3I2I4IO.js";import"./chunk-PNGBWMQH.js";import"./chunk-Y66CDFAT.js";import"./chunk-W2XRHDQQ.js";import"./chunk-553OZX4H.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";async function t(n){console.error(" note: `sootsim install` is now `sootsim setup-repo`. forwarding\u2026\n"),await o(n)}export{t as runInstall};
@@ -1,37 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as z}from"./chunk-DHJIXXWG.js";import"./chunk-QUULF2II.js";import"./chunk-I7KXFJDK.js";import{d as W}from"./chunk-EOWN4ZFJ.js";import{c as R,e as $}from"./chunk-PNGBWMQH.js";import{b as C}from"./chunk-Y66CDFAT.js";import"./chunk-553OZX4H.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";import{existsSync as Z,mkdirSync as _,readFileSync as ee,rmSync as L,writeFileSync as U}from"fs";import{tmpdir as oe}from"os";import{dirname as T,extname as re,join as te,resolve as O}from"path";var D=6e4;async function ve(e,r){if((e.includes("--help")||e.includes("-h"))&&(console.log(`
3
- sootsim record \u2014 capture the running sim
4
-
5
- usage:
6
- sootsim record [options] one-shot capture (duration-bounded)
7
- sootsim record start [options] begin stateful recording
8
- sootsim record stop [--output <path>] finalize stateful recording
9
-
10
- options:
11
- --mode <kind> video | live | combined (default: video)
12
- video \u2014 local webm/mp4 file
13
- live \u2014 pointer events only, uploads /preview/<id>
14
- combined \u2014 events + video, uploads /preview/<id>
15
- --duration <sec> recording duration (default: 10, atomic mode only)
16
- --fps <n> frame rate for video/gif (default: 30)
17
- --format <fmt> webm | mp4 | gif | png (video mode; inferred from --output ext)
18
- --output <path> output file (video/gif) or directory (png frames)
19
- --frames <n> sample N png frames evenly across --duration
20
- --max-width <px> downscale gif frames to this width
21
- --no-shell exclude the simulated iOS chrome (status bar, keyboard,
22
- toasts) \u2014 records the tenant surfaces only
23
- --shell-only record only the shell chrome
24
- --open open the preview URL in the browser after stop (live/combined)
25
- --sim <sim> target a specific sim
26
-
27
- examples:
28
- sootsim record # webm, 10s, ./sootsim-<ts>.webm
29
- sootsim record --format mp4 --duration 5
30
- sootsim record --output demo.gif --duration 3
31
- sootsim record --frames 10 --output ./frames/
32
- sootsim record --mode combined --duration 8 --open
33
- sootsim record start --format mp4 # start video; interact freely
34
- sootsim record start --mode combined # start preview-share recording
35
- sootsim record stop --output flow.mp4 # finalize video
36
- sootsim record stop --open # finalize live/combined + open URL
37
- `),process.exit(0)),e[0]==="start"){await ae(e.slice(1),r);return}if(e[0]==="stop"){await le(e.slice(1),r);return}if(e[0]==="cancel"){await ce(e.slice(1),r);return}if(e[0]==="status"){de();return}let o=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width"]}),t=V(c(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,i=c(e,"--format"),s=c(e,"--output"),a=Number(c(e,"--duration")??"10"),l=Number(c(e,"--fps")??"30"),d=c(e,"--frames"),w=e.includes("--open"),h=c(e,"--max-width")?Number(c(e,"--max-width")):void 0,v=Math.max(100,Math.round(a*1e3));if(await z("record"),t==="live"||t==="combined"){let u=$({...o,commandTimeoutMs:6e4});try{await j(u),await K(u,t)||(console.error(` start failed: recording store refused to start (${t})`),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(y=>setTimeout(y,v)),await G(u);let k=await H(u);Q(k,w)}finally{u.close()}return}let M=d?Number(d):null,S=se(i,s,M),p=$({...o,commandTimeoutMs:6e4});try{if(await J(p),S==="png"){let b=M??10,f=O(process.cwd(),s??`./sootsim-frames-${B()}`);_(f,{recursive:!0}),console.log(` sampling ${b} frames over ${a}s \u2192 ${f}`);let g=await p.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${b}, durationMs: ${v} })`});(!g.ok||!g.requestId)&&(console.error(` frame capture start failed: ${g.error??"unknown error"}`),process.exit(1)),await new Promise(m=>setTimeout(m,v));let X=Date.now()+Math.max(5e3,v),A=null;for(;;){let m=await p.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${g.requestId})`});if(m||(console.error(" frame capture result missing"),process.exit(1)),m.done){m.ok||(console.error(` frame capture failed: ${m.error??"unknown error"}`),process.exit(1)),A=m.frames??[];break}Date.now()>=X&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(E=>setTimeout(E,100))}A.forEach((m,E)=>{let Y=`${f}/frame-${String(E+1).padStart(3,"0")}.png`;U(Y,Buffer.from(m.data,"base64"))}),console.log(` saved ${A.length} frames`);return}if(S==="gif"){let b=M??Math.max(10,Math.round(a*l/3)),f=O(process.cwd(),s??`./sootsim-${B()}.gif`);_(T(f),{recursive:!0}),console.log(` encoding gif: ${b} frames over ${a}s \u2192 ${f}`);let g=await p.send({type:"evaluate",code:`window.__sootsimRecorder.captureGif({ frames: ${b}, durationMs: ${v}${h?`, maxWidth: ${h}`:""} })`});g||(console.error(" gif capture returned no frames"),process.exit(1)),U(f,Buffer.from(g.data,"base64")),console.log(` saved: ${f} (${P(g.size)})`);return}let u=O(process.cwd(),s??`./sootsim-${B()}.${S}`);_(T(u),{recursive:!0});let I={format:S,fps:l};n&&(I.layers=n);let k=await p.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(I)})`});k.ok||(console.error(` start failed: ${k.error??"unknown error"}`),process.exit(1)),console.log(` recording ${S} for ${a}s \u2192 ${u}`),await new Promise(b=>setTimeout(b,v));let y=await p.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});y.ok||(console.error(` stop failed: ${y.error??"unknown error"}`),process.exit(1)),y.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await q(p,u),console.log(` saved: ${u} (${P(y.size)})`)}finally{p.close()}}async function J(e){if(!await e.send({type:"evaluate",code:'typeof window.__sootsimRecorder !== "undefined"'}))throw new Error("window.__sootsimRecorder missing \u2014 is sootsim engine running in this sim?")}async function q(e,r){let o=[],t=0;for(;;){let n=await e.send({type:"evaluate",code:`window.__sootsimRecorder.getBlobBase64({ offset: ${t}, chunk: 2097152 })`});if(!n)throw new Error("no blob available on recorder");if(o.push(Buffer.from(n.data,"base64")),t=n.offset,n.done)break}U(r,Buffer.concat(o))}function c(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function ne(e){if(!e)return;let r=re(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function se(e,r,o){return e||(o!=null?"png":ne(r)??"webm")}function B(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function P(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function V(e){if(!e)return"video";if(e==="video"||e==="live"||e==="combined")return e;console.error(` invalid --mode "${e}" \u2014 expected video | live | combined`),process.exit(1)}function N(){return te(oe(),`sootsim-recording-${C()}.json`)}function F(){let e=N();if(!Z(e))return null;try{return{mode:"video",...JSON.parse(ee(e,"utf8"))}}catch{return L(e,{force:!0}),null}}function ie(e){U(N(),JSON.stringify(e,null,2))}function x(){L(N(),{force:!0})}async function ae(e,r){let o=F();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`sootsim record stop\` first, or \`sootsim record cancel\` to discard.`),process.exit(1)),await z("record");let t=R(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only"],stripValueFlags:["--mode","--fps","--format","--max-width"]}),n=V(c(e,"--mode")),i=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=c(e,"--format"),a=s==="mp4"?"mp4":"webm";s&&a!==s&&(console.error(` record start only supports webm or mp4 (got: ${s}). for gif/png use atomic mode: sootsim record --format ${s} --duration <s>`),process.exit(1));let l=Number(c(e,"--fps")??"30"),d=$({...t,commandTimeoutMs:15e3});try{if(n==="live"||n==="combined")await j(d),await K(d,n)||(console.error(` start failed: recording store refused to start (${n})`),process.exit(1));else{await J(d);let w={format:a,fps:l};i&&(w.layers=i);let h=await d.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(w)})`});h.ok||(console.error(` start failed: ${h.error??"unknown error"}`),process.exit(1))}ie({simId:t.simId??null,mode:n,format:a,fps:l,layers:i,startedAt:new Date().toISOString()}),console.log(n==="video"?` recording ${a} @ ${l}fps${i?` (${i})`:""} \u2014 run \`sootsim record stop --output <path>\` when done`:` recording ${n} \u2014 run \`sootsim record stop\` when done (add --open to launch the preview URL)`)}finally{d.close()}}function de(){let e=F();if(!e){console.log(" no recording in progress");return}e.mode==="video"?console.log(` recording ${e.mode} (${e.format} @ ${e.fps}fps) on sim ${e.simId??"?"} since ${e.startedAt}`):console.log(` recording ${e.mode} on sim ${e.simId??"?"} since ${e.startedAt}`)}async function ce(e,r){let o=F();if(!o){console.log(" no recording in progress");return}let t=R(e,{port:r.port}),n=t.simId??o.simId??void 0,i=$({...t,simId:n,commandTimeoutMs:15e3});try{o.mode==="live"||o.mode==="combined"?await i.send({type:"evaluate",code:"void window.SootSim?.bridges?.cancelRecording?.()"}):await i.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"})}catch{}finally{x(),i.close()}console.log(" recording cancelled")}async function le(e,r){let o=F();o||(console.error(" no recording in progress. start one with `sootsim record start`."),process.exit(1));let t=R(e,{port:r.port,stripBooleanFlags:["--open"],stripValueFlags:["--output"]}),n=t.simId??o.simId??void 0,i=e.includes("--open"),s=$({...t,simId:n,commandTimeoutMs:6e4});try{if(o.mode==="live"||o.mode==="combined"){await G(s);let w=await H(s);x(),Q(w,i);return}let a=c(e,"--output"),l=O(process.cwd(),a??`./sootsim-${B()}.${o.format}`);_(T(l),{recursive:!0});let d=await s.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});d.ok||(console.error(` stop failed: ${d.error??"unknown error"}`),x(),process.exit(1)),d.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),x(),process.exit(1)),await q(s,l),x(),console.log(` saved: ${l} (${P(d.size)})`)}finally{s.close()}}async function j(e){if(!await e.send({type:"evaluate",code:'typeof window.SootSim?.bridges?.startRecording === "function" && typeof window.SootSim?.bridges?.stopRecording === "function"'}))throw new Error("SootSim.bridges.startRecording missing \u2014 is sootsim engine running in this sim?")}async function K(e,r){return await e.send({type:"evaluate",code:`window.SootSim.bridges.startRecording(${JSON.stringify(r)})`})===!0}async function G(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function H(e){let r=Date.now()+D;for(;Date.now()<r;){let o=await e.send({type:"evaluate",code:"(() => { const s = window.SootSim?.bridges?.getRecordingState?.(); return s ? { state: s.state, lastUpload: s.lastUpload, uploadError: s.uploadError } : null })()"});if(o&&o.state==="idle"){if(o.uploadError)return{uploadError:o.uploadError};if(o.lastUpload?.previewUrl)return{previewUrl:o.lastUpload.previewUrl}}await new Promise(t=>setTimeout(t,300))}return{uploadError:`upload did not settle within ${D/1e3}s`}}function Q(e,r){e.uploadError&&(console.error(` upload failed: ${e.uploadError}`),process.exit(1)),e.previewUrl||(console.error(" upload returned no preview URL"),process.exit(1)),console.log(` preview: ${e.previewUrl}`),r&&W(e.previewUrl)}export{ne as extToFormat,se as resolveFormat,ve as runRecord,c as valueOf};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-5IAIIX7B.js";import"./chunk-PNGBWMQH.js";import"./chunk-Y66CDFAT.js";import"./chunk-U3JD6X75.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";export{a as runRuntime};
@@ -1,35 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as X,c as D,d as Z,e as H,f as Q,h as ee,i as w,j as te,k as ie,l as re,p as ne,s as A,t as se,u as oe,v as ae,w as ce}from"./chunk-OV5TY7M3.js";import"./chunk-DSTHAISO.js";import{a as E}from"./chunk-4L45Q3YX.js";import"./chunk-CCZHRBXJ.js";import"./chunk-LCES5ZJI.js";import{d as z}from"./chunk-EOWN4ZFJ.js";import{a as U}from"./chunk-YJMXGTP4.js";import{k as Y}from"./chunk-U3JD6X75.js";import{a as G,b as q}from"./chunk-W2XRHDQQ.js";import"./chunk-553OZX4H.js";import"./chunk-XWXFUFB2.js";import{A as F,B as L,D as j,E as $,F as J,G as K,H as V,I as N,u as _,v as M,y as T,z as W}from"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";import{spawn as Ee}from"child_process";import v from"fs";import{createServer as Ie}from"http";import S from"path";import{WebSocket as m,WebSocketServer as Pe}from"ws";import de from"node:fs";import I from"node:path";var P=1;function Se(){return[Number(process.env.VITE_PORT_WEB||process.env.PORT||3e3),Number(process.env.VITE_PORT_ZERO||7849),Number(process.env.VITE_PORT_POSTGRES||7432),Number(process.env.VITE_PORT_R2||9500)].filter(a=>Number.isFinite(a)&&a>0)}var x=class{subscriptions=new Map;sessionsBySocket=new Map;allSockets=new Set;pendingPromptEchoes=new Map;pendingTurns=new Map;opts;constructor(e={}){this.opts=e}registerSocket(e){this.allSockets.add(e)}unregisterSocket(e){let t=this.sessionsBySocket.get(e);if(t){for(let i of t)this.decrementSubscription(i);this.sessionsBySocket.delete(e)}this.allSockets.delete(e)}async handleMessage(e,t){let i=t?.type;if(typeof i!="string"||!i.startsWith("agent:"))return!1;let s=t.id;try{let n=await this.dispatch(e,i,t);this.respond(e,s,n)}catch(n){n instanceof A?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 re()}catch(e){process.stderr.write(`[sootsim-agent] seedFromDemoAppRegistry failed: ${e instanceof Error?e.message:String(e)}
3
- `)}}close(){for(let e of this.subscriptions.values())try{e.unsubscribe()}catch{}this.subscriptions.clear(),this.sessionsBySocket.clear(),this.allSockets.clear()}async dispatch(e,t,i){switch(t){case"agent:list-projects":return H();case"agent:upsert-project":return D(i.input??{});case"agent:delete-project":return ee(String(i.projectId)),{ok:!0};case"agent:auto-attach-for-url":return this.autoAttachForUrl(i.input??{});case"agent:list-sessions":return te(i.projectId?String(i.projectId):void 0);case"agent:start-session":return this.doStartSession(i.input??{});case"agent:send-prompt":{let n=String(i.sessionId),o=w(n);if(!o)throw new A("NO_SESSION",`no session: ${n}`);let r=this.normalizePromptEnvelope(i);return await oe(n,r),this.notePromptAccepted(n,r,o.status==="working")}case"agent:end-session":this.dropSessionFanout(String(i.sessionId)),await ae(String(i.sessionId));let s=w(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 A("UNKNOWN_AGENT_MSG",`unknown agent message: ${t}`)}}async doStartSession(e){if(!Z(e.projectId))throw new A("NO_PROJECT",`no project: ${e.projectId}`);let i=await se(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?.()??Se(),o=(await E({excludePorts:s})).find(c=>String(c.port)===i);if(!o||!o.cwd)return{project:null};let r=H().find(c=>c.cwd===o.cwd)??null,d=Array.from(new Set([...r?.knownBundleUrls??[],o.bundleUrl,t]));return{project:D({cwd:o.cwd,name:o.projectName??I.basename(o.cwd),preferredProvider:e.provider??r?.preferredProvider,sourceRoots:r?.sourceRoots??[o.cwd],knownBundleUrls:d,framework:r?.framework??ye(o.framework),bundleId:o.bundleId??r?.bundleId})}}getTranscript(e){let t=ne(e);return de.existsSync(t)?de.readFileSync(t,"utf8"):{error:"transcript not found",code:"NO_TRANSCRIPT"}}getPaths(){let e=X();return{userDataDir:e,storeFile:I.join(e,"attached-projects.json"),sessionsDir:I.join(e,"sessions"),transcriptsDir:I.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=ce(t,o=>{let r=this.coalescePromptEcho(t,o);if(r&&(this.applySessionEvent(t,r),this.fanOutEvent(t,r)),o.type==="turn-completed"){let d=w(t);if(d)try{Q(d.projectId,{usd:o.costUsd,ts:o.ts})}catch(l){process.stderr.write(`[sootsim-agent] recordTurnTelemetry failed: ${l instanceof Error?l.message:String(l)}
4
- `)}}});return this.subscriptions.set(t,{unsubscribe:n,refCount:1}),{ok:!0,refCount:1}}unsubscribeSocket(e,t){let i=this.sessionsBySocket.get(e);return!i||!i.has(t)?{ok:!0,refCount:0}:(i.delete(t),this.decrementSubscription(t))}decrementSubscription(e){let t=this.subscriptions.get(e);if(!t)return{ok:!0,refCount:0};if(t.refCount--,t.refCount<=0){try{t.unsubscribe()}catch{}return this.subscriptions.delete(e),{ok:!0,refCount:0}}return{ok:!0,refCount:t.refCount}}dropSessionFanout(e){let t=this.subscriptions.get(e);if(t){try{t.unsubscribe()}catch{}this.subscriptions.delete(e)}for(let i of this.sessionsBySocket.values())i.delete(e);this.clearPromptTracking(e)}normalizePromptEnvelope(e){if(e?.prompt&&typeof e.prompt=="object"){let t=e.prompt;return{text:String(t.text??""),...typeof t.displayText=="string"?{displayText:t.displayText}:{},...typeof t.inspectSummary=="string"?{inspectSummary:t.inspectSummary}:{},...typeof t.inspectTrace=="string"?{inspectTrace:t.inspectTrace}:{}}}return{text:String(e?.text??""),...typeof e?.displayText=="string"?{displayText:e.displayText}:{},...typeof e?.inspectSummary=="string"?{inspectSummary:e.inspectSummary}:{},...typeof e?.inspectTrace=="string"?{inspectTrace:e.inspectTrace}:{}}}notePromptAccepted(e,t,i){let s=Date.now(),n=this.pendingPromptEchoes.get(e)??[];n.push({sentAt:s}),this.pendingPromptEchoes.set(e,n);let o=Math.max(this.pendingTurns.get(e)??0,i?1:0)+1;this.pendingTurns.set(e,o);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:o>1,pendingTurns:o,queueDepth:Math.max(0,o-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){ie(e,t);let i=w(e);i&&this.broadcastSessionStatus(i)}coalescePromptEcho(e,t){if(t.type!=="prompt-received")return t;let i=this.pendingPromptEchoes.get(e);if(!i||i.length===0)return t;for(;i.length>0&&Date.now()-i[0].sentAt>15e3;)i.shift();return i.length===0?(this.pendingPromptEchoes.delete(e),t):(i.shift(),i.length===0?this.pendingPromptEchoes.delete(e):this.pendingPromptEchoes.set(e,i),null)}consumeSettledTurn(e){let t=Math.max(0,(this.pendingTurns.get(e)??1)-1);return t>0?this.pendingTurns.set(e,t):this.pendingTurns.delete(e),t}clearPromptTracking(e){this.pendingPromptEchoes.delete(e),this.pendingTurns.delete(e)}fanOutEvent(e,t){let i=JSON.stringify({type:"agent:event",sessionId:e,event:t});for(let[s,n]of this.sessionsBySocket)if(n.has(e)&&s.readyState===P)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===P)try{i.send(t)}catch{}}respond(e,t,i){if(e.readyState===P)try{e.send(JSON.stringify({id:t,result:i}))}catch{}}respondError(e,t,i,s){if(e.readyState===P)try{e.send(JSON.stringify({id:t,error:i,...s?{code:s}:{}}))}catch{}}};function ye(a){return a==="expo"?"expo":a==="one"||a==="vxrn"?"one":"unknown"}import ve from"http";import be from"https";var we="sootsim",Ae=new Set(["host","origin","referer","user-agent","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"]),ke={"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"};function k(a){for(let[e,t]of Object.entries(ke))a.setHeader(e,t)}function Ce(a,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 a.includes("stored-in-.env.local")?`${n} | upstream url still contains placeholder env values`:n}function Te(a){let e={};for(let[t,i]of Object.entries(a))i&&(Ae.has(t.toLowerCase())||(e[t]=Array.isArray(i)?i.join(", "):i));return e["user-agent"]=we,e}function le(a){return a?.startsWith("/__fetch-proxy?")||a?.startsWith("/__proxy?")||!1}function ue(a){return a?!!(a.startsWith("/__app-api?")||a.startsWith("/__app-api/")):!1}async function pe(a,e){if(a.method==="OPTIONS"){k(e),e.writeHead(204),e.end();return}let i=new URLSearchParams((a.url||"").split("?")[1]||"").get("url");if(!i){k(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("missing url param");return}let s;try{s=new URL(i)}catch{k(e),e.writeHead(400,{"Content-Type":"text/plain"}),e.end("invalid url param");return}let n=Te(a.headers),o;if(a.method!=="GET"&&a.method!=="HEAD"){let c=[];for await(let u of a)c.push(Buffer.isBuffer(u)?u:Buffer.from(u));c.length>0&&(o=Buffer.concat(c))}let r;try{r=await fetch(s.href,{method:a.method,headers:n,body:o,redirect:"follow"})}catch(c){k(e),e.writeHead(502,{"Content-Type":"text/plain"}),e.end(`fetch proxy error: ${Ce(s.href,c)}`);return}r.headers.forEach((c,u)=>{let p=u.toLowerCase();p==="content-encoding"||p==="transfer-encoding"||p==="content-length"||p==="set-cookie"||p.startsWith("access-control-")||e.setHeader(u,c)}),k(e);let d=r.headers.getSetCookie?.()??[];d.length>0&&e.setHeader("x-sootsim-set-cookie",d.join(", ")),e.statusCode=r.status;let l=Buffer.from(await r.arrayBuffer());e.end(l)}function he(a,e){let t=a.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(a.method==="OPTIONS")return e.writeHead(204,{"Access-Control-Allow-Origin":a.headers.origin||"*","Access-Control-Allow-Methods":"GET,POST,PUT,PATCH,DELETE,OPTIONS","Access-Control-Allow-Headers":a.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 o=n.protocol==="https:"?be:ve,r={...a.headers};delete r.host,r.host=n.host;let d=o.request({hostname:n.hostname,port:n.port||(n.protocol==="https:"?443:80),path:n.pathname+n.search,method:a.method,headers:r},l=>{let c=Object.keys(l.headers).filter(u=>{let p=u.toLowerCase();return!p.startsWith("access-control-")&&p!=="set-cookie"}).join(", ");e.writeHead(l.statusCode??502,{...l.headers,"access-control-allow-origin":a.headers.origin||"*","access-control-allow-credentials":"true","access-control-expose-headers":c}),l.pipe(e)});return d.on("error",l=>{e.statusCode=502,e.end(`app proxy error: ${l.message}`)}),a.pipe(d),!0}var xe=new Set(["tap","keyboard","close"]);function Re(a){return!a||typeof a.type!="string"?!1:a.acquireLock===!0?!0:a.readOnly===!0?!1:xe.has(a.type)}var Be=5e3,Oe=3600*1e3,_e="SOOTSIM_RUNTIME_UPDATE_INTERVAL_MS",Le={".html":"text/html; charset=utf-8",".js":"application/javascript",".cjs":"application/javascript",".mjs":"application/javascript",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".wasm":"application/wasm",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2",".map":"application/json",".txt":"text/plain; charset=utf-8"};function me(a){let e;try{let s=_();e=JSON.stringify(s)}catch{e="{}"}let t=`<script>window.__sootsimSharedConfig=${e};window.__sootsimCliVersion=${JSON.stringify(U())};</script>`,i=a.toString("utf8");return i.includes("</head>")?i.replace("</head>",t+"</head>"):i.includes("</body>")?i.replace("</body>",t+"</body>"):t+i}var R=class a{port;openUrlHandler;httpServer=null;wss=null;nextCommandId=1;nextSimNumber=161;sims=new Map;primarySimId=null;pendingCommands=new Map;cliBySentId=new Map;cliSimBySocket=new Map;cliLastCommandAt=new Map;cliIdentityKeyBySocket=new Map;cliLabelBySocket=new Map;restorableSims=new Map;nextCliFallbackId=1;cliIdleTimer=null;agentHost;static CLI_IDLE_TIMEOUT_MS=6e4;static CLI_LEASE_TTL_MS=6e5;static USER_ACTIVE_LEASE_TTL_MS=8e3;static USER_BOOT_LEASE_TTL_MS=6e4;static SIM_RECONNECT_TTL_MS=3e4;preferredPort;portFallbackCount;shouldWriteLockfile;effectivePort=0;startedAt=0;heartbeatTimer=null;wsHeartbeatTimer=null;wsIsAlive=new WeakMap;static WS_HEARTBEAT_INTERVAL_MS=3e4;runtimeUpdateTimer=null;runtimeUpdateInFlight=null;activeRuntimeVersion=null;activeRuntimeDirPath=null;scanCache=null;scanCacheAt=0;inflightScan=null;static SCAN_FRESH_MS=2e3;constructor(e={}){this.preferredPort=e.port||7668,this.port=this.preferredPort,this.shouldWriteLockfile=e.writeLockfile===!0,this.portFallbackCount=Math.max(1,e.portFallbackCount??10),this.openUrlHandler=e.openUrl,this.agentHost=new x({getExcludePorts:e.agentScanExcludes})}getAgentHost(){return this.agentHost}start(e){this.startAsync(e)}async startAsync(e){if(this.httpServer||this.wss)return this.effectivePort;this.refreshActiveRuntime();for(let t=0;t<this.portFallbackCount;t++){let i=this.preferredPort+t;try{return await this.bindOnce(i,e?.silent===!0),this.effectivePort=i,this.port=i,this.startedAt=Date.now(),t>0&&!e?.silent&&process.stderr.write(`ws bridge bound to port ${i} (preferred ${this.preferredPort} was taken)
5
- `),this.afterBind(),i}catch(s){if(s?.code!=="EADDRINUSE")throw s;e?.silent||process.stderr.write(`ws bridge port ${i} already in use, trying ${i+1}
6
- `)}}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=Ie((d,l)=>this.handleHttpRequest(d,l)),o=!1,r=d=>{if(!o){o=!0;try{n.close()}catch{}this.httpServer=null,this.wss=null,s(d)}};n.once("error",r),n.listen(e,"127.0.0.1",()=>{o||(o=!0,n.removeListener("error",r),n.on("error",d=>{process.stderr.write(`ws bridge http error: ${String(d)}
7
- `)}),this.httpServer=n,this.wss=new Pe({server:n}),this.wireWebSocketServer(),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.shouldPromoteSim(n)&&(this.primarySimId=n.id),this.broadcastSimAssignments(),this.broadcastSimClientStates();else{let o=`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,o)}e.on("message",o=>{let r;try{r=JSON.parse(o.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 d=L(),l=this.getActiveRuntime(),c={type:"runtime:list:ok",id:r.id,installed:d,active:l.version,activeRuntimeDir:l.runtimeDir};try{e.send(JSON.stringify(c))}catch{}return}if(r.type==="runtime:use"){let d=typeof r.version=="string"?r.version:"";if(!L().includes(d)){try{e.send(JSON.stringify({type:"runtime:use:error",id:r.id,error:`runtime ${d||"(missing)"} is not installed`}))}catch{}return}let c=this.setActiveRuntime(d);try{e.send(JSON.stringify({type:"runtime:use:ok",id:r.id,version:c.version,runtimeDir:c.runtimeDir}))}catch{}return}if(r.type==="runtime:get"){let d=this.getActiveRuntime();try{e.send(JSON.stringify({type:"runtime:get:ok",id:r.id,active:d.version,activeRuntimeDir:d.runtimeDir}))}catch{}return}if(s==="sim"){if(n&&(n.lastSeenAt=Date.now()),r.type==="bridge:register"&&n){let c=r,u=this.tryRestoreSimId(n,c.simId);n.url=c.url,n.title=c.title,n.userAgent=c.userAgent,typeof c.kind=="string"&&c.kind.trim()&&(n.kind=c.kind.trim()),c.meta&&typeof c.meta=="object"&&(n.meta=c.meta),u&&(this.broadcastSimAssignments(),this.broadcastSimClientStates());return}if(r.type==="bridge:user-focus-state"&&n){let c=r;this.updateUserFocusLease(n,c.focused===!0);return}if(r.type==="bridge:user-interact"&&n){this.updateUserActivity(n);return}if(r.type==="bridge:write-shared-config"){let c=r.patch&&typeof r.patch=="object"?r.patch:null;if(!c)return;let u;try{u=M(c)}catch(h){process.stderr.write(`sootsim: bridge:write-shared-config failed: ${h instanceof Error?h.message:String(h)}
8
- `);return}let p=JSON.stringify({type:"bridge:shared-config-changed",config:u});for(let h of this.sims.values())if(h.ws.readyState===m.OPEN)try{h.ws.send(p)}catch{}return}if(r.type==="bridge:open-path"){let c=typeof r.path=="string"?r.path:"",u=typeof r.line=="number"&&Number.isFinite(r.line)?r.line:void 0,p=typeof r.column=="number"&&Number.isFinite(r.column)?r.column:void 0;c&&this.openPathInEditor(c,u,p);return}if(r.type==="bridge:boot-clients"&&n){let c=[];for(let[p,h]of this.cliSimBySocket)h===n.id&&c.push(p);for(let p of c){this.cliSimBySocket.delete(p);try{p.close(1e3,"booted by sim")}catch{}}let u=!!n.cliLease;n.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:Date.now()+a.USER_BOOT_LEASE_TTL_MS},process.stderr.write(`sootsim booted ${c.length} cli client(s)${u?" (overrode prior lease)":""}; held sim for user [${n.id}]
9
- `),this.recordSimAction(n.id,"sim booted cli clients"),this.broadcastSimClientStates();return}let d=this.pendingCommands.get(r.id);if(d){this.pendingCommands.delete(r.id),r.error?d.reject(new Error(r.error)):d.resolve(r.result);return}let l=this.cliBySentId.get(r.id);if(l&&(this.cliBySentId.delete(r.id),l.ws.readyState===m.OPEN)){let c=this.getOtherCliIdentityCount(l.ws,l.simId),u=c>0?{...r,id:l.originalId,i:c}:{...r,id:l.originalId};l.ws.send(JSON.stringify(u))}return}(async()=>{this.cliLastCommandAt.set(e,Date.now());try{if(r.type==="bridge:bye"){let p=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[h,g]of this.cliBySentId)g.ws===e&&this.cliBySentId.delete(h);p&&this.broadcastSimClientStates();return}if(r.type==="bridge:hello"){let p=typeof r.cliIdentityKey=="string"&&r.cliIdentityKey.trim()?r.cliIdentityKey.trim():this.cliIdentityKeyBySocket.get(e)||`ws-${this.nextCliFallbackId++}`;this.cliIdentityKeyBySocket.set(e,p),typeof r.cliLabel=="string"&&r.cliLabel.trim()&&this.cliLabelBySocket.set(e,r.cliLabel.trim()),e.readyState===m.OPEN&&e.send(JSON.stringify({id:r.id,result:{cliIdentityKey:p,leaseTtlMs:a.CLI_LEASE_TTL_MS,leasing:!0}}));return}if(r.type==="bridge:list-sims"){e.readyState===m.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===m.OPEN&&e.send(JSON.stringify({id:r.id,result:{ok:!0,url:r.url}}));return}if(r.type==="bridge:claim"){let p=await this.waitForSim(r.simId),h=this.tryAcquireLease(e,p,{force:r.force===!0});if(!h.granted){e.readyState===m.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${p.id} is locked by another cli`,o:h.lock}));return}this.setCliSimTarget(e,p.id),this.recordSimAction(p.id,h.bootedCount>0?`cli force-claimed sim (booted ${h.bootedCount})`:"cli claimed sim"),e.readyState===m.OPEN&&e.send(JSON.stringify({id:r.id,result:{simId:p.id,lockedBy:h.lease.cliIdentityKey,lockExpiresAt:h.lease.expiresAt,bootedCount:h.bootedCount}}));return}let d=await this.waitForSim(r.simId);if(Re(r)){let p=this.tryAcquireLease(e,d);if(!p.granted){e.readyState===m.OPEN&&e.send(JSON.stringify({id:r.id,error:`sim ${d.id} is locked by another cli \u2014 use \`sootsim claim ${d.id} --force\` or \`sootsim open --new\``,o:p.lock}));return}}else this.ensureCliIdentityKey(e);this.setCliSimTarget(e,d.id),this.recordSimAction(d.id,this.describeForwardedCommand(r));let l=this.nextCommandId++;this.cliBySentId.set(l,{simId:d.id,ws:e,originalId:r.id});let{simId:c,...u}=r;d.ws.send(JSON.stringify({...u,id:l}))}catch(d){e.readyState===m.OPEN&&e.send(JSON.stringify({id:r.id,error:d instanceof Error?d.message:String(d)}))}})()}}),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[o,r]of this.pendingCommands)r.simId===n.id&&(r.reject(new Error("sim disconnected")),this.pendingCommands.delete(o));for(let[o,r]of this.cliBySentId)r.simId===n.id&&(r.ws.readyState===m.OPEN&&r.ws.send(JSON.stringify({id:r.originalId,error:"sim disconnected before responding"})),this.cliBySentId.delete(o));this.broadcastSimAssignments(),this.broadcastSimClientStates()}else if(s==="cli"){let o=this.cliSimBySocket.delete(e);this.cliLastCommandAt.delete(e),this.cliIdentityKeyBySocket.delete(e),this.cliLabelBySocket.delete(e);for(let[r,d]of this.cliBySentId)d.ws===e&&this.cliBySentId.delete(r);o&&this.broadcastSimClientStates()}})})}afterBind(){if(process.stderr.write(`ws bridge listening on port ${this.port}
10
- `),this.cliIdleTimer=setInterval(()=>this.sweepIdleCliClients(),3e4),this.cliIdleTimer.unref(),this.wsHeartbeatTimer=setInterval(()=>this.sweepDeadWebSockets(),a.WS_HEARTBEAT_INTERVAL_MS),this.wsHeartbeatTimer.unref(),this.shouldWriteLockfile){try{if(T(),!V(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)}
11
- `),e}this.heartbeatTimer=setInterval(()=>{try{this.writeLockfileSnapshot()}catch{}},Be),this.heartbeatTimer.unref(),this.startRuntimeUpdater()}this.agentHost.seedOnBoot()}bootstrapping=!0;buildLockfileSnapshot(){return{schema:1,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,activeRuntimeDir:this.activeRuntimeDirPath,startedAt:this.startedAt,heartbeatAt:Date.now(),bootstrapping:this.bootstrapping}}writeLockfileSnapshot(){K(this.buildLockfileSnapshot())}refreshActiveRuntime(){this.activeRuntimeVersion=W(),this.activeRuntimeDirPath=j()}runServerScan(){if(this.inflightScan)return this.inflightScan;let e=this.effectivePort>0?[this.effectivePort]:[];return this.inflightScan=E({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<a.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[_e]);return Number.isFinite(e)&&e>0?Math.max(100,Math.round(e)):Oe}startRuntimeUpdater(){if(!this.shouldWriteLockfile||this.runtimeUpdateTimer)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
12
- `);let t=await Y();if(!t.updated||!t.latestVersion){e==="startup"&&process.stderr.write(`sootsim: runtime ${this.activeRuntimeVersion??"(none)"} is current
13
- `);return}let i=this.setActiveRuntime(t.latestVersion);process.stderr.write(`sootsim runtime updated to ${i.version} (${e})
14
- `)}catch(t){process.stderr.write(`sootsim runtime update failed (${e}): ${t instanceof Error?t.message:String(t)}
15
- `)}finally{if(this.runtimeUpdateInFlight=null,e==="startup"&&this.bootstrapping){if(this.bootstrapping=!1,this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}process.stderr.write(`sootsim: ready
16
- `)}}})(),this.runtimeUpdateInFlight)}setActiveRuntime(e){if(F(e),this.refreshActiveRuntime(),this.shouldWriteLockfile&&this.httpServer)try{this.writeLockfileSnapshot()}catch{}let t=JSON.stringify({type:"runtime:changed",version:e,runtimeDir:this.activeRuntimeDirPath});for(let i of this.sims.values())if(i.ws.readyState===m.OPEN)try{i.ws.send(t)}catch{}return{version:e,runtimeDir:this.activeRuntimeDirPath}}getActiveRuntime(){return{version:this.activeRuntimeVersion,runtimeDir:this.activeRuntimeDirPath}}removeLockfile(){if(this.shouldWriteLockfile)try{N()}catch{}}handleHttpRequest(e,t){if(t.setHeader("Cross-Origin-Opener-Policy","same-origin"),t.setHeader("Cross-Origin-Embedder-Policy","credentialless"),t.setHeader("Cross-Origin-Resource-Policy","cross-origin"),t.setHeader("Document-Policy","js-profiling"),le(e.url)){pe(e,t);return}if(ue(e.url)&&he(e,t))return;let i=(e.method||"GET").toUpperCase();if(i!=="GET"&&i!=="HEAD"){t.writeHead(405,{Allow:"GET, HEAD"}),t.end("method not allowed");return}let s=new URL(e.url||"/","http://localhost");if(s.pathname==="/__bundle-proxy"){let l=s.searchParams.get("url");if(!l){t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: missing url query param");return}let c;try{c=new URL(l)}catch{t.writeHead(400,{"Content-Type":"text/plain"}),t.end("bundle-proxy: invalid url");return}let u=c.hostname;if(!(u==="localhost"||u==="127.0.0.1"||u==="::1"||u.endsWith(".localhost"))){t.writeHead(403,{"Content-Type":"text/plain"}),t.end("bundle-proxy: only loopback targets allowed");return}(async()=>{try{let h=await fetch(c.toString(),{redirect:"follow"}),g={},f=h.headers.get("content-type");if(f&&(g["Content-Type"]=f),g["Cache-Control"]="no-store",t.writeHead(h.status,g),!h.body){t.end();return}let b=h.body.getReader();for(;;){let{done:C,value:y}=await b.read();if(C)break;t.write(Buffer.from(y))}t.end()}catch(h){t.writeHead(502,{"Content-Type":"text/plain"}),t.end(`bundle-proxy: upstream fetch failed: ${h instanceof Error?h.message:String(h)}`)}})();return}if(s.pathname==="/__server-scan"){this.handleServerScan(t);return}if(s.pathname==="/healthz"){t.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),t.end(JSON.stringify({ok:!0,pid:process.pid,platform:process.platform,bridgePort:this.effectivePort,runtimePort:this.effectivePort,activeRuntime:this.activeRuntimeVersion,startedAt:this.startedAt,uptimeMs:this.startedAt>0?Date.now()-this.startedAt:0}));return}if(s.pathname==="/__sootsim/shared-config"){if(t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Cache-Control","no-store"),i==="GET"||i==="HEAD"){let l="{}";try{l=JSON.stringify(_())}catch{}t.writeHead(200,{"Content-Type":"application/json"}),i==="HEAD"?t.end():t.end(l);return}t.writeHead(405,{Allow:"GET, HEAD"}),t.end("method not allowed (use the bridge over WS for writes)");return}this.refreshActiveRuntime();let n=this.activeRuntimeDirPath;if(!n){t.writeHead(503,{"Content-Type":"text/plain; charset=utf-8"}),t.end("sootsim: no active runtime installed. run `sootsim runtime install` to fetch one.");return}let o=s.pathname;if(o==="/runtime"||o==="/runtime/"?o="/":o.startsWith("/runtime/")&&(o=o.slice(8)),(o===""||o==="/")&&(o="/index.html"),o.includes("\0")){t.writeHead(400),t.end("bad request");return}if(process.platform!=="win32"&&o.includes("\\")){t.writeHead(400),t.end("bad request");return}for(let l of o.split("/"))if(l===".."){t.writeHead(403),t.end("forbidden");return}let r=S.resolve(n,"."+o),d=n.endsWith(S.sep)?n:n+S.sep;if(!r.startsWith(d)&&r!==n){t.writeHead(403),t.end("forbidden");return}v.realpath(r,(l,c)=>{let u=l?r:c,p=u.endsWith(S.sep)?u:u+S.sep;if(!l){let h=(()=>{try{let g=v.realpathSync(n);return g.endsWith(S.sep)?g:g+S.sep}catch{return d}})();if(!p.startsWith(h)&&u+S.sep!==h){t.writeHead(403),t.end("forbidden");return}}v.stat(u,(h,g)=>{if(h||!g?.isFile()){let y=S.extname(o).toLowerCase();if(y&&y!==".html"){t.writeHead(404),t.end("not found");return}if(o.startsWith("/__")||o.startsWith("/api/")||o==="/api"){t.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),t.end("not found");return}let O=S.join(n,"index.html");v.readFile(O,(fe,ge)=>{if(fe){t.writeHead(404),t.end("not found");return}if(t.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),i==="HEAD"){t.end();return}t.end(me(ge))});return}let f=S.extname(u).toLowerCase(),b=Le[f]||"application/octet-stream";if(t.writeHead(200,{"Content-Type":b,"Cache-Control":"no-store"}),i==="HEAD"){t.end();return}if(f===".html"){v.readFile(u,(y,O)=>{if(y){try{t.end()}catch{}return}t.end(me(O))});return}let C=v.createReadStream(u);C.pipe(t),C.on("error",()=>{try{t.end()}catch{}})})})}sweepIdleCliClients(){let e=Date.now(),t=!1;for(let[i,s]of this.cliSimBySocket){let n=this.cliLastCommandAt.get(i)??0;if(!(e-n<a.CLI_IDLE_TIMEOUT_MS)){this.cliSimBySocket.delete(i),this.cliLastCommandAt.delete(i);for(let[o,r]of this.cliBySentId)r.ws===i&&this.cliBySentId.delete(o);try{i.close(1e3,"idle timeout")}catch{}t=!0}}t&&this.broadcastSimClientStates(),this.sweepRestorableSims(e)}sweepDeadWebSockets(){if(this.wss)for(let e of this.wss.clients){if(e.readyState!==m.OPEN)continue;if(this.wsIsAlive.get(e)===!1){try{e.terminate()}catch{}continue}this.wsIsAlive.set(e,!1);try{e.ping()}catch{try{e.terminate()}catch{}}}}listSims(){return Array.from(this.sims.values()).sort((e,t)=>e.id===this.primarySimId?-1:t.id===this.primarySimId?1:e.connectedAt-t.connectedAt).map(e=>this.describeSim(e))}async sendCommand(e){let t=await this.waitForSim(e.simId),i=this.nextCommandId++;return new Promise((s,n)=>{let o=setTimeout(()=>{this.pendingCommands.delete(i),this.broadcastSimClientStates(),n(new Error("command timed out after 30s"))},3e4);this.pendingCommands.set(i,{simId:t.id,resolve:l=>{clearTimeout(o),this.pendingCommands.delete(i),this.broadcastSimClientStates(),s(l)},reject:l=>{clearTimeout(o),this.pendingCommands.delete(i),this.broadcastSimClientStates(),n(l)}}),this.broadcastSimClientStates();let{simId:r,...d}=e;t.ws.send(JSON.stringify({...d,id:i}))})}async evaluate(e,t){return this.sendCommand({type:"evaluate",code:e,simId:t})}async focusSim(e){return this.sendCommand({type:"focus",simId:e})}async closeSim(e){return this.sendCommand({type:"close",simId:e})}async openPathInEditor(e,t,i){let s=t!=null?`:${t}${i!=null?`:${i}`:""}`:"",n=`${e}${s}`,o=(d,l)=>new Promise(c=>{try{let u=Ee(d,l,{detached:!0,stdio:"ignore"}),p=!1;u.on("error",()=>{p||(p=!0,c(!1))}),u.on("spawn",()=>{p||(p=!0,u.unref(),c(!0))})}catch{c(!1)}}),r=process.env.REACT_EDITOR||process.env.EDITOR;if(r){let d=r.split(" ").filter(Boolean);if(d.length&&await o(d[0],[...d.slice(1),"-g",n]))return}await o("cursor",["-g",n])||await o("code",["-g",n])||await this.openUrl(e)}async openUrl(e,t={}){if(this.openUrlHandler){await this.openUrlHandler(e,t);return}await z(e,t)}async close(){if(this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.wsHeartbeatTimer&&(clearInterval(this.wsHeartbeatTimer),this.wsHeartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null),this.shouldWriteLockfile)try{N()}catch{}this.effectivePort=0,this.startedAt=0,this.agentHost.close();for(let[i,s]of this.pendingCommands)s.reject(new Error("server closing")),this.pendingCommands.delete(i);for(let i of this.sims.values())i.ws.close();this.sims.clear(),this.primarySimId=null;let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}describeSim(e){let t;try{t=e.ws.readyState}catch{t=m.CLOSED}let i=this.getActiveLease(e);return{id:e.id,origin:e.origin,url:e.url,title:e.title,userAgent:e.userAgent,connectedAt:e.connectedAt,lastSeenAt:e.lastSeenAt,lastActiveAt:e.lastActiveAt||void 0,isPrimary:e.id===this.primarySimId,readyState:t===m.OPEN?"open":t===m.CLOSING?"closing":"closed",attachedCliCount:this.getAttachedCliCount(e.id),lockedBy:i?i.cliLabel||i.cliIdentityKey:void 0,lockedByKind:i?i.kind:void 0,lockExpiresAt:i?i.expiresAt:void 0,userFocused:e.userFocused||void 0,kind:e.kind,meta:e.meta}}getActiveLease(e){let t=e.cliLease;return t?Date.now()>=t.expiresAt?(e.cliLease=void 0,null):t:null}tryAcquireLease(e,t,i={}){let s=this.cliIdentityKeyBySocket.get(e)??(()=>{let u=`ws-${this.nextCliFallbackId++}`;return this.cliIdentityKeyBySocket.set(e,u),u})(),n=this.cliLabelBySocket.get(e),o=Date.now(),r=this.getActiveLease(t),d=r&&r.cliIdentityKey===s,l=0;if(r&&!d&&!i.force)return{granted:!1,lease:r,lock:{by:r.cliLabel||r.cliIdentityKey,expiresInMs:Math.max(0,r.expiresAt-o)},bootedCount:0};if(r&&!d&&i.force)for(let[u,p]of this.cliSimBySocket){if(p!==t.id)continue;let h=this.cliIdentityKeyBySocket.get(u);if(h&&h!==s){this.cliSimBySocket.delete(u);try{u.close(1e3,"lease claimed by another cli")}catch{}l++}}let c={kind:"cli",cliIdentityKey:s,cliLabel:n,expiresAt:o+a.CLI_LEASE_TTL_MS};return t.cliLease=c,{granted:!0,lease:c,bootedCount:l}}updateUserFocusLease(e,t){let i=t;e.userFocused!==i&&(e.userFocused=i,this.broadcastSimClientStates())}updateUserActivity(e){let t=this.getActiveLease(e);if(t&&t.kind==="cli")return;let s=Date.now()+a.USER_ACTIVE_LEASE_TTL_MS,n=t&&t.kind==="user-active"?Math.max(t.expiresAt,s):s;e.cliLease={kind:"user-active",cliIdentityKey:"__user-active__",cliLabel:"active user",expiresAt:n},this.broadcastSimClientStates()}ensureCliIdentityKey(e){let t=this.cliIdentityKeyBySocket.get(e);if(t)return t;let i=`ws-${this.nextCliFallbackId++}`;return this.cliIdentityKeyBySocket.set(e,i),i}getOpenSim(e){if(e){let i=this.sims.get(e);return i?.ws.readyState===m.OPEN?i:null}let t=this.primarySimId!=null?this.sims.get(this.primarySimId):null;if(t?.ws.readyState===m.OPEN)return t;for(let i of this.sims.values())if(i.ws.readyState===m.OPEN)return i;return null}async waitForSim(e,t={}){let i=t.attempts??10,s=t.intervalMs??200;for(let n=0;n<i;n++){let o=this.getOpenSim(e);if(o)return o;await new Promise(r=>setTimeout(r,s))}throw new Error(e?`no sim connected with id ${e}`:"no sim connected")}shouldPromoteSim(e){let t=this.primarySimId?this.sims.get(this.primarySimId):null,i=e.origin?.includes(":5173"),s=t?.origin?.includes(":5173");return!t||t.ws.readyState!==m.OPEN||!!i||!s}broadcastSimAssignments(){for(let e of this.sims.values())e.ws.readyState===m.OPEN&&e.ws.send(JSON.stringify({type:"bridge:welcome",simId:e.id,isPrimary:e.id===this.primarySimId}))}broadcastSimClientStates(){for(let e of this.sims.values()){if(e.ws.readyState!==m.OPEN)continue;let t=this.getActiveLease(e),i={type:"bridge:client-state",attachedCliCount:this.getAttachedCliCount(e.id),activeAgentCommandCount:this.getActiveAgentCommandCount(e.id),recentActions:e.recentActions,lockedBy:t?t.cliLabel||t.cliIdentityKey:void 0,lockedByKind:t?t.kind:void 0,lockExpiresAt:t?t.expiresAt:void 0,userFocused:e.userFocused||void 0};e.ws.send(JSON.stringify(i))}}setCliSimTarget(e,t){let i=this.cliSimBySocket.get(e);i!==t&&(this.cliSimBySocket.set(e,t),this.recordSimAction(t,i?"cli switched sims":"cli connected",!1),this.broadcastSimClientStates())}recordSimAction(e,t,i=!0){let s=t?.trim();if(!s)return;let n=this.sims.get(e);if(!n)return;let o=Date.now();n.lastActiveAt=o,n.recentActions=[{label:s,at:o},...n.recentActions.filter(r=>r.label!==s)].slice(0,4),i&&this.broadcastSimClientStates()}describeForwardedCommand(e){switch(e?.type){case"evaluate":return"evaluated page state";case"screenshot":return"captured screenshot";case"tap":return"sent tap event";case"keyboard":return e?.action==="type"?"typed text":"used keyboard";case"tree":return"dumped tree";case"focus":return"focused sim";case"close":return"requested close";default:return typeof e?.type=="string"?e.type:null}}getAttachedCliCount(e){let t=new Set;for(let[i,s]of this.cliSimBySocket){if(s!==e||i.readyState!==m.OPEN)continue;let n=this.cliIdentityKeyBySocket.get(i);t.add(n??`ws-unknown-${t.size}`)}return t.size}getOtherCliIdentityCount(e,t){let i=this.cliIdentityKeyBySocket.get(e),s=new Set;for(let[n,o]of this.cliSimBySocket){if(o!==t||n.readyState!==m.OPEN)continue;let r=this.cliIdentityKeyBySocket.get(n);r&&r===i||s.add(r??`ws-unknown-${s.size}`)}return s.size}getActiveAgentCommandCount(e){let t=0;for(let i of this.pendingCommands.values())i.simId===e&&t++;return t}allocateSimId(){for(;;){let e=this.nextSimNumber.toString(16);if(this.nextSimNumber++,!this.sims.has(e)&&!this.restorableSims.has(e))return e}}tryRestoreSimId(e,t){let i=t?.trim();if(!i||i===e.id)return!1;let s=this.sims.get(i);if(s&&s!==e&&s.ws.readyState===m.OPEN)return!1;let n=this.getRestorableSimState(i),o=e.id;this.sims.delete(o),e.id=i,n&&(e.recentActions=n.recentActions.map(r=>({...r})),e.lastActiveAt=n.lastActiveAt,e.cliLease=n.cliLease?{...n.cliLease}:void 0,this.restorableSims.delete(i)),this.sims.set(e.id,e),this.primarySimId===o&&(this.primarySimId=e.id);for(let[r,d]of this.cliSimBySocket)d===o&&this.cliSimBySocket.set(r,e.id);return!0}rememberDisconnectedSim(e){let t=this.getActiveLease(e);this.restorableSims.set(e.id,{recentActions:e.recentActions.map(i=>({...i})),lastActiveAt:e.lastActiveAt,cliLease:t&&t.kind==="cli"?{...t}:void 0,expiresAt:Date.now()+a.SIM_RECONNECT_TTL_MS}),this.sims.delete(e.id)}getRestorableSimState(e){let t=this.restorableSims.get(e);return t?t.expiresAt<=Date.now()?(this.restorableSims.delete(e),null):(t.cliLease&&t.cliLease.expiresAt<=Date.now()&&(t.cliLease=void 0),t):null}sweepRestorableSims(e=Date.now()){for(let[t,i]of this.restorableSims)if(!(i.expiresAt>e)){this.restorableSims.delete(t);for(let[s,n]of this.cliSimBySocket)n===t&&this.cliSimBySocket.delete(s)}}resetServerState(){this.cliIdleTimer&&(clearInterval(this.cliIdleTimer),this.cliIdleTimer=null),this.wsHeartbeatTimer&&(clearInterval(this.wsHeartbeatTimer),this.wsHeartbeatTimer=null),this.runtimeUpdateTimer&&(clearInterval(this.runtimeUpdateTimer),this.runtimeUpdateTimer=null);let e=this.wss,t=this.httpServer;if(this.wss=null,this.httpServer=null,e)try{e.close()}catch{}if(t)try{t.close()}catch{}}};function Ne(){let a=process.env.XPC_SERVICE_NAME||"";return!!(a.includes("dev.sootsim.daemon")||a.includes("dev.sootsim.server")||process.env.INVOCATION_ID)}async function dt(a,e={}){(a.includes("--help")||a.includes("-h"))&&(console.log(`
17
- sootsim server \u2014 run the sootsim bridge daemon in the foreground
18
-
19
- hosts the WS bridge that CLI commands talk to. once running, any sootsim
20
- renderer (browser, electron, headless playwright) that connects to port 7668
21
- becomes drivable from 'sootsim describe', 'sootsim tap', etc.
22
-
23
- usage:
24
- sootsim server [options]
25
-
26
- options:
27
- --port <n> bridge port (defaults to ${7668})
28
- --quiet suppress per-connection logging
29
-
30
- examples:
31
- sootsim server
32
- sootsim server --port 7668 --quiet
33
- `),process.exit(0));let t=a.indexOf("--port"),i=t>=0&&a[t+1]?Number(a[t+1]):e.port??7668;Number.isNaN(i)&&(console.error(` invalid --port value: ${a[t+1]}`),process.exit(1));let s=a.includes("--quiet")||a.includes("-q"),n=$();n&&J(n)&&(console.error(` a sootsim daemon is already running (pid ${n.pid}, port ${n.bridgePort})`),console.error(" stop it with 'sootsim daemon stop' first"),process.exit(1)),T();let o=new R({port:i,writeLockfile:!0}),r=await o.startAsync({silent:s}),d=Date.now(),l=h=>{s||process.stdout.write(`${h}
34
- `)},c=new Set,u=setInterval(()=>{let h=o.listSims(),g=new Set(h.map(f=>f.id));for(let f of h)if(!c.has(f.id)){let b=f.title||f.url||f.origin||"(unknown)";l(` + ${f.id} ${b}`)}for(let f of c)g.has(f)||l(` - ${f}`);c.clear();for(let f of g)c.add(f)},500);G({event:"daemon_heartbeat",properties:{bridge_port:r,under_daemon:Ne(),platform:process.platform,subsource:"daemon"}}),q(),l(`sootsim bridge listening on ws://localhost:${r} (runtime http on same port)`),r!==i&&l(` (preferred port ${i} was taken \u2014 fell back to ${r})`),l(" ready for browser, electron, or headless playwright sims to connect"),l(" (ctrl-c to stop)");let p=async h=>{clearInterval(u),l(`
35
- ${h} received \u2014 shutting down after ${Math.round((Date.now()-d)/1e3)}s`);try{await o.close()}catch{}process.exit(0)};process.on("SIGINT",()=>p("SIGINT")),process.on("SIGTERM",()=>p("SIGTERM")),process.on("SIGHUP",()=>p("SIGHUP")),process.on("exit",()=>{try{o.removeLockfile()}catch{}}),await new Promise(()=>{})}export{dt as runServer};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-D2ZMP7G4.js";import"./chunk-J6BPROH4.js";import"./chunk-Z3I2I4IO.js";import"./chunk-PNGBWMQH.js";import"./chunk-Y66CDFAT.js";import"./chunk-W2XRHDQQ.js";import"./chunk-553OZX4H.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";export{a as runSetupRepo};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-PKB6IEGM.js";import"./chunk-Y5CFIRLN.js";import"./chunk-DEBXVPIE.js";export{a as settingsStore};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b}from"./chunk-W2XRHDQQ.js";import"./chunk-553OZX4H.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";export{b as flushCliTelemetry,a as trackCliEvent};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b,c}from"./chunk-LXR5EI74.js";import"./chunk-QUULF2II.js";import"./chunk-I7KXFJDK.js";import"./chunk-EOWN4ZFJ.js";import"./chunk-PNGBWMQH.js";import"./chunk-Y66CDFAT.js";import"./chunk-W2XRHDQQ.js";import"./chunk-553OZX4H.js";import"./chunk-XWXFUFB2.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.40 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{d as n}from"./chunk-553OZX4H.js";import"./chunk-YKEBL6GE.js";import"./chunk-DEBXVPIE.js";async function s(){let o=await n();o?.token||(console.log(" not signed in"),process.exit(1));let e=o.user;console.log(` ${e?.email||e?.name||e?.id||"signed in"}`),console.log(` origin: ${o.origin}`),console.log(` updated: ${o.updatedAt}`)}export{s as runWhoami};