Dashboard › opencode-lore › Distillation
d8316e98-4e55-4d79-b8b3-7482dff68fac["lore_tm_v1_8ZtEzR5rfYZadqZlgDjwLWodMRn8_t5W_uuAJSng8U4","lore_tm_v1_urBQHyeQTIYZVtzsrGdwTySM75pvzfApY_aEccfruBw"]
Date: Sep 16, 2026
packages/gateway/src/stream/openai-responses.ts documents the OpenAI Responses API SSE lifecycle as response.created → response.in_progress → response.output_item.added → repeated response.output_text.delta → response.output_item.done → response.function_call_arguments.delta → response.function_call_arguments.done → response.completed; it reuses parseSSEStream because the Anthropic and Responses APIs share the same SSE wire format.ResponsesAccState in packages/gateway/src/stream/openai-responses.ts:48-93 contains id, model, stopReason, usage, optional terminalEvent, optional terminalResponse, optional codexRateLimits, rawItems, strict identity indexes itemIndexById/callIndexById/effectiveToolIndexById, nextOutputIndex, lifecycle sets activeTextItems/activeToolItems/unboundTextItems/unboundToolItems/textDoneItems/refusalDoneItems/argumentDoneItems, and indexed items holding either text items (id, text, optional refusal, optional content) or tool-use items (id, callId, name, args).SUPPORTED_RESPONSES_OUTPUT_ITEM_TYPES at packages/gateway/src/stream/openai-responses.ts:95-127 contains, in order: 1. message, 2. function_call, 3. function_call_output, 4. reasoning, 5. item_reference, 6. web_search_call, 7. file_search_call, 8. computer_call, 9. computer_call_output, 10. computer_tool_call, 11. computer_tool_call_output, 12. code_interpreter_call, 13. image_generation_call, 14. local_shell_call, 15. local_shell_call_output, 16. shell_call, 17. shell_call_output, 18. mcp_call, 19. mcp_list_tools, 20. mcp_approval_request, 21. mcp_approval_response, 22. custom_tool_call, 23. custom_tool_call_output, 24. apply_patch_call, 25. apply_patch_call_output, 26. program, 27. program_output, 28. tool_search_call, 29. tool_search_output, 30. additional_tools, 31. compaction.OUTPUT_ITEM_STATUSES_BY_TYPE uses phases "added", "done", and "terminal": message and reasoning allow added=in_progress, done/terminal=completed|incomplete; function_call allows added=in_progress, done/terminal=completed|incomplete|failed; web_search_call allows added=in_progress|searching, done/terminal=completed|failed; file_search_call allows added=in_progress|searching, done/terminal=completed|incomplete|failed; tool_search_call, computer_call, computer_tool_call, local_shell_call, shell_call, and custom_tool_call allow added=in_progress, done/terminal=completed|incomplete; code_interpreter_call allows added=in_progress|interpreting, done/terminal=completed|incomplete|failed; image_generation_call allows added=in_progress|generating, done/terminal=completed|failed; mcp_call allows added=in_progress|calling, done/terminal=completed|incomplete|failed; apply_patch_call requires added=in_progress and done/terminal=completed; apply_patch_call_output allows completed|failed in all three phases.function_call_output, computer_call_output, computer_tool_call_output, local_shell_call_output, shell_call_output, custom_tool_call_output, program_output, and tool_search_output require status completed for added, done, and terminal phases.packages/gateway/src/stream/openai-responses.ts:678-679, final output text handling implements that policy with the comment // Replace accumulated text with the final version (more reliable) followed by item.text = text;.