import type { Node, Edge } from "@xyflow/react";
import type { WorkflowExecution } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
import type { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/enum_pb";
import type { DerivedTaskState } from "../internal/store/workflow-execution-event-store.js";
/** Options for {@link useWorkflowExecutionGraph}. */
export interface UseWorkflowExecutionGraphOptions {
    /** ID of the workflow execution to visualize. */
    readonly executionId: string;
    /**
     * Pre-fetched execution from the parent. When provided, the hook
     * skips its own `useWorkflowExecution` call — eliminating the
     * duplicate fetch.
     */
    readonly execution?: WorkflowExecution | null;
    /**
     * Externally-derived task states from a shared event store. When
     * provided, the hook skips its own `useWorkflowExecutionEventStream`
     * call — eliminating the duplicate gRPC subscription.
     */
    readonly taskStates?: ReadonlyMap<string, DerivedTaskState>;
    /**
     * Callback invoked once when the hook auto-selects a failed task
     * on a terminal execution. The parent can wire this to its own
     * `setSelectedTaskName` to keep the inspector in sync.
     *
     * Without this, auto-selection only affects the hook's internal
     * `selectedTaskName` state and is invisible to sibling components.
     */
    readonly onAutoSelectTask?: (taskName: string) => void;
    /**
     * When `true`, non-sentinel nodes are marked `draggable: true` so
     * the parent component can allow ephemeral drag repositioning.
     * Sentinel nodes (Start/End) remain non-draggable regardless.
     * @default false
     */
    readonly nodesDraggable?: boolean;
}
/** Return value of {@link useWorkflowExecutionGraph}. */
export interface UseWorkflowExecutionGraphReturn {
    /** React Flow nodes with execution state merged into data. */
    readonly nodes: Node[];
    /** React Flow edges. */
    readonly edges: Edge[];
    /** Current execution lifecycle phase. */
    readonly executionPhase: ExecutionPhase | undefined;
    /** Currently selected task name in the graph. */
    readonly selectedTaskName: string | null;
    /** Set the selected task in the graph. */
    readonly setSelectedTaskName: (name: string | null) => void;
    /** `true` while the graph model is being loaded (workflow fetch + parse). */
    readonly isLoading: boolean;
    /** Error from workflow fetch or graph building. */
    readonly error: string | null;
    /**
     * When the workflow has been modified since this execution ran,
     * indicates the mismatch. `null` when no mismatch detected.
     */
    readonly versionMismatch: string | null;
    /**
     * `true` when the execution has a pinned version hash but the version
     * lookup failed (NOT_FOUND, network error, empty YAML). The graph shows
     * the current definition as a fallback but this is an imprecise view.
     */
    readonly versionResolutionFailed: boolean;
    /** Task states from the event stream (for the inspector). */
    readonly taskStates: ReadonlyMap<string, DerivedTaskState>;
}
/**
 * Behavior hook that builds a complete read-only execution graph by:
 * 1. Resolving the workflow definition (always fetched — it's the graph source)
 * 2. Serializing to YAML and parsing into a graph model
 * 3. Computing dagre layout
 * 4. Converting to React Flow elements
 * 5. Merging live execution state into node data
 *
 * When `execution` and `taskStates` are provided externally (from a
 * parent that already subscribes), the hook skips its own duplicate
 * subscriptions. When omitted, it falls back to independent fetching
 * for standalone `<WorkflowExecutionGraph executionId="..." />` usage.
 */
export declare function useWorkflowExecutionGraph(options: UseWorkflowExecutionGraphOptions): UseWorkflowExecutionGraphReturn;
//# sourceMappingURL=useWorkflowExecutionGraph.d.ts.map