import type { WorkflowExecution } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
/**
 * A single failed execution reference within a {@link FailureGroup}.
 */
export interface FailureInstance {
    readonly executionId: string;
    readonly executionName: string;
    readonly error: string;
    readonly failedAt: Date | null;
}
/**
 * A group of failures sharing the same failing task name.
 *
 * Sorted by {@link count} descending so the most frequent failures
 * appear first in the failure analysis panel.
 */
export interface FailureGroup {
    /** The task name that failed across multiple executions. */
    readonly taskName: string;
    /** Number of executions where this task failed. */
    readonly count: number;
    /** Most recent error message from this task. */
    readonly latestError: string;
    /** Timestamp of the most recent failure. */
    readonly latestFailedAt: Date | null;
    /** Individual failed execution references (most recent first). */
    readonly instances: readonly FailureInstance[];
}
/**
 * Groups failed executions by their failing task name.
 *
 * Pure function. Only considers executions in FAILED phase. Within each
 * execution, finds the first FAILED task and groups by its name. Executions
 * with no identifiable failed task are grouped under `"(unknown)"`.
 *
 * Returns groups sorted by failure count descending, with instances
 * within each group sorted by failure time descending (most recent first).
 */
export declare function deriveFailureAnalysis(executions: readonly WorkflowExecution[]): FailureGroup[];
//# sourceMappingURL=derive-failure-analysis.d.ts.map