@@ -15,6 +15,8 @@ import {
1515 WorkerApiRunHeartbeatResponseBody ,
1616 WorkerApiRunLatestSnapshotResponseBody ,
1717 WorkerApiDebugLogBody ,
18+ WorkerApiSuspendRunRequestBody ,
19+ WorkerApiSuspendRunResponseBody ,
1820} from "./schemas.js" ;
1921import { SupervisorClientCommonOptions } from "./types.js" ;
2022import { getDefaultWorkerHeaders } from "./util.js" ;
@@ -220,14 +222,30 @@ export class SupervisorHttpClient {
220222 ) ;
221223 }
222224
223- getSuspendCompletionUrl ( runId : string , snapshotId : string , runnerId ?: string ) {
224- return {
225- url : `${ this . apiUrl } /engine/v1/worker-actions/runs/${ runId } /snapshots/${ snapshotId } /suspend` ,
226- headers : {
227- ...this . defaultHeaders ,
228- ...this . runnerIdHeader ( runnerId ) ,
229- } ,
230- } ;
225+ async submitSuspendCompletion ( {
226+ runId,
227+ snapshotId,
228+ runnerId,
229+ body,
230+ } : {
231+ runId : string ;
232+ snapshotId : string ;
233+ runnerId ?: string ;
234+ body : WorkerApiSuspendRunRequestBody ;
235+ } ) {
236+ return wrapZodFetch (
237+ WorkerApiSuspendRunResponseBody ,
238+ `${ this . apiUrl } /engine/v1/worker-actions/runs/${ runId } /snapshots/${ snapshotId } /suspend` ,
239+ {
240+ method : "POST" ,
241+ headers : {
242+ ...this . defaultHeaders ,
243+ ...this . runnerIdHeader ( runnerId ) ,
244+ "Content-Type" : "application/json" ,
245+ } ,
246+ body : JSON . stringify ( body ) ,
247+ }
248+ ) ;
231249 }
232250
233251 private runnerIdHeader ( runnerId ?: string ) : Record < string , string > {
0 commit comments