import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
/**
 * Lifecycle phases for the Workflow Architect generate flow.
 *
 * - `idle` — waiting for user to submit a prompt
 * - `starting` — creating session + execution
 * - `streaming` — agent is working (tool calls, validation, generation)
 * - `complete` — agent finished and YAML was extracted successfully
 * - `extraction-failed` — agent finished but no YAML block was found
 * - `applying` — creating the workflow from extracted YAML
 * - `error` — a failure occurred (RPC, stream, or apply)
 */
export type ArchitectPhase = "idle" | "starting" | "streaming" | "complete" | "extraction-failed" | "applying" | "error";
/** Options for {@link useWorkflowArchitectFlow}. */
export interface UseWorkflowArchitectFlowOptions {
    /** Organization slug — used for session, execution, and workflow creation. */
    readonly org: string;
    /**
     * Called after the workflow is created successfully.
     * Receives the org slug and workflow slug for navigation.
     */
    readonly onSuccess: (org: string, slug: string) => void;
    /**
     * Called when any step fails. Receives a human-readable message.
     * Errors are also available via {@link UseWorkflowArchitectFlowReturn.error}.
     */
    readonly onError?: (message: string) => void;
}
/** Return value of {@link useWorkflowArchitectFlow}. */
export interface UseWorkflowArchitectFlowReturn {
    /** Current prompt value. */
    readonly prompt: string;
    /** Update the prompt. */
    readonly setPrompt: (value: string) => void;
    /** Current lifecycle phase. */
    readonly phase: ArchitectPhase;
    /**
     * Latest execution snapshot from the agent stream.
     *
     * Non-null during `streaming`, `complete`, and `extraction-failed`
     * phases. Pass to `MessageThread` for rendering agent messages.
     */
    readonly execution: AgentExecution | null;
    /** `true` while the agent execution is actively streaming. */
    readonly isStreaming: boolean;
    /** Extracted YAML when phase is `complete`, otherwise `null`. */
    readonly extractedYaml: string | null;
    /** Agent's explanation prose when phase is `complete`, otherwise `null`. */
    readonly explanation: string | null;
    /** Human-readable error message, or `null` when healthy. */
    readonly error: string | null;
    /**
     * Validate the prompt and launch the Workflow Architect agent.
     *
     * Creates a session with the `workflow-architect` system agent,
     * starts an execution with the user's prompt, and begins streaming.
     * The stream phase transitions automatically when the agent finishes.
     */
    readonly generate: () => Promise<void>;
    /**
     * Create a workflow from the extracted YAML via `workflow.apply()`.
     *
     * Only callable when phase is `complete`. Calls `onSuccess` with
     * the org and slug on completion.
     */
    readonly createWorkflow: () => Promise<void>;
    /** Reset all state to initial values. Does not delete the session. */
    readonly reset: () => void;
}
/**
 * Behavior hook that orchestrates the agent-powered "generate a workflow"
 * flow using the built-in Workflow Architect system agent.
 *
 * Composes existing infrastructure:
 * - {@link useCreateSession} to create a session with the agent
 * - {@link useCreateAgentExecution} to start the generation execution
 * - {@link useExecutionStream} + `ConversationStore` for real-time streaming
 * - {@link extractWorkflowYaml} to parse YAML from agent messages
 * - `workflow.apply()` to persist the generated workflow
 *
 * The hook is framework-agnostic (DD-004) and returns referentially
 * stable values (DD-010).
 *
 * @example
 * ```tsx
 * const flow = useWorkflowArchitectFlow({
 *   org: "acme",
 *   onSuccess: (org, slug) => router.push(`/library/workflows/${org}/${slug}`),
 *   onError: (msg) => toast.error(msg),
 * });
 *
 * <WorkflowArchitectDialog {...flow} />
 * ```
 */
export declare function useWorkflowArchitectFlow(options: UseWorkflowArchitectFlowOptions): UseWorkflowArchitectFlowReturn;
//# sourceMappingURL=useWorkflowArchitectFlow.d.ts.map