22
33import { APIResource } from '../../resource' ;
44import { isRequestOptions } from '../../core' ;
5+ import { APIPromise } from '../../core' ;
56import * as Core from '../../core' ;
67import * as Shared from '../shared' ;
78import * as DiskSnapshotsAPI from './disk-snapshots' ;
@@ -32,6 +33,7 @@ import {
3233 DiskSnapshotsCursorIDPage ,
3334 type DiskSnapshotsCursorIDPageParams ,
3435} from '../../pagination' ;
36+ import { Stream } from '../../streaming' ;
3537import { type Response } from '../../_shims/index' ;
3638import {
3739 longPollUntil ,
@@ -545,8 +547,10 @@ export class Devboxes extends APIResource {
545547 * scheduled. Best-effort and advisory: a Devbox stays running until its deadline,
546548 * and delivery is not guaranteed.
547549 */
548- watchEvictions ( options ?: Core . RequestOptions ) : Core . APIPromise < DevboxWatchEvictionsResponse > {
549- return this . _client . get ( '/v1/devboxes/watch_evictions' , options ) ;
550+ watchEvictions ( options ?: Core . RequestOptions ) : APIPromise < Stream < DevboxEvictionEventView > > {
551+ return this . _client . get ( '/v1/devboxes/watch_evictions' , { ...options , stream : true } ) as APIPromise <
552+ Stream < DevboxEvictionEventView >
553+ > ;
550554 }
551555
552556 /**
@@ -630,6 +634,19 @@ export interface DevboxAsyncExecutionDetailView {
630634 stdout_truncated ?: boolean | null ;
631635}
632636
637+ export interface DevboxEvictionEventView {
638+ /**
639+ * The ID of the Devbox with a pending eviction.
640+ */
641+ devbox_id : string ;
642+
643+ /**
644+ * Unix timestamp (milliseconds) after which the Devbox will be suspended. Advisory
645+ * and best-effort.
646+ */
647+ eviction_deadline_ms : number ;
648+ }
649+
633650export interface DevboxExecutionDetailView {
634651 /**
635652 * Devbox id where command was executed.
@@ -1105,19 +1122,6 @@ export type DevboxRemoveTunnelResponse = unknown;
11051122
11061123export type DevboxUploadFileResponse = unknown ;
11071124
1108- export interface DevboxWatchEvictionsResponse {
1109- /**
1110- * The ID of the Devbox with a pending eviction.
1111- */
1112- devbox_id : string ;
1113-
1114- /**
1115- * Unix timestamp (milliseconds) after which the Devbox will be suspended. Advisory
1116- * and best-effort.
1117- */
1118- eviction_deadline_ms : number ;
1119- }
1120-
11211125/**
11221126 * Parameters for creating a new Devbox.
11231127 *
@@ -1563,6 +1567,7 @@ Devboxes.Executions = Executions;
15631567export declare namespace Devboxes {
15641568 export {
15651569 type DevboxAsyncExecutionDetailView as DevboxAsyncExecutionDetailView ,
1570+ type DevboxEvictionEventView as DevboxEvictionEventView ,
15661571 type DevboxExecutionDetailView as DevboxExecutionDetailView ,
15671572 type DevboxKillExecutionRequest as DevboxKillExecutionRequest ,
15681573 type DevboxListView as DevboxListView ,
@@ -1580,7 +1585,6 @@ export declare namespace Devboxes {
15801585 type DevboxReadFileContentsResponse as DevboxReadFileContentsResponse ,
15811586 type DevboxRemoveTunnelResponse as DevboxRemoveTunnelResponse ,
15821587 type DevboxUploadFileResponse as DevboxUploadFileResponse ,
1583- type DevboxWatchEvictionsResponse as DevboxWatchEvictionsResponse ,
15841588 DevboxViewsDevboxesCursorIDPage as DevboxViewsDevboxesCursorIDPage ,
15851589 DevboxSnapshotViewsDiskSnapshotsCursorIDPage as DevboxSnapshotViewsDiskSnapshotsCursorIDPage ,
15861590 type DevboxCreateParams as DevboxCreateParams ,
0 commit comments