Commit Graph

75 Commits

Author SHA1 Message Date
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
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
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
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
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
whatevertogo
a3c4c6b096 Refactor legacy API and LLM compatibility logic
- Moved legacy LLM and tool compatibility logic from `_legacy_api.py` to a new module `_legacy_llm.py` for better organization and separation of concerns.
- Updated `_legacy_api.py` to import necessary components from `_legacy_llm.py`, removing redundant code.
- Enhanced database client functionality by adding support for batch read/write operations and change event subscriptions.
- Improved documentation in the database client and capability router to reflect new features.
- Refined environment management process in the loader to better handle plugin grouping and virtual environment management.
2026-03-13 19:31:14 +08:00
whatevertogo
0406d270da 增强旧版兼容性,添加适配器边界的启动和关闭钩子支持 2026-03-13 19:07:20 +08:00
whatevertogo
7b2f6f5497 增强旧版兼容性,添加多个旧路径入口和相关功能 2026-03-13 18:26:13 +08:00
whatevertogo
4680cb405b Refactor legacy runtime execution boundary 2026-03-13 18:08:23 +08:00
whatevertogo
2fe1311b5d Implement legacy hook and tool compat runtime 2026-03-13 17:41:06 +08:00
letr
24c71828b3 fix: preserve unicode sample fixtures in runtime tests 2026-03-13 17:09:49 +08:00
letr
56274c8ee6 docs: clarify compat package boundaries 2026-03-13 17:04:26 +08:00
whatevertogo
885e4fe32e Consolidate controlled legacy facade compatibility 2026-03-13 16:53:05 +08:00
whatevertogo
701384398e Tighten external legacy plugin compatibility smoke tests 2026-03-13 16:24:28 +08:00
whatevertogo
d83e2551b7 Expand legacy astrbot package compatibility 2026-03-13 16:02:30 +08:00
whatevertogo
dc365fdad0 Add legacy session waiter compatibility 2026-03-13 15:42:19 +08:00
whatevertogo
10d3990970 Merge pull request #3 from united-pooh/refact1/envs_manager
实现 v4 运行时插件分组环境管理
2026-03-13 15:18:44 +08:00
united_pooh
aa5ace7eac 实现 v4 运行时插件分组环境管理 2026-03-13 15:13:23 +08:00
whatevertogo
91b5ed400e Improve legacy plugin compat and add mrfzccl fixture 2026-03-13 15:01:42 +08:00
Lishiling
945bc3bc34 add:数据库添加批量操作支持,附测试代码 2026-03-13 11:02:31 +08:00
whatevertogo
0064716f73 Fix runtime init and stream capability semantics 2026-03-13 07:28:59 +08:00
whatevertogo
3ba9b24522 feat: 更新文档和测试,增强旧版插件兼容性及能力装饰器的命名约束 2026-03-13 06:45:49 +08:00
whatevertogo
b0f13a00a6 feat: 添加旧版插件兼容测试及相关配置文件 2026-03-13 06:41:27 +08:00
whatevertogo
3d5c8f7ff7 feat(protocol): 优化协议模块导出,确保根目录专注于原生 v4 模型,遗留适配器从子模块显式导入 2026-03-13 06:34:57 +08:00
whatevertogo
a93f267d8a feat(loader): enhance plugin import handling and legacy compatibility
- Updated `import_string` to evict conflicting cached top-level plugin packages, ensuring proper isolation of plugins with the same package names.
- Preserved the order of legacy handler declarations in `_iter_discoverable_names` to maintain expected behavior for legacy plugins.
- Added tests to verify the isolation of top-level packages and the preservation of handler declaration order.
- Improved module cleanup in tests to prevent conflicts between plugins.
2026-03-13 06:32:26 +08:00
whatevertogo
4b6e20468b feat: 更新文档和代码,优化运行时模块的导出,确保高级原语的稳定性和兼容性 2026-03-13 06:23:00 +08:00
whatevertogo
9c5ecf0a13 feat: Enhance plugin capability support and legacy compatibility
- Introduced LoadedCapability class to manage plugin capabilities.
- Updated load_plugin function to discover and load capabilities alongside handlers.
- Enhanced Peer class to handle remote provided capabilities during initialization.
- Added tests for capability registration and invocation in legacy plugins.
- Improved MessageChain and message component handling in legacy plugins.
- Added comprehensive tests for legacy plugin integration and compatibility.
- Updated protocol messages to include provided capabilities in initialization.
- Enhanced top-level module imports to include capability-related functions.
2026-03-13 06:16:57 +08:00
whatevertogo
d7aa75aff0 fix: 优化配置值规范化逻辑,确保类型检查更为严谨 2026-03-13 05:48:58 +08:00
whatevertogo
72d600679f feat: 更新遗留 API,支持标量 JSON 值和兼容性文档,增强消息组件和事件过滤器功能 2026-03-13 05:44:01 +08:00
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
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