@@ -289,7 +289,9 @@ export function makeCursorAgentSdkReplayRunner(
289289
290290 const waitForRun = < Error > (
291291 runId : string ,
292- sendInput : CursorAgentSdk . CursorAgentSdkSendInput < Error > ,
292+ runInput : {
293+ readonly onDelta ?: ( update : InteractionUpdate ) => Effect . Effect < void , Error > ;
294+ } ,
293295 ) : Effect . Effect < RunResult , CursorAgentSdkReplayError > =>
294296 Effect . gen ( function * ( ) {
295297 while ( true ) {
@@ -365,7 +367,7 @@ export function makeCursorAgentSdkReplayRunner(
365367 ) ;
366368 }
367369 advance ( ) ;
368- yield * ( sendInput . onDelta ?.( frame . update ) ?? Effect . void ) . pipe (
370+ yield * ( runInput . onDelta ?.( frame . update ) ?? Effect . void ) . pipe (
369371 Effect . mapError ( ( cause ) =>
370372 recordFailure (
371373 new CursorReplayRuntimeError ( {
@@ -447,6 +449,34 @@ export function makeCursorAgentSdkReplayRunner(
447449 } ,
448450 catch : ( cause ) => replayRunnerError ( transcript , cause , "replay.session.send" ) ,
449451 } ) ,
452+ summarize : ( summarizeInput ) =>
453+ Effect . try ( {
454+ try : ( ) => {
455+ assertOutbound ( {
456+ type : "run.summarize" ,
457+ } ) ;
458+ const started = consumeInbound ( "run.started" ) ;
459+ const run : CursorAgentSdk . CursorAgentSdkRun = {
460+ runId : started . runId ,
461+ agentId : started . agentId ,
462+ wait : waitForRun ( started . runId , summarizeInput ?? { } ) . pipe (
463+ Effect . mapError ( ( cause ) =>
464+ replayRunnerError ( transcript , cause , "replay.run.wait" ) ,
465+ ) ,
466+ ) ,
467+ cancel : Effect . try ( {
468+ try : ( ) =>
469+ assertOutbound ( {
470+ type : "run.cancel" ,
471+ runId : started . runId ,
472+ } ) ,
473+ catch : ( cause ) => replayRunnerError ( transcript , cause , "replay.run.cancel" ) ,
474+ } ) ,
475+ } ;
476+ return run ;
477+ } ,
478+ catch : ( cause ) => replayRunnerError ( transcript , cause , "replay.session.summarize" ) ,
479+ } ) ,
450480 listMessages : Effect . try ( {
451481 try : ( ) => {
452482 assertOutbound ( {
0 commit comments