插件清单字段
插件清单 plugin.json(cablesim.plugin/2)的结构:身份、运行方式、权限、资源、计算能力与封签。
每个插件在 plugins/<id>/plugin.json 中用 cablesim.plugin/2 格式描述自己。宿主只读清单:清单声明了什么,界面就展示什么、预检就检查什么。下面的字段表由仓库中的 plugin-spec/manifest.schema.json 在构建时生成,与宿主校验清单所用的规则一致。
顶层字段
| 字段 | 类型 | 必填 |
|---|---|---|
schema | "cablesim.plugin/2" | 是 |
id | string | 是 |
version | string | 是 |
name | string | 是 |
description | string | null | 否 |
icon | "assets/icon.svg" | null | 否 |
presentation | Presentation | null | 否 |
publisher | Publisher | 是 |
host_api | HostApi | 是 |
license | License | 是 |
platforms | string[] | 是 |
runtime | Runtime | null | 否 |
permissions | "project.read" | "study.run" | "artifact.read" | "artifact.write" | "project.propose"[] | 是 |
dependencies | object[] | 是 |
resources | Resources | 是 |
capabilities | Capability[] | 是 |
files | PackageFile[] | 是 |
| 字段 | 说明 |
|---|---|
schema | 固定为 cablesim.plugin/2。 |
id、version、name | 插件标识(如 cablesim.iec60287)、版本和显示名称。已发布的版本内容变化时必须升版本号。 |
description、icon、presentation | 说明文字、图标和展示素材。 |
publisher | 发布者标识与名称。 |
host_api | 需要的宿主接口主版本和最低次版本。 |
license | 许可证(SPDX)及是否需要人工审查。 |
platforms | 支持的操作系统与架构。 |
runtime | 运行方式,例如 Python 版本范围和入口文件。 |
permissions | 申请的权限。 |
dependencies | 运行所需的依赖。安装插件不会自动安装依赖。 |
resources | 单次运行的超时、内存上限和网络权限(如 network: "none")。 |
capabilities | 计算能力列表,见下节。 |
files | 封签:插件中每个文件的路径、大小和 SHA256。宿主每次调用前核对,不一致就拒绝运行。 |
计算能力(capabilities[])
| 字段 | 类型 | 必填 |
|---|---|---|
kind | "method" | "report-template" | "agent-skill" | 是 |
id | string | 是 |
title | string | 是 |
solver | "local" | "slurm" | "either" | 否 |
method_version | string | 是 |
analysis | string | 是 |
input_schema | string | 是 |
outputs | Output[] | 否 |
artifacts | ArtifactSpec[] | 否 |
validation | Validation | 是 |
limitations | string[] | 是 |
description | string | null | 否 |
parameter_schema | ParameterSchema | 否 |
input_contract | InputContract | null | 否 |
x-groups | ParameterGroup[] | 否 |
x-headline | Headline[] | 否 |
preview | boolean | 否 |
preview_timeout_s | integer | 否 |
study_tasks | string[] | 否 |
category | string | null | 否 |
x-temperature-field-binding | TemperatureFieldBinding | null | 否 |
report_template | ReportTemplate | null | 否 |
agent_skill | AgentSkill | null | 否 |
read_only | boolean | 否 |
| 字段 | 说明 |
|---|---|
kind、id、title | 能力类型(计算方法为 method)、标识和显示名称。 |
solver | 求解位置:local 只在本机,slurm 只在超算,either 两者均可;省略按 local。 |
method_version、analysis | 方法版本与分析类型。方法版本记录在每次运行中。 |
input_schema、input_contract | 输入格式(如 cablesim.domain/1 的 SI 领域输入)与绑定方式。 |
parameter_schema、x-groups | 方法参数的 JSON Schema 与分组。每个参数应有中文标题、说明、单位(x-unit)和范围。 |
outputs、artifacts、x-headline | 输出的量、结果工件类型和结论栏显示的关键量。 |
validation | 验证等级与用例。 |
limitations、description | 适用范围与已知限制、说明。界面和本站方法页直接展示这些文字。 |
study_tasks | 适用的研究任务(如 rating)。 |
report_template、agent_skill | 声明式的报告模板与 Agent 技能,见插件示例。 |
运行协议
插件以独立子进程运行(cablesim.run/2):宿主把请求写入 input/request.json,插件在 output/result.json 中写出结果,每个工况的状态为 succeeded、not_applicable 或 failed。领域输入使用 cablesim.domain/1,全部为 SI 单位。宿主校验结果工件后才保存运行。
校验与封签
python scripts/plugin_sdk.py verify # 校验全部插件清单与封签
python scripts/plugin_sdk.py seal plugins/<id>/plugin.json --write # 重写指定插件的依赖锁、files 与注册条目
python scripts/seal_plugin_catalog.py # 核对插件目录生成文件修改了插件源码或其静态引用的公共源码后,需要重新封签;已发布的版本先升版本号。