Commit Graph

396 Commits

Author SHA1 Message Date
Stream 2c87f0ac8b Merge branch 'feat/plugin-readme' into feat/trigger
# Conflicts:
#	internal/db/init.go
2025-10-23 11:26:38 +08:00
Harry 5e4319d8a3 fix(plugin): add recovery mechanism in OnTraffic to handle panics
- Introduced a deferred function in OnTraffic to recover from panics, logging the error and stack trace for better debugging.
- This enhancement improves the stability of the DifyServer by preventing crashes due to unexpected runtime errors.
2025-10-13 16:46:34 +08:00
Harry 27f3d3ad8d refactor(trigger): rename TriggerInvoke to TriggerInvokeEvent and update related structures
- Renamed TriggerInvoke function and associated request/response types to TriggerInvokeEvent for improved clarity.
- Updated routing and controller methods to reflect the new naming convention.
- Ensured all references to the trigger invoke functionality are consistent with the new event terminology.
2025-10-10 19:48:23 +08:00
Harry 4c7b399e60 Merge remote-tracking branch 'origin/main' into feat/trigger 2025-09-29 18:52:44 +08:00
Yeuoly 057d8ec0e4 Check manifest when saving plugin packages (#467) 2025-09-29 18:17:06 +08:00
Harry 1dcee066a3 Merge remote-tracking branch 'origin/main' into feat/trigger 2025-09-26 12:04:54 +08:00
Yeuoly 878edde455 feat(datasource): Implement datasource validation and invocation steps (#295)
* feat(datasource): Implement datasource validation and invocation steps

- Added new functionality for validating datasource credentials and invoking the first and second steps of the datasource process.
- Introduced new API endpoints for datasource operations in the HTTP server.
- Created corresponding service and controller methods to handle datasource requests.
- Defined new request and response structures for datasource operations in the entities package.

* feat: add routes

* feat(datasource): Add initial datasource models and validation

- Introduced new `DatasourceInstallation` model to represent datasource installations with relevant fields.
- Created `datasource.go` file for future datasource service implementation.
- Enhanced `datasource_declaration.go` with new types and validation functions for datasource provider and parameters.
- Updated `plugin_declaration.go` to include datasource support in plugin structures.
- Refactored `agent_declaration.go` and `tool_declaration.go` to use a unified `ParameterOption` type for options.

* refactor(datasource): Update request and response types for online document content retrieval

- Renamed and updated request and response types for the `DatasourceGetOnlineDocumentPageContent` function to improve clarity and consistency.
- Introduced `RequestInvokeOnlineDocumentDatasourceGetContent` and `DatasourceInvokeOnlineDocumentGetContentResponse` types.
- Adjusted related function signatures and dispatchers to reflect the new types across the datasource service and controller implementations.

* feat(datasource): Implement datasource installation handling

- Added functionality to create and update `DatasourceInstallation` records during plugin installation and upgrade processes.
- Enhanced the `InstallPlugin` function to create a new datasource installation if a datasource declaration is present.
- Updated the `UpgradePlugin` function to handle the deletion of the original datasource installation and creation of a new one if the datasource declaration changes.

* feat(datasource): Add datasource registration handling in plugin runtime

- Introduced handling for datasource declarations in the plugin runtime.
- Updated `RemotePluginRuntime` to track datasource registration status.
- Enhanced message processing to include validation and assignment of datasource declarations.

* feat(datasource): Implement datasource listing and retrieval endpoints

- Added `ListDatasources` and `GetDatasource` functions to the service layer for handling datasource queries.
- Created corresponding controller methods to process HTTP requests for listing and retrieving datasources.
- Implemented request validation for tenant ID, page, page size, plugin ID, and provider parameters.

* add datasource routes

* feat(datasource): Add icon remapping for datasource declarations

- Implemented functionality to remap icons for both the main datasource and its individual datasources within the plugin declaration.
- Enhanced error handling to provide clearer feedback when remapping fails.

* fix(datasource): update OAuthSchema validation to remove unnecessary 'dive' tag

- Modified the validation tag for OAuthSchema in DatasourceProviderDeclaration to simplify the validation process by removing the 'dive' requirement.

* feat(tests): add datasource declaration parsing and output

- Introduced a new main.go file for testing datasource declaration parsing.
- Implemented JSON unmarshalling for RemotePluginRegisterPayload and DatasourceProviderDeclaration.
- Added a sample datasource declaration for testing purposes.

* fix(plugin): improve error handling in UninstallPlugin and add datasource deletion

- Enhanced error handling to return a specific message when a plugin is not installed.
- Added functionality to delete the associated datasource installation during the uninstallation process.

* feat(datasource): add support for decoding datasource provider declaration

- Added custom JSON marshalling and unmarshalling methods to handle CredentialsSchema and Datasources more effectively.
- Improved error handling during YAML unmarshalling to support both object and array formats for CredentialsSchema.
- Ensured proper initialization of DatasourceFiles and Tags to prevent nil references.

* fix: provider type

* refactor(datasource): simplify JSON unmarshalling for CredentialsSchema

- Removed complex handling of CredentialsSchema in the UnmarshalJSON method, focusing on the Datasources field.
- Streamlined the code to improve readability and maintainability by eliminating unnecessary checks and logic related to CredentialsSchema.

* feat: streaming datasource

* feat: datasource

* feat: datasource

* feat:datasource

* feat:datasource

* feat:datasource

* feat: add redirect_uri field to OAuth request structs

* feat: add online driver file request and response structures

* feat: add online driver file request and response structures

* feat: add online_driver datasource type to validation

* feat: rename online driver to online drive and update related classes and methods :)

* refactor: rename OnlineDocumentPageChunk to DatasourceGetPagesResponse and update related references

* feat: update request types for online drive browsing and downloading

* feat: add metadata field to OAuthGetCredentialsResult

* feat: built-in json schema definations

* feat(plugin_entities): add built-in schema definitions and processing for datasource YAML

* test(plugin_entities): add unit tests for schema definitions and YAML processing

* refactor(plugin_entities): centralize built-in schema definitions and processing

* refactor(plugin_entities): remove unused properties from built-in schema definitions

* refactor(plugin_entities): built-in schema & new datasource structure

* refactor(plugin_entities): enhance schema processing with  checks and error handling

* refactor(plugin_entities): update validation for OnlineDriveBrowseFilesRequest prefix field to be optional

* refactor(json_schema): remove json schema definitions and validation

* fix(plugin_entities): remove output_schema validation tests

* feat: add rag tag

---------

Co-authored-by: Harry <xh001x@hotmail.com>
Co-authored-by: Dongyu Li <544104925@qq.com>
Co-authored-by: Novice <novice12185727@gmail.com>
2025-09-16 17:32:14 +08:00
Yunlu Wen e6bb4967a8 fix lock release (#447) 2025-09-12 19:30:01 +08:00
Harry 1ca6c35697 feat: add remapping for trigger icons in MediaBucket
- Enhanced the RemapAssets function to include remapping of trigger identity icons and dark icons.
- Added error handling for remapping failures to ensure robust asset management.

These changes improve the handling of trigger assets within the plugin system, ensuring icons are correctly remapped as needed.
2025-09-05 12:03:12 +08:00
Yunlu Wen a4c32d32ea feat: propagate plugin unique identifier to serverless control plane (#428)
* feat: propagate plugin unique identifier to serverless

* resolve conflict
2025-09-03 11:01:48 +08:00
Harry 390b7641ea Implement trigger functionality and clean up dynamic select code
- Added new trigger-related access types and actions in access.go.
- Introduced new HTTP routes for trigger operations in http_server.gen.go.
- Updated plugin declaration to include triggers in plugin_entities.
- Removed unused dynamic select service and controller files.
- Enhanced message handling in debugging_runtime to support trigger registration.

This update enhances the plugin system by integrating trigger capabilities while cleaning up legacy code.
2025-09-02 16:28:19 +08:00
Yeuoly 604da5d495 refactor: rename AWS references to Serverless in plugin daemon (#437)
- Updated AWS-related types and functions to reflect Serverless terminology, including renaming `AWSTransactionHandler` to `ServerlessTransactionHandler` and `AWSTransactionWriter` to `ServerlessTransactionWriter`.
- Adjusted error messages and comments to align with the new naming conventions.
- Modified installation functions to use Serverless terminology for clarity and consistency across the codebase.
2025-08-28 18:24:22 +08:00
Stream 5134f3b5d0 feat: add plugin asset extraction endpoint with caching support 2025-08-27 18:54:56 +08:00
kuangzhiqiang 6c03c1b3c8 fix Frequent plugin pulls (#420)
Co-authored-by: kuangzhiqiang <kuangzhiqiang@xiaomi.com>
2025-08-27 14:16:31 +08:00
Yeuoly b286be778e chore: remove JSON schema validation from tool and agent services (#430)
* chore: remove JSON schema validation from tool and agent services

- Remove bindAgentStrategyValidator and bindToolValidator functions
- Remove gojsonschema dependency
- Simplify InvokeAgentStrategy by removing validation logic
- Consolidate tool invocation into generated code
- Remove redundant tool_service.go and related test files
- Move InvokeTool to generated files for consistency

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: remove duplicated routes

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-26 20:36:25 +08:00
Betula-L 21015d4474 fix credential type (#419) 2025-08-08 21:56:34 +08:00
Yeuoly 222ab80a6b refactor(session_manager): update GetSession function to return error (#413)
- Modified GetSession to return an error alongside the session, improving error handling when a session is not found.
- Updated invocation of GetSession in AWS event handler to handle the new error return value.
- Removed logging statements in favor of returning errors directly for better error propagation.
2025-07-24 13:40:38 +08:00
Yeuoly bace3bfb58 feat(oauth): implement refresh credentials functionality (#408)
* feat(oauth): implement refresh credentials functionality

- Added RefreshCredentials endpoint to handle OAuth credential refresh requests.
- Introduced RequestOAuthRefreshCredentials structure for request validation.
- Updated access types and actions to include refresh credentials.
- Enhanced server routing and controller logic to support the new functionality.
- Updated OAuth entities to include expiration handling for refreshed credentials.

* feat(oauth): add metadata field to OAuthGetCredentialsResult

---------

Co-authored-by: Harry <xh001x@hotmail.com>
2025-07-23 13:11:36 +08:00
Maries a0414b30e6 0.2.0 (#402)
* feat(oauth): add RedirectURI field to OAuth request structures

* feat(oauth): update OAuthSchema validation

* feat: add Context field to request and session structures

* feat: add CredentialType field to Credentials and InvokeToolRequest structures

* fix: handle unhandled default case in basic_type.go

* feat: add support for build branches in build-push.yml
2025-07-17 16:28:43 +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 7bc3b7565e feat(plugin_manager): enhance asset remapping for icons (#392)
- Refactored the RemapAssets function to streamline the remapping of icon fields for both models and tools, including support for dark mode icons.
- Introduced new fields IconSmallDark and IconLargeDark in the ModelProviderDeclaration and added IconDark in ToolProviderIdentity to accommodate dark mode assets.
- Improved error handling during the remapping process for better clarity and maintainability.
2025-07-09 17:02:57 +08:00
homejim 6ae762ba11 feat(plugin_manager): optimize local plugin startup with concurrency (#375)
* feat(plugin_manager): optimize local plugin startup with concurrent control

- Add semaphore-based concurrency control for plugin launches
- Implement parallel plugin startup using goroutines
- Optimize error handling to prevent goroutine blocking
- Add concurrency metrics logging

Note: handleNewLocalPlugins now accepts config parameter with default concurrency limit

* feat(plugin_manager): make local plugin launching concurrency configurable

* fix(plugin_manager): optimize comment and error handling

- Updated comments to clarify the concurrent plugin launching configuration.
- Added a nil check for the error channel during plugin startup to improve code robustness.

* refactor(plugin_manager): refactor plugin startup logic

- Remove the semaphore mechanism and switch to using routine.Submit for concurrency management

* fix(plugin_manager): Optimize plugin startup logs and concurrency control

- Added log output for maximum concurrency when starting local plugins
- Implemented a channel-based concurrency control mechanism to ensure limits are not exceeded
- Fixed closure variable capture issue to prevent incorrect plugin information
- Improved error handling to avoid deadlocks during startup

* fix(plugin_manager): simplify error channel handling and semaphore release logic

---------

Co-authored-by: jim02.he <jim02.he@vipshop.com>
2025-07-08 19:09:31 +08:00
Yeuoly b97cce7167 enhance(cli/icon): add multiple categories default plugin icons (#388)
* feat: add support for dark icon

- Introduced IconDark field in PluginDeclaration and related structures to support dark mode icons.
- Updated the installation process to handle dark icons.
- Enhanced asset validation to check for the presence of dark icons.

This change improves the visual consistency of plugins in dark mode environments.

* enhance(cli/icon): add plugin icon support with multiple categories

- Added support for light and dark icons for various plugin categories including agent, datasource, extension, model, tool, and trigger.
- Replaced the previous single icon implementation with a structured map for better organization and retrieval of icons based on category and theme.
- Removed the old Python icon file to streamline asset management.

This update improves the visual representation of plugins across different themes, enhancing user experience.

* change icons

* fix

* fix

* comments
2025-07-08 12:48:48 +08:00
Blackoutta 18d4151883 optimize: skip sleep for remote plugin runtime during restart, making the debugging experience smoother (#387) 2025-07-07 18:17:02 +08:00
AkisAya 412589f94a skip error plugin names (#381) 2025-07-03 23:43:03 +08:00
Yeuoly 6d6fb3892e feat: add InvokeLLMWithStructuredOutput functionality (#369)
* feat: add InvokeLLMWithStructuredOutput functionality

- Introduced a new method InvokeLLMWithStructuredOutput to the BackwardsInvocation interface for handling structured output requests.
- Added corresponding request and response types to support structured output.
- Implemented the method in both RealBackwardsInvocation and MockedDifyInvocation for testing purposes.
- Updated permission handling and task execution for the new structured output invocation type.

This enhancement allows for more flexible and detailed responses from the LLM, improving the overall functionality of the invocation system.

* refactor: enhance LLMResultChunkWithStructuredOutput structure

- Updated the LLMResultChunkWithStructuredOutput type to include additional fields: Model, SystemFingerprint, and Delta.
- Added comments to clarify the reasoning behind the structure and the use of type embedding for JSON marshaling.

This change improves the clarity and functionality of the LLMResultChunkWithStructuredOutput type, ensuring proper JSON serialization.

* refactor: streamline LLMResultChunk construction in InvokeLLMWithStructuredOutput

- Simplified the construction of LLMResultChunk and LLMResultChunkWithStructuredOutput by removing unnecessary type embedding.
- Enhanced readability and maintainability of the code while preserving functionality.

This change contributes to cleaner code and improved clarity in the handling of structured output responses.
2025-06-30 12:07:46 +08:00
Yeuoly a70d808dd0 feat(dynamic_select): implement dynamic parameter fetching functionality (#358)
* feat(dynamic_select): implement dynamic parameter fetching functionality

- Added FetchDynamicParameterOptions function to handle dynamic parameter selection.
- Introduced new access type and action for dynamic select in access_types.
- Updated HTTP server routes to include the new endpoint for fetching dynamic parameters.
- Created necessary service and controller files for dynamic select operations.

* refactor(access_types): rename dynamic select access type to dynamic parameter

- Updated access type constants to reflect the change from PLUGIN_ACCESS_TYPE_DYNAMIC_SELECT to PLUGIN_ACCESS_TYPE_DYNAMIC_PARAMETER.
- Adjusted related references in the PluginDispatchers and FetchDynamicParameterOptions function to maintain consistency.
2025-06-27 19:24:59 +08:00
kinoooolu f096900e62 fix:response data will be discard if tool/llm response buffer overflow (#362)
Co-authored-by: kino.lu <kino.lu@vipshop.com>
2025-06-26 11:44:41 +08:00
Yeuoly ae2658dd43 refactor(plugin_manager): remove first logging of local plugin launch (#357) 2025-06-24 13:17:19 +08:00
Rhys 3d1e2aba0e fix: skip waiting if error occured (#337)
* fix: skip waiting if error occured

* Update internal/core/plugin_manager/watcher.go

Co-authored-by: Rhys <nghuutho74@gmail.com>

* fix: handle nil error channels in plugin manager

---------

Co-authored-by: Yeuoly <45712896+Yeuoly@users.noreply.github.com>
Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-06-16 19:15:15 +08:00
Nevermore 6cea2d401e refactor(local_runtime): optimize listener lookup in stdioHolder (#345)
Directly fetch and invoke the listener for a given session_id instead of iterating over the entire listener map.

Signed-off-by: guanz42 <guanz42@163.com>
2025-06-16 18:31:46 +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 5f8072c982 Chore/unify configurations (#319)
* refactor: update PluginManager to use configuration for various configurations

- Replaced hardcoded values in PluginManager methods with values from the configuration.
- Updated serverless plugin launch timeout and working paths to utilize the new configuration structure.
- Enhanced local plugin runtime initialization to pull settings from the configuration, improving maintainability and flexibility.

* refactor: clean up PluginManager by removing unused fields and updating platform check

- Removed commented-out fields from PluginManager to enhance code clarity.
- Updated platform check to utilize the configuration structure instead of a direct field reference, improving maintainability.
2025-06-04 20:18:13 +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
Byron.wang 1c9e28bc75 Feat: Replace the internal/oss module with dify-cloud-kit (#317)
* replace internal oss with dify-cloud-kit

* remove validate

* fix tests

* fix tests
2025-05-30 16:44:59 +08:00
NeatGuyCoding 6b7172d6a6 fix: errChan failed to write response because of panic nil (#296) (#297)
* fix: errChan failed to write response because of panic nil (#296)

* fix: join err and er into a single error using errors.Join, thanks @Yeuoly (#296)

---------

Co-authored-by: NeatGuyCoding <cto@sb>
2025-05-26 11:25:11 +08:00
Yeuoly 3d28e0ceed feat: Add code generation for plugin controllers and services (#301)
* feat: Add code generation for plugin controllers and services

- Introduced a code generation mechanism for plugin controllers and services, allowing for automatic generation based on defined dispatchers.
- Created new files for generated controllers, services, and templates to streamline the plugin invocation process.
- Removed outdated functions related to tool validation and runtime parameters, consolidating functionality into generated files.
- Updated dependencies in go.mod and go.sum to include necessary packages for the new code generation features.

* fix
2025-05-23 14:57:56 +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
Yeuoly a22b9c17f0 feat: add fake OpenAI server for local runtime benchmarking (#286)
- Introduced a new test file to implement a fake OpenAI server that streams responses for benchmarking purposes.
- Updated the existing benchmark test to utilize the new fake server, enhancing the testing environment for local plugin runtime invocations.
- Refactored the package name in the benchmark test file for clarity and consistency.
2025-05-15 15:42:43 +08:00
Yeuoly d884cab8ae feat: add plugin reinstallation functionality and admin API support (#285)
* feat: add plugin reinstallation functionality and admin API support

- Implemented ReinstallToAWSFromPkg method to allow reinstallation of plugins on AWS Lambda, updating function URL and name.
- Added clearServerlessRuntimeCache method to manage serverless runtime cache.
- Enhanced LaunchPlugin to support an ignoreIdempotent flag for forced reinstallation.
- Introduced admin API endpoints for plugin reinstallation, secured with an API key validation middleware.
- Updated configuration to include AdminApiEnabled and AdminApiKey settings.

* refactor: update plugin reinstallation endpoint and improve unauthorized response

- Changed the plugin reinstallation endpoint from "/plugins/reinstall" to "/plugin/serverless/reinstall" for better clarity.
- Modified the unauthorized response in the AdminAPIKey middleware to return a more descriptive JSON message.
2025-05-15 15:22:25 +08:00
Yeuoly f99e0e8119 feat: add input validation for installed bucket path (#264)
- Implemented validation in NewInstalledBucket to log warnings for non-alphanumeric starting characters and empty paths for installedPath.
- Updated parameter naming for consistency across methods in InstalledBucket, enhancing code clarity.
2025-05-09 12:28:47 +08:00
Yeuoly 7a7e23fcb1 fix: update stdio buffer size configuration in stdioHolder (#273)
- Adjusted the buffer size settings in the stdioHolder to utilize configurable values for stdout buffer size and maximum buffer size, enhancing flexibility in plugin output handling.
2025-05-09 12:28:14 +08:00
Yeuoly 1ebe7fdf65 fix: improve line processing in StdioRequestReader (#260)
* fix: improve line processing in StdioRequestReader

- Replaced synchronous stdin reading with asynchronous data retrieval.
- Enhanced line processing to skip empty lines and handle incomplete data more effectively, improving overall robustness of the request reading mechanism.

* feat: add asynchronous reading to StdioRequestReader

- Implemented the _read_async method to read data from stdin in 64KB chunks, optimizing data retrieval.
- This enhancement improves the efficiency of the request reading process in the StdioRequestReader class.
2025-05-06 15:09:54 +08:00
Good Wood 977665e73b feat: add read & write timeout config (#259)
* feat: add read & write timeout config

* refactor: update Dify invocation configuration to use structured payload

- Changed the Dify invocation daemon to accept a structured payload for initialization, improving clarity and maintainability.
- Updated related configuration variables in the .env.example file to reflect the new naming convention for backwards invocation timeouts.
- Adjusted tests and plugin manager to accommodate the new payload structure.

---------

Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-05-06 13:08:02 +08:00
Yeuoly 61bd7d9c8a feat: add configurable stdio buffer sizes for plugins (#256)
- Introduced new configuration options for plugin stdio buffer sizes in the .env.example file.
- Updated the PluginManager and LocalPluginRuntime to utilize these new buffer size settings.
- Enhanced the stdioHolder to accept buffer size configurations, improving plugin output handling.
- Modified related tests to accommodate the new stdioHolder configuration structure.
2025-04-30 15:28:34 +08:00
Yeuoly d80630acd5 feat: implement OAuth functionality (#245)
* feat: implement OAuth functionality in plugin daemon

- Added OAuth service methods for getting authorization URLs and credentials.
- Updated access types to include OAuth-related actions.
- Created new controller for handling OAuth requests.
- Introduced entities for OAuth results and requests.
- Enhanced plugin entities to support OAuth schema in tool declarations.

* feat: add OAuth endpoints for authorization and credentials retrieval

- Introduced new POST endpoints for obtaining authorization URLs and credentials in the OAuth controller.
- Enhanced the plugin dispatch group to include these new OAuth routes, improving integration with OAuth services.
2025-04-27 13:59:57 +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 c5cda9cbbf enhance(local runtime): patches prompt messages and replace json loads with pydantic (#222)
- Introduced two new patch files: `0.1.1.llm.py.patch` and `0.1.1.request_reader.py.patch` to enhance the plugin's functionality.
- Updated the `environment_python.go` file to reference the new patches and apply them conditionally based on the plugin SDK version.
- Improved the handling of LLM usage and request reading in the plugin environment.
2025-04-17 16:07:54 +08:00