(req, res, params)
| 505 | * POST /annotations/:id/thread - Add a thread message. |
| 506 | */ |
| 507 | const addThreadHandler: RouteHandler = async (req, res, params) => { |
| 508 | try { |
| 509 | const body = await parseBody<{ role: "human" | "agent"; content: string }>(req); |
| 510 | |
| 511 | if (!body.role || !body.content) { |
| 512 | return sendError(res, 400, "role and content are required"); |
| 513 | } |
| 514 | |
| 515 | const annotation = addThreadMessage(params.id, body.role, body.content); |
| 516 | |
| 517 | if (!annotation) { |
| 518 | return sendError(res, 404, "Annotation not found"); |
| 519 | } |
| 520 | |
| 521 | sendJson(res, 201, annotation); |
| 522 | } catch (err) { |
| 523 | sendError(res, 400, (err as Error).message); |
| 524 | } |
| 525 | }; |
| 526 | |
| 527 | /** |
| 528 | * GET /sessions/:id/events - SSE stream of events for a session. |
nothing calls this directly
no test coverage detected
searching dependent graphs…