mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 16:56:16 +08:00
5a61f01cfc
Phase 4: polish the four remaining edge cases uncovered by Phase 1-3. Custom headers passthrough - check_claude_stream and check_gemini_stream now accept an optional extra_headers map which is appended after all built-in headers so it can override defaults (e.g. a custom User-Agent). - OpenClaw reads from settings_config.headers. - OpenCode reads from settings_config.options.headers. - All pre-existing Claude/Codex/Gemini call sites pass None. OpenClaw custom auth header (Longcat-style) - When settings_config.authHeader is true, the provider expects a custom auth header whose name is only known to the OpenClaw gateway itself. Return a dedicated openclaw_auth_header_not_supported error so the user sees a meaningful explanation instead of a 401. Bedrock error polish - The bedrock-converse-stream (OpenClaw) and @ai-sdk/amazon-bedrock (OpenCode) branches now explain why (SigV4 signing) and point to the official consoles as an alternative test path. OpenCode baseURL fallback - resolve_opencode_base_url: when options.baseURL is empty and the npm package has a canonical default endpoint (@ai-sdk/openai, @ai-sdk/anthropic, @ai-sdk/google), fall back to that endpoint. @ai-sdk/openai-compatible still requires an explicit baseURL because its whole purpose is to point at a custom OpenAI clone. Tests - 8 new unit tests covering authHeader detection, baseURL resolution (explicit / fallback / error), and header map extraction on both apps. Total stream_check tests: 18 → 26.