Commit Graph
471 Commits
Author SHA1 Message Date
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 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
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
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
Luis Pater 049ced5c3f feat(pluginhost, api): add support for "X-CPA-SUPPORT-PLUGIN" header with CGO detection
- Introduced `SupportPluginHeaderValue` to indicate CGO build status (`1` for enabled, `0` for disabled).
- Updated API response headers in `handler.go` to include "X-CPA-SUPPORT-PLUGIN".
- Added unit tests to verify proper header behavior under varying conditions.
2026-06-12 23:54:26 +08:00
LTbinglingfeng e38ba28db5 feat(pluginstore): add plugin store support 2026-06-12 23:15:00 +08:00
Luis Pater 8e39db2ec7 feat(plugin, api): introduce host model callback support with Go example and API handlers
- Added an example plugin `host-model-callback` in Go to summarize host model callbacks.
- Implemented `cliproxy_plugin_init`, `cliproxyPluginCall`, and other plugin functions for callback handling.
- Introduced API handlers for `ModelExecution` and `ModelExecutionStream` with support for both streaming and non-streaming requests.
- Included unit tests (`model_execution_test.go`) to validate execution logic and streaming responses.
2026-06-12 02:22:23 +08:00
Luis Pater 44ea9abced feat(pluginhost): introduce browser-navigable plugin resources in Management API
- Added `resources` field in `management.register` for defining browser-accessible resources.
- Updated examples and documentation to reflect resource-based paths under `/v0/resource/plugins/<pluginID>/...`.
- Replaced legacy `GET` menu routes with resource-based implementations for consistent plugin behavior.
- Enhanced request handling for resource paths, including proper response headers and streamlined test coverage.
2026-06-09 22:46:27 +08:00
Luis Pater 1762ee0d2e feat(pluginhost): add support for interceptors and metadata sanitization
- Implemented `RequestInterceptor`, `ResponseInterceptor`, and `StreamChunkInterceptor` capabilities.
- Added `sanitizePluginMetadata` to clean metadata for RPC compatibility.
- Enhanced interceptor chaining, error handling, and test coverage.
- Updated plugin configuration to register and dispatch interceptor methods.
2026-06-09 01:41:46 +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.
2026-06-07 03:20:04 +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 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.
2026-06-05 01:48:05 +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
2026-06-04 00:53:43 +08:00