Skip to content

Pilot ​

A session is a real browser that keeps running in the background, driven one JSON call at a time. It's how a coding agent works on your app: it reads the graph, picks Blocks you've already checked, and sees where each one landed and what the page shows. Pilot plans nothing itself; the agent does. Start with the guide: Agents and exploring.

auto, browser, pilot ​

CommandIs
waygraph autothe interactive picker (a panel in the browser, or --cli)
waygraph browser starta new session: visible by default (--headless for none), on about:blank (--goto <url>)
waygraph pilot startbrowser start, plus the whole project graph and where it is, in one reply

All three take the same session commands with the same id.

Lifecycle ​

bash
waygraph browser sessions [--json]       # what's live: check before opening another
waygraph pilot start                     # {"sessionId":"bb65d74c","socketPath":"...","headless":false,"graph":{...},"snapshot":{...}}
waygraph pilot attach <id>               # graph + snapshot for a session already running
waygraph browser attach <id>             # a terminal picker on it
waygraph browser stop <id>               # or --all

Commands ​

CommandDoes
status <id>the snapshot: where it is, the menu, what the page shows. No side effects
send <id> "<pick>" [--data '{...}']runs one Block (menu index or name), answers with the new snapshot
reach <id> <Checkpoint> [--data '{...}']finds the route and plays it, checking each step lands where its edge says
read <id> [path] [--where f=v] [--rows a:b]what the page shows (What a page shows)
dom <id> [--mode full] [--selector s] [--depth n]the accessibility tree (default, small), or a bounded DOM (truncated: true when cut)
trace <id>the last 500 Blocks run: name, Checkpoint before and after, their narration
console <id>console and network errors, and coverage gaps (below)
storage <id>localStorage, sessionStorage, service workers
highlight <id> "#x|Label|tone"paints rings on the page (or a JSON body)
resync <id>re-detects where it is from the real page
watch <id> · hello <id>the live feed · the protocol version and where it is

Mem in a session. A session fills each key a Block requires once, when it starts: from --data on pilot start / browser start (or WAYGRAPH_DATA), else from the key's mem stub. --data on a send or reach sets keys before that step, so you can switch users mid-session; a name no Block requires is refused, naming the keys there are. Every snapshot's mem says where each value came from - data (start), stub or step - never the value itself:

json
"mem": { "saucedemo.credentials": "stub", "saucedemo.selectedItem": "stub" }

A credential that says stub signed in as the mem stub's user, not the one you meant.

reach and rows. A step with one option per row (a Method with instanceOptions: add this item) runs when mem already says which row: --data, an earlier pick, or the key's mem stub. Otherwise reach stops there and says to pick one with send.

reach limits. A route through a Nav that's open from anywhere, whose page needs setup first (fields filled before a submit), can't be found safely: reach fails within a timeout instead of guessing.

resync. A session updates where it is only after its own actions. When a person clicks around in a visible session, run resync before the next pick.

Coverage gaps ​

A live session watches the page for things no Block covers yet, and says so once per element:

text
[waygraph] unmapped nav link on this page: /settings - no NavBlock covers this URL; add defineNavBlock
[waygraph] unmapped button on this page: #save-draft - no Method/NavClick Block selector matches; consider defineMethodBlock or defineNavClickBlock

console <id> returns them. waygraph check can't find these: there's no Block to scan.

Coverage: what waygraph knows on the page ​

In a visible session, the Coverage chip (bottom-left; waygraph pilot coverage <id> on|off does the same) outlines what waygraph knows on the page you are looking at, so someone who never reads the code can see what a flow can touch and what is missing:

  • green, labelled with its name and the page it belongs to (HomeSel.press · page-home): a selector some Block or page uses, a typed sel.* builder included (the session finds its elements through Playwright, since the page can't run Playwright's selector engines); hover the label for the file and line it is written at;
  • green, page /items/:id: a link to a page waygraph has (a page with a param covers every id);
  • orange, dashed, not registered: a link, button, field or tab nothing registers yet.

The chip counts both (Coverage 12 registered, 3 not) and keeps up as the page changes. It is the same list the console warns about (unmapped nav link, unmapped button), made visible.

A session also keeps what the page shows after every Block it runs and every resync on its trail, the way a run does, so mem.trail.latest(Page.read.x) works for checks and stubs in a free browser too. A page a person opened by its address (/items/7 on /items/:id) records its params on the trail (mem.trail.paramsOf("Item") is { id: "7" }), the way Page.go({ id }) would.

Registering what the outline says is missing ​

In a visible session, click an orange outline's tag, type a name and press Enter: the element's selector (its id, test hook, name, label or text) is written into the _sel.ts of the page the session is on, and the tag says saved HomeSel.saveDraft. The same from a terminal or an agent: waygraph pilot register <id> <PageCheckpoint> <name> "<selector>" writes it into that page's _sel.ts (HomeSel.saveDraft: "#save-draft") and answers with the file and name, so the next Block uses it by name and the outline turns green. It never overwrites: a name already there is an error. An agent or Waygraph Studio does the same over the session protocol ({ "op": "register", "page", "key", "selector" }).

On the page ​

A visible session shows a badge in the bottom-right corner (Waygraph Pilot - session <id> - <Checkpoint>); clicking it lists the menu. Bottom-left toasts say what's running: Running (Block): … or Running (no Block): … for raw click / type / goto. Both survive navigation.

The session protocol (for clients such as Waygraph Studio) ​

A live session (browser start, pilot start) is a process listening on a Unix socket. Requests and replies are newline-delimited JSON; the types are exported: SessionRequest, SessionResponse, SessionStreamMessage, SESSION_OPS (every op, once) and SESSION_PROTOCOL_VERSION (bumped when a shape changes; a new op or optional field does not bump it).

OpAnswers
hello{ protocol, waygraph, sessionId, here }. Cheap, never waits behind a running step
status, send, reach, resync, raw actionsthe snapshot: here, the menu, and read / missing where the page has a read
read, dom, trace, console, storagewhat the page / session shows, without changing anything
subscribekeeps the socket open: one line per run event (step:start, step:read, step:end, ...) and one { type: "snapshot" } after each change

In code: requestSession(projectDir, sessionId, { op: "status" }) for one request, and subscribeSession(projectDir, sessionId, (message) => ...) for the feed (returns close()). From a terminal: waygraph pilot hello <id> and waygraph pilot watch <id> (the feed, until Ctrl-C).

Requests run one at a time per session (a second waits for the first), except hello and subscribe.

Blind pilot: no Blocks yet ​

A session works on a project with no Blocks at all (here stays null). Four commands let an agent build the library as it goes:

bash
waygraph auto click <id> "<selector>"
waygraph auto type <id> "<selector>" "<text>"
waygraph auto goto <id> "<url>"
waygraph auto reload <id>                # loads Block files just written, keeps the page and mem

click / type / goto re-detect where the session is and return a snapshot; a selector that matches nothing is a failure naming it. waygraph writes no Blocks itself: the agent writes the .block.ts, _sel.ts and key files, then reload and send the new Block.

GotchaMeans
reload did nothingthe new file probably throws on import: run waygraph check to see the error
a Block in no flow is in the menuright: being an orphan only affects route finding

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed