/**
 * Trace-analyst auto-execution hook.
 *
 * Wires `analyzeTraces` into a `TraceEmitter`'s `onRunComplete` so a
 * direct matrix run produces an analysis artifact without an out-of-band
 * step. Designed for the case where the consumer reports "the analyst
 * never ran" — the cause is almost always orchestration, not the analyst.
 *
 * Usage:
 *
 *   const emitter = new TraceEmitter(store, {
 *     onRunComplete: [traceAnalystOnRunComplete({ analyze: opts, save })],
 *   })
 *
 * Hooks are best-effort by default — they never crash the underlying run.
 * The caller decides whether to gate the run on the analysis result via
 * the `gateOn` callback.
 */
import type { RunCompleteHook, RunCompleteHookContext } from '../trace/emitter';
import { type AnalyzeTracesOptions, type AnalyzeTracesResult } from './analyst';
export interface TraceAnalystHookOptions {
    /**
     * Options forwarded to `analyzeTraces`. The hook supplies the question
     * if you don't pass one — defaulting to a launch-grade prompt that asks
     * for failure modes, surprising findings, and a recommendation.
     */
    analyze: Omit<AnalyzeTracesOptions, 'source'> & {
        source?: AnalyzeTracesOptions['source'];
    };
    /**
     * Override the question. The default is intentionally generic:
     * "Summarise what happened in this run, surface any failure modes,
     *  surprising findings, or evidence the verdict is wrong."
     */
    question?: string;
    /**
     * Persist the result. The hook calls this with the analysis output and
     * the run context. Common implementations write to a TraceAnalysisStore
     * or append to a per-run JSONL.
     */
    save?: (result: AnalyzeTracesResult, ctx: RunCompleteHookContext) => Promise<void>;
    /**
     * Predicate gating execution per run. Default: every completed run.
     * Use to skip aborted runs, debug runs, or runs without LLM activity.
     */
    shouldRun?: (ctx: RunCompleteHookContext) => boolean;
    /**
     * Optional gate: if set and returns false, the hook records the failure
     * as a log event on the run instead of staying quiet. The caller can
     * then trigger downstream alerts off `analyst_gate_failed` log events.
     */
    gateOn?: (result: AnalyzeTracesResult, ctx: RunCompleteHookContext) => boolean;
}
export declare function traceAnalystOnRunComplete(opts: TraceAnalystHookOptions): RunCompleteHook;
//# sourceMappingURL=hook.d.ts.map