@petukhovart/agent-view 0.15.0 → 0.17.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 +1 -1
- package/README.md +34 -11
- package/dist/cdp/png.d.ts +15 -0
- package/dist/cdp/png.d.ts.map +1 -0
- package/dist/cdp/png.js +147 -0
- package/dist/cdp/png.js.map +1 -0
- package/dist/cdp/transport.d.ts +2 -0
- package/dist/cdp/transport.d.ts.map +1 -1
- package/dist/cdp/transport.js +233 -50
- package/dist/cdp/transport.js.map +1 -1
- package/dist/cdp/types.d.ts +72 -6
- package/dist/cdp/types.d.ts.map +1 -1
- package/dist/cdp/types.js.map +1 -1
- package/dist/cli/client.d.ts.map +1 -1
- package/dist/cli/client.js +1 -3
- package/dist/cli/client.js.map +1 -1
- package/dist/cli/commands/act.d.ts +3 -0
- package/dist/cli/commands/act.d.ts.map +1 -0
- package/dist/cli/commands/act.js +19 -0
- package/dist/cli/commands/act.js.map +1 -0
- package/dist/cli/commands/click.d.ts +2 -0
- package/dist/cli/commands/click.d.ts.map +1 -1
- package/dist/cli/commands/click.js +9 -4
- package/dist/cli/commands/click.js.map +1 -1
- package/dist/cli/commands/dom.d.ts.map +1 -1
- package/dist/cli/commands/dom.js +1 -0
- package/dist/cli/commands/dom.js.map +1 -1
- package/dist/cli/commands/drag.d.ts +4 -0
- package/dist/cli/commands/drag.d.ts.map +1 -1
- package/dist/cli/commands/drag.js +18 -0
- package/dist/cli/commands/drag.js.map +1 -1
- package/dist/cli/commands/fill.d.ts +2 -0
- package/dist/cli/commands/fill.d.ts.map +1 -1
- package/dist/cli/commands/fill.js +11 -4
- package/dist/cli/commands/fill.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 +10 -1
- package/dist/cli/commands/screenshot.js.map +1 -1
- package/dist/cli/commands/wait.d.ts +3 -1
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +6 -2
- package/dist/cli/commands/wait.js.map +1 -1
- package/dist/cli/commands/watch.js +1 -1
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/index.js +51 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/config/manager.js +4 -0
- package/dist/config/manager.js.map +1 -1
- package/dist/config/types.d.ts +5 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/inspectors/controls/index.d.ts +39 -0
- package/dist/inspectors/controls/index.d.ts.map +1 -0
- package/dist/inspectors/controls/index.js +140 -0
- package/dist/inspectors/controls/index.js.map +1 -0
- package/dist/inspectors/dom/index.d.ts +2 -0
- package/dist/inspectors/dom/index.d.ts.map +1 -1
- package/dist/inspectors/dom/index.js +21 -14
- package/dist/inspectors/dom/index.js.map +1 -1
- package/dist/server/act-replay.d.ts +23 -0
- package/dist/server/act-replay.d.ts.map +1 -0
- package/dist/server/act-replay.js +143 -0
- package/dist/server/act-replay.js.map +1 -0
- package/dist/server/act-script.d.ts +46 -0
- package/dist/server/act-script.d.ts.map +1 -0
- package/dist/server/act-script.js +46 -0
- package/dist/server/act-script.js.map +1 -0
- package/dist/server/act-session.d.ts +23 -0
- package/dist/server/act-session.d.ts.map +1 -0
- package/dist/server/act-session.js +304 -0
- package/dist/server/act-session.js.map +1 -0
- package/dist/server/locator.d.ts +19 -0
- package/dist/server/locator.d.ts.map +1 -0
- package/dist/server/locator.js +33 -0
- package/dist/server/locator.js.map +1 -0
- package/dist/server/port.d.ts +7 -0
- package/dist/server/port.d.ts.map +1 -0
- package/dist/server/port.js +19 -0
- package/dist/server/port.js.map +1 -0
- package/dist/server/server.d.ts +1 -0
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +89 -25
- package/dist/server/server.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/verify/SKILL.md +12 -20
- package/skills/verify/references/commands.md +127 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-view",
|
|
3
3
|
"description": "Visual verification CLI for Electron/Tauri/Chromium apps via Chrome DevTools Protocol. Ships with verify skill for easy and cheap checks against a live app, including heap-snapshot memory-leak debugging.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cdp",
|
|
7
7
|
"electron",
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Works with any agent that can run shell commands. There's a Claude Code plugin i
|
|
|
34
34
|
- Electron, Tauri on Windows (WebView2), and plain Chromium. One CLI, same commands. Tauri on macOS/Linux embeds WebKit, which has no Chrome DevTools Protocol, so it is out of reach.
|
|
35
35
|
- `click`, `fill`, and `drag` fire real CDP input events. Vue `v-model`, React controlled inputs, and native fields actually accept the value; synthetic DOM events fail silently there.
|
|
36
36
|
- `watch` emits RFC-6902 JSON-patches of any JS expression between two events. Answers "what mutated after the click?" without parsing screenshots.
|
|
37
|
-
- `dom` returns the accessibility tree with `[ref=N]` handles. `--compact` cuts deep trees by 40–60%; `--diff`, `--count`, and `--max-lines` keep output bounded. `screenshot --crop` and
|
|
37
|
+
- `dom` returns the accessibility tree with `[ref=N]` handles. `--compact` cuts deep trees by 40–60%; `--diff`, `--count`, and `--max-lines` keep output bounded. `screenshot --crop` and `--scale` do the same for vision tokens.
|
|
38
38
|
- Lazy CDP daemon, one persistent socket, 300 ms AX-tree cache. `dom → click → dom` in about 17 ms.
|
|
39
39
|
|
|
40
40
|
---
|
|
@@ -146,9 +146,9 @@ The daemon is why `dom → click → dom` runs in ~17ms total: one persistent CD
|
|
|
146
146
|
|
|
147
147
|
| Command | What it gives the agent |
|
|
148
148
|
|---------------|-----------------------------------------------------------------------------------------|
|
|
149
|
-
| `dom` | Accessibility tree with `[ref=N]` handles. Flags: `--filter`, `--compact`, `--count`, `--max-lines`, `--diff`. |
|
|
150
|
-
| `screenshot` | PNG,
|
|
151
|
-
| `click` / `fill` / `drag` | Real CDP input events. Works with Vue/React/native and
|
|
149
|
+
| `dom` | Accessibility tree with `[ref=N]` handles and the project's test ids (`[testid=…]`). Flags: `--filter`, `--compact`, `--count`, `--max-lines`, `--diff`. |
|
|
150
|
+
| `screenshot` | PNG, scaled with `--scale`, or `--crop <element>` for one element only. Cuts vision tokens. |
|
|
151
|
+
| `click` / `fill` / `drag` | Real CDP input events. Works with Vue/React/native; `drag` does HTML5 DnD through `Input.dragIntercepted` and pointer DnD through mouse events. `click` / `fill` / `wait` / `screenshot` also address elements by `--testid` or `--selector`. |
|
|
152
152
|
| `eval` | Run JS in the page's main world. Read store/state directly instead of scraping DOM. |
|
|
153
153
|
| `watch` | Stream JSON-patch diffs of any expression. Answers "what changed between click and final state?". |
|
|
154
154
|
| `console` | `console.log` + `Log.entryAdded` per page **and per worker**, with `--follow --until <pattern>`. |
|
|
@@ -310,7 +310,8 @@ Full form with all optional fields:
|
|
|
310
310
|
"captureBody": false,
|
|
311
311
|
"networkBufferSize": 200,
|
|
312
312
|
"logFile": ".agent-view/console.log",
|
|
313
|
-
"logMaxBytes": 8388608
|
|
313
|
+
"logMaxBytes": 8388608,
|
|
314
|
+
"testIdAttribute": "data-testid"
|
|
314
315
|
}
|
|
315
316
|
```
|
|
316
317
|
|
|
@@ -327,6 +328,7 @@ Full form with all optional fields:
|
|
|
327
328
|
| `networkBufferSize` | no | Per-target network ring capacity. Positive integer. Default `200` (smaller than console — entries are heavier) |
|
|
328
329
|
| `logFile` | no | Feed file for `agent-view logs`. Relative paths resolve against the project root. Default `.agent-view/console.log` (gitignore it). Keep it per-checkout: two ports recording into one file is refused |
|
|
329
330
|
| `logMaxBytes` | no | Feed size cap in bytes; on overflow it rotates once to `<file>.prev`. Default `8388608` (8 MB) |
|
|
331
|
+
| `testIdAttribute` | no | Attribute holding the project's test ids, shown by `dom` and matched by `--testid`. Default: `data-testid`, `data-test-id`, `data-test`, `data-qa` and `data-cy` are all read. Setting it reads only that one |
|
|
330
332
|
|
|
331
333
|
---
|
|
332
334
|
|
|
@@ -391,16 +393,37 @@ agent-view fill 3 "hello@example.com"
|
|
|
391
393
|
|
|
392
394
|
### `drag`
|
|
393
395
|
|
|
394
|
-
|
|
396
|
+
Drag-and-drop over CDP. Two paths, picked automatically:
|
|
397
|
+
|
|
398
|
+
- **HTML5** (`draggable=true`, `dragstart`/`dragover`/`drop`). Plain mouse events never start one in Chromium: `dragstart` does not fire, `dataTransfer` stays empty, `drop` never arrives. So `drag` enables `Input.setInterceptDrags`, presses and moves, and when Chromium reports `Input.dragIntercepted` it finishes the gesture with `Input.dispatchDragEvent` (`dragEnter` → N × `dragOver` → `drop`), carrying the app's real `dataTransfer` payload. The same mechanism Puppeteer uses.
|
|
399
|
+
- **Pointer** (`mousedown`/`mousemove`/`mouseup`, pointer events). Used when no `dragIntercepted` arrives within 1 s: `vue-draggable-resizable`, `react-grid-layout`, gridstack, canvas, resize handles.
|
|
395
400
|
|
|
396
401
|
```bash
|
|
397
402
|
agent-view drag --from 42 --to 88 # ref → ref
|
|
398
403
|
agent-view drag --from-pos 86,792 --to-pos 640,200 # coord → coord (canvas, custom DnD)
|
|
399
404
|
agent-view drag --from 42 --to-pos 640,200 # mixed
|
|
400
405
|
agent-view drag --from 5 --to 9 --steps 20 --hold-ms 150
|
|
406
|
+
agent-view drag --from-pos 385,303 --to-pos 1250,589 --cancel # HTML5: dragCancel instead of drop (Esc mid-drag)
|
|
407
|
+
agent-view drag --from-pos 385,303 --to-pos 1250,589 --html5 # fail instead of falling back to pointer
|
|
408
|
+
agent-view drag --from-pos 385,303 --to-pos 1250,589 --pointer # never intercept
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The output names the path and, for HTML5, the intercepted MIME types and data — check that the payload is the app's (`application/json`, a custom type), not a text selection:
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
Dragged (385, 303) → (1250, 589) via html5 drop (dragOperationsMask=3)
|
|
415
|
+
text/plain: "1:hr:4100@UInt16"
|
|
416
|
+
application/json: "[{\"id\":\"1:hr:4100@UInt16\",\"name\":\"Float HiLo\",...}]"
|
|
401
417
|
```
|
|
402
418
|
|
|
403
|
-
|
|
419
|
+
```
|
|
420
|
+
Dragged (485, 140) → (1250, 589) via pointer
|
|
421
|
+
warning: no HTML5 drag started (Input.dragIntercepted not fired within 1 s): the element at --from is not draggable, or a control (input/select/button) under the cursor swallowed dragstart
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Pitfalls of the HTML5 path: start on a cell without a control — an `<input>`, `<select>` or `<button>` under the cursor swallows `dragstart` even inside a `draggable` row; Chromium needs several `mouseMoved` past its drag threshold, so `--steps 0` will not start one. `--mask <n>` overrides `dragOperationsMask` on the dispatched events — diagnostics for `effectAllowed` / `dropEffect` mismatches, which the browser enforces only on a real drag.
|
|
425
|
+
|
|
426
|
+
`--steps` (default 10) controls intermediate `mouseMoved` / `dragOver` events so libraries that throttle on movement deltas still see continuous motion. `--hold-ms` inserts a pause between press and the first move (some libs require >100ms for touch-style activation). `--button` accepts `left|right|middle`.
|
|
404
427
|
|
|
405
428
|
### `upload`
|
|
406
429
|
|
|
@@ -442,18 +465,18 @@ Out of reach: `showOpenFilePicker()` (File System Access API) exposes no input t
|
|
|
442
465
|
|
|
443
466
|
### `screenshot`
|
|
444
467
|
|
|
445
|
-
Captures a screenshot, saves to temp dir, prints the file path. PNG
|
|
468
|
+
Captures a screenshot, saves to temp dir, prints the file path. Always PNG.
|
|
446
469
|
|
|
447
470
|
```bash
|
|
448
471
|
agent-view screenshot
|
|
449
|
-
agent-view screenshot --scale 0.5 # Half-res
|
|
450
|
-
agent-view screenshot --scale 0.25 # Quarter-res
|
|
472
|
+
agent-view screenshot --scale 0.5 # Half-res (~3× fewer vision tokens)
|
|
473
|
+
agent-view screenshot --scale 0.25 # Quarter-res (~12× fewer, 1 tile)
|
|
451
474
|
agent-view screenshot --crop "Sidebar" # Crop to element bounding box (~12× fewer in best case)
|
|
452
475
|
agent-view screenshot --crop "Chart" --scale 0.5 # Crop + scale (stacks)
|
|
453
476
|
agent-view screenshot --crop "Active bookings" --crop-up 1 # Crop the card, not its heading
|
|
454
477
|
```
|
|
455
478
|
|
|
456
|
-
`--scale` accepts a factor in `(0, 1]
|
|
479
|
+
`--scale` accepts a factor in `(0, 1]`; recommended for agent loops where vision tokens dominate cost. Crop and scale run inside the server on a plain full-viewport capture: a CDP `clip` resizes the app's render view until the capture completes, and on a hidden or minimised window it never completes, leaving the app drawn in a corner.
|
|
457
480
|
|
|
458
481
|
`--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`.
|
|
459
482
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type PixelRect = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Crops an 8-bit RGB/RGBA PNG to `rect` (image pixels, clamped to the image)
|
|
9
|
+
* and downscales it by `scale` with an area average. Chromium can do both
|
|
10
|
+
* through `Page.captureScreenshot({ clip })`, but a clip resizes the render
|
|
11
|
+
* view for the capture and restores it only if the capture completes — a
|
|
12
|
+
* hidden window never completes it, so the app stays shrunk.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cropScalePng(png: Buffer, rect: PixelRect | undefined, scale: number): Buffer;
|
|
15
|
+
//# sourceMappingURL=png.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/cdp/png.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAM/E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CA6B5F"}
|
package/dist/cdp/png.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { deflateSync, inflateSync } from 'node:zlib';
|
|
2
|
+
const SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
3
|
+
/**
|
|
4
|
+
* Crops an 8-bit RGB/RGBA PNG to `rect` (image pixels, clamped to the image)
|
|
5
|
+
* and downscales it by `scale` with an area average. Chromium can do both
|
|
6
|
+
* through `Page.captureScreenshot({ clip })`, but a clip resizes the render
|
|
7
|
+
* view for the capture and restores it only if the capture completes — a
|
|
8
|
+
* hidden window never completes it, so the app stays shrunk.
|
|
9
|
+
*/
|
|
10
|
+
export function cropScalePng(png, rect, scale) {
|
|
11
|
+
const src = decode(png);
|
|
12
|
+
const x0 = clamp(Math.round(rect?.x ?? 0), 0, src.width - 1);
|
|
13
|
+
const y0 = clamp(Math.round(rect?.y ?? 0), 0, src.height - 1);
|
|
14
|
+
const x1 = clamp(Math.round((rect?.x ?? 0) + (rect?.width ?? src.width)), x0 + 1, src.width);
|
|
15
|
+
const y1 = clamp(Math.round((rect?.y ?? 0) + (rect?.height ?? src.height)), y0 + 1, src.height);
|
|
16
|
+
const width = Math.max(1, Math.round((x1 - x0) * scale));
|
|
17
|
+
const height = Math.max(1, Math.round((y1 - y0) * scale));
|
|
18
|
+
const rgba = Buffer.alloc(width * height * 4);
|
|
19
|
+
for (let y = 0; y < height; y++) {
|
|
20
|
+
const sy0 = y0 + Math.floor((y * (y1 - y0)) / height);
|
|
21
|
+
const sy1 = Math.max(sy0 + 1, y0 + Math.floor(((y + 1) * (y1 - y0)) / height));
|
|
22
|
+
for (let x = 0; x < width; x++) {
|
|
23
|
+
const sx0 = x0 + Math.floor((x * (x1 - x0)) / width);
|
|
24
|
+
const sx1 = Math.max(sx0 + 1, x0 + Math.floor(((x + 1) * (x1 - x0)) / width));
|
|
25
|
+
const sum = [0, 0, 0, 0];
|
|
26
|
+
for (let sy = sy0; sy < sy1; sy++) {
|
|
27
|
+
for (let sx = sx0; sx < sx1; sx++) {
|
|
28
|
+
const i = (sy * src.width + sx) * 4;
|
|
29
|
+
for (let c = 0; c < 4; c++)
|
|
30
|
+
sum[c] += src.rgba[i + c];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const n = (sy1 - sy0) * (sx1 - sx0);
|
|
34
|
+
const o = (y * width + x) * 4;
|
|
35
|
+
for (let c = 0; c < 4; c++)
|
|
36
|
+
rgba[o + c] = Math.round(sum[c] / n);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return encode({ width, height, rgba });
|
|
40
|
+
}
|
|
41
|
+
function clamp(v, min, max) {
|
|
42
|
+
return Math.min(Math.max(v, min), max);
|
|
43
|
+
}
|
|
44
|
+
function decode(png) {
|
|
45
|
+
if (!png.subarray(0, 8).equals(SIGNATURE))
|
|
46
|
+
throw new Error('Not a PNG');
|
|
47
|
+
let width = 0;
|
|
48
|
+
let height = 0;
|
|
49
|
+
let channels = 0;
|
|
50
|
+
const idat = [];
|
|
51
|
+
for (let off = 8; off < png.length;) {
|
|
52
|
+
const len = png.readUInt32BE(off);
|
|
53
|
+
const type = png.toString('latin1', off + 4, off + 8);
|
|
54
|
+
const data = png.subarray(off + 8, off + 8 + len);
|
|
55
|
+
if (type === 'IHDR') {
|
|
56
|
+
width = data.readUInt32BE(0);
|
|
57
|
+
height = data.readUInt32BE(4);
|
|
58
|
+
const colorType = data[9];
|
|
59
|
+
if (data[8] !== 8 || (colorType !== 2 && colorType !== 6) || data[12] !== 0) {
|
|
60
|
+
throw new Error(`Unsupported PNG: bit depth ${data[8]}, color type ${colorType}, interlace ${data[12]}`);
|
|
61
|
+
}
|
|
62
|
+
channels = colorType === 6 ? 4 : 3;
|
|
63
|
+
}
|
|
64
|
+
else if (type === 'IDAT') {
|
|
65
|
+
idat.push(data);
|
|
66
|
+
}
|
|
67
|
+
else if (type === 'IEND') {
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
off += 12 + len;
|
|
71
|
+
}
|
|
72
|
+
const raw = inflateSync(Buffer.concat(idat));
|
|
73
|
+
const stride = width * channels;
|
|
74
|
+
const pixels = Buffer.alloc(stride * height);
|
|
75
|
+
for (let y = 0; y < height; y++) {
|
|
76
|
+
const filter = raw[y * (stride + 1)];
|
|
77
|
+
const line = raw.subarray(y * (stride + 1) + 1, (y + 1) * (stride + 1));
|
|
78
|
+
const row = y * stride;
|
|
79
|
+
for (let i = 0; i < stride; i++) {
|
|
80
|
+
const a = i >= channels ? pixels[row + i - channels] : 0;
|
|
81
|
+
const b = y > 0 ? pixels[row - stride + i] : 0;
|
|
82
|
+
const c = i >= channels && y > 0 ? pixels[row - stride + i - channels] : 0;
|
|
83
|
+
pixels[row + i] = (line[i] + unfilter(filter, a, b, c)) & 0xff;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (channels === 4)
|
|
87
|
+
return { width, height, rgba: pixels };
|
|
88
|
+
const rgba = Buffer.alloc(width * height * 4, 0xff);
|
|
89
|
+
for (let p = 0; p < width * height; p++)
|
|
90
|
+
pixels.copy(rgba, p * 4, p * 3, p * 3 + 3);
|
|
91
|
+
return { width, height, rgba };
|
|
92
|
+
}
|
|
93
|
+
function unfilter(filter, a, b, c) {
|
|
94
|
+
switch (filter) {
|
|
95
|
+
case 0: return 0;
|
|
96
|
+
case 1: return a;
|
|
97
|
+
case 2: return b;
|
|
98
|
+
case 3: return (a + b) >> 1;
|
|
99
|
+
case 4: {
|
|
100
|
+
const p = a + b - c;
|
|
101
|
+
const pa = Math.abs(p - a);
|
|
102
|
+
const pb = Math.abs(p - b);
|
|
103
|
+
const pc = Math.abs(p - c);
|
|
104
|
+
return pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
|
|
105
|
+
}
|
|
106
|
+
default: throw new Error(`Unknown PNG filter ${filter}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function encode({ width, height, rgba }) {
|
|
110
|
+
const stride = width * 4;
|
|
111
|
+
const raw = Buffer.alloc((stride + 1) * height);
|
|
112
|
+
for (let y = 0; y < height; y++) {
|
|
113
|
+
// Filter 1 (Sub) — flat UI areas become runs of zeros and deflate well.
|
|
114
|
+
raw[y * (stride + 1)] = 1;
|
|
115
|
+
for (let i = 0; i < stride; i++) {
|
|
116
|
+
const left = i >= 4 ? rgba[y * stride + i - 4] : 0;
|
|
117
|
+
raw[y * (stride + 1) + 1 + i] = (rgba[y * stride + i] - left) & 0xff;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const ihdr = Buffer.alloc(13);
|
|
121
|
+
ihdr.writeUInt32BE(width, 0);
|
|
122
|
+
ihdr.writeUInt32BE(height, 4);
|
|
123
|
+
ihdr[8] = 8;
|
|
124
|
+
ihdr[9] = 6;
|
|
125
|
+
return Buffer.concat([SIGNATURE, chunk('IHDR', ihdr), chunk('IDAT', deflateSync(raw)), chunk('IEND', Buffer.alloc(0))]);
|
|
126
|
+
}
|
|
127
|
+
function chunk(type, data) {
|
|
128
|
+
const head = Buffer.alloc(8);
|
|
129
|
+
head.writeUInt32BE(data.length, 0);
|
|
130
|
+
head.write(type, 4, 'latin1');
|
|
131
|
+
const crc = Buffer.alloc(4);
|
|
132
|
+
crc.writeUInt32BE(crc32(Buffer.concat([head.subarray(4), data])), 0);
|
|
133
|
+
return Buffer.concat([head, data, crc]);
|
|
134
|
+
}
|
|
135
|
+
const CRC_TABLE = Array.from({ length: 256 }, (_, n) => {
|
|
136
|
+
let c = n;
|
|
137
|
+
for (let k = 0; k < 8; k++)
|
|
138
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
139
|
+
return c >>> 0;
|
|
140
|
+
});
|
|
141
|
+
function crc32(buf) {
|
|
142
|
+
let c = 0xffffffff;
|
|
143
|
+
for (const byte of buf)
|
|
144
|
+
c = CRC_TABLE[(c ^ byte) & 0xff] ^ (c >>> 8);
|
|
145
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=png.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/cdp/png.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAMpD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,IAA2B,EAAE,KAAa;IAClF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IACvB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC5D,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC7D,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG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
|
@@ -3,6 +3,8 @@ import type { AxTreeCache } from './ax-cache.js';
|
|
|
3
3
|
export declare class CDPTimeoutError extends Error {
|
|
4
4
|
constructor(message: string);
|
|
5
5
|
}
|
|
6
|
+
/** The socket died under a call — typically the window reloaded (login, logout). A fresh session works. */
|
|
7
|
+
export declare const isDeadSocket: (err: unknown) => boolean;
|
|
6
8
|
export declare function listTargets(port: number): Promise<CDPTarget[]>;
|
|
7
9
|
export declare function listSupportedTargets(port: number): Promise<TargetInfo[]>;
|
|
8
10
|
export declare function connectToRuntime(port: number, target: TargetInfo): Promise<RuntimeSession>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/cdp/transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAaL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/cdp/transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAaL,KAAK,SAAS,EAKd,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAkBjB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AA6BhD,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,2GAA2G;AAC3G,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,KAAG,OAC2C,CAAA;AA8CvF,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAkBpE;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAQ9E;AAi0BD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CA+BhG;AAMD,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,WAAW,CAAC,CAqftB"}
|