export type TraceTopicGroup = 'code' | 'research' | 'review' | 'content' | 'ops';
/**
 * `real`/`guard`/`hook` are the cause buckets of a FAILED tool call (`classifyCause`).
 * `behavioral` is different in kind: a silent failure with no error code at all — the
 * agent went idle after its last event and a human had to nudge it. It is derived from
 * per-session friction facets (`computeBehavioralPatterns` in `insights.ts`), never from
 * `classifyCause`, so a failed-tool-call classifier never returns it.
 */
export type TraceFailureCause = 'real' | 'guard' | 'hook' | 'behavioral';
/** Per-bucket aggregate stats for one day, stored in the rolling bucketHistory. */
export interface BucketStats {
    key: string;
    date: string;
    count: number;
    /** Tool-error count / total tool calls in this session set (0–1). */
    errorRate: number;
    /** Sessions with ≥1 stall friction signal / total sessions in bucket (0–1). */
    stallRate: number;
}
/** Movement signal for one topic bucket compared to its 7-day rolling average. */
export interface DriftSignal {
    bucket: string;
    /** current errorRate − 7d average (positive = degrading). */
    errorDelta: number;
    /** current stallRate − 7d average (positive = degrading). */
    stallDelta: number;
    severity: 'degrading' | 'stable' | 'improving';
}
export interface TopicEvidence {
    cwd?: string | null;
    gitBranch?: string | null;
    topic?: string | null;
    label?: string | null;
    toolMix?: Record<string, number>;
}
export interface ClassifiedTopic {
    group: TraceTopicGroup;
    key: string;
    label: string;
}
export interface ToolCallFailure {
    tool: string;
    exit_code?: number | null;
    status_code?: number | null;
    error_code?: string | null;
    error?: string | null;
    parse_error?: string | null;
    outcome?: string | null;
}
/** Classify a session from metadata and aggregate tool names; never reads transcript text. */
export declare function classifyTopic(input: TopicEvidence): ClassifiedTopic;
/** Bucket a failed tool call without inspecting raw tool input or transcript text. */
export declare function classifyCause(call: ToolCallFailure): TraceFailureCause;
/**
 * Compare today's per-bucket stats to the last 7 days of history and return
 * movement signals. Buckets with fewer than 3 historical days are skipped —
 * not enough signal to distinguish noise from drift.
 */
export declare function computeDriftSignal(history: BucketStats[][], today: BucketStats[]): DriftSignal[];
