/** * Audit Logger * * JSONL logging for autopilot runs. */ import type { TokenUsage, AutopilotStatus, WorkerStatus } from '../types.js'; /** * Log entry types */ export type AuditLogType = 'run:started' | 'run:completed' | 'run:paused' | 'run:resumed' | 'run:aborted' | 'epic:started' | 'epic:completed' | 'epic:failed' | 'ticket:started' | 'ticket:completed' | 'ticket:failed' | 'ticket:retried' | 'worker:created' | 'worker:started' | 'worker:completed' | 'worker:failed' | 'worker:idle' | 'cost:threshold' | 'cost:limit_reached' | 'rate_limit:hit' | 'rate_limit:cleared' | 'error:systemic' | 'sync:state' | 'git:commit' | 'git:merge' | 'git:conflict'; /** * Base log entry */ export interface AuditLogEntry { timestamp: string; runId: string; type: AuditLogType; data: Record; } /** * Audit Logger Options */ export interface AuditLoggerOptions { runId: string; workingDirectory: string; logDir?: string; } /** * Audit Logger * * Writes structured JSONL logs for autopilot runs. */ export declare class AuditLogger { private runId; private logFilePath; private writeQueue; private isWriting; private initialized; constructor(options: AuditLoggerOptions); /** * Initialize the logger */ initialize(): Promise; /** * Log an entry */ log(type: AuditLogType, data?: Record): Promise; /** * Process the write queue */ private processQueue; /** * Log run started */ logRunStarted(data: { specificationId: string; maxParallelWorkers: number; maxTotalCostUsd: number; }): Promise; /** * Log run completed */ logRunCompleted(data: { status: AutopilotStatus; totalCostUsd: number; totalTokens: TokenUsage; completedTickets: number; failedTickets: number; durationMs: number; }): Promise; /** * Log run paused */ logRunPaused(reason: string): Promise; /** * Log run resumed */ logRunResumed(): Promise; /** * Log run aborted */ logRunAborted(reason: string): Promise; /** * Log epic started */ logEpicStarted(epicId: string, epicTitle: string): Promise; /** * Log epic completed */ logEpicCompleted(epicId: string, ticketsCompleted: number, ticketsFailed: number): Promise; /** * Log epic failed */ logEpicFailed(epicId: string, error: string): Promise; /** * Log ticket started */ logTicketStarted(ticketId: string, ticketTitle: string, workerId: number): Promise; /** * Log ticket completed */ logTicketCompleted(ticketId: string, workerId: number, costUsd: number, tokens: TokenUsage, filesModified: string[]): Promise; /** * Log ticket failed */ logTicketFailed(ticketId: string, workerId: number, error: string, retryCount: number): Promise; /** * Log ticket retried */ logTicketRetried(ticketId: string, workerId: number, retryCount: number): Promise; /** * Log worker created */ logWorkerCreated(workerId: number, worktreePath: string): Promise; /** * Log worker status change */ logWorkerStatus(workerId: number, status: WorkerStatus, ticketId?: string): Promise; /** * Log cost threshold */ logCostThreshold(threshold: number, currentCost: number, percentUsed: number): Promise; /** * Log cost limit reached */ logCostLimitReached(limit: number, currentCost: number): Promise; /** * Log rate limit hit */ logRateLimitHit(retryAfterMs: number, provider: string): Promise; /** * Log rate limit cleared */ logRateLimitCleared(): Promise; /** * Log systemic error */ logSystemicError(errorType: string, errorCount: number, message: string): Promise; /** * Log git commit */ logGitCommit(ticketId: string, commitHash: string, branch: string): Promise; /** * Log git merge */ logGitMerge(sourceBranch: string, targetBranch: string, success: boolean, commitHash?: string): Promise; /** * Log git conflict */ logGitConflict(sourceBranch: string, targetBranch: string, files: string[]): Promise; /** * Flush pending writes */ flush(): Promise; /** * Get log file path */ getLogFilePath(): string; /** * Get run ID */ getRunId(): string; /** * Read log entries */ readEntries(): Promise; /** * Get entries by type */ getEntriesByType(type: AuditLogType): Promise; } /** * Create an audit logger */ export declare function createAuditLogger(options: AuditLoggerOptions): AuditLogger; //# sourceMappingURL=audit-logger.d.ts.map