import { WorkflowTaskKind } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/enum_pb";
import type { JsonObject } from "@bufbuild/protobuf";
import type { Node, Edge } from "@xyflow/react";
import type { WorkflowInput } from "@stigmer/sdk";
import type { TopologyNodeCategory } from "./useWorkflowTopology.js";
import type { WorkflowGraphModel } from "./workflow-graph-model.js";
import { type VisualClass } from "./task-type-visual-registry.js";
export declare const CANVAS_TASK_NODE_TYPE: "canvasTask";
export declare const CANVAS_TRANSITION_EDGE_TYPE: "canvasTransition";
export { categorizeKind } from "./kind-metadata.js";
export declare function taskKindToString(kind: WorkflowTaskKind): string;
export declare function stringToTaskKind(str: string): WorkflowTaskKind;
/**
 * Parses a Stigmer Workflow YAML string into an editable graph model.
 *
 * Builds nodes from `spec.tasks` with full configuration data, and infers
 * edges from sequential ordering, explicit `flow.then`, `switch_case`
 * branches, `human_input` outcomes, and fallback task references.
 *
 * @throws {Error} When the YAML is fundamentally unparseable or lacks required structure.
 *
 * @since T15 (Visual Canvas Editor)
 */
export declare function yamlToGraph(yaml: string): WorkflowGraphModel;
/**
 * Serializes a graph model back to canonical Stigmer Workflow YAML.
 *
 * Uses topological sort to determine task ordering. Sequential transitions
 * (task N → task N+1 in sorted order) are implicit and omitted from YAML.
 * Non-sequential transitions emit explicit `flow.then` directives.
 *
 * @since T15 (Visual Canvas Editor)
 */
export declare function graphToYaml(graph: WorkflowGraphModel): string;
/**
 * Converts a graph model into a `WorkflowInput` suitable for
 * `stigmer.workflow.apply()`.
 *
 * This will be the primary save path in Batch 3 when `useWorkflowSave`
 * is extended to accept `WorkflowInput` directly.
 *
 * @since T15 (Visual Canvas Editor)
 */
export declare function graphToWorkflowInput(graph: WorkflowGraphModel, org: string): WorkflowInput;
/**
 * Execution status for a single node in the execution graph.
 * Derived from `DerivedTaskState` in the event store, plus a synthetic
 * `"not_reached"` value for nodes the execution has not touched.
 */
export type NodeExecutionStatus = "not_reached" | "pending" | "running" | "completed" | "failed" | "skipped" | "retrying" | "waiting_approval";
/** Per-node execution state attached to canvas nodes in execution mode. */
export interface NodeExecutionState {
    readonly status: NodeExecutionStatus;
    readonly durationMs?: number;
    readonly costMicros?: bigint;
    readonly attemptNumber?: number;
    readonly error?: string;
}
/** Data payload attached to canvas task nodes. */
export interface CanvasTaskNodeData extends Record<string, unknown> {
    taskName: string;
    kind: WorkflowTaskKind;
    kindString: string;
    category: TopologyNodeCategory;
    visualClass: VisualClass;
    displayName: string;
    ariaShapeLabel: string;
    config: JsonObject;
    exportAs?: string;
    isSentinel: boolean;
    errorCount?: number;
    executionState?: NodeExecutionState;
    /** Fork branch completion progress (T06). Present only for fork nodes in execution mode. */
    forkProgress?: {
        readonly completed: number;
        readonly total: number;
        readonly compete: boolean;
    };
    /** Tool name awaiting approval. Present when status is waiting_approval and a tool name is known. */
    approvalToolName?: string;
    /** Live agent activity summary. Present on running agent_call nodes when progress events arrive. */
    agentActivity?: {
        readonly agentSlug: string;
        readonly currentToolName: string;
        readonly messagesCount: number;
        readonly toolCallsCount: number;
    };
    /** Diff state (T14). Present only in diff mode. */
    diffState?: {
        readonly status: import("./diff/types").NodeDiffStatus;
        readonly changedFields?: readonly string[];
    };
}
/** Data payload attached to canvas transition edges. */
export interface CanvasTransitionEdgeData extends Record<string, unknown> {
    label?: string;
    /** Edge execution state (T06). Present only in execution mode. */
    executionState?: import("./execution").EdgeExecutionState;
    /** Edge diff state (T14). Present only in diff mode. */
    diffState?: import("./diff/types").EdgeDiffStatus;
}
/**
 * Converts a `WorkflowGraphModel` into React Flow node and edge arrays
 * with the custom type identifiers used by `CanvasTaskNode` and
 * `CanvasTransitionEdge`.
 *
 * @since T15 (Visual Canvas Editor)
 */
export declare function toReactFlowElements(graph: WorkflowGraphModel): {
    nodes: Node[];
    edges: Edge[];
};
//# sourceMappingURL=workflow-graph-conversions.d.ts.map