/** * memory-journal-mcp — Audit Interceptor * * Wraps tool execution to produce audit entries for all tool * invocations. Write/admin tools are always logged; read-scoped * tools are logged only when `--audit-reads` is enabled. * * Each entry includes a `tokenEstimate` (~4 bytes per token) * computed from the serialized result size. * * The interceptor is injected into the tool handler cache * (ensureToolCache in handlers/tools/index.ts) so that all * tool handlers are audited without per-handler changes. */ import type { AuditLogger } from './audit-logger.js'; /** Tool handler function signature that the interceptor wraps */ export type AuditToolHandlerFn = (args: Record) => Promise; /** * Audit interceptor interface — provides an `around` method * to wrap tool execution with audit logging. */ export interface AuditInterceptor { /** * Wrap a tool invocation with audit logging. * Returns the tool result unchanged; re-throws any errors. * * @param toolName MCP tool name * @param args Tool input arguments * @param fn The actual tool handler to execute */ around(toolName: string, args: unknown, fn: () => Promise): Promise; } /** * Create an audit interceptor bound to the given logger. * * @param auditLogger The JSONL audit logger */ export declare function createAuditInterceptor(auditLogger: AuditLogger): AuditInterceptor; /** * Execute an operation with audit logging. * Intended for resources and prompts which operate outside the standard tool interceptor. */ export declare function auditOperation(auditLogger: AuditLogger | null, operationType: 'resource' | 'prompt', name: string, fn: () => Promise | T): Promise; //# sourceMappingURL=interceptor.d.ts.map