Skip to content

Implement terminal streaming with diff algorithm #75

@2witstudios

Description

@2witstudios

Epic 4: WebSocket & Real-Time Push — Issue 3/3

Source: 3-agent worktree — best terminal diff algorithm (longest common suffix)

Description

Per-agent terminal output streaming over WebSocket with efficient diff algorithm that only sends new lines.

Acceptance Criteria

  • Per-agent subscriptions with lazy initialization
  • 500ms polling interval for tmux pane content
  • Longest common suffix diff algorithm — only sends new lines, not full buffer
  • Shared timer across clients watching the same agent (don't poll twice)
  • Auto-cleanup when subscriber count drops to 0
  • Error handling for dead/missing panes
  • Tests: diff algorithm, subscription lifecycle, shared timer, cleanup

Dependencies

Files to Create/Modify

  • src/server/ws/terminal.ts (new)
  • src/server/ws/terminal.test.ts (new)

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:websocketEpic 4: WebSocket & Real-Time PushmobilePPG Mobile project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions