Scripts had no way to see the cookie jar: document.cookie through
page.evaluate hides HttpOnly cookies, and the getCookies tool was kept
off the page object because script methods were exactly the recorded
tools.
Tool.isScriptable() now decides what a page carries: the recorded tools
plus getCookies, which stays out of recordings. Called from a script it
returns an array of cookie objects in the --cookie-jar shape; the MCP
and agent tool keep their text lines.
Each recorded tool now declares what its page method returns to a
script, and `zig build docs` renders it next to the call signature, so
the docs site no longer keeps a handwritten table of return values.
Pages register WebMCP tools through navigator.modelContext.registerTool,
but only CDP clients could see or run them. pageTools lists the current
page's tools and callPageTool runs one, so the agent, the MCP server and
scripts can use them too. A navigation result names the page's tools
when it has any.
callPageTool waits for the tool's promise, returns the text of an
MCP-style CallToolResult or JSON for any other value, and handles a
navigation the tool triggers the same way evaluate does. The CDP WebMCP
domain now shares the invoke path through ModelContext.Tool.invoke.
Review feedback: keep the description to what the model needs, drop the
driver_guidance mention, keep comments to the non-obvious why, report the
reason phrase from the response instead of deriving it, and fold the
single-tool downloading doc group into navigation.
An agent had no way to get a binary response out of the browser: in-page
fetch is CORS-blocked on cross-origin reads, and base64-ing a large body
through evaluate's result channel doesn't scale. download {url, path}
saves a response body to a file with the session's cookies.
The transfer is a frame-owned engine request (frame.newRequest +
submitSync), so it rides the same pipeline as a page load: redirects
followed, --http-proxy and TLS settings applied, --block-urls enforced
on every hop, cookies attached per hop from the session's jar, and
Set-Cookie from every response — redirect steps included — stored back.
The body is buffered and the file written only on a 2xx, so a failed
download leaves nothing behind; failures carry is_error with the HTTP
status.
The partial re-derived the call shape and got extract wrong: its script
form takes the schema alone (`Runtime.extractArgs`), not a `save` option.
`skill.writeSignature` already renders it, so both now call it.
`close` moves into a `Runtime.page_methods` table that `construct`
installs from and the partial renders, instead of a row keyed on goto.
`zig build docs` now also writes pandascript-builtins.mdx: the methods
`new Page()` installs (the recorded tools plus `close`), each with the
call shape the runtime marshals from `Schema.positionalFor` and the
schema's remaining fields, and the `console` methods with the stream
each writes to. The docs site's PandaScript reference has drifted from
the runtime twice; this lets it import the tables instead.
The docs' MCP tools page carried handwritten Sessions and Reading a
resource sections after the generated tables. Move that prose into the
generator and the registry so it sits next to what it describes:
- session_new, session_list and session_close say they need the HTTP
transport, which also tells the model why they fail over stdio.
- The MCP-only tools intro explains Mcp-Session-Id routing and the
default session.
- The Resources section notes which resources need a loaded page, shows
a resources/read request, and contrasts resources with tools.
The aligned listings in the extract description were plain indented text,
which the docs generator recognised with a heuristic written for this one
string. Fencing them in the description itself makes it markdown for both
the model and the docs, so writeText is a plain escape. Prose is no longer
split per line, which also stops a code span wrapped across lines (the save
prompt's `page.extract({...})`) from being escaped.
Read browser tool schemas from Schema.all() instead of re-parsing them,
format table rows through Anchor/Cell formatters, share one flag writer
between traits and hints, and use mcp/tools.zig's browser_tool_list
directly. Group headings move next to the generator, and an addGenerator
helper in build.zig drives both the skills and docs steps.
Render MDX partials for the docs site from the registries the runtime
serves, so the browser tools, MCP tools and agent REPL command references
can't drift from the code:
- browser-tools.mdx: every tool, grouped, with its description, an
argument table from its input schema, and its script/navigation/page
state traits.
- mcp-tools.mdx: titles and annotation hints per tool, linking to the
browser tools reference, plus the MCP-only tools and resources.
- agent-commands.mdx: meta, LLM and browser slash commands in the syntax
the REPL parses.
Tool.group() assigns each tool its docs section as an exhaustive switch,
so a new tool can't ship undocumented. The release workflow attaches the
partials to each release as lightpanda-docs.tar.gz for the docs repo to
pull.