Skip to content

feat: vendor AstrBot SDK snapshot#7645

Open
whatevertogo wants to merge 2 commits intoAstrBotDevs:masterfrom
whatevertogo:stack/pr1-sdk-vendor
Open

feat: vendor AstrBot SDK snapshot#7645
whatevertogo wants to merge 2 commits intoAstrBotDevs:masterfrom
whatevertogo:stack/pr1-sdk-vendor

Conversation

@whatevertogo
Copy link
Copy Markdown
Contributor

This PR vendors the current astrbot-sdk snapshot into the main repository as a standalone change.

Modifications / 改动点

  • add the vendored astrbot-sdk/ package tree

  • add SDK sync scripts for Windows and Unix environments

  • ignore local SDK testing artifacts in .gitignore

  • keep this PR limited to vendor content and sync tooling only

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

Verification steps used while preparing the split:

git diff --stat upstream/master..stack/pr1-sdk-vendor

Result summary:

  • vendor-only diff
  • 111 files changed
  • 33573 insertions

Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“Verification Steps”和“运行结果”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Copilot AI review requested due to automatic review settings April 18, 2026 09:42
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Apr 18, 2026
@dosubot dosubot Bot added the area:core The bug / feature is about astrbot's core, backend label Apr 18, 2026
@whatevertogo
Copy link
Copy Markdown
Contributor Author

@codex review it

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Vendors a snapshot of astrbot-sdk into the main repo, including the runtime/protocol layer and sync tooling to keep the subtree updated.

Changes:

  • Added the astrbot-sdk/ src-layout package tree (runtime, protocol models, typed clients, internal helpers).
  • Introduced built-in capability router mixins for SDK-side mock/runtime bridging (LLM/DB/HTTP/Conversation, etc.).
  • Added vendoring documentation and packaging metadata (README.md, VENDORED.md, pyproject.toml, LICENSE notice).

Reviewed changes

Copilot reviewed 75 out of 111 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/capabilities/llm.py Adds built-in LLM capability handlers (echo + streaming stub) for the router bridge
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/capabilities/http.py Adds HTTP route registration/listing built-ins with route + namespace validation
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/capabilities/db.py Adds plugin-scoped DB KV built-ins (get/set/delete/list/batch/watch)
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/capabilities/conversation.py Adds in-memory conversation CRUD capabilities for sessions
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/capabilities/init.py Exports capability mixins for builtin capability registration
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/bridge_base.py Provides shared bridge helpers (schema descriptors, mock embeddings, session/platform helpers)
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/_host.py Defines the host interface/attributes used by the builtin bridge/mixins
astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/init.py Combines builtin capability mixins into a single router mixin registration surface
astrbot-sdk/src/astrbot_sdk/runtime/init.py Adds runtime public exports with lazy imports to avoid heavy dependencies on import
astrbot-sdk/src/astrbot_sdk/protocol/messages.py Adds protocol message models (initialize/invoke/result/event/cancel) and parsing
astrbot-sdk/src/astrbot_sdk/protocol/descriptors.py Adds protocol descriptor models (capabilities, handlers, triggers, filters) + schema governance
astrbot-sdk/src/astrbot_sdk/protocol/codec.py Adds JSON/Msgpack protocol codecs for message encoding/decoding
astrbot-sdk/src/astrbot_sdk/protocol/init.py Defines protocol package public entrypoint and re-exports
astrbot-sdk/src/astrbot_sdk/plugin_kv.py Adds plugin-scoped KV helper mixin backed by runtime DB client
astrbot-sdk/src/astrbot_sdk/message_session.py Adds backward-compatible export shim for MessageSession
astrbot-sdk/src/astrbot_sdk/message_result.py Adds backward-compatible module alias shim for message result module
astrbot-sdk/src/astrbot_sdk/message_components.py Adds backward-compatible module alias shim for message components module
astrbot-sdk/src/astrbot_sdk/message/session.py Adds MessageSession value object + parsing/normalization
astrbot-sdk/src/astrbot_sdk/message/result.py Adds rich message chain/result/builder utilities for handlers
astrbot-sdk/src/astrbot_sdk/message/init.py Re-exports message components/results/session subpackage API
astrbot-sdk/src/astrbot_sdk/llm/tools.py Adds LLM tool manager helper calling llm_tool.manager capabilities
astrbot-sdk/src/astrbot_sdk/llm/providers.py Adds typed provider proxies (STT/TTS/Embedding/Rerank) and factory
astrbot-sdk/src/astrbot_sdk/llm/entities.py Adds Pydantic entities for providers/tools/requests
astrbot-sdk/src/astrbot_sdk/llm/agents.py Adds agent metadata + base runner type for registration surface
astrbot-sdk/src/astrbot_sdk/llm/init.py Adds lazy-loaded LLM package exports
astrbot-sdk/src/astrbot_sdk/filters.py Adds SDK-native declarative filters with local evaluation bindings
astrbot-sdk/src/astrbot_sdk/errors.py Adds cross-boundary AstrBotError model + stable error codes and (de)serialization
astrbot-sdk/src/astrbot_sdk/conversation.py Adds ConversationSession helper for interactive session flows and state transitions
astrbot-sdk/src/astrbot_sdk/commands.py Adds command grouping utilities and command tree rendering
astrbot-sdk/src/astrbot_sdk/clients/skills.py Adds typed skill registration client
astrbot-sdk/src/astrbot_sdk/clients/session.py Adds session-scoped plugin/service managers
astrbot-sdk/src/astrbot_sdk/clients/registry.py Adds read-only handler registry client + handler metadata model
astrbot-sdk/src/astrbot_sdk/clients/provider.py Adds provider discovery + provider manager client (+ watch hooks)
astrbot-sdk/src/astrbot_sdk/clients/platform.py Adds platform messaging client with rich chain serialization and stats models
astrbot-sdk/src/astrbot_sdk/clients/permission.py Adds permission query/manager clients
astrbot-sdk/src/astrbot_sdk/clients/metadata.py Adds metadata client and plugin metadata model (+ config access guard)
astrbot-sdk/src/astrbot_sdk/clients/memory.py Adds memory client (namespace support, search/save/get/delete, ttl, batch, stats)
astrbot-sdk/src/astrbot_sdk/clients/llm.py Adds LLM client (chat/chat_raw/stream_chat) with payload shaping + response model
astrbot-sdk/src/astrbot_sdk/clients/http.py Adds HTTP API registration client with capability resolution helpers
astrbot-sdk/src/astrbot_sdk/clients/db.py Adds DB client (KV get/set/delete/list, batch, watch)
astrbot-sdk/src/astrbot_sdk/clients/_proxy.py Adds CapabilityProxy abstraction that validates/dispatches capability calls/streams
astrbot-sdk/src/astrbot_sdk/clients/_errors.py Adds client exception wrapper helpers for more contextual failures
astrbot-sdk/src/astrbot_sdk/clients/init.py Re-exports SDK typed clients as a public package surface
astrbot-sdk/src/astrbot_sdk/_testing_support.py Re-exports internal testing support helpers for downstream consumers
astrbot-sdk/src/astrbot_sdk/_star_runtime.py Re-exports star runtime context bindings
astrbot-sdk/src/astrbot_sdk/_plugin_logger.py Re-exports plugin logger types
astrbot-sdk/src/astrbot_sdk/_message_types.py Adds message type normalization helper
astrbot-sdk/src/astrbot_sdk/_internal/typing_utils.py Adds Optional-unwrapping helper for type introspection
astrbot-sdk/src/astrbot_sdk/_internal/star_runtime.py Implements star runtime contextvars + bind/reset context manager
astrbot-sdk/src/astrbot_sdk/_internal/sdk_logger.py Adds Loguru patching utilities and source formatting helpers
astrbot-sdk/src/astrbot_sdk/_internal/plugin_logger.py Adds plugin logger with console formatting + in-process log broker/watch API
astrbot-sdk/src/astrbot_sdk/_internal/plugin_ids.py Adds plugin ID validation + namespace helpers for capability/HTTP routing
astrbot-sdk/src/astrbot_sdk/_internal/memory_utils.py Adds memory namespace normalization, TTL helpers, keyword scoring, embedding utilities
astrbot-sdk/src/astrbot_sdk/_internal/invocation_context.py Adds contextvar-based caller plugin scoping for capability calls
astrbot-sdk/src/astrbot_sdk/_internal/injected_params.py Adds injected-parameter detection for handler signatures
astrbot-sdk/src/astrbot_sdk/_internal/command_model.py Adds BaseModel-based command arg parsing + help formatting
astrbot-sdk/src/astrbot_sdk/_internal/init.py Declares the internal package as non-public
astrbot-sdk/src/astrbot_sdk/_command_model.py Adds public shim re-exporting internal command model helpers
astrbot-sdk/src/astrbot_sdk/main.py Adds python -m astrbot_sdk CLI entrypoint
astrbot-sdk/src/astrbot_sdk/init.py Adds top-level SDK public API re-exports
astrbot-sdk/pyproject.toml Adds packaging metadata for the vendored SDK snapshot (deps, Python requirement)
astrbot-sdk/VENDORED.md Documents vendoring contract and subtree synchronization notes
astrbot-sdk/README.md Documents the vendored snapshot layout and scope
astrbot-sdk/LICENSE Adds licensing notice placeholder for the snapshot

Comment thread astrbot-sdk/src/astrbot_sdk/clients/_proxy.py
Comment thread astrbot-sdk/src/astrbot_sdk/_internal/command_model.py Outdated
Comment thread astrbot-sdk/src/astrbot_sdk/filters.py
Comment thread astrbot-sdk/pyproject.toml
Comment thread astrbot-sdk/LICENSE
Comment thread astrbot-sdk/LICENSE
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c58450c07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread astrbot-sdk/src/astrbot_sdk/cli.py
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the AstrBot SDK, a comprehensive framework for plugin development featuring a CLI, runtime, protocol layer, and specialized clients for LLMs, databases, and messaging platforms. The code review identified potential data loss in the manager clients' normalization logic, where already-instantiated message components or history records would be incorrectly filtered out. Additionally, redundant conditional logic was found in session normalization helpers across multiple files, which can be simplified to improve code clarity.

Comment thread astrbot-sdk/src/astrbot_sdk/clients/managers.py
Comment thread astrbot-sdk/src/astrbot_sdk/clients/managers.py
Comment thread astrbot-sdk/src/astrbot_sdk/clients/managers.py Outdated
Comment thread astrbot-sdk/src/astrbot_sdk/clients/session.py Outdated
astrbot-sdk/VENDORED.md
- Why: The vendored snapshot notes no longer matched the files kept for `astr init --agents`.
- How: Documented that the snapshot now retains the minimal agent skill scaffold while still excluding broader reference assets.

astrbot-sdk/src/astrbot_sdk/_internal/command_model.py
- Why: Boolean help text advertised underscore option names that the parser does not accept.
- How: Reused the canonical option formatter when rendering `--foo-bar` and `--no-foo-bar` help text.

astrbot-sdk/src/astrbot_sdk/clients/managers.py
- Why: Manager payload normalization dropped already-instantiated message components and history records.
- How: Preserved `BaseMessageComponent` and `MessageHistoryRecord` instances during normalization and simplified redundant session string conversion.

astrbot-sdk/src/astrbot_sdk/clients/session.py
- Why: Session normalization duplicated the same `str()` conversion path.
- How: Removed the redundant `MessageSession` branch and kept the special-case handling only for `MessageEvent`.

astrbot-sdk/src/astrbot_sdk/filters.py
- Why: Local filter evaluation re-ran signature introspection on every call.
- How: Cached whether the filter accepts `event` and `ctx` in `__post_init__` and reused those flags during evaluation.

astrbot-sdk/src/astrbot_sdk/runtime/_capability_router_builtins/capabilities/http.py
- Why: HTTP API registration accepted method lists that normalized to an empty set.
- How: Trimmed method names before normalization and rejected registrations without any non-empty HTTP method.

astrbot-sdk/src/astrbot_sdk/templates/skills/astrbot-plugin-dev/SKILL.md
- Why: `astr init --agents` expected a vendored skill template that was missing from the snapshot.
- How: Added the minimal reusable skill scaffold shipped with generated plugins.

astrbot-sdk/src/astrbot_sdk/templates/skills/astrbot-plugin-dev/agents/openai.yaml
- Why: The generated Codex skill scaffold also expected an agent config file.
- How: Added the matching OpenAI agent template used by the vendored skill scaffold.

pyproject.toml
- Why: The vendored SDK imports `msgpack` for its protocol codec, but the main repo did not declare it.
- How: Added `msgpack>=1.1.1` to the main project dependencies.

requirements.txt
- Why: The pip-style dependency entrypoint must stay aligned with `pyproject.toml` for runtime installs.
- How: Added the same `msgpack>=1.1.1` requirement in the existing flat requirements format.

tests/test_msgpack_dependency.py
- Why: The new dependency needs a guard against future drift between dependency files.
- How: Added tests that assert `msgpack` is declared in both `pyproject.toml` and `requirements.txt`.

tests/test_vendored_sdk_review_fixes.py
- Why: The review-driven SDK fixes need regression coverage in the main repo.
- How: Added focused tests for CLI option help text, agent template rendering, HTTP method validation, filter signature caching, and message history normalization.
@Soulter Soulter force-pushed the master branch 2 times, most recently from faf411f to 0068960 Compare April 19, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants