Open
Conversation
feat(runtime): add configurable msgpack worker transport support
refactor: 更新 HandlerDispatcher 和 WorkerSession,增强参数处理和结果汇总逻辑
CLI 的 _normalize_init_plugin_name 函数现在自动添加 astrbot_plugin_ 前缀, 测试期望的目录名从 demo_plugin 更新为 astrbot_plugin_demo_plugin。
…d schedule and session waiter modules - Simplified `GroupWorkerRuntime` and `PluginWorkerRuntime` constructors by removing the codec parameter and related logic. - Introduced `schedule.py` to define `ScheduleContext` for managing scheduled tasks with a clear structure and payload handling. - Added `session_waiter.py` for session-based conversational flow management, including `SessionController` and `SessionWaiterManager` for handling multi-turn dialogues. - Enhanced testing utilities in `testing.py` by removing unused classes and streamlining the structure. - Created `types.py` to introduce `GreedyStr` for improved command parameter parsing.
- 新增 llm/ 模块,包含 LLMToolSpec、ProviderRequest、AgentSpec 等实体 - 新增 LLMToolManager 用于管理 LLM 工具注册和激活状态 - 新增 SessionPluginManager 用于会话级别的插件启用状态管理 - 新增 SessionServiceManager 用于会话级别的 LLM/TTS 服务状态管理 - 新增 RegistryClient 用于查询 handler 元数据和设置白名单 - 扩展 CapabilityRouter 内置能力,支持 session.* 和 registry.* 命名空间 - 增强描述符和装饰器以支持新的 trigger 类型
新增模块: - clients/files.py: 文件上传/下载客户端 - clients/managers.py: 会话/LLM/Provider 管理器 - clients/provider.py: LLM Provider 客户端 - conversation.py: 对话上下文管理 - plugin_kv.py: 插件 KV 存储辅助 - runtime/limiter.py: 限流器 - star_tools.py: Star 工具函数 - docs/: 完整的 SDK 使用文档 (01-05) 功能增强: - Context 大幅扩展,增加 reply/send_image/typing 等便捷方法 - 装饰器增强,支持 on_llm_request/on_provider_request 等 - 内置 schemas 扩展,覆盖更多 capability 定义 - capability_router_builtins 大幅扩展内置能力实现 - handler_dispatcher 增强参数注入和错误处理 - Star 基类增加生命周期钩子和工具方法
…t SDK - Introduced `types.md` detailing type aliases, generics, and Pydantic models used in the SDK. - Added `utils.md` covering utility classes and functions including CancelToken, MessageSession, command groups, and session management. - Included usage examples and detailed descriptions for each component to enhance developer understanding and ease of use.
- Introduced `Star` class as a base for v4 native plugins, providing lifecycle methods and context management. - Added `StarTools` class for accessing runtime context and managing LLM tools. - Implemented `PluginHarness` for local development and testing of plugins, allowing for message dispatching and lifecycle management. - Created `GreedyStr` type for enhanced command parameter parsing, enabling the capture of remaining command text as a single argument. - Added testing utilities and mock capabilities for plugin development.
…nsport, and wire codecs - Deleted `test_testing_module.py` as it is no longer needed. - Removed `test_top_level_modules.py` which had no content. - Eliminated `test_transport.py` due to redundancy. - Cleared out `test_wire_codecs.py` as part of the cleanup.
* refactor(testing): share command matching with handler dispatcher * fix:添加公共函数文件
* fix: simplify register_task completion handling Remove duplicated cancellation logging in Context.register_task while keeping Future inputs compatible with asyncio.create_task semantics. Add regression coverage for coroutine, Future, cancellation, and failure paths. * fix: prioritize local src in tests_v4 Ensure tests_v4 always imports the working tree package by moving src to sys.path[0] even when another checkout or installed copy is already present.
Co-authored-by: united_pooh <united_pooh@outlook.com>
fix(runtime): avoid instantiating Star in on_error fallback
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ansports - Added functions to build SSL contexts for both server and client websocket transports. - Updated WebSocketServerTransport to accept an optional SSL context and modified the URL scheme based on SSL context presence. - Enhanced WebSocketClientTransport to utilize SSL context and server hostname. - Introduced a new workers manifest file to define remote worker configurations with TLS settings. - Updated worker runtime classes to handle worker IDs and plugin specifications more flexibly. - Added tests to validate the new websocket parameters and workers manifest loading.
fix: 修复 StdioTransport 中的异常处理逻辑,确保在读取过程中正确处理 ValueError fix: 更新 WorkerSession 初始化错误处理,提供更清晰的错误日志
feat: 添加多个装饰器错误处理函数,增强装饰器的错误上下文信息
feat: 添加错误处理包装函数,增强客户端异常处理能力
…-sdk - Changed all mentions of "v4" to "astrbot-sdk" in documentation and code comments. - Updated protocol references from "v4" to "s5r" in relevant files. - Adjusted error messages and class descriptions to reflect the new naming conventions. - Ensured consistency across all modules, including AGENTS.md, CLAUDE.md, and various source files. - Modified test cases to align with the updated protocol versioning.
src/astrbot_sdk/cli.py - Why: _run_async_entrypoint 和 _run_sync_entrypoint 存在完全重复的异常处理和生命周期管理逻辑 - How: 提取 _run_entrypoint 通用入口和 _handle_cli_entrypoint_failure 统一错误处理;引入 _LocalDevState dataclass 替代裸 dict 传递 dev 状态,通过 dispatch_kwargs() 消除重复参数拆包;提取 _should_include_plugin_file 统一 watch/build 文件过滤规则;将 _iter_watch_files 从 rglob 改为 scandir 逐层遍历避免不必要的递归 src/astrbot_sdk/context.py - Why: Context 和 PlatformCompatFacade 中大量 proxy.call + try/except + _wrap_context_exception 样板代码重复 - How: 提取 _call_proxy_with_context 和 Context._call_proxy 统一 proxy 调用与异常包装;提取 _normalize_platform_instance_payload 统一平台实例载荷校验;提取 _platform_lookup_target / _match_platform_instance 统一平台查找逻辑 src/astrbot_sdk/events.py - Why: MessageEvent.from_payload 中 target 解析逻辑在 session_key_from_payload 等场景也需要复用 - How: 提取 _resolve_message_target 辅助函数,新增 MessageEvent.session_key_from_payload 静态方法供 dispatcher 直接使用 src/astrbot_sdk/runtime/handler_dispatcher.py - Why: invoke 方法中 session_waiter 和普通 handler 路径存在大量重复的 Context 构建、task 生命周期管理代码 - How: 提取 _create_context_event / _spawn_plugin_task / _await_tracked_task / _resolve_waiter_plugin_id 等方法消除重复,使主路径逻辑更清晰 src/astrbot_sdk/runtime/loader.py - Why: load_plugin_config_schema / load_plugin_config / _load_state 中 JSON 文件读取+校验逻辑完全重复;_copy_limiter_meta / _copy_conversation_meta 手工逐字段拷贝易与 dataclass 定义漂移 - How: 提取 _read_json_object 统一 JSON 读取与容错;合并 _copy_meta 使用 dataclasses.replace 替代手工字段拷贝 src/astrbot_sdk/runtime/supervisor.py - Why: _sync_remote_state 中每个 metadata 字段的 isinstance 校验+列表推导模式重复;_publish_session_runtime_metadata 中 llm_tools/agents 按 plugin 分组逻辑完全重复 - How: 提取 _metadata_string_list / _metadata_string_dict / _metadata_dict_list / _group_records_by_plugin 通用元数据辅助函数;将 issues 解析独立为 _parse_remote_issues 方法 tests/test_protocol_stdout.py - Why: 验证 _snapshot_watch_files 的文件过滤和 _LocalDevState.dispatch_kwargs 的字段归一化行为 - How: 新增 test_snapshot_watch_files_skips_build_artifacts_and_caches 和 test_local_dev_state_dispatch_kwargs_normalize_fields 测试 tests/test_provider_client_context_regressions.py - Why: 验证 MockContext 中平台查找方法复用归一化后的实例记录 - How: 新增 test_mock_context_platform_lookup_reuses_normalized_instance_records 测试 tests/test_runtime_loader_regressions.py - Why: 验证 loader JSON 配置辅助函数对非对象类型 JSON 的容错行为 - How: 新增 test_plugin_config_helpers_treat_non_object_json_as_empty 测试;修正已有热重载测试断言验证模块缓存清理正确性 tests/test_runtime_supervisor_registry_sync.py - Why: 验证 _sync_remote_state 对各类 metadata 字段的鲁棒解析;修正 init waiter 失败测试匹配新的异常链结构 - How: 新增 test_worker_session_sync_remote_state_normalizes_metadata_shapes 测试;更新 test_worker_session_start_surfaces_init_waiter_failure 断言 tests/test_testing_session_waiter.py - Why: 验证 session waiter dispatch 只创建一次 Context 避免重复构建 - How: 新增 test_session_waiter_dispatch_builds_runtime_context_once 测试,通过猴子补丁 Context 记录创建次数
jj: typo: remove unused import
- propagate configured wire codecs through supervisor/worker runtime paths - reject unsupported custom codecs for local worker subprocess spawning - cover local worker command codec handling with regression tests
feat: msgpack wire codec
- 将 _plugin_spec() 函数中的硬编码 /tmp 路径替换为跨平台的临时目录 - 使用 pytest 的 tmp_path fixture 或 tempfile.gettempdir() 作为后备 - 更新所有使用 _plugin_spec() 的测试函数以接受 tmp_path 参数 - 修复了在 Windows 等 Unix 以外的平台上运行测试时的潜在路径问题 影响范围: tests/test_runtime_worker.py
test: 修复 test_runtime_worker.py 中的硬编码 Unix 路径以提高跨平台兼容性
- Removed unused local MCP tool management from ProviderCapabilityMixin. - Cleaned up SystemCapabilityMixin by removing deprecated file handling and event management methods. - Updated CapabilityRouter to eliminate local MCP server references and related attributes. - Removed MCP-related tests and decorators that are no longer applicable. - Adjusted tests to reflect the removal of MCP server functionality and ensure compatibility with the updated codebase.
Why: - AstrBot needs the SDK to support Python 3.10 as an official floor instead of only documenting 3.12+ - the repository needed real compatibility validation instead of metadata-only changes How: - lower package metadata and public docs/templates to >=3.10 and add a CI test matrix for 3.10-3.13 - add Python 3.10 fallbacks for CLI Traversable imports and vendor sync TOML loading - update version-sensitive tests and record the design/review artifacts for this compatibility change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.