import { PhaseProgressPhase, PhaseProgressStatus } from '../primitives/phase-progress';
import { LiveLogTailHandle, LiveLogTailParseResult } from '../primitives/live-log-tail';
import { MetricsItem } from './metrics-card';
import { PerCaseColumnDef, PerCaseRow } from './per-case-stats-table';
/**
 * RunMonitor — top-level composite for live training-run monitoring.
 * @countermeasure-platform/web-components/composites/run-monitor
 *
 * Renders a flexible run-monitor layout. All slots are optional and absent
 * slots collapse cleanly. The default ordering is:
 *
 *   header        → top of the card (consumer renders back-button, title)
 *   PhaseProgress → always (driven by `phases` + `currentPhase` + `status`)
 *   MetricsCard   → when `metrics` is provided
 *   PerCaseStats  → when `perCaseStats` + `perCaseColumns` are provided
 *   LiveLogTail   → always (auto-following CodeMirror viewer)
 *   summary       → after the per-case table when present
 *   error         → red-tinted card when `status === 'failed' | 'cancelled'`
 *   actions       → bottom-right (consumer renders cancel/resume buttons)
 *
 * SSE wiring is opt-in via `streamSource`:
 *   - `'auto'` (default): the composite calls `useSSE(streamUrl)` itself,
 *     dispatches `log` events into the LogTail, and exposes connection
 *     state via the live badge.
 *   - `'none'`: the composite does NOT open an EventSource. Callers feed
 *     log lines via the `onLogLine` callback (which they invoke from their
 *     own SSE handler) — useful when the host already manages SSE for
 *     phase / progress / status events outside of this composite.
 *
 * `lineParser` colours each line; `onLogLine` fires for every line so a
 * host can update per-case stats from log content without re-implementing
 * the LogTail buffer.
 */
import * as React from 'react';
export type { PhaseProgressPhase as RunMonitorPhase, PhaseProgressStatus as RunMonitorStatus };
export type { MetricsItem, PerCaseColumnDef, PerCaseRow };
export type RunMonitorStreamSource = 'auto' | 'none';
export interface RunMonitorProps extends React.HTMLAttributes<HTMLDivElement> {
    runId: number | string;
    streamUrl: string;
    phases: PhaseProgressPhase[];
    currentPhase: string;
    status: PhaseProgressStatus;
    metrics?: MetricsItem[];
    perCaseStats?: PerCaseRow[];
    perCaseColumns?: PerCaseColumnDef[];
    /**
     * Auth token for the SSE connection. NOT surfaced in the DOM — intentionally
     * stripped to prevent token leakage. Cookie-backed auth (`withCredentials`)
     * is the supported path; query-string tokens require the lower-level
     * SSEManager with explicit `allowQueryTokenAuth`.
     */
    sseToken?: string;
    /** Slot rendered in the top-left of the header strip. */
    header?: React.ReactNode;
    /** Slot rendered in the top-right of the header strip. */
    actions?: React.ReactNode;
    /** Slot rendered after the per-case table. */
    summary?: React.ReactNode;
    /**
     * Slot rendered when `status === 'failed' | 'cancelled'`. Wrapped in a
     * red-tinted card so the host can pass plain text or a structured node.
     */
    error?: React.ReactNode;
    /** Custom log-line parser used by `LiveLogTail` for severity coloring. */
    lineParser?: (line: string) => LiveLogTailParseResult;
    /**
     * Fires for every parsed log line — including ones synthesized by the
     * host when `streamSource='none'`. Hosts use this to drive per-case
     * stats from log content without re-implementing the LogTail buffer.
     */
    onLogLine?: (line: string) => void;
    /**
     * Whether this composite manages its own SSE connection. Defaults to
     * `'auto'`. `'none'` disables internal SSE wiring so callers can feed
     * the LogTail externally via the `logRef` ref.
     */
    streamSource?: RunMonitorStreamSource;
    /**
     * Imperative handle into the embedded LogTail. Hosts using
     * `streamSource='none'` call `logRef.current?.append(line)` from their
     * own event handler.
     */
    logRef?: React.Ref<LiveLogTailHandle>;
    /**
     * @deprecated Pass a Cancel button via the `actions` slot. Kept for
     * back-compat with v0.3.0 callers.
     */
    onCancel?: () => void;
    /**
     * @deprecated Pass a Resume button via the `actions` slot. Kept for
     * back-compat with v0.3.0 callers.
     */
    onResume?: () => void;
    /**
     * @deprecated Renamed to `lineParser` to mirror `LiveLogTail`. Both
     * names are accepted; `lineParser` wins when both are supplied.
     */
    logLineParser?: (line: string) => LiveLogTailParseResult;
}
export declare function RunMonitor({ runId, streamUrl, phases, currentPhase, status, metrics, perCaseStats, perCaseColumns, sseToken: _sseToken, header, actions, summary, error, lineParser, logLineParser, onLogLine, streamSource, logRef, onCancel, onResume, className, ...rest }: RunMonitorProps): import("react/jsx-runtime").JSX.Element;
//# sourceMappingURL=run-monitor.d.ts.map