Commit Graph

675 Commits

Author SHA1 Message Date
Luis Pater
3bbd1652be Merge pull request #6765 from router-for-me/models
fix(api): allow empty home model catalog
2026-10-19 12:26:16 +08:00
hkfires
4d34502f07 fix(api): reject home models error envelopes
Reject any home models payload containing an error key before
parsing provider sections. Array-shaped error values were
previously treated as model sections, masking upstream errors
as valid or empty catalogs instead of returning an error.
2026-10-19 12:11:57 +08:00
hkfires
07feedf7b7 fix(api): allow empty home model catalog
Return an empty catalog when home returns no model records, e.g.
when the client's access scopes have no routes, instead of erroring.
Still reject null payloads, null sections, and non-empty sections
with no usable model IDs as malformed.
2026-10-19 10:30:30 +08:00
Luis Pater
50cfd2380f feat(management): add support for static and plugin model definitions retrieval by channel
- Implement fallback logic in model definitions handler to query plugin host and global registry for unknown channels.
- Add sorting for registry model definitions by provider and ID to ensure consistent responses.

Closes: #6736
2026-10-19 00:23:19 +08:00
Luis Pater
d69962e40c feat(management): add safe Modify method for auth records with epoch validation and locking
- Implement `Modify` method on auth manager to load, clone, edit, and commit records atomically under a per-auth mutation lock.
- Refactor auth field patches and status updates to use the new `Modify` API, preventing race conditions and lost concurrent updates.
- Add comprehensive test coverage verifying concurrent patch operations, token refreshes, removals, and epoch checks.

Closes: #6733
2026-10-18 23:00:32 +08:00
hkfires
3e309fb474 fix(auth): preserve plugin excluded models on synthesis
Stop clearing existing excluded_models attributes in
ApplyAuthExcludedModelsMeta so plugin-provided rules survive
when an auth file defines none; callers rebuilding attributes
must drop stale values first, as PatchAuthFileFields now does.

Also reject config-sourced credentials in PatchAuthFileFields
with 404 and require excluded_models to be a string array or
null, rejecting legacy comma-separated string forms.
2026-10-18 11:53:43 +08:00
hkfires
1a28c61e56 fix(auth): tolerate invalid excluded models on load
Keep existing credentials loading when excluded_models is invalid
instead of dropping them, warning and retaining only valid string
entries. Reject invalid rules at write entry points instead: auth
file uploads now validate before persisting and return 400, and
PATCH validates via the same extractor, accepting the legacy
comma-separated string form and persisting it as a canonical array.

Add regression coverage that a fence-dropped model registration is
replaced by applyConfigRuntime re-registration in Home mode.
2026-10-18 11:53:42 +08:00
hkfires
94d1a9a046 Refactor authentication exclusion handling and improve model registration
- Simplified the ApplyAuthExcludedModelsMeta function to focus solely on credential-specific exclusions, removing unnecessary configuration dependencies.
- Updated tests to reflect changes in the exclusion handling logic, ensuring that credential-level exclusions take precedence over global configurations.
- Removed the metadata_exports.go file as it was no longer needed.
- Enhanced model registration logic to maintain global exclusion summaries and prevent obsolete configurations from affecting new registrations.
- Introduced new tests to verify that global exclusions are retained after authentication updates and that irrelevant config reloads do not discard valid registrations.
- Improved the handling of plugin model providers to ensure that exclusion rules are correctly applied and updated.
2026-10-18 11:52:09 +08:00
Supra4E8C
b015f208d2 fix(oauth): restore credential exclusion priority 2026-10-18 11:34:11 +08:00
Luis Pater
fa68946ad5 feat(management): add optimistic concurrency control with ETag and If-Match to v8 config endpoints
- Implement ETag generation using SHA-256 source hashes on v8 management config reads.
- Enforce RFC 9110 If-Match validation on mutating requests to prevent stale overwrites.
- Expose ETag headers for CORS and mask sensitive `value` query parameters in request logs.

Closes: #6666
2026-10-16 07:20:24 +08:00
Luis Pater
1631875b9a fix(watcher): guard management saves against stale config reloads and serialize file updates
- Add `SourceHash` tracking to config parsing to identify stale config file reloads.
- Reject reloads in management handlers and watchers if they are based on an older file snapshot.
- Serialize concurrent config reloads and secure lock handling in basic/list management endpoints.

Closes: #6631
2026-10-15 09:56:31 +08:00
Luis Pater
345cc9d5a8 feat(claude): add timeout and retry logic for silent TLS handshakes
Closes: #6615
2026-10-14 20:23:35 +08:00
Rat0323
50eaed0d16 feat(pluginapi): expose config field defaults 2026-10-14 20:23:34 +08:00
Luis Pater
81573f0429 fix(server): prevent data races during concurrent config access and reloads
- Access configuration safely via getters across server routes, middleware, and service routines.
- Clone configuration snapshots for runtime and synchronize access in management handlers.
- Guard configuration YAML snapshots with mutex locks during reloads.

Closes: #6592
2026-10-14 05:07:44 +08:00
Luis Pater
e235fb3d64 fix(server): prevent data races during concurrent config access and reloads
- Access configuration safely via getters across server routes, middleware, and service routines.
- Clone configuration snapshots for runtime and synchronize access in management handlers.
- Guard configuration YAML snapshots with mutex locks during reloads.

Closes: #6559
2026-10-13 07:04:51 +08:00
Luis Pater
dd7b433492 feat(server): support max-request-body-bytes request body limit
Closes: #6550
2026-10-12 20:21:50 +08:00
hkfires
3d61c9542c fix(management): conditionally expose quota_plugin_id for v8 auth files 2026-10-12 16:17:50 +08:00
hkfires
0c7084019b fix(management): resolve v8 plugin quota contract gaps
Expose quota_plugin_id on credential entries using the host's two-pass selection precedence, excluding fused plugins and selecting healthy alternatives.

Stop advertising declarative quota_probe support in v8 while preserving v0 behavior. Add regression tests for selection precedence, plugin fusion, and version-specific quota metadata.

Fixes #6519
2026-10-12 15:50:00 +08:00
Luis Pater
03a3cfecb5 feat(claude): honor upstream.claude.tool-search in executor, catalog and server 2026-10-11 14:08:49 +08:00
Luis Pater
11f04c2077 feat(codex): advertise tool search only for natively supported Claude routes 2026-10-11 11:09:17 +08:00
gitrvc-hub
a68ad1344f fix(claude): address tool_search review findings
Enable deferred filtering only when the client tool_search declaration
wins the tool_search name, so a same-named user function keeps the
deferred tools. Pass Home catalog provider routes to the search
capability check so Claude-only Home models advertise tool search.
2026-10-10 15:30:40 -04:00
Luis Pater
37fe2608ee feat(usage): propagate access provider and native key metadata to usage records
- Inject API key, access provider, and native key flags into the request context during authentication
- Add `IsNativeKey` and `AccessProvider` fields to usage records, plugin API types, and redis queue payloads
- Provide context helper functions and automatic fallback resolution in the usage manager and reporter

Closes: #6509
2026-10-10 22:16:00 +08:00
Luis Pater
0a23627d22 fix(config): normalize collection styles and unquote mapping keys in v8 api
- Export `NormalizeCollectionNodeStyles` to traverse document nodes and clear double quotes from string mapping keys
- Apply collection style normalization before YAML marshaling in the v8 management config handler

Closes: #6451
2026-10-08 13:20:41 +08:00
Supra4E8C
7c41cd05e4 feat: add global server GitHub token configuration 2026-10-08 00:33:27 +08:00
luohui1
6a853dce05 feat(xai): expose Grok TTS on /v1/audio/speech
Route OpenAI speech requests to the official xAI /tts endpoint and register grok-tts and grok-voice-tts-1.0.
2026-10-06 02:49:21 -07:00
Luis Pater
c997cbb58a feat(httpwire): introduce error-aware response flushing helper
- Add `FlushResponse` to prefer error-aware flushing and unwrap wrapped response writers
- Bypass Gin's void `Flush` while maintaining header accounting via `WriteHeaderNow` to keep transport errors observable

Closes: #6332
2026-10-04 17:33:19 +08:00
Luis Pater
cbc4cd5532 feat(interactions): support antigravity session continuation and model detail lookup
- Add `InteractionsSessionCache` to preserve Antigravity interaction continuations across tool call rounds
- Automatically restore and inject `previous_interaction_id` and `environment_id` in Gemini interactions executor
- Normalize Antigravity tool identity mappings in OpenAI responses translator
- Add `/v1/models/*model` endpoint to support retrieving individual model details

Closes: #5190
2026-10-04 04:23:31 +08:00
Luis Pater
0fb50a18c3 feat(management): inject auth indexes into v8 api-keys config
- Synthesize and populate live `auth_index` attributes into V8 `api-keys` responses
- Strip transient `auth_index` and `auth-index` fields from incoming update payloads and root nodes before persistence
- Ensure `auth_index` keys are omitted during V8 config transformations

Closes: #6287
2026-10-03 02:32:15 +08:00
Luis Pater
d306f2c56d fix(codex): retain template freeform apply_patch capability by default
- Retain `freeform` apply_patch tool type for native template models when `enable-apply-patch` is false
- Update client configuration documentation for `client.codex.enable-apply-patch`

Closes: #6286
2026-10-03 00:01:42 +08:00
hkfires
3be5fa44f9 fix(config): support historical v8 aliases
Accept historical v8 config paths and request bodies while saving the
latest canonical layout. Preserve comments on scalar updates and keep v0
saves from migrating legacy-only files unnecessarily.
2026-10-02 22:36:37 +08:00
hkfires
52d5507dd3 feat(config): add shared upstream provider settings
Move shared Codex, Claude, and xAI provider options under upstream so
they apply consistently to OAuth and API-key credentials. Migrate
historical OAuth paths, preserve OAuth-only header scope, and expose the
new upstream management API path.
2026-10-02 22:36:35 +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
Supra4E8C
097511b81f fix(management): remove deprecated credential quota endpoints from v8 API 2026-09-30 22:52:07 +08:00
Supra4E8C
775a308f0d test(config): add test for DELETE operation preserving document presence 2026-09-29 15:20:43 +08:00
Luis Pater
df2774ca18 feat(oauth): support per-channel model settings overrides
- Add `oauth-settings` configuration to override model capabilities such as `max-context-length`
- Implement sanitization, YAML preservation, and live reload diff detection for OAuth settings
- Apply OAuth model settings during model resolution and Codex model list responses

Closes: #6099
2026-09-29 11:43:51 +08:00
Luis Pater
d33f63f8e3 feat(logging): switch request ID generation to UUIDv7
- Generate UUIDv7 request IDs using crypto random source
- Add `ShortRequestID` helper to truncate IDs to 8 trailing characters in log output and filenames
- Update management log handlers to match log files using short request IDs
2026-09-29 00:45:52 +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
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
4a2c81864f fix(config): preserve unknown legacy sections as comments during v8 migration
- Retain obsolete and unknown root sections as comments instead of dropping them during v8 migration
- Defer removal of deprecated legacy blocks so they can be preserved as comments during layout normalization
2026-09-27 20:17:03 +08:00
Luis Pater
6c385e6069 fix(config): drop obsolete legacy keys during v8 migration
- Remove obsolete `home` and `enable-gemini-cli-endpoint` root keys when migrating configuration to version 8
2026-09-27 19:57:28 +08:00
Luis Pater
31f4cfab3f feat: migrate CLIProxyAPI to version 8 2026-09-27 14:42:26 +08:00
hkfires
9a0502c87e feat(api): use query params for v8 oauth routes 2026-09-27 14:16:28 +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
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
5530cbd2a5 fix(auth): preserve attributes and path across plugin refreshes
- Merge existing auth attributes and preserve file path metadata across plugin refreshes
- Avoid overwriting existing source and path attributes during auth data conversion
- Retry file stat during atomic replace to prevent premature removal of known auth files

Closes: #6119
2026-09-25 11:55:21 +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
Luis Pater
759c57c261 fix(api): immediately close connections on stop and guard state access
- Switch HTTP server stop from graceful shutdown to immediate close to prevent hanging on active requests
- Guard listeners and configuration access with dedicated mutexes
- Instantiate service shutdown context with a fresh timeout deadline upon exit

Closes: #6094
2026-09-24 23:31:51 +08:00
Luis Pater
c404af96eb fix(auth): preserve file priority across plugin auth refreshes
- Introduce `AttributeFilePriority` and helper to track priority inherited from auth files
- Preserve file-configured priority attributes and metadata in plugin host during auth refresh
- Apply file priority metadata consistently across synthesizer, token filestore, and management handlers

Closes: #6089
2026-09-24 08:09:21 +08:00
Luis Pater
e6fcfa34ba fix(logging): prevent request log collisions and select latest log by ID
- Switch request ID generation to an atomic incrementing 8-character hex counter
- Create unique log files with numeric sequence fallback to prevent overwriting existing logs
- Select the latest log file matching request ID based on modification time and filename sequence in management API
2026-09-23 13:03:05 +08:00