[INFRA-012] SSE endpoint for CLI consumers #174

Closed
opened 2026-02-01 07:25:31 +00:00 by jason.woltje · 0 comments
Owner

Summary

Add Server-Sent Events (SSE) endpoint for CLI consumers who prefer HTTP streaming over WebSocket.

Endpoint

GET /runner-jobs/:jobId/events/stream

Response Format

event: step.started
data: {"stepId": "uuid", "name": "Running tests", "phase": "validation"}

event: step.output
data: {"stepId": "uuid", "chunk": "Test suite passed: 42/42"}

event: step.completed
data: {"stepId": "uuid", "status": "completed", "duration_ms": 1234}

Tasks

  • Create SSE endpoint in runner-jobs controller
  • Implement event stream from Valkey Pub/Sub
  • Add keep-alive pings
  • Handle connection cleanup
  • Add authentication

Files to Modify

  • apps/api/src/runner-jobs/runner-jobs.controller.ts

Acceptance Criteria

  • curl can stream events
  • Events match WebSocket format
  • Keep-alive prevents timeout
  • Auth token required
## Summary Add Server-Sent Events (SSE) endpoint for CLI consumers who prefer HTTP streaming over WebSocket. ## Endpoint GET /runner-jobs/:jobId/events/stream ## Response Format ``` event: step.started data: {"stepId": "uuid", "name": "Running tests", "phase": "validation"} event: step.output data: {"stepId": "uuid", "chunk": "Test suite passed: 42/42"} event: step.completed data: {"stepId": "uuid", "status": "completed", "duration_ms": 1234} ``` ## Tasks - [ ] Create SSE endpoint in runner-jobs controller - [ ] Implement event stream from Valkey Pub/Sub - [ ] Add keep-alive pings - [ ] Handle connection cleanup - [ ] Add authentication ## Files to Modify - apps/api/src/runner-jobs/runner-jobs.controller.ts ## Acceptance Criteria - curl can stream events - Events match WebSocket format - Keep-alive prevents timeout - Auth token required ## Related - Epic: #162 - Depends on: #169 (job events)
jason.woltje added this to the M4.2-Infrastructure (0.0.4) milestone 2026-02-01 07:25:31 +00:00
jason.woltje added the apiapiphase-4p1 labels 2026-02-01 07:25:31 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#174