Commit Graph

62 Commits

Author SHA1 Message Date
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
ae73a18f60 docs: 更新 CLAUDE 和 AGENTS 文档,添加旧 Star 文档以描述遗留行为,确保兼容性和功能完整性 2026-03-13 05:12:52 +08:00
whatevertogo
a533a30985 Remove deprecated documentation files related to code interpreter, built-in commands, context compression, custom rules, function calling, old knowledge base, knowledge base, MCP, plugins, proactive agent, skills, subagent, unified webhook, web search, and web UI management. Update references to the latest features and functionalities in AstrBot. 2026-03-13 05:07:31 +08:00
whatevertogo
1706e89d14 Merge branch 'refact1/refactsome' of https://github.com/united-pooh/astrbot-sdk into refact1/refactsome 2026-03-13 05:06:53 +08:00
whatevertogo
f4f7f69e29 docs: 加入旧文档方便开发 2026-03-13 05:06:36 +08:00
whatevertogo
136d8f915d Add new documentation for various features and functionalities in AstrBot
- Introduced a new guide for the Docker-based code interpreter, including setup instructions and usage examples.
- Added a section on built-in commands available in AstrBot.
- Documented the automatic context compression feature to manage conversation history efficiently.
- Explained the custom rules functionality for flexible message handling based on source.
- Provided details on function calling capabilities for external tool integration.
- Updated the knowledge base documentation to reflect the new system and its configuration.
- Added instructions for using the MCP (Model Context Protocol) for enhanced tool interaction.
- Documented the new proactive agent capabilities for scheduling tasks and sending multimedia messages.
- Introduced the concept of subagents for task delegation within AstrBot.
- Explained the unified webhook mode for simplified configuration across multiple platforms.
- Added a guide for the web search functionality to enhance information retrieval.
- Updated the management panel documentation for better user guidance on configuration and plugin management.
2026-03-13 05:04:48 +08:00
whatevertogo
9d05934d53 feat: 添加稳定错误码常量,重构能力描述符以使用协议模式,更新相关测试用例 2026-03-13 04:46:00 +08:00
whatevertogo
a106354e20 feat: 更新文档和代码,移除过时注释,增强兼容性和错误处理,添加新测试用例 2026-03-13 04:39:12 +08:00
whatevertogo
cc5dc9266c feat: 重构处理器分发和插件加载模块,增强兼容性和错误处理,更新文档 2026-03-13 04:37:13 +08:00
whatevertogo
7d0802fb9e feat: 更新运行时模块,增强 Peer 和 HandlerDispatcher 功能,优化插件加载和请求处理逻辑,添加新测试用例 2026-03-13 04:28:07 +08:00
whatevertogo
8ebf5489b6 feat: 更新协议模块,增强 v4 协议适配器和消息解析功能,添加新测试用例 2026-03-13 04:15:43 +08:00
whatevertogo
2e990f81e0 feat: 移除多个模块中的 TODO 注释,优化代码可读性 2026-03-13 04:15:02 +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
298ccf7437 feat: 更新调度触发器以支持别名,优化 Peer 类的关闭逻辑,增强插件发现功能 2026-03-13 03:48:43 +08:00
whatevertogo
4627276187 feat: 更新文档和测试,确保 LegacyContext 共享和兼容性 2026-03-13 03:42:16 +08:00
whatevertogo
ffafd74881 docs: 增强 api 模块兼容层文档,提示插件作者迁移
- 添加 warning 块明确标注为 v3 兼容层
- 提示插件制作者迁移至新版导入路径
- 添加迁移示例代码对比旧版/新版导入方式
- 说明兼容层将在未来版本移除
2026-03-13 03:31:00 +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
9d83fccafd feat: 添加新旧架构对比文档,详细说明各模块的功能和结构变化 2026-03-13 02:44:53 +08:00
whatevertogo
ca2beb79a2 feat: 添加新旧对比文档,详细说明各模块结构变化及功能缺失 2026-03-13 02:44:42 +08:00
whatevertogo
3c158760f9 feat: 添加协议模块及消息定义,详细说明新版协议与旧版的差异 2026-03-13 02:37:13 +08:00
whatevertogo
bfe5b21f6b feat: 添加新版 API 模块文档,详细说明与旧版的差异及缺失内容 2026-03-13 02:33:42 +08:00
whatevertogo
921223d3e9 feat: 添加客户端模块文档,详细说明各模块功能及与旧版的对比 2026-03-13 02:32:04 +08:00
whatevertogo
97ac3ee76b feat: 添加对 astrbot_sdk 第一层模块的测试,确保模块可导入及公共 API 正确导出 2026-03-13 02:28:15 +08:00
whatevertogo
59715cffa1 feat: 添加 API 模块的兼容层文档,提供旧版接口的说明和迁移指南 2026-03-13 02:24:00 +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
d330b595de fix: 修复 LegacyConversationManager 和 Peer 的异步处理逻辑,确保正确处理取消和初始化事件 2026-03-13 02:18:26 +08:00
whatevertogo
024b043567 Merge branch 'refact1/refactsome' of https://github.com/united-pooh/astrbot-sdk into refact1/refactsome 2026-03-13 01:45:30 +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
whatevertogo
280e32bfae feat: 添加旧版会话管理器的兼容实现,支持会话数据的存储、获取和删除功能
feat: 在内存客户端中添加精确获取记忆项的功能
feat: 在事件消息中添加字段约束验证,确保各阶段的字段符合要求
feat: 在 SupervisorRuntime 中注册 handler 时处理冲突并输出警告
2026-03-13 01:45:17 +08:00
united_pooh
f865b2b7e9 chore(runtime): 使用 ruff format 并为 peer 补充中文文档
- 运行 ruff format 统一代码格式
- 说明 Peer 在协议层中的命名含义
- 为 Peer 类及其所有方法补充中文注释型文档
2026-03-13 01:39:22 +08:00
whatevertogo
0159b008c3 Add unit tests for protocol messages and transport implementations
- Created `test_protocol_messages.py` to cover tests for protocol message models including ErrorPayload, PeerInfo, InitializeMessage, ResultMessage, InvokeMessage, EventMessage, CancelMessage, and the parse_message function.
- Implemented validation tests to ensure required fields and serialization behavior.
- Added `test_transport.py` to test the Transport base class and its implementations: StdioTransport and WebSocketTransport.
- Included tests for lifecycle methods, message handling, and error conditions in transport classes.
2026-03-13 01:17:23 +08:00
whatevertogo
055198336e feat: 添加测试用例,覆盖各个客户端的实现,包括 CapabilityProxy、DBClient、LLMClient、MemoryClient 和 PlatformClient 2026-03-13 01:06:06 +08:00
whatevertogo
9d9cd9dd6d feat: 添加测试用例,覆盖 API 装饰器、事件过滤器和遗留上下文的功能 2026-03-13 00:47:31 +08:00
whatevertogo
9bf831810d feat: 添加测试框架和相关测试用例,涵盖 API 装饰器、事件、上下文和传输通信 2026-03-13 00:29:12 +08:00
united_pooh
c3ccc2b5da style: 🎨 使用ruff对项目进行format 2026-03-13 00:17:59 +08:00
whatevertogo
0d01998637 feat: 添加 AstrBot SDK v4 架构与实现文档,包含目录、核心设计原则及模块详解 2026-03-13 00:07:44 +08:00
whatevertogo
b2d87df223 feat: 增强 LegacyContext 和 WorkerSession 的消息处理,支持更灵活的参数传递和连接关闭管理 2026-03-13 00:07:34 +08:00
whatevertogo
8922e1409c Refactor code structure for improved readability and maintainability 2026-03-12 23:24:35 +08:00
whatevertogo
488c91d758 feat: 在初始化失败时停止 Peer 实例并更新测试用例以验证关闭状态 2026-03-12 22:59:51 +08:00
whatevertogo
61eecd2024 feat: 添加对保留能力命名空间的检查,防止暴露注册 2026-03-12 22:56:27 +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
140344322b refactor: 移除重构架构设计文档中的冗余内容 2026-03-12 22:01:45 +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
united_pooh
b7d4b647be test: add independent worker resource benchmark 2026-03-12 01:22:20 +08:00
united_pooh
166bf4254c feat: restore independent plugin workers 2026-03-11 23:10:02 +08:00
Soulter
a04d668cf6 refactor: update put_kv_data and get_kv_data methods in Context class to accept dictionary values 2025-11-27 18:10:21 +08:00
Soulter
21a7e742f1 refactor: update component registration method in Context class to use private method 2025-11-27 16:47:57 +08:00