@@ -5,13 +5,7 @@ import type {
55 BlockErrorData ,
66 BlockStartedData ,
77} from '@/lib/workflows/executor/execution-events'
8- import type {
9- BlockLog ,
10- BlockState ,
11- ExecutionResult ,
12- NormalizedBlockOutput ,
13- StreamingExecution ,
14- } from '@/executor/types'
8+ import type { BlockLog , BlockState , ExecutionResult , StreamingExecution } from '@/executor/types'
159import { stripCloneSuffixes } from '@/executor/utils/subflow-utils'
1610import { processSSEStream } from '@/hooks/use-execution-stream'
1711
@@ -112,7 +106,6 @@ export interface BlockEventHandlerConfig {
112106 accumulatedBlockLogs : BlockLog [ ]
113107 accumulatedBlockStates : Map < string , BlockState >
114108 executedBlockIds : Set < string >
115- consoleMode : 'update' | 'add'
116109 includeStartConsoleEntry : boolean
117110 onBlockCompleteCallback ?: ( blockId : string , output : unknown ) => Promise < void >
118111}
@@ -142,7 +135,6 @@ export function createBlockEventHandlers(
142135 accumulatedBlockLogs,
143136 accumulatedBlockStates,
144137 executedBlockIds,
145- consoleMode,
146138 includeStartConsoleEntry,
147139 onBlockCompleteCallback,
148140 } = config
@@ -203,61 +195,6 @@ export function createBlockEventHandlers(
203195 endedAt : data . endedAt ,
204196 } )
205197
206- const addConsoleEntry = ( data : BlockCompletedData , output : NormalizedBlockOutput ) => {
207- if ( ! workflowId ) return
208- addConsole ( {
209- input : data . input || { } ,
210- output,
211- success : true ,
212- durationMs : data . durationMs ,
213- startedAt : data . startedAt ,
214- executionOrder : data . executionOrder ,
215- endedAt : data . endedAt ,
216- workflowId,
217- blockId : data . blockId ,
218- executionId : executionIdRef . current ,
219- blockName : data . blockName || 'Unknown Block' ,
220- blockType : data . blockType || 'unknown' ,
221- ...extractIterationFields ( data ) ,
222- } )
223- }
224-
225- const addConsoleErrorEntry = ( data : BlockErrorData ) => {
226- if ( ! workflowId ) return
227-
228- const existingRunningEntry = useTerminalConsoleStore
229- . getState ( )
230- . getWorkflowEntries ( workflowId )
231- . some (
232- ( entry ) =>
233- entry . blockId === data . blockId &&
234- entry . executionId === executionIdRef . current &&
235- entry . isRunning
236- )
237-
238- if ( existingRunningEntry ) {
239- updateConsoleErrorEntry ( data )
240- return
241- }
242-
243- addConsole ( {
244- input : data . input || { } ,
245- output : { } ,
246- success : false ,
247- error : data . error ,
248- durationMs : data . durationMs ,
249- startedAt : data . startedAt ,
250- executionOrder : data . executionOrder ,
251- endedAt : data . endedAt ,
252- workflowId,
253- blockId : data . blockId ,
254- executionId : executionIdRef . current ,
255- blockName : data . blockName || 'Unknown Block' ,
256- blockType : data . blockType || 'unknown' ,
257- ...extractIterationFields ( data ) ,
258- } )
259- }
260-
261198 const updateConsoleEntry = ( data : BlockCompletedData ) => {
262199 updateConsole (
263200 data . blockId ,
@@ -353,11 +290,7 @@ export function createBlockEventHandlers(
353290
354291 accumulatedBlockLogs . push ( createBlockLogEntry ( data , { success : true , output : data . output } ) )
355292
356- if ( consoleMode === 'update' ) {
357- updateConsoleEntry ( data )
358- } else {
359- addConsoleEntry ( data , data . output as NormalizedBlockOutput )
360- }
293+ updateConsoleEntry ( data )
361294
362295 if ( onBlockCompleteCallback ) {
363296 onBlockCompleteCallback ( data . blockId , data . output ) . catch ( ( error ) => {
@@ -391,11 +324,7 @@ export function createBlockEventHandlers(
391324 createBlockLogEntry ( data , { success : false , output : { } , error : data . error } )
392325 )
393326
394- if ( consoleMode === 'update' ) {
395- updateConsoleErrorEntry ( data )
396- } else {
397- addConsoleErrorEntry ( data )
398- }
327+ updateConsoleErrorEntry ( data )
399328 }
400329
401330 const onBlockChildWorkflowStarted = ( data : {
@@ -714,7 +643,6 @@ export async function executeWorkflowWithFullLogging(
714643 accumulatedBlockLogs,
715644 accumulatedBlockStates : new Map ( ) ,
716645 executedBlockIds : new Set ( ) ,
717- consoleMode : 'update' ,
718646 includeStartConsoleEntry : true ,
719647 onBlockCompleteCallback : options . onBlockComplete ,
720648 } ,
0 commit comments