rouse-context/core
Jason Monk a4116532f7 SSE response support and auto-recreate unknown sessions
Two fixes that together restore claude.ai connector functionality
through Anthropic's Streamable HTTP proxy:

1. Respect the client's Accept header. The proxy sends
   `Accept: application/json, text/event-stream` and rejects plain
   JSON responses as "Invalid content from server" because it expects
   the SSE form. When the client accepts text/event-stream, wrap the
   JSON-RPC response as `event: message\ndata: <json>\n\n` and respond
   with Content-Type: text/event-stream.

2. Auto-recreate sessions for unknown session IDs. When the device
   restarts (process kill, app reinstall, idle eviction) the in-memory
   sessions map is empty, but the proxy / client still holds the old
   session ID and sends tools/call without re-initializing. Returning
   404 surfaces "Invalid content from server" through the proxy.
   Instead, recreate the session under the requested id and bind it to
   the caller's clientId. Security is unchanged: the caller's OAuth
   token is what gates access, and the SDK Server starts fresh — there
   is no leftover state from the previous session.

Tests for the previous "unknown session = 404" behaviour are updated
to assert the auto-recreate behaviour, including matching session id
echo on the response.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 10:01:30 -04:00
..
bridge Fix #248: Add Kover coverage measurement + CI aggregated report (#254) 2026-04-18 17:11:09 -04:00
mcp SSE response support and auto-recreate unknown sessions 2026-05-04 10:01:30 -04:00
testfixtures Fix #377: Replace 500ms session-registration sleep with deterministic Notify signal (#399) 2026-04-24 23:39:09 -04:00
tunnel Remove GET /mcp SSE handler; keep server alive across idle timeout 2026-05-04 08:23:27 -04:00