import type { RunnableConfig } from '@langchain/core/runnables'; import type { ApprovalGateConfig, BaseGraphState } from '@/types/graph'; /** * Interrupt payload for approval gate nodes. * Passed to interrupt() and persisted in the checkpoint. */ export interface ApprovalGateInterrupt { /** Discriminator to distinguish from tool approval interrupts */ type: 'approval_gate'; /** Unique gate identifier */ gateId: string; /** Approval channel (chat, outlook, telegram) */ channel: string; /** Human-readable prompt for the approver */ prompt?: string; /** Approver identifier */ approver?: string; /** Timeout in ms */ timeoutMs?: number; /** Source agent ID (who just finished) */ sourceAgentId?: string; /** Destination agent ID (who will run next if approved) */ destinationAgentId?: string; } /** * Creates a graph node function that acts as an approval gate. * * Unlike tool approval (which respects ExecutionContext and can be auto-approved * in scheduled/handoff modes), approval gates ALWAYS fire. They are placed by * the builder between agents in a sequence and represent explicit human * checkpoints that cannot be bypassed. * * Flow: * 1. Dispatch ON_APPROVAL_GATE notification (for SSE/persistence) * 2. Call interrupt() — graph pauses, state is checkpointed * 3. On resume, interrupt() returns the ToolApprovalResponse * 4. If approved, pass state through (next agent runs) * 5. If denied, return state as-is (routing handled by conditional edge) * * @param config - The approval gate configuration from the edge definition * @param sourceAgentId - The agent that precedes this gate * @param destinationAgentId - The agent that follows this gate */ export declare function createApprovalGateNode(config: ApprovalGateConfig, sourceAgentId: string, destinationAgentId: string): (state: BaseGraphState, runnableConfig?: RunnableConfig) => Promise>; /** * Node ID for an approval gate, derived from the gate configuration. * Used by MultiAgentGraph when inserting gate nodes into the graph. */ export declare function getApprovalGateNodeId(gateId: string): string;