shellpuppet 0.1.0 → 0.2.0
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.
- package/README.md +191 -32
- package/dist/cli/desktopShortcut.d.ts +22 -0
- package/dist/cli/desktopShortcut.js +157 -0
- package/dist/cli/desktopShortcut.js.map +1 -0
- package/dist/cli/index.js +205 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/client/http.d.ts +62 -1
- package/dist/client/http.js +388 -32
- package/dist/client/http.js.map +1 -1
- package/dist/core/dialogs.d.ts +20 -12
- package/dist/core/dialogs.js +31 -19
- package/dist/core/dialogs.js.map +1 -1
- package/dist/core/manager.d.ts +35 -5
- package/dist/core/manager.js +121 -8
- package/dist/core/manager.js.map +1 -1
- package/dist/core/nativePty.d.ts +9 -5
- package/dist/core/nativePty.js +11 -6
- package/dist/core/nativePty.js.map +1 -1
- package/dist/core/promptDetector.d.ts +37 -3
- package/dist/core/promptDetector.js +303 -12
- package/dist/core/promptDetector.js.map +1 -1
- package/dist/core/reasoning.d.ts +19 -6
- package/dist/core/reasoning.js +223 -30
- package/dist/core/reasoning.js.map +1 -1
- package/dist/core/regexBudget.d.ts +20 -0
- package/dist/core/regexBudget.js +25 -1
- package/dist/core/regexBudget.js.map +1 -1
- package/dist/core/renderer.d.ts +16 -1
- package/dist/core/renderer.js +97 -6
- package/dist/core/renderer.js.map +1 -1
- package/dist/core/selection.d.ts +6 -0
- package/dist/core/selection.js +48 -0
- package/dist/core/selection.js.map +1 -0
- package/dist/core/session.d.ts +266 -12
- package/dist/core/session.js +583 -99
- package/dist/core/session.js.map +1 -1
- package/dist/core/types.d.ts +53 -18
- package/dist/core/types.js +30 -6
- package/dist/core/types.js.map +1 -1
- package/dist/core/waiter.d.ts +12 -4
- package/dist/core/waiter.js +63 -70
- package/dist/core/waiter.js.map +1 -1
- package/dist/core/windowsConsoleHost.d.ts +147 -0
- package/dist/core/windowsConsoleHost.js +588 -0
- package/dist/core/windowsConsoleHost.js.map +1 -0
- package/dist/core/windowsPtyStart.d.ts +100 -29
- package/dist/core/windowsPtyStart.js +143 -36
- package/dist/core/windowsPtyStart.js.map +1 -1
- package/dist/daemon/auth.d.ts +72 -2
- package/dist/daemon/auth.js +128 -3
- package/dist/daemon/auth.js.map +1 -1
- package/dist/daemon/config.d.ts +44 -1
- package/dist/daemon/config.js +276 -9
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/folderPicker.d.ts +27 -0
- package/dist/daemon/folderPicker.js +115 -0
- package/dist/daemon/folderPicker.js.map +1 -0
- package/dist/daemon/index.js +20 -19
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/launchProfiles.d.ts +155 -0
- package/dist/daemon/launchProfiles.js +554 -0
- package/dist/daemon/launchProfiles.js.map +1 -0
- package/dist/daemon/paths.d.ts +2 -0
- package/dist/daemon/paths.js.map +1 -1
- package/dist/daemon/screenshot.d.ts +58 -1
- package/dist/daemon/screenshot.js +172 -26
- package/dist/daemon/screenshot.js.map +1 -1
- package/dist/daemon/server.d.ts +219 -10
- package/dist/daemon/server.js +1970 -203
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/sessionFeed.d.ts +48 -0
- package/dist/daemon/sessionFeed.js +101 -0
- package/dist/daemon/sessionFeed.js.map +1 -0
- package/dist/daemon/viewerLauncher.d.ts +100 -9
- package/dist/daemon/viewerLauncher.js +349 -67
- package/dist/daemon/viewerLauncher.js.map +1 -1
- package/dist/mcp/config.d.ts +7 -14
- package/dist/mcp/config.js +10 -21
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/index.js +20 -11
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools.d.ts +14 -7
- package/dist/mcp/tools.js +161 -60
- package/dist/mcp/tools.js.map +1 -1
- package/dist/viewer/dashboard-folders.js +20 -0
- package/dist/viewer/dashboard-layout.js +52 -0
- package/dist/viewer/dashboard.css +67 -0
- package/dist/viewer/dashboard.html +44 -0
- package/dist/viewer/dashboard.js +1518 -0
- package/dist/viewer/icon.ico +0 -0
- package/dist/viewer/index.html +12 -7
- package/dist/viewer/pane.js +736 -0
- package/dist/viewer/viewer.css +18 -7
- package/dist/viewer/viewer.js +47 -624
- package/package.json +13 -13
|
@@ -20,9 +20,14 @@
|
|
|
20
20
|
* So: detect an installed Chromium-family browser, and degrade gracefully when
|
|
21
21
|
* there is none. `chrome-launcher` (Apache-2.0, ~140 KB) does the fiddly
|
|
22
22
|
* cross-platform detection, which is exactly the part that would otherwise
|
|
23
|
-
* be machine-specific guesswork:
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* be machine-specific guesswork: the install folders on Windows,
|
|
24
|
+
* LaunchServices on macOS, `.desktop` files and PATH on Linux. On macOS and
|
|
25
|
+
* Linux the part of that search which shells out runs in a child process,
|
|
26
|
+
* never in the daemon (`detectBrowser`); on Windows the paths checked by
|
|
27
|
+
* file access are the whole search, so the child is not run. A lookup that
|
|
28
|
+
* times out, crashes or returns something other than a JSON list is logged
|
|
29
|
+
* once. We spawn the browser ourselves, because the detachment discipline
|
|
30
|
+
* below is not negotiable.
|
|
26
31
|
*
|
|
27
32
|
* Nothing here may ever fail a session start. A browser that will not launch is
|
|
28
33
|
* an inconvenience: the launcher reports that nothing opened, the daemon hands
|
|
@@ -31,9 +36,16 @@
|
|
|
31
36
|
* window opened: a spawn settles on the child's `spawn` or `error` event, and
|
|
32
37
|
* the system's opener (`start`, `open`, `xdg-open`) on its exit code.
|
|
33
38
|
*/
|
|
34
|
-
import { spawn } from 'node:child_process';
|
|
39
|
+
import { execFile, spawn } from 'node:child_process';
|
|
35
40
|
import * as fs from 'node:fs';
|
|
41
|
+
import { createRequire } from 'node:module';
|
|
36
42
|
import * as path from 'node:path';
|
|
43
|
+
import { pathToFileURL } from 'node:url';
|
|
44
|
+
import { NULL_LOGGER } from '../core/types.js';
|
|
45
|
+
/** A stalled filesystem check cannot hold browser detection indefinitely. */
|
|
46
|
+
const BROWSER_ACCESS_TIMEOUT_MS = 1_500;
|
|
47
|
+
/** Bound the wait for Node's spawn or error event, including dashboard launches. */
|
|
48
|
+
const BROWSER_SPAWN_TIMEOUT_MS = 3_000;
|
|
37
49
|
/**
|
|
38
50
|
* Chromium-family browsers that `chrome-launcher` does NOT look for, checked
|
|
39
51
|
* after it. Edge earns its place: it ships with Windows, so including it means
|
|
@@ -68,26 +80,82 @@ export function extraBrowserCandidates() {
|
|
|
68
80
|
];
|
|
69
81
|
}
|
|
70
82
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
83
|
+
* The Chrome installations `chrome-launcher` checks by file access alone,
|
|
84
|
+
* before any lookup that shells out, in the order it ranks them: the
|
|
85
|
+
* `CHROME_PATH` and `LIGHTHOUSE_CHROMIUM_PATH` overrides first everywhere; on
|
|
86
|
+
* Windows its whole search, which is these paths and nothing else; on macOS
|
|
87
|
+
* the two `/Applications` bundles its own `getFirstInstallation()` checks
|
|
88
|
+
* before its LaunchServices query, which rank above anything that query
|
|
89
|
+
* finds. Linux has only the overrides here: its lookup reads `.desktop` files
|
|
90
|
+
* and PATH, which a fixed list cannot match.
|
|
74
91
|
*/
|
|
75
|
-
export
|
|
92
|
+
export function wellKnownChromePaths(platform = process.platform, env = process.env) {
|
|
93
|
+
const overrides = [env['CHROME_PATH'], env['LIGHTHOUSE_CHROMIUM_PATH']].filter((value) => typeof value === 'string' && value !== '');
|
|
94
|
+
if (platform === 'win32') {
|
|
95
|
+
const roots = [env['LOCALAPPDATA'], env['PROGRAMFILES'], env['PROGRAMFILES(X86)']].filter((value) => typeof value === 'string' && value !== '');
|
|
96
|
+
const relative = [
|
|
97
|
+
path.join('Google', 'Chrome SxS', 'Application', 'chrome.exe'),
|
|
98
|
+
path.join('Google', 'Chrome', 'Application', 'chrome.exe'),
|
|
99
|
+
];
|
|
100
|
+
return [...overrides, ...roots.flatMap((root) => relative.map((rel) => path.join(root, rel)))];
|
|
101
|
+
}
|
|
102
|
+
if (platform === 'darwin') {
|
|
103
|
+
return [
|
|
104
|
+
...overrides,
|
|
105
|
+
'/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
|
|
106
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
return overrides;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* How long chrome-launcher's full lookup may take. Its macOS query took 5.7 s
|
|
113
|
+
* and 9.7 s on macOS CI runners, so this leaves room for a slower machine.
|
|
114
|
+
*/
|
|
115
|
+
export const BROWSER_LOOKUP_TIMEOUT_MS = 30_000;
|
|
116
|
+
const nodeRequire = createRequire(import.meta.url);
|
|
117
|
+
/** The detection the daemon runs: chrome-launcher's, then the supplementary list. */
|
|
118
|
+
export function defaultBrowserDetection() {
|
|
119
|
+
let lookupModule = '';
|
|
120
|
+
// On Windows, `wellKnownChromePaths` is chrome-launcher's entire search,
|
|
121
|
+
// so a child lookup cannot find a browser that list missed. macOS and
|
|
122
|
+
// Linux search beyond a fixed list, and that lookup runs in a child.
|
|
123
|
+
if (process.platform !== 'win32') {
|
|
124
|
+
try {
|
|
125
|
+
lookupModule = pathToFileURL(nodeRequire.resolve('chrome-launcher')).href;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Not installed: the well-known and supplementary paths still apply.
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
wellKnown: wellKnownChromePaths(),
|
|
133
|
+
lookupModule,
|
|
134
|
+
lookupTimeoutMs: BROWSER_LOOKUP_TIMEOUT_MS,
|
|
135
|
+
extra: extraBrowserCandidates(),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Find a Chromium-family browser, or null. Detection can never stop the
|
|
140
|
+
* daemon from serving: nothing here throws, and no part of it holds the
|
|
141
|
+
* daemon's event loop (see `detectBrowser`).
|
|
142
|
+
*/
|
|
143
|
+
export async function findBrowser(explicitPath, logger = NULL_LOGGER) {
|
|
76
144
|
if (explicitPath !== undefined && explicitPath !== '') {
|
|
77
145
|
// Never cached: an operator who names a binary means that binary, and the
|
|
78
|
-
// answer is a single
|
|
79
|
-
return
|
|
146
|
+
// answer is a single file check anyway.
|
|
147
|
+
return (await exists(explicitPath)) ? explicitPath : null;
|
|
80
148
|
}
|
|
81
149
|
// Detection is memoised for the daemon's lifetime because it is NOT cheap:
|
|
82
|
-
// chrome-launcher's macOS
|
|
83
|
-
// on macOS CI runners. A session start waits for the launch, so the
|
|
84
|
-
// looks once as it starts (server.ts) and every start after that
|
|
85
|
-
// answer ready; it changes only when someone installs a browser.
|
|
86
|
-
// restart re-detects.
|
|
150
|
+
// chrome-launcher's macOS lookup (a LaunchServices query) took 5.7 s and
|
|
151
|
+
// 9.7 s on macOS CI runners. A session start waits for the launch, so the
|
|
152
|
+
// daemon looks once as it starts (server.ts) and every start after that
|
|
153
|
+
// finds the answer ready; it changes only when someone installs a browser.
|
|
154
|
+
// A daemon restart re-detects.
|
|
87
155
|
// The promise is memoised, not the value, so a caller that arrives while
|
|
88
156
|
// detection is still running waits for the rest of it instead of starting
|
|
89
157
|
// a second detection of its own.
|
|
90
|
-
cachedDetection ??= detectBrowser();
|
|
158
|
+
cachedDetection ??= detectBrowser(defaultBrowserDetection(), logger);
|
|
91
159
|
return cachedDetection;
|
|
92
160
|
}
|
|
93
161
|
/** Memoised detection; `undefined` means "not looked yet". */
|
|
@@ -96,72 +164,282 @@ let cachedDetection;
|
|
|
96
164
|
export function resetBrowserCache() {
|
|
97
165
|
cachedDetection = undefined;
|
|
98
166
|
}
|
|
99
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Detect a browser without holding the daemon's event loop. chrome-launcher's
|
|
169
|
+
* lookup is synchronous and shells out on macOS (`lsregister -dump`, seconds)
|
|
170
|
+
* and Linux (`grep` over `.desktop` files, `which`). Run in the daemon, it
|
|
171
|
+
* would stop `/health` and every other request being answered while it ran,
|
|
172
|
+
* on macOS for long enough that a client gives up on a daemon it has just
|
|
173
|
+
* started. So the paths chrome-launcher itself checks first are tried with
|
|
174
|
+
* asynchronous file checks; only when none exists does its full lookup run,
|
|
175
|
+
* in a child process; and the supplementary list is checked last. On Windows
|
|
176
|
+
* the default detection leaves that lookup empty, because the well-known
|
|
177
|
+
* paths are the whole search. The answer is the one chrome-launcher's own
|
|
178
|
+
* ranking gives, then the first supplementary browser present. A lookup that
|
|
179
|
+
* times out, crashes or prints something other than a JSON list is logged
|
|
180
|
+
* once, through `logger`.
|
|
181
|
+
*/
|
|
182
|
+
export async function detectBrowser(detection = defaultBrowserDetection(), logger = NULL_LOGGER) {
|
|
183
|
+
const known = await firstExisting(detection.wellKnown);
|
|
184
|
+
if (known !== null)
|
|
185
|
+
return known;
|
|
186
|
+
if (detection.lookupModule !== '') {
|
|
187
|
+
const found = await lookUpInChild(detection.lookupModule, detection.lookupTimeoutMs, logger);
|
|
188
|
+
if (found !== null)
|
|
189
|
+
return found;
|
|
190
|
+
}
|
|
191
|
+
return firstExisting(detection.extra);
|
|
192
|
+
}
|
|
193
|
+
async function exists(file) {
|
|
194
|
+
let timer;
|
|
100
195
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
196
|
+
return await Promise.race([
|
|
197
|
+
fs.promises.access(file).then(() => true, () => false),
|
|
198
|
+
new Promise((resolve) => {
|
|
199
|
+
timer = setTimeout(() => resolve(false), BROWSER_ACCESS_TIMEOUT_MS);
|
|
200
|
+
}),
|
|
201
|
+
]);
|
|
105
202
|
}
|
|
106
203
|
catch {
|
|
107
|
-
|
|
108
|
-
// supplementary list rather than giving up.
|
|
204
|
+
return false;
|
|
109
205
|
}
|
|
110
|
-
|
|
111
|
-
if (
|
|
206
|
+
finally {
|
|
207
|
+
if (timer !== undefined)
|
|
208
|
+
clearTimeout(timer);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function firstExisting(candidates) {
|
|
212
|
+
for (const candidate of candidates) {
|
|
213
|
+
if (await exists(candidate))
|
|
112
214
|
return candidate;
|
|
113
215
|
}
|
|
114
216
|
return null;
|
|
115
217
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
218
|
+
/**
|
|
219
|
+
* What the child process runs: import the module named by its one argument,
|
|
220
|
+
* an absolute file URL, so nothing depends on the child's working directory,
|
|
221
|
+
* and print what `getInstallations()` returns as JSON. A lookup that throws
|
|
222
|
+
* (chrome-launcher's does on Linux when it finds nothing) prints an empty list.
|
|
223
|
+
*/
|
|
224
|
+
const LOOKUP_SCRIPT = [
|
|
225
|
+
'let found = [];',
|
|
226
|
+
'try {',
|
|
227
|
+
' const { Launcher } = await import(process.argv[1]);',
|
|
228
|
+
' found = Launcher.getInstallations();',
|
|
229
|
+
'} catch {',
|
|
230
|
+
' found = [];',
|
|
231
|
+
'}',
|
|
232
|
+
'process.stdout.write(JSON.stringify(found));',
|
|
233
|
+
].join('\n');
|
|
234
|
+
function lookUpInChild(moduleUrl, timeoutMs, logger) {
|
|
235
|
+
const fail = (reason, resolve) => {
|
|
236
|
+
logger.warn('browser lookup failed', { reason });
|
|
237
|
+
resolve(null);
|
|
238
|
+
};
|
|
239
|
+
return new Promise((resolve) => {
|
|
131
240
|
try {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
241
|
+
execFile(process.execPath, ['--input-type=module', '-e', LOOKUP_SCRIPT, moduleUrl], { timeout: timeoutMs, windowsHide: true, encoding: 'utf8', maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
242
|
+
if (error !== null) {
|
|
243
|
+
fail(error.message, resolve);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const parsed = JSON.parse(stdout);
|
|
248
|
+
if (!Array.isArray(parsed)) {
|
|
249
|
+
fail('unreadable output', resolve);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const first = parsed[0];
|
|
253
|
+
// An empty list is a lookup that found nothing, not a failure.
|
|
254
|
+
resolve(typeof first === 'string' && first !== '' ? first : null);
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
fail('unreadable output', resolve);
|
|
258
|
+
}
|
|
138
259
|
});
|
|
139
|
-
return openInDefaultBrowser(url, logger, 'isolated-app', deps, 'profile directory unavailable');
|
|
140
260
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// the same profile hands the URL over and exits at once, with code 0, and
|
|
144
|
-
// the window is in the other process.
|
|
145
|
-
const outcome = await spawnDetached(browser, [
|
|
146
|
-
`--app=${url}`,
|
|
147
|
-
`--user-data-dir=${profileDir}`,
|
|
148
|
-
'--new-window',
|
|
149
|
-
// First-run flows would hijack the window with a sign-in wizard; the
|
|
150
|
-
// default-browser prompt would ask to change a setting the user never
|
|
151
|
-
// asked to change from a window they did not open.
|
|
152
|
-
'--no-first-run',
|
|
153
|
-
'--no-default-browser-check',
|
|
154
|
-
]);
|
|
155
|
-
if (outcome.spawned) {
|
|
156
|
-
logger.info('viewer window opened', { browser, profileDir });
|
|
157
|
-
return { launched: true, mode, browser };
|
|
261
|
+
catch (error) {
|
|
262
|
+
fail(error instanceof Error ? error.message : 'lookup failed', resolve);
|
|
158
263
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Open `url` in a chromeless window backed by its own browser profile.
|
|
268
|
+
*
|
|
269
|
+
* `--app=` removes the address bar, tabs and navigation. A terminal viewer has
|
|
270
|
+
* no use for them, and the address bar is where the viewer grant would
|
|
271
|
+
* otherwise be on display. `--user-data-dir` is the isolation: its own cookie
|
|
272
|
+
* jar, storage and history, invisible to the user's normal browsing and vice
|
|
273
|
+
* versa.
|
|
274
|
+
*
|
|
275
|
+
* The profile directory is per-daemon rather than per-session, so window
|
|
276
|
+
* position and the text-size preference persist across sessions. A per-session
|
|
277
|
+
* profile would isolate marginally harder at the cost of a cold browser start
|
|
278
|
+
* every time, which is the wrong trade for a window a human is meant to keep
|
|
279
|
+
* open and glance at.
|
|
280
|
+
*/
|
|
281
|
+
export function isolatedWindowArgs(url, profileDir) {
|
|
282
|
+
return [
|
|
283
|
+
`--app=${url}`,
|
|
284
|
+
`--user-data-dir=${profileDir}`,
|
|
285
|
+
'--new-window',
|
|
286
|
+
// First-run flows would hijack the window with a sign-in wizard; the
|
|
287
|
+
// default-browser prompt would ask to change a setting the user never
|
|
288
|
+
// asked to change from a window they did not open.
|
|
289
|
+
'--no-first-run',
|
|
290
|
+
'--no-default-browser-check',
|
|
291
|
+
...QUIET_BROWSER_SWITCHES,
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Switches that ask a Chromium-family browser ShellPuppet starts, the viewer
|
|
296
|
+
* window and the screenshot browser alike, to make no network requests of its
|
|
297
|
+
* own: updates, reports and the services a browser contacts in the
|
|
298
|
+
* background. Nothing leaves the machine unless a human sends it or switches
|
|
299
|
+
* it on, and nobody asked these browsers to call anywhere. Each switch is
|
|
300
|
+
* documented in Chromium's source, named beside it; none changes what a page
|
|
301
|
+
* can do, so the viewer and its WebSocket to the daemon work as they would
|
|
302
|
+
* without them.
|
|
303
|
+
*
|
|
304
|
+
* They ask, and they do not reach everything. A NetLog of a fresh Chrome
|
|
305
|
+
* started with them, over its first minute, still showed its component
|
|
306
|
+
* updater, a Safe Browsing key fetch, an account check and a search endpoint
|
|
307
|
+
* contacted, none of which these switches turn off; a vendor's own services,
|
|
308
|
+
* such as Edge's, may be beyond Chromium's switches too.
|
|
309
|
+
*/
|
|
310
|
+
export const QUIET_BROWSER_SWITCHES = [
|
|
311
|
+
// chrome/common/chrome_switches.h: "Disable several subsystems which run
|
|
312
|
+
// network requests in the background."
|
|
313
|
+
'--disable-background-networking',
|
|
314
|
+
// chrome/common/chrome_switches.h: no updates for the components listed at
|
|
315
|
+
// chrome://components.
|
|
316
|
+
'--disable-component-update',
|
|
317
|
+
// chrome/common/chrome_switches.h: "Disable default component extensions
|
|
318
|
+
// with background pages."
|
|
319
|
+
'--disable-component-extensions-with-background-pages',
|
|
320
|
+
// chrome/common/chrome_switches.h: "Disables installation of default apps
|
|
321
|
+
// on first run."
|
|
322
|
+
'--disable-default-apps',
|
|
323
|
+
// chrome/common/chrome_switches.h: "Disables Domain Reliability Monitoring."
|
|
324
|
+
'--disable-domain-reliability',
|
|
325
|
+
// components/sync/base/command_line_switches.h: "Disables syncing browser
|
|
326
|
+
// data to a Google Account."
|
|
327
|
+
'--disable-sync',
|
|
328
|
+
// components/metrics/metrics_switches.h: "Enables the recording of metrics
|
|
329
|
+
// reports but disables reporting."
|
|
330
|
+
'--metrics-recording-only',
|
|
331
|
+
// base/base_switches.h: "Disables the crash reporting."
|
|
332
|
+
'--disable-breakpad',
|
|
333
|
+
// components/variations/variations_switches.cc: "Disable fetching of
|
|
334
|
+
// variations seed from the server."
|
|
335
|
+
'--disable-variations-seed-fetch',
|
|
336
|
+
// chrome/common/chrome_switches.h: "Don't use a proxy server, always make
|
|
337
|
+
// direct connections." With the system's proxy detection on, a browser
|
|
338
|
+
// looks for a `wpad` host on the local network. Both pages talk to
|
|
339
|
+
// 127.0.0.1 alone, which Chromium never sends through a proxy.
|
|
340
|
+
'--no-proxy-server',
|
|
341
|
+
// base/base_switches.h: "Comma-separated list of feature names to disable."
|
|
342
|
+
// One switch for every name, because Chromium keeps only the last. The
|
|
343
|
+
// names are features in Chromium's source:
|
|
344
|
+
// components/optimization_guide/core/optimization_guide_features.cc, the
|
|
345
|
+
// Optimization Hints component's syncing and the prediction models a
|
|
346
|
+
// browser downloads; components/network_time/network_time_tracker.cc, the
|
|
347
|
+
// network time queries. A name a later Chromium no longer knows is ignored,
|
|
348
|
+
// and that feature keeps its default.
|
|
349
|
+
'--disable-features=OptimizationHints,OptimizationTargetPrediction,NetworkTimeServiceQuerying',
|
|
350
|
+
];
|
|
351
|
+
export async function launchViewer(url, home, config, logger, deps = {}) {
|
|
352
|
+
return launchWindow(url, home, config, logger, deps, true);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Open the dashboard in ShellPuppet's isolated browser profile, and never in
|
|
356
|
+
* the person's default browser.
|
|
357
|
+
*
|
|
358
|
+
* The dashboard URL carries the one-use grant, so the profile it lands in has
|
|
359
|
+
* to be the one ShellPuppet owns. `viewer.launchMode` is deliberately not
|
|
360
|
+
* consulted: `shellpuppet dashboard` exists to open a window, and a mode meant
|
|
361
|
+
* for automatic viewer windows must not turn that into a default-browser
|
|
362
|
+
* hand-off. `viewer.browserPath` and `viewer.profileDir` still apply.
|
|
363
|
+
*
|
|
364
|
+
* `deps` is accepted so a test can inject a recording opener and prove that a
|
|
365
|
+
* failure never reaches it.
|
|
366
|
+
*/
|
|
367
|
+
export async function launchDashboard(url, home, config, logger, deps = {}) {
|
|
368
|
+
return launchWindow(url, home, { ...config, launchMode: 'isolated-app' }, logger, deps, false);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* The launch both windows share. The viewer may fall back to the system's
|
|
372
|
+
* opener so a session start never fails; the dashboard may not, because its
|
|
373
|
+
* grant would then land in a browser profile with extensions.
|
|
374
|
+
*/
|
|
375
|
+
async function launchWindow(url, home, config, logger, deps, allowFallback) {
|
|
376
|
+
const mode = config.launchMode ?? 'no-window';
|
|
377
|
+
if (mode === 'no-window')
|
|
378
|
+
return { launched: false, mode, reason: 'viewer.launchMode is "no-window"' };
|
|
379
|
+
if (mode === 'isolated-app') {
|
|
380
|
+
const isolated = await openIsolatedWindow(url, home, config, logger, allowFallback ? 'viewer' : 'dashboard', deps);
|
|
381
|
+
if (isolated.launched)
|
|
382
|
+
return isolated;
|
|
383
|
+
if (!allowFallback)
|
|
384
|
+
return isolated;
|
|
385
|
+
// Degrade rather than fail: the system's opener is tried, and when
|
|
386
|
+
// nothing opens the daemon hands the caller the URL.
|
|
387
|
+
return openInDefaultBrowser(url, logger, 'isolated-app', deps, isolated.reason);
|
|
388
|
+
}
|
|
389
|
+
if (!allowFallback) {
|
|
390
|
+
// Unreachable for the dashboard, which forces `isolated-app`; kept so a
|
|
391
|
+
// future caller cannot make this function hand a grant to the default
|
|
392
|
+
// browser by choosing another mode.
|
|
393
|
+
return {
|
|
394
|
+
launched: false,
|
|
395
|
+
mode: 'isolated-app',
|
|
396
|
+
reason: 'the dashboard opens only in its isolated window',
|
|
397
|
+
};
|
|
162
398
|
}
|
|
163
399
|
return openInDefaultBrowser(url, logger, 'default-browser', deps);
|
|
164
400
|
}
|
|
401
|
+
/** Open `url` in the isolated profile, or report why that was not possible. */
|
|
402
|
+
async function openIsolatedWindow(url, home, config, logger, kind, deps) {
|
|
403
|
+
const mode = 'isolated-app';
|
|
404
|
+
const browser = await (deps.findBrowser ?? findBrowser)(config.browserPath, logger);
|
|
405
|
+
if (deps.shouldLaunch?.() === false) {
|
|
406
|
+
return { launched: false, mode, reason: 'daemon is stopping' };
|
|
407
|
+
}
|
|
408
|
+
if (browser === null) {
|
|
409
|
+
logger.warn(`no Chromium-family browser found for the isolated ${kind} window`, {
|
|
410
|
+
hint: kind === 'viewer'
|
|
411
|
+
? 'set viewer.browserPath, or viewer.launchMode to "default-browser"'
|
|
412
|
+
: 'set viewer.browserPath',
|
|
413
|
+
});
|
|
414
|
+
return { launched: false, mode, reason: 'no Chromium-family browser found' };
|
|
415
|
+
}
|
|
416
|
+
const profileDir = config.profileDir ?? path.join(home, 'viewer-profile');
|
|
417
|
+
try {
|
|
418
|
+
fs.mkdirSync(profileDir, { recursive: true });
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
logger.warn(`could not create the ${kind} profile directory`, {
|
|
422
|
+
profileDir,
|
|
423
|
+
error: String(error),
|
|
424
|
+
});
|
|
425
|
+
return { launched: false, mode, reason: 'profile directory unavailable' };
|
|
426
|
+
}
|
|
427
|
+
// The browser is spawned directly, so "opened" means its process started.
|
|
428
|
+
// Its exit is not judged: a Chromium launched beside a running instance of
|
|
429
|
+
// the same profile hands the URL over and exits at once, with code 0, and
|
|
430
|
+
// the window is in the other process.
|
|
431
|
+
if (deps.shouldLaunch?.() === false) {
|
|
432
|
+
return { launched: false, mode, reason: 'daemon is stopping' };
|
|
433
|
+
}
|
|
434
|
+
const outcome = await (deps.spawnIsolated ?? spawnDetached)(browser, isolatedWindowArgs(url, profileDir));
|
|
435
|
+
if (outcome.spawned) {
|
|
436
|
+
logger.info(`${kind} window opened`, { browser, profileDir });
|
|
437
|
+
return { launched: true, mode, browser };
|
|
438
|
+
}
|
|
439
|
+
const error = outcome.error ?? 'the browser did not start';
|
|
440
|
+
logger.warn(`the ${kind} browser failed to launch`, { browser, error });
|
|
441
|
+
return { launched: false, mode, reason: error };
|
|
442
|
+
}
|
|
165
443
|
/**
|
|
166
444
|
* The command that opens `url` in the default browser.
|
|
167
445
|
*
|
|
@@ -247,8 +525,10 @@ function spawnDetached(command, args, windowsVerbatimArguments = false, settleMs
|
|
|
247
525
|
if (settled)
|
|
248
526
|
return;
|
|
249
527
|
settled = true;
|
|
528
|
+
clearTimeout(launchTimer);
|
|
250
529
|
resolve(outcome);
|
|
251
530
|
};
|
|
531
|
+
const launchTimer = setTimeout(() => settle({ spawned: false, error: 'browser spawn timed out' }), BROWSER_SPAWN_TIMEOUT_MS);
|
|
252
532
|
let child;
|
|
253
533
|
try {
|
|
254
534
|
child = spawn(command, args, {
|
|
@@ -264,6 +544,8 @@ function spawnDetached(command, args, windowsVerbatimArguments = false, settleMs
|
|
|
264
544
|
}
|
|
265
545
|
child.on('error', (error) => settle({ spawned: false, error: String(error) }));
|
|
266
546
|
child.on('spawn', () => {
|
|
547
|
+
if (settled)
|
|
548
|
+
return;
|
|
267
549
|
if (settleMs <= 0) {
|
|
268
550
|
settle({ spawned: true });
|
|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AAC;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/mcp/config.d.ts
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The MCP adapter's own section of `config.json` (the daemon
|
|
3
|
-
* rest): the framing toggle at launch
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The MCP adapter's own section of `config.json` (the daemon parses the
|
|
3
|
+
* rest, the variable lists included): the framing toggle at launch. Also the
|
|
4
|
+
* rules by which the MCP server and the CLI apply those lists at every start.
|
|
5
|
+
* Problems are reported through the logger, which the adapter points at
|
|
6
|
+
* stderr: stdout belongs to the MCP protocol.
|
|
6
7
|
*/
|
|
7
8
|
import type { Logger } from '../core/types.js';
|
|
8
9
|
export interface McpConfig {
|
|
9
10
|
/** §4.4 framing toggle: `{ "mcp": { "untrustedFraming": false } }` disables. */
|
|
10
11
|
untrustedFraming: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* The variables a client may pass into a session from its own environment:
|
|
13
|
-
* this server for `terminal_start`'s `envNames`, and the CLI for
|
|
14
|
-
* `start --env-name` (§4.6). Set by the human, so the agent driving either
|
|
15
|
-
* can ask only for these; empty when unset, so nothing passes until a
|
|
16
|
-
* person lists something.
|
|
17
|
-
*/
|
|
18
|
-
passEnv: string[];
|
|
19
12
|
}
|
|
20
13
|
/** The `mcp` section of a parsed config, with defaults for what is absent. */
|
|
21
|
-
export declare function parseMcpConfig(parsed: unknown
|
|
14
|
+
export declare function parseMcpConfig(parsed: unknown): McpConfig;
|
|
22
15
|
/**
|
|
23
16
|
* Resolve requested variable names against the human's list (§4.6), for the
|
|
24
17
|
* MCP server's `envNames` and the CLI's `--env-name` alike. Names off the
|
|
@@ -37,7 +30,7 @@ export declare function resolvePassedEnv(requested: readonly string[], allowed:
|
|
|
37
30
|
* session the agent's list is the whole answer: its names pass without being
|
|
38
31
|
* asked for, and a requested name off that list refuses the start. A session
|
|
39
32
|
* that runs as no agent passes only requested names on `adHoc`
|
|
40
|
-
* (`
|
|
33
|
+
* (config `envNames`). Names, never values, go into the notes and the refusal.
|
|
41
34
|
*/
|
|
42
35
|
export declare function planPassedEnv(input: {
|
|
43
36
|
agent: string | null;
|
package/dist/mcp/config.js
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The MCP adapter's own section of `config.json` (the daemon
|
|
3
|
-
* rest): the framing toggle at launch
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The MCP adapter's own section of `config.json` (the daemon parses the
|
|
3
|
+
* rest, the variable lists included): the framing toggle at launch. Also the
|
|
4
|
+
* rules by which the MCP server and the CLI apply those lists at every start.
|
|
5
|
+
* Problems are reported through the logger, which the adapter points at
|
|
6
|
+
* stderr: stdout belongs to the MCP protocol.
|
|
6
7
|
*/
|
|
7
8
|
import * as fs from 'node:fs';
|
|
8
9
|
import { configPath } from '../daemon/paths.js';
|
|
9
|
-
|
|
10
|
-
const DEFAULTS = { untrustedFraming: true, passEnv: [] };
|
|
10
|
+
const DEFAULTS = { untrustedFraming: true };
|
|
11
11
|
/** The `mcp` section of a parsed config, with defaults for what is absent. */
|
|
12
|
-
export function parseMcpConfig(parsed
|
|
12
|
+
export function parseMcpConfig(parsed) {
|
|
13
13
|
const mcp = typeof parsed === 'object' && parsed !== null
|
|
14
14
|
? parsed.mcp
|
|
15
15
|
: undefined;
|
|
16
16
|
if (mcp === undefined || mcp === null)
|
|
17
17
|
return { ...DEFAULTS };
|
|
18
|
-
|
|
19
|
-
let passEnv = [];
|
|
20
|
-
if (Array.isArray(listed)) {
|
|
21
|
-
passEnv = listed.filter((name) => typeof name === 'string' && ENV_NAME_PATTERN.test(name));
|
|
22
|
-
if (passEnv.length !== listed.length) {
|
|
23
|
-
logger.warn('mcp.passEnv: ignoring entries that are not variable names');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else if (listed !== undefined) {
|
|
27
|
-
logger.warn('mcp.passEnv must be an array of variable names: passing none');
|
|
28
|
-
}
|
|
29
|
-
return { untrustedFraming: mcp.untrustedFraming !== false, passEnv };
|
|
18
|
+
return { untrustedFraming: mcp.untrustedFraming !== false };
|
|
30
19
|
}
|
|
31
20
|
/**
|
|
32
21
|
* Resolve requested variable names against the human's list (§4.6), for the
|
|
@@ -62,7 +51,7 @@ export function resolvePassedEnv(requested, allowed, environment) {
|
|
|
62
51
|
* session the agent's list is the whole answer: its names pass without being
|
|
63
52
|
* asked for, and a requested name off that list refuses the start. A session
|
|
64
53
|
* that runs as no agent passes only requested names on `adHoc`
|
|
65
|
-
* (`
|
|
54
|
+
* (config `envNames`). Names, never values, go into the notes and the refusal.
|
|
66
55
|
*/
|
|
67
56
|
export function planPassedEnv(input) {
|
|
68
57
|
const { agent, requested, environment, source } = input;
|
|
@@ -96,7 +85,7 @@ export function readMcpConfig(home, logger) {
|
|
|
96
85
|
return { ...DEFAULTS };
|
|
97
86
|
}
|
|
98
87
|
try {
|
|
99
|
-
return parseMcpConfig(JSON.parse(raw)
|
|
88
|
+
return parseMcpConfig(JSON.parse(raw));
|
|
100
89
|
}
|
|
101
90
|
catch {
|
|
102
91
|
logger.warn('config.json could not be parsed: using the MCP defaults');
|