Skip to content

Plugin JSON Schema 规范

plugin.json Schema

所有插件必须包含 plugin.json 配置文件,遵循以下 schema:

json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["id", "name", "version", "type", "entry_point"],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9.-]*$",
      "description": "插件唯一标识符,推荐反向域名格式"
    },
    "name": {
      "type": "string",
      "maxLength": 50,
      "description": "插件显示名称"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+",
      "description": "语义化版本号"
    },
    "description": {
      "type": "string",
      "maxLength": 200,
      "description": "插件简要描述"
    },
    "author": {
      "type": "string",
      "description": "作者名称"
    },
    "type": {
      "type": "string",
      "enum": ["process"],
      "description": "插件类型(固定 process)"
    },
    "entry_point": {
      "type": "string",
      "description": "入口文件路径"
    },
    "runtime": {
      "type": "string",
      "enum": ["python3", "node", "python"],
      "description": "运行时(Process 插件必需)"
    },
    "permissions": {
      "type": "array",
      "items": { "type": "string" },
      "description": "所需权限列表"
    },
    "icon": {
      "type": "string",
      "description": "图标文件路径(256x256 PNG)"
    },
    "min_platform_version": {
      "type": "string",
      "description": "最低平台版本要求"
    }
  }
}

权限列表

权限说明适用类型
network网络访问Process
storage数据持久化Process
notification推送通知Process
modelAI 模型调用Process
clipboard剪贴板访问Process
fs:read文件读取Process
fs:write文件写入Process

验证工具

bash
# 使用 ajv-cli 验证
npx ajv validate -s plugin-schema.json -d plugin.json

相关文档

HAMA | 蛤蟆数字