Skip to content

manifest 清单配置 ​

manifest.json 是插件的唯一身份与能力声明文件。客户端在不加载插件代码的前提下读取它,用于展示插件信息、渲染配置表单、决定如何启动服务、注入 UI 组件。

PluginManifest(TypeScript 类型定义见 @aweeclaw 客户端 shared/plugin-sdk/types.ts)

顶层字段 ​

字段类型必需说明
idstring✅插件唯一标识,小写字母/数字/连字符,字母开头,3–64 字符。发布后不可修改(即后端 pluginKey)
namestring✅英文显示名(≤ 64 字符)
nameZhstring✅中文显示名(≤ 64 字符)
descriptionstring✅英文描述(≤ 2000 字符)
descriptionZhstring✅中文描述(≤ 2000 字符)
typestring✅插件类型,见插件类型;创建后不可改
versionstring✅semver,如 1.0.0;发布新版本必须递增
mainstring⚠️入口文件相对路径。MCP 型且为空 → ConfigOnly 插件;非 MCP 型必填
iconstring❌Lucide 图标名(如 Package)/ 远程 URL / 本地相对路径(icon/icon.png),默认 Package
categorystring❌分类,见分类,默认 productivity
tagsstring[]❌标签数组,用于市场搜索
lifecyclestring❌singleton / per-account / per-session,默认 singleton
capabilitiesobject✅能力声明,见 capabilities
configSchemaobject❌用户配置表单,见配置表单
permissionsstring[]❌权限声明,见权限
contributesobject❌UI 扩展点声明,见 UI 扩展
platformsstring[]❌darwin / win32 / linux,默认三者全支持
isFreeboolean❌是否免费,默认 true
pricenumber❌价格(元),isFree: false 时须大于 0
validityDaysnumber❌有效期(天):0 / 不传 = 永久买断;> 0 = 按天计费
minAppVersionstring❌要求的最低客户端版本
author / homepage / repository / licensestring❌作者、主页、仓库、许可证(默认 MIT)
builtinboolean❌标记为内置插件(平台自用,市场不展示)
inlineCode / inlineUiCodestring⛔发布脚本自动写入,禁止手填

插件类型 ​

类型典型形态说明
mcpstdio 子进程 / in-process / 远程 SSE通过 MCP 协议向智能体暴露工具,最主流
toolin-process工具型插件,可附 UI 扩展
channel内置适配器打包消息渠道(飞书、微信、钉钉…)
provider内置适配器打包模型服务商接入
hookin-process生命周期钩子,可拦截/改写调用流程
composite组合聚合多个子插件
scenario场景包以插件形式分发的场景
skill技能包提示词/流程类技能

分类 ​

category 必须取自后端维护的分类表(发布脚本会自动拉取校验):

值名称
productivity效率
development开发
automation自动化与集成
database数据库
design设计
frontend前端设计
office办公
aiAI 与搜索
utility实用工具
channel消息渠道

该表是全系统唯一数据源(后端 PLUGIN_CATEGORIES)。新增分类需后端先维护,否则 publish 接口会报 Invalid category。


capabilities ​

capabilities 按插件类型声明对应能力块,只需声明自己用到的那些。

mcp ​

json
{
  "capabilities": {
    "mcp": {
      "transport": "stdio",
      "command": "node",
      "args": ["{{pluginDir}}/index.js"],
      "env": { "DEBUG": "{{config.DEBUG}}" },
      "autoConnect": true,
      "timeout": 30000
    }
  }
}
字段适用 transport说明
transport全部in-process / stdio / sse
inProcessExportin-process出口工厂函数名,缺省按 default → createMcpServer → create 顺序识别
commandstdio启动命令:node / npx / uvx / python3 等
argsstdio参数数组,支持 {{pluginDir}}、{{dataDir}}、{{config.KEY}}
envstdio环境变量,支持 {{config.KEY}}
urlsse远程服务 URL
autoConnect全部是否在应用启动时自动连接
timeout全部单次工具调用超时(毫秒),默认 30000;视频生成等长任务需显式放大(如 660000)

详见传输模式。

channel ​

json
{
  "capabilities": {
    "channel": {
      "connectionModes": ["websocket", "webhook"],
      "defaultConnectionMode": "websocket",
      "chatTypes": ["direct", "group"],
      "media": true,
      "reactions": true,
      "threads": true,
      "edit": true,
      "streaming": true,
      "voice": false,
      "files": true
    }
  }
}

tool ​

json
{
  "capabilities": {
    "tool": {
      "concurrency": "parallel-safe",
      "sandboxed": false,
      "requiresApproval": false
    }
  }
}

concurrency 取值:parallel-safe(可并发)/ serialized(串行)/ approval-gated(需用户审批)。

hook ​

json
{
  "capabilities": {
    "hook": {
      "events": ["before-tool-call", "after-tool-call", "after-agent-reply"]
    }
  }
}

可用事件:Hook 事件 一节列出全部取值。

provider ​

json
{
  "capabilities": {
    "provider": {
      "protocols": ["openai-compatible"],
      "streaming": true,
      "toolCalling": true,
      "embedding": false,
      "multimodal": true
    }
  }
}

desktop ​

json
{
  "capabilities": {
    "desktop": {
      "operations": ["screen_capture", "mouse_click", "keyboard_type"],
      "requiresAccessibility": true,
      "requiresScreenCapture": true,
      "workflowSteps": false,
      "recordingEvents": false
    }
  }
}

权限 ​

permissions 声明插件需要访问的宿主能力。in-process 插件通过 ctx.host 访问时受此清单校验,未声明的能力会抛 PermissionDeniedError。

权限说明
network发起网络请求
filesystem.read读取文件
filesystem.write写入文件
shell.execute执行 Shell 命令
clipboard.read / clipboard.write读写剪贴板
notification发送系统通知
system.info读取系统信息
desktop.input模拟鼠标/键盘输入
desktop.screen屏幕截图
desktop.windows窗口管理
desktop.apps应用启动/退出
desktop.recording操作录制
desktop.workflow工作流执行
desktop.visual-agent视觉智能体
ui.render在客户端渲染 UI 组件(使用 contributes 时必须声明)

Hook 事件 ​

hook 能力与 ctx.registerHook 支持的事件:

before-agent-start      after-agent-reply
before-tool-call        after-tool-call
before-message-send     after-message-receive
on-session-create       on-session-reset
on-channel-connect      on-channel-disconnect     on-channel-error
on-config-change        on-cron-trigger
before-desktop-action   after-desktop-action
before-recording-start  after-recording-stop
before-workflow-run     after-workflow-complete
before-replay           after-replay
on-visual-agent-step

钩子处理函数返回 { proceed: boolean, modified?: unknown, reason?: string }:proceed: false 可中断后续流程,modified 可改写即将执行的输入。


完整示例 ​

一个带配置表单与 UI 扩展的 in-process 工具插件:

json
{
  "id": "ai-macro-recorder",
  "name": "AI Macro Recorder",
  "nameZh": "AI 宏录制器",
  "description": "Record user input via native system hooks, auto-generate action steps.",
  "descriptionZh": "基于原生输入钩子录制用户操作,自动生成操作步骤。",
  "type": "tool",
  "version": "4.0.3",
  "main": "index.js",
  "icon": "Video",
  "category": "automation",
  "tags": ["automation", "macro", "recorder"],
  "capabilities": {
    "mcp": {
      "transport": "in-process",
      "autoConnect": true
    }
  },
  "configSchema": {
    "fields": [
      {
        "key": "default_interval_ms",
        "label": "Default Sampling Interval (ms)",
        "labelZh": "默认采样间隔(毫秒)",
        "type": "number",
        "required": false,
        "default": "1000"
      }
    ]
  },
  "permissions": [
    "desktop.screen",
    "desktop.input",
    "desktop.windows",
    "filesystem.read",
    "filesystem.write",
    "ui.render"
  ],
  "contributes": {
    "ui": { "entry": "ui.js" },
    "sidebarPanels": [
      {
        "id": "ai-macro-recorder:panel",
        "icon": "Video",
        "label": "Macros",
        "labelZh": "宏管理",
        "component": "macro-panel",
        "position": 50
      }
    ]
  },
  "platforms": ["darwin", "win32", "linux"],
  "license": "MIT"
}

校验规则 ​

发布脚本与后端会依次校验:

  1. 必需字段齐全(id / name / nameZh / description / descriptionZh / type / version / capabilities)
  2. id 匹配 ^[a-z][a-z0-9-]*$,且与后端 pluginKey 一致
  3. version 匹配 semver,且与上传参数一致
  4. category 在后端分类表内
  5. MCP 型插件声明了 capabilities.mcp
  6. type 与后端已有记录一致(不一致需删除重建)

下一步 ​

AweeClaw AI 应用构建平台