feat(wave-1): 适配器框架与安全基座(schema校验/dry-run/exec沙箱/密钥库/日志脱敏/字段拆分)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://agentdock.local/schemas/adapter.schema.json",
|
||||
"title": "AgentDock Adapter",
|
||||
"description": "Agent CLI 适配器定义(v1)。Wave 0 仅含占位字段;完整 schema 见架构 §3.1,随 Wave 1 落地。",
|
||||
"description": "Agent CLI 适配器定义(v1,对齐架构 §3.1)。首批 14 工具在 Wave 1 仅保留 id/name/name_zh/vendor/status 五字段占位;其余字段(platforms/official/runtime_deps/install/detect/update/uninstall/authorization/configuration/diagnostics/documentation)为可选,供 Wave 2 起逐工具填充。所有 command 必须是 argv 数组,禁止 shell 元字符与字符串拼接。",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "name", "name_zh", "vendor", "status"],
|
||||
@@ -28,6 +28,267 @@
|
||||
"type": "string",
|
||||
"enum": ["available", "watch"],
|
||||
"description": "目录状态:available=可安装列表;watch=观察中(第二批)"
|
||||
},
|
||||
"adapter_version": {
|
||||
"type": "string",
|
||||
"description": "适配器自身版本(semver,如 1.2.0)",
|
||||
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$"
|
||||
},
|
||||
"license": {
|
||||
"type": "string",
|
||||
"description": "展示用许可;专有许可注明「仅官方渠道安装、不重打包」"
|
||||
},
|
||||
"platforms": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"windows": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"architectures": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "enum": ["x64", "arm64"] }
|
||||
},
|
||||
"notes": {
|
||||
"type": "string",
|
||||
"description": "如 Gemini 要求 Win11 24H2+"
|
||||
}
|
||||
}
|
||||
},
|
||||
"linux": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"distributions": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "enum": ["ubuntu", "debian"] }
|
||||
},
|
||||
"architectures": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "enum": ["x64", "arm64"] }
|
||||
},
|
||||
"min_ubuntu": {
|
||||
"type": "string",
|
||||
"description": "最低 Ubuntu 版本,如 22.04"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"official": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"homepage": { "type": "string", "format": "uri" },
|
||||
"docs": { "type": "string", "format": "uri" },
|
||||
"allowed_hosts": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "网络白名单(诊断/下载仅可访问这些主机)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"runtime_deps": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id"],
|
||||
"properties": {
|
||||
"id": { "type": "string", "enum": ["node", "python", "git", "powershell", "uv", "bash"] },
|
||||
"semver_range": { "type": "string", "description": "如 >=20" },
|
||||
"required_for": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "enum": ["install", "run"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"install": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"preferred": { "type": "string", "description": "默认渠道 channel id" },
|
||||
"channels": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/definitions/channel" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"detect": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["executable"],
|
||||
"properties": {
|
||||
"executable": { "type": "string", "description": "PATH 上的命令名;Cursor 为 agent" },
|
||||
"version_args": { "type": "array", "items": { "type": "string" } },
|
||||
"version_regex": { "type": "string" },
|
||||
"version_unconfirmed": { "type": "boolean", "description": "调研标注「文档未能确认」时 true" },
|
||||
"path_hints": { "type": "array", "items": { "type": "string" }, "description": "非 PATH 常见位置" }
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"method": {
|
||||
"type": "string",
|
||||
"enum": ["npm_update", "self_update_cmd", "channel_reinstall", "winget_upgrade", "pypi_upgrade", "manual"]
|
||||
},
|
||||
"command": { "type": "array", "items": { "type": "string" } }
|
||||
}
|
||||
},
|
||||
"uninstall": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"method": { "type": "string", "enum": ["npm_uninstall", "package_manager", "manual_delete"] },
|
||||
"command": { "type": "array", "items": { "type": "string" } },
|
||||
"keep_config_default": { "type": "boolean", "default": true }
|
||||
}
|
||||
},
|
||||
"authorization": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"modes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["mode"],
|
||||
"properties": {
|
||||
"mode": { "type": "string", "enum": ["browser_oauth", "device_code", "api_key", "local_tui"] },
|
||||
"command": { "type": "array", "items": { "type": "string" } },
|
||||
"env_keys": { "type": "array", "items": { "type": "string" } },
|
||||
"status_command": { "type": "array", "items": { "type": "string" } },
|
||||
"notes_zh": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"files": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["path", "format"],
|
||||
"properties": {
|
||||
"path": { "type": "string", "description": "支持 ~ 与平台变量" },
|
||||
"format": { "type": "string", "enum": ["toml", "json", "jsonc", "yaml", "env", "crushrc"] },
|
||||
"scope": { "type": "string", "enum": ["user", "project", "system"] }
|
||||
}
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["key"],
|
||||
"properties": {
|
||||
"key": { "type": "string" },
|
||||
"sensitive": { "type": "boolean", "default": false },
|
||||
"maps_to_field": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "label_zh", "type", "storage"],
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"label_zh": { "type": "string" },
|
||||
"help_zh": { "type": "string" },
|
||||
"required": { "type": "boolean", "default": false },
|
||||
"sensitive": { "type": "boolean", "default": false },
|
||||
"type": { "type": "string", "enum": ["string", "url", "enum", "bool"] },
|
||||
"storage": { "type": "string", "enum": ["file", "env", "keyring"], "description": "keyring 永不进普通备份" },
|
||||
"platforms": { "type": "array", "items": { "type": "string", "enum": ["windows", "linux"] } },
|
||||
"docs_url": { "type": "string", "format": "uri" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"diagnostics": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["rule_id"],
|
||||
"properties": {
|
||||
"rule_id": { "type": "string", "description": "引用规则库或内联" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"documentation": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"quickstart_zh": { "type": "string" },
|
||||
"commands": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"cmd": { "type": "string" },
|
||||
"desc_zh": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"updated_at": { "type": "string", "format": "date" },
|
||||
"risks_zh": { "type": "array", "items": { "type": "string" } }
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"channel": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"enum": ["npm", "official_script", "winget", "choco", "scoop", "brew", "apt", "pypi_uv", "github_release"]
|
||||
},
|
||||
"platforms": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "enum": ["windows", "linux"] }
|
||||
},
|
||||
"command": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "命令必须是 argv 数组,禁止字符串拼接与 shell 元字符(| & ; $ \\ > < ( `)"
|
||||
},
|
||||
"script": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"url": { "type": "string", "format": "uri" },
|
||||
"kind": { "type": "string", "enum": ["powershell_irm", "bash_pipe", "ps1_file"] },
|
||||
"integrity": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": { "sha256": { "type": "string", "pattern": "^[0-9a-fA-F]{64}$" } }
|
||||
}
|
||||
}
|
||||
},
|
||||
"package": { "type": "string", "description": "npm/pypi 包名" },
|
||||
"elevate": { "type": "string", "enum": ["never", "if_needed", "required"] },
|
||||
"elevate_reason_zh": { "type": "string" },
|
||||
"post_checks": { "type": "array", "items": { "type": "string" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user