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

@@ -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.
## 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
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 形成方案。在约束内自行排错,无需软件实现统一安装接口。
## 固定发行物:消费已有回执
仅当解析知识包含 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 应保持稳定。共享数据库还要按服务器/库名领取占用,不能只锁软件目录。