@comecaramelos/dsh-chrome-mcp 1.0.0 → 2.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 +44 -39
- package/lib/client.js +2186 -614
- package/lib/client.js.map +4 -4
- package/lib/host/apply.d.ts +38 -1
- package/lib/host/apply.d.ts.map +1 -1
- package/lib/host/apply.js +43 -17
- package/lib/host/apply.js.map +1 -1
- package/lib/host/bridge.d.ts +28 -19
- package/lib/host/bridge.d.ts.map +1 -1
- package/lib/host/bridge.js +71 -79
- package/lib/host/bridge.js.map +1 -1
- package/lib/host/catalog.d.ts +2 -2
- package/lib/host/catalog.js +2 -2
- package/lib/host/commands/chrome-path.d.ts +4 -0
- package/lib/host/commands/chrome-path.d.ts.map +1 -0
- package/lib/host/commands/chrome-path.js +65 -0
- package/lib/host/commands/chrome-path.js.map +1 -0
- package/lib/host/commands/chrome-refresh.d.ts +17 -0
- package/lib/host/commands/chrome-refresh.d.ts.map +1 -0
- package/lib/host/commands/chrome-refresh.js +37 -0
- package/lib/host/commands/chrome-refresh.js.map +1 -0
- package/lib/host/commands/index.d.ts +26 -0
- package/lib/host/commands/index.d.ts.map +1 -0
- package/lib/host/commands/index.js +41 -0
- package/lib/host/commands/index.js.map +1 -0
- package/lib/host/constants.d.ts +107 -30
- package/lib/host/constants.d.ts.map +1 -1
- package/lib/host/constants.js +107 -30
- package/lib/host/constants.js.map +1 -1
- package/lib/host/controller/_trace.d.ts +3 -0
- package/lib/host/controller/_trace.d.ts.map +1 -0
- package/lib/host/controller/_trace.js +14 -0
- package/lib/host/controller/_trace.js.map +1 -0
- package/lib/host/controller/bridge-run.d.ts +4 -2
- package/lib/host/controller/bridge-run.d.ts.map +1 -1
- package/lib/host/controller/bridge-run.js +24 -8
- package/lib/host/controller/bridge-run.js.map +1 -1
- package/lib/host/controller/captures.d.ts +9 -16
- package/lib/host/controller/captures.d.ts.map +1 -1
- package/lib/host/controller/captures.js +73 -48
- package/lib/host/controller/captures.js.map +1 -1
- package/lib/host/controller/commits.d.ts +2 -2
- package/lib/host/controller/commits.d.ts.map +1 -1
- package/lib/host/controller/commits.js +97 -41
- package/lib/host/controller/commits.js.map +1 -1
- package/lib/host/controller/connections.d.ts +38 -0
- package/lib/host/controller/connections.d.ts.map +1 -0
- package/lib/host/controller/connections.js +71 -0
- package/lib/host/controller/connections.js.map +1 -0
- package/lib/host/controller/controller.d.ts +19 -24
- package/lib/host/controller/controller.d.ts.map +1 -1
- package/lib/host/controller/controller.js +181 -114
- package/lib/host/controller/controller.js.map +1 -1
- package/lib/host/controller/index.d.ts +18 -14
- package/lib/host/controller/index.d.ts.map +1 -1
- package/lib/host/controller/index.js +16 -14
- package/lib/host/controller/index.js.map +1 -1
- package/lib/host/controller/notes.d.ts +9 -9
- package/lib/host/controller/notes.d.ts.map +1 -1
- package/lib/host/controller/notes.js +16 -21
- package/lib/host/controller/notes.js.map +1 -1
- package/lib/host/controller/persist.d.ts +10 -3
- package/lib/host/controller/persist.d.ts.map +1 -1
- package/lib/host/controller/persist.js +89 -42
- package/lib/host/controller/persist.js.map +1 -1
- package/lib/host/controller/publish.d.ts +4 -0
- package/lib/host/controller/publish.d.ts.map +1 -0
- package/lib/host/controller/publish.js +56 -0
- package/lib/host/controller/publish.js.map +1 -0
- package/lib/host/controller/runs.d.ts +34 -10
- package/lib/host/controller/runs.d.ts.map +1 -1
- package/lib/host/controller/runs.js +241 -58
- package/lib/host/controller/runs.js.map +1 -1
- package/lib/host/controller/state.d.ts +122 -20
- package/lib/host/controller/state.d.ts.map +1 -1
- package/lib/host/controller/windows-run.d.ts +10 -2
- package/lib/host/controller/windows-run.d.ts.map +1 -1
- package/lib/host/controller/windows-run.js +66 -35
- package/lib/host/controller/windows-run.js.map +1 -1
- package/lib/host/discovery/candidates.d.ts +23 -13
- package/lib/host/discovery/candidates.d.ts.map +1 -1
- package/lib/host/discovery/candidates.js +20 -8
- package/lib/host/discovery/candidates.js.map +1 -1
- package/lib/host/discovery/index.d.ts +1 -0
- package/lib/host/discovery/index.d.ts.map +1 -1
- package/lib/host/discovery/index.js +1 -0
- package/lib/host/discovery/index.js.map +1 -1
- package/lib/host/discovery/probe.d.ts +16 -5
- package/lib/host/discovery/probe.d.ts.map +1 -1
- package/lib/host/discovery/probe.js +68 -10
- package/lib/host/discovery/probe.js.map +1 -1
- package/lib/host/discovery/scan.d.ts +14 -9
- package/lib/host/discovery/scan.d.ts.map +1 -1
- package/lib/host/discovery/scan.js +56 -30
- package/lib/host/discovery/scan.js.map +1 -1
- package/lib/host/flags.d.ts +28 -5
- package/lib/host/flags.d.ts.map +1 -1
- package/lib/host/flags.js +75 -7
- package/lib/host/flags.js.map +1 -1
- package/lib/host/kind.d.ts +45 -0
- package/lib/host/kind.d.ts.map +1 -0
- package/lib/host/kind.js +251 -0
- package/lib/host/kind.js.map +1 -0
- package/lib/host/manager.d.ts +21 -0
- package/lib/host/manager.d.ts.map +1 -0
- package/lib/host/manager.js +113 -0
- package/lib/host/manager.js.map +1 -0
- package/lib/host/migration.d.ts +26 -0
- package/lib/host/migration.d.ts.map +1 -0
- package/lib/host/migration.js +127 -0
- package/lib/host/migration.js.map +1 -0
- package/lib/host/plugin-meta.d.ts +12 -3
- package/lib/host/plugin-meta.d.ts.map +1 -1
- package/lib/host/plugin-meta.js +13 -4
- package/lib/host/plugin-meta.js.map +1 -1
- package/lib/host/schema.d.ts +301 -247
- package/lib/host/schema.d.ts.map +1 -1
- package/lib/host/schema.js +145 -120
- package/lib/host/schema.js.map +1 -1
- package/lib/host/settings.d.ts +22 -3
- package/lib/host/settings.d.ts.map +1 -1
- package/lib/host/settings.js +81 -60
- package/lib/host/settings.js.map +1 -1
- package/lib/host/status.d.ts +7 -10
- package/lib/host/status.d.ts.map +1 -1
- package/lib/host/status.js +8 -23
- package/lib/host/status.js.map +1 -1
- package/lib/host/tool.d.ts +13 -7
- package/lib/host/tool.d.ts.map +1 -1
- package/lib/host/tool.js +4 -3
- package/lib/host/tool.js.map +1 -1
- package/lib/host/types/config.d.ts +66 -12
- package/lib/host/types/config.d.ts.map +1 -1
- package/lib/host/types/executable.d.ts +8 -3
- package/lib/host/types/executable.d.ts.map +1 -1
- package/lib/host/types/index.d.ts +5 -4
- package/lib/host/types/index.d.ts.map +1 -1
- package/lib/host/types/services.d.ts +26 -0
- package/lib/host/types/services.d.ts.map +1 -0
- package/lib/host/types/services.js +9 -0
- package/lib/host/types/services.js.map +1 -0
- package/lib/host/types/settings.d.ts +118 -65
- package/lib/host/types/settings.d.ts.map +1 -1
- package/lib/host/types/stderr.d.ts +3 -5
- package/lib/host/types/stderr.d.ts.map +1 -1
- package/lib/host/values.d.ts +152 -37
- package/lib/host/values.d.ts.map +1 -1
- package/lib/host/values.js +304 -112
- package/lib/host/values.js.map +1 -1
- package/lib/host/windows/connect-flags.d.ts +19 -8
- package/lib/host/windows/connect-flags.d.ts.map +1 -1
- package/lib/host/windows/connect-flags.js +50 -20
- package/lib/host/windows/connect-flags.js.map +1 -1
- package/lib/host/windows/index.d.ts +1 -1
- package/lib/host/windows/index.d.ts.map +1 -1
- package/lib/host/windows/index.js +1 -1
- package/lib/host/windows/index.js.map +1 -1
- package/lib/host/windows/paths.d.ts +27 -6
- package/lib/host/windows/paths.d.ts.map +1 -1
- package/lib/host/windows/paths.js +40 -13
- package/lib/host/windows/paths.js.map +1 -1
- package/lib/host/windows/run.d.ts.map +1 -1
- package/lib/host/windows/run.js +3 -2
- package/lib/host/windows/run.js.map +1 -1
- package/lib/index.d.ts +72 -56
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +74 -55
- package/lib/index.js.map +1 -1
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +35 -14
- package/cordis.patch.yml +0 -5
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function createChromeRefreshCommand(controller) {
|
|
2
|
+
return {
|
|
3
|
+
name: "chrome-refresh",
|
|
4
|
+
description: "Re-run Chrome executable discovery and merge what exists into the saved rows",
|
|
5
|
+
input: { hint: "(no arguments)" },
|
|
6
|
+
async handler() {
|
|
7
|
+
const live = controller.live;
|
|
8
|
+
const before = live.executableDiscoveryRevision;
|
|
9
|
+
try {
|
|
10
|
+
await controller.run();
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
return { kind: "error", text: `The executable run failed: ${String(error instanceof Error ? error.message : error)}` };
|
|
14
|
+
}
|
|
15
|
+
if (live.executableDiscoveryRevision === before) {
|
|
16
|
+
return { kind: "error", text: "The executable run did not complete." };
|
|
17
|
+
}
|
|
18
|
+
const statuses = live.executableStatus;
|
|
19
|
+
const found = statuses.filter((status) => status.version !== "");
|
|
20
|
+
const failed = statuses.filter((status) => status.error !== "");
|
|
21
|
+
const blocked = statuses.filter((status) => status.note !== "" && status.version === "" && status.error === "");
|
|
22
|
+
const lines = [`Executable run: ${found.length} runnable, ${failed.length} failed, ${blocked.length} offered-but-never-probed. Found paths merge into the saved rows.`];
|
|
23
|
+
for (const status of statuses) {
|
|
24
|
+
const answer = status.version !== "" ? status.version : status.error !== "" ? `failed: ${status.error}` : status.note;
|
|
25
|
+
lines.push(` - ${status.path}: ${answer}`);
|
|
26
|
+
}
|
|
27
|
+
// A discovery that found nothing runnable is a failed run reported
|
|
28
|
+
// the way the card reports it — through the error line it carries.
|
|
29
|
+
if (found.length === 0 && live.lastError !== "")
|
|
30
|
+
return { kind: "error", text: `${lines.join("\n")}\n${live.lastError}` };
|
|
31
|
+
if (live.lastError !== "")
|
|
32
|
+
lines.push(`Note: ${live.lastError}`);
|
|
33
|
+
return { kind: "success", text: lines.join("\n") };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=chrome-refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-refresh.js","sourceRoot":"","sources":["../../../src/host/commands/chrome-refresh.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,0BAA0B,CAAC,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c,MAAM,CAAC,MAAM,YAAY,OAAO,CAAC,MAAM,mEAAmE,CAAC,CAAC;YACxK,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;gBAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBACtH,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;YAChD,CAAC;YACD,mEAAmE;YACnE,mEAAmE;YACnE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,SAAS,KAAK,EAAE;gBAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YAC1H,IAAI,IAAI,CAAC,SAAS,KAAK,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YACjE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash commands — the headless mirror of the card's two executable actions.
|
|
3
|
+
*
|
|
4
|
+
* The Web card is the primary surface, but a host with no GUI (or a user in an
|
|
5
|
+
* agent conversation) gets the same two actions: `/chrome-path` picks the
|
|
6
|
+
* executable and `/chrome-refresh` re-runs the discovery, both writing the SAME
|
|
7
|
+
* persisted fields through the SAME write-back channel as the card, so the pill,
|
|
8
|
+
* the command and the default answers never disagree.
|
|
9
|
+
*
|
|
10
|
+
* Registration rides the `commands` service lazily for the same reason the
|
|
11
|
+
* MCP tool avoids a static injection: the service may resolve only after
|
|
12
|
+
* `apply` returns, and a host without a commands plane simply gets no
|
|
13
|
+
* registration. Every `register()` disposer is retained so a hot re-apply of
|
|
14
|
+
* this plugin releases them — the registry throws on a duplicate name.
|
|
15
|
+
*/
|
|
16
|
+
import type { ChromeMcpController } from "../controller/index.js";
|
|
17
|
+
import type { ChromeMcpConfig, PluginContext } from "../types/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* Register this plugin's commands on the `commands` service.
|
|
20
|
+
*
|
|
21
|
+
* @param ctx - plugin context.
|
|
22
|
+
* @param config - the validated row config (only the log prefix reads it).
|
|
23
|
+
* @param controller - the live state the commands drive through.
|
|
24
|
+
*/
|
|
25
|
+
export declare function installChromeMcpCommands(ctx: PluginContext, config: ChromeMcpConfig, controller: ChromeMcpController): void;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/host/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAU3F;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,GAAG,IAAI,CA0B3H"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createChromePathCommand } from "./chrome-path.js";
|
|
2
|
+
import { createChromeRefreshCommand } from "./chrome-refresh.js";
|
|
3
|
+
/**
|
|
4
|
+
* Register this plugin's commands on the `commands` service.
|
|
5
|
+
*
|
|
6
|
+
* @param ctx - plugin context.
|
|
7
|
+
* @param config - the validated row config (only the log prefix reads it).
|
|
8
|
+
* @param controller - the live state the commands drive through.
|
|
9
|
+
*/
|
|
10
|
+
export function installChromeMcpCommands(ctx, config, controller) {
|
|
11
|
+
ctx.effect(() => {
|
|
12
|
+
const commandDisposers = [];
|
|
13
|
+
let registered = false;
|
|
14
|
+
ctx.inject(["commands"], (inner) => {
|
|
15
|
+
if (registered)
|
|
16
|
+
return;
|
|
17
|
+
const commands = inner.commands;
|
|
18
|
+
// A host without a commands plane answers this half with nothing.
|
|
19
|
+
if (commands === undefined)
|
|
20
|
+
return;
|
|
21
|
+
registered = true;
|
|
22
|
+
for (const definition of [createChromePathCommand(controller), createChromeRefreshCommand(controller)]) {
|
|
23
|
+
// The registry throws on a duplicate name — a re-apply racing a
|
|
24
|
+
// still-live registration. The earlier definitions stay live, so
|
|
25
|
+
// a warning beats breaking `apply`.
|
|
26
|
+
try {
|
|
27
|
+
commandDisposers.push(commands.register(definition));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
ctx.logger.warn(`dsh-chrome-mcp(${config.serverName}): command "${definition.name}" registration skipped: ${String(error)}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return () => {
|
|
35
|
+
for (const dispose of commandDisposers.splice(0))
|
|
36
|
+
dispose();
|
|
37
|
+
registered = false;
|
|
38
|
+
};
|
|
39
|
+
}, "chrome-mcp: slash commands");
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/host/commands/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAQjE;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAkB,EAAE,MAAuB,EAAE,U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a public contract — the
|
|
5
|
-
* persistence key and the Web card's
|
|
6
|
-
* README and the tests quote, so they live here once and every
|
|
7
|
-
* rather than repeats them.
|
|
4
|
+
* The strings are a public contract — the profile entry id is both the
|
|
5
|
+
* persistence key and the Web card's configuration-form key — and the budgets
|
|
6
|
+
* are what the README and the tests quote, so they live here once and every
|
|
7
|
+
* module imports rather than repeats them.
|
|
8
8
|
*/
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The profile entry id the bundle patch inserts (`cordis.patch.yml`), and the
|
|
11
|
+
* key every read and write of the configuration form goes through. Since dsh
|
|
12
|
+
* 0.2.0 the card addresses the Host through the **entry id**, not a namespace of
|
|
13
|
+
* its own, and `serverName` is not part of that identity. The Host reads the
|
|
14
|
+
* live id off its own fiber (`chromeMcpEntryId`) so a renamed row keeps
|
|
15
|
+
* working; this constant is what the loud failure and the log lines name.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ENTRY_ID = "mcp-chrome";
|
|
11
18
|
/** Environment variable that seeds the launch flags for one dsh run. */
|
|
12
19
|
export declare const FLAGS_ENV_VAR = "DSH_CHROME_MCP_FLAGS";
|
|
13
20
|
/**
|
|
14
21
|
* Flag entries are appended verbatim to the bridge argv and reach Chrome via
|
|
15
22
|
* a direct execve (no shell), so shell metacharacters cannot execute here.
|
|
16
23
|
* What must never reach argv is control characters (newlines, NULs) — they
|
|
17
|
-
* corrupt the argument framing, so entries may not contain any.
|
|
24
|
+
* corrupt the argument framing, so entries may not contain any. This is the
|
|
25
|
+
* `extraFlags` field's own pattern: a form write naming a control character is
|
|
26
|
+
* refused Host-side, by the schema rather than by a `validate` hook.
|
|
18
27
|
*/
|
|
19
28
|
export declare const CONTROL_PATTERN: RegExp;
|
|
29
|
+
/**
|
|
30
|
+
* One `extraFlags` entry as a form write may land it: non-empty, and no control
|
|
31
|
+
* character. This is the field's own pattern, so the gate that refuses them is
|
|
32
|
+
* the **schema**, not a `validate` hook — the write path runs it Host-side, on
|
|
33
|
+
* every layer (a row config carrying a newline fails to resolve rather than
|
|
34
|
+
* reaching argv as a corrupt entry). Spaces inside a value stay allowed: a
|
|
35
|
+
* Windows-style path in a flag value is one argv item, never a shell word (see
|
|
36
|
+
* ./flags.ts `validateExtraFlags` for what the paths the form never edits —
|
|
37
|
+
* `DSH_CHROME_MCP_FLAGS`, the row config — still check).
|
|
38
|
+
*/
|
|
39
|
+
export declare const EXTRA_FLAG_PATTERN: RegExp;
|
|
20
40
|
/** Flags every launch carries unless the user overrides them. */
|
|
21
41
|
export declare const DEFAULT_EXTRA_FLAGS: string[];
|
|
22
42
|
/**
|
|
@@ -46,17 +66,39 @@ export declare const CONFIGURATION_DOCS_URL = "https://github.com/ChromeDevTools
|
|
|
46
66
|
/** Timeout for one check subprocess (chrome executable probe). */
|
|
47
67
|
export declare const CHECK_TIMEOUT_MS = 15000;
|
|
48
68
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
* What a Windows executable answers when no version folder sits beside it. On
|
|
70
|
+
* Windows a Chromium browser does not answer `--version`: it opens a window
|
|
71
|
+
* (or hands one to the instance already running), so it is never spawned to
|
|
72
|
+
* ask — the version is read off the install's own `<major>.<minor>.<build>.<patch>`
|
|
73
|
+
* folder instead, and an install without one answers this.
|
|
74
|
+
*/
|
|
75
|
+
export declare const WINDOWS_VERSION_UNKNOWN = "version unknown";
|
|
76
|
+
/**
|
|
77
|
+
* How long a failed executable run waits before its one bounded retry. The
|
|
78
|
+
* failure this answers is not "nothing is installed here" — it is a host that
|
|
79
|
+
* is not ready yet at the moment the run fires (a WSL boot whose interop
|
|
80
|
+
* mount has not been served yet, a drive not yet mounted). Without the retry
|
|
81
|
+
* that answer would stand until someone fired the run again by hand.
|
|
82
|
+
*/
|
|
83
|
+
export declare const DISCOVERY_RETRY_DELAY_MS = 15000;
|
|
84
|
+
/** How many retries one run chain may arm. Bounded so a machine with nothing
|
|
85
|
+
* installed is never probed forever — four passes span a boot window, and the
|
|
86
|
+
* manual trigger stays the answer beyond it. */
|
|
87
|
+
export declare const DISCOVERY_RETRY_MAX = 4;
|
|
88
|
+
/**
|
|
89
|
+
* Why a Windows `chrome.exe` on a WSL host is **never probed** — and, since the
|
|
90
|
+
* Windows executables this host carries *are* offered as candidates, what such a
|
|
91
|
+
* candidate reads as instead of a failure. The exec answers successfully — which
|
|
92
|
+
* is what makes the selection look healthy — but answering means *attaching to
|
|
93
|
+
* the Windows browser session*, and that brings a browser instance up (measured
|
|
94
|
+
* on WSL2 + Google Chrome 153: `chrome.exe --version` spawns the browser process
|
|
95
|
+
* plus its crashpad handler). No tool call could ever drive what it started (the
|
|
96
|
+
* debug pipes do not cross the interop boundary), so the probe buys nothing and
|
|
97
|
+
* costs a running browser: the check answers nothing, and the scan keeps the
|
|
98
|
+
* entry visible carrying this reason — as its **note**, never as a failure,
|
|
99
|
+
* because the **Prelaunch Windows Chrome** run drives it in connect mode.
|
|
100
|
+
*/
|
|
101
|
+
export declare const WSL_WINDOWS_LAUNCH_ERROR = "Windows chrome.exe cannot be launched from WSL \u2014 run Prelaunch Windows Chrome to drive it in connect mode";
|
|
60
102
|
/** Max length of a reported error line. */
|
|
61
103
|
export declare const ERROR_CAP = 240;
|
|
62
104
|
/**
|
|
@@ -79,17 +121,51 @@ export declare const STDERR_MODE_FIELD_PATTERN: RegExp;
|
|
|
79
121
|
* POSIX absolute path; nothing else. */
|
|
80
122
|
export declare const OPTIONAL_PATH_PATTERN: RegExp;
|
|
81
123
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
124
|
+
* The connection kinds this component registers with the manager's
|
|
125
|
+
* `mcpConnections` service. They are the
|
|
126
|
+
* component: the row stands up no bridge of its own any more, every live bridge
|
|
127
|
+
* is one of these connections.
|
|
128
|
+
*
|
|
129
|
+
* `chrome` — the local `chrome-devtools-mcp` bridge, what the row used to start
|
|
130
|
+
* for itself. `chrome-windows` — the Windows browser driven through the WSL
|
|
131
|
+
* interop mount (the run the **Prelaunch Windows Chrome** button answers with),
|
|
132
|
+
* async to launch. The ids are the contract with `servers` entries; the labels
|
|
133
|
+
* are what the picker lists. Neither kind caps its entries and neither carries
|
|
134
|
+
* a composer pill.
|
|
135
|
+
*/
|
|
136
|
+
export declare const KIND_ID_CHROME = "chrome";
|
|
137
|
+
export declare const KIND_ID_WINDOWS = "chrome-windows";
|
|
138
|
+
export declare const KIND_CHROME_LABEL = "Chrome MCP";
|
|
139
|
+
export declare const KIND_CHROME_SUMMARY = "Runs `chrome-devtools-mcp` and launches a local Chrome. The executable and the flags are picked on the connection.";
|
|
140
|
+
export declare const KIND_WINDOWS_LABEL = "Windows Chrome (WSL debug port)";
|
|
141
|
+
export declare const KIND_WINDOWS_SUMMARY = "Opens the Windows Chrome through the WSL interop mount and connects to its debugging port. WSL only.";
|
|
142
|
+
/**
|
|
143
|
+
* The keys one entry's `extra` carries for these kinds. They are a contract with
|
|
144
|
+
* the manager's entry editor: what the fields write is exactly what `resolve`
|
|
145
|
+
* reads back. `extraFlags` is a `lines` field, so its value is one flag per
|
|
146
|
+
* line joined by newlines (see ./kind.ts `parseFlagLines`).
|
|
147
|
+
*/
|
|
148
|
+
export declare const KIND_FIELDS: {
|
|
149
|
+
readonly executable: "executable";
|
|
150
|
+
readonly extraFlags: "extraFlags";
|
|
151
|
+
readonly stderrMode: "stderrMode";
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Whether the translation of a **standalone** row config has been offered and
|
|
155
|
+
* turned down. It is a volatile field of this
|
|
156
|
+
* row — what was refused is this row's configuration, so the dismissal lives
|
|
157
|
+
* here and nowhere else.
|
|
86
158
|
*/
|
|
87
|
-
export declare const
|
|
159
|
+
export declare const MIGRATION_DISMISSED_FIELD = "migrationDismissed";
|
|
160
|
+
/** One entry's extra flag lines joined the way a `lines` field stores them. */
|
|
161
|
+
export declare const FLAG_LINE_SEPARATOR = "\n";
|
|
162
|
+
/** Why the `chrome-windows` kind refuses an entry off WSL (spec §2: not-applicable). */
|
|
163
|
+
export declare const NOT_WSL_ERROR = "This host is not a WSL instance: there is no Windows-side browser to drive \u2014 use the Chrome MCP kind instead";
|
|
88
164
|
/**
|
|
89
165
|
* `chromePath` user layer: a filesystem path or a PATH-resolved name. Nothing
|
|
90
166
|
* travels through a shell here either, so the only hard constraint is that no
|
|
91
167
|
* control character reaches it; the length cap keeps one absurd value out of
|
|
92
|
-
* argv and out of the
|
|
168
|
+
* argv and out of the row's own patch layer.
|
|
93
169
|
*/
|
|
94
170
|
export declare const CHROME_PATH_PATTERN: RegExp;
|
|
95
171
|
/** Upper bound of the **legacy** UI-authored custom-executable MRU (oldest
|
|
@@ -107,12 +183,13 @@ export declare const CATALOG_NAME_MAX_LENGTH = 200;
|
|
|
107
183
|
* catalog without limit. */
|
|
108
184
|
export declare const CATALOG_MAX_LENGTH = 50;
|
|
109
185
|
/**
|
|
110
|
-
* The Windows-side Chrome/Edge executables
|
|
111
|
-
* button locates through
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
186
|
+
* The Windows-side Chrome/Edge executables this host carries. The
|
|
187
|
+
* **Prelaunch Windows Chrome** button locates through them, and — on a WSL host
|
|
188
|
+
* only — the executable run folds the ones this machine actually carries into its
|
|
189
|
+
* candidate list, so the picker can name the executable the run drives. They are
|
|
190
|
+
* never *probed* from here (`WSL_WINDOWS_LAUNCH_ERROR`): the run drives them in
|
|
191
|
+
* *connect* mode, which is the only Windows path ever measured to work. The list
|
|
192
|
+
* is host-served logic: the card carries no copy of it.
|
|
116
193
|
*/
|
|
117
194
|
export declare const WINDOWS_CHROME_CANDIDATES: readonly ["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe", "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"];
|
|
118
195
|
/** The debugging port every Windows Chrome launch carries first — kept
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/host/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/host/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,wEAAwE;AACxE,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QAAqB,CAAC;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,QAA6B,CAAC;AAE7D,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,UAAqD,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,UAA+C,CAAC;AAE5E,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,0FACwD,CAAC;AAE5F,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAE9C;;gDAEgD;AAChD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,mHAC0E,CAAC;AAEhH,2CAA2C;AAC3C,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAqC,CAAC;AAErE,qEAAqE;AACrE,eAAO,MAAM,UAAU,+DAAgE,CAAC;AAExF;;;;GAIG;AACH,eA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F;AACjF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAEzD,iEAAiE;AACjE,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAE/D,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,2DAA4D,CAAC;AAExG;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,yCAAyC,CAAC;AAEnF;;yDAEyD;AACzD,eAAO,MAAM,+BAA+B,cAAc,CAAC;AAE3D;;;6EAG6E;AAC7E,eAAO,MAAM,qBAAqB,2GAQxB,CAAC;AAEX,sDAAsD;AACtD,eAAO,MAAM,4BAA4B,QAAsF,CAAC;AAEhI;;;GAGG;AACH,eAAO,MAAM,2BAA2B,mKAC4H,CAAC;AAErK;;iDAEiD;AACjD,eAAO,MAAM,iBAAiB,qCAAsC,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,YAAY,iEAAkE,CAAC;AAE5F;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,wCAAwC,CAAC;AAExE;iDACiD;AACjD,eAAO,MAAM,oBAAoB,QAAoD,CAAC;AAEtF;iFACiF;AACjF,eAAO,MAAM,mBAAmB,QAAa,CAAC;AAE9C,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,QAAgC,CAAC"}
|
package/lib/host/constants.js
CHANGED
|
@@ -1,22 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Host-half fixed identifiers, budgets and validation patterns.
|
|
3
3
|
*
|
|
4
|
-
* The strings are a public contract — the
|
|
5
|
-
* persistence key and the Web card's
|
|
6
|
-
* README and the tests quote, so they live here once and every
|
|
7
|
-
* rather than repeats them.
|
|
4
|
+
* The strings are a public contract — the profile entry id is both the
|
|
5
|
+
* persistence key and the Web card's configuration-form key — and the budgets
|
|
6
|
+
* are what the README and the tests quote, so they live here once and every
|
|
7
|
+
* module imports rather than repeats them.
|
|
8
8
|
*/
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The profile entry id the bundle patch inserts (`cordis.patch.yml`), and the
|
|
11
|
+
* key every read and write of the configuration form goes through. Since dsh
|
|
12
|
+
* 0.2.0 the card addresses the Host through the **entry id**, not a namespace of
|
|
13
|
+
* its own, and `serverName` is not part of that identity. The Host reads the
|
|
14
|
+
* live id off its own fiber (`chromeMcpEntryId`) so a renamed row keeps
|
|
15
|
+
* working; this constant is what the loud failure and the log lines name.
|
|
16
|
+
*/
|
|
17
|
+
export const ENTRY_ID = "mcp-chrome";
|
|
11
18
|
/** Environment variable that seeds the launch flags for one dsh run. */
|
|
12
19
|
export const FLAGS_ENV_VAR = "DSH_CHROME_MCP_FLAGS";
|
|
13
20
|
/**
|
|
14
21
|
* Flag entries are appended verbatim to the bridge argv and reach Chrome via
|
|
15
22
|
* a direct execve (no shell), so shell metacharacters cannot execute here.
|
|
16
23
|
* What must never reach argv is control characters (newlines, NULs) — they
|
|
17
|
-
* corrupt the argument framing, so entries may not contain any.
|
|
24
|
+
* corrupt the argument framing, so entries may not contain any. This is the
|
|
25
|
+
* `extraFlags` field's own pattern: a form write naming a control character is
|
|
26
|
+
* refused Host-side, by the schema rather than by a `validate` hook.
|
|
18
27
|
*/
|
|
19
28
|
export const CONTROL_PATTERN = /[\x00-\x1f\x7f]/u;
|
|
29
|
+
/**
|
|
30
|
+
* One `extraFlags` entry as a form write may land it: non-empty, and no control
|
|
31
|
+
* character. This is the field's own pattern, so the gate that refuses them is
|
|
32
|
+
* the **schema**, not a `validate` hook — the write path runs it Host-side, on
|
|
33
|
+
* every layer (a row config carrying a newline fails to resolve rather than
|
|
34
|
+
* reaching argv as a corrupt entry). Spaces inside a value stay allowed: a
|
|
35
|
+
* Windows-style path in a flag value is one argv item, never a shell word (see
|
|
36
|
+
* ./flags.ts `validateExtraFlags` for what the paths the form never edits —
|
|
37
|
+
* `DSH_CHROME_MCP_FLAGS`, the row config — still check).
|
|
38
|
+
*/
|
|
39
|
+
export const EXTRA_FLAG_PATTERN = /^(?:[^\x00-\x1f\x7f]+)$/u;
|
|
20
40
|
/** Flags every launch carries unless the user overrides them. */
|
|
21
41
|
export const DEFAULT_EXTRA_FLAGS = ["--no-usage-statistics", "--no-performance-crux"];
|
|
22
42
|
/**
|
|
@@ -46,17 +66,39 @@ export const CONFIGURATION_DOCS_URL = "https://github.com/ChromeDevTools/chrome-
|
|
|
46
66
|
/** Timeout for one check subprocess (chrome executable probe). */
|
|
47
67
|
export const CHECK_TIMEOUT_MS = 15000;
|
|
48
68
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
* What a Windows executable answers when no version folder sits beside it. On
|
|
70
|
+
* Windows a Chromium browser does not answer `--version`: it opens a window
|
|
71
|
+
* (or hands one to the instance already running), so it is never spawned to
|
|
72
|
+
* ask — the version is read off the install's own `<major>.<minor>.<build>.<patch>`
|
|
73
|
+
* folder instead, and an install without one answers this.
|
|
74
|
+
*/
|
|
75
|
+
export const WINDOWS_VERSION_UNKNOWN = "version unknown";
|
|
76
|
+
/**
|
|
77
|
+
* How long a failed executable run waits before its one bounded retry. The
|
|
78
|
+
* failure this answers is not "nothing is installed here" — it is a host that
|
|
79
|
+
* is not ready yet at the moment the run fires (a WSL boot whose interop
|
|
80
|
+
* mount has not been served yet, a drive not yet mounted). Without the retry
|
|
81
|
+
* that answer would stand until someone fired the run again by hand.
|
|
82
|
+
*/
|
|
83
|
+
export const DISCOVERY_RETRY_DELAY_MS = 15000;
|
|
84
|
+
/** How many retries one run chain may arm. Bounded so a machine with nothing
|
|
85
|
+
* installed is never probed forever — four passes span a boot window, and the
|
|
86
|
+
* manual trigger stays the answer beyond it. */
|
|
87
|
+
export const DISCOVERY_RETRY_MAX = 4;
|
|
88
|
+
/**
|
|
89
|
+
* Why a Windows `chrome.exe` on a WSL host is **never probed** — and, since the
|
|
90
|
+
* Windows executables this host carries *are* offered as candidates, what such a
|
|
91
|
+
* candidate reads as instead of a failure. The exec answers successfully — which
|
|
92
|
+
* is what makes the selection look healthy — but answering means *attaching to
|
|
93
|
+
* the Windows browser session*, and that brings a browser instance up (measured
|
|
94
|
+
* on WSL2 + Google Chrome 153: `chrome.exe --version` spawns the browser process
|
|
95
|
+
* plus its crashpad handler). No tool call could ever drive what it started (the
|
|
96
|
+
* debug pipes do not cross the interop boundary), so the probe buys nothing and
|
|
97
|
+
* costs a running browser: the check answers nothing, and the scan keeps the
|
|
98
|
+
* entry visible carrying this reason — as its **note**, never as a failure,
|
|
99
|
+
* because the **Prelaunch Windows Chrome** run drives it in connect mode.
|
|
100
|
+
*/
|
|
101
|
+
export const WSL_WINDOWS_LAUNCH_ERROR = "Windows chrome.exe cannot be launched from WSL — run Prelaunch Windows Chrome to drive it in connect mode";
|
|
60
102
|
/** Max length of a reported error line. */
|
|
61
103
|
export const ERROR_CAP = 240;
|
|
62
104
|
/**
|
|
@@ -79,17 +121,51 @@ export const STDERR_MODE_FIELD_PATTERN = /^(?:log|console)?$/u;
|
|
|
79
121
|
* POSIX absolute path; nothing else. */
|
|
80
122
|
export const OPTIONAL_PATH_PATTERN = /^(?:\/[^\x00-\x1f\x7f]*|)$/u;
|
|
81
123
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
124
|
+
* The connection kinds this component registers with the manager's
|
|
125
|
+
* `mcpConnections` service. They are the
|
|
126
|
+
* component: the row stands up no bridge of its own any more, every live bridge
|
|
127
|
+
* is one of these connections.
|
|
128
|
+
*
|
|
129
|
+
* `chrome` — the local `chrome-devtools-mcp` bridge, what the row used to start
|
|
130
|
+
* for itself. `chrome-windows` — the Windows browser driven through the WSL
|
|
131
|
+
* interop mount (the run the **Prelaunch Windows Chrome** button answers with),
|
|
132
|
+
* async to launch. The ids are the contract with `servers` entries; the labels
|
|
133
|
+
* are what the picker lists. Neither kind caps its entries and neither carries
|
|
134
|
+
* a composer pill.
|
|
135
|
+
*/
|
|
136
|
+
export const KIND_ID_CHROME = "chrome";
|
|
137
|
+
export const KIND_ID_WINDOWS = "chrome-windows";
|
|
138
|
+
export const KIND_CHROME_LABEL = "Chrome MCP";
|
|
139
|
+
export const KIND_CHROME_SUMMARY = "Runs `chrome-devtools-mcp` and launches a local Chrome. The executable and the flags are picked on the connection.";
|
|
140
|
+
export const KIND_WINDOWS_LABEL = "Windows Chrome (WSL debug port)";
|
|
141
|
+
export const KIND_WINDOWS_SUMMARY = "Opens the Windows Chrome through the WSL interop mount and connects to its debugging port. WSL only.";
|
|
142
|
+
/**
|
|
143
|
+
* The keys one entry's `extra` carries for these kinds. They are a contract with
|
|
144
|
+
* the manager's entry editor: what the fields write is exactly what `resolve`
|
|
145
|
+
* reads back. `extraFlags` is a `lines` field, so its value is one flag per
|
|
146
|
+
* line joined by newlines (see ./kind.ts `parseFlagLines`).
|
|
147
|
+
*/
|
|
148
|
+
export const KIND_FIELDS = {
|
|
149
|
+
executable: "executable",
|
|
150
|
+
extraFlags: "extraFlags",
|
|
151
|
+
stderrMode: "stderrMode"
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Whether the translation of a **standalone** row config has been offered and
|
|
155
|
+
* turned down. It is a volatile field of this
|
|
156
|
+
* row — what was refused is this row's configuration, so the dismissal lives
|
|
157
|
+
* here and nowhere else.
|
|
86
158
|
*/
|
|
87
|
-
export const
|
|
159
|
+
export const MIGRATION_DISMISSED_FIELD = "migrationDismissed";
|
|
160
|
+
/** One entry's extra flag lines joined the way a `lines` field stores them. */
|
|
161
|
+
export const FLAG_LINE_SEPARATOR = "\n";
|
|
162
|
+
/** Why the `chrome-windows` kind refuses an entry off WSL (spec §2: not-applicable). */
|
|
163
|
+
export const NOT_WSL_ERROR = "This host is not a WSL instance: there is no Windows-side browser to drive — use the Chrome MCP kind instead";
|
|
88
164
|
/**
|
|
89
165
|
* `chromePath` user layer: a filesystem path or a PATH-resolved name. Nothing
|
|
90
166
|
* travels through a shell here either, so the only hard constraint is that no
|
|
91
167
|
* control character reaches it; the length cap keeps one absurd value out of
|
|
92
|
-
* argv and out of the
|
|
168
|
+
* argv and out of the row's own patch layer.
|
|
93
169
|
*/
|
|
94
170
|
export const CHROME_PATH_PATTERN = /^[^\x00-\x1f\x7f]{0,4096}$/u;
|
|
95
171
|
/** Upper bound of the **legacy** UI-authored custom-executable MRU (oldest
|
|
@@ -107,12 +183,13 @@ export const CATALOG_NAME_MAX_LENGTH = 200;
|
|
|
107
183
|
* catalog without limit. */
|
|
108
184
|
export const CATALOG_MAX_LENGTH = 50;
|
|
109
185
|
/**
|
|
110
|
-
* The Windows-side Chrome/Edge executables
|
|
111
|
-
* button locates through
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
186
|
+
* The Windows-side Chrome/Edge executables this host carries. The
|
|
187
|
+
* **Prelaunch Windows Chrome** button locates through them, and — on a WSL host
|
|
188
|
+
* only — the executable run folds the ones this machine actually carries into its
|
|
189
|
+
* candidate list, so the picker can name the executable the run drives. They are
|
|
190
|
+
* never *probed* from here (`WSL_WINDOWS_LAUNCH_ERROR`): the run drives them in
|
|
191
|
+
* *connect* mode, which is the only Windows path ever measured to work. The list
|
|
192
|
+
* is host-served logic: the card carries no copy of it.
|
|
116
193
|
*/
|
|
117
194
|
export const WINDOWS_CHROME_CANDIDATES = [
|
|
118
195
|
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/host/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH
|
|
1
|
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AAC,MAAM,4BAA4B,GAAG,mFAAmF,CAAC;AAEhI;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACpC,gKAAgK,CAAC;AAErK;;iDAEiD;AACjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,YAAY,CAAU,CAAC;AAErE;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,CAAU,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,qCAAqC,CAAC;AAExE;iDACiD;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,iDAAiD,CAAC;AAEtF;iFACiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAE9C,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_trace.d.ts","sourceRoot":"","sources":["../../../src/host/controller/_trace.ts"],"names":[],"mappings":"AAMA,2EAA2E;AAC3E,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAM1D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// TEMPORARY diagnostic: append one JSON line per traced event to a scratch
|
|
2
|
+
// log so a live reproduction can be inspected without a browser console.
|
|
3
|
+
import { appendFileSync } from "node:fs";
|
|
4
|
+
const PATH = "/tmp/dsh-chrome-home/plugin-trace.log";
|
|
5
|
+
/** Trace one event. Never throws: diagnostics must not change behavior. */
|
|
6
|
+
export function trace(event) {
|
|
7
|
+
try {
|
|
8
|
+
appendFileSync(PATH, `${new Date().toISOString()} ${JSON.stringify(event)}\n`);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// Scratch home not writable — nothing to do.
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=_trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_trace.js","sourceRoot":"","sources":["../../../src/host/controller/_trace.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,yEAAyE;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,IAAI,GAAG,uCAAuC,CAAC;AAErD,2EAA2E;AAC3E,MAAM,UAAU,KAAK,CAAC,KAA8B;IAChD,IAAI,CAAC;QACD,cAAc,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnF,CAAC;IAAC,MAAM,CAAC;QACL,6CAA6C;IACjD,CAAC;AACL,CAAC"}
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
import { bridgeConfig } from "../bridge.js";
|
|
11
11
|
import type { BridgeStderrMode, ChromeMcpConfig } from "../types/index.js";
|
|
12
12
|
import type { Controller } from "./state.js";
|
|
13
|
-
/** The
|
|
14
|
-
*
|
|
13
|
+
/** The bridge's own view of one config: the ordinary passthroughs ride along
|
|
14
|
+
* verbatim, and the two levers the run owns — the flags list and the resolved
|
|
15
|
+
* selection — are handed in explicitly, so nothing here mistakes a reference for
|
|
16
|
+
* a value. The logical argv shape is unchanged. */
|
|
15
17
|
export declare function configForBridge(controller: Controller, flags: string[]): ChromeMcpConfig;
|
|
16
18
|
/**
|
|
17
19
|
* Restart the bridge connection with one built config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-run.d.ts","sourceRoot":"","sources":["../../../src/host/controller/bridge-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"bridge-run.d.ts","sourceRoot":"","sources":["../../../src/host/controller/bridge-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAI3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;mDAGmD;AACnD,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,eAAe,CAExF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBhH;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAexE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CASpF"}
|