Commit Graph

3033 Commits

Author SHA1 Message Date
Luis Pater
466cee6e16 fix: complete xAI image usage reporting 2026-07-16 02:32:56 +08:00
Luis Pater
3cb2d27d98 Merge remote-tracking branch 'origin/pr-4344' into dev 2026-07-16 02:29:45 +08:00
Luis Pater
b6ce0beecd feat(executor): simplify xAI function schema handling and rejection logic
- Refactored `xaiFunctionParametersNeedSimplification` to identify schemas xAI cannot process, including those with non-object types in unions.
- Limited parameter simplifications to problematic schemas instead of specific tools or namespaces.
- Clarified and updated debug messages to reflect schema rejection and hang prevention.

Closes: #4343
v7.2.79
2026-07-16 02:05:50 +08:00
Luis Pater
71b5beb8b9 feat(gitstore): migrate to new client options API and disable commit signing
- Updated git operations to leverage `ClientOptions` for authentication and configuration, replacing the deprecated `AuthMethod`.
- Implemented logic to disable GPG commit signing in repositories to prevent signature errors in automated workflows.
- Upgraded dependencies in `go.mod` and `go.sum` to align with the latest `github.com/go-git/go-git/v6` alpha releases.
- Added unit tests to verify commit signing is properly disabled in repositories.

Closes: #4341
2026-07-16 01:44:28 +08:00
Matt Van Horn
9f500aef7a fix: publish usage event for xAI images/generations path 2026-07-15 08:45:44 -07:00
Luis Pater
768b4c49fd feat(usage): track generate flag with backward-compatible defaults
Propagate client generate metadata through usage records while keeping
legacy callers that omit the field enabled by default. Preserve an
existing context generate=false when metadata does not set the value,
and normalize omission to true only at publishing boundaries.
v7.2.78
2026-07-15 21:30:09 +08:00
Luis Pater
35a5f06612 feat(config): resolve plugin directory paths and handle tilde expansion
- Added `ResolvePluginsDir` to normalize plugin directory paths, including tilde (`~`) expansion.
- Integrated directory resolution into config loading, runtime setup, and plugin management flows.
- Updated tests across components to validate correct handling of unresolved and expanded plugin paths.
- Added error handling for invalid or unresolved plugin directories to prevent runtime issues.

Closes: #4313
2026-07-15 16:53:02 +08:00
Luis Pater
c8803713c9 feat(translator): disambiguate and deduplicate tool names in request/response workflows
- Introduced `SanitizedFunctionNameMap` and `DisambiguatedToolNameMap` for consistent mapping between sanitized and original tool names.
- Added collision handling with deterministic hash suffixes for name disambiguation within character limits.
- Implemented logic to deduplicate and map tool and function names across translator components, including Interactions, Claude, and Gemini.
- Updated test cases to validate name restoration, deduplication, disambiguation, and mapping behaviors.

Closes: #4244
v7.2.77
2026-07-15 04:49:30 +08:00
Luis Pater
9f62c8df28 feat(translator): enhance handling of custom tool calls and improve tool call batching logic
- Introduced support for custom tool calls in request serialization, including preservation of call IDs, input, and output.
- Enhanced tool call batching logic to handle ambiguous, missing, and reused call IDs across assistant messages.
- Updated processing of tool call outputs to ensure proper matching with pending calls and introduced synthesized IDs when necessary.
- Added extensive test cases to validate behavior for custom tool call histories, mixed call types, and edge cases with ambiguous or orphaned IDs.

Closes: #4256
v7.2.76
2026-07-15 03:14:05 +08:00
Luis Pater
e57416731a feat(logging): add deferred request body capture for error handling
- Introduced `deferredRequestBodyCapture` for spooling and retaining large error-only request bodies for improved logging.
- Enhanced `RequestLoggingMiddleware` to capture request body based on size and error criteria.
- Implemented decompression and truncation for large request bodies with Zstd encoding.
- Added support for deferred API request logging and context tracking.
- Included extensive test coverage for error-specific body capture and serialization behavior.
v7.2.75
2026-07-14 23:35:29 +08:00
Luis Pater
3d46ede431 feat(translator): handle reasoning content and improve request serialization
- Added support for reasoning content in assistant messages with proper serialization of `thought`, `thoughtSignature`, and content parts.
- Ensured empty assistant messages and invalid function calls are skipped during request generation.
- Enhanced compatibility by adding test cases for preserving reasoning content, tool calls, and visible assistant content in `ConvertOpenAIRequestToGemini` and `ConvertOpenAIRequestToAntigravity`.

Closes: #4304
2026-07-14 22:19:07 +08:00
Luis Pater
411d7d41ee feat(auth): add SelectAuthByKind method and enhance Codex Alpha Search handling
- Implemented `SelectAuthByKind` to filter and select credentials by kind with retry logic and error handling.
- Updated Codex Alpha Search to enforce OAuth credentials and sanitize upstream request body.
- Added unit tests to validate `SelectAuthByKind` behavior across scenarios.
- Introduced `sanitizeCodexAlphaSearchBody` for removing sensitive fields from API payloads.

Closes #4289
v7.2.74
2026-07-14 16:31:45 +08:00
Luis Pater
160a55612e feat(auth): add home force mapping logic with tests and alias result handling
- Implemented `homeForceMappingAliasResult` for handling forced alias mapping in the authentication process.
- Updated `resolveExecutionAliasResultForRequested` to incorporate home force mapping.
- Introduced new attributes (`home_force_mapping` and `home_original_alias`) for managing alias behavior.
- Extended `homeAuthDispatchResponse` with fields for force mapping and original alias.
- Added test cases to validate force mapping logic and edge cases.
2026-07-14 14:59:15 +08:00
sususu98
03d58c4402 fix(usage): collapse OpenAI service tier metadata (#4275)
* fix(usage): preserve request service tier metadata

* fix(usage): collapse request tier metadata

* fix(usage): emit only service_tier and response_service_tier

Collapse request tier to service_tier for usage records and queue payloads. Keep RequestServiceTier as a deprecated input-only alias for older plugin callers.
2026-07-14 14:19:13 +08:00
Luis Pater
6c6b16f044 feat(ui): update Kimi logo with new SVG design and dimensions 2026-07-14 12:36:24 +08:00
Luis Pater
06a4e46f69 Merge pull request #4283 from MapleMapleCat/docs/add-grok-search-mcp
docs(readme): add Grok Search MCP project entry
2026-07-14 05:20:55 +08:00
Luis Pater
2a63b27187 fix(release): rename GOARCH to TARGET_GOARCH in release workflow to resolve variable mismatch during FreeBSD builds v7.2.73 2026-07-14 05:12:49 +08:00
Luis Pater
a9831c841a fix(xai): sync allowed_tools and prune orphaned choices for x_search inject
Normalize and drop tool_choice entries that reference tools removed by
normalizeXAITools before injecting native x_search, then allow x_search in
allowed_tools without duplicates so Grok can select the injected tool.
2026-07-14 05:03:19 +08:00
Luis Pater
423f3d5ff7 feat(xai): add xAI API key support with comprehensive handling and tests
- Introduced `xai-api-key` to configuration for supporting xAI provider integration.
- Added API key operations: creation, updates, deletion, and sanitization.
- Implemented backend enhancements for credential-specific routing, response filtering with model aliasing, and WebSocket handling for xAI services.
- Included extensive test coverage to validate configuration parsing, CRUD operations, and the new functionalities.
- Updated related modules to handle `xai-api-key`, including the watcher, management handlers, and configuration sanitizers.
2026-07-14 04:40:12 +08:00
Luis Pater
a5577cc67d feat(xai): enhance response filtering with client-declared tool support to distinguish internal X Search traces
- Added `clientDeclaredTools` to `xaiInternalXSearchResponseFilter` for improved filtering precision.
- Implemented `collectXAIClientDeclaredToolKeys` to register client-declared tools with effective normalization to function calls.
- Prevented leakage of internal traces (e.g., `xs_call-*`) while preserving client-declared tools with overlapping names.
- Introduced multiple test cases to ensure filter correctness and preserve expected WebSocket response outputs.
- Enhanced completed output handling in response filtering.

Closes: #4282 / PR #4284.
2026-07-14 03:38:29 +08:00
Luis Pater
4fd81f904b Merge pull request #4284 from vvanglro/codex/fix-xai-x-search-history-4282 2026-07-14 01:30:40 +08:00
vvanglro
4651c3705d perf(xai): reuse parsed input array 2026-07-14 00:44:14 +08:00
sususu98
194fbce4b4 fix(executor): strip orphan reasoning ids when store is disabled (#4285)
* fix(executor): strip orphan reasoning ids when store is disabled

Codex backend requires store=false and treats reasoning items with an
id but no usable encrypted_content as store lookups, which 404 with
"Item with id not found". Drop those orphan ids after removing invalid
encrypted_content (and when encrypted_content is already missing),
while preserving ids when store=true.

* fix(executor): skip id delete when reasoning item has no id

Avoid sjson.Delete on encrypted_content drops that never carried an id,
matching the orphan-id path's Exists() guard.
2026-07-14 00:35:48 +08:00
vvanglro
caa93a7fc6 fix(xai): filter internal X search calls 2026-07-14 00:19:49 +08:00
Dmitry R.
7f6d491e70 perf(executor): avoid O(n^2) rebuilds when sanitizing reasoning encrypted_content (#4281)
Previously each dropped encrypted_content re-ran sjson.DeleteBytes on
the whole body/array per item, causing O(n^2) work on inputs with many
reasoning items.

Now the array is walked once, editing only offending items in place
and lazily building a replacement "input" array via strings.Builder.
The builder stays nil (no allocation) when nothing needs sanitizing,
and the array is spliced back with a single SetRawBytes call.
2026-07-14 00:16:05 +08:00
vvanglro
7bb8132817 fix(xai): normalize custom tool call history 2026-07-13 23:45:44 +08:00
MapleMapleCat
a9813dcc2c docs(readme): add Grok Search MCP translations
Keep the project entry consistent across the Chinese and Japanese README files.
2026-07-13 23:11:41 +08:00
MapleMapleCat
cf10f25e70 docs(readme): add Grok Search MCP project entry
Document the MCP server built on CLIProxyAPI so users can discover its Grok search integration and administration features.
2026-07-13 23:04:29 +08:00
Luis Pater
7efe8b394a Merge pull request #4278 from huahai0202/fix/disable-custom-tool-search
fix(codex): 仅为有模板的纯 Codex 路由保留 tool search
2026-07-13 21:54:28 +08:00
huahai0202
e73aad2e0a fix(codex): require model template for tool search 2026-07-13 19:35:16 +08:00
huahai0202
ceaeb75d53 fix(codex): gate tool search by model providers 2026-07-13 19:22:58 +08:00
Luis Pater
6279bb8a4c feat(ui): add provider SVG logos and descriptions in multilingual README files
- Introduced logo assets (`Kimi`, `OpenAI`, `Claude`, `Gemini`, `Grok`) under `assets/logo/`.
- Updated multilingual README files (`README.md`, `README_JA.md`, `README_CN.md`) to include provider SVG logos and enhance descriptions for supported APIs.
- Improved clarity of provider details with tables for better readability.
v7.2.72
2026-07-13 18:21:00 +08:00
sususu98
4fe2c60c51 feat(registry): remote-refresh Codex client model catalog (#4276)
Load codex_client_models.json like models.json with validation, revisioned
handler reloads, CI bake, and Home-aware updater gates so list IDs still
come from Home while templates can refresh on the edge.
2026-07-13 17:47:35 +08:00
Luis Pater
e674f19129 Fix xAI allowed tool namespace choices 2026-07-13 14:58:03 +08:00
Luis Pater
19fb0f0774 Merge pull request #4251 from huahai0202/fix/xai-namespace-tool-routing 2026-07-13 14:48:55 +08:00
huahai0202
4123e27583 fix(xai): handle additional namespace tools 2026-07-13 10:39:39 +08:00
Luis Pater
e0a0b5a4b7 feat(codex): add summary detection and processing for local compaction in websocket input
Closes: #4227
2026-07-13 03:22:47 +08:00
Luis Pater
5b7f2361ee Merge pull request #4190 from sususu98/pr/xai-sse-reasoning-replay
feat(xai): encrypted reasoning replay for Responses/Claude
v7.2.71
2026-07-13 00:14:05 +08:00
sususu
18d239d567 fix(xai): clear replay after compaction 2026-07-12 23:59:39 +08:00
huahai0202
eb6d169407 fix(xai): qualify namespaced tool choices 2026-07-12 23:58:16 +08:00
sususu
487f8afc98 fix(xai): disable unisolated replay without caller auth 2026-07-12 23:38:11 +08:00
huahai0202
c4eda81b93 fix(xai): address namespace routing review feedback
Use exact namespace separator matching, normalize replay-inserted calls, preserve payloads on JSON update failures, and remove redundant completed-response restoration.
2026-07-12 23:33:53 +08:00
sususu
f1e9347f51 fix(xai): preserve tool-call-only replay batches 2026-07-12 23:19:36 +08:00
huahai0202
0e3a3e6199 fix(xai): preserve namespace tool routing
xAI Responses does not accept namespace tool containers, so the executor flattens nested tools before forwarding them upstream. The original namespace support in 8b3670b8 moved children to the top level but discarded their namespace identity; ca67caf later retained namespace context only for targeted schema simplification.

Qualify flattened names to avoid collisions, normalize namespaced function-call history, and restore name plus namespace on HTTP and WebSocket responses. This keeps Codex MCP routing intact without changing the existing xAI tool_search filtering policy.
2026-07-12 23:16:57 +08:00
sususu
3f875ecd2d fix(xai): avoid ambiguous reasoning replay injection 2026-07-12 23:07:04 +08:00
Luis Pater
55f4d6ed1d feat(codex): pass Gin context to auth selection for Alpha search
- Introduced `codexSearchGinContextSelector` to capture and validate Gin context during credential selection.
- Added test case to verify context propagation and query parameter usage (`TestCodexAlphaSearchPassesGinContextToAuthSelection`).
- Updated `SelectAuth` implementation to include Gin context for enhanced compatibility with Home scheduling.
2026-07-12 23:06:38 +08:00
Luis Pater
9c3f720710 feat(codex): implement session affinity and request logging for alpha search
- Added `SelectAuth` method to enhance flexible credential selection.
- Introduced session affinity mechanism for consistent credential reuse per session.
- Enabled detailed request/response logging for Codex alpha search API.
- Updated tests to validate session affinity behavior and log capture.

Closes: #4166
v7.2.70
2026-07-12 22:59:14 +08:00
Luis Pater
dee653cd6d Merge PR #4239: fix(codex): proxy GPT-5.6 standalone search 2026-07-12 22:41:36 +08:00
sususu
dc551b7de5 refactor(xai): remove unused assistant content equal helpers
Drop xaiAssistantMessageContentEqual and xaiAssistantMessagePartValue,
which were left unused after the last-assistant skip path landed.
2026-07-12 22:31:19 +08:00
sususu
041816c2fd feat(xai): encrypted reasoning replay for Responses/Claude with hardened cache
Preserve include=reasoning.encrypted_content, cache reasoning+assistant message
for store:false multi-turn, and accept Grok thinking signatures on Claude→Codex
for grok targets.

Harden replay cache: blob-level reasoning filter, never double-inject assistant
when history has a last message, isolate session keys by downstream API key,
clear cache on non-replayable completed turns, and normalize refusal parts.
2026-07-12 22:31:19 +08:00