sootsim 0.1.66 → 0.1.67

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 (147) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-IW7CCSSI.js → agent-Z45KTLTP.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-5DJBERZP.js → agent-wrapper-EEKVEJOC.js} +2 -2
  4. package/dist-cli/chunks/{assert-RHILK3WR.js → assert-MDYZKXZ6.js} +2 -2
  5. package/dist-cli/chunks/auto-bootstrap-YZ6C6VYO.js +2 -0
  6. package/dist-cli/chunks/beta-WXH75XUE.js +2 -0
  7. package/dist-cli/chunks/chunk-2HKCZLY7.js +372 -0
  8. package/dist-cli/chunks/{chunk-UMXVWFST.js → chunk-2I535GZU.js} +1 -1
  9. package/dist-cli/chunks/{chunk-TJEP4DBA.js → chunk-3KVVIZ6M.js} +2 -2
  10. package/dist-cli/chunks/chunk-42NMKOVE.js +3 -0
  11. package/dist-cli/chunks/{chunk-WAOLC7WV.js → chunk-4H6LBA4A.js} +1 -1
  12. package/dist-cli/chunks/{chunk-LVFWALS4.js → chunk-4QSGVTBE.js} +2 -2
  13. package/dist-cli/chunks/{chunk-T4YLDM5C.js → chunk-52RZ6TSZ.js} +3 -3
  14. package/dist-cli/chunks/{chunk-AYBGSHQK.js → chunk-5WRBVYML.js} +2 -2
  15. package/dist-cli/chunks/{chunk-BD76YSRN.js → chunk-67566AJS.js} +2 -2
  16. package/dist-cli/chunks/chunk-6O64VUC6.js +2 -0
  17. package/dist-cli/chunks/chunk-7PQHQOCI.js +186 -0
  18. package/dist-cli/chunks/{chunk-V4SZERWD.js → chunk-AQ7YR4MO.js} +14 -14
  19. package/dist-cli/chunks/{chunk-6AP6LXVV.js → chunk-ATRGAFJD.js} +1 -1
  20. package/dist-cli/chunks/{chunk-LRBMW2WC.js → chunk-BCVVANS5.js} +2 -2
  21. package/dist-cli/chunks/chunk-CUNQTNH4.js +35 -0
  22. package/dist-cli/chunks/{chunk-DEQ7RED3.js → chunk-DOWYG3HG.js} +2 -2
  23. package/dist-cli/chunks/{chunk-XZ5SQJM2.js → chunk-EJTXYZEF.js} +128 -36
  24. package/dist-cli/chunks/{chunk-4NT6VRUU.js → chunk-F23Y4HMT.js} +1 -1
  25. package/dist-cli/chunks/{chunk-M2Q4FXRE.js → chunk-F4RC4AOY.js} +1 -1
  26. package/dist-cli/chunks/chunk-GFVC6EEB.js +1 -0
  27. package/dist-cli/chunks/{chunk-BEQD2DSK.js → chunk-HW5YHSIE.js} +1 -1
  28. package/dist-cli/chunks/{chunk-VRV2X4X2.js → chunk-IB4BRND4.js} +1 -1
  29. package/dist-cli/chunks/{chunk-22CO2ZE3.js → chunk-IBWN764Q.js} +2 -2
  30. package/dist-cli/chunks/chunk-JE4JBSNJ.js +119 -0
  31. package/dist-cli/chunks/{chunk-HWCZYW6M.js → chunk-K4PKR2EO.js} +2 -2
  32. package/dist-cli/chunks/chunk-KBJ2WHII.js +73 -0
  33. package/dist-cli/chunks/chunk-KR36VJSN.js +1 -0
  34. package/dist-cli/chunks/{chunk-EEMGSSWY.js → chunk-LQ5BA5JU.js} +2 -2
  35. package/dist-cli/chunks/chunk-MIAAZSSE.js +12 -0
  36. package/dist-cli/chunks/{chunk-BTHB3PMG.js → chunk-N4JRDJMN.js} +3 -3
  37. package/dist-cli/chunks/{chunk-FXF2FHPI.js → chunk-NYR3Z44O.js} +2 -2
  38. package/dist-cli/chunks/{chunk-EIQLQDKX.js → chunk-O624O5MO.js} +2 -2
  39. package/dist-cli/chunks/{chunk-4LYNJPUM.js → chunk-SH6HMUCY.js} +2 -2
  40. package/dist-cli/chunks/chunk-SVFSMAZN.js +2 -0
  41. package/dist-cli/chunks/chunk-TEMZK6Q2.js +1 -0
  42. package/dist-cli/chunks/{chunk-D4VEI6MI.js → chunk-TLTS533S.js} +1 -1
  43. package/dist-cli/chunks/chunk-U47AHSGE.js +23 -0
  44. package/dist-cli/chunks/{chunk-LCKLQSZX.js → chunk-XCRUPKWB.js} +2 -2
  45. package/dist-cli/chunks/{chunk-NCSGLZRV.js → chunk-YGQV3CUV.js} +2 -2
  46. package/dist-cli/chunks/{chunk-UNSLXX7V.js → chunk-ZJJKYJMH.js} +2 -2
  47. package/dist-cli/chunks/{chunk-GDCMTHEU.js → chunk-ZO7SGE65.js} +1 -1
  48. package/dist-cli/chunks/{chunk-HIN5TAAL.js → chunk-ZP2HMCKS.js} +1 -1
  49. package/dist-cli/chunks/cli-version-5LGQQE5P.js +2 -0
  50. package/dist-cli/chunks/{compat-I7JXYUJN.js → compat-5MMZ4R3Q.js} +3 -3
  51. package/dist-cli/chunks/{config-3HR5RKVH.js → config-YWN44WJQ.js} +2 -2
  52. package/dist-cli/chunks/control-LUCFDAZI.js +2 -0
  53. package/dist-cli/chunks/{cpu-profile-ZVHMTVAU.js → cpu-profile-VFGUVXU5.js} +2 -2
  54. package/dist-cli/chunks/{daemon-VYRTYH55.js → daemon-ONX5ZBXF.js} +2 -2
  55. package/dist-cli/chunks/{debug-CQ6Y7GJ2.js → debug-CPOG32OT.js} +5 -5
  56. package/dist-cli/chunks/demo-app-registry-LWT6JLU6.js +2 -0
  57. package/dist-cli/chunks/{detox-7ZKTGLDR.js → detox-J6NGSZR5.js} +2 -2
  58. package/dist-cli/chunks/{device-4M6Z7E2N.js → device-QYOQXI2P.js} +2 -2
  59. package/dist-cli/chunks/{diagnose-SMQLYGNX.js → diagnose-MMW4LJLA.js} +2 -2
  60. package/dist-cli/chunks/drivers-NRWUJJCD.js +2 -0
  61. package/dist-cli/chunks/{electron-6N2MIN5W.js → electron-IK3HIZY4.js} +3 -3
  62. package/dist-cli/chunks/flow-2MB7HINM.js +2 -0
  63. package/dist-cli/chunks/{hints-RJCZS2E3.js → hints-KZOD56U5.js} +2 -2
  64. package/dist-cli/chunks/{home-paths-DCUNA3CD.js → home-paths-R2YZZTUM.js} +2 -2
  65. package/dist-cli/chunks/inspect-ZARO3HQ4.js +970 -0
  66. package/dist-cli/chunks/install-O67RTYCX.js +2 -0
  67. package/dist-cli/chunks/{install-desktop-C7424OSW.js → install-desktop-4GH5I7SC.js} +3 -3
  68. package/dist-cli/chunks/{keys-TXUQOAZ3.js → keys-AXEFZUUI.js} +2 -2
  69. package/dist-cli/chunks/{launch-MVA44QTC.js → launch-QLE56ON7.js} +3 -3
  70. package/dist-cli/chunks/{login-NHO2WTHC.js → login-J45NQQM6.js} +4 -4
  71. package/dist-cli/chunks/{logout-SRRWADCE.js → logout-ZE5OUBB7.js} +2 -2
  72. package/dist-cli/chunks/{maestro-UHNXEZAN.js → maestro-FS6CAKDD.js} +2 -2
  73. package/dist-cli/chunks/{preview-ETIUP7KC.js → preview-TSU5IXVR.js} +2 -2
  74. package/dist-cli/chunks/{profile-MY5JFVIF.js → profile-ZBJ4TYWA.js} +2 -2
  75. package/dist-cli/chunks/{react-KCMC4GL3.js → react-TGZLTTYN.js} +2 -2
  76. package/dist-cli/chunks/record-JSBFUNOD.js +54 -0
  77. package/dist-cli/chunks/runtime-DGDQ7NVY.js +2 -0
  78. package/dist-cli/chunks/{runtime-delivery-LQZIWQU6.js → runtime-delivery-36UMAXOV.js} +2 -2
  79. package/dist-cli/chunks/screenshot-3CHMALUJ.js +33 -0
  80. package/dist-cli/chunks/{screenshot-mode-USPWASI3.js → screenshot-mode-C547UT5H.js} +2 -2
  81. package/dist-cli/chunks/{screenshots-EPEDNA6H.js → screenshots-XCNGSNYG.js} +2 -2
  82. package/dist-cli/chunks/{server-222QT33M.js → server-W37X3IW7.js} +6 -6
  83. package/dist-cli/chunks/setup-repo-DETS5ZJT.js +2 -0
  84. package/dist-cli/chunks/{skills-6XRREE2M.js → skills-OXZLDNDW.js} +2 -2
  85. package/dist-cli/chunks/{start-YCAZBZEX.js → start-N6ZQYUBP.js} +4 -4
  86. package/dist-cli/chunks/store-QOXJKJUZ.js +2 -0
  87. package/dist-cli/chunks/telemetry-74LX7WG4.js +2 -0
  88. package/dist-cli/chunks/{test-6TNRHSWC.js → test-DWZ7PRSW.js} +3 -3
  89. package/dist-cli/chunks/{three-mode-MDOLHGXW.js → three-mode-P2R7KA62.js} +2 -2
  90. package/dist-cli/chunks/{timeline-72MWE44G.js → timeline-VPES3YCN.js} +3 -3
  91. package/dist-cli/chunks/{upgrade-IHZ4DFAE.js → upgrade-NYQLA4UJ.js} +2 -2
  92. package/dist-cli/chunks/upload-YOMMYESV.js +2 -0
  93. package/dist-cli/chunks/{web-JLJSJUS2.js → web-OTALJKK5.js} +2 -2
  94. package/dist-cli/chunks/what-happened-GZ73H6KF.js +22 -0
  95. package/dist-cli/chunks/{whoami-2EYGCRDQ.js → whoami-UDLQK7IY.js} +2 -2
  96. package/dist-lib/agent-daemon-client.cjs +1 -1
  97. package/dist-lib/agent-events.cjs +1 -1
  98. package/dist-lib/agent-sessions.cjs +1 -1
  99. package/dist-lib/attached-projects.cjs +1 -1
  100. package/dist-lib/auth/shared-session.cjs +1 -1
  101. package/dist-lib/backend-origin.cjs +1 -1
  102. package/dist-lib/bridge-constants.cjs +1 -1
  103. package/dist-lib/cli-constants.cjs +1 -1
  104. package/dist-lib/config.cjs +1 -1
  105. package/dist-lib/dev-bundle-resolution.cjs +9 -2
  106. package/dist-lib/home-paths.cjs +1 -1
  107. package/dist-lib/host/bridge-host.cjs +23 -7
  108. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  109. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  110. package/dist-lib/index.cjs +1 -1
  111. package/dist-lib/metro.cjs +1 -1
  112. package/dist-lib/profiles.cjs +1 -1
  113. package/dist-lib/render-mode.cjs +1 -1
  114. package/dist-lib/vite-base.cjs +23 -7
  115. package/dist-lib/vite.cjs +1 -1
  116. package/package.json +1 -1
  117. package/dist-cli/chunks/auto-bootstrap-PS2UDBP7.js +0 -2
  118. package/dist-cli/chunks/beta-XLYWSKEA.js +0 -2
  119. package/dist-cli/chunks/chunk-5MVFADNH.js +0 -3
  120. package/dist-cli/chunks/chunk-7NYW73Q6.js +0 -2
  121. package/dist-cli/chunks/chunk-EMMX6RF7.js +0 -73
  122. package/dist-cli/chunks/chunk-FIIBCY5I.js +0 -3
  123. package/dist-cli/chunks/chunk-G4VWDOWB.js +0 -17
  124. package/dist-cli/chunks/chunk-GMKGJHVG.js +0 -1
  125. package/dist-cli/chunks/chunk-M3ZEZHOB.js +0 -34
  126. package/dist-cli/chunks/chunk-MWTMLNGM.js +0 -348
  127. package/dist-cli/chunks/chunk-NQKBIKUZ.js +0 -1
  128. package/dist-cli/chunks/chunk-QMRXLBPN.js +0 -11
  129. package/dist-cli/chunks/chunk-X4HQLK4V.js +0 -119
  130. package/dist-cli/chunks/chunk-XOTJSR4T.js +0 -2
  131. package/dist-cli/chunks/chunk-YSQV4D7P.js +0 -1
  132. package/dist-cli/chunks/chunk-Z6HSVZIO.js +0 -100
  133. package/dist-cli/chunks/cli-version-ESQ2S6N5.js +0 -2
  134. package/dist-cli/chunks/control-TDZXFNVT.js +0 -2
  135. package/dist-cli/chunks/demo-app-registry-JAYU7BBM.js +0 -2
  136. package/dist-cli/chunks/drivers-SIY6JBEM.js +0 -2
  137. package/dist-cli/chunks/flow-BZEWL7UQ.js +0 -2
  138. package/dist-cli/chunks/inspect-T5NC7HHB.js +0 -1025
  139. package/dist-cli/chunks/install-YTJI5RS7.js +0 -2
  140. package/dist-cli/chunks/record-DHDSXC2Y.js +0 -51
  141. package/dist-cli/chunks/runtime-AJP6V5LM.js +0 -2
  142. package/dist-cli/chunks/screenshot-4KPEEI6I.js +0 -28
  143. package/dist-cli/chunks/setup-repo-D56L3CEB.js +0 -2
  144. package/dist-cli/chunks/store-Z32KZ34K.js +0 -2
  145. package/dist-cli/chunks/telemetry-RFTX2BZK.js +0 -2
  146. package/dist-cli/chunks/upload-G5C7LJWG.js +0 -2
  147. package/dist-cli/chunks/what-happened-BUXSJ3QS.js +0 -15
@@ -0,0 +1,3 @@
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as y}from"./chunk-IB4BRND4.js";import{existsSync as S,mkdirSync as h,readFileSync as b,writeFileSync as H,rmSync as p}from"fs";import{tmpdir as m}from"os";import{dirname as v,join as w}from"path";var d=new Map;function s(e,r){d.set(e,r)}var c=1;function i(){return w(m(),`sootsim-cli-hints-${y()}.json`)}function l(){return w(m(),"sootsim-cli-hints-global.json")}function u(e){if(!S(e))return{version:c,shown:{}};try{let r=JSON.parse(b(e,"utf8"));return r?.version!==c||!r?.shown?{version:c,shown:{}}:r}catch{return{version:c,shown:{}}}}function f(e,r){try{h(v(e),{recursive:!0}),H(e,JSON.stringify(r)+`
3
+ `)}catch{}}function F(){let e=(process.env.SOOTSIM_HINTS||"").toLowerCase();return e==="off"||e==="0"||e==="false"?"off":e==="always"||e==="verbose"?"always":"normal"}function x(e,r){let o=F();if(o==="off")return!1;if(o==="always"||r==="always")return!0;let n=Date.now();if(r==="once-per-identity"){let t=u(i());return t.shown[e]?!1:(t.shown[e]=n,f(i(),t),!0)}if(r==="once-ever"){let t=u(l());return t.shown[e]?!1:(t.shown[e]=n,f(l(),t),!0)}if(typeof r=="object"&&"cooldownMs"in r){let t=u(i()),a=t.shown[e]??0;return n-a<r.cooldownMs?!1:(t.shown[e]=n,f(i(),t),!0)}return!0}function k(e,...r){let o=d.get(e);if(!o)return process.env.SOOTSIM_HINTS_DEBUG&&console.error(` [hints] no hint registered for id "${e}"`),!1;if(!x(e,o.frequency))return!1;let n=o.render(...r);if(n==null)return!1;let t=Array.isArray(n)?n:[n],a=o.stream==="error"?console.error:console.log;for(let g of t)a(` hint: ${g}`);return!0}function M(){p(i(),{force:!0})}function O(){p(l(),{force:!0})}function T(){return Array.from(d.entries()).map(([e,r])=>({id:e,frequency:r.frequency}))}s("app-still-loading",{frequency:{cooldownMs:6e4},render:e=>`app may still be loading (${e} nodes). run \`sootsim wait ready\` first.`});s("wait-selector-for-missing-testid",{frequency:"once-per-identity",render:e=>`sootsim wait selector ${e}`,stream:"error"});s("prefer-cli-over-eval",{frequency:"once-per-identity",render:e=>e.length?["try the CLI shortcut instead:",...e.map(r=>` ${r}`)]:null,stream:"error"});s("describe-use-filters",{frequency:"once-per-identity",render:()=>["describe output is long. narrow it with:"," sootsim describe --only '*Bottom Sheet*'"," sootsim describe --testid-like 'swap-*'"," sootsim describe --subtree <testID>"]});s("describe-filter-context",{frequency:"once-per-identity",render:()=>["filtered describe is search output, not current-route proof.","run `sootsim describe` without filters after navigation; clipped nodes are marked `(clipped:...)`."]});s("subtree-root-not-found",{frequency:"always",render:e=>`no node with testID/id "${e}" \u2014 try \`sootsim find --testid ${e}\` to discover available ids.`,stream:"error"});export{k as a,M as b,O as c,T as d};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  function t(_){return`(async () => {
3
3
  const __t = window.__sootsimTest
4
4
  if (!__t) throw new Error('__sootsimTest not available')
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as u}from"./chunk-FXF2FHPI.js";var S=52,l=18,h=42,x=96,g=54,E=1.5,$="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",w=1;function y(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+x:t.height+28,c=9.5,b=w,p=a+c*2,m=d+w*2,f=c+(o?l:14),B=o?h:14,H=o?S:t.cornerRadius+14,v=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:H,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:$,buttons:v,legacyHomeButton:o?{top:h+t.height+(x-g)/2,left:t.width/2-g/2+l,size:g,ring:E}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function L(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as u}from"./chunk-NYR3Z44O.js";var S=52,l=18,h=42,x=96,g=54,E=1.5,$="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",w=1;function y(e){let t=u(e),r=t.scale,o=!t.dynamicIsland&&t.homeIndicatorHeight===0&&t.cornerRadius===0,n=t.width,i=t.height,a=o?t.width+l*2:t.width+28,d=o?t.height+h+x:t.height+28,c=9.5,b=w,p=a+c*2,m=d+w*2,f=c+(o?l:14),B=o?h:14,H=o?S:t.cornerRadius+14,v=[{side:"right",top:t.hardwareButtons.lock.top,height:t.hardwareButtons.lock.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.ringToggle.top,height:t.hardwareButtons.ringToggle.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeUp.top,height:t.hardwareButtons.volumeUp.height,width:t.hardwareButtons.width},{side:"left",top:t.hardwareButtons.volumeDown.top,height:t.hardwareButtons.volumeDown.height,width:t.hardwareButtons.width}];return{model:e,renderScale:r,outerWidth:Math.round(p*r),outerHeight:Math.round(m*r),logicalOuterWidth:p,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:d,logicalFrameLeft:c,logicalFrameTop:b,logicalScreenWidth:n,logicalScreenHeight:i,logicalScreenLeft:f,logicalScreenTop:B,logicalScreenRadius:o?0:t.cornerRadius,logicalFrameRadius:H,frameBackground:o?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:o?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:o?null:$,buttons:v,legacyHomeButton:o?{top:h+t.height+(x-g)/2,left:t.width/2-g/2+l,size:g,ring:E}:null,showHomeIndicator:t.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:t.homeIndicatorHeight}}function L(e){let t=e.side==="right",r=t?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
3
3
  <div
4
4
  aria-hidden="true"
5
5
  style="
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as d}from"./chunk-G4VWDOWB.js";import{a as p,d as w,h as $,j as y}from"./chunk-NCSGLZRV.js";import{A as g,B as f,i as h,y as m,z as a}from"./chunk-BEQD2DSK.js";import b from"fs";import{WebSocket as D}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){R();return}switch(o){case"install":return O(t,e);case"list":case"ls":return S(t);case"use":return T(t);case"remove":case"rm":return N(t);case"which":case"active":return F();default:console.error(` unknown runtime subcommand: ${o}`),R(),process.exit(1)}}function R(){console.log(`
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as d}from"./chunk-U47AHSGE.js";import{a as p,d as w,h as $,j as y}from"./chunk-YGQV3CUV.js";import{A as g,B as f,i as h,y as m,z as a}from"./chunk-HW5YHSIE.js";import b from"fs";import{WebSocket as D}from"ws";async function P(n,e={}){let[o,...t]=n;if(!o||o==="--help"||o==="-h"){R();return}switch(o){case"install":return O(t,e);case"list":case"ls":return S(t);case"use":return T(t);case"remove":case"rm":return N(t);case"which":case"active":return F();default:console.error(` unknown runtime subcommand: ${o}`),R(),process.exit(1)}}function R(){console.log(`
3
3
  sootsim runtime \u2014 manage engine runtimes under ~/.sootsim/runtimes/
4
4
 
5
5
  usage:
@@ -22,4 +22,4 @@ examples:
22
22
  sootsim runtime install 1.2.3
23
23
  sootsim runtime install --channel beta
24
24
  sootsim runtime use 1.2.3
25
- `)}async function O(n,e){let{version:o,flags:t}=_(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await y({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-DCUNA3CD.js"),t=o();if(!e(t))return!1;let s=d();return new Promise(l=>{let c=!1,i=!1,u=x=>{c||(c=!0,l(x))},r=new D(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),v=setTimeout(()=>{try{r.close()}catch{}u(i)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:n,id:0})),i=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(v),u(i)}),r.on("error",()=>{clearTimeout(v),u(!1)})})}async function S(n){m();let e=f(),o=a();if(console.log("installed:"),e.length===0)console.log(" (none)");else for(let t of e)console.log(` ${t===o?"*":" "} ${t}`);try{let t=await $();console.log("available (latest per channel):");for(let[s,l]of Object.entries(t.channels))console.log(` ${s.padEnd(8)} ${l.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${I(t)})`)}}async function T(n){let e=n[0];e||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let o=f();o.includes(e)||(console.error(` version ${e} is not installed`),console.error(` installed: ${o.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${e}\` first`),process.exit(1)),await k(e)}async function N(n){let e=n[0];e||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),a()===e&&(console.error(` cannot remove active runtime ${e}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=h(e);if(!b.existsSync(t)){console.error(` ${e} is not installed`);return}b.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${e}`)}async function F(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}function _(n){let e={},o=[];for(let t=0;t<n.length;t++){let s=n[t];if(s==="--channel"&&t+1<n.length){e.channel=n[t+1],t++;continue}if(s.startsWith("--channel=")){e.channel=s.slice(10);continue}if(s==="--force"){e.force=!0;continue}if(s==="--set-active=false"||s==="--no-set-active"){e.setActive=!1;continue}o.push(s)}return{version:o[0]??null,flags:e}}function I(n){return n instanceof Error?n.message:String(n)}export{P as a};
25
+ `)}async function O(n,e){let{version:o,flags:t}=_(n),s=t.channel??e.channel??"stable",l=t.force===!0,c=t.setActive!==!1;m(),console.log("sootsim runtime install"),console.log(` cdn: ${w()}`);try{let i=await y({version:o,channel:s,force:l,setActive:c});console.log(` version: ${i.version} (channel: ${i.channel})`),i.installed?console.log(` installed ${i.version}`):console.log(` already installed at ${i.runtimeDir}`),c&&await k(i.version)}catch(i){console.error(` ${I(i)}`),process.exit(1)}}async function k(n){g(n),console.log(` active: ${n}`),await A(n)||console.log(` (no daemon running \u2014 next sootsim/electron launch will pick up ${n})`)}async function A(n){let{isDaemonLockfileFresh:e,readDaemonLockfile:o}=await import("./home-paths-R2YZZTUM.js"),t=o();if(!e(t))return!1;let s=d();return new Promise(l=>{let c=!1,i=!1,u=x=>{c||(c=!0,l(x))},r=new D(`ws://127.0.0.1:${s}`,{handshakeTimeout:800}),v=setTimeout(()=>{try{r.close()}catch{}u(i)},1500);r.on("open",()=>{try{r.send(JSON.stringify({type:"runtime:use",version:n,id:0})),i=!0}catch{}setTimeout(()=>{try{r.close()}catch{}},100)}),r.on("close",()=>{clearTimeout(v),u(i)}),r.on("error",()=>{clearTimeout(v),u(!1)})})}async function S(n){m();let e=f(),o=a();if(console.log("installed:"),e.length===0)console.log(" (none)");else for(let t of e)console.log(` ${t===o?"*":" "} ${t}`);try{let t=await $();console.log("available (latest per channel):");for(let[s,l]of Object.entries(t.channels))console.log(` ${s.padEnd(8)} ${l.latest}`)}catch(t){console.log(`available: (could not fetch manifest: ${I(t)})`)}}async function T(n){let e=n[0];e||(console.error(" usage: sootsim runtime use <version>"),process.exit(1));let o=f();o.includes(e)||(console.error(` version ${e} is not installed`),console.error(` installed: ${o.join(", ")||"(none)"}`),console.error(` run \`sootsim runtime install ${e}\` first`),process.exit(1)),await k(e)}async function N(n){let e=n[0];e||(console.error(" usage: sootsim runtime remove <version>"),process.exit(1)),a()===e&&(console.error(` cannot remove active runtime ${e}`),console.error(" switch with `sootsim runtime use <other>` first, or install another version"),process.exit(1));let t=h(e);if(!b.existsSync(t)){console.error(` ${e} is not installed`);return}b.rmSync(t,{recursive:!0,force:!0}),console.log(` removed ${e}`)}async function F(){let n=a();if(!n){console.log(" no active runtime");return}console.log(n)}function _(n){let e={},o=[];for(let t=0;t<n.length;t++){let s=n[t];if(s==="--channel"&&t+1<n.length){e.channel=n[t+1],t++;continue}if(s.startsWith("--channel=")){e.channel=s.slice(10);continue}if(s==="--force"){e.force=!0;continue}if(s==="--set-active=false"||s==="--no-set-active"){e.setActive=!1;continue}o.push(s)}return{version:o[0]??null,flags:e}}function I(n){return n instanceof Error?n.message:String(n)}export{P as a};
@@ -1,3 +1,3 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{l as P,n as a,y as m}from"./chunk-BEQD2DSK.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{l as P,n as a,y as m}from"./chunk-HW5YHSIE.js";import l from"fs";import c from"path";var s="default",S="profiles.json",i=1;function o(e){let r=e.trim();if(!r)throw new Error("profile id is required");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(r))throw new Error("profile ids must start with a letter or number and contain only letters, numbers, dot, dash, or underscore");if(r==="."||r==="..")throw new Error(`invalid profile id: ${r}`);return r}function d(){return c.join(a(),S)}function I(e){return`sootsim-profile-${o(e)}`}function h(e){return c.join(P(),"Partitions",I(e))}function A(e){return c.join(a(),"playwright",o(e))}function u(){try{let e=JSON.parse(l.readFileSync(d(),"utf8"));if(!e||e.version!==i)return{version:i,profiles:[]};let r=Array.isArray(e.profiles)?e.profiles.filter(t=>!!t&&typeof t.id=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string").map(t=>({id:o(t.id),createdAt:t.createdAt,updatedAt:t.updatedAt})):[];return{version:i,profiles:r}}catch{return{version:i,profiles:[]}}}function x(e){return[...e].sort((r,t)=>r.id===s?-1:t.id===s?1:r.id.localeCompare(t.id))}function p(e){if(e.profiles.some(t=>t.id===s))return{...e,profiles:x(e.profiles)};let r=new Date().toISOString();return{version:i,profiles:x([{id:s,createdAt:r,updatedAt:r},...e.profiles])}}function g(e){m();let r=p(e),t=`${d()}.tmp`;return l.writeFileSync(t,`${JSON.stringify(r,null,2)}
3
3
  `,"utf8"),l.renameSync(t,d()),r}function y(){return g(u()).profiles}function E(e){let r=o(e);return y().find(t=>t.id===r)??null}function _(e=s){let r=o(e),t=E(r);return t||D(r)}function D(e){let r=o(e),t=p(u());if(t.profiles.some(w=>w.id===r))throw new Error(`profile already exists: ${r}`);let f=new Date().toISOString(),n={id:r,createdAt:f,updatedAt:f};return g({version:i,profiles:[...t.profiles,n]}),n}function F(e){let r=o(e);if(r===s)throw new Error("the default profile cannot be deleted; clear it instead");let t=p(u()),f=t.profiles.find(n=>n.id===r);if(!f)throw new Error(`profile not found: ${r}`);return g({version:i,profiles:t.profiles.filter(n=>n.id!==r)}),v(r),f}function v(e){let r=o(e);for(let t of[h(r),A(r)])try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}export{A as a,y as b,_ as c,D as d,F as e,v as f};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as R}from"./chunk-M2Q4FXRE.js";import{l as D}from"./chunk-BEQD2DSK.js";import{a as T}from"./chunk-D4VEI6MI.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(y.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??y.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let t;try{t=(await import("./demo-app-registry-JAYU7BBM.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(h(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(h(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(h(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as R}from"./chunk-F4RC4AOY.js";import{l as D}from"./chunk-HW5YHSIE.js";import{a as T}from"./chunk-TLTS533S.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import y from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function h(){return _()}function U(){return y.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(y.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(y.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=y.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??y.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function ye(){return S().attachedProjects}var Q=336*60*60*1e3;function he(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let t;try{t=(await import("./demo-app-registry-LWT6JLU6.js")).APPS}catch(n){console.warn("[sootsim] seedFromDemoAppRegistry: could not load demo registry:",n.message);return}if(!Array.isArray(t))return;let r=t;w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=y.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(h(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(h(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(h(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),P=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&P.push("--codex-bin",e.codexBin),e.claudeBin&&P.push("--claude-bin",e.claudeBin),e.freshThread&&P.push("--fresh-thread"),o&&P.push("--claude-session-uuid",o);let x=V(A,P,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:h()}});x.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(x.pid)try{process.kill(x.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:x.pid,status:"idle"}),{session:k(s.id),wrapperPid:x.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
3
3
  `)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Re(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=j(e),n=h();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ne(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,f.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ee.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let c=I(d);c&&t(c)});let a=!1;return()=>{if(!a){a=!0;try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ae(e,t,r){let n=i.openSync(e,f.O_RDWR|f.O_NONBLOCK),o=Buffer.alloc(8192),s="",a=Date.now()+r;try{for(;Date.now()<a;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(c){if(c.code!=="EAGAIN")throw c;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let c;for(;(c=s.indexOf(`
4
4
  `))>=0;){let g=s.slice(0,c);s=s.slice(c+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(c=>setTimeout(c,30))}return null}finally{i.closeSync(n)}}export{I as a,h as b,ge as c,F as d,ye as e,he as f,Se as g,we as h,k as i,C as j,v as k,ve as l,j as m,W as n,J as o,te as p,O as q,re as r,l as s,Te as t,De as u,Re as v,Ne as w};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ var O="sootsim close";export{O as a};
@@ -0,0 +1,186 @@
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as u,b as f}from"./chunk-ZO7SGE65.js";import{a as p,c as h}from"./chunk-5WRBVYML.js";import{a as c,b as m,c as d}from"./chunk-ZP2HMCKS.js";function T(){let e=c();return e?{available:!0,reason:null,detail:e}:{available:!1,reason:"no chromium-family browser found (chrome, chromium, edge, brave, arc)"}}async function O(e){if(e.headless)return{launched:!1,message:"the chromium driver launches a visible browser window and cannot run headless \u2014 a headless `chrome --headless=new` process exits immediately and the sim never connects. for headless automation use `--driver playwright`."};let r=c();if(!r)return{launched:!1,message:"chromium not found \u2014 install chrome or run `sootsim list --drivers`"};if(!e.url)return{launched:!1,message:"chromium driver requires a target url"};if(e.profileId||e.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current Chrome profile"};try{let t=await d(e.url,{detached:e.detached??!0});return{launched:!0,message:`chromium launched \u2192 ${e.url}`,pid:t.pid,target:t.target??r,attachUrl:e.url}}catch(t){return{launched:!1,message:`chromium spawn failed: ${t instanceof Error?t.message:String(t)}`}}}var v={id:"chromium",name:"chromium",description:"system chrome / chromium / edge \u2014 visible window (headless: use playwright)",kind:"browser",availability:T,launch:O};function I(){let e=u();return e?{available:!0,reason:null,detail:`${e.kind} @ ${e.path}`}:{available:!1,reason:"sootsim desktop app not installed (run `sootsim install-desktop`)"}}async function x(e){let r=u();if(!r)return{launched:!1,message:"sootsim desktop app not installed"};try{let t=await f(e.url,r,{device:e.device,profileId:e.profileId,ephemeralProfile:e.ephemeralProfile});return t.launched?{launched:!0,message:e.url?`electron launched via ${t.via} \u2192 ${e.url}`:`electron launched via ${t.via}`,target:t.target,attachUrl:e.url}:{launched:!1,message:"desktop companion failed to start"}}catch(t){return{launched:!1,message:`electron launch failed: ${t instanceof Error?t.message:String(t)}`}}}var w={id:"electron",name:"electron",description:"sootsim desktop companion app (native window, menu bar)",kind:"native",availability:I,launch:x};import{spawn as A}from"child_process";import{closeSync as M,mkdtempSync as _,openSync as L,readFileSync as E}from"fs";import{createRequire as C}from"module";import{tmpdir as g}from"os";import{join as y}from"path";var R=`
3
+ const modulePath = process.env.SOOTSIM_PW_MODULE;
4
+ const url = process.env.SOOTSIM_PW_URL;
5
+ const headless = process.env.SOOTSIM_PW_HEADLESS === '1';
6
+ const userDataDir = process.env.SOOTSIM_PW_USERDATADIR || '';
7
+ const closeTimeoutMs = Number(process.env.SOOTSIM_PW_CLOSE_TIMEOUT_MS || 2500);
8
+ const connectAckFile = process.env.SOOTSIM_PW_CONNECTED_ACK_FILE || '';
9
+ const { existsSync, unlinkSync } = require('fs');
10
+ (async () => {
11
+ const pw = require(modulePath);
12
+ let browser = null;
13
+ let context;
14
+ let keepAlive = null;
15
+ let connectTimer = null;
16
+ let connectAckPoll = null;
17
+ let connected = false;
18
+ let shuttingDown = false;
19
+ const clearConnectTimer = () => {
20
+ if (connectTimer) {
21
+ clearTimeout(connectTimer);
22
+ connectTimer = null;
23
+ }
24
+ if (connectAckPoll) {
25
+ clearInterval(connectAckPoll);
26
+ connectAckPoll = null;
27
+ }
28
+ };
29
+ const markConnected = () => {
30
+ connected = true;
31
+ clearConnectTimer();
32
+ };
33
+ const ackFileExists = () => {
34
+ if (!connectAckFile) return false;
35
+ try { return existsSync(connectAckFile); } catch { return false; }
36
+ };
37
+ const bounded = async (label, work, timeoutMs) => {
38
+ let timer = null;
39
+ try {
40
+ const timeout = new Promise((resolve) => {
41
+ timer = setTimeout(() => resolve({ timedOut: true }), timeoutMs);
42
+ });
43
+ if (typeof timer.unref === 'function') timer.unref();
44
+ const result = await Promise.race([
45
+ Promise.resolve().then(work).then(
46
+ () => ({ timedOut: false }),
47
+ (error) => ({ timedOut: false, error }),
48
+ ),
49
+ timeout,
50
+ ]);
51
+ if (result && result.timedOut) {
52
+ process.stderr.write('[shutdown-timeout] ' + label + ' exceeded ' + timeoutMs + 'ms\\n');
53
+ return false;
54
+ }
55
+ if (result && result.error) {
56
+ process.stderr.write('[shutdown-error] ' + label + ': ' + String((result.error && result.error.message) || result.error) + '\\n');
57
+ return false;
58
+ }
59
+ return true;
60
+ } finally {
61
+ if (timer) clearTimeout(timer);
62
+ }
63
+ };
64
+ const maybeBrowser = () => {
65
+ if (browser) return browser;
66
+ if (context && typeof context.browser === 'function') {
67
+ try { return context.browser(); } catch {}
68
+ }
69
+ return null;
70
+ };
71
+ const browserProcess = () => {
72
+ const b = maybeBrowser();
73
+ if (b && typeof b.process === 'function') {
74
+ try { return b.process(); } catch {}
75
+ }
76
+ return null;
77
+ };
78
+ const processIsAlive = (proc) => {
79
+ if (!proc || !proc.pid) return false;
80
+ try {
81
+ process.kill(proc.pid, 0);
82
+ return true;
83
+ } catch (err) {
84
+ return err && err.code === 'EPERM';
85
+ }
86
+ };
87
+ const terminateBrowserProcess = async () => {
88
+ const proc = browserProcess();
89
+ if (!proc || !proc.pid || !processIsAlive(proc)) return;
90
+ try { proc.kill('SIGTERM'); } catch {}
91
+ await bounded('browser process exit after SIGTERM', async () => {
92
+ while (processIsAlive(proc)) {
93
+ await new Promise((resolve) => setTimeout(resolve, 50));
94
+ }
95
+ }, 600);
96
+ if (!processIsAlive(proc)) return;
97
+ try { proc.kill('SIGKILL'); } catch {}
98
+ };
99
+ const shutdown = async (code = 0) => {
100
+ if (shuttingDown) return;
101
+ shuttingDown = true;
102
+ clearConnectTimer();
103
+ if (keepAlive) clearInterval(keepAlive);
104
+ const timeoutMs = Number.isFinite(closeTimeoutMs) && closeTimeoutMs > 0 ? closeTimeoutMs : 2500;
105
+ if (context) await bounded('context.close', () => context.close(), timeoutMs);
106
+ const b = maybeBrowser();
107
+ if (b) await bounded('browser.close', () => b.close(), timeoutMs);
108
+ await terminateBrowserProcess();
109
+ if (connectAckFile) {
110
+ try { unlinkSync(connectAckFile); } catch {}
111
+ }
112
+ process.exit(code);
113
+ };
114
+ process.once('SIGTERM', () => { void shutdown(0); });
115
+ process.once('SIGINT', () => { void shutdown(0); });
116
+ // use the real Google Chrome install, not Playwright's bundled Chromium /
117
+ // Chrome for Testing builds. local SootSim sessions should look like the
118
+ // user's browser and must not leave behind a pile of "Chrome for Testing"
119
+ // processes. NOTE: this is NOT enough to make \`sootsim cpu-profile\`
120
+ // work \u2014 that profiles the tenant *worker*, and the JS Self-Profiler API
121
+ // cannot be constructed in a dedicated worker by any means (see
122
+ // worker-handlers/cpu-profile.ts). cpu-profile needs a CDP-based profiler
123
+ // instead.
124
+ const launchOpts = { headless, channel: 'chrome' };
125
+ if (userDataDir) {
126
+ context = await pw.chromium.launchPersistentContext(userDataDir, launchOpts);
127
+ } else {
128
+ browser = await pw.chromium.launch(launchOpts);
129
+ context = await browser.newContext();
130
+ }
131
+ const hostMeta = {
132
+ sootsimHostDriver: 'playwright',
133
+ sootsimHostPid: process.pid,
134
+ sootsimHostStartedAt: Date.now(),
135
+ };
136
+ await context.addInitScript({
137
+ content: 'Object.defineProperty(window, "__sootsimHostMeta", { value: ' + JSON.stringify(hostMeta) + ', configurable: true });',
138
+ });
139
+ await context.exposeBinding('__sootsimHostClose', async () => {
140
+ await shutdown(0);
141
+ });
142
+ const connectTimeoutMs = Number(process.env.SOOTSIM_PW_CONNECT_TIMEOUT_MS || 120000);
143
+ if (connectAckFile) {
144
+ connectAckPoll = setInterval(() => {
145
+ if (ackFileExists()) markConnected();
146
+ }, 500);
147
+ if (typeof connectAckPoll.unref === 'function') connectAckPoll.unref();
148
+ }
149
+ connectTimer = setTimeout(() => {
150
+ if (ackFileExists()) {
151
+ markConnected();
152
+ return;
153
+ }
154
+ if (connected) return;
155
+ process.stderr.write('[connect-timeout] sim did not register with the bridge within ' + connectTimeoutMs + 'ms; closing playwright host\\n');
156
+ void shutdown(2);
157
+ }, Number.isFinite(connectTimeoutMs) && connectTimeoutMs > 0 ? connectTimeoutMs : 120000);
158
+ if (typeof connectTimer.unref === 'function') connectTimer.unref();
159
+ const page = await context.newPage();
160
+ // surface page-side failures (engine boot crash, failed WS registration)
161
+ // to stderr so a sim that never connects produces a real diagnostic
162
+ // instead of a silent "timed out waiting for opened sim to connect".
163
+ page.on('pageerror', (e) => {
164
+ process.stderr.write('[pageerror] ' + ((e && e.stack) || e) + '\\n');
165
+ });
166
+ page.on('console', (m) => {
167
+ if (m.type() === 'error') {
168
+ process.stderr.write('[console.error] ' + m.text() + '\\n');
169
+ }
170
+ });
171
+ page.on('crash', () => process.stderr.write('[page] renderer crashed\\n'));
172
+ try {
173
+ await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
174
+ } catch (err) {
175
+ process.stderr.write('[goto] ' + String((err && err.message) || err) + '\\n');
176
+ }
177
+ keepAlive = setInterval(() => {}, 1 << 30);
178
+ if (browser) browser.on('disconnected', () => { void shutdown(0); });
179
+ context.on('close', () => { void shutdown(0); });
180
+ page.on('close', () => { void shutdown(0); });
181
+ })().catch((err) => {
182
+ process.stderr.write(String((err && err.stack) || err) + '\\n');
183
+ process.exit(1);
184
+ });
185
+ `;function b(){let e=[process.cwd()+"/"];try{process.argv[1]&&e.push(process.argv[1])}catch{}for(let r of e)try{let t=C(r);for(let i of["playwright","playwright-chromium","playwright-core"])try{return{spec:i,modulePath:t.resolve(i)}}catch{}}catch{}return null}function $(){let e=b();return e?{available:!0,reason:null,detail:`resolved via ${e.spec}`}:{available:!1,reason:"playwright not installed in the current workspace"}}function U(e){return e.profileId?p(h(e.profileId).id):e.ephemeralProfile?_(y(g(),"sootsim-playwright-profile-")):""}async function F(e){let r=b();if(!r)return{launched:!1,message:"playwright not installed \u2014 run `bun add -D playwright` first"};if(!e.url)return{launched:!1,message:"playwright driver requires a target url"};let t=y(g(),`sootsim-playwright-host-${Date.now().toString(36)}-${process.pid}.log`),i=`${t}.connected`,a=L(t,"a");try{let n=A(process.execPath,["-e",R],{detached:!0,stdio:["ignore","ignore",a],env:{...process.env,SOOTSIM_PW_MODULE:r.modulePath,SOOTSIM_PW_URL:e.url,SOOTSIM_PW_HEADLESS:e.headless??!0?"1":"0",SOOTSIM_PW_USERDATADIR:U(e),SOOTSIM_PW_CONNECTED_ACK_FILE:i}});n.unref();let l=await new Promise(o=>{let k=setTimeout(()=>o(null),4e3);n.once("exit",P=>{clearTimeout(k),o(P??0)})});if(l!==null&&l!==0){let o=E(t,"utf8").trim();return{launched:!1,message:`playwright host exited early (code ${l}) \u2014 host log ${t}${o?`:
186
+ ${o}`:""}`}}return{launched:!0,message:`playwright chrome launched \u2192 ${e.url}`,pid:n.pid,target:r.spec,attachUrl:e.url,connectAckFile:i}}catch(n){return{launched:!1,message:`playwright launch failed: ${n instanceof Error?n.message:String(n)}`}}finally{M(a)}}var D={id:"playwright",name:"playwright",description:"programmatic chromium via the playwright package \u2014 headless default",kind:"automation",availability:$,launch:F};function W(){return process.platform!=="darwin"&&process.platform!=="linux"&&process.platform!=="win32"?{available:!1,reason:`unsupported platform: ${process.platform}`}:{available:!0,reason:null,detail:process.platform==="darwin"?"open(1)":process.platform==="win32"?"cmd /c start":"xdg-open(1)"}}async function N(e){if(e.headless)return{launched:!1,message:"system driver does not support --headless; use chromium or playwright"};if(!e.url)return{launched:!1,message:"system driver requires a target url"};if(e.profileId||e.ephemeralProfile)return{launched:!1,message:"profiles require electron or playwright; browser tabs use your current browser profile"};try{let r=await m(e.url,{detached:e.detached??!0,newWindow:e.newWindow});return{launched:!0,message:`${r.via} launch \u2192 ${e.url}`,pid:r.pid,target:r.target,attachUrl:e.url}}catch(r){return{launched:!1,message:`system launch failed: ${r instanceof Error?r.message:String(r)}`}}}var S={id:"system",name:"system",description:"shared browser launcher \u2014 system default or chromium window",kind:"delegate",availability:W,launch:N};var s=[v,w,D,S];function ne(){return s}function oe(e){return s.find(r=>r.id===e)??null}function se(e,r){if(e)return s.find(i=>i.id===e)??null;for(let t of r){let i=s.find(a=>a.id===t);if(i&&i.availability().available)return i}return null}function ae(){return s.map(e=>{let r=e.availability();return{id:e.id,name:e.name,kind:e.kind,description:e.description,available:r.available,reason:r.reason,detail:r.detail??null}})}export{v as a,w as b,D as c,S as d,s as e,ne as f,oe as g,se as h,ae as i};
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n){let s=e.indexOf(r);if(s>=0&&e[s+1]){let i=Number(e[s+1]);if(Number.isFinite(i))return Math.max(100,i)}}return t}async function v(e){let t=await e.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof t=="number"?t:0}}async function I(e,t=5){let n=await e.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${t}))()`});return{depth:t,tree:n}}async function _(e){let t=await e.send({type:"evaluate",code:"window.location.href"});return{url:typeof t=="string"?t:""}}async function k(e,t){let n=`(async () => {
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ function k(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n){let s=e.indexOf(r);if(s>=0&&e[s+1]){let a=Number(e[s+1]);if(Number.isFinite(a))return Math.max(100,a)}}return t}async function E(e){let t=await e.send({type:"evaluate",code:"(async () => await window.__sootsimTest.getNodeCount())()"});return{nodes:typeof t=="number"?t:0}}async function P(e,t=5){let n=await e.send({type:"evaluate",code:`(async () => await window.__sootsimTest.dumpTree(${t}))()`});return{depth:t,tree:n}}async function A(e){let t=await e.send({type:"evaluate",code:"window.location.href"});return{url:typeof t=="string"?t:""}}async function L(e,t){let n=`(async () => {
3
3
  const t = window.__sootsimTest
4
4
  const mainShell = window.SootSim?.bridges?.mainShell
5
5
  const kb = window.__sootsimKeyboard
@@ -14,7 +14,7 @@ function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n
14
14
  const nodeCount = (await t.getNodeCount?.()) || 0
15
15
  const keyboard = kb && typeof kb.getLayout === 'function' ? kb.getLayout() : null
16
16
  return { tree, shell, nodeCount, keyboard }
17
- })()`;return await e.send({type:"evaluate",code:n})??{}}var y=`(async () => {
17
+ })()`;return await e.send({type:"evaluate",code:n})??{}}var m=`(async () => {
18
18
  const t = window.__sootsimTest
19
19
  if (!t) return []
20
20
 
@@ -87,7 +87,7 @@ function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n
87
87
  return all
88
88
  .filter(n => isVisibleTarget(n) && hasAccessibleSignal(n))
89
89
  .map(normalize)
90
- })()`;async function E(e){let t=await e.send({type:"evaluate",code:y});return Array.isArray(t)?t:[]}var l=`
90
+ })()`;async function D(e){let t=await e.send({type:"evaluate",code:m});return Array.isArray(t)?t:[]}var y=`
91
91
  const fromInspectable = async () => {
92
92
  if (typeof t.listInspectable !== 'function') return null
93
93
  const list = await t.listInspectable({})
@@ -159,19 +159,19 @@ function T(e,t){let n=["--max-ms","--maxMs","--maxms","--max_ms"];for(let r of n
159
159
  abs.y < screenH
160
160
  )
161
161
  }
162
- `;function p(e){return e.testId?{mode:"testid",code:`(async () => {
162
+ `;function f(e){return e.testId?{mode:"testid",code:`(async () => {
163
163
  const t = window.__sootsimTest
164
164
  return (await t.findByTestId(${JSON.stringify(e.testId)})) || (await t.findById(${JSON.stringify(e.testId)}))
165
165
  })()`}:e.role?{mode:"role",code:`(async () => await window.__sootsimTest.queryAll({ hasRole: ${JSON.stringify(e.role)}, pruneHidden: true }))()`}:e.type?{mode:"type",code:`(async () => await window.__sootsimTest.queryAll({ type: ${JSON.stringify(e.type)}, pruneHidden: true }))()`}:e.pressable?{mode:"pressable",code:`(async () => {
166
166
  const t = window.__sootsimTest
167
- ${l}
167
+ ${y}
168
168
  const inspectable = await fromInspectable()
169
169
  if (inspectable) return inspectable.filter(n => n.pressable && isVisibleTarget(n))
170
170
  const all = await t.queryAll({ pruneHidden: true })
171
171
  return all.filter(n => n.pressable && isVisibleTarget(n))
172
172
  })()`}:e.interactive?{mode:"interactive-targets",code:`(async () => {
173
173
  const t = window.__sootsimTest
174
- ${l}
174
+ ${y}
175
175
  const inspectable = await fromInspectable()
176
176
  if (inspectable) {
177
177
  return inspectable.filter(n => n.pressable && isVisibleTarget(n))
@@ -181,7 +181,7 @@ ${l}
181
181
  })()`}:e.visible?{mode:"visible",code:`(async () => {
182
182
  const all = await window.__sootsimTest.queryAll({ pruneHidden: true })
183
183
  return all.filter(n => n.layout && n.layout.width > 0 && n.layout.height > 0)
184
- })()`}:e.text?{mode:"text",code:`(async () => await window.__sootsimTest.findByText(${JSON.stringify(e.text)}))()`}:null}async function R(e,t){let n=p(t);if(!n)return null;let r=await e.send({type:"evaluate",code:n.code});return{mode:n.mode,result:r}}function P(e){return[...e].sort((t,n)=>c(n)-c(t))}function c(e){let t=0;e.testID&&(t+=100),typeof e.text=="string"&&e.text.trim().length>0&&(t+=60),typeof e.accessibilityLabel=="string"&&e.accessibilityLabel.trim().length>0&&(t+=30),e.accessibilityRole&&(t+=15);let n=e.layout?.width??0,r=e.layout?.height??0,s=n*r;return s>=400&&s<=6e4?t+=25:s>6e4&&(t-=20),(e.absolutePosition?.y??0)<0&&(t-=30),t}function A(e){if(e.testID)return`sootsim do tap-id ${u(e.testID)}`;let t=typeof e.text=="string"?e.text.trim():"";if(t.length>0&&t.length<=80)return`sootsim do tap-text ${u(t)}`;let n=Math.round(((e.absolutePosition?.x??0)+(e.layout?.width??0)/2)*10)/10,r=Math.round(((e.absolutePosition?.y??0)+(e.layout?.height??0)/2)*10)/10;return`sootsim do tap ${n} ${r}`}function u(e){return/^[A-Za-z0-9_./@:-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}var b=`(async () => {
184
+ })()`}:e.text?{mode:"text",code:`(async () => await window.__sootsimTest.findByText(${JSON.stringify(e.text)}))()`}:null}async function N(e,t){let n=f(t);if(!n)return null;let r=await e.send({type:"evaluate",code:n.code});return{mode:n.mode,result:r}}function H(e){return[...e].sort((t,n)=>p(n)-p(t))}function p(e){let t=0;e.testID&&(t+=100),typeof e.text=="string"&&e.text.trim().length>0&&(t+=60),typeof e.accessibilityLabel=="string"&&e.accessibilityLabel.trim().length>0&&(t+=30),e.accessibilityRole&&(t+=15);let n=e.layout?.width??0,r=e.layout?.height??0,s=n*r;return s>=400&&s<=6e4?t+=25:s>6e4&&(t-=20),(e.absolutePosition?.y??0)<0&&(t-=30),t}function B(e){if(e.testID)return`sootsim do tap-id ${g(e.testID)}`;let t=typeof e.text=="string"?e.text.trim():"";if(t.length>0&&t.length<=80)return`sootsim do tap-text ${g(t)}`;let n=Math.round(((e.absolutePosition?.x??0)+(e.layout?.width??0)/2)*10)/10,r=Math.round(((e.absolutePosition?.y??0)+(e.layout?.height??0)/2)*10)/10;return`sootsim do tap ${n} ${r}`}function g(e){return/^[A-Za-z0-9_./@:-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}var w=`(async () => {
185
185
  const t = window.__sootsimTest
186
186
  let nodes = 0
187
187
  try { nodes = (await t?.getNodeCount?.()) || 0 } catch {}
@@ -276,7 +276,7 @@ ${l}
276
276
  externalStatus,
277
277
  externalError,
278
278
  }
279
- })()`,g=50,m=100,f=750;function w(e){return e.targets>0||e.nodes>=m}async function L(e,t=2e4){let n=Date.now(),r=n+t,s=-1,i=n,o={flag:void 0,at:0,nodes:0,targets:0,errors:0,loadingText:"",externalReady:null,externalStatus:"",externalError:""};for(;Date.now()<r;){try{o=await e.send({type:"evaluate",code:b})??o}catch{}let a=Date.now();if(o.nodes!==s&&(s=o.nodes,i=a),o.flag===!0&&o.externalReady!==!1&&!o.externalError&&!o.loadingText&&o.nodes>=g&&w(o)&&a-i>=f)return{ready:!0,elapsedMs:a-n,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,externalReady:o.externalReady,externalStatus:o.externalStatus,externalError:o.externalError,errors:o.errors};await new Promise(d=>setTimeout(d,150))}return{ready:!1,elapsedMs:Date.now()-n,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,externalReady:o.externalReady,externalStatus:o.externalStatus,externalError:o.externalError,errors:o.errors}}async function D(e,t,n=5e3){return await e.send({type:"evaluate",code:`(async () => {
279
+ })()`,h=50,x=100,S=750,T=2e3;function v(e){return e.targets>0||e.nodes>=x}function C(e){return e.externalError?`guest app errored: ${e.externalError}`:e.loadingText?`still showing "${e.loadingText}"`:e.externalReady===!1?"guest app is still loading":e.flag!==!0?"guest app has not emitted sootsim:externalAppReady":e.targets<=0?"ready flag emitted but no visible app content is inspectable yet":"node tree is still changing"}async function M(e,t=2e4,n={}){let r=Date.now(),s=r+t,a=n.progressIntervalMs??T,l=r+a,c=-1,u=r,o={flag:void 0,at:0,nodes:0,targets:0,errors:0,loadingText:"",externalReady:null,externalStatus:"",externalError:""};for(;Date.now()<s;){try{o=await e.send({type:"evaluate",code:w})??o}catch{}let i=Date.now(),d={ready:!1,elapsedMs:i-r,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,externalReady:o.externalReady,externalStatus:o.externalStatus,externalError:o.externalError,errors:o.errors};if(o.nodes!==c&&(c=o.nodes,u=i),o.flag===!0&&o.externalReady!==!1&&!o.externalError&&!o.loadingText&&o.nodes>=h&&v(o)&&i-u>=S)return{...d,ready:!0};if(n.onProgress&&a>0&&i>=l){n.onProgress(d);do l+=a;while(i>=l)}await new Promise(b=>setTimeout(b,150))}return{ready:!1,elapsedMs:Date.now()-r,nodes:o.nodes,targets:o.targets,flag:o.flag,loadingText:o.loadingText,externalReady:o.externalReady,externalStatus:o.externalStatus,externalError:o.externalError,errors:o.errors}}async function $(e,t,n=5e3){return await e.send({type:"evaluate",code:`(async () => {
280
280
  const start = Date.now()
281
281
  const deadline = start + ${n}
282
282
  const t = window.__sootsimTest
@@ -295,17 +295,17 @@ ${l}
295
295
  await new Promise((r) => setTimeout(r, 80))
296
296
  }
297
297
  return { found: false, elapsed: Date.now() - start }
298
- })()`})??{found:!1,elapsed:n}}async function N(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getErrors(${t}) || []`});return Array.isArray(n)?n:[]}async function H(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getWarnings(${t}) || []`});return Array.isArray(n)?n:[]}async function B(e){await e.send({type:"evaluate",code:'window.__sootsimConsole?.clear(); "cleared"'})}async function C(e,t={}){let n=t.limit??20,r=t.failed===!1?"getRequests":"getFailedRequests",s=await e.send({type:"call",path:`__sootsimTest.${r}`,args:[n]});return Array.isArray(s)?s:[]}async function M(e){await e.send({type:"call",path:"__sootsimTest.clearRequests",args:[]})}async function $(e){let t=await e.send({type:"evaluate",code:`(() => {
298
+ })()`})??{found:!1,elapsed:n}}async function O(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getErrors(${t}) || []`});return Array.isArray(n)?n:[]}async function W(e,t=20){let n=await e.send({type:"evaluate",code:`window.__sootsimConsole?.getWarnings(${t}) || []`});return Array.isArray(n)?n:[]}async function F(e){await e.send({type:"evaluate",code:'window.__sootsimConsole?.clear(); "cleared"'})}async function z(e,t={}){let n=t.limit??20,r=t.failed===!1?"getRequests":"getFailedRequests",s=await e.send({type:"call",path:`__sootsimTest.${r}`,args:[n]});return Array.isArray(s)?s:[]}async function K(e){await e.send({type:"call",path:"__sootsimTest.clearRequests",args:[]})}async function J(e){let t=await e.send({type:"evaluate",code:`(() => {
299
299
  const obs = window.__sootsimObservability;
300
300
  if (!obs) return { ok: false };
301
301
  return { ok: true, entries: obs.logs.getSnapshot() };
302
- })()`});if(!t||!t.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return t.entries??[]}async function O(e){await e.send({type:"evaluate",code:'window.__sootsimObservability?.logs.clear(); "cleared"'})}function h(e,t){if(e.source===t.source||e.level!==t.level||Math.abs(e.ts-t.ts)>1e3||e.args.length!==t.args.length)return!1;let n=new Set([e.source,t.source]);return!n.has("sootsim-worker")||!n.has("render-worker")&&!n.has("forwarded-render-worker")?!1:e.args.every((r,s)=>r===t.args[s])}function F(e,t={}){let n=[];for(let r of e)n.some(s=>h(s,r))||n.push(r);if(t.showInternal||(n=n.filter(r=>{let s=r.args[0];return!(typeof s=="string"&&s.startsWith("[sootsim]"))})),t.level&&(n=n.filter(r=>t.level.has(r.level))),t.filter){let r=t.filter.toLowerCase();n=n.filter(s=>s.args.join(" ").toLowerCase().includes(r))}return n}async function W(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.summary",args:[t]})}async function z(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.recent",args:[t]})}async function K(e,t,n){await e.send({type:"call",path:"SootSim.bridges.timeline.cursorAdvance",args:[t,n]})}async function J(e){return await e.send({type:"evaluate",code:`(() => {
302
+ })()`});if(!t||!t.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return t.entries??[]}async function V(e){await e.send({type:"evaluate",code:'window.__sootsimObservability?.logs.clear(); "cleared"'})}function I(e,t){if(e.source===t.source||e.level!==t.level||Math.abs(e.ts-t.ts)>1e3||e.args.length!==t.args.length)return!1;let n=new Set([e.source,t.source]);return!n.has("sootsim-worker")||!n.has("render-worker")&&!n.has("forwarded-render-worker")?!1:e.args.every((r,s)=>r===t.args[s])}function j(e,t={}){let n=[];for(let r of e)n.some(s=>I(s,r))||n.push(r);if(t.showInternal||(n=n.filter(r=>{let s=r.args[0];return!(typeof s=="string"&&s.startsWith("[sootsim]"))})),t.level&&(n=n.filter(r=>t.level.has(r.level))),t.filter){let r=t.filter.toLowerCase();n=n.filter(s=>s.args.join(" ").toLowerCase().includes(r))}return n}async function Q(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.summary",args:[t]})}async function Y(e,t){return await e.send({type:"call",path:"SootSim.bridges.timeline.recent",args:[t]})}async function q(e,t,n){await e.send({type:"call",path:"SootSim.bridges.timeline.cursorAdvance",args:[t,n]})}async function G(e){return await e.send({type:"evaluate",code:`(() => {
303
303
  const kb = window.__sootsimKeyboard
304
304
  if (!kb || typeof kb.getLayout !== 'function') {
305
305
  return { error: 'keyboard bridge getLayout() not available' }
306
306
  }
307
307
  return kb.getLayout()
308
- })()`})??{error:"keyboard bridge returned no result"}}function x(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function S(e,t=0){let n=Date.now()+Math.max(0,t);for(;;)try{return await e.send({type:"call",path:"SootSim.bridges.mainShell.getState",args:[]})}catch(r){if(!x(r)||Date.now()>=n)throw r;await new Promise(s=>setTimeout(s,50))}}async function V(e){let t=await e.send({type:"evaluate",code:`(async () => {
308
+ })()`})??{error:"keyboard bridge returned no result"}}function _(e){let t=e instanceof Error?e.message:String(e);return t.includes("call target not found: SootSim.bridges.mainShell")||t.includes("test bridge unavailable before app-in-worker boot")}async function R(e,t=0){let n=Date.now()+Math.max(0,t);for(;;)try{return await e.send({type:"call",path:"SootSim.bridges.mainShell.getState",args:[]})}catch(r){if(!_(r)||Date.now()>=n)throw r;await new Promise(s=>setTimeout(s,50))}}async function U(e){let t=await e.send({type:"evaluate",code:`(async () => {
309
309
  const test = window.__sootsimTest
310
310
  const kb = window.__sootsimKeyboard
311
311
  const navSnap =
@@ -329,7 +329,7 @@ ${l}
329
329
  })()
330
330
  : null
331
331
  return { nav: navSnap, keyboard }
332
- })()`});return{shell:await S(e,500).catch(()=>null),nav:t?.nav??null,keyboard:t?.keyboard??null}}async function j(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.status()"})}async function Q(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.flags()"})}async function Y(e,t){let n=t==="sheets"?"findSheets":"findPortals";return e.send({type:"evaluate",code:`window.__sootsimDebug.${n}()`})}async function q(e,t,n=50){let r=t&&t!=="all"?`window.__sootsimDebug.recent(${JSON.stringify(t)}, ${n})`:`window.__sootsimDebug.recent(undefined, ${n})`;return e.send({type:"evaluate",code:r})}async function U(e,t,n){let r=n.length>0?n.map(s=>JSON.stringify(s)).join(", "):t==="disable"?"'all'":"";return e.send({type:"evaluate",code:`window.__sootsimDebug.${t}(${r})`})}async function G(e){return await e.send({type:"evaluate",code:`(async () => {
332
+ })()`});return{shell:await R(e,500).catch(()=>null),nav:t?.nav??null,keyboard:t?.keyboard??null}}async function X(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.status()"})}async function Z(e){return e.send({type:"evaluate",code:"window.__sootsimDebug.flags()"})}async function ee(e,t){let n=t==="sheets"?"findSheets":"findPortals";return e.send({type:"evaluate",code:`window.__sootsimDebug.${n}()`})}async function te(e,t,n=50){let r=t&&t!=="all"?`window.__sootsimDebug.recent(${JSON.stringify(t)}, ${n})`:`window.__sootsimDebug.recent(undefined, ${n})`;return e.send({type:"evaluate",code:r})}async function ne(e,t,n){let r=n.length>0?n.map(s=>JSON.stringify(s)).join(", "):t==="disable"?"'all'":"";return e.send({type:"evaluate",code:`window.__sootsimDebug.${t}(${r})`})}async function re(e){return await e.send({type:"evaluate",code:`(async () => {
333
333
  const host = window.__sootsimRenderHost
334
334
  const stats = host?.queryStats ? await host.queryStats() : null
335
335
  const hostMem = performance.memory
@@ -344,4 +344,4 @@ ${l}
344
344
  workerHeap: stats?.memory?.workerHeap ?? null,
345
345
  hostHeap: hostMem,
346
346
  }
347
- })()`})??{imageLoader:null,workerHeap:null,hostHeap:null}}function X(e){if(e.total===0)return"nothing recorded";let t=[],n=["error","warning","console","fetch","toast","alert","actionsheet","picker","notification","screen","route","keyboard","app-launch","shell","scroll","gesture","text-input","react-commit","animation","reanimated"],r=new Set;for(let s of n){let i=e.byKind[s];i&&(t.push(`${i} ${s}${i===1?"":"s"}`),r.add(s))}for(let[s,i]of Object.entries(e.byKind))!r.has(s)&&i&&t.push(`${i} ${s}${i===1?"":"s"}`);return t.join(" \xB7 ")}export{T as a,v as b,I as c,_ as d,k as e,E as f,R as g,P as h,A as i,b as j,g as k,f as l,w as m,L as n,D as o,N as p,H as q,B as r,C as s,M as t,$ as u,O as v,F as w,W as x,z as y,K as z,J as A,x as B,S as C,V as D,j as E,Q as F,Y as G,q as H,U as I,G as J,X as K};
347
+ })()`})??{imageLoader:null,workerHeap:null,hostHeap:null}}function se(e){if(e.total===0)return"nothing recorded";let t=[],n=["error","warning","console","fetch","toast","alert","actionsheet","picker","notification","screen","route","keyboard","app-launch","shell","scroll","gesture","text-input","react-commit","animation","reanimated"],r=new Set;for(let s of n){let a=e.byKind[s];a&&(t.push(`${a} ${s}${a===1?"":"s"}`),r.add(s))}for(let[s,a]of Object.entries(e.byKind))!r.has(s)&&a&&t.push(`${a} ${s}${a===1?"":"s"}`);return t.join(" \xB7 ")}export{k as a,E as b,P as c,A as d,L as e,D as f,N as g,H as h,B as i,w as j,h as k,S as l,v as m,C as n,M as o,$ as p,O as q,W as r,F as s,z as t,K as u,J as v,V as w,j as x,Q as y,Y as z,q as A,G as B,_ as C,R as D,U as E,X as F,Z as G,ee as H,te as I,ne as J,re as K,se as L};
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import{createInterface as i}from"readline";var c=()=>i({input:process.stdin,output:process.stdout});function s(o){return new Promise(n=>{let r=c();r.question(o,t=>{r.close(),n(t.trim())})})}async function u(o,n=!0){let r=n?"[Y/n]":"[y/N]";if(!process.stdin.isTTY)return console.log(` ${o} ${r} ${n?"y":"n"} (non-interactive)`),n;let t=await s(` ${o} ${r} `);return t===""?n:t.toLowerCase().startsWith("y")}async function a(o,n){console.log(`
3
3
  ${o}
4
4
  `);for(let e=0;e<n.length;e++)console.log(` ${e+1}. ${n[e]}`);if(console.log(),!process.stdin.isTTY)return console.log(` choose [1-${n.length}]: 1 (non-interactive)`),0;let r=await s(` choose [1-${n.length}]: `),t=parseInt(r,10);return t>=1&&t<=n.length?t-1:0}export{u as a,a as b};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{g as w,i as u,j as m,k as l}from"./chunk-FXF2FHPI.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function g(e){let t={};for(let n of v){if(!(n in e))continue;let r=e[n],o=u[n];o.validate&&!o.validate(r)||o.options&&!o.options.includes(r)||(t[n]=r)}return t}function h(e){let t={};for(let n of v)t[n]=e[n];return t}function _(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?g(JSON.parse(e)):{}}catch{return{}}}function V(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function E(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:g(t)}function K(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function k(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=k()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!k())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function b(){let e=_(),t=j(),n=E();return{...e,...t,...n}}function R(e){V(e),K(e),D(e)}function C(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(g(JSON.parse(i.newValue)))}catch{}};window.addEventListener("storage",t);let n=S(),r;n?.onSharedConfigChanged&&(r=n.onSharedConfigChanged(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var M=l(),P=b();for(let e of Object.keys(m()))delete P[e];var s={...M,...P},f=[],a=null;function y(){for(let e of f)e();R(s)}C(e=>{let t={...s},n=!1;for(let[r,o]of Object.entries(e)){let c=r;t[c]!==o&&(t[c]=o,n=!0)}if(n){s=t,a=null;for(let r of f)r()}});var L={get(e){return s[e]},set(e,t){let n=u[e];n.validate&&!n.validate(t)||n.options&&!n.options.includes(t)||s[e]!==t&&(s={...s,[e]:t},e==="deviceModel"&&(a=null),y())},getAll(){return s},apply(e){let t=!1,n={...s};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;let c=r,i=u[c];i&&(i.validate&&!i.validate(o)||i.options&&!i.options.includes(o)||n[c]!==o&&(n[c]=o,t=!0))}t&&(s=n,a=null,y())},reset(){s=l(),a=null,y()},subscribe(e){return f.push(e),()=>{f=f.filter(t=>t!==e)}},getDeviceSpec(){return a||(a=w(s.deviceModel)),a},getA11yMode(){return s.a11yMode},setA11yMode(e){this.set("a11yMode",e)},getInspectMode(){return s.inspectMode},setInspectMode(e){this.set("inspectMode",e)}};export{L as a};
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{g as w,i as u,j as m,k as l}from"./chunk-NYR3Z44O.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function g(e){let t={};for(let n of v){if(!(n in e))continue;let r=e[n],o=u[n];o.validate&&!o.validate(r)||o.options&&!o.options.includes(r)||(t[n]=r)}return t}function h(e){let t={};for(let n of v)t[n]=e[n];return t}function _(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?g(JSON.parse(e)):{}}catch{return{}}}function V(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function E(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:g(t)}function K(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function k(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=k()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!k())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function b(){let e=_(),t=j(),n=E();return{...e,...t,...n}}function R(e){V(e),K(e),D(e)}function C(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(g(JSON.parse(i.newValue)))}catch{}};window.addEventListener("storage",t);let n=S(),r;n?.onSharedConfigChanged&&(r=n.onSharedConfigChanged(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var M=l(),P=b();for(let e of Object.keys(m()))delete P[e];var s={...M,...P},f=[],a=null;function y(){for(let e of f)e();R(s)}C(e=>{let t={...s},n=!1;for(let[r,o]of Object.entries(e)){let c=r;t[c]!==o&&(t[c]=o,n=!0)}if(n){s=t,a=null;for(let r of f)r()}});var L={get(e){return s[e]},set(e,t){let n=u[e];n.validate&&!n.validate(t)||n.options&&!n.options.includes(t)||s[e]!==t&&(s={...s,[e]:t},e==="deviceModel"&&(a=null),y())},getAll(){return s},apply(e){let t=!1,n={...s};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;let c=r,i=u[c];i&&(i.validate&&!i.validate(o)||i.options&&!i.options.includes(o)||n[c]!==o&&(n[c]=o,t=!0))}t&&(s=n,a=null,y())},reset(){s=l(),a=null,y()},subscribe(e){return f.push(e),()=>{f=f.filter(t=>t!==e)}},getDeviceSpec(){return a||(a=w(s.deviceModel)),a},getA11yMode(){return s.a11yMode},setA11yMode(e){this.set("a11yMode",e)},getInspectMode(){return s.inspectMode},setInspectMode(e){this.set("inspectMode",e)}};export{L as a};
@@ -0,0 +1,35 @@
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{C as A,j as _,k as h,l as v,m as S}from"./chunk-AQ7YR4MO.js";import{d as y,h as B,i as E}from"./chunk-U47AHSGE.js";var W={timeoutMs:1800,settleMs:48,startWindowMs:64};function p(e){return new Promise(t=>setTimeout(t,e))}function J(e){return e.includes("--json")}function Y(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
3
+ `)}function $(e,t=Date.now()){let r=new Date(e),n=`${b(r.getHours())}:${b(r.getMinutes())}:${b(r.getSeconds())}`,s=t-e;if(s<0)return n;let o=Math.round(s/1e3);return o<60?`${n} +${o}s`:o<3600?`${n} +${Math.round(o/60)}m`:o<86400?`${n} +${Math.round(o/3600)}h`:`${n} +${Math.round(o/86400)}d`}function b(e){return e<10?`0${e}`:String(e)}async function D(e,t,...r){return B(e,`__sootsimTest.${t}`,...r)}async function q(e,t,...r){return E(e,`SootSim.bridges.mainShell.${t}`,...r)}async function U(e,t={}){try{let r=await D(e,"waitForScreenTransitions",W);if(!t.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}async function z(e,t,r,...n){let s=Date.now()+Math.max(0,r);for(;;)try{return await q(e,t,...n)}catch(o){if(!A(o)||Date.now()>=s)throw o;await p(50)}}async function K(e,t,r,n={}){let s=n.attempts??30,o=n.intervalMs??500,l=n.minNodeCount??10;for(let a=0;a<s;a++){let u=y(e,{commandTimeoutMs:t,simId:r,simIdSource:n.simIdSource});try{let c=await u.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof c=="number"&&c>l)return{bridge:u,count:c}}catch{}u.close(),await p(o)}return null}async function Q(e,t,r,n={}){let s=n.timeoutMs??8e3,o=n.intervalMs??250,l=Date.now()+s;for(;Date.now()<l;){let a=y(e,{commandTimeoutMs:t,simId:r,simIdSource:n.simIdSource});try{return await a.send({type:"evaluate",code:"1"}),a}catch{a.close()}await p(o)}return null}async function V(e,t={}){let r=t.timeoutMs??1e4,n=t.errorGraceMs??3e3,s=t.pollIntervalMs??200,o=Date.now(),l=o+r,a=-1,u=o,c=null,m=!1,d={ready:!1,source:"timeout",elapsedMs:0,nodes:0,targets:0,flag:void 0,loadingText:"",externalReady:null,externalStatus:"",externalError:"",errors:0};for(;Date.now()<l;){try{let i=await e.send({type:"evaluate",code:_}),f=Date.now()-o,g=Number(i?.nodes)||0,x=Number(i?.targets)||0,C=Number(i?.errors)||0,T=i?.flag===!0,w=i?.externalReady,P=typeof i?.loadingText=="string"?i.loadingText.trim():"",N=typeof i?.externalStatus=="string"?i.externalStatus.trim():"",R=typeof i?.externalError=="string"?i.externalError.trim():"",M=typeof i?.externalError=="string"&&R.length>0;if(c=w,m=M,g!==a&&(a=g,u=f),d={ready:!1,source:"timeout",elapsedMs:f,nodes:g,targets:x,flag:i?.flag,loadingText:P,externalReady:typeof w=="boolean"?w:null,externalStatus:N,externalError:R,errors:C},T&&w!==!1&&!M&&g>=h&&S({nodes:g,targets:x})&&f-u>=v)return{...d,ready:!0,source:"flag"};if(f>=n&&C>0&&!T)return{...d,ready:!1,source:"error-bail"}}catch{}await p(s)}return c!==!1&&!m&&d.nodes>=h&&S(d)?{...d,ready:!0,source:"nodes-fallback"}:{...d,ready:!1,source:"timeout",elapsedMs:Date.now()-o}}function k(e){let t=e.displayUrl||e.url;return e.status!=null?`${e.method} ${t} -> ${e.status}${e.statusText?` ${e.statusText}`:""}`:e.error?`${e.method} ${t} -> ${e.error}`:`${e.method} ${t}`}async function I(e,t,...r){return e.send({type:"call",path:`__sootsimTest.${t}`,args:r})}async function O(e,t={}){let r=await e.send({type:"evaluate",code:"window.__sootsimConsole?.count?.() || { errors: 0, warnings: 0, total: 0 }"});if(!r||typeof r!="object")return;let n=Math.max(0,Number(r.errors)||0),s=Math.max(0,Number(r.warnings)||0);if(n===0&&s===0)return;let o=[];if(n>0&&o.push(`${n} console error${n===1?"":"s"}`),s>0&&o.push(`${s} console warning${s===1?"":"s"}`),console.log(`
4
+ console: ${o.join(", ")}`),t.errorsCommand&&console.log(` inspect: ${t.errorsCommand}`),s>0&&t.warningsCommand&&console.log(` inspect: ${t.warningsCommand}`),!t.includeTail||n===0)return;let l=await e.send({type:"evaluate",code:"window.__sootsimConsole?.getErrors?.(5) || []"});if(!(!Array.isArray(l)||l.length===0)){console.log(`
5
+ recent console errors:
6
+ `);for(let a of l){let u=$(a.timestamp),c=Array.isArray(a.args)?a.args.map(m=>typeof m=="object"?JSON.stringify(m):String(m)).join(" "):String(a);console.log(` [${u}] ${c}`)}}}async function F(e,t={}){let r=await I(e,"getRequestCounts");if(!r||typeof r!="object")return;let n=Math.max(0,Number(r.failed)||0);if(n===0||(console.log(`
7
+ network: ${n} failed request${n===1?"":"s"}`),t.requestsCommand&&console.log(` inspect: ${t.requestsCommand}`),!t.includeTail))return;let s=await I(e,"getFailedRequests",5);if(!(!Array.isArray(s)||s.length===0)){console.log(`
8
+ recent failed requests:
9
+ `);for(let o of s){let l=$(o.timestamp);console.log(` [${l}] ${k(o)}`),o.responseBody?console.log(` ${o.responseBody}`):o.error&&console.log(` ${o.error}`)}}}async function j(e){let t=await e.send({type:"evaluate",code:`(async () => {
10
+ const test = window.__sootsimTest
11
+ const mainShell = window.SootSim?.bridges?.mainShell
12
+ let shell = null
13
+ try {
14
+ shell = typeof mainShell?.getState === 'function' ? await mainShell.getState() : null
15
+ } catch {}
16
+ let nodeCount = 0
17
+ try {
18
+ nodeCount = typeof test?.getNodeCount === 'function' ? await test.getNodeCount() : 0
19
+ } catch {}
20
+ return {
21
+ url: window.location.href,
22
+ simId: window.__sootsimSimId || null,
23
+ nodeCount,
24
+ mode: window.__sootsimRenderHost ? 'render-worker' : 'main-thread',
25
+ shell: shell
26
+ ? {
27
+ state: shell.state || null,
28
+ activeApp: shell.activeApp || null,
29
+ showSwitcher: !!shell.showSwitcher,
30
+ switcherPhase: shell.switcherPhase || null,
31
+ }
32
+ : null,
33
+ }
34
+ })()`});if(!t||typeof t!="object")return;console.log(`
35
+ state:`),t.simId&&console.log(` sim: ${t.simId}`),t.url&&console.log(` url: ${t.url}`),t.mode&&console.log(` mode: ${t.mode}`);let r=Number(t.nodeCount)||0;console.log(` nodes: ${r}${r>10?" (ready)":" (not ready)"}`);let n=t.shell;if(n&&typeof n=="object"){let s=[n.state?`state=${n.state}`:null,n.activeApp?`app=${n.activeApp}`:null,n.showSwitcher?"switcher=open":null,n.switcherPhase?`phase=${n.switcherPhase}`:null].filter(Boolean);s.length>0&&console.log(` shell: ${s.join(" ")}`)}}async function ee(e,t={}){try{await j(e)}catch{}try{await O(e,{includeTail:!0,errorsCommand:t.errorsCommand,warningsCommand:t.warningsCommand})}catch{}try{await F(e,{includeTail:!0,requestsCommand:t.requestsCommand})}catch{}}export{p as a,J as b,Y as c,$ as d,D as e,U as f,z as g,K as h,Q as i,V as j,j as k,ee as l};
@@ -1,2 +1,2 @@
1
- /*! sootsim v0.1.66 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as s}from"./chunk-EIQLQDKX.js";import{w as o}from"./chunk-BEQD2DSK.js";function u(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!o()}function a(){if(u())return null;let e=process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let t=process.env.SOOT_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:t.replace(/\/+$/,"")}}function c(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:"anonymous-cli":"anonymous-cli"}function p(e){let t=e.identity??{},n={$lib:"soot-cli",source:t.source??"cli",...e.properties};return t.userId&&(n.userId=t.userId),t.repoId&&(n.repoId=t.repoId),t.installationId!=null&&(n.installationId=String(t.installationId)),t.shareId&&(n.shareId=t.shareId),t.plan&&(n.plan=t.plan),{event:e.event,distinct_id:c(t),properties:n,timestamp:new Date().toISOString()}}var r=[],l=!1;async function i(){if(r.length===0)return;let e=a();if(!e){r.length=0;return}let t=r.splice(0,r.length).map(p);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:t}),signal:AbortSignal.timeout(2e3)})}catch{}}function d(){l||(l=!0,process.on("beforeExit",()=>{i()}),process.on("exit",()=>{i()}))}function h(e){if(u())return;d();let t=null;try{t=s()?.user?.id??null}catch{t=null}r.push({...e,identity:{source:"cli",userId:t,...e.identity}})}async function g(){await i()}export{h as a,g as b};
1
+ /*! sootsim v0.1.67 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as s}from"./chunk-O624O5MO.js";import{w as o}from"./chunk-HW5YHSIE.js";function u(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!o()}function a(){if(u())return null;let e=process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let t=process.env.SOOT_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:t.replace(/\/+$/,"")}}function c(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:"anonymous-cli":"anonymous-cli"}function p(e){let t=e.identity??{},n={$lib:"soot-cli",source:t.source??"cli",...e.properties};return t.userId&&(n.userId=t.userId),t.repoId&&(n.repoId=t.repoId),t.installationId!=null&&(n.installationId=String(t.installationId)),t.shareId&&(n.shareId=t.shareId),t.plan&&(n.plan=t.plan),{event:e.event,distinct_id:c(t),properties:n,timestamp:new Date().toISOString()}}var r=[],l=!1;async function i(){if(r.length===0)return;let e=a();if(!e){r.length=0;return}let t=r.splice(0,r.length).map(p);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:t}),signal:AbortSignal.timeout(2e3)})}catch{}}function d(){l||(l=!0,process.on("beforeExit",()=>{i()}),process.on("exit",()=>{i()}))}function h(e){if(u())return;d();let t=null;try{t=s()?.user?.id??null}catch{t=null}r.push({...e,identity:{source:"cli",userId:t,...e.identity}})}async function g(){await i()}export{h as a,g as b};