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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { NULL_LOGGER } from '../core/types.js';
|
|
2
|
+
const trackedFields = [
|
|
3
|
+
'cols', 'rows', 'geometryHeld', 'ready', 'readyReason', 'watchers',
|
|
4
|
+
'label', 'purpose', 'exited', 'exitCode', 'waitingOnPrompt',
|
|
5
|
+
];
|
|
6
|
+
export function changedFields(before, after) {
|
|
7
|
+
return trackedFields.filter((field) => {
|
|
8
|
+
if (field !== 'waitingOnPrompt')
|
|
9
|
+
return before[field] !== after[field];
|
|
10
|
+
const left = before.waitingOnPrompt;
|
|
11
|
+
const right = after.waitingOnPrompt;
|
|
12
|
+
if (left === undefined || right === undefined)
|
|
13
|
+
return left !== right;
|
|
14
|
+
return left.question !== right.question || left.alerted !== right.alerted ||
|
|
15
|
+
left.selectedOption !== right.selectedOption ||
|
|
16
|
+
left.options.length !== right.options.length ||
|
|
17
|
+
left.options.some((option, index) => option !== right.options[index]);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export class SessionFeed {
|
|
21
|
+
version;
|
|
22
|
+
snapshot;
|
|
23
|
+
logger;
|
|
24
|
+
current = new Map();
|
|
25
|
+
subscribers = new Set();
|
|
26
|
+
pending = [];
|
|
27
|
+
dispatching = false;
|
|
28
|
+
constructor(version, snapshot, logger = NULL_LOGGER) {
|
|
29
|
+
this.version = version;
|
|
30
|
+
this.snapshot = snapshot;
|
|
31
|
+
this.logger = logger;
|
|
32
|
+
for (const summary of snapshot())
|
|
33
|
+
this.current.set(summary.id, summary);
|
|
34
|
+
}
|
|
35
|
+
subscribe(listener) {
|
|
36
|
+
// Capture the list before registering. Events raised by a callback while
|
|
37
|
+
// these two frames are delivered queue behind the captured snapshot.
|
|
38
|
+
const sessions = this.snapshot();
|
|
39
|
+
const subscriber = { listener, initialising: true, queued: [] };
|
|
40
|
+
this.subscribers.add(subscriber);
|
|
41
|
+
this.deliver(subscriber, { type: 'hello', version: this.version });
|
|
42
|
+
this.deliver(subscriber, { type: 'snapshot', at: new Date().toISOString(), sessions });
|
|
43
|
+
while (subscriber.queued.length > 0)
|
|
44
|
+
this.deliver(subscriber, subscriber.queued.shift());
|
|
45
|
+
subscriber.initialising = false;
|
|
46
|
+
return () => { this.subscribers.delete(subscriber); };
|
|
47
|
+
}
|
|
48
|
+
add(summary) {
|
|
49
|
+
if (this.current.has(summary.id))
|
|
50
|
+
return;
|
|
51
|
+
this.current.set(summary.id, summary);
|
|
52
|
+
this.emit({ type: 'session-added', at: new Date().toISOString(), session: summary });
|
|
53
|
+
}
|
|
54
|
+
update(summary) {
|
|
55
|
+
const previous = this.current.get(summary.id);
|
|
56
|
+
if (previous === undefined)
|
|
57
|
+
return;
|
|
58
|
+
const changed = changedFields(previous, summary);
|
|
59
|
+
this.current.set(summary.id, summary);
|
|
60
|
+
if (changed.length > 0) {
|
|
61
|
+
this.emit({ type: 'session-updated', at: new Date().toISOString(), session: summary, changed });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
remove(id) {
|
|
65
|
+
if (!this.current.delete(id))
|
|
66
|
+
return;
|
|
67
|
+
this.emit({ type: 'session-removed', at: new Date().toISOString(), session: id });
|
|
68
|
+
}
|
|
69
|
+
emit(frame) {
|
|
70
|
+
this.pending.push({ frame, recipients: [...this.subscribers] });
|
|
71
|
+
if (this.dispatching)
|
|
72
|
+
return;
|
|
73
|
+
this.dispatching = true;
|
|
74
|
+
try {
|
|
75
|
+
while (this.pending.length > 0) {
|
|
76
|
+
const next = this.pending.shift();
|
|
77
|
+
for (const subscriber of next.recipients) {
|
|
78
|
+
if (!this.subscribers.has(subscriber))
|
|
79
|
+
continue;
|
|
80
|
+
if (subscriber.initialising)
|
|
81
|
+
subscriber.queued.push(next.frame);
|
|
82
|
+
else
|
|
83
|
+
this.deliver(subscriber, next.frame);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
this.dispatching = false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
deliver(subscriber, frame) {
|
|
92
|
+
try {
|
|
93
|
+
subscriber.listener(frame);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// A fixed message keeps screen text in a thrown error out of the log.
|
|
97
|
+
this.logger.warn('session feed listener failed');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=sessionFeed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionFeed.js","sourceRoot":"","sources":["../../src/daemon/sessionFeed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAc/C,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU;IAClE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB;CACnD,CAAC;AAEX,MAAM,UAAU,aAAa,CAAC,MAAmB,EAAE,KAAkB;IACnE,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACpC,IAAI,KAAK,KAAK,iBAAiB;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,GAAG,MAAM,CAAC,eAAe,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,eAAe,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,IAAI,KAAK,KAAK,CAAC;QACrE,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,O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AAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,sEAAsE;YACtE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -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,8 +36,8 @@
|
|
|
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 type
|
|
35
|
-
export type ViewerLaunchMode = 'isolated-app' | 'default-browser' | '
|
|
39
|
+
import { type Logger } from '../core/types.js';
|
|
40
|
+
export type ViewerLaunchMode = 'dashboard' | 'isolated-app' | 'default-browser' | 'no-window';
|
|
36
41
|
export interface ViewerLaunchConfig {
|
|
37
42
|
launchMode?: ViewerLaunchMode;
|
|
38
43
|
/** Explicit browser binary, overriding detection entirely. */
|
|
@@ -60,13 +65,62 @@ export interface ViewerLaunchResult {
|
|
|
60
65
|
*/
|
|
61
66
|
export declare function extraBrowserCandidates(): string[];
|
|
62
67
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
68
|
+
* The Chrome installations `chrome-launcher` checks by file access alone,
|
|
69
|
+
* before any lookup that shells out, in the order it ranks them: the
|
|
70
|
+
* `CHROME_PATH` and `LIGHTHOUSE_CHROMIUM_PATH` overrides first everywhere; on
|
|
71
|
+
* Windows its whole search, which is these paths and nothing else; on macOS
|
|
72
|
+
* the two `/Applications` bundles its own `getFirstInstallation()` checks
|
|
73
|
+
* before its LaunchServices query, which rank above anything that query
|
|
74
|
+
* finds. Linux has only the overrides here: its lookup reads `.desktop` files
|
|
75
|
+
* and PATH, which a fixed list cannot match.
|
|
66
76
|
*/
|
|
67
|
-
export declare function
|
|
77
|
+
export declare function wellKnownChromePaths(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string[];
|
|
78
|
+
/** Where browser detection looks, in the order it looks. */
|
|
79
|
+
export interface BrowserDetection {
|
|
80
|
+
/** Checked first, by file access alone. */
|
|
81
|
+
wellKnown: string[];
|
|
82
|
+
/**
|
|
83
|
+
* A module exporting chrome-launcher's `Launcher`, as a file URL. A child
|
|
84
|
+
* process imports it and runs `Launcher.getInstallations()`. Empty skips
|
|
85
|
+
* the lookup.
|
|
86
|
+
*/
|
|
87
|
+
lookupModule: string;
|
|
88
|
+
/** How long the child process may take before it is ended and counts as finding nothing. */
|
|
89
|
+
lookupTimeoutMs: number;
|
|
90
|
+
/** Checked last, by file access alone. */
|
|
91
|
+
extra: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* How long chrome-launcher's full lookup may take. Its macOS query took 5.7 s
|
|
95
|
+
* and 9.7 s on macOS CI runners, so this leaves room for a slower machine.
|
|
96
|
+
*/
|
|
97
|
+
export declare const BROWSER_LOOKUP_TIMEOUT_MS = 30000;
|
|
98
|
+
/** The detection the daemon runs: chrome-launcher's, then the supplementary list. */
|
|
99
|
+
export declare function defaultBrowserDetection(): BrowserDetection;
|
|
100
|
+
/**
|
|
101
|
+
* Find a Chromium-family browser, or null. Detection can never stop the
|
|
102
|
+
* daemon from serving: nothing here throws, and no part of it holds the
|
|
103
|
+
* daemon's event loop (see `detectBrowser`).
|
|
104
|
+
*/
|
|
105
|
+
export declare function findBrowser(explicitPath?: string, logger?: Logger): Promise<string | null>;
|
|
68
106
|
/** Test hook: forget the memoised browser so detection runs again. */
|
|
69
107
|
export declare function resetBrowserCache(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Detect a browser without holding the daemon's event loop. chrome-launcher's
|
|
110
|
+
* lookup is synchronous and shells out on macOS (`lsregister -dump`, seconds)
|
|
111
|
+
* and Linux (`grep` over `.desktop` files, `which`). Run in the daemon, it
|
|
112
|
+
* would stop `/health` and every other request being answered while it ran,
|
|
113
|
+
* on macOS for long enough that a client gives up on a daemon it has just
|
|
114
|
+
* started. So the paths chrome-launcher itself checks first are tried with
|
|
115
|
+
* asynchronous file checks; only when none exists does its full lookup run,
|
|
116
|
+
* in a child process; and the supplementary list is checked last. On Windows
|
|
117
|
+
* the default detection leaves that lookup empty, because the well-known
|
|
118
|
+
* paths are the whole search. The answer is the one chrome-launcher's own
|
|
119
|
+
* ranking gives, then the first supplementary browser present. A lookup that
|
|
120
|
+
* times out, crashes or prints something other than a JSON list is logged
|
|
121
|
+
* once, through `logger`.
|
|
122
|
+
*/
|
|
123
|
+
export declare function detectBrowser(detection?: BrowserDetection, logger?: Logger): Promise<string | null>;
|
|
70
124
|
/**
|
|
71
125
|
* Open `url` in a chromeless window backed by its own browser profile.
|
|
72
126
|
*
|
|
@@ -82,6 +136,24 @@ export declare function resetBrowserCache(): void;
|
|
|
82
136
|
* every time, which is the wrong trade for a window a human is meant to keep
|
|
83
137
|
* open and glance at.
|
|
84
138
|
*/
|
|
139
|
+
export declare function isolatedWindowArgs(url: string, profileDir: string): string[];
|
|
140
|
+
/**
|
|
141
|
+
* Switches that ask a Chromium-family browser ShellPuppet starts, the viewer
|
|
142
|
+
* window and the screenshot browser alike, to make no network requests of its
|
|
143
|
+
* own: updates, reports and the services a browser contacts in the
|
|
144
|
+
* background. Nothing leaves the machine unless a human sends it or switches
|
|
145
|
+
* it on, and nobody asked these browsers to call anywhere. Each switch is
|
|
146
|
+
* documented in Chromium's source, named beside it; none changes what a page
|
|
147
|
+
* can do, so the viewer and its WebSocket to the daemon work as they would
|
|
148
|
+
* without them.
|
|
149
|
+
*
|
|
150
|
+
* They ask, and they do not reach everything. A NetLog of a fresh Chrome
|
|
151
|
+
* started with them, over its first minute, still showed its component
|
|
152
|
+
* updater, a Safe Browsing key fetch, an account check and a search endpoint
|
|
153
|
+
* contacted, none of which these switches turn off; a vendor's own services,
|
|
154
|
+
* such as Edge's, may be beyond Chromium's switches too.
|
|
155
|
+
*/
|
|
156
|
+
export declare const QUIET_BROWSER_SWITCHES: readonly string[];
|
|
85
157
|
/**
|
|
86
158
|
* What a test may inject in place of the platform's opener command, so the
|
|
87
159
|
* default-browser path can be exercised without opening a browser.
|
|
@@ -90,8 +162,27 @@ export interface LaunchDependencies {
|
|
|
90
162
|
opener?: (url: string) => DefaultBrowserCommand;
|
|
91
163
|
/** How long to wait for the opener's exit code; `OPENER_SETTLE_MS` by default. */
|
|
92
164
|
openerSettleMs?: number;
|
|
165
|
+
/** Checked after detection and immediately before an isolated browser spawn. */
|
|
166
|
+
shouldLaunch?: () => boolean;
|
|
167
|
+
/** Test seams for the two sides of the shutdown race. */
|
|
168
|
+
findBrowser?: typeof findBrowser;
|
|
169
|
+
spawnIsolated?: (command: string, args: string[]) => Promise<SpawnOutcome>;
|
|
93
170
|
}
|
|
94
171
|
export declare function launchViewer(url: string, home: string, config: ViewerLaunchConfig, logger: Logger, deps?: LaunchDependencies): Promise<ViewerLaunchResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Open the dashboard in ShellPuppet's isolated browser profile, and never in
|
|
174
|
+
* the person's default browser.
|
|
175
|
+
*
|
|
176
|
+
* The dashboard URL carries the one-use grant, so the profile it lands in has
|
|
177
|
+
* to be the one ShellPuppet owns. `viewer.launchMode` is deliberately not
|
|
178
|
+
* consulted: `shellpuppet dashboard` exists to open a window, and a mode meant
|
|
179
|
+
* for automatic viewer windows must not turn that into a default-browser
|
|
180
|
+
* hand-off. `viewer.browserPath` and `viewer.profileDir` still apply.
|
|
181
|
+
*
|
|
182
|
+
* `deps` is accepted so a test can inject a recording opener and prove that a
|
|
183
|
+
* failure never reaches it.
|
|
184
|
+
*/
|
|
185
|
+
export declare function launchDashboard(url: string, home: string, config: ViewerLaunchConfig, logger: Logger, deps?: LaunchDependencies): Promise<ViewerLaunchResult>;
|
|
95
186
|
/** How to hand a URL to the platform's default browser. */
|
|
96
187
|
export interface DefaultBrowserCommand {
|
|
97
188
|
command: string;
|