import { type AgentRunEvent, type AgentRunRecording, type AgentRunState, type ReplayAgentRunOptions } from './agent-run.js'; export interface UseAgentRunOptions { /** * Stop the real run. Resolve once it has stopped; the hook then records the * run as stopped (unless your producer already sent `run-stopped`). Throw if * it could not be stopped, and the stop control comes back. * * Not needed for a replay — stopping a replay cancels it. */ onStop?: () => void | Promise; /** * Send an approval decision. Resolve — optionally with the resolution text, * e.g. "Approved by Ada at 14:02" — once it is recorded. Throw if it did not * arrive: the approval stays pending and says so, because a decision the * server never received must not look made. * * Without it the approval renders without buttons, as a record. */ onDecision?: (stepId: string, decision: 'approved' | 'rejected') => void | string | Promise; } /** * useAgentRun — run state for AgentActivity, ApprovalGate, StreamingText and * AgentStop, from events. * * Feed it events with `dispatch` from however the run reports progress, or * play a recording with `replay`. It hands back the state and props ready to * spread, and applies the AgentRun and HumanApproval patterns' rules on the * way: one active step, a stopped run keeps what it did, an unanswered * approval is not a yes, a failed decision is not a decision. */ export declare function useAgentRun(options?: UseAgentRunOptions): { state: AgentRunState; dispatch: (event: AgentRunEvent) => void; reset: () => void; replay: (recording: AgentRunRecording, replayOptions?: ReplayAgentRunOptions) => void; /** Steps that began — what AgentActivity lists. */ log: import("./agent-run.js").AgentRunStep[]; hasEnded: boolean; /** Show AgentStop while this is true. */ isRunning: boolean; stop: () => Promise; approve: () => undefined; reject: () => undefined; /** Spread onto AgentStop. */ stopProps: { onStop: () => undefined; isStopping: boolean; }; /** Spread onto StreamingText. */ outputProps: { isStreaming: boolean; children: string; }; /** Spread onto the ApprovalGate for `state.approval.stepId`, with your title. */ approvalProps: { onApprove?: (() => undefined) | undefined; onReject?: (() => undefined) | undefined; status: "pending" | "approved" | "rejected" | "expired"; isSubmitting: boolean; resolution: string | undefined; } | null; }; export type UseAgentRunResult = ReturnType; export type { AgentRunState }; //# sourceMappingURL=use-agent-run.d.ts.map