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`
23 lines
556 B
Python
23 lines
556 B
Python
"""Errors and error envelopes for OpenAI Responses compatibility."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
class ResponsesConversionError(ValueError):
|
|
"""Raised when a Responses request cannot be converted deterministically."""
|
|
|
|
|
|
def openai_error_payload(*, message: str, error_type: str) -> dict[str, Any]:
|
|
"""Return an OpenAI-compatible error envelope."""
|
|
|
|
return {
|
|
"error": {
|
|
"message": message,
|
|
"type": error_type,
|
|
"param": None,
|
|
"code": None,
|
|
}
|
|
}
|