@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
|
@@ -4,26 +4,37 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The public half (`createChromeMcpController`, `ChromeMcpController`,
|
|
6
6
|
* `ChromeMcpControllerDeps`) lives in ./controller.ts; the behavior it wires
|
|
7
|
-
* together is split across the sibling modules here (`notes`, `
|
|
7
|
+
* together is split across the sibling modules here (`notes`, `connections`,
|
|
8
8
|
* `runs`, `windows-run`, `persist`, `captures`, `commits`). This file names the
|
|
9
|
-
* state those helpers share — every
|
|
10
|
-
* every
|
|
11
|
-
* pieces a method needs to act on (the row config, the
|
|
12
|
-
*
|
|
9
|
+
* state those helpers share — every live answer targets `state.live` and reaches
|
|
10
|
+
* the card through `publishLive`, every layer read goes through `state.source`,
|
|
11
|
+
* and the immutable context pieces a method needs to act on (the row config, the
|
|
12
|
+
* WSL answer, the injected Windows run, the manager's connection service) sit
|
|
13
|
+
* alongside it. Nothing here is part of the public surface.
|
|
13
14
|
*/
|
|
14
|
-
import type { BridgeStderrMode, ChromeMcpConfig, ChromeExecutableEntry,
|
|
15
|
+
import type { BridgeStderrMode, ChromeMcpConfig, ChromeExecutableEntry, ConfigLayers, ConfigLiveFields, ChromeMcpForm, EffectiveChromeSource, PluginContext, WindowsChromeRun } from "../types/index.js";
|
|
15
16
|
import type { WindowsChromeRunOptions } from "../windows/index.js";
|
|
17
|
+
import type { LiveMirror } from "@comecaramelos/dsh-ancesters/host";
|
|
18
|
+
import type { McpConnectionsService } from "@comecaramelos/dsh-mcp-manager/api";
|
|
19
|
+
import type { RunningAnswers } from "./connections.js";
|
|
16
20
|
/** The live state one controller instance owns and mutates. */
|
|
17
21
|
export interface ControllerState {
|
|
18
|
-
/** The
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
/** The live mirror — what every Host answer carries, published through the
|
|
23
|
+
* volatile references on every change batch, never persisted. */
|
|
24
|
+
live: ConfigLiveFields;
|
|
25
|
+
/** The configuration form once it is attached (undefined until the settings
|
|
26
|
+
* service resolves and the row's entry id is known). */
|
|
27
|
+
form: ChromeMcpForm | undefined;
|
|
28
|
+
/** Read the form's layers (the user layer over the row config). Swapped when
|
|
29
|
+
* the form attaches; before that the references answer alone. */
|
|
30
|
+
source: () => ConfigLayers;
|
|
31
|
+
/** Flags the default answers run with — what a connection with no own
|
|
32
|
+
* `extra` answer is answered with. Mirrored from the last resolve, so what
|
|
33
|
+
* the machine page states is what is running, not what was last configured. */
|
|
23
34
|
runningFlags: string[];
|
|
24
|
-
/** Effective
|
|
35
|
+
/** Effective console-output mode of the default answer ("log"/"console"). */
|
|
25
36
|
runningStderrMode: BridgeStderrMode;
|
|
26
|
-
/** Executable the
|
|
37
|
+
/** Executable the default answer launches with. */
|
|
27
38
|
runningChromePath: string;
|
|
28
39
|
/** Where that executable came from. */
|
|
29
40
|
runningChromeSource: EffectiveChromeSource;
|
|
@@ -41,30 +52,121 @@ export interface ControllerState {
|
|
|
41
52
|
seenUserSelection: boolean;
|
|
42
53
|
/** Serializes runs so rapid actions never interleave. */
|
|
43
54
|
runs: Promise<unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* One bounded retry of a FAILED executable run. The run chain answers once
|
|
57
|
+
* per queue and never re-tries on its own — a host that answers empty (the
|
|
58
|
+
* shape a WSL boot takes while the interop mount is not served yet) would
|
|
59
|
+
* read "not found" until someone pressed Fetch. So a failing run arms
|
|
60
|
+
* **one** retry behind `DISCOVERY_RETRY_DELAY_MS`, capped across the
|
|
61
|
+
* instance at `DISCOVERY_RETRY_MAX`, and any run that no longer stands
|
|
62
|
+
* failed resets the count. Cancelled when the instance is disposed.
|
|
63
|
+
*/
|
|
64
|
+
retryTimer: NodeJS.Timeout | undefined;
|
|
65
|
+
/** Consecutive scheduled retries after failed runs; reset on a non-failed
|
|
66
|
+
* run. */
|
|
67
|
+
retriesPending: number;
|
|
68
|
+
/** Set once this instance is disposed: a late retry answer must not fire
|
|
69
|
+
* runs for an instance that no longer exists. */
|
|
70
|
+
disposed: boolean;
|
|
44
71
|
/** Whether the WSL + Windows-executable warning has been logged already. */
|
|
45
72
|
wslNoticeShown: boolean;
|
|
46
73
|
/** Whether the workspace `.chrome` view "kept" notice has been logged. */
|
|
47
74
|
profileLinkKeptShown: boolean;
|
|
48
75
|
/** Whether the legacy hand-typed MRU has been folded into the rows already. */
|
|
49
76
|
legacyPathsMerged: boolean;
|
|
77
|
+
/** Whether the row config's legacy `--executablePath` fold has been announced
|
|
78
|
+
* already (one warn line, however often the layers churn). */
|
|
79
|
+
legacyPinAnnounced: boolean;
|
|
80
|
+
/** The live mirror (ancestros' `createLiveMirror`), stood up on the first
|
|
81
|
+
* publish. */
|
|
82
|
+
mirror: LiveMirror | undefined;
|
|
83
|
+
/** Set while one coalesced "kinds changed" notice is already queued. */
|
|
84
|
+
kindsNotifyQueued: boolean;
|
|
85
|
+
/** The manager's `mcpConnections` service while the manager runs it (see
|
|
86
|
+
* ../manager.ts). Undefined when no manager stands behind this row — the
|
|
87
|
+
* component then answers the row's own page and starts nothing. */
|
|
88
|
+
connections: McpConnectionsService | undefined;
|
|
89
|
+
/** Says "what a picker would answer just moved" (./../manager.ts installs
|
|
90
|
+
* the real half); a no-op until then. */
|
|
91
|
+
notifyKindsChanged: () => void;
|
|
50
92
|
}
|
|
51
|
-
/** Everything a controller method needs: the immutable context + the state.
|
|
93
|
+
/** Everything a controller method needs: the immutable context + the state.
|
|
94
|
+
* `ChromeMcpController` is this same type — the public surface is the object
|
|
95
|
+
* itself, and every consumer (the form, the commands, the kinds) works through
|
|
96
|
+
* one and the same instance. */
|
|
52
97
|
export interface Controller {
|
|
53
98
|
ctx: PluginContext;
|
|
99
|
+
/** The config `apply` validated. Every `.volatile()` field here is a
|
|
100
|
+
* reference, not a value — read them through `readConfigField`. */
|
|
54
101
|
config: ChromeMcpConfig;
|
|
55
102
|
/** True on a WSL host (where the Windows run is the only working path). */
|
|
56
103
|
wslHost: boolean;
|
|
104
|
+
/** True on a Linux host. The candidate list models the stable-channel
|
|
105
|
+
* installs a Linux host carries, so the executable-missing answer's advice
|
|
106
|
+
* keys on this (see `runs.ts`); WSL is the case with the Windows-side
|
|
107
|
+
* alternative next to it. */
|
|
108
|
+
linuxHost: boolean;
|
|
57
109
|
/** A path this host must never exec (a Windows binary under WSL). */
|
|
58
110
|
blockedForPlatform: (candidate: string) => string;
|
|
59
|
-
/** The
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
rowFlags: string[];
|
|
111
|
+
/** The `DSH_CHROME_MCP_FLAGS` answer from the launch environment (anything
|
|
112
|
+
* the caller did not supply is "no answer"). */
|
|
113
|
+
launchFlags: unknown;
|
|
63
114
|
/** The Windows run half — injected by tests, the real one otherwise. */
|
|
64
115
|
windowsChrome: (options: WindowsChromeRunOptions) => Promise<WindowsChromeRun>;
|
|
65
|
-
/** The
|
|
66
|
-
|
|
116
|
+
/** The Windows-side executables this host carries, in preference order and
|
|
117
|
+
* in their Windows spelling — located through the interop mount, `[]` off
|
|
118
|
+
* WSL. A run folds them into its candidate list (they are never probed: a
|
|
119
|
+
* Windows binary answers `note`, never a version) so the picker can name the
|
|
120
|
+
* executable a run drives instead of hiding it. */
|
|
121
|
+
windowsExecutables: () => string[];
|
|
67
122
|
/** The live mutable state. */
|
|
68
123
|
state: ControllerState;
|
|
124
|
+
/** Bind the configuration form to this controller (the first call also serves
|
|
125
|
+
* as the mount's first read, so the registration run fires off the first
|
|
126
|
+
* commit's nonce diffs instead of being called separately). */
|
|
127
|
+
attachForm(form: ChromeMcpForm): void;
|
|
128
|
+
/** Drop the form again — the references stand in for the layers until it
|
|
129
|
+
* returns. */
|
|
130
|
+
detachForm(): void;
|
|
131
|
+
/** Route one configuration-form commit: re-derive the default answers, and
|
|
132
|
+
* run one executable refresh on the fetch trigger. */
|
|
133
|
+
onFormCommit(): void;
|
|
134
|
+
/** Run one executable refresh (probe the candidates, merge what is found
|
|
135
|
+
* into the saved rows, seed a never-configured host) and re-probe the
|
|
136
|
+
* selection — the whole fetch the card's **Fetch executables** fires. Runs
|
|
137
|
+
* are serialized so rapid actions never interleave. */
|
|
138
|
+
run(): Promise<unknown>;
|
|
139
|
+
/** Read the configuration form's live layers — the same read every commit
|
|
140
|
+
* and every run makes (the references, plus the described row once it
|
|
141
|
+
* exists). A headless surface (the slash commands) reads the saved rows
|
|
142
|
+
* through it. */
|
|
143
|
+
source(): ConfigLayers;
|
|
144
|
+
/** The live mirror — every answer the Host has standing. Headless surfaces
|
|
145
|
+
* (the slash commands) read their answers off it and write nothing to it:
|
|
146
|
+
* answers belong to the controller's own modules. */
|
|
147
|
+
readonly live: ConfigLiveFields;
|
|
148
|
+
/** Write one executable selection through the Host write-back channel — the
|
|
149
|
+
* same persisted `chromePath` field the card's picker writes — and re-fire
|
|
150
|
+
* the run behind it. `""` clears the user layer back to the row config. */
|
|
151
|
+
selectChromePath(path: string): Promise<void>;
|
|
152
|
+
/** Run the Windows Chrome path once (locate, prereq, port, launch, wait for
|
|
153
|
+
* the bind) on the same one-run-at-a-time chain the button drives through,
|
|
154
|
+
* and answer with what the run stated. */
|
|
155
|
+
prelaunchWindowsChrome(): Promise<string>;
|
|
156
|
+
/** Mirror what one live connection answered it runs with (./connections.ts).
|
|
157
|
+
* Every kind `resolve` ends with this. */
|
|
158
|
+
noteRunning(entry: {
|
|
159
|
+
id: string;
|
|
160
|
+
}, answers: RunningAnswers): void;
|
|
161
|
+
/** Drive the prelaunch machinery once for a live `chrome-windows`
|
|
162
|
+
* connection's async `resolve`. */
|
|
163
|
+
prelaunchForConnection(): Promise<WindowsChromeRun>;
|
|
164
|
+
/** Mark the standalone-config translation dismissed (./../migration.ts
|
|
165
|
+
* D4): the row's `migrationDismissed` flips true so the offer stops. */
|
|
166
|
+
dismissMigration(): void;
|
|
167
|
+
/** Stand this instance down: nothing late (the bounded retry behind a failed
|
|
168
|
+
* run most of all) may fire runs for an instance that no longer exists. A
|
|
169
|
+
* hot re-apply disposes the prior instance this way. */
|
|
170
|
+
dispose(): void;
|
|
69
171
|
}
|
|
70
172
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/host/controller/state.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":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I,CAAC;IACnB;0DACsD;IACtD,YAAY,IAAI,IAAI,CAAC;IACrB;;;2DAGuD;IACvD,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB;;;qBAGiB;IACjB,MAAM,IAAI,YAAY,CAAC;IACvB;;yDAEqD;IACrD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC;;+EAE2E;IAC3E,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;8CAE0C;IAC1C,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C;8CAC0C;IAC1C,WAAW,CAAC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAClE;uCACmC;IACnC,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpD;4EACwE;IACxE,gBAAgB,IAAI,IAAI,CAAC;IACzB;;4DAEwD;IACxD,OAAO,IAAI,IAAI,CAAC;CACnB"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import type { WindowsChromeRun } from "../types/index.js";
|
|
1
2
|
import type { Controller } from "./state.js";
|
|
2
3
|
/**
|
|
3
4
|
* One **Prelaunch Windows Chrome** run. When the host is not WSL there is simply
|
|
4
5
|
* nothing to drive and the answer is `not-applicable`; otherwise the state moves
|
|
5
6
|
* through `launching` while the run (locate, prereq, launch, port) settles, and
|
|
6
|
-
*
|
|
7
|
+
* the settled state is mirrored before the run is returned.
|
|
7
8
|
*/
|
|
8
|
-
export declare function runWindowsChrome(controller: Controller): Promise<
|
|
9
|
+
export declare function runWindowsChrome(controller: Controller): Promise<WindowsChromeRun>;
|
|
10
|
+
/**
|
|
11
|
+
* The kind-side half of the run: a live `chrome-windows` connection's async
|
|
12
|
+
* `resolve` drives the launch through the same one-run-at-a-time chain the
|
|
13
|
+
* button uses, and gets the run result back to turn into the connect-mode
|
|
14
|
+
* stdio config.
|
|
15
|
+
*/
|
|
16
|
+
export declare function prelaunchWindowsForConnection(controller: Controller): Promise<WindowsChromeRun>;
|
|
9
17
|
//# sourceMappingURL=windows-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-run.d.ts","sourceRoot":"","sources":["../../../src/host/controller/windows-run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"windows-run.d.ts","sourceRoot":"","sources":["../../../src/host/controller/windows-run.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,mBAAmB,CAAC;AAI9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkExF;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAOrG"}
|
|
@@ -1,51 +1,74 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Controller — the one Windows Chrome run.
|
|
3
3
|
*
|
|
4
|
-
* The whole Windows path the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* The whole Windows path the **Prelaunch Windows Chrome** surface drives (the
|
|
5
|
+
* card button, the `prelaunch_windows_chrome` tool, and the async `resolve` of a
|
|
6
|
+
* live `chrome-windows` connection), sequenced here against the injected run
|
|
7
|
+
* half (./run.ts in ../windows). The run never kills what it started; everything
|
|
8
|
+
* it answers lands in the live mirror's `windowsChromeStatus`, and the run
|
|
9
|
+
* result is handed back to the caller — in the component model the browser is
|
|
10
|
+
* driven by a connection, not by a bridge this row owns, so a successful run
|
|
11
|
+
* writes no flag anywhere: the debugging URL belongs to the connection's own
|
|
12
|
+
* answer, not to this row's configuration.
|
|
13
|
+
*
|
|
14
|
+
* Re-entry is cheap by construction: when a previous run already left the live
|
|
15
|
+
* mirror connected, the URL it stated rides into `currentFlags`, and the
|
|
16
|
+
* underlying run reuses that port when the browser behind it still answers —
|
|
17
|
+
* so re-running is idempotent, never a second browser.
|
|
11
18
|
*/
|
|
12
|
-
import { sameFlags } from "../flags.js";
|
|
13
19
|
import { firstLine } from "../status.js";
|
|
20
|
+
import { isWindowsExecutablePath } from "../platform.js";
|
|
14
21
|
import { windowsChromeProjectDir, withBrowserUrlFlag } from "../windows/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
22
|
+
import { resolveLaunchFlags, resolveSelection } from "../values.js";
|
|
23
|
+
import { publishLive } from "./publish.js";
|
|
17
24
|
/**
|
|
18
25
|
* One **Prelaunch Windows Chrome** run. When the host is not WSL there is simply
|
|
19
26
|
* nothing to drive and the answer is `not-applicable`; otherwise the state moves
|
|
20
27
|
* through `launching` while the run (locate, prereq, launch, port) settles, and
|
|
21
|
-
*
|
|
28
|
+
* the settled state is mirrored before the run is returned.
|
|
22
29
|
*/
|
|
23
30
|
export async function runWindowsChrome(controller) {
|
|
24
31
|
const { state } = controller;
|
|
25
32
|
if (!controller.wslHost) {
|
|
26
|
-
state.
|
|
27
|
-
|
|
33
|
+
state.live.windowsChromeStatus = { state: "not-applicable", port: 0, error: "" };
|
|
34
|
+
publishLive(controller);
|
|
35
|
+
return { state: "not-applicable", port: 0, url: "", profileDir: "", error: "" };
|
|
36
|
+
}
|
|
37
|
+
state.live.windowsChromeStatus = { state: "launching", port: state.live.windowsChromeStatus.port, error: "" };
|
|
38
|
+
publishLive(controller);
|
|
39
|
+
let currentFlags = resolveLaunchFlags(state.source(), controller.launchFlags);
|
|
40
|
+
// A run answering from a mirror that stands connected carries its own URL in
|
|
41
|
+
// — that is what makes re-entry (tool re-run, pool re-prepare) idempotent:
|
|
42
|
+
// the underlying run reuses the live port instead of launching again.
|
|
43
|
+
if (state.live.windowsChromeStatus.state === "connected" && state.live.windowsChromeStatus.port > 0) {
|
|
44
|
+
currentFlags = withBrowserUrlFlag(currentFlags, `http://127.0.0.1:${state.live.windowsChromeStatus.port}`);
|
|
28
45
|
}
|
|
29
|
-
state.entry.windowsChromeStatus = { state: "launching", port: state.entry.windowsChromeStatus.port, error: "" };
|
|
30
|
-
const live = state.source();
|
|
31
|
-
const currentFlags = Array.isArray(live.extraFlags) ? live.extraFlags : state.runningFlags;
|
|
32
|
-
let result;
|
|
33
46
|
// The workspace that carries the run's `.chrome` view: the row-config `cwd`,
|
|
34
47
|
// else the live session's workspace — the run answers the GUI the user is
|
|
35
48
|
// driving, not the directory `dsh web` happened to be launched from (a view
|
|
36
49
|
// rooted at `~` links `~/.chrome`) — else the host's own cwd.
|
|
37
50
|
const projectDir = windowsChromeProjectDir(controller.config.cwd, controller.ctx.get("sessions"), process.cwd());
|
|
51
|
+
// The executable the picker selected, when that selection is a Windows one:
|
|
52
|
+
// what the run launches is then exactly what the card named, not the first
|
|
53
|
+
// location the run happens to find. Nothing else stands in — a selection
|
|
54
|
+
// that is not there answers by naming it — while a selection naming no
|
|
55
|
+
// Windows executable (nothing picked, or a local one) leaves the run's own
|
|
56
|
+
// locate in charge, exactly as it was.
|
|
57
|
+
const selected = resolveSelection(state.source()).path;
|
|
58
|
+
const candidates = isWindowsExecutablePath(selected) ? [selected] : void 0;
|
|
59
|
+
let result;
|
|
38
60
|
try {
|
|
39
61
|
result = await controller.windowsChrome({
|
|
40
62
|
cwd: projectDir,
|
|
41
|
-
currentFlags
|
|
63
|
+
currentFlags,
|
|
64
|
+
...(candidates === void 0 ? {} : { candidates })
|
|
42
65
|
});
|
|
43
66
|
}
|
|
44
67
|
catch (error) {
|
|
45
68
|
result = { state: "launch-failed", port: 0, url: "", profileDir: "", error: firstLine(error instanceof Error ? error.message : String(error)) };
|
|
46
69
|
}
|
|
47
|
-
state.
|
|
48
|
-
if (result.state === "connected"
|
|
70
|
+
state.live.windowsChromeStatus = { state: result.state, port: result.port, error: firstLine(result.error) };
|
|
71
|
+
if (result.state === "connected") {
|
|
49
72
|
if (result.profileDir !== "") {
|
|
50
73
|
if (result.profileLink === "kept") {
|
|
51
74
|
// A real `.chrome` directory already sits at the view's spot:
|
|
@@ -53,26 +76,34 @@ export async function runWindowsChrome(controller) {
|
|
|
53
76
|
// — say it once, not on every run.
|
|
54
77
|
if (!state.profileLinkKeptShown) {
|
|
55
78
|
state.profileLinkKeptShown = true;
|
|
56
|
-
controller.ctx.logger.warn(`chrome-
|
|
79
|
+
controller.ctx.logger.warn(`dsh-chrome-mcp(${controller.config.serverName}): ${projectDir}/.chrome is an existing directory — the Windows profile stays at ${result.profileDir}, not linked into the checkout`);
|
|
57
80
|
}
|
|
58
81
|
}
|
|
59
82
|
else {
|
|
60
|
-
controller.ctx.logger.info(`chrome-
|
|
83
|
+
controller.ctx.logger.info(`dsh-chrome-mcp(${controller.config.serverName}): Windows Chrome profile ${result.profileDir}, workspace view ${projectDir}/.chrome`);
|
|
61
84
|
}
|
|
62
85
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// The bridge now connects instead of launching — the same flag path
|
|
67
|
-
// the extra-flags editor writes through. Persisting is what keeps
|
|
68
|
-
// connect mode across a reconnect and the next dsh start.
|
|
69
|
-
controller.ctx.logger.info(`chrome-devtools-mcp(${controller.config.serverName}): Windows Chrome connected at ${result.url} — switching the bridge to connect mode`);
|
|
70
|
-
applyFlags(controller, next);
|
|
71
|
-
void persistExtraFlags(controller, next);
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
86
|
+
state.live.lastError = "";
|
|
87
|
+
publishLive(controller);
|
|
88
|
+
return { state: result.state, port: result.port, url: result.url, profileDir: result.profileDir, error: "" };
|
|
74
89
|
}
|
|
75
|
-
state.
|
|
76
|
-
|
|
90
|
+
state.live.lastError = firstLine(result.error);
|
|
91
|
+
publishLive(controller);
|
|
92
|
+
controller.ctx.logger.warn(`dsh-chrome-mcp(${controller.config.serverName}): Windows Chrome run did not connect: ${state.live.lastError}`);
|
|
93
|
+
return { state: result.state, port: result.port, url: result.url, profileDir: result.profileDir, error: state.live.lastError };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The kind-side half of the run: a live `chrome-windows` connection's async
|
|
97
|
+
* `resolve` drives the launch through the same one-run-at-a-time chain the
|
|
98
|
+
* button uses, and gets the run result back to turn into the connect-mode
|
|
99
|
+
* stdio config.
|
|
100
|
+
*/
|
|
101
|
+
export async function prelaunchWindowsForConnection(controller) {
|
|
102
|
+
const { state } = controller;
|
|
103
|
+
const off = "off";
|
|
104
|
+
const failed = "launch-failed";
|
|
105
|
+
return state.runs
|
|
106
|
+
.then(async () => (state.disposed ? { state: off, port: 0, url: "", profileDir: "", error: "the component was disposed" } : runWindowsChrome(controller)))
|
|
107
|
+
.catch((error) => ({ state: failed, port: 0, url: "", profileDir: "", error: firstLine(error instanceof Error ? error.message : String(error)) }));
|
|
77
108
|
}
|
|
78
109
|
//# sourceMappingURL=windows-run.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-run.js","sourceRoot":"","sources":["../../../src/host/controller/windows-run.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"windows-run.js","sourceRoot":"","sources":["../../../src/host/controller/windows-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAsB;IACzD,MA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AAM,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;AACnI,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,UAAsB;IACtE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IAC7B,MAAM,GAAG,GAAuB,KAAK,CAAC;IACtC,MAAM,MAAM,GAAuB,eAAe,CAAC;IACnD,OAAO,KAAK,CAAC,IAAI;SACZ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;SACzJ,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3J,CAAC"}
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
* Chrome discovery — the candidate list.
|
|
3
3
|
*
|
|
4
4
|
* Where discovery looks before anything is picked: the platform's stable-channel
|
|
5
|
-
* Chrome locations (mirroring upstream puppeteer's
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* ./
|
|
5
|
+
* Chrome locations (mirroring upstream puppeteer's) and the ordered candidate
|
|
6
|
+
* list one run folds together — row-config `chromePaths`, then whatever else this
|
|
7
|
+
* host carries (on a WSL host: the Windows-side executables answering through the
|
|
8
|
+
* interop mount, never spawned from here), then the saved rows' ids, then the
|
|
9
|
+
* selection. The probes over that list live in ./scan.ts; the `--version` probe
|
|
10
|
+
* itself in ./probe.ts.
|
|
10
11
|
*/
|
|
11
12
|
import type { ChromeMcpConfig } from "../types/index.js";
|
|
12
13
|
/**
|
|
13
14
|
* Google Chrome stable-channel locations probed by discovery when
|
|
14
15
|
* `chromePath` is empty — mirrors the upstream (puppeteer) system-channel
|
|
15
|
-
* resolution.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* resolution. The Windows-side locations a WSL host reaches through the interop
|
|
17
|
+
* mount are deliberately not mixed into the *platform* list (their spelling
|
|
18
|
+
* belongs to the other side of the boundary); a WSL host's run folds them in
|
|
19
|
+
* separately, as the candidates it offers without probing (see
|
|
20
|
+
* `chromeExecutableCandidates`' `extraCandidates` and the never-spawn rule in
|
|
21
|
+
* ./scan.ts). Unknown platforms probe nothing.
|
|
19
22
|
*/
|
|
20
23
|
export declare const DEFAULT_CHROME_PATHS: {
|
|
21
24
|
linux: string[];
|
|
@@ -26,12 +29,19 @@ export declare const DEFAULT_CHROME_PATHS: {
|
|
|
26
29
|
export declare function defaultChromePaths(platform?: NodeJS.Platform): string[];
|
|
27
30
|
/**
|
|
28
31
|
* Every path one executable run probes: the row-config candidate list (default
|
|
29
|
-
* the platform list), then
|
|
30
|
-
* selection — deduplicated, in this order,
|
|
31
|
-
*
|
|
32
|
+
* the platform list), then whatever else this host carries, then the ids the
|
|
33
|
+
* saved rows carry, then the current selection — deduplicated, in this order,
|
|
34
|
+
* so the list reads "what the profile configures, then what the machine carries,
|
|
35
|
+
* then what the card saved, then what runs".
|
|
32
36
|
* @param entry - validated row config (`chromePaths` is the candidate list).
|
|
33
37
|
* @param savedIds - the saved rows' ids, in row order (see ./catalog.ts).
|
|
34
38
|
* @param effectivePath - the currently selected path, always kept in the list.
|
|
39
|
+
* @param extraCandidates - what this host carries beyond the configured list:
|
|
40
|
+
* the Windows-side executables a WSL host reaches through the interop mount.
|
|
41
|
+
* They join the list so the **Prelaunch Windows Chrome** run drives what the
|
|
42
|
+
* picker picked rather than what it happens to locate first — and, offered
|
|
43
|
+
* without being probed, they answer a note and never a version (see the
|
|
44
|
+
* `blockedForPlatform` answer threaded through ./scan.ts).
|
|
35
45
|
*/
|
|
36
|
-
export declare function chromeExecutableCandidates(entry: Pick<ChromeMcpConfig, "chromePaths">, savedIds?: readonly string[], effectivePath?: string): string[];
|
|
46
|
+
export declare function chromeExecutableCandidates(entry: Pick<ChromeMcpConfig, "chromePaths">, savedIds?: readonly string[], effectivePath?: string, extraCandidates?: readonly string[]): string[];
|
|
37
47
|
//# sourceMappingURL=candidates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidates.d.ts","sourceRoot":"","sources":["../../../src/host/discovery/candidates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"candidates.d.ts","sourceRoot":"","sources":["../../../src/host/discovery/candidates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;;;;CAahC,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,EAAE,CAGzF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CACtC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,EAC3C,QAAQ,GAAE,SAAS,MAAM,EAAO,EAChC,aAAa,SAAK,EAClB,eAAe,GAAE,SAAS,MAAM,EAAO,GACxC,MAAM,EAAE,CAiBV"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Google Chrome stable-channel locations probed by discovery when
|
|
3
3
|
* `chromePath` is empty — mirrors the upstream (puppeteer) system-channel
|
|
4
|
-
* resolution.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* resolution. The Windows-side locations a WSL host reaches through the interop
|
|
5
|
+
* mount are deliberately not mixed into the *platform* list (their spelling
|
|
6
|
+
* belongs to the other side of the boundary); a WSL host's run folds them in
|
|
7
|
+
* separately, as the candidates it offers without probing (see
|
|
8
|
+
* `chromeExecutableCandidates`' `extraCandidates` and the never-spawn rule in
|
|
9
|
+
* ./scan.ts). Unknown platforms probe nothing.
|
|
8
10
|
*/
|
|
9
11
|
export const DEFAULT_CHROME_PATHS = {
|
|
10
12
|
linux: [
|
|
@@ -27,16 +29,24 @@ export function defaultChromePaths(platform = process.platform) {
|
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Every path one executable run probes: the row-config candidate list (default
|
|
30
|
-
* the platform list), then
|
|
31
|
-
* selection — deduplicated, in this order,
|
|
32
|
-
*
|
|
32
|
+
* the platform list), then whatever else this host carries, then the ids the
|
|
33
|
+
* saved rows carry, then the current selection — deduplicated, in this order,
|
|
34
|
+
* so the list reads "what the profile configures, then what the machine carries,
|
|
35
|
+
* then what the card saved, then what runs".
|
|
33
36
|
* @param entry - validated row config (`chromePaths` is the candidate list).
|
|
34
37
|
* @param savedIds - the saved rows' ids, in row order (see ./catalog.ts).
|
|
35
38
|
* @param effectivePath - the currently selected path, always kept in the list.
|
|
39
|
+
* @param extraCandidates - what this host carries beyond the configured list:
|
|
40
|
+
* the Windows-side executables a WSL host reaches through the interop mount.
|
|
41
|
+
* They join the list so the **Prelaunch Windows Chrome** run drives what the
|
|
42
|
+
* picker picked rather than what it happens to locate first — and, offered
|
|
43
|
+
* without being probed, they answer a note and never a version (see the
|
|
44
|
+
* `blockedForPlatform` answer threaded through ./scan.ts).
|
|
36
45
|
*/
|
|
37
|
-
export function chromeExecutableCandidates(entry, savedIds = [], effectivePath = "") {
|
|
46
|
+
export function chromeExecutableCandidates(entry, savedIds = [], effectivePath = "", extraCandidates = []) {
|
|
38
47
|
const rowPaths = Array.isArray(entry?.chromePaths) ? entry.chromePaths : [];
|
|
39
48
|
const saved = Array.isArray(savedIds) ? savedIds : [];
|
|
49
|
+
const extra = Array.isArray(extraCandidates) ? extraCandidates : [];
|
|
40
50
|
const seen = new Set();
|
|
41
51
|
const candidates = [];
|
|
42
52
|
const push = (value) => {
|
|
@@ -48,6 +58,8 @@ export function chromeExecutableCandidates(entry, savedIds = [], effectivePath =
|
|
|
48
58
|
};
|
|
49
59
|
for (const path of rowPaths)
|
|
50
60
|
push(path);
|
|
61
|
+
for (const path of extra)
|
|
62
|
+
push(path);
|
|
51
63
|
for (const path of saved)
|
|
52
64
|
push(path);
|
|
53
65
|
push(effectivePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidates.js","sourceRoot":"","sources":["../../../src/host/discovery/candidates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"candidates.js","sourceRoot":"","sources":["../../../src/host/discovery/candidates.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,KAAK,EAAE;QACH,2BAA2B;QAC3B,wBAAwB;QACxB,+BAA+B;QAC/B,8BAA8B;QAC9B,eAAe;KAClB;IACD,MAAM,EAAE,CAAC,8DAA8D,CAAC;IACxE,KAAK,EAAE;QACH,4DAA4D;QAC5D,kEAAkE;KACrE;CACJ,CAAC;AAEF,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAAC,WAA4B,OAAO,CAAC,QAAQ;IAC3E,MAAM,UAAU,GAAG,oBAAoB,CAAC,QAA6C,CAAC,CAAC;IACvF,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,U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behaviour and the WSL interop note.
|
|
15
15
|
*/
|
|
16
16
|
export { chromeExecutableCandidates, DEFAULT_CHROME_PATHS, defaultChromePaths } from "./candidates.js";
|
|
17
|
+
export { probeExecutable, readWindowsInstallVersion } from "./probe.js";
|
|
17
18
|
export { checkChrome, discoverChrome, scanChromeExecutables } from "./scan.js";
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/host/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/host/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* substituted. See ./scan.ts for the full behaviour and the WSL interop note.
|
|
15
15
|
*/
|
|
16
16
|
export { chromeExecutableCandidates, DEFAULT_CHROME_PATHS, defaultChromePaths } from "./candidates.js";
|
|
17
|
+
export { probeExecutable, readWindowsInstallVersion } from "./probe.js";
|
|
17
18
|
export { checkChrome, discoverChrome, scanChromeExecutables } from "./scan.js";
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/host/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/host/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The version a Windows install states without being run: the highest
|
|
3
|
+
* `<major>.<minor>.<build>.<patch>` folder beside the executable (the layout
|
|
4
|
+
* Chrome, Edge, Brave and Chromium all install with), or
|
|
5
|
+
* {@link WINDOWS_VERSION_UNKNOWN} when none is there. A missing file rejects
|
|
6
|
+
* like the spawn would; a bare name (no folder to look in) answers unknown.
|
|
6
7
|
*/
|
|
7
|
-
export declare function
|
|
8
|
+
export declare function readWindowsInstallVersion(target: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Answer one executable's version. On Windows nothing is spawned — a Chromium
|
|
11
|
+
* browser asked `--version` there opens a window instead of answering — and
|
|
12
|
+
* the version is read off the install ({@link readWindowsInstallVersion}).
|
|
13
|
+
* Everywhere else: one `chromePath --version` probe (scrubbed parent env,
|
|
14
|
+
* bounded timeout). Resolves the first stdout line (the version); ENOENT
|
|
15
|
+
* rejects with "Chrome executable not found: <path>" carrying code "ENOENT"; a
|
|
16
|
+
* non-zero exit rejects with the first non-empty stderr/stdout line.
|
|
17
|
+
*/
|
|
18
|
+
export declare function probeExecutable(target: string, platform?: NodeJS.Platform): Promise<string>;
|
|
8
19
|
/** True when a candidate path can be handed to the OS for a `--version` probe.
|
|
9
20
|
* A path that is absent (or not executable) never reaches the spawn: a
|
|
10
21
|
* Chrome-less host runs one scan without launching anything. Paths with no
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/host/discovery/probe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/host/discovery/probe.ts"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAyBhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CA+C7G;AAED;;;;qBAIqB;AACrB,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAWxD;AAED;;oDAEoD;AACpD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMlD"}
|