sootsim 0.1.138 → 0.1.140

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 (161) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-TD7SHXRH.js → agent-N767ME6M.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-H6JLLQAZ.js → agent-wrapper-ELHIUFZZ.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-JDQFGE3V.js → app-fonts-OZ3OSNAJ.js} +2 -2
  5. package/dist-cli/chunks/{assert-2XLXLJOD.js → assert-GGFUQBNB.js} +2 -2
  6. package/dist-cli/chunks/auto-bootstrap-L5E6XMCK.js +2 -0
  7. package/dist-cli/chunks/beta-D74SDA2L.js +2 -0
  8. package/dist-cli/chunks/camera-5PYEDLLB.js +20 -0
  9. package/dist-cli/chunks/chunk-4FBFOWV3.js +4 -0
  10. package/dist-cli/chunks/{chunk-7ELG4PYE.js → chunk-4FGNOWB6.js} +1 -1
  11. package/dist-cli/chunks/{chunk-ZSPUTLK7.js → chunk-5EP5RRNS.js} +35 -34
  12. package/dist-cli/chunks/{chunk-BA3QQ5B3.js → chunk-5VTYMBUK.js} +2 -2
  13. package/dist-cli/chunks/chunk-6KUVOSFF.js +79 -0
  14. package/dist-cli/chunks/{chunk-CTXIRBH2.js → chunk-77TL74AM.js} +1 -1
  15. package/dist-cli/chunks/{chunk-BDOLDROC.js → chunk-7SMEXHWJ.js} +1 -1
  16. package/dist-cli/chunks/{chunk-JFQVDRBK.js → chunk-AI65UVSN.js} +52 -4
  17. package/dist-cli/chunks/{chunk-XWHR6IKV.js → chunk-AOICEZCA.js} +2 -2
  18. package/dist-cli/chunks/chunk-AP2MOP44.js +2 -0
  19. package/dist-cli/chunks/chunk-BEA3AO36.js +5 -0
  20. package/dist-cli/chunks/{chunk-PILBWKNB.js → chunk-BGXNYXBC.js} +1 -1
  21. package/dist-cli/chunks/{chunk-FFVME5EQ.js → chunk-BLQBPN76.js} +2 -2
  22. package/dist-cli/chunks/{chunk-Q4J2SESV.js → chunk-BM7QWZRI.js} +2 -2
  23. package/dist-cli/chunks/{chunk-5N5MQQM5.js → chunk-C3FURRBF.js} +1 -1
  24. package/dist-cli/chunks/{chunk-RHU73TIJ.js → chunk-CQ3LV5VL.js} +2 -2
  25. package/dist-cli/chunks/chunk-EH6YDCSN.js +119 -0
  26. package/dist-cli/chunks/{chunk-T3HJHXXN.js → chunk-EMNVJOEL.js} +3 -3
  27. package/dist-cli/chunks/{chunk-C563J47N.js → chunk-FYUDIUFX.js} +2 -2
  28. package/dist-cli/chunks/{chunk-WHIZNJLR.js → chunk-GI43DDEI.js} +1 -1
  29. package/dist-cli/chunks/{chunk-KLFGCFE4.js → chunk-GL74P6NR.js} +1 -1
  30. package/dist-cli/chunks/{chunk-GYZ5ZZMH.js → chunk-GYZNLDBX.js} +2 -2
  31. package/dist-cli/chunks/chunk-HPTMLB7V.js +2 -0
  32. package/dist-cli/chunks/{chunk-NPUHFOSG.js → chunk-MRQRJINW.js} +1 -1
  33. package/dist-cli/chunks/{chunk-IEGRNKTT.js → chunk-N2XPC4Z7.js} +2 -2
  34. package/dist-cli/chunks/chunk-NQG4R5K2.js +1 -0
  35. package/dist-cli/chunks/{chunk-62DPZPFC.js → chunk-O2SQNUDP.js} +1 -1
  36. package/dist-cli/chunks/{chunk-I7RL227U.js → chunk-PBS47TD5.js} +2 -2
  37. package/dist-cli/chunks/chunk-Q5Z7P54I.js +2 -0
  38. package/dist-cli/chunks/{chunk-FBDOREAI.js → chunk-QOZ2Q4FH.js} +1 -1
  39. package/dist-cli/chunks/{chunk-SX6BVZL5.js → chunk-QRRBQE6M.js} +2 -2
  40. package/dist-cli/chunks/{chunk-KJOBH5CA.js → chunk-QXOZB7WD.js} +2 -2
  41. package/dist-cli/chunks/{chunk-3XBLSPSH.js → chunk-R5F7XGAO.js} +3 -3
  42. package/dist-cli/chunks/{chunk-VIZ5BLM2.js → chunk-RAY2DLSK.js} +1 -1
  43. package/dist-cli/chunks/{chunk-TP3NTZUM.js → chunk-REIC7HRW.js} +1 -1
  44. package/dist-cli/chunks/chunk-S7I6ZCT2.js +1 -0
  45. package/dist-cli/chunks/{chunk-GSGRNYPC.js → chunk-SSZBFWV7.js} +1 -1
  46. package/dist-cli/chunks/chunk-UHTE6FLK.js +69 -0
  47. package/dist-cli/chunks/{chunk-MZ7TYYP7.js → chunk-WGDXZMKT.js} +2 -2
  48. package/dist-cli/chunks/chunk-WN3WZEE5.js +1 -0
  49. package/dist-cli/chunks/{chunk-JEL7BQG7.js → chunk-X6AWKKL4.js} +2 -2
  50. package/dist-cli/chunks/{chunk-T6QPOIJN.js → chunk-XGYD25DJ.js} +1 -1
  51. package/dist-cli/chunks/{chunk-XV6XIC4J.js → chunk-ZGDJ5TFU.js} +2 -2
  52. package/dist-cli/chunks/{chunk-KBOMW6U3.js → chunk-ZN4Z2W7F.js} +2 -2
  53. package/dist-cli/chunks/{chunk-MNKYCXHQ.js → chunk-ZVQOEMXS.js} +52 -52
  54. package/dist-cli/chunks/cli-version-EZRTEUXF.js +2 -0
  55. package/dist-cli/chunks/{compat-6KRCWKBL.js → compat-U3772TUK.js} +3 -3
  56. package/dist-cli/chunks/{config-JGTLOWS6.js → config-6CZCIYKJ.js} +2 -2
  57. package/dist-cli/chunks/{control-3LHOESUK.js → control-NVA25O65.js} +2 -2
  58. package/dist-cli/chunks/{cpu-profile-KWE5IXBN.js → cpu-profile-WRLTZYO6.js} +2 -2
  59. package/dist-cli/chunks/{daemon-S5LNAQAU.js → daemon-QQPGLGS6.js} +2 -2
  60. package/dist-cli/chunks/{debug-KJ3TNXUN.js → debug-RKYLSDZV.js} +3 -3
  61. package/dist-cli/chunks/{detox-UJIPM47N.js → detox-ZRUQQU22.js} +2 -2
  62. package/dist-cli/chunks/{device-23SEWSUA.js → device-HXTOLEWY.js} +2 -2
  63. package/dist-cli/chunks/{diagnose-53JGSJF2.js → diagnose-QN4E4WA6.js} +2 -2
  64. package/dist-cli/chunks/drivers-EVK22AX5.js +2 -0
  65. package/dist-cli/chunks/{electron-F43274XT.js → electron-ZHRC4WQ5.js} +3 -3
  66. package/dist-cli/chunks/flow-ICCRVJVX.js +2 -0
  67. package/dist-cli/chunks/help-QMZ35MIQ.js +2 -0
  68. package/dist-cli/chunks/{hints-6EFUPUX6.js → hints-HCHKMDUE.js} +2 -2
  69. package/dist-cli/chunks/{home-paths-TAGKOEXO.js → home-paths-3OHKRAE4.js} +2 -2
  70. package/dist-cli/chunks/{inspect-UVBYBYJB.js → inspect-QXUBDKJJ.js} +3 -3
  71. package/dist-cli/chunks/install-JSDZIE2T.js +2 -0
  72. package/dist-cli/chunks/{install-desktop-M2QEFAIN.js → install-desktop-QCX44BGL.js} +7 -7
  73. package/dist-cli/chunks/{keys-IJNQHCGZ.js → keys-VEP2KPUF.js} +2 -2
  74. package/dist-cli/chunks/{launch-UK4I6UYE.js → launch-K4BPQLTP.js} +3 -3
  75. package/dist-cli/chunks/{login-OBLKQALN.js → login-UVC5XRKR.js} +4 -4
  76. package/dist-cli/chunks/{logout-HUOLFAU6.js → logout-3VW34IBA.js} +2 -2
  77. package/dist-cli/chunks/{maestro-B6JMWFEO.js → maestro-HTFXXMLR.js} +2 -2
  78. package/dist-cli/chunks/optional-demo-registry-5YYEAL46.js +2 -0
  79. package/dist-cli/chunks/{preview-TYICI3EN.js → preview-TZYJMLEJ.js} +2 -2
  80. package/dist-cli/chunks/{profile-NQO5HFFJ.js → profile-HDJRF7YB.js} +2 -2
  81. package/dist-cli/chunks/{react-WXEGMAH6.js → react-RLJR26M7.js} +2 -2
  82. package/dist-cli/chunks/{record-3DK7CCXV.js → record-2LDDHHUY.js} +2 -2
  83. package/dist-cli/chunks/runtime-QPYF2WQX.js +2 -0
  84. package/dist-cli/chunks/{runtime-delivery-QAHWI6JH.js → runtime-delivery-3F6O57E5.js} +2 -2
  85. package/dist-cli/chunks/{screenshot-SQ7ETUJY.js → screenshot-QAUSSEPK.js} +2 -2
  86. package/dist-cli/chunks/{screenshot-mode-YYIBQI6S.js → screenshot-mode-K6HEVK4K.js} +2 -2
  87. package/dist-cli/chunks/{screenshots-YH5P24GR.js → screenshots-TWMCGUBT.js} +2 -2
  88. package/dist-cli/chunks/{server-PVYHPTCD.js → server-ZPIZCBW5.js} +3 -3
  89. package/dist-cli/chunks/setup-repo-VHOZJEIV.js +2 -0
  90. package/dist-cli/chunks/{skills-2V2A7R4O.js → skills-NI3RH7CW.js} +2 -2
  91. package/dist-cli/chunks/{start-JKY3T6AY.js → start-G6CQL6HJ.js} +4 -4
  92. package/dist-cli/chunks/store-F6MJUJYW.js +2 -0
  93. package/dist-cli/chunks/telemetry-DM2Y7OQJ.js +2 -0
  94. package/dist-cli/chunks/{test-FVA5WGGM.js → test-V47D6EPK.js} +3 -3
  95. package/dist-cli/chunks/{three-mode-GVODLLP3.js → three-mode-G7N3LRHM.js} +2 -2
  96. package/dist-cli/chunks/{timeline-LCJYWJBG.js → timeline-EBUOILTJ.js} +2 -2
  97. package/dist-cli/chunks/{upgrade-4TVPQJRL.js → upgrade-OQJLTCQP.js} +2 -2
  98. package/dist-cli/chunks/upload-W3YCA65H.js +2 -0
  99. package/dist-cli/chunks/{version-2XWRCYTM.js → version-3YJPPUE5.js} +2 -2
  100. package/dist-cli/chunks/web-ZKUX5ICX.js +2 -0
  101. package/dist-cli/chunks/{what-happened-R57H6WK6.js → what-happened-HOY3TA42.js} +2 -2
  102. package/dist-cli/chunks/{whoami-YCVHJHIM.js → whoami-GOCSBVTG.js} +2 -2
  103. package/dist-lib/agent-daemon-client.cjs +1 -1
  104. package/dist-lib/agent-events.cjs +1 -1
  105. package/dist-lib/agent-sessions.cjs +1 -1
  106. package/dist-lib/attached-projects.cjs +42 -820
  107. package/dist-lib/auth/shared-session.cjs +1 -1
  108. package/dist-lib/backend-origin.cjs +1 -1
  109. package/dist-lib/beta.cjs +1 -1
  110. package/dist-lib/beta.mjs +1 -1
  111. package/dist-lib/bridge-constants.cjs +1 -1
  112. package/dist-lib/cli-constants.cjs +1 -1
  113. package/dist-lib/config.cjs +1 -1
  114. package/dist-lib/detox/index.cjs +1 -1
  115. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  116. package/dist-lib/home-paths.cjs +1 -1
  117. package/dist-lib/host/bridge-host.cjs +179 -956
  118. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  119. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  120. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  121. package/dist-lib/host/websocket-proxy.cjs +1 -1
  122. package/dist-lib/index.cjs +1 -1
  123. package/dist-lib/metro.cjs +1 -1
  124. package/dist-lib/profiles.cjs +1 -1
  125. package/dist-lib/render-mode.cjs +1 -1
  126. package/dist-lib/scripts/dev-server-scanner.cjs +29 -797
  127. package/dist-lib/sdk.cjs +1 -1
  128. package/dist-lib/sdk.mjs +1 -1
  129. package/dist-lib/skills.cjs +660 -1032
  130. package/dist-lib/vite.cjs +1 -1
  131. package/package.json +2 -6
  132. package/scripts/dev-server-scanner.ts +10 -2
  133. package/scripts/optional-demo-registry.ts +54 -0
  134. package/src/attached-projects.ts +6 -27
  135. package/dist-cli/chunks/auto-bootstrap-Q7Z5522T.js +0 -2
  136. package/dist-cli/chunks/beta-LW4TRSKL.js +0 -2
  137. package/dist-cli/chunks/chunk-3AVKOCIL.js +0 -5
  138. package/dist-cli/chunks/chunk-BXITI3GQ.js +0 -4
  139. package/dist-cli/chunks/chunk-DBJCMZX7.js +0 -1
  140. package/dist-cli/chunks/chunk-DV4DKAHB.js +0 -64
  141. package/dist-cli/chunks/chunk-KYAAYSMS.js +0 -2
  142. package/dist-cli/chunks/chunk-M6GZUJXH.js +0 -62
  143. package/dist-cli/chunks/chunk-N4DFR7UX.js +0 -79
  144. package/dist-cli/chunks/chunk-N7TXV2XT.js +0 -1
  145. package/dist-cli/chunks/chunk-SIKDBA2E.js +0 -119
  146. package/dist-cli/chunks/chunk-YB7NANNJ.js +0 -1
  147. package/dist-cli/chunks/chunk-ZS55UGAA.js +0 -2
  148. package/dist-cli/chunks/cli-version-ROECZHPK.js +0 -2
  149. package/dist-cli/chunks/demo-app-registry-SU74KYFQ.js +0 -2
  150. package/dist-cli/chunks/drivers-LQS4T2IT.js +0 -2
  151. package/dist-cli/chunks/flow-H4F2X23Y.js +0 -2
  152. package/dist-cli/chunks/help-BT5NJNJ5.js +0 -2
  153. package/dist-cli/chunks/install-P5R6747T.js +0 -2
  154. package/dist-cli/chunks/runtime-IFNZGBPZ.js +0 -2
  155. package/dist-cli/chunks/setup-repo-Y63FUXRC.js +0 -2
  156. package/dist-cli/chunks/store-KNRC4EGM.js +0 -2
  157. package/dist-cli/chunks/telemetry-HDSITSDA.js +0 -2
  158. package/dist-cli/chunks/upload-3AXP6K6R.js +0 -2
  159. package/dist-cli/chunks/web-4Z6SFQFV.js +0 -2
  160. package/dist-lib/scripts/demo-app-registry.cjs +0 -818
  161. package/scripts/demo-app-registry.ts +0 -1006
@@ -1,4 +1,4 @@
1
- /*! sootsim v0.1.138 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! sootsim v0.1.140 | (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;
@@ -32,802 +32,34 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  ));
33
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
 
35
- // scripts/demo-app-registry.ts
36
- var demo_app_registry_exports = {};
37
- __export(demo_app_registry_exports, {
38
- APPS: () => APPS
35
+ // scripts/optional-demo-registry.ts
36
+ var optional_demo_registry_exports = {};
37
+ __export(optional_demo_registry_exports, {
38
+ loadOptionalDemoApps: () => loadOptionalDemoApps,
39
+ optionalDemoAppsSync: () => optionalDemoAppsSync
39
40
  });
40
- function findWorkspaceRoot(startDir) {
41
- let dir = startDir;
42
- while (true) {
43
- if ((0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "pnpm-workspace.yaml")) || (0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "turbo.json")) || (0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "nx.json")) || (0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "lerna.json"))) {
44
- return dir;
45
- }
46
- const packageJsonPath = (0, import_node_path.join)(dir, "package.json");
47
- if ((0, import_node_fs.existsSync)(packageJsonPath)) {
48
- try {
49
- const pkg = JSON.parse((0, import_node_fs.readFileSync)(packageJsonPath, "utf8"));
50
- if (pkg.workspaces) return dir;
51
- } catch {
52
- }
53
- }
54
- const parent = (0, import_node_path.dirname)(dir);
55
- if (parent === dir) return null;
56
- dir = parent;
57
- }
58
- }
59
- function resolveWorkspaceScriptPath(workspaceRelativePath, packageRelativePath) {
60
- const workspaceRoot = findWorkspaceRoot(process.cwd());
61
- const candidates = [
62
- workspaceRoot ? (0, import_node_path.resolve)(workspaceRoot, workspaceRelativePath) : null,
63
- (0, import_node_path.resolve)(process.cwd(), workspaceRelativePath),
64
- (0, import_node_path.resolve)(process.cwd(), packageRelativePath)
65
- ].filter((candidate) => Boolean(candidate));
66
- for (const candidate of candidates) {
67
- if ((0, import_node_fs.existsSync)(candidate)) return candidate;
68
- }
69
- return candidates[0] ?? (0, import_node_path.resolve)(process.cwd(), workspaceRelativePath);
70
- }
71
- function parseEnvFile(filePath) {
72
- if (!(0, import_node_fs.existsSync)(filePath)) return {};
73
- const env = {};
74
- const source = (0, import_node_fs.readFileSync)(filePath, "utf8");
75
- for (const rawLine of source.split(/\r?\n/)) {
76
- const line = rawLine.trim();
77
- if (!line || line.startsWith("#")) continue;
78
- const match = line.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);
79
- if (!match) continue;
80
- let value = match[2].trim();
81
- if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
82
- value = value.slice(1, -1);
83
- }
84
- env[match[1]] = value;
85
- }
86
- return env;
87
- }
88
- function isUsableUniswapEnvValue(value) {
89
- if (!value) return false;
90
- const trimmed = value.trim();
91
- if (!trimmed) return false;
92
- if (trimmed.includes(UNISWAP_PLACEHOLDER)) return false;
93
- if (trimmed === "TRADING_API_KEY" || trimmed === "UNISWAP_API_KEY") return false;
94
- return true;
95
- }
96
- function pickEnvValue(sources, keys) {
97
- for (const source of sources) {
98
- for (const key of keys) {
99
- const value = source[key];
100
- if (isUsableUniswapEnvValue(value)) return value.trim();
101
- }
102
- }
103
- return void 0;
104
- }
105
- function resolveUniswapDemoEnv() {
106
- const localEnv = parseEnvFile(UNISWAP_ENV_LOCAL_FILE);
107
- const webEnv = parseEnvFile((0, import_node_path.join)(UNISWAP_REPO_DIR, "apps/web/.env"));
108
- const sources = [
109
- process.env,
110
- localEnv,
111
- webEnv
112
- ];
113
- const env = {};
114
- const bindings = [
115
- ["AMPLITUDE_PROXY_URL_OVERRIDE", ["REACT_APP_AMPLITUDE_PROXY_URL"]],
116
- ["QUICKNODE_ENDPOINT_NAME", ["REACT_APP_QUICKNODE_ENDPOINT_NAME"]],
117
- ["QUICKNODE_ENDPOINT_TOKEN", ["REACT_APP_QUICKNODE_ENDPOINT_TOKEN"]],
118
- ["INFURA_KEY", ["REACT_APP_INFURA_KEY"]],
119
- ["STATSIG_API_KEY", ["REACT_APP_STATSIG_API_KEY"]],
120
- ["STATSIG_PROXY_URL_OVERRIDE", ["REACT_APP_STATSIG_PROXY_URL"]],
121
- ["WALLETCONNECT_PROJECT_ID", ["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],
122
- ["WALLETCONNECT_PROJECT_ID_BETA", ["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],
123
- ["WALLETCONNECT_PROJECT_ID_DEV", ["REACT_APP_WALLET_CONNECT_PROJECT_ID"]],
124
- ["TRADING_API_KEY", ["REACT_APP_TRADING_API_KEY"]],
125
- ["UNISWAP_API_KEY", []]
126
- ];
127
- for (const [target, aliases] of bindings) {
128
- const value = pickEnvValue(sources, [target, ...aliases]);
129
- if (!value) continue;
130
- env[target] = value;
131
- for (const alias of aliases) {
132
- env[alias] = value;
133
- }
134
- }
135
- const hasPrivateGatewayKeys = isUsableUniswapEnvValue(env.TRADING_API_KEY) && isUsableUniswapEnvValue(env.UNISWAP_API_KEY);
136
- if (!hasPrivateGatewayKeys) {
137
- const publicGraphqlUrl = pickEnvValue(sources, ["GRAPHQL_URL_OVERRIDE", "REACT_APP_AWS_API_ENDPOINT"]) || "https://interface.gateway.uniswap.org/v1/graphql";
138
- env.API_BASE_URL_OVERRIDE = "https://interface.gateway.uniswap.org";
139
- env.API_BASE_URL_V2_OVERRIDE = "https://interface.gateway.uniswap.org/v2";
140
- env.GRAPHQL_URL_OVERRIDE = publicGraphqlUrl;
141
- env.TRADING_API_URL_OVERRIDE = "https://trading-api-labs.interface.gateway.uniswap.org";
142
- env.FOR_API_URL_OVERRIDE = "https://for.interface.gateway.uniswap.org/v2/FOR.v1.FORService";
143
- }
144
- return env;
145
- }
146
- function ensureUniswapDemoEnvLocal() {
147
- const existingSource = (0, import_node_fs.existsSync)(UNISWAP_ENV_LOCAL_FILE) ? (0, import_node_fs.readFileSync)(UNISWAP_ENV_LOCAL_FILE, "utf8") : "";
148
- if (existingSource && !existingSource.includes(UNISWAP_DEMO_ENV_MARKER)) {
149
- return;
150
- }
151
- const env = resolveUniswapDemoEnv();
152
- const lines = [UNISWAP_DEMO_ENV_MARKER];
153
- for (const [key, value] of Object.entries(env).sort(([a], [b]) => a.localeCompare(b))) {
154
- lines.push(`${key}=${JSON.stringify(value)}`);
155
- }
156
- lines.push("");
157
- (0, import_node_fs.writeFileSync)(UNISWAP_ENV_LOCAL_FILE, `${lines.join("\n")}
158
- `);
159
- }
160
- function ensureUniswapForceUpgradePatched() {
161
- const hookNeedle = `export function useForceUpgradeStatus(): ForceUpgradeStatus {
162
- `;
163
- const hookPatch = ` // sootsim demo: bypass the force-upgrade gate during local engine demos.
164
- return 'not-required'
165
-
166
- `;
167
- const hookLegacyPatch = ` // sootsim demo: bypass the force-upgrade gate during local engine demos.
168
- if (process.env.${UNISWAP_FORCE_UPGRADE_PATCH_MARKER} === 'true') {
169
- return 'not-required'
170
- }
171
-
172
- `;
173
- const notificationNeedle = ` const getForceUpgradeStatus = (): ForceUpgradeStatus => {
174
- `;
175
- const notificationPatch = ` // sootsim demo: bypass the force-upgrade gate during local engine demos.
176
- return 'not-required'
177
-
178
- `;
179
- const notificationLegacyPatch = ` // sootsim demo: bypass the force-upgrade gate during local engine demos.
180
- if (process.env.${UNISWAP_FORCE_UPGRADE_PATCH_MARKER} === 'true') {
181
- return 'not-required'
182
- }
183
-
184
- `;
185
- const patchWithMigration = (filePath, needle, patch, legacyPatch) => {
186
- const source = (0, import_node_fs.readFileSync)(filePath, "utf8");
187
- if (source.includes(patch)) return;
188
- if (source.includes(legacyPatch)) {
189
- (0, import_node_fs.writeFileSync)(filePath, source.replace(legacyPatch, patch));
190
- return;
191
- }
192
- if (!source.includes(needle)) {
193
- throw new Error(
194
- `uniswap demo patch failed: expected snippet not found in ${filePath}`
195
- );
196
- }
197
- (0, import_node_fs.writeFileSync)(filePath, source.replace(needle, `${needle}${patch}`));
198
- };
199
- patchWithMigration(
200
- UNISWAP_FORCE_UPGRADE_HOOK_FILE,
201
- hookNeedle,
202
- hookPatch,
203
- hookLegacyPatch
204
- );
205
- patchWithMigration(
206
- UNISWAP_FORCE_UPGRADE_NOTIFICATION_FILE,
207
- notificationNeedle,
208
- notificationPatch,
209
- notificationLegacyPatch
210
- );
211
- }
212
- function ensureJoplinWatchmanConfigs() {
213
- if (!(0, import_node_fs.existsSync)(JOPLIN_DIR)) return;
214
- for (const rel of JOPLIN_WATCH_ROOTS) {
215
- const dir = (0, import_node_path.join)(JOPLIN_DIR, rel);
216
- if (!(0, import_node_fs.existsSync)(dir)) continue;
217
- const cfg = (0, import_node_path.join)(dir, ".watchmanconfig");
218
- if (!(0, import_node_fs.existsSync)(cfg)) (0, import_node_fs.writeFileSync)(cfg, "{}\n");
219
- }
220
- }
221
- function ensureJoplinBuilt() {
222
- if (!(0, import_node_fs.existsSync)(JOPLIN_DIR)) return;
223
- const missing = JOPLIN_BUILD_SENTINELS.filter(
224
- (rel) => !(0, import_node_fs.existsSync)((0, import_node_path.join)(JOPLIN_DIR, rel))
225
- );
226
- if (missing.length === 0) return;
227
- const { execSync } = require("node:child_process");
228
- execSync("yarn buildParallel", {
229
- cwd: JOPLIN_DIR,
230
- stdio: "inherit",
231
- env: { ...process.env, NO_FLIPPER: "1", CI: "" }
232
- });
233
- const stillMissing = JOPLIN_BUILD_SENTINELS.filter(
234
- (rel) => !(0, import_node_fs.existsSync)((0, import_node_path.join)(JOPLIN_DIR, rel))
235
- );
236
- if (stillMissing.length > 0) {
237
- throw new Error(
238
- `joplin demo: yarn buildParallel did not produce: ${stillMissing.join(", ")}`
239
- );
240
- }
241
- }
242
- function runRainbowSetupCommand(command, cwd) {
243
- const { execSync } = require("node:child_process");
244
- execSync(command, {
245
- cwd,
246
- stdio: "inherit",
247
- env: {
248
- ...process.env,
249
- METADATA_BASE_URL: RAINBOW_METADATA_BASE_URL,
250
- RAINBOW_RELAY_QUOTE_SIGNER: process.env.RAINBOW_RELAY_QUOTE_SIGNER ?? RAINBOW_DEMO_QUOTE_SIGNER
251
- }
252
- });
253
- }
254
- function ensureRainbowGraphqlConfig() {
255
- if (!(0, import_node_fs.existsSync)(RAINBOW_GRAPHQL_DIR)) return;
256
- const source = (0, import_node_fs.existsSync)(RAINBOW_GRAPHQL_CONFIG_FILE) ? (0, import_node_fs.readFileSync)(RAINBOW_GRAPHQL_CONFIG_FILE, "utf8") : "";
257
- if (source.includes(RAINBOW_PUBLIC_ENS_GRAPHQL_URL) && source.includes(RAINBOW_METADATA_BASE_URL)) {
258
- return;
259
- }
260
- (0, import_node_fs.writeFileSync)(
261
- RAINBOW_GRAPHQL_CONFIG_FILE,
262
- `exports.config = {
263
- ens: {
264
- __name: 'ens',
265
- document: './queries/ens.graphql',
266
- schema: {
267
- method: 'POST',
268
- url: '${RAINBOW_PUBLIC_ENS_GRAPHQL_URL}',
269
- },
270
- },
271
- metadata: {
272
- __name: 'metadata',
273
- document: './queries/metadata.graphql',
274
- schema: { method: 'GET', url: '${RAINBOW_METADATA_BASE_URL}/v1/graph' },
275
- },
276
- metadataPOST: {
277
- __name: 'metadataPOST',
278
- document: './queries/metadata.graphql',
279
- schema: { method: 'POST', url: '${RAINBOW_METADATA_BASE_URL}/v1/graph' },
280
- },
281
- arc: {
282
- __name: 'arc',
283
- document: './queries/arc.graphql',
284
- schema: {
285
- method: 'GET',
286
- url: 'https://arc-graphql.rainbow.me/graphql',
287
- headers: {
288
- 'x-api-key': 'ARC_GRAPHQL_API_KEY',
289
- },
290
- },
291
- },
292
- arcDev: {
293
- __name: 'arcDev',
294
- document: './queries/arc.graphql',
295
- schema: {
296
- method: 'GET',
297
- url: 'https://arc-graphql.rainbowdotme.workers.dev/graphql',
298
- headers: {},
299
- },
300
- },
301
- };
302
- `
303
- );
304
- }
305
- function resolveRainbowDemoEnv() {
306
- const env = {
307
- ENABLE_DEV_MODE: "1",
308
- IS_TESTING: "false",
309
- METADATA_BASE_URL: process.env.RAINBOW_METADATA_BASE_URL ?? RAINBOW_DEMO_METADATA_BASE_URL,
310
- ADDYS_API_KEY: process.env.ADDYS_API_KEY ?? RAINBOW_DEMO_SERVICE_API_KEY,
311
- ADDYS_BASE_URL: process.env.ADDYS_BASE_URL ?? RAINBOW_DEMO_METADATA_BASE_URL,
312
- PLATFORM_API_KEY: process.env.PLATFORM_API_KEY ?? RAINBOW_DEMO_SERVICE_API_KEY,
313
- PLATFORM_BASE_URL: process.env.PLATFORM_BASE_URL ?? RAINBOW_DEMO_METADATA_BASE_URL,
314
- RAINBOW_MASTER_KEY: process.env.RAINBOW_MASTER_KEY ?? RAINBOW_DEMO_MASTER_KEY,
315
- RAINBOW_RELAY_QUOTE_SIGNER: process.env.RAINBOW_RELAY_QUOTE_SIGNER ?? RAINBOW_DEMO_QUOTE_SIGNER,
316
- RAINBOW_RELAY_URL: process.env.RAINBOW_RELAY_URL ?? RAINBOW_DEMO_RELAY_URL,
317
- RPC_PROXY_API_KEY_PROD: RAINBOW_DEMO_RPC_API_KEY,
318
- RPC_PROXY_BASE_URL_PROD: process.env.RAINBOW_RPC_PROXY_BASE_URL ?? process.env.RPC_PROXY_BASE_URL_PROD ?? RAINBOW_DEMO_RPC_PROXY_BASE_URL,
319
- SECURE_WALLET_HASH_KEY: process.env.SECURE_WALLET_HASH_KEY ?? RAINBOW_DEMO_SECURE_WALLET_HASH_KEY,
320
- WC_PROJECT_ID: process.env.WC_PROJECT_ID ?? process.env.RAINBOW_WALLETCONNECT_PROJECT_ID ?? RAINBOW_DEMO_WALLETCONNECT_PROJECT_ID
321
- };
322
- const optionalEnvVars = [
323
- "ADDYS_API_KEY",
324
- "ADDYS_BASE_URL",
325
- "IMGIX_DOMAIN",
326
- "IMGIX_TOKEN",
327
- "PLATFORM_API_KEY",
328
- "PLATFORM_BASE_URL",
329
- "RAINBOW_TEST_WALLET",
330
- "RAINBOW_RELAY_API_KEY",
331
- "RAINBOW_RELAY_URL",
332
- "SECURE_WALLET_HASH_KEY",
333
- "TOKEN_SEARCH_URL"
334
- ];
335
- for (const key of optionalEnvVars) {
336
- const value = process.env[key];
337
- if (value) env[key] = value;
338
- }
339
- return env;
340
- }
341
- function ensureRainbowDemoNetworks() {
342
- if (!(0, import_node_fs.existsSync)(RAINBOW_NETWORKS_FILE)) return;
343
- const payload = JSON.parse((0, import_node_fs.readFileSync)(RAINBOW_NETWORKS_FILE, "utf8"));
344
- if (!Array.isArray(payload.networks)) return;
345
- let changed = false;
346
- for (const network of payload.networks) {
347
- const url = network.id ? RAINBOW_DEMO_PUBLIC_RPC_URLS[network.id] : void 0;
348
- if (!url || !network.defaultRPC) continue;
349
- if (network.defaultRPC.url === url) continue;
350
- network.defaultRPC.url = url;
351
- changed = true;
352
- }
353
- if (changed) {
354
- (0, import_node_fs.writeFileSync)(RAINBOW_NETWORKS_FILE, `${JSON.stringify(payload)}
355
- `);
356
- }
357
- }
358
- function ensureRainbowSetup() {
359
- if (!(0, import_node_fs.existsSync)(RAINBOW_DIR)) return;
360
- ensureRainbowGraphqlConfig();
361
- if (!(0, import_node_fs.existsSync)((0, import_node_path.join)(RAINBOW_GRAPHQL_DIR, "node_modules/.bin/graphql-codegen"))) {
362
- runRainbowSetupCommand("fnm exec --using=22 yarn install", RAINBOW_GRAPHQL_DIR);
363
- }
364
- const missingGraphql = RAINBOW_GRAPHQL_SENTINELS.some(
365
- (rel) => !(0, import_node_fs.existsSync)((0, import_node_path.join)(RAINBOW_DIR, rel))
366
- );
367
- if (missingGraphql) {
368
- runRainbowSetupCommand("fnm exec --using=22 yarn codegen", RAINBOW_GRAPHQL_DIR);
369
- }
370
- if (!(0, import_node_fs.existsSync)(RAINBOW_NETWORKS_FILE)) {
371
- runRainbowSetupCommand("fnm exec --using=22 yarn fetch:networks", RAINBOW_DIR);
372
- }
373
- ensureRainbowDemoNetworks();
374
- }
375
- function readArtsyKeysPayload() {
376
- if (!(0, import_node_fs.existsSync)(ARTSY_KEYS_FILE)) return void 0;
41
+ async function loadOptionalDemoApps() {
42
+ if (cached) return cached;
377
43
  try {
378
- const parsed = JSON.parse((0, import_node_fs.readFileSync)(ARTSY_KEYS_FILE, "utf8"));
379
- if (!parsed || typeof parsed !== "object") return void 0;
380
- const secure = parsed.secure && typeof parsed.secure === "object" ? parsed.secure : void 0;
381
- const publicKeys = parsed.public && typeof parsed.public === "object" ? parsed.public : void 0;
382
- if (!secure && !publicKeys) return void 0;
383
- return { secure, public: publicKeys };
44
+ const mod = await import(
45
+ /* @vite-ignore */
46
+ REGISTRY_SPECIFIER
47
+ );
48
+ cached = Array.isArray(mod.APPS) ? mod.APPS : [];
384
49
  } catch {
385
- return void 0;
386
- }
387
- }
388
- function resolveArtsyRuntimeConfig() {
389
- const email = process.env.SOOTSIM_ARTSY_EMAIL ?? process.env.MAESTRO_TEST_EMAIL;
390
- const password = process.env.SOOTSIM_ARTSY_PASSWORD ?? process.env.MAESTRO_TEST_PASSWORD;
391
- const keys = readArtsyKeysPayload();
392
- const env = {};
393
- if (email && password) {
394
- env.SOOTSIM_LAUNCH_ARGUMENTS = JSON.stringify({
395
- email,
396
- password,
397
- useMaestroInit: true
398
- });
399
- }
400
- if (keys) {
401
- env.SOOTSIM_REACT_NATIVE_KEYS_JSON = JSON.stringify(keys);
50
+ cached = [];
402
51
  }
403
- if (Object.keys(env).length === 0) return void 0;
404
- return {
405
- env
406
- };
52
+ return cached;
407
53
  }
408
- function ensureArtsySetup() {
409
- if (!(0, import_node_fs.existsSync)(ARTSY_DIR)) return;
410
- const { execSync } = require("node:child_process");
411
- const yarnRelease = (0, import_node_path.join)(ARTSY_DIR, ".yarn/releases/yarn-4.10.3.cjs");
412
- if ((0, import_node_fs.existsSync)(yarnRelease)) {
413
- const src = (0, import_node_fs.readFileSync)(yarnRelease, "utf8");
414
- const needle = '["clone","-c core.autocrlf=false",';
415
- if (src.includes(needle)) {
416
- (0, import_node_fs.writeFileSync)(
417
- yarnRelease,
418
- src.replace(needle, '["clone","-c","core.autocrlf=false",')
419
- );
420
- }
421
- }
422
- if (!(0, import_node_fs.existsSync)((0, import_node_path.join)(ARTSY_DIR, "node_modules/.yarn-state.yml"))) {
423
- execSync("yarn install", {
424
- cwd: ARTSY_DIR,
425
- stdio: "inherit",
426
- env: { ...process.env, YARN_CHECKSUM_BEHAVIOR: "update" }
427
- });
428
- }
429
- if (!(0, import_node_fs.existsSync)(ARTSY_KEYS_FILE) || !(0, import_node_fs.existsSync)(ARTSY_METAFLAGS_FILE)) {
430
- try {
431
- execSync("yarn setup:oss", { cwd: ARTSY_DIR, stdio: "inherit" });
432
- } catch {
433
- if (!(0, import_node_fs.existsSync)(ARTSY_KEYS_FILE) || !(0, import_node_fs.existsSync)(ARTSY_METAFLAGS_FILE)) {
434
- throw new Error("artsy demo: setup:oss did not create keys/metaflags");
435
- }
436
- }
437
- }
438
- const rnlaPkgJson = (0, import_node_path.join)(
439
- ARTSY_DIR,
440
- "node_modules/react-native-launch-arguments/package.json"
441
- );
442
- if ((0, import_node_fs.existsSync)(rnlaPkgJson)) {
443
- const raw = (0, import_node_fs.readFileSync)(rnlaPkgJson, "utf8");
444
- if (raw.includes('"dist/index.js"')) {
445
- (0, import_node_fs.writeFileSync)(rnlaPkgJson, raw.replace('"dist/index.js"', '"src/index.ts"'));
446
- }
447
- }
448
- if (!(0, import_node_fs.existsSync)(ARTSY_RELAY_SENTINEL)) {
449
- execSync("yarn relay", { cwd: ARTSY_DIR, stdio: "inherit" });
450
- (0, import_node_fs.writeFileSync)(ARTSY_RELAY_SENTINEL, "");
451
- }
54
+ function optionalDemoAppsSync() {
55
+ return cached ?? [];
452
56
  }
453
- var import_node_fs, import_node_os, import_node_path, HOME, getExpensifyProxyScript, getRainbowMetadataProxyScript, getMattermostRNUtilsNativeModule, getMattermostKeychainNativeModule, getMattermostNetworkClientNativeModule, getMattermostPreviewServerScript, EXPENSIFY_NATIVE_PROXY_ENV, MATTERMOST_DIR, UNISWAP_REPO_DIR, UNISWAP_APP_DIR, UNISWAP_ENV_LOCAL_FILE, UNISWAP_PLACEHOLDER, UNISWAP_DEMO_ENV_MARKER, UNISWAP_FORCE_UPGRADE_HOOK_FILE, UNISWAP_FORCE_UPGRADE_NOTIFICATION_FILE, UNISWAP_FORCE_UPGRADE_PATCH_MARKER, JOPLIN_DIR, JOPLIN_APP_DIR, JOPLIN_WATCH_ROOTS, JOPLIN_BUILD_SENTINELS, RAINBOW_DIR, RAINBOW_GRAPHQL_DIR, RAINBOW_GRAPHQL_CONFIG_FILE, RAINBOW_NETWORKS_FILE, RAINBOW_METADATA_BASE_URL, RAINBOW_METADATA_PROXY_PORT, RAINBOW_DEMO_METADATA_BASE_URL, RAINBOW_PUBLIC_ENS_GRAPHQL_URL, RAINBOW_DEMO_QUOTE_SIGNER, RAINBOW_DEMO_RELAY_URL, RAINBOW_DEMO_MASTER_KEY, RAINBOW_DEMO_RPC_PROXY_BASE_URL, RAINBOW_DEMO_RPC_API_KEY, RAINBOW_DEMO_PUBLIC_RPC_URLS, RAINBOW_DEMO_SERVICE_API_KEY, RAINBOW_DEMO_SECURE_WALLET_HASH_KEY, RAINBOW_DEMO_WALLETCONNECT_PROJECT_ID, RAINBOW_GRAPHQL_SENTINELS, ARTSY_DIR, ARTSY_KEYS_FILE, ARTSY_METAFLAGS_FILE, ARTSY_RELAY_SENTINEL, APPS;
454
- var init_demo_app_registry = __esm({
455
- "scripts/demo-app-registry.ts"() {
57
+ var REGISTRY_SPECIFIER, cached;
58
+ var init_optional_demo_registry = __esm({
59
+ "scripts/optional-demo-registry.ts"() {
456
60
  "use strict";
457
- import_node_fs = require("node:fs");
458
- import_node_os = require("node:os");
459
- import_node_path = require("node:path");
460
- HOME = (0, import_node_os.homedir)();
461
- getExpensifyProxyScript = () => resolveWorkspaceScriptPath(
462
- "packages/sootsim-engine/scripts/expensify-web-proxy.ts",
463
- "scripts/expensify-web-proxy.ts"
464
- );
465
- getRainbowMetadataProxyScript = () => resolveWorkspaceScriptPath(
466
- "packages/sootsim-engine/scripts/rainbow-metadata-proxy.ts",
467
- "scripts/rainbow-metadata-proxy.ts"
468
- );
469
- getMattermostRNUtilsNativeModule = () => resolveWorkspaceScriptPath(
470
- "packages/compat/src/stubs/mattermost-rnutils-native.ts",
471
- "../compat/src/stubs/mattermost-rnutils-native.ts"
472
- );
473
- getMattermostKeychainNativeModule = () => resolveWorkspaceScriptPath(
474
- "packages/compat/src/stubs/native-seams/react-native-keychain-manager.ts",
475
- "../compat/src/stubs/native-seams/react-native-keychain-manager.ts"
476
- );
477
- getMattermostNetworkClientNativeModule = () => resolveWorkspaceScriptPath(
478
- "packages/compat/src/stubs/mattermost-network-client-native.ts",
479
- "../compat/src/stubs/mattermost-network-client-native.ts"
480
- );
481
- getMattermostPreviewServerScript = () => resolveWorkspaceScriptPath(
482
- "packages/sootsim-engine/scripts/mattermost-preview-server.ts",
483
- "scripts/mattermost-preview-server.ts"
484
- );
485
- EXPENSIFY_NATIVE_PROXY_ENV = {
486
- USE_NGROK: "true",
487
- NGROK_URL: "http://localhost:9000/",
488
- SECURE_NGROK_URL: "http://localhost:9000/"
489
- };
490
- MATTERMOST_DIR = (0, import_node_path.join)(HOME, "github/mattermost-mobile");
491
- UNISWAP_REPO_DIR = (0, import_node_path.join)(HOME, "github/uniswap-interface");
492
- UNISWAP_APP_DIR = (0, import_node_path.join)(UNISWAP_REPO_DIR, "apps/mobile");
493
- UNISWAP_ENV_LOCAL_FILE = (0, import_node_path.join)(UNISWAP_REPO_DIR, ".env.defaults.local");
494
- UNISWAP_PLACEHOLDER = "stored-in-.env.local";
495
- UNISWAP_DEMO_ENV_MARKER = "# sootsim demo env overrides";
496
- UNISWAP_FORCE_UPGRADE_HOOK_FILE = (0, import_node_path.join)(
497
- UNISWAP_REPO_DIR,
498
- "packages/uniswap/src/features/forceUpgrade/hooks/useForceUpgradeStatus.ts"
499
- );
500
- UNISWAP_FORCE_UPGRADE_NOTIFICATION_FILE = (0, import_node_path.join)(
501
- UNISWAP_REPO_DIR,
502
- "apps/mobile/src/notification-service/data-sources/createForceUpgradeNotificationDataSource.ts"
503
- );
504
- UNISWAP_FORCE_UPGRADE_PATCH_MARKER = "SOOTSIM_DEMO_DISABLE_FORCE_UPGRADE";
505
- JOPLIN_DIR = (0, import_node_path.join)(HOME, "github/joplin");
506
- JOPLIN_APP_DIR = (0, import_node_path.join)(JOPLIN_DIR, "packages/app-mobile");
507
- JOPLIN_WATCH_ROOTS = [
508
- "packages/lib",
509
- "packages/renderer",
510
- "packages/turndown",
511
- "packages/turndown-plugin-gfm",
512
- "packages/editor",
513
- "packages/tools",
514
- "packages/utils",
515
- "packages/fork-htmlparser2",
516
- "packages/fork-uslug",
517
- "packages/fork-sax",
518
- "packages/htmlpack",
519
- "packages/react-native-saf-x",
520
- "packages/react-native-alarm-notification"
521
- ];
522
- JOPLIN_BUILD_SENTINELS = [
523
- "packages/lib/models/Setting.js",
524
- "packages/turndown/lib/turndown.cjs.js",
525
- "packages/app-mobile/pluginAssets/index.js"
526
- ];
527
- RAINBOW_DIR = (0, import_node_path.join)(HOME, "github/rainbow");
528
- RAINBOW_GRAPHQL_DIR = (0, import_node_path.join)(RAINBOW_DIR, "src/graphql");
529
- RAINBOW_GRAPHQL_CONFIG_FILE = (0, import_node_path.join)(RAINBOW_GRAPHQL_DIR, "config.js");
530
- RAINBOW_NETWORKS_FILE = (0, import_node_path.join)(RAINBOW_DIR, "src/references/networks.json");
531
- RAINBOW_METADATA_BASE_URL = "https://metadata.p.rainbow.me";
532
- RAINBOW_METADATA_PROXY_PORT = 9011;
533
- RAINBOW_DEMO_METADATA_BASE_URL = `http://127.0.0.1:${RAINBOW_METADATA_PROXY_PORT}`;
534
- RAINBOW_PUBLIC_ENS_GRAPHQL_URL = "https://api.thegraph.com/subgraphs/name/ensdomains/ens";
535
- RAINBOW_DEMO_QUOTE_SIGNER = "0x0000000000000000000000000000000000000000";
536
- RAINBOW_DEMO_RELAY_URL = "https://relay.rainbow.me";
537
- RAINBOW_DEMO_MASTER_KEY = "sootsim-rainbow-demo-master-key-do-not-use-for-real-wallets";
538
- RAINBOW_DEMO_RPC_PROXY_BASE_URL = "https://rpc.rainbow.me/v1";
539
- RAINBOW_DEMO_RPC_API_KEY = "";
540
- RAINBOW_DEMO_PUBLIC_RPC_URLS = {
541
- "1": "https://ethereum-rpc.publicnode.com"
542
- };
543
- RAINBOW_DEMO_SERVICE_API_KEY = "sootsim-rainbow-demo-api-key";
544
- RAINBOW_DEMO_SECURE_WALLET_HASH_KEY = "0x736f6f7473696d2d7261696e626f772d64656d6f2d686173682d6b6579000000";
545
- RAINBOW_DEMO_WALLETCONNECT_PROJECT_ID = "00000000000000000000000000000000";
546
- RAINBOW_GRAPHQL_SENTINELS = [
547
- "src/graphql/__generated__/ens.ts",
548
- "src/graphql/__generated__/metadata.ts",
549
- "src/graphql/__generated__/metadataPOST.ts"
550
- ];
551
- ARTSY_DIR = (0, import_node_path.join)(HOME, "github/eigen");
552
- ARTSY_KEYS_FILE = (0, import_node_path.join)(ARTSY_DIR, "keys.shared.json");
553
- ARTSY_METAFLAGS_FILE = (0, import_node_path.join)(ARTSY_DIR, "metaflags.json");
554
- ARTSY_RELAY_SENTINEL = (0, import_node_path.join)(ARTSY_DIR, "src/__generated__/.relay-complete");
555
- APPS = [
556
- {
557
- name: "bluesky",
558
- label: "Bluesky",
559
- dir: (0, import_node_path.join)(HOME, "github/bluesky"),
560
- preferredPort: 8082,
561
- framework: "expo",
562
- command: (p) => ({ cmd: `npx expo start --port ${p}` }),
563
- credentials: {
564
- envVars: ["SOOTSIM_BLUESKY_PASSWORD"],
565
- known: { HANDLE: "natew.bsky.social" }
566
- }
567
- },
568
- {
569
- name: "3pc",
570
- label: "3PunchConvo",
571
- dir: (0, import_node_path.join)(HOME, "lightstrike-labs/three-punch-convo-app/apps/one"),
572
- preferredPort: 8081,
573
- framework: "one",
574
- command: (p) => ({ cmd: "npx one dev", env: { ONE_PORT: String(p) } })
575
- },
576
- {
577
- name: "uniswap",
578
- label: "Uniswap",
579
- dir: UNISWAP_APP_DIR,
580
- preferredPort: 8085,
581
- framework: "expo",
582
- prepare: () => {
583
- ensureUniswapDemoEnvLocal();
584
- ensureUniswapForceUpgradePatched();
585
- },
586
- command: (p) => ({
587
- cmd: `npx expo start --clear --port ${p}`,
588
- // prefer the real local mobile env when present, otherwise fall back
589
- // to Uniswap's checked-in public web RPC settings so demo boots cleanly.
590
- env: resolveUniswapDemoEnv()
591
- })
592
- },
593
- {
594
- name: "takeout",
595
- label: "Takeout",
596
- dir: (0, import_node_path.join)(HOME, "takeout"),
597
- preferredPort: 8086,
598
- framework: "one",
599
- // takeout needs more than Metro for the demo to actually work: better-auth
600
- // (login), zero-cache (sync), and a postgres for both. `bun lite` brings
601
- // up the orez-backed stack (PG + zero + s3 in one binary) plus the One
602
- // dev server. takeout's env system shifts every port (web, pg, zero,
603
- // minio) uniformly by PORT_OFFSET, so we derive offset = port - 8081
604
- // (the base web port) to keep all backend ports clear of the default
605
- // dev stack while pinning One to the demo slot. OREZ_DATA_DIR is isolated
606
- // to a per-demo path so we don't fight a soot dev orez that may already
607
- // be holding pglite locks on ~/takeout/.orez (soot can attach takeout as
608
- // a project and spin up its own orez against the same data dir).
609
- readyTimeoutMs: 24e4,
610
- managedPorts: (p) => {
611
- const offset = p - 8081;
612
- return [5433 + offset, 4848 + offset, 9200 + offset];
613
- },
614
- command: (p) => ({
615
- cmd: "bun lite:demo",
616
- env: {
617
- TAKEOUT_ENV_MODE: "development",
618
- PORT_OFFSET: String(p - 8081),
619
- OREZ_DATA_DIR: `${HOME}/.cache/sootsim-demo/takeout-orez`,
620
- VITE_DEMO_MODE: "1",
621
- ZERO_APP_ID: "takeout",
622
- ZERO_APP_PUBLICATIONS: "zero_takeout",
623
- ZERO_CVR_MAX_CONNS: "4",
624
- ZERO_NUM_SYNC_WORKERS: "2",
625
- ZERO_UPSTREAM_MAX_CONNS: "8"
626
- }
627
- })
628
- },
629
- {
630
- name: "expensify",
631
- label: "Expensify",
632
- dir: (0, import_node_path.join)(HOME, "github/expensify"),
633
- preferredPort: 8087,
634
- framework: "rock",
635
- runtimeConfig: {
636
- env: EXPENSIFY_NATIVE_PROXY_ENV
637
- },
638
- sidecars: [
639
- {
640
- name: "web-proxy",
641
- port: 9e3,
642
- readyPath: "/api/Ping",
643
- command: () => ({
644
- cmd: `bun ${JSON.stringify(getExpensifyProxyScript())}`,
645
- env: EXPENSIFY_NATIVE_PROXY_ENV
646
- })
647
- }
648
- ],
649
- command: (p) => ({
650
- cmd: `fnm exec --using=20.20.0 npx rock start --port ${p} --no-interactive`,
651
- env: EXPENSIFY_NATIVE_PROXY_ENV
652
- })
653
- },
654
- {
655
- name: "artsy",
656
- label: "Artsy",
657
- dir: ARTSY_DIR,
658
- preferredPort: 8088,
659
- framework: "expo",
660
- runtimeConfig: resolveArtsyRuntimeConfig(),
661
- prepare: () => {
662
- ensureArtsySetup();
663
- },
664
- command: (p) => ({
665
- // eigen's `yarn start` wraps `react-native start` with a relay watcher
666
- // via concurrently; for the demo we run relay once in prepare and
667
- // invoke the metro server directly so --port is respected.
668
- cmd: `npx react-native start --port ${p}`
669
- }),
670
- credentials: {
671
- envVars: ["SOOTSIM_ARTSY_EMAIL", "SOOTSIM_ARTSY_PASSWORD"],
672
- note: "auto-login reuses Artsy\u2019s built-in Maestro launch-arguments hook"
673
- }
674
- },
675
- {
676
- name: "rainbow",
677
- label: "Rainbow",
678
- dir: RAINBOW_DIR,
679
- preferredPort: 8089,
680
- framework: "rock",
681
- sidecars: [
682
- {
683
- name: "metadata-proxy",
684
- port: RAINBOW_METADATA_PROXY_PORT,
685
- readyPath: "/health",
686
- command: () => ({
687
- cmd: `bun ${JSON.stringify(getRainbowMetadataProxyScript())}`,
688
- env: {
689
- PORT: String(RAINBOW_METADATA_PROXY_PORT),
690
- RAINBOW_PUBLIC_RPC_URLS: JSON.stringify(RAINBOW_DEMO_PUBLIC_RPC_URLS),
691
- RAINBOW_UPSTREAM_METADATA_BASE_URL: RAINBOW_METADATA_BASE_URL
692
- }
693
- })
694
- }
695
- ],
696
- prepare: () => {
697
- ensureRainbowSetup();
698
- },
699
- command: (p) => ({
700
- cmd: `fnm exec --using=22 yarn start --port ${p} --reset-cache`,
701
- env: resolveRainbowDemoEnv()
702
- }),
703
- credentials: {
704
- envVars: ["RAINBOW_TEST_WALLET"],
705
- optionalEnvVars: [
706
- "RAINBOW_WALLETCONNECT_PROJECT_ID",
707
- "WC_PROJECT_ID",
708
- "IMGIX_DOMAIN",
709
- "IMGIX_TOKEN"
710
- ],
711
- note: "launcher supplies demo encryption, public mainnet RPC, and a placeholder WalletConnect project id; use only a public throwaway mnemonic for RAINBOW_TEST_WALLET"
712
- }
713
- },
714
- {
715
- name: "rocket-chat",
716
- label: "Rocket.Chat",
717
- dir: (0, import_node_path.join)(HOME, "github/Rocket.Chat.ReactNative"),
718
- preferredPort: 8093,
719
- framework: "expo",
720
- command: (p) => ({
721
- cmd: `npx react-native start --port ${p}`,
722
- env: { RUNNING_E2E_TESTS: "true" }
723
- }),
724
- credentials: {
725
- envVars: [
726
- "ROCKET_CHAT_DEMO_SERVER",
727
- "ROCKET_CHAT_DEMO_USERNAME",
728
- "ROCKET_CHAT_DEMO_PASSWORD"
729
- ],
730
- known: { SERVER: "https://mobile.qa.rocket.chat" },
731
- note: "use packages/sootsim-engine/scripts/rocket-chat-demo-auth.ts to create/login a disposable QA user and print the rocketchat://auth deep link"
732
- }
733
- },
734
- {
735
- name: "mattermost",
736
- label: "Mattermost",
737
- dir: MATTERMOST_DIR,
738
- preferredPort: 8090,
739
- framework: "expo",
740
- sidecars: [
741
- {
742
- name: "preview-server",
743
- port: 8065,
744
- readyPath: "/api/v4/system/ping",
745
- command: () => ({
746
- cmd: `bun ${JSON.stringify(getMattermostPreviewServerScript())}`
747
- })
748
- }
749
- ],
750
- runtimeConfig: {
751
- modules: {
752
- // mattermost patches react-native-keychain's JS entry in its own
753
- // repo; run that package and provide only the native manager seam.
754
- "react-native-keychain": false,
755
- "dist/assets/config.json": {
756
- inline: {
757
- AuthUrlScheme: "mmauth://",
758
- AuthUrlSchemeDev: "mmauthbeta://",
759
- DefaultServerUrl: "http://localhost:8065",
760
- DefaultServerName: "Mattermost Demo",
761
- TestServerUrl: "http://localhost:8065",
762
- AutoSelectServerUrl: true,
763
- WebsiteURL: "https://mattermost.com",
764
- ServerNoticeURL: "https://github.com/mattermost/mattermost-server/blob/master/NOTICE.txt",
765
- MobileNoticeURL: "https://github.com/mattermost/mattermost-mobile/blob/master/NOTICE.txt",
766
- RudderApiKey: "",
767
- SentryEnabled: false,
768
- SentryDsnIos: "",
769
- SentryDsnAndroid: "",
770
- SentryOptions: {
771
- deactivateStacktraceMerging: true,
772
- autoBreadcrumbs: {
773
- xhr: false,
774
- console: true
775
- },
776
- severityLevelFilter: ["fatal"]
777
- },
778
- ShowReview: false,
779
- ShowOnboarding: false,
780
- ExperimentalNormalizeMarkdownLinks: false,
781
- CustomRequestHeaders: {},
782
- CollectNetworkMetrics: false
783
- }
784
- }
785
- },
786
- nativeModules: {
787
- RNKeychainManager: { file: getMattermostKeychainNativeModule() },
788
- RNUtils: { file: getMattermostRNUtilsNativeModule() },
789
- GenericClient: { file: getMattermostNetworkClientNativeModule() },
790
- ApiClient: { file: getMattermostNetworkClientNativeModule() },
791
- WebSocketClient: { file: getMattermostNetworkClientNativeModule() }
792
- }
793
- },
794
- command: (p) => ({
795
- cmd: `npx react-native start --host 127.0.0.1 --port ${p}`
796
- }),
797
- credentials: {
798
- known: {
799
- SERVER: "http://localhost:8065",
800
- USERNAME: "demo",
801
- PASSWORD: "DemoPassword1!"
802
- },
803
- note: "local mattermost-preview seeded through the real REST API; no signup or OTP needed"
804
- }
805
- },
806
- {
807
- name: "joplin",
808
- label: "Joplin",
809
- dir: JOPLIN_APP_DIR,
810
- preferredPort: 8084,
811
- framework: "expo",
812
- // joplin is local-first: sync.target defaults to 0 ("None") and the
813
- // mobile startup runs WelcomeUtils.install() on first launch, which
814
- // seeds a "Welcome!" folder + welcome notes. no login or external
815
- // credentials are needed for a usable demo — just boot it. tenant
816
- // bedrock SQLite (via react-native-sqlite-storage stub) carries the
817
- // seeded notes across reloads.
818
- prepare: () => {
819
- ensureJoplinWatchmanConfigs();
820
- ensureJoplinBuilt();
821
- },
822
- command: (p) => ({
823
- cmd: `npx expo start --port ${p}`,
824
- env: { BROWSERSLIST_IGNORE_OLD_DATA: "true" }
825
- }),
826
- credentials: {
827
- note: "no login required \u2014 sync.target=0 (None), seed via WelcomeUtils"
828
- }
829
- }
830
- ];
61
+ REGISTRY_SPECIFIER = "./demo-app-registry.ts";
62
+ cached = null;
831
63
  }
832
64
  });
833
65
 
@@ -898,20 +130,21 @@ function normalizeNativeDevBundleUrl(bundleUrl) {
898
130
  }
899
131
 
900
132
  // scripts/dev-server-scanner.ts
901
- init_demo_app_registry();
133
+ init_optional_demo_registry();
902
134
  var execP = (0, import_util.promisify)(import_child_process.exec);
135
+ void loadOptionalDemoApps();
903
136
  var TIMEOUT_MS = 250;
904
137
  var MANIFEST_TIMEOUT_MS = 1500;
905
138
  var TCP_GATE_MS = 120;
906
139
  function tcpPing(port, timeout = TCP_GATE_MS) {
907
- return new Promise((resolve2) => {
140
+ return new Promise((resolve) => {
908
141
  const sock = new import_net.default.Socket();
909
142
  let settled = false;
910
143
  const done = (ok) => {
911
144
  if (settled) return;
912
145
  settled = true;
913
146
  sock.destroy();
914
- resolve2(ok);
147
+ resolve(ok);
915
148
  };
916
149
  sock.setTimeout(timeout);
917
150
  sock.once("connect", () => done(true));
@@ -921,7 +154,7 @@ function tcpPing(port, timeout = TCP_GATE_MS) {
921
154
  });
922
155
  }
923
156
  function httpGet(port, path7, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
924
- return new Promise((resolve2) => {
157
+ return new Promise((resolve) => {
925
158
  const req = import_http.default.request(
926
159
  { hostname: "localhost", port, path: path7, method, timeout, headers },
927
160
  (res) => {
@@ -935,14 +168,14 @@ function httpGet(port, path7, method = "GET", timeout = TIMEOUT_MS, headers = {}
935
168
  })();
936
169
  res.on(
937
170
  "end",
938
- () => resolve2({ statusCode: res.statusCode || 0, body, contentType })
171
+ () => resolve({ statusCode: res.statusCode || 0, body, contentType })
939
172
  );
940
173
  }
941
174
  );
942
- req.on("error", () => resolve2(null));
175
+ req.on("error", () => resolve(null));
943
176
  req.setTimeout(timeout, () => {
944
177
  req.destroy();
945
- resolve2(null);
178
+ resolve(null);
946
179
  });
947
180
  req.end();
948
181
  });
@@ -1017,8 +250,8 @@ async function discoverListeningProcesses(excludePorts = []) {
1017
250
  var cwdByPid = /* @__PURE__ */ new Map();
1018
251
  async function resolveProcessCwd(pid) {
1019
252
  if (pid <= 0) return null;
1020
- const cached2 = cwdByPid.get(pid);
1021
- if (cached2) return cached2;
253
+ const cached3 = cwdByPid.get(pid);
254
+ if (cached3) return cached3;
1022
255
  try {
1023
256
  const { stdout } = await execP(`lsof -p ${pid} -a -d cwd -Fn 2>/dev/null`, {
1024
257
  encoding: "utf8",
@@ -1050,7 +283,7 @@ function makeResult(port, framework) {
1050
283
  };
1051
284
  }
1052
285
  function withRuntimeConfig(port, bundleUrl) {
1053
- const knownApp = APPS.find((app) => app.preferredPort === port);
286
+ const knownApp = optionalDemoAppsSync().find((app) => app.preferredPort === port);
1054
287
  const configured = knownApp?.runtimeConfig ? applySootSimConfigToUrl(bundleUrl, knownApp.runtimeConfig) : bundleUrl;
1055
288
  return normalizeNativeDevBundleUrl(configured);
1056
289
  }
@@ -1226,12 +459,12 @@ async function scanDevServers(opts = {}) {
1226
459
  const results = [];
1227
460
  const toProbe = [];
1228
461
  for (const { port, pid } of processes) {
1229
- const cached2 = portCache.get(port);
1230
- if (cached2 && __shouldReuseScannerCacheEntry(cached2, pid)) {
1231
- if (cached2.result) results.push(cached2.result);
462
+ const cached3 = portCache.get(port);
463
+ if (cached3 && __shouldReuseScannerCacheEntry(cached3, pid)) {
464
+ if (cached3.result) results.push(cached3.result);
1232
465
  continue;
1233
466
  }
1234
- if (cached2 && cached2.pid !== pid) {
467
+ if (cached3 && cached3.pid !== pid) {
1235
468
  knownNonPatched.delete(port);
1236
469
  knownNonExpo.delete(port);
1237
470
  knownOne.delete(port);
@@ -1274,34 +507,34 @@ var SOOTSIM_BRIDGE_SIM_CLOSE_CODE = 4001;
1274
507
  var SOOTSIM_BRIDGE_SIM_CLOSE_REASON = "sootsim close";
1275
508
 
1276
509
  // src/cli-version.ts
1277
- var import_node_fs2 = require("node:fs");
510
+ var import_node_fs = require("node:fs");
1278
511
  var import_node_url = require("node:url");
1279
512
  var import_meta = {};
1280
- var cached = null;
513
+ var cached2 = null;
1281
514
  function getCliVersion() {
1282
- if (cached != null) return cached;
515
+ if (cached2 != null) return cached2;
1283
516
  const candidates = [
1284
517
  () => (0, import_node_url.fileURLToPath)(import_meta.resolve("sootsim/package.json")),
1285
518
  () => (0, import_node_url.fileURLToPath)(new URL("../package.json", __sootsim_import_meta_url))
1286
519
  ];
1287
- for (const resolve2 of candidates) {
520
+ for (const resolve of candidates) {
1288
521
  try {
1289
- const version = JSON.parse((0, import_node_fs2.readFileSync)(resolve2(), "utf8")).version;
522
+ const version = JSON.parse((0, import_node_fs.readFileSync)(resolve(), "utf8")).version;
1290
523
  if (typeof version === "string" && version) {
1291
- cached = version;
1292
- return cached;
524
+ cached2 = version;
525
+ return cached2;
1293
526
  }
1294
527
  } catch {
1295
528
  }
1296
529
  }
1297
- cached = "0.0.0";
1298
- return cached;
530
+ cached2 = "0.0.0";
531
+ return cached2;
1299
532
  }
1300
533
 
1301
534
  // src/home-paths.ts
1302
- var import_node_fs3 = __toESM(require("node:fs"), 1);
1303
- var import_node_os2 = require("node:os");
1304
- var import_node_path2 = __toESM(require("node:path"), 1);
535
+ var import_node_fs2 = __toESM(require("node:fs"), 1);
536
+ var import_node_os = require("node:os");
537
+ var import_node_path = __toESM(require("node:path"), 1);
1305
538
  var SOOTSIM_HOME_ENV = "SOOTSIM_HOME";
1306
539
  var ACTIVE_RUNTIME_FILE = "active";
1307
540
  var DAEMON_LOCKFILE = "daemon.json";
@@ -1309,39 +542,39 @@ var CONFIG_FILE = "config.json";
1309
542
  var DAEMON_HEARTBEAT_STALE_MS = 3e4;
1310
543
  function sootsimHomeDir() {
1311
544
  const override = process.env[SOOTSIM_HOME_ENV];
1312
- if (override && override.length > 0) return import_node_path2.default.resolve(override);
1313
- return import_node_path2.default.join((0, import_node_os2.homedir)(), ".sootsim");
545
+ if (override && override.length > 0) return import_node_path.default.resolve(override);
546
+ return import_node_path.default.join((0, import_node_os.homedir)(), ".sootsim");
1314
547
  }
1315
548
  function runtimesDir() {
1316
- return import_node_path2.default.join(sootsimHomeDir(), "runtimes");
549
+ return import_node_path.default.join(sootsimHomeDir(), "runtimes");
1317
550
  }
1318
551
  function runtimeDir(version) {
1319
- return import_node_path2.default.join(runtimesDir(), version);
552
+ return import_node_path.default.join(runtimesDir(), version);
1320
553
  }
1321
554
  function activeRuntimeFile() {
1322
- return import_node_path2.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
555
+ return import_node_path.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
1323
556
  }
1324
557
  function electronDir() {
1325
- return import_node_path2.default.join(sootsimHomeDir(), "electron");
558
+ return import_node_path.default.join(sootsimHomeDir(), "electron");
1326
559
  }
1327
560
  function electronUserDataDir() {
1328
- return import_node_path2.default.join(electronDir(), "userData");
561
+ return import_node_path.default.join(electronDir(), "userData");
1329
562
  }
1330
563
  function profilesDir() {
1331
- return import_node_path2.default.join(sootsimHomeDir(), "profiles");
564
+ return import_node_path.default.join(sootsimHomeDir(), "profiles");
1332
565
  }
1333
566
  function cacheDir() {
1334
- return import_node_path2.default.join(sootsimHomeDir(), "cache");
567
+ return import_node_path.default.join(sootsimHomeDir(), "cache");
1335
568
  }
1336
569
  function daemonLockfilePath() {
1337
- return import_node_path2.default.join(sootsimHomeDir(), DAEMON_LOCKFILE);
570
+ return import_node_path.default.join(sootsimHomeDir(), DAEMON_LOCKFILE);
1338
571
  }
1339
572
  function configFilePath() {
1340
- return import_node_path2.default.join(sootsimHomeDir(), CONFIG_FILE);
573
+ return import_node_path.default.join(sootsimHomeDir(), CONFIG_FILE);
1341
574
  }
1342
575
  function readSharedConfig() {
1343
576
  try {
1344
- const raw = import_node_fs3.default.readFileSync(configFilePath(), "utf8");
577
+ const raw = import_node_fs2.default.readFileSync(configFilePath(), "utf8");
1345
578
  const parsed = JSON.parse(raw);
1346
579
  return parsed && typeof parsed === "object" ? parsed : {};
1347
580
  } catch {
@@ -1359,34 +592,34 @@ function writeSharedConfig(patch) {
1359
592
  };
1360
593
  }
1361
594
  const tmp = `${configFilePath()}.tmp`;
1362
- import_node_fs3.default.writeFileSync(tmp, `${JSON.stringify(next, null, 2)}
595
+ import_node_fs2.default.writeFileSync(tmp, `${JSON.stringify(next, null, 2)}
1363
596
  `, "utf8");
1364
- import_node_fs3.default.renameSync(tmp, configFilePath());
597
+ import_node_fs2.default.renameSync(tmp, configFilePath());
1365
598
  return next;
1366
599
  }
1367
600
  function ensureSootsimHome() {
1368
- import_node_fs3.default.mkdirSync(sootsimHomeDir(), { recursive: true });
1369
- import_node_fs3.default.mkdirSync(runtimesDir(), { recursive: true });
1370
- import_node_fs3.default.mkdirSync(electronDir(), { recursive: true });
1371
- import_node_fs3.default.mkdirSync(profilesDir(), { recursive: true });
1372
- import_node_fs3.default.mkdirSync(cacheDir(), { recursive: true });
601
+ import_node_fs2.default.mkdirSync(sootsimHomeDir(), { recursive: true });
602
+ import_node_fs2.default.mkdirSync(runtimesDir(), { recursive: true });
603
+ import_node_fs2.default.mkdirSync(electronDir(), { recursive: true });
604
+ import_node_fs2.default.mkdirSync(profilesDir(), { recursive: true });
605
+ import_node_fs2.default.mkdirSync(cacheDir(), { recursive: true });
1373
606
  }
1374
607
  function readActiveRuntime() {
1375
608
  try {
1376
- const value = import_node_fs3.default.readFileSync(activeRuntimeFile(), "utf8").trim();
609
+ const value = import_node_fs2.default.readFileSync(activeRuntimeFile(), "utf8").trim();
1377
610
  return value.length > 0 ? value : null;
1378
611
  } catch {
1379
612
  return null;
1380
613
  }
1381
614
  }
1382
615
  function writeActiveRuntime(version) {
1383
- import_node_fs3.default.mkdirSync(runtimesDir(), { recursive: true });
1384
- import_node_fs3.default.writeFileSync(activeRuntimeFile(), `${version}
616
+ import_node_fs2.default.mkdirSync(runtimesDir(), { recursive: true });
617
+ import_node_fs2.default.writeFileSync(activeRuntimeFile(), `${version}
1385
618
  `, "utf8");
1386
619
  }
1387
620
  function listInstalledRuntimes() {
1388
621
  try {
1389
- return import_node_fs3.default.readdirSync(runtimesDir(), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort(compareSemver);
622
+ return import_node_fs2.default.readdirSync(runtimesDir(), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort(compareSemver);
1390
623
  } catch {
1391
624
  return [];
1392
625
  }
@@ -1417,7 +650,7 @@ function activeRuntimeDir() {
1417
650
  if (!version) return null;
1418
651
  const dir = runtimeDir(version);
1419
652
  try {
1420
- if (import_node_fs3.default.statSync(dir).isDirectory()) return dir;
653
+ if (import_node_fs2.default.statSync(dir).isDirectory()) return dir;
1421
654
  } catch {
1422
655
  }
1423
656
  return null;
@@ -1425,10 +658,10 @@ function activeRuntimeDir() {
1425
658
  var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
1426
659
  function readDaemonLockfile() {
1427
660
  try {
1428
- const fd = import_node_fs3.default.openSync(daemonLockfilePath(), "r");
661
+ const fd = import_node_fs2.default.openSync(daemonLockfilePath(), "r");
1429
662
  try {
1430
663
  const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
1431
- const bytesRead = import_node_fs3.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
664
+ const bytesRead = import_node_fs2.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
1432
665
  const raw = buf.subarray(0, bytesRead).toString("utf8");
1433
666
  const parsed = JSON.parse(raw);
1434
667
  if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number") {
@@ -1436,7 +669,7 @@ function readDaemonLockfile() {
1436
669
  }
1437
670
  return null;
1438
671
  } finally {
1439
- import_node_fs3.default.closeSync(fd);
672
+ import_node_fs2.default.closeSync(fd);
1440
673
  }
1441
674
  } catch {
1442
675
  return null;
@@ -1455,9 +688,9 @@ function isDaemonLockfileFresh(lock, now = Date.now()) {
1455
688
  function writeDaemonLockfile(data) {
1456
689
  ensureSootsimHome();
1457
690
  const tmp = `${daemonLockfilePath()}.tmp`;
1458
- import_node_fs3.default.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
691
+ import_node_fs2.default.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
1459
692
  `, "utf8");
1460
- import_node_fs3.default.renameSync(tmp, daemonLockfilePath());
693
+ import_node_fs2.default.renameSync(tmp, daemonLockfilePath());
1461
694
  }
1462
695
  function claimDaemonLockfile(data) {
1463
696
  ensureSootsimHome();
@@ -1470,7 +703,7 @@ function claimDaemonLockfile(data) {
1470
703
  }
1471
704
  function removeDaemonLockfile() {
1472
705
  try {
1473
- import_node_fs3.default.unlinkSync(daemonLockfilePath());
706
+ import_node_fs2.default.unlinkSync(daemonLockfilePath());
1474
707
  } catch {
1475
708
  }
1476
709
  }
@@ -1665,36 +898,36 @@ async function downloadToFile(url, destPath) {
1665
898
  }
1666
899
  }
1667
900
  function sha256File(filePath) {
1668
- return new Promise((resolve2, reject) => {
901
+ return new Promise((resolve, reject) => {
1669
902
  const hash = import_crypto.default.createHash("sha256");
1670
903
  const stream = import_fs.default.createReadStream(filePath);
1671
904
  stream.on("data", (chunk) => hash.update(chunk));
1672
905
  stream.on("error", reject);
1673
- stream.on("end", () => resolve2(hash.digest("hex")));
906
+ stream.on("end", () => resolve(hash.digest("hex")));
1674
907
  });
1675
908
  }
1676
909
  function extractTarball(tarPath, destDir) {
1677
- return new Promise((resolve2, reject) => {
910
+ return new Promise((resolve, reject) => {
1678
911
  const child = (0, import_child_process2.spawn)("tar", ["-xzf", tarPath, "-C", destDir], {
1679
912
  stdio: ["ignore", "inherit", "inherit"]
1680
913
  });
1681
914
  child.on("error", reject);
1682
915
  child.on("exit", (code) => {
1683
- if (code === 0) resolve2();
916
+ if (code === 0) resolve();
1684
917
  else reject(new Error(`tar exited with code ${code}`));
1685
918
  });
1686
919
  });
1687
920
  }
1688
921
 
1689
922
  // src/host/agent-host.ts
1690
- var import_node_fs6 = __toESM(require("node:fs"), 1);
1691
- var import_node_path5 = __toESM(require("node:path"), 1);
923
+ var import_node_fs5 = __toESM(require("node:fs"), 1);
924
+ var import_node_path4 = __toESM(require("node:path"), 1);
1692
925
 
1693
926
  // src/agent-sessions.ts
1694
927
  var import_node_child_process = require("node:child_process");
1695
928
  var import_node_crypto2 = require("node:crypto");
1696
- var import_node_fs5 = __toESM(require("node:fs"), 1);
1697
- var import_node_path4 = __toESM(require("node:path"), 1);
929
+ var import_node_fs4 = __toESM(require("node:fs"), 1);
930
+ var import_node_path3 = __toESM(require("node:path"), 1);
1698
931
  var import_node_readline = __toESM(require("node:readline"), 1);
1699
932
 
1700
933
  // src/agent-events.ts
@@ -1738,8 +971,8 @@ function encodeAgentPromptEnvelope(input) {
1738
971
 
1739
972
  // src/attached-projects.ts
1740
973
  var import_node_crypto = require("node:crypto");
1741
- var import_node_fs4 = __toESM(require("node:fs"), 1);
1742
- var import_node_path3 = __toESM(require("node:path"), 1);
974
+ var import_node_fs3 = __toESM(require("node:fs"), 1);
975
+ var import_node_path2 = __toESM(require("node:path"), 1);
1743
976
  var overrideDir = null;
1744
977
  function userDataDir() {
1745
978
  if (overrideDir) return overrideDir;
@@ -1751,7 +984,7 @@ function getUserDataDir() {
1751
984
  return userDataDir();
1752
985
  }
1753
986
  function storeFile() {
1754
- return import_node_path3.default.join(userDataDir(), "attached-projects.json");
987
+ return import_node_path2.default.join(userDataDir(), "attached-projects.json");
1755
988
  }
1756
989
  function cloneEmpty() {
1757
990
  return {
@@ -1765,7 +998,7 @@ function loadStore() {
1765
998
  const file = storeFile();
1766
999
  let raw;
1767
1000
  try {
1768
- raw = import_node_fs4.default.readFileSync(file, "utf8");
1001
+ raw = import_node_fs3.default.readFileSync(file, "utf8");
1769
1002
  } catch (err) {
1770
1003
  if (err.code === "ENOENT") return cloneEmpty();
1771
1004
  throw err;
@@ -1782,7 +1015,7 @@ function loadStore() {
1782
1015
  } catch (err) {
1783
1016
  const quarantine = `${file}.corrupt-${Date.now()}`;
1784
1017
  try {
1785
- import_node_fs4.default.renameSync(file, quarantine);
1018
+ import_node_fs3.default.renameSync(file, quarantine);
1786
1019
  console.warn(
1787
1020
  `[sootsim] attached-projects.json was unparseable; quarantined to ${quarantine}. original error: ${err.message}`
1788
1021
  );
@@ -1793,16 +1026,16 @@ function loadStore() {
1793
1026
  }
1794
1027
  function writeStore(store) {
1795
1028
  const file = storeFile();
1796
- import_node_fs4.default.mkdirSync(import_node_path3.default.dirname(file), { recursive: true });
1029
+ import_node_fs3.default.mkdirSync(import_node_path2.default.dirname(file), { recursive: true });
1797
1030
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
1798
- const fd = import_node_fs4.default.openSync(tmp, "w", 384);
1031
+ const fd = import_node_fs3.default.openSync(tmp, "w", 384);
1799
1032
  try {
1800
- import_node_fs4.default.writeFileSync(fd, JSON.stringify(store, null, 2));
1801
- import_node_fs4.default.fsyncSync(fd);
1033
+ import_node_fs3.default.writeFileSync(fd, JSON.stringify(store, null, 2));
1034
+ import_node_fs3.default.fsyncSync(fd);
1802
1035
  } finally {
1803
- import_node_fs4.default.closeSync(fd);
1036
+ import_node_fs3.default.closeSync(fd);
1804
1037
  }
1805
- import_node_fs4.default.renameSync(tmp, file);
1038
+ import_node_fs3.default.renameSync(tmp, file);
1806
1039
  }
1807
1040
  function mutateStore(fn) {
1808
1041
  const store = loadStore();
@@ -1811,13 +1044,13 @@ function mutateStore(fn) {
1811
1044
  return store;
1812
1045
  }
1813
1046
  function projectIdForCwd(cwd) {
1814
- return (0, import_node_crypto.createHash)("sha256").update(import_node_path3.default.resolve(cwd)).digest("hex").slice(0, 16);
1047
+ return (0, import_node_crypto.createHash)("sha256").update(import_node_path2.default.resolve(cwd)).digest("hex").slice(0, 16);
1815
1048
  }
1816
1049
  function newSessionId() {
1817
1050
  return `s_${(0, import_node_crypto.randomBytes)(10).toString("hex")}`;
1818
1051
  }
1819
1052
  function upsertProject(input) {
1820
- const cwd = import_node_path3.default.resolve(input.cwd);
1053
+ const cwd = import_node_path2.default.resolve(input.cwd);
1821
1054
  const id = projectIdForCwd(cwd);
1822
1055
  let result;
1823
1056
  mutateStore((store) => {
@@ -1843,7 +1076,7 @@ function upsertProject(input) {
1843
1076
  const now = Date.now();
1844
1077
  const created = {
1845
1078
  id,
1846
- name: input.name ?? import_node_path3.default.basename(cwd),
1079
+ name: input.name ?? import_node_path2.default.basename(cwd),
1847
1080
  cwd,
1848
1081
  repoRoot: input.repoRoot,
1849
1082
  sourceRoots: input.sourceRoots ?? [cwd],
@@ -1968,23 +1201,13 @@ function updateSessionStatus(id, patch) {
1968
1201
  async function seedFromDemoAppRegistry() {
1969
1202
  const existing = loadStore().attachedProjects;
1970
1203
  if (existing.length > 0) return;
1971
- let APPS2;
1972
- try {
1973
- const mod = await Promise.resolve().then(() => (init_demo_app_registry(), demo_app_registry_exports));
1974
- APPS2 = mod.APPS;
1975
- } catch (err) {
1976
- console.warn(
1977
- "[sootsim] seedFromDemoAppRegistry: could not load demo registry:",
1978
- err.message
1979
- );
1980
- return;
1981
- }
1982
- if (!Array.isArray(APPS2)) return;
1983
- const apps = APPS2;
1204
+ const { loadOptionalDemoApps: loadOptionalDemoApps2 } = await Promise.resolve().then(() => (init_optional_demo_registry(), optional_demo_registry_exports));
1205
+ const apps = await loadOptionalDemoApps2();
1206
+ if (apps.length === 0) return;
1984
1207
  mutateStore((store) => {
1985
1208
  for (const app of apps) {
1986
- if (!import_node_fs4.default.existsSync(app.dir)) continue;
1987
- const cwd = import_node_path3.default.resolve(app.dir);
1209
+ if (!import_node_fs3.default.existsSync(app.dir)) continue;
1210
+ const cwd = import_node_path2.default.resolve(app.dir);
1988
1211
  const id = projectIdForCwd(cwd);
1989
1212
  if (store.attachedProjects.some((p) => p.id === id)) continue;
1990
1213
  const now = Date.now();
@@ -2008,16 +1231,16 @@ async function seedFromDemoAppRegistry() {
2008
1231
 
2009
1232
  // src/agent-sessions.ts
2010
1233
  function sessionDir(sessionId) {
2011
- return import_node_path4.default.join(getUserDataDir(), "sessions", sessionId);
1234
+ return import_node_path3.default.join(getUserDataDir(), "sessions", sessionId);
2012
1235
  }
2013
1236
  function promptFifoPath(sessionId) {
2014
- return import_node_path4.default.join(sessionDir(sessionId), "prompt.in");
1237
+ return import_node_path3.default.join(sessionDir(sessionId), "prompt.in");
2015
1238
  }
2016
1239
  function eventsFifoPath(sessionId) {
2017
- return import_node_path4.default.join(sessionDir(sessionId), "events.out");
1240
+ return import_node_path3.default.join(sessionDir(sessionId), "events.out");
2018
1241
  }
2019
1242
  function transcriptPath(sessionId) {
2020
- return import_node_path4.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
1243
+ return import_node_path3.default.join(getUserDataDir(), "transcripts", `${sessionId}.log`);
2021
1244
  }
2022
1245
  function pidIsAlive(pid, sessionId) {
2023
1246
  if (!pid) return false;
@@ -2027,7 +1250,7 @@ function pidIsAlive(pid, sessionId) {
2027
1250
  return false;
2028
1251
  }
2029
1252
  if (sessionId) {
2030
- if (!import_node_fs5.default.existsSync(sessionDir(sessionId))) return false;
1253
+ if (!import_node_fs4.default.existsSync(sessionDir(sessionId))) return false;
2031
1254
  }
2032
1255
  return true;
2033
1256
  }
@@ -2039,11 +1262,11 @@ function resolveSootsimInvocation() {
2039
1262
  const resourcesPath = process.resourcesPath;
2040
1263
  if (resourcesPath) {
2041
1264
  const candidates = [
2042
- import_node_path4.default.join(resourcesPath, "bin", "sootsim"),
2043
- import_node_path4.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
1265
+ import_node_path3.default.join(resourcesPath, "bin", "sootsim"),
1266
+ import_node_path3.default.join(resourcesPath, "bin", `sootsim-${process.platform}-${process.arch}`)
2044
1267
  ];
2045
1268
  for (const c of candidates) {
2046
- if (import_node_fs5.default.existsSync(c)) return { cmd: c, prefixArgs: [] };
1269
+ if (import_node_fs4.default.existsSync(c)) return { cmd: c, prefixArgs: [] };
2047
1270
  }
2048
1271
  }
2049
1272
  }
@@ -2066,15 +1289,15 @@ function tryWorkspaceSootsim() {
2066
1289
  const sootsimDir = resolveSootsimPackageDir();
2067
1290
  if (!sootsimDir) return null;
2068
1291
  const binaryName = `sootsim-${process.platform}-${process.arch}`;
2069
- const distBinary = import_node_path4.default.join(sootsimDir, "dist-bin", binaryName);
2070
- if (import_node_fs5.default.existsSync(distBinary)) return { cmd: distBinary, prefixArgs: [] };
2071
- const distBin = import_node_path4.default.join(sootsimDir, "dist-cli", "bin.js");
2072
- if (import_node_fs5.default.existsSync(distBin)) {
1292
+ const distBinary = import_node_path3.default.join(sootsimDir, "dist-bin", binaryName);
1293
+ if (import_node_fs4.default.existsSync(distBinary)) return { cmd: distBinary, prefixArgs: [] };
1294
+ const distBin = import_node_path3.default.join(sootsimDir, "dist-cli", "bin.js");
1295
+ if (import_node_fs4.default.existsSync(distBin)) {
2073
1296
  try {
2074
- const src = import_node_path4.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
2075
- if (import_node_fs5.default.existsSync(src)) {
2076
- const srcMtime = import_node_fs5.default.statSync(src).mtimeMs;
2077
- const buildMtime = import_node_fs5.default.statSync(distBin).mtimeMs;
1297
+ const src = import_node_path3.default.join(sootsimDir, "cli", "commands", "agent-wrapper.ts");
1298
+ if (import_node_fs4.default.existsSync(src)) {
1299
+ const srcMtime = import_node_fs4.default.statSync(src).mtimeMs;
1300
+ const buildMtime = import_node_fs4.default.statSync(distBin).mtimeMs;
2078
1301
  if (buildMtime < srcMtime) {
2079
1302
  console.warn(
2080
1303
  `[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).`
@@ -2093,22 +1316,22 @@ function tryWorkspaceSootsim() {
2093
1316
  function resolveSootsimPackageDir() {
2094
1317
  try {
2095
1318
  const resolved = require.resolve("sootsim/package.json");
2096
- return import_node_path4.default.dirname(resolved);
1319
+ return import_node_path3.default.dirname(resolved);
2097
1320
  } catch {
2098
1321
  }
2099
1322
  const here = fileFromImportMeta();
2100
1323
  if (!here) return null;
2101
- let cur = import_node_path4.default.dirname(here);
1324
+ let cur = import_node_path3.default.dirname(here);
2102
1325
  for (let i = 0; i < 8; i++) {
2103
- const pkg = import_node_path4.default.join(cur, "package.json");
1326
+ const pkg = import_node_path3.default.join(cur, "package.json");
2104
1327
  try {
2105
- if (import_node_fs5.default.existsSync(pkg)) {
2106
- const parsed = JSON.parse(import_node_fs5.default.readFileSync(pkg, "utf8"));
1328
+ if (import_node_fs4.default.existsSync(pkg)) {
1329
+ const parsed = JSON.parse(import_node_fs4.default.readFileSync(pkg, "utf8"));
2107
1330
  if (parsed.name === "sootsim") return cur;
2108
1331
  }
2109
1332
  } catch {
2110
1333
  }
2111
- const parent = import_node_path4.default.dirname(cur);
1334
+ const parent = import_node_path3.default.dirname(cur);
2112
1335
  if (parent === cur) break;
2113
1336
  cur = parent;
2114
1337
  }
@@ -2124,28 +1347,28 @@ function fileFromImportMeta() {
2124
1347
  }
2125
1348
  }
2126
1349
  async function withStartLock(projectId, provider, fn) {
2127
- const lockDir = import_node_path4.default.join(getUserDataDir(), "locks");
2128
- import_node_fs5.default.mkdirSync(lockDir, { recursive: true });
1350
+ const lockDir = import_node_path3.default.join(getUserDataDir(), "locks");
1351
+ import_node_fs4.default.mkdirSync(lockDir, { recursive: true });
2129
1352
  try {
2130
- import_node_fs5.default.chmodSync(lockDir, 448);
1353
+ import_node_fs4.default.chmodSync(lockDir, 448);
2131
1354
  } catch {
2132
1355
  }
2133
- const lockPath = import_node_path4.default.join(lockDir, `start-${projectId}-${provider}.lock`);
1356
+ const lockPath = import_node_path3.default.join(lockDir, `start-${projectId}-${provider}.lock`);
2134
1357
  const deadline = Date.now() + 4e3;
2135
1358
  let fd = null;
2136
1359
  while (fd === null) {
2137
1360
  try {
2138
- fd = import_node_fs5.default.openSync(
1361
+ fd = import_node_fs4.default.openSync(
2139
1362
  lockPath,
2140
- import_node_fs5.constants.O_WRONLY | import_node_fs5.constants.O_CREAT | import_node_fs5.constants.O_EXCL,
1363
+ import_node_fs4.constants.O_WRONLY | import_node_fs4.constants.O_CREAT | import_node_fs4.constants.O_EXCL,
2141
1364
  384
2142
1365
  );
2143
1366
  } catch (err) {
2144
1367
  if (err.code !== "EEXIST") throw err;
2145
1368
  try {
2146
- const stale = Number(import_node_fs5.default.readFileSync(lockPath, "utf8").trim());
1369
+ const stale = Number(import_node_fs4.default.readFileSync(lockPath, "utf8").trim());
2147
1370
  if (stale && !isProcessAlive(stale)) {
2148
- import_node_fs5.default.unlinkSync(lockPath);
1371
+ import_node_fs4.default.unlinkSync(lockPath);
2149
1372
  continue;
2150
1373
  }
2151
1374
  } catch {
@@ -2159,15 +1382,15 @@ async function withStartLock(projectId, provider, fn) {
2159
1382
  }
2160
1383
  }
2161
1384
  try {
2162
- import_node_fs5.default.writeFileSync(fd, String(process.pid));
1385
+ import_node_fs4.default.writeFileSync(fd, String(process.pid));
2163
1386
  return await fn();
2164
1387
  } finally {
2165
1388
  try {
2166
- import_node_fs5.default.closeSync(fd);
1389
+ import_node_fs4.default.closeSync(fd);
2167
1390
  } catch {
2168
1391
  }
2169
1392
  try {
2170
- import_node_fs5.default.unlinkSync(lockPath);
1393
+ import_node_fs4.default.unlinkSync(lockPath);
2171
1394
  } catch {
2172
1395
  }
2173
1396
  }
@@ -2181,25 +1404,25 @@ function isProcessAlive(pid) {
2181
1404
  }
2182
1405
  }
2183
1406
  function mkfifoSync(p) {
2184
- const parent = import_node_path4.default.dirname(p);
2185
- import_node_fs5.default.mkdirSync(parent, { recursive: true });
1407
+ const parent = import_node_path3.default.dirname(p);
1408
+ import_node_fs4.default.mkdirSync(parent, { recursive: true });
2186
1409
  try {
2187
- import_node_fs5.default.chmodSync(parent, 448);
1410
+ import_node_fs4.default.chmodSync(parent, 448);
2188
1411
  } catch {
2189
1412
  }
2190
- if (import_node_fs5.default.existsSync(p)) {
1413
+ if (import_node_fs4.default.existsSync(p)) {
2191
1414
  try {
2192
- const stat = import_node_fs5.default.statSync(p);
1415
+ const stat = import_node_fs4.default.statSync(p);
2193
1416
  if (stat.isFIFO()) {
2194
1417
  try {
2195
- import_node_fs5.default.chmodSync(p, 384);
1418
+ import_node_fs4.default.chmodSync(p, 384);
2196
1419
  } catch {
2197
1420
  }
2198
1421
  return;
2199
1422
  }
2200
- import_node_fs5.default.unlinkSync(p);
1423
+ import_node_fs4.default.unlinkSync(p);
2201
1424
  } catch {
2202
- import_node_fs5.default.unlinkSync(p);
1425
+ import_node_fs4.default.unlinkSync(p);
2203
1426
  }
2204
1427
  }
2205
1428
  const result = (0, import_node_child_process.spawnSync)("mkfifo", ["-m", "600", p]);
@@ -2246,10 +1469,10 @@ async function startSession(opts) {
2246
1469
  const transcript = transcriptPath(session.id);
2247
1470
  mkfifoSync(promptIn);
2248
1471
  mkfifoSync(eventsOut);
2249
- const transcriptDir = import_node_path4.default.dirname(transcript);
2250
- import_node_fs5.default.mkdirSync(transcriptDir, { recursive: true });
1472
+ const transcriptDir = import_node_path3.default.dirname(transcript);
1473
+ import_node_fs4.default.mkdirSync(transcriptDir, { recursive: true });
2251
1474
  try {
2252
- import_node_fs5.default.chmodSync(transcriptDir, 448);
1475
+ import_node_fs4.default.chmodSync(transcriptDir, 448);
2253
1476
  } catch {
2254
1477
  }
2255
1478
  const { cmd, prefixArgs } = resolveSootsimInvocation();
@@ -2300,7 +1523,7 @@ async function startSession(opts) {
2300
1523
  }
2301
1524
  }
2302
1525
  try {
2303
- import_node_fs5.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
1526
+ import_node_fs4.default.rmSync(sessionDir(session.id), { recursive: true, force: true });
2304
1527
  } catch {
2305
1528
  }
2306
1529
  updateSessionStatus(session.id, { status: "ended" });
@@ -2328,18 +1551,18 @@ async function sendPrompt(sessionId, prompt) {
2328
1551
  );
2329
1552
  }
2330
1553
  const fifo = promptFifoPath(sessionId);
2331
- if (!import_node_fs5.default.existsSync(fifo)) {
1554
+ if (!import_node_fs4.default.existsSync(fifo)) {
2332
1555
  throw new AgentSessionError("NO_FIFO", `prompt FIFO missing: ${fifo}`);
2333
1556
  }
2334
- const fd = import_node_fs5.default.openSync(fifo, import_node_fs5.constants.O_WRONLY);
1557
+ const fd = import_node_fs4.default.openSync(fifo, import_node_fs4.constants.O_WRONLY);
2335
1558
  try {
2336
1559
  const wireText = encodeAgentPromptEnvelope(prompt);
2337
1560
  if (!wireText) {
2338
1561
  throw new AgentSessionError("EMPTY_PROMPT", "prompt text is empty");
2339
1562
  }
2340
- import_node_fs5.default.writeSync(fd, wireText + "\n");
1563
+ import_node_fs4.default.writeSync(fd, wireText + "\n");
2341
1564
  } finally {
2342
- import_node_fs5.default.closeSync(fd);
1565
+ import_node_fs4.default.closeSync(fd);
2343
1566
  }
2344
1567
  updateSessionStatus(sessionId, {
2345
1568
  lastPrompt: prompt.displayText ?? prompt.text,
@@ -2361,7 +1584,7 @@ async function endSession(sessionId) {
2361
1584
  const base = getUserDataDir();
2362
1585
  if (dir.startsWith(base)) {
2363
1586
  try {
2364
- import_node_fs5.default.rmSync(dir, { recursive: true, force: true });
1587
+ import_node_fs4.default.rmSync(dir, { recursive: true, force: true });
2365
1588
  } catch {
2366
1589
  }
2367
1590
  }
@@ -2369,11 +1592,11 @@ async function endSession(sessionId) {
2369
1592
  }
2370
1593
  function subscribeEvents(sessionId, onEvent) {
2371
1594
  const fifo = eventsFifoPath(sessionId);
2372
- if (!import_node_fs5.default.existsSync(fifo)) {
1595
+ if (!import_node_fs4.default.existsSync(fifo)) {
2373
1596
  throw new AgentSessionError("NO_FIFO", `events FIFO missing: ${fifo}`);
2374
1597
  }
2375
- const fd = import_node_fs5.default.openSync(fifo, import_node_fs5.constants.O_RDWR);
2376
- const stream = import_node_fs5.default.createReadStream("", { fd, autoClose: true });
1598
+ const fd = import_node_fs4.default.openSync(fifo, import_node_fs4.constants.O_RDWR);
1599
+ const stream = import_node_fs4.default.createReadStream("", { fd, autoClose: true });
2377
1600
  const rl = import_node_readline.default.createInterface({ input: stream, crlfDelay: Infinity });
2378
1601
  rl.on("line", (line) => {
2379
1602
  const event = parseAgentEventLine(line);
@@ -2394,7 +1617,7 @@ function subscribeEvents(sessionId, onEvent) {
2394
1617
  };
2395
1618
  }
2396
1619
  async function waitForFirstEvent(fifo, predicate, timeoutMs) {
2397
- const fd = import_node_fs5.default.openSync(fifo, import_node_fs5.constants.O_RDWR | import_node_fs5.constants.O_NONBLOCK);
1620
+ const fd = import_node_fs4.default.openSync(fifo, import_node_fs4.constants.O_RDWR | import_node_fs4.constants.O_NONBLOCK);
2398
1621
  const buf = Buffer.alloc(8192);
2399
1622
  let leftover = "";
2400
1623
  const deadline = Date.now() + timeoutMs;
@@ -2402,7 +1625,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
2402
1625
  while (Date.now() < deadline) {
2403
1626
  let n = 0;
2404
1627
  try {
2405
- n = import_node_fs5.default.readSync(fd, buf, 0, buf.length, null);
1628
+ n = import_node_fs4.default.readSync(fd, buf, 0, buf.length, null);
2406
1629
  } catch (err) {
2407
1630
  if (err.code !== "EAGAIN") throw err;
2408
1631
  n = 0;
@@ -2422,7 +1645,7 @@ async function waitForFirstEvent(fifo, predicate, timeoutMs) {
2422
1645
  }
2423
1646
  return null;
2424
1647
  } finally {
2425
- import_node_fs5.default.closeSync(fd);
1648
+ import_node_fs4.default.closeSync(fd);
2426
1649
  }
2427
1650
  }
2428
1651
 
@@ -2593,7 +1816,7 @@ var AgentHost = class {
2593
1816
  );
2594
1817
  const project = upsertProject({
2595
1818
  cwd: match.cwd,
2596
- name: match.projectName ?? import_node_path5.default.basename(match.cwd),
1819
+ name: match.projectName ?? import_node_path4.default.basename(match.cwd),
2597
1820
  preferredProvider: input.provider ?? existing?.preferredProvider,
2598
1821
  sourceRoots: existing?.sourceRoots ?? [match.cwd],
2599
1822
  knownBundleUrls,
@@ -2604,18 +1827,18 @@ var AgentHost = class {
2604
1827
  }
2605
1828
  getTranscript(sessionId) {
2606
1829
  const p = transcriptPath(sessionId);
2607
- if (!import_node_fs6.default.existsSync(p)) {
1830
+ if (!import_node_fs5.default.existsSync(p)) {
2608
1831
  return { error: "transcript not found", code: "NO_TRANSCRIPT" };
2609
1832
  }
2610
- return import_node_fs6.default.readFileSync(p, "utf8");
1833
+ return import_node_fs5.default.readFileSync(p, "utf8");
2611
1834
  }
2612
1835
  getPaths() {
2613
1836
  const dir = getUserDataDir();
2614
1837
  return {
2615
1838
  userDataDir: dir,
2616
- storeFile: import_node_path5.default.join(dir, "attached-projects.json"),
2617
- sessionsDir: import_node_path5.default.join(dir, "sessions"),
2618
- transcriptsDir: import_node_path5.default.join(dir, "transcripts")
1839
+ storeFile: import_node_path4.default.join(dir, "attached-projects.json"),
1840
+ sessionsDir: import_node_path4.default.join(dir, "sessions"),
1841
+ transcriptsDir: import_node_path4.default.join(dir, "transcripts")
2619
1842
  };
2620
1843
  }
2621
1844
  // --- subscription management ---
@@ -3262,7 +2485,7 @@ function buildChromiumUrlCommand(url, options = {}) {
3262
2485
  };
3263
2486
  }
3264
2487
  async function spawnLaunch(command, args, detached) {
3265
- return new Promise((resolve2, reject) => {
2488
+ return new Promise((resolve, reject) => {
3266
2489
  const child = (0, import_child_process3.spawn)(command, args, {
3267
2490
  detached,
3268
2491
  stdio: "ignore"
@@ -3270,7 +2493,7 @@ async function spawnLaunch(command, args, detached) {
3270
2493
  child.once("error", reject);
3271
2494
  child.once("spawn", () => {
3272
2495
  if (detached) child.unref();
3273
- resolve2(child.pid);
2496
+ resolve(child.pid);
3274
2497
  });
3275
2498
  });
3276
2499
  }
@@ -3652,7 +2875,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3652
2875
  );
3653
2876
  }
3654
2877
  bindOnce(port, _silent) {
3655
- return new Promise((resolve2, reject) => {
2878
+ return new Promise((resolve, reject) => {
3656
2879
  const server = (0, import_http3.createServer)((req, res) => this.handleHttpRequest(req, res));
3657
2880
  let settled = false;
3658
2881
  const onError = (err) => {
@@ -3684,7 +2907,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
3684
2907
  this.wss?.emit("connection", ws, req);
3685
2908
  });
3686
2909
  });
3687
- resolve2();
2910
+ resolve();
3688
2911
  });
3689
2912
  });
3690
2913
  }
@@ -4659,7 +3882,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4659
3882
  async sendCommand(cmd) {
4660
3883
  const sim = await this.waitForSim(cmd.simId);
4661
3884
  const id = this.nextCommandId++;
4662
- return new Promise((resolve2, reject) => {
3885
+ return new Promise((resolve, reject) => {
4663
3886
  const timeout = setTimeout(() => {
4664
3887
  this.pendingCommands.delete(id);
4665
3888
  this.broadcastSimClientStates();
@@ -4671,7 +3894,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4671
3894
  clearTimeout(timeout);
4672
3895
  this.pendingCommands.delete(id);
4673
3896
  this.broadcastSimClientStates();
4674
- resolve2(value);
3897
+ resolve(value);
4675
3898
  },
4676
3899
  reject: (error) => {
4677
3900
  clearTimeout(timeout);
@@ -4697,23 +3920,23 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4697
3920
  async openPathInEditor(filePath, line, column) {
4698
3921
  const loc = line != null ? `:${line}${column != null ? `:${column}` : ""}` : "";
4699
3922
  const target = `${filePath}${loc}`;
4700
- const trySpawn = (cmd, args) => new Promise((resolve2) => {
3923
+ const trySpawn = (cmd, args) => new Promise((resolve) => {
4701
3924
  try {
4702
3925
  const child = (0, import_child_process4.spawn)(cmd, args, { detached: true, stdio: "ignore" });
4703
3926
  let settled = false;
4704
3927
  child.on("error", () => {
4705
3928
  if (settled) return;
4706
3929
  settled = true;
4707
- resolve2(false);
3930
+ resolve(false);
4708
3931
  });
4709
3932
  child.on("spawn", () => {
4710
3933
  if (settled) return;
4711
3934
  settled = true;
4712
3935
  child.unref();
4713
- resolve2(true);
3936
+ resolve(true);
4714
3937
  });
4715
3938
  } catch {
4716
- resolve2(false);
3939
+ resolve(false);
4717
3940
  }
4718
3941
  });
4719
3942
  const envEditor = process.env.REACT_EDITOR || process.env.EDITOR;
@@ -4940,7 +4163,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
4940
4163
  for (let attempt = 0; attempt < attempts; attempt++) {
4941
4164
  const sim = this.getOpenSim(simId);
4942
4165
  if (sim) return sim;
4943
- await new Promise((resolve2) => setTimeout(resolve2, intervalMs));
4166
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
4944
4167
  }
4945
4168
  throw new Error(simId ? `no sim connected with id ${simId}` : "no sim connected");
4946
4169
  }