Expand description
§plumb-cdp
Chromium DevTools Protocol driver for Plumb.
This crate owns every interaction with the browser. It is the only
Plumb crate where unsafe is permitted — and only for FFI-adjacent
hot spots, each with an explicit // SAFETY: comment. The walking
skeleton doesn’t yet use unsafe; the override exists to preempt
future friction when snapshot conversion lands.
§Supported Chromium versions
Plumb accepts Chromium major versions in the inclusive range
MIN_SUPPORTED_CHROMIUM_MAJOR..=MAX_SUPPORTED_CHROMIUM_MAJOR.
The lower bound is the oldest major Plumb has validated against; the
upper bound is the newest major tested up to. Both are public so
callers can introspect the accepted range. Constraining the browser
to a known range is part of Plumb’s determinism guarantee
(docs/local/prd.md §9, §16) — DOMSnapshot output stability is
re-verified whenever the upper bound moves.
§Behavior
ChromiumDriver::snapshot_all launches Chromium exactly once,
validates Browser::version,
and then loops over the requested targets — for each it opens a
fresh page, applies the per-target viewport via CDP
Emulation.setDeviceMetricsOverride, navigates to the URL, and
calls DOMSnapshot.captureSnapshot with the
COMPUTED_STYLE_WHITELIST from PRD §10.3. Each CDP response is
flattened into a PlumbSnapshot with deterministic ordering
(nodes sorted by dom_order, computed styles inserted in
whitelist order). ChromiumDriver::snapshot is a thin wrapper
over snapshot_all for callers that only want a single target.
The plumb-fake:// URL scheme in plumb-cli is handled by
FakeDriver from this crate’s test-fake wiring.
PersistentBrowser is the long-lived counterpart for callers
that lint many URLs in one process (the MCP server). It launches
Chromium once, validates the version, and gives each
PersistentBrowser::snapshot call a fresh incognito
BrowserContext so cookies and localStorage from call N do not
leak into call N+1.
Modules§
- chrome_
path - Plumb-side Chromium path discovery.
- fetcher
- Opt-in Chromium auto-fetch.
Structs§
- Chromium
Driver - Real Chromium-backed driver.
- Chromium
Options - Configuration for
ChromiumDriver. - Cookie
- A cookie to install before navigation.
- Fake
Driver - Deterministic fake driver. Recognizes
plumb-fake://helloand returnsPlumbSnapshot::canned. Used by the walking-skeleton CLI and by downstream tests. - Persistent
Browser - A persistent Chromium browser kept warm across multiple snapshots.
- Storage
State - Playwright
storage-state.jsonrepresentation. - Storage
State Cookie - One cookie entry in a Playwright
storage-state.json. - Storage
State Local Storage Entry - One
localStorage[]entry in a Playwrightstorage-state.json. - Storage
State Origin - One
origins[]entry in a Playwrightstorage-state.json. - Target
- A snapshot target: URL + viewport + per-target capture knobs.
Enums§
- CdpError
- Errors returned by drivers.
Constants§
- COMPUTED_
STYLE_ WHITELIST - CSS property whitelist passed to
DOMSnapshot.captureSnapshotas thecomputedStylesargument. - MAX_
SUPPORTED_ CHROMIUM_ MAJOR - Highest Chromium major version Plumb has tested up to. Booting a Chromium binary with a larger major refuses to run; bump this constant after running the e2e suite against the new major.
- MIN_
SUPPORTED_ CHROMIUM_ MAJOR - Lowest Chromium major version Plumb has validated against. Booting a Chromium binary with a smaller major refuses to run.
Traits§
- Browser
Driver - Async trait for browser drivers. Implementations are expected to be cheap to construct and expensive per-call.
Functions§
- is_
fake_ url - Whether a URL belongs to the fake-driver scheme.
- parse_
header_ kv - Parse and validate an HTTP header
name: valuetoken. - validate_
safe_ path - Public CLI-facing wrapper around
canonicalize_safe_path.