@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.
Files changed (172) hide show
  1. package/README.md +44 -39
  2. package/lib/client.js +2186 -614
  3. package/lib/client.js.map +4 -4
  4. package/lib/host/apply.d.ts +38 -1
  5. package/lib/host/apply.d.ts.map +1 -1
  6. package/lib/host/apply.js +43 -17
  7. package/lib/host/apply.js.map +1 -1
  8. package/lib/host/bridge.d.ts +28 -19
  9. package/lib/host/bridge.d.ts.map +1 -1
  10. package/lib/host/bridge.js +71 -79
  11. package/lib/host/bridge.js.map +1 -1
  12. package/lib/host/catalog.d.ts +2 -2
  13. package/lib/host/catalog.js +2 -2
  14. package/lib/host/commands/chrome-path.d.ts +4 -0
  15. package/lib/host/commands/chrome-path.d.ts.map +1 -0
  16. package/lib/host/commands/chrome-path.js +65 -0
  17. package/lib/host/commands/chrome-path.js.map +1 -0
  18. package/lib/host/commands/chrome-refresh.d.ts +17 -0
  19. package/lib/host/commands/chrome-refresh.d.ts.map +1 -0
  20. package/lib/host/commands/chrome-refresh.js +37 -0
  21. package/lib/host/commands/chrome-refresh.js.map +1 -0
  22. package/lib/host/commands/index.d.ts +26 -0
  23. package/lib/host/commands/index.d.ts.map +1 -0
  24. package/lib/host/commands/index.js +41 -0
  25. package/lib/host/commands/index.js.map +1 -0
  26. package/lib/host/constants.d.ts +107 -30
  27. package/lib/host/constants.d.ts.map +1 -1
  28. package/lib/host/constants.js +107 -30
  29. package/lib/host/constants.js.map +1 -1
  30. package/lib/host/controller/_trace.d.ts +3 -0
  31. package/lib/host/controller/_trace.d.ts.map +1 -0
  32. package/lib/host/controller/_trace.js +14 -0
  33. package/lib/host/controller/_trace.js.map +1 -0
  34. package/lib/host/controller/bridge-run.d.ts +4 -2
  35. package/lib/host/controller/bridge-run.d.ts.map +1 -1
  36. package/lib/host/controller/bridge-run.js +24 -8
  37. package/lib/host/controller/bridge-run.js.map +1 -1
  38. package/lib/host/controller/captures.d.ts +9 -16
  39. package/lib/host/controller/captures.d.ts.map +1 -1
  40. package/lib/host/controller/captures.js +73 -48
  41. package/lib/host/controller/captures.js.map +1 -1
  42. package/lib/host/controller/commits.d.ts +2 -2
  43. package/lib/host/controller/commits.d.ts.map +1 -1
  44. package/lib/host/controller/commits.js +97 -41
  45. package/lib/host/controller/commits.js.map +1 -1
  46. package/lib/host/controller/connections.d.ts +38 -0
  47. package/lib/host/controller/connections.d.ts.map +1 -0
  48. package/lib/host/controller/connections.js +71 -0
  49. package/lib/host/controller/connections.js.map +1 -0
  50. package/lib/host/controller/controller.d.ts +19 -24
  51. package/lib/host/controller/controller.d.ts.map +1 -1
  52. package/lib/host/controller/controller.js +181 -114
  53. package/lib/host/controller/controller.js.map +1 -1
  54. package/lib/host/controller/index.d.ts +18 -14
  55. package/lib/host/controller/index.d.ts.map +1 -1
  56. package/lib/host/controller/index.js +16 -14
  57. package/lib/host/controller/index.js.map +1 -1
  58. package/lib/host/controller/notes.d.ts +9 -9
  59. package/lib/host/controller/notes.d.ts.map +1 -1
  60. package/lib/host/controller/notes.js +16 -21
  61. package/lib/host/controller/notes.js.map +1 -1
  62. package/lib/host/controller/persist.d.ts +10 -3
  63. package/lib/host/controller/persist.d.ts.map +1 -1
  64. package/lib/host/controller/persist.js +89 -42
  65. package/lib/host/controller/persist.js.map +1 -1
  66. package/lib/host/controller/publish.d.ts +4 -0
  67. package/lib/host/controller/publish.d.ts.map +1 -0
  68. package/lib/host/controller/publish.js +56 -0
  69. package/lib/host/controller/publish.js.map +1 -0
  70. package/lib/host/controller/runs.d.ts +34 -10
  71. package/lib/host/controller/runs.d.ts.map +1 -1
  72. package/lib/host/controller/runs.js +241 -58
  73. package/lib/host/controller/runs.js.map +1 -1
  74. package/lib/host/controller/state.d.ts +122 -20
  75. package/lib/host/controller/state.d.ts.map +1 -1
  76. package/lib/host/controller/windows-run.d.ts +10 -2
  77. package/lib/host/controller/windows-run.d.ts.map +1 -1
  78. package/lib/host/controller/windows-run.js +66 -35
  79. package/lib/host/controller/windows-run.js.map +1 -1
  80. package/lib/host/discovery/candidates.d.ts +23 -13
  81. package/lib/host/discovery/candidates.d.ts.map +1 -1
  82. package/lib/host/discovery/candidates.js +20 -8
  83. package/lib/host/discovery/candidates.js.map +1 -1
  84. package/lib/host/discovery/index.d.ts +1 -0
  85. package/lib/host/discovery/index.d.ts.map +1 -1
  86. package/lib/host/discovery/index.js +1 -0
  87. package/lib/host/discovery/index.js.map +1 -1
  88. package/lib/host/discovery/probe.d.ts +16 -5
  89. package/lib/host/discovery/probe.d.ts.map +1 -1
  90. package/lib/host/discovery/probe.js +68 -10
  91. package/lib/host/discovery/probe.js.map +1 -1
  92. package/lib/host/discovery/scan.d.ts +14 -9
  93. package/lib/host/discovery/scan.d.ts.map +1 -1
  94. package/lib/host/discovery/scan.js +56 -30
  95. package/lib/host/discovery/scan.js.map +1 -1
  96. package/lib/host/flags.d.ts +28 -5
  97. package/lib/host/flags.d.ts.map +1 -1
  98. package/lib/host/flags.js +75 -7
  99. package/lib/host/flags.js.map +1 -1
  100. package/lib/host/kind.d.ts +45 -0
  101. package/lib/host/kind.d.ts.map +1 -0
  102. package/lib/host/kind.js +251 -0
  103. package/lib/host/kind.js.map +1 -0
  104. package/lib/host/manager.d.ts +21 -0
  105. package/lib/host/manager.d.ts.map +1 -0
  106. package/lib/host/manager.js +113 -0
  107. package/lib/host/manager.js.map +1 -0
  108. package/lib/host/migration.d.ts +26 -0
  109. package/lib/host/migration.d.ts.map +1 -0
  110. package/lib/host/migration.js +127 -0
  111. package/lib/host/migration.js.map +1 -0
  112. package/lib/host/plugin-meta.d.ts +12 -3
  113. package/lib/host/plugin-meta.d.ts.map +1 -1
  114. package/lib/host/plugin-meta.js +13 -4
  115. package/lib/host/plugin-meta.js.map +1 -1
  116. package/lib/host/schema.d.ts +301 -247
  117. package/lib/host/schema.d.ts.map +1 -1
  118. package/lib/host/schema.js +145 -120
  119. package/lib/host/schema.js.map +1 -1
  120. package/lib/host/settings.d.ts +22 -3
  121. package/lib/host/settings.d.ts.map +1 -1
  122. package/lib/host/settings.js +81 -60
  123. package/lib/host/settings.js.map +1 -1
  124. package/lib/host/status.d.ts +7 -10
  125. package/lib/host/status.d.ts.map +1 -1
  126. package/lib/host/status.js +8 -23
  127. package/lib/host/status.js.map +1 -1
  128. package/lib/host/tool.d.ts +13 -7
  129. package/lib/host/tool.d.ts.map +1 -1
  130. package/lib/host/tool.js +4 -3
  131. package/lib/host/tool.js.map +1 -1
  132. package/lib/host/types/config.d.ts +66 -12
  133. package/lib/host/types/config.d.ts.map +1 -1
  134. package/lib/host/types/executable.d.ts +8 -3
  135. package/lib/host/types/executable.d.ts.map +1 -1
  136. package/lib/host/types/index.d.ts +5 -4
  137. package/lib/host/types/index.d.ts.map +1 -1
  138. package/lib/host/types/services.d.ts +26 -0
  139. package/lib/host/types/services.d.ts.map +1 -0
  140. package/lib/host/types/services.js +9 -0
  141. package/lib/host/types/services.js.map +1 -0
  142. package/lib/host/types/settings.d.ts +118 -65
  143. package/lib/host/types/settings.d.ts.map +1 -1
  144. package/lib/host/types/stderr.d.ts +3 -5
  145. package/lib/host/types/stderr.d.ts.map +1 -1
  146. package/lib/host/values.d.ts +152 -37
  147. package/lib/host/values.d.ts.map +1 -1
  148. package/lib/host/values.js +304 -112
  149. package/lib/host/values.js.map +1 -1
  150. package/lib/host/windows/connect-flags.d.ts +19 -8
  151. package/lib/host/windows/connect-flags.d.ts.map +1 -1
  152. package/lib/host/windows/connect-flags.js +50 -20
  153. package/lib/host/windows/connect-flags.js.map +1 -1
  154. package/lib/host/windows/index.d.ts +1 -1
  155. package/lib/host/windows/index.d.ts.map +1 -1
  156. package/lib/host/windows/index.js +1 -1
  157. package/lib/host/windows/index.js.map +1 -1
  158. package/lib/host/windows/paths.d.ts +27 -6
  159. package/lib/host/windows/paths.d.ts.map +1 -1
  160. package/lib/host/windows/paths.js +40 -13
  161. package/lib/host/windows/paths.js.map +1 -1
  162. package/lib/host/windows/run.d.ts.map +1 -1
  163. package/lib/host/windows/run.js +3 -2
  164. package/lib/host/windows/run.js.map +1 -1
  165. package/lib/index.d.ts +72 -56
  166. package/lib/index.d.ts.map +1 -1
  167. package/lib/index.js +74 -55
  168. package/lib/index.js.map +1 -1
  169. package/locale/en.json +6 -0
  170. package/locale/zh.json +6 -0
  171. package/package.json +35 -14
  172. package/cordis.patch.yml +0 -5
@@ -1,26 +1,73 @@
1
1
  /**
2
- * Precedence resolution + persisted reads.
2
+ * Precedence resolution + the configuration form's answers.
3
3
  *
4
- * Two levers resolve from the persisted layer upward. The launch flags come
5
- * from one of four sources (highest first): the settings user layer (last UI
6
- * edit, read via `readPersistedFlags` when the service is already up), the
7
- * launch environment (`DSH_CHROME_MCP_FLAGS`, resolved by the controller
8
- * through `resolveEnvFlags`), the row config `extraFlags`, and the schema
9
- * default. The executable comes from three (highest first): the persisted
10
- * `chromePath` the card wrote or the host seeded once, the row config
11
- * `chromePath` (a legacy row-level `--executablePath` folded in — see
12
- * `src/host/flags.ts`), and nothing. There is no auto resolution: nothing is
13
- * inferred on every start, and nothing is re-inferred when the chosen path
14
- * breaks.
4
+ * Two levers resolve upward. The launch flags come from one of four sources
5
+ * (highest first): the user layer (the card's last edit), the launch environment
6
+ * (`DSH_CHROME_MCP_FLAGS`, read through `launchEnvironmentOf`), the row-config
7
+ * `extraFlags`, and the schema default. The executable comes from three (highest
8
+ * first): the `chromePath` the card picked or the host seeded once, the row
9
+ * config (a legacy row-level `--executablePath` folded in — see ./flags.ts), and
10
+ * nothing. There is no auto resolution: nothing is inferred on every start, and
11
+ * nothing is re-inferred when the chosen path breaks.
15
12
  *
16
- * Everything here is pure — the controller composes the precedence; reading
17
- * the persisted selection never throws when the service is not up yet.
13
+ * The reads are one `readConfigLayers` wide: since dsh 0.2.0 the *references*
14
+ * apply() handed answer the effective value (they resolve the user layer over the
15
+ * row config), while the two layers the distinction needs ride the described settings row (`readFormRow`)
16
+ * — `user` is what the profile patch carries (presence is the answer), `base` what
17
+ * the row config carries under it. Before the form attaches only the references
18
+ * answer, so the first commit settles the distinction.
18
19
  */
19
- import { CUSTOM_PATHS_CAP, SETTINGS_NAMESPACE } from "./constants.js";
20
- import { validateExtraFlags } from "./flags.js";
20
+ import { readFormRow } from "@comecaramelos/dsh-ancesters/host";
21
+ import { CUSTOM_PATHS_CAP, DEFAULT_EXTRA_FLAGS, WSL_EXTRA_FLAGS } from "./constants.js";
22
+ import { extractExecutablePathFlag, stripExecutablePathFlags, validateExtraFlags } from "./flags.js";
23
+ import { normalizeEntries } from "./catalog.js";
24
+ /**
25
+ * Environment variable that seeds the launch flags for one dsh run: a
26
+ * whitespace-separated extraFlags list, e.g.
27
+ * `DSH_CHROME_MCP_FLAGS="--headless --isolated"`.
28
+ */
29
+ export { FLAGS_ENV_VAR } from "./constants.js";
30
+ /**
31
+ * Read one config field. A `.volatile()` field arrives as a reference the fiber
32
+ * resolves live (dsh 0.2.0: `apply` hands references, ordinary fields plain
33
+ * values), so reading the field's type is not enough — this is the one way every
34
+ * volatile read answers, whether what it holds is a reference or, on the cold
35
+ * path of a hand-built config, the plain value itself.
36
+ *
37
+ * A reference hands a snapshot, so arrays come back copied: the running state
38
+ * holds values, never the reference's own object.
39
+ * @param field - what the config carries for that field.
40
+ * @param fallback - what to answer when it holds nothing.
41
+ */
42
+ export function readConfigField(field, fallback) {
43
+ const holder = field;
44
+ if (typeof holder?.get === "function") {
45
+ const value = holder.get();
46
+ if (value === void 0)
47
+ return fallback;
48
+ return Array.isArray(value) ? value.slice() : value;
49
+ }
50
+ if (field === void 0 || field === null)
51
+ return fallback;
52
+ return Array.isArray(field) ? field.slice() : field;
53
+ }
54
+ /**
55
+ * The canonical default extra-flags list — the live mirror's answer for the
56
+ * card's **Restore defaults** control (the card carries no copy of it).
57
+ */
58
+ export function readDefaultExtraFlags() {
59
+ return [...DEFAULT_EXTRA_FLAGS];
60
+ }
61
+ /**
62
+ * The recommended WSL ↔ Windows extra-flags list — the live mirror's answer for
63
+ * the card's **Flags WSL** control (a fixed recommendation, never persisted).
64
+ */
65
+ export function readWslExtraFlags() {
66
+ return [...WSL_EXTRA_FLAGS];
67
+ }
21
68
  /**
22
69
  * Parse a whitespace-separated flags list from the environment.
23
- * @param configured - the row config `extraFlags` value.
70
+ * @param configured - what the row config answers.
24
71
  * @param envValue - `DSH_CHROME_MCP_FLAGS` as seen in the launch env.
25
72
  * @returns the env flags when the value is a non-empty string whose every
26
73
  * entry is valid, else `configured` (the caller decides on warnings).
@@ -37,45 +84,117 @@ export function resolveEnvFlags(configured, envValue) {
37
84
  }
38
85
  return flags;
39
86
  }
87
+ /** Normalize one layer's `extraFlags` answer (undefined = the layer is silent). */
88
+ function readLayerFlags(value) {
89
+ if (!Array.isArray(value))
90
+ return void 0;
91
+ if (!value.every((flag) => typeof flag === "string" && flag !== ""))
92
+ return void 0;
93
+ return value;
94
+ }
95
+ /** Normalize one layer's `chromePath` answer ("" when absent or unusable). */
96
+ function readLayerChromePath(value) {
97
+ return typeof value === "string" ? value.trim() : "";
98
+ }
40
99
  /**
41
- * Read the last UI-selected extraFlags list from the persisted user layer
42
- * when the settings service is already up and the stored value is valid.
43
- * The host consults this before the first bridge spawn so the very first
44
- * connection launches with the persisted flags — and every in-process
45
- * reconnect, which reuses the bridge config, comes back on them as well.
46
- * @param ctx - plugin context.
47
- * @returns the persisted flags array, or undefined when absent, invalid, or
48
- * the settings service is not available yet (the installSection initial
49
- * onChange then applies the persisted selection in place).
100
+ * One read of the configuration form's layers. `value` answers what runs now —
101
+ * the references resolve the user layer over the row config, which is exactly
102
+ * what the bridge launches with. `user` answers "did the user edit this?" (the
103
+ * selection source, and where the launch environment sits in the flags
104
+ * precedence), `base` "what does the row config say?", and both stay undefined
105
+ * until the form answers.
106
+ *
107
+ * The live-only volatile fields are not consulted here: they are Host answers,
108
+ * held in the controller's mirror and published, not read.
109
+ * @param config - the config `apply` received (references included).
110
+ * @param row - the described form row, when the service is already up.
50
111
  */
51
- export function readPersistedFlags(ctx) {
52
- try {
53
- const settings = ctx.get("settings");
54
- const section = settings?.document?.[SETTINGS_NAMESPACE];
55
- if (section === null || typeof section !== "object" || Array.isArray(section))
56
- return void 0;
57
- const value = section.extraFlags;
58
- if (Array.isArray(value) && value.every((flag) => typeof flag === "string" && flag !== "")) {
59
- return [...value];
60
- }
61
- }
62
- catch {
63
- // settings service not available yet: row config defaults apply.
64
- }
65
- return void 0;
112
+ export function readConfigLayers(config, row) {
113
+ const described = (row === null || typeof row !== "object" ? {} : row);
114
+ const describedLayer = (layer) => {
115
+ const source = layer === null || typeof layer !== "object" || Array.isArray(layer) ? {} : layer;
116
+ const flags = readLayerFlags(source.extraFlags);
117
+ const executables = Array.isArray(source.executables) ? normalizeEntries(source.executables) : void 0;
118
+ const paths = Array.isArray(source.chromeCustomPaths) ? normalizeCustomPaths(source.chromeCustomPaths) : void 0;
119
+ const stderrMode = source.stderrMode === "log" || source.stderrMode === "console" ? source.stderrMode : void 0;
120
+ const chromePath = typeof source.chromePath === "string" ? source.chromePath.trim() : void 0;
121
+ const dropped = Array.isArray(source.droppedExecutables)
122
+ ? source.droppedExecutables.filter((item) => typeof item === "string")
123
+ : void 0;
124
+ return {
125
+ ...(flags === void 0 ? {} : { extraFlags: flags }),
126
+ ...(chromePath === void 0 || chromePath === "" ? {} : { chromePath }),
127
+ ...(executables === void 0 ? {} : { executables }),
128
+ ...(dropped === void 0 ? {} : { droppedExecutables: dropped }),
129
+ ...(paths === void 0 ? {} : { chromeCustomPaths: paths }),
130
+ ...(stderrMode === void 0 ? {} : { stderrMode }),
131
+ ...(typeof source.refreshExecutablesNonce === "number" ? { refreshExecutablesNonce: source.refreshExecutablesNonce } : {}),
132
+ ...(typeof source.openWindowsChromeNonce === "number" ? { openWindowsChromeNonce: source.openWindowsChromeNonce } : {})
133
+ };
134
+ };
135
+ const value = {
136
+ extraFlags: readConfigField(config.extraFlags, [...DEFAULT_EXTRA_FLAGS]),
137
+ chromePath: readConfigField(config.chromePath, "").trim(),
138
+ executables: normalizeEntries(readConfigField(config.executables, [])),
139
+ droppedExecutables: readConfigField(config.droppedExecutables, []).filter((item) => typeof item === "string"),
140
+ chromeCustomPaths: normalizeCustomPaths(readConfigField(config.chromeCustomPaths, [])),
141
+ stderrMode: readConfigField(config.stderrMode, ""),
142
+ refreshExecutablesNonce: readConfigField(config.refreshExecutablesNonce, 0),
143
+ openWindowsChromeNonce: readConfigField(config.openWindowsChromeNonce, 0)
144
+ };
145
+ const base = describedLayer(described.base);
146
+ const hasLayers = described.user !== void 0 || described.base !== void 0;
147
+ return {
148
+ value,
149
+ // Before the form attaches nothing distinguishes the layers, so the
150
+ // references answer for the row config as well; the first commit reads the
151
+ // real layers and settles the distinction.
152
+ user: hasLayers ? describedLayer(described.user) : {},
153
+ base: hasLayers ? base : { ...value }
154
+ };
66
155
  }
67
156
  /**
68
- * Environment variable that seeds the launch flags for one dsh run: a
69
- * whitespace-separated extraFlags list, e.g.
70
- * `DSH_CHROME_MCP_FLAGS="--headless --isolated"`.
157
+ * The effective launch flags for one read of the layers (highest first: the
158
+ * user layer, `DSH_CHROME_MCP_FLAGS`, the row config, the schema default).
159
+ * Before the layers answer the references stand in, exactly the way the old cold
160
+ * path did. The executable-pinning flag never reaches argv — the picker owns
161
+ * that flag, so a layer that still carries one is answered as the selection
162
+ * source instead (see ./flags.ts), never as a second source of truth.
163
+ * @param layers - the last read of the form's layers.
164
+ * @param envValue - the launch environment's `DSH_CHROME_MCP_FLAGS` value.
71
165
  */
72
- export { FLAGS_ENV_VAR } from "./constants.js";
166
+ export function resolveLaunchFlags(layers, envValue) {
167
+ const user = readLayerFlags(layers.user.extraFlags);
168
+ if (user !== void 0)
169
+ return stripExecutablePathFlags(user);
170
+ const row = readLayerFlags(layers.base.extraFlags) ?? layers.value.extraFlags;
171
+ const fromEnv = resolveEnvFlags(row, envValue);
172
+ return stripExecutablePathFlags(fromEnv);
173
+ }
73
174
  /**
74
- * Resolve the effective bridge stderr mode. The persisted UI toggle
75
- * (`stderrMode`) wins when set; otherwise the row-config `bridgeStderr`
76
- * (mirrored into the base layer as `rowStderr`). An invalid/empty override
77
- * falls back to the row config.
78
- * @param override - persisted `stderrMode` value, or "".
175
+ * The effective executable selection for one read of the layers: the user layer
176
+ * (the card's pick, or the host's one seed) wins, then the row config — its
177
+ * legacy `--executablePath` folded in — and, before either answers, nothing.
178
+ * There is no auto source and nothing is re-resolved here: a path that breaks
179
+ * keeps breaking so what the pill claims keeps being what the bridge runs.
180
+ */
181
+ export function resolveSelection(layers) {
182
+ const userPath = readLayerChromePath(layers.user.chromePath);
183
+ if (userPath !== "")
184
+ return { path: userPath, source: "selected", pinned: false };
185
+ const baseChromePath = readLayerChromePath(layers.base.chromePath);
186
+ if (baseChromePath !== "")
187
+ return { path: baseChromePath, source: "row-config", pinned: false };
188
+ const pinned = extractExecutablePathFlag(readLayerFlags(layers.base.extraFlags) ?? []);
189
+ if (pinned !== "")
190
+ return { path: pinned, source: "row-config", pinned: true };
191
+ return { path: "", source: "", pinned: false };
192
+ }
193
+ /**
194
+ * Resolve the effective bridge stderr mode. The user layer's toggle
195
+ * (`stderrMode`) wins when it states one; otherwise the row config's
196
+ * `bridgeStderr`. An invalid/empty override falls back to the row config.
197
+ * @param override - the persisted `stderrMode` value, or "".
79
198
  * @param rowDefault - the validated row-config `bridgeStderr` ("log"/"console").
80
199
  * @returns "log" | "console".
81
200
  */
@@ -84,6 +203,29 @@ export function resolveStderrMode(override, rowDefault) {
84
203
  return override;
85
204
  return rowDefault === "console" ? "console" : "log";
86
205
  }
206
+ /**
207
+ * The effective bridge stderr mode from one read of the form's layers, in the
208
+ * precedence every other layer-resolved field follows: what the user layer says
209
+ * wins, the **row config** answers under it, and what the references resolved at
210
+ * boot sits under that again (the references answer both layers before the form
211
+ * attaches, so the cold path keeps answering).
212
+ *
213
+ * The `base` step is what keeps the answer single. The references can resolve an
214
+ * empty `stderrMode` for a row that states one — no user layer ever wrote it —
215
+ * while the described row still serves it, and then the card states one mode
216
+ * while the bridge runs the other. A control that diffs its own flip against
217
+ * what is *effective* drops every flip as "already served" against a stale
218
+ * mirror, which is exactly the dead toggle: the profile that configures the
219
+ * switch in its own row is the profile that can never switch it. Reading the
220
+ * row-config layer here makes the Host state the same mode the card states, and
221
+ * the mirror it publishes then stays honest on its own.
222
+ * @param layers - the last read of the form's layers.
223
+ * @param rowDefault - the validated row-config `bridgeStderr` ("log"/"console").
224
+ * @returns "log" | "console".
225
+ */
226
+ export function resolveStderrModeFromLayers(layers, rowDefault) {
227
+ return resolveStderrMode(layers.user.stderrMode ?? layers.base.stderrMode ?? layers.value.stderrMode, rowDefault);
228
+ }
87
229
  /**
88
230
  * The effective Chrome executable path (highest first):
89
231
  *
@@ -97,7 +239,7 @@ export function resolveStderrMode(override, rowDefault) {
97
239
  * Nothing here consults the scan list: a fixed path stays fixed even when it
98
240
  * breaks, because re-resolving would be an auto mode in disguise.
99
241
  *
100
- * @param userLayer - persisted `chromePath` value ("" or absent when unset).
242
+ * @param userLayer - the persisted `chromePath` value ("" when unset).
101
243
  * @param rowConfig - validated row-config `chromePath` value.
102
244
  * @returns the trimmed effective path, possibly "".
103
245
  */
@@ -105,62 +247,47 @@ export function resolveEffectiveChromePath(userLayer, rowConfig) {
105
247
  const user = typeof userLayer === "string" ? userLayer.trim() : "";
106
248
  if (user !== "")
107
249
  return user;
108
- const config = typeof rowConfig === "string" ? rowConfig.trim() : "";
109
- return config;
250
+ return typeof rowConfig === "string" ? rowConfig.trim() : "";
110
251
  }
111
252
  /**
112
- * Read the last UI-seeded (or host-seeded) `chromePath` from the persisted user
113
- * layer when the settings service is already up. ""/absent/invalid means
114
- * "nothing picked yet".
115
- * @param ctx - plugin context.
253
+ * The persisted user-layer `extraFlags` list (undefined = the user never said
254
+ * anything, so the launch environment answers instead).
255
+ * @param layers - the last read of the form's layers.
116
256
  */
117
- export function readPersistedChromePath(ctx) {
118
- return readPersistedStringField(ctx, "chromePath");
257
+ export function readPersistedFlags(layers) {
258
+ return readLayerFlags(layers.user.extraFlags);
119
259
  }
120
260
  /**
121
- * Read the last persisted "Reduce log output" mode from the persisted user
122
- * layer when the settings service is already up. Empty/absent/invalid means
123
- * "follow the row config".
124
- * @param ctx - plugin context.
261
+ * The last UI-seeded (or host-seeded) `chromePath` from the user layer ("" means
262
+ * "nothing picked yet" → fall back to the row config).
263
+ * @param layers - the last read of the form's layers.
264
+ */
265
+ export function readPersistedChromePath(layers) {
266
+ return readLayerChromePath(layers.user.chromePath);
267
+ }
268
+ /**
269
+ * The last persisted "Reduce log output" mode from the user layer.
270
+ * Empty/absent/invalid means "follow the row config".
271
+ * @param layers - the last read of the form's layers.
125
272
  * @returns "log" | "console" when explicitly set, "" otherwise.
126
273
  */
127
- export function readPersistedStderrMode(ctx) {
128
- try {
129
- const settings = ctx.get("settings");
130
- const section = settings?.document?.[SETTINGS_NAMESPACE];
131
- if (section === null || section === void 0 || typeof section !== "object" || Array.isArray(section))
132
- return "";
133
- const value = section.stderrMode;
134
- if (value === "log" || value === "console")
135
- return value;
136
- }
137
- catch {
138
- // settings service not available yet: row config default applies.
139
- }
140
- return "";
274
+ export function readPersistedStderrMode(layers) {
275
+ const mode = layers.user.stderrMode;
276
+ return mode === "log" || mode === "console" ? mode : "";
141
277
  }
142
278
  /**
143
- * Read the persisted custom-executable MRU from the user layer when the
144
- * settings service is already up. Invalid entries (non-string, empty, control
145
- * characters) are dropped rather than poisoning the candidate list.
146
- * @param ctx - plugin context.
279
+ * The persisted custom-executable MRU from the user layer — a **legacy** field
280
+ * nothing writes any more, read once to fold the older hand-typed paths into
281
+ * the rows. Invalid entries (non-string, empty, control characters) are dropped
282
+ * rather than poisoning the candidate list.
283
+ * @param layers - the last read of the form's layers.
147
284
  * @returns the stored paths, trimmed and deduplicated ("" list when absent).
148
285
  */
149
- export function readPersistedCustomPaths(ctx) {
150
- try {
151
- const settings = ctx.get("settings");
152
- const section = settings?.document?.[SETTINGS_NAMESPACE];
153
- if (section === null || section === void 0 || typeof section !== "object" || Array.isArray(section))
154
- return [];
155
- const value = section.chromeCustomPaths;
156
- if (!Array.isArray(value))
157
- return [];
158
- return normalizeCustomPaths(value);
159
- }
160
- catch {
161
- // settings service not available yet: no custom candidates.
162
- return [];
163
- }
286
+ export function readPersistedCustomPaths(layers) {
287
+ const paths = layers.user.chromeCustomPaths;
288
+ if (paths === void 0)
289
+ return normalizeCustomPaths(layers.value.chromeCustomPaths);
290
+ return normalizeCustomPaths(paths);
164
291
  }
165
292
  /**
166
293
  * Normalized form of a **legacy** custom-path list: trimmed, empty entries
@@ -191,22 +318,87 @@ export function normalizeCustomPaths(value, cap = CUSTOM_PATHS_CAP) {
191
318
  return paths;
192
319
  return paths.slice(0, cap);
193
320
  }
194
- /** Read one persisted string field of the `chrome-mcp` section ("" when
195
- * absent, invalid or the service is not up yet). */
196
- function readPersistedStringField(ctx, field) {
197
- try {
198
- const settings = ctx.get("settings");
199
- const section = settings?.document?.[SETTINGS_NAMESPACE];
200
- if (section === null || section === void 0 || typeof section !== "object" || Array.isArray(section))
201
- return "";
202
- const value = section[field];
203
- if (typeof value !== "string")
204
- return "";
205
- const trimmed = value.trim();
206
- return /[\x00-\x1f\x7f]/u.test(trimmed) ? "" : trimmed;
207
- }
208
- catch {
209
- return "";
321
+ /**
322
+ * The saved executable rows the picker shows: re-normalized on every read, since
323
+ * what a form write hands may carry any shape.
324
+ * @param layers - the last read of the form's layers.
325
+ */
326
+ export function readSavedExecutables(layers) {
327
+ return normalizeEntries(layers.user.executables ?? layers.value.executables);
328
+ }
329
+ /**
330
+ * The ids of rows the user has dropped — the ids every merge step must skip so a
331
+ * deletion outlives the run behind the write that made it (see ./schema.ts
332
+ * `droppedExecutables`). Deduped; a malformed entry drops out exactly like a
333
+ * malformed row id.
334
+ * @param layers - the last read of the form's layers.
335
+ */
336
+ export function readDroppedExecutables(layers) {
337
+ const raw = (layers.user.droppedExecutables ?? layers.value.droppedExecutables);
338
+ if (!Array.isArray(raw))
339
+ return [];
340
+ const out = [];
341
+ const seen = new Set();
342
+ for (const item of raw) {
343
+ if (typeof item !== "string")
344
+ continue;
345
+ const id = item.trim();
346
+ if (id === "" || seen.has(id))
347
+ continue;
348
+ seen.add(id);
349
+ out.push(id);
210
350
  }
351
+ return out;
352
+ }
353
+ /**
354
+ * The live mirror's field names — the fields the Host answers through the
355
+ * volatile references and never authors by hand. Every write that lands in the
356
+ * stored row carries this list as **unset** ops: each unset returns the field to
357
+ * the answer beneath its own patch layer — what the row config says — so what
358
+ * only the live references stand drops out of what the write lands instead of
359
+ * riding the write into the file. This is what keeps the persistence boundary
360
+ * from the inside: a live commit answers, a persisted write clears (measured
361
+ * live 2026-10-12: booting the plugin with no user write at all filled the row
362
+ * with the whole live mirror; with the clear riding the write the row stays
363
+ * clean, and a row that already carries leaked live keys is healed by its first
364
+ * write).
365
+ */
366
+ export function liveMirrorKeys() {
367
+ return Object.keys(createLiveMirror());
368
+ }
369
+ /**
370
+ * The mirror the Host publishes: what every live field answers when nothing has
371
+ * run yet. The whole point of starting from the defaults is that a card reads
372
+ * exactly what a Host with no answers would serve, never a hole.
373
+ */
374
+ export function createLiveMirror() {
375
+ return {
376
+ lastError: "",
377
+ chromeMissing: false,
378
+ executableDiscoveryRevision: 0,
379
+ chromeVersion: "",
380
+ executableStatus: [],
381
+ effectiveChromePath: "",
382
+ effectiveSource: "",
383
+ stderrEffective: "log",
384
+ defaultExtraFlags: readDefaultExtraFlags(),
385
+ wslExtraFlags: readWslExtraFlags(),
386
+ wslWindowsExecutable: false,
387
+ windowsChromeStatus: { state: "off", port: 0, error: "" },
388
+ carriesConnectionMode: false,
389
+ runningFlags: [],
390
+ runningNote: ""
391
+ };
392
+ }
393
+ /**
394
+ * Read the row's two layers through the settings service. Undefined when the
395
+ * service (or this entry) is not described yet — the cold path, where only the
396
+ * references answer.
397
+ * @param settings - the settings service (`SettingsForms`), when resolved.
398
+ * @param entryId - the profile entry id this row is keyed by.
399
+ */
400
+ export function readConfigForm(settings, entryId) {
401
+ // A service that cannot answer is the same cold path as no service.
402
+ return readFormRow(settings, entryId);
211
403
  }
212
404
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/host/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,UAAoB,EAAE,QAAiB;IACnE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,UAAU,CAAC;IAC9E,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IACnE,IAAI,CAAC;QACD,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAkB;IACjD,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,CAAC,kBAAkB,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC;QAC7F,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;QACjC,IAAI,KAAK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AAE;QACnB,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,qBAAqB,EAAE;QAC1C,aAAa,EAAE,iBAAiB,EAAE;QAClC,oBAAoB,EAAE,KAAK;QAC3B,mBAAmB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACzD,qBAAqB,EAAE,KAAK;QAC5B,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAClB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAmC,EAAE,OAAe;IAC/E,oEAAoE;IACpE,OAAO,WAAW,CAAkB,QAAiB,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC"}
@@ -1,16 +1,27 @@
1
1
  /** The connect address one debugging port answers for. */
2
2
  export declare function windowsChromeUrl(port: number): string;
3
- /** The debugging port one `--browserUrl=` entry carries, 0 when the list
4
- * carries none (or one this helper cannot read). */
3
+ /** The debugging port the live connect entry carries, 0 when the list carries
4
+ * none. The entry's **spelling** is irrelevant: the port is read through the
5
+ * very predicate that decides connect mode (`carriesConnectionMode` in
6
+ * `./flags.ts`), so `--browserUrl=<url>`, `--browserUrl <url>` (the two-entry
7
+ * form the whitespace-split env source produces), one string carrying its
8
+ * value after whitespace, and `--wsEndpoint=<url>` all answer with the live
9
+ * port instead of reading as "no live session". */
5
10
  export declare function browserUrlFlagPort(flags: unknown): number;
6
11
  /**
7
- * Replace this plugin's own connect entry and keep everything else: an entry
8
- * already pinned to `--browserUrl=` is rewritten in place (one connect source,
9
- * never two), and a list without one gets the entry appended. That is the
10
- * idempotency rule the saved-executable merge follows for a repeated id.
12
+ * Collapse every connect entry the list carries into the run's own address, so
13
+ * the saved list keeps exactly **one** connect source whatever spelling it was
14
+ * stored in — the same idempotency rule the saved-executable merge follows for
15
+ * a repeated id, keyed now on the whole connect-mode predicate rather than one
16
+ * flag spelling. An entry that carries its value as the *following* entry (the
17
+ * `--browserUrl <url>` form the whitespace-split env source produces) consumes
18
+ * that value with it, so no bare URL survives as a stray argv item.
19
+ *
11
20
  * The one thing that does not survive is a `--user-data-dir` row: connect
12
- * carries no local profile to hand the browser, upstream refuses both at
13
- * once, so keeping a saved Flags-WSL row would leave the bridge unspawnable.
21
+ * carries no local profile to hand the browser, upstream refuses both at once,
22
+ * so keeping a saved Flags-WSL row would leave the bridge unspawnable
23
+ * (`Arguments userDataDir and browserUrl are mutually exclusive`, measured live
24
+ * with chrome-devtools-mcp).
14
25
  */
15
26
  export declare function withBrowserUrlFlag(flags: unknown, url: string): string[];
16
27
  //# sourceMappingURL=connect-flags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-flags.d.ts","sourceRoot":"","sources":["../../../src/host/windows/connect-flags.ts"],"names":[],"mappings":"AAYA,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;oDACoD;AACpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASzD;AAQD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBxE"}
1
+ {"version":3,"file":"connect-flags.d.ts","sourceRoot":"","sources":["../../../src/host/windows/connect-flags.ts"],"names":[],"mappings":"AAaA,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;mDAMmD;AACnD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAoBzD;AAQD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CA0BxE"}