@@ -16,7 +16,6 @@ import {
16
16
type WorkloadRunAttemptCompleteResponseBody ,
17
17
WorkloadRunAttemptStartRequestBody ,
18
18
type WorkloadRunAttemptStartResponseBody ,
19
- type WorkloadRunLatestSnapshotResponseBody ,
20
19
WorkloadRunSnapshotsSinceResponseBody ,
21
20
type WorkloadServerToClientEvents ,
22
21
type WorkloadSuspendRunResponseBody ,
@@ -126,7 +125,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
126
125
}
127
126
128
127
private createHttpServer ( { host, port } : { host : string ; port : number } ) {
129
- return new HttpServer ( {
128
+ const httpServer = new HttpServer ( {
130
129
port,
131
130
host,
132
131
metrics : {
@@ -322,28 +321,6 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
322
321
} ,
323
322
}
324
323
)
325
- . route ( "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/latest" , "GET" , {
326
- paramsSchema : WorkloadActionParams . pick ( { runFriendlyId : true } ) ,
327
- handler : async ( { req, reply, params } ) => {
328
- const latestSnapshotResponse = await this . workerClient . getLatestSnapshot (
329
- params . runFriendlyId ,
330
- this . runnerIdFromRequest ( req )
331
- ) ;
332
-
333
- if ( ! latestSnapshotResponse . success ) {
334
- this . logger . error ( "Failed to get latest snapshot" , {
335
- runId : params . runFriendlyId ,
336
- error : latestSnapshotResponse . error ,
337
- } ) ;
338
- reply . empty ( 500 ) ;
339
- return ;
340
- }
341
-
342
- reply . json ( {
343
- execution : latestSnapshotResponse . data . execution ,
344
- } satisfies WorkloadRunLatestSnapshotResponseBody ) ;
345
- } ,
346
- } )
347
324
. route (
348
325
"/api/v1/workload-actions/runs/:runFriendlyId/snapshots/since/:snapshotFriendlyId" ,
349
326
"GET" ,
@@ -369,23 +346,6 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
369
346
} ,
370
347
}
371
348
)
372
- . route ( "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" , "POST" , {
373
- paramsSchema : WorkloadActionParams . pick ( { runFriendlyId : true } ) ,
374
- bodySchema : WorkloadDebugLogRequestBody ,
375
- handler : async ( { req, reply, params, body } ) => {
376
- reply . empty ( 204 ) ;
377
-
378
- if ( ! env . SEND_RUN_DEBUG_LOGS ) {
379
- return ;
380
- }
381
-
382
- await this . workerClient . sendDebugLog (
383
- params . runFriendlyId ,
384
- body ,
385
- this . runnerIdFromRequest ( req )
386
- ) ;
387
- } ,
388
- } )
389
349
. route ( "/api/v1/workload-actions/deployments/:deploymentId/dequeue" , "GET" , {
390
350
paramsSchema : z . object ( {
391
351
deploymentId : z . string ( ) ,
@@ -410,6 +370,31 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
410
370
reply . json ( dequeueResponse . data satisfies WorkloadDequeueFromVersionResponseBody ) ;
411
371
} ,
412
372
} ) ;
373
+
374
+ if ( env . SEND_RUN_DEBUG_LOGS ) {
375
+ httpServer . route ( "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" , "POST" , {
376
+ paramsSchema : WorkloadActionParams . pick ( { runFriendlyId : true } ) ,
377
+ bodySchema : WorkloadDebugLogRequestBody ,
378
+ handler : async ( { req, reply, params, body } ) => {
379
+ reply . empty ( 204 ) ;
380
+
381
+ await this . workerClient . sendDebugLog (
382
+ params . runFriendlyId ,
383
+ body ,
384
+ this . runnerIdFromRequest ( req )
385
+ ) ;
386
+ } ,
387
+ } ) ;
388
+ } else {
389
+ // Lightweight mock route without schemas
390
+ httpServer . route ( "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" , "POST" , {
391
+ handler : async ( { reply } ) => {
392
+ reply . empty ( 204 ) ;
393
+ } ,
394
+ } ) ;
395
+ }
396
+
397
+ return httpServer ;
413
398
}
414
399
415
400
private createWebsocketServer ( ) {
0 commit comments