Skip to content

SDK リファレンス

NekoPluginBase

すべてのプラグインは NekoPluginBase を継承する必要があります。

python
from plugin.sdk.base import NekoPluginBase

class MyPlugin(NekoPluginBase):
    def __init__(self, ctx):
        super().__init__(ctx)

メソッド

get_input_schema() → dict

プラグインの入力 JSON Schema を返します。デフォルトではクラス属性から読み取ります。動的なスキーマにはオーバーライドしてください。

report_status(status: dict) → None

プラグインのステータスをメインプロセスに報告します。

python
self.report_status({
    "status": "running",
    "progress": 50,
    "message": "Processing..."
})

collect_entries() → dict

すべてのエントリーポイント(@plugin_entry で装飾されたメソッド)を収集します。システムにより自動的に呼び出されます。

PluginContext

プラグインのコンストラクタに渡される ctx オブジェクトです。

プロパティ

プロパティ説明
ctx.plugin_idstrプラグイン識別子
ctx.config_pathPathplugin.toml へのパス
ctx.loggerLoggerロガーインスタンス

メソッド

ctx.update_status(status: dict) → None

メインプロセスのプラグインステータスを更新します。

ctx.push_message(...) → None

メインシステムにメッセージをプッシュします。

python
ctx.push_message(
    source="my_feature",          # メッセージソース識別子
    message_type="text",          # "text" | "url" | "binary" | "binary_url"
    description="Task complete",  # 人間が読める説明
    priority=5,                   # 0-10(0=低、10=緊急)
    content="Result text",        # text/url タイプ用
    binary_data=b"...",           # binary タイプ用
    binary_url="https://...",     # binary_url タイプ用
    metadata={"key": "value"}    # 追加メタデータ
)

メッセージタイプ

タイプ用途
textプレーンテキストメッセージ
urlURL リンク
binary小さなバイナリデータ(直接送信)
binary_url大きなファイル(URL で参照)

優先度レベル

範囲レベル用途
0-2情報メッセージ
3-5一般的な通知
6-8重要な通知
9-10緊急即座の対応が必要

MIT ライセンスの下で公開。