Commit Graph

145 Commits

Author SHA1 Message Date
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
whatevertogo
2e1ad839bb Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-14 17:35:44 +08:00
whatevertogo
89d3e2f014 Add architecture doc and refine API compat
- Add PROJECT_ARCHITECTURE.md documenting architecture, compat surface,
  and testing notes.
- Update astrbot_sdk.api.__init__ to clarify it is a compatibility
  implementation layer, not a simple facade, and list migration targets.
- Normalize platform in AstrMessageEvent.to_payload to emit a string id
  by using get_platform_id().
2026-03-14 17:17:25 +08:00
whatevertogo
1672bc3227 Add v4 compat layer and legacy shims
- Introduce private v4 compatibility surface using
  _legacy_api.py, _legacy_runtime.py, _legacy_loader.py plus new
  _legacy_context.py and _legacy_star.py to centralize legacy adapters
  while keeping public APIs thin.
- Extend InitializeOutput to carry protocol_version for negotiated
  protocol, enabling runtime to adapt to the chosen v4 version.
- Add lightweight legacy support for Star/Context via new LegacyStar and
  LegacyContext shims and expose legacy API through the aggregate
  _legacy_api entry point.
- Ensure legacy loader preserves class declaration order by iterating
  module.__dict__ instead of relying on alphabetical sorting.
- Add tests: protocol_version handling in InitializeOutput, legacy
  main component order preservation, and embedded-newline framing in
  transport tests.
2026-03-14 17:16:42 +08:00
whatevertogo
142d3ad747 Merge pull request #5 from united-pooh/refact1/envs_manager 2026-03-14 01:29:45 +08:00
united_pooh
76319d633d Support grouped plugin workers in shared environments
- add group metadata driven worker startup for shared env plans
- track per-plugin handler and capability ownership inside grouped workers
- update runtime and smoke tests for grouped worker session behavior
2026-03-14 01:11:21 +08:00
whatevertogo
61c3015ea6 Merge pull request #4 from letr007/chore/compat-structure-cleanup 2026-03-14 00:41:21 +08:00
whatevertogo
e891cc8c8d refactor: 更新兼容层和导入路径,优化文档描述 2026-03-13 23:55:39 +08:00
whatevertogo
2074053624 Refactor legacy runtime handling and improve plugin loading
- Updated `handler_dispatcher.py` to streamline legacy runtime preparation and dispatching results.
- Enhanced `loader.py` to simplify legacy plugin detection and manifest building.
- Added tests for new HTTPClient and MetadataClient functionalities.
- Introduced tests for legacy context metadata methods and legacy loader helpers.
- Improved legacy runtime tests to cover new functionality and edge cases.
2026-03-13 23:44:32 +08:00
whatevertogo
1fec76eda1 feat: add platform client documentation and examples
- Introduced platform client documentation in `docs/v4/clients/platform.md` detailing methods for sending messages, images, and managing group members.
- Added example plugins for LLM chat and database functionalities in `docs/v4/examples/README.md`, `docs/v4/examples/llm-chat/README.md`, and `docs/v4/examples/database/README.md`.
- Enhanced quickstart guide with links to new documentation and example plugins.
- Implemented runtime contract tests to ensure compatibility of public capabilities and hooks.
2026-03-13 21:09:13 +08:00
whatevertogo
1c4c9677bb feat: 添加插件初始化、验证和构建命令,增强 CLI 功能 2026-03-13 20:55:03 +08:00
whatevertogo
623e0c1f33 feat: Enhance CLI and testing capabilities
- Added a new script entry point `astrbot-sdk` in `pyproject.toml`.
- Introduced `has_waiter` method in `SessionWaiterManager` to check for existing waiters.
- Updated `cli.py` to improve error handling and added context to error messages.
- Implemented local development support in `cli.py` with a new `dev` command for running plugins against a mock core.
- Created a new testing module `astrbot_sdk.testing` with utilities for local development and plugin testing.
- Added comprehensive tests for the new testing module and CLI commands.
- Improved compatibility and error messaging for plugin loading failures.
2026-03-13 20:26:42 +08:00
united_pooh
b69d9e2067 Merge remote-tracking branch 'origin/refact1/refactsome' into refact1/envs_manager 2026-03-13 19:44:43 +08:00
united_pooh
980efbc23f 补充插件分组环境测试覆盖 2026-03-13 19:44:03 +08:00