@petukhovart/agent-view 0.1.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/.claude-plugin/plugin.json +10 -0
- package/LICENSE +21 -0
- package/README.md +296 -0
- package/dist/adapters/browser.d.ts +3 -0
- package/dist/adapters/browser.d.ts.map +1 -0
- package/dist/adapters/browser.js +20 -0
- package/dist/adapters/browser.js.map +1 -0
- package/dist/adapters/electron.d.ts +3 -0
- package/dist/adapters/electron.d.ts.map +1 -0
- package/dist/adapters/electron.js +20 -0
- package/dist/adapters/electron.js.map +1 -0
- package/dist/adapters/registry.d.ts +4 -0
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +13 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/adapters/tauri.d.ts +8 -0
- package/dist/adapters/tauri.d.ts.map +1 -0
- package/dist/adapters/tauri.js +32 -0
- package/dist/adapters/tauri.js.map +1 -0
- package/dist/adapters/types.d.ts +8 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/cdp/transport.d.ts +4 -0
- package/dist/cdp/transport.d.ts.map +1 -0
- package/dist/cdp/transport.js +89 -0
- package/dist/cdp/transport.js.map +1 -0
- package/dist/cdp/types.d.ts +37 -0
- package/dist/cdp/types.d.ts.map +1 -0
- package/dist/cdp/types.js +2 -0
- package/dist/cdp/types.js.map +1 -0
- package/dist/cli/client.d.ts +3 -0
- package/dist/cli/client.d.ts.map +1 -0
- package/dist/cli/client.js +89 -0
- package/dist/cli/client.js.map +1 -0
- package/dist/cli/commands/click.d.ts +9 -0
- package/dist/cli/commands/click.d.ts.map +1 -0
- package/dist/cli/commands/click.js +43 -0
- package/dist/cli/commands/click.js.map +1 -0
- package/dist/cli/commands/discover.d.ts +3 -0
- package/dist/cli/commands/discover.d.ts.map +1 -0
- package/dist/cli/commands/discover.js +15 -0
- package/dist/cli/commands/discover.js.map +1 -0
- package/dist/cli/commands/dom.d.ts +9 -0
- package/dist/cli/commands/dom.d.ts.map +1 -0
- package/dist/cli/commands/dom.js +19 -0
- package/dist/cli/commands/dom.js.map +1 -0
- package/dist/cli/commands/fill.d.ts +8 -0
- package/dist/cli/commands/fill.d.ts.map +1 -0
- package/dist/cli/commands/fill.js +39 -0
- package/dist/cli/commands/fill.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +14 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/launch.d.ts +3 -0
- package/dist/cli/commands/launch.d.ts.map +1 -0
- package/dist/cli/commands/launch.js +21 -0
- package/dist/cli/commands/launch.js.map +1 -0
- package/dist/cli/commands/scene.d.ts +11 -0
- package/dist/cli/commands/scene.d.ts.map +1 -0
- package/dist/cli/commands/scene.js +29 -0
- package/dist/cli/commands/scene.js.map +1 -0
- package/dist/cli/commands/screenshot.d.ts +7 -0
- package/dist/cli/commands/screenshot.d.ts.map +1 -0
- package/dist/cli/commands/screenshot.js +20 -0
- package/dist/cli/commands/screenshot.js.map +1 -0
- package/dist/cli/commands/snap.d.ts +9 -0
- package/dist/cli/commands/snap.d.ts.map +1 -0
- package/dist/cli/commands/snap.js +25 -0
- package/dist/cli/commands/snap.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +2 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +22 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/wait.d.ts +9 -0
- package/dist/cli/commands/wait.d.ts.map +1 -0
- package/dist/cli/commands/wait.js +26 -0
- package/dist/cli/commands/wait.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +136 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/manager.d.ts +5 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +84 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/types.d.ts +13 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/inspectors/dom.d.ts +17 -0
- package/dist/inspectors/dom.d.ts.map +1 -0
- package/dist/inspectors/dom.js +131 -0
- package/dist/inspectors/dom.js.map +1 -0
- package/dist/inspectors/scene/formatter.d.ts +5 -0
- package/dist/inspectors/scene/formatter.d.ts.map +1 -0
- package/dist/inspectors/scene/formatter.js +91 -0
- package/dist/inspectors/scene/formatter.js.map +1 -0
- package/dist/inspectors/scene/index.d.ts +8 -0
- package/dist/inspectors/scene/index.d.ts.map +1 -0
- package/dist/inspectors/scene/index.js +26 -0
- package/dist/inspectors/scene/index.js.map +1 -0
- package/dist/inspectors/scene/pixi.d.ts +3 -0
- package/dist/inspectors/scene/pixi.d.ts.map +1 -0
- package/dist/inspectors/scene/pixi.js +52 -0
- package/dist/inspectors/scene/pixi.js.map +1 -0
- package/dist/inspectors/scene/registry.d.ts +4 -0
- package/dist/inspectors/scene/registry.d.ts.map +1 -0
- package/dist/inspectors/scene/registry.js +13 -0
- package/dist/inspectors/scene/registry.js.map +1 -0
- package/dist/inspectors/scene/types.d.ts +31 -0
- package/dist/inspectors/scene/types.d.ts.map +1 -0
- package/dist/inspectors/scene/types.js +2 -0
- package/dist/inspectors/scene/types.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +11 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/launcher.d.ts +4 -0
- package/dist/server/launcher.d.ts.map +1 -0
- package/dist/server/launcher.js +43 -0
- package/dist/server/launcher.js.map +1 -0
- package/dist/server/ref-store.d.ts +20 -0
- package/dist/server/ref-store.d.ts.map +1 -0
- package/dist/server/ref-store.js +29 -0
- package/dist/server/ref-store.js.map +1 -0
- package/dist/server/server.d.ts +28 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +444 -0
- package/dist/server/server.js.map +1 -0
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
- package/skills/verify/SKILL.md +100 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-view",
|
|
3
|
+
"description": "Multi-platform visual verification CLI for Frontend apps (Electron/Tauri/Browser) via Chrome DevTools Protocol. Inspect DOM, interact with UI, capture screenshots, WebGL libraries support. Use when verifying UI changes, checking visual regressions, testing user interactions, or when any workflow phase needs to inspect the running application.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "PetukhovArt"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/PetukhovArt/agent-view",
|
|
9
|
+
"license": "MIT"
|
|
10
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Artem Petukhov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# agent-view
|
|
2
|
+
|
|
3
|
+
**Give your AI agent eyes and hands for desktop apps.**
|
|
4
|
+
|
|
5
|
+
AI coding agents can write code, run tests, and read logs — but they can't *see* what the app actually looks like. Without visual verification, an agent is essentially **coding blind** — builds pass, tests are green, but the login form is broken, the button is off-screen, or the modal never appears.
|
|
6
|
+
|
|
7
|
+
agent-view bridges that gap: it connects to any Chromium-based desktop app via Chrome DevTools Protocol and lets the agent inspect the UI, take screenshots, click buttons, and fill forms.
|
|
8
|
+
|
|
9
|
+
Built for [Claude Code](https://docs.anthropic.com/en/docs/claude-code), but works with any AI agent or automation pipeline that can call CLI commands.
|
|
10
|
+
|
|
11
|
+
## Why CLI, not MCP?
|
|
12
|
+
|
|
13
|
+
Most alternatives in this space are MCP servers with 30+ tool definitions loaded into context on every session. That burns tokens before the agent even starts working.
|
|
14
|
+
|
|
15
|
+
agent-view is a CLI. One Bash call, compact text output, zero schema overhead. The accessibility tree comes back as plain text — not wrapped in JSON-RPC with metadata. For an agent that runs dozens of verification steps, the token savings add up fast.
|
|
16
|
+
|
|
17
|
+
And CLI works everywhere — Claude Code, Copilot, Codex, custom pipelines, CI. No MCP client required.
|
|
18
|
+
|
|
19
|
+
## The feedback loop
|
|
20
|
+
|
|
21
|
+
The real power isn't in individual commands — it's in the **loop**:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Code → Launch → See → Verify → Fix → See again
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The agent writes code, then immediately checks what the user would see. If something's wrong, it fixes and re-checks — no human needed. This catches problems that builds and tests miss: CSS regressions, broken layouts, missing error messages, silent IPC failures.
|
|
28
|
+
|
|
29
|
+
## Enabling CDP
|
|
30
|
+
|
|
31
|
+
### Recommended: in code (reliable, works with any build tool)
|
|
32
|
+
|
|
33
|
+
Add to your Electron main process:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
app.commandLine.appendSwitch('remote-debugging-port', '9222');
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For dev-only:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
if (!app.isPackaged) {
|
|
43
|
+
app.commandLine.appendSwitch('remote-debugging-port', '9222');
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Alternative: via CLI flag (no code changes)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Plain Electron
|
|
51
|
+
electron . --remote-debugging-port=9222
|
|
52
|
+
|
|
53
|
+
# electron-vite (note the -- to forward the flag past the build tool)
|
|
54
|
+
npx electron-vite dev -- --remote-debugging-port=9222
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Other runtimes
|
|
58
|
+
|
|
59
|
+
| Runtime | Setup |
|
|
60
|
+
|---------|-------|
|
|
61
|
+
| **Tauri** | CDP via devtools configuration |
|
|
62
|
+
| **Any Chromium app** | `--remote-debugging-port=9222` launch flag |
|
|
63
|
+
|
|
64
|
+
### Verify CDP is working
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
curl -s http://localhost:9222/json/version
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If you see a JSON response with browser info — you're good.
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g agent-view
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick start
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cd your-electron-project
|
|
82
|
+
|
|
83
|
+
# 1. Generate config (auto-detects runtime, port, launch command)
|
|
84
|
+
agent-view init
|
|
85
|
+
|
|
86
|
+
# 2. Start your app (or let agent-view do it)
|
|
87
|
+
agent-view launch
|
|
88
|
+
|
|
89
|
+
# 3. See what's on screen
|
|
90
|
+
agent-view discover # List all windows
|
|
91
|
+
agent-view dom # Accessibility tree with ref IDs
|
|
92
|
+
agent-view screenshot # PNG screenshot
|
|
93
|
+
|
|
94
|
+
# 4. Interact
|
|
95
|
+
agent-view click 5 # Click element by ref
|
|
96
|
+
agent-view fill 3 "hello" # Type into input
|
|
97
|
+
|
|
98
|
+
# 5. Verify the result
|
|
99
|
+
agent-view dom --filter "success" # Check for expected element
|
|
100
|
+
agent-view screenshot # Visual confirmation
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## How it works
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
CLI → TCP → Lazy Server → CDP → Your App
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A background server connects to your app's CDP port, caches sessions, and auto-shuts down after 5 minutes of inactivity. No manual `connect` step — the server starts on first CLI call and handles connection lifecycle automatically.
|
|
110
|
+
|
|
111
|
+
## Config
|
|
112
|
+
|
|
113
|
+
Running `agent-view init` in your project root generates `agent-view.config.json`:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"runtime": "electron",
|
|
118
|
+
"port": 9222,
|
|
119
|
+
"launch": "npm run dev"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
| Field | Required | Description |
|
|
124
|
+
|-------|----------|-------------|
|
|
125
|
+
| `runtime` | yes | `"electron"`, `"tauri"`, or `"browser"` |
|
|
126
|
+
| `port` | yes | CDP debugging port |
|
|
127
|
+
| `launch` | no | Command to start the app |
|
|
128
|
+
| `webgl.engine` | no | `"pixi"` (scene extractor architecture supports adding more engines) |
|
|
129
|
+
|
|
130
|
+
## Commands
|
|
131
|
+
|
|
132
|
+
### `init`
|
|
133
|
+
|
|
134
|
+
Auto-generates config by reading `package.json`.
|
|
135
|
+
|
|
136
|
+
### `discover`
|
|
137
|
+
|
|
138
|
+
Lists running app windows as JSON — window IDs, titles, URLs.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
agent-view discover
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### `dom`
|
|
145
|
+
|
|
146
|
+
Dumps the accessibility tree in compact text format. Each element gets a session ref ID for interaction.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
agent-view dom
|
|
150
|
+
agent-view dom --filter "Submit" # Filter by text/role
|
|
151
|
+
agent-view dom --depth 3 # Limit tree depth
|
|
152
|
+
agent-view dom --window "Settings" # Target specific window
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### `click`
|
|
156
|
+
|
|
157
|
+
Clicks a DOM element by ref ID or coordinates.
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
agent-view click 5 # By ref from dom output
|
|
161
|
+
agent-view click --pos 100,200 # By coordinates (for canvas)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### `fill`
|
|
165
|
+
|
|
166
|
+
Types text into an input. Uses native value setter + dispatches input/change events (works with Vue, React, and other frameworks).
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
agent-view fill 3 "hello@example.com"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `screenshot`
|
|
173
|
+
|
|
174
|
+
Captures a PNG screenshot, saves to temp dir, prints the file path.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
agent-view screenshot
|
|
178
|
+
agent-view screenshot --window "Settings"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### `scene`
|
|
182
|
+
|
|
183
|
+
Reads the WebGL scene graph for canvas-based apps. Currently supports PixiJS via `window.__PIXI_DEVTOOLS__`.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
agent-view scene # Full scene graph
|
|
187
|
+
agent-view scene --diff # Changes since last call
|
|
188
|
+
agent-view scene --filter "player" # Filter by name/type
|
|
189
|
+
agent-view scene --verbose # Extended props (alpha, scale, bounds)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### `snap`
|
|
193
|
+
|
|
194
|
+
Combined DOM + scene graph in one call. Shows DOM always; scene section appears when a WebGL engine is detected.
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
agent-view snap
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### `wait`
|
|
201
|
+
|
|
202
|
+
Waits for a DOM element matching the filter to appear. Useful after navigation or async operations.
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
agent-view wait --filter "Dashboard" # Wait for element (default 10s)
|
|
206
|
+
agent-view wait --filter "Dashboard" --timeout 30 # Custom timeout in seconds
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### `launch`
|
|
210
|
+
|
|
211
|
+
Starts the app using the `launch` command from config. Polls CDP until ready (60s timeout). Idempotent — skips if already running.
|
|
212
|
+
|
|
213
|
+
### `stop`
|
|
214
|
+
|
|
215
|
+
Stops the background lazy server.
|
|
216
|
+
|
|
217
|
+
## Multiwindow
|
|
218
|
+
|
|
219
|
+
All commands accept `--window` with either an ID (from `discover`) or a window title substring:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
agent-view dom --window "Settings"
|
|
223
|
+
agent-view screenshot --window "About"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Output format
|
|
227
|
+
|
|
228
|
+
| Command | Format | Why |
|
|
229
|
+
|---------|--------|-----|
|
|
230
|
+
| `dom`, `scene`, `snap` | Plain text | LLM-friendly, minimal tokens |
|
|
231
|
+
| `discover` | JSON | Machine-parseable |
|
|
232
|
+
| `screenshot` | File path | Agent reads the image |
|
|
233
|
+
|
|
234
|
+
## Claude Code plugin
|
|
235
|
+
|
|
236
|
+
agent-view ships as a Claude Code plugin with a built-in `verify` skill. The skill teaches Claude how to use agent-view for UI verification after code changes.
|
|
237
|
+
|
|
238
|
+
### Local development
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
claude --plugin-dir /path/to/agent-view
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The skill becomes available as `/agent-view:verify`.
|
|
245
|
+
|
|
246
|
+
### After npm install
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Find where the package is installed
|
|
250
|
+
npm root -g
|
|
251
|
+
# Use that path with --plugin-dir
|
|
252
|
+
claude --plugin-dir "$(npm root -g)/agent-view"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Example: testing a login flow
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Start the app
|
|
259
|
+
agent-view launch
|
|
260
|
+
|
|
261
|
+
# See the login page
|
|
262
|
+
agent-view dom --filter "login"
|
|
263
|
+
# RootWebArea "My App"
|
|
264
|
+
# textbox "Email" [ref=3]
|
|
265
|
+
# textbox "Password" [ref=5]
|
|
266
|
+
# button "Sign in" [ref=7]
|
|
267
|
+
|
|
268
|
+
# Fill credentials and submit
|
|
269
|
+
agent-view fill 3 "admin@example.com"
|
|
270
|
+
agent-view fill 5 "password123"
|
|
271
|
+
agent-view click 7
|
|
272
|
+
|
|
273
|
+
# Verify — did we land on the dashboard?
|
|
274
|
+
agent-view dom --depth 2
|
|
275
|
+
agent-view screenshot
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Troubleshooting
|
|
279
|
+
|
|
280
|
+
### CDP not responding
|
|
281
|
+
|
|
282
|
+
1. Check the port is listening: `curl -s http://localhost:9222/json/version`
|
|
283
|
+
2. For electron-vite: make sure you use `--` before the flag: `npx electron-vite dev -- --remote-debugging-port=9222`
|
|
284
|
+
3. Restart the app — HMR doesn't restart the main process
|
|
285
|
+
|
|
286
|
+
### Stale refs after HMR
|
|
287
|
+
|
|
288
|
+
After hot reload, refs from previous `dom` calls become invalid. Run `agent-view dom` again to get fresh refs.
|
|
289
|
+
|
|
290
|
+
### Launch timeout
|
|
291
|
+
|
|
292
|
+
Complex Electron apps may take >60s on cold start. If `agent-view launch` times out, start the app manually and use `agent-view discover` to verify.
|
|
293
|
+
|
|
294
|
+
## License
|
|
295
|
+
|
|
296
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAIhD,eAAO,MAAM,cAAc,EAAE,cAkB5B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { listTargets, connectToTarget } from '../cdp/transport.js';
|
|
2
|
+
import { RuntimeType } from '../types.js';
|
|
3
|
+
export const browserAdapter = {
|
|
4
|
+
runtime: RuntimeType.Browser,
|
|
5
|
+
async discover(port) {
|
|
6
|
+
const targets = await listTargets(port);
|
|
7
|
+
return targets
|
|
8
|
+
.filter(t => t.type === 'page')
|
|
9
|
+
.map(t => ({
|
|
10
|
+
id: t.id,
|
|
11
|
+
title: t.title,
|
|
12
|
+
url: t.url,
|
|
13
|
+
type: t.type,
|
|
14
|
+
}));
|
|
15
|
+
},
|
|
16
|
+
async connect(port, windowId) {
|
|
17
|
+
return connectToTarget(port, windowId);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AAG1D,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,OAAO,EAAE,WAAW,CAAC,OAAO;IAE5B,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;aAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACT,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC,CAAA;IACP,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB;QAC1C,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACxC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"electron.d.ts","sourceRoot":"","sources":["../../src/adapters/electron.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAIhD,eAAO,MAAM,eAAe,EAAE,cAkB7B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { listTargets, connectToTarget } from '../cdp/transport.js';
|
|
2
|
+
import { RuntimeType } from '../types.js';
|
|
3
|
+
export const electronAdapter = {
|
|
4
|
+
runtime: RuntimeType.Electron,
|
|
5
|
+
async discover(port) {
|
|
6
|
+
const targets = await listTargets(port);
|
|
7
|
+
return targets
|
|
8
|
+
.filter(t => t.type === 'page')
|
|
9
|
+
.map(t => ({
|
|
10
|
+
id: t.id,
|
|
11
|
+
title: t.title,
|
|
12
|
+
url: t.url,
|
|
13
|
+
type: t.type,
|
|
14
|
+
}));
|
|
15
|
+
},
|
|
16
|
+
async connect(port, windowId) {
|
|
17
|
+
return connectToTarget(port, windowId);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=electron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"electron.js","sourceRoot":"","sources":["../../src/adapters/electron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AAG1D,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,OAAO,EAAE,WAAW,CAAC,QAAQ;IAE7B,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;aAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACT,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC,CAAA;IACP,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB;QAC1C,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACxC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAWhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAE/D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RuntimeType } from '../types.js';
|
|
2
|
+
import { electronAdapter } from './electron.js';
|
|
3
|
+
import { browserAdapter } from './browser.js';
|
|
4
|
+
import { tauriAdapter } from './tauri.js';
|
|
5
|
+
const adapters = {
|
|
6
|
+
[RuntimeType.Electron]: electronAdapter,
|
|
7
|
+
[RuntimeType.Browser]: browserAdapter,
|
|
8
|
+
[RuntimeType.Tauri]: tauriAdapter,
|
|
9
|
+
};
|
|
10
|
+
export function getAdapter(runtime) {
|
|
11
|
+
return adapters[runtime];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,QAAQ,GAAwC;IACpD,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,eAAe;IACvC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,cAAc;IACrC,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY;CAClC,CAAA;AAED,MAAM,UAAU,UAAU,CAAC,OAAoB;IAC7C,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauri.d.ts","sourceRoot":"","sources":["../../src/adapters/tauri.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAWhD,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAIzF;AAED,eAAO,MAAM,YAAY,EAAE,cAkB1B,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { listTargets, connectToTarget } from '../cdp/transport.js';
|
|
2
|
+
import { RuntimeType } from '../types.js';
|
|
3
|
+
/** URLs that Tauri/WebView2 exposes as CDP targets but aren't app windows */
|
|
4
|
+
const INTERNAL_URL_PATTERNS = [
|
|
5
|
+
'about:blank',
|
|
6
|
+
'devtools://',
|
|
7
|
+
'chrome-extension://',
|
|
8
|
+
];
|
|
9
|
+
export function isAppTarget(target) {
|
|
10
|
+
if (target.type !== 'page')
|
|
11
|
+
return false;
|
|
12
|
+
const url = target.url.toLowerCase();
|
|
13
|
+
return !INTERNAL_URL_PATTERNS.some(pattern => url.startsWith(pattern));
|
|
14
|
+
}
|
|
15
|
+
export const tauriAdapter = {
|
|
16
|
+
runtime: RuntimeType.Tauri,
|
|
17
|
+
async discover(port) {
|
|
18
|
+
const targets = await listTargets(port);
|
|
19
|
+
return targets
|
|
20
|
+
.filter(isAppTarget)
|
|
21
|
+
.map(t => ({
|
|
22
|
+
id: t.id,
|
|
23
|
+
title: t.title,
|
|
24
|
+
url: t.url,
|
|
25
|
+
type: t.type,
|
|
26
|
+
}));
|
|
27
|
+
},
|
|
28
|
+
async connect(port, windowId) {
|
|
29
|
+
return connectToTarget(port, windowId);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=tauri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauri.js","sourceRoot":"","sources":["../../src/adapters/tauri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AAG1D,6EAA6E;AAC7E,MAAM,qBAAqB,GAAG;IAC5B,aAAa;IACb,aAAa;IACb,qBAAqB;CACtB,CAAA;AAED,MAAM,UAAU,WAAW,CAAC,MAAoD;IAC9E,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,KAAK,CAAA;IACxC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA;IACpC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;AACxE,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,OAAO,EAAE,WAAW,CAAC,KAAK;IAE1B,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,OAAO;aACX,MAAM,CAAC,WAAW,CAAC;aACnB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACT,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC,CAAA;IACP,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB;QAC1C,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACxC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WindowInfo, RuntimeType } from '../types.js';
|
|
2
|
+
import type { CDPConnection } from '../cdp/types.js';
|
|
3
|
+
export type RuntimeAdapter = {
|
|
4
|
+
readonly runtime: RuntimeType;
|
|
5
|
+
discover(port: number): Promise<WindowInfo[]>;
|
|
6
|
+
connect(port: number, windowId: string): Promise<CDPConnection>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAC7C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CAChE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CDPConnection, CDPTarget } from './types.js';
|
|
2
|
+
export declare function listTargets(port: number): Promise<CDPTarget[]>;
|
|
3
|
+
export declare function connectToTarget(port: number, targetId: string): Promise<CDPConnection>;
|
|
4
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/cdp/transport.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAU,MAAM,YAAY,CAAA;AAQlE,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAkBpE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAwE5F"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// @ts-expect-error no types available for chrome-remote-interface
|
|
2
|
+
import CDP from 'chrome-remote-interface';
|
|
3
|
+
// CDP hosts to try: IPv4 first, then IPv6 (WebView2/Tauri often listens on ::1)
|
|
4
|
+
const CDP_HOSTS = ['127.0.0.1', '::1'];
|
|
5
|
+
// Maps targetId → host for connection routing
|
|
6
|
+
const targetHostMap = new Map();
|
|
7
|
+
export async function listTargets(port) {
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
const result = [];
|
|
10
|
+
for (const host of CDP_HOSTS) {
|
|
11
|
+
try {
|
|
12
|
+
const targets = await CDP.List({ host, port });
|
|
13
|
+
for (const t of targets) {
|
|
14
|
+
if (!seen.has(t.id)) {
|
|
15
|
+
seen.add(t.id);
|
|
16
|
+
targetHostMap.set(`${port}:${t.id}`, host);
|
|
17
|
+
result.push(t);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch { /* host not available */ }
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
export async function connectToTarget(port, targetId) {
|
|
26
|
+
const host = targetHostMap.get(`${port}:${targetId}`) ?? 'localhost';
|
|
27
|
+
const client = await CDP({ host, port, target: targetId });
|
|
28
|
+
const { Runtime, Accessibility, Page, DOM, Input } = client;
|
|
29
|
+
await Page.enable();
|
|
30
|
+
await DOM.enable();
|
|
31
|
+
await Accessibility.enable();
|
|
32
|
+
async function dispatchClick(x, y) {
|
|
33
|
+
await Input.dispatchMouseEvent({ type: 'mousePressed', x, y, button: 'left', clickCount: 1 });
|
|
34
|
+
await Input.dispatchMouseEvent({ type: 'mouseReleased', x, y, button: 'left', clickCount: 1 });
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
async evaluate(expression) {
|
|
38
|
+
const { result } = await Runtime.evaluate({
|
|
39
|
+
expression,
|
|
40
|
+
returnByValue: true,
|
|
41
|
+
});
|
|
42
|
+
return result.value;
|
|
43
|
+
},
|
|
44
|
+
async getAccessibilityTree() {
|
|
45
|
+
const { nodes } = await Accessibility.getFullAXTree();
|
|
46
|
+
return nodes;
|
|
47
|
+
},
|
|
48
|
+
async captureScreenshot() {
|
|
49
|
+
const { data } = await Page.captureScreenshot({ format: 'png' });
|
|
50
|
+
return Buffer.from(data, 'base64');
|
|
51
|
+
},
|
|
52
|
+
async clickByNodeId(backendNodeId) {
|
|
53
|
+
const { object } = await DOM.resolveNode({ backendNodeId });
|
|
54
|
+
await Runtime.callFunctionOn({
|
|
55
|
+
objectId: object.objectId,
|
|
56
|
+
functionDeclaration: 'function() { this.scrollIntoViewIfNeeded() }',
|
|
57
|
+
});
|
|
58
|
+
const { model } = await DOM.getBoxModel({ backendNodeId });
|
|
59
|
+
const [x1, y1, x2, y2, x3, y3, x4, y4] = model.content;
|
|
60
|
+
const cx = (x1 + x2 + x3 + x4) / 4;
|
|
61
|
+
const cy = (y1 + y2 + y3 + y4) / 4;
|
|
62
|
+
await dispatchClick(cx, cy);
|
|
63
|
+
},
|
|
64
|
+
async clickAtPosition(x, y) {
|
|
65
|
+
await dispatchClick(x, y);
|
|
66
|
+
},
|
|
67
|
+
async fillByNodeId(backendNodeId, value) {
|
|
68
|
+
const { object } = await DOM.resolveNode({ backendNodeId });
|
|
69
|
+
await DOM.focus({ backendNodeId });
|
|
70
|
+
// Set value and dispatch input/change events for framework reactivity
|
|
71
|
+
await Runtime.callFunctionOn({
|
|
72
|
+
objectId: object.objectId,
|
|
73
|
+
functionDeclaration: `function(val) {
|
|
74
|
+
const nativeSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set
|
|
75
|
+
|| Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')?.set;
|
|
76
|
+
if (nativeSetter) nativeSetter.call(this, val);
|
|
77
|
+
else this.value = val;
|
|
78
|
+
this.dispatchEvent(new Event('input', { bubbles: true }));
|
|
79
|
+
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
80
|
+
}`,
|
|
81
|
+
arguments: [{ value }],
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
async close() {
|
|
85
|
+
await client.close();
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=transport.js.map
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;;;;;;UAOnB;gBACF,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC;QAED,KAAK,CAAC,KAAK;YACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;QACtB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type CDPTarget = {
|
|
2
|
+
id: string;
|
|
3
|
+
type: string;
|
|
4
|
+
title: string;
|
|
5
|
+
url: string;
|
|
6
|
+
webSocketDebuggerUrl: string;
|
|
7
|
+
};
|
|
8
|
+
export type CDPConnection = {
|
|
9
|
+
getAccessibilityTree: () => Promise<AXNode[]>;
|
|
10
|
+
captureScreenshot: () => Promise<Buffer>;
|
|
11
|
+
clickByNodeId: (backendNodeId: number) => Promise<void>;
|
|
12
|
+
clickAtPosition: (x: number, y: number) => Promise<void>;
|
|
13
|
+
fillByNodeId: (backendNodeId: number, value: string) => Promise<void>;
|
|
14
|
+
/** Executes arbitrary JS in the target process. Only pass trusted, hardcoded expressions. */
|
|
15
|
+
evaluate: (js: string) => Promise<unknown>;
|
|
16
|
+
close: () => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export type AXNode = {
|
|
19
|
+
nodeId: string;
|
|
20
|
+
role: {
|
|
21
|
+
value: string;
|
|
22
|
+
};
|
|
23
|
+
name?: {
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
childIds?: string[];
|
|
27
|
+
backendDOMNodeId?: number;
|
|
28
|
+
properties?: AXProperty[];
|
|
29
|
+
};
|
|
30
|
+
export type AXProperty = {
|
|
31
|
+
name: string;
|
|
32
|
+
value: {
|
|
33
|
+
type: string;
|
|
34
|
+
value?: unknown;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cdp/types.ts"],"names":[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