fix: 目录插件经固定发行物安装不启动候选,提交后待用户启用,发布 1.16.7 (#12)

承接主仓 desirecore/desirecore#6434(ADR-376 阶段 5):

- plugin-contributions(中英)新增「目录插件:经固定发行物安装」:knowledge 带
  appRelease 的插件走 AppAuthoring prepare_release → commit_release;不启动候选、
  不调用 runtime_enroll、不登记为 Agent 的 MCP 服务;回执 activation: pending、
  reason: plugin_enablement_required 表示已安装待启用;随后据实 record_verification
  (只核验到固定材料、逐文件摘要与客户端能力),再由用户在插件设置启用。这类安装没有
  deployment.descriptor,材料由宿主从受管 release 目录读取。描述材料与 PATCH 登记
  一节限定为不带 appRelease 的目录条目与非目录包。
- agent-led-installation(中英)固定发行物一节加插件例外,验证并登记一节注明插件不用 PATCH。
- SKILL.md 1.7.1 → 1.7.2;agent.json 1.16.6 → 1.16.7;requiredClientVersion 不变
  (旧客户端对插件提交仍报 application_runtime_contract_missing 时按指引停止并提示更新)。
This commit is contained in:
yige authored and GitHub committed 2026-11-27 18:22:05 +08:00
1 parent ef9dd2eb8a
commit 99b3f994c2
6 files changed
+40 -16

No files matched your search

@@ -42,6 +42,7 @@ Only when resolved knowledge contains knowledge.appRelease, use the client's exi
- Evaluate existing package entry points for preparation. Preserve the actual cwd, data root and original execution owner. Enroll and normally stop candidates through the current tool contract; independent processes or log text are not owner receipts. Native contracts replay the accepted startup command: first select and retain the entry point, cwd, port, data root and environment; do not reselect ports or repeat one-time preparation inside that replayable command.
- commit_release reports saving and activation separately. When activation=available, recheck with runtime_read; if still available, verify actual function without repeating runtime_start. If the readback or activation is unavailable, read the reason and available actions before choosing a necessary owner start. Denial, identity conflicts and unknown outcomes do not justify blind restarts.
- After a lost response, query the original submissionId or reread installation/runtime facts. Repair recording failures without repeating installation. Do not save calls by skipping approval, identity checks or treating historical success as live health.
- Plugin exception (materialized definition `productKind: plugin`): candidate enrollment, startup contracts and runtime_read/runtime_start above do not apply. Do not start a candidate or call runtime_enroll; commit right after a successful prepare_release. A receipt with `activation: pending` and `reason: plugin_enablement_required` means installed and awaiting enablement. Then record_verification truthfully (scoped to fixed material, per-file digests and client capability), and the user enables the plugin in plugin settings. See [Contribution installation and settings](plugin-contributions.md).
## Resource ownership
@@ -51,7 +52,7 @@ Coordinate a conflicting holder rather than changing UUID and executing concurre
## Verify and record
For plugins and applications with contributions or direct dependencies, first read [Contribution installation and settings](plugin-contributions.md). For a fresh catalog target, knowledge.productKind/type/extension/descriptorRequired come from the server catalog. When a descriptor is required, add the actual deployment.type and descriptor: {fileRef, sha256}. The generic example below does not replace these requirements; missing declarations must not be registered as default applications. Non-catalog declarative artifacts also require a descriptor.
For plugins and applications with contributions or direct dependencies, first read [Contribution installation and settings](plugin-contributions.md). For a fresh catalog target, knowledge.productKind/type/extension/descriptorRequired come from the server catalog. When a descriptor is required, add the actual deployment.type and descriptor: {fileRef, sha256}. The generic example below does not replace these requirements; missing declarations must not be registered as default applications. Non-catalog declarative artifacts also require a descriptor. Catalog plugins with knowledge.appRelease are committed through the fixed-release flow above, without a descriptor and without the PATCH below.
PATCH /api/installed-entries/instances/{installationId}:
@@ -42,6 +42,7 @@ POST /api/registry/acquisitions/resolve,body 为上述对象。只有 success=
- 准备操作优先评估包内现有入口,保留真实 cwd、数据根和原执行 owner。候选纳管及正常停止按当前工具合同完成,不用独立进程或日志文字冒充。原生合同会重放已接纳的启动命令;先确定并保留入口、cwd、端口、数据根和环境,不在可重放命令中重新探测端口或重做一次性准备。
- commit_release 的保存事实与 activation 分开。activation=available 时先用 runtime_read 复核;读回仍可用则核验功能,不重复 runtime_start。读回未可用或 activation 未可用时先读原因与可用动作,确需启动才沿原 owner 执行;拒绝、身份冲突或结果未知不构成盲重启的理由。
- 响应丢失先用原 submissionId 查询提交,或重读实例/运行事实;登记失败只修登记。不要为省调用跳过审批、身份核验或把历史成功当作当前健康。
- 插件例外(物化定义 `productKind: plugin`):上面的候选纳管、启动合同与 runtime_read/runtime_start 不适用。不启动候选、不调用 runtime_enroll,prepare_release 成功后直接提交;回执 `activation: pending`、`reason: plugin_enablement_required` 表示已安装待启用。随后据实 record_verification(只核验到固定材料、逐文件摘要与客户端能力),再由用户在插件设置启用。详见[贡献安装与启停](plugin-contributions.zh-CN.md)。
## 实际资源占用
@@ -51,7 +52,7 @@ POST /api/registry/acquisitions/resolve,body 为上述对象。只有 success=
## 验证并登记
插件、带贡献或直接依赖的普通应用,先读[贡献安装与启停](plugin-contributions.zh-CN.md)。目录首装 `knowledge` 的 `productKind`、`type`、`extension`、`descriptorRequired` 来自服务端目录;需要描述材料时为 deployment 增加真实 `type` 和 `descriptor: {fileRef, sha256}`。下面的通用示例不代替该要求;缺失描述会拒绝,不能把扩展登记成默认应用。非目录声明制品也必须提交描述。
插件、带贡献或直接依赖的普通应用,先读[贡献安装与启停](plugin-contributions.zh-CN.md)。目录首装 `knowledge` 的 `productKind`、`type`、`extension`、`descriptorRequired` 来自服务端目录;需要描述材料时为 deployment 增加真实 `type` 和 `descriptor: {fileRef, sha256}`。下面的通用示例不代替该要求;缺失描述会拒绝,不能把扩展登记成默认应用。非目录声明制品也必须提交描述。带 knowledge.appRelease 的目录插件经上方固定发行物提交,没有 descriptor,也不用下面的 PATCH。
PATCH /api/installed-entries/instances/{installationId}:
@@ -6,19 +6,30 @@ Plugins add host capabilities; applications own business workspaces and may also
## Confirm target and client support
Use the v2 Plan, exact instance resolution and actual resource claims. For fresh catalog installations, read knowledge.productKind/type/extension/descriptorRequired. The writer rereads the exact catalog source/product before recording; request-body knownProduct is not authority. If these fields are unavailable for a declared extension, investigate client support instead of submitting the old default-application example. Unsupported artifact, descriptor or settings contracts require a client update; never drop fields, read tokens or edit the ledger to bypass rejection.
Use the v2 Plan, exact instance resolution and actual resource claims. For fresh catalog installations, read knowledge.productKind/type/extension/descriptorRequired and appRelease. The writer rereads the exact catalog source/product before recording; request-body knownProduct is not authority. If these fields are unavailable for a declared extension, investigate client support instead of submitting the old default-application example. Unsupported artifact, descriptor or settings contracts require a client update; never drop fields, read tokens or edit the ledger to bypass rejection.
Use fixed catalog products or authorized user materials. Non-catalog packages use sourceId=user-managed and id=target.softwareId. Changing a source label cannot claim official publication. Identify source, product, installation, device and host rather than matching display names.
## Catalog plugins installed from a fixed release
When catalog knowledge carries appRelease (every entry the distribution generator produces for a plugin does), install through AppAuthoring `prepare_release` → `commit_release` as described under "Fixed releases" in the [general v2 flow](agent-led-installation.md), not through the deployment.descriptor and generic observation PATCH of the next section. When the materialized definition has `productKind: plugin`, the flow differs from ordinary native applications:
- Do not start a candidate process, do not call `runtime_enroll`, and do not register the plugin service as an Agent MCP server. A plugin has no candidate to enroll: the host starts and manages its resident service from the verified runtime descriptor in the package after the user enables it. Commit right after a successful `prepare_release`.
- A commit receipt with `activation: pending` and `reason: plugin_enablement_required` means installed and awaiting enablement, not failure; do not call `runtime_read` or `runtime_start`. If the client still answers a plugin commit with `application_runtime_contract_missing`, it does not support this path yet: stop and explain that the client needs an update, without falling back to candidate enrollment or the generic observation PATCH.
- Then call `record_verification` truthfully. Before enablement only the fixed material, per-file digests and client capability can be verified: write verified only when those checks pass, state this scope in scope, and do not claim the function works. The coordinator attaches contributions only for installations verified as verified; without a verified record, plugin settings report the installation as unverified and attach no contributions.
- Then ask the user to enable the plugin in plugin settings (the settings UI uses `PATCH /api/installed-entries/<installationId>/extension-settings` described below; submit through that API only when the user explicitly asks the Agent to enable it). After enabling, rely on plugin settings and the related feature page for its state; the pre-enablement verification record does not show that the function was verified.
Such installations have no `deployment.descriptor`. The host reads material from this user's managed release directory after verifying ownership, the manifest and every file digest; package references are read with their digests relative to the materialized definition file, and the resident service's installation root is that release directory. Do not obtain a resourceRef, write a separate AppDefinition or record through PATCH to add a descriptor.
## Prepare actual descriptor material
Save AppDefinition JSON in the actual installation directory with sourceId/id/name/version/productKind/entrypoints/placementPolicy and extension. Plugins need a real contribution and may have empty entrypoints. Uses-only applications may have empty contributes but retain a valid principal entrypoint. Contribution, configuration Schema, service descriptor and Skill references use package-relative paths and actual SHA-256 digests, never unverified inline model declarations.
This section applies to catalog entries without appRelease and to non-catalog packages. Save AppDefinition JSON in the actual installation directory with sourceId/id/name/version/productKind/entrypoints/placementPolicy and extension. Plugins need a real contribution and may have empty entrypoints. Uses-only applications may have empty contributes but retain a valid principal entrypoint. Contribution, configuration Schema, service descriptor and Skill references use package-relative paths and actual SHA-256 digests, never unverified inline model declarations.
Resolve the descriptor using GET /api/files/resolve-reference?agentId=<current-agent>&path=<URL-encoded-absolute-path> and hash its raw bytes. Submit deployment.descriptor={fileRef: resourceRef, sha256: actual digest}, actual type/version/resources/materials/data locations and maintenance notes. Descriptor and observed versions must agree; never substitute a catalog version for unknown deployed facts.
Fresh catalog contribution installations retain knowledge.type, the principal category and extension relationships. Missing descriptors, discarded extensions, plugin-to-application substitution or changed delivery types are rejected. Repair recording material without repeating software side effects. Declarative packages use artifact with runtime.kind=declarative and no fictitious ports/processes. Service plugins retain real native-app/docker-app deployments and reference existing governed connection/tool identities; installation grants no execution authority.
Verify the agreed consumer capability and record through PATCH /api/installed-entries/instances/<installationId>. Non-catalog extensions also need descriptors. Installation, enablement and current health remain separate facts; prose, model claims and responding ports cannot replace actual consumer checks.
Verify the agreed consumer capability and record through PATCH /api/installed-entries/instances/<installationId> (except plugins installed from a fixed release; see the previous section). Non-catalog extensions also need descriptors. Installation, enablement and current health remain separate facts; prose, model claims and responding ports cannot replace actual consumer checks.
## Settings, dependencies and enablement
@@ -49,8 +60,8 @@ On 409, GET and reconcile the snapshot the user is viewing; never simply replace
## Updates, removal and natural-language customization
Updates/reinstallation, including same-version replacement, reverify the descriptor, package material and digests through the existing writer. File edits never hot-replace formal active versions. Enlarged authority needs review and configuration must satisfy the new Schema; failures do not imply automatic rollback.
Updates/reinstallation, including same-version replacement, reverify the descriptor, package material and digests through the existing writer. Plugins installed from a fixed release repeat `prepare_release` → `commit_release` for the new appRelease, again without a candidate process. File edits never hot-replace formal active versions. Enlarged authority needs review and configuration must satisfy the new Schema; failures do not imply automatic rollback.
Before removal, identify disablement, shared references and actual process/material scope. Preserve user data by default. Record absent only after verifying the exact removal; removed descriptor files do not prevent retaining existing snapshots for removal or exact committed retries. Existing instances remain maintainable from recorded facts when the catalog is offline.
Persist descriptor locations/digests, settings entrypoints, tool/service references, verification and shared-data preservation rules in maintenance notes. Generate declarative contributions in supported session-scoped development previews; exiting releases temporary bindings. Only explicit save-and-use creates durable material through the same installation/settings owners. Generation or preview is not installation/enablement and does not authorize sharing or publication.
Persist descriptor locations/digests (the release directory and releaseDigest for release installations), settings entrypoints, tool/service references, verification and shared-data preservation rules in maintenance notes. Generate declarative contributions in supported session-scoped development previews; exiting releases temporary bindings. Only explicit save-and-use creates durable material through the same installation/settings owners. Generation or preview is not installation/enablement and does not authorize sharing or publication.
@@ -6,19 +6,30 @@
## 先确认目标和客户端契约
沿通用 v2 流程保存 Plan、解析精确实例并领取实际资源占用。目录首装读取 knowledge.productKind、type、extension、descriptorRequired;writer 提交前会重读同来源/产品,正文不能自报 knownProduct 绕过约束。没有这些知识且包明确是插件/扩展时调查实际客户端支持,不直接沿旧默认应用示例提交。旧客户端不理解 artifact、描述材料或设置 API 时停止并说明需更新,不删字段降级、不读 token 或手写账本。
沿通用 v2 流程保存 Plan、解析精确实例并领取实际资源占用。目录首装读取 knowledge.productKind、type、extension、descriptorRequired 与 appRelease;writer 提交前会重读同来源/产品,正文不能自报 knownProduct 绕过约束。没有这些知识且包明确是插件/扩展时调查实际客户端支持,不直接沿旧默认应用示例提交。旧客户端不理解 artifact、描述材料或设置 API 时停止并说明需更新,不删字段降级、不读 token 或手写账本。
材料来源是目录提供的固定产品或用户已授权材料。非目录包 sourceId 为 user-managed,id 对应 target.softwareId;不能只改来源标签宣称官方发布。名称不能替代 sourceId + appId + installationId + deviceId + hostInstanceId。
## 目录插件:经固定发行物安装
目录条目的 knowledge 带 appRelease 时(分发生成器为插件生成的条目都带),按[通用 v2 流程](agent-led-installation.zh-CN.md)「固定发行物」一节用 AppAuthoring `prepare_release` → `commit_release` 安装,不用下一节的 deployment.descriptor 与通用观察 PATCH 登记。物化定义为 `productKind: plugin` 时与普通原生应用不同:
- 不启动候选进程、不调用 `runtime_enroll`,也不把插件服务登记为 Agent 的 MCP 服务。插件没有需要纳管的候选:常驻服务由宿主在用户启用后按包内受核验运行描述启动和管理。`prepare_release` 成功后直接提交。
- 提交回执 `activation: pending`、`reason: plugin_enablement_required` 表示已安装、等待启用,不是失败;不调用 `runtime_read` 或 `runtime_start`。若客户端对插件提交仍返回 `application_runtime_contract_missing`,说明它尚未支持这条路径:停止并说明客户端需更新,不改为纳管候选,也不改用通用观察 PATCH。
- 随后据实调用 `record_verification`。启用前能核验的只有固定材料、逐文件摘要与客户端能力:这些检查通过才写 verified,scope 写明只核验到这一层,不声称功能已可用。协调器只接入核验为 verified 的安装的贡献;没有 verified 记录时,插件设置会提示安装尚未核验、不接入贡献。
- 然后请用户到插件设置启用(设置界面背后是下文的 `PATCH /api/installed-entries/<installationId>/extension-settings`;用户明确要求由 Agent 启用时按该接口提交)。启用后的状态以插件设置与对应功能页面为准,启用前的核验记录不代表功能已验证。
这类安装没有 `deployment.descriptor`:宿主从本用户受管的 release 目录读取材料,先核验归属、清单与逐文件摘要,包内引用按相对物化定义文件的路径带摘要读取,常驻服务的安装目录就是该 release 目录。不要为补描述去取 resourceRef、另写 AppDefinition 或再用 PATCH 登记。
## 准备实际描述材料
在实际安装目录保存 AppDefinition JSON。它包含 sourceId、id、name、version、productKind、entrypoints、placementPolicy,以及贡献关系 extension。plugin 必须至少提供一项真实贡献,可以 entrypoints: [];仅使用依赖的 application 可以 contributes: [],但保留自己的有效入口。configurationSchemaRef、definitionRef、service descriptor 及 Skill 引用必须是包内规范相对路径和实际字节 SHA-256,不复制未核验的内联模型声明。
以下适用于不带 appRelease 的目录条目与非目录包。在实际安装目录保存 AppDefinition JSON。它包含 sourceId、id、name、version、productKind、entrypoints、placementPolicy,以及贡献关系 extension。plugin 必须至少提供一项真实贡献,可以 entrypoints: [];仅使用依赖的 application 可以 contributes: [],但保留自己的有效入口。configurationSchemaRef、definitionRef、service descriptor 及 Skill 引用必须是包内规范相对路径和实际字节 SHA-256,不复制未核验的内联模型声明。
通过 GET /api/files/resolve-reference?agentId=<当前Agent>&path=<URL编码绝对路径> 获得描述文件的 resourceRef;按原始字节计算 SHA-256。登记 deployment.descriptor: {fileRef: resourceRef, sha256: 实际摘要},并写实际 type、actualVersion、resources、materials、dataLocations 和 maintenance。描述版本须等于实际登记版本;不把目录版本替代未知部署事实。
目录插件/附属贡献首装的 deployment.type 必须与 knowledge.type 一致,并保留目录主要归属和扩展关系。缺少描述、丢失 extension、把 plugin 写成 application 或改变交付类别都会拒绝;先修复材料再登记,不反复执行软件副作用。纯声明包使用 artifact 且 runtime.kind=declarative,不填虚假端口/进程;MCP/HTTP 服务插件保留真实 native-app/docker-app 部署,其 runtime descriptor 只引用原连接/工具 owner 已登记的身份。运行/注册/授权工具仍走原治理,不因安装插件自动获得权限。
核验约定能力后用唯一 PATCH /api/installed-entries/instances/<installationId> 提交事实。非目录扩展同样提交描述。安装成功只说明安装事实,启用与实际健康分别读取;文档、模型回复或端口响应不能代替真实消费者验证。
核验约定能力后用唯一 PATCH /api/installed-entries/instances/<installationId> 提交事实(经固定发行物安装的插件除外,见上一节)。非目录扩展同样提交描述。安装成功只说明安装事实,启用与实际健康分别读取;文档、模型回复或端口响应不能代替真实消费者验证。
## 配置、直接依赖和启停
@@ -49,8 +60,8 @@ PATCH /api/installed-entries/<installationId>/extension-settings 提交真实 mu
## 更新、卸载与自然语言定制
更新/重装(即使版本相同)重新核验 AppDefinition、包内材料及摘要,经原 writer 提交新安装修订;不靠直接改文件热替换正式活动版本。权限扩大需要重新治理,配置必须通过新 Schema;失败不声称自动回滚。
更新/重装(即使版本相同)重新核验 AppDefinition、包内材料及摘要,经原 writer 提交新安装修订;经固定发行物安装的插件按新的 appRelease 重新 `prepare_release` → `commit_release`,同样不启动候选;不靠直接改文件热替换正式活动版本。权限扩大需要重新治理,配置必须通过新 Schema;失败不声称自动回滚。
卸载先明确停用、共享引用、真实进程及材料范围,默认保留用户数据。确认精确实例 absent 后提交卸载事实;旧描述文件已移除时可保留既有快照用于卸载和完全相同提交重放。已有实例可依据历史记录离线维护,不要求目录仍在架。
维护说明保存描述位置/摘要、配置与启停入口、工具/服务引用、核验方法、更新及共享数据保留规则。自然语言创建纯声明贡献先走客户端支持的会话开发预览,退出释放临时绑定;用户显式保存并使用后才保留正式材料并经过同一登记与设置 owner。不把生成文件或预览称为已安装/已启用,也不绕过审批创建分享/发布制品。
维护说明保存描述位置/摘要(发行物安装为 release 目录与 releaseDigest)、配置与启停入口、工具/服务引用、核验方法、更新及共享数据保留规则。自然语言创建纯声明贡献先走客户端支持的会话开发预览,退出释放临时绑定;用户显式保存并使用后才保留正式材料并经过同一登记与设置 owner。不把生成文件或预览称为已安装/已启用,也不绕过审批创建分享/发布制品。