summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/INFRASTRUCTURE.md
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-01 03:37:41 -0500
committerBen Sima <ben@bensima.com>2025-12-01 03:37:41 -0500
commitf8eb55d38c5a7873133e01b0ecf7f07989f1f48b (patch)
tree80d3a85b93904f60f94782d56a8afc569f95ca11 /Biz/PodcastItLater/INFRASTRUCTURE.md
parentcf6fe60892144d4c9c4c3a01a192e2eaf4443a5c (diff)
Add SSE streaming endpoint for agent events
Perfect! The build passes with no errors. Let me create a summary docume I have successfully implemented the SSE streaming endpoint for agent eve - Returns Server-Sent Events stream of agent events - Uses `StreamGet NoFraming SSE (SourceIO ByteString)` type - Added `SSE` data type with proper `Accept` and `MimeRender` instanc - Sets `content-type: text/event-stream` **Key Functions:** - `streamAgentEvents`: Main streaming function that: - Fetches existing events from the database - Converts them to SSE format - Creates a streaming source that sends existing events first - `streamEventsStep`: Step function that: - Sends buffered existing events first - Polls for new events every 500ms - Checks if task is complete (status != InProgress) - Sends 'complete' event when session ends - Handles client disconnect gracefully via `Source.Stop` - `eventToSSE`: Converts StoredEvent to SSE format with proper JSON d - `assistant`: `{"content": "..."}` - `toolcall`: `{"tool": "tool_name", "args": {"data": "..."}}` - `toolresult`: `{"tool": "unknown", "success": true, "output": ".. - `cost`: `{"cost": "..."}` - `error`: `{"error": "..."}` - `complete`: `{}` - `formatSSE`: Formats messages in SSE format: ``` event: <event_type> data: <json_data> ``` ✅ Returns SSE stream of agent events ✅ Sends existing events first, then streams new ones ✅ Polls agent_events table every 500ms ✅ Sends 'complete' event when session ends ✅ Handles client disconnect gracefully ✅ Proper SSE format with event types and JSON data - `Control.Concurrent` for `threadDelay` - `Data.Aeson` for JSON encoding - `Servant.Types.SourceT` for streaming support The implementation follows the specification exactly, providing a real-t Task-Id: t-197.4
Diffstat (limited to 'Biz/PodcastItLater/INFRASTRUCTURE.md')
0 files changed, 0 insertions, 0 deletions