feat(domain): project verified runtime policy to desktop

This commit is contained in:
冰朔 2026-08-10 10:25:25 +08:00
commit 683e135f5e
12 changed files with 224 additions and 25 deletions

View file

@ -1,10 +1,21 @@
export type DomainAccessStage = 'checking' | 'login-required' | 'identity-verified' | 'runtime-ready';
export interface VerifiedDomainRuntimePolicyProjection {
allowedSessionScopes: readonly string[];
forbiddenDataScopes: readonly string[];
manifestDigest: string;
permissionPolicyRef: string;
routeRef: string;
themeOwner: 'domain-team' | 'fifth-domain';
themePackageRef: string;
}
export interface DomainAccessProjection {
blockers: string[];
domainId?: string;
nodeId?: string;
nodeType?: 'local-terminal' | 'cloud-resident';
runtimePolicy?: VerifiedDomainRuntimePolicyProjection;
runtimeReady: boolean;
stage: DomainAccessStage;
trustSource?: {
@ -23,6 +34,11 @@ export interface DomainConnectionStep {
detail: string;
}
export interface DomainRuntimePolicyReceiptRow {
label: string;
value: string;
}
const blockerToStep: Record<string, DomainConnectionStep['id']> = {
account_identity_missing: 'identity',
verified_node_registration_missing: 'identity',
@ -90,3 +106,16 @@ export function projectDomainTrustSource(access: DomainAccessProjection): string
const health = source.status === 'CURRENT' ? '当前' : '上次可信快照';
return `可信清单 ${health} · v${version} · ${commit} · 已登记签名人 ${source.signerCount}`;
}
export function projectDomainRuntimePolicyReceipt(access: DomainAccessProjection): DomainRuntimePolicyReceiptRow[] {
const policy = access.runtimeReady ? access.runtimePolicy : undefined;
if (!policy) return [];
return [
{ label: '主题包', value: policy.themePackageRef },
{ label: '运行路线', value: policy.routeRef },
{ label: '权限策略', value: policy.permissionPolicyRef },
{ label: '允许会话', value: policy.allowedSessionScopes.join(' · ') },
{ label: '禁止数据', value: policy.forbiddenDataScopes.join(' · ') },
{ label: '清单摘要', value: `${policy.manifestDigest.slice(0, 12)}${policy.manifestDigest.slice(-8)}` },
];
}