# agent-view **DevTools for AI agents. Electron, Tauri, Chromium.**
Your agent sees the DOM, state, console and network of a running app, and clicks through it like a user. [![npm](https://img.shields.io/npm/v/@petukhovart/agent-view?label=npm&color=7aa2e0)](https://www.npmjs.com/package/@petukhovart/agent-view) [![CI](https://github.com/PetukhovArt/agent-view/actions/workflows/ci.yml/badge.svg)](https://github.com/PetukhovArt/agent-view/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-66c29a)](LICENSE)
Agents read your code and your tests. They can't see whether the button is disabled, whether the modal opened or whether the store mutated. agent-view is one CLI that answers those questions over Chrome DevTools Protocol, for any agent that can run a shell command. ## Why agent-view - **Real input, iframes included.** `click`, `fill`, `key`, `drag` and `hover` fire CDP input events, so Vue `v-model`, React controlled inputs and native fields accept the value, inside same-process iframes too. - **Compact output.** `dom` prints the accessibility tree with `[ref=N]` handles and test ids; `--compact`, `--diff` and `--count` keep it 40–60% smaller, `screenshot --crop --scale` does the same for images. - **Workers, windows, background.** Console, network and state reach shared, service and dedicated workers; `--window` addresses settings, tray and detached windows; the app stays behind other windows and never takes focus. - **Answers, not screenshots.** `network` records from page load on, WebSocket and SSE frames included; `logs` keeps a console feed that survives reloads; `watch` prints JSON-patches of any expression, `coverage` tells whether an action reached a function, `heap` diffs snapshots down to the detached DOM and its retainers. - **WebGL scenes.** `scene` reads the scene graph of PixiJS, CesiumJS or any engine through a hook the app sets; on CesiumJS and the hook `click --scene` clicks an object in it. - **Replayable and fast.** `act` saves a path through the app and replays it in seconds without a model; a lazy daemon keeps one CDP socket: `dom → click → dom` in about 17 ms. Running arbitrary JS (`allowEval`) and keeping response bodies (`captureBody`) stay off until the project turns them on. ## Quick start ```bash npm install -g @petukhovart/agent-view agent-view init # writes agent-view.config.json: runtime, CDP port, launch command agent-view launch # starts the app and waits for CDP agent-view dom --filter "Submit" # accessibility tree with [ref=N] handles agent-view click 12 # a ref from the dom output ``` The app has to open a CDP port matching `port` in the config:
Electron: top of main.ts, before app.whenReady() ```js import { app } from 'electron'; if (!app.isPackaged) { app.commandLine.appendSwitch('remote-debugging-port', '9876'); } ```
Tauri 2 (WebView2, Windows only) ```json { "scripts": { "dev": "cross-env WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9876 tauri dev" } } ``` On macOS and Linux Tauri embeds WebKit, which has no CDP.
Chromium ```bash chromium --remote-debugging-port=9876 ```
## Agents Any agent that runs shell commands can call the CLI. The `verify` skill teaches it the cheap-checks-first workflow ([workflow](docs/workflow.md)); install it once per agent:
Claude Code: the skill and the act-decider agent ```bash claude plugin marketplace add PetukhovArt/agent-view claude plugin install agent-view@agent-view ```
Codex ```bash codex plugin marketplace add PetukhovArt/agent-view codex plugin add agent-view@agent-view ```
Cursor, OpenCode, Grok and other agents ```bash npx skills@latest add PetukhovArt/agent-view -a # cursor, opencode, ...; omit -a to choose ```
Then describe what must be true: ```text Verify: after clicking Save, the button stays disabled until the request completes. No console errors. ```
Commands | Command | What it gives the agent | |---|---| | `dom` | Accessibility tree with `[ref=N]` handles and test ids; `--filter`, `--compact`, `--count`, `--diff` | | `click` / `hover` / `fill` / `key` / `drag` | Real CDP input; address by ref, `--testid` or `--selector` | | `screenshot` | PNG, `--scale` or `--crop `, `--out ` | | `emulate` | Viewport size, pixel ratio, color scheme, coarse pointer, reduced motion | | `audit` | Layout findings (offscreen, clipped, text-clip, overlap, target-size, contrast), `--shot` draws them, `--scene` audits a canvas scene; exit 1 on an error | | `eval` / `watch` | Read JS state; stream JSON-patch diffs of an expression (needs `allowEval`) | | `console` / `logs` | Console of pages and workers; a durable file feed that survives reloads | | `network` | Requests, headers, timing, bodies, WebSocket and SSE frames, from page load on | | `coverage` / `listeners` | Which functions ran; handlers on a node with their `file:line` | | `heap` | Snapshot diff by class, detached DOM, retainers | | `act` | Step protocol: reach a screen, save the path, replay it | | `upload` / `dialog` / `wait` | File inputs, JS modals and file pickers, waiting for an element | | `scene` / `snap` | WebGL scene graph (PixiJS, CesiumJS, any engine through a hook); DOM + scene in one call | | `discover` / `targets` / `launch` / `init` / `stop` | Windows, targets and lifecycle | Every flag: [commands](docs/commands.md).
## Docs [Commands](docs/commands.md) · [Configuration and CDP](docs/configuration.md) · [Workflow](docs/workflow.md) · [How it works](docs/architecture.md) · [Troubleshooting](docs/troubleshooting.md) · [Changelog](CHANGELOG.md) MIT © Artem Petukhov