/**
 * Operation Log Service
 *
 * Provides persistent, queryable operation logs for observability.
 * Writes structured log entries to the operation_log SQLite table so that
 * events survive session restarts and can be queried later via the CLI.
 *
 * Categories:
 * - dispatch: Task dispatch events, poll errors
 * - session: Session spawn/terminate/failure
 * - merge: Test results, merge outcomes
 * - rate-limit: Rate limit detection and recovery
 * - steward: Steward execution events
 * - recovery: Orphan recovery events
 *
 * @module
 */
import type { StorageBackend } from '@stoneforge/storage';
/**
 * Log levels for operation log entries
 */
export declare const OperationLogLevel: {
    readonly INFO: "info";
    readonly WARN: "warn";
    readonly ERROR: "error";
};
export type OperationLogLevel = (typeof OperationLogLevel)[keyof typeof OperationLogLevel];
/**
 * Categories for operation log entries
 */
export declare const OperationLogCategory: {
    readonly DISPATCH: "dispatch";
    readonly MERGE: "merge";
    readonly SESSION: "session";
    readonly RATE_LIMIT: "rate-limit";
    readonly STEWARD: "steward";
    readonly RECOVERY: "recovery";
};
export type OperationLogCategory = (typeof OperationLogCategory)[keyof typeof OperationLogCategory];
/**
 * An operation log entry as stored in the database
 */
export interface OperationLogEntry {
    readonly id: string;
    readonly timestamp: string;
    readonly level: OperationLogLevel;
    readonly category: OperationLogCategory;
    readonly agentId?: string;
    readonly taskId?: string;
    readonly message: string;
    readonly details?: Record<string, unknown>;
}
/**
 * Filters for querying operation log entries
 */
export interface OperationLogFilter {
    /** Filter by log level */
    readonly level?: OperationLogLevel;
    /** Filter by category */
    readonly category?: OperationLogCategory;
    /** Filter entries after this ISO timestamp */
    readonly since?: string;
    /** Filter by task ID */
    readonly taskId?: string;
    /** Filter by agent ID */
    readonly agentId?: string;
    /** Maximum number of entries to return (default: 20) */
    readonly limit?: number;
}
/**
 * Operation Log Service interface
 */
export interface OperationLogService {
    /**
     * Write a log entry to the operation_log table.
     *
     * @param level - Log level: 'info', 'warn', or 'error'
     * @param category - Log category: 'dispatch', 'merge', 'session', 'rate-limit', 'steward', 'recovery'
     * @param message - Human-readable message
     * @param details - Optional structured details (stored as JSON)
     */
    write(level: OperationLogLevel, category: OperationLogCategory, message: string, details?: {
        agentId?: string;
        taskId?: string;
    } & Record<string, unknown>): void;
    /**
     * Query operation log entries with optional filters.
     *
     * @param filters - Optional filters for level, category, since, task, agent, limit
     * @returns Array of matching log entries, newest first
     */
    query(filters?: OperationLogFilter): OperationLogEntry[];
}
/**
 * Creates an OperationLogService backed by the given StorageBackend.
 *
 * @param storage - The SQLite storage backend with the operation_log table
 * @returns An OperationLogService instance
 */
export declare function createOperationLogService(storage: StorageBackend): OperationLogService;
//# sourceMappingURL=operation-log-service.d.ts.map