Remove screenshot type from protocol results - #2754
Open
monadoid wants to merge 4 commits into
Open
Conversation
|
monadoid
marked this pull request as ready for review
August 17, 2026 13:50
Contributor
There was a problem hiding this comment.
No issues found across 11 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant SDK as SDK (TS/Python/Go)
participant Client as Protocol Client
participant Runtime as Stagehand Runtime
participant Browser as Browser
participant GoSDK as Go SDK
Note over SDK, Browser: CHANGED: Screenshot Result Shape (data only)
SDK->>Client: page.screenshot(options)
Note over SDK: options.type (png/jpeg) still sent as input
Client->>Runtime: RPC page.screenshot(ref, options)
Runtime->>Browser: page.screenshot(options)
Browser-->>Runtime: raw image bytes
Runtime->>Runtime: base64 encode bytes
Runtime-->>Client: CHANGED: { data: base64Image }
Client-->>SDK: CHANGED: result (data only)
alt SDK validates result type
SDK->>SDK: CHANGED: schema parse - Type field removed
Note over SDK: Rejects extra type field
end
Note over Runtime: CHANGED: Returns bytesToBase64 without type
Note over SDK: Callers determine format from request option or byte inspection
Note over GoSDK: CHANGED: Go model - PageScreenshotResultType removed
Note over GoSDK: CHANGED: Page.Screenshot() returns []byte (unchanged API)
Note over SDK, Browser: Failure path: malformed base64 data
Runtime-->>Client: { data: malformedString }
Client-->>SDK: parse error
SDK-->>SDK: return error to caller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Before:
page.screenshotreturned{ data, type }over RPC even though Chrome only returns the image data and every SDK’s screenshot API returns decoded bytes.data, while the existingtypeinput still selects PNG or JPEG.Before: generated Python and Go wire models included the unused result field.
Breaking change
PageScreenshotResult.Typeand the associated result-type constants from the Go SDK.Page.Screenshot(...) ([]byte, error)is unchanged.Summary by cubic
Removes the type field from
page.screenshotresults; results were { data, type }, now { data }. This tightens the protocol and removes unused SDK surface without changing request options or public screenshot APIs.typefromPageScreenshotResultinpackages/protocol/schemas.tsandpackages/protocol/stagehand.v4.json; tests now asserttypeis invalid.packages/extension/runtime.tsno longer returnstypein the screenshot result.typeand related enums frompackages/sdk-goand generated typing frompackages/sdk-python; updated tests and the embedded extension asset inpackages/sdk-go.page.screenshot.typeexemption inrules/ast-grep/sdk-field-pipeline.test.tsso result fields must be used or removed.Migration
result.typein all callers.options.type) or by inspecting decoded bytes.packages/sdk-goandpackages/sdk-python.Written for commit 678eacf. Summary will update on new commits.