import type { ActorAssurance } from './tokens.js'; import { type MetaSource } from './receipt.js'; import type { CustomPiiPattern, DetectorToggles } from './types.js'; export interface AuditEntry { timestamp: string; actor: string; /** How the identity was established. The artefact carries not just who, but HOW they were known. */ actorAssurance?: ActorAssurance; /** Name of the active masking profile (if any). Undefined on the base policy. */ policyProfile?: string; tool: string; args?: any; source?: string; rowsReturned?: number; maskedCount?: number; denied: boolean; status?: string; target?: string; reason?: string; governance?: unknown; /** * Connected client, if it reported during MCP `initialize` (`clientInfo`). * OVERRIDES the config declaration: a measured value outranks a declared one. */ client?: { name: string; version: string; source?: MetaSource; }; /** * Text sent to the client. Only the hash is written to the receipt. NEVER * written to the audit JSONL — the result line must not leak into the audit trail. */ disclosurePayload?: string; prevHash?: string; hash?: string; signature?: string; /** Ed25519 signature over entry.hash (v0.1). */ sig?: { alg: 'Ed25519'; keyId: string; value: string; }; } /** * Receipt metadata. Since v0.3 BOTH are OPTIONAL — a gap is not invented; * it is written on the receipt as `source: 'undeclared'`. * * Why it was relaxed: model identity is not in the MCP protocol, so it cannot * come from anywhere unless the operator declares it. Making it required kept * the receipt completely shut — the "signed receipt for every access" promise * was therefore unmet in production. Receipts are now produced and mark the * unknown field as undeclared instead of hiding it. */ export interface ReceiptMeta { model?: { provider: string; name: string; version: string; }; client?: { name: string; version: string; source?: MetaSource; }; /** Operator declaration. Not verified. Policy does not read this. */ destination?: string; } export declare class Audit { private sink?; private consumer; private failClosed; private hmacKey?; private signingKey; /** keyId → verify key (current signing pubkey + CONARIUM_AUDIT_TRUST_PUBKEYS). */ private trustStore; private lastHash; /** Sink byte size at last sync — if another writer interleaved, a stale lastHash is caught. */ private sinkSize; /** Receipt chain state — opt-in (active when receiptSink is provided). */ private receiptSink?; private receiptMeta?; private receiptLastHash; private receiptSeq; private scanCharCap?; private detectors?; private customPatterns; private lockPath?; constructor(opts?: { sink?: string; consumer?: string; failClosed?: boolean; receiptSink?: string; receiptMeta?: ReceiptMeta; scanCharCap?: number; detectors?: DetectorToggles; customPatterns?: CustomPiiPattern[]; }); close(): void; private requireSigningCapability; private currentSinkSize; /** * If another writer appended to the sink, the in-memory lastHash is stale. * Cheap exit if size did not change; re-read the tail if it did. * Does not close a real race of two instances writing at once — that needs a file lock. */ private syncLastHashIfStale; private getLastHash; /** Load the receipt chain's last state from the file (seq + hash). */ private loadReceiptChainState; /** Same pipeline as audit args — used for client-facing error text (G13). */ maskText(value: string): string; private maskArgs; log(entry: Omit & { /** The person who performed the access. If omitted, the per-instance fixed consumer is used. */ actor?: string; actorAssurance?: ActorAssurance; }): AuditEntry; /** Build a receipt from AuditEntry, append to the chain, write to receiptSink. */ private writeReceipt; private validateChain; } //# sourceMappingURL=audit.d.ts.map