Commit Graph

903 Commits

Author SHA1 Message Date
Yeuoly 97d2322717 enhance(plugin_manager): improve logging for local plugin watcher
- Updated log message to include the maximum concurrency setting when starting to handle new plugins.
- Removed redundant maxConcurrency variable and its associated log statement for clarity.
2025-07-07 18:41:17 +08:00
jim02.he 404869a33b refactor(plugin_manager): refactor plugin startup logic
- Remove the semaphore mechanism and switch to using routine.Submit for concurrency management
2025-07-05 00:30:42 +08:00
jim02.he add2213d7d 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.
2025-07-02 12:29:34 +08:00
jim02.he 1fe2e518a8 Merge remote-tracking branch 'origin/main' into plugin_launch_concurent 2025-07-02 08:59:35 +08:00
jim02.he 8825b94c01 feat(plugin_manager): make local plugin launching concurrency configurable 2025-07-02 08:56:39 +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.
0.1.3
2025-06-30 12:07:46 +08:00
jim02.he f945225e56 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
2025-06-30 00:16:51 +08:00
@defstream 7a7848b3ae Update README.md (#372) 2025-06-28 12:31:57 +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
Tianyi Jing af3fec6f32 fix: prevent duplicate packaging (#367)
fixes: https://github.com/langgenius/dify-plugins/issues/612
fixes: https://github.com/langgenius/dify-plugins/issues/234

Signed-off-by: jingfelix <jingfelix@outlook.com>
2025-06-26 17:45:59 +08:00
Yeuoly f80d8a8946 feat: add pull request template for improved contribution guidelines (#366)
- Introduced a new pull request template to standardize contributions.
- The template includes sections for description, type of change, essential checklist, and additional information to assist reviewers.
2025-06-26 12:09:55 +08:00
Yeuoly 7bb6406894 test(stream): add delay in TestStreamCloseBlockingWrite to ensure blocking write completion (#365) 2025-06-26 11:54:54 +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
Byron.wang 9c6bbc687f refactor: extract DSN construction to buildDSN for better reuse and readability (#360) 2025-06-25 14:15:47 +08:00
Yeuoly ae2658dd43 refactor(plugin_manager): remove first logging of local plugin launch (#357) 2025-06-24 13:17:19 +08:00
Tsonglew 166609f3f6 fix: launch error when using redis sentinel (#352) 2025-06-23 16:51:22 +08:00
Ganondorf ff875c7e7a Split REMOTE_INSTALL_ADDRESS into HOST and PORT in .env.example to align with the official docs (#356)
Co-authored-by: lizb <lizb@sugon.com>
2025-06-20 10:33:28 +08:00
Yeuoly a6c8fae9c7 feat: add decode plugin from identifier endpoint (#349)
* feat: add decode plugin from identifier endpoint

- Introduced a new endpoint to decode a plugin from a unique identifier.
- Implemented the DecodePluginFromIdentifier function to handle decoding and verification of plugin signatures.
- Updated the HTTP server routes to include the new decode endpoint.

* refactor: update decode plugin endpoint path

- Moved the decode plugin from identifier endpoint to a new path for better organization.
- Updated the HTTP server routes accordingly to reflect the new endpoint structure.
2025-06-18 16:01:15 +08:00
Yeuoly dfc9622e91 feat(db): enhance database configuration with charset and extras support (#347)
- Updated .env.example to include DB_EXTRAS and DB_CHARSET variables.
- Refactored InitPluginDB functions for PostgreSQL and MySQL to accept a configuration struct, allowing for more flexible database connection settings.
- Adjusted connection pool settings to utilize new configuration options for charset and extras.

This change improves the configurability of database connections and prepares the codebase for future enhancements.
2025-06-18 12:08:56 +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
Byron.wang 18e91bbb37 fix s3 client path style not used (#344)
* bump cloud-kit version to fix #343

* change env name USE_AWS_S3 to S3_USE_AWS

* update s3_use_aws default value to true

* update readme about the upgrade notice
2025-06-13 15:10:21 +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.
0.1.2
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
Byron.wang debb3744c0 add USE_AWS_S3 args avoid ambiguity. (#340) 2025-06-11 14:32:53 +08:00
Byron.wang 7c1e46f643 add serverless runtime interface docs (#338)
* add sri docs

* add refer to readme

* format readme
2025-06-10 16:48:09 +08:00
Byron.wang 6873c3f600 bump dify-cloud-kit version to 681efb7762a4 (#339) 2025-06-10 16:48:00 +08:00
Novice 8c9458cf2f Merge pull request #325 from Nov1c444/feat/add-meta
feat: agent plugin add meta version
2025-06-05 09:44:25 +08:00
Novice cfd399b602 feat: agent plugin add meta version 2025-06-05 09:35:04 +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
湛露先生 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
湛露先生 5573e1fbd1 Fix env read bug for GCS_CREDENTIALS. (#324) 2025-06-02 09:03:30 +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
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
Novice 0167554a03 feat: add mcp tool type (#315) 2025-05-30 14:05:20 +08:00
Byron Wang 1fb2d1b532 update issute template: add self checks 2025-05-28 19:04:13 +08:00
Yeuoly 3918b377f2 refactor: streamline plugin initialization and update YAML templates for consistency (#313)
- Removed redundant flag retrieval in the plugin initialization process, simplifying the code.
- Updated permission handling to use a single `permissionRequirement` structure for better clarity and maintainability.
- Enhanced YAML templates by adding quotes around dynamic values to ensure proper formatting and prevent potential parsing issues.
2025-05-27 19:48:11 +08:00
Byron.wang b3c68cbeec add packaged file info when plugin package larger than max size (#312) 0.1.1 2025-05-27 13:02:25 +08:00
Good Wood 2cd64adf3b feat: change listPlugin struct & add total (#302) 2025-05-27 12:53:37 +08:00
Yeuoly 478c98da5c fix: signature dose not work as expected, if upload new pkg to old dify (#311)
- Updated the  method in the  interface to remove the  parameter, simplifying its usage.
- Introduced a new  function to provide a default verification structure.
- Added a  file to store verification data, improving the plugin signing process.
- Enhanced tests in  to validate the verification process, ensuring proper handling of success and failure scenarios.
- Refactored related code to accommodate the new verification structure and improve overall maintainability.
2025-05-26 13:10:34 +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 b6906f7eb5 feat: Generate HTTP server routes from template (#306)
* feat: Generate HTTP server routes from template

- Added a new file `http_server.gen.go` to automatically generate HTTP server routes based on defined dispatchers.
- Refactored existing route definitions in `http_server.go` to utilize the generated routes, improving maintainability.
- Introduced a code generation function in `generator.go` to create the HTTP server file, enhancing the plugin development workflow.
- Updated the template for HTTP server generation to streamline route creation for various controllers.

* fix: Update OAuth paths in PluginDispatchers for consistency

- Changed the path for authorization URL from `/oauth/authorization_url` to `/oauth/get_authorization_url`.
- Updated the path for credentials from `/oauth/credentials` to `/oauth/get_credentials` to align with naming conventions.
2025-05-23 15:27:43 +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
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
Byron.wang cdf3493c35 Update issue templates 2025-05-22 16:46:13 +08:00
Yeuoly 9a1da25d59 feat: Enhance plugin signing with authorized category verification (#293)
* feat: Enhance plugin signing with authorized category verification

- Added support for an `authorized_category` flag in the signature command to validate the category before signing.
- Updated the `Sign` function to accept a verification parameter, allowing for category-based signing.
- Enhanced error handling for invalid categories during the signing process.
- Updated tests to cover new verification scenarios and ensure proper functionality with the authorized category.

* fix

* fix

* test

* test: Add unit test for plugin verification without verification field

- Introduced a new test case to verify the behavior of plugins that lack a verification field.
- Updated the signature_test.go file to include the test, ensuring proper functionality of the signing process.
- Removed the outdated verifier_test.go file and associated test data to streamline the codebase.
2025-05-21 20:05:45 +08:00
Yeuoly c799d90e88 chore: coding style (#291)
- Renamed parameters for consistency and clarity, changing `tenant_id`, `plugin_unique_identifier`, and `install_type` to `tenantId`, `pluginUniqueIdentifier`, and `installType` respectively across multiple functions.
- Updated corresponding database queries to reflect the new parameter names, enhancing code readability and maintainability.
2025-05-20 17:14:44 +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
bravomark 458542ca9f fix: Fix the issue where the List method of Alibaba Cloud OSS did not correctly return plugin file paths. (#287) 2025-05-20 14:11:57 +08:00