Repository navigation
docs(plugins): align manifest schema doc with validators - #2019
Conversation
The manifest spec claimed checks that no validator performs and omitted fields and permissions the SDK already ships. Authors reading it would expect an unknown permission or a wrong schemaVersion to be rejected at install, and could not find ui.settings, agent.extension, models.list, session.read or session.autoTitle in the enum. Correct the permission enum, the theme and provider contribution types, and validation rules 1, 2, 4, 7 and 12 to match validateManifest(), pi-plugin check and the host-core installer, in both the English and zh-CN documents. Related to vastsa#2000
vastsa
left a comment
There was a problem hiding this comment.
已独立对照 SDK 的 PluginManifest / PLUGIN_PERMISSIONS / validateManifest、DevKit check、Rust read_manifest / validate_contributions 及运行时工具命名和权限处理。文档新增的字段、45 项权限、未知权限、schemaVersion、agentTools 及 scenicThemes 的描述与当前实现一致;英文与中文对应,未发现阻塞问题。
在最新 main 4e1650b 上验证 GitHub 合并候选 c9f8306:diff --check、base ancestry、86 组中英配对、599 个文档页面、agent-policy sync 及 VitePress 生产构建通过。此 PR 只改文档,不需要应用 E2E。合入前同时确认 GitHub Docs checks 和 Head contains latest base 通过。
|
Merged. Thanks! This is the model for how #2000 asked audits to work: English and Chinese in the same PR, every finding tied to a code location, and the implementation bug split out to #2020 instead of being quietly patched into the docs. Both locales still align structurally (19 headings each) after your change. |
Related to #2000
P1 第 1 项:manifest schema 准确性审计。只改文档,中英文成对。
检查的文档
docs/spec/07-plugins/02-plugin-manifest-schema.mddocs/zh-CN/spec/07-plugins/02-plugin-manifest-schema.md对照的代码
PluginManifest、PLUGIN_PERMISSIONS、validateManifest()、validateContributions()(packages/plugin-sdk/src/index.ts)pi-plugin check(packages/plugin-devkit/src/check.ts)read_manifest/validate_contributions(crates/host-core/src/plugins/manifest.rs、validation.rs)apps/desktop/electron/main/plugin-runtime.ts、apps/desktop/electron/main/ipc/plugin-ui-ipc.ts发现与修改
PLUGIN_PERMISSIONS还有ui.settings、agent.extension、models.list、session.read、session.autoTitle(13 号权限矩阵也都有)PLUGIN_PERMISSIONSpi-plugin check报permission.unknown;validateManifest()和 宿主read_manifest都不检查权限名schemaVersionmust be1”;§10 “host should reject a too-high major version”typeof schemaVersion !== "number";宿主schema_version: u32仅反序列化,不比较取值id/name/versionmain同样必填:SDK、宿主 “PLUGIN_INVALID: id/main required”mainagentTools需要agent.tool.register(语气是校验失败)permission.tools-missing;安装器validate_contributions不检查;运行时agent.registerTool才assertPermissionname“allows only”[a-zA-Z][a-zA-Z0-9_]*pluginToolName把其他字符替换为_agentExtensions→agent.extension、windowAppearance→ui.window.appearance;scenicThemes不在校验阶段检查,缺ui.settings/ui.theme时 IPC 直接跳过provider.oauthPluginThemeContrib无variablesvariables?: PluginThemeVariableContrib[],文档开头 Appearance extensions 也在讲它PluginProviderContrib无descriptiondescription?: string | PluginLocalizedString,§5.4 正文也在讲它发现但未在本 PR 处理
pi-plugin check以“installer rejects package-relative assets (ADR 0255)”为由把包内相对路径的 theme asset 判为错误(check.ts),但宿主安装器实际接受包内相对路径(validation.rs,注释引用 ADR 0288),SDK 类型注释也说接受。这是代码问题,会另开 issue。验证
git diff --check通过§5、§7 rule 1交叉引用指向本文件现有章节upstream/main30f3c52