/** * Evidence Graph View — 只读派生视图(Resolution 修复关系 + artifact 依赖图 + 任务证据摘要)。 * * 设计原则:旁路新增,不替换旧逻辑。本视图: * - 不持久化、不签名、不改任何 record(纯派生查询) * - artifact 依赖/下游查询复用现有 downstreamClosure/directDependencies(不改它们) * - 任务摘要/证据链数据经 View 读 store,消费方不直接拼装(Step5 消费接入) * * 提供: * Resolution 修复关系视图: * - getFindingResolutions(findingId) / getResolutionArtifacts(resolutionId) / getArtifactFindings(artifact) * artifact 依赖图视图: * - getArtifactDependencies(domain, kind) / getArtifactDownstream(domain, kind) * 任务证据摘要(Step5 消费入口): * - getTaskSummary(taskId): findings/resolutions/artifacts/unresolvedCount * - getFindingEvidenceChain(findingId): Finding→Resolution→Artifact * * Legacy 兼容:旧 finding 无 resolution → 返回空;contracts 未注入 → 依赖查询返回空;reviewStore 未注入 → findings=[]。 */ import type { DomainName, DomainContract } from "./types.js"; import type { ArtifactRef } from "./upgrade_reconcile/types.js"; import type { ResolutionStore, ResolutionRecord, ResolutionTarget } from "./resolution_store.js"; import type { AdversarialReviewStore } from "./adversarial_review_store.js"; /** 任务证据图摘要(Step5 消费接入的诊断输出)。 */ export interface EvidenceGraphSummary { /** 涉及的 finding_id 集(去重;reviewStore 未注入则空) */ findings: string[]; /** task 的 resolution_id 列表 */ resolutions: string[]; /** 修复涉及的产物路径(去重) */ artifacts: string[]; /** 无 Resolution 的 finding 数(待处理) */ unresolvedCount: number; } /** finding 证据链(Finding→Resolution→Artifact)。 */ export interface FindingEvidenceChain { findingId: string; resolutions: ResolutionRecord[]; artifacts: ResolutionTarget[]; } /** Evidence Graph 只读派生视图。 */ export declare class EvidenceGraphView { private readonly resolutions; private readonly contracts; private readonly reviewStore?; constructor(resolutions: ResolutionStore, contracts?: DomainContract[], reviewStore?: AdversarialReviewStore | undefined); /** finding 的所有 resolution(append-only 下多条:历史 + 最新;按 updated_at 降序)。 * 旧 finding 无 resolution → 返回 [](消费方 fallback verifyFindingFixed 旧逻辑)。 */ getFindingResolutions(findingId: string): Promise; /** resolution 涉及的产物(target_artifacts;修复可指向 finding.artifact 之外的文件)。 * resolution 不存在 → null。 */ getResolutionArtifacts(resolutionId: string): Promise; /** 涉及某 artifact 的 finding 集(经 resolution 的 target_artifacts 反查;返回 finding_id 去重)。 */ getArtifactFindings(artifact: string): Promise; /** 产物的直接依赖(requires + requires_upstream)。contracts 未注入或产物未声明 → []。 */ getArtifactDependencies(domain: DomainName, kind: string): ArtifactRef[]; /** 产物的下游闭包(所有传递依赖它的产物)。contracts 未注入或产物未声明 → []。 */ getArtifactDownstream(domain: DomainName, kind: string): ArtifactRef[]; /** task 的证据图摘要(findings/resolutions/artifacts/unresolvedCount)。数据经 View 读 store,不要求调用方拼装。 * reviewStore 未注入 → findings=[](仅 resolutions/artifacts);HMAC 非法 record 已被 store read 排除,不进图。 */ getTaskSummary(taskId: string): Promise; /** finding 的证据链(Finding→Resolution→Artifact)。无 Resolution → 空 resolutions/artifacts(legacy chain)。 */ getFindingEvidenceChain(findingId: string): Promise; }