mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-07-03 14:05:26 +02:00
8d2e5b95f7
## Summary - Split monolithic `core/openai_responses/conversion.py` and `sse.py` into focused protocol modules (input, output, stream, tools, reasoning, events, etc.) behind an `OpenAIResponsesAdapter` facade. - Wire `ClaudeProxyService.create_response()` through the adapter instead of importing conversion helpers directly, tightening the API/import boundary. - Add Codex bridging for Responses `custom_tool_call` items and document the adapter architecture in `ARCHITECTURE.md`. ## Test plan - [x] `uv run pytest tests/core/openai_responses/ tests/api/test_openai_responses.py tests/cli/test_adapters.py tests/contracts/test_import_boundaries.py` - [x] Full CI via `.\scripts\ci.ps1`
38 lines
924 B
Python
38 lines
924 B
Python
"""Responses object and output item builders."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
def message_item(item_id: str, text: str, status: str) -> dict[str, Any]:
|
|
return {
|
|
"id": item_id,
|
|
"type": "message",
|
|
"status": status,
|
|
"role": "assistant",
|
|
"content": [{"type": "output_text", "text": text, "annotations": []}],
|
|
}
|
|
|
|
|
|
def reasoning_item(item_id: str, text: str, status: str) -> dict[str, Any]:
|
|
return {
|
|
"id": item_id,
|
|
"type": "reasoning",
|
|
"status": status,
|
|
"summary": [],
|
|
"content": [{"type": "reasoning_text", "text": text}],
|
|
}
|
|
|
|
|
|
def encrypted_reasoning_item(
|
|
item_id: str, encrypted_content: str, status: str
|
|
) -> dict[str, Any]:
|
|
return {
|
|
"id": item_id,
|
|
"type": "reasoning",
|
|
"status": status,
|
|
"summary": [],
|
|
"encrypted_content": encrypted_content,
|
|
}
|