Send a single SSE event.
(event_type: str, payload)
| 385 | self.end_headers() |
| 386 | |
| 387 | def emit(event_type: str, payload): |
| 388 | """Send a single SSE event.""" |
| 389 | try: |
| 390 | data_str = json.dumps({"type": event_type, "data": payload}) |
| 391 | self.wfile.write(f"data: {data_str}\n\n".encode('utf-8')) |
| 392 | self.wfile.flush() |
| 393 | except BrokenPipeError: |
| 394 | # Client disconnected |
| 395 | raise |
| 396 | |
| 397 | # Run the agent synchronously, emitting checkpoints |
| 398 | try: |