Skip to content

feat(listener): add dedicated stream websocket channel #2051

Open
4shub wants to merge 2 commits intomainfrom
shub/ws-two-channel-split
Open

feat(listener): add dedicated stream websocket channel #2051
4shub wants to merge 2 commits intomainfrom
shub/ws-two-channel-split

Conversation

@4shub
Copy link
Copy Markdown
Collaborator

@4shub 4shub commented May 1, 2026

Summary

  • add support for a dedicated listener stream websocket alongside the existing control websocket
  • route runtime/protocol emissions (stream_delta, device/loop status, queue updates, subagent state) over the stream socket
  • keep command and request/response handling on the control socket
  • fall back to legacy single-socket behavior unless registration advertises supportsSplitStatusChannels

Why

When streamed run output and control/filesystem responses share one socket, heavy streaming can delay or starve latency-sensitive device operations. Splitting those flows improves responsiveness without breaking older servers.

Main changes

  • listener runtime now tracks:
    • streamSocket
    • streamTransport
  • emitProtocolV2Message() prefers the stream transport for stream/runtime message types
  • listener client opens:
    • channel=control
    • channel=stream
      only when the server advertises support
  • old servers remain single-socket because registration defaults supportsSplitStatusChannels to false

Validation

  • targeted biome check passed
  • bun test src/tests/websocket/listen-register.test.ts passed

4shub and others added 2 commits May 1, 2026 14:48
Open a separate listener stream socket for runtime emissions and keep command responses on the control socket so streamed runs no longer block device request handling.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
Only enable the dedicated stream socket when registration advertises split-channel support so listeners remain compatible with older environment servers.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
@4shub 4shub changed the title Shub/ws two channel split feat(listener): add dedicated stream websocket channel May 1, 2026
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