Skip to main content

Provider-V2 平台插件 SDK — 第三方平台适配器开发与加载

Project description

provider-sdk

Provider-V2 通用插件 SDK,对标 maibot-plugin-sdk

平台适配器只是可选扩展(extensions.platform),不是 SDK 核心。

安装

pip install provider-sdk

快速开始

plugins/
  my_plugin/
    _manifest.json
    plugin.py
from provider_sdk import ProviderPlugin, Route, Hook, API

class MyPlugin(ProviderPlugin):
    async def on_load(self) -> None:
        self.ctx.logger.info("loaded")

    @Route("/plugins/my/status", methods=["GET"])
    async def status(self) -> dict:
        return {"ok": True}

def create_plugin() -> MyPlugin:
    return MyPlugin()

与 maibot-sdk 的对应

maibot-sdk provider-sdk
MaiBotPlugin ProviderPlugin
@Tool / @Command / @API @Route / @Hook / @API
create_plugin() + _manifest.json 相同
self.ctx.* 能力代理 logger / config / http
@MessageGateway 无(Provider 非 IM Bot)
平台相关 extensions.platform.PlatformAdapter(可选)

插件类型

plugin_type 说明
general(默认) 通用插件,声明 Route/Hook/API
platform 额外提供 PlatformAdapter,供网关注册

示例

  • examples/hello_plugin/ — 通用插件
  • examples/echo_platform/ — 平台扩展插件

文档:docs/guide.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

provider_sdk-0.2.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

provider_sdk-0.2.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file provider_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: provider_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for provider_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 91fc61f838266768ad156c0e958c23cb35fe324d06cb27f071484fe070eb0103
MD5 9bd48e66ed8deb170c2205c528fcbc70
BLAKE2b-256 c0bc5cf5123755919ef4b041618e58d472518923833e97751cc47686e0a4562e

See more details on using hashes here.

File details

Details for the file provider_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: provider_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for provider_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6060dafb167492a5a6647e6997ff3f45613ab9d9006c797720d54227eef7600c
MD5 02874990a07a1b82a7bec2db80692161
BLAKE2b-256 d695286520e76784bca72ad114725653b316a0df062eb93693555a4d271fd8de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page