export interface ToolCallRecord {
    id: number;
    tool: string;
    args: string;
    result: string;
    status: 'ok' | 'error';
    duration_ms: number;
    tokens: number;
    timestamp: number;
}
export interface TelemetryFilter {
    tool?: string;
    status?: 'ok' | 'error';
    since?: number;
    until?: number;
    limit?: number;
}
export interface TelemetrySummary {
    total_calls: number;
    total_tokens: number;
    total_errors: number;
    total_duration_ms: number;
    by_tool: Record<string, {
        calls: number;
        tokens: number;
        errors: number;
        avg_duration_ms: number;
    }>;
}
/**
 * TelemetryDB — in-memory (or file-backed) SQLite telemetry store via sql.js.
 *
 * Records tool calls with duration and token usage.
 * Supports filtered queries, summary aggregation, and JSON/CSV export.
 */
export declare class TelemetryDB {
    private db;
    private dbPath;
    private ready;
    constructor(dbPath?: string);
    /**
     * Initialize the WASM SQLite database. Must be called before any other method.
     */
    init(): Promise<void>;
    private createSchema;
    /**
     * Record a tool call.
     */
    recordToolCall(tool: string, args: Record<string, unknown>, result: Record<string, unknown>, duration: number, tokens: number): void;
    /**
     * Query tool call records with optional filters.
     */
    query(filter?: TelemetryFilter): ToolCallRecord[];
    /**
     * Get a summary of all tool call activity.
     */
    getSummary(): TelemetrySummary;
    /**
     * Export all records as JSON or CSV.
     */
    export(format?: 'json' | 'csv'): string;
    /**
     * Persist the database to disk (if a path was provided at construction).
     * Returns true if saved, false if in-memory-only.
     */
    save(): Promise<boolean>;
    /**
     * Close the database, freeing WASM memory.
     */
    close(): void;
    get isReady(): boolean;
    private assertReady;
    /** Type-safe accessor: call only from methods guarded by assertReady(). */
    private get _db();
}
//# sourceMappingURL=db.d.ts.map