/**
 * ChatTracesService — retrieves the full execution trace of a chat session.
 *
 * A "chat id" is a session id. Its trace is everything that happened in that
 * chat: the persisted messages (with their executed tool calls, outbound LLM
 * context flow, and chain-of-thought) plus any agent threads spun off from the
 * session and their activity logs. This lets an agent inspect how a past chat
 * actually ran — useful for evaluating provider behaviour, diagnosing loops,
 * or auditing tool usage.
 */
import type { SqliteDatabase } from "../db/sqlite-shim.js";
export interface ChatTracesOptions {
    /** Chat (session) id to fetch traces for. */
    chatId: string;
    /** Restrict to a session owned by this user. Optional safety check. */
    userId?: string;
    /** Include chat messages. Defaults to true. */
    includeMessages?: boolean;
    /** Include agent threads + their activities. Defaults to true. */
    includeThreads?: boolean;
    /** Include parsed tool-call payloads on assistant messages. Defaults to true. */
    includeToolCalls?: boolean;
    /** Include the full outbound LLM context-flow rounds. Verbose — defaults to false. */
    includeContextFlow?: boolean;
    /** Include chain-of-thought / reasoning content. Defaults to false. */
    includeThinking?: boolean;
    /** Max messages to return (most recent). Defaults to 200, capped at 1000. */
    messageLimit?: number;
    /** Max thread activities per thread. Defaults to 200, capped at 2000. */
    activityLimit?: number;
}
export interface ChatTraceMessage {
    id: string;
    role: string;
    content: string;
    toolCalls?: unknown;
    segments?: unknown;
    contextFlow?: unknown;
    thinking?: string | null;
    createdAt: string;
}
export interface ChatTraceThreadActivity {
    id: string;
    kind: string;
    summary: string;
    payload?: unknown;
    createdAt: string;
}
export interface ChatTraceThread {
    id: string;
    title: string;
    providerId: string;
    model: string | null;
    runtimeMode: string;
    kind: string;
    status: string;
    error: string | null;
    workingDirectory: string | null;
    branch: string | null;
    prUrl: string | null;
    prState: string | null;
    executionNodeName: string | null;
    createdAt: string;
    updatedAt: string;
    completedAt: string | null;
    activities: ChatTraceThreadActivity[];
}
export interface ChatTracesResult {
    chatId: string;
    found: boolean;
    session: {
        id: string;
        name: string | null;
        userId: string | null;
        projectId: string | null;
        projectPath: string | null;
        status: string | null;
        createdAt: string;
        lastActiveAt: string;
    } | null;
    messages: ChatTraceMessage[];
    threads: ChatTraceThread[];
    counts: {
        messages: number;
        threads: number;
        threadActivities: number;
    };
}
export declare class ChatTracesService {
    private readonly sqlite;
    constructor(sqlite: SqliteDatabase);
    traces(options: ChatTracesOptions): ChatTracesResult;
    private loadSession;
    private loadMessages;
    private loadThreads;
    private loadActivities;
}
//# sourceMappingURL=chat-traces.d.ts.map