/** * Transcript Logger * * Records agent interactions with Merkle chain integrity. * Each entry is cryptographically linked to the previous, * enabling tamper detection and audit trails. * * @module transcripts/logger */ /** * Type of transcript entry */ export type TranscriptEntryType = "prompt" | "tool_call" | "tool_result" | "model_response" | "system" | "error" | "redaction"; /** * A single transcript entry */ export interface TranscriptEntry { /** Entry ID */ id: string; /** Timestamp */ timestamp: string; /** Entry type */ type: TranscriptEntryType; /** Session ID */ sessionId: string; /** Model ID if applicable */ modelId?: string; /** Tool name if tool_call or tool_result */ toolName?: string; /** Redacted content for logging */ content: string; /** SHA-256 hash of original (un-redacted) content */ contentHash: string; /** Hash of previous entry (Merkle chain) */ previousHash: string; /** This entry's hash */ entryHash: string; /** Metadata */ metadata?: Record; } /** * Signed transcript bundle */ export interface SignedTranscript { /** Session ID */ sessionId: string; /** Start timestamp */ startedAt: string; /** End timestamp */ endedAt: string; /** Number of entries */ entryCount: number; /** First entry hash (root of Merkle chain) */ rootHash: string; /** Last entry hash (tip of Merkle chain) */ tipHash: string; /** Summary of entry types */ entrySummary: Record; /** Whether redactions were applied */ hasRedactions: boolean; /** Sigstore signature (populated by signing module) */ signature?: string; /** Signing timestamp */ signedAt?: string; } /** * Verification result */ export interface TranscriptVerification { /** Whether the chain is valid */ valid: boolean; /** Number of entries verified */ entriesVerified: number; /** Index where chain breaks (if invalid) */ brokenAt?: number; /** Description of the issue */ issue?: string; /** Root hash */ rootHash: string; /** Tip hash */ tipHash: string; } /** * Logger for recording agent transcripts with Merkle chain integrity */ export declare class TranscriptLogger { private sessionId; private entries; private previousHash; private filePath; private startedAt; private hasRedactions; /** * Create a new transcript logger */ constructor(sessionId?: string); /** * Get the session ID */ getSessionId(): string; /** * Append an entry to the transcript */ append(entry: Omit): TranscriptEntry; /** * Log a prompt */ logPrompt(content: string, modelId?: string, metadata?: Record): TranscriptEntry; /** * Log a tool call */ logToolCall(toolName: string, input: string, metadata?: Record): TranscriptEntry; /** * Log a tool result */ logToolResult(toolName: string, output: string, metadata?: Record): TranscriptEntry; /** * Log a model response */ logModelResponse(content: string, modelId?: string, metadata?: Record): TranscriptEntry; /** * Log a system event */ logSystem(content: string, metadata?: Record): TranscriptEntry; /** * Log an error */ logError(content: string, metadata?: Record): TranscriptEntry; /** * Log a redaction event (for audit trail) */ logRedaction(originalContentHash: string, redactionType: string, metadata?: Record): TranscriptEntry; /** * Get all entries */ getChain(): TranscriptEntry[]; /** * Get entry count */ getEntryCount(): number; /** * Verify the Merkle chain integrity */ verify(): TranscriptVerification; /** * Generate a signed transcript summary */ generateSignedTranscript(): SignedTranscript; /** * Configure file persistence */ setFilePath(path: string): Promise; /** * Append entry to file */ private appendToFile; /** * Export to JSONL format */ toJSONL(): string; /** * Export entries to JSON */ toJSON(): string; } /** * Create a new transcript logger */ export declare function createLogger(sessionId?: string): TranscriptLogger; /** * Get an existing logger by session ID */ export declare function getLogger(sessionId: string): TranscriptLogger | undefined; /** * Remove a logger */ export declare function removeLogger(sessionId: string): boolean; /** * Get all active session IDs */ export declare function getActiveSessions(): string[]; /** * Load a transcript from a JSONL file */ export declare function loadTranscript(filePath: string): Promise; /** * Verify a transcript file */ export declare function verifyTranscriptFile(filePath: string): Promise; //# sourceMappingURL=logger.d.ts.map