Skip to content

API: a Bot's screen viewer can say how large it draws the screen - #2150

Merged
davidmckayv merged 1 commit into
mainfrom
sharp-screen-spec
Nov 24, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
sharp-screen-spec

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

A Bot's screen looks soft on a high-resolution display: the computer sends frames at the screen's own 1280 by 800 pixels, and a Retina display draws the view at twice that or more, so text is upscaled.

This adds what a viewer needs to ask for frames at the size it actually draws them:

  • ScreenHello.viewSize (optional boolean): the server says it takes a view size.
  • ScreenViewSize ({"type":"view-size","width","height"}), a new message on the screen socket: how large the viewer draws the screen, in its own device pixels (its size on the page times the display's pixel ratio). Sent only after hello says viewSize, and again when the size changes. A viewer that only watches may send it too.
  • Wording on ScreenFrame: the picture can have more pixels than width and height, which stay the screen's own size that mouse positions are measured in.

Additive only. A viewer that never sends view-size, and a server that never says viewSize, behave exactly as today, and clicks keep the same coordinates.

Checks: bun run api:lint clean, bun run api:live:diff against main says no change breaks a client, bun run api:generate changes nothing else (the REST spec is untouched).

Adds an optional viewSize flag to the screen socket's hello and a view-size message the viewer sends back, so frames can come at the size the viewer draws them in its own device pixels (sharp on a high-resolution display) and no larger. Additive only: a viewer that never sends view-size, and a server that never says viewSize, behave as today.
@davidmckayv
davidmckayv merged commit 2f263c9 into main Nov 24, 2026
23 checks passed
@davidmckayv
davidmckayv deleted the sharp-screen-spec branch November 24, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant