Commit Graph

13 Commits

Author SHA1 Message Date
whatevertogo
8ebf5489b6 feat: 更新协议模块,增强 v4 协议适配器和消息解析功能,添加新测试用例 2026-03-13 04:15:43 +08:00
whatevertogo
ae5d6dc692 feat: 增强 v4 客户端功能,添加内存获取和错误处理,更新文档和测试用例 2026-03-13 04:02:07 +08:00
whatevertogo
7cab1cd432 feat: 更新 CLAUDE 和 AGENTS 文档,添加 v4 迁移对比文档,增强兼容性说明 2026-03-13 03:48:54 +08:00
whatevertogo
4627276187 feat: 更新文档和测试,确保 LegacyContext 共享和兼容性 2026-03-13 03:42:16 +08:00
whatevertogo
cdf72b75a4 feat: 实现 v4 API 兼容层,支持旧版插件导入路径
新增模块:
- api/basic/: AstrBotConfig, BaseConversationManager, Conversation
- api/event/: AstrMessageEvent, AstrBotMessage, EventType, MessageType,
  MessageSession, EventResult 等核心事件类型
- api/message/: MessageChain 及所有消息组件 (Plain, At, Image, File 等)
- api/platform/: PlatformMetadata 平台元数据类型
- api/provider/: LLMResponse 提供者响应实体
- api/star/star.py: StarMetadata 插件元数据类型

更新模块:
- api/__init__.py: 导出所有子模块
- api/components/: 扩展 Command 兼容性
- api/event/filter.py: 增强 filter 装饰器兼容性
- context.py, decorators.py, events.py: 顶层兼容入口

测试更新:
- test_api_event_filter.py: 验证 filter 兼容性
- test_api_modules.py: 验证新模块可导入
- test_handler_dispatcher.py: 验证处理器分发

文档更新:
- AGENTS.md/CLAUDE.md: 添加兼容层设计说明,避免重复造轮子

设计原则:
- 兼容层通过 thin re-export 方式暴露旧版 API
- 不复制独立运行时逻辑,保持架构清晰
- 新版推荐使用顶层模块导入路径
2026-03-13 03:17:03 +08:00
whatevertogo
54b6ca7b7d 修正重要说明中的标点,确保新实现兼容旧实现并遵循良好设计原则 2026-03-13 02:54:34 +08:00
whatevertogo
6f1373ed32 feat: 添加重要说明,确保新实现兼容旧实现并遵循良好设计原则 2026-03-13 02:51:31 +08:00
whatevertogo
d330b595de fix: 修复 LegacyConversationManager 和 Peer 的异步处理逻辑,确保正确处理取消和初始化事件 2026-03-13 02:18:26 +08:00
whatevertogo
280e32bfae feat: 添加旧版会话管理器的兼容实现,支持会话数据的存储、获取和删除功能
feat: 在内存客户端中添加精确获取记忆项的功能
feat: 在事件消息中添加字段约束验证,确保各阶段的字段符合要求
feat: 在 SupervisorRuntime 中注册 handler 时处理冲突并输出警告
2026-03-13 01:45:17 +08:00
whatevertogo
9bf831810d feat: 添加测试框架和相关测试用例,涵盖 API 装饰器、事件、上下文和传输通信 2026-03-13 00:29:12 +08:00
whatevertogo
8922e1409c Refactor code structure for improved readability and maintainability 2026-03-12 23:24:35 +08:00
whatevertogo
db9cb169e4 feat: Enhance Supervisor and Worker Runtime with Internal Capabilities and Lifecycle Hooks
- Added internal capability for handler invocation in SupervisorRuntime.
- Implemented lifecycle hooks (on_start, on_stop) in Star class and PluginWorkerRuntime.
- Updated CapabilityRouter to support request_id in call and stream handlers.
- Refactored message handling in PeerRuntime to include request_id.
- Introduced tests for API contract, legacy adapter, and migration scenarios.
- Improved WebSocketServerTransport to manage connection state more effectively.
- Enhanced plugin loading and discovery to maintain compatibility with legacy systems.
2026-03-12 22:46:22 +08:00
whatevertogo
9d04cec8a4 feat: Implement Peer and Transport layers for asynchronous communication
- Added Peer class for managing peer-to-peer communication, including initialization, invocation, and cancellation of requests.
- Introduced Transport abstract base class with StdioTransport and WebSocketTransport implementations for message handling.
- Created Star class for error handling in event-driven architecture.
- Developed MemoryTransport for testing purposes, allowing in-memory communication between peers.
- Implemented unit tests for Peer functionality, protocol message parsing, and runtime integration with plugins.
- Established entry point tests to ensure package import and command-line interface functionality.
2026-03-12 21:42:46 +08:00