feat: anchor domain runtime handoff transport

This commit is contained in:
冰朔 2026-08-10 09:04:58 +08:00
commit 9994d81fd2
9 changed files with 759 additions and 19 deletions

View file

@ -22,6 +22,11 @@ import { DomainAccessOrchestrator } from '../../guanghu-knowledge-base/server/do
import { TrustedSignerSnapshotLoader } from '../../guanghu-knowledge-base/server/trusted-signer-snapshot.js';
import { NodeRegistrationSnapshotLoader } from '../../guanghu-knowledge-base/server/node-registration-snapshot.js';
import { HttpNodeRegistrationClaimSource } from '../../guanghu-knowledge-base/server/node-registration-client.js';
import { DomainRuntimeHandoffSnapshotLoader } from '../../guanghu-knowledge-base/server/domain-runtime-handoff-snapshot.js';
import {
AnchoredDomainRuntimeHandoffSource,
HttpDomainRuntimeHandoffTransport,
} from '../../guanghu-knowledge-base/server/domain-runtime-handoff-source.js';
// ─── 配置 ───
@ -339,6 +344,28 @@ const nodeRegistrationSnapshots = new NodeRegistrationSnapshotLoader({
const nodeRegistrationClaims = new HttpNodeRegistrationClaimSource();
const domainRuntimeHandoffSnapshots = new DomainRuntimeHandoffSnapshotLoader({
async fetchJson(url: string): Promise<unknown> {
const response = await fetch(url, {
cache: 'no-store',
credentials: 'omit',
headers: { Accept: 'application/json' },
redirect: 'manual',
referrerPolicy: 'no-referrer',
signal: AbortSignal.timeout(5000),
});
if (!response.ok || response.type === 'opaqueredirect') {
throw new Error(`domain_runtime_handoff_source_http_${response.status}`);
}
return response.json();
},
});
const domainRuntimeHandoffs = new AnchoredDomainRuntimeHandoffSource(
domainRuntimeHandoffSnapshots,
new HttpDomainRuntimeHandoffTransport(),
);
const domainAccessOrchestrator = new DomainAccessOrchestrator(
trustedSignerSnapshots,
nodeRegistrationSnapshots,
@ -366,12 +393,7 @@ const domainAccessOrchestrator = new DomainAccessOrchestrator(
// proof keeps the domain gate closed even if a future signed claim appears.
async prove() { return null; },
},
{
async read() {
// 当前灯塔尚未发布签名运行体交接端点。保持关闭,不从账号身份推导运行体权限。
return null;
},
},
domainRuntimeHandoffs,
);
function startServer(): Promise<void> {