sootsim 0.1.310 → 0.1.311

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 (151) hide show
  1. package/dist-cli/bin.js +5 -5
  2. package/dist-cli/chunks/{agent-CPD4GIXP.js → agent-KOPVOZ7G.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-JZTNUUZE.js → agent-wrapper-KVAIIK7K.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-CFIBFEVF.js → app-fonts-5ZX2IRBS.js} +2 -2
  5. package/dist-cli/chunks/{assert-C5WAWJ6I.js → assert-NRKM4ZIK.js} +2 -2
  6. package/dist-cli/chunks/{auth-UY7RPLPH.js → auth-MSLDV5HR.js} +2 -2
  7. package/dist-cli/chunks/{beta-NM7T7MDN.js → beta-L5QKFHWI.js} +2 -2
  8. package/dist-cli/chunks/{camera-4YUYYYJI.js → camera-5JUNQPSI.js} +2 -2
  9. package/dist-cli/chunks/{chunk-RYPPRVBM.js → chunk-3Y6476ZM.js} +2 -2
  10. package/dist-cli/chunks/{chunk-GQVBLBUJ.js → chunk-5V5MOREL.js} +2 -2
  11. package/dist-cli/chunks/{chunk-FT2XATWO.js → chunk-6JYTKF5O.js} +1 -1
  12. package/dist-cli/chunks/{chunk-LKAAQBT6.js → chunk-6QZY6YO2.js} +1 -1
  13. package/dist-cli/chunks/{chunk-TAQV44LZ.js → chunk-6SICKWPQ.js} +3 -3
  14. package/dist-cli/chunks/{chunk-Z6H5FR3U.js → chunk-75KNNHMR.js} +2 -2
  15. package/dist-cli/chunks/{chunk-YRRUK3EK.js → chunk-75YOUNTE.js} +1 -1
  16. package/dist-cli/chunks/chunk-7PHOEBKV.js +4 -0
  17. package/dist-cli/chunks/{chunk-S7WXPIOY.js → chunk-7W63IKAP.js} +2 -2
  18. package/dist-cli/chunks/chunk-CJKSD5BZ.js +5 -0
  19. package/dist-cli/chunks/{chunk-SY7E43UY.js → chunk-CKMQ2YXQ.js} +3 -3
  20. package/dist-cli/chunks/{chunk-QPZVGHRV.js → chunk-CUVLXG63.js} +1 -1
  21. package/dist-cli/chunks/{chunk-7RJEULWN.js → chunk-EHBHUE6S.js} +2 -2
  22. package/dist-cli/chunks/{chunk-NLTJE335.js → chunk-F2WH6XM7.js} +2 -2
  23. package/dist-cli/chunks/{chunk-63JWRDM6.js → chunk-GEUU2WIL.js} +2 -2
  24. package/dist-cli/chunks/{chunk-ZNK3ZAA5.js → chunk-GFKP5JIA.js} +2 -2
  25. package/dist-cli/chunks/{chunk-6UXXOG6P.js → chunk-GLECQIGB.js} +2 -2
  26. package/dist-cli/chunks/{chunk-3S7UEXZW.js → chunk-HI5MWY32.js} +1 -1
  27. package/dist-cli/chunks/{chunk-GH2OE6F6.js → chunk-J6ZKDIRN.js} +2 -2
  28. package/dist-cli/chunks/{chunk-PJKCYUT3.js → chunk-JGFIT5X5.js} +2 -2
  29. package/dist-cli/chunks/{chunk-3EO5JEG7.js → chunk-KGIXNUUM.js} +2 -2
  30. package/dist-cli/chunks/{chunk-BFNAFH27.js → chunk-KKXSWEYS.js} +1 -1
  31. package/dist-cli/chunks/{chunk-EPMLSKSB.js → chunk-NBNEISXX.js} +2 -2
  32. package/dist-cli/chunks/{chunk-EWRPLFYI.js → chunk-P7MI3VFY.js} +1 -1
  33. package/dist-cli/chunks/{chunk-YIJFCR5T.js → chunk-PHFRI2QF.js} +1 -1
  34. package/dist-cli/chunks/{chunk-RMIKUUCO.js → chunk-PJ27D3WO.js} +1 -1
  35. package/dist-cli/chunks/{chunk-MUQDPJUP.js → chunk-QCEMDWL4.js} +1 -1
  36. package/dist-cli/chunks/{chunk-2TRPGEZE.js → chunk-QILKSUH6.js} +2 -2
  37. package/dist-cli/chunks/{chunk-WWIQEYHT.js → chunk-QMHUIADD.js} +1 -1
  38. package/dist-cli/chunks/{chunk-66Z2ADUQ.js → chunk-QUAY5AZB.js} +2 -2
  39. package/dist-cli/chunks/{chunk-C3GMSIRT.js → chunk-RATCQLQA.js} +2 -2
  40. package/dist-cli/chunks/{chunk-C3O6UUPY.js → chunk-RHGVZJIY.js} +3 -3
  41. package/dist-cli/chunks/{chunk-BMIIHY6K.js → chunk-RIT4KI4Y.js} +3 -3
  42. package/dist-cli/chunks/{chunk-4XMPRQGE.js → chunk-S5U22PVL.js} +1 -1
  43. package/dist-cli/chunks/{chunk-XBBNRESY.js → chunk-SKGITCWL.js} +1 -1
  44. package/dist-cli/chunks/{chunk-RX4CFOVV.js → chunk-ULJT3HDO.js} +1 -1
  45. package/dist-cli/chunks/{chunk-XMOULANJ.js → chunk-VAFDFOE6.js} +2 -2
  46. package/dist-cli/chunks/{chunk-M2LP2VYQ.js → chunk-VJMY2MX6.js} +2 -2
  47. package/dist-cli/chunks/{chunk-IS5OOCN5.js → chunk-VNS6KYRJ.js} +1 -1
  48. package/dist-cli/chunks/{chunk-R7AS52NA.js → chunk-W4S7GGPG.js} +3 -3
  49. package/dist-cli/chunks/{chunk-YMD6WWI7.js → chunk-WIYIQQQS.js} +2 -2
  50. package/dist-cli/chunks/{chunk-VAGUPECL.js → chunk-WTNKX7QD.js} +2 -2
  51. package/dist-cli/chunks/{chunk-STWCCIBA.js → chunk-Y5O5GK2Q.js} +11 -11
  52. package/dist-cli/chunks/{chunk-YZPSUNTO.js → chunk-Y7RQGSZD.js} +2 -2
  53. package/dist-cli/chunks/{chunk-XKAXZ4DS.js → chunk-YOIHAHR5.js} +1 -1
  54. package/dist-cli/chunks/{chunk-ZS7OXPHR.js → chunk-YS7YDOGW.js} +1 -1
  55. package/dist-cli/chunks/{chunk-CORSX7M5.js → chunk-YTP5VCDL.js} +1 -1
  56. package/dist-cli/chunks/{chunk-2KSLGBIU.js → chunk-ZB3UAYJ4.js} +2 -2
  57. package/dist-cli/chunks/{chunk-EPZUFQMX.js → chunk-ZDQO6TJQ.js} +2 -2
  58. package/dist-cli/chunks/{chunk-C4O4VRN5.js → chunk-ZHPLBK34.js} +2 -2
  59. package/dist-cli/chunks/{cleanup-2ZM4QSDV.js → cleanup-436GW67Y.js} +2 -2
  60. package/dist-cli/chunks/{cli-version-WXOEWZDA.js → cli-version-BY3A3SBN.js} +2 -2
  61. package/dist-cli/chunks/{compat-MGY3FZSI.js → compat-DDJSQ3WI.js} +2 -2
  62. package/dist-cli/chunks/{config-3W5VNME6.js → config-XFLK4XZN.js} +2 -2
  63. package/dist-cli/chunks/{control-7LNRM2BK.js → control-W6KUVHYU.js} +2 -2
  64. package/dist-cli/chunks/daemon-E5MGIR55.js +4 -0
  65. package/dist-cli/chunks/{debug-4CMFC2CO.js → debug-PHSYXSNH.js} +3 -3
  66. package/dist-cli/chunks/{desktop-Q6CZSS4R.js → desktop-6V5ALYCZ.js} +3 -3
  67. package/dist-cli/chunks/{detox-2AF4MXXN.js → detox-SA27XGTO.js} +2 -2
  68. package/dist-cli/chunks/{device-E2WCI2N2.js → device-XURVFXBT.js} +2 -2
  69. package/dist-cli/chunks/{diagnose-CZGCKNVY.js → diagnose-HMUQWQOK.js} +2 -2
  70. package/dist-cli/chunks/disk-cleanup-KYAFCV6S.js +4 -0
  71. package/dist-cli/chunks/drivers-INII4IWR.js +4 -0
  72. package/dist-cli/chunks/{film-UDSAJZXL.js → film-3UM6EUYF.js} +3 -3
  73. package/dist-cli/chunks/flow-RP4UVYUA.js +4 -0
  74. package/dist-cli/chunks/help-STHBZD6I.js +4 -0
  75. package/dist-cli/chunks/{hidden-runtime-alias-CHAB56GM.js → hidden-runtime-alias-DVVAGM4I.js} +2 -2
  76. package/dist-cli/chunks/{home-paths-WFCI5ORX.js → home-paths-LVGGR4AJ.js} +2 -2
  77. package/dist-cli/chunks/inspect-5W52ZHKD.js +4 -0
  78. package/dist-cli/chunks/install-desktop-H4HLLT7K.js +4 -0
  79. package/dist-cli/chunks/{login-57UP2EKB.js → login-2QTBTTGJ.js} +4 -4
  80. package/dist-cli/chunks/{logout-UYNCJTOC.js → logout-PUBLDHVY.js} +2 -2
  81. package/dist-cli/chunks/{maestro-QMAPXPZ7.js → maestro-2UJ27MKD.js} +3 -3
  82. package/dist-cli/chunks/{maestro-generate-N2BJXJDH.js → maestro-generate-P4MDFYMV.js} +3 -3
  83. package/dist-cli/chunks/{mode-SY5G7WQD.js → mode-RRHPX23W.js} +2 -2
  84. package/dist-cli/chunks/{optional-demo-registry-DH3L6FFX.js → optional-demo-registry-5IRF7M7Z.js} +2 -2
  85. package/dist-cli/chunks/{perf-NZ6VEDLA.js → perf-BOLWOAKV.js} +2 -2
  86. package/dist-cli/chunks/{permissions-EMH2K5LX.js → permissions-ZIOTIBPV.js} +2 -2
  87. package/dist-cli/chunks/{record-44PMWGYY.js → record-DU2IKPFK.js} +3 -3
  88. package/dist-cli/chunks/{report-issue-PLGMRWXG.js → report-issue-4CQDUWT2.js} +2 -2
  89. package/dist-cli/chunks/runtime-QWPQ3M7H.js +4 -0
  90. package/dist-cli/chunks/{screenshot-command-GJT5XS7P.js → screenshot-command-XEN26NJV.js} +3 -3
  91. package/dist-cli/chunks/{screenshot-layers-4JSTS5VY.js → screenshot-layers-CRCQ4CEF.js} +2 -2
  92. package/dist-cli/chunks/{screenshots-capture-AQQISSQD.js → screenshots-capture-XGQFYINL.js} +2 -2
  93. package/dist-cli/chunks/{serve-TJMO4KGX.js → serve-UBSRDYA3.js} +2 -2
  94. package/dist-cli/chunks/{setup-7ZSYCUX6.js → setup-AKYIOBVO.js} +2 -2
  95. package/dist-cli/chunks/{skills-GRQPAAD5.js → skills-V5WV4LWH.js} +2 -2
  96. package/dist-cli/chunks/{storage-GWRZNBAU.js → storage-3PJPIHNM.js} +2 -2
  97. package/dist-cli/chunks/store-A27JYIGF.js +4 -0
  98. package/dist-cli/chunks/telemetry-LLD24AVX.js +4 -0
  99. package/dist-cli/chunks/{timeline-2FXM7HEU.js → timeline-OHQNHG52.js} +2 -2
  100. package/dist-cli/chunks/{upgrade-AV7UOK2X.js → upgrade-Q2TYYVIX.js} +2 -2
  101. package/dist-cli/chunks/upload-57FIDO2B.js +4 -0
  102. package/dist-cli/chunks/{version-C72O2LMS.js → version-SW6VCJVI.js} +2 -2
  103. package/dist-cli/chunks/{web-4V3YGWNC.js → web-BXVM3HJ3.js} +2 -2
  104. package/dist-cli/chunks/{what-happened-RGD2DOQI.js → what-happened-H62ASSI5.js} +2 -2
  105. package/dist-lib/agent-daemon-client.cjs +1 -1
  106. package/dist-lib/agent-events.cjs +1 -1
  107. package/dist-lib/agent-identity.cjs +1 -1
  108. package/dist-lib/agent-sessions.cjs +1 -1
  109. package/dist-lib/attached-projects.cjs +1 -1
  110. package/dist-lib/auth/shared-session.cjs +1 -1
  111. package/dist-lib/backend-origin.cjs +1 -1
  112. package/dist-lib/beta.cjs +1 -1
  113. package/dist-lib/beta.mjs +1 -1
  114. package/dist-lib/bridge-constants.cjs +1 -1
  115. package/dist-lib/cli-constants.cjs +1 -1
  116. package/dist-lib/config.cjs +1 -1
  117. package/dist-lib/detox/index.cjs +20 -16
  118. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  119. package/dist-lib/home-paths.cjs +1 -1
  120. package/dist-lib/host/bridge-host.cjs +164 -102
  121. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  122. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  123. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  124. package/dist-lib/host/websocket-proxy.cjs +1 -1
  125. package/dist-lib/index.cjs +1 -1
  126. package/dist-lib/jump-to-source-babel.cjs +1 -1
  127. package/dist-lib/menu.cjs +1 -1
  128. package/dist-lib/menu.mjs +1 -1
  129. package/dist-lib/metro.cjs +1 -1
  130. package/dist-lib/profiles.cjs +1 -1
  131. package/dist-lib/render-mode.cjs +1 -1
  132. package/dist-lib/scripts/dev-server-scanner.cjs +43 -23
  133. package/dist-lib/sdk.cjs +1 -1
  134. package/dist-lib/sdk.mjs +1 -1
  135. package/dist-lib/skills.cjs +277 -206
  136. package/dist-lib/vite.cjs +1 -1
  137. package/package.json +1 -1
  138. package/scripts/dev-server-scanner.ts +34 -8
  139. package/dist-cli/chunks/chunk-63EKEKDF.js +0 -4
  140. package/dist-cli/chunks/chunk-OQO3HU4Y.js +0 -5
  141. package/dist-cli/chunks/daemon-ZNCVHOWJ.js +0 -4
  142. package/dist-cli/chunks/disk-cleanup-4T6MDZBA.js +0 -4
  143. package/dist-cli/chunks/drivers-NEB27ZKQ.js +0 -4
  144. package/dist-cli/chunks/flow-GXXVEHEW.js +0 -4
  145. package/dist-cli/chunks/help-3RVUJUAN.js +0 -4
  146. package/dist-cli/chunks/inspect-4H4VNQJ4.js +0 -4
  147. package/dist-cli/chunks/install-desktop-RGCBPM4J.js +0 -4
  148. package/dist-cli/chunks/runtime-CUSKTS2J.js +0 -4
  149. package/dist-cli/chunks/store-MLODFZBM.js +0 -4
  150. package/dist-cli/chunks/telemetry-XL3UDJSE.js +0 -4
  151. package/dist-cli/chunks/upload-6DXF4DAQ.js +0 -4
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.310 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.311 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -113,6 +113,7 @@ var import_child_process = require("child_process");
113
113
  var import_promises2 = require("fs/promises");
114
114
  var import_http = __toESM(require("http"), 1);
115
115
  var import_net = __toESM(require("net"), 1);
116
+ var import_node_path3 = require("node:path");
116
117
  var import_util = require("util");
117
118
 
118
119
  // src/config.ts
@@ -514,14 +515,14 @@ var TIMEOUT_MS = 250;
514
515
  var MANIFEST_TIMEOUT_MS = 1500;
515
516
  var TCP_GATE_MS = 120;
516
517
  function tcpPing(port, timeout = TCP_GATE_MS) {
517
- return new Promise((resolve) => {
518
+ return new Promise((resolve2) => {
518
519
  const sock = new import_net.default.Socket();
519
520
  let settled = false;
520
521
  const done = (ok) => {
521
522
  if (settled) return;
522
523
  settled = true;
523
524
  sock.destroy();
524
- resolve(ok);
525
+ resolve2(ok);
525
526
  };
526
527
  sock.setTimeout(timeout);
527
528
  sock.once("connect", () => done(true));
@@ -531,7 +532,7 @@ function tcpPing(port, timeout = TCP_GATE_MS) {
531
532
  });
532
533
  }
533
534
  function httpGet(port, path9, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
534
- return new Promise((resolve) => {
535
+ return new Promise((resolve2) => {
535
536
  const req = import_http.default.request(
536
537
  { hostname: "localhost", port, path: path9, method, timeout, headers },
537
538
  (res) => {
@@ -545,14 +546,14 @@ function httpGet(port, path9, method = "GET", timeout = TIMEOUT_MS, headers = {}
545
546
  })();
546
547
  res.on(
547
548
  "end",
548
- () => resolve({ statusCode: res.statusCode || 0, body, contentType })
549
+ () => resolve2({ statusCode: res.statusCode || 0, body, contentType })
549
550
  );
550
551
  }
551
552
  );
552
- req.on("error", () => resolve(null));
553
+ req.on("error", () => resolve2(null));
553
554
  req.setTimeout(timeout, () => {
554
555
  req.destroy();
555
- resolve(null);
556
+ resolve2(null);
556
557
  });
557
558
  req.end();
558
559
  });
@@ -624,6 +625,48 @@ async function discoverListeningProcesses(excludePorts = []) {
624
625
  }
625
626
  return FALLBACK_PORTS.filter((p) => acceptPort(p.port, excluded));
626
627
  }
628
+ function pidFromNetstat(stdout, port) {
629
+ for (const line of stdout.split("\n")) {
630
+ if (!line.includes("LISTEN")) continue;
631
+ const parts = line.trim().split(/\s+/);
632
+ if (!parts[3]?.endsWith(`.${port}`)) continue;
633
+ for (const token of parts) {
634
+ const owner = token.match(/^\S+:(\d+)$/);
635
+ if (owner) {
636
+ const pid = Number(owner[1]);
637
+ if (pid > 0) return pid;
638
+ }
639
+ }
640
+ }
641
+ return null;
642
+ }
643
+ async function resolveListeningPid(port) {
644
+ if (!Number.isInteger(port) || port <= 0) return null;
645
+ try {
646
+ const { stdout } = await execP("netstat -anv -p tcp 2>/dev/null", {
647
+ encoding: "utf8",
648
+ timeout: 8e3,
649
+ maxBuffer: 16 * 1024 * 1024
650
+ });
651
+ const pid = pidFromNetstat(stdout, port);
652
+ if (pid !== null) return pid;
653
+ } catch {
654
+ }
655
+ try {
656
+ const { stdout } = await execP(`ss -tlnp 2>/dev/null`, {
657
+ encoding: "utf8",
658
+ timeout: 8e3,
659
+ maxBuffer: 16 * 1024 * 1024
660
+ });
661
+ for (const line of stdout.split("\n")) {
662
+ if (!new RegExp(`:${port}\\s`).test(line)) continue;
663
+ const pid = Number(line.match(/pid=(\d+)/)?.[1]);
664
+ if (pid > 0) return pid;
665
+ }
666
+ } catch {
667
+ }
668
+ return null;
669
+ }
627
670
  var cwdByPid = /* @__PURE__ */ new Map();
628
671
  async function resolveProcessCwd(pid) {
629
672
  if (pid <= 0) return null;
@@ -655,20 +698,24 @@ async function resolveProcessCwd(pid) {
655
698
  }
656
699
  return null;
657
700
  }
658
- function makeResult(port, framework) {
701
+ function makeResult(port, framework, owner) {
659
702
  return {
660
703
  port,
661
704
  framework,
662
705
  bundleUrl: withRuntimeConfig(
663
706
  port,
664
- `http://localhost:${port}/index.bundle?platform=ios&dev=true&hot=true&minify=false`
707
+ `http://localhost:${port}/index.bundle?platform=ios&dev=true&hot=true&minify=false`,
708
+ owner.cwd
665
709
  ),
666
710
  hmrUrl: `ws://localhost:${port}/hot`,
667
- lastSeen: Date.now()
711
+ lastSeen: Date.now(),
712
+ ...owner
668
713
  };
669
714
  }
670
- function withRuntimeConfig(port, bundleUrl) {
671
- const knownApp = optionalDemoAppsSync().find((app) => app.preferredPort === port);
715
+ function withRuntimeConfig(port, bundleUrl, projectCwd) {
716
+ const knownApp = projectCwd ? optionalDemoAppsSync().find(
717
+ (app) => app.preferredPort === port && (0, import_node_path3.resolve)(app.dir) === (0, import_node_path3.resolve)(projectCwd)
718
+ ) : void 0;
672
719
  const configured = knownApp?.runtimeConfig ? applySootSimConfigToUrl(bundleUrl, knownApp.runtimeConfig) : bundleUrl;
673
720
  return normalizeNativeDevBundleUrl(configured);
674
721
  }
@@ -693,7 +740,7 @@ function applyManifest(result, manifestRes, buildIconProxyUrl) {
693
740
  if (result.framework === "metro" && client.sdkVersion) result.framework = "expo";
694
741
  const launchUrl2 = manifest?.launchAsset?.url;
695
742
  if (launchUrl2 && !result.patched && !isDirectOneBundleUrl(result.bundleUrl)) {
696
- result.bundleUrl = withRuntimeConfig(result.port, launchUrl2);
743
+ result.bundleUrl = withRuntimeConfig(result.port, launchUrl2, result.cwd);
697
744
  }
698
745
  const rawIconUrl = client.iconUrl || client.ios?.iconUrl || client.icon || client.ios?.icon;
699
746
  if (rawIconUrl) {
@@ -761,9 +808,16 @@ async function fetchManifestEnrichment(port, buildIconProxyUrl) {
761
808
  var knownNonPatched = /* @__PURE__ */ new Set();
762
809
  var knownNonExpo = /* @__PURE__ */ new Set();
763
810
  var knownOne = /* @__PURE__ */ new Set();
764
- async function probePort(port, buildIconProxyUrl) {
811
+ async function probePort(port, buildIconProxyUrl, listeningProcess) {
765
812
  await loadOptionalDemoApps();
766
813
  if (!await tcpPing(port)) return null;
814
+ const suppliedPid = listeningProcess?.pid;
815
+ const ownerPid = suppliedPid && suppliedPid > 0 ? suppliedPid : await resolveListeningPid(port);
816
+ const ownerCwd = ownerPid ? await resolveProcessCwd(ownerPid) : null;
817
+ const owner = {
818
+ ...ownerPid ? { pid: ownerPid } : {},
819
+ ...ownerCwd ? { cwd: ownerCwd } : {}
820
+ };
767
821
  const onePath = `/node_modules/one/metro-entry.bundle?platform=ios&dev=true`;
768
822
  const [sootsimRes, statusRes, manifestRes, expoRes] = await Promise.all([
769
823
  knownNonPatched.has(port) ? Promise.resolve(null) : httpGet(port, "/__soot/"),
@@ -789,9 +843,10 @@ async function probePort(port, buildIconProxyUrl) {
789
843
  {
790
844
  port,
791
845
  framework,
792
- bundleUrl: withRuntimeConfig(port, launchUrl2),
846
+ bundleUrl: withRuntimeConfig(port, launchUrl2, owner.cwd),
793
847
  hmrUrl: `ws://localhost:${port}/hot`,
794
- lastSeen: Date.now()
848
+ lastSeen: Date.now(),
849
+ ...owner
795
850
  },
796
851
  manifestRes,
797
852
  buildIconProxyUrl
@@ -801,7 +856,7 @@ async function probePort(port, buildIconProxyUrl) {
801
856
  knownNonPatched.add(port);
802
857
  return enrichWithManifest(
803
858
  applyManifest(
804
- makeResult(port, expoRes && expoRes.statusCode === 200 ? "expo" : "metro"),
859
+ makeResult(port, expoRes && expoRes.statusCode === 200 ? "expo" : "metro", owner),
805
860
  manifestRes,
806
861
  buildIconProxyUrl
807
862
  ),
@@ -815,10 +870,15 @@ async function probePort(port, buildIconProxyUrl) {
815
870
  {
816
871
  port,
817
872
  framework: "one",
818
- bundleUrl: withRuntimeConfig(port, `http://localhost:${port}/__soot/bundle.js`),
873
+ bundleUrl: withRuntimeConfig(
874
+ port,
875
+ `http://localhost:${port}/__soot/bundle.js`,
876
+ owner.cwd
877
+ ),
819
878
  hmrUrl: `ws://localhost:${port}/hot`,
820
879
  lastSeen: Date.now(),
821
- patched: true
880
+ patched: true,
881
+ ...owner
822
882
  },
823
883
  manifestRes,
824
884
  buildIconProxyUrl
@@ -841,10 +901,12 @@ async function probePort(port, buildIconProxyUrl) {
841
901
  framework: "one",
842
902
  bundleUrl: withRuntimeConfig(
843
903
  port,
844
- `http://localhost:${port}${onePath}&minify=false`
904
+ `http://localhost:${port}${onePath}&minify=false`,
905
+ owner.cwd
845
906
  ),
846
907
  hmrUrl: `ws://localhost:${port}/hot`,
847
- lastSeen: Date.now()
908
+ lastSeen: Date.now(),
909
+ ...owner
848
910
  },
849
911
  manifestRes,
850
912
  buildIconProxyUrl
@@ -870,7 +932,7 @@ function isWeakCachedResult(result) {
870
932
  }
871
933
  function hasCurrentRuntimeConfig(result) {
872
934
  if (!result) return true;
873
- return withRuntimeConfig(result.port, result.bundleUrl) === result.bundleUrl;
935
+ return withRuntimeConfig(result.port, result.bundleUrl, result.cwd) === result.bundleUrl;
874
936
  }
875
937
  function __shouldReuseScannerCacheEntry(entry, pid, now = Date.now()) {
876
938
  if (pid === 0) return false;
@@ -928,7 +990,7 @@ async function scanDevServers(opts = {}) {
928
990
  }
929
991
  if (toProbe.length > 0) {
930
992
  const probed = await Promise.all(
931
- toProbe.map((p) => probePort(p.port, opts.buildIconProxyUrl))
993
+ toProbe.map((p) => probePort(p.port, opts.buildIconProxyUrl, p))
932
994
  );
933
995
  probed.forEach((result, i) => {
934
996
  const { port, pid } = toProbe[i];
@@ -975,9 +1037,9 @@ function getCliVersion() {
975
1037
  () => (0, import_node_url2.fileURLToPath)(import_meta.resolve("sootsim/package.json")),
976
1038
  () => (0, import_node_url2.fileURLToPath)(new URL("../package.json", __sootsim_import_meta_url))
977
1039
  ];
978
- for (const resolve of candidates) {
1040
+ for (const resolve2 of candidates) {
979
1041
  try {
980
- const version = JSON.parse((0, import_node_fs2.readFileSync)(resolve(), "utf8")).version;
1042
+ const version = JSON.parse((0, import_node_fs2.readFileSync)(resolve2(), "utf8")).version;
981
1043
  if (typeof version === "string" && version) {
982
1044
  cached2 = version;
983
1045
  return cached2;
@@ -992,7 +1054,7 @@ function getCliVersion() {
992
1054
  // src/home-paths.ts
993
1055
  var import_node_fs3 = __toESM(require("node:fs"), 1);
994
1056
  var import_node_os = require("node:os");
995
- var import_node_path3 = __toESM(require("node:path"), 1);
1057
+ var import_node_path4 = __toESM(require("node:path"), 1);
996
1058
  var SOOTSIM_HOME_ENV = "SOOTSIM_HOME";
997
1059
  var ACTIVE_RUNTIME_FILE = "active";
998
1060
  var DAEMON_LOCKFILE = "daemon.json";
@@ -1001,8 +1063,8 @@ var CONFIG_FILE = "config.json";
1001
1063
  var DAEMON_HEARTBEAT_STALE_MS = 3e4;
1002
1064
  function sootsimHomeDir() {
1003
1065
  const override = process.env[SOOTSIM_HOME_ENV];
1004
- if (override && override.length > 0) return import_node_path3.default.resolve(override);
1005
- return import_node_path3.default.join((0, import_node_os.homedir)(), ".sootsim");
1066
+ if (override && override.length > 0) return import_node_path4.default.resolve(override);
1067
+ return import_node_path4.default.join((0, import_node_os.homedir)(), ".sootsim");
1006
1068
  }
1007
1069
  function isSootsimDevCheckout() {
1008
1070
  if (process.env.SOOTSIM_FORCE_DAEMON_INSTALL === "1") return false;
@@ -1013,40 +1075,40 @@ function isSootsimDevCheckout() {
1013
1075
  if (!argv1) return false;
1014
1076
  try {
1015
1077
  const real = import_node_fs3.default.realpathSync(argv1);
1016
- return real.includes(`${import_node_path3.default.sep}packages${import_node_path3.default.sep}sootsim${import_node_path3.default.sep}`);
1078
+ return real.includes(`${import_node_path4.default.sep}packages${import_node_path4.default.sep}sootsim${import_node_path4.default.sep}`);
1017
1079
  } catch {
1018
1080
  return false;
1019
1081
  }
1020
1082
  }
1021
1083
  function runtimesDir() {
1022
- return import_node_path3.default.join(sootsimHomeDir(), "runtimes");
1084
+ return import_node_path4.default.join(sootsimHomeDir(), "runtimes");
1023
1085
  }
1024
1086
  function runtimeDir(version) {
1025
- return import_node_path3.default.join(runtimesDir(), version);
1087
+ return import_node_path4.default.join(runtimesDir(), version);
1026
1088
  }
1027
1089
  function activeRuntimeFile() {
1028
- return import_node_path3.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
1090
+ return import_node_path4.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
1029
1091
  }
1030
1092
  function electronDir() {
1031
- return import_node_path3.default.join(sootsimHomeDir(), "electron");
1093
+ return import_node_path4.default.join(sootsimHomeDir(), "electron");
1032
1094
  }
1033
1095
  function electronUserDataDir() {
1034
- return import_node_path3.default.join(electronDir(), "userData");
1096
+ return import_node_path4.default.join(electronDir(), "userData");
1035
1097
  }
1036
1098
  function profilesDir() {
1037
- return import_node_path3.default.join(sootsimHomeDir(), "profiles");
1099
+ return import_node_path4.default.join(sootsimHomeDir(), "profiles");
1038
1100
  }
1039
1101
  function cacheDir() {
1040
- return import_node_path3.default.join(sootsimHomeDir(), "cache");
1102
+ return import_node_path4.default.join(sootsimHomeDir(), "cache");
1041
1103
  }
1042
1104
  function daemonLockfilePath() {
1043
- return import_node_path3.default.join(sootsimHomeDir(), DAEMON_LOCKFILE);
1105
+ return import_node_path4.default.join(sootsimHomeDir(), DAEMON_LOCKFILE);
1044
1106
  }
1045
1107
  function devBridgeLockfilePath() {
1046
- return import_node_path3.default.join(sootsimHomeDir(), DEV_BRIDGE_LOCKFILE);
1108
+ return import_node_path4.default.join(sootsimHomeDir(), DEV_BRIDGE_LOCKFILE);
1047
1109
  }
1048
1110
  function configFilePath() {
1049
- return import_node_path3.default.join(sootsimHomeDir(), CONFIG_FILE);
1111
+ return import_node_path4.default.join(sootsimHomeDir(), CONFIG_FILE);
1050
1112
  }
1051
1113
  function readSharedConfig() {
1052
1114
  try {
@@ -1074,7 +1136,7 @@ function writeSharedConfig(patch) {
1074
1136
  return next;
1075
1137
  }
1076
1138
  function runtimeUpgradeNoticePath() {
1077
- return import_node_path3.default.join(sootsimHomeDir(), "runtime-upgraded.json");
1139
+ return import_node_path4.default.join(sootsimHomeDir(), "runtime-upgraded.json");
1078
1140
  }
1079
1141
  function writeRuntimeUpgradeNotice(notice) {
1080
1142
  ensureSootsimHome();
@@ -1189,13 +1251,13 @@ var import_node_child_process = require("node:child_process");
1189
1251
  var import_node_crypto = __toESM(require("node:crypto"), 1);
1190
1252
  var import_node_fs5 = __toESM(require("node:fs"), 1);
1191
1253
  var import_node_os2 = __toESM(require("node:os"), 1);
1192
- var import_node_path5 = __toESM(require("node:path"), 1);
1254
+ var import_node_path6 = __toESM(require("node:path"), 1);
1193
1255
  var import_node_stream = require("node:stream");
1194
1256
  var import_promises3 = require("node:stream/promises");
1195
1257
 
1196
1258
  // ../contrast-runtime-delivery/src/product.ts
1197
1259
  var import_node_fs4 = __toESM(require("node:fs"), 1);
1198
- var import_node_path4 = __toESM(require("node:path"), 1);
1260
+ var import_node_path5 = __toESM(require("node:path"), 1);
1199
1261
  function isValidRuntimeVersion(value) {
1200
1262
  return value.length <= 100 && /^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(value);
1201
1263
  }
@@ -1207,7 +1269,7 @@ function listInstalledRuntimes(product) {
1207
1269
  }
1208
1270
  }
1209
1271
  function runtimeTarballCacheName(product, version) {
1210
- return import_node_path4.default.posix.basename(product.tarballPath(version));
1272
+ return import_node_path5.default.posix.basename(product.tarballPath(version));
1211
1273
  }
1212
1274
  function compareSemver(a, b) {
1213
1275
  const parse = (v) => {
@@ -1304,7 +1366,7 @@ function createRuntimeDelivery(product) {
1304
1366
  const setActive = opts.setActive !== false;
1305
1367
  const protectVersions = [version, ...opts.protectVersions ?? []];
1306
1368
  pruneLocalRetention({ protectVersions });
1307
- if (!opts.force && import_node_fs5.default.existsSync(import_node_path5.default.join(destDir, product.installedMarker))) {
1369
+ if (!opts.force && import_node_fs5.default.existsSync(import_node_path6.default.join(destDir, product.installedMarker))) {
1308
1370
  if (setActive) product.writeActiveRuntime(version);
1309
1371
  pruneLocalRetention({ protectVersions });
1310
1372
  return {
@@ -1319,14 +1381,14 @@ function createRuntimeDelivery(product) {
1319
1381
  }
1320
1382
  const tarUrl = entry.tarball || tarballUrl(version, cdnOrigin);
1321
1383
  const downloadDir = import_node_fs5.default.mkdtempSync(
1322
- import_node_path5.default.join(import_node_os2.default.tmpdir(), `${product.id}-runtime-download-`)
1384
+ import_node_path6.default.join(import_node_os2.default.tmpdir(), `${product.id}-runtime-download-`)
1323
1385
  );
1324
- const runtimeArchivePath = import_node_path5.default.join(
1386
+ const runtimeArchivePath = import_node_path6.default.join(
1325
1387
  downloadDir,
1326
1388
  runtimeTarballCacheName(product, version)
1327
1389
  );
1328
- const tmpDir = import_node_path5.default.join(
1329
- import_node_path5.default.dirname(destDir),
1390
+ const tmpDir = import_node_path6.default.join(
1391
+ import_node_path6.default.dirname(destDir),
1330
1392
  `.installing-${version}-${process.pid}`
1331
1393
  );
1332
1394
  import_node_fs5.default.rmSync(tmpDir, { recursive: true, force: true });
@@ -1344,7 +1406,7 @@ function createRuntimeDelivery(product) {
1344
1406
  }
1345
1407
  import_node_fs5.default.mkdirSync(tmpDir, { recursive: true });
1346
1408
  await extractTarball(runtimeArchivePath, tmpDir);
1347
- if (!import_node_fs5.default.existsSync(import_node_path5.default.join(tmpDir, product.installedMarker))) {
1409
+ if (!import_node_fs5.default.existsSync(import_node_path6.default.join(tmpDir, product.installedMarker))) {
1348
1410
  throw new Error(
1349
1411
  `extracted tarball for runtime ${version} is missing ${product.installedMarker}`
1350
1412
  );
@@ -1378,7 +1440,7 @@ function createRuntimeDelivery(product) {
1378
1440
  if (pin) {
1379
1441
  const activeVersion2 = product.readActiveRuntime();
1380
1442
  const pinInstalled = import_node_fs5.default.existsSync(
1381
- import_node_path5.default.join(product.runtimeDir(pin), product.installedMarker)
1443
+ import_node_path6.default.join(product.runtimeDir(pin), product.installedMarker)
1382
1444
  );
1383
1445
  if (activeVersion2 === pin && pinInstalled) {
1384
1446
  return {
@@ -1427,7 +1489,7 @@ function createRuntimeDelivery(product) {
1427
1489
  }
1428
1490
  const activeVersion = product.readActiveRuntime();
1429
1491
  const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
1430
- const activeInstalled = activeDir ? import_node_fs5.default.existsSync(import_node_path5.default.join(activeDir, product.installedMarker)) : false;
1492
+ const activeInstalled = activeDir ? import_node_fs5.default.existsSync(import_node_path6.default.join(activeDir, product.installedMarker)) : false;
1431
1493
  const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
1432
1494
  if (!shouldInstall) {
1433
1495
  return {
@@ -1504,7 +1566,7 @@ function createRuntimeDelivery(product) {
1504
1566
  const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
1505
1567
  const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
1506
1568
  return complete || partial;
1507
- }).map((entry) => import_node_path5.default.join(product.cacheDir(), entry.name)).sort();
1569
+ }).map((entry) => import_node_path6.default.join(product.cacheDir(), entry.name)).sort();
1508
1570
  } catch {
1509
1571
  }
1510
1572
  }
@@ -1548,7 +1610,7 @@ async function downloadToFile(url, destPath) {
1548
1610
  if (!res.ok || !res.body) {
1549
1611
  throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
1550
1612
  }
1551
- import_node_fs5.default.mkdirSync(import_node_path5.default.dirname(destPath), { recursive: true });
1613
+ import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(destPath), { recursive: true });
1552
1614
  const tmp = `${destPath}.partial`;
1553
1615
  try {
1554
1616
  await (0, import_promises3.pipeline)(
@@ -1565,22 +1627,22 @@ async function downloadToFile(url, destPath) {
1565
1627
  }
1566
1628
  }
1567
1629
  function sha256File(filePath) {
1568
- return new Promise((resolve, reject) => {
1630
+ return new Promise((resolve2, reject) => {
1569
1631
  const hash = import_node_crypto.default.createHash("sha256");
1570
1632
  const stream = import_node_fs5.default.createReadStream(filePath);
1571
1633
  stream.on("data", (chunk) => hash.update(chunk));
1572
1634
  stream.on("error", reject);
1573
- stream.on("end", () => resolve(hash.digest("hex")));
1635
+ stream.on("end", () => resolve2(hash.digest("hex")));
1574
1636
  });
1575
1637
  }
1576
1638
  function extractTarball(tarPath, destDir) {
1577
- return new Promise((resolve, reject) => {
1639
+ return new Promise((resolve2, reject) => {
1578
1640
  const child = (0, import_node_child_process.spawn)("tar", ["-xzf", tarPath, "-C", destDir], {
1579
1641
  stdio: ["ignore", "inherit", "inherit"]
1580
1642
  });
1581
1643
  child.on("error", reject);
1582
1644
  child.on("exit", (code) => {
1583
- if (code === 0) resolve();
1645
+ if (code === 0) resolve2();
1584
1646
  else reject(new Error(`tar exited with code ${code}`));
1585
1647
  });
1586
1648
  });
@@ -1660,13 +1722,13 @@ var sootsimRuntime = createRuntimeDelivery(SOOTSIM_RUNTIME_PRODUCT);
1660
1722
 
1661
1723
  // src/host/agent-host.ts
1662
1724
  var import_node_fs8 = __toESM(require("node:fs"), 1);
1663
- var import_node_path8 = __toESM(require("node:path"), 1);
1725
+ var import_node_path9 = __toESM(require("node:path"), 1);
1664
1726
 
1665
1727
  // src/agent-sessions.ts
1666
1728
  var import_node_child_process2 = require("node:child_process");
1667
1729
  var import_node_crypto3 = require("node:crypto");
1668
1730
  var import_node_fs7 = __toESM(require("node:fs"), 1);
1669
- var import_node_path7 = __toESM(require("node:path"), 1);
1731
+ var import_node_path8 = __toESM(require("node:path"), 1);
1670
1732
  var import_node_readline = __toESM(require("node:readline"), 1);
1671
1733
 
1672
1734
  // src/agent-events.ts
@@ -1711,7 +1773,7 @@ function encodeAgentPromptEnvelope(input) {
1711
1773
  // src/attached-projects.ts
1712
1774
  var import_node_crypto2 = require("node:crypto");
1713
1775
  var import_node_fs6 = __toESM(require("node:fs"), 1);
1714
- var import_node_path6 = __toESM(require("node:path"), 1);
1776
+ var import_node_path7 = __toESM(require("node:path"), 1);
1715
1777
  var overrideDir = null;
1716
1778
  function userDataDir() {
1717
1779
  if (overrideDir) return overrideDir;
@@ -1723,7 +1785,7 @@ function getUserDataDir() {
1723
1785
  return userDataDir();
1724
1786
  }
1725
1787
  function storeFile() {
1726
- return import_node_path6.default.join(userDataDir(), "attached-projects.json");
1788
+ return import_node_path7.default.join(userDataDir(), "attached-projects.json");
1727
1789
  }
1728
1790
  function cloneEmpty() {
1729
1791
  return {
@@ -1765,7 +1827,7 @@ function loadStore() {
1765
1827
  }
1766
1828
  function writeStore(store) {
1767
1829
  const file = storeFile();
1768
- import_node_fs6.default.mkdirSync(import_node_path6.default.dirname(file), { recursive: true });
1830
+ import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(file), { recursive: true });
1769
1831
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
1770
1832
  const fd = import_node_fs6.default.openSync(tmp, "w", 384);
1771
1833
  try {
@@ -1783,13 +1845,13 @@ function mutateStore(fn) {
1783
1845
  return store;
1784
1846
  }
1785
1847
  function projectIdForCwd(cwd) {
1786
- return (0, import_node_crypto2.createHash)("sha256").update(import_node_path6.default.resolve(cwd)).digest("hex").slice(0, 16);
1848
+ return (0, import_node_crypto2.createHash)("sha256").update(import_node_path7.default.resolve(cwd)).digest("hex").slice(0, 16);
1787
1849
  }
1788
1850
  function newSessionId() {
1789
1851
  return `s_${(0, import_node_crypto2.randomBytes)(10).toString("hex")}`;
1790
1852
  }
1791
1853
  function upsertProject(input) {
1792
- const cwd = import_node_path6.default.resolve(input.cwd);
1854
+ const cwd = import_node_path7.default.resolve(input.cwd);
1793
1855
  const id = projectIdForCwd(cwd);
1794
1856
  let result;
1795
1857
  mutateStore((store) => {
@@ -1815,7 +1877,7 @@ function upsertProject(input) {
1815
1877
  const now = Date.now();
1816
1878
  const created = {
1817
1879
  id,
1818
- name: input.name ?? import_node_path6.default.basename(cwd),
1880
+ name: input.name ?? import_node_path7.default.basename(cwd),
1819
1881
  cwd,
1820
1882
  repoRoot: input.repoRoot,
1821
1883
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -1962,7 +2024,7 @@ async function seedFromDemoAppRegistry() {
1962
2024
  mutateStore((store) => {
1963
2025
  for (const app of apps) {
1964
2026
  if (!import_node_fs6.default.existsSync(app.dir)) continue;
1965
- const cwd = import_node_path6.default.resolve(app.dir);
2027
+ const cwd = import_node_path7.default.resolve(app.dir);
1966
2028
  const id = projectIdForCwd(cwd);
1967
2029
  if (store.attachedProjects.some((p) => p.id === id)) continue;
1968
2030
  const now = Date.now();
@@ -1986,16 +2048,16 @@ async function seedFromDemoAppRegistry() {
1986
2048
 
1987
2049
  // src/agent-sessions.ts
1988
2050
  function sessionDir(sessionId) {
1989
- return import_node_path7.default.join(getUserDataDir(), "sessions", sessionId);
2051
+ return import_node_path8.default.join(getUserDataDir(), "sessions", sessionId);
1990
2052
  }
1991
2053
  function promptFifoPath(sessionId) {
1992
- return import_node_path7.default.join(sessionDir(sessionId), "prompt.in");
2054
+ return import_node_path8.default.join(sessionDir(sessionId), "prompt.in");
1993
2055
  }
1994
2056
  function eventsFifoPath(sessionId) {
1995
- return import_node_path7.default.join(sessionDir(sessionId), "events.out");
2057
+ return import_node_path8.default.join(sessionDir(sessionId), "events.out");
1996
2058
  }
1997
2059
  function transcriptPath(sessionId) {
1998
- return import_node_path7.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
2060
+ return import_node_path8.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
1999
2061
  }
2000
2062
  function pidIsAlive(pid, sessionId) {
2001
2063
  if (!pid) return false;
@@ -2017,8 +2079,8 @@ function resolveSootsimInvocation() {
2017
2079
  const resourcesPath = process.resourcesPath;
2018
2080
  if (resourcesPath) {
2019
2081
  const candidates = [
2020
- import_node_path7.default.join(resourcesPath, "bin", "sootsim"),
2021
- import_node_path7.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
2082
+ import_node_path8.default.join(resourcesPath, "bin", "sootsim"),
2083
+ import_node_path8.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
2022
2084
  ];
2023
2085
  for (const c of candidates) {
2024
2086
  if (import_node_fs7.default.existsSync(c)) return { cmd: c, prefixArgs: [] };
@@ -2044,12 +2106,12 @@ function tryWorkspaceSootsim() {
2044
2106
  const sootsimDir = resolveSootsimPackageDir();
2045
2107
  if (!sootsimDir) return null;
2046
2108
  const binaryName = `sootsim-${process.platform}-${process.arch}`;
2047
- const distBinary = import_node_path7.default.join(sootsimDir, "dist-bin", binaryName);
2109
+ const distBinary = import_node_path8.default.join(sootsimDir, "dist-bin", binaryName);
2048
2110
  if (import_node_fs7.default.existsSync(distBinary)) return { cmd: distBinary, prefixArgs: [] };
2049
- const distBin = import_node_path7.default.join(sootsimDir, "dist-cli", "bin.js");
2111
+ const distBin = import_node_path8.default.join(sootsimDir, "dist-cli", "bin.js");
2050
2112
  if (import_node_fs7.default.existsSync(distBin)) {
2051
2113
  try {
2052
- const src = import_node_path7.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
2114
+ const src = import_node_path8.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
2053
2115
  if (import_node_fs7.default.existsSync(src)) {
2054
2116
  const srcMtime = import_node_fs7.default.statSync(src).mtimeMs;
2055
2117
  const buildMtime = import_node_fs7.default.statSync(distBin).mtimeMs;
@@ -2071,14 +2133,14 @@ function tryWorkspaceSootsim() {
2071
2133
  function resolveSootsimPackageDir() {
2072
2134
  try {
2073
2135
  const resolved = require.resolve("sootsim/package.json");
2074
- return import_node_path7.default.dirname(resolved);
2136
+ return import_node_path8.default.dirname(resolved);
2075
2137
  } catch {
2076
2138
  }
2077
2139
  const here = fileFromImportMeta();
2078
2140
  if (!here) return null;
2079
- let cur = import_node_path7.default.dirname(here);
2141
+ let cur = import_node_path8.default.dirname(here);
2080
2142
  for (let i = 0; i < 8; i++) {
2081
- const pkg = import_node_path7.default.join(cur, "package.json");
2143
+ const pkg = import_node_path8.default.join(cur, "package.json");
2082
2144
  try {
2083
2145
  if (import_node_fs7.default.existsSync(pkg)) {
2084
2146
  const parsed = JSON.parse(import_node_fs7.default.readFileSync(pkg, "utf8"));
@@ -2086,7 +2148,7 @@ function resolveSootsimPackageDir() {
2086
2148
  }
2087
2149
  } catch {
2088
2150
  }
2089
- const parent = import_node_path7.default.dirname(cur);
2151
+ const parent = import_node_path8.default.dirname(cur);
2090
2152
  if (parent === cur) break;
2091
2153
  cur = parent;
2092
2154
  }
@@ -2102,13 +2164,13 @@ function fileFromImportMeta() {
2102
2164
  }
2103
2165
  }
2104
2166
  async function withStartLock(projectId, provider, fn) {
2105
- const lockDir = import_node_path7.default.join(getUserDataDir(), "locks");
2167
+ const lockDir = import_node_path8.default.join(getUserDataDir(), "locks");
2106
2168
  import_node_fs7.default.mkdirSync(lockDir, { recursive: true });
2107
2169
  try {
2108
2170
  import_node_fs7.default.chmodSync(lockDir, 448);
2109
2171
  } catch {
2110
2172
  }
2111
- const lockPath = import_node_path7.default.join(lockDir, `start-${projectId}-${provider}.lock`);
2173
+ const lockPath = import_node_path8.default.join(lockDir, `start-${projectId}-${provider}.lock`);
2112
2174
  const deadline = Date.now() + 4e3;
2113
2175
  let fd = null;
2114
2176
  while (fd === null) {
@@ -2159,7 +2221,7 @@ function isProcessAlive(pid) {
2159
2221
  }
2160
2222
  }
2161
2223
  function mkfifoSync(p) {
2162
- const parent = import_node_path7.default.dirname(p);
2224
+ const parent = import_node_path8.default.dirname(p);
2163
2225
  import_node_fs7.default.mkdirSync(parent, { recursive: true });
2164
2226
  try {
2165
2227
  import_node_fs7.default.chmodSync(parent, 448);
@@ -2224,7 +2286,7 @@ async function startSession(opts) {
2224
2286
  const transcript = transcriptPath(session.id);
2225
2287
  mkfifoSync(promptIn);
2226
2288
  mkfifoSync(eventsOut);
2227
- const transcriptDir = import_node_path7.default.dirname(transcript);
2289
+ const transcriptDir = import_node_path8.default.dirname(transcript);
2228
2290
  import_node_fs7.default.mkdirSync(transcriptDir, { recursive: true });
2229
2291
  try {
2230
2292
  import_node_fs7.default.chmodSync(transcriptDir, 448);
@@ -2443,7 +2505,7 @@ async function sendPromptToTeamMachineSession(input) {
2443
2505
  }
2444
2506
  const command = resolveTeamMachineCommand(input.command);
2445
2507
  const timeoutMs = input.timeoutMs ?? 15e3;
2446
- await new Promise((resolve, reject) => {
2508
+ await new Promise((resolve2, reject) => {
2447
2509
  const child = (0, import_node_child_process3.spawn)(command, ["send", sessionId, text], {
2448
2510
  stdio: ["ignore", "ignore", "pipe"],
2449
2511
  env: process.env
@@ -2467,7 +2529,7 @@ async function sendPromptToTeamMachineSession(input) {
2467
2529
  child.on("exit", (code, signal) => {
2468
2530
  clearTimeout(timer);
2469
2531
  if (code === 0) {
2470
- resolve();
2532
+ resolve2();
2471
2533
  return;
2472
2534
  }
2473
2535
  const detail = stderr.trim();
@@ -2682,7 +2744,7 @@ var AgentHost = class {
2682
2744
  );
2683
2745
  const project = upsertProject({
2684
2746
  cwd: match.cwd,
2685
- name: match.projectName ?? import_node_path8.default.basename(match.cwd),
2747
+ name: match.projectName ?? import_node_path9.default.basename(match.cwd),
2686
2748
  preferredProvider: input.provider ?? existing?.preferredProvider,
2687
2749
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
2688
2750
  knownBundleUrls,
@@ -2702,9 +2764,9 @@ var AgentHost = class {
2702
2764
  const dir = getUserDataDir();
2703
2765
  return {
2704
2766
  userDataDir: dir,
2705
- storeFile: import_node_path8.default.join(dir, "attached-projects.json"),
2706
- sessionsDir: import_node_path8.default.join(dir, "sessions"),
2707
- transcriptsDir: import_node_path8.default.join(dir, "transcripts")
2767
+ storeFile: import_node_path9.default.join(dir, "attached-projects.json"),
2768
+ sessionsDir: import_node_path9.default.join(dir, "sessions"),
2769
+ transcriptsDir: import_node_path9.default.join(dir, "transcripts")
2708
2770
  };
2709
2771
  }
2710
2772
  // --- subscription management ---
@@ -3185,7 +3247,7 @@ async function handleFetchProxyRequest(req, res) {
3185
3247
  } else if (nextBody) {
3186
3248
  targetHeaders["content-length"] = String(nextBody.byteLength);
3187
3249
  }
3188
- const proxyRes = await new Promise((resolve, reject) => {
3250
+ const proxyRes = await new Promise((resolve2, reject) => {
3189
3251
  const proxyReq = transport.request(
3190
3252
  {
3191
3253
  hostname: targetUrl2.hostname,
@@ -3195,7 +3257,7 @@ async function handleFetchProxyRequest(req, res) {
3195
3257
  headers: targetHeaders,
3196
3258
  ...loopbackTlsOptions(targetUrl2)
3197
3259
  },
3198
- resolve
3260
+ resolve2
3199
3261
  );
3200
3262
  const abort = () => proxyReq.destroy(new Error("fetch proxy client disconnected"));
3201
3263
  req.once("aborted", abort);
@@ -3349,7 +3411,7 @@ function buildOpenUrlCommand(url, options = {}) {
3349
3411
  };
3350
3412
  }
3351
3413
  async function spawnLaunch(command, args, detached) {
3352
- return new Promise((resolve, reject) => {
3414
+ return new Promise((resolve2, reject) => {
3353
3415
  const child = (0, import_child_process2.spawn)(command, args, {
3354
3416
  detached,
3355
3417
  stdio: "ignore"
@@ -3357,7 +3419,7 @@ async function spawnLaunch(command, args, detached) {
3357
3419
  child.once("error", reject);
3358
3420
  child.once("spawn", () => {
3359
3421
  if (detached) child.unref();
3360
- resolve(child.pid);
3422
+ resolve2(child.pid);
3361
3423
  });
3362
3424
  });
3363
3425
  }
@@ -3781,7 +3843,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3781
3843
  );
3782
3844
  }
3783
3845
  bindOnce(port, _silent) {
3784
- return new Promise((resolve, reject) => {
3846
+ return new Promise((resolve2, reject) => {
3785
3847
  const server = (0, import_http3.createServer)((req, res) => this.handleHttpRequest(req, res));
3786
3848
  let settled = false;
3787
3849
  const onError = (err) => {
@@ -3813,7 +3875,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3813
3875
  this.wss?.emit("connection", ws, req);
3814
3876
  });
3815
3877
  });
3816
- resolve();
3878
+ resolve2();
3817
3879
  });
3818
3880
  });
3819
3881
  }
@@ -4961,7 +5023,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4961
5023
  async sendCommand(cmd) {
4962
5024
  const sim = await this.waitForSim(cmd.simId);
4963
5025
  const id = this.nextCommandId++;
4964
- return new Promise((resolve, reject) => {
5026
+ return new Promise((resolve2, reject) => {
4965
5027
  const timeout = setTimeout(() => {
4966
5028
  this.pendingCommands.delete(id);
4967
5029
  this.broadcastSimClientStates();
@@ -4973,7 +5035,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4973
5035
  clearTimeout(timeout);
4974
5036
  this.pendingCommands.delete(id);
4975
5037
  this.broadcastSimClientStates();
4976
- resolve(value);
5038
+ resolve2(value);
4977
5039
  },
4978
5040
  reject: (error) => {
4979
5041
  clearTimeout(timeout);
@@ -4999,23 +5061,23 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4999
5061
  async openPathInEditor(filePath, line, column) {
5000
5062
  const loc = line != null ? `:${line}${column != null ? `:${column}` : ""}` : "";
5001
5063
  const target = `${filePath}${loc}`;
5002
- const trySpawn = (cmd, args) => new Promise((resolve) => {
5064
+ const trySpawn = (cmd, args) => new Promise((resolve2) => {
5003
5065
  try {
5004
5066
  const child = (0, import_child_process3.spawn)(cmd, args, { detached: true, stdio: "ignore" });
5005
5067
  let settled = false;
5006
5068
  child.on("error", () => {
5007
5069
  if (settled) return;
5008
5070
  settled = true;
5009
- resolve(false);
5071
+ resolve2(false);
5010
5072
  });
5011
5073
  child.on("spawn", () => {
5012
5074
  if (settled) return;
5013
5075
  settled = true;
5014
5076
  child.unref();
5015
- resolve(true);
5077
+ resolve2(true);
5016
5078
  });
5017
5079
  } catch {
5018
- resolve(false);
5080
+ resolve2(false);
5019
5081
  }
5020
5082
  });
5021
5083
  const envEditor = process.env.REACT_EDITOR || process.env.EDITOR;
@@ -5262,7 +5324,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
5262
5324
  const sim = this.getOpenSim(simId);
5263
5325
  if (sim) return sim;
5264
5326
  }
5265
- await new Promise((resolve) => setTimeout(resolve, intervalMs));
5327
+ await new Promise((resolve2) => setTimeout(resolve2, intervalMs));
5266
5328
  }
5267
5329
  if (!simId) throw new Error("no sim connected");
5268
5330
  const openSimIds = this.getDefaultSimCandidates().map((sim) => sim.id);