import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
/**
 * Lifecycle phases for the workflow refinement flow.
 *
 * - `idle` — panel open, no conversation yet
 * - `starting` — creating session (first turn) + execution
 * - `streaming` — agent is working (tool calls, validation, refinement)
 * - `complete` — agent finished, YAML was extracted (diff showing)
 * - `ready` — agent finished without YAML (clarifying question / explanation),
 *   or user accepted/discarded a previous result
 * - `error` — a failure occurred (RPC, stream)
 */
export type RefinePhase = "idle" | "starting" | "streaming" | "complete" | "ready" | "error";
/** Options for {@link useRefineWorkflowFlow}. */
export interface UseRefineWorkflowFlowOptions {
    /** Organization slug for session and execution creation. */
    readonly org: string;
    /** Live YAML from the editor. Captured via ref at send-time, not reactively. */
    readonly currentYaml: string;
    /** Called when any step fails. Also available via the `error` return. */
    readonly onError?: (message: string) => void;
}
/** Return value of {@link useRefineWorkflowFlow}. */
export interface UseRefineWorkflowFlowReturn {
    /** Current lifecycle phase. */
    readonly phase: RefinePhase;
    /** Completed execution snapshots for MessageThread (chronological). */
    readonly completedExecutions: readonly AgentExecution[];
    /** Currently streaming execution, or null when idle/between turns. */
    readonly activeExecution: AgentExecution | null;
    /** `true` while the agent execution is actively streaming. */
    readonly isStreaming: boolean;
    /** Extracted YAML from the latest turn (null unless phase is `complete`). */
    readonly extractedYaml: string | null;
    /** Agent's explanation prose from the latest turn. */
    readonly explanation: string | null;
    /** Human-readable error message, or `null` when healthy. */
    readonly error: string | null;
    /** Send a refinement instruction. Creates session on first call. */
    readonly sendInstruction: (instruction: string) => Promise<void>;
    /** Accept the extracted YAML. Returns the YAML string. Transitions to `ready`. */
    readonly acceptResult: () => string | null;
    /** Discard the extracted YAML without applying. Transitions to `ready`. */
    readonly discardResult: () => void;
    /** Reset all state to initial values. Does not delete the server-side session. */
    readonly reset: () => void;
}
/**
 * Behavior hook that orchestrates agent-powered workflow refinement
 * using the built-in Workflow Architect system agent.
 *
 * Manages a multi-turn conversation within a single Session:
 * - First turn creates a Session + AgentExecution
 * - Subsequent turns reuse the Session (conversational context)
 * - Each turn streams agent messages via {@link useExecutionStream}
 * - YAML is extracted from agent responses via {@link extractWorkflowYaml}
 *
 * The `currentYaml` prop is captured at send-time (ref-based, not reactive)
 * and included in the message only when it differs from the last-sent version.
 *
 * Framework-agnostic (DD-004), referentially stable returns (DD-010).
 *
 * @example
 * ```tsx
 * const flow = useRefineWorkflowFlow({
 *   org: "acme",
 *   currentYaml: editor.yaml,
 *   onError: (msg) => toast.error(msg),
 * });
 *
 * <WorkflowRefinePanel flow={flow} onAccept={...} onClose={...} />
 * ```
 */
export declare function useRefineWorkflowFlow(options: UseRefineWorkflowFlowOptions): UseRefineWorkflowFlowReturn;
//# sourceMappingURL=useRefineWorkflowFlow.d.ts.map