feat(authz): add resident agent operation receipts

This commit is contained in:
冰朔 2026-07-26 15:26:21 +08:00
commit 357ac5e67a
6 changed files with 136 additions and 18 deletions

View file

@ -50,6 +50,13 @@ async function authorizeRepoPush(options, deps = {}) {
const map = await requestJson(fetchImpl, `${baseUrl}/api/navigation-map/read`, common, session.session_token);
await requestJson(fetchImpl, `${baseUrl}/api/navigation-map/ack`, { ...common, map_hash: map.map_hash }, session.session_token);
const grant = await requestJson(fetchImpl, `${baseUrl}/api/repo-push/grant`, { ...common, repo }, session.session_token);
if (grant.transport && grant.transport.status !== "ready") {
output(`[LL-REPO-PUSH-TRANSPORT-BLOCKED] ${grant.transport.diagnostic_code || "repo_push_transport_unavailable"}`);
output(`NEXT_STEP=${grant.transport.next_step || "读取服务器 operation receipt。"}`);
const error = new Error(grant.transport.diagnostic_code || "repo_push_transport_unavailable");
error.receipt = grant.receipt;
throw error;
}
output(`[LL-REPO-PUSH-GRANTED] ${grant.repo} 已获得限时推送许可。现在重试原 git push。`);
return grant;
}