import type { DesignLifecycleStageId } from "../contracts/design_lifecycle_contract.js";
/**
 * Consumption Trace Store — 统一消费追踪。
 *
 * 为 router/expander/verifier/adapter prompt 提供统一的 trace 记录接口。
 * 所有消费者写入真实 trace，Release Gate 从此读取。
 */
/** 消费追踪条目 */
export interface ConsumptionTraceEntry {
    consumer: "router" | "expander" | "reviewer" | "verifier" | "deliverer" | "adapter_prompt" | "sync_migration" | "init" | "sync_templates" | "knowledge_index" | "knowledge_selection" | "scaffold" | "contract_gate" | "pipeline_sync";
    asset_id: string;
    fields_consumed: string[];
    matched_reason: string;
    task_id_or_route: string;
    consumed_at: string;
    /** 生命周期阶段，用于证明该资产在哪个阶段被消费 */
    lifecycle_stage?: DesignLifecycleStageId;
    /** 真实消费动作 */
    action?: "created" | "synced" | "indexed" | "selected" | "injected" | "reviewed" | "verified" | "delivery_blocked" | "delivered" | "denied";
    /** 结构化选择原因 */
    matched_signals?: string[];
    /** 结构化排除原因 */
    excluded_reasons?: string[];
    /** 合同裁决结果（由合同门禁入口填充） */
    contract_decision?: "allowed" | "denied" | "unregistered";
    /** 资产路径（用于逐资产跟踪） */
    asset_path?: string;
    /** 声明消费者 — 必须与合同 mainline_consumer 精确对应 */
    declared_consumer?: string;
}
/** consumer 必须消费的字段契约 */
export declare const CONSUMER_FIELD_CONTRACTS: Record<ConsumptionTraceEntry["consumer"], string[]>;
/**
 * ConsumptionTraceStore — 可实例化的消费追踪存储。
 *
 * 使用类实例替代模块级全局状态，支持测试隔离。
 * 生产代码使用 globalTraceStore 单例，测试可创建独立实例。
 */
export declare class ConsumptionTraceStore {
    private _store;
    private readonly _maxTrace;
    constructor(maxTrace?: number);
    /** 记录一条消费 trace */
    record(entry: ConsumptionTraceEntry): void;
    /** 读取所有消费 trace */
    getAll(): ReadonlyArray<ConsumptionTraceEntry>;
    /** 按消费者筛选 */
    getByConsumer(consumer: ConsumptionTraceEntry["consumer"]): ReadonlyArray<ConsumptionTraceEntry>;
    /** 清空 trace（测试用） */
    clear(): void;
    /** 验证 trace 条目完整性 */
    validateEntry(entry: ConsumptionTraceEntry): {
        valid: boolean;
        missing: string[];
    };
    /** 验证所有 trace */
    validateAll(): {
        valid: boolean;
        invalidCount: number;
        issues: string[];
    };
    /** 获取各消费者 trace 数量 */
    getTraceCounts(): Record<ConsumptionTraceEntry["consumer"], number>;
    /** 逐 consumer 校验 fields_consumed 是否满足契约 */
    validateFieldContracts(): {
        valid: boolean;
        issues: string[];
    };
}
/** 全局单例 — 生产代码使用此实例 */
export declare const globalTraceStore: ConsumptionTraceStore;
/** 记录一条消费 trace */
export declare function recordConsumptionTrace(entry: ConsumptionTraceEntry): void;
/** 读取所有消费 trace */
export declare function getConsumptionTraces(): ReadonlyArray<ConsumptionTraceEntry>;
/** 按消费者筛选 */
export declare function getTracesByConsumer(consumer: ConsumptionTraceEntry["consumer"]): ReadonlyArray<ConsumptionTraceEntry>;
/** 清空 trace（测试用） */
export declare function clearConsumptionTraces(): void;
/** 验证所有 trace */
export declare function validateAllTraces(): {
    valid: boolean;
    invalidCount: number;
    issues: string[];
};
/** 获取各消费者 trace 数量 */
export declare function getTraceCounts(): Record<ConsumptionTraceEntry["consumer"], number>;
/** 逐 consumer 校验 fields_consumed 是否满足契约 */
export declare function validateTraceFieldContracts(): {
    valid: boolean;
    issues: string[];
};
//# sourceMappingURL=consumption_trace_store.d.ts.map