feat: Antigravity 和 Codex 服务支持

- 新增 Antigravity 服务:签名缓存、URL 可用性检测、信封处理
- 新增 Codex 服务:信封处理、元数据收集器
- 重构 provider transport 支持新的服务架构
- 新增 stream_bridge 和 upstream_stream_bridge 处理流式响应
- 优化 OAuth 工具函数
- 添加相关测试用例
This commit is contained in:
fawney19
2026-02-05 15:57:52 +08:00
parent ed2ff5c1d7
commit 440721368f
44 changed files with 3498 additions and 134 deletions

View File

@@ -1,6 +1,9 @@
from __future__ import annotations
from src.services.provider.codex import maybe_patch_request_for_codex, patch_openai_cli_request_for_codex
from src.services.provider.codex import (
maybe_patch_request_for_codex,
patch_openai_cli_request_for_codex,
)
def test_patch_openai_cli_request_for_codex_sets_store_and_instructions() -> None:
@@ -101,3 +104,13 @@ def test_maybe_patch_request_for_codex_patches_for_codex_openai_cli() -> None:
assert out["store"] is False
assert "instructions" in out
def test_codex_envelope_extra_headers_includes_sse_accept_and_session() -> None:
from src.services.codex.envelope import codex_oauth_envelope
headers = codex_oauth_envelope.extra_headers() or {}
assert headers.get("Accept") == "text/event-stream"
assert headers.get("x-oai-web-search-eligible") == "true"
assert headers.get("originator") == "codex_cli_rs"
assert isinstance(headers.get("session_id"), str)
assert headers.get("session_id")