/** * Baseline Store — 存量债务基线(独立物种,sacp 反哺 C 批 WG.2)。 * * 物种边界(与 waiver 分离——债与豁免的消费逻辑/生命周期/失效语义全不同): * - baseline=「已承认的存量违例配额」:违例计数 ≤ 登记数 → 基线内债务放行(finding 标注 baseline_debt); * 超出登记数 → 红(债务增长被拦)。治「存量债登记进豁免通道」的物种混淆(QUAL-* 三份实证)。 * - waiver=「个案放行」(individual/structural)——继续走 matchWaiver,本 store 不参与豁免匹配。 * * 只减不增执法:registered_count 只许减少(清偿);调增=门禁变更,须显式 increase 操作+审计留痕 * (increase_action=true 参数,reason 必填)。登记 0 或删除即退出。 * * 安全:HMAC 签名(同 waiver/decision store 惯例);读侧 fail-closed(损坏/无签名记录排除并计入诊断)。 * 持久化:.soloforge/baselines/.json + .soloforge/baselines/audit.jsonl。 */ export declare function generateBaselineId(): string; declare const SCHEMA_VERSION = 1; /** 基线登记项:一个 (check_id + 路径模式) 的存量违例配额。 */ export interface BaselineRecord { schema_version: typeof SCHEMA_VERSION; /** 唯一基线 ID(bl-) */ baseline_id: string; /** 被登记的 check id(违例计数所属检查) */ check_id: string; /** 路径模式(违例的文件或产物范围,如 src 目录通配;与 check 输出的 finding location 前缀比对)——示例值避免在 JSDoc 内出现连续星斜杠(会提前终止注释) */ path_pattern: string; /** 登记的存量违例数(计数锁:实际违例 ≤ 此数放行标注,超出即红) */ registered_count: number; /** 登记日期(ISO) */ registered_at: string; /** 清理专项挂钩(可选:关联任务/批次说明) */ cleanup_ref?: string; /** 备注(可选) */ notes?: string; /** HMAC 签名(创建/修改时由 provider 签) */ hmac?: string; /** 移除时间戳(未移除则 undefined——移除即退出计数锁) */ removed_at?: number; /** 移除理由(审计) */ removed_reason?: string; } /** 基线计数锁评估结果(gate 消费)。 */ export interface BaselineEvaluation { /** 命中的基线记录(未命中为 null) */ baseline: BaselineRecord | null; /** 实际违例是否在登记数内(true=基线内债务放行;false=超出→红) */ within: boolean; /** 登记数(未命中 0) */ registered: number; } /** * BaselineStore — 存量债务基线的持久化与计数锁查询。 * 读侧:active 列表 fail-closed(损坏/验签失败记录跳过并计诊断,不中断主链)。 */ export declare class BaselineStore { private readonly projectRoot; private readonly provider; constructor(projectRoot: string); private dir; private filePath; private appendAudit; /** 创建基线登记(HMAC 签名+审计)。 */ create(record: Omit): Promise; /** * 调整登记数。只减不增执法:newCount < old 为清偿(自由,附清偿验证提示由调用方呈现); * newCount > old 为调增(门禁变更)——须 increaseAction=true 且 reason 必填,否则拒绝。 */ adjust(baselineId: string, newCount: number, opts?: { increaseAction?: boolean; reason?: string; }): Promise; /** 移除基线(登记退出)。 */ remove(baselineId: string, reason: string): Promise; /** 读取单条(验签 fail-closed:无 secret/验签失败返 null)。 */ get(baselineId: string): Promise; /** 全部 active 基线(removed 过滤;损坏记录跳过并 debug)。 */ listActive(): Promise; /** * 计数锁评估(gate 消费入口):按 (check_id, 路径前缀匹配) 找 active 基线, * actualCount ≤ registered_count → within=true(基线内债务放行);超出 → within=false(红)。 * 路径匹配=登记 path_pattern 作为 finding location 的前缀/模式命中(简化为 glob 前缀比对)。 */ evaluate(checkId: string, findingLocations: string[], actualCount?: number): Promise; } /** location 与 path_pattern 的宽松匹配(模式末段通配/前缀比对;专用 glob 引擎留给后续按需引入)。 */ export declare function locationMatchesPattern(location: string, pattern: string): boolean; export {};