@cloudflare/workers-types 4.20250124.3 → 4.20250129.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -538,6 +538,7 @@ interface DurableObjectState {
538
538
  waitUntil(promise: Promise<any>): void;
539
539
  readonly id: DurableObjectId;
540
540
  readonly storage: DurableObjectStorage;
541
+ container?: Container;
541
542
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
542
543
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
543
544
  getWebSockets(tag?: string): WebSocket[];
@@ -3401,6 +3402,18 @@ interface EventSourceEventSourceInit {
3401
3402
  withCredentials?: boolean;
3402
3403
  fetcher?: Fetcher;
3403
3404
  }
3405
+ interface Container {
3406
+ get running(): boolean;
3407
+ start(options?: ContainerStartupOptions): void;
3408
+ monitor(): Promise<void>;
3409
+ destroy(error?: any): Promise<void>;
3410
+ signal(signo: number): void;
3411
+ getTcpPort(port: number): Fetcher;
3412
+ }
3413
+ interface ContainerStartupOptions {
3414
+ entrypoint?: string[];
3415
+ enableInternet: boolean;
3416
+ }
3404
3417
  type AiImageClassificationInput = {
3405
3418
  image: number[];
3406
3419
  };
@@ -4097,6 +4110,7 @@ interface AiModels {
4097
4110
  }
4098
4111
  type AiOptions = {
4099
4112
  gateway?: GatewayOptions;
4113
+ returnRawResponse?: boolean;
4100
4114
  prefix?: string;
4101
4115
  extraHeaders?: object;
4102
4116
  };
@@ -4131,11 +4145,17 @@ type AiModelListType = Record<string, any>;
4131
4145
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4132
4146
  aiGatewayLogId: string | null;
4133
4147
  gateway(gatewayId: string): AiGateway;
4134
- run<Name extends keyof AiModelList>(
4148
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4135
4149
  model: Name,
4136
4150
  inputs: AiModelList[Name]["inputs"],
4137
- options?: AiOptions,
4138
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4151
+ options?: Options,
4152
+ ): Promise<
4153
+ Options extends {
4154
+ returnRawResponse: true;
4155
+ }
4156
+ ? Response
4157
+ : AiModelList[Name]["postProcessedOutputs"]
4158
+ >;
4139
4159
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4140
4160
  }
4141
4161
  type GatewayOptions = {
@@ -543,6 +543,7 @@ export interface DurableObjectState {
543
543
  waitUntil(promise: Promise<any>): void;
544
544
  readonly id: DurableObjectId;
545
545
  readonly storage: DurableObjectStorage;
546
+ container?: Container;
546
547
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
547
548
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
548
549
  getWebSockets(tag?: string): WebSocket[];
@@ -3413,6 +3414,18 @@ export interface EventSourceEventSourceInit {
3413
3414
  withCredentials?: boolean;
3414
3415
  fetcher?: Fetcher;
3415
3416
  }
3417
+ export interface Container {
3418
+ get running(): boolean;
3419
+ start(options?: ContainerStartupOptions): void;
3420
+ monitor(): Promise<void>;
3421
+ destroy(error?: any): Promise<void>;
3422
+ signal(signo: number): void;
3423
+ getTcpPort(port: number): Fetcher;
3424
+ }
3425
+ export interface ContainerStartupOptions {
3426
+ entrypoint?: string[];
3427
+ enableInternet: boolean;
3428
+ }
3416
3429
  export type AiImageClassificationInput = {
3417
3430
  image: number[];
3418
3431
  };
@@ -4109,6 +4122,7 @@ export interface AiModels {
4109
4122
  }
4110
4123
  export type AiOptions = {
4111
4124
  gateway?: GatewayOptions;
4125
+ returnRawResponse?: boolean;
4112
4126
  prefix?: string;
4113
4127
  extraHeaders?: object;
4114
4128
  };
@@ -4145,11 +4159,17 @@ export declare abstract class Ai<
4145
4159
  > {
4146
4160
  aiGatewayLogId: string | null;
4147
4161
  gateway(gatewayId: string): AiGateway;
4148
- run<Name extends keyof AiModelList>(
4162
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4149
4163
  model: Name,
4150
4164
  inputs: AiModelList[Name]["inputs"],
4151
- options?: AiOptions,
4152
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4165
+ options?: Options,
4166
+ ): Promise<
4167
+ Options extends {
4168
+ returnRawResponse: true;
4169
+ }
4170
+ ? Response
4171
+ : AiModelList[Name]["postProcessedOutputs"]
4172
+ >;
4153
4173
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4154
4174
  }
4155
4175
  export type GatewayOptions = {
@@ -538,6 +538,7 @@ interface DurableObjectState {
538
538
  waitUntil(promise: Promise<any>): void;
539
539
  readonly id: DurableObjectId;
540
540
  readonly storage: DurableObjectStorage;
541
+ container?: Container;
541
542
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
542
543
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
543
544
  getWebSockets(tag?: string): WebSocket[];
@@ -3427,6 +3428,18 @@ interface EventSourceEventSourceInit {
3427
3428
  withCredentials?: boolean;
3428
3429
  fetcher?: Fetcher;
3429
3430
  }
3431
+ interface Container {
3432
+ get running(): boolean;
3433
+ start(options?: ContainerStartupOptions): void;
3434
+ monitor(): Promise<void>;
3435
+ destroy(error?: any): Promise<void>;
3436
+ signal(signo: number): void;
3437
+ getTcpPort(port: number): Fetcher;
3438
+ }
3439
+ interface ContainerStartupOptions {
3440
+ entrypoint?: string[];
3441
+ enableInternet: boolean;
3442
+ }
3430
3443
  type AiImageClassificationInput = {
3431
3444
  image: number[];
3432
3445
  };
@@ -4123,6 +4136,7 @@ interface AiModels {
4123
4136
  }
4124
4137
  type AiOptions = {
4125
4138
  gateway?: GatewayOptions;
4139
+ returnRawResponse?: boolean;
4126
4140
  prefix?: string;
4127
4141
  extraHeaders?: object;
4128
4142
  };
@@ -4157,11 +4171,17 @@ type AiModelListType = Record<string, any>;
4157
4171
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4158
4172
  aiGatewayLogId: string | null;
4159
4173
  gateway(gatewayId: string): AiGateway;
4160
- run<Name extends keyof AiModelList>(
4174
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4161
4175
  model: Name,
4162
4176
  inputs: AiModelList[Name]["inputs"],
4163
- options?: AiOptions,
4164
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4177
+ options?: Options,
4178
+ ): Promise<
4179
+ Options extends {
4180
+ returnRawResponse: true;
4181
+ }
4182
+ ? Response
4183
+ : AiModelList[Name]["postProcessedOutputs"]
4184
+ >;
4165
4185
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4166
4186
  }
4167
4187
  type GatewayOptions = {
@@ -543,6 +543,7 @@ export interface DurableObjectState {
543
543
  waitUntil(promise: Promise<any>): void;
544
544
  readonly id: DurableObjectId;
545
545
  readonly storage: DurableObjectStorage;
546
+ container?: Container;
546
547
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
547
548
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
548
549
  getWebSockets(tag?: string): WebSocket[];
@@ -3439,6 +3440,18 @@ export interface EventSourceEventSourceInit {
3439
3440
  withCredentials?: boolean;
3440
3441
  fetcher?: Fetcher;
3441
3442
  }
3443
+ export interface Container {
3444
+ get running(): boolean;
3445
+ start(options?: ContainerStartupOptions): void;
3446
+ monitor(): Promise<void>;
3447
+ destroy(error?: any): Promise<void>;
3448
+ signal(signo: number): void;
3449
+ getTcpPort(port: number): Fetcher;
3450
+ }
3451
+ export interface ContainerStartupOptions {
3452
+ entrypoint?: string[];
3453
+ enableInternet: boolean;
3454
+ }
3442
3455
  export type AiImageClassificationInput = {
3443
3456
  image: number[];
3444
3457
  };
@@ -4135,6 +4148,7 @@ export interface AiModels {
4135
4148
  }
4136
4149
  export type AiOptions = {
4137
4150
  gateway?: GatewayOptions;
4151
+ returnRawResponse?: boolean;
4138
4152
  prefix?: string;
4139
4153
  extraHeaders?: object;
4140
4154
  };
@@ -4171,11 +4185,17 @@ export declare abstract class Ai<
4171
4185
  > {
4172
4186
  aiGatewayLogId: string | null;
4173
4187
  gateway(gatewayId: string): AiGateway;
4174
- run<Name extends keyof AiModelList>(
4188
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4175
4189
  model: Name,
4176
4190
  inputs: AiModelList[Name]["inputs"],
4177
- options?: AiOptions,
4178
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4191
+ options?: Options,
4192
+ ): Promise<
4193
+ Options extends {
4194
+ returnRawResponse: true;
4195
+ }
4196
+ ? Response
4197
+ : AiModelList[Name]["postProcessedOutputs"]
4198
+ >;
4179
4199
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4180
4200
  }
4181
4201
  export type GatewayOptions = {
@@ -556,6 +556,7 @@ interface DurableObjectState {
556
556
  waitUntil(promise: Promise<any>): void;
557
557
  readonly id: DurableObjectId;
558
558
  readonly storage: DurableObjectStorage;
559
+ container?: Container;
559
560
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
560
561
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
561
562
  getWebSockets(tag?: string): WebSocket[];
@@ -3452,6 +3453,18 @@ interface EventSourceEventSourceInit {
3452
3453
  withCredentials?: boolean;
3453
3454
  fetcher?: Fetcher;
3454
3455
  }
3456
+ interface Container {
3457
+ get running(): boolean;
3458
+ start(options?: ContainerStartupOptions): void;
3459
+ monitor(): Promise<void>;
3460
+ destroy(error?: any): Promise<void>;
3461
+ signal(signo: number): void;
3462
+ getTcpPort(port: number): Fetcher;
3463
+ }
3464
+ interface ContainerStartupOptions {
3465
+ entrypoint?: string[];
3466
+ enableInternet: boolean;
3467
+ }
3455
3468
  type AiImageClassificationInput = {
3456
3469
  image: number[];
3457
3470
  };
@@ -4148,6 +4161,7 @@ interface AiModels {
4148
4161
  }
4149
4162
  type AiOptions = {
4150
4163
  gateway?: GatewayOptions;
4164
+ returnRawResponse?: boolean;
4151
4165
  prefix?: string;
4152
4166
  extraHeaders?: object;
4153
4167
  };
@@ -4182,11 +4196,17 @@ type AiModelListType = Record<string, any>;
4182
4196
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4183
4197
  aiGatewayLogId: string | null;
4184
4198
  gateway(gatewayId: string): AiGateway;
4185
- run<Name extends keyof AiModelList>(
4199
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4186
4200
  model: Name,
4187
4201
  inputs: AiModelList[Name]["inputs"],
4188
- options?: AiOptions,
4189
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4202
+ options?: Options,
4203
+ ): Promise<
4204
+ Options extends {
4205
+ returnRawResponse: true;
4206
+ }
4207
+ ? Response
4208
+ : AiModelList[Name]["postProcessedOutputs"]
4209
+ >;
4190
4210
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4191
4211
  }
4192
4212
  type GatewayOptions = {
@@ -561,6 +561,7 @@ export interface DurableObjectState {
561
561
  waitUntil(promise: Promise<any>): void;
562
562
  readonly id: DurableObjectId;
563
563
  readonly storage: DurableObjectStorage;
564
+ container?: Container;
564
565
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
565
566
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
566
567
  getWebSockets(tag?: string): WebSocket[];
@@ -3464,6 +3465,18 @@ export interface EventSourceEventSourceInit {
3464
3465
  withCredentials?: boolean;
3465
3466
  fetcher?: Fetcher;
3466
3467
  }
3468
+ export interface Container {
3469
+ get running(): boolean;
3470
+ start(options?: ContainerStartupOptions): void;
3471
+ monitor(): Promise<void>;
3472
+ destroy(error?: any): Promise<void>;
3473
+ signal(signo: number): void;
3474
+ getTcpPort(port: number): Fetcher;
3475
+ }
3476
+ export interface ContainerStartupOptions {
3477
+ entrypoint?: string[];
3478
+ enableInternet: boolean;
3479
+ }
3467
3480
  export type AiImageClassificationInput = {
3468
3481
  image: number[];
3469
3482
  };
@@ -4160,6 +4173,7 @@ export interface AiModels {
4160
4173
  }
4161
4174
  export type AiOptions = {
4162
4175
  gateway?: GatewayOptions;
4176
+ returnRawResponse?: boolean;
4163
4177
  prefix?: string;
4164
4178
  extraHeaders?: object;
4165
4179
  };
@@ -4196,11 +4210,17 @@ export declare abstract class Ai<
4196
4210
  > {
4197
4211
  aiGatewayLogId: string | null;
4198
4212
  gateway(gatewayId: string): AiGateway;
4199
- run<Name extends keyof AiModelList>(
4213
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4200
4214
  model: Name,
4201
4215
  inputs: AiModelList[Name]["inputs"],
4202
- options?: AiOptions,
4203
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4216
+ options?: Options,
4217
+ ): Promise<
4218
+ Options extends {
4219
+ returnRawResponse: true;
4220
+ }
4221
+ ? Response
4222
+ : AiModelList[Name]["postProcessedOutputs"]
4223
+ >;
4204
4224
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4205
4225
  }
4206
4226
  export type GatewayOptions = {
@@ -556,6 +556,7 @@ interface DurableObjectState {
556
556
  waitUntil(promise: Promise<any>): void;
557
557
  readonly id: DurableObjectId;
558
558
  readonly storage: DurableObjectStorage;
559
+ container?: Container;
559
560
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
560
561
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
561
562
  getWebSockets(tag?: string): WebSocket[];
@@ -3453,6 +3454,18 @@ interface EventSourceEventSourceInit {
3453
3454
  withCredentials?: boolean;
3454
3455
  fetcher?: Fetcher;
3455
3456
  }
3457
+ interface Container {
3458
+ get running(): boolean;
3459
+ start(options?: ContainerStartupOptions): void;
3460
+ monitor(): Promise<void>;
3461
+ destroy(error?: any): Promise<void>;
3462
+ signal(signo: number): void;
3463
+ getTcpPort(port: number): Fetcher;
3464
+ }
3465
+ interface ContainerStartupOptions {
3466
+ entrypoint?: string[];
3467
+ enableInternet: boolean;
3468
+ }
3456
3469
  type AiImageClassificationInput = {
3457
3470
  image: number[];
3458
3471
  };
@@ -4149,6 +4162,7 @@ interface AiModels {
4149
4162
  }
4150
4163
  type AiOptions = {
4151
4164
  gateway?: GatewayOptions;
4165
+ returnRawResponse?: boolean;
4152
4166
  prefix?: string;
4153
4167
  extraHeaders?: object;
4154
4168
  };
@@ -4183,11 +4197,17 @@ type AiModelListType = Record<string, any>;
4183
4197
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4184
4198
  aiGatewayLogId: string | null;
4185
4199
  gateway(gatewayId: string): AiGateway;
4186
- run<Name extends keyof AiModelList>(
4200
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4187
4201
  model: Name,
4188
4202
  inputs: AiModelList[Name]["inputs"],
4189
- options?: AiOptions,
4190
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4203
+ options?: Options,
4204
+ ): Promise<
4205
+ Options extends {
4206
+ returnRawResponse: true;
4207
+ }
4208
+ ? Response
4209
+ : AiModelList[Name]["postProcessedOutputs"]
4210
+ >;
4191
4211
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4192
4212
  }
4193
4213
  type GatewayOptions = {
@@ -561,6 +561,7 @@ export interface DurableObjectState {
561
561
  waitUntil(promise: Promise<any>): void;
562
562
  readonly id: DurableObjectId;
563
563
  readonly storage: DurableObjectStorage;
564
+ container?: Container;
564
565
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
565
566
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
566
567
  getWebSockets(tag?: string): WebSocket[];
@@ -3465,6 +3466,18 @@ export interface EventSourceEventSourceInit {
3465
3466
  withCredentials?: boolean;
3466
3467
  fetcher?: Fetcher;
3467
3468
  }
3469
+ export interface Container {
3470
+ get running(): boolean;
3471
+ start(options?: ContainerStartupOptions): void;
3472
+ monitor(): Promise<void>;
3473
+ destroy(error?: any): Promise<void>;
3474
+ signal(signo: number): void;
3475
+ getTcpPort(port: number): Fetcher;
3476
+ }
3477
+ export interface ContainerStartupOptions {
3478
+ entrypoint?: string[];
3479
+ enableInternet: boolean;
3480
+ }
3468
3481
  export type AiImageClassificationInput = {
3469
3482
  image: number[];
3470
3483
  };
@@ -4161,6 +4174,7 @@ export interface AiModels {
4161
4174
  }
4162
4175
  export type AiOptions = {
4163
4176
  gateway?: GatewayOptions;
4177
+ returnRawResponse?: boolean;
4164
4178
  prefix?: string;
4165
4179
  extraHeaders?: object;
4166
4180
  };
@@ -4197,11 +4211,17 @@ export declare abstract class Ai<
4197
4211
  > {
4198
4212
  aiGatewayLogId: string | null;
4199
4213
  gateway(gatewayId: string): AiGateway;
4200
- run<Name extends keyof AiModelList>(
4214
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4201
4215
  model: Name,
4202
4216
  inputs: AiModelList[Name]["inputs"],
4203
- options?: AiOptions,
4204
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4217
+ options?: Options,
4218
+ ): Promise<
4219
+ Options extends {
4220
+ returnRawResponse: true;
4221
+ }
4222
+ ? Response
4223
+ : AiModelList[Name]["postProcessedOutputs"]
4224
+ >;
4205
4225
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4206
4226
  }
4207
4227
  export type GatewayOptions = {
@@ -556,6 +556,7 @@ interface DurableObjectState {
556
556
  waitUntil(promise: Promise<any>): void;
557
557
  readonly id: DurableObjectId;
558
558
  readonly storage: DurableObjectStorage;
559
+ container?: Container;
559
560
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
560
561
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
561
562
  getWebSockets(tag?: string): WebSocket[];
@@ -3456,6 +3457,18 @@ interface EventSourceEventSourceInit {
3456
3457
  withCredentials?: boolean;
3457
3458
  fetcher?: Fetcher;
3458
3459
  }
3460
+ interface Container {
3461
+ get running(): boolean;
3462
+ start(options?: ContainerStartupOptions): void;
3463
+ monitor(): Promise<void>;
3464
+ destroy(error?: any): Promise<void>;
3465
+ signal(signo: number): void;
3466
+ getTcpPort(port: number): Fetcher;
3467
+ }
3468
+ interface ContainerStartupOptions {
3469
+ entrypoint?: string[];
3470
+ enableInternet: boolean;
3471
+ }
3459
3472
  type AiImageClassificationInput = {
3460
3473
  image: number[];
3461
3474
  };
@@ -4152,6 +4165,7 @@ interface AiModels {
4152
4165
  }
4153
4166
  type AiOptions = {
4154
4167
  gateway?: GatewayOptions;
4168
+ returnRawResponse?: boolean;
4155
4169
  prefix?: string;
4156
4170
  extraHeaders?: object;
4157
4171
  };
@@ -4186,11 +4200,17 @@ type AiModelListType = Record<string, any>;
4186
4200
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4187
4201
  aiGatewayLogId: string | null;
4188
4202
  gateway(gatewayId: string): AiGateway;
4189
- run<Name extends keyof AiModelList>(
4203
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4190
4204
  model: Name,
4191
4205
  inputs: AiModelList[Name]["inputs"],
4192
- options?: AiOptions,
4193
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4206
+ options?: Options,
4207
+ ): Promise<
4208
+ Options extends {
4209
+ returnRawResponse: true;
4210
+ }
4211
+ ? Response
4212
+ : AiModelList[Name]["postProcessedOutputs"]
4213
+ >;
4194
4214
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4195
4215
  }
4196
4216
  type GatewayOptions = {
@@ -561,6 +561,7 @@ export interface DurableObjectState {
561
561
  waitUntil(promise: Promise<any>): void;
562
562
  readonly id: DurableObjectId;
563
563
  readonly storage: DurableObjectStorage;
564
+ container?: Container;
564
565
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
565
566
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
566
567
  getWebSockets(tag?: string): WebSocket[];
@@ -3468,6 +3469,18 @@ export interface EventSourceEventSourceInit {
3468
3469
  withCredentials?: boolean;
3469
3470
  fetcher?: Fetcher;
3470
3471
  }
3472
+ export interface Container {
3473
+ get running(): boolean;
3474
+ start(options?: ContainerStartupOptions): void;
3475
+ monitor(): Promise<void>;
3476
+ destroy(error?: any): Promise<void>;
3477
+ signal(signo: number): void;
3478
+ getTcpPort(port: number): Fetcher;
3479
+ }
3480
+ export interface ContainerStartupOptions {
3481
+ entrypoint?: string[];
3482
+ enableInternet: boolean;
3483
+ }
3471
3484
  export type AiImageClassificationInput = {
3472
3485
  image: number[];
3473
3486
  };
@@ -4164,6 +4177,7 @@ export interface AiModels {
4164
4177
  }
4165
4178
  export type AiOptions = {
4166
4179
  gateway?: GatewayOptions;
4180
+ returnRawResponse?: boolean;
4167
4181
  prefix?: string;
4168
4182
  extraHeaders?: object;
4169
4183
  };
@@ -4200,11 +4214,17 @@ export declare abstract class Ai<
4200
4214
  > {
4201
4215
  aiGatewayLogId: string | null;
4202
4216
  gateway(gatewayId: string): AiGateway;
4203
- run<Name extends keyof AiModelList>(
4217
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4204
4218
  model: Name,
4205
4219
  inputs: AiModelList[Name]["inputs"],
4206
- options?: AiOptions,
4207
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4220
+ options?: Options,
4221
+ ): Promise<
4222
+ Options extends {
4223
+ returnRawResponse: true;
4224
+ }
4225
+ ? Response
4226
+ : AiModelList[Name]["postProcessedOutputs"]
4227
+ >;
4208
4228
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4209
4229
  }
4210
4230
  export type GatewayOptions = {
@@ -561,6 +561,7 @@ interface DurableObjectState {
561
561
  waitUntil(promise: Promise<any>): void;
562
562
  readonly id: DurableObjectId;
563
563
  readonly storage: DurableObjectStorage;
564
+ container?: Container;
564
565
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
565
566
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
566
567
  getWebSockets(tag?: string): WebSocket[];
@@ -3461,6 +3462,18 @@ interface EventSourceEventSourceInit {
3461
3462
  withCredentials?: boolean;
3462
3463
  fetcher?: Fetcher;
3463
3464
  }
3465
+ interface Container {
3466
+ get running(): boolean;
3467
+ start(options?: ContainerStartupOptions): void;
3468
+ monitor(): Promise<void>;
3469
+ destroy(error?: any): Promise<void>;
3470
+ signal(signo: number): void;
3471
+ getTcpPort(port: number): Fetcher;
3472
+ }
3473
+ interface ContainerStartupOptions {
3474
+ entrypoint?: string[];
3475
+ enableInternet: boolean;
3476
+ }
3464
3477
  type AiImageClassificationInput = {
3465
3478
  image: number[];
3466
3479
  };
@@ -4157,6 +4170,7 @@ interface AiModels {
4157
4170
  }
4158
4171
  type AiOptions = {
4159
4172
  gateway?: GatewayOptions;
4173
+ returnRawResponse?: boolean;
4160
4174
  prefix?: string;
4161
4175
  extraHeaders?: object;
4162
4176
  };
@@ -4191,11 +4205,17 @@ type AiModelListType = Record<string, any>;
4191
4205
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4192
4206
  aiGatewayLogId: string | null;
4193
4207
  gateway(gatewayId: string): AiGateway;
4194
- run<Name extends keyof AiModelList>(
4208
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4195
4209
  model: Name,
4196
4210
  inputs: AiModelList[Name]["inputs"],
4197
- options?: AiOptions,
4198
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4211
+ options?: Options,
4212
+ ): Promise<
4213
+ Options extends {
4214
+ returnRawResponse: true;
4215
+ }
4216
+ ? Response
4217
+ : AiModelList[Name]["postProcessedOutputs"]
4218
+ >;
4199
4219
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4200
4220
  }
4201
4221
  type GatewayOptions = {
@@ -566,6 +566,7 @@ export interface DurableObjectState {
566
566
  waitUntil(promise: Promise<any>): void;
567
567
  readonly id: DurableObjectId;
568
568
  readonly storage: DurableObjectStorage;
569
+ container?: Container;
569
570
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
570
571
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
571
572
  getWebSockets(tag?: string): WebSocket[];
@@ -3473,6 +3474,18 @@ export interface EventSourceEventSourceInit {
3473
3474
  withCredentials?: boolean;
3474
3475
  fetcher?: Fetcher;
3475
3476
  }
3477
+ export interface Container {
3478
+ get running(): boolean;
3479
+ start(options?: ContainerStartupOptions): void;
3480
+ monitor(): Promise<void>;
3481
+ destroy(error?: any): Promise<void>;
3482
+ signal(signo: number): void;
3483
+ getTcpPort(port: number): Fetcher;
3484
+ }
3485
+ export interface ContainerStartupOptions {
3486
+ entrypoint?: string[];
3487
+ enableInternet: boolean;
3488
+ }
3476
3489
  export type AiImageClassificationInput = {
3477
3490
  image: number[];
3478
3491
  };
@@ -4169,6 +4182,7 @@ export interface AiModels {
4169
4182
  }
4170
4183
  export type AiOptions = {
4171
4184
  gateway?: GatewayOptions;
4185
+ returnRawResponse?: boolean;
4172
4186
  prefix?: string;
4173
4187
  extraHeaders?: object;
4174
4188
  };
@@ -4205,11 +4219,17 @@ export declare abstract class Ai<
4205
4219
  > {
4206
4220
  aiGatewayLogId: string | null;
4207
4221
  gateway(gatewayId: string): AiGateway;
4208
- run<Name extends keyof AiModelList>(
4222
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4209
4223
  model: Name,
4210
4224
  inputs: AiModelList[Name]["inputs"],
4211
- options?: AiOptions,
4212
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4225
+ options?: Options,
4226
+ ): Promise<
4227
+ Options extends {
4228
+ returnRawResponse: true;
4229
+ }
4230
+ ? Response
4231
+ : AiModelList[Name]["postProcessedOutputs"]
4232
+ >;
4213
4233
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4214
4234
  }
4215
4235
  export type GatewayOptions = {
@@ -561,6 +561,7 @@ interface DurableObjectState {
561
561
  waitUntil(promise: Promise<any>): void;
562
562
  readonly id: DurableObjectId;
563
563
  readonly storage: DurableObjectStorage;
564
+ container?: Container;
564
565
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
565
566
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
566
567
  getWebSockets(tag?: string): WebSocket[];
@@ -3463,6 +3464,18 @@ interface EventSourceEventSourceInit {
3463
3464
  withCredentials?: boolean;
3464
3465
  fetcher?: Fetcher;
3465
3466
  }
3467
+ interface Container {
3468
+ get running(): boolean;
3469
+ start(options?: ContainerStartupOptions): void;
3470
+ monitor(): Promise<void>;
3471
+ destroy(error?: any): Promise<void>;
3472
+ signal(signo: number): void;
3473
+ getTcpPort(port: number): Fetcher;
3474
+ }
3475
+ interface ContainerStartupOptions {
3476
+ entrypoint?: string[];
3477
+ enableInternet: boolean;
3478
+ }
3466
3479
  type AiImageClassificationInput = {
3467
3480
  image: number[];
3468
3481
  };
@@ -4159,6 +4172,7 @@ interface AiModels {
4159
4172
  }
4160
4173
  type AiOptions = {
4161
4174
  gateway?: GatewayOptions;
4175
+ returnRawResponse?: boolean;
4162
4176
  prefix?: string;
4163
4177
  extraHeaders?: object;
4164
4178
  };
@@ -4193,11 +4207,17 @@ type AiModelListType = Record<string, any>;
4193
4207
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4194
4208
  aiGatewayLogId: string | null;
4195
4209
  gateway(gatewayId: string): AiGateway;
4196
- run<Name extends keyof AiModelList>(
4210
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4197
4211
  model: Name,
4198
4212
  inputs: AiModelList[Name]["inputs"],
4199
- options?: AiOptions,
4200
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4213
+ options?: Options,
4214
+ ): Promise<
4215
+ Options extends {
4216
+ returnRawResponse: true;
4217
+ }
4218
+ ? Response
4219
+ : AiModelList[Name]["postProcessedOutputs"]
4220
+ >;
4201
4221
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4202
4222
  }
4203
4223
  type GatewayOptions = {
@@ -566,6 +566,7 @@ export interface DurableObjectState {
566
566
  waitUntil(promise: Promise<any>): void;
567
567
  readonly id: DurableObjectId;
568
568
  readonly storage: DurableObjectStorage;
569
+ container?: Container;
569
570
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
570
571
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
571
572
  getWebSockets(tag?: string): WebSocket[];
@@ -3475,6 +3476,18 @@ export interface EventSourceEventSourceInit {
3475
3476
  withCredentials?: boolean;
3476
3477
  fetcher?: Fetcher;
3477
3478
  }
3479
+ export interface Container {
3480
+ get running(): boolean;
3481
+ start(options?: ContainerStartupOptions): void;
3482
+ monitor(): Promise<void>;
3483
+ destroy(error?: any): Promise<void>;
3484
+ signal(signo: number): void;
3485
+ getTcpPort(port: number): Fetcher;
3486
+ }
3487
+ export interface ContainerStartupOptions {
3488
+ entrypoint?: string[];
3489
+ enableInternet: boolean;
3490
+ }
3478
3491
  export type AiImageClassificationInput = {
3479
3492
  image: number[];
3480
3493
  };
@@ -4171,6 +4184,7 @@ export interface AiModels {
4171
4184
  }
4172
4185
  export type AiOptions = {
4173
4186
  gateway?: GatewayOptions;
4187
+ returnRawResponse?: boolean;
4174
4188
  prefix?: string;
4175
4189
  extraHeaders?: object;
4176
4190
  };
@@ -4207,11 +4221,17 @@ export declare abstract class Ai<
4207
4221
  > {
4208
4222
  aiGatewayLogId: string | null;
4209
4223
  gateway(gatewayId: string): AiGateway;
4210
- run<Name extends keyof AiModelList>(
4224
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4211
4225
  model: Name,
4212
4226
  inputs: AiModelList[Name]["inputs"],
4213
- options?: AiOptions,
4214
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4227
+ options?: Options,
4228
+ ): Promise<
4229
+ Options extends {
4230
+ returnRawResponse: true;
4231
+ }
4232
+ ? Response
4233
+ : AiModelList[Name]["postProcessedOutputs"]
4234
+ >;
4215
4235
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4216
4236
  }
4217
4237
  export type GatewayOptions = {
@@ -561,6 +561,7 @@ interface DurableObjectState {
561
561
  waitUntil(promise: Promise<any>): void;
562
562
  readonly id: DurableObjectId;
563
563
  readonly storage: DurableObjectStorage;
564
+ container?: Container;
564
565
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
565
566
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
566
567
  getWebSockets(tag?: string): WebSocket[];
@@ -3463,6 +3464,18 @@ interface EventSourceEventSourceInit {
3463
3464
  withCredentials?: boolean;
3464
3465
  fetcher?: Fetcher;
3465
3466
  }
3467
+ interface Container {
3468
+ get running(): boolean;
3469
+ start(options?: ContainerStartupOptions): void;
3470
+ monitor(): Promise<void>;
3471
+ destroy(error?: any): Promise<void>;
3472
+ signal(signo: number): void;
3473
+ getTcpPort(port: number): Fetcher;
3474
+ }
3475
+ interface ContainerStartupOptions {
3476
+ entrypoint?: string[];
3477
+ enableInternet: boolean;
3478
+ }
3466
3479
  type AiImageClassificationInput = {
3467
3480
  image: number[];
3468
3481
  };
@@ -4159,6 +4172,7 @@ interface AiModels {
4159
4172
  }
4160
4173
  type AiOptions = {
4161
4174
  gateway?: GatewayOptions;
4175
+ returnRawResponse?: boolean;
4162
4176
  prefix?: string;
4163
4177
  extraHeaders?: object;
4164
4178
  };
@@ -4193,11 +4207,17 @@ type AiModelListType = Record<string, any>;
4193
4207
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4194
4208
  aiGatewayLogId: string | null;
4195
4209
  gateway(gatewayId: string): AiGateway;
4196
- run<Name extends keyof AiModelList>(
4210
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4197
4211
  model: Name,
4198
4212
  inputs: AiModelList[Name]["inputs"],
4199
- options?: AiOptions,
4200
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4213
+ options?: Options,
4214
+ ): Promise<
4215
+ Options extends {
4216
+ returnRawResponse: true;
4217
+ }
4218
+ ? Response
4219
+ : AiModelList[Name]["postProcessedOutputs"]
4220
+ >;
4201
4221
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4202
4222
  }
4203
4223
  type GatewayOptions = {
@@ -566,6 +566,7 @@ export interface DurableObjectState {
566
566
  waitUntil(promise: Promise<any>): void;
567
567
  readonly id: DurableObjectId;
568
568
  readonly storage: DurableObjectStorage;
569
+ container?: Container;
569
570
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
570
571
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
571
572
  getWebSockets(tag?: string): WebSocket[];
@@ -3475,6 +3476,18 @@ export interface EventSourceEventSourceInit {
3475
3476
  withCredentials?: boolean;
3476
3477
  fetcher?: Fetcher;
3477
3478
  }
3479
+ export interface Container {
3480
+ get running(): boolean;
3481
+ start(options?: ContainerStartupOptions): void;
3482
+ monitor(): Promise<void>;
3483
+ destroy(error?: any): Promise<void>;
3484
+ signal(signo: number): void;
3485
+ getTcpPort(port: number): Fetcher;
3486
+ }
3487
+ export interface ContainerStartupOptions {
3488
+ entrypoint?: string[];
3489
+ enableInternet: boolean;
3490
+ }
3478
3491
  export type AiImageClassificationInput = {
3479
3492
  image: number[];
3480
3493
  };
@@ -4171,6 +4184,7 @@ export interface AiModels {
4171
4184
  }
4172
4185
  export type AiOptions = {
4173
4186
  gateway?: GatewayOptions;
4187
+ returnRawResponse?: boolean;
4174
4188
  prefix?: string;
4175
4189
  extraHeaders?: object;
4176
4190
  };
@@ -4207,11 +4221,17 @@ export declare abstract class Ai<
4207
4221
  > {
4208
4222
  aiGatewayLogId: string | null;
4209
4223
  gateway(gatewayId: string): AiGateway;
4210
- run<Name extends keyof AiModelList>(
4224
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4211
4225
  model: Name,
4212
4226
  inputs: AiModelList[Name]["inputs"],
4213
- options?: AiOptions,
4214
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4227
+ options?: Options,
4228
+ ): Promise<
4229
+ Options extends {
4230
+ returnRawResponse: true;
4231
+ }
4232
+ ? Response
4233
+ : AiModelList[Name]["postProcessedOutputs"]
4234
+ >;
4215
4235
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4216
4236
  }
4217
4237
  export type GatewayOptions = {
@@ -566,6 +566,7 @@ interface DurableObjectState {
566
566
  waitUntil(promise: Promise<any>): void;
567
567
  readonly id: DurableObjectId;
568
568
  readonly storage: DurableObjectStorage;
569
+ container?: Container;
569
570
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
570
571
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
571
572
  getWebSockets(tag?: string): WebSocket[];
@@ -3542,6 +3543,18 @@ interface EventSourceEventSourceInit {
3542
3543
  withCredentials?: boolean;
3543
3544
  fetcher?: Fetcher;
3544
3545
  }
3546
+ interface Container {
3547
+ get running(): boolean;
3548
+ start(options?: ContainerStartupOptions): void;
3549
+ monitor(): Promise<void>;
3550
+ destroy(error?: any): Promise<void>;
3551
+ signal(signo: number): void;
3552
+ getTcpPort(port: number): Fetcher;
3553
+ }
3554
+ interface ContainerStartupOptions {
3555
+ entrypoint?: string[];
3556
+ enableInternet: boolean;
3557
+ }
3545
3558
  type AiImageClassificationInput = {
3546
3559
  image: number[];
3547
3560
  };
@@ -4238,6 +4251,7 @@ interface AiModels {
4238
4251
  }
4239
4252
  type AiOptions = {
4240
4253
  gateway?: GatewayOptions;
4254
+ returnRawResponse?: boolean;
4241
4255
  prefix?: string;
4242
4256
  extraHeaders?: object;
4243
4257
  };
@@ -4272,11 +4286,17 @@ type AiModelListType = Record<string, any>;
4272
4286
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4273
4287
  aiGatewayLogId: string | null;
4274
4288
  gateway(gatewayId: string): AiGateway;
4275
- run<Name extends keyof AiModelList>(
4289
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4276
4290
  model: Name,
4277
4291
  inputs: AiModelList[Name]["inputs"],
4278
- options?: AiOptions,
4279
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4292
+ options?: Options,
4293
+ ): Promise<
4294
+ Options extends {
4295
+ returnRawResponse: true;
4296
+ }
4297
+ ? Response
4298
+ : AiModelList[Name]["postProcessedOutputs"]
4299
+ >;
4280
4300
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4281
4301
  }
4282
4302
  type GatewayOptions = {
@@ -571,6 +571,7 @@ export interface DurableObjectState {
571
571
  waitUntil(promise: Promise<any>): void;
572
572
  readonly id: DurableObjectId;
573
573
  readonly storage: DurableObjectStorage;
574
+ container?: Container;
574
575
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
575
576
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
576
577
  getWebSockets(tag?: string): WebSocket[];
@@ -3554,6 +3555,18 @@ export interface EventSourceEventSourceInit {
3554
3555
  withCredentials?: boolean;
3555
3556
  fetcher?: Fetcher;
3556
3557
  }
3558
+ export interface Container {
3559
+ get running(): boolean;
3560
+ start(options?: ContainerStartupOptions): void;
3561
+ monitor(): Promise<void>;
3562
+ destroy(error?: any): Promise<void>;
3563
+ signal(signo: number): void;
3564
+ getTcpPort(port: number): Fetcher;
3565
+ }
3566
+ export interface ContainerStartupOptions {
3567
+ entrypoint?: string[];
3568
+ enableInternet: boolean;
3569
+ }
3557
3570
  export type AiImageClassificationInput = {
3558
3571
  image: number[];
3559
3572
  };
@@ -4250,6 +4263,7 @@ export interface AiModels {
4250
4263
  }
4251
4264
  export type AiOptions = {
4252
4265
  gateway?: GatewayOptions;
4266
+ returnRawResponse?: boolean;
4253
4267
  prefix?: string;
4254
4268
  extraHeaders?: object;
4255
4269
  };
@@ -4286,11 +4300,17 @@ export declare abstract class Ai<
4286
4300
  > {
4287
4301
  aiGatewayLogId: string | null;
4288
4302
  gateway(gatewayId: string): AiGateway;
4289
- run<Name extends keyof AiModelList>(
4303
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4290
4304
  model: Name,
4291
4305
  inputs: AiModelList[Name]["inputs"],
4292
- options?: AiOptions,
4293
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4306
+ options?: Options,
4307
+ ): Promise<
4308
+ Options extends {
4309
+ returnRawResponse: true;
4310
+ }
4311
+ ? Response
4312
+ : AiModelList[Name]["postProcessedOutputs"]
4313
+ >;
4294
4314
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4295
4315
  }
4296
4316
  export type GatewayOptions = {
package/index.d.ts CHANGED
@@ -538,6 +538,7 @@ interface DurableObjectState {
538
538
  waitUntil(promise: Promise<any>): void;
539
539
  readonly id: DurableObjectId;
540
540
  readonly storage: DurableObjectStorage;
541
+ container?: Container;
541
542
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
542
543
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
543
544
  getWebSockets(tag?: string): WebSocket[];
@@ -3401,6 +3402,18 @@ interface EventSourceEventSourceInit {
3401
3402
  withCredentials?: boolean;
3402
3403
  fetcher?: Fetcher;
3403
3404
  }
3405
+ interface Container {
3406
+ get running(): boolean;
3407
+ start(options?: ContainerStartupOptions): void;
3408
+ monitor(): Promise<void>;
3409
+ destroy(error?: any): Promise<void>;
3410
+ signal(signo: number): void;
3411
+ getTcpPort(port: number): Fetcher;
3412
+ }
3413
+ interface ContainerStartupOptions {
3414
+ entrypoint?: string[];
3415
+ enableInternet: boolean;
3416
+ }
3404
3417
  type AiImageClassificationInput = {
3405
3418
  image: number[];
3406
3419
  };
@@ -4097,6 +4110,7 @@ interface AiModels {
4097
4110
  }
4098
4111
  type AiOptions = {
4099
4112
  gateway?: GatewayOptions;
4113
+ returnRawResponse?: boolean;
4100
4114
  prefix?: string;
4101
4115
  extraHeaders?: object;
4102
4116
  };
@@ -4131,11 +4145,17 @@ type AiModelListType = Record<string, any>;
4131
4145
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4132
4146
  aiGatewayLogId: string | null;
4133
4147
  gateway(gatewayId: string): AiGateway;
4134
- run<Name extends keyof AiModelList>(
4148
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4135
4149
  model: Name,
4136
4150
  inputs: AiModelList[Name]["inputs"],
4137
- options?: AiOptions,
4138
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4151
+ options?: Options,
4152
+ ): Promise<
4153
+ Options extends {
4154
+ returnRawResponse: true;
4155
+ }
4156
+ ? Response
4157
+ : AiModelList[Name]["postProcessedOutputs"]
4158
+ >;
4139
4159
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4140
4160
  }
4141
4161
  type GatewayOptions = {
package/index.ts CHANGED
@@ -543,6 +543,7 @@ export interface DurableObjectState {
543
543
  waitUntil(promise: Promise<any>): void;
544
544
  readonly id: DurableObjectId;
545
545
  readonly storage: DurableObjectStorage;
546
+ container?: Container;
546
547
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
547
548
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
548
549
  getWebSockets(tag?: string): WebSocket[];
@@ -3413,6 +3414,18 @@ export interface EventSourceEventSourceInit {
3413
3414
  withCredentials?: boolean;
3414
3415
  fetcher?: Fetcher;
3415
3416
  }
3417
+ export interface Container {
3418
+ get running(): boolean;
3419
+ start(options?: ContainerStartupOptions): void;
3420
+ monitor(): Promise<void>;
3421
+ destroy(error?: any): Promise<void>;
3422
+ signal(signo: number): void;
3423
+ getTcpPort(port: number): Fetcher;
3424
+ }
3425
+ export interface ContainerStartupOptions {
3426
+ entrypoint?: string[];
3427
+ enableInternet: boolean;
3428
+ }
3416
3429
  export type AiImageClassificationInput = {
3417
3430
  image: number[];
3418
3431
  };
@@ -4109,6 +4122,7 @@ export interface AiModels {
4109
4122
  }
4110
4123
  export type AiOptions = {
4111
4124
  gateway?: GatewayOptions;
4125
+ returnRawResponse?: boolean;
4112
4126
  prefix?: string;
4113
4127
  extraHeaders?: object;
4114
4128
  };
@@ -4145,11 +4159,17 @@ export declare abstract class Ai<
4145
4159
  > {
4146
4160
  aiGatewayLogId: string | null;
4147
4161
  gateway(gatewayId: string): AiGateway;
4148
- run<Name extends keyof AiModelList>(
4162
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4149
4163
  model: Name,
4150
4164
  inputs: AiModelList[Name]["inputs"],
4151
- options?: AiOptions,
4152
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4165
+ options?: Options,
4166
+ ): Promise<
4167
+ Options extends {
4168
+ returnRawResponse: true;
4169
+ }
4170
+ ? Response
4171
+ : AiModelList[Name]["postProcessedOutputs"]
4172
+ >;
4153
4173
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4154
4174
  }
4155
4175
  export type GatewayOptions = {
package/oldest/index.d.ts CHANGED
@@ -538,6 +538,7 @@ interface DurableObjectState {
538
538
  waitUntil(promise: Promise<any>): void;
539
539
  readonly id: DurableObjectId;
540
540
  readonly storage: DurableObjectStorage;
541
+ container?: Container;
541
542
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
542
543
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
543
544
  getWebSockets(tag?: string): WebSocket[];
@@ -3401,6 +3402,18 @@ interface EventSourceEventSourceInit {
3401
3402
  withCredentials?: boolean;
3402
3403
  fetcher?: Fetcher;
3403
3404
  }
3405
+ interface Container {
3406
+ get running(): boolean;
3407
+ start(options?: ContainerStartupOptions): void;
3408
+ monitor(): Promise<void>;
3409
+ destroy(error?: any): Promise<void>;
3410
+ signal(signo: number): void;
3411
+ getTcpPort(port: number): Fetcher;
3412
+ }
3413
+ interface ContainerStartupOptions {
3414
+ entrypoint?: string[];
3415
+ enableInternet: boolean;
3416
+ }
3404
3417
  type AiImageClassificationInput = {
3405
3418
  image: number[];
3406
3419
  };
@@ -4097,6 +4110,7 @@ interface AiModels {
4097
4110
  }
4098
4111
  type AiOptions = {
4099
4112
  gateway?: GatewayOptions;
4113
+ returnRawResponse?: boolean;
4100
4114
  prefix?: string;
4101
4115
  extraHeaders?: object;
4102
4116
  };
@@ -4131,11 +4145,17 @@ type AiModelListType = Record<string, any>;
4131
4145
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
4132
4146
  aiGatewayLogId: string | null;
4133
4147
  gateway(gatewayId: string): AiGateway;
4134
- run<Name extends keyof AiModelList>(
4148
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4135
4149
  model: Name,
4136
4150
  inputs: AiModelList[Name]["inputs"],
4137
- options?: AiOptions,
4138
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4151
+ options?: Options,
4152
+ ): Promise<
4153
+ Options extends {
4154
+ returnRawResponse: true;
4155
+ }
4156
+ ? Response
4157
+ : AiModelList[Name]["postProcessedOutputs"]
4158
+ >;
4139
4159
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4140
4160
  }
4141
4161
  type GatewayOptions = {
package/oldest/index.ts CHANGED
@@ -543,6 +543,7 @@ export interface DurableObjectState {
543
543
  waitUntil(promise: Promise<any>): void;
544
544
  readonly id: DurableObjectId;
545
545
  readonly storage: DurableObjectStorage;
546
+ container?: Container;
546
547
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
547
548
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
548
549
  getWebSockets(tag?: string): WebSocket[];
@@ -3413,6 +3414,18 @@ export interface EventSourceEventSourceInit {
3413
3414
  withCredentials?: boolean;
3414
3415
  fetcher?: Fetcher;
3415
3416
  }
3417
+ export interface Container {
3418
+ get running(): boolean;
3419
+ start(options?: ContainerStartupOptions): void;
3420
+ monitor(): Promise<void>;
3421
+ destroy(error?: any): Promise<void>;
3422
+ signal(signo: number): void;
3423
+ getTcpPort(port: number): Fetcher;
3424
+ }
3425
+ export interface ContainerStartupOptions {
3426
+ entrypoint?: string[];
3427
+ enableInternet: boolean;
3428
+ }
3416
3429
  export type AiImageClassificationInput = {
3417
3430
  image: number[];
3418
3431
  };
@@ -4109,6 +4122,7 @@ export interface AiModels {
4109
4122
  }
4110
4123
  export type AiOptions = {
4111
4124
  gateway?: GatewayOptions;
4125
+ returnRawResponse?: boolean;
4112
4126
  prefix?: string;
4113
4127
  extraHeaders?: object;
4114
4128
  };
@@ -4145,11 +4159,17 @@ export declare abstract class Ai<
4145
4159
  > {
4146
4160
  aiGatewayLogId: string | null;
4147
4161
  gateway(gatewayId: string): AiGateway;
4148
- run<Name extends keyof AiModelList>(
4162
+ run<Name extends keyof AiModelList, Options extends AiOptions>(
4149
4163
  model: Name,
4150
4164
  inputs: AiModelList[Name]["inputs"],
4151
- options?: AiOptions,
4152
- ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4165
+ options?: Options,
4166
+ ): Promise<
4167
+ Options extends {
4168
+ returnRawResponse: true;
4169
+ }
4170
+ ? Response
4171
+ : AiModelList[Name]["postProcessedOutputs"]
4172
+ >;
4153
4173
  public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4154
4174
  }
4155
4175
  export type GatewayOptions = {
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20250124.3"
10
+ "version": "4.20250129.0"
11
11
  }