/** * Surface 2 — `darwinAnnotation(extra?)`. * * Returns a LangGraph `Annotation.Root({ ... })` pre-populated with three * Darwin-aware channels: * - `task` (string, last-write-wins): the task fed to the Darwin agent. * - `output` (string, last-write-wins): the agent's final text output. * - `darwinTrajectory` (ExecutionTrace | undefined, last-write-wins): * the captured execution trace, available downstream nodes or to * the post-run evolution hook. * * Composable: pass any extra channels via the `extra` argument and they * merge into the same `Annotation.Root` spread. * * @example * ```ts * import { darwinAnnotation } from "darwin-langgraph"; * import { Annotation, StateGraph } from "@langchain/langgraph"; * * const State = darwinAnnotation({ * reviewNotes: Annotation({ * reducer: (a, b) => a.concat(b), * default: () => [], * }), * }); * * const graph = new StateGraph(State) * .addNode("research", createDarwinNode(researcher)) * .addNode("review", createDarwinNode(reviewer)) * .compile(); * ``` * * Design note: the channels use default last-write-wins reducers. If you * want trajectory-accumulation (e.g. one entry per node), define your own * channel via `extra` (e.g. `trajectories: Annotation(...)`) * and skip `captureTrace` on every `createDarwinNode` call except the one * you want to overwrite the singleton. */ import type { ExecutionTrace } from "darwin-agents"; /** * Pure last-write-wins reducer for trajectory. Exported for testability * and so consumers can wrap it (e.g. cap at last-N). */ export declare function lastWriteWinsTrajectoryReducer(_prev: ExecutionTrace | undefined, next: ExecutionTrace | undefined): ExecutionTrace | undefined; /** * Spec object used inside `Annotation.Root({ ... })`. Exported so power * users can spread it manually into their own `Annotation.Root` call when * the generic helper doesn't fit their setup (e.g. when they need a * differently named `task` or `output` channel and don't want the * defaults). * * Returned as a fresh object on every call so consumers can mutate it * without affecting other graphs in the same process — the underlying * `Annotation` references are reused, which is what LangGraph expects. * * Return type is intentionally inferred. The internal `LastValue` vs * `BaseChannel<...>` mismatch between `Annotation()` (zero-arg, plain * last-write) and `Annotation({reducer,default})` (full BaseChannel) * is opaque to `Annotation.Root` (it accepts the union via `SDZod`). * Hand-typing the return triggers TS2741 — inference works correctly. */ export declare function getDarwinChannelSpec(): { task: import("@langchain/langgraph").LastValue; output: import("@langchain/langgraph").LastValue; darwinTrajectory: import("@langchain/langgraph").BaseChannel | undefined, unknown>; }; /** * Build an `Annotation.Root` schema with Darwin's three default channels * plus any extra channels supplied by the caller. * * The return type is intentionally inferred from * `Annotation.Root({...})` so `typeof darwinAnnotation().State` works * exactly like a hand-rolled `Annotation.Root`. */ export declare function darwinAnnotation = {}>(extra?: Extra): import("@langchain/langgraph").AnnotationRoot<{ task: import("@langchain/langgraph").LastValue; output: import("@langchain/langgraph").LastValue; darwinTrajectory: import("@langchain/langgraph").BaseChannel | undefined, unknown>; } & Extra>; //# sourceMappingURL=darwin-annotation.d.ts.map