Commit Graph

158 Commits

Author SHA1 Message Date
whatevertogo
85342f149b feat(tests): 添加测试用例以验证 register_task 的行为并更新测试运行说明 2026-03-19 02:18:58 +08:00
whatevertogo
fdffc09b89 Merge pull request #26 from united-pooh/fix/fix-star-on-error-fallback
fix(runtime): avoid instantiating Star in on_error fallback
2026-03-19 02:13:49 +08:00
united_pooh
3b09747cc1 feat: 完善 memory 向量检索与索引统计 (#28)
Co-authored-by: united_pooh <united_pooh@outlook.com>
2026-03-19 02:06:09 +08:00
whatevertogo
7dda607737 chore: sync subtree from AstrBot 2026-03-19 01:27:23 +08:00
letr
c7d47add23 fix: simplify register_task completion handling (#27)
* 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.
2026-03-19 00:22:35 +08:00
Li-shi-ling
e76a588818 refactor(runtime): unify command matching logic (#25)
* refactor(testing): share command matching with handler dispatcher

* fix:添加公共函数文件
2026-03-19 00:19:52 +08:00
Lishiling
665c9c69ae fix(runtime): avoid virtual dispatch in Star.on_error fallback 2026-03-18 23:21:27 +08:00
Lishiling
200559a580 fix(runtime): avoid creating Star instance in on_error fallback 2026-03-18 23:05:40 +08:00
whatevertogo
6449167726 Remove obsolete test files for testing module, top-level modules, transport, 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.
2026-03-17 21:57:14 +08:00
whatevertogo
b0e4d038ef delete: remove hello_plugin example and its related files 2026-03-17 21:21:03 +08:00
whatevertogo
6d00add2ed Merge branch 'dev' of https://github.com/united-pooh/astrbot-sdk into dev 2026-03-17 20:53:04 +08:00
whatevertogo
c55c89a464 feat: add Star plugin base class and StarTools utility class
- 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.
2026-03-17 20:53:00 +08:00
whatevertogo
693b46ac93 delete again 2026-03-17 20:32:10 +08:00
whatevertogo
39a15bfa86 delete no need thing 2026-03-17 20:32:02 +08:00
whatevertogo
aa0d9ed4be change location 2026-03-17 20:24:49 +08:00
whatevertogo
821c10d176 feat: 增强过滤器类型和能力路由文档,添加 Provider 和会话管理功能 2026-03-17 13:47:17 +08:00
whatevertogo
f8db7ef440 feat: 添加高级方法和辅助函数文档,增强消息组件和事件处理功能 2026-03-17 02:14:16 +08:00
whatevertogo
a6acc3df36 Add comprehensive API documentation for types and utilities in AstrBot 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.
2026-03-17 02:06:18 +08:00
whatevertogo
780580bc3d feat: 大幅增强 SDK 核心功能和文档
新增模块:
- 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 基类增加生命周期钩子和工具方法
2026-03-17 01:15:29 +08:00
whatevertogo
6d60e0f66b feat: 添加 LLM 工具管理和会话级别状态管理能力
- 新增 llm/ 模块,包含 LLMToolSpec、ProviderRequest、AgentSpec 等实体
- 新增 LLMToolManager 用于管理 LLM 工具注册和激活状态
- 新增 SessionPluginManager 用于会话级别的插件启用状态管理
- 新增 SessionServiceManager 用于会话级别的 LLM/TTS 服务状态管理
- 新增 RegistryClient 用于查询 handler 元数据和设置白名单
- 扩展 CapabilityRouter 内置能力,支持 session.* 和 registry.* 命名空间
- 增强描述符和装饰器以支持新的 trigger 类型
2026-03-16 17:53:07 +08:00
whatevertogo
ce8f29953d Merge branch 'refact1/refactsome' into dev 2026-03-16 02:01:38 +08:00
whatevertogo
e2e38bb3b2 Refactor worker initialization and remove unused codec parameters; add 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.
2026-03-16 01:58:52 +08:00
whatevertogo
06f4536851 fix(test): 更新 init_plugin 测试以匹配新的目录命名规范
CLI 的 _normalize_init_plugin_name 函数现在自动添加 astrbot_plugin_ 前缀,
测试期望的目录名从 demo_plugin 更新为 astrbot_plugin_demo_plugin。
2026-03-15 01:33:28 +08:00
whatevertogo
a10a7c87a6 merge: 合并 dev 分支的 msgpack wire codec 等更新 2026-03-15 01:29:09 +08:00
whatevertogo
e3395cc454 feat: 添加 AGENTS.md 文档,描述 v4 架构约束和开发命令
refactor: 更新 HandlerDispatcher 和 WorkerSession,增强参数处理和结果汇总逻辑
2026-03-15 01:26:51 +08:00
united_pooh
ff55f4d0d0 Merge pull request #10 from united-pooh/feat/msgpack-wire-codec
feat(runtime): add configurable msgpack worker transport support
2026-03-15 01:11:28 +08:00
letr
5bcf259fb6 fix(cli): scope worker wire codec option 2026-03-15 00:54:56 +08:00
letr
a979e92568 fix(runtime): preserve json transport compatibility 2026-03-15 00:54:38 +08:00
letr
98a5eddfcb fix(runtime): align msgpack framing with transport defaults 2026-03-15 00:54:37 +08:00
letr
0d7c4994aa feat(runtime): add configurable msgpack wire codec support 2026-03-15 00:54:37 +08:00
united_pooh
fc7ede9d42 Merge branch 'refact1/refactsome' into dev
# Conflicts:
#	src-new/astrbot_sdk/cli.py
#	tests_v4/test_top_level_modules.py
2026-03-15 00:41:38 +08:00
whatevertogo
84184c4c0a feat(errors): Enhance AstrBotError with detailed documentation and examples
feat(events): Expand MessageEvent with reply capabilities and detailed docstrings

fix(loader): Ensure plugin path is correctly managed in sys.path

feat(star): Improve Star class documentation and lifecycle method descriptions

feat(testing): Add plugin metadata handling in MockContext and enhance PluginHarness

feat(hello): Refactor HelloPlugin to utilize new reply methods and structured capabilities

test(decorators): Add tests for input/output model support in provide_capability

test(events): Implement tests for reply_image and reply_chain methods in MessageEvent

test(http): Validate API registration with capability handler references and error handling

test(tests): Enhance tests for plugin harness and directory handling in dev commands
2026-03-14 23:37:09 +08:00
whatevertogo
6bab178d6f refactor: 更新项目架构文档,增强能力客户端和执行边界的描述,移除兼容层设计章节 2026-03-14 23:08:49 +08:00
whatevertogo
6a0f33a3fb refactor: 更新兼容层弃用通知,优化文档结构和可读性 2026-03-14 23:05:10 +08:00
whatevertogo
fc93450bba refactor: 删除过时的架构文档、变更日志和兼容矩阵文件 2026-03-14 23:02:09 +08:00
whatevertogo
956d12cb5c feat: 添加 hello_plugin 示例,包含插件结构、命令处理和测试用例 2026-03-14 22:38:25 +08:00
whatevertogo
0ea532bd91 feat: 增强错误处理,添加上下文信息,优化插件组件加载和参数注入校验 2026-03-14 22:32:01 +08:00
whatevertogo
731fa6d5bd feat: 添加插件热重载功能,支持文件变更时自动重新加载插件 2026-03-14 22:25:51 +08:00
whatevertogo
5aa760f4a6 refactor: 更新文档和代码注释,优化兼容性描述,增强可读性 2026-03-14 22:17:28 +08:00
whatevertogo
1c089b1b2d feat: 更新 SDK 描述,重构插件调用上下文,移除插件 ID 传递,增强能力路由和 HTTP 客户端的插件身份管理 2026-03-14 22:16:21 +08:00
whatevertogo
94514fb19b feat: Enhance handler and capability dispatchers with improved error handling
- Updated HandlerDispatcher to raise TypeError for uninjectable required parameters, logging errors appropriately.
- Refactored CapabilityDispatcher to raise TypeError for missing required parameters during capability execution.
- Renamed _load_plugin_config to load_plugin_config for clarity and consistency.
- Introduced _sync_plugin_registry method in SupervisorRuntime to manage plugin capabilities more effectively.
- Enhanced capability registration logic to handle naming conflicts with better logging and automatic renaming.
- Added tests for handler and capability dispatchers to ensure proper error handling and functionality.
- Implemented new HTTP and metadata capabilities with corresponding tests for registration and retrieval.
- Improved MemoryClient methods with additional tests for save_with_ttl, get_many, delete_many, and stats.
- Added tests for the testing module to ensure proper import and functionality of PluginHarness.
2026-03-14 22:07:10 +08:00
whatevertogo
6127d4ef3f clean it 2026-03-14 21:33:54 +08:00
united_pooh
01743f8f19 Merge pull request #12 from united-pooh/feat/cli-create
feat(cli): normalize plugin init skeletons
2026-03-14 21:11:10 +08:00
united_pooh
5ca586a1bb Update lint.yml 2026-03-14 21:09:48 +08:00
united_pooh
040b893f3b Create lint.yml 2026-03-14 21:08:20 +08:00
united_pooh
eb94f21828 feat(cli): normalize plugin init skeletons
Add interactive plugin init prompts and normalize generated plugin names to the astrbot_plugin_ convention.
Update CLI tests for the new skeleton layout and ignore generated plugin directories in git and coverage tooling.
Also include related runtime logging adjustments from the current worktree.
2026-03-14 21:07:07 +08:00
whatevertogo
d5430f7a94 delete old sdk (#7)
Co-authored-by: whatevertogo <whatevertogo@users.noreply.github.com>
2026-03-14 17:49:47 +08:00
whatevertogo
1612f6a2f1 Merge branch 'refact1/refactsome' of https://github.com/united-pooh/astrbot-sdk into refact1/refactsome 2026-03-14 17:42:01 +08:00
whatevertogo
4282f4f8a5 delete old sdk 2026-03-14 17:41:12 +08:00
whatevertogo
7df01225d5 Merge pull request #6 from united-pooh/refact1/refactsome
refactor: 添加架构文档并完善 v4 兼容层
2026-03-14 17:39:31 +08:00