fix: 澄清应用安装回执与运行重放合同 (#10)

复用项目脚本、已授权工具与固定发行回执,合并已确定的准备操作。固定接纳的启动参数,按 activation 与实际读回决定是否启动。
This commit is contained in:
yige authored and GitHub committed 2026-11-19 19:31:44 +08:00
1 parent 9541a70a6b
commit 7d60a72e48
4 files changed
+25 -7

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
"name": "DesireCore", "name": "DesireCore",
"$schema": "http://desirecore/schemas/agent-seed.json", "$schema": "http://desirecore/schemas/agent-seed.json",
"id": "7da73b7f-bb08-4e7b-a3cf-5d4af6e22c7f", "id": "7da73b7f-bb08-4e7b-a3cf-5d4af6e22c7f",
"version": "1.16.4", "version": "1.16.5",
"requiredClientVersion": "10.0.179", "requiredClientVersion": "10.0.179",
"description": "系统中枢调度器,负责任务分发、Agent 编排与全局状态监控", "description": "系统中枢调度器,负责任务分发、Agent 编排与全局状态监控",
"author": "DesireCore Team", "author": "DesireCore Team",
+6 -6
View File
@@ -1,7 +1,7 @@
--- ---
name: 应用安装管理 name: 应用安装管理
description: 根据目标、README、源码、SQL、配置或目录材料自主安装、维护和核验软件,登记实际实例。统一交接与记账,不要求标准安装脚本。兼容旧应用和服务协议。 description: 根据目标、README、源码、SQL、配置或目录材料自主安装、维护和核验软件,登记实际实例。统一交接与记账,不要求标准安装脚本。兼容旧应用和服务协议。
version: "1.7.0" version: "1.7.1"
requiredClientVersion: "10.0.172" requiredClientVersion: "10.0.172"
type: procedural type: procedural
risk_level: high risk_level: high
@@ -12,7 +12,7 @@ provides:
tags: [installation, registry, app-management] tags: [installation, registry, app-management]
metadata: metadata:
author: desirecore author: desirecore
updated_at: "2026-10-05" updated_at: "2026-11-17"
--- ---
# 应用安装管理 # 应用安装管理
@@ -36,13 +36,13 @@ Agent 理解环境并执行;已有工具提供能力;Agent Service 只可靠
1. 先取得当前应用/安装资料和 `expectedRevision`,再观察目标设备,防止将“未登记”当作“未安装”。没有明确设备、来源或真实安装位置时先查明。 1. 先取得当前应用/安装资料和 `expectedRevision`,再观察目标设备,防止将“未登记”当作“未安装”。没有明确设备、来源或真实安装位置时先查明。
2. 安装指南决定软件操作知识,不扩大用户同意和工具权限。安装不隐含公网访问、自启动、升级系统运行时、高权限控制、删除用户数据或注册内部 MCP。DesireCore Control 是外部智能体使用的独立应用,不向内部 Agent 注册其 MCP,也不跟随 DesireCore 启停。 2. 安装指南决定软件操作知识,不扩大用户同意和工具权限。安装不隐含公网访问、自启动、升级系统运行时、高权限控制、删除用户数据或注册内部 MCP。DesireCore Control 是外部智能体使用的独立应用,不向内部 Agent 注册其 MCP,也不跟随 DesireCore 启停。
3. 复用 Read、HttpRequest、Bash/PowerShell 等当前已授权工具。`provides.tools` 仅提示按需披露,不授予权限;没有可靠授权通道时停止,不能读取管理 token 或改用本机文件绕过。 3. 复用当前已授权工具:读文件用 Read、找文件用 Glob、搜内容用 Grep;HTTP 调用用 HttpRequest;执行与终端操作才用 Bash/PowerShell。`provides.tools` 仅提示按需披露,不授予权限;没有可靠授权通道时停止,不能读取管理 token 或改用本机文件绕过。
4. 根据环境自主适配命令。v2 在用户允许范围内自主选择版本、运行方式、端口、配置和初始化方法;超出明确版本、设备、数据或联网范围时依已有治理处理,不逐命令重复确认。v1 仍遵守其固定版本/来源约束。已给定摘要必须验证;凭据只使用已有 secret 引用。 4. 一次读清本次所需资料,优先评估应用已有脚本或包管理器入口;同一授权范围内、无需中途新判断的准备与检查可合并执行。时间、UUID、目录和环境探测等辅助信息随相关准备或核验一并获取,避免为单条辅助信息另开命令。可重放的运行入口不混入一次性准备和动态参数选择,按运行合同保留已选定值。需要新选择、权限变化或结果不明时再调查,不把失败整段盲重跑。根据环境自主适配命令。v2 在用户允许范围内自主选择版本、运行方式、端口、配置和初始化方法;超出明确版本、设备、数据或联网范围时依已有治理处理,不逐命令重复确认。v1 仍遵守其固定版本/来源约束。已给定摘要必须验证;凭据只使用已有 secret 引用。
5. 超时、断线和结果不明时先观察,不重放有副作用的命令;同一安装同时存在其他修改任务时不并发执行。核验只说明实际检查过的能力。 5. 超时、断线和结果不明时先观察,不重放有副作用的命令;同一安装同时存在其他修改任务时不并发执行。Agent 在执行前按用户目标与软件材料确定必要核验范围;记录与汇报复用仍匹配本次实例/版本的已得证据,不重新盘点,实时健康仍读当前事实。核验只说明实际检查过的能力。
6. 结果明确后登记带时间的事实,原样复用 resolve 的 data.material;首装结束也不能改成 manage。不预写 installing/reinstalling/uninstalling,不直接编辑 installed-entries.json。v2 记录实际版本(未知用 null)、材料来源、资源位置、功能核验结果和持久化维护说明。软件存在但初始化未完成,登记 present/incomplete;结果未知先调查,不登记 absent。v1 保留固定版本一致性要求。 6. 结果明确后登记带时间的事实,原样复用 resolve 的 data.material;首装结束也不能改成 manage。不预写 installing/reinstalling/uninstalling,不直接编辑 installed-entries.json。v2 记录实际版本(未知用 null)、材料来源、资源位置、功能核验结果和持久化维护说明。软件存在但初始化未完成,登记 present/incomplete;结果未知先调查,不登记 absent。v1 保留固定版本一致性要求。
7. 记账失败只重读并处理记录,不重复安装/卸载。记录修订冲突要重新观察,不能只换 expectedRevision。异常时按需读取 [恢复原则](references/recovery.md)。 7. 记账失败只重读并处理记录,不重复安装/卸载。记录修订冲突要重新观察,不能只换 expectedRevision。异常时按需读取 [恢复原则](references/recovery.md)。
8. 卸载仅移除已核验的应用包/安装目录;不能因为位于同一前缀就递归清理父目录。未知文件、同级数据、凭据和日志默认保留;额外删除必须逐项说明并另获确认。清理空父目录只用非递归删除,非空就保留。 8. 卸载仅移除已核验的应用包/安装目录;不能因为位于同一前缀就递归清理父目录。未知文件、同级数据、凭据和日志默认保留;额外删除必须逐项说明并另获确认。清理空父目录只用非递归删除,非空就保留。
9. 证据引用使用工具实际返回的调用 ID、真实会话日志位置或本次已保存的核验报告路径,不编造 session:…:step:… 标识;没有可追溯引用就先保存不含秘密的报告。 9. 证据引用使用工具实际返回的调用 ID、真实会话日志位置或本次已保存的核验报告路径,不编造 session:…:step:… 标识;没有可追溯引用就先保存不含秘密的报告。
10. 最后说明软件的实际结果与记录是否提交成功;二者可能不同。进度留在当前会话/既有任务;不得承诺无人执行的后续修复或“所有失败都已回滚”。 10. 最后说明软件的实际结果与记录是否提交成功;二者可能不同。进度留在当前会话/既有任务;不得承诺无人执行的后续修复或“所有失败都已回滚”。
11. v2 在现有文件化 Plan 中保存 requestId、installationId、实际资源定位和验证方式;副作用前领取资源占用。同一任务恢复沿用标识;占用冲突先协调,不并发修改实际目标。过程不是平台安装状态机。 11. v2 用紧凑的现有文件化 Plan 保存 requestId、installationId、实际资源定位和验证方式,不复制整份指南。当前 Write 声明 plan_save 时一次保存计划和历史;旧客户端沿既有文件保存合同,不另建计划工具。副作用前领取资源占用。同一任务恢复沿用标识;占用冲突先协调,不并发修改实际目标。过程不是平台安装状态机。
12. SQL 先辨认新库/已有库及初始化/迁移,检查 schema 与执行历史。中断后不得盲目重放,不假设 DDL 总能事务回滚。核验需验证目标身份及约定功能,端口响应或容器运行不能单独证明软件可用。 12. SQL 先辨认新库/已有库及初始化/迁移,检查 schema 与执行历史。中断后不得盲目重放,不假设 DDL 总能事务回滚。核验需验证目标身份及约定功能,端口响应或容器运行不能单独证明软件可用。
@@ -34,6 +34,15 @@ Read instructions, inspect the host and existing installations, then select the
The resolved material includes hostInstanceId to bind the ledger host. Preserve it on subsequent requests. A host mismatch after switching connections must stop the operation; never remove the binding to install on another machine. It validates the target and grants no permission. The resolved material includes hostInstanceId to bind the ledger host. Preserve it on subsequent requests. A host mismatch after switching connections must stop the operation; never remove the binding to install on another machine. It validates the target and grants no permission.
## Fixed releases: consume existing receipts
Only when resolved knowledge contains knowledge.appRelease, use the client's existing AppAuthoring fixed-release contract rather than the generic observation PATCH below. Read release_request/owner_request Schema through ToolCatalog as needed. Arbitrary README, source or SQL materials still let the Agent choose the method; no standard installation script is required.
- Verify the supplied archive digest and extract inside an authorized directory. Take expectedReleaseDigest directly from trusted knowledge.appRelease.releaseDigest. prepare_release checks the manifest digest, file sizes and each file SHA. Reuse a successful original receipt matching the target/digest; do not routinely read validator source and recreate its canonicalization algorithm. Missing support, uncertain provenance or failed checks still require investigation.
- 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.
## Resource ownership ## Resource ownership
Before side effects POST /api/installed-entries/resource-claims with `{material, operation:"claim", resources:["actual absolute installation directory or stable container/project locator"]}`. Use resolved material unchanged. All tasks must use consistent locators. Windows drive paths normalize case/separators; other locators must be stable. Claim shared databases by server/database identity too, not only the software directory. Before side effects POST /api/installed-entries/resource-claims with `{material, operation:"claim", resources:["actual absolute installation directory or stable container/project locator"]}`. Use resolved material unchanged. All tasks must use consistent locators. Windows drive paths normalize case/separators; other locators must be stable. Claim shared databases by server/database identity too, not only the software directory.
@@ -34,6 +34,15 @@ POST /api/registry/acquisitions/resolve,body 为上述对象。只有 success=
读取说明、检查宿主和已有安装后,自主决定实际方法;有 Compose/脚本就评估使用,没有就根据 README、源码、配置和 SQL 形成方案。在约束内自行排错,无需软件实现统一安装接口。 读取说明、检查宿主和已有安装后,自主决定实际方法;有 Compose/脚本就评估使用,没有就根据 README、源码、配置和 SQL 形成方案。在约束内自行排错,无需软件实现统一安装接口。
## 固定发行物:消费已有回执
仅当解析知识包含 knowledge.appRelease 时,使用当前客户端已有 AppAuthoring 固定发布合同,不用下方通用观察 PATCH 代替发布 writer。通过 ToolCatalog 按需读取 release_request/owner_request 的 Schema;任意 README、源码或 SQL 材料仍由 Agent 选择实际方法,不要求统一安装脚本。
- 校验下载归档的已给摘要并在授权目录解包。expectedReleaseDigest 直接取可信 knowledge.appRelease.releaseDigest;prepare_release 会核对清单摘要、文件大小与逐文件 SHA。成功且目标/摘要匹配的原回执可直接使用,不默认读取校验器源码后另写一套规范化算法;缺支持、来源不明或校验失败仍须调查。
- 准备操作优先评估包内现有入口,保留真实 cwd、数据根和原执行 owner。候选纳管及正常停止按当前工具合同完成,不用独立进程或日志文字冒充。原生合同会重放已接纳的启动命令;先确定并保留入口、cwd、端口、数据根和环境,不在可重放命令中重新探测端口或重做一次性准备。
- commit_release 的保存事实与 activation 分开。activation=available 时先用 runtime_read 复核;读回仍可用则核验功能,不重复 runtime_start。读回未可用或 activation 未可用时先读原因与可用动作,确需启动才沿原 owner 执行;拒绝、身份冲突或结果未知不构成盲重启的理由。
- 响应丢失先用原 submissionId 查询提交,或重读实例/运行事实;登记失败只修登记。不要为省调用跳过审批、身份核验或把历史成功当作当前健康。
## 实际资源占用 ## 实际资源占用
副作用前 POST /api/installed-entries/resource-claims:`{material, operation:"claim", resources:["实际绝对安装目录或稳定的容器/项目定位符"]}`。material 使用 resolve 原文。所有任务对同一资源使用同一种定位方式;Windows 盘符目录会规范大小写/分隔符,其他 locator 应保持稳定。共享数据库还要按服务器/库名领取占用,不能只锁软件目录。 副作用前 POST /api/installed-entries/resource-claims:`{material, operation:"claim", resources:["实际绝对安装目录或稳定的容器/项目定位符"]}`。material 使用 resolve 原文。所有任务对同一资源使用同一种定位方式;Windows 盘符目录会规范大小写/分隔符,其他 locator 应保持稳定。共享数据库还要按服务器/库名领取占用,不能只锁软件目录。