u-foo 4.0.5 → 4.0.10

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 (149) hide show
  1. package/README.md +224 -19
  2. package/README.zh-CN.md +3 -3
  3. package/bin/ucode.js +10 -2
  4. package/bin/ufoo.js +3 -0
  5. package/dist/tui/darwin-arm64/ufoo-tui +0 -0
  6. package/dist/tui/darwin-x64/ufoo-tui +0 -0
  7. package/dist/tui/linux-arm64/ufoo-tui +0 -0
  8. package/dist/tui/linux-x64/ufoo-tui +0 -0
  9. package/{OBSERVABILITY.md → docs/OBSERVABILITY.md} +3 -3
  10. package/docs/README.md +27 -0
  11. package/extensions/ufoo-browser/LICENSE +152 -0
  12. package/extensions/ufoo-browser/NOTICE +10 -0
  13. package/extensions/ufoo-browser/README.md +30 -0
  14. package/extensions/ufoo-browser/background.js +409 -0
  15. package/extensions/ufoo-browser/icons/icon-128.png +0 -0
  16. package/extensions/ufoo-browser/icons/icon-16.png +0 -0
  17. package/extensions/ufoo-browser/icons/icon-256.png +0 -0
  18. package/extensions/ufoo-browser/icons/icon-32.png +0 -0
  19. package/extensions/ufoo-browser/icons/icon-48.png +0 -0
  20. package/extensions/ufoo-browser/icons/logo.png +0 -0
  21. package/extensions/ufoo-browser/icons/toolbar-16.png +0 -0
  22. package/extensions/ufoo-browser/icons/toolbar-32.png +0 -0
  23. package/extensions/ufoo-browser/icons/toolbar-logo.png +0 -0
  24. package/extensions/ufoo-browser/manifest.json +30 -0
  25. package/extensions/ufoo-browser/popup.css +71 -0
  26. package/extensions/ufoo-browser/popup.html +44 -0
  27. package/extensions/ufoo-browser/popup.js +153 -0
  28. package/package.json +5 -3
  29. package/scripts/postinstall.js +6 -0
  30. package/src/agents/capabilities/browser/index.js +49 -0
  31. package/src/agents/capabilities/coding/backgroundHooks.js +94 -0
  32. package/src/agents/capabilities/coding/index.js +30 -1
  33. package/src/agents/capabilities/index.js +5 -2
  34. package/src/agents/capabilities/planning/index.js +44 -5
  35. package/src/agents/capabilities/turnRecall/index.js +341 -0
  36. package/src/agents/controller/controllerToolExecutor.js +2 -2
  37. package/src/agents/internal/internalRunner.js +30 -8
  38. package/src/agents/internal/taskControl.js +107 -0
  39. package/src/agents/profiles/coding.js +1 -1
  40. package/src/agents/profiles/main.js +1 -1
  41. package/src/agents/prompts/mainAgent.js +1 -0
  42. package/src/agents/prompts/native/toolDescriptions/bash.js +7 -1
  43. package/src/agents/providers/claudeSessionFiles.js +1 -1
  44. package/src/agents/providers/codexThreadProvider.js +6 -1
  45. package/src/agents/providers/credentials/agy.js +171 -0
  46. package/src/agents/providers/directAuthStatus.js +20 -2
  47. package/src/agents/providers/modelsCatalog.js +26 -5
  48. package/src/agents/providers/nativeTransport.js +36 -20
  49. package/src/agents/providers/providerId.js +17 -0
  50. package/src/agents/providers/runtimeConfig.js +26 -19
  51. package/src/agents/providers/transports/antigravityTransport.js +242 -0
  52. package/src/agents/providers/transports/index.js +1 -0
  53. package/src/agents/providers/transports/openaiChatTransport.js +3 -2
  54. package/src/agents/providers/transports/openaiResponsesTransport.js +2 -1
  55. package/src/agents/providers/transports/responsesProtocol.js +119 -18
  56. package/src/agents/providers/transports/transportContract.js +1 -0
  57. package/src/agents/providers/upstreamRuntime.js +3 -1
  58. package/src/agents/runtime/context/contextBudget.js +1 -19
  59. package/src/agents/runtime/context/contextWindow.js +5 -0
  60. package/src/agents/runtime/context/replayHistory.js +16 -10
  61. package/src/agents/runtime/context/runtimeStore.js +0 -2
  62. package/src/agents/runtime/context/sessionJournal.js +1 -1
  63. package/src/agents/runtime/context/slidingWindowManager.js +792 -0
  64. package/src/agents/runtime/context/topicSelector.js +338 -0
  65. package/src/agents/runtime/context/turnAnalyzer.js +767 -0
  66. package/src/agents/runtime/context/turnIndexStore.js +515 -0
  67. package/src/agents/runtime/core/agentLoop.js +95 -32
  68. package/src/agents/runtime/core/executionBudget.js +2 -1
  69. package/src/agents/runtime/core/toolErrorGuard.js +39 -0
  70. package/src/agents/runtime/createAgentRuntime.js +80 -7
  71. package/src/agents/runtime/index.js +5 -0
  72. package/src/agents/runtime/protocol/materialize.js +1 -1
  73. package/src/agents/runtime/tasks/hooks.js +137 -0
  74. package/src/app/chat/ChatController.js +8 -4
  75. package/src/app/chat/daemonMessageRouter.js +3 -1
  76. package/src/app/chat/inputSubmitHandler.js +2 -2
  77. package/src/app/chat/transport.js +1 -1
  78. package/src/app/cli/browserCommands.js +340 -0
  79. package/src/app/cli/features/doctor.js +21 -0
  80. package/src/app/cli/metricsCommands.js +1 -1
  81. package/src/app/cli/run.js +80 -1
  82. package/src/app/cli/setupCommands.js +200 -0
  83. package/src/code/UcodeController.js +31 -1
  84. package/src/code/agent.js +41 -7
  85. package/src/code/busConsumer.js +13 -12
  86. package/src/code/commands.js +0 -1
  87. package/src/code/context/assembler.js +11 -88
  88. package/src/code/context/planGraphService.js +83 -9
  89. package/src/code/context/planProjection.js +10 -2
  90. package/src/code/context/reducers.js +172 -4
  91. package/src/code/context/stateCommit.js +0 -32
  92. package/src/code/context/transcript.js +7 -4
  93. package/src/code/internalThread.js +9 -1
  94. package/src/code/launcher/ucode.js +4 -2
  95. package/src/code/nativeRunner.js +221 -10
  96. package/src/code/repl.js +27 -1
  97. package/src/code/runtime/agentWakeup.js +20 -3
  98. package/src/code/runtime/backgroundWakeHost.js +45 -0
  99. package/src/code/runtime/taskFocusContext.js +7 -0
  100. package/src/code/runtime/taskLoop.js +24 -1
  101. package/src/code/sessionStore.js +14 -10
  102. package/src/code/taskDecomposer.js +13 -7
  103. package/src/code/tools/backgroundProcess.js +23 -0
  104. package/src/code/tools/bash.js +764 -12
  105. package/src/code/tools/executor.js +12 -4
  106. package/src/code/tools/specs.js +60 -3
  107. package/src/code/tools/taskRun.js +38 -0
  108. package/src/config.js +92 -6
  109. package/src/coordination/bus/subscriber.js +1 -1
  110. package/src/coordination/history/agentPerformance.js +18 -18
  111. package/src/coordination/history/agentTrace.js +7 -3
  112. package/src/coordination/state/workspaceAccess.js +3 -1
  113. package/src/orchestration/groups/modelConfig.js +66 -0
  114. package/src/orchestration/groups/validateTemplate.js +2 -0
  115. package/src/runtime/browser/broker.js +1027 -0
  116. package/src/runtime/browser/brokerClient.js +108 -0
  117. package/src/runtime/browser/componentInstaller.js +275 -0
  118. package/src/runtime/browser/installState.js +329 -0
  119. package/src/runtime/browser/manifest.js +145 -0
  120. package/src/runtime/browser/native-host-runner.js +198 -0
  121. package/src/runtime/browser/nativeHost.js +213 -0
  122. package/src/runtime/browser/nativeMessagingProtocol.js +50 -0
  123. package/src/runtime/browser/paths.js +134 -0
  124. package/src/runtime/browser/playwrightSession.js +614 -0
  125. package/src/runtime/daemon/agentHost.js +175 -30
  126. package/src/runtime/daemon/busBridge.js +2 -1
  127. package/src/runtime/daemon/globalDaemon.js +20 -0
  128. package/src/runtime/daemon/groupOrchestrator.js +20 -1
  129. package/src/runtime/daemon/index.js +5 -4
  130. package/src/runtime/daemon/ops.js +14 -8
  131. package/src/tools/handlers/listAgents.js +1 -1
  132. package/src/tools/handlers/readBusSummary.js +1 -1
  133. package/src/tools/handlers/routeAgent.js +122 -5
  134. package/src/tools/schemaFixtures.js +1 -1
  135. package/src/ui/agentSurface.js +26 -3
  136. package/src/ui/format/index.js +34 -2
  137. package/src/ui/rustChatHost.js +22 -7
  138. package/src/ui/rustMultiSession.js +14 -2
  139. package/src/ui/rustUcodeHost.js +246 -77
  140. package/src/ui/ucodeAgentSession.js +88 -0
  141. package/templates/groups/build-lane.json +57 -3
  142. package/templates/groups/build-ultra.json +114 -6
  143. package/templates/groups/design-system.json +57 -3
  144. package/templates/groups/product-discovery.json +57 -3
  145. package/templates/groups/ui-plan-review.json +57 -3
  146. package/templates/groups/ui-polish.json +57 -3
  147. package/templates/groups/verify-ship.json +57 -3
  148. package/src/agents/runtime/context/checkpointStore.js +0 -52
  149. package/src/agents/runtime/context/compaction.js +0 -171
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const { resolveNodeExecutable } = require("../process/nodeExecutable");
6
+ const { writeFileAtomic } = require("../../coordination/bus/utils");
7
+ const {
8
+ nativeHostDir,
9
+ nativeHostLauncherPath,
10
+ nativeHostRunnerPath,
11
+ chromeNativeMessagingHostsDirs,
12
+ } = require("./paths");
13
+ const {
14
+ NATIVE_HOST_NAME,
15
+ DEV_NATIVE_HOST_NAME,
16
+ getReleaseManifest,
17
+ } = require("./manifest");
18
+ const { writeInstallState } = require("./installState");
19
+
20
+ const RUNNER_SOURCE_PATH = path.join(__dirname, "native-host-runner.js");
21
+
22
+ function shellEscapeSingle(value) {
23
+ return `'${String(value || "").replace(/'/g, "'\\''")}'`;
24
+ }
25
+
26
+ function buildLauncherScript(nodeExecutable, runnerPath) {
27
+ return [
28
+ "#!/bin/sh",
29
+ `exec ${shellEscapeSingle(nodeExecutable)} ${shellEscapeSingle(runnerPath)} "$@"`,
30
+ "",
31
+ ].join("\n");
32
+ }
33
+
34
+ function buildNativeHostManifest({ name, description, launcherPath, allowedOrigins }) {
35
+ return {
36
+ name,
37
+ description,
38
+ path: launcherPath,
39
+ type: "stdio",
40
+ allowed_origins: allowedOrigins,
41
+ };
42
+ }
43
+
44
+ /**
45
+ * Install the stable native-host launcher script and register Chrome NativeMessagingHosts manifests.
46
+ */
47
+ function registerNativeHost({
48
+ env = process.env,
49
+ platform = process.platform,
50
+ mode = "release",
51
+ nodeExecutable = resolveNodeExecutable(),
52
+ } = {}) {
53
+ const manifest = getReleaseManifest(env);
54
+ const hostDir = nativeHostDir(env);
55
+ const launcherPath = nativeHostLauncherPath(env);
56
+ const runnerPath = nativeHostRunnerPath(env);
57
+
58
+ fs.mkdirSync(hostDir, { recursive: true, mode: 0o700 });
59
+ fs.copyFileSync(RUNNER_SOURCE_PATH, runnerPath);
60
+ fs.chmodSync(runnerPath, 0o755);
61
+ writeFileAtomic(launcherPath, buildLauncherScript(nodeExecutable, runnerPath), { mode: 0o755 });
62
+ fs.chmodSync(launcherPath, 0o755);
63
+
64
+ const dirs = chromeNativeMessagingHostsDirs(env, platform);
65
+ const written = [];
66
+ let releaseRegistered = false;
67
+ let devRegistered = false;
68
+
69
+ for (const dir of dirs) {
70
+ fs.mkdirSync(dir, { recursive: true });
71
+ if (manifest.releaseExtensionId) {
72
+ const releaseManifestPath = path.join(dir, `${NATIVE_HOST_NAME}.json`);
73
+ const releasePayload = buildNativeHostManifest({
74
+ name: NATIVE_HOST_NAME,
75
+ description: "ufoo Browser Native Messaging Host",
76
+ launcherPath,
77
+ allowedOrigins: [`chrome-extension://${manifest.releaseExtensionId}/`],
78
+ });
79
+ writeFileAtomic(releaseManifestPath, JSON.stringify(releasePayload, null, 2), { mode: 0o644 });
80
+ written.push(releaseManifestPath);
81
+ releaseRegistered = true;
82
+ }
83
+ if (mode === "dev" || !manifest.releaseExtensionId) {
84
+ const devManifestPath = path.join(dir, `${DEV_NATIVE_HOST_NAME}.json`);
85
+ const devPayload = buildNativeHostManifest({
86
+ name: DEV_NATIVE_HOST_NAME,
87
+ description: "ufoo Browser Native Messaging Host (Developer Mode)",
88
+ launcherPath,
89
+ allowedOrigins: [`chrome-extension://${manifest.devExtensionId}/`],
90
+ });
91
+ writeFileAtomic(devManifestPath, JSON.stringify(devPayload, null, 2), { mode: 0o644 });
92
+ written.push(devManifestPath);
93
+ devRegistered = true;
94
+ }
95
+ }
96
+
97
+ writeInstallState({
98
+ nativeHostRegistered: releaseRegistered || devRegistered,
99
+ devHostRegistered: devRegistered,
100
+ }, env);
101
+
102
+ return {
103
+ ok: written.length > 0,
104
+ launcherPath,
105
+ runnerPath,
106
+ nodeExecutable,
107
+ written,
108
+ releaseRegistered,
109
+ devRegistered,
110
+ };
111
+ }
112
+
113
+ function parseLauncherNodePath(launcherPath) {
114
+ try {
115
+ const content = fs.readFileSync(launcherPath, "utf8");
116
+ const match = content.match(/^exec\s+'([^']+)'/m) || content.match(/^exec\s+"([^"]+)"/m);
117
+ return match ? match[1] : "";
118
+ } catch {
119
+ return "";
120
+ }
121
+ }
122
+
123
+ function checkNativeHostHealth({ env = process.env, platform = process.platform } = {}) {
124
+ const launcherPath = nativeHostLauncherPath(env);
125
+ const runnerPath = nativeHostRunnerPath(env);
126
+ const issues = [];
127
+ const launcherExists = fs.existsSync(launcherPath);
128
+ const runnerExists = fs.existsSync(runnerPath);
129
+ if (!launcherExists) issues.push("launcher_missing");
130
+ if (!runnerExists) issues.push("runner_missing");
131
+
132
+ const configuredNode = launcherExists ? parseLauncherNodePath(launcherPath) : "";
133
+ const nodeExists = Boolean(configuredNode && fs.existsSync(configuredNode));
134
+ if (launcherExists && !nodeExists) issues.push("node_executable_missing");
135
+
136
+ let launcherExecutable = false;
137
+ if (launcherExists) {
138
+ try {
139
+ const mode = fs.statSync(launcherPath).mode;
140
+ launcherExecutable = (mode & 0o111) !== 0;
141
+ if (!launcherExecutable) issues.push("launcher_not_executable");
142
+ } catch {
143
+ issues.push("launcher_unreadable");
144
+ }
145
+ }
146
+
147
+ const dirs = chromeNativeMessagingHostsDirs(env, platform);
148
+ const manifests = [];
149
+ for (const dir of dirs) {
150
+ for (const hostName of [NATIVE_HOST_NAME, DEV_NATIVE_HOST_NAME]) {
151
+ const file = path.join(dir, `${hostName}.json`);
152
+ if (!fs.existsSync(file)) continue;
153
+ try {
154
+ const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
155
+ const valid = parsed.path === launcherPath && Array.isArray(parsed.allowed_origins) && parsed.allowed_origins.length > 0;
156
+ manifests.push({ file, hostName, valid, allowedOrigins: parsed.allowed_origins || [] });
157
+ if (!valid) issues.push(`manifest_stale:${file}`);
158
+ } catch {
159
+ manifests.push({ file, hostName, valid: false });
160
+ issues.push(`manifest_corrupt:${file}`);
161
+ }
162
+ }
163
+ }
164
+ if (manifests.length === 0) issues.push("no_native_host_manifest");
165
+
166
+ return {
167
+ ok: issues.length === 0,
168
+ issues,
169
+ launcherPath,
170
+ runnerPath,
171
+ configuredNode,
172
+ nodeExists,
173
+ launcherExecutable,
174
+ manifests,
175
+ };
176
+ }
177
+
178
+ function repairNativeHost({ env = process.env, platform = process.platform, mode = "release" } = {}) {
179
+ return registerNativeHost({
180
+ env,
181
+ platform,
182
+ mode,
183
+ nodeExecutable: resolveNodeExecutable(),
184
+ });
185
+ }
186
+
187
+ function unregisterNativeHost({ env = process.env, platform = process.platform } = {}) {
188
+ const dirs = chromeNativeMessagingHostsDirs(env, platform);
189
+ const removed = [];
190
+ for (const dir of dirs) {
191
+ for (const hostName of [NATIVE_HOST_NAME, DEV_NATIVE_HOST_NAME]) {
192
+ const file = path.join(dir, `${hostName}.json`);
193
+ if (fs.existsSync(file)) {
194
+ fs.rmSync(file, { force: true });
195
+ removed.push(file);
196
+ }
197
+ }
198
+ }
199
+ const hostDir = nativeHostDir(env);
200
+ if (fs.existsSync(hostDir)) {
201
+ fs.rmSync(hostDir, { recursive: true, force: true });
202
+ }
203
+ return { removed };
204
+ }
205
+
206
+ module.exports = {
207
+ buildLauncherScript,
208
+ registerNativeHost,
209
+ checkNativeHostHealth,
210
+ repairNativeHost,
211
+ unregisterNativeHost,
212
+ parseLauncherNodePath,
213
+ };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ const MAX_NATIVE_MESSAGE_BYTES = 1024 * 1024;
4
+
5
+ /**
6
+ * Encode a JSON-serializable object into Chrome Native Messaging 4-byte LE framed buffer.
7
+ */
8
+ function encodeNativeMessage(payload) {
9
+ const json = Buffer.from(JSON.stringify(payload), "utf8");
10
+ if (json.length > MAX_NATIVE_MESSAGE_BYTES) {
11
+ throw new Error(`Native messaging payload exceeds ${MAX_NATIVE_MESSAGE_BYTES} bytes`);
12
+ }
13
+ const header = Buffer.allocUnsafe(4);
14
+ header.writeUInt32LE(json.length, 0);
15
+ return Buffer.concat([header, json]);
16
+ }
17
+
18
+ /**
19
+ * Create a streaming decoder for Chrome Native Messaging stdin chunks.
20
+ */
21
+ function createNativeMessageReader(onMessage, onError = () => {}) {
22
+ let buffer = Buffer.alloc(0);
23
+
24
+ return function push(chunk) {
25
+ if (!chunk || !chunk.length) return;
26
+ buffer = Buffer.concat([buffer, chunk]);
27
+ while (buffer.length >= 4) {
28
+ const length = buffer.readUInt32LE(0);
29
+ if (length === 0 || length > MAX_NATIVE_MESSAGE_BYTES) {
30
+ buffer = Buffer.alloc(0);
31
+ onError(new Error(`Invalid native message length: ${length}`));
32
+ return;
33
+ }
34
+ if (buffer.length < 4 + length) return;
35
+ const body = buffer.slice(4, 4 + length).toString("utf8");
36
+ buffer = buffer.slice(4 + length);
37
+ try {
38
+ onMessage(JSON.parse(body));
39
+ } catch (error) {
40
+ onError(error);
41
+ }
42
+ }
43
+ };
44
+ }
45
+
46
+ module.exports = {
47
+ MAX_NATIVE_MESSAGE_BYTES,
48
+ encodeNativeMessage,
49
+ createNativeMessageReader,
50
+ };
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ const crypto = require("crypto");
4
+ const os = require("os");
5
+ const path = require("path");
6
+
7
+ /**
8
+ * Resolve the user-scoped optional browser home directory (`~/.ufoo/browser/`).
9
+ * Respects `UFOO_BROWSER_HOME` for isolated test environments.
10
+ */
11
+ function browserHomeDir(env = process.env) {
12
+ const override = String(env.UFOO_BROWSER_HOME || "").trim();
13
+ if (override) return path.resolve(override);
14
+ return path.join(os.homedir(), ".ufoo", "browser");
15
+ }
16
+
17
+ function installStatePath(env = process.env) {
18
+ return path.join(browserHomeDir(env), "install.json");
19
+ }
20
+
21
+ function activeRuntimePath(env = process.env) {
22
+ return path.join(browserHomeDir(env), "active.json");
23
+ }
24
+
25
+ function runtimeVersionsDir(env = process.env) {
26
+ return path.join(browserHomeDir(env), "runtime");
27
+ }
28
+
29
+ function nativeHostDir(env = process.env) {
30
+ return path.join(browserHomeDir(env), "native-host");
31
+ }
32
+
33
+ function nativeHostLauncherPath(env = process.env) {
34
+ return path.join(nativeHostDir(env), "ufoo-browser-host");
35
+ }
36
+
37
+ function nativeHostRunnerPath(env = process.env) {
38
+ return path.join(nativeHostDir(env), "native-host-runner.js");
39
+ }
40
+
41
+ function privateDir(env = process.env) {
42
+ return path.join(browserHomeDir(env), "private");
43
+ }
44
+
45
+ function brokerSocketPath(env = process.env) {
46
+ const candidate = path.join(privateDir(env), "broker.sock");
47
+ if (Buffer.byteLength(candidate) <= 96) return candidate;
48
+ const tag = crypto.createHash("sha256").update(privateDir(env)).digest("hex").slice(0, 16);
49
+ return path.join("/tmp", `ufoo-bb-${tag}.sock`);
50
+ }
51
+
52
+ function brokerLockPath(env = process.env) {
53
+ return path.join(privateDir(env), "broker.lock");
54
+ }
55
+
56
+ function brokerInfoPath(env = process.env) {
57
+ return path.join(privateDir(env), "broker.json");
58
+ }
59
+
60
+ function runtimeLeasesDir(env = process.env) {
61
+ return path.join(privateDir(env), "leases");
62
+ }
63
+
64
+ function setupLockPath(env = process.env) {
65
+ return path.join(browserHomeDir(env), "setup.lock");
66
+ }
67
+
68
+ /**
69
+ * Return Chrome NativeMessagingHosts directories for the current platform.
70
+ * Override with `UFOO_BROWSER_NATIVE_HOST_DIRS` (path.delimiter separated) in tests.
71
+ */
72
+ function chromeNativeMessagingHostsDirs(env = process.env, platform = process.platform) {
73
+ const override = String(env.UFOO_BROWSER_NATIVE_HOST_DIRS || "").trim();
74
+ if (override) {
75
+ return override.split(path.delimiter).map((item) => item.trim()).filter(Boolean);
76
+ }
77
+ const home = os.homedir();
78
+ if (platform === "darwin") {
79
+ return [
80
+ path.join(home, "Library", "Application Support", "Google", "Chrome", "NativeMessagingHosts"),
81
+ path.join(home, "Library", "Application Support", "Google", "Chrome Beta", "NativeMessagingHosts"),
82
+ path.join(home, "Library", "Application Support", "Google", "Chrome Canary", "NativeMessagingHosts"),
83
+ path.join(home, "Library", "Application Support", "Chromium", "NativeMessagingHosts"),
84
+ ];
85
+ }
86
+ if (platform === "linux") {
87
+ return [
88
+ path.join(home, ".config", "google-chrome", "NativeMessagingHosts"),
89
+ path.join(home, ".config", "chromium", "NativeMessagingHosts"),
90
+ ];
91
+ }
92
+ return [];
93
+ }
94
+
95
+ /**
96
+ * Return candidate Chrome User Data directories for read-only profile/extension checks.
97
+ */
98
+ function chromeUserDataDirs(env = process.env, platform = process.env) {
99
+ const override = String(env.UFOO_BROWSER_CHROME_USER_DATA_DIR || "").trim();
100
+ if (override) return [path.resolve(override)];
101
+ const home = os.homedir();
102
+ if (platform === "darwin") {
103
+ return [
104
+ path.join(home, "Library", "Application Support", "Google", "Chrome"),
105
+ path.join(home, "Library", "Application Support", "Google", "Chrome Beta"),
106
+ path.join(home, "Library", "Application Support", "Google", "Chrome Canary"),
107
+ ];
108
+ }
109
+ if (platform === "linux") {
110
+ return [
111
+ path.join(home, ".config", "google-chrome"),
112
+ path.join(home, ".config", "chromium"),
113
+ ];
114
+ }
115
+ return [];
116
+ }
117
+
118
+ module.exports = {
119
+ browserHomeDir,
120
+ installStatePath,
121
+ activeRuntimePath,
122
+ runtimeVersionsDir,
123
+ nativeHostDir,
124
+ nativeHostLauncherPath,
125
+ nativeHostRunnerPath,
126
+ privateDir,
127
+ brokerSocketPath,
128
+ brokerLockPath,
129
+ brokerInfoPath,
130
+ runtimeLeasesDir,
131
+ setupLockPath,
132
+ chromeNativeMessagingHostsDirs,
133
+ chromeUserDataDirs,
134
+ };