/** * CAELTrace — Contracted Agent-Environment Loop artifact schema (Phase 1). * * JSONL entry format with hash-chain integrity. Each line is one event. * * Hash mode (Option C, 2026-04-20 SECURITY wave): the chain hash * function is configurable between FNV-1a (default, fast, non- * cryptographic) and SHA-256 (opt-in via ContractConfig.useCryptographicHash). * Mode is threaded into hashCAELEntry + verifyCAELHashChain, and * written into cael.init.payload.hashMode for trace self-identification * (Prereq 3 — prevents silent-downgrade and mid-trace mode tampering). * * See: packages/engine/src/simulation/sha256.ts for the hash primitives. */ import { type HashMode } from './sha256'; import { hashCAELEntry } from './hashes'; export { hashCAELEntry }; export type CAELTraceEvent = 'init' | 'step' | 'interaction' | 'solve' | 'final'; export interface CAELTraceEntry { version: 'cael.v1'; runId: string; index: number; event: CAELTraceEvent; timestamp: number; simTime: number; prevHash: string; hash: string; payload: Record; } export type CAELTrace = CAELTraceEntry[]; export declare function encodeCAELValue(value: unknown): unknown; export declare function decodeCAELValue(value: unknown): unknown; export declare function toCAELJSONL(trace: CAELTrace): string; export declare function parseCAELJSONL(jsonl: string): CAELTrace; /** * Verify the hash chain of a CAEL trace under a given mode. * * Mode semantics (Option C, Prereq 3): * - If `mode` is provided, every entry's hash must both (a) equal * the re-computed hashCAELEntry output under that mode and * (b) have a shape consistent with that mode. Any entry whose * hash shape contradicts the declared mode is a mid-trace * tamper — the verifier rejects with a specific error. * - If `mode` is omitted, infer from the trace: prefer the mode * recorded in `trace[0].payload.hashMode`, else fall back to * 'fnv1a' (back-compat for pre-Option-C traces). * * The shape check is the Prereq 3 guard: an adversary who replaces a * single event's hash with a different-mode hash (even with a * matching chain recomputation) is caught before the expected-hash * comparison runs. */ export declare function verifyCAELHashChain(trace: CAELTrace, mode?: HashMode): { valid: boolean; brokenAt?: number; reason?: string; }; //# sourceMappingURL=CAELTrace.d.ts.map