@@ -66,21 +66,25 @@ export class PreprocessAgent {
6666 const validatedRecording = TeachModeRecordingSchema . parse ( recording ) ;
6767 Logging . log ( "PreprocessAgent" , `Processing recording with ${ validatedRecording . events . length } events` , "info" ) ;
6868
69+ // Filter out session events for processing count
70+ const eventsToProcess = validatedRecording . events . filter (
71+ e => e . action . type !== 'session_start' && e . action . type !== 'session_end'
72+ ) ;
73+
6974 // Emit preprocessing started
7075 this . _emitProgress ( 'preprocessing_started' , {
71- totalEvents : validatedRecording . events . filter (
72- e => e . action . type !== 'session_start' && e . action . type !== 'session_end'
73- ) . length
76+ totalEvents : eventsToProcess . length
7477 } ) ;
7578
7679 // Transcribe audio if present and narration not already set
7780 let transcript = validatedRecording . narration ?. transcript || "" ;
7881 if ( ! transcript && validatedRecording . audio ) {
7982 Logging . log ( "PreprocessAgent" , "Transcribing audio recording..." , "info" ) ;
8083
81- // Emit progress for transcription stage
8284 this . _emitProgress ( 'preprocessing_progress' , {
8385 stage : 'transcription' ,
86+ current : 0 ,
87+ total : eventsToProcess . length ,
8488 message : 'Transcribing audio narration...'
8589 } ) ;
8690
@@ -91,17 +95,19 @@ export class PreprocessAgent {
9195 // Emit debug info for transcript
9296 this . _emitDebug ( 'Transcript extracted' , transcript ) ;
9397
94- // Emit progress with transcription complete
9598 this . _emitProgress ( 'preprocessing_progress' , {
9699 stage : 'transcription' ,
100+ current : 0 ,
101+ total : eventsToProcess . length ,
97102 message : 'Transcription completed' ,
98103 transcript
99104 } ) ;
100105 } catch ( error ) {
101106 Logging . log ( "PreprocessAgent" , `Transcription failed: ${ error } ` , "warning" ) ;
102- // Continue without transcript - no special error event needed
103107 this . _emitProgress ( 'preprocessing_progress' , {
104108 stage : 'transcription' ,
109+ current : 0 ,
110+ total : eventsToProcess . length ,
105111 message : 'Continuing without transcription' ,
106112 error : String ( error )
107113 } ) ;
@@ -118,11 +124,6 @@ export class PreprocessAgent {
118124 const steps : SemanticWorkflow [ 'steps' ] = [ ] ;
119125 let previousState : StateSnapshot | undefined ;
120126
121- // Filter out session events for processing count
122- const eventsToProcess = validatedRecording . events . filter (
123- e => e . action . type !== 'session_start' && e . action . type !== 'session_end'
124- ) ;
125-
126127 let processedCount = 0 ;
127128 for ( let i = 0 ; i < validatedRecording . events . length ; i ++ ) {
128129 const event = validatedRecording . events [ i ] ;
0 commit comments