Skip to content

feat: add browser streaming proxy routes#25

Merged
fg-nava merged 5 commits intolabs-aspfrom
feat/browser-streaming-routes
Oct 14, 2025
Merged

feat: add browser streaming proxy routes#25
fg-nava merged 5 commits intolabs-aspfrom
feat/browser-streaming-routes

Conversation

@fg-nava
Copy link
Copy Markdown
Collaborator

@fg-nava fg-nava commented Oct 9, 2025

Ticket

Adds browser streaming proxy infrastructure and improves fullscreen user control mode

Changes

Added three new API routes to support browser streaming in production:

  • /api/browser-ws-config - provides runtime WebSocket proxy configuration
  • /api/browser-stream-proxy - secure WebSocket proxy that bridges wss:// client connections to ws:// backend (solves mixed content blocking in HTTPS deployments)
  • /api/mastra-proxy - server-side proxy for Mastra backend to handle CORS and enable runtime URL configuration

Enhanced the browser artifact fullscreen mode with a global Escape key listener that exits user control mode when pressed, merged with upstream cleanup improvements that now properly check WebSocket state before disconnecting.

Testing

Tested manually in dev environment:

  • Browser streaming connects successfully through proxy routes
  • Fullscreen mode activates when taking control
  • Pressing Escape exits fullscreen and returns control to agent
  • WebSocket cleanup no longer throws errors when connection is already closed
  • Mastra proxy forwards requests correctly to backend

Context for reviewers

The proxy routes solve two key production issues: browsers block insecure WebSocket connections (ws://) from HTTPS pages, and Next.js build-time env vars can't be changed at runtime for different environments. The server-side proxies handle both. The keyboard handler was added to improve UX in fullscreen mode but had a merge conflict with upstream cleanup improvements - both changes are now included.

@fg-nava fg-nava changed the title feat: add browser streaming proxy routes and enhance fullscreen controls feat: add browser streaming proxy routes Oct 9, 2025
@fg-nava fg-nava marked this pull request as ready for review October 14, 2025 16:25
@fg-nava fg-nava requested a review from KayTV October 14, 2025 16:26
KayTV
KayTV previously approved these changes Oct 14, 2025
Copy link
Copy Markdown
Collaborator

@KayTV KayTV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good to me!

Comment thread artifacts/browser/client.tsx Outdated

// Connect to the browser streaming WebSocket
const ws = new WebSocket(connectionInfo.url);
console.log('Connecting to browser stream:', wsUrl);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the console?

@fg-nava fg-nava merged commit 41701a7 into labs-asp Oct 14, 2025
@fg-nava fg-nava deleted the feat/browser-streaming-routes branch February 10, 2026 23:47
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