Add AsyncAPI schema for stream server WebSocket protocol#997
Open
bilby91 wants to merge 2 commits intovercel-labs:mainfrom
Open
Add AsyncAPI schema for stream server WebSocket protocol#997bilby91 wants to merge 2 commits intovercel-labs:mainfrom
bilby91 wants to merge 2 commits intovercel-labs:mainfrom
Conversation
Contributor
|
@bilby91 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Add a formal AsyncAPI 3.0 schema documenting the stream server's WebSocket protocol and replace inline json!() macros with typed serde structs derived from it. - Add schemas/stream-server.asyncapi.yaml with all 7 message types - Add stream_protocol.rs with Serialize/Deserialize structs and tests - Refactor stream.rs to use typed protocol structs - Update README to reference the schema Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Derive CommandMessage, ResultMessage, ConsoleMessage, PageErrorMessage, TabsMessage, and UrlMessage from the AsyncAPI spec. Replace all remaining ad-hoc json!() calls in stream.rs with the typed structs. Update the AsyncAPI schema with the new message types added in main (engine, recording, tabs, console, page_error, url, windowsVirtualKeyCode). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ba83e7e to
8ac65ec
Compare
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
schemas/stream-server.asyncapi.yaml) documenting all 7 stream server message typesstream_protocol.rswith typed serde structs derived from the schema, replacing inlinejson!()macros instream.rsCloses #995
Motivation
The stream server's WebSocket protocol is currently defined implicitly via inline
json!()macros scattered acrossstream.rs. This makes it hard for consumers building clients in other languages to depend on a stable contract, and means protocol changes aren't visible as schema diffs.What changed
schemas/stream-server.asyncapi.yaml— Single source of truth for the wire protocol. Covers server-to-client messages (frame, status, error) and client-to-server messages (input_mouse, input_keyboard, input_touch, status request). Validates clean with@asyncapi/cli.cli/src/native/stream_protocol.rs— Typed Rust structs with#[derive(Serialize)]/#[derive(Deserialize)]matching the schema. Includes aClientMessagetagged enum for deserialization dispatch. 8 unit tests verify wire format round-trips.cli/src/native/stream.rs— Refactored to use the typed structs. Alljson!()macros for stream protocol messages replaced. Remainingjson!()calls are CDP protocol commands (different protocol, unchanged).README.md— Streaming section now points to the schema for full details, with a compact inline example.Test plan
cargo test stream)cargo test e2e -- --ignored --test-threads=1)@asyncapi/cli validate