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 |
model | AI 模型调用 | Process |
clipboard | 剪贴板访问 | Process |
fs:read | 文件读取 | Process |
fs:write | 文件写入 | Process |
验证工具
bash
# 使用 ajv-cli 验证
npx ajv validate -s plugin-schema.json -d plugin.json