import { type BackendAgentRuntimeKind } from '../../agentRuntime/runtimeSelection';
import type { StreamingUpdate } from '../../agent/types';
import type { AnalysisResult } from '../../agent/core/orchestratorTypes';
import type { QueryResult } from '../../services/traceProcessorService';
import type { CodeAwareMode } from '../../services/codebase/codeAwareFeature';
import { type DataEnvelope } from '../../types/dataContract';
import type { CliAnalysisMode } from '../types';
export interface RunTurnInput {
    tracePath?: string;
    traceId?: string;
    referenceTraceId?: string;
    query: string;
    sessionId?: string;
    analysisMode?: CliAnalysisMode;
    codeAwareMode?: CodeAwareMode;
    codebaseIds?: string[];
    /** Receives every StreamingUpdate from the orchestrator in real time. */
    onEvent: (update: StreamingUpdate) => void;
    /**
     * Fires once after `prepareSession` resolves, before `analyze()` starts
     * streaming events. Lets callers create the session folder + switch to
     * direct disk writes instead of buffering events in memory.
     */
    onSessionReady?: (sessionId: string) => void;
}
export interface RunTurnOutput {
    sessionId: string;
    traceId: string;
    sdkSessionId?: string;
    result: AnalysisResult;
    /** Absolute path to the generated HTML report, or undefined if generation failed. */
    reportHtml?: string;
    reportError?: string;
    model?: string;
    providerId?: string | null;
    agentRuntimeKind?: BackendAgentRuntimeKind;
    providerSnapshotHash?: string | null;
}
export declare function envelopesFromStreamingUpdate(update: StreamingUpdate): DataEnvelope[];
export declare function shouldExposeLiveStreamingUpdate(update: StreamingUpdate): boolean;
/**
 * Singleton per CLI process.
 * - Own `AssistantApplicationService` — no HTTP routes touch it, so the 30-min
 *   idle cleanup (only scheduled from agentRoutes.ts) never runs.
 * - `SessionPersistenceService` writes to `backend/data/sessions/sessions.db`
 *   (the same DB the HTTP server uses — intentional, so REPL sessions are
 *   visible to the web UI and vice versa).
 */
export declare class CliAnalyzeService {
    private static checkedTraceProcessorPath;
    private static traceProcessorInstallPromise;
    private readonly appService;
    private readonly persistence;
    private readonly analyzeService;
    constructor();
    loadTrace(tracePath: string): Promise<string>;
    /**
     * Resume-only path: try to reload an existing trace by its original id,
     * preserving identity so the persisted session's `traceId` still matches.
     * Returns true on success, false if the trace file has been evicted from
     * `uploads/traces/` (caller should then degrade to a fresh load).
     */
    reloadTraceById(traceId: string): Promise<boolean>;
    queryTrace(traceId: string, sql: string): Promise<QueryResult>;
    runTurn(input: RunTurnInput): Promise<RunTurnOutput>;
    /**
     * Build the HTML report for a completed turn. Routes through the shared
     * `normalizeResultForReport` + `buildAgentDrivenReportData` pipeline the
     * HTTP path uses, so CLI and web UI emit identical reports for the same
     * session (same sanitized conclusion text, same derived conclusionContract).
     */
    private buildReportHtml;
    private ensureTraceProcessorAvailable;
    private installTraceProcessor;
    /**
     * Best-effort teardown. Called by CLI on process exit to stop the
     * trace_processor_shell subprocess — otherwise Node waits on it.
     */
    shutdown(): Promise<void>;
}
//# sourceMappingURL=cliAnalyzeService.d.ts.map