import type { WorkflowExecution } from "@stigmer/protos/ai/stigmer/agentic/workflowexecution/v1/api_pb";
import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
/** Options for {@link useWorkflowExecutionActions}. */
export interface UseWorkflowExecutionActionsOptions {
    /**
     * Called after any lifecycle action (cancel, terminate, pause, resume,
     * recover) succeeds. Receives the updated execution returned by the
     * server. Useful for triggering a refetch of execution data so the UI
     * reflects the new phase.
     *
     * Not called for approval submissions — those are background operations
     * whose effects arrive via the event stream.
     */
    readonly onSuccess?: (execution: WorkflowExecution) => void;
}
/** Return value of {@link useWorkflowExecutionActions}. */
export interface UseWorkflowExecutionActionsReturn {
    /** Cancel a running execution gracefully. */
    readonly cancel: (reason?: string) => Promise<WorkflowExecution | null>;
    /** Terminate a running execution immediately. */
    readonly terminate: (reason?: string) => Promise<WorkflowExecution | null>;
    /** Pause a running execution. */
    readonly pause: (reason?: string) => Promise<WorkflowExecution | null>;
    /** Resume a paused execution. */
    readonly resume: () => Promise<WorkflowExecution | null>;
    /**
     * Recover a failed execution with task-level resume.
     *
     * Terminates stale workflows, re-resolves environment variables (picks up
     * any config fixes), and starts a fresh run in recovery mode. Completed
     * tasks are skipped — their outputs are restored from the event log —
     * and execution resumes from the first incomplete or failed task.
     *
     * @param reason - Optional audit trail message explaining why recovery
     *   was triggered (e.g., "Rotated API key").
     */
    readonly recover: (reason?: string) => Promise<WorkflowExecution | null>;
    /** Submit an approval decision for a child agent's tool execution. */
    readonly submitApproval: (toolCallId: string, action: ApprovalAction, comment?: string) => Promise<WorkflowExecution | null>;
    /**
     * Submit a reviewer's decision for a workflow-level human_input task.
     *
     * Unlike `submitApproval` (which forwards agent tool approvals),
     * this sends a Temporal signal to the workflow runner's human_input
     * orchestrator, unblocking the task with the selected outcome.
     */
    readonly submitTaskApproval: (taskName: string, outcome: string, formData?: Record<string, unknown>, comment?: string) => Promise<WorkflowExecution | null>;
    /** `true` while any action is in flight. */
    readonly isSubmitting: boolean;
    /** Error from the last failed action, or `null`. */
    readonly error: Error | null;
    /** Reset `error` to `null`. */
    readonly clearError: () => void;
}
/**
 * Behavior hook that encapsulates workflow execution lifecycle actions.
 *
 * Each action calls the corresponding RPC and returns the updated
 * execution, or `null` on failure (with `error` populated).
 *
 * Pass `null` for `executionId` to disable all actions (they become
 * no-ops that return `null`).
 *
 * @example
 * ```tsx
 * const actions = useWorkflowExecutionActions(executionId, {
 *   onSuccess: () => refetchExecution(),
 * });
 *
 * <button onClick={() => actions.cancel("No longer needed")} disabled={actions.isSubmitting}>
 *   Cancel
 * </button>
 * ```
 */
export declare function useWorkflowExecutionActions(executionId: string | null, options?: UseWorkflowExecutionActionsOptions): UseWorkflowExecutionActionsReturn;
//# sourceMappingURL=useWorkflowExecutionActions.d.ts.map