Skip to content

v0.7.0 - Plugin System 🔌

Choose a tag to compare

@idoubi idoubi released this 17 Mar 11:46
· 671 commits to dev since this release

🔌 Plugin System

用任意语言编写插件扩展 FastClaw,通过 JSON-RPC 协议通信。

插件类型

类型 用途 示例
channel 新增消息渠道 飞书、微信、LINE
tool 新增 Agent 工具 图像生成、沙箱执行
provider 新增 LLM 提供商 自定义模型
hook 事件钩子 消息过滤、审计日志

工作原理

Gateway ←→ stdin/stdout JSON-RPC ←→ Plugin Process (Python/Node/Go/...)
  • 插件是独立进程,崩溃自动重启(指数退避)
  • Channel 插件无缝集成到消息路由
  • Tool 插件自动注册到 Agent 工具列表
  • 发现目录: ~/.fastclaw/plugins/

配置

{
  "plugins": {
    "enabled": true,
    "entries": {
      "feishu": {
        "enabled": true,
        "config": {"appId": "...", "appSecret": "..."}
      }
    }
  }
}

写一个插件

  1. 创建目录 ~/.fastclaw/plugins/my-plugin/
  2. 写 plugin.json(声明 id/type/command)
  3. 写插件代码(实现 JSON-RPC 协议)
  4. fastclaw plugin list 查看

附带示例:examples/plugins/echo/(Python echo 工具)

CLI

fastclaw plugin list              # 查看插件
fastclaw plugin install ./my-plugin  # 安装
fastclaw plugin remove my-plugin     # 卸载

Install / Update

fastclaw upgrade