Commit graph

2413 commits

Author SHA1 Message Date
Max
517a4cf5b0 Implement OAuth endpoint logic and enhance test setup
- Added core functionality for OAuth authorization, token handling, and user info retrieval, including error handling and response generation.
- Introduced helper functions for managing different grant types, improving code organization and clarity.
- Enhanced the test setup with a new Prepare function to initialize the OpenAPI test environment and a Clean function for proper resource management.
- Updated tests to ensure the OpenAPI server is correctly loaded and operational during testing.
2025-07-21 15:34:13 +08:00
Max
458391f5b4 Refactor OAuth endpoint structure and add well-known handlers
- Removed OAuth discovery and metadata endpoints from the attachOAuth function to streamline the code.
- Introduced a new method to handle well-known endpoints, improving organization and clarity in the OAuth implementation.
- Updated the Attach method to include the new well-known handlers, ensuring proper routing for OAuth-related metadata.
2025-07-20 19:11:16 +08:00
Max
6256e131b3 Add OAuth documentation for versioned paths and discovery endpoints
- Added notes in the OAuth handler to clarify the requirements for using versioned paths, including the placement of discovery endpoints and server metadata.
- Emphasized the importance of mounting discovery endpoints at the root level for proper MCP client configuration and OAuth functionality.
2025-07-20 19:05:41 +08:00
Max
b96a400869 Add OpenAPI support and enhance configuration handling
- Integrated OpenAPI loading functionality into the engine's Load and Reload processes, allowing for better API management.
- Updated the OpenAPI configuration to set a default BaseURL and ensure it does not have a trailing slash.
- Implemented the Attach method to connect the OpenAPI server to the Gin router, facilitating API endpoint management.
- Removed the obsolete hello package to streamline the OpenAPI module.
2025-07-20 18:52:30 +08:00
Max
0fff602c93 Implement JSON marshaling and unmarshaling for configuration with duration parsing
- Enhanced the Config struct to support JSON marshaling and unmarshaling with human-readable duration strings for various OAuth settings.
- Introduced temporary structures to facilitate the conversion of string duration fields to time.Duration types during JSON operations.
- Added utility functions for parsing and formatting duration strings, ensuring accurate handling of time-related configurations.
- Updated tests to validate the correct parsing and formatting of duration fields in the configuration.
2025-07-20 17:49:01 +08:00
Max
fa58bf42dc Enhance test for Load function by adding data store cleanup
- Implemented a cleanup step in the TestLoad function to remove the data store created during tests, ensuring a clean test environment.
- Added error handling for the Load function to improve robustness and provide feedback in case of failures.
2025-07-20 12:03:25 +08:00
Max
5d3c03db1f Update OAuth store management and enhance cache configurations
- Added support for a new OAuth data store in the system store management, allowing for better organization and retrieval of OAuth-related data.
- Updated the OAuth cache store configuration to increase the cache size from 4096 to 8192, improving performance and storage capacity.
- Enhanced test utilities to include the new OAuth store, ensuring comprehensive testing coverage for the updated store management features.
2025-07-20 11:47:57 +08:00
Max
8523170992 Implement system store management and enhance store loading functionality
- Introduced a new system store management feature, allowing for the loading of predefined system stores such as cache and OAuth client stores.
- Added a `loadSystemStores` function to handle the loading of system stores with variable replacement for configuration paths.
- Enhanced the `Load` function to include the loading of system stores, improving the overall store management process.
- Updated test utilities to support loading system stores for testing, ensuring comprehensive coverage and functionality.
- Refactored the `replaceVars` function to facilitate variable replacement in JSON strings, enhancing flexibility in store configurations.
2025-07-20 11:23:00 +08:00
Max
72b732348d Enhance OAuth configuration types with optional defaults
- Updated the SigningConfig, TokenConfig, SecurityConfig, and ClientConfig structures to include optional default values for various fields, improving clarity and usability.
- Added comments to specify default values and optionality for each configuration parameter, enhancing documentation within the code.
- This change aims to streamline the configuration process for OAuth service implementations.
2025-07-18 17:05:13 +08:00
Max
ef07622e7e Add user and security tests 2025-07-18 15:48:50 +08:00
Max
2610036082 Refactor token exchange implementation in OAuth service
- Updated the TokenExchange method to utilize a new generateExchangedToken function for improved token generation.
- Enhanced error handling to return a descriptive error response if token generation fails.
- Added a new generateExchangedToken function to encapsulate the logic for creating exchanged tokens, improving code organization and maintainability.
2025-07-18 15:30:52 +08:00
Max
b959768016 Refactor dynamic client registration tests in OAuth service
- Updated test cases to improve coverage for dynamic client registration scenarios.
- Enhanced error handling tests for various client registration edge cases, ensuring robustness in validation processes.
- Streamlined test setup for consistency across different testing environments.
2025-07-18 15:13:08 +08:00
Max
9fd0d4713a Add tests for dynamic client registration validation in OAuth service
- Implemented tests to verify error handling for disallowed redirect URI hosts and schemes during dynamic client registration.
- Updated test clients to use localhost for redirect URIs, ensuring consistency in testing environment.
2025-07-18 14:58:29 +08:00
Max
944c3e1b8e Enhance client creation and dynamic registration in OAuth service
- Added default values for grant types, response types, application type, and token endpoint auth method during dynamic client registration.
- Implemented nil checks for client information in the CreateClient and UpdateClient methods to ensure robust error handling and validation.
2025-07-18 14:51:34 +08:00
Max
d3874b28ad Refactor OAuth service to improve client registration and user management
- Enhanced dynamic client registration by refining client ID and secret generation methods.
- Improved validation processes for client registration requests and authorization flows.
- Streamlined user management integration with the updated user model, ensuring compatibility and efficiency.
- Updated token management features to support new client and user interactions, enhancing overall service functionality.
2025-07-18 14:28:44 +08:00
Max
58eb00f8f2 Implement dynamic client registration and enhance OAuth service functionality
- Added dynamic client registration support in the OAuth service, implementing RFC 7591 for automatic client registration.
- Introduced methods for generating client IDs and secrets, validating registration requests, and creating client information.
- Enhanced authorization flow by validating client requests, redirect URIs, and response types.
- Implemented token management features, including token introspection, token exchange, and refresh token handling.
- Improved security with state parameter generation and validation, as well as code challenge methods for PKCE.
- Updated endpoint discovery and server metadata retrieval to include new features and capabilities.
2025-07-18 12:11:21 +08:00
Max
fb20eb54c5 Add user model integration and enhance OAuth user provider
- Introduced a new user model `yao/models/user.mod.yao` to support user management functionalities.
- Updated the OAuth service to utilize the new `DefaultUser` provider, enhancing user authentication and management capabilities.
- Refactored user retrieval methods to align with the new user model structure, ensuring compatibility and improved functionality.
- Added token management methods to the user provider interface, streamlining token handling processes.
- Enhanced test utilities to include the new user model for comprehensive testing coverage.
2025-07-18 11:31:39 +08:00
Max
e19aa4b8df Remove deprecated OAuth interfaces and types
- Deleted the OAuth interface and related types that were previously defined in the `interfaces.go` and `types.go` files, streamlining the codebase.
- Updated the `oauth.go` file to integrate user and client providers directly, enhancing the service's functionality and reducing complexity.
- Refactored the user information retrieval method to utilize the new user provider structure, ensuring compatibility with the updated architecture.
2025-07-17 17:19:22 +08:00
Max
54607bc3ee Add OAuth service implementation with configuration and validation
- Introduced the OAuth service structure, including configuration management and user provider integration.
- Implemented default settings and validation for various configuration parameters, ensuring robust service initialization.
- Added methods for retrieving service configuration and user information based on access tokens.
- Defined error handling for configuration issues, enhancing reliability of the OAuth service.
2025-07-17 12:04:42 +08:00
Max
57d61c1ba3 Set default prefix in Prepare function for test environment
- Added logic to set a default prefix of "yao_" for the application if none is provided, ensuring consistent naming conventions in the test setup.
2025-07-16 17:05:05 +08:00
Max
d5dd0f56c7 Add system model loading functionality for testing
- Introduced a new function `loadSystemModels` to load predefined system models for testing purposes, enhancing the test environment setup.
- Implemented error handling for model loading and migration, ensuring robust integration of system models.
- Updated the `Prepare` function to call `loadSystemModels`, streamlining the test preparation process.
2025-07-16 16:43:45 +08:00
Max
206a6505d1 Enhance DSL error handling and metadata management
- Improved error messages in the Inspect, Update, and Delete methods to provide clearer context by including the DSL type.
- Added default store type handling in the Create method and ensured validation for store types.
- Enhanced the Inspect method in the FS and DB implementations to extract and populate metadata fields from source data, including label, description, tags, and sort order.
- Updated the Info struct to ensure correct store type assignment based on the source of the data, improving consistency across data retrieval methods.
2025-07-16 16:15:16 +08:00
Max
1a231ac9b2 Update go.mod and go.sum to include new indirect dependencies
- Added github.com/mark3labs/mcp-go v0.32.0 and github.com/yosida95/uritemplate/v3 v3.0.2 as indirect dependencies in go.mod.
- Updated go.sum to reflect the new dependencies and their respective checksums.
2025-07-16 15:16:19 +08:00
Max
520e73627b Implement enhanced loading, unloading, and validation for YaoConnector
- Added comprehensive loading logic in the Load method to support various data sources, including direct source input, file system, and database.
- Improved error handling by validating options in Load, Unload, and Reload methods, ensuring required parameters are provided.
- Enhanced the Loaded method to return detailed metadata for all connectors, improving visibility into available DSLs.
- Updated the Validate method to return a successful validation response with an empty lint message array.
- Refined the Execute method to indicate unimplemented functionality, enhancing clarity for future development.
2025-07-16 12:33:48 +08:00
Max
1f1f44fab5 Refactor 'readable' field to 'readonly' in model and database handling
- Updated the Info struct to replace the 'readable' field with 'readonly' for better clarity in metadata representation.
- Modified Create and Update methods in db.go to utilize the new 'readonly' field.
- Enhanced test cases to assert the correctness of 'readonly' and 'builtin' fields, ensuring comprehensive validation of model attributes.
- Adjusted model loading logic to correctly populate 'readonly' and 'builtin' fields from metadata.
2025-07-16 11:39:36 +08:00
Max
25c5688727 Enhance model loading and error handling in YaoModel
- Refactored the Load, Unload, and Reload methods to support multiple data source options, including loading from a provided source, file system, or database.
- Improved error handling by implementing panic recovery in the Unload method to manage model retrieval failures gracefully.
- Removed the Source field from UnloadOptions struct to streamline the options interface.
2025-07-15 20:21:45 +08:00
Max
5f9eee97ea Enhance time value handling and improve test assertions
- Added a new toTime function to convert various time formats to RFC3339 strings, ensuring consistent time representation in the data.
- Updated the fmtRow function to utilize the new toTime function for 'mtime' and 'ctime' fields, enhancing data formatting.
- Modified the TestDBList function to include a check for non-empty lists before asserting the ID, improving test robustness.
2025-07-15 18:54:41 +08:00
Max
cb9606681e Refactor boolean value handling in fmtRow function
- Simplified the conversion of 'readable' and 'built_in' fields to boolean values by utilizing a new toBool function, enhancing code readability and maintainability.
- Removed debug SQL print statements from the Update method to clean up the output and improve performance.
2025-07-15 18:37:42 +08:00
Max
bd95ac0604 Enhance DSL data handling and model structure
- Introduced a new fmtRow function to format row data for DSL info, improving data consistency and readability.
- Updated the Inspect and List methods to utilize the fmtRow function for better data representation.
- Added new fields for 'readonly' and 'built_in' in the DSL model, allowing for more detailed metadata management.
- Enhanced the Create and Update methods to handle the new fields, ensuring proper data storage and retrieval.
- Updated the ListOptions struct to include a Pattern field for file name matching, improving search capabilities.
2025-07-15 18:28:01 +08:00
Max
bdd7c0865e Refactor DSL list retrieval to support conditional data source selection
- Enhanced the List method in the DSL struct to conditionally retrieve data from either the database or file system based on the StoreType specified in ListOptions.
- Updated the Info struct to include a new Source field for optional source content retrieval.
- Modified the List methods in both DB and FS to include source information when requested, improving data accessibility and flexibility.
2025-07-15 16:58:41 +08:00
Max
c74916296a Enhance model definitions and loading process for system models
- Added new system models for assistant, attachment, audit, chat, config, dsl, history, and kb with metadata including tags, built-in status, read-only attributes, and sort order.
- Refactored the model loading process to include a dedicated function for loading system models, improving organization and maintainability.
- Updated the application loading logic to set a default prefix for system tables, ensuring consistent naming conventions.
- Improved error handling during model loading and migration processes for better reliability.
2025-07-15 16:33:14 +08:00
Max
62e20a90ea Refactor DSL management by introducing IO interfaces for database and file system operations
- Removed the db.go and fs.go files, consolidating database and file system interactions into a unified IO interface.
- Updated DSL struct to include db and fs fields for improved separation of concerns.
- Refactored existing methods across various DSL managers (API, Connector, MCP, Model) to utilize the new IO interfaces for operations like Inspect, Create, Update, Delete, and List.
- Enhanced error handling and validation in Create, Update, and Delete methods to ensure robust functionality.
- Updated types to include new options for Load, Unload, and Reload operations, improving flexibility and usability.
2025-07-15 12:25:56 +08:00
Max
06f5134083 Update dependencies in go.mod and go.sum to latest versions for improved stability and performance 2025-07-14 21:03:57 +08:00
Max
0b5d7fcc41 Remove unused indexes from multiple model files and delete the mcp model file to streamline the database schema. 2025-07-14 11:26:58 +08:00
Max
a13fe36aa6 Update dependencies in go.mod and go.sum to latest versions for improved stability and performance 2025-07-13 09:15:54 +08:00
Max
d6b44730e6 Update dependencies in go.mod and go.sum to latest versions for improved compatibility and performance
- Upgraded golang.org/x/text to v0.27.0, golang.org/x/image to v0.29.0, golang.org/x/sync to v0.16.0, and golang.org/x/tools to v0.34.0.
- Adjusted go.sum to reflect the changes in dependency versions, ensuring the project uses the most recent and stable library versions.
2025-07-10 18:49:55 +08:00
Max
60927acfdb Update github.com/spf13/cast dependency to v1.9.2 in go.mod and go.sum for improved functionality and compatibility 2025-07-07 10:29:13 +08:00
Max
c057a616cf Update dependencies in go.mod and go.sum for improved compatibility and performance
- Upgraded several dependencies to their latest versions, including golang.org/x/crypto, golang.org/x/net, and golang.org/x/text.
- Added new indirect dependencies: dgraph-io/badger, dgraph-io/ristretto, and dustin/go-humanize.
- Updated opentelemetry packages to the latest versions for enhanced observability features.
- Adjusted go.mod and go.sum to reflect these changes, ensuring the project uses the most recent and stable library versions.
2025-07-02 13:32:28 +08:00
Max
062f678e10 Add gzip option to ManagerOption struct and update app processing logic
- Introduced a new Gzip field in the ManagerOption struct to allow optional gzip compression for file uploads.
- Updated the processXgen function to include the gzip setting for chat, assets, and knowledge upload configurations, enhancing flexibility in file handling.
2025-06-27 20:03:09 +08:00
Max
cd145ba3e8 Refactor file download and upload methods in neo package for improved clarity and functionality
- Streamlined handleDownload and handleUpload methods to enhance code readability and maintainability.
- Improved error handling and validation checks during file operations to ensure robust functionality.
- Updated documentation to reflect changes in file handling processes and usage examples.
2025-06-01 18:40:29 +08:00
Max
445bcdd7ea Implement file download functionality and refactor existing methods in neo package
- Added handleDownload method to manage file download requests, including validation for session ID and file ID.
- Enhanced permission checks to ensure users can only download files they are authorized to access.
- Updated CORS headers to include Content-Disposition for better file handling in responses.
- Removed deprecated download logic from the neo package to streamline code and improve maintainability.
- Refactored existing methods to improve clarity and error handling during file operations.
2025-06-01 18:33:38 +08:00
Max
e6a0f37a66 Enhance file upload handling and deduplication features in neo package
- Updated UserOrGuestID method to return guest status alongside user ID.
- Introduced UploadOption struct to encapsulate additional upload parameters, including public visibility and collection ID.
- Enhanced handleUpload method to validate collection ID for knowledge storage and improved error handling.
- Updated GetHeader function to include file size in the header processing.
- Implemented content fingerprinting for file deduplication and added support for upload status tracking.
- Enhanced README documentation to reflect new features and usage examples for file uploads and deduplication.
2025-06-01 17:46:28 +08:00
Max
68e4e64e35 Add KnowledgeFilter struct and update database configuration in README
- Changed the database configuration example from 'app.yao' to 'neo.yml' for clarity.
- Introduced the KnowledgeFilter struct to facilitate filtering of knowledge collections by various criteria such as user ID, collection name, public status, and pagination.
- Added usage examples for retrieving system and readonly knowledge collections with specific fields.
2025-06-01 16:44:02 +08:00
Max
e1f2899723 Add attachment status management and filtering in neo package
- Introduced new status field in the attachment table to track processing states: uploading, uploaded, indexing, indexed, upload_failed, and index_failed.
- Added progress and error fields to provide detailed information during the attachment processing workflow.
- Implemented AttachmentFilter struct to support filtering attachments by status.
- Updated SaveAttachment and GetAttachments methods to handle new status and progress information.
- Enhanced tests to validate attachment status management and filtering functionality.
2025-06-01 16:26:39 +08:00
Max
49562b8be0 Add attachment and knowledge management features in neo package
- Implemented SaveAttachment, DeleteAttachment, GetAttachments, and GetAttachment methods for managing file attachments.
- Introduced SaveKnowledge, DeleteKnowledge, GetKnowledges, and GetKnowledge methods for handling knowledge collections.
- Enhanced the Store interface to include methods for attachment and knowledge management.
- Updated tests to cover new attachment and knowledge functionalities, ensuring robust validation and error handling.
2025-06-01 16:06:41 +08:00
Max
2222bbfcd7 Refactor file upload handling in neo package
- Simplified the file header conversion process by introducing GetHeader function to streamline header management during uploads.
- Updated handleUpload method to utilize the new GetHeader function, improving code clarity and reducing error handling complexity.
- Enhanced test cases to reflect changes in upload logic and ensure accurate content validation.
- Improved chunked upload handling by implementing a more robust mechanism for tracking upload progress and managing chunk data.
2025-06-01 12:00:45 +08:00
Max
5b99f3bf44 Enhance file upload functionality and authentication in neo package
- Updated the API to support dynamic storage paths for file uploads, allowing for differentiated handling of chat, knowledge, and asset uploads.
- Implemented comprehensive authentication checks to ensure only authorized users can upload files.
- Introduced new upload options to handle original filenames and improved error responses for better user feedback.
- Enhanced CORS headers to accommodate new upload requirements and improve API security.
- Initialized authentication settings in the Load function to streamline user management.
2025-05-31 16:36:02 +08:00
Max
43686be6e4 Enhance asset upload management in neo package
- Added support for custom asset upload settings in the Upload struct, allowing for more flexible file handling.
- Implemented logic in initUpload to register default or custom asset upload configurations based on user settings.
- Improved error handling during asset registration to ensure robust functionality.
2025-05-31 13:33:23 +08:00
Max
a9b6eed025 Add upload management to neo package for enhanced file handling
- Introduced initUpload function to initialize upload settings for chat and knowledge attachments.
- Updated Upload struct to include specific settings for chat and knowledge uploads.
- Implemented RegisterDefault and ReplaceEnv methods in the attachment manager for better configuration management.
- Enhanced error handling during the upload initialization process to ensure robust functionality.
2025-05-31 11:30:11 +08:00
Max
96d2f22e77 Update dependencies in go.mod and go.sum; refactor file handling in neo package
- Added the jsonrepair package to go.mod for enhanced JSON handling capabilities.
- Removed unused dependencies from go.mod and updated existing ones for better performance.
- Refactored file upload and download methods in the neo package to return nil values, indicating a temporary placeholder for future implementation.
- Updated the Message struct to use the new attachment package for better organization of file attachments.
2025-05-31 10:07:19 +08:00