import type { AssistantRunContext, ServerAssistant } from '../types/server.js'; /** * The part of a compiled graph the adapter uses. * * Structural, so the server entry point never imports the graph runtime: an application that serves * plain functions does not load it, and one that serves graphs already has it. */ export interface GraphLike { /** Runs an input, yielding one event per superstep. */ stream(input: unknown, options: { threadId?: string; signal?: AbortSignal; metadata?: Record; }): AsyncIterable; /** Answers an interrupt and continues the thread. */ resume(threadId: string, value: unknown, options: { signal?: AbortSignal; metadata?: Record; }): AsyncIterable; /** The thread's checkpoint, at its latest step or at one given. */ state(threadId: string, step?: number): Promise<{ step?: number; state?: unknown; } | undefined>; /** Writes values into a thread's state, which is how a rollback is applied. */ updateState?(threadId: string, values: Record, options?: { asNode?: string; }): Promise; } /** Options for `graphAssistant()`. */ export interface GraphAssistantOptions { /** What the assistant is, reported by the assistants endpoint. */ description?: string; /** Metadata recorded on every checkpoint the server's runs create. */ metadata?: Record; } /** * Serves a compiled graph as an assistant. * * Threads map to graph threads, so state, interrupts, history, and checkpoints are the graph's own; * the server adds only the record of which run owns a thread. A graph compiled without a * checkpointer still works for stateless runs, but cannot resume or roll back. */ export declare function graphAssistant(graph: GraphLike, options?: GraphAssistantOptions): ServerAssistant; /** * Serves a plain function as an assistant, for work that is not a graph. * * The function may return a value or yield events; the last value it yields is the run's output. */ export declare function functionAssistant(run: (input: unknown, context: AssistantRunContext) => AsyncIterable | Promise | unknown, options?: { description?: string; }): ServerAssistant;