|
|
|
@ -1172,16 +1172,22 @@ const useSuperAgentStream = ({ |
|
|
|
"cancelled", |
|
|
|
"canceled", |
|
|
|
].includes(runPhase); |
|
|
|
const isPersistedExecutionActiveForUi = |
|
|
|
isPersistedExecutionActive && !isTerminalRunPhase; |
|
|
|
const effectiveRunPhase = |
|
|
|
isPersistedSuspended |
|
|
|
? "idle" |
|
|
|
: shouldResetStaleWaitingPhase |
|
|
|
? "running" |
|
|
|
: isPersistedExecutionActive && (runPhase === "idle" || isTerminalRunPhase) |
|
|
|
: isPersistedExecutionActive && runPhase === "idle" |
|
|
|
? "running" |
|
|
|
: runPhase; |
|
|
|
const effectiveIsLocalRunActive = isPersistedSuspended ? false : isLocalRunActive; |
|
|
|
const effectiveIsBusinessRunning = isPersistedSuspended ? false : isBusinessRunning; |
|
|
|
const isPersistedThreadActiveForUi = |
|
|
|
isPersistedThreadActive && !isTerminalRunPhase; |
|
|
|
const effectiveIsLocalRunActive = |
|
|
|
isPersistedSuspended || isTerminalRunPhase ? false : isLocalRunActive; |
|
|
|
const effectiveIsBusinessRunning = |
|
|
|
isPersistedSuspended || isTerminalRunPhase ? false : isBusinessRunning; |
|
|
|
const visibleInterrupts = useMemo(() => { |
|
|
|
if (!isStreamProjectionReady && !isInterruptProjectionReady) return []; |
|
|
|
|
|
|
|
@ -1230,13 +1236,15 @@ const useSuperAgentStream = ({ |
|
|
|
effectiveRunPhase |
|
|
|
); |
|
|
|
const effectiveIsLoading = |
|
|
|
isPersistedSuspended |
|
|
|
isTerminalRunPhase |
|
|
|
? false |
|
|
|
: isPersistedSuspended |
|
|
|
? isRespondingInterrupt |
|
|
|
: stream.isLoading || |
|
|
|
isRespondingInterrupt || |
|
|
|
isBusinessRunning || |
|
|
|
isRunPhaseActive || |
|
|
|
isPersistedExecutionActive; |
|
|
|
isPersistedExecutionActiveForUi; |
|
|
|
|
|
|
|
return { |
|
|
|
messages: streamMessages, |
|
|
|
@ -1250,7 +1258,7 @@ const useSuperAgentStream = ({ |
|
|
|
isLoading: effectiveIsLoading, |
|
|
|
isLocalRunActive: effectiveIsLocalRunActive, |
|
|
|
runPhase: effectiveRunPhase, |
|
|
|
isPersistedThreadActive, |
|
|
|
isPersistedThreadActive: isPersistedThreadActiveForUi, |
|
|
|
currentInterruptId: |
|
|
|
hydratedState && |
|
|
|
pendingHydratedInterrupts.length === 0 && |
|
|
|
|