export declare const DEFAULT_AUDIT_FILE: string; export declare const REDACTED = "[redacted]"; export interface AuditEntry { timestamp: string; session_id: string; /** LAN IPv4 of the host. Recorded in stdio mode only (meaningless inside a container). */ machine_ip?: string; /** Identity of the caller as known to the host (hosted deployments). */ user_id?: string; /** Correlates the entry with the host's request log (hosted deployments). */ request_id?: string; tool: string; /** Allowlisted arguments verbatim; everything else present becomes "[redacted]". */ args: Record; outcome: "success" | "error" | "not_found"; error_message?: string; clio_user_id?: string; matter_id?: number; result_count?: number; } export interface AuditFilter { date_from?: string; date_to?: string; matter_id?: number; limit?: number; offset?: number; /** Restrict to one caller. Injected automatically from the session context when it carries a userId. */ user_id?: string; session_id?: string; } /** @deprecated Use AuditFilter. Kept for 2.x compatibility. */ export type AuditLogFilter = AuditFilter; export interface AuditReadResult { entries: AuditEntry[]; total_matched: number; } export interface ReadAuditLogResult extends AuditReadResult { truncated: boolean; } export interface AuditSink { append(entry: AuditEntry): Promise; read(filter: AuditFilter & { limit: number; offset: number; }): Promise; } /** tool name -> argument keys that may be written to the log verbatim. */ export type RedactPolicy = Readonly>; /** * Audit keys that are DERIVED from an argument rather than being one. * * A tool may log a summary of an input instead of the input itself. `update_matter` * accepts `custom_field_values`, which carry the values a firm vets cases on, and * logs `custom_field_ids`, which say which fields were touched without saying what * they were set to. Such a key by definition cannot appear in the tool's * inputSchema, so the "allowlisted keys must be real inputs" invariant has to be * told about it. * * Adding a key here is deliberate and reviewable. Everything in this set must be * ids or counts; `auditRedaction.test.ts` enforces that separately, so this stays * a narrow exception rather than a way around the guard. */ export declare const DERIVED_AUDIT_KEYS: ReadonlySet; export declare const AUDIT_ARG_ALLOWLIST: RedactPolicy; /** * Apply the allowlist for `tool` to `args`. Keys with an `undefined` value are * dropped (they were not passed). Allowed keys keep their value (secret-named * nested keys are still masked); every other key becomes "[redacted]". */ export declare function redactAuditArgs(tool: string, args: Record, policy?: RedactPolicy): Record; /** The default sink: one JSON object per line, appended to a file. */ export declare function createFileAuditSink(file?: string): AuditSink; interface AuditConfig { sink: AuditSink; redact: RedactPolicy; /** Force machine_ip on/off. Defaults to "only in stdio mode". */ includeMachineIp?: boolean; } /** Replace the sink and/or the redaction policy. Hosts call this once at startup. */ export declare function configureAudit(options: Partial): void; /** Back to the file sink and the built-in allowlist. Used by tests. */ export declare function resetAudit(): void; export declare function appendAuditLog(entry: Omit & { clio_user_id?: string; result_count?: number; }): Promise; /** * Read entries through the configured sink. When the session context carries a * userId (hosted deployments) the read is scoped to that user unless the * filter names one explicitly. */ export declare function readAuditLog(filter?: AuditFilter): Promise; export {}; //# sourceMappingURL=auditLog.d.ts.map