@comecaramelos/dsh-chrome-mcp 0.0.1 → 1.0.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 +22 -78
- package/assets/dsh-chrome-mcp-social.png +0 -0
- package/assets/icon.svg +71 -0
- package/assets/prelaunch-windows-chrome.html +277 -0
- package/lib/client.js +1433 -568
- package/lib/client.js.map +7 -0
- package/lib/host/apply.d.ts +3 -0
- package/lib/host/apply.d.ts.map +1 -0
- package/lib/host/apply.js +31 -0
- package/lib/host/apply.js.map +1 -0
- package/lib/host/bridge.d.ts +65 -0
- package/lib/host/bridge.d.ts.map +1 -0
- package/lib/host/bridge.js +176 -0
- package/lib/host/bridge.js.map +1 -0
- package/lib/host/catalog.d.ts +31 -0
- package/lib/host/catalog.d.ts.map +1 -0
- package/lib/host/catalog.js +92 -0
- package/lib/host/catalog.js.map +1 -0
- package/lib/host/constants.d.ts +229 -0
- package/lib/host/constants.d.ts.map +1 -0
- package/lib/host/constants.js +242 -0
- package/lib/host/constants.js.map +1 -0
- package/lib/host/controller/bridge-run.d.ts +38 -0
- package/lib/host/controller/bridge-run.d.ts.map +1 -0
- package/lib/host/controller/bridge-run.js +69 -0
- package/lib/host/controller/bridge-run.js.map +1 -0
- package/lib/host/controller/captures.d.ts +22 -0
- package/lib/host/controller/captures.d.ts.map +1 -0
- package/lib/host/controller/captures.js +60 -0
- package/lib/host/controller/captures.js.map +1 -0
- package/lib/host/controller/commits.d.ts +4 -0
- package/lib/host/controller/commits.d.ts.map +1 -0
- package/lib/host/controller/commits.js +75 -0
- package/lib/host/controller/commits.js.map +1 -0
- package/lib/host/controller/controller.d.ts +40 -0
- package/lib/host/controller/controller.d.ts.map +1 -0
- package/lib/host/controller/controller.js +167 -0
- package/lib/host/controller/controller.js.map +1 -0
- package/lib/host/controller/index.d.ts +26 -0
- package/lib/host/controller/index.d.ts.map +1 -0
- package/lib/host/controller/index.js +25 -0
- package/lib/host/controller/index.js.map +1 -0
- package/lib/host/controller/notes.d.ts +26 -0
- package/lib/host/controller/notes.d.ts.map +1 -0
- package/lib/host/controller/notes.js +49 -0
- package/lib/host/controller/notes.js.map +1 -0
- package/lib/host/controller/persist.d.ts +9 -0
- package/lib/host/controller/persist.d.ts.map +1 -0
- package/lib/host/controller/persist.js +51 -0
- package/lib/host/controller/persist.js.map +1 -0
- package/lib/host/controller/runs.d.ts +56 -0
- package/lib/host/controller/runs.d.ts.map +1 -0
- package/lib/host/controller/runs.js +211 -0
- package/lib/host/controller/runs.js.map +1 -0
- package/lib/host/controller/state.d.ts +70 -0
- package/lib/host/controller/state.d.ts.map +1 -0
- package/lib/host/controller/state.js +2 -0
- package/lib/host/controller/state.js.map +1 -0
- package/lib/host/controller/windows-run.d.ts +9 -0
- package/lib/host/controller/windows-run.d.ts.map +1 -0
- package/lib/host/controller/windows-run.js +78 -0
- package/lib/host/controller/windows-run.js.map +1 -0
- package/lib/host/discovery/candidates.d.ts +37 -0
- package/lib/host/discovery/candidates.d.ts.map +1 -0
- package/lib/host/discovery/candidates.js +56 -0
- package/lib/host/discovery/candidates.js.map +1 -0
- package/lib/host/discovery/index.d.ts +18 -0
- package/lib/host/discovery/index.d.ts.map +1 -0
- package/lib/host/discovery/index.js +18 -0
- package/lib/host/discovery/index.js.map +1 -0
- package/lib/host/discovery/probe.d.ts +18 -0
- package/lib/host/discovery/probe.d.ts.map +1 -0
- package/lib/host/discovery/probe.js +97 -0
- package/lib/host/discovery/probe.js.map +1 -0
- package/lib/host/discovery/scan.d.ts +67 -0
- package/lib/host/discovery/scan.d.ts.map +1 -0
- package/lib/host/discovery/scan.js +169 -0
- package/lib/host/discovery/scan.js.map +1 -0
- package/lib/host/flags.d.ts +42 -0
- package/lib/host/flags.d.ts.map +1 -0
- package/lib/host/flags.js +118 -0
- package/lib/host/flags.js.map +1 -0
- package/lib/host/platform.d.ts +38 -0
- package/lib/host/platform.d.ts.map +1 -0
- package/lib/host/platform.js +64 -0
- package/lib/host/platform.js.map +1 -0
- package/lib/host/plugin-meta.d.ts +12 -0
- package/lib/host/plugin-meta.d.ts.map +1 -0
- package/lib/host/plugin-meta.js +12 -0
- package/lib/host/plugin-meta.js.map +1 -0
- package/lib/host/schema.d.ts +307 -0
- package/lib/host/schema.d.ts.map +1 -0
- package/lib/host/schema.js +171 -0
- package/lib/host/schema.js.map +1 -0
- package/lib/host/settings.d.ts +9 -0
- package/lib/host/settings.d.ts.map +1 -0
- package/lib/host/settings.js +70 -0
- package/lib/host/settings.js.map +1 -0
- package/lib/host/status.d.ts +28 -0
- package/lib/host/status.d.ts.map +1 -0
- package/lib/host/status.js +60 -0
- package/lib/host/status.js.map +1 -0
- package/lib/host/tool.d.ts +59 -0
- package/lib/host/tool.d.ts.map +1 -0
- package/lib/host/tool.js +51 -0
- package/lib/host/tool.js.map +1 -0
- package/lib/host/types/config.d.ts +47 -0
- package/lib/host/types/config.d.ts.map +1 -0
- package/lib/host/types/config.js +2 -0
- package/lib/host/types/config.js.map +1 -0
- package/lib/host/types/executable.d.ts +30 -0
- package/lib/host/types/executable.d.ts.map +1 -0
- package/lib/host/types/executable.js +9 -0
- package/lib/host/types/executable.js.map +1 -0
- package/lib/host/types/index.d.ts +23 -0
- package/lib/host/types/index.d.ts.map +1 -0
- package/lib/host/types/index.js +2 -0
- package/lib/host/types/index.js.map +1 -0
- package/lib/host/types/plugin.d.ts +38 -0
- package/lib/host/types/plugin.d.ts.map +1 -0
- package/lib/host/types/plugin.js +10 -0
- package/lib/host/types/plugin.js.map +1 -0
- package/lib/host/types/settings.d.ts +127 -0
- package/lib/host/types/settings.d.ts.map +1 -0
- package/lib/host/types/settings.js +2 -0
- package/lib/host/types/settings.js.map +1 -0
- package/lib/host/types/stderr.d.ts +53 -0
- package/lib/host/types/stderr.d.ts.map +1 -0
- package/lib/host/types/stderr.js +9 -0
- package/lib/host/types/stderr.js.map +1 -0
- package/lib/host/types/windows.d.ts +39 -0
- package/lib/host/types/windows.d.ts.map +1 -0
- package/lib/host/types/windows.js +9 -0
- package/lib/host/types/windows.js.map +1 -0
- package/lib/host/values.d.ts +89 -0
- package/lib/host/values.d.ts.map +1 -0
- package/lib/host/values.js +212 -0
- package/lib/host/values.js.map +1 -0
- package/lib/host/windows/connect-flags.d.ts +16 -0
- package/lib/host/windows/connect-flags.d.ts.map +1 -0
- package/lib/host/windows/connect-flags.js +67 -0
- package/lib/host/windows/connect-flags.js.map +1 -0
- package/lib/host/windows/index.d.ts +31 -0
- package/lib/host/windows/index.d.ts.map +1 -0
- package/lib/host/windows/index.js +30 -0
- package/lib/host/windows/index.js.map +1 -0
- package/lib/host/windows/landing.d.ts +47 -0
- package/lib/host/windows/landing.d.ts.map +1 -0
- package/lib/host/windows/landing.js +174 -0
- package/lib/host/windows/landing.js.map +1 -0
- package/lib/host/windows/link.d.ts +11 -0
- package/lib/host/windows/link.d.ts.map +1 -0
- package/lib/host/windows/link.js +52 -0
- package/lib/host/windows/link.js.map +1 -0
- package/lib/host/windows/paths.d.ts +43 -0
- package/lib/host/windows/paths.d.ts.map +1 -0
- package/lib/host/windows/paths.js +121 -0
- package/lib/host/windows/paths.js.map +1 -0
- package/lib/host/windows/run.d.ts +74 -0
- package/lib/host/windows/run.d.ts.map +1 -0
- package/lib/host/windows/run.js +210 -0
- package/lib/host/windows/run.js.map +1 -0
- package/lib/host/windows/spawn.d.ts +22 -0
- package/lib/host/windows/spawn.d.ts.map +1 -0
- package/lib/host/windows/spawn.js +73 -0
- package/lib/host/windows/spawn.js.map +1 -0
- package/lib/index.d.ts +86 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +72 -625
- package/lib/index.js.map +1 -0
- package/package.json +26 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-half plugin identity.
|
|
3
|
+
*
|
|
4
|
+
* `name` is what the cordis loader reports for diagnostics and `inject` is the
|
|
5
|
+
* list of host services this half needs of its own; the nested mcp-client row
|
|
6
|
+
* declares the tools, so nothing is injected here.
|
|
7
|
+
*/
|
|
8
|
+
/** Cordis plugin name used by loader diagnostics. */
|
|
9
|
+
export declare const name = "chrome-devtools-mcp";
|
|
10
|
+
/** No host services of our own: the nested bridge declares `tools`. */
|
|
11
|
+
export declare const inject: string[];
|
|
12
|
+
//# sourceMappingURL=plugin-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-meta.d.ts","sourceRoot":"","sources":["../../src/host/plugin-meta.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qDAAqD;AACrD,eAAO,MAAM,IAAI,wBAAwB,CAAC;AAE1C,uEAAuE;AACvE,eAAO,MAAM,MAAM,EAAE,MAAM,EAAO,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-half plugin identity.
|
|
3
|
+
*
|
|
4
|
+
* `name` is what the cordis loader reports for diagnostics and `inject` is the
|
|
5
|
+
* list of host services this half needs of its own; the nested mcp-client row
|
|
6
|
+
* declares the tools, so nothing is injected here.
|
|
7
|
+
*/
|
|
8
|
+
/** Cordis plugin name used by loader diagnostics. */
|
|
9
|
+
export const name = "chrome-devtools-mcp";
|
|
10
|
+
/** No host services of our own: the nested bridge declares `tools`. */
|
|
11
|
+
export const inject = [];
|
|
12
|
+
//# sourceMappingURL=plugin-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-meta.js","sourceRoot":"","sources":["../../src/host/plugin-meta.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAE1C,uEAAuE;AACvE,MAAM,CAAC,MAAM,MAAM,GAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two zod schemas: the cordis row config and the settings section.
|
|
3
|
+
*
|
|
4
|
+
* The row config validates what lives in the profile (one row per plugin
|
|
5
|
+
* instance); the settings schema describes the namespace the Web GUI card
|
|
6
|
+
* edits — the persisted user layer (flags, the executable selection, the saved
|
|
7
|
+
* executable rows, the stderr toggle and the one action trigger) plus the
|
|
8
|
+
* base-layer status fields served alongside it.
|
|
9
|
+
*/
|
|
10
|
+
import z from "@deepseek-ai/schemastery";
|
|
11
|
+
export declare const Config: z<Schemastery.ObjectS<{
|
|
12
|
+
serverName: z<string, string>;
|
|
13
|
+
command: z<string, string>;
|
|
14
|
+
package: z<string, string>;
|
|
15
|
+
extraFlags: z<string[], string[]>;
|
|
16
|
+
chromePath: z<string, string>;
|
|
17
|
+
chromePaths: z<string[], string[]>;
|
|
18
|
+
env: z<import("@deepseek-ai/cosmokit").Dict<string, string>, import("@deepseek-ai/cosmokit").Dict<string, string>>;
|
|
19
|
+
cwd: z<string, string>;
|
|
20
|
+
toolCallTimeoutMs: z<number, number>;
|
|
21
|
+
failOnStartupError: z<boolean, boolean>;
|
|
22
|
+
reconnect: z<Schemastery.ObjectS<{
|
|
23
|
+
enabled: z<boolean, boolean>;
|
|
24
|
+
initialDelayMs: z<number, number>;
|
|
25
|
+
maxDelayMs: z<number, number>;
|
|
26
|
+
maxAttempts: z<number, number>;
|
|
27
|
+
}>, Schemastery.ObjectT<{
|
|
28
|
+
enabled: z<boolean, boolean>;
|
|
29
|
+
initialDelayMs: z<number, number>;
|
|
30
|
+
maxDelayMs: z<number, number>;
|
|
31
|
+
maxAttempts: z<number, number>;
|
|
32
|
+
}>>;
|
|
33
|
+
/** Bridge console-output routing: "log" (default) redirects the spawned
|
|
34
|
+
* npx child's inherited stderr into a per-spawn log file so its progress
|
|
35
|
+
* / startup lines stay out of the dsh console; "console" inherits it
|
|
36
|
+
* (debug). The card's "Reduce log output" toggle (`stderrMode`) overrides
|
|
37
|
+
* this. See {@link buildBridgeSpawn}. */
|
|
38
|
+
bridgeStderr: z<"log" | "console", "log" | "console">;
|
|
39
|
+
/** Log path override for "log" mode; "" = auto (see
|
|
40
|
+
* {@link bridgeStderrLogPath}). Absolute paths only. */
|
|
41
|
+
bridgeStderrLog: z<string, string>;
|
|
42
|
+
}>, Schemastery.ObjectT<{
|
|
43
|
+
serverName: z<string, string>;
|
|
44
|
+
command: z<string, string>;
|
|
45
|
+
package: z<string, string>;
|
|
46
|
+
extraFlags: z<string[], string[]>;
|
|
47
|
+
chromePath: z<string, string>;
|
|
48
|
+
chromePaths: z<string[], string[]>;
|
|
49
|
+
env: z<import("@deepseek-ai/cosmokit").Dict<string, string>, import("@deepseek-ai/cosmokit").Dict<string, string>>;
|
|
50
|
+
cwd: z<string, string>;
|
|
51
|
+
toolCallTimeoutMs: z<number, number>;
|
|
52
|
+
failOnStartupError: z<boolean, boolean>;
|
|
53
|
+
reconnect: z<Schemastery.ObjectS<{
|
|
54
|
+
enabled: z<boolean, boolean>;
|
|
55
|
+
initialDelayMs: z<number, number>;
|
|
56
|
+
maxDelayMs: z<number, number>;
|
|
57
|
+
maxAttempts: z<number, number>;
|
|
58
|
+
}>, Schemastery.ObjectT<{
|
|
59
|
+
enabled: z<boolean, boolean>;
|
|
60
|
+
initialDelayMs: z<number, number>;
|
|
61
|
+
maxDelayMs: z<number, number>;
|
|
62
|
+
maxAttempts: z<number, number>;
|
|
63
|
+
}>>;
|
|
64
|
+
/** Bridge console-output routing: "log" (default) redirects the spawned
|
|
65
|
+
* npx child's inherited stderr into a per-spawn log file so its progress
|
|
66
|
+
* / startup lines stay out of the dsh console; "console" inherits it
|
|
67
|
+
* (debug). The card's "Reduce log output" toggle (`stderrMode`) overrides
|
|
68
|
+
* this. See {@link buildBridgeSpawn}. */
|
|
69
|
+
bridgeStderr: z<"log" | "console", "log" | "console">;
|
|
70
|
+
/** Log path override for "log" mode; "" = auto (see
|
|
71
|
+
* {@link bridgeStderrLogPath}). Absolute paths only. */
|
|
72
|
+
bridgeStderrLog: z<string, string>;
|
|
73
|
+
}>>;
|
|
74
|
+
/**
|
|
75
|
+
* User-settings section served to the Web GUI card.
|
|
76
|
+
*
|
|
77
|
+
* Persisted (user layer in `$DSH_HOME/settings.yaml`): `extraFlags`,
|
|
78
|
+
* `chromePath` (the executable the picker selected — or that the host seeded
|
|
79
|
+
* once), `executables` (the saved-executables rows: `id` = path, `name` = UI
|
|
80
|
+
* label), `refreshExecutablesNonce` (the card's **Search executables**
|
|
81
|
+
* trigger), `openWindowsChromeNonce` (the card's **Prelaunch Windows Chrome**
|
|
82
|
+
* trigger), `chromeCustomPaths` (the **legacy** hand-typed MRU: folded into the
|
|
83
|
+
* rows once by the first scan, never written again) and `stderrMode` (the
|
|
84
|
+
* "Reduce log output" toggle: "log" captures the bridge's stderr into a
|
|
85
|
+
* per-spawn log file, "console" echoes it, "" follows the row-config
|
|
86
|
+
* `bridgeStderr`).
|
|
87
|
+
* Served but never persisted (composition base layer held in memory by the
|
|
88
|
+
* host): `lastError`, `executableDiscoveryRevision`, `chromeVersion`,
|
|
89
|
+
* `executableStatus`, `chromeMissing`, `effectiveChromePath`,
|
|
90
|
+
* `effectiveSource`, `wslWindowsExecutable`, `windowsChromeStatus`,
|
|
91
|
+
* `carriesConnectionMode`, the static `rowStderr` mirror, the static
|
|
92
|
+
* `defaultExtraFlags` mirror (the canonical defaults list the card's
|
|
93
|
+
* **Restore defaults** control appends) and the static `wslExtraFlags` mirror
|
|
94
|
+
* (the recommended WSL ↔ Windows flags the card's **Flags WSL** control
|
|
95
|
+
* appends) — the client's polls stop when the served revision advances past its
|
|
96
|
+
* action-time value.
|
|
97
|
+
*/
|
|
98
|
+
export declare const SettingsSchema: z<Schemastery.ObjectS<{
|
|
99
|
+
/** Flags appended after `npx -y <package>`; persisted last UI edit. An
|
|
100
|
+
* executable-pinning flag is rejected: the executable is picked below. */
|
|
101
|
+
extraFlags: z<string[], string[]>;
|
|
102
|
+
/** Written by the UI **Search executables** button; the host reacts to it by
|
|
103
|
+
* re-probing the saved rows and merging what it finds back into them. */
|
|
104
|
+
refreshExecutablesNonce: z<number, number>;
|
|
105
|
+
/** Written by the UI **Prelaunch Windows Chrome** button; the host reacts to it
|
|
106
|
+
* by running the Windows launch: locate the Windows Chrome, prove the
|
|
107
|
+
* mirrored-loopback prereq, launch it with a debugging port, and write the
|
|
108
|
+
* `--browserUrl` connect entry that leaves the bridge in connect mode. */
|
|
109
|
+
openWindowsChromeNonce: z<number, number>;
|
|
110
|
+
/**
|
|
111
|
+
* The executable the bridge launches with: picked in the picker (a saved
|
|
112
|
+
* row's `id`) or seeded once by the host's first scan. "" = nothing resolved
|
|
113
|
+
* yet — there is no auto state to fall back to.
|
|
114
|
+
*/
|
|
115
|
+
chromePath: z<string, string>;
|
|
116
|
+
/** The picker's saved rows — `{ id: path, name: label }`, user-authored. The
|
|
117
|
+
* host re-normalizes (trim, dedupe, caps) on every read, and a scan merges
|
|
118
|
+
* what it discovers into them without dropping a name the user chose. */
|
|
119
|
+
executables: z<({
|
|
120
|
+
id?: string | null | undefined;
|
|
121
|
+
name?: string | null | undefined;
|
|
122
|
+
} & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<{
|
|
123
|
+
id: z<string, string>;
|
|
124
|
+
name: z<string, string>;
|
|
125
|
+
}>[]>;
|
|
126
|
+
/**
|
|
127
|
+
* **Legacy** MRU of hand-typed executables, newest first. The saved rows
|
|
128
|
+
* replace it: a host whose settings still carry it folds its paths into the
|
|
129
|
+
* rows during the first scan (see ./catalog.ts `mergeEntries`), so the field
|
|
130
|
+
* is read once and never written again.
|
|
131
|
+
*/
|
|
132
|
+
chromeCustomPaths: z<string[], string[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Persisted UI "Reduce log output" toggle: "log" captures the bridge's
|
|
135
|
+
* stderr into the log file, "console" echoes it (debug). "" follows the
|
|
136
|
+
* row-config `bridgeStderr` (mirrored into `rowStderr`).
|
|
137
|
+
*/
|
|
138
|
+
stderrMode: z<string, string>;
|
|
139
|
+
/** Last check/connection failure, human-readable; empty when healthy. */
|
|
140
|
+
lastError: z<string, string>;
|
|
141
|
+
/** Known error: the last failure was "no Chrome executable detected". */
|
|
142
|
+
chromeMissing: z<boolean, boolean>;
|
|
143
|
+
/** Executable-run counter (success or failure); completion signal for every
|
|
144
|
+
* executable action the card can take. */
|
|
145
|
+
executableDiscoveryRevision: z<number, number>;
|
|
146
|
+
/** The version the **selected** executable answered with; "" when nothing
|
|
147
|
+
* answered — nothing picked, a connect mode, or a blocked path. */
|
|
148
|
+
chromeVersion: z<string, string>;
|
|
149
|
+
/** Per-row probe status keyed by path: the version the row answered with,
|
|
150
|
+
* and the failure for a row that is present but not runnable (or blocked).
|
|
151
|
+
* Base layer, never persisted — the rows themselves live in the user
|
|
152
|
+
* layer. */
|
|
153
|
+
executableStatus: z<({
|
|
154
|
+
path?: string | null | undefined;
|
|
155
|
+
version?: string | null | undefined;
|
|
156
|
+
error?: string | null | undefined;
|
|
157
|
+
} & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<{
|
|
158
|
+
path: z<string, string>;
|
|
159
|
+
version: z<string, string>;
|
|
160
|
+
error: z<string, string>;
|
|
161
|
+
}>[]>;
|
|
162
|
+
/** The path the bridge actually launches with ("" when nothing is fixed).
|
|
163
|
+
* Base layer, never persisted. */
|
|
164
|
+
effectiveChromePath: z<string, string>;
|
|
165
|
+
/** Where `effectiveChromePath` came from — picked (`"selected"`), row config
|
|
166
|
+
* (`"row-config"`) or nothing yet (""). Base layer, never persisted. */
|
|
167
|
+
effectiveSource: z<string, string>;
|
|
168
|
+
/** Row-config `bridgeStderr` in effect (static base layer; never
|
|
169
|
+
* persisted) — the fallback when `stderrMode` is "". */
|
|
170
|
+
rowStderr: z<"log" | "console", "log" | "console">;
|
|
171
|
+
/** The canonical default extra-flags list (static base layer; never
|
|
172
|
+
* persisted) — the list the card's **Restore defaults** control appends to
|
|
173
|
+
* what the editor holds. Mirror of `DEFAULT_EXTRA_FLAGS`. */
|
|
174
|
+
defaultExtraFlags: z<string[], string[]>;
|
|
175
|
+
/** The recommended WSL ↔ Windows extra-flags list (static base layer;
|
|
176
|
+
* never persisted) — the list the card's **Flags WSL** control appends to
|
|
177
|
+
* what the editor holds, missing entries only. Mirror of
|
|
178
|
+
* `WSL_EXTRA_FLAGS`. */
|
|
179
|
+
wslExtraFlags: z<string[], string[]>;
|
|
180
|
+
/** True while this host runs under WSL and the selected executable is a
|
|
181
|
+
* Windows binary — the state the card's notice explains. Base layer, never
|
|
182
|
+
* persisted (see ./platform.ts). */
|
|
183
|
+
wslWindowsExecutable: z<boolean, boolean>;
|
|
184
|
+
/** What the **Prelaunch Windows Chrome** run is doing (base layer; never
|
|
185
|
+
* persisted) — the single field the card derives the button's state, its
|
|
186
|
+
* disabled reason and the pill's connect-mode muting from. The locate,
|
|
187
|
+
* prereq, launch and port answers all live host-side (./windows/), so
|
|
188
|
+
* the card never carries a list of Windows paths or reachability rules. */
|
|
189
|
+
windowsChromeStatus: z<Schemastery.ObjectS<{
|
|
190
|
+
state: z<string, string>;
|
|
191
|
+
port: z<number, number>;
|
|
192
|
+
error: z<string, string>;
|
|
193
|
+
}>, Schemastery.ObjectT<{
|
|
194
|
+
state: z<string, string>;
|
|
195
|
+
port: z<number, number>;
|
|
196
|
+
error: z<string, string>;
|
|
197
|
+
}>>;
|
|
198
|
+
/** True while the bridge launches with a connect-mode flag
|
|
199
|
+
* (`--browserUrl` / `--wsEndpoint`): no local executable is then launched
|
|
200
|
+
* or probed, so the card mutes the picker. Base layer, never persisted. */
|
|
201
|
+
carriesConnectionMode: z<boolean, boolean>;
|
|
202
|
+
}>, Schemastery.ObjectT<{
|
|
203
|
+
/** Flags appended after `npx -y <package>`; persisted last UI edit. An
|
|
204
|
+
* executable-pinning flag is rejected: the executable is picked below. */
|
|
205
|
+
extraFlags: z<string[], string[]>;
|
|
206
|
+
/** Written by the UI **Search executables** button; the host reacts to it by
|
|
207
|
+
* re-probing the saved rows and merging what it finds back into them. */
|
|
208
|
+
refreshExecutablesNonce: z<number, number>;
|
|
209
|
+
/** Written by the UI **Prelaunch Windows Chrome** button; the host reacts to it
|
|
210
|
+
* by running the Windows launch: locate the Windows Chrome, prove the
|
|
211
|
+
* mirrored-loopback prereq, launch it with a debugging port, and write the
|
|
212
|
+
* `--browserUrl` connect entry that leaves the bridge in connect mode. */
|
|
213
|
+
openWindowsChromeNonce: z<number, number>;
|
|
214
|
+
/**
|
|
215
|
+
* The executable the bridge launches with: picked in the picker (a saved
|
|
216
|
+
* row's `id`) or seeded once by the host's first scan. "" = nothing resolved
|
|
217
|
+
* yet — there is no auto state to fall back to.
|
|
218
|
+
*/
|
|
219
|
+
chromePath: z<string, string>;
|
|
220
|
+
/** The picker's saved rows — `{ id: path, name: label }`, user-authored. The
|
|
221
|
+
* host re-normalizes (trim, dedupe, caps) on every read, and a scan merges
|
|
222
|
+
* what it discovers into them without dropping a name the user chose. */
|
|
223
|
+
executables: z<({
|
|
224
|
+
id?: string | null | undefined;
|
|
225
|
+
name?: string | null | undefined;
|
|
226
|
+
} & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<{
|
|
227
|
+
id: z<string, string>;
|
|
228
|
+
name: z<string, string>;
|
|
229
|
+
}>[]>;
|
|
230
|
+
/**
|
|
231
|
+
* **Legacy** MRU of hand-typed executables, newest first. The saved rows
|
|
232
|
+
* replace it: a host whose settings still carry it folds its paths into the
|
|
233
|
+
* rows during the first scan (see ./catalog.ts `mergeEntries`), so the field
|
|
234
|
+
* is read once and never written again.
|
|
235
|
+
*/
|
|
236
|
+
chromeCustomPaths: z<string[], string[]>;
|
|
237
|
+
/**
|
|
238
|
+
* Persisted UI "Reduce log output" toggle: "log" captures the bridge's
|
|
239
|
+
* stderr into the log file, "console" echoes it (debug). "" follows the
|
|
240
|
+
* row-config `bridgeStderr` (mirrored into `rowStderr`).
|
|
241
|
+
*/
|
|
242
|
+
stderrMode: z<string, string>;
|
|
243
|
+
/** Last check/connection failure, human-readable; empty when healthy. */
|
|
244
|
+
lastError: z<string, string>;
|
|
245
|
+
/** Known error: the last failure was "no Chrome executable detected". */
|
|
246
|
+
chromeMissing: z<boolean, boolean>;
|
|
247
|
+
/** Executable-run counter (success or failure); completion signal for every
|
|
248
|
+
* executable action the card can take. */
|
|
249
|
+
executableDiscoveryRevision: z<number, number>;
|
|
250
|
+
/** The version the **selected** executable answered with; "" when nothing
|
|
251
|
+
* answered — nothing picked, a connect mode, or a blocked path. */
|
|
252
|
+
chromeVersion: z<string, string>;
|
|
253
|
+
/** Per-row probe status keyed by path: the version the row answered with,
|
|
254
|
+
* and the failure for a row that is present but not runnable (or blocked).
|
|
255
|
+
* Base layer, never persisted — the rows themselves live in the user
|
|
256
|
+
* layer. */
|
|
257
|
+
executableStatus: z<({
|
|
258
|
+
path?: string | null | undefined;
|
|
259
|
+
version?: string | null | undefined;
|
|
260
|
+
error?: string | null | undefined;
|
|
261
|
+
} & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<{
|
|
262
|
+
path: z<string, string>;
|
|
263
|
+
version: z<string, string>;
|
|
264
|
+
error: z<string, string>;
|
|
265
|
+
}>[]>;
|
|
266
|
+
/** The path the bridge actually launches with ("" when nothing is fixed).
|
|
267
|
+
* Base layer, never persisted. */
|
|
268
|
+
effectiveChromePath: z<string, string>;
|
|
269
|
+
/** Where `effectiveChromePath` came from — picked (`"selected"`), row config
|
|
270
|
+
* (`"row-config"`) or nothing yet (""). Base layer, never persisted. */
|
|
271
|
+
effectiveSource: z<string, string>;
|
|
272
|
+
/** Row-config `bridgeStderr` in effect (static base layer; never
|
|
273
|
+
* persisted) — the fallback when `stderrMode` is "". */
|
|
274
|
+
rowStderr: z<"log" | "console", "log" | "console">;
|
|
275
|
+
/** The canonical default extra-flags list (static base layer; never
|
|
276
|
+
* persisted) — the list the card's **Restore defaults** control appends to
|
|
277
|
+
* what the editor holds. Mirror of `DEFAULT_EXTRA_FLAGS`. */
|
|
278
|
+
defaultExtraFlags: z<string[], string[]>;
|
|
279
|
+
/** The recommended WSL ↔ Windows extra-flags list (static base layer;
|
|
280
|
+
* never persisted) — the list the card's **Flags WSL** control appends to
|
|
281
|
+
* what the editor holds, missing entries only. Mirror of
|
|
282
|
+
* `WSL_EXTRA_FLAGS`. */
|
|
283
|
+
wslExtraFlags: z<string[], string[]>;
|
|
284
|
+
/** True while this host runs under WSL and the selected executable is a
|
|
285
|
+
* Windows binary — the state the card's notice explains. Base layer, never
|
|
286
|
+
* persisted (see ./platform.ts). */
|
|
287
|
+
wslWindowsExecutable: z<boolean, boolean>;
|
|
288
|
+
/** What the **Prelaunch Windows Chrome** run is doing (base layer; never
|
|
289
|
+
* persisted) — the single field the card derives the button's state, its
|
|
290
|
+
* disabled reason and the pill's connect-mode muting from. The locate,
|
|
291
|
+
* prereq, launch and port answers all live host-side (./windows/), so
|
|
292
|
+
* the card never carries a list of Windows paths or reachability rules. */
|
|
293
|
+
windowsChromeStatus: z<Schemastery.ObjectS<{
|
|
294
|
+
state: z<string, string>;
|
|
295
|
+
port: z<number, number>;
|
|
296
|
+
error: z<string, string>;
|
|
297
|
+
}>, Schemastery.ObjectT<{
|
|
298
|
+
state: z<string, string>;
|
|
299
|
+
port: z<number, number>;
|
|
300
|
+
error: z<string, string>;
|
|
301
|
+
}>>;
|
|
302
|
+
/** True while the bridge launches with a connect-mode flag
|
|
303
|
+
* (`--browserUrl` / `--wsEndpoint`): no local executable is then launched
|
|
304
|
+
* or probed, so the card mutes the picker. Base layer, never persisted. */
|
|
305
|
+
carriesConnectionMode: z<boolean, boolean>;
|
|
306
|
+
}>>;
|
|
307
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/host/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAqBzC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;IAYf;;;;6CAIyC;;IAEzC;4DACwD;;;;;;;;;;;;;;;;;;;;;;;;IAPxD;;;;6CAIyC;;IAEzC;4DACwD;;GAE1D,CAAC;AA2BH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc;IACvB;8EAC0E;;IAE1E;6EACyE;;IAEzE;;;8EAG0E;;IAE1E;;;;OAIG;;IAEH;;6EAEyE;;;;;;;;IAEzE;;;;;OAKG;;IAEH;;;;OAIG;;IAEH,yEAAyE;;IAEzE,yEAAyE;;IAEzE;8CAC0C;;IAE1C;uEACmE;;IAEnE;;;gBAGY;;;;;;;;;;IAEZ;sCACkC;;IAElC;4EACwE;;IAExE;4DACwD;;IAExD;;iEAE6D;;IAE7D;;;4BAGwB;;IAExB;;wCAEoC;;IAEpC;;;;+EAI2E;;;;;;;;;;IAE3E;;+EAE2E;;;IA/E3E;8EAC0E;;IAE1E;6EACyE;;IAEzE;;;8EAG0E;;IAE1E;;;;OAIG;;IAEH;;6EAEyE;;;;;;;;IAEzE;;;;;OAKG;;IAEH;;;;OAIG;;IAEH,yEAAyE;;IAEzE,yEAAyE;;IAEzE;8CAC0C;;IAE1C;uEACmE;;IAEnE;;;gBAGY;;;;;;;;;;IAEZ;sCACkC;;IAElC;4EACwE;;IAExE;4DACwD;;IAExD;;iEAE6D;;IAE7D;;;4BAGwB;;IAExB;;wCAEoC;;IAEpC;;;;+EAI2E;;;;;;;;;;IAE3E;;+EAE2E;;GAE7E,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two zod schemas: the cordis row config and the settings section.
|
|
3
|
+
*
|
|
4
|
+
* The row config validates what lives in the profile (one row per plugin
|
|
5
|
+
* instance); the settings schema describes the namespace the Web GUI card
|
|
6
|
+
* edits — the persisted user layer (flags, the executable selection, the saved
|
|
7
|
+
* executable rows, the stderr toggle and the one action trigger) plus the
|
|
8
|
+
* base-layer status fields served alongside it.
|
|
9
|
+
*/
|
|
10
|
+
import z from "@deepseek-ai/schemastery";
|
|
11
|
+
import { CHROME_PATH_PATTERN, DEFAULT_EXTRA_FLAGS, EFFECTIVE_SOURCE_PATTERN, OPTIONAL_PATH_PATTERN, STDERR_MODE_FIELD_PATTERN, WINDOWS_CHROME_STATE_PATTERN, WSL_EXTRA_FLAGS } from "./constants.js";
|
|
12
|
+
import { defaultChromePaths } from "./discovery/index.js";
|
|
13
|
+
/** Reconnect policy passthrough; mirrors dsh-mcp-client's schema. */
|
|
14
|
+
const Reconnect = z.object({
|
|
15
|
+
enabled: z.boolean().default(true),
|
|
16
|
+
initialDelayMs: z.number().min(1).max(600000).default(500),
|
|
17
|
+
maxDelayMs: z.number().min(1).max(600000).default(30000),
|
|
18
|
+
maxAttempts: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(10)
|
|
19
|
+
});
|
|
20
|
+
export const Config = z.object({
|
|
21
|
+
serverName: z.string().pattern(/^[A-Za-z0-9_-]{1,32}$/).default("chrome"),
|
|
22
|
+
command: z.string().default("npx"),
|
|
23
|
+
package: z.string().min(1).default("chrome-devtools-mcp@latest"),
|
|
24
|
+
extraFlags: z.array(String).default(DEFAULT_EXTRA_FLAGS),
|
|
25
|
+
chromePath: z.string().default(""),
|
|
26
|
+
chromePaths: z.array(String).default(defaultChromePaths()),
|
|
27
|
+
env: z.dict(String).default({}),
|
|
28
|
+
cwd: z.string().default(""),
|
|
29
|
+
toolCallTimeoutMs: z.number().default(60000),
|
|
30
|
+
failOnStartupError: z.boolean().default(false),
|
|
31
|
+
reconnect: Reconnect,
|
|
32
|
+
/** Bridge console-output routing: "log" (default) redirects the spawned
|
|
33
|
+
* npx child's inherited stderr into a per-spawn log file so its progress
|
|
34
|
+
* / startup lines stay out of the dsh console; "console" inherits it
|
|
35
|
+
* (debug). The card's "Reduce log output" toggle (`stderrMode`) overrides
|
|
36
|
+
* this. See {@link buildBridgeSpawn}. */
|
|
37
|
+
bridgeStderr: z.union([z.const("log"), z.const("console")]).default("log"),
|
|
38
|
+
/** Log path override for "log" mode; "" = auto (see
|
|
39
|
+
* {@link bridgeStderrLogPath}). Absolute paths only. */
|
|
40
|
+
bridgeStderrLog: z.string().default("").pattern(OPTIONAL_PATH_PATTERN)
|
|
41
|
+
});
|
|
42
|
+
/** One saved-executable catalog row: `id` is the path that goes on the wire
|
|
43
|
+
* (`--executablePath=<id>`), `name` the label the user chose for the UI
|
|
44
|
+
* ("" = render the path). Persisted. */
|
|
45
|
+
const ExecutableEntrySchema = z.object({
|
|
46
|
+
id: z.string().default("").pattern(CHROME_PATH_PATTERN),
|
|
47
|
+
name: z.string().default("")
|
|
48
|
+
});
|
|
49
|
+
/** What one saved row's probe answered with, keyed by its id (`path`): the
|
|
50
|
+
* `--version` line, and the failure that makes it not runnable. Base layer. */
|
|
51
|
+
const ExecutableStatusSchema = z.object({
|
|
52
|
+
path: z.string().default("").pattern(CHROME_PATH_PATTERN),
|
|
53
|
+
version: z.string().default(""),
|
|
54
|
+
error: z.string().default("")
|
|
55
|
+
});
|
|
56
|
+
/** The served Windows-Chrome state: what the **Prelaunch Windows Chrome** run is
|
|
57
|
+
* doing, the debugging port it settled on (0 = none) and the failure line.
|
|
58
|
+
* Base layer. */
|
|
59
|
+
const WindowsChromeStatusSchema = z.object({
|
|
60
|
+
state: z.string().pattern(WINDOWS_CHROME_STATE_PATTERN).default("off"),
|
|
61
|
+
port: z.number().default(0),
|
|
62
|
+
error: z.string().default("")
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* User-settings section served to the Web GUI card.
|
|
66
|
+
*
|
|
67
|
+
* Persisted (user layer in `$DSH_HOME/settings.yaml`): `extraFlags`,
|
|
68
|
+
* `chromePath` (the executable the picker selected — or that the host seeded
|
|
69
|
+
* once), `executables` (the saved-executables rows: `id` = path, `name` = UI
|
|
70
|
+
* label), `refreshExecutablesNonce` (the card's **Search executables**
|
|
71
|
+
* trigger), `openWindowsChromeNonce` (the card's **Prelaunch Windows Chrome**
|
|
72
|
+
* trigger), `chromeCustomPaths` (the **legacy** hand-typed MRU: folded into the
|
|
73
|
+
* rows once by the first scan, never written again) and `stderrMode` (the
|
|
74
|
+
* "Reduce log output" toggle: "log" captures the bridge's stderr into a
|
|
75
|
+
* per-spawn log file, "console" echoes it, "" follows the row-config
|
|
76
|
+
* `bridgeStderr`).
|
|
77
|
+
* Served but never persisted (composition base layer held in memory by the
|
|
78
|
+
* host): `lastError`, `executableDiscoveryRevision`, `chromeVersion`,
|
|
79
|
+
* `executableStatus`, `chromeMissing`, `effectiveChromePath`,
|
|
80
|
+
* `effectiveSource`, `wslWindowsExecutable`, `windowsChromeStatus`,
|
|
81
|
+
* `carriesConnectionMode`, the static `rowStderr` mirror, the static
|
|
82
|
+
* `defaultExtraFlags` mirror (the canonical defaults list the card's
|
|
83
|
+
* **Restore defaults** control appends) and the static `wslExtraFlags` mirror
|
|
84
|
+
* (the recommended WSL ↔ Windows flags the card's **Flags WSL** control
|
|
85
|
+
* appends) — the client's polls stop when the served revision advances past its
|
|
86
|
+
* action-time value.
|
|
87
|
+
*/
|
|
88
|
+
export const SettingsSchema = z.object({
|
|
89
|
+
/** Flags appended after `npx -y <package>`; persisted last UI edit. An
|
|
90
|
+
* executable-pinning flag is rejected: the executable is picked below. */
|
|
91
|
+
extraFlags: z.array(String).default(DEFAULT_EXTRA_FLAGS),
|
|
92
|
+
/** Written by the UI **Search executables** button; the host reacts to it by
|
|
93
|
+
* re-probing the saved rows and merging what it finds back into them. */
|
|
94
|
+
refreshExecutablesNonce: z.number().default(0),
|
|
95
|
+
/** Written by the UI **Prelaunch Windows Chrome** button; the host reacts to it
|
|
96
|
+
* by running the Windows launch: locate the Windows Chrome, prove the
|
|
97
|
+
* mirrored-loopback prereq, launch it with a debugging port, and write the
|
|
98
|
+
* `--browserUrl` connect entry that leaves the bridge in connect mode. */
|
|
99
|
+
openWindowsChromeNonce: z.number().default(0),
|
|
100
|
+
/**
|
|
101
|
+
* The executable the bridge launches with: picked in the picker (a saved
|
|
102
|
+
* row's `id`) or seeded once by the host's first scan. "" = nothing resolved
|
|
103
|
+
* yet — there is no auto state to fall back to.
|
|
104
|
+
*/
|
|
105
|
+
chromePath: z.string().default("").pattern(CHROME_PATH_PATTERN),
|
|
106
|
+
/** The picker's saved rows — `{ id: path, name: label }`, user-authored. The
|
|
107
|
+
* host re-normalizes (trim, dedupe, caps) on every read, and a scan merges
|
|
108
|
+
* what it discovers into them without dropping a name the user chose. */
|
|
109
|
+
executables: z.array(ExecutableEntrySchema).default([]),
|
|
110
|
+
/**
|
|
111
|
+
* **Legacy** MRU of hand-typed executables, newest first. The saved rows
|
|
112
|
+
* replace it: a host whose settings still carry it folds its paths into the
|
|
113
|
+
* rows during the first scan (see ./catalog.ts `mergeEntries`), so the field
|
|
114
|
+
* is read once and never written again.
|
|
115
|
+
*/
|
|
116
|
+
chromeCustomPaths: z.array(z.string().default("").pattern(CHROME_PATH_PATTERN)).default([]),
|
|
117
|
+
/**
|
|
118
|
+
* Persisted UI "Reduce log output" toggle: "log" captures the bridge's
|
|
119
|
+
* stderr into the log file, "console" echoes it (debug). "" follows the
|
|
120
|
+
* row-config `bridgeStderr` (mirrored into `rowStderr`).
|
|
121
|
+
*/
|
|
122
|
+
stderrMode: z.string().default("").pattern(STDERR_MODE_FIELD_PATTERN),
|
|
123
|
+
/** Last check/connection failure, human-readable; empty when healthy. */
|
|
124
|
+
lastError: z.string().default(""),
|
|
125
|
+
/** Known error: the last failure was "no Chrome executable detected". */
|
|
126
|
+
chromeMissing: z.boolean().default(false),
|
|
127
|
+
/** Executable-run counter (success or failure); completion signal for every
|
|
128
|
+
* executable action the card can take. */
|
|
129
|
+
executableDiscoveryRevision: z.number().default(0),
|
|
130
|
+
/** The version the **selected** executable answered with; "" when nothing
|
|
131
|
+
* answered — nothing picked, a connect mode, or a blocked path. */
|
|
132
|
+
chromeVersion: z.string().default(""),
|
|
133
|
+
/** Per-row probe status keyed by path: the version the row answered with,
|
|
134
|
+
* and the failure for a row that is present but not runnable (or blocked).
|
|
135
|
+
* Base layer, never persisted — the rows themselves live in the user
|
|
136
|
+
* layer. */
|
|
137
|
+
executableStatus: z.array(ExecutableStatusSchema).default([]),
|
|
138
|
+
/** The path the bridge actually launches with ("" when nothing is fixed).
|
|
139
|
+
* Base layer, never persisted. */
|
|
140
|
+
effectiveChromePath: z.string().default("").pattern(CHROME_PATH_PATTERN),
|
|
141
|
+
/** Where `effectiveChromePath` came from — picked (`"selected"`), row config
|
|
142
|
+
* (`"row-config"`) or nothing yet (""). Base layer, never persisted. */
|
|
143
|
+
effectiveSource: z.string().default("").pattern(EFFECTIVE_SOURCE_PATTERN),
|
|
144
|
+
/** Row-config `bridgeStderr` in effect (static base layer; never
|
|
145
|
+
* persisted) — the fallback when `stderrMode` is "". */
|
|
146
|
+
rowStderr: z.union([z.const("log"), z.const("console")]).default("log"),
|
|
147
|
+
/** The canonical default extra-flags list (static base layer; never
|
|
148
|
+
* persisted) — the list the card's **Restore defaults** control appends to
|
|
149
|
+
* what the editor holds. Mirror of `DEFAULT_EXTRA_FLAGS`. */
|
|
150
|
+
defaultExtraFlags: z.array(String).default(DEFAULT_EXTRA_FLAGS),
|
|
151
|
+
/** The recommended WSL ↔ Windows extra-flags list (static base layer;
|
|
152
|
+
* never persisted) — the list the card's **Flags WSL** control appends to
|
|
153
|
+
* what the editor holds, missing entries only. Mirror of
|
|
154
|
+
* `WSL_EXTRA_FLAGS`. */
|
|
155
|
+
wslExtraFlags: z.array(String).default(WSL_EXTRA_FLAGS),
|
|
156
|
+
/** True while this host runs under WSL and the selected executable is a
|
|
157
|
+
* Windows binary — the state the card's notice explains. Base layer, never
|
|
158
|
+
* persisted (see ./platform.ts). */
|
|
159
|
+
wslWindowsExecutable: z.boolean().default(false),
|
|
160
|
+
/** What the **Prelaunch Windows Chrome** run is doing (base layer; never
|
|
161
|
+
* persisted) — the single field the card derives the button's state, its
|
|
162
|
+
* disabled reason and the pill's connect-mode muting from. The locate,
|
|
163
|
+
* prereq, launch and port answers all live host-side (./windows/), so
|
|
164
|
+
* the card never carries a list of Windows paths or reachability rules. */
|
|
165
|
+
windowsChromeStatus: WindowsChromeStatusSchema.default({ state: "off", port: 0, error: "" }),
|
|
166
|
+
/** True while the bridge launches with a connect-mode flag
|
|
167
|
+
* (`--browserUrl` / `--wsEndpoint`): no local executable is then launched
|
|
168
|
+
* or probed, so the card mutes the picker. Base layer, never persisted. */
|
|
169
|
+
carriesConnectionMode: z.boolean().default(false)
|
|
170
|
+
});
|
|
171
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/host/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,eAAe,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,qEAAqE;AACrE,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC1D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACxD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAClF,CAAC,CAAC;AAEH,MAAM,CAAC,M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AAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC;IACzE;4DACwD;IACxD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACvE;;iEAE6D;IAC7D,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAC/D;;;4BAGwB;IACxB,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IACvD;;wCAEoC;IACpC,oBAAoB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAChD;;;;+EAI2E;IAC3E,mBAAmB,EAAE,yBAAyB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC5F;;+EAE2E;IAC3E,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACpD,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChromeMcpController } from "./controller/index.js";
|
|
2
|
+
import type { PluginContext } from "./types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Install the settings namespace and wire its hooks into the controller.
|
|
5
|
+
* @param ctx - plugin context.
|
|
6
|
+
* @param controller - the live state created by `apply`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installChromeMcpSection(ctx: PluginContext, controller: ChromeMcpController): void;
|
|
9
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/host/settings.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,kBAAkB,CAAC;AAEzF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAuCjG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host half — the `chrome-mcp` settings section.
|
|
3
|
+
*
|
|
4
|
+
* Installs the namespace the Web GUI card edits and routes every commit into
|
|
5
|
+
* the controller. Two contract details decide the shape of this module:
|
|
6
|
+
*
|
|
7
|
+
* - `installSection` runs `hooks.onChange()` synchronously at registration,
|
|
8
|
+
* which is how a persisted `extraFlags` selection lands on the FIRST
|
|
9
|
+
* connection when the settings service is already up (the cold path is
|
|
10
|
+
* `readPersistedFlags` in ./values.ts).
|
|
11
|
+
* - The `validate` hook is the UI write gate: an invalid flags list throws
|
|
12
|
+
* inside `installSection` (surfaced on the card), it never reaches the
|
|
13
|
+
* running bridge. The executable fields are gated the same way — a path
|
|
14
|
+
* carrying control characters can never become a selection nor a saved-row
|
|
15
|
+
* id — and `--executablePath` in the flags list is rejected outright,
|
|
16
|
+
* because the picker owns that one flag (see ./flags.ts).
|
|
17
|
+
*/
|
|
18
|
+
import { CHROME_PATH_PATTERN, CUSTOM_PATHS_CAP, SETTINGS_NAMESPACE } from "./constants.js";
|
|
19
|
+
import { isValidEntryId } from "./catalog.js";
|
|
20
|
+
import { SettingsSchema } from "./schema.js";
|
|
21
|
+
import { validateExtraFlags } from "./flags.js";
|
|
22
|
+
import { normalizeCustomPaths } from "./values.js";
|
|
23
|
+
/**
|
|
24
|
+
* Install the settings namespace and wire its hooks into the controller.
|
|
25
|
+
* @param ctx - plugin context.
|
|
26
|
+
* @param controller - the live state created by `apply`.
|
|
27
|
+
*/
|
|
28
|
+
export function installChromeMcpSection(ctx, controller) {
|
|
29
|
+
ctx.inject(["settings"], (inner) => {
|
|
30
|
+
const settings = inner.settings;
|
|
31
|
+
if (!settings)
|
|
32
|
+
return;
|
|
33
|
+
settings.installSection(inner, SETTINGS_NAMESPACE, SettingsSchema, controller.entry, {
|
|
34
|
+
setSource: (next) => {
|
|
35
|
+
controller.setSource(next);
|
|
36
|
+
},
|
|
37
|
+
validate: (value) => {
|
|
38
|
+
try {
|
|
39
|
+
validateExtraFlags(value.extraFlags);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const msg = error instanceof Error ? String(error.message ?? error) : String(error);
|
|
43
|
+
throw new Error(`settings "${SETTINGS_NAMESPACE}": ${msg}`);
|
|
44
|
+
}
|
|
45
|
+
if (value.stderrMode !== "" && value.stderrMode !== "log" && value.stderrMode !== "console") {
|
|
46
|
+
throw new Error(`settings "${SETTINGS_NAMESPACE}": stderrMode must be "log", "console" or empty (row-config default)`);
|
|
47
|
+
}
|
|
48
|
+
for (const path of [value.chromePath, ...normalizeCustomPaths(value.chromeCustomPaths, CUSTOM_PATHS_CAP)]) {
|
|
49
|
+
if (typeof path !== "string" || path === "" || CHROME_PATH_PATTERN.test(path))
|
|
50
|
+
continue;
|
|
51
|
+
throw new Error(`settings "${SETTINGS_NAMESPACE}": chromePath "${path}" must be a path without control characters`);
|
|
52
|
+
}
|
|
53
|
+
// The saved rows go on the wire the same way the selection does,
|
|
54
|
+
// so the gate that rejects a control-character path rejects a
|
|
55
|
+
// control-character row id — a bad row never reaches a scan, and
|
|
56
|
+
// never reaches argv as `--executablePath=<id>`.
|
|
57
|
+
for (const row of Array.isArray(value.executables) ? value.executables : []) {
|
|
58
|
+
const id = row === null || typeof row !== "object" ? "" : row.id;
|
|
59
|
+
if (isValidEntryId(id))
|
|
60
|
+
continue;
|
|
61
|
+
throw new Error(`settings "${SETTINGS_NAMESPACE}": executable row "${String(id ?? "")}" must carry a path without control characters`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
onChange: () => {
|
|
65
|
+
controller.onSettingsChange();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/host/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAInD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAkB,EAAE,UAA+B;IACvF,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,KAAoB,EAAE,EAAE;QAC9C,MAAM,QAAQ,GAAI,KAAwC,CAAC,QAAQ,CAAC;QACpE,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE;YACjF,SAAS,EAAE,CAAC,IAA4B,EAAE,EAAE;gBACxC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YACD,QAAQ,EAAE,CAAC,KAAuB,EAAE,EAAE;gBAClC,IAAI,CAAC;oBACD,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;gBACzC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,KA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CAAC;YACL,CAAC;YACD,QAAQ,EAAE,GAAG,EAAE;gBACX,UAAU,CAAC,gBAAgB,EAAE,CAAC;YAClC,CAAC;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ToolCallResult } from "./types/index.js";
|
|
2
|
+
/** First non-empty line of a text block, capped. */
|
|
3
|
+
export declare function firstLine(text: unknown, cap?: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* Recognizes the known, developer-actionable error "no Chrome executable was
|
|
6
|
+
* detected": our own ENOENT/discovery lines, the upstream executable-discovery
|
|
7
|
+
* failures ("Could not find Google Chrome executable for channel 'stable'
|
|
8
|
+
* at:", puppeteer's configured-path miss), and the umbrella launch failure
|
|
9
|
+
* chrome-devtools-mcp surfaces when it cannot start a browser binary. Upstream
|
|
10
|
+
* starts the browser lazily (on the first tool call), so the check probe is
|
|
11
|
+
* what surfaces the state without any tool call. Anything else is a generic
|
|
12
|
+
* check or connection error.
|
|
13
|
+
* @param text - an error message (or first line thereof).
|
|
14
|
+
* @returns true when the failure is the known executable-missing state.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isChromeMissing(text: unknown): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Summarize one chrome-tool call result for the card's status line. Failed
|
|
19
|
+
* calls return "<tool> failed: <first text line>" — tool-level errors
|
|
20
|
+
* (browser unreachable, "Target closed", …) are returned to the calling
|
|
21
|
+
* agent and never route through the bridge logger, so this is the only
|
|
22
|
+
* capture point. Successes return null: the caller clears the stored error.
|
|
23
|
+
* @param toolName - fully qualified registered name (`mcp__<server>__<tool>`).
|
|
24
|
+
* @param result - settled tools-service execution result.
|
|
25
|
+
* @returns the note, or null when the call did not fail.
|
|
26
|
+
*/
|
|
27
|
+
export declare function toolResultNote(toolName: string, result: ToolCallResult | null | undefined): string | null;
|
|
28
|
+
//# sourceMappingURL=status.d.ts.map
|