Commit Graph

129 Commits

Author SHA1 Message Date
Blackoutta b86f12fbaa Add Redis caching to FetchPluginInstallation middleware for performance optimization (#400)
* add caching to fetch plugin installation middleware

* invalidate plugin inst cache after successfully upgrading or uninstalling operations

* optimize: refactored cache invalidation ops from curd layer to service layer

---------

Co-authored-by: yangyi.hu593671 <yangyi.hu593671@seres.cn>
2025-08-27 14:16:52 +08:00
Yeuoly 33c023b375 refactor(plugin_manager): enhance HTTP client timeout handling in ser… (#385)
* refactor(plugin_manager): enhance HTTP client timeout handling in serverless runtime with DialContext

- Updated the HTTP client in the ServerlessPluginRuntime to use a context-aware DialContext for better timeout management.
- Removed the write timeout option from the HTTP request builder, streamlining the request handling process.
- Improved connection handling by setting write deadlines based on the PluginMaxExecutionTimeout.

This change enhances the reliability of network operations within the serverless runtime environment.

* refactor(plugin_manager): remove write deadline setting in serverless runtime connection initialization

- Eliminated the write deadline setting from the connection initialization in the ServerlessPluginRuntime.
- This change simplifies the connection handling process and aligns with the recent enhancements to timeout management.

This update contributes to a more streamlined and efficient network operation within the serverless environment.

* refactor(plugin_manager): adjust HTTP client timeout settings in serverless runtime

- Modified the HTTP client configuration in the ServerlessPluginRuntime to set the TLS handshake timeout based on PluginMaxExecutionTimeout.
- Retained the IdleConnTimeout setting to ensure consistent connection management.

This update improves the timeout handling for secure connections, enhancing overall network reliability in the serverless environment.
2025-07-09 17:43:24 +08:00
Yeuoly 7bb6406894 test(stream): add delay in TestStreamCloseBlockingWrite to ensure blocking write completion (#365) 2025-06-26 11:54:54 +08:00
Yeuoly 1e260eedf4 refactor: using length-prefixed chunking for Backwards invocations (#342)
- Adjusted the header byte manipulation in chunking functions to correctly use the first four bytes for data length.
- Modified the HTTP request streaming function to include the length-prefixed option for improved data handling.
2025-06-11 16:01:53 +08:00
Yeuoly ac6441746d feat: add length-prefixed HTTP chunking functionality (#341)
- Introduced new constants for HTTP option types to improve code readability and maintainability.
- Updated existing HTTP option functions to utilize the new constants.
- Implemented line-based and length-prefixed chunking methods for improved data processing in HTTP requests.
- Added comprehensive tests for chunking functionality to ensure reliability and correctness.
2025-06-11 14:45:21 +08:00
湛露先生 412084b1d8 fix build error, go.mod upgrade for github.com/panjf2000/ants/v2 (#323)
Signed-off-by: zhanluxianshen <zhanluxianshen@163.com>
2025-06-03 16:17:11 +08:00
Yeuoly 052cd0c410 fix: remove redundant Content-Type header for payloadReader in HTTP request builder (#320) 2025-05-30 18:49:19 +08:00
Yeuoly f8914412d9 fix: support serverless plugin management with execution timeout (#318)
- Added `pluginMaxExecutionTimeout` to `PluginManager` for configurable execution limits.
- Updated `ServerlessPluginRuntime` to utilize the new timeout setting in HTTP requests.
- Refactored AWSPluginRuntime references to ServerlessPluginRuntime for consistency across the codebase.
2025-05-30 18:08:24 +08:00
Yeuoly 8380c1d6fa fix(lock): Add concurrency test for Redis lock functionality (#305)
- Introduced a new test case `TestLock` to validate the behavior of the Redis locking mechanism under concurrent access.
- Enhanced the `Lock` function to improve error handling and ensure proper locking behavior.
- Utilized `sync.WaitGroup` and atomic operations to measure wait times during lock acquisition, ensuring the lock behaves as expected under high concurrency.
2025-05-23 14:39:37 +08:00
Zhi 6b112bc8b5 feat(redis): Add support for Redis Sentinel mode (#276)
* feat(redis): Add support for Redis Sentinel mode

Added support for Redis Sentinel mode to the Redis client, enabling automatic discovery and connection to the primary node through Sentinel. Updated relevant configuration files and initialization logic to support Sentinel mode configuration and connection.

* add lost RedisUser.
2025-05-20 14:23:01 +08:00
Yeuoly 31d7c7417e feat[0.1.0]: introduce 'run' command for local plugin execution (#283)
* feat: introduce 'run' command for local plugin execution

- Added a new command `run` to launch plugins locally, allowing communication through stdin/stdout.
- Removed the previous `test` command and its associated functionality to streamline the plugin testing process.

* feat: enhance 'run' command with TCP support

- Introduced a new `RunPluginPayload` structure to encapsulate plugin execution parameters.
- Added TCP communication mode to the `run` command, allowing multiple client connections.
- Updated command flags to configure run mode and logging options.
- Implemented client handling and server creation for both stdin/stdout and TCP modes.

* docs: improve comments in RunPlugin function for clarity

- Enhanced comments to provide clearer explanations of the plugin decoding process and the creation of client streams for both stdin/stdout and TCP modes.
- Updated comments to reflect the functionality and behavior of the plugin execution flow.

* refactor: update command structure and enhance plugin invocation handling

- Changed the command structure to add `runPluginCommand` under `pluginCommand` for better organization.
- Introduced `InvokePluginPayload` type to encapsulate plugin invocation details.
- Enhanced `RunPlugin` function to handle responses and errors more effectively, including logging to stdout.
- Updated client handling to support session management and improved error handling during plugin invocation.
- Renamed TCP server creation function for consistency.

* feat: enhance plugin response handling and logging capabilities

- Added a new flag `--response-format` to specify the output format (text or json) for plugin responses.
- Introduced a `logger` to manage logging output to stdout with timestamps and file information.
- Updated `logResponse` and `systemLog` functions to handle different response formats.
- Enhanced `handleClient` and `RunPlugin` functions to utilize the new response format feature.
- Implemented signal handling to clean up temporary directories on shutdown.

* feat: enhance plugin response structure and logging

- Added `InvokeID` to `InvokePluginPayload` and `GenericResponse` for better tracking of plugin invocations.
- Updated `logResponse` to include `InvokeID` in error responses for improved debugging.
- Enhanced client handling in `handleClient` to log plugin readiness and received requests.
- Refactored client stream creation for better readability and consistency.

* feat: add plugin invoke end response type and logging

- Introduced `GENERIC_RESPONSE_TYPE_PLUGIN_INVOKE_END` to enhance response tracking for plugin invocations.
- Updated `handleClient` to log the end of plugin invocation, improving visibility into the plugin lifecycle.

* chore: remove fullfeature tags
2025-05-16 14:20:29 +08:00
Taeyoung Park 5d83258371 Add optional Redis username authentication (#218)
* You can include username for Redis Auth

* Redis auth with username - test code update

* fix: tests

---------

Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-04-25 20:42:14 +08:00
Yeuoly 9730b7dc63 tests: enhance integration testing for specific plugins (#242)
* feat: enhance integration testing for specific plugins

- Added integration tests for the official agent, including test data for agent strategy invocation.
- Introduced JSON schema generation and validation utilities to ensure proper request formatting.
- Enhanced mock invocation handling in the plugin manager to support tool parameters.
- Added new test utilities for simulating OpenAI server responses and managing plugin runtime.

* fix: update RunOnce function to return response stream and enhance integration test

- Modified the RunOnce function to return a response stream instead of an error, allowing for better handling of streamed responses.
- Updated the integration test for the official agent to read from the response stream, ensuring proper validation of the agent strategy invocation.
2025-04-24 16:33:50 +08:00
Yeuoly 2d216df27a feat: add benchmark workflow (#216)
* feat: add benchmark workflow

- Introduced a GitHub Actions workflow for benchmarking Go code, triggered on pushes to the main branch and pull requests.
- Added a benchmark test for the stream package to measure performance of the Write method under concurrent conditions.

* fix: setup license

* fix: exclude non-benchmark

* fix: stash license

* chore: update triggers

* update README
2025-04-16 21:23:54 +08:00
Yeuoly 0a74b44f11 refactor(plugin_daemon): simplify InvokeTool function and enhance stream handling (#208)
* refactor(plugin_daemon): simplify InvokeTool function and enhance stream handling

- Removed unnecessary complexity from the InvokeTool function by eliminating the blob handling logic and directly returning the response.
- Updated the stream implementation to support blocking writes, allowing for better management of data flow when the buffer is full.
- Added tests for the new blocking write functionality to ensure reliability and performance under high load conditions.

* fix: buffer size
2025-04-15 19:13:24 +08:00
非法操作 25e013618a fix self.session.delete alway success (#12)
* fix self.session.delete alway success

* fix save data always failed

* redis delete response deleted item num

* add deleted num to invocate response
2025-04-11 13:32:52 +08:00
Yeuoly 36e7a10169 fix: cobr unmarshal map[string]any to map[any]any, feat: add tests for redirecting traffic with path style and refactor redirect request logic 2025-04-08 13:51:26 +09:00
zxfishhack c7a104b07b fix unit test 2025-03-31 14:54:01 +08:00
Yeuoly b5fefd1a99 Merge pull request #152 from quicksandznzn/add-redis-db-config
optimize: add redis db config
2025-03-30 21:10:27 +09:00
Yeuoly fdf260cc41 Merge pull request #160 from lengyhua/main
fix: thread safety issue and len inaccuracy in Map
2025-03-30 20:27:11 +09:00
Yeuoly 77f6e756c5 Merge pull request #159 from langgenius/fix/marshal-any-map
feat: add ConvertAnyMap function and corresponding tests for map conv…
2025-03-30 20:10:43 +09:00
lengyhua c904632417 fix: thread safety issue and len inaccuracy in Map 2025-03-29 01:14:30 +08:00
Yeuoly 084c4a24ad feat: add ConvertAnyMap function and corresponding tests for map conversion 2025-03-29 02:02:59 +09:00
Yeuoly 14e303bfa1 Merge pull request #155 from zxfishhack/add-get-delete-for-internal-use
Add get/delete implement, for internal use.
2025-03-29 00:07:56 +09:00
Yeuoly 900af90e0b Merge pull request #135 from AkisAya/feat/enhance-s3-compatible
make pathStyle param configurable when using s3 compatible storage
2025-03-28 23:48:27 +09:00
zxfishhack 5cfd484cff Add get/delete implement, from internal use. 2025-03-27 17:02:21 +08:00
quicksandzn b50a0c4403 optimize: add redis db config 2025-03-27 14:48:59 +08:00
zxfishhack 3c49043a32 BUGFIX: fix AutoGetWithGetter will never hit cache issue. 2025-03-24 17:14:28 +08:00
zxfishhack 7d8a655ef6 BUGFIX: fix AutoGetWithGetter will never hit cache issue. 2025-03-24 17:02:28 +08:00
akisaya a6e73807f1 remove S3_BUCKET_NAME in env.example & fix some logs 2025-03-22 18:42:33 +08:00
Yeuoly 324cea6c2b fix: improve Redis subscription error handling with logging and retry (#84) 2025-03-10 13:43:04 +08:00
Junious_Cheng b27beb5a3d fix: remove duplicate code (#75) 2025-03-07 17:58:41 +08:00
Yeuoly 541050b9da refactor: update Redis cache SetNX method to use CBOR encoding 2025-02-25 23:12:05 +08:00
Yeuoly 2dc8f0c01d fix: improve Redis cache Get method for CBOR decoding 2025-02-25 22:45:06 +08:00
Yeuoly 6d63795993 refactor: switch Redis cache from JSON to CBOR encoding 2025-02-25 22:40:47 +08:00
Yeuoly b19140ca23 refactor: optimize plugin declaration caching and encoding (#34) 2025-02-25 20:52:51 +08:00
Yeuoly 87463a23c7 refactor: using lowercase to hook id 2025-02-11 22:02:21 +08:00
Yeuoly 507cf3722d fix: undercase to snakecase 2025-02-10 16:02:38 +08:00
Masashi Tomooka c6c882e86a support REDIS_USE_SSL config parameter (#21)
* support REDIS_USE_SSL config parameter

* fix tests

* add tests
2025-01-30 00:32:38 +08:00
Yeuoly 6444214942 Revert "Revert: refactor: serverless connector This reverts commit b413e6c96546cc50b1dbc94731d24f5c51e7a455."
This reverts commit d08d78e8b2.
2025-01-14 16:31:13 +08:00
Yeuoly d60f60ba09 fix: process does not exist when panic 2025-01-14 14:58:48 +08:00
Yeuoly d08d78e8b2 Revert: refactor: serverless connector This reverts commit b413e6c965. 2025-01-09 14:24:10 +08:00
Yeuoly 8874762c68 fix: adapter to new serverless connector 2025-01-08 18:31:10 +08:00
Yeuoly b413e6c965 refactor: serverless connector 2025-01-08 16:57:21 +08:00
Yeuoly 673cb35017 fix: change log trace depth to 3 2025-01-07 15:27:12 +08:00
Yeuoly 15060ee312 refactor: move entities to pkg 2025-01-06 14:52:02 +08:00
Yeuoly 0b6d97cd51 improve: add launched_at to routine.Submit 2024-12-19 17:18:45 +08:00
Yeuoly bc27da9524 fix: avoid writing logs into file 2024-12-19 16:18:30 +08:00
Yeuoly 9ef9f16e6e feat: support for sentry 2024-12-17 20:51:14 +08:00
Yeuoly 407fb941ca feat: support for pprof 2024-12-04 14:15:16 +08:00