480 Commits

Author SHA1 Message Date
Luis Pater
5771abbc81 feat(management): add ResetQuota endpoint and auth manager quota reset functionality
- Introduced a new `/reset-quota` API endpoint in the management handler to clear quota and cooldown state for auth records.
- Implemented `ResetQuota` method in the auth manager to handle runtime and registry state resets for affected models.
- Added tests to validate quota reset behavior, including proper state updates and registry consistency.
- Refactored utility functions to support deduplication and registered models handling in quota resets.

Closes: #3866
2026-06-20 13:49:40 +08:00
Luis Pater
a79ae80f6e feat(registry): improve model fallback logic and refactor Claude model handling
- Replaced internal model-specific constants with exported defaults (`DefaultClaudeMaxInputTokens`, `DefaultClaudeMaxOutputTokens`).
- Refactored Claude model formatting to centralize schema application in `formatHomeClaudeModel`, with fields like `type`, `display_name`, and token limits.
- Added new unit tests for fallback behavior, metadata fields, and token handling in Claude and Gemini models.
- Removed deprecated test coverage for Amp provider model routes.

Closes: #3833
2026-06-20 13:09:44 +08:00
Luis Pater
b0ca3794ad Merge pull request #3834 from dcrdev/main 2026-06-20 12:56:25 +08:00
Luis Pater
790ec307f9 feat(config): add support for rebuild_mid_system_message configuration
- Introduced `RebuildMidSystemMessage` field in config to move system messages into the top-level Claude system field.
- Updated executor to handle mid-system message rebuilding when enabled via config or auth attributes.
- Added unit tests to verify rebuilding behavior and default behavior when disabled.
- Updated configuration example and API handlers to support the new field.

Closes: #3792
2026-06-20 12:15:06 +08:00
Luis Pater
041a065b2f Merge branch 'remove-gemini-cli' into dev
# Conflicts:
#	internal/api/handlers/management/auth_files.go
#	internal/thinking/provider/geminicli/apply.go
2026-06-19 14:40:29 +08:00
Luis Pater
d33ac5e1e9 feat(auth): add transient error cooldown configuration and adjust retry logic
- Introduced `SetTransientErrorCooldownSeconds` to enable configurable cooldowns for transient errors (e.g., 408/500/502/503/504).
- Updated retry scheduling logic to use the new `nextTransientErrorRetryAfter` function.
- Modified config parsing to include `transient-error-cooldown-seconds` with support for disabling or defaulting to legacy behavior.
- Expanded tests to validate transient cooldown logic with various configurations and edge cases.

Closes: #3315
2026-06-19 04:26:04 +08:00
Luis Pater
1d0551a991 feat(config): improve config reload handling and introduce async management save hook
- Refactored `ConfigReloadHook` to use `reloadConfigFromWatcher` for consistency.
- Added async `reloadConfigAfterManagementSaveAsync` to handle post-save operations.
- Introduced `ReloadConfigIfChanged` in watcher for manual trigger support.
- Enhanced config reload paths to separate auth synthesis from standard updates.
- Updated `applyConfigUpdate` logic to allow more granular reload behaviors.

Closes: #3235
2026-06-19 03:35:09 +08:00
Luis Pater
41c52b9df6 test(management): add concurrency test for Codex OAuth session handling
- Introduced `TestRequestCodexTokenCompletionKeepsConcurrentSessionPending` to validate proper handling of concurrent OAuth sessions.
- Refactored Codex OAuth logic to use `newCodexOAuthService` for improved testability.

Closes: #3171
2026-06-18 23:15:43 +08:00
Luis Pater
78ba8ba731 chore: remove Gemini CLI-related translator packages and logic
- Deleted `geminicli` provider and related `Apply` logic.
- Removed all translator packages specific to Gemini CLI (Claude, Codex integrations).
- Purged associated test files for Gemini CLI translation.
- Removed `GeminiAuthenticator` and all associated authentication logic (OAuth flows, token handling, refresh logic).
- Deleted internal/executor Gemini OAuth support, including bearer token handling and runtime API logic.
- Purged all tests, configs, and command-line flags specific to Gemini OAuth flows.
- Updated documentation and aliases to reflect Gemini removal.
- Renamed `parseRetryDelay` to `ParseRetryDelay` and `deleteJSONField` to `DeleteJSONField`.
- Updated references in `antigravity_executor` and tests to use the new `helps` package.
- Adjusted import paths and test cases to ensure compatibility with the new location.
- Updated README files to reflect changes in the retry logic references.
- Updated `.github/ISSUE_TEMPLATE/bug_report.md` to remove deprecated Gemini CLI mention.
2026-06-18 13:33:10 +08:00
Luis Pater
acaf250fa8 feat(management): add test to validate priority preservation in auth file uploads
- Implemented `TestUploadAuthFile_PreservesPriorityAttributes` to ensure priority attributes and metadata are preserved during auth file uploads.
- Updated `UploadAuthFile` logic to utilize `SynthesizeAuthFile` for better handling of generated auth attributes and metadata.

Closes: #2924
2026-06-17 21:48:34 +08:00
Luis Pater
8d2c00c107 feat(plugin-config): update default plugin Enabled behavior to false and expand test coverage
- Changed default plugin `Enabled` state from `true` to `false` across configurations, runtime logic, and YAML defaults.
- Added helper function `enabledPluginConfigs` for generating plugin configs with `Enabled` set explicitly.
- Expanded unit tests in `pluginhost`, `config`, and `management` to validate behavior changes for disabled plugins, default settings, and skipped load scenarios.
2026-06-17 03:46:30 +08:00
LTbinglingfeng
09596d2f54 Treat loading plugins as busy 2026-06-17 03:19:31 +08:00
LTbinglingfeng
a3c87ceeb4 Fix management reload snapshot ordering 2026-06-17 03:17:56 +08:00
LTbinglingfeng
7b16321e50 Stabilize management reload race tests 2026-06-17 02:43:12 +08:00
LTbinglingfeng
a4756ab7a9 Use config snapshots for management reload 2026-06-17 02:40:34 +08:00
LTbinglingfeng
a65ced4a92 fix(management): reload plugins asynchronously after changes 2026-06-17 01:06:57 +08:00
Supra4E8C
e40599831a Merge pull request #3850 from router-for-me/feat/log-feat
Feat/log feat
2026-06-15 22:06:38 +08:00
Dominic Robinson
1ed1f7b390 Merge branch 'dev' into main 2026-06-15 14:16:49 +01:00
LTbinglingfeng
0b21b07115 fix log cursor rotation gap 2026-06-15 18:37:21 +08:00
LTbinglingfeng
5036513bf9 Fix ambiguous empty log cursor handling 2026-06-15 16:53:50 +08:00
LTbinglingfeng
a47c386319 Avoid counting all logs for tail reads 2026-06-15 15:51:15 +08:00
LTbinglingfeng
db3fdea4a1 Disambiguate zero-offset log cursors 2026-06-15 15:50:03 +08:00
LTbinglingfeng
917cec3bf6 Continue log cursors across rotation 2026-06-15 15:46:58 +08:00
LTbinglingfeng
3b0cc913ec feat(plugins): implement asynchronous config reload after plugin deletion 2026-06-15 15:35:55 +08:00
Luis Pater
f85768eef3 feat(auth): add config API key exclusion management with tests
- Implemented helper methods `IsConfigAPIKeyAuth` and `toggleConfigAPIKeyExcludedAll` for managing config API key exclusions.
- Updated API request handling to support enabling/disabling config API key exclusion patterns.
- Added test coverage to validate exclusion toggling logic and persistence behavior.
- Refactored duplicate code for identifying config API key auth entries into reusable utilities.
2026-06-15 11:14:05 +08:00
LTbinglingfeng
d417fa534f Bound management log cursor reads 2026-06-15 02:18:58 +08:00
LTbinglingfeng
0d82daca6b Preserve management log line counts 2026-06-15 02:17:57 +08:00
LTbinglingfeng
331daa24ad Read management logs from cursors 2026-06-15 02:10:25 +08:00
LTbinglingfeng
95a72a47c8 Tail management logs with cursors 2026-06-15 02:08:06 +08:00
LTbinglingfeng
c61453a807 Add log cursor helpers 2026-06-15 02:06:25 +08:00
Luis Pater
7de9757c82 feat: add OpenAI video support with improved error handling and response normalization
- Introduced `/openai/v1/videos` endpoint to support OpenAI-specific video generation.
- Added error normalization and handling for OpenAI video resources, including detailed error propagation.
- Enhanced response structure to include OpenAI-specific fields for status, progress, and model mappings.
- Implemented new handlers for video content retrieval and error scenarios.
- Expanded test coverage to validate OpenAI video support, error handling, and backend compatibility.
2026-06-15 01:53:52 +08:00
LTbinglingfeng
6f3bd7641b feat(pluginstore): improve nil checks in pluginStoreSnapshot function 2026-06-15 01:21:07 +08:00
LTbinglingfeng
239d7ee0b0 feat(pluginstore): refactor plugin store source handling to use string URLs 2026-06-15 00:54:32 +08:00
LTbinglingfeng
303c0f2f53 feat(pluginstore): add support for third-party plugin store sources and enhance plugin management 2026-06-15 00:50:22 +08:00
Luis Pater
6f923a28f7 feat(pluginhost): implement host authentication callbacks and add tests
- Introduced `auth_callbacks` for handling host authentication list, get, runtime, and save operations.
- Added extensive unit tests to validate functionality, including disk fallback and runtime-specific cases.
- Created example implementation in Go to demonstrate host callback integrations.
2026-06-14 23:51:40 +08:00
hkfires
b5da088767 fix(home): forward credentials for home models 2026-06-14 22:09:29 +08:00
hkfires
79db0e54be refactor(api): remove deprecated route module interfaces 2026-06-14 20:45:23 +08:00
hkfires
8122b9fe4b feat!: remove amp integration support
BREAKING CHANGE: ampcode configuration, management endpoints, provider
routing, and X-Amp-Thread-Id session affinity are no longer supported
2026-06-14 20:31:00 +08:00
Dominic Robinson
c354f88f3b feat(api): Route Anthropic /v1/models requests to the Claude format
/v1/models is shared by the OpenAI and Anthropic surfaces and was
dispatched to the Claude format only for claude-cli User-Agents, so
generic Anthropic API clients received the OpenAI format. Distinguish
Anthropic requests by the Anthropic-Version header (sent by every
Anthropic client, never by OpenAI/Codex clients) in addition to the
existing claude-cli check, in both unifiedModelsHandler and
handleHomeModels. Additive and non-breaking for existing clients.
2026-06-14 06:03:58 +01:00
LTbinglingfeng
9cdb18e1d6 refactor(plugin): remove timeout handling from plugin installation logic 2026-06-13 21:14:06 +08:00
LTbinglingfeng
b39ee66250 Add plugin store install timeout 2026-06-13 20:56:49 +08:00
LTbinglingfeng
c5cfdb15e5 Add plugin delete management endpoint 2026-06-13 20:52:07 +08:00
LTbinglingfeng
7cd5b15c9b fix: precompute exposed CORS headers 2026-06-13 05:59:18 +08:00
LTbinglingfeng
2659e490a8 fix: expose plugin support header for CORS 2026-06-13 05:53:19 +08:00
LTbinglingfeng
4f5f1b8f2b fix(plugins): guard config read with mutex 2026-06-13 05:05:49 +08:00
LTbinglingfeng
b60ec43944 fix(plugins): expose saved plugin config 2026-06-13 04:51:07 +08:00
LTbinglingfeng
220b4e5bbd feat(management): resolve plugin store versions from latest releases
List entries now show each plugin's latest release version and compute
update availability against it, falling back to the registry version
when the lookup fails. Lookups run concurrently and are cached per
repository with a short failure TTL to respect API rate limits.
2026-06-13 04:05:09 +08:00
LTbinglingfeng
40f4b8b856 feat(pluginstore): fetch and install plugins from latest release
Replace the tag-pinned release lookup with the repository latest
release endpoint. Derive the plugin version from the release tag,
validate it, and attach an optional token to API requests to raise
the rate limit.
2026-06-13 04:00:05 +08:00
Luis Pater
44d3066a9c feat(htmlsanitize): add HTML and JSON sanitization utilities with integration across plugins and APIs
- Introduced `htmlsanitize` package for escaping HTML and handling JSON body sanitization to prevent XSS vulnerabilities.
- Integrated sanitization functions into plugin store, plugin host, and API management handlers to ensure all user-facing content is escaped.
- Added unit tests to verify proper escaping of HTML strings, JSON bodies, and nested data structures.
- Updated existing management and plugin-related tests to validate sanitization implementations.
2026-06-13 01:10:27 +08:00
Luis Pater
60f6a54282 feat(pluginstore, pluginhost): add plugin unload handling and preserve config during plugin updates
- Introduced logic to handle plugin unloading during updates to prevent conflicts with loaded plugins.
- Preserved existing plugin configurations during updates, ensuring seamless transitions and maintaining custom fields.
- Added support for reloading the configuration after management saves changes.
- Enhanced unit tests to validate unloading, configuration preservation, and reloading behaviors.
2026-06-13 00:33:21 +08:00