Commit Graph

75 Commits

Author SHA1 Message Date
Stream 56480c27be fix: avoid path collusion 2025-10-24 19:53:02 +08:00
Stream 2c87f0ac8b Merge branch 'feat/plugin-readme' into feat/trigger
# Conflicts:
#	internal/db/init.go
2025-10-23 11:26:38 +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
Harry 24a63d88a8 Add trigger functionality and enhance database integration
- Introduced TriggerInstallation model for managing trigger installations in the database.
- Updated autoMigrate function to include trigger installations in the migration process.
- Added new HTTP routes for listing and retrieving triggers in the HTTP server.
- Implemented ListTriggers and GetTrigger controller functions for handling trigger requests.
- Enhanced plugin management functions to create, update, and delete trigger installations during plugin lifecycle events.

These changes integrate trigger capabilities into the system, improving the overall plugin functionality and management.
2025-09-04 13:31:20 +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
Stream 470aeafc01 Merge branch 'main' into feat/plugin-readme 2025-08-27 13:13:29 +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
Harry d3a5d2cbb8 feat(plugins): add FetchPluginReadme endpoint and update launch configurations 2025-08-22 16:40:17 +08:00
Yeuoly 56fcd686e1 feat: add active request tracking to health check and dispatch routes (#384)
- Implemented middleware to track active requests and active dispatch requests using atomic counters.
- Updated health check response to include counts of active requests and active dispatch requests.
- Integrated the new middleware into the HTTP server and plugin dispatch group for improved monitoring.
2025-07-04 19:56:42 +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 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 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 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
mr-chenguang lcgash 0cd7591aea change log health api by env switch 2025-03-11 07:58:16 +00:00
mr-chenguang lcgash 7bb0b42c88 fix: skip log health api 2025-03-11 05:43:09 +00:00
Yeuoly 8ab1e2a91e feat: Add max execution time parameter to endpoint handling (#88)
Modify endpoint-related functions to support configurable maximum execution time:
- Update EndpointHandler signature to include maxExecutionTime
- Pass max execution timeout from config to endpoint service
- Modify timeout mechanism to use configurable duration instead of hardcoded 240 seconds
2025-03-10 18:23:13 +08:00
Yeuoly b19140ca23 refactor: optimize plugin declaration caching and encoding (#34) 2025-02-25 20:52:51 +08:00
Yeuoly 6a54d44142 refactor: rename aws_lambda to serverless 2025-02-10 15:04:24 +08:00
Yeuoly c26f5f9359 fix: use double pointer to implement setDefaultValue 2025-01-08 01:35:12 +08:00
Yeuoly e39b35d7d9 refactor: docker build 2025-01-06 14:38:44 +08:00
Yeuoly 3bb694e958 fix: incorrect endpoint path 2024-12-17 21:54:58 +08:00
Yeuoly a00e6ad26f fix: remove healthcheck from healthcheck 2024-12-17 21:46:22 +08:00
Yeuoly 9ef9f16e6e feat: support for sentry 2024-12-17 20:51:14 +08:00
Yeuoly 548adf4c0c refactor: rename agent to agent strategy 2024-12-12 18:26:55 +08:00
Yeuoly 1aecaf9a7c feat: support agent management 2024-12-09 22:25:41 +08:00
Yeuoly 7bb4705a48 feat: agent pluign 2024-12-09 22:01:01 +08:00
Yeuoly 31fd5590ea fix: add mutex and threadcreate traces 2024-12-06 01:28:55 +08:00
Yeuoly 5df0c68632 fix: add more traces for pprof 2024-12-06 01:28:09 +08:00
Yeuoly 407fb941ca feat: support for pprof 2024-12-04 14:15:16 +08:00
Yeuoly 0ab0fc15fc feat: support fetch installed tools 2024-11-25 23:19:38 +08:00
Yeuoly d341ff9918 fix: incorrect route of delete all installing tasks 2024-11-25 17:11:08 +08:00
Yeuoly dd5325b681 feat: support delete all install tasks 2024-11-25 17:01:25 +08:00
Yeuoly 9c9a6c26c0 feat: support upload bundle 2024-11-14 22:59:51 +08:00
Yeuoly 44a2de1f62 feat: support upload bundle 2024-11-14 21:23:33 +08:00
Yeuoly 26fd94ebcd refactor: convert snakecase to camelcase 2024-11-12 21:24:41 +08:00
Yeuoly c57b554245 feat: checking missing dependencies 2024-11-12 19:51:28 +08:00
Yeuoly eeadb3e29c refactor: support upgrade plugin to any verions 2024-10-25 17:41:14 +08:00
Yeuoly 0c5eac1897 fix: add subpath 2024-10-25 13:27:05 +08:00
Yeuoly f339a21001 feat: support remove single item from installation task 2024-10-25 13:19:54 +08:00
Yeuoly 090f1e004d fix: install progress has bad handing logics 2024-10-16 14:36:48 +08:00
Yeuoly fc7bfc91b4 fix: async install plugins task 2024-10-16 14:01:08 +08:00
Yeuoly a74a1a4801 refactor: plugin installation changed to sync tasks 2024-10-14 18:11:22 +08:00
Yeuoly 1fae793cdf feat: support tool get runtime parameters 2024-09-29 18:19:50 +08:00
Yeuoly 37a5b12c86 feat: support fetch tool entity 2024-09-29 17:09:09 +08:00
Yeuoly b92d497ced refactor: using plugin id to dispatch request instead 2024-09-27 21:48:20 +08:00
takatost 5251bdb92b fix: missing few routes of model 2024-09-26 15:21:25 +08:00
Yeuoly ab3def1052 feat: add endpoints counter for installation 2024-09-26 11:36:46 +08:00
Yeuoly 1b3e9cede4 enhance: add gzip 2024-09-24 14:00:30 +08:00