Skip to content

stagehand-python@4.2.0a0.dev1543

@supremeboxlogos supremeboxlogos tagged this 27 Sep 22:34
# why

Expose PDF rendering through the existing Stagehand SDK conventions
after the internal extension implementation is in place.

This is **PR2 of 2**, stacked directly on #3034
(`amel/pdf-render-extension`). Merge the parent first and follow the
repository's stacked-PR handoff rules when moving this PR to `main`.

# what changed

- Register the `page.pdf` protocol operation and connect the extension
router, controller, and runtime to the internal implementation from
#3034. Replace its temporary native-CDP signature with the canonical
protocol types.
- Add TypeScript and Python `page.pdf()` and Go `Page.PDF()`, returning
PDF bytes. TypeScript and Python optionally write a local file using
their existing screenshot conventions.
- Add typed print options and matching SDK response deadlines: 30
seconds for capture by default, with `timeout: 0` disabling the
deadline. Preserve error causes and include computed timeout durations
in diagnostics.
- Regenerate the protocol document, Python and Go models, and the final
embedded extension ZIP. Keep the public API documentation and release
changeset with the SDK exposure.
- Add wire/tracing, SDK, file-output, and local Chrome integration
coverage. Fix integration-test discovery and validate its mapping
against repository files.

The capture implementation and recovery tests are reviewed in #3034, not
repeated in this diff. The complete stack's Git tree is identical to the
previously reviewed implementation at `2b416e172`; this split changes
review boundaries, not behavior.

# test plan

- Complete-stack local Chromium PDF and screenshot integration: **9
passed**. Verify PDF bytes and file equality, page count, CSS
dimensions, tags, page ranges, and captures after a rejected print.
- Extension, TypeScript SDK, protocol, reference documentation, SDK
parity, and integration discovery: **989 passed** across 102 files (10
existing TODOs).
- `pnpm check`: **36 tasks passed**. Generated Go extension matches the
final extension build; `git diff --check` passes.
- The identical final tree was also verified with **235 Python tests**,
Ruff/type checks, Go SDK tests, `go vet`, and generated-artifact checks.
- Parent #3034 was independently verified with **975 regressions**, **7
screenshot integration tests**, all **36 repository checks**, and
Go/Python generated-artifact checks.
Assets 2
Loading