/**
 * Run-dispatch recording (issue #347) — now a thin write into the unified
 * event stream (`emit('run.dispatched', …)`). The historical hash-chained file
 * at `~/.agents/.history/audit/log.jsonl` is still readable via
 * `readAuditLog` / `verifyAuditChain` for pre-unification history; new runs do
 * NOT append there. Operators list run outcomes with:
 *
 *   agents events --include runs
 *   agents events audit          # nested alias of the above
 */
/** First record's `prevHash` — a fixed anchor so the chain has a root. */
export declare const GENESIS_HASH = "GENESIS";
/** A run's outcome, derived from its process exit code. */
export type AuditOutcome = 'ok' | 'fail';
/** One immutable audit record. `hash` seals every other field, `prevHash` included. */
export interface AuditRecord {
    ts: string;
    agent: string;
    version: string;
    repo: string;
    mode: string;
    outcome: AuditOutcome;
    exit: number;
    prevHash: string;
    hash: string;
}
/** The caller-supplied fields — the chain fields (`prevHash`/`hash`) are computed here. */
export type AuditEntry = Omit<AuditRecord, 'prevHash' | 'hash'>;
/**
 * Absolute path to the append-only audit log. Lives under `.history/` — the
 * durable-but-machine-local runtime bucket that is gitignored and never synced
 * by `agents repo push/pull`. Keeping it here (not under a top-level, tracked
 * `~/.agents/` path) means the token-bearing `repo` field can never leak into a
 * version-controlled DotAgents repo, and no cross-machine pull can fork the chain.
 */
export declare function getAuditLogPath(): string;
/**
 * Append one record to the hash chain and return it. Links to the previous
 * record's `hash` (or `GENESIS_HASH` for the first), computes the sealing
 * hash, and writes a single JSONL line. Synchronous so the record is durable
 * before the caller proceeds.
 *
 * Read-last-hash + append run under the canonical advisory file lock
 * (`withFileLock`, backed by proper-lockfile). Without it, two concurrent
 * writers — the norm under parallel teams/routines dispatch — both read the
 * same last hash and both write `prevHash=H`, forking the chain into a false
 * "tampered" verdict. The lock forces a total order so every record links off
 * the genuinely-previous one. `ensureLockTarget` creates the file first because
 * proper-lockfile locks an existing path.
 */
export declare function appendAuditRecord(entry: AuditEntry, logPath?: string): AuditRecord;
/**
 * Walk the chain and confirm every record reproduces. A record is valid when
 * (a) its `prevHash` matches the prior record's `hash` (GENESIS for the first)
 * AND (b) recomputing its sealing hash from its own fields reproduces the
 * stored `hash`. Returns the first failing index in `brokenAt`.
 */
export declare function verifyAuditChain(logPath?: string): {
    ok: boolean;
    brokenAt?: number;
};
/** Read the whole chain, oldest-first. Exposed for `agents events audit verify`. */
export declare function readAuditLog(logPath?: string): AuditRecord[];
/**
 * Record ONE dispatched run at the single exec chokepoint into the unified
 * event stream. Non-fatal by contract: any failure is caught and warned, never
 * thrown — a log hiccup must not crash a run that already finished.
 */
export declare function recordDispatchedRun(run: {
    agent: string;
    version: string;
    mode: string;
    cwd: string;
    exitCode: number;
}): void;
