fix(langgraph): allow defining interrupt and writer when using Annotation.Root (#1668)

This commit is contained in:
David Duong
2025-09-18 13:51:35 +02:00
committed by GitHub
parent 5184725130
commit a5bcd74081
2 changed files with 20 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@langchain/langgraph": patch
---
Fix type issue with defining `interrupt` and `writer` in StateGraph constructor when using Annotation.Root
+15 -5
View File
@@ -312,11 +312,21 @@ export class StateGraph<
declare Node: StrictNodeAction<S, U, C, N, InterruptType, WriterType>;
constructor(
state: SD extends InteropZodObject
? SD
: SD extends StateDefinition
? AnnotationRoot<SD>
: never,
state: SD extends StateDefinition ? AnnotationRoot<SD> : never,
options?: {
context?: C | AnnotationRoot<ToStateDefinition<C>>;
input?: I | AnnotationRoot<ToStateDefinition<I>>;
output?: O | AnnotationRoot<ToStateDefinition<O>>;
interrupt?: InterruptType;
writer?: WriterType;
nodes?: N[];
}
);
constructor(
state: SD extends InteropZodObject ? SD : never,
options?: {
context?: C | AnnotationRoot<ToStateDefinition<C>>;
input?: I | AnnotationRoot<ToStateDefinition<I>>;