@petukhovart/agent-view 0.1.0 → 0.5.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/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +13 -2
- package/README.md +211 -61
- package/dist/adapters/browser.d.ts.map +1 -1
- package/dist/adapters/browser.js +11 -11
- package/dist/adapters/browser.js.map +1 -1
- package/dist/adapters/electron.d.ts.map +1 -1
- package/dist/adapters/electron.js +11 -11
- package/dist/adapters/electron.js.map +1 -1
- package/dist/adapters/tauri.d.ts.map +1 -1
- package/dist/adapters/tauri.js +11 -11
- package/dist/adapters/tauri.js.map +1 -1
- package/dist/adapters/types.d.ts +5 -2
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cdp/_tests/console-stream.d.ts +35 -0
- package/dist/cdp/_tests/console-stream.d.ts.map +1 -0
- package/dist/cdp/_tests/console-stream.js +103 -0
- package/dist/cdp/_tests/console-stream.js.map +1 -0
- package/dist/cdp/ax-cache.d.ts +16 -0
- package/dist/cdp/ax-cache.d.ts.map +1 -0
- package/dist/cdp/ax-cache.js +31 -0
- package/dist/cdp/ax-cache.js.map +1 -0
- package/dist/cdp/console-stream.d.ts +35 -0
- package/dist/cdp/console-stream.d.ts.map +1 -0
- package/dist/cdp/console-stream.js +103 -0
- package/dist/cdp/console-stream.js.map +1 -0
- package/dist/cdp/transport.d.ts +5 -2
- package/dist/cdp/transport.d.ts.map +1 -1
- package/dist/cdp/transport.js +309 -26
- package/dist/cdp/transport.js.map +1 -1
- package/dist/cdp/types.d.ts +109 -8
- package/dist/cdp/types.d.ts.map +1 -1
- package/dist/cdp/types.js +35 -1
- package/dist/cdp/types.js.map +1 -1
- package/dist/cli/commands/console.d.ts +12 -0
- package/dist/cli/commands/console.d.ts.map +1 -0
- package/dist/cli/commands/console.js +32 -0
- package/dist/cli/commands/console.js.map +1 -0
- package/dist/cli/commands/dom.d.ts +5 -0
- package/dist/cli/commands/dom.d.ts.map +1 -1
- package/dist/cli/commands/dom.js +5 -0
- package/dist/cli/commands/dom.js.map +1 -1
- package/dist/cli/commands/drag.d.ts +13 -0
- package/dist/cli/commands/drag.d.ts.map +1 -0
- package/dist/cli/commands/drag.js +72 -0
- package/dist/cli/commands/drag.js.map +1 -0
- package/dist/cli/commands/eval.d.ts +9 -0
- package/dist/cli/commands/eval.d.ts.map +1 -0
- package/dist/cli/commands/eval.js +30 -0
- package/dist/cli/commands/eval.js.map +1 -0
- package/dist/cli/commands/scene.d.ts +1 -0
- package/dist/cli/commands/scene.d.ts.map +1 -1
- package/dist/cli/commands/scene.js +2 -0
- package/dist/cli/commands/scene.js.map +1 -1
- package/dist/cli/commands/screenshot.d.ts +2 -0
- package/dist/cli/commands/screenshot.d.ts.map +1 -1
- package/dist/cli/commands/screenshot.js +6 -0
- package/dist/cli/commands/screenshot.js.map +1 -1
- package/dist/cli/commands/snap.d.ts +1 -0
- package/dist/cli/commands/snap.d.ts.map +1 -1
- package/dist/cli/commands/snap.js +2 -0
- package/dist/cli/commands/snap.js.map +1 -1
- package/dist/cli/commands/targets.d.ts +7 -0
- package/dist/cli/commands/targets.d.ts.map +1 -0
- package/dist/cli/commands/targets.js +30 -0
- package/dist/cli/commands/targets.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +12 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +233 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/index.js +86 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/config/manager.js +11 -1
- package/dist/config/manager.js.map +1 -1
- package/dist/config/types.d.ts +11 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/inspectors/dom/index.d.ts +30 -0
- package/dist/inspectors/dom/index.d.ts.map +1 -0
- package/dist/inspectors/dom/index.js +283 -0
- package/dist/inspectors/dom/index.js.map +1 -0
- package/dist/inspectors/scene/adapters/pixi/adapter.d.ts +3 -0
- package/dist/inspectors/scene/adapters/pixi/adapter.d.ts.map +1 -0
- package/dist/inspectors/scene/adapters/pixi/adapter.js +51 -0
- package/dist/inspectors/scene/adapters/pixi/adapter.js.map +1 -0
- package/dist/inspectors/scene/adapters/pixi/index.d.ts +2 -0
- package/dist/inspectors/scene/adapters/pixi/index.d.ts.map +1 -0
- package/dist/inspectors/scene/adapters/pixi/index.js +2 -0
- package/dist/inspectors/scene/adapters/pixi/index.js.map +1 -0
- package/dist/inspectors/scene/adapters/pixi/injection.d.ts +39 -0
- package/dist/inspectors/scene/adapters/pixi/injection.d.ts.map +1 -0
- package/dist/inspectors/scene/adapters/pixi/injection.js +41 -0
- package/dist/inspectors/scene/adapters/pixi/injection.js.map +1 -0
- package/dist/inspectors/scene/formatter.d.ts +0 -1
- package/dist/inspectors/scene/formatter.d.ts.map +1 -1
- package/dist/inspectors/scene/formatter.js +100 -43
- package/dist/inspectors/scene/formatter.js.map +1 -1
- package/dist/inspectors/scene/index.d.ts +4 -4
- package/dist/inspectors/scene/index.d.ts.map +1 -1
- package/dist/inspectors/scene/index.js +8 -5
- package/dist/inspectors/scene/index.js.map +1 -1
- package/dist/inspectors/scene/pixi.js.map +1 -1
- package/dist/inspectors/scene/registry.d.ts +2 -2
- package/dist/inspectors/scene/registry.d.ts.map +1 -1
- package/dist/inspectors/scene/registry.js +8 -8
- package/dist/inspectors/scene/registry.js.map +1 -1
- package/dist/inspectors/scene/types.d.ts +6 -10
- package/dist/inspectors/scene/types.d.ts.map +1 -1
- package/dist/inspectors/watch/index.d.ts +18 -0
- package/dist/inspectors/watch/index.d.ts.map +1 -0
- package/dist/inspectors/watch/index.js +39 -0
- package/dist/inspectors/watch/index.js.map +1 -0
- package/dist/inspectors/watch/types.d.ts +70 -0
- package/dist/inspectors/watch/types.d.ts.map +1 -0
- package/dist/inspectors/watch/types.js +21 -0
- package/dist/inspectors/watch/types.js.map +1 -0
- package/dist/server/server.d.ts +31 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +620 -67
- package/dist/server/server.js.map +1 -1
- package/dist/server/watch-session.d.ts +32 -0
- package/dist/server/watch-session.d.ts.map +1 -0
- package/dist/server/watch-session.js +165 -0
- package/dist/server/watch-session.js.map +1 -0
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +61 -59
- package/skills/verify/SKILL.md +146 -11
- package/skills/verify-recipe/SKILL.md +185 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-view",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "PetukhovArt",
|
|
5
|
+
"url": "https://github.com/PetukhovArt"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "agent-view",
|
|
10
|
+
"source": "./",
|
|
11
|
+
"description": "Visual verification CLI for desktop apps (Electron/Tauri/Browser) via Chrome DevTools Protocol. Inspect DOM, interact with UI, capture screenshots, and read WebGL scene graphs."
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-view",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Visual verification CLI for desktop apps (Electron/Tauri/Browser) via Chrome DevTools Protocol. Ships two skills: verify (run DOM, screenshot, eval, watch, console checks against a live app) and verify-recipe (author a disciplined verification plan as a .md file).",
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cdp",
|
|
7
|
+
"electron",
|
|
8
|
+
"tauri",
|
|
9
|
+
"desktop",
|
|
10
|
+
"testing",
|
|
11
|
+
"accessibility",
|
|
12
|
+
"screenshot",
|
|
13
|
+
"automation"
|
|
14
|
+
],
|
|
5
15
|
"author": {
|
|
6
16
|
"name": "PetukhovArt"
|
|
7
17
|
},
|
|
8
18
|
"homepage": "https://github.com/PetukhovArt/agent-view",
|
|
19
|
+
"repository": "https://github.com/PetukhovArt/agent-view",
|
|
9
20
|
"license": "MIT"
|
|
10
21
|
}
|
package/README.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
# agent-view
|
|
2
2
|
|
|
3
|
-
**Give your AI agent eyes and hands for desktop apps
|
|
3
|
+
**Give your AI agent eyes and hands for complex desktop apps verification**
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
-
agent-view bridges that gap: it connects to any Chromium-based desktop app via Chrome DevTools Protocol and lets the agent inspect
|
|
7
|
+
agent-view bridges that gap: it connects to any Chromium-based desktop app via Chrome DevTools Protocol and lets the agent inspect, interact, and verify.
|
|
8
8
|
|
|
9
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
10
|
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
- **DOM accessibility tree** with ref IDs — compact, LLM-friendly, with text/role filters; `--compact` merges single-child chains for 40–60% fewer tokens, `--count` returns just the match count, `--max-lines` caps output, `--diff` emits only what changed since the last call
|
|
14
|
+
- **Screenshots** — full-res PNG, scaled WebP (~3–12× fewer vision tokens), or `--crop <filter>` to a single element bounding box
|
|
15
|
+
- **Interaction** — click, fill, and drag by ref or coordinates; works with Vue/React/native frameworks
|
|
16
|
+
- **JS state via `eval`** — read store contents, computed values, async results without scraping the DOM
|
|
17
|
+
- **Reactive state via `watch`** — stream JSON-patch diffs of any expression (store, ref, computed) until a condition is met
|
|
18
|
+
- **Console capture** — `console.log/warn/error` per page and per worker, with level/since filters and `--follow --until <pattern>` for early exit on a matching log
|
|
19
|
+
- **Worker access** — SharedWorker, ServiceWorker, dedicated Worker visible alongside pages; fuzzy `--target` resolution everywhere (id → title → URL)
|
|
20
|
+
- **Canvas / WebGL scene graph** — PixiJS today, engine-pluggable; `--compact` mirrors the DOM mode
|
|
21
|
+
|
|
11
22
|
## Why CLI, not MCP?
|
|
12
23
|
|
|
13
24
|
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.
|
|
@@ -16,31 +27,70 @@ agent-view is a CLI. One Bash call, compact text output, zero schema overhead. T
|
|
|
16
27
|
|
|
17
28
|
And CLI works everywhere — Claude Code, Copilot, Codex, custom pipelines, CI. No MCP client required.
|
|
18
29
|
|
|
19
|
-
##
|
|
30
|
+
## Install & Update
|
|
31
|
+
|
|
32
|
+
### Claude Code (recommended)
|
|
33
|
+
|
|
34
|
+
Two steps — both required:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 1. Install the plugin — adds two skills: verify (run checks against a live app) and verify-recipe (author a verification plan)
|
|
38
|
+
/plugin marketplace add PetukhovArt/agent-view
|
|
39
|
+
/plugin install agent-view@agent-view
|
|
40
|
+
|
|
41
|
+
# 2. Install the CLI — the skill calls these binaries; the plugin doesn't bundle them
|
|
42
|
+
npm install -g @petukhovart/agent-view
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The plugin ships two skills. **`verify`** executes visual and runtime checks against a running app. **`verify-recipe`** generates a `.claude/verify-recipes/<slug>.md` file — a disciplined, cheapest-first command sequence for a feature or bugfix — that you or any AI agent can run later. Trigger it with phrases like "write a verify-recipe for the login fix" or "generate a verification plan for this feature".
|
|
20
46
|
|
|
21
|
-
|
|
47
|
+
Verify:
|
|
22
48
|
|
|
49
|
+
```bash
|
|
50
|
+
agent-view --version # 0.5.0+
|
|
23
51
|
```
|
|
24
|
-
|
|
52
|
+
|
|
53
|
+
### Standalone CLI (any other agent, CI, or scripting)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @petukhovart/agent-view
|
|
25
57
|
```
|
|
26
58
|
|
|
27
|
-
|
|
59
|
+
Everything works from this alone — `agent-view dom`, `screenshot`, `eval`, etc. Skip the plugin step.
|
|
60
|
+
|
|
61
|
+
### Update
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Update the CLI to the latest version
|
|
65
|
+
npm update -g @petukhovart/agent-view
|
|
66
|
+
|
|
67
|
+
# Update the Claude Code plugin (refreshes skills from the marketplace)
|
|
68
|
+
/plugin marketplace update agent-view
|
|
69
|
+
/plugin install agent-view@agent-view # re-run to pick up new skill versions
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The two are independent — bump the CLI when a new release ships features (see `CHANGELOG.md`), bump the plugin when skill instructions change.
|
|
28
73
|
|
|
29
74
|
## Enabling CDP
|
|
30
75
|
|
|
76
|
+
agent-view talks to your app over Chrome DevTools Protocol. Your app must be launched with a debugging port open.
|
|
77
|
+
|
|
31
78
|
### Recommended: in code (reliable, works with any build tool)
|
|
32
79
|
|
|
33
80
|
Add to your Electron main process:
|
|
34
81
|
|
|
35
82
|
```js
|
|
36
|
-
app.commandLine.appendSwitch('remote-debugging-port', '
|
|
83
|
+
app.commandLine.appendSwitch('remote-debugging-port', '9876');
|
|
37
84
|
```
|
|
38
85
|
|
|
86
|
+
> Any free port works — `9876` is just an example. Avoid `9222` (Chrome's own default remote-debugging port) to prevent
|
|
87
|
+
> collisions when Chrome is open.
|
|
88
|
+
|
|
39
89
|
For dev-only:
|
|
40
90
|
|
|
41
91
|
```js
|
|
42
92
|
if (!app.isPackaged) {
|
|
43
|
-
|
|
93
|
+
app.commandLine.appendSwitch('remote-debugging-port', '9876');
|
|
44
94
|
}
|
|
45
95
|
```
|
|
46
96
|
|
|
@@ -48,32 +98,26 @@ if (!app.isPackaged) {
|
|
|
48
98
|
|
|
49
99
|
```bash
|
|
50
100
|
# Plain Electron
|
|
51
|
-
electron . --remote-debugging-port=
|
|
101
|
+
electron . --remote-debugging-port=9876
|
|
52
102
|
|
|
53
103
|
# electron-vite (note the -- to forward the flag past the build tool)
|
|
54
|
-
npx electron-vite dev -- --remote-debugging-port=
|
|
104
|
+
npx electron-vite dev -- --remote-debugging-port=9876
|
|
55
105
|
```
|
|
56
106
|
|
|
57
107
|
### Other runtimes
|
|
58
108
|
|
|
59
|
-
| Runtime
|
|
60
|
-
|
|
61
|
-
| **Tauri**
|
|
62
|
-
| **Any Chromium app** | `--remote-debugging-port=
|
|
109
|
+
| Runtime | Setup |
|
|
110
|
+
|----------------------|--------------------------------------------|
|
|
111
|
+
| **Tauri** | CDP via devtools configuration |
|
|
112
|
+
| **Any Chromium app** | `--remote-debugging-port=9876` launch flag |
|
|
63
113
|
|
|
64
114
|
### Verify CDP is working
|
|
65
115
|
|
|
66
116
|
```bash
|
|
67
|
-
curl -s http://localhost:
|
|
117
|
+
curl -s http://localhost:9876/json/version
|
|
68
118
|
```
|
|
69
119
|
|
|
70
|
-
If you see a JSON response with
|
|
71
|
-
|
|
72
|
-
## Install
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm install -g agent-view
|
|
76
|
-
```
|
|
120
|
+
If you see a JSON response with process info — you're good.
|
|
77
121
|
|
|
78
122
|
## Quick start
|
|
79
123
|
|
|
@@ -93,7 +137,7 @@ agent-view screenshot # PNG screenshot
|
|
|
93
137
|
|
|
94
138
|
# 4. Interact
|
|
95
139
|
agent-view click 5 # Click element by ref
|
|
96
|
-
agent-view fill 3 "hello"
|
|
140
|
+
agent-view fill 3 "hello" # Type into input
|
|
97
141
|
|
|
98
142
|
# 5. Verify the result
|
|
99
143
|
agent-view dom --filter "success" # Check for expected element
|
|
@@ -110,25 +154,47 @@ A background server connects to your app's CDP port, caches sessions, and auto-s
|
|
|
110
154
|
|
|
111
155
|
## Config
|
|
112
156
|
|
|
113
|
-
Running `agent-view init` in your project root generates `agent-view.config.json
|
|
157
|
+
Running `agent-view init` in your project root generates `agent-view.config.json`. Minimal form:
|
|
114
158
|
|
|
115
159
|
```json
|
|
116
160
|
{
|
|
117
161
|
"runtime": "electron",
|
|
118
|
-
"port":
|
|
162
|
+
"port": 9876,
|
|
119
163
|
"launch": "npm run dev"
|
|
120
164
|
}
|
|
121
165
|
```
|
|
122
166
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
167
|
+
Full form with all optional fields:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"runtime": "electron",
|
|
172
|
+
"port": 9876,
|
|
173
|
+
"launch": "npm run dev",
|
|
174
|
+
"allowEval": true,
|
|
175
|
+
"webgl": {
|
|
176
|
+
"engine": "pixi"
|
|
177
|
+
},
|
|
178
|
+
"consoleBufferSize": 500,
|
|
179
|
+
"consoleTargets": ["page", "shared_worker", "service_worker"]
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Field | Required | Description |
|
|
184
|
+
|---------------------|----------|-----------------------------------------------------------------------------------------------------------|
|
|
185
|
+
| `runtime` | yes | `"electron"`, `"tauri"`, or `"browser"` |
|
|
186
|
+
| `port` | yes | CDP debugging port |
|
|
187
|
+
| `launch` | no | Command to start the app |
|
|
188
|
+
| `webgl.engine` | no | `"pixi"` (scene extractor architecture supports adding more engines) |
|
|
189
|
+
| `allowEval` | no | `true` to enable `agent-view eval` and `watch`. Off by default — opt-in for arbitrary JS execution |
|
|
190
|
+
| `consoleBufferSize` | no | Per-target console ring capacity. Default `500` |
|
|
191
|
+
| `consoleTargets` | no | Target types `agent-view console` auto-attaches to. Default `["page", "shared_worker", "service_worker"]` |
|
|
129
192
|
|
|
130
193
|
## Commands
|
|
131
194
|
|
|
195
|
+
Every command targeting a window accepts `--window <id|title-substring>` (IDs come from `discover`). Examples below omit
|
|
196
|
+
it for brevity.
|
|
197
|
+
|
|
132
198
|
### `init`
|
|
133
199
|
|
|
134
200
|
Auto-generates config by reading `package.json`.
|
|
@@ -149,9 +215,22 @@ Dumps the accessibility tree in compact text format. Each element gets a session
|
|
|
149
215
|
agent-view dom
|
|
150
216
|
agent-view dom --filter "Submit" # Filter by text/role
|
|
151
217
|
agent-view dom --depth 3 # Limit tree depth
|
|
152
|
-
agent-view dom --
|
|
218
|
+
agent-view dom --max-lines 200 # Hard line budget (refs for hidden nodes still stored)
|
|
219
|
+
agent-view dom --text # Fall back to DOM textContent search when AX returns no match
|
|
220
|
+
agent-view dom --compact # Merge single-child chains onto one line (saves ~40-60% tokens)
|
|
221
|
+
agent-view dom --count # Return only the count of matching nodes (e.g. "5")
|
|
222
|
+
agent-view dom --filter "row" --count # Count how many rows match
|
|
223
|
+
agent-view dom --diff # Show only lines that changed since last call
|
|
153
224
|
```
|
|
154
225
|
|
|
226
|
+
When `--filter` is set, depth defaults to unlimited so deep matches aren't truncated.
|
|
227
|
+
|
|
228
|
+
`--count` skips tree formatting and ref-store mutations entirely — useful for assertions like "does this section have N rows?" without the token cost of a full tree dump.
|
|
229
|
+
|
|
230
|
+
`--max-lines <n>` caps the number of output lines. When the tree exceeds the budget, output is truncated after `n-1` lines and a summary tail `… M more nodes` is appended. Refs for all nodes — including those past the cutoff — are still registered in the ref store, so a follow-up `dom --filter` or `click <ref>` works without re-running.
|
|
231
|
+
|
|
232
|
+
`--diff` computes a line-level diff against the previous `dom` call for the same target. The first call always returns the full tree (no prior snapshot). Subsequent calls emit only added (`+ `) and removed (`- `) lines. Returns `No changes` when the tree is identical.
|
|
233
|
+
|
|
155
234
|
### `click`
|
|
156
235
|
|
|
157
236
|
Clicks a DOM element by ref ID or coordinates.
|
|
@@ -169,15 +248,41 @@ Types text into an input. Uses native value setter + dispatches input/change eve
|
|
|
169
248
|
agent-view fill 3 "hello@example.com"
|
|
170
249
|
```
|
|
171
250
|
|
|
251
|
+
### `drag`
|
|
252
|
+
|
|
253
|
+
HTML5 / pointer-driven drag-and-drop via CDP `Input.dispatchMouseEvent`
|
|
254
|
+
(`mousePressed` → N × `mouseMoved` → `mouseReleased`). Real mouse events, not
|
|
255
|
+
synthesized JS events — works with `vue-draggable-resizable`, `react-grid-layout`,
|
|
256
|
+
gridstack, kanban boards, file drop zones, map pin drags, resize handles.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
agent-view drag --from 42 --to 88 # ref → ref
|
|
260
|
+
agent-view drag --from-pos 86,792 --to-pos 640,200 # coord → coord (canvas, custom DnD)
|
|
261
|
+
agent-view drag --from 42 --to-pos 640,200 # mixed
|
|
262
|
+
agent-view drag --from 5 --to 9 --steps 20 --hold-ms 150
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
`--steps` (default 10) controls intermediate `mouseMoved` events so libraries
|
|
266
|
+
that throttle on movement deltas still see continuous motion. `--hold-ms`
|
|
267
|
+
inserts a pause between press and the first move (some libs require >100ms
|
|
268
|
+
for touch-style activation). `--button` accepts `left|right|middle`.
|
|
269
|
+
|
|
172
270
|
### `screenshot`
|
|
173
271
|
|
|
174
|
-
Captures a
|
|
272
|
+
Captures a screenshot, saves to temp dir, prints the file path. PNG by default; WebP (q=80) when `--scale` is set (JPEG fallback for older Chrome/Electron).
|
|
175
273
|
|
|
176
274
|
```bash
|
|
177
275
|
agent-view screenshot
|
|
178
|
-
agent-view screenshot --
|
|
276
|
+
agent-view screenshot --scale 0.5 # Half-res WebP (~3× fewer vision tokens)
|
|
277
|
+
agent-view screenshot --scale 0.25 # Quarter-res WebP (~12× fewer, 1 tile)
|
|
278
|
+
agent-view screenshot --crop "Sidebar" # Crop to element bounding box (~12× fewer in best case)
|
|
279
|
+
agent-view screenshot --crop "Chart" --scale 0.5 # Crop + scale (stacks)
|
|
179
280
|
```
|
|
180
281
|
|
|
282
|
+
`--scale` accepts a factor in `(0, 1]`. CDP-side clip + WebP encode — recommended for agent loops where vision tokens dominate cost.
|
|
283
|
+
|
|
284
|
+
`--crop <filter>` resolves a DOM element by the same filter syntax as `dom --filter`, then crops the screenshot to its bounding box before encoding. One tile (~1.6k vision tokens) instead of twelve (~19k) in the best case. If the filter matches nothing a warning is emitted to stderr and the full window is captured instead. Combines naturally with `--scale`.
|
|
285
|
+
|
|
181
286
|
### `scene`
|
|
182
287
|
|
|
183
288
|
Reads the WebGL scene graph for canvas-based apps. Currently supports PixiJS via `window.__PIXI_DEVTOOLS__`.
|
|
@@ -187,14 +292,16 @@ agent-view scene # Full scene graph
|
|
|
187
292
|
agent-view scene --diff # Changes since last call
|
|
188
293
|
agent-view scene --filter "player" # Filter by name/type
|
|
189
294
|
agent-view scene --verbose # Extended props (alpha, scale, bounds)
|
|
295
|
+
agent-view scene --compact # Merge single-child chains onto one line
|
|
190
296
|
```
|
|
191
297
|
|
|
192
298
|
### `snap`
|
|
193
299
|
|
|
194
|
-
Combined DOM + scene graph in one call. Shows DOM always; scene section appears when a WebGL engine is detected.
|
|
300
|
+
Combined DOM + scene graph in one call. Shows DOM always; scene section appears when a WebGL engine is detected. Pass `--scale` to also capture a screenshot and append it as a third section.
|
|
195
301
|
|
|
196
302
|
```bash
|
|
197
303
|
agent-view snap
|
|
304
|
+
agent-view snap --scale 0.5 # DOM + Scene + Screenshot (path written to tmp)
|
|
198
305
|
```
|
|
199
306
|
|
|
200
307
|
### `wait`
|
|
@@ -210,48 +317,91 @@ agent-view wait --filter "Dashboard" --timeout 30 # Custom timeout in seconds
|
|
|
210
317
|
|
|
211
318
|
Starts the app using the `launch` command from config. Polls CDP until ready (60s timeout). Idempotent — skips if already running.
|
|
212
319
|
|
|
213
|
-
### `
|
|
214
|
-
|
|
215
|
-
Stops the background lazy server.
|
|
216
|
-
|
|
217
|
-
## Multiwindow
|
|
320
|
+
### `targets`
|
|
218
321
|
|
|
219
|
-
|
|
322
|
+
Lists every CDP target — pages, iframes, shared/service/dedicated workers. Use this when you need access to non-page targets (e.g. an Electron app with a `SharedWorker`).
|
|
220
323
|
|
|
221
324
|
```bash
|
|
222
|
-
agent-view
|
|
223
|
-
agent-view
|
|
325
|
+
agent-view targets # all supported types
|
|
326
|
+
agent-view targets --type shared_worker,service_worker # filter
|
|
327
|
+
agent-view targets --json # machine-readable
|
|
224
328
|
```
|
|
225
329
|
|
|
226
|
-
|
|
330
|
+
### `eval`
|
|
227
331
|
|
|
228
|
-
|
|
229
|
-
|---------|--------|-----|
|
|
230
|
-
| `dom`, `scene`, `snap` | Plain text | LLM-friendly, minimal tokens |
|
|
231
|
-
| `discover` | JSON | Machine-parseable |
|
|
232
|
-
| `screenshot` | File path | Agent reads the image |
|
|
332
|
+
Runs `Runtime.evaluate` in any connectable target. **Requires `"allowEval": true` in `agent-view.config.json`** — the local socket is shared and this is the project-owner opt-in.
|
|
233
333
|
|
|
234
|
-
|
|
334
|
+
```bash
|
|
335
|
+
agent-view eval "document.title"
|
|
336
|
+
agent-view eval --target IJ56KL "self.constructor.name" # by id (or title/url substring)
|
|
337
|
+
agent-view eval --window "Monitor 1" --await "fetch('/api/health').then(r => r.status)"
|
|
338
|
+
agent-view eval --json "({ buttons: document.querySelectorAll('button').length })"
|
|
339
|
+
```
|
|
235
340
|
|
|
236
|
-
|
|
341
|
+
Output is capped at 64 KB. Thrown exceptions and syntax errors propagate as non-zero exit with the CDP error message.
|
|
237
342
|
|
|
238
|
-
###
|
|
343
|
+
### `console`
|
|
344
|
+
|
|
345
|
+
Streams or dumps console output (`Runtime.consoleAPICalled` + `Log.entryAdded`) from auto-attached targets. Lazy: first call attaches matching targets, subsequent calls reuse them.
|
|
239
346
|
|
|
240
347
|
```bash
|
|
241
|
-
|
|
348
|
+
agent-view console # buffered messages since attach
|
|
349
|
+
agent-view console --follow --timeout 10 # stream for 10s
|
|
350
|
+
agent-view console --follow --until "ready" # exit as soon as a message contains "ready"
|
|
351
|
+
agent-view console --follow --until "/error/i" # exit on regex match (case-insensitive)
|
|
352
|
+
agent-view console --target IJ56KL # restrict to one target (exact id)
|
|
353
|
+
agent-view console --target sync-worker # restrict to one target (title/URL substring)
|
|
354
|
+
agent-view console --level error,warn # level filter
|
|
355
|
+
agent-view console --since "2026-04-26T10:00:00Z"
|
|
356
|
+
agent-view console --clear # drop in-memory ring
|
|
242
357
|
```
|
|
243
358
|
|
|
244
|
-
|
|
359
|
+
`--until <pattern>` requires `--follow`. Exits as soon as a message matches the pattern (substring or `/regex/flags`). On timeout without match exits non-zero with `Timeout: pattern not seen in <N>s`.
|
|
360
|
+
|
|
361
|
+
`--target` resolves the same way as `eval --target`: exact id wins, then title substring, then URL substring. If no match is found, an error is returned.
|
|
362
|
+
|
|
363
|
+
Default attached target types: `page`, `shared_worker`, `service_worker`. Override with `consoleTargets` in config.
|
|
245
364
|
|
|
246
|
-
###
|
|
365
|
+
### `watch`
|
|
366
|
+
|
|
367
|
+
Polls a JS expression and streams JSON-patch (RFC 6902) diffs as it changes. Closes the "what changed between click and final state?" gap that screenshots and DOM dumps can't cover. **Requires `"allowEval": true`** (same gate as `eval`).
|
|
247
368
|
|
|
248
369
|
```bash
|
|
249
|
-
#
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
370
|
+
agent-view watch "store.cart.total" # 250ms poll, exits at 10 changes or 30s
|
|
371
|
+
agent-view watch "appState" --interval 100 --duration 60 # tighter cadence, longer window
|
|
372
|
+
agent-view watch "store.status" --until "store.status === 'ready'" # wait-for assertion
|
|
373
|
+
agent-view watch "appState" --max-changes 1 # snapshot first change after a click
|
|
374
|
+
agent-view watch "appState" --json # NDJSON, one frame per line
|
|
253
375
|
```
|
|
254
376
|
|
|
377
|
+
Output frames: `init` (baseline value), `diff` (RFC 6902 ops since last frame), `error`, `stop`. SIGINT exits cleanly. Snapshot size cap 256 KB — narrow the expression (e.g. `store.cart.items.length`) when watching large objects.
|
|
378
|
+
|
|
379
|
+
### `stop`
|
|
380
|
+
|
|
381
|
+
Stops the background lazy server.
|
|
382
|
+
|
|
383
|
+
## Output format
|
|
384
|
+
|
|
385
|
+
| Command | Format | Why |
|
|
386
|
+
|------------------------|------------|------------------------------|
|
|
387
|
+
| `dom`, `scene`, `snap` | Plain text | LLM-friendly, minimal tokens |
|
|
388
|
+
| `discover` | JSON | Machine-parseable |
|
|
389
|
+
| `screenshot` | File path | Agent reads the image |
|
|
390
|
+
|
|
391
|
+
## Performance
|
|
392
|
+
|
|
393
|
+
Built for tight `dom → click → dom` loops. Typical Electron app, ~200 AX nodes:
|
|
394
|
+
|
|
395
|
+
| Scenario | agent-view | Playwright (estimate) |
|
|
396
|
+
|--------------------------------|------------|-----------------------|
|
|
397
|
+
| `dom` cold fetch | 2ms | ~30–80ms |
|
|
398
|
+
| `dom` warm (cache hit) | 1ms | ~30–80ms |
|
|
399
|
+
| Full cycle `dom → click → dom` | 17ms | ~75ms |
|
|
400
|
+
|
|
401
|
+
What makes it fast: 300ms AX-tree cache (invalidated on `click`/`fill`/navigation; cached responses prefixed with
|
|
402
|
+
`[cache]`), parallel CDP calls in `click`, `Accessibility.queryAXTree` for filter lookups, and a single persistent CDP
|
|
403
|
+
WebSocket reused across commands (no relay).
|
|
404
|
+
|
|
255
405
|
## Example: testing a login flow
|
|
256
406
|
|
|
257
407
|
```bash
|
|
@@ -279,8 +429,8 @@ agent-view screenshot
|
|
|
279
429
|
|
|
280
430
|
### CDP not responding
|
|
281
431
|
|
|
282
|
-
1. Check the port is listening: `curl -s http://localhost:
|
|
283
|
-
2. For electron-vite: make sure you use `--` before the flag: `npx electron-vite dev -- --remote-debugging-port=
|
|
432
|
+
1. Check the port is listening: `curl -s http://localhost:9876/json/version`
|
|
433
|
+
2. For electron-vite: make sure you use `--` before the flag: `npx electron-vite dev -- --remote-debugging-port=9876`
|
|
284
434
|
3. Restart the app — HMR doesn't restart the main process
|
|
285
435
|
|
|
286
436
|
### Stale refs after HMR
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,eAAO,MAAM,cAAc,EAAE,cAgB5B,CAAA"}
|
package/dist/adapters/browser.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { listSupportedTargets, connectToPage } from '../cdp/transport.js';
|
|
2
2
|
import { RuntimeType } from '../types.js';
|
|
3
|
+
import { TargetType } from '../cdp/types.js';
|
|
3
4
|
export const browserAdapter = {
|
|
4
5
|
runtime: RuntimeType.Browser,
|
|
5
6
|
async discover(port) {
|
|
6
|
-
const targets = await
|
|
7
|
+
const targets = await listSupportedTargets(port);
|
|
7
8
|
return targets
|
|
8
|
-
.filter(t => t.type ===
|
|
9
|
-
.map(t => ({
|
|
10
|
-
id: t.id,
|
|
11
|
-
title: t.title,
|
|
12
|
-
url: t.url,
|
|
13
|
-
type: t.type,
|
|
14
|
-
}));
|
|
9
|
+
.filter(t => t.type === TargetType.Page)
|
|
10
|
+
.map(t => ({ id: t.id, title: t.title, url: t.url, type: t.type }));
|
|
15
11
|
},
|
|
16
|
-
async connect(port, windowId) {
|
|
17
|
-
|
|
12
|
+
async connect(port, windowId, cache) {
|
|
13
|
+
const targets = await listSupportedTargets(port);
|
|
14
|
+
const target = targets.find(t => t.id === windowId);
|
|
15
|
+
if (!target)
|
|
16
|
+
throw new Error(`Target not found: ${windowId}`);
|
|
17
|
+
return connectToPage(port, target, cache);
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/adapters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAoB,MAAM,iBAAiB,CAAA;AAG9D,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,OAAO,EAAE,WAAW,CAAC,OAAO;IAE5B,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAChD,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC;aACvC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB,EAAE,KAAkB;QAC9D,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAA;QAC7D,OAAO,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;CACF,CAAA"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"electron.d.ts","sourceRoot":"","sources":["../../src/adapters/electron.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKhD,eAAO,MAAM,eAAe,EAAE,cAgB7B,CAAA"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { listSupportedTargets, connectToPage } from '../cdp/transport.js';
|
|
2
2
|
import { RuntimeType } from '../types.js';
|
|
3
|
+
import { TargetType } from '../cdp/types.js';
|
|
3
4
|
export const electronAdapter = {
|
|
4
5
|
runtime: RuntimeType.Electron,
|
|
5
6
|
async discover(port) {
|
|
6
|
-
const targets = await
|
|
7
|
+
const targets = await listSupportedTargets(port);
|
|
7
8
|
return targets
|
|
8
|
-
.filter(t => t.type ===
|
|
9
|
-
.map(t => ({
|
|
10
|
-
id: t.id,
|
|
11
|
-
title: t.title,
|
|
12
|
-
url: t.url,
|
|
13
|
-
type: t.type,
|
|
14
|
-
}));
|
|
9
|
+
.filter(t => t.type === TargetType.Page)
|
|
10
|
+
.map(t => ({ id: t.id, title: t.title, url: t.url, type: t.type }));
|
|
15
11
|
},
|
|
16
|
-
async connect(port, windowId) {
|
|
17
|
-
|
|
12
|
+
async connect(port, windowId, cache) {
|
|
13
|
+
const targets = await listSupportedTargets(port);
|
|
14
|
+
const target = targets.find(t => t.id === windowId);
|
|
15
|
+
if (!target)
|
|
16
|
+
throw new Error(`Target not found: ${windowId}`);
|
|
17
|
+
return connectToPage(port, target, cache);
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=electron.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron.js","sourceRoot":"","sources":["../../src/adapters/electron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"electron.js","sourceRoot":"","sources":["../../src/adapters/electron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAoB,MAAM,iBAAiB,CAAA;AAG9D,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,OAAO,EAAE,WAAW,CAAC,QAAQ;IAE7B,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAChD,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC;aACvC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB,EAAE,KAAkB;QAC9D,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAA;QAC7D,OAAO,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;CACF,CAAA"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"tauri.d.ts","sourceRoot":"","sources":["../../src/adapters/tauri.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAYhD,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,cAgB1B,CAAA"}
|
package/dist/adapters/tauri.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { listSupportedTargets, connectToPage } from '../cdp/transport.js';
|
|
2
2
|
import { RuntimeType } from '../types.js';
|
|
3
|
+
import { TargetType } from '../cdp/types.js';
|
|
3
4
|
/** URLs that Tauri/WebView2 exposes as CDP targets but aren't app windows */
|
|
4
5
|
const INTERNAL_URL_PATTERNS = [
|
|
5
6
|
'about:blank',
|
|
@@ -7,7 +8,7 @@ const INTERNAL_URL_PATTERNS = [
|
|
|
7
8
|
'chrome-extension://',
|
|
8
9
|
];
|
|
9
10
|
export function isAppTarget(target) {
|
|
10
|
-
if (target.type !==
|
|
11
|
+
if (target.type !== TargetType.Page)
|
|
11
12
|
return false;
|
|
12
13
|
const url = target.url.toLowerCase();
|
|
13
14
|
return !INTERNAL_URL_PATTERNS.some(pattern => url.startsWith(pattern));
|
|
@@ -15,18 +16,17 @@ export function isAppTarget(target) {
|
|
|
15
16
|
export const tauriAdapter = {
|
|
16
17
|
runtime: RuntimeType.Tauri,
|
|
17
18
|
async discover(port) {
|
|
18
|
-
const targets = await
|
|
19
|
+
const targets = await listSupportedTargets(port);
|
|
19
20
|
return targets
|
|
20
21
|
.filter(isAppTarget)
|
|
21
|
-
.map(t => ({
|
|
22
|
-
id: t.id,
|
|
23
|
-
title: t.title,
|
|
24
|
-
url: t.url,
|
|
25
|
-
type: t.type,
|
|
26
|
-
}));
|
|
22
|
+
.map(t => ({ id: t.id, title: t.title, url: t.url, type: t.type }));
|
|
27
23
|
},
|
|
28
|
-
async connect(port, windowId) {
|
|
29
|
-
|
|
24
|
+
async connect(port, windowId, cache) {
|
|
25
|
+
const targets = await listSupportedTargets(port);
|
|
26
|
+
const target = targets.find(t => t.id === windowId);
|
|
27
|
+
if (!target)
|
|
28
|
+
throw new Error(`Target not found: ${windowId}`);
|
|
29
|
+
return connectToPage(port, target, cache);
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=tauri.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tauri.js","sourceRoot":"","sources":["../../src/adapters/tauri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tauri.js","sourceRoot":"","sources":["../../src/adapters/tauri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAoB,MAAM,iBAAiB,CAAA;AAG9D,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,UAAU,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACjD,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,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAChD,OAAO,OAAO;aACX,MAAM,CAAC,WAAW,CAAC;aACnB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB,EAAE,KAAkB;QAC9D,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAA;QAC7D,OAAO,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;CACF,CAAA"}
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { WindowInfo, RuntimeType } from '../types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PageSession } from '../cdp/types.js';
|
|
3
|
+
import type { AxTreeCache } from '../cdp/ax-cache.js';
|
|
3
4
|
export type RuntimeAdapter = {
|
|
4
5
|
readonly runtime: RuntimeType;
|
|
6
|
+
/** Discover page-targets only — kept for back-compat. Use `listSupportedTargets` for all targets. */
|
|
5
7
|
discover(port: number): Promise<WindowInfo[]>;
|
|
6
|
-
|
|
8
|
+
/** Connect to a page-target. Worker targets go through `connectToRuntime` directly. */
|
|
9
|
+
connect(port: number, windowId: string, cache: AxTreeCache): Promise<PageSession>;
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +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,
|
|
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,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,qGAAqG;IACrG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAC7C,uFAAuF;IACvF,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAClF,CAAA"}
|