Skip to content

chore(agent-browser): drop redundant viewportWidth/Height status cast#171

Merged
nedtwigg merged 1 commit into
mainfrom
chore/agent-browser-drop-redundant-status-cast
Jun 29, 2026
Merged

chore(agent-browser): drop redundant viewportWidth/Height status cast#171
nedtwigg merged 1 commit into
mainfrom
chore/agent-browser-drop-redundant-status-cast

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

Surfaced by the nightly code-quality survey.

The status event payload in AgentBrowserPanel's connection subscription is already typed AgentBrowserStreamStatus (imported as StreamStatus), and that interface declares viewportWidth?: number and viewportHeight?: number (agent-browser-connection.ts#L27-L28). The status branch nonetheless re-cast event.status to StreamStatus & { viewportWidth?: number; viewportHeight?: number } before reading those fields — an intersection that adds nothing the base type doesn't already provide.

This reads the fields directly off event.status, dropping the cast and the intermediate maybeStatus local. Pure simplification — no behavior change; the typeof … === 'number' guards are unchanged.

No regression test: this is a type-level cleanup with no runtime behavior change, validated by the tsc -b step in CI.

The `status` event payload is already typed `AgentBrowserStreamStatus`
(aliased `StreamStatus`), which declares `viewportWidth?: number` and
`viewportHeight?: number` (agent-browser-connection.ts:27-28). The
intersection cast at the status branch added nothing, so read the fields
directly off `event.status`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9d010ce
Status: ✅  Deploy successful!
Preview URL: https://871a5449.mouseterm.pages.dev
Branch Preview URL: https://chore-agent-browser-drop-red.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 11c9039 into main Jun 29, 2026
7 checks passed
@nedtwigg nedtwigg deleted the chore/agent-browser-drop-redundant-status-cast branch June 29, 2026 18:32
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.

2 participants