@@ -19,6 +19,7 @@ import { googleSheetUpdateTasks, processGoogleSheetUpdates } from './workflow-ma
1919import { airtableUpdateTasks , processAirtableUpdates } from './workflow-management/integrations/airtable' ;
2020import { io as serverIo } from "./server" ;
2121import { sendWebhook } from './routes/webhook' ;
22+ import { BinaryOutputService } from './storage/mino' ;
2223
2324if ( ! process . env . DB_USER || ! process . env . DB_PASSWORD || ! process . env . DB_HOST || ! process . env . DB_PORT || ! process . env . DB_NAME ) {
2425 throw new Error ( 'Failed to start pgboss worker: one or more required environment variables are missing.' ) ;
@@ -242,11 +243,22 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
242243 log : interpretationInfo . log . join ( '\n' )
243244 } ) ;
244245
246+ // Upload binary output to MinIO and update run with MinIO URLs
247+ const updatedRun = await Run . findOne ( { where : { runId : data . runId } } ) ;
248+ if ( updatedRun && updatedRun . binaryOutput && Object . keys ( updatedRun . binaryOutput ) . length > 0 ) {
249+ try {
250+ const binaryService = new BinaryOutputService ( 'maxun-run-screenshots' ) ;
251+ await binaryService . uploadAndStoreBinaryOutput ( updatedRun , updatedRun . binaryOutput ) ;
252+ logger . log ( 'info' , `Uploaded binary output to MinIO for run ${ data . runId } ` ) ;
253+ } catch ( minioError : any ) {
254+ logger . log ( 'error' , `Failed to upload binary output to MinIO for run ${ data . runId } : ${ minioError . message } ` ) ;
255+ }
256+ }
257+
245258 let totalSchemaItemsExtracted = 0 ;
246259 let totalListItemsExtracted = 0 ;
247260 let extractedScreenshotsCount = 0 ;
248261
249- const updatedRun = await Run . findOne ( { where : { runId : data . runId } } ) ;
250262 if ( updatedRun ) {
251263 if ( updatedRun . serializableOutput ) {
252264 if ( updatedRun . serializableOutput . scrapeSchema ) {
0 commit comments