Commit Graph

1137 Commits

Author SHA1 Message Date
hkfires
f3fd2f232d fix(signature): suppress routine Gemini bypass logs 2026-10-02 10:58:36 +08:00
Luis Pater
63c04b4bd4 feat(config): introduce client configuration section for codex settings
- Add `ClientConfig` and `CodexClientConfig` structs to `SDKConfig`
- Move `optimize-multi-agent-v2` and add `enable-apply-patch` under `client.codex`
2026-10-02 05:34:30 +08:00
Luis Pater
3ebee06516 fix(interactions): bridge apply_patch tool calls in responses translation
- Handle apply_patch custom tool call streaming deltas and snapshots for Responses API translation
- Track and resolve step indexes, function call identities, and error states across stream events
- Propagate apply_patch tool input errors and upstream failure states in stream and non-stream responses
2026-10-02 03:49:51 +08:00
ggbdpq
b467a83c0f fix(xai): bump pinned grok client version to 1.0.44 for chat-proxy
xAI raised the minimum accepted x-grok-client-version on
cli-chat-proxy.grok.com, so every xAI OAuth chat request through the CLI
chat-proxy failed with HTTP 426 ("Your Grok CLI version (0.2.120) is
outdated"). /v1/models is not gated, so discovery looked healthy while
inference was dead.

Bump the pin to the current stable Grok CLI version (1.0.44) and record
the observed server floor in the constant's comment. Both
x-grok-client-version and the derived User-Agent ship from this one
constant.

Regression tests lock three things: the pinned version meets the known
server floor (red against 0.2.120), the two identity headers stay
derived from the same constant, and the per-auth `header:*` custom
header override still wins over the pin - the documented operator
escape hatch when xAI ratchets the floor again.

Closes #6249

Generated-by: GLM-5.3-Flash (ZCode)
2026-10-01 06:14:37 +08:00
Luis Pater
97f244b8dd fix(codex): pass target executor to compatibility translation and token counting
- Pass target executor identity during Codex token counting and xAI request translation
- Skip tool integer normalization when target executor is Codex during compatibility translation
- Preserve number types in tool parameter schemas during token counting requests
2026-10-01 03:06:59 +08:00
Luis Pater
9e71c20d01 fix(codex): handle upstream stream disconnect before first payload as bad gateway
- Return Bad Gateway error when Codex upstream stream closes before emitting any payload
- Allow failover to subsequent credentials on premature stream disconnect before output
- Map HTTP 408 Request Timeout status to server_error in base error response handlers

Closes: #6247
2026-10-01 02:51:19 +08:00
Luis Pater
67cb32b6d3 fix(codex): determine tool integer normalization by target executor identity
- Base tool integer normalization checks strictly on target executor identity rather than protocol
- Add executor-aware translation helpers to pass target executor identity during request translation
- Ensure non-Codex executors normalize tool integer types for Codex clients regardless of protocol
2026-10-01 02:26:02 +08:00
Luis Pater
a8ffd5a843 fix(codex): skip tool parameter integer normalization for codex executor targets
- Skip normalizing tool parameter number types to integer when the target executor is Codex or Codex WebSocket
- Remove tool integer type normalization from schema cleanup in native Codex execution paths to preserve reserved tool schemas
- Apply tool integer type normalization only for non-Codex upstream targets with Codex client User-Agents

Closes: #6244
2026-10-01 02:04:49 +08:00
Luis Pater
82f8e92b21 fix(executor): support negotiated ALPN protocols in uTLS client
- Select HTTP/2 or HTTP/1.1 transport dynamically based on TLS ALPN negotiation
- Route empty ALPN and HTTP/1.1 requests through a dedicated non-pooled transport reusing the handshaken connection
- Ensure uTLS connections are cleanly closed upon response completion or request failure

Closes: #6223
2026-10-01 00:47:24 +08:00
Luis Pater
e5b5a1cfca fix(kimi): reorder interleaved tool outputs in responses input
- Defer intervening non-tool messages until all batch tool outputs are emitted to keep outputs contiguous
- Apply responses input normalization across standard and streaming executor execution paths

Closes: #6231
2026-09-30 23:39:28 +08:00
Luis Pater
71a5f1f6c5 fix(codex): normalize tool parameter number types to integer for codex clients
- Detect Codex client requests via User-Agent and convert target numeric parameters to integer types
- Support schemas across OpenAI functions, Claude input schema, Gemini declarations, and namespace tools
- Apply normalization during executor payload processing, multi-agent request translation, and WebSocket streaming

Closes: #6237
2026-09-30 22:27:18 +08:00
Luis Pater
f33f04d6c0 fix(codex): convert agent_message in compat mode without multi-agent optimization
- Enable multi-agent input rewriting when model compatibility mode is active, even if `optimize-multi-agent-v2` is disabled
- Ensure `agent_message` items are converted into portable user messages for third-party endpoints under API key configurations

Closes: #6233
2026-09-30 17:57:51 +08:00
Luis Pater
6004ebdfdb fix(claude): fail open on unmapped oauth mcp tool aliases
- Forward unmapped Claude OAuth MCP tool aliases unchanged instead of returning an error
- Log a warning when no request-local tool match is found to prevent stream termination

Closes: #6208
2026-09-30 12:04:58 +08:00
Luis Pater
f1697119f6 fix(interactions): handle failure events in response translators and stream executor
- Translate `response.failed` and `interaction.failed` events across Claude, Gemini, OpenAI Chat, and Responses formats
- Lazily emit `interaction.created` in Devin executor to allow clean HTTP error status propagation on immediate

Closes: #6204
2026-09-30 11:35:55 +08:00
Luis Pater
81756a57e3 fix(auth): track auto-refresh job epochs and bound credential acquisition
- Track auto-refresh jobs with registration epochs to prevent stale or phantom pending states
- Enforce bounded timeouts for Antigravity token refresh and project discovery
- Manage Antigravity credits refresh tasks with epoch validation and lifecycle cancellation

Closes: #6199
2026-09-30 06:57:24 +08:00
Luis Pater
b7f321f2a1 feat(api): support request path overrides and image protocols in model execution
- Add `Path` field to model execution requests and plugin interceptor responses
- Propagate custom request paths through execution metadata
- Allow image models during execution when entry or exit protocol is `openai-image`

Closes: #6196
2026-09-29 22:44:33 +08:00
Luis Pater
a0cc065d4d fix(claude): distinguish claude-sonnet-5-5 from sonnet-5 in model checks
- Add `isClaudeSonnet55Model` helper and prevent Sonnet 5 matching on Sonnet 5.5 prefixes
- Include Claude Sonnet 5.5 in progress display checks

Closes: #6193
2026-09-29 21:21:58 +08:00
Luis Pater
673e58d55c Merge pull request #6176 from router-for-me/home 2026-09-28 20:47:09 +08:00
hkfires
ac42accc88 fix(openai): use routed home model compatibility options 2026-09-28 20:40:10 +08:00
Luis Pater
e8156ec775 Merge pull request #6175 from magoz/fix/claude-oauth-tool-change-alias
fix(claude): remap MCP aliases in tool_addition/tool_removal blocks
2026-09-28 19:22:35 +08:00
hkfires
d3cd466ddb fix(codex): use resolved compat for multi-agent v2 2026-09-28 19:03:22 +08:00
hkfires
b9971ee3df feat(sdk): add Home credential capabilities and quota APIs
Use Home credential options as authoritative model capability
configuration for compat handling and prompt cache behavior.

Expose quota provider operations through the public plugin host API.
2026-09-28 19:03:21 +08:00
Luis Pater
59baf7314a feat(codex): extract and persist subscription plan type
- Extract `plan_type` from JWT claims and default missing values to `free`
- Include `plan_type` in token data, token storage, auth attributes, and file synthesis
- Ensure `plan_type` is maintained across token refresh flows
- Preserve empty map allocations during auth object cloning
2026-09-28 18:54:03 +08:00
magoz
958eeca719 fix(claude): remap MCP aliases in tool_addition/tool_removal blocks
- Rewrite `tool.name` of mid-conversation `tool_addition`/`tool_removal` blocks with a `tool_reference` to the same MCP alias as `tools[]`
- Rewrite `tool.definition.name` of inline `tool_definition` additions that redefine a declared custom tool
- Apply the same rewrite in the batched-edits and legacy remap paths
- Prevent upstream `references unknown tool` 400s for cloaked requests using mid-conversation tool changes

Closes: #6174
2026-09-28 10:12:12 +00:00
Luis Pater
48686ccc8f feat(config): preserve unknown nested fields as comments during v8 migration
- Traverse nested configuration paths to comment out unrecognized fields during v8 migration
- Remove deprecated Codex `identity-confuse` configuration option and request handling
- Clean up identity confuse mapping logic from Codex HTTP and WebSocket executors
2026-09-28 10:46:32 +08:00
Luis Pater
2c27e61fe7 fix(meta): strip unsupported search_content_types from web search tools
- Add `SanitizeMetaWebSearchTools` to remove `search_content_types` from `web_search` tool definitions
- Support sanitizing nested tools within `namespace` tool definitions
- Apply web search tool sanitization during Meta request preparation

Closes: #6156
2026-09-27 22:54:19 +08:00
Luis Pater
31f4cfab3f feat: migrate CLIProxyAPI to version 8 2026-09-27 14:42:26 +08:00
hkfires
d9922f0589 feat(config): add v8 configuration API
Introduce the v8 management configuration tree with migration-aware reads and
writes, grouped upstream API-key providers, and independent v8 operational
routes.

Preserve legacy configuration compatibility while ensuring successful v8 writes
migrate layouts, redact JSON TURN secrets, and keep OAuth-only provider
settings from affecting API-key credentials.
2026-09-27 14:16:27 +08:00
Luis Pater
6dea3dfa13 fix(antigravity): extract and apply reasoning summary config for OpenAI responses
- Use `ExtractSummaryConfig` to parse summary configuration from OpenAI response payloads
- Default to enabled auto summaries when reasoning effort is set without explicit summary visibility
- Apply the resolved summary configuration directly to Antigravity translations

Closes: #6143
2026-09-27 02:35:18 +08:00
Luis Pater
fc2c98d1ca feat(runtime): enhance Devin model aggregation and UID normalization
- Implement `splitDevinUID` for consistent UID splitting and effort extraction.
- Update model aggregation to handle thinking levels and merge variants.
- Refine display name cleaning logic to remove redundant suffixes.
- Adjust Devin catalog integration to exclude exposed thinking variants.
- Normalize and sort thinking levels with an extended rank scheme.

Closes: #6141
2026-09-27 02:03:55 +08:00
Luis Pater
3b2882b72e fix(codex): strip non-standard multi-agent metadata for compat models
- Pass compat mode flag to multi-agent v2 input rewriting
- Proactively remove `author`, `recipient`, and internal passthrough metadata for compat models
- Allow stripping non-standard metadata even when multi-agent v2 optimization is disabled

Closes: #6136
2026-09-26 22:51:47 +08:00
Luis Pater
ed980be34b fix(auth): preserve resolved model capabilities and configuration update support
- Attach resolved execution model info during execution and token counting even when restoring execution models
- Propagate configuration update support to resolved Home dispatch model info
- Track modifications to configuration updates across plugin normalizers in the translation pipeline
- Mark configuration update support for eligible Codex models in the registry
2026-09-26 13:57:06 +08:00
Luis Pater
4332048dda fix(claude): apply cloaking by default for direct Messages OAuth requests
- Remove direct Messages passthrough bypass for unconfirmed OAuth credentials
- Ensure standard cache control handling and CLI fingerprinting apply upstream
- Support detection for Claude Code 2.1.280 title helper payload shape

Closes: #6120
2026-09-25 12:38:18 +08:00
Luis Pater
9bdde54b59 fix(meta): fix client id header and preserve subscription metadata
- Fix malformed `X-Client-Id` header and ensure it is applied to upstream requests
- Preserve subscription metadata during OAuth token creation and token refreshes
- Support dynamic retry-after for 404 responses and shorten default Meta 404 cooldown

Closes: #6117
2026-09-25 03:05:24 +08:00
sususu
377747b8b6 fix(registry,cliproxy): set xai owned_by for Devin grok models and align Antigravity web search tests
- Map Devin grok models to xai owned_by in catalog and fetch_devin_models tool
- Update Antigravity fetched capability test to reflect gemini-pro-agent native web search support
- Fix formatting in test fixtures
2026-09-24 22:23:18 +08:00
sususu
c7f358d4d4 fix(executor,auth): support Session_id header in Antigravity replay and remove redundant stream chunk logging 2026-09-24 20:54:05 +08:00
Chén Mù
8222e328c0 Enhance logging and improve thought signature handling (#6106)
* fix(gemini): suppress repeated thoughtSignature sanitizations and improve logging

* fix(executor): enhance logging for antigravity replay context hash rejections and clean up request struct formatting

* fix(executor): enhance context hash rejection logging and improve request index handling
fix(signature): distinguish detected providers in thought signature sanitization logs
fix(translator): update thought signature handling in OpenAI responses conversion
2026-09-24 18:55:40 +08:00
sususu98
f7c738dad3 fix(claude): align 2.1.280 fingerprint and thinking visibility (#6096)
* fix(claude): align Opus 5.5 cloak and preserve native CLI hints

* fix(claude): recognize the 2.1.280 Haiku title helper

The native title request now appends server-side fallback, fallback credit,
and cache diagnosis after the structured-output beta. Keep the helper
allowlist exact so this sequence passes through without cloaking.

* fix(claude): align thinking visibility and Messages passthrough

* fix(claude): preserve thinking visibility through compatibility paths

* fix(claude): harden OAuth beta, session alignment, and 2.1.280 helper headers
2026-09-24 15:26:39 +08:00
Luis Pater
dd3b657b5d fix(codex): use resolved base model for routing hint
- Pass resolved `baseModel` directly to `applyCodexRoutingHint` instead of reading model from the upstream body
- Ensure the routing hint header accurately reflects the resolved model across HTTP and WebSocket executions
2026-09-24 13:02:16 +08:00
Luis Pater
0876e7f043 Merge commit 'refs/pull/6090/head' of github.com:router-for-me/CLIProxyAPI into dev 2026-09-24 12:49:55 +08:00
hkfires
6d1d74b30d refactor(executor): remove unsupported reasoning effort handling and update related tests 2026-09-24 09:02:02 +08:00
SamGu-NRX
b97f71da0c fix(codex): send the ChatGPT routing hint native Codex sends
- Send X-Codex-Routing-Hint ("model=<slug>" plus ";tier=<service_tier>")
  on ChatGPT-backend requests over HTTP, compact and websocket handshakes,
  matching openai/codex rust-v0.155.0 build_routing_hint_header. Translated
  requests previously carried service_tier=priority only in the body.
- Derive the hint from the final upstream body, replacing a hint a native
  client forwarded, so it names the model and tier actually sent.
- Keep operator precedence: an auth header rule that resolves to a value
  wins, a dynamic rule that resolves to nothing falls back to the derived
  hint, and models.json override_header still applies last.
- Leave API-key requests unchanged, and keep websocket reuse as native Codex
  does: an open connection keeps its handshake hint when the tier changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 19:56:53 -05:00
hkfires
984aee8df0 feat(executor): enhance sanitizeXAIResponsesBody to utilize resolved thinking support 2026-09-24 08:50:29 +08:00
Luis Pater
2fe9932bb9 feat(usage): track execution request ID and trace ID across usage records
- Add `RequestID` (unique execution UUID) and `TraceID` (inbound request ID) fields to usage records and plugin API
- Generate unique UUIDs per model attempt in `UsageReporter` while linking to parent trace context
- Expose `execution_id` and `trace_id` in Redis queue usage payloads while preserving legacy `request_id`
2026-09-23 19:31:39 +08:00
Luis Pater
bd584a7523 feat(claude): support Claude Code 2.1.280 feature-gated betas
- Add header definitions and ordering for per-turn control, timing, inline tools, clear-at, dangerous tool use, thinking binding/resumption, and prompt caching evict betas
- Dynamically assemble beta headers based on model capabilities and request body fields matching Claude Code 2.1.280 behavior

Closes: #6054
2026-09-23 08:11:33 +08:00
Luis Pater
779bf317e0 feat(claude): bump claude cli baseline to 2.1.280 and support tool changes beta
- Update default Claude CLI version to 2.1.280 in cloaking and device profile
- Add `mid-conversation-tool-changes-2026-07-01` beta header support for supported models

Closes: #6054
2026-09-23 05:07:49 +08:00
Luis Pater
f351924f42 feat(codex): add support for disable codex cloaking per credential
Closes: #6034
2026-09-22 22:39:20 +08:00
Luis Pater
4b5adbbe9a feat(openai): support video input in responses request translation
- Convert `input_video` and `video_url` content parts to chat completion video parts
- Preserve video URL and processing options for upstream handling

Closes: #6037
2026-09-22 21:38:10 +08:00
Luis Pater
320100ecf7 fix(codex): strip octal NUL pattern escapes from tool schemas
- Strip octal NUL (`\0`) escapes in regex patterns to prevent rejection by strict upstream JSON Schema validators
- Update tool schema normalization fast-path to check for serialized `\0` escape sequences

Closes: #6025
2026-09-22 18:25:48 +08:00
Luis Pater
a26cf2a8c2 perf(executor): avoid discarded copies of Gemini and Kimi stream lines
Read Gemini interactions scanner lines directly because emitted frames are already cloned before reuse, and allocate each Kimi responses passthrough chunk once so it stays owned without a second copy.
2026-09-22 08:32:35 +08:00