@@ -27,7 +27,8 @@ import {
2727} from "./pending-final-delivery.js" ;
2828import type { FollowupRun } from "./queue.js" ;
2929import type { ReplyMediaContext } from "./reply-media-paths.js" ;
30- import type { ReplyOperationRunState } from "./reply-operation-run-state.js" ;
30+ import { recordReplyOperationAgentTurn } from "./reply-operation-agent-turn-state.js" ;
31+ import { resolveReplyOperationRunState } from "./reply-operation-run-state.js" ;
3132import type { ReplyOperation } from "./reply-run-registry.js" ;
3233import { resolveReplyToMode } from "./reply-threading.js" ;
3334import { createReplyRestartRecoveryClaimController } from "./restart-recovery-claim.js" ;
@@ -82,7 +83,6 @@ type ExecutePreparedReplyAgentRunInput = Pick<
8283 performSessionReset : ( options : SessionResetOptions ) => Promise < boolean > ;
8384 replyMediaContext : ReplyMediaContext ;
8485 replyOperation : ReplyOperation ;
85- replyOperationRunState : ReplyOperationRunState | undefined ;
8686 replyRouteThreadId : ReturnType < typeof resolveRoutedDeliveryThreadId > ;
8787 replyToChannel : OriginatingChannelType | undefined ;
8888 replyToMode : ReturnType < typeof resolveReplyToMode > ;
@@ -126,7 +126,6 @@ export async function executePreparedReplyAgentRun(
126126 queueKey,
127127 replyMediaContext,
128128 replyOperation,
129- replyOperationRunState,
130129 replyRouteThreadId,
131130 replyThreadingOverride,
132131 replyToChannel,
@@ -394,11 +393,10 @@ export async function executePreparedReplyAgentRun(
394393 } ) ,
395394 ) ,
396395 ) ;
397- if ( replyOperationRunState ) {
398- replyOperationRunState . agentTurn = {
399- status : runOutcome . outcome . kind === "settled" ? runOutcome . outcome . status : "failed" ,
400- } ;
401- }
396+ recordReplyOperationAgentTurn (
397+ resolveReplyOperationRunState ( opts ) ,
398+ runOutcome . outcome . kind === "settled" ? runOutcome . outcome . status : "failed" ,
399+ ) ;
402400 activeSessionEntry = getActiveSessionEntry ( ) ;
403401 activeIsNewSession = getActiveIsNewSession ( ) ;
404402
0 commit comments