@@ -19,6 +19,7 @@ import { googleSheetUpdateTasks, processGoogleSheetUpdates } from './workflow-ma
19
19
import { airtableUpdateTasks , processAirtableUpdates } from './workflow-management/integrations/airtable' ;
20
20
import { io as serverIo } from "./server" ;
21
21
import { sendWebhook } from './routes/webhook' ;
22
+ import { BinaryOutputService } from './storage/mino' ;
22
23
23
24
if ( ! process . env . DB_USER || ! process . env . DB_PASSWORD || ! process . env . DB_HOST || ! process . env . DB_PORT || ! process . env . DB_NAME ) {
24
25
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>) {
242
243
log : interpretationInfo . log . join ( '\n' )
243
244
} ) ;
244
245
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
+
245
258
let totalSchemaItemsExtracted = 0 ;
246
259
let totalListItemsExtracted = 0 ;
247
260
let extractedScreenshotsCount = 0 ;
248
261
249
- const updatedRun = await Run . findOne ( { where : { runId : data . runId } } ) ;
250
262
if ( updatedRun ) {
251
263
if ( updatedRun . serializableOutput ) {
252
264
if ( updatedRun . serializableOutput . scrapeSchema ) {
0 commit comments