Commit Graph

2628 Commits

Author SHA1 Message Date
Luis Pater
c75fb2c814 chore(build): add caching for Go dependencies and FreeBSD-specific artifacts in release workflow 2026-06-07 04:53:55 +08:00
Luis Pater
3dedf47839 chore(build): set additional environment variables for FreeBSD builds in release workflow 2026-06-07 04:41:55 +08:00
Luis Pater
9ee64935fb chore(build): remove goreleaser configuration and refactor release workflow
- Deleted `.goreleaser.yml` configuration and migrated functionality to GitHub Actions workflows.
- Replaced `goreleaser` with matrix-based build and archiving process for improved flexibility.
- Enhanced platform and architecture-specific builds, including FreeBSD support and custom runners.
- Streamlined artifact upload, checksum generation, and release publishing.
2026-06-07 04:36:19 +08:00
Luis Pater
bc58c21673 chore(build): update dependencies, enhance cross-compilation, and refactor workflows
- Updated `golang.org/x/sys` to v0.38.0 in `go.mod` and replaced `syscall` with `windows` package for memory allocation in `loader_windows.go`.
- Improved cross-compilation in `.goreleaser.yml` using Zig-based toolchains for better platform support.
- Changed GitHub Actions workflow to use macOS runners and added Zig toolchain setup.
v7.1.49
2026-06-07 04:13:15 +08:00
Luis Pater
0ed85bb88b feat(pluginhost): refactor and enhance plugin system with new execution and thinking capabilities
- Removed `examples/plugin/main.go` and `internal/pluginhost/loader_plugin.go` after migrating to a more modular system.
- Introduced `streamBridge` in `internal/pluginhost/stream_bridge.go` for efficient stream handling and communication.
- Added examples of `thinking` plugins written in both Rust and Go under `examples/plugin/thinking`.
- Enhanced test coverage for plugin host system changes, including stream chunk translation and thinking logic.
- Improved API compatibility and ensured backward-compatible upgrades for plugin execution.
v7.1.48
2026-06-07 03:20:04 +08:00
Luis Pater
3abfc83d96 Merge branch 'dynamic' into dev
# Conflicts:
#	internal/cmd/run.go
v7.1.47
2026-06-06 18:41:13 +08:00
Luis Pater
d625caddd9 feat(pluginhost): add capabilities for command-line flag handling and plugin execution
- Implemented command-line flag registration and execution for plugins with priority-based conflict resolution.
- Enabled plugin-owned command-line flag execution and persistence of plugin-auth data.
- Added new `Host` methods to support command-line capabilities, including flag normalization, validation, and execution state management.
- Introduced unit tests to ensure coverage for command-line plugin functionality, including auth data persistence.
- Updated configs to normalize plugins during initialization.
2026-06-06 18:35:17 +08:00
Luis Pater
fca12a2630 Merge pull request #3735 from router-for-me/safemode
feat(safemode): implement example API key warning server and related functionality
v7.1.46
2026-06-06 13:31:37 +08:00
hkfires
bc38b68902 feat(safemode): implement example API key warning server and related functionality 2026-06-06 11:42:21 +08:00
Luis Pater
5753d1a089 feat(logging): enable file-backed request/response sources for enhanced API logging
- Introduced support for file-backed logging of API requests and responses to handle large payloads efficiently.
- Refactored `attachWebsocketLogSources` to `attachRequestLogSources` for broader request and response handling.
- Added new methods for appending request/response data to file-backed sources and updated existing logging workflows for compatibility.
- Improved cleanup and merge logic for file-backed sources during request processing.
- Updated tests to cover newly introduced file-backed logging functionality.
v7.1.45
2026-06-05 01:48:05 +08:00
Luis Pater
387c783b32 Merge pull request #3649 from intcua/fix/xai-empty-tools-orphan-tool-choice
fix(executor/xai): drop orphaned tool_choice when Claude tools array is empty
2026-06-04 13:11:23 +08:00
Luis Pater
90d46e7749 docs: remove outdated Amp CLI and related tool references
- Removed sections on Amp CLI integration and related management tools from all READMEs (`README.md`, `README_JA.md`, and `README_CN.md`).
- Updated project descriptions for relevance and focus.
2026-06-04 12:58:50 +08:00
Luis Pater
bebdaa4d65 Merge pull request #3702 from Villoh/docs/add-tunnel-agent
docs: add Tunnel Agent to community projects
2026-06-04 12:48:11 +08:00
Luis Pater
fd30944830 feat(auth): add error event publishing and Redis queue integration
- Introduced `publishErrorEvent` in `Manager` to publish error events to Redis.
- Implemented error event structure to capture authentication errors with detailed metadata.
- Added test cases for error event publishing, subscription, and Redis protocol handling.
- Enhanced error and usage queue handling with `SubscribeErrors` and `EnqueueError`.

Closes: #3701
v7.1.44
2026-06-04 00:53:43 +08:00
Mikel Villota
46a152a21b docs: use 智能体 for Agent in Chinese translation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-06-03 18:48:40 +02:00
Villoh
1074507a2f docs: add Tunnel Agent to community projects 2026-06-03 18:34:56 +02:00
Luis Pater
55440f0a39 feat(auth): add runtime auth removal and unscheduling logic
- Introduced `Manager.Remove` to delete runtime auth and unschedule associated tasks.
- Updated handler logic to directly remove auth instead of marking as disabled.
- Added tests to validate removal, unscheduling, and runtime state handling.
- Added a test to validate `skipPersist` behavior during registration.
- Enhanced `Remove` test to verify auto-refresh loop state before and after removal.

Closes: #3690
v7.1.43
2026-06-03 11:56:56 +08:00
Luis Pater
9c02454005 Merge pull request #3657 from catoncat/fix/responses-input-id-dedupe-orphaned-output
fix(openai): keep referenced tool call when deduping websocket input IDs
v7.1.42
2026-06-03 11:22:00 +08:00
Luis Pater
1c9601ff32 Merge pull request #3689 from sususu98/pr/cloudflare-challenge-retry
fix(auth): retry and backoff cloudflare challenge 403 errors
2026-06-03 11:07:08 +08:00
sususu98
77061aad4b refactor(auth): simplify and narrow cloudflare challenge checks 2026-06-03 10:35:39 +08:00
sususu98
45f58d4f91 fix(auth): retry and backoff cloudflare challenge 403 errors
Introduce Cloudflare challenge detection for 403 errors in the Auth
Manager. Apply a progressive rate-limiting cooldown ladder using the
existing BackoffLevel field instead of a hard 30-minute credentials
suspension. This ensures challenged requests fall through to subsequent
credentials and recover exponentially.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 10:28:43 +08:00
sususu98
7682accd95 Merge pull request #3688 from sususu98/fix-codex-replay-dev
fix(codex): avoid replaying orphan tool calls
2026-06-03 09:59:44 +08:00
sususu98
17af089189 fix(codex): avoid replaying orphan tool calls 2026-06-03 09:52:17 +08:00
Luis Pater
35ab084fc3 refactor(runtime): enhance NewUtlsHTTPClient with context-based RoundTripper
- Updated `NewUtlsHTTPClient` to support context-aware RoundTrippers for protected hosts (e.g., Cloudflare bypass).
- Replaced `anthropicHosts` with `utlsProtectedHosts` to generalize host handling logic.
- Added unit test to validate context-based RoundTripper behavior.
- Replaced `NewProxyAwareHTTPClient` with `NewUtlsHTTPClient` in relevant executors for improved TLS fingerprinting.

Closes: #3680
v7.1.41
2026-06-03 06:58:26 +08:00
Luis Pater
0e3c809ceb fix(codex): handle non-empty reasoning and content items, add test for trailing empty messages
Closes: #3683
2026-06-03 06:28:51 +08:00
Luis Pater
28c7f41cba docs(readme): update project descriptions and add Panopticon link
- Updated links and descriptions for `CPA-Manager-Plus`, replacing outdated `CPA-Manager` references.
- Added `Panopticon`, a multi-agent orchestration tool, to the project list.
2026-06-02 19:42:51 +08:00
Luis Pater
d710248407 Merge pull request #3676 from eltmon/add-panopticon-to-users
docs: add Panopticon to "Who is with us?"
2026-06-02 19:35:57 +08:00
Luis Pater
02d0d92a8e Merge pull request #3677 from sususu98/codex/home-auth-loop-upstream-dev
Fix Home auth refresh retry handling
v7.1.40
2026-06-02 19:30:14 +08:00
Luis Pater
8306391f91 Merge pull request #3667 from sususu98/feat/codex-reasoning-replay-cache-upstream-dev
feat(codex): cache reasoning replay items
2026-06-02 19:28:55 +08:00
sususu98
4abd59ce1b Merge pull request #3679 from sususu98/codex/system-role-to-user-upstream-dev
fix(translator): normalize message-level system roles for Gemini
2026-06-02 16:56:27 +08:00
sususu98
68282c4aa7 fix(translator): normalize message-level system roles for Gemini 2026-06-02 16:48:58 +08:00
sususu98
603a08fc1a feat(codex): cache reasoning replay items 2026-06-02 16:08:40 +08:00
sususu98
c9dc6bd628 Fix Home auth refresh retry handling
Parse Home refresh auth envelopes so refreshed access tokens are used instead of returning missing access token.

Stop retrying when Home dispatch returns an auth that already failed within the same request.
2026-06-02 13:43:07 +08:00
Edward Becker
7cb466a8e6 docs: add Panopticon to "Who is with us?" 2026-06-02 01:11:03 -04:00
Luis Pater
87d813c56c chore(models): remove legacy GPT 5.2 and GPT 5.3 Codex entries from registry
- Cleaned up outdated GPT 5.2 and GPT 5.3 Codex model configurations from `models.json`.
- Simplified registry by removing unused model references across all tiers (`codex-team`, `codex-plus`, `codex-pro`).
2026-06-02 10:41:12 +08:00
Luis Pater
bf04a24221 feat(models): add support for grok-composer-2.5-fast model
- Introduced `grok-composer-2.5-fast` as a new XAI model.
- Updated registry to include display name, description, and configuration details for the new model.
- Enabled support for the model in the Responses API.
2026-06-02 08:50:32 +08:00
Luis Pater
f353979e0a feat(watcher, redisqueue): add usage refresh notification support
- Introduced `NotifyUsageRefresh` in `redisqueue` to notify subscribers of usage refresh events.
- Enhanced `Watcher` logic to trigger usage refresh notifications on client changes (add/update/remove).
- Updated tests to validate proper broadcast of usage refresh messages to subscribers.
- Added support for initial `support_refresh` payload upon subscription initialization.
v7.1.39
2026-06-02 02:52:27 +08:00
Luis Pater
959067edfb feat(usage): introduce executor type tracking in usage reporting
- Replaced `NewUsageReporter` with `NewExecutorUsageReporter` to include executor type in usage records.
- Updated all executors to use the new reporter implementation.
- Extended `UsageReporter` to track and publish executor type.
- Added tests to validate proper executor type recording and handling.
- Enhanced RedisQueue plugin and payload schema with executor type support.
v7.1.38
2026-06-02 00:43:16 +08:00
cat
f05d68d4ec refactor(openai): parse dedupe input item metadata in a single pass
Address review feedback: parse each item's type/id/call_id once with
gjson.GetManyBytes and reuse it across the dedupe loops instead of
rescanning every item up to five times. Behavior is unchanged.
2026-06-01 15:01:31 +08:00
cat
e7f4dd470d fix(openai): keep referenced tool call when deduping websocket input IDs
The input item ID dedupe added in #3620 keeps only the last occurrence of
each item id. When an upstream reuses the same item id across a re-sent or
repaired tool call (so two function_call items share an id but carry
different call_ids), the last-wins rule can drop the function_call whose
call_id still has a matching function_call_output. The upstream then rejects
the request with HTTP 400 "No tool call found for function call output with
call_id ...", breaking every subsequent turn over the Codex WebSocket path.

Make the dedupe orphan-aware: when several input items share an id, never
replace an item whose call_id is still referenced by a tool-call output with
one that is not. This keeps a single item per id (preserving the original
intent) while ensuring retained tool calls stay paired with their outputs.

Adds a regression test covering two function_call items that share an id
where only the earlier call_id has a surviving output.
2026-06-01 13:10:41 +08:00
Luis Pater
05b972479a feat(executor): refine session and conversation header handling for Codex
- Updated session handling to replace `Session_id` and `Conversation_id` headers with new logic ensuring consistent use of `Cache.ID` and prompt keys.
- Restored `Session_id` as a priority extraction source for `ExtractSessionID`.
- Added tests to validate case-sensitive and case-insensitive headers, canonical account header usage, and session key preservation.
- Removed legacy support for deprecated `Conversation_id` header to clean up API.
v7.1.37
2026-06-01 11:27:10 +08:00
Luis Pater
fb4f39d300 test(models, executor): add XAI video model test and fix Codex User-Agent assertions v7.1.36 2026-06-01 02:59:31 +08:00
Luis Pater
ac1360f479 feat(models): add support for grok-imagine-video-1.5-preview model
- Introduced `grok-imagine-video-1.5-preview` as a new XAI video model.
- Updated handlers, registry, and validation logic to include support for the new model.
- Enhanced test coverage to validate integration and functionality of the preview model.
2026-06-01 02:56:15 +08:00
Luis Pater
bbcdaab79d feat(executor): enhance Codex identity obfuscation with turn and window metadata handling
- Modified `applyCodexIdentityConfuse*` functions to include `turn_id` and `window_id` in metadata transformations.
- Updated test cases to validate the inclusion and restoration of these fields.
- Removed deprecated `Conversation_id` header support and related logic for cleaner implementation.
v7.1.35
2026-06-01 00:50:46 +08:00
lamtran
303685c230 fix(executor/xai): drop orphaned tool_choice when Claude tools array is empty
When Claude Code sends a stop-hook evaluator request (or any request
without tools), the payload includes "tools": [] (empty array). The
claude->codex translator unconditionally emits tools: [] + tool_choice:
"auto" + parallel_tool_calls: true into the Codex Responses shape.

When that payload is routed to xAI, the upstream rejects with HTTP 400:
"A tool_choice was set on the request but no tools were specified."

Fix entirely in the xAI executor (translator package is policy-locked):
add normalizeXAIToolChoiceForTools() after normalizeXAITools() to drop
tool_choice and parallel_tool_calls whenever tools end up absent or
empty (covering both the empty-from-source case and the
all-filtered-out case where every tool was an unsupported type such as
tool_search or image_generation).

Per code-review feedback: always remove parallel_tool_calls when tools
are missing (not gated on tool_choice presence) and existence-check
each key before sjson delete to avoid unnecessary JSON parse/copy.

Verification:
- go build -o test-output ./cmd/server
- go test ./internal/runtime/executor/... -count=1
- 5 new regression tests cover empty / missing / present / orphaned
  parallel_tool_calls / no-op-when-both-absent.
2026-05-31 23:13:15 +07:00
Luis Pater
0f24cafbdd feat(executor): implement identity obfuscation for Codex requests and responses
- Added `applyCodexIdentityConfuse*` functions for remapping request and response payloads and headers to enhance security.
- Updated WebSocket and HTTP logic to handle identity state transformations seamlessly.
- Introduced unit tests to verify remapping and restoration of identity-related fields.
v7.1.34
2026-05-31 23:31:35 +08:00
Luis Pater
33983b6f3e refactor(executor): consolidate Codex request translation logic
- Introduced `translateCodexRequestPair` to simplify and reuse translation logic for handling original and modified payloads.
- Updated relevant methods to use the new function.
- Added unit tests to cover payload reuse and differentiation scenarios.
v7.1.33
2026-05-31 14:38:54 +08:00
Luis Pater
3a54fb7fcf Merge branch 'dev', commit 'refs/pull/3621/head' of github.com:router-for-me/CLIProxyAPI into dev
# Conflicts:
#	internal/translator/gemini/openai/responses/gemini_openai-responses_request_test.go
v7.1.32
2026-05-30 20:57:14 +08:00
Luis Pater
430e679e2a fix(auth): strip "generate" from payload during WebSocket HTTP fallback
- Added `sanitizeDownstreamWebsocketFallbackRequest` to clean `generate` from payload for HTTP fallback requests.
- Implemented tests to validate payload handling logic in WebSocket-to-HTTP transitions.

Closes: #3556
2026-05-30 05:14:05 +08:00
Luis Pater
55901f0bda Merge pull request #3620 from iBenzene/fix/responses-input-id-dedupe
fix(openai): dedupe response websocket input item IDs
v7.1.31
2026-05-30 03:27:36 +08:00