import type { Command } from 'commander';
import type { SessionTrajectory } from '../lib/session/trajectory.js';
import type { TrajectoryComparison, TrajectoryDivergence, TrajectorySummary } from '../lib/session/trajectory-compare.js';
import type { TrajectoryStep } from '../lib/session/trajectory.js';
import type { LineageEdge, LineageNode, SessionLineage } from '../lib/session/trajectory-lineage.js';
/** Versioned envelope emitted by `--json` — the stable contract for consumers. */
export declare const SESSIONS_TRACE_SCHEMA_VERSION = 1;
/** The `diff` block of a `layout: 'compare'` envelope — everything but the two full trajectories, which already ride `sessions`. */
export interface SessionsTraceDiffEnvelope {
    divergence?: TrajectoryDivergence;
    added: TrajectoryStep[];
    removed: TrajectoryStep[];
    summaryA: TrajectorySummary;
    summaryB: TrajectorySummary;
    truncatedA: number;
    truncatedB: number;
}
/** The `lineage` block of a `layout: 'lineage'` envelope — the delegation graph. */
export interface SessionsTraceLineageEnvelope {
    rootId: string;
    nodes: LineageNode[];
    edges: LineageEdge[];
    teams: string[];
    unresolvedParentIds: string[];
}
/** The `--json` envelope: the versioned contract for the ext / triaging agents. */
export interface SessionsTraceEnvelope {
    schemaVersion: typeof SESSIONS_TRACE_SCHEMA_VERSION;
    kind: 'sessions-trace';
    layout: 'single' | 'compare' | 'lineage';
    sessions: SessionTrajectory[];
    diff?: SessionsTraceDiffEnvelope;
    lineage?: SessionsTraceLineageEnvelope;
}
/** Build the versioned `--json` envelope for a single-session trajectory. */
export declare function buildTraceEnvelope(models: SessionTrajectory[]): SessionsTraceEnvelope;
/** Build the versioned `--json` envelope for a two-session compare. */
export declare function buildCompareTraceEnvelope(cmp: TrajectoryComparison): SessionsTraceEnvelope;
/**
 * Build the versioned `--json` envelope for a lineage. `sessions` carries the
 * ROOT's trajectory only: the graph's own numbers come from the indexed session
 * rows, so a consumer pays one transcript parse instead of one per teammate —
 * `agents sessions trace <child>` is how you get a child's full trajectory.
 */
export declare function buildLineageTraceEnvelope(lineage: SessionLineage, rootTrajectory: SessionTrajectory): SessionsTraceEnvelope;
interface TraceOptions {
    html?: boolean;
    text?: boolean;
    json?: boolean;
    output?: string;
    open?: boolean;
    errorsOnly?: boolean;
    redact?: boolean;
    all?: boolean;
    since?: string;
    limit?: string;
    agent?: string;
    compare?: boolean;
    tree?: boolean;
}
export type RenderFormat = 'html' | 'text' | 'json';
/**
 * Pick the rendering by audience: explicit `--html/--text/--json` win; otherwise
 * a person at a TTY gets the visual HTML and a piped/headless caller (an agent)
 * gets the compact text trajectory.
 */
export declare function chooseFormat(options: TraceOptions, isTTY: boolean): RenderFormat;
/**
 * Decide the trace layout from what the user TYPED (`selectorCount`) vs what
 * those selectors RESOLVED to (`resolvedCount`). Keyed on selector count so a
 * single content-search selector that happens to match two sessions never
 * silently becomes a compare — every unsupported combination fails loud with a
 * clear message. Pure, so the boundaries are unit-tested without the command.
 */
export declare function decideTraceLayout(options: Pick<TraceOptions, 'tree' | 'compare'>, selectorCount: number, resolvedCount: number): 'single' | 'compare' | 'lineage';
/** Attach the trace behaviour to a command node (canonical or top-level alias). */
export declare function configureTraceCommand(cmd: Command): Command;
/** Canonical `agents sessions trace <selectors...>`. */
export declare function registerSessionsTraceCommand(sessionsCmd: Command): void;
/** Top-level alias `agents trace <selectors...>` (mirrors `agents insights`). */
export declare function registerTraceCommand(program: Command): void;
export {};
