Commit Graph

2888 Commits

Author SHA1 Message Date
sususu98
8f686345b9 fix(responses): full transcript replay on WS-to-SSE Codex paths
For downstream websocket with CPA-mediated HTTP/SSE upstream (non-passthrough),
always merge the full conversation transcript instead of sending incremental
previous_response_id turns. Release pinned websocket auths after timeout and
gateway failures, and after WS bootstrap failover pin the successful SSE
credential so the next turn keeps merged context instead of retrying a
suspended websocket auth.

Fixes #4048
2026-06-29 18:47:55 +08:00
Luis Pater
95b7cd4233 Merge pull request #4051 from sususu98/codex/fix-force-mapped-antigravity-sse-rewriter
fix(auth): repair force-mapped Responses SSE framing for WS forwarder
2026-06-29 18:46:28 +08:00
sususu98
150e7f0dc5 fix(auth): repair force-mapped Responses SSE framing for WS forwarder
Force-mapping rewrites streaming OpenAI Responses SSE through StreamRewriter before the /v1/responses websocket forwarder. Antigravity/Gemini and Codex emit frames without reliable trailing newlines, so buffered chunks glued as ...}event:..., ...}data:..., or event:/data: without separators. The rewriter dropped pending tails and downstream WS synthesized 408 without response.completed even when upstream returned HTTP 200.

- safeReplaceGlued for }event: and }data: when data JSON is complete\n- Finish flush with glue normalization and line-wise fallback\n- Newline between pending event: and next data: line (Codex scanner lines)\n- Regression tests: Antigravity sim, Codex data lines, force-map WS forward
2026-06-29 18:11:44 +08:00
Luis Pater
a26d38450e Merge pull request #4043 from sususu98/fix/responses-gemini-reasoning-signature-upstream-dev
fix(translator): OpenAI Responses reasoning signatures for Gemini
v7.2.46
2026-06-29 15:58:40 +08:00
Luis Pater
8c8009c148 Merge pull request #4042 from router-for-me/plugin
feat(tests): refactor snapshot handling in model registration tests for improved clarity and consistency
2026-06-29 15:54:45 +08:00
sususu98
ca7478a1f4 fix(antigravity): align CLI User-Agent with agy 1.0.13 short form (#4045)
Use the aidev_client parenthetical suffix for default Antigravity UA and
route loadCodeAssist through the short UA. Keep onboardUser on the long UA
with google-api-nodejs-client.
2026-06-29 15:37:10 +08:00
sususu98
3648bc155e fix(translator): align reasoning merge with Responses visible text rules
Recognize model-visible output_text even when message.role is user, accept
assistant string content, and preserve raw merged text without trimming.
Always merge the adjacent visible item into native Gemini reasoning turns so
trailing output is not dropped by prefill stripping.
2026-06-29 13:56:57 +08:00
sususu98
4b51f85c4c fix(translator): map OpenAI Responses reasoning to Gemini two-part signatures
Build Gemini-native model contents for reasoning items when the routed model
uses the Gemini signature provider: thought summary on a thought part and the
replay signature on the adjacent visible part. Merge following assistant
visible text when it is not trailing prefill, and keep reasoning history when
stripping trailing model-authored prefill.

Extend Responses translator tests for signature compatibility and Antigravity
wrapper coverage; clarify stale replay signature expectations in executor tests.
2026-06-29 13:40:09 +08:00
hkfires
c48516c5d6 feat(tests): refactor snapshot handling in model registration tests for improved clarity and consistency 2026-06-29 11:54:26 +08:00
Chén Mù
dc43747cac Merge pull request #4039 from router-for-me/plugin
feat(pluginstore): add API URL to ReleaseAsset and update asset download logic
2026-06-29 09:47:45 +08:00
hkfires
caf70529e1 feat(pluginstore): refactor installation tests to improve asset download logic and error handling 2026-06-29 09:43:40 +08:00
hkfires
8970873156 feat(auth): streamline GitHub token handling and enhance download asset logic 2026-06-29 09:37:13 +08:00
hkfires
3ea7f18979 feat(pluginstore): add API URL to ReleaseAsset and update asset download logic 2026-06-29 08:59:50 +08:00
Chén Mù
c22795af80 Merge pull request #4038 from router-for-me/plugins
feat(auth): refactor authentication handling for plugins and add tests
v7.2.45
2026-06-29 06:45:21 +08:00
hkfires
00c0b4d74a feat(auth): refactor authentication handling for plugins and add tests 2026-06-29 06:41:04 +08:00
Luis Pater
f106c4167b Merge pull request #4036 from router-for-me/plugins
feat(plugins): enhance plugin deletion test and config handling
2026-06-28 22:59:07 +08:00
hkfires
60eae92bcd feat(plugins): enhance plugin deletion test and config handling 2026-06-28 22:14:36 +08:00
Luis Pater
884fc3ce94 Merge pull request #4035 from router-for-me/plugin
feat(pluginstore): introduce support for direct install type and version management
v7.2.44
2026-06-28 21:34:57 +08:00
hkfires
1f16e87e1a feat(pluginstore): introduce support for direct install type and version management
- Added Manifest struct to encapsulate plugin metadata and installation details.
- Implemented ManifestFromRelease and ManifestFromPlugin functions for creating manifests from releases and plugins.
- Enhanced Plugin struct to include Versions and InstallPlan for direct installations.
- Introduced validation for direct install type, ensuring artifacts are correctly specified.
- Updated registry validation to support new schema version and direct install requirements.
- Added tests for parsing and validating direct install plugins, ensuring correct artifact handling.
2026-06-28 21:19:34 +08:00
Luis Pater
21d8164c56 feat(handlers): add disable-cooling support in OpenAI compatibility configuration
- Introduced `disable-cooling` field in OpenAI compatibility configurations.
- Updated `PatchOpenAICompat` to handle `disable-cooling` updates.
- Refined response structure in compatibility handlers to include `disable-cooling`.
- Added unit test to validate `disable-cooling` propagation in API responses.

Closes: #4023
2026-06-28 17:54:49 +08:00
Luis Pater
b05a27e4d7 docs(README): add CyberPay to partners section with multilingual updates
- Introduced CyberPay details to `README.md`, `README_JA.md`, and `README_CN.md`.
- Added a new image asset `cyberpay.jpg`.
v7.2.43
2026-06-28 03:15:17 +08:00
Luis Pater
2fa4dabe93 feat(executor): improve downstream response ID rewrite and add test for repeated response scenarios 2026-06-26 16:34:02 +08:00
Luis Pater
4c0c60292d Merge pull request #4009 from router-for-me/plugin
feat(pluginhost): enhance plugin version management and logging for hot reload
v7.2.42
2026-06-26 12:28:15 +08:00
hkfires
6a59d645b5 feat(pluginhost): enhance plugin version management and logging for hot reload 2026-06-26 12:05:07 +08:00
Luis Pater
65f2288a4a feat(models): refine Gemini 3.5 Flash variants and add Medium tier
- Updated display names and descriptions of existing Gemini 3.5 Flash variants for better clarity.
- Introduced a new "Gemini 3.5 Flash (Medium)" variant with distinct configuration.
- Renamed "Low" tier to "Extra Low" for improved naming consistency.

Closes: #3949
v7.2.41
2026-06-26 01:55:33 +08:00
Luis Pater
cb6992ef20 docs: add Universal Chat Provider section to README files 2026-06-26 01:15:17 +08:00
Luis Pater
abe68cc1cf Merge pull request #4003 from maxdewald/add-universal-chat-provider
docs: add Universal Chat Provider to "Who is with us?"
2026-06-26 01:12:42 +08:00
Maximilian Dewald
7d1d251245 docs: add Universal Chat Provider to "Who is with us?"
Universal Chat Provider is a VS Code extension that surfaces Claude,
ChatGPT/Codex, Antigravity, Grok, and Kimi subscriptions as native
language models in GitHub Copilot Chat, using CLIProxyAPI as a fully
managed background server.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 17:22:17 +02:00
sususu98
eb2e1e33d4 fix(auth): rewrite API key alias response models (#4002) v7.2.40 2026-06-25 22:32:48 +08:00
Luis Pater
c4cf0fd324 Merge pull request #4001 from router-for-me/plugin
Enhance logging with plugin name and path
v7.2.39
2026-06-25 21:07:44 +08:00
hkfires
192888f9b1 feat(pluginhost): enhance logging with plugin name and path fields 2026-06-25 20:51:20 +08:00
Supra4E8C
29b53434b2 Merge pull request #3998 from router-for-me/feat/plugin-OAuth
feat(pluginhost): add OAuthProvider field to plugin metadata and upda…
v7.2.38
2026-06-25 17:37:22 +08:00
Supra4E8C
810abe5e2a feat(pluginhost): add OAuthProvider field to plugin metadata and update related functionality 2026-06-25 17:35:17 +08:00
Luis Pater
b53d1e9569 refactor(pluginhost): replace Snapshot().records with activeRecords for improved filtering
- Introduced `activeRecords` and `activeRecordsFromSnapshot` to filter current plugin records more efficiently.
- Updated all instances of `Snapshot().records` across code and tests to use `activeRecords`.
- Added additional checks for `recordCurrent` and plugin identity validation in several plugin capability calls.
- Enhanced test logic to validate `activeRecords` usage and ensure consistent behavior.
v7.2.37
2026-06-25 01:24:44 +08:00
Luis Pater
7712ffed1d Merge pull request #3986 from router-for-me/sdk
Add ParseAuths method and shadow plugin management
v7.2.36
2026-06-24 21:43:03 +08:00
hkfires
df10a5b1c7 feat(pluginhost): add shadow plugin management and cleanup functionality 2026-06-24 21:29:13 +08:00
sususu98
a7250275c1 fix(oauth): force-map responses to config alias not request suffix (#3983)
* fix(oauth): force-map responses to config alias not request suffix

Rewrite client-visible model fields using oauth-model-alias Alias from config
(e.g. gpt-5.4-fast) instead of mirroring the requested model string when the
client adds thinking suffixes (e.g. gpt-5.4-fast(high)). Upstream routing
still preserves suffixes on the resolved upstream model.

* test(oauth): gate response rewrite on ForceMapping and document OriginalAlias

- Document that OriginalAlias is only applied when ForceMapping is true
- Set OriginalAlias to config alias only when force-mapping is enabled
- Add tests: no non-stream/stream payload rewrite when ForceMapping is false

* test(oauth): assert disabled force mapping response
2026-06-24 16:57:03 +08:00
hkfires
a183e72992 feat(auth): add ParseAuths method for expanding credential payloads into multiple auth records 2026-06-24 16:16:57 +08:00
Luis Pater
87e6d9cf25 feat(videos): add model binding and propagation for video auth management
- Introduced `model` field in `videoAuthBinding` for model tracking.
- Enhanced binding store with `setWithModel` and `getBinding` methods for binding models.
- Updated handlers to propagate execution models during video processing.
- Added tests to verify model binding, retrieval, and propagation logic.
v7.2.35
2026-06-24 16:10:53 +08:00
Luis Pater
c20ac28a54 Merge pull request #3981 from sususu98/feat/oauth-model-alias-force-mapping
feat(oauth): add force-mapping for upstream response model rewrite
v7.2.34
2026-06-24 15:43:29 +08:00
sususu98
fd93ee035d feat(oauth): add force-mapping for upstream response model rewrite
Add OAuthModelAlias.ForceMapping to rewrite client-visible model fields in non-stream and SSE stream responses while leaving request-log upstream payloads unchanged.

- Wire config, watcher diff, and conductor execute/stream paths
- Rewrite force-mapped responses in Antigravity credits fallback paths
- Prevent buffered SSE chunks from being emitted by line-wise fallback
- Preserve thinking suffixes for same-base force-mapping aliases
- Cover codex, antigravity, kimi, and xai with live-derived fixtures and regression tests
- Document a conservative antigravity-only force-mapping example in config.example.yaml
2026-06-24 14:51:35 +08:00
sususu98
38ed7aefc6 fix(codex): sanitize downstream UA for direct image calls
Direct OpenAI image calls can inherit downstream User-Agent values from the Gin request context, which may trigger upstream Cloudflare 1010 blocks.

Clone inbound Codex headers for direct image requests and remove only User-Agent before applying defaults. This keeps Version, X-Codex-Turn-Metadata, X-Client-Request-Id, and Originator forwarding intact.

Expand direct image regression coverage for downstream identity headers and align edit endpoint expectations with /images/edits.
2026-06-24 14:43:44 +08:00
Luis Pater
3a13865db8 refactor(home): relocate and rename home plugin status reporting logic
- Moved `reportHomePluginStatus` from `cmd/server` to `internal/home` as `ReportPluginStatus`.
- Updated interface and variable names for consistency.
- Adjusted imports and references in `main.go` and test files to align with the changes.
- Improved code structure for better modularity and reuse.
v7.2.33
2026-06-23 23:27:11 +08:00
Luis Pater
70053beadb feat(auth): refactor credential kind detection and add dynamic source classification
- Introduced `AuthKind` and `AuthSourceKind` methods for improved credential type and source classification.
- Replaced legacy fallback logic with normalized attribute-based handling in `AuthKind`.
- Consolidated metadata inspection for both API key and OAuth attributes.
- Updated calls to replace direct `AccountInfo` usage with `AuthKind` and `AuthSourceKind`.
- Enhanced unit tests to validate explicit and fallback credential resolution scenarios.
2026-06-23 23:21:33 +08:00
Luis Pater
b89c594aac Merge pull request #3973 from router-for-me/home
feat(home): enhance plugin management and synchronization
v7.2.32
2026-06-23 21:59:41 +08:00
hkfires
e9a11db7b9 feat(home): enhance plugin management and synchronization
- Added NodeID field to HomeConfig for better identification.
- Updated ConfigFromJWT to populate NodeID from claims.
- Introduced new Redis keys for managing plugin status and tasks.
- Implemented RPushPluginStatus and GetPluginTasks methods in the client for handling plugin-related data.
- Enhanced Sync functionality to include detailed reporting on plugin installation and deletion tasks.
- Added error handling and reporting for plugin synchronization failures.
- Created tests for new plugin synchronization and management features.
- Improved the overall structure and readability of the plugin synchronization logic.
2026-06-23 20:42:33 +08:00
sususu98
05d1792d43 feat(xai): replay Grok reasoning for Claude messages (#3962)
Add Grok-native reasoning replay for Claude-sourced xAI Responses requests. Replay state is scoped by model and session, normalized to reasoning/function_call/custom_tool_call items, and injected with the same tool-call alignment semantics used by Codex.

Include the minimal Grok encrypted_content validator needed on upstream/dev so replay cache entries cannot accept Codex/GPT, Gemini, or Claude signature shapes. Cache completed output items from HTTP, streaming, and WebSocket xAI responses.

Cover two-turn Claude replay, tool_result continuity, valid Grok cache storage, and rejection of Codex-shaped encrypted_content.
v7.2.31
2026-06-23 14:57:53 +08:00
sususu98
53a21dfb0b [codex] Drop foreign encrypted_content before xAI Grok upstream (#3961)
* Drop foreign encrypted_content before xAI Grok upstream

xAI Grok accepts provider-native encrypted_content as opaque replay state, but GPT/Codex reasoning signatures, Gemini thoughtSignature blobs, and Claude thinking signatures can all travel through OpenAI Responses-style reasoning.encrypted_content while remaining incompatible with xAI. Forwarding those foreign blobs to Grok causes upstream validation failures, especially when the foreign value is high-entropy enough to look ciphertext-like.

Add a Grok encrypted_content transport validator that stays conservative and shape-oriented:

- require unpadded standard base64 with no foreign characters
- reject obvious GPT/Codex gAAAA reasoning signatures before decode
- reject strict Claude thinking signatures in both official E-form and Antigravity R-form
- reject known Gemini thoughtSignature envelopes by reusing the central Gemini validator, covering Gemini 2.5 field-1 and Gemini 3.x field-2 shapes
- require decoded payloads to be long enough and high-entropy enough to look like native Grok ciphertext
- avoid decrypting, protobuf-parsing, or otherwise interpreting native Grok payloads on the hot path

Wire the validator into the xAI Responses request preparation path for reasoning and compaction input items. Invalid encrypted_content fields are deleted before the request is sent upstream, while the surrounding item is preserved and debug logging records only redacted metadata.

Extend coverage with native Grok corpus preservation, Gemini field-1/field-2 rejection, Claude E-form and R-form rejection, invalid-blob sanitizer tests, and compact/websocket replay preservation. The foreign-provider checks are deliberately narrow so high-entropy Grok blobs are not rejected merely because they look random.

* fix(xai): harden encrypted content sanitizer
2026-06-23 14:33:27 +08:00
Luis Pater
f1ed8912bb feat(translator): wrap message-level system roles as user-visible reminders
- Added `ClaudeMessageSystemReminderText` to convert system content into user-readable reminder text.
- Updated translators (Antigravity, Gemini, Codex, OpenAI) to wrap `system` roles as reminders with `<system-reminder>` tags.
- Adjusted related test cases to validate reminder wrapping logic.
v7.2.30
2026-06-23 13:43:14 +08:00
Luis Pater
7c390a7a2e feat(runtime): add Claude Code session handling with caching and tests
- Introduced `ClaudeCodeSessionID` resolution logic, preferring headers over payload metadata.
- Added `ClaudeCodePromptCache` to map sessions to stable prompt cache keys.
- Refactored existing logic to integrate `ClaudeCodePromptCache` for session-based handling.
- Included extensive unit tests to validate session ID extraction, cache reuse, and header prioritization.
2026-06-23 13:19:13 +08:00