Commit Graph

8 Commits

Author SHA1 Message Date
whatevertogo
a93f267d8a feat(loader): enhance plugin import handling and legacy compatibility
- Updated `import_string` to evict conflicting cached top-level plugin packages, ensuring proper isolation of plugins with the same package names.
- Preserved the order of legacy handler declarations in `_iter_discoverable_names` to maintain expected behavior for legacy plugins.
- Added tests to verify the isolation of top-level packages and the preservation of handler declaration order.
- Improved module cleanup in tests to prevent conflicts between plugins.
2026-03-13 06:32:26 +08:00
whatevertogo
9c5ecf0a13 feat: Enhance plugin capability support and legacy compatibility
- Introduced LoadedCapability class to manage plugin capabilities.
- Updated load_plugin function to discover and load capabilities alongside handlers.
- Enhanced Peer class to handle remote provided capabilities during initialization.
- Added tests for capability registration and invocation in legacy plugins.
- Improved MessageChain and message component handling in legacy plugins.
- Added comprehensive tests for legacy plugin integration and compatibility.
- Updated protocol messages to include provided capabilities in initialization.
- Enhanced top-level module imports to include capability-related functions.
2026-03-13 06:16:57 +08:00
whatevertogo
96ea836edc feat: Enhance legacy API with message chain support and new context handling
- Updated `LegacyContext.send_message` to handle rich message chains using `send_chain`.
- Introduced `LegacyStar` class for backward compatibility with legacy plugins.
- Added `register` decorator for legacy plugin metadata.
- Enhanced `MessageChain` class with `to_payload` and `is_plain_text_only` methods.
- Updated `AstrMessageEvent.send` method to utilize `send_chain` for rich messages.
- Implemented `send_chain` method in `PlatformClient` for sending complex message structures.
- Added capability routing for `platform.send_chain`.
- Introduced tests for new functionality, ensuring compatibility with legacy plugins and message handling.
2026-03-13 05:34:14 +08:00
whatevertogo
7d0802fb9e feat: 更新运行时模块,增强 Peer 和 HandlerDispatcher 功能,优化插件加载和请求处理逻辑,添加新测试用例 2026-03-13 04:28:07 +08:00
whatevertogo
298ccf7437 feat: 更新调度触发器以支持别名,优化 Peer 类的关闭逻辑,增强插件发现功能 2026-03-13 03:48:43 +08:00
whatevertogo
4627276187 feat: 更新文档和测试,确保 LegacyContext 共享和兼容性 2026-03-13 03:42:16 +08:00
whatevertogo
4694f250ba Refactor tests and add integration tests for runtime module
- Added integration tests for the runtime module covering subprocess lifecycle, concurrency, and real-world scenarios in `test_runtime_integration.py`.
- Updated existing test files to include a blank line after module docstrings for consistency.
- Enhanced `test_protocol_legacy_adapter.py` with additional assertions for message output.
- Modified `test_transport.py` to use concrete transport implementations for abstract method tests.
- Improved test cases for handling timeouts and remote handler tracking in `test_timeout_handling.py` and `test_peer_remote_handlers.py`.
2026-03-13 02:18:36 +08:00
whatevertogo
4cb7cbdf96 Add comprehensive tests for HandlerDispatcher and Plugin loading utilities
- Implement tests for HandlerDispatcher in `tests_v4/test_handler_dispatcher.py`, covering initialization, invocation, cancellation, argument building, result consumption, error handling, and handler execution.
- Introduce tests for Plugin loading functionalities in `tests_v4/test_loader.py`, including plugin specification, discovery, environment management, and loading components and handlers.
2026-03-13 01:45:28 +08:00