@@ -3501,40 +3501,31 @@ graph TD;
35013501 it ( "should handle partial pending checkpoint" , async ( ) => {
35023502 const checkpointer = await createCheckpointer ( ) ;
35033503
3504- const StateAnnotation = Annotation . Root ( {
3505- my_key : Annotation < string > ( {
3506- reducer : ( a , b ) => a + b ,
3507- } ) ,
3508- market : Annotation < string > ,
3509- } ) ;
3510-
3511- const toolOne = (
3512- s : typeof StateAnnotation . State
3513- ) : typeof StateAnnotation . Update => {
3514- return { my_key : " one" } ;
3515- } ;
3516-
35173504 let toolTwoNodeCount = 0 ;
35183505
3519- function toolTwoNode (
3520- s : typeof StateAnnotation . State
3521- ) : typeof StateAnnotation . Update {
3522- toolTwoNodeCount += 1 ;
3523- const answer =
3524- s . market === "DE" ? interrupt ( "Just because..." ) : " all good" ;
3525- return { my_key : answer } ;
3526- }
3506+ const toolTwoGraph = new StateGraph (
3507+ Annotation . Root ( {
3508+ my_key : Annotation < string > ( { reducer : ( a , b ) => a + b } ) ,
3509+ market : Annotation < string > ,
3510+ } )
3511+ )
3512+ . addNode ( {
3513+ tool_one : ( ) => ( { my_key : " one" } ) ,
3514+ tool_two : ( { market } ) => {
3515+ toolTwoNodeCount += 1 ;
35273516
3528- function start (
3529- state : typeof StateAnnotation . State
3530- ) : Array < Send | string > {
3531- return [ "tool_two" , new Send ( "tool_one" , state ) ] ;
3532- }
3517+ if ( market === "DE" ) {
3518+ return { my_key : interrupt ( "Just because..." ) } ;
3519+ }
35333520
3534- const toolTwoGraph = new StateGraph ( StateAnnotation )
3535- . addNode ( "tool_two" , toolTwoNode )
3536- . addNode ( "tool_one" , toolOne )
3537- . addConditionalEdges ( START , start , [ "tool_one" , "tool_two" ] ) ;
3521+ return { my_key : " all good" } ;
3522+ } ,
3523+ } )
3524+ . addConditionalEdges (
3525+ START ,
3526+ ( state ) => [ "tool_two" , new Send ( "tool_one" , state ) ] ,
3527+ [ "tool_one" , "tool_two" ]
3528+ ) ;
35383529
35393530 let toolTwo = toolTwoGraph . compile ( ) ;
35403531
0 commit comments