File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -1337,10 +1337,16 @@ export class Runner extends RunHooks<any, AgentOutputType<unknown>> {
13371337 callModelInputFilter,
13381338 } ;
13391339 const session = effectiveOptions . session ;
1340- const sessionOriginalInput =
1341- input instanceof RunState
1342- ? undefined
1343- : ( input as string | AgentInputItem [ ] ) ;
1340+ const resumingFromState = input instanceof RunState ;
1341+ let sessionOriginalInput : string | AgentInputItem [ ] | undefined ;
1342+ if ( resumingFromState ) {
1343+ if ( session ) {
1344+ sessionOriginalInput = [ ] as AgentInputItem [ ] ;
1345+ // Persist new outputs without duplicating the original turn when resuming with memory.
1346+ }
1347+ } else {
1348+ sessionOriginalInput = input as string | AgentInputItem [ ] ;
1349+ }
13441350
13451351 let preparedInput : typeof input = input ;
13461352 if ( ! ( preparedInput instanceof RunState ) ) {
@@ -1349,10 +1355,6 @@ export class Runner extends RunHooks<any, AgentOutputType<unknown>> {
13491355 session ,
13501356 sessionInputCallback ,
13511357 ) ;
1352- } else if ( session ) {
1353- throw new UserError (
1354- 'Cannot provide a session when resuming from a previous RunState.' ,
1355- ) ;
13561358 }
13571359
13581360 const executeRun = async ( ) => {
You can’t perform that action at this time.
0 commit comments