Part of #1. Depends on #4, #9.
Goal
Translate the SSE event stream of upstream `/responses` (and the streamed `reasoning_content` chunks of upstream `/chat/completions`) into:
- OpenAI-shape SSE on `/v1/responses` (mostly straight passthrough)
- Anthropic-shape SSE on `/v1/messages` (`message_start` → `content_block_start` (thinking) → `thinking_delta` × N → `signature_delta` → `content_block_stop` → next content_block_start (text) → ...)
Background
Upstream Responses-API SSE events include:
- `response.created`, `response.in_progress`, `response.completed`, `response.failed`
- `response.output_item.added` / `.done`
- `response.content_part.added` / `.done`
- `response.output_text.delta` / `.done`
- `response.reasoning.delta` / `.done`
- `response.reasoning_summary_text.delta` / `.done`
- `response.function_call_arguments.delta` / `.done`
These need to map to Anthropic's:
- `message_start`, `content_block_start`, `content_block_delta` (with `text_delta` | `thinking_delta` | `signature_delta` | `input_json_delta`), `content_block_stop`, `message_delta`, `message_stop`, `ping`
Current state
`src/routes/messages/stream-translation.ts` only handles the chat-completions stream shape (single `choices[0].delta`). `thinking_delta` and `signature_delta` types exist in `anthropic-types.ts:145–146` but have no producer.
Tasks
Acceptance criteria
- `/v1/messages` streaming with `gpt-5.3-codex` shows incremental `thinking` text in Claude Code's UI
- Tool calls inside reasoning context preserve correct ordering (reasoning → tool_use → reasoning → text)
- Stream cancellation propagates upstream
File pointers
- `src/routes/messages/stream-translation.ts` (extend)
- New: `src/routes/responses/stream-translation.ts` (passthrough/normalization)
Part of #1. Depends on #4, #9.
Goal
Translate the SSE event stream of upstream `/responses` (and the streamed `reasoning_content` chunks of upstream `/chat/completions`) into:
Background
Upstream Responses-API SSE events include:
These need to map to Anthropic's:
Current state
`src/routes/messages/stream-translation.ts` only handles the chat-completions stream shape (single `choices[0].delta`). `thinking_delta` and `signature_delta` types exist in `anthropic-types.ts:145–146` but have no producer.
Tasks
Acceptance criteria
File pointers