@narumitw/pi-chrome-devtools 0.53.1 → 0.53.3

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 (41) hide show
  1. package/README.md +89 -230
  2. package/dist/chunks/{browser-settings-menu-REIU7C3Q.js → browser-settings-menu-SR7KLZT6.js} +16 -42
  3. package/dist/chunks/browser-settings-menu-SR7KLZT6.js.map +7 -0
  4. package/dist/chunks/{chunk-GTTYS5GT.js → chunk-4KMN4SFF.js} +2 -2
  5. package/dist/chunks/chunk-4KMN4SFF.js.map +7 -0
  6. package/dist/chunks/{chunk-SRT3UUIP.js → chunk-F5VG35UI.js} +23 -74
  7. package/dist/chunks/chunk-F5VG35UI.js.map +7 -0
  8. package/dist/chunks/{chunk-YJVYJ2L2.js → chunk-MZCGM6D3.js} +43 -48
  9. package/dist/chunks/chunk-MZCGM6D3.js.map +7 -0
  10. package/dist/chunks/{menu-H5HMVGHI.js → menu-YR4VRT7D.js} +10 -23
  11. package/dist/chunks/menu-YR4VRT7D.js.map +7 -0
  12. package/dist/chunks/{tools-6P7EUX37.js → tools-6R7Z6HWJ.js} +17 -59
  13. package/dist/chunks/tools-6R7Z6HWJ.js.map +7 -0
  14. package/dist/index.ts +23 -48
  15. package/dist/index.ts.map +2 -2
  16. package/docs/browser-setup.md +147 -0
  17. package/package.json +54 -55
  18. package/src/browser-manager.ts +872 -942
  19. package/src/browser-settings-menu.ts +315 -350
  20. package/src/cdp-client.ts +381 -398
  21. package/src/chrome-devtools.ts +205 -232
  22. package/src/display.ts +35 -0
  23. package/src/lazy-tools.ts +158 -181
  24. package/src/menu.ts +409 -446
  25. package/src/render.ts +74 -84
  26. package/src/runtime.ts +137 -140
  27. package/src/screenshot.ts +170 -186
  28. package/src/settings.ts +472 -523
  29. package/src/tool-names.ts +8 -14
  30. package/src/tool-selector.ts +245 -289
  31. package/src/tools.ts +218 -226
  32. package/src/webmcp/discovery.ts +184 -188
  33. package/src/webmcp/policy.ts +296 -329
  34. package/src/webmcp/protocol.ts +324 -337
  35. package/src/webmcp/tools.ts +136 -147
  36. package/dist/chunks/browser-settings-menu-REIU7C3Q.js.map +0 -7
  37. package/dist/chunks/chunk-GTTYS5GT.js.map +0 -7
  38. package/dist/chunks/chunk-SRT3UUIP.js.map +0 -7
  39. package/dist/chunks/chunk-YJVYJ2L2.js.map +0 -7
  40. package/dist/chunks/menu-H5HMVGHI.js.map +0 -7
  41. package/dist/chunks/tools-6P7EUX37.js.map +0 -7
package/README.md CHANGED
@@ -2,189 +2,78 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@narumitw/pi-chrome-devtools)](https://www.npmjs.com/package/@narumitw/pi-chrome-devtools) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4
4
 
5
- Let Pi inspect browser tabs, navigate pages, evaluate JavaScript, and capture screenshots through native Chrome DevTools Protocol tools.
6
-
7
- Use it for web debugging, UI validation, and browser-assisted investigation without running an MCP server.
8
-
9
- The design is inspired by [`chrome-devtools-mcp`](https://github.com/ChromeDevTools/chrome-devtools-mcp), not guaranteed to be compatible with it.
5
+ Inspect browser tabs, navigate pages, evaluate JavaScript, and capture screenshots from Pi through the Chrome DevTools Protocol.
6
+ Use these native Pi tools for web debugging, UI validation, and browser-assisted investigation without an MCP server.
7
+ The design is inspired by [`chrome-devtools-mcp`](https://github.com/ChromeDevTools/chrome-devtools-mcp), but compatibility is not guaranteed.
10
8
 
11
9
  ## ✨ Features
12
10
 
13
11
  - Lists and selects inspectable pages, navigates URLs, evaluates JavaScript, and captures PNG screenshots.
14
- - Reuses an existing CDP endpoint or lazily launches an isolated Chromium-family browser.
15
- - Recovers from stale page selections and reports actionable browser startup or endpoint errors.
12
+ - Reuses an existing CDP endpoint or launches an isolated Chromium-family browser on first use.
13
+ - Recovers from stale page selections and explains browser startup or endpoint failures.
16
14
  - Loads explicitly approved unpacked extensions only in an extension-owned Chrome for Testing or Chromium process.
17
- - Uses native deferred browser tools when supported and eager exposure otherwise, with availability, setup, status, and help through `/chrome-devtools`.
15
+ - Uses native deferred browser tools when supported and exposes allowed tools eagerly otherwise.
16
+ - Provides availability controls, setup guidance, status, and help through `/chrome-devtools`.
18
17
  - Shows compact expandable results and activity only while browser tools are running.
19
18
  - Persists reviewed tool availability while keeping browser connection settings machine-owned.
20
19
  - Offers opt-in experimental WebMCP discovery and invocation through two fixed gateway tools without dynamically registering page-provided definitions.
21
20
 
22
21
  ## 📦 Install
23
22
 
23
+ Install persistently:
24
+
24
25
  ```bash
25
26
  pi install npm:@narumitw/pi-chrome-devtools
26
27
  ```
27
28
 
28
- Try without installing permanently:
29
+ Run once from npm:
29
30
 
30
31
  ```bash
31
32
  pi -e npm:@narumitw/pi-chrome-devtools
32
33
  ```
33
34
 
34
- Build and try this package locally from the repository root:
35
+ Build and run a local checkout from the repository root:
35
36
 
36
37
  ```bash
37
38
  npm --workspace @narumitw/pi-chrome-devtools run build
38
39
  pi -e ./packages/pi-chrome-devtools
39
40
  ```
40
41
 
41
- The package declares `dist/index.ts`, so an unbuilt local checkout must run the build before Pi loads the package directory.
42
+ The package declares `dist/index.ts`, so build a local checkout before loading its package directory.
43
+
44
+ Pi extensions run with your user permissions.
45
+ Review third-party extension source before installing it.
42
46
 
43
47
  ## 🚀 Quick start
44
48
 
45
- Start Pi and ask the agent to load the Chrome DevTools capability needed for the task.
46
- The extension first tries `http://127.0.0.1:9222` and otherwise launches an isolated local Chromium-family browser by default.
47
- Run `/chrome-devtools` to review browser status, settings, help, and available tools.
48
- Experimental WebMCP remains disabled until the user explicitly enables it.
49
+ Start Pi and ask the agent to load the browser capability needed for the task.
50
+ By default, the extension tries `http://127.0.0.1:9222` and launches an isolated local Chromium-family browser if that endpoint is unavailable.
51
+ Run `/chrome-devtools` to review status, settings, help, and available tools.
52
+ WebMCP remains disabled until you explicitly enable it.
49
53
 
50
54
  ## 🌐 Browser setup
51
55
 
52
- Without unpacked extensions, the extension first tries `browser.endpoint`, defaulting to `http://127.0.0.1:9222`.
53
- If that endpoint is unavailable and `browser.autoLaunch` is `true`, it lazily launches an extension-owned browser with an isolated temporary profile and retries the CDP request.
54
- Existing endpoints are reused and never terminated by the extension.
55
-
56
- Configure the canonical user file at `${PI_CODING_AGENT_DIR:-~/.pi/agent}/pi-chrome-devtools.json`:
57
-
58
- ```json
59
- {
60
- "browser": {
61
- "endpoint": "http://127.0.0.1:9222",
62
- "autoLaunch": true,
63
- "executablePath": "/absolute/path/to/chromium"
64
- }
65
- }
66
- ```
67
-
68
- `browser.endpoint` must be an HTTP origin with an explicit port and no credentials, path, query, or fragment.
69
- Omitting it keeps attach-first behavior on `127.0.0.1:9222` and lets a managed launch use Chrome's dynamic DevTools port mode (`--remote-debugging-port=0`).
70
- Explicitly saving an endpoint pins managed launches to that port.
71
- `browser.autoLaunch` defaults to `true`.
72
- `browser.executablePath` is optional and must be an absolute path; when absent, normal browser discovery applies.
73
-
74
- The configured endpoint must expose the standard CDP HTTP discovery routes such as `/json/version` and `/json/list`.
75
- Chrome's newer built-in permission flow can listen on port `9222` while returning `404` from those routes; setting the same HTTP origin does not by itself make that flow compatible.
56
+ By default, the extension attaches to `http://127.0.0.1:9222` or launches an isolated local browser on first use.
57
+ It never closes an external browser.
58
+ Use `/chrome-devtools` → **Browser settings** to change the endpoint, auto-launch policy, or executable.
76
59
 
77
- ### Unpacked extensions
60
+ Read the [browser setup reference](./docs/browser-setup.md) for endpoint requirements, executable discovery, unpacked extensions, manual launch, and deprecated environment overrides.
61
+ Manual settings edits apply after `/reload` or session replacement.
78
62
 
79
63
  > [!WARNING]
80
- > An unpacked extension executes privileged browser code.
81
- > Load only code you trust.
82
- > Project settings are honored only when Pi reports the project as trusted.
83
-
84
- Add trusted unpacked-extension paths to the same canonical user file:
85
-
86
- ```json
87
- {
88
- "browser": {
89
- "executablePath": "/absolute/path/to/chrome-for-testing",
90
- "extensionPaths": [
91
- "/absolute/path/to/unpacked-extension-one",
92
- "/absolute/path/to/unpacked-extension-two"
93
- ]
94
- }
95
- }
96
- ```
97
-
98
- Every user-file path must be absolute.
99
- Each extension path must resolve to a directory containing a valid `manifest.json` and cannot contain a comma because Chrome uses commas to separate multiple startup paths.
100
- For extension-configured sessions, `executablePath` must identify Chrome for Testing or Chromium.
101
- Branded Google Chrome is rejected because tested releases can silently ignore unpacked-extension startup flags.
102
-
103
- A trusted project can replace the user extension list in `<workspace>/.pi/pi-chrome-devtools.json`.
104
- Relative paths resolve from the workspace (`ctx.cwd`):
105
-
106
- ```json
107
- {
108
- "browser": {
109
- "extensionPaths": ["./extension"]
110
- }
111
- }
112
- ```
113
-
114
- Project `extensionPaths` replace, rather than append to, the user array.
115
- A project file cannot override `browser.endpoint`, `browser.autoLaunch`, or `browser.executablePath`; browser connection settings remain machine-owned user configuration.
116
- Effective precedence is defaults, user settings, trusted project extension paths, then deprecated environment overrides.
117
- No new environment variable is required.
118
-
119
- When `extensionPaths` is non-empty, the extension skips attach-first behavior and starts an isolated, extension-owned managed browser with `--disable-extensions-except` and `--load-extension`.
120
- It fails before spawning when the endpoint is remote, auto-launch is disabled, an explicit port is occupied, the executable is missing, or the browser product is unsupported.
121
- It never adds extensions to, modifies, restarts, or closes an external browser.
122
-
123
- Settings are loaded on session start.
124
- After editing JSON, use `/reload` or replace the session; the old managed browser is closed before the new configuration is applied.
125
- Missing files preserve the existing no-extension behavior.
126
- Invalid JSON, invalid browser values, and missing manifests are left unchanged and ignored with an actionable warning.
64
+ > Unpacked extensions execute privileged browser code; load only trusted code.
65
+ > They require an extension-owned Chrome for Testing or Chromium process.
66
+ > Trusted project settings may replace only the extension-path list, not machine-owned connection settings.
127
67
 
128
68
  ### Experimental WebMCP
129
69
 
130
70
  > [!WARNING]
131
- > WebMCP support is experimental, disabled by default, and subject to Chrome protocol changes.
132
- > Page-provided tools operate the visible page with its current authentication, entitlement, and UI state.
133
- > Every call requires observable confirmation, including tools that claim to be read-only.
134
-
135
- Enable WebMCP only in the canonical user settings file:
136
-
137
- ```json
138
- {
139
- "webmcp": {
140
- "enabled": true
141
- }
142
- }
143
- ```
144
-
145
- A project `pi-chrome-devtools.json` cannot enable WebMCP or weaken confirmation policy.
146
- The settings menu labels WebMCP as experimental, persists the user-owned boolean atomically, and aborts active WebMCP work before disablement or browser replacement.
147
- The two gateway tools remain unavailable while the gate is disabled even if an older `tools` array contains their names.
148
- After enabling the gate, choose whether each gateway is available through `/chrome-devtools tools` or the main menu.
149
-
150
- WebMCP requires a Chrome build whose `/json/protocol` exposes the experimental `WebMCP` domain.
151
- Origin-trial sites must meet Chrome's Origin Trial, origin isolation, Permissions Policy, authentication, and browser feature requirements.
152
- For local pages outside an Origin Trial, open `chrome://flags/#enable-webmcp-testing`, enable **WebMCP for testing**, and relaunch a compatible Chrome build.
153
- The extension does not automatically add testing flags to a managed browser.
154
-
155
- `chrome_devtools_webmcp_list_tools` opens an operation-scoped page CDP session, lists frame-aware page tools, and returns bounded metadata with a deterministic schema-and-annotation digest.
156
- `chrome_devtools_webmcp_call_tool` re-discovers the exact page, document loader, frame, origin, tool, schema, annotations, and session generation before invocation and again after confirmation.
157
- The call gateway rejects print and JSON modes because they cannot provide observable confirmation.
158
- TUI and RPC modes use Pi's standard confirmation dialog.
159
- Cancellation is forwarded to Chrome through `WebMCP.cancelInvocation` after Chrome returns an invocation ID.
160
-
161
- Page URLs, origins, names, descriptions, schemas, errors, and outputs are untrusted.
162
- Displayed text strips terminal controls and bidirectional overrides, accepted JSON has explicit byte, depth, and collection limits, and model-visible output is capped at 50 KB or 2,000 lines.
163
- CDP text messages are capped at 8 MB before JSON parsing.
164
- Page-controlled `pattern` and `patternProperties` schemas and schemas exceeding 128 combinator or dependent-schema branches are rejected because they cannot be evaluated safely on Pi's main thread.
165
- Annotations are descriptive hints only and never authorize a call.
166
- WebMCP is not backend MCP, generic browser automation, or a way to bypass browser policy.
167
-
168
- If listing reports that the WebMCP domain is unavailable, update Chrome and verify `/json/protocol` contains `WebMCP`.
169
- If a page lists no tools, verify that the site participates in the Origin Trial or that **WebMCP for testing** is enabled for local development.
170
- If a call reports a stale identity, list tools again after navigation, reload, frame changes, tool registration changes, settings changes, or browser replacement.
171
- Attached everyday browser profiles receive a stronger confirmation warning than isolated managed profiles.
71
+ > WebMCP is experimental, disabled by default, and subject to Chrome protocol changes.
72
+ > Page tools use the visible page's current authentication and require confirmation on every call.
172
73
 
173
- ### Deprecated environment overrides and manual endpoints
174
-
175
- The existing `PI_CHROME_DEVTOOLS_HOST`, `PI_CHROME_DEVTOOLS_PORT`, `PI_CHROME_DEVTOOLS_AUTO_LAUNCH`, and `PI_CHROME_DEVTOOLS_BROWSER` variables remain temporary compatibility overrides.
176
- They still take precedence over JSON, but every session that sees one emits a deprecation warning.
177
- Move their values to `browser.endpoint`, `browser.autoLaunch`, and `browser.executablePath`; the variables will be removed in a future version.
178
-
179
- Without unpacked extensions, browser discovery still checks platform-specific Chrome, Chromium, Brave, and Microsoft Edge candidates.
180
- Manual launch remains available when no unpacked extensions are configured:
181
-
182
- ```bash
183
- google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/pi-chrome-devtools
184
- ```
185
-
186
- On session shutdown, the extension terminates only browser processes it started and best-effort removes their temporary profiles.
187
- It never closes user-started browsers or remote endpoints.
74
+ Enable `webmcp.enabled` only in user settings, then choose which gateway tools are available through `/chrome-devtools tools`.
75
+ Project settings cannot enable WebMCP or weaken confirmation.
76
+ See [WebMCP setup and troubleshooting](./docs/browser-setup.md#experimental-webmcp) for compatible Chrome builds, browser flags, schema limits, and stale-page recovery.
188
77
 
189
78
  ## 🛠️ Tools
190
79
 
@@ -199,30 +88,23 @@ It never closes user-started browsers or remote endpoints.
199
88
 
200
89
  ### Tool exposure
201
90
 
202
- All eight tools are registered: one loader, five stable DevTools capabilities, and two fixed experimental WebMCP gateways.
203
-
204
- On a model/provider with native deferred-tool support, only `chrome_devtools_load` starts active for this extension.
205
-
91
+ The extension registers eight tools: one loader, five stable DevTools capabilities, and two fixed experimental WebMCP gateways.
92
+ With native deferred-tool support, only `chrome_devtools_load` starts active.
206
93
  The loader accepts a task-oriented `query`, matches it against the five stable capabilities plus enabled WebMCP gateways, and adds matching available tools without removing any active Pi tool.
207
-
208
94
  Loaded capability tools remain active for the rest of the session unless the user makes them unavailable through `/chrome-devtools`.
209
95
 
210
96
  Pi uses native deferred tool references on compatible Anthropic models, native additional-tools or tool-search loading on compatible OpenAI and Codex Responses models, and native Kimi loading on compatible OpenAI Chat Completions models.
211
-
212
97
  Kimi-compatible models declare `compat.deferredToolsMode: "kimi"` in Pi's model metadata.
213
-
214
98
  `azure-openai-responses` remains eager because Pi's Azure adapter does not implement native deferred tool-search serialization.
99
+ Fireworks Messages models also remain eager because their native protocol requires the canonical `ToolSearch` or `tool_search` loader name, while this independently installable package keeps the collision-safe `chrome_devtools_load` name.
215
100
 
216
101
  When the selected model/provider lacks native deferred support, the extension activates every capability allowed by settings before the next model request instead of using Pi's cache-invalidating lazy-loading fallback.
217
-
218
102
  After a session enters eager exposure, it stays eager across later model switches to avoid removing tool definitions within that session.
219
-
220
103
  The capability tools omit active-only prompt snippets so native deferred loading does not rebuild the system-prompt prefix.
221
104
 
222
105
  The saved `tools` array controls which capabilities the extension may expose.
223
- The `webmcp.enabled` gate is applied before that catalog, so persisted WebMCP names cannot bypass a disabled gate.
106
+ The `webmcp.enabled` gate takes precedence, so persisted WebMCP names cannot bypass a disabled gate.
224
107
  Page-provided tool definitions appear only in list results and never alter Pi's provider-visible tool definitions.
225
-
226
108
  An empty array leaves the loader active but makes every browser capability unavailable.
227
109
 
228
110
  ### Screenshot files
@@ -253,55 +135,25 @@ If the model cannot inspect the inline image, ask it to read the saved path, for
253
135
 
254
136
  ## 💬 Commands
255
137
 
256
- ```text
257
- /chrome-devtools
258
- ```
259
-
260
- Opens a menu that shows the tool catalog size, whether that catalog is saved, the configured endpoint, the observed managed-browser state, and any settings or launch warning before you choose an action.
261
- The five actions stay on one level:
262
-
263
- - **Choose available browser tools…** — stage any combination of the five stable capabilities and, when enabled, the two experimental WebMCP gateways, then review the exact available/unavailable result before selecting **Apply tool changes**.
264
- - **Make all browser tools available…** or **Make all browser tools unavailable…** — preview the context-appropriate bulk change before applying it.
265
- - **Browser status** — inspect runtime, endpoint, launch mode, and the last launch attempt without probing the endpoint or starting Chrome.
266
- - **Browser settings** — immediately save the endpoint, auto-launch policy, browser executable, or experimental WebMCP gate.
267
- Inspect unpacked-extension paths and effective sources.
268
- A deprecated environment override remains effective until removed even when its underlying JSON value changes.
269
- - **Help** — view command usage and return to the menu.
270
-
271
- In the tool screen, **Select all** and **Select none** are unambiguous shortcuts; individual rows use friendly task labels while retaining their raw `chrome_devtools_*` identity in the description.
272
- Toggles remain a command-local draft.
273
- **Review changes** previews the exact effect, **Apply tool changes** saves it, and Cancel, Escape, Ctrl+C, disposal, or session replacement discards an unconfirmed draft without changing runtime tools or settings.
274
- A failed apply restores the previous availability and loaded-tool state, preserves the settings file, retains the draft for retry, and reports how to recover.
275
-
276
- Direct subcommands are also available:
277
-
278
- ```text
279
- /chrome-devtools help
280
- /chrome-devtools quickstart
281
- /chrome-devtools status
282
- /chrome-devtools settings
283
- /chrome-devtools tools
284
- /chrome-devtools toggle
285
- /chrome-devtools enable
286
- /chrome-devtools disable
287
- ```
288
-
289
- Compatibility aliases remain available: `toggle` and `select` mean `tools`, `on` means `enable`, and `off` means `disable`.
290
-
291
- - `help` shows command usage.
292
- - `quickstart` shows the configured CDP endpoint, endpoint source, auto-launch mode, browser candidates, last launch attempt, and launch hints.
293
- - `status` shows available and loaded capability counts, loader state, the persisted catalog, settings file path, endpoint source, launch mode, last launch attempt, and active non-Chrome tool count.
294
- - `settings` opens the same immediate-save browser settings flow used by the menu.
295
- - `tools` opens the same staged, width-safe availability and review flow used by the menu.
296
- - `toggle` and `select` are compatibility aliases for `tools`.
297
- - `enable` makes all currently gated capability tools available and follows the current native-deferred or eager exposure mode; `on` is a compatibility alias.
298
- - `disable` makes all capability tools unavailable and saves the empty catalog; `off` is a compatibility alias.
299
- The slash command and `chrome_devtools_load` remain available.
300
-
301
- The menu, `settings`, `tools`, `help`, `quickstart`, and `status` require TUI or RPC mode so their result is observable.
302
- TUI uses keyboard navigation and injected Pi keybindings; RPC receives equivalent standard dialogs.
303
- In print and JSON modes, interactive and informational routes reject explicitly instead of silently opening unavailable UI.
304
- The immediate `enable`/`disable` routes remain available for deterministic non-interactive use.
138
+ | Command | Purpose |
139
+ | --- | --- |
140
+ | `/chrome-devtools` | Manage browser-tool availability and browser settings. |
141
+ | `/chrome-devtools help` | Show command usage. |
142
+ | `/chrome-devtools quickstart` | Show the CDP endpoint, launch candidates, and setup hints. |
143
+ | `/chrome-devtools status` | Inspect tools, settings sources, and the last browser launch without probing or starting Chrome. |
144
+ | `/chrome-devtools settings` | Change browser settings; successful edits save immediately. |
145
+ | `/chrome-devtools tools` (aliases: `toggle`, `select`) | Stage tool availability, review the result, and apply it. |
146
+ | `/chrome-devtools enable` (alias: `on`) | Immediately make all currently gated capabilities available and save the selection. |
147
+ | `/chrome-devtools disable` (alias: `off`) | Immediately make all capabilities unavailable and save the empty selection. |
148
+
149
+ All routes support TUI and RPC and reject unknown or trailing arguments.
150
+ Only `enable` and `disable` also support print and JSON modes.
151
+ Disabling capabilities leaves the slash command and `chrome_devtools_load` available; see [Tool exposure](#tool-exposure).
152
+
153
+ Menu tool changes require **Apply tool changes**; cancellation discards the unconfirmed draft.
154
+ Failed apply leaves previous tool availability and settings intact and retains the draft for retry.
155
+ Browser settings instead save immediately, and closing the flow does not undo them.
156
+ See [Browser setup](./docs/browser-setup.md) for prerequisites and environment-override precedence, and [Experimental WebMCP](#experimental-webmcp) before enabling its gateways.
305
157
 
306
158
  ## ⚙️ Settings
307
159
 
@@ -311,6 +163,18 @@ The available capability names are saved to:
311
163
  ${PI_CODING_AGENT_DIR:-~/.pi/agent}/pi-chrome-devtools.json
312
164
  ```
313
165
 
166
+ Use **Browser settings** for connection preferences or **Choose available browser tools…** for tool availability.
167
+ For example, this partial document attaches to a user-started browser without launching another:
168
+
169
+ ```json
170
+ {
171
+ "browser": {
172
+ "endpoint": "http://127.0.0.1:9222",
173
+ "autoLaunch": false
174
+ }
175
+ }
176
+ ```
177
+
314
178
  The same file owns `browser.endpoint`, `browser.autoLaunch`, `browser.executablePath`, `browser.extensionPaths`, and user-only `webmcp.enabled`.
315
179
  Browser connection fields and `webmcp.enabled` are machine-owned user settings; trusted project files may replace only `browser.extensionPaths`.
316
180
  Confirmed menu changes apply before the next browser connection and close only an extension-owned managed browser.
@@ -328,6 +192,18 @@ The first subsequent settings save writes the canonical file.
328
192
  If both files exist, `pi-chrome-devtools.json` wins and the legacy file is ignored.
329
193
  The legacy filename is deprecated and will be removed in a future major release.
330
194
 
195
+ ## 🔒 Security and privacy
196
+
197
+ A CDP connection can inspect and change browser content, execute JavaScript, and access the selected browser profile's authenticated pages.
198
+ Connect only to trusted endpoints and profiles.
199
+
200
+ The extension never closes an external browser.
201
+ It closes only managed browser processes that it started and removes their temporary profiles on a best-effort basis.
202
+
203
+ Unpacked extensions run privileged browser code and are loaded only into an isolated managed browser after explicit configuration.
204
+ WebMCP page tools use the visible page's authentication and require confirmation before every call.
205
+ Screenshot output is restricted to the current working directory or OS temporary directory as described above.
206
+
331
207
  ## 🧠 Use cases
332
208
 
333
209
  - Debug front-end applications with an AI coding agent.
@@ -338,36 +214,19 @@ The legacy filename is deprecated and will be removed in a future major release.
338
214
 
339
215
  ## 🗂️ Package layout
340
216
 
341
- ```txt
217
+ ```text
342
218
  packages/pi-chrome-devtools/
343
- ├── dist/ # Generated TypeScript runtime loaded by Jiti
344
- ├── reference/webmcp/ # Non-entrypoint compatibility prototype
345
- ├── scripts/
346
- │ └── build-runtime.mjs # Deterministic runtime builder and boundary validator
347
- ├── src/
348
- │ ├── index.ts # Pi package entrypoint
349
- │ ├── chrome-devtools.ts # Extension registration and command orchestration
350
- │ ├── lazy-tools.ts # Deferred capability catalog and loader tool
351
- │ ├── webmcp/ # Lazy CDP protocol, discovery, policy, and invocation implementation
352
- │ └── *.ts # Package-local browser, CDP, tool, and storage modules
353
- ├── README.md
354
- ├── LICENSE
355
- ├── tsconfig.json
356
- └── package.json
357
- ```
358
-
359
- `index.ts` is the Pi entrypoint and forwards to `chrome-devtools.ts`; the other source modules are internal.
360
- The package exposes its Pi extension through `package.json`:
361
-
362
- ```json
363
- {
364
- "pi": {
365
- "extensions": ["./dist/index.ts"]
366
- }
367
- }
219
+ ├── src/ # Authoritative implementation and helpers
220
+ │ ├── index.ts # Thin Pi entrypoint
221
+ │ └── chrome-devtools.ts # Browser tools and command orchestration
222
+ ├── dist/ # Generated Jiti runtime
223
+ ├── scripts/build-runtime.mjs # Runtime builder
224
+ ├── docs/ # Published reference documentation
225
+ ├── reference/webmcp/ # Repository-only compatibility prototype
226
+ └── test/ # Behavior and lifecycle coverage
368
227
  ```
369
228
 
370
- The generated runtime is built from the authoritative `src/index.ts` graph and does not import back into `src`.
229
+ The generated runtime is built from `src/index.ts` and does not import back into `src`.
371
230
 
372
231
  ## 🔎 Keywords
373
232
 
@@ -5,7 +5,7 @@ import {
5
5
  configuredChromeDevtoolsTools,
6
6
  sanitizeChromeDevtoolsDisplay,
7
7
  setChromeDevtoolsSessionOwner
8
- } from "./chunk-YJVYJ2L2.js";
8
+ } from "./chunk-MZCGM6D3.js";
9
9
  import {
10
10
  applyRuntimeBrowserSettings,
11
11
  applyRuntimeWebMcpSetting,
@@ -18,7 +18,7 @@ import {
18
18
  state,
19
19
  syncManagedBrowserSettings,
20
20
  webMcpEnabled
21
- } from "./chunk-SRT3UUIP.js";
21
+ } from "./chunk-F5VG35UI.js";
22
22
 
23
23
  // src/browser-settings-menu.ts
24
24
  import { isAbsolute } from "node:path";
@@ -83,9 +83,7 @@ async function showChromeDevtoolsBrowserSettings(pi, ctx, generation) {
83
83
  kind: "input",
84
84
  title: "DevTools endpoint",
85
85
  lines: [
86
- sanitizeChromeDevtoolsDisplay(
87
- `Current effective endpoint: ${current.load.effectiveBrowser.endpoint}`
88
- ),
86
+ sanitizeChromeDevtoolsDisplay(`Current effective endpoint: ${current.load.effectiveBrowser.endpoint}`),
89
87
  'Enter an HTTP origin with an explicit port, or "default".'
90
88
  ],
91
89
  placeholder: "http://127.0.0.1:9222",
@@ -124,33 +122,18 @@ async function showChromeDevtoolsBrowserSettings(pi, ctx, generation) {
124
122
  notifySaveFailure(ctx, error);
125
123
  return { kind: "rejected" };
126
124
  }
127
- const saved = await saveAndApplyBrowserPatch(
128
- ctx,
129
- generation,
130
- ownerSignal,
131
- signal,
132
- projectTrusted,
133
- { endpoint }
134
- );
125
+ const saved = await saveAndApplyBrowserPatch(ctx, generation, ownerSignal, signal, projectTrusted, {
126
+ endpoint
127
+ });
135
128
  if (!saved) return { kind: "rejected" };
136
- notifyEffectiveSave(
137
- ctx,
138
- "endpoint",
139
- saved.effectiveBrowser.endpoint,
140
- saved.effectiveBrowser.endpointSource
141
- );
129
+ notifyEffectiveSave(ctx, "endpoint", saved.effectiveBrowser.endpoint, saved.effectiveBrowser.endpointSource);
142
130
  return { kind: "back" };
143
131
  },
144
132
  "set-auto-launch": async ({ value, signal }) => {
145
133
  if (value !== "On" && value !== "Off") return { kind: "rejected" };
146
- const saved = await saveAndApplyBrowserPatch(
147
- ctx,
148
- generation,
149
- ownerSignal,
150
- signal,
151
- projectTrusted,
152
- { autoLaunch: value === "On" }
153
- );
134
+ const saved = await saveAndApplyBrowserPatch(ctx, generation, ownerSignal, signal, projectTrusted, {
135
+ autoLaunch: value === "On"
136
+ });
154
137
  if (!saved) return { kind: "rejected" };
155
138
  notifyEffectiveSave(
156
139
  ctx,
@@ -188,14 +171,9 @@ async function showChromeDevtoolsBrowserSettings(pi, ctx, generation) {
188
171
  return { kind: "rejected" };
189
172
  }
190
173
  const executablePath = reset ? null : trimmed;
191
- const saved = await saveAndApplyBrowserPatch(
192
- ctx,
193
- generation,
194
- ownerSignal,
195
- signal,
196
- projectTrusted,
197
- { executablePath }
198
- );
174
+ const saved = await saveAndApplyBrowserPatch(ctx, generation, ownerSignal, signal, projectTrusted, {
175
+ executablePath
176
+ });
199
177
  if (!saved) return { kind: "rejected" };
200
178
  notifyEffectiveSave(
201
179
  ctx,
@@ -218,9 +196,7 @@ async function showChromeDevtoolsBrowserSettings(pi, ctx, generation) {
218
196
  signal: ownerSignal,
219
197
  isCurrent: isCurrent2,
220
198
  onError: (currentCtx, error) => currentCtx.ui.notify(
221
- sanitizeChromeDevtoolsDisplay(
222
- `Chrome DevTools browser settings failed: ${formatError(error)}`
223
- ),
199
+ sanitizeChromeDevtoolsDisplay(`Chrome DevTools browser settings failed: ${formatError(error)}`),
224
200
  "error"
225
201
  )
226
202
  });
@@ -272,9 +248,7 @@ async function saveAndApplyWebMcpSetting(pi, ctx, generation, ownerSignal, actio
272
248
  if (isCurrent(generation, ownerSignal, actionSignal)) {
273
249
  notifySaveFailure(
274
250
  ctx,
275
- rollbackError ? new Error(
276
- `${formatError(error)}; WebMCP rollback failed: ${formatError(rollbackError)}`
277
- ) : error
251
+ rollbackError ? new Error(`${formatError(error)}; WebMCP rollback failed: ${formatError(rollbackError)}`) : error
278
252
  );
279
253
  }
280
254
  return false;
@@ -339,4 +313,4 @@ function formatError(error) {
339
313
  export {
340
314
  showChromeDevtoolsBrowserSettings
341
315
  };
342
- //# sourceMappingURL=browser-settings-menu-REIU7C3Q.js.map
316
+ //# sourceMappingURL=browser-settings-menu-SR7KLZT6.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/browser-settings-menu.ts"],
4
+ "sourcesContent": ["import { isAbsolute } from \"node:path\";\nimport type { ExtensionAPI, ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { shutdownManagedBrowser, syncManagedBrowserSettings } from \"./browser-manager.js\";\nimport {\n applyAvailableChromeDevtoolsTools,\n configuredChromeDevtoolsTools,\n setChromeDevtoolsSessionOwner,\n} from \"./lazy-tools.js\";\nimport {\n applyRuntimeBrowserSettings,\n applyRuntimeWebMcpSetting,\n invalidateWebMcpOperations,\n state,\n webMcpEnabled,\n} from \"./runtime.js\";\nimport {\n type BrowserSettingsPatch,\n type BrowserSettingsSource,\n loadSettings,\n parseBrowserEndpoint,\n type SettingsLoadResult,\n saveBrowserSettings,\n saveWebMcpSettings,\n} from \"./settings.js\";\nimport { sanitizeChromeDevtoolsDisplay } from \"./tool-selector.js\";\n\ntype BrowserSettingsScreen = \"settings\" | \"endpoint\" | \"executable\" | \"extensions\";\ntype BrowserSettingsAction =\n | \"open-endpoint\"\n | \"save-endpoint\"\n | \"set-auto-launch\"\n | \"set-webmcp\"\n | \"open-executable\"\n | \"save-executable\"\n | \"show-extensions\";\n\ninterface BrowserSettingsMenuState {\n load: SettingsLoadResult;\n}\n\ntype CommandContext = ExtensionCommandContext;\n\nexport async function showChromeDevtoolsBrowserSettings(\n pi: ExtensionAPI,\n ctx: CommandContext,\n generation: number,\n): Promise<{ closeParent: boolean }> {\n setChromeDevtoolsSessionOwner(pi, ctx.sessionManager);\n const ownerSignal = state.sessionController.signal;\n const isCurrent = () => generation === state.sessionGeneration && !ownerSignal.aborted;\n const projectTrusted = ctx.isProjectTrusted();\n const menu = defineMenu<BrowserSettingsMenuState, BrowserSettingsScreen, BrowserSettingsAction>({\n start: \"settings\",\n screens: {\n settings: ({ state: current }) => {\n if (current.load.userFile.kind === \"invalid\") return invalidSettingsScreen(current.load);\n const browser = current.load.effectiveBrowser;\n return {\n kind: \"settings\",\n title: \"Chrome DevTools Browser settings\",\n lines: settingsContextLines(current.load),\n items: [\n {\n id: \"endpoint\",\n label: \"DevTools endpoint\",\n description: 'HTTP origin with an explicit port; enter \"default\" to restore 127.0.0.1:9222.',\n currentValue: sanitizeChromeDevtoolsDisplay(browser.endpoint),\n action: \"open-endpoint\",\n },\n {\n id: \"auto-launch\",\n label: \"Auto-launch\",\n description: \"Launch an isolated managed browser when a local endpoint is unavailable.\",\n currentValue: browser.autoLaunchEnabled ? \"On\" : \"Off\",\n values: [\"On\", \"Off\"],\n action: \"set-auto-launch\",\n },\n {\n id: \"executable\",\n label: \"Browser executable\",\n description: 'Absolute executable path; enter \"automatic\" to restore browser discovery.',\n currentValue: sanitizeChromeDevtoolsDisplay(browser.executablePath ?? \"Automatic\"),\n action: \"open-executable\",\n },\n {\n id: \"webmcp\",\n label: \"WebMCP \u00B7 Experimental\",\n description: \"Allow user-confirmed calls to page-provided WebMCP tools in this browser session.\",\n currentValue: current.load.effectiveWebMcpEnabled ? \"On\" : \"Off\",\n values: [\"On\", \"Off\"],\n action: \"set-webmcp\",\n },\n {\n id: \"extensions\",\n label: \"Unpacked extensions\",\n description: \"Inspect trusted extension paths configured in user or project JSON.\",\n currentValue: `${browser.extensionPaths.length} configured`,\n action: \"show-extensions\",\n },\n ],\n };\n },\n endpoint: ({ state: current }) => ({\n kind: \"input\",\n title: \"DevTools endpoint\",\n lines: [\n sanitizeChromeDevtoolsDisplay(`Current effective endpoint: ${current.load.effectiveBrowser.endpoint}`),\n 'Enter an HTTP origin with an explicit port, or \"default\".',\n ],\n placeholder: \"http://127.0.0.1:9222\",\n action: \"save-endpoint\",\n hint: \"back\",\n }),\n executable: ({ state: current }) => ({\n kind: \"input\",\n title: \"Browser executable\",\n lines: [\n sanitizeChromeDevtoolsDisplay(\n `Current effective executable: ${current.load.effectiveBrowser.executablePath ?? \"automatic discovery\"}`,\n ),\n 'Enter an absolute path, or \"automatic\".',\n ],\n placeholder: \"absolute browser executable path\",\n action: \"save-executable\",\n hint: \"back\",\n }),\n extensions: ({ state: current }) => ({\n kind: \"detail\",\n title: \"Unpacked extensions\",\n lines: extensionDetailLines(current.load),\n hint: \"back\",\n }),\n },\n actions: {\n \"open-endpoint\": () => ({ kind: \"to\", screen: \"endpoint\" }),\n \"save-endpoint\": async ({ value, signal }) => {\n if (value === undefined) return { kind: \"rejected\" };\n let endpoint: string | null;\n try {\n const trimmed = value.trim();\n endpoint = trimmed.toLowerCase() === \"default\" ? null : parseBrowserEndpoint(trimmed).endpoint;\n } catch (error) {\n notifySaveFailure(ctx, error);\n return { kind: \"rejected\" };\n }\n const saved = await saveAndApplyBrowserPatch(ctx, generation, ownerSignal, signal, projectTrusted, {\n endpoint,\n });\n if (!saved) return { kind: \"rejected\" };\n notifyEffectiveSave(ctx, \"endpoint\", saved.effectiveBrowser.endpoint, saved.effectiveBrowser.endpointSource);\n return { kind: \"back\" };\n },\n \"set-auto-launch\": async ({ value, signal }) => {\n if (value !== \"On\" && value !== \"Off\") return { kind: \"rejected\" };\n const saved = await saveAndApplyBrowserPatch(ctx, generation, ownerSignal, signal, projectTrusted, {\n autoLaunch: value === \"On\",\n });\n if (!saved) return { kind: \"rejected\" };\n notifyEffectiveSave(\n ctx,\n \"auto-launch\",\n saved.effectiveBrowser.autoLaunchEnabled ? \"On\" : \"Off\",\n saved.effectiveBrowser.autoLaunchSource,\n );\n return { kind: \"stay\" };\n },\n \"set-webmcp\": async ({ value, signal }) => {\n if (value !== \"On\" && value !== \"Off\") return { kind: \"rejected\" };\n const saved = await saveAndApplyWebMcpSetting(\n pi,\n ctx,\n generation,\n ownerSignal,\n signal,\n projectTrusted,\n value === \"On\",\n );\n if (!saved) return { kind: \"rejected\" };\n ctx.ui.notify(\n saved.effectiveWebMcpEnabled\n ? \"Experimental WebMCP enabled. Every page-provided tool call requires confirmation. Choose gateway availability under Browser tools.\"\n : \"Experimental WebMCP disabled. Active WebMCP work was aborted and both gateway tools are unavailable.\",\n \"warning\",\n );\n return { kind: \"stay\" };\n },\n \"open-executable\": () => ({ kind: \"to\", screen: \"executable\" }),\n \"save-executable\": async ({ value, signal }) => {\n if (value === undefined) return { kind: \"rejected\" };\n const trimmed = value.trim();\n const reset = [\"automatic\", \"default\", \"none\"].includes(trimmed.toLowerCase());\n if (!reset && (!trimmed || !isAbsolute(trimmed))) {\n notifySaveFailure(ctx, new Error('Enter an absolute path or \"automatic\".'));\n return { kind: \"rejected\" };\n }\n const executablePath = reset ? null : trimmed;\n const saved = await saveAndApplyBrowserPatch(ctx, generation, ownerSignal, signal, projectTrusted, {\n executablePath,\n });\n if (!saved) return { kind: \"rejected\" };\n notifyEffectiveSave(\n ctx,\n \"browser executable\",\n saved.effectiveBrowser.executablePath ?? \"automatic discovery\",\n saved.effectiveBrowser.executablePathSource,\n );\n return { kind: \"back\" };\n },\n \"show-extensions\": () => ({ kind: \"to\", screen: \"extensions\" }),\n },\n });\n const result = await runMenu(ctx, menu, {\n getState: async ({ signal }) => {\n signal.throwIfAborted();\n const load = await loadSettings({ cwd: ctx.cwd, projectTrusted });\n signal.throwIfAborted();\n return { load };\n },\n signal: ownerSignal,\n isCurrent,\n onError: (currentCtx, error) =>\n currentCtx.ui.notify(\n sanitizeChromeDevtoolsDisplay(`Chrome DevTools browser settings failed: ${formatError(error)}`),\n \"error\",\n ),\n });\n return { closeParent: result.kind === \"closed\" && result.reason === \"close\" };\n}\n\nasync function saveAndApplyBrowserPatch(\n ctx: CommandContext,\n generation: number,\n ownerSignal: AbortSignal,\n actionSignal: AbortSignal,\n projectTrusted: boolean,\n patch: BrowserSettingsPatch,\n) {\n try {\n await ctx.waitForIdle();\n if (!isCurrent(generation, ownerSignal, actionSignal)) return false;\n await saveBrowserSettings(patch);\n if (!isCurrent(generation, ownerSignal, actionSignal)) return false;\n invalidateWebMcpOperations(ctx.sessionManager, \"Chrome DevTools browser configuration changed\");\n await shutdownManagedBrowser(undefined, { owner: ctx.sessionManager });\n if (!isCurrent(generation, ownerSignal, actionSignal)) return false;\n const loaded = await loadSettings({ cwd: ctx.cwd, projectTrusted });\n if (!isCurrent(generation, ownerSignal, actionSignal)) return false;\n applyRuntimeBrowserSettings(loaded.effectiveBrowser, loaded.paths, projectTrusted);\n syncManagedBrowserSettings(ctx.sessionManager, loaded.effectiveBrowser);\n state.settingsNotice = loaded.notice;\n return loaded;\n } catch (error) {\n if (isCurrent(generation, ownerSignal, actionSignal)) notifySaveFailure(ctx, error);\n return false;\n }\n}\n\nasync function saveAndApplyWebMcpSetting(\n pi: ExtensionAPI,\n ctx: CommandContext,\n generation: number,\n ownerSignal: AbortSignal,\n actionSignal: AbortSignal,\n projectTrusted: boolean,\n enabled: boolean,\n) {\n const previousEnabled = webMcpEnabled(ctx.sessionManager);\n const previousTools = configuredChromeDevtoolsTools(pi);\n try {\n await ctx.waitForIdle();\n if (!isCurrent(generation, ownerSignal, actionSignal)) return false;\n applyRuntimeWebMcpSetting(enabled, ctx.sessionManager);\n applyAvailableChromeDevtoolsTools(pi, previousTools);\n await saveWebMcpSettings(enabled);\n if (!isOwnerCurrent(generation, ownerSignal)) return false;\n const loaded = await loadSettings({ cwd: ctx.cwd, projectTrusted });\n if (!isOwnerCurrent(generation, ownerSignal)) return false;\n state.settingsNotice = loaded.notice;\n return loaded;\n } catch (error) {\n if (!isOwnerCurrent(generation, ownerSignal)) return false;\n let rollbackError: unknown;\n try {\n applyRuntimeWebMcpSetting(previousEnabled, ctx.sessionManager);\n applyAvailableChromeDevtoolsTools(pi, previousTools);\n } catch (caught) {\n rollbackError = caught;\n }\n if (isCurrent(generation, ownerSignal, actionSignal)) {\n notifySaveFailure(\n ctx,\n rollbackError\n ? new Error(`${formatError(error)}; WebMCP rollback failed: ${formatError(rollbackError)}`)\n : error,\n );\n }\n return false;\n }\n}\n\nfunction isOwnerCurrent(generation: number, ownerSignal: AbortSignal) {\n return generation === state.sessionGeneration && !ownerSignal.aborted;\n}\n\nfunction isCurrent(generation: number, ownerSignal: AbortSignal, actionSignal: AbortSignal) {\n return isOwnerCurrent(generation, ownerSignal) && !actionSignal.aborted;\n}\n\nfunction invalidSettingsScreen(load: SettingsLoadResult) {\n const reason = load.userFile.kind === \"invalid\" ? load.userFile.reason : \"The user settings file is unavailable.\";\n return {\n kind: \"detail\" as const,\n title: \"Chrome DevTools Browser settings \u00B7 Read only\",\n lines: [\n sanitizeChromeDevtoolsDisplay(\n `Fix the active user settings before saving; the file will not be overwritten. ${reason}`,\n ),\n ],\n hint: \"back\" as const,\n };\n}\n\nfunction settingsContextLines(load: SettingsLoadResult) {\n const browser = load.effectiveBrowser;\n return [\n `User settings \u00B7 ${load.paths.user}`,\n `Effective sources: endpoint ${browser.endpointSource} \u00B7 auto-launch ${browser.autoLaunchSource} \u00B7 executable ${browser.executablePathSource}`,\n ...(load.notice ? [`Warning: ${load.notice}`] : []),\n ].map((line) => sanitizeChromeDevtoolsDisplay(line));\n}\n\nfunction extensionDetailLines(load: SettingsLoadResult) {\n const browser = load.effectiveBrowser;\n return [\n `Effective source: ${browser.extensionPathsSource}`,\n ...(browser.extensionPaths.length > 0\n ? browser.extensionPaths.map((extensionPath) => `- ${extensionPath}`)\n : [\"No unpacked extensions are configured.\"]),\n \"Edit browser.extensionPaths in the user JSON or a trusted project JSON, then run /reload.\",\n \"Unpacked extensions execute privileged browser code; load only paths you trust.\",\n ].map((line) => sanitizeChromeDevtoolsDisplay(line));\n}\n\nfunction notifyEffectiveSave(\n ctx: CommandContext,\n setting: string,\n effectiveValue: string,\n source: BrowserSettingsSource,\n) {\n const overrideNotice = source === \"environment\" ? \" The deprecated environment override remains effective.\" : \"\";\n ctx.ui.notify(\n sanitizeChromeDevtoolsDisplay(\n `Chrome DevTools ${setting} saved. Effective ${setting}: ${effectiveValue} (${source}).${overrideNotice}`,\n ),\n \"info\",\n );\n}\n\nfunction notifySaveFailure(ctx: CommandContext, error: unknown) {\n ctx.ui.notify(\n sanitizeChromeDevtoolsDisplay(\n `Chrome DevTools browser settings save failed; previous settings remain active: ${formatError(error)}`,\n ),\n \"warning\",\n );\n}\n\nfunction formatError(error: unknown) {\n return error instanceof Error ? error.message : String(error);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAE3B,SAAS,YAAY,eAAe;AAyCpC,eAAsB,kCACpB,IACA,KACA,YACmC;AACnC,gCAA8B,IAAI,IAAI,cAAc;AACpD,QAAM,cAAc,MAAM,kBAA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ACL;AAAA,MACE,mBAAmB,OAAO,qBAAqB,OAAO,KAAK,cAAc,KAAK,MAAM,KAAK,cAAc;AAAA,IACzG;AAAA,IACA;AAAA,EACF;AACF;AAEA,SAAS,kBAAkB,KAAqB,OAAgB;AAC9D,MAAI,GAAG;AAAA,IACL;AAAA,MACE,kFAAkF,YAAY,KAAK,CAAC;AAAA,IACtG;AAAA,IACA;AAAA,EACF;AACF;AAEA,SAAS,YAAY,OAAgB;AACnC,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
6
+ "names": ["isCurrent"]
7
+ }
@@ -10,7 +10,7 @@ import {
10
10
  launchHint,
11
11
  state,
12
12
  withEndpointRetry
13
- } from "./chunk-SRT3UUIP.js";
13
+ } from "./chunk-F5VG35UI.js";
14
14
 
15
15
  // src/cdp-client.ts
16
16
  var MAX_BUFFERED_EVENTS_PER_METHOD = 32;
@@ -381,4 +381,4 @@ export {
381
381
  withCdp,
382
382
  CdpClient
383
383
  };
384
- //# sourceMappingURL=chunk-GTTYS5GT.js.map
384
+ //# sourceMappingURL=chunk-4KMN4SFF.js.map