import type { InterruptRequest, PendingInterrupt } from '../types/graph.js'; /** Base class for graph errors, each with a stable `code`. */ export declare class GraphError extends Error { /** Stable code, such as `GRAPH_NODE_ERROR`. */ readonly code: string; /** The underlying error. */ readonly cause?: unknown | undefined; constructor(message: string, /** Stable code, such as `GRAPH_NODE_ERROR`. */ code: string, /** The underlying error. */ cause?: unknown | undefined); } /** * Raised when a graph definition is invalid: an unknown node, a missing entry point, or a bad * channel. */ export declare class GraphValidationError extends GraphError { constructor(message: string, cause?: unknown); } /** * Thrown by `context.interrupt()` to suspend the graph. * * Control flow, not a failure: the runtime catches it, checkpoints, and reports `awaiting_input`. * It escapes to the caller only when a node interrupts on a graph compiled without a checkpointer, * where there would be nothing to resume from. */ export declare class GraphInterrupt extends GraphError { /** What the node asked for. */ readonly request: InterruptRequest; /** The node that interrupted. */ readonly node: string; /** Superstep it happened in. */ readonly step: number; /** Its position among that node's interrupts in the step. */ readonly index: number; /** Task that asked. Equal to `node` unless the task came from a `Send`. */ readonly taskId: string; constructor( /** What the node asked for. */ request: InterruptRequest, /** The node that interrupted. */ node: string, /** Superstep it happened in. */ step: number, /** Its position among that node's interrupts in the step. */ index: number, /** Task that asked. Equal to `node` unless the task came from a `Send`. */ taskId?: string); } /** * Raised when a run exceeds its superstep budget. * * Cycles are a supported shape, so this is the only thing standing between a mistaken router and an * infinite loop. The message names what was still pending. */ export declare class GraphStepLimitError extends GraphError { /** The budget that was exceeded. */ readonly maxSteps: number; /** Tasks still pending when it stopped. */ readonly pending: readonly string[]; constructor( /** The budget that was exceeded. */ maxSteps: number, /** Tasks still pending when it stopped. */ pending: readonly string[]); } /** Raised when a node throws. The original error is its `cause`. */ export declare class GraphNodeError extends GraphError { /** The node that failed. */ readonly node: string; /** Superstep it failed in. */ readonly step: number; constructor( /** The node that failed. */ node: string, /** Superstep it failed in. */ step: number, cause: unknown); } /** Raised when a thread has no checkpoint to resume or inspect. */ export declare class GraphThreadNotFoundError extends GraphError { /** The thread looked up. */ readonly threadId: string; constructor( /** The thread looked up. */ threadId: string); } /** Raised when resuming a thread that is not awaiting input. */ export declare class GraphNotInterruptedError extends GraphError { /** The thread. */ readonly threadId: string; /** Its current status. */ readonly status: string; constructor( /** The thread. */ threadId: string, /** Its current status. */ status: string); } /** * Raised when a node outlives its `timeoutMs`. * * Separate from an ordinary failure because it is usually worth retrying, and because the node's * signal was aborted underneath it rather than the node choosing to stop. */ export declare class GraphNodeTimeoutError extends GraphError { /** The node. */ readonly node: string; /** The timeout it exceeded, in milliseconds. */ readonly timeoutMs: number; constructor( /** The node. */ node: string, /** The timeout it exceeded, in milliseconds. */ timeoutMs: number); } /** * Stable key for one interrupt, so a replayed node picks up the answer it was given. * * Keyed by task rather than node, so several `Send` tasks of one node each keep their own answer. * For a node reached through an ordinary edge the task id is the node name, so keys written by * earlier releases still resolve. */ export declare function interruptKey(pending: Pick & { taskId?: string; }): string;