import { type AtomicJsonSource } from './policy-anchor-log.js'; import { type PolicyState } from '@claude-flow/security/policy/index'; export type AnchorEvent = 'append' | 'migrated-from-state' | 'establish-anchor'; export interface AnchorEntry { seq: number; length: number; headHash: string | null; prevAnchorHash: string | null; ts: number; event: AnchorEvent; by?: string; /** * How much of the archive this anchor claims (`state.retainedFrom` at * anchor time) and the hash of its newest archived receipt (#3892 Blocker * 1). Absent on anchors written before this field existed, or for a * ledger that has never been pruned — both resolve to a vacuous pass so * the unpruned baseline stays byte-for-byte identical (see `entryHash`). */ archivedThrough?: number; archiveHeadHash?: string | null; hash: string; } export type AnchorAssessment = { kind: 'absent'; } | { kind: 'ok'; last: AnchorEntry; behind: boolean; } | { kind: 'fail'; error: string; }; export type AnchorWriter = (file: string, value: unknown) => Promise; export type StreamingAnchorWriter = (file: string, value: AtomicJsonSource) => Promise; export declare const ANCHOR_LOG_FILE = "ledger-anchors.json"; export declare const ANCHOR_MIRROR_FILE = "ledger-anchor-head.json"; export declare const anchorLogPath: (projectRoot: string) => string; /** * Directory holding per-project trust material (anchor mirror, HMAC key). * Resolved from the environment at call time (#3919): $XDG_CONFIG_HOME when it * is absolute, else $HOME/.config (os.homedir() honours $HOME), so a scratch * HOME keeps tests and sandboxed runs out of the developer's real home. An XDG * user who already has trust state under the legacy ~/.config keeps using it. */ export declare function policyTrustRoot(): string; /** Convert archive record-limit/UTF8 failures into structured gate failures. */ export declare function assessAnchors(projectRoot: string, state: PolicyState, rebuild?: boolean): AnchorAssessment; /** * Append an entry for the current state if the newest entry does not already * describe it. Must run under the policy lock. Throws if the log is corrupt: * only an explicit establish may replace a corrupt log. */ export declare function recordAnchor(projectRoot: string, state: PolicyState, write: AnchorWriter, event?: AnchorEvent, by?: string, writeLog?: StreamingAnchorWriter, assessedTip?: AnchorEntry): Promise; export declare function anchorPosture(projectRoot: string): { log: boolean; mirror: boolean; }; //# sourceMappingURL=policy-ledger-anchor.d.ts.map