import type { Workflow } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/api_pb";
import type { WorkflowInstance } from "@stigmer/protos/ai/stigmer/agentic/workflowinstance/v1/api_pb";
import type { EnvVarDeclaration } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
/** Field-level validation errors keyed by field name. */
export type RunWorkflowFieldErrors = Record<string, string>;
/** Options for {@link useRunWorkflowFlow}. */
export interface UseRunWorkflowFlowOptions {
    /** Organization slug that owns the workflow. */
    readonly org: string;
    /** Workflow resource (must include metadata and spec). */
    readonly workflow: Workflow;
    /** Available workflow instances (for instance selector). */
    readonly instances: readonly WorkflowInstance[];
    /**
     * Called after the execution is created successfully.
     * Receives the execution ID for navigation.
     */
    readonly onSuccess: (executionId: string) => void;
    /**
     * Called when submission fails. Receives a human-readable message.
     * Errors are also available via {@link UseRunWorkflowFlowReturn.error}.
     */
    readonly onError?: (message: string) => void;
}
/** Return value of {@link useRunWorkflowFlow}. */
export interface UseRunWorkflowFlowReturn {
    /** Current trigger message value. */
    readonly triggerMessage: string;
    /** Update the trigger message. */
    readonly setTriggerMessage: (value: string) => void;
    /** Current runtime environment variable overrides (keyed by var name). */
    readonly runtimeEnv: Record<string, string>;
    /** Update a single env var value. */
    readonly setEnvVar: (key: string, value: string) => void;
    /** Selected instance ID, or `null` for server-resolved default. */
    readonly selectedInstanceId: string | null;
    /** Update the selected instance. */
    readonly setSelectedInstanceId: (id: string | null) => void;
    /** Declared environment variables from the workflow spec. */
    readonly envDeclarations: Record<string, EnvVarDeclaration>;
    /**
     * Set of env var keys already provided by the selected instance's
     * bound environments. Empty when no instance is selected or its
     * environments haven't loaded yet.
     */
    readonly instanceEnvKeys: Set<string>;
    /** `true` while instance environment keys are being resolved. */
    readonly isLoadingInstanceEnvKeys: boolean;
    /**
     * Whether the workflow references `$input` / trigger_message in its tasks.
     * When `false`, the trigger message field is irrelevant for this workflow.
     */
    readonly usesTriggerInput: boolean;
    /**
     * Whether the trigger message field should be visible in the form.
     * Defaults to `usesTriggerInput`; can be toggled by the user via
     * the escape-hatch "Add trigger input" link.
     */
    readonly showTriggerMessage: boolean;
    /** Toggle visibility of the trigger message field (escape hatch). */
    readonly setShowTriggerMessage: (show: boolean) => void;
    /** Field-level validation errors (empty when valid). */
    readonly fieldErrors: RunWorkflowFieldErrors;
    /** `true` while the create execution RPC is in flight. */
    readonly isSubmitting: boolean;
    /** Error from the last failed submission, or `null`. */
    readonly error: string | null;
    /** Validate form fields. Returns `true` if valid. */
    readonly validate: () => boolean;
    /** Validate, then create the workflow execution. */
    readonly submit: () => Promise<void>;
    /** Reset all form state to initial values. */
    readonly reset: () => void;
}
/**
 * Behavior hook that orchestrates the "run a workflow" flow.
 *
 * Manages form state (trigger message, runtime env overrides, instance
 * selection), validates required fields, and calls
 * `WorkflowExecutionClient.create()` on submission. On success, the
 * consumer-provided `onSuccess` callback receives the execution ID for
 * navigation or further action.
 *
 * This hook is framework-agnostic — it works identically in Next.js,
 * Vite, Tauri, or any React environment. Navigation and toast feedback
 * are the consumer's responsibility.
 *
 * @example
 * ```tsx
 * const flow = useRunWorkflowFlow({
 *   org: "acme",
 *   workflow,
 *   instances,
 *   onSuccess: (id) => router.push(`/workflows/executions/${id}`),
 *   onError: (msg) => toast.error(msg),
 * });
 *
 * <input value={flow.triggerMessage} onChange={e => flow.setTriggerMessage(e.target.value)} />
 * <button onClick={flow.submit} disabled={flow.isSubmitting}>Run</button>
 * ```
 */
export declare function useRunWorkflowFlow(options: UseRunWorkflowFlowOptions): UseRunWorkflowFlowReturn;
//# sourceMappingURL=useRunWorkflowFlow.d.ts.map