@cloudflare/workers-types 4.20260317.1 → 4.20260331.1

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.
package/latest/index.d.ts CHANGED
@@ -489,6 +489,11 @@ type ExportedHandlerFetchHandler<
489
489
  env: Env,
490
490
  ctx: ExecutionContext<Props>,
491
491
  ) => Response | Promise<Response>;
492
+ type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
493
+ socket: Socket,
494
+ env: Env,
495
+ ctx: ExecutionContext<Props>,
496
+ ) => void | Promise<void>;
492
497
  type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
493
498
  events: TraceItem[],
494
499
  env: Env,
@@ -530,6 +535,7 @@ interface ExportedHandler<
530
535
  Props = unknown,
531
536
  > {
532
537
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
538
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
533
539
  tail?: ExportedHandlerTailHandler<Env, Props>;
534
540
  trace?: ExportedHandlerTraceHandler<Env, Props>;
535
541
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -551,12 +557,14 @@ declare abstract class Navigator {
551
557
  interface AlarmInvocationInfo {
552
558
  readonly isRetry: boolean;
553
559
  readonly retryCount: number;
560
+ readonly scheduledTime: number;
554
561
  }
555
562
  interface Cloudflare {
556
563
  readonly compatibilityFlags: Record<string, boolean>;
557
564
  }
558
565
  interface DurableObject {
559
566
  fetch(request: Request): Response | Promise<Response>;
567
+ connect?(socket: Socket): void | Promise<void>;
560
568
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
561
569
  webSocketMessage?(
562
570
  ws: WebSocket,
@@ -574,7 +582,7 @@ type DurableObjectStub<
574
582
  T extends Rpc.DurableObjectBranded | undefined = undefined,
575
583
  > = Fetcher<
576
584
  T,
577
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
585
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
578
586
  > & {
579
587
  readonly id: DurableObjectId;
580
588
  readonly name?: string;
@@ -583,6 +591,7 @@ interface DurableObjectId {
583
591
  toString(): string;
584
592
  equals(other: DurableObjectId): boolean;
585
593
  readonly name?: string;
594
+ readonly jurisdiction?: string;
586
595
  }
587
596
  declare abstract class DurableObjectNamespace<
588
597
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3106,6 +3115,11 @@ interface QueuingStrategyInit {
3106
3115
  */
3107
3116
  highWaterMark: number;
3108
3117
  }
3118
+ interface TracePreviewInfo {
3119
+ id: string;
3120
+ slug: string;
3121
+ name: string;
3122
+ }
3109
3123
  interface ScriptVersion {
3110
3124
  id?: string;
3111
3125
  tag?: string;
@@ -3120,6 +3134,7 @@ interface TraceItem {
3120
3134
  | (
3121
3135
  | TraceItemFetchEventInfo
3122
3136
  | TraceItemJsRpcEventInfo
3137
+ | TraceItemConnectEventInfo
3123
3138
  | TraceItemScheduledEventInfo
3124
3139
  | TraceItemAlarmEventInfo
3125
3140
  | TraceItemQueueEventInfo
@@ -3138,6 +3153,8 @@ interface TraceItem {
3138
3153
  readonly scriptVersion?: ScriptVersion;
3139
3154
  readonly dispatchNamespace?: string;
3140
3155
  readonly scriptTags?: string[];
3156
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3157
+ readonly preview?: TracePreviewInfo;
3141
3158
  readonly durableObjectId?: string;
3142
3159
  readonly outcome: string;
3143
3160
  readonly executionModel: string;
@@ -3148,6 +3165,7 @@ interface TraceItem {
3148
3165
  interface TraceItemAlarmEventInfo {
3149
3166
  readonly scheduledTime: Date;
3150
3167
  }
3168
+ interface TraceItemConnectEventInfo {}
3151
3169
  interface TraceItemCustomEventInfo {}
3152
3170
  interface TraceItemScheduledEventInfo {
3153
3171
  readonly scheduledTime: number;
@@ -3769,7 +3787,7 @@ interface ContainerStartupOptions {
3769
3787
  entrypoint?: string[];
3770
3788
  enableInternet: boolean;
3771
3789
  env?: Record<string, string>;
3772
- hardTimeout?: number | bigint;
3790
+ labels?: Record<string, string>;
3773
3791
  }
3774
3792
  /**
3775
3793
  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
@@ -3916,11 +3934,10 @@ declare abstract class Performance {
3916
3934
  */
3917
3935
  toJSON(): object;
3918
3936
  }
3919
- // AI Search V2 API Error Interfaces
3937
+ // ============ AI Search Error Interfaces ============
3920
3938
  interface AiSearchInternalError extends Error {}
3921
3939
  interface AiSearchNotFoundError extends Error {}
3922
- interface AiSearchNameNotSetError extends Error {}
3923
- // AI Search V2 Request Types
3940
+ // ============ AI Search Request Types ============
3924
3941
  type AiSearchSearchRequest = {
3925
3942
  messages: Array<{
3926
3943
  role: "system" | "developer" | "user" | "assistant" | "tool";
@@ -3945,9 +3962,8 @@ type AiSearchSearchRequest = {
3945
3962
  [key: string]: unknown;
3946
3963
  };
3947
3964
  reranking?: {
3948
- /** Enable reranking (default false) */
3949
3965
  enabled?: boolean;
3950
- model?: "@cf/baai/bge-reranker-base" | "";
3966
+ model?: "@cf/baai/bge-reranker-base" | string;
3951
3967
  /** Match threshold (0-1, default 0.4) */
3952
3968
  match_threshold?: number;
3953
3969
  [key: string]: unknown;
@@ -3959,6 +3975,7 @@ type AiSearchChatCompletionsRequest = {
3959
3975
  messages: Array<{
3960
3976
  role: "system" | "developer" | "user" | "assistant" | "tool";
3961
3977
  content: string | null;
3978
+ [key: string]: unknown;
3962
3979
  }>;
3963
3980
  model?: string;
3964
3981
  stream?: boolean;
@@ -3979,7 +3996,7 @@ type AiSearchChatCompletionsRequest = {
3979
3996
  };
3980
3997
  reranking?: {
3981
3998
  enabled?: boolean;
3982
- model?: "@cf/baai/bge-reranker-base" | "";
3999
+ model?: "@cf/baai/bge-reranker-base" | string;
3983
4000
  match_threshold?: number;
3984
4001
  [key: string]: unknown;
3985
4002
  };
@@ -3987,7 +4004,7 @@ type AiSearchChatCompletionsRequest = {
3987
4004
  };
3988
4005
  [key: string]: unknown;
3989
4006
  };
3990
- // AI Search V2 Response Types
4007
+ // ============ AI Search Response Types ============
3991
4008
  type AiSearchSearchResponse = {
3992
4009
  search_query: string;
3993
4010
  chunks: Array<{
@@ -4006,26 +4023,65 @@ type AiSearchSearchResponse = {
4006
4023
  keyword_score?: number;
4007
4024
  /** Vector similarity score (0-1) */
4008
4025
  vector_score?: number;
4026
+ [key: string]: unknown;
4027
+ };
4028
+ }>;
4029
+ };
4030
+ type AiSearchChatCompletionsResponse = {
4031
+ id?: string;
4032
+ object?: string;
4033
+ model?: string;
4034
+ choices: Array<{
4035
+ index?: number;
4036
+ message: {
4037
+ role: "system" | "developer" | "user" | "assistant" | "tool";
4038
+ content: string | null;
4039
+ [key: string]: unknown;
4009
4040
  };
4041
+ [key: string]: unknown;
4010
4042
  }>;
4043
+ chunks: AiSearchSearchResponse["chunks"];
4044
+ [key: string]: unknown;
4011
4045
  };
4012
- type AiSearchListResponse = Array<{
4046
+ type AiSearchStatsResponse = {
4047
+ queued?: number;
4048
+ running?: number;
4049
+ completed?: number;
4050
+ error?: number;
4051
+ skipped?: number;
4052
+ outdated?: number;
4053
+ last_activity?: string;
4054
+ };
4055
+ // ============ AI Search Instance Info Types ============
4056
+ type AiSearchInstanceInfo = {
4013
4057
  id: string;
4014
- internal_id?: string;
4015
- account_id?: string;
4016
- account_tag?: string;
4017
- /** Whether the instance is enabled (default true) */
4018
- enable?: boolean;
4019
- type?: "r2" | "web-crawler";
4058
+ type?: "r2" | "web-crawler" | string;
4020
4059
  source?: string;
4060
+ paused?: boolean;
4061
+ status?: string;
4062
+ namespace?: string;
4063
+ created_at?: string;
4064
+ modified_at?: string;
4021
4065
  [key: string]: unknown;
4022
- }>;
4066
+ };
4067
+ type AiSearchListResponse = {
4068
+ result: AiSearchInstanceInfo[];
4069
+ result_info?: {
4070
+ count: number;
4071
+ page: number;
4072
+ per_page: number;
4073
+ total_count: number;
4074
+ };
4075
+ };
4076
+ // ============ AI Search Config Types ============
4023
4077
  type AiSearchConfig = {
4024
4078
  /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
4025
4079
  id: string;
4026
- type: "r2" | "web-crawler";
4027
- source: string;
4028
- source_params?: object;
4080
+ /** Instance type. Omit to create with built-in storage. */
4081
+ type?: "r2" | "web-crawler" | string;
4082
+ /** Source URL (required for web-crawler type). */
4083
+ source?: string;
4084
+ source_params?: unknown;
4029
4085
  /** Token ID (UUID format) */
4030
4086
  token_id?: string;
4031
4087
  ai_gateway_id?: string;
@@ -4035,54 +4091,307 @@ type AiSearchConfig = {
4035
4091
  reranking?: boolean;
4036
4092
  embedding_model?: string;
4037
4093
  ai_search_model?: string;
4094
+ [key: string]: unknown;
4038
4095
  };
4039
- type AiSearchInstance = {
4096
+ // ============ AI Search Item Types ============
4097
+ type AiSearchItemInfo = {
4040
4098
  id: string;
4041
- enable?: boolean;
4042
- type?: "r2" | "web-crawler";
4043
- source?: string;
4099
+ key: string;
4100
+ status:
4101
+ | "completed"
4102
+ | "error"
4103
+ | "skipped"
4104
+ | "queued"
4105
+ | "processing"
4106
+ | "outdated";
4107
+ metadata?: Record<string, unknown>;
4044
4108
  [key: string]: unknown;
4045
4109
  };
4046
- // AI Search Instance Service - Instance-level operations
4047
- declare abstract class AiSearchInstanceService {
4110
+ type AiSearchItemContentResult = {
4111
+ body: ReadableStream;
4112
+ contentType: string;
4113
+ filename: string;
4114
+ size: number;
4115
+ };
4116
+ type AiSearchUploadItemOptions = {
4117
+ metadata?: Record<string, unknown>;
4118
+ };
4119
+ type AiSearchListItemsParams = {
4120
+ page?: number;
4121
+ per_page?: number;
4122
+ };
4123
+ type AiSearchListItemsResponse = {
4124
+ result: AiSearchItemInfo[];
4125
+ result_info?: {
4126
+ count: number;
4127
+ page: number;
4128
+ per_page: number;
4129
+ total_count: number;
4130
+ };
4131
+ };
4132
+ // ============ AI Search Job Types ============
4133
+ type AiSearchJobInfo = {
4134
+ id: string;
4135
+ source: "user" | "schedule";
4136
+ description?: string;
4137
+ last_seen_at?: string;
4138
+ started_at?: string;
4139
+ ended_at?: string;
4140
+ end_reason?: string;
4141
+ };
4142
+ type AiSearchJobLog = {
4143
+ id: number;
4144
+ message: string;
4145
+ message_type: number;
4146
+ created_at: number;
4147
+ };
4148
+ type AiSearchCreateJobParams = {
4149
+ description?: string;
4150
+ };
4151
+ type AiSearchListJobsParams = {
4152
+ page?: number;
4153
+ per_page?: number;
4154
+ };
4155
+ type AiSearchListJobsResponse = {
4156
+ result: AiSearchJobInfo[];
4157
+ result_info?: {
4158
+ count: number;
4159
+ page: number;
4160
+ per_page: number;
4161
+ total_count: number;
4162
+ };
4163
+ };
4164
+ type AiSearchJobLogsParams = {
4165
+ page?: number;
4166
+ per_page?: number;
4167
+ };
4168
+ type AiSearchJobLogsResponse = {
4169
+ result: AiSearchJobLog[];
4170
+ result_info?: {
4171
+ count: number;
4172
+ page: number;
4173
+ per_page: number;
4174
+ total_count: number;
4175
+ };
4176
+ };
4177
+ // ============ AI Search Sub-Service Classes ============
4178
+ /**
4179
+ * Single item service for an AI Search instance.
4180
+ * Provides info, delete, and download operations on a specific item.
4181
+ */
4182
+ declare abstract class AiSearchItem {
4183
+ /** Get metadata about this item. */
4184
+ info(): Promise<AiSearchItemInfo>;
4185
+ /**
4186
+ * Download the item's content.
4187
+ * @returns Object with body stream, content type, filename, and size.
4188
+ */
4189
+ download(): Promise<AiSearchItemContentResult>;
4190
+ }
4191
+ /**
4192
+ * Items collection service for an AI Search instance.
4193
+ * Provides list, upload, and access to individual items.
4194
+ */
4195
+ declare abstract class AiSearchItems {
4196
+ /** List items in this instance. */
4197
+ list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
4198
+ /**
4199
+ * Upload a file as an item.
4200
+ * @param name Filename for the uploaded item.
4201
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4202
+ * @param options Optional metadata to attach to the item.
4203
+ * @returns The created item info.
4204
+ */
4205
+ upload(
4206
+ name: string,
4207
+ content: ReadableStream | ArrayBuffer | string,
4208
+ options?: AiSearchUploadItemOptions,
4209
+ ): Promise<AiSearchItemInfo>;
4210
+ /**
4211
+ * Upload a file and poll until processing completes.
4212
+ * @param name Filename for the uploaded item.
4213
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4214
+ * @param options Optional metadata to attach to the item.
4215
+ * @returns The item info after processing completes (or timeout).
4216
+ */
4217
+ uploadAndPoll(
4218
+ name: string,
4219
+ content: ReadableStream | ArrayBuffer | string,
4220
+ options?: AiSearchUploadItemOptions,
4221
+ ): Promise<AiSearchItemInfo>;
4222
+ /**
4223
+ * Get an item by ID.
4224
+ * @param itemId The item identifier.
4225
+ * @returns Item service for info, delete, and download operations.
4226
+ */
4227
+ get(itemId: string): AiSearchItem;
4228
+ /** Delete this item from the instance.
4229
+ * @param itemId The item identifier.
4230
+ */
4231
+ delete(itemId: string): Promise<void>;
4232
+ }
4233
+ /**
4234
+ * Single job service for an AI Search instance.
4235
+ * Provides info and logs for a specific job.
4236
+ */
4237
+ declare abstract class AiSearchJob {
4238
+ /** Get metadata about this job. */
4239
+ info(): Promise<AiSearchJobInfo>;
4240
+ /** Get logs for this job. */
4241
+ logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
4242
+ }
4243
+ /**
4244
+ * Jobs collection service for an AI Search instance.
4245
+ * Provides list, create, and access to individual jobs.
4246
+ */
4247
+ declare abstract class AiSearchJobs {
4248
+ /** List jobs for this instance. */
4249
+ list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
4250
+ /**
4251
+ * Create a new indexing job.
4252
+ * @param params Optional job parameters.
4253
+ * @returns The created job info.
4254
+ */
4255
+ create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
4256
+ /**
4257
+ * Get a job by ID.
4258
+ * @param jobId The job identifier.
4259
+ * @returns Job service for info and logs operations.
4260
+ */
4261
+ get(jobId: string): AiSearchJob;
4262
+ }
4263
+ // ============ AI Search Binding Classes ============
4264
+ /**
4265
+ * Instance-level AI Search service.
4266
+ *
4267
+ * Used as:
4268
+ * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
4269
+ * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
4270
+ *
4271
+ * Provides search, chat, update, stats, items, and jobs operations.
4272
+ *
4273
+ * @example
4274
+ * ```ts
4275
+ * // Via namespace binding
4276
+ * const instance = env.AI_SEARCH.get("blog");
4277
+ * const results = await instance.search({
4278
+ * messages: [{ role: "user", content: "How does caching work?" }],
4279
+ * });
4280
+ *
4281
+ * // Via single instance binding
4282
+ * const results = await env.BLOG_SEARCH.search({
4283
+ * messages: [{ role: "user", content: "How does caching work?" }],
4284
+ * });
4285
+ * ```
4286
+ */
4287
+ declare abstract class AiSearchInstance {
4048
4288
  /**
4049
4289
  * Search the AI Search instance for relevant chunks.
4050
- * @param params Search request with messages and AI search options
4051
- * @returns Search response with matching chunks
4290
+ * @param params Search request with messages and optional AI search options.
4291
+ * @returns Search response with matching chunks and search query.
4052
4292
  */
4053
4293
  search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
4294
+ /**
4295
+ * Generate chat completions with AI Search context (streaming).
4296
+ * @param params Chat completions request with stream: true.
4297
+ * @returns ReadableStream of server-sent events.
4298
+ */
4299
+ chatCompletions(
4300
+ params: AiSearchChatCompletionsRequest & {
4301
+ stream: true;
4302
+ },
4303
+ ): Promise<ReadableStream>;
4054
4304
  /**
4055
4305
  * Generate chat completions with AI Search context.
4056
- * @param params Chat completions request with optional streaming
4057
- * @returns Response object (if streaming) or chat completion result
4306
+ * @param params Chat completions request.
4307
+ * @returns Chat completion response with choices and RAG chunks.
4058
4308
  */
4059
4309
  chatCompletions(
4060
4310
  params: AiSearchChatCompletionsRequest,
4061
- ): Promise<Response | object>;
4311
+ ): Promise<AiSearchChatCompletionsResponse>;
4062
4312
  /**
4063
- * Delete this AI Search instance.
4313
+ * Update the instance configuration.
4314
+ * @param config Partial configuration to update.
4315
+ * @returns Updated instance info.
4064
4316
  */
4065
- delete(): Promise<void>;
4317
+ update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
4318
+ /** Get metadata about this instance. */
4319
+ info(): Promise<AiSearchInstanceInfo>;
4320
+ /**
4321
+ * Get instance statistics (item count, indexing status, etc.).
4322
+ * @returns Statistics with counts per status and last activity time.
4323
+ */
4324
+ stats(): Promise<AiSearchStatsResponse>;
4325
+ /** Items collection — list, upload, and manage items in this instance. */
4326
+ get items(): AiSearchItems;
4327
+ /** Jobs collection — list, create, and inspect indexing jobs. */
4328
+ get jobs(): AiSearchJobs;
4066
4329
  }
4067
- // AI Search Account Service - Account-level operations
4068
- declare abstract class AiSearchAccountService {
4330
+ /**
4331
+ * Namespace-level AI Search service.
4332
+ *
4333
+ * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
4334
+ * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
4335
+ *
4336
+ * @example
4337
+ * ```ts
4338
+ * // Access an instance within the namespace
4339
+ * const blog = env.AI_SEARCH.get("blog");
4340
+ * const results = await blog.search({
4341
+ * messages: [{ role: "user", content: "How does caching work?" }],
4342
+ * });
4343
+ *
4344
+ * // List all instances in the namespace
4345
+ * const instances = await env.AI_SEARCH.list();
4346
+ *
4347
+ * // Create a new instance with built-in storage
4348
+ * const tenant = await env.AI_SEARCH.create({
4349
+ * id: "tenant-123",
4350
+ * });
4351
+ *
4352
+ * // Upload items into the instance
4353
+ * await tenant.items.upload("doc.pdf", fileContent);
4354
+ *
4355
+ * // Delete an instance
4356
+ * await env.AI_SEARCH.delete("tenant-123");
4357
+ * ```
4358
+ */
4359
+ declare abstract class AiSearchNamespace {
4069
4360
  /**
4070
- * List all AI Search instances in the account.
4071
- * @returns Array of AI Search instances
4361
+ * Get an instance by name within the bound namespace.
4362
+ * @param name Instance name.
4363
+ * @returns Instance service for search, chat, update, stats, items, and jobs.
4364
+ */
4365
+ get(name: string): AiSearchInstance;
4366
+ /**
4367
+ * List all instances in the bound namespace.
4368
+ * @returns Array of instance metadata.
4072
4369
  */
4073
4370
  list(): Promise<AiSearchListResponse>;
4074
4371
  /**
4075
- * Get an AI Search instance by ID.
4076
- * @param name Instance ID
4077
- * @returns Instance service for performing operations
4372
+ * Create a new instance within the bound namespace.
4373
+ * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
4374
+ * @returns Instance service for the newly created instance.
4375
+ *
4376
+ * @example
4377
+ * ```ts
4378
+ * // Create with built-in storage (upload items manually)
4379
+ * const instance = await env.AI_SEARCH.create({ id: "my-search" });
4380
+ *
4381
+ * // Create with web crawler source
4382
+ * const instance = await env.AI_SEARCH.create({
4383
+ * id: "docs-search",
4384
+ * type: "web-crawler",
4385
+ * source: "https://developers.cloudflare.com",
4386
+ * });
4387
+ * ```
4078
4388
  */
4079
- get(name: string): AiSearchInstanceService;
4389
+ create(config: AiSearchConfig): Promise<AiSearchInstance>;
4080
4390
  /**
4081
- * Create a new AI Search instance.
4082
- * @param config Instance configuration
4083
- * @returns Instance service for performing operations
4391
+ * Delete an instance from the bound namespace.
4392
+ * @param name Instance name to delete.
4084
4393
  */
4085
- create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
4394
+ delete(name: string): Promise<void>;
4086
4395
  }
4087
4396
  type AiImageClassificationInput = {
4088
4397
  image: number[];
@@ -4358,6 +4667,400 @@ declare abstract class BaseAiTranslation {
4358
4667
  inputs: AiTranslationInput;
4359
4668
  postProcessedOutputs: AiTranslationOutput;
4360
4669
  }
4670
+ /**
4671
+ * Workers AI support for OpenAI's Chat Completions API
4672
+ */
4673
+ type ChatCompletionContentPartText = {
4674
+ type: "text";
4675
+ text: string;
4676
+ };
4677
+ type ChatCompletionContentPartImage = {
4678
+ type: "image_url";
4679
+ image_url: {
4680
+ url: string;
4681
+ detail?: "auto" | "low" | "high";
4682
+ };
4683
+ };
4684
+ type ChatCompletionContentPartInputAudio = {
4685
+ type: "input_audio";
4686
+ input_audio: {
4687
+ /** Base64 encoded audio data. */
4688
+ data: string;
4689
+ format: "wav" | "mp3";
4690
+ };
4691
+ };
4692
+ type ChatCompletionContentPartFile = {
4693
+ type: "file";
4694
+ file: {
4695
+ /** Base64 encoded file data. */
4696
+ file_data?: string;
4697
+ /** The ID of an uploaded file. */
4698
+ file_id?: string;
4699
+ filename?: string;
4700
+ };
4701
+ };
4702
+ type ChatCompletionContentPartRefusal = {
4703
+ type: "refusal";
4704
+ refusal: string;
4705
+ };
4706
+ type ChatCompletionContentPart =
4707
+ | ChatCompletionContentPartText
4708
+ | ChatCompletionContentPartImage
4709
+ | ChatCompletionContentPartInputAudio
4710
+ | ChatCompletionContentPartFile;
4711
+ type FunctionDefinition = {
4712
+ name: string;
4713
+ description?: string;
4714
+ parameters?: Record<string, unknown>;
4715
+ strict?: boolean | null;
4716
+ };
4717
+ type ChatCompletionFunctionTool = {
4718
+ type: "function";
4719
+ function: FunctionDefinition;
4720
+ };
4721
+ type ChatCompletionCustomToolGrammarFormat = {
4722
+ type: "grammar";
4723
+ grammar: {
4724
+ definition: string;
4725
+ syntax: "lark" | "regex";
4726
+ };
4727
+ };
4728
+ type ChatCompletionCustomToolTextFormat = {
4729
+ type: "text";
4730
+ };
4731
+ type ChatCompletionCustomToolFormat =
4732
+ | ChatCompletionCustomToolTextFormat
4733
+ | ChatCompletionCustomToolGrammarFormat;
4734
+ type ChatCompletionCustomTool = {
4735
+ type: "custom";
4736
+ custom: {
4737
+ name: string;
4738
+ description?: string;
4739
+ format?: ChatCompletionCustomToolFormat;
4740
+ };
4741
+ };
4742
+ type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
4743
+ type ChatCompletionMessageFunctionToolCall = {
4744
+ id: string;
4745
+ type: "function";
4746
+ function: {
4747
+ name: string;
4748
+ /** JSON-encoded arguments string. */
4749
+ arguments: string;
4750
+ };
4751
+ };
4752
+ type ChatCompletionMessageCustomToolCall = {
4753
+ id: string;
4754
+ type: "custom";
4755
+ custom: {
4756
+ name: string;
4757
+ input: string;
4758
+ };
4759
+ };
4760
+ type ChatCompletionMessageToolCall =
4761
+ | ChatCompletionMessageFunctionToolCall
4762
+ | ChatCompletionMessageCustomToolCall;
4763
+ type ChatCompletionToolChoiceFunction = {
4764
+ type: "function";
4765
+ function: {
4766
+ name: string;
4767
+ };
4768
+ };
4769
+ type ChatCompletionToolChoiceCustom = {
4770
+ type: "custom";
4771
+ custom: {
4772
+ name: string;
4773
+ };
4774
+ };
4775
+ type ChatCompletionToolChoiceAllowedTools = {
4776
+ type: "allowed_tools";
4777
+ allowed_tools: {
4778
+ mode: "auto" | "required";
4779
+ tools: Array<Record<string, unknown>>;
4780
+ };
4781
+ };
4782
+ type ChatCompletionToolChoiceOption =
4783
+ | "none"
4784
+ | "auto"
4785
+ | "required"
4786
+ | ChatCompletionToolChoiceFunction
4787
+ | ChatCompletionToolChoiceCustom
4788
+ | ChatCompletionToolChoiceAllowedTools;
4789
+ type DeveloperMessage = {
4790
+ role: "developer";
4791
+ content:
4792
+ | string
4793
+ | Array<{
4794
+ type: "text";
4795
+ text: string;
4796
+ }>;
4797
+ name?: string;
4798
+ };
4799
+ type SystemMessage = {
4800
+ role: "system";
4801
+ content:
4802
+ | string
4803
+ | Array<{
4804
+ type: "text";
4805
+ text: string;
4806
+ }>;
4807
+ name?: string;
4808
+ };
4809
+ /**
4810
+ * Permissive merged content part used inside UserMessage arrays.
4811
+ *
4812
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4813
+ * inside nested array items does not correctly match different branches for
4814
+ * different array elements, so the schema uses a single merged object.
4815
+ */
4816
+ type UserMessageContentPart = {
4817
+ type: "text" | "image_url" | "input_audio" | "file";
4818
+ text?: string;
4819
+ image_url?: {
4820
+ url?: string;
4821
+ detail?: "auto" | "low" | "high";
4822
+ };
4823
+ input_audio?: {
4824
+ data?: string;
4825
+ format?: "wav" | "mp3";
4826
+ };
4827
+ file?: {
4828
+ file_data?: string;
4829
+ file_id?: string;
4830
+ filename?: string;
4831
+ };
4832
+ };
4833
+ type UserMessage = {
4834
+ role: "user";
4835
+ content: string | Array<UserMessageContentPart>;
4836
+ name?: string;
4837
+ };
4838
+ type AssistantMessageContentPart = {
4839
+ type: "text" | "refusal";
4840
+ text?: string;
4841
+ refusal?: string;
4842
+ };
4843
+ type AssistantMessage = {
4844
+ role: "assistant";
4845
+ content?: string | null | Array<AssistantMessageContentPart>;
4846
+ refusal?: string | null;
4847
+ name?: string;
4848
+ audio?: {
4849
+ id: string;
4850
+ };
4851
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4852
+ function_call?: {
4853
+ name: string;
4854
+ arguments: string;
4855
+ };
4856
+ };
4857
+ type ToolMessage = {
4858
+ role: "tool";
4859
+ content:
4860
+ | string
4861
+ | Array<{
4862
+ type: "text";
4863
+ text: string;
4864
+ }>;
4865
+ tool_call_id: string;
4866
+ };
4867
+ type FunctionMessage = {
4868
+ role: "function";
4869
+ content: string;
4870
+ name: string;
4871
+ };
4872
+ type ChatCompletionMessageParam =
4873
+ | DeveloperMessage
4874
+ | SystemMessage
4875
+ | UserMessage
4876
+ | AssistantMessage
4877
+ | ToolMessage
4878
+ | FunctionMessage;
4879
+ type ChatCompletionsResponseFormatText = {
4880
+ type: "text";
4881
+ };
4882
+ type ChatCompletionsResponseFormatJSONObject = {
4883
+ type: "json_object";
4884
+ };
4885
+ type ResponseFormatJSONSchema = {
4886
+ type: "json_schema";
4887
+ json_schema: {
4888
+ name: string;
4889
+ description?: string;
4890
+ schema?: Record<string, unknown>;
4891
+ strict?: boolean | null;
4892
+ };
4893
+ };
4894
+ type ResponseFormat =
4895
+ | ChatCompletionsResponseFormatText
4896
+ | ChatCompletionsResponseFormatJSONObject
4897
+ | ResponseFormatJSONSchema;
4898
+ type ChatCompletionsStreamOptions = {
4899
+ include_usage?: boolean;
4900
+ include_obfuscation?: boolean;
4901
+ };
4902
+ type PredictionContent = {
4903
+ type: "content";
4904
+ content:
4905
+ | string
4906
+ | Array<{
4907
+ type: "text";
4908
+ text: string;
4909
+ }>;
4910
+ };
4911
+ type AudioParams = {
4912
+ voice:
4913
+ | string
4914
+ | {
4915
+ id: string;
4916
+ };
4917
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4918
+ };
4919
+ type WebSearchUserLocation = {
4920
+ type: "approximate";
4921
+ approximate: {
4922
+ city?: string;
4923
+ country?: string;
4924
+ region?: string;
4925
+ timezone?: string;
4926
+ };
4927
+ };
4928
+ type WebSearchOptions = {
4929
+ search_context_size?: "low" | "medium" | "high";
4930
+ user_location?: WebSearchUserLocation;
4931
+ };
4932
+ type ChatTemplateKwargs = {
4933
+ /** Whether to enable reasoning, enabled by default. */
4934
+ enable_thinking?: boolean;
4935
+ /** If false, preserves reasoning context between turns. */
4936
+ clear_thinking?: boolean;
4937
+ };
4938
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4939
+ type ChatCompletionsCommonOptions = {
4940
+ model?: string;
4941
+ audio?: AudioParams;
4942
+ frequency_penalty?: number | null;
4943
+ logit_bias?: Record<string, unknown> | null;
4944
+ logprobs?: boolean | null;
4945
+ top_logprobs?: number | null;
4946
+ max_tokens?: number | null;
4947
+ max_completion_tokens?: number | null;
4948
+ metadata?: Record<string, unknown> | null;
4949
+ modalities?: Array<"text" | "audio"> | null;
4950
+ n?: number | null;
4951
+ parallel_tool_calls?: boolean;
4952
+ prediction?: PredictionContent;
4953
+ presence_penalty?: number | null;
4954
+ reasoning_effort?: "low" | "medium" | "high" | null;
4955
+ chat_template_kwargs?: ChatTemplateKwargs;
4956
+ response_format?: ResponseFormat;
4957
+ seed?: number | null;
4958
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4959
+ stop?: string | Array<string> | null;
4960
+ store?: boolean | null;
4961
+ stream?: boolean | null;
4962
+ stream_options?: ChatCompletionsStreamOptions;
4963
+ temperature?: number | null;
4964
+ tool_choice?: ChatCompletionToolChoiceOption;
4965
+ tools?: Array<ChatCompletionTool>;
4966
+ top_p?: number | null;
4967
+ user?: string;
4968
+ web_search_options?: WebSearchOptions;
4969
+ function_call?:
4970
+ | "none"
4971
+ | "auto"
4972
+ | {
4973
+ name: string;
4974
+ };
4975
+ functions?: Array<FunctionDefinition>;
4976
+ };
4977
+ type PromptTokensDetails = {
4978
+ cached_tokens?: number;
4979
+ audio_tokens?: number;
4980
+ };
4981
+ type CompletionTokensDetails = {
4982
+ reasoning_tokens?: number;
4983
+ audio_tokens?: number;
4984
+ accepted_prediction_tokens?: number;
4985
+ rejected_prediction_tokens?: number;
4986
+ };
4987
+ type CompletionUsage = {
4988
+ prompt_tokens: number;
4989
+ completion_tokens: number;
4990
+ total_tokens: number;
4991
+ prompt_tokens_details?: PromptTokensDetails;
4992
+ completion_tokens_details?: CompletionTokensDetails;
4993
+ };
4994
+ type ChatCompletionTopLogprob = {
4995
+ token: string;
4996
+ logprob: number;
4997
+ bytes: Array<number> | null;
4998
+ };
4999
+ type ChatCompletionTokenLogprob = {
5000
+ token: string;
5001
+ logprob: number;
5002
+ bytes: Array<number> | null;
5003
+ top_logprobs: Array<ChatCompletionTopLogprob>;
5004
+ };
5005
+ type ChatCompletionAudio = {
5006
+ id: string;
5007
+ /** Base64 encoded audio bytes. */
5008
+ data: string;
5009
+ expires_at: number;
5010
+ transcript: string;
5011
+ };
5012
+ type ChatCompletionUrlCitation = {
5013
+ type: "url_citation";
5014
+ url_citation: {
5015
+ url: string;
5016
+ title: string;
5017
+ start_index: number;
5018
+ end_index: number;
5019
+ };
5020
+ };
5021
+ type ChatCompletionResponseMessage = {
5022
+ role: "assistant";
5023
+ content: string | null;
5024
+ refusal: string | null;
5025
+ annotations?: Array<ChatCompletionUrlCitation>;
5026
+ audio?: ChatCompletionAudio;
5027
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
5028
+ function_call?: {
5029
+ name: string;
5030
+ arguments: string;
5031
+ } | null;
5032
+ };
5033
+ type ChatCompletionLogprobs = {
5034
+ content: Array<ChatCompletionTokenLogprob> | null;
5035
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
5036
+ };
5037
+ type ChatCompletionChoice = {
5038
+ index: number;
5039
+ message: ChatCompletionResponseMessage;
5040
+ finish_reason:
5041
+ | "stop"
5042
+ | "length"
5043
+ | "tool_calls"
5044
+ | "content_filter"
5045
+ | "function_call";
5046
+ logprobs: ChatCompletionLogprobs | null;
5047
+ };
5048
+ type ChatCompletionsPromptInput = {
5049
+ prompt: string;
5050
+ } & ChatCompletionsCommonOptions;
5051
+ type ChatCompletionsMessagesInput = {
5052
+ messages: Array<ChatCompletionMessageParam>;
5053
+ } & ChatCompletionsCommonOptions;
5054
+ type ChatCompletionsOutput = {
5055
+ id: string;
5056
+ object: string;
5057
+ created: number;
5058
+ model: string;
5059
+ choices: Array<ChatCompletionChoice>;
5060
+ usage?: CompletionUsage;
5061
+ system_fingerprint?: string | null;
5062
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
5063
+ };
4361
5064
  /**
4362
5065
  * Workers AI support for OpenAI's Responses API
4363
5066
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4779,6 +5482,12 @@ type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4779
5482
  type StreamOptions = {
4780
5483
  include_obfuscation?: boolean;
4781
5484
  };
5485
+ /** Marks keys from T that aren't in U as optional never */
5486
+ type Without<T, U> = {
5487
+ [P in Exclude<keyof T, keyof U>]?: never;
5488
+ };
5489
+ /** Either T or U, but not both (mutually exclusive) */
5490
+ type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4782
5491
  type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4783
5492
  | {
4784
5493
  text: string | string[];
@@ -5071,10 +5780,12 @@ declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5071
5780
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5072
5781
  }
5073
5782
  interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5074
- /**
5075
- * Base64 encoded value of the audio data.
5076
- */
5077
- audio: string;
5783
+ audio:
5784
+ | string
5785
+ | {
5786
+ body?: object;
5787
+ contentType?: string;
5788
+ };
5078
5789
  /**
5079
5790
  * Supported tasks are 'translate' or 'transcribe'.
5080
5791
  */
@@ -5092,9 +5803,33 @@ interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5092
5803
  */
5093
5804
  initial_prompt?: string;
5094
5805
  /**
5095
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5806
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5096
5807
  */
5097
5808
  prefix?: string;
5809
+ /**
5810
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5811
+ */
5812
+ beam_size?: number;
5813
+ /**
5814
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5815
+ */
5816
+ condition_on_previous_text?: boolean;
5817
+ /**
5818
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5819
+ */
5820
+ no_speech_threshold?: number;
5821
+ /**
5822
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5823
+ */
5824
+ compression_ratio_threshold?: number;
5825
+ /**
5826
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5827
+ */
5828
+ log_prob_threshold?: number;
5829
+ /**
5830
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5831
+ */
5832
+ hallucination_silence_threshold?: number;
5098
5833
  }
5099
5834
  interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5100
5835
  transcription_info?: {
@@ -5241,11 +5976,11 @@ interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5241
5976
  truncate_inputs?: boolean;
5242
5977
  }
5243
5978
  type Ai_Cf_Baai_Bge_M3_Output =
5244
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5979
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5245
5980
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5246
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5981
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5247
5982
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5248
- interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5983
+ interface Ai_Cf_Baai_Bge_M3_Output_Query {
5249
5984
  response?: {
5250
5985
  /**
5251
5986
  * Index of the context in the request
@@ -5265,7 +6000,7 @@ interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5265
6000
  */
5266
6001
  pooling?: "mean" | "cls";
5267
6002
  }
5268
- interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
6003
+ interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5269
6004
  shape?: number[];
5270
6005
  /**
5271
6006
  * Embeddings of the requested text values
@@ -5370,7 +6105,7 @@ interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5370
6105
  */
5371
6106
  role?: string;
5372
6107
  /**
5373
- * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
6108
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5374
6109
  */
5375
6110
  tool_call_id?: string;
5376
6111
  content?:
@@ -5625,10 +6360,18 @@ interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5625
6360
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5626
6361
  */
5627
6362
  role: string;
5628
- /**
5629
- * The content of the message as a string.
5630
- */
5631
- content: string;
6363
+ content:
6364
+ | string
6365
+ | {
6366
+ /**
6367
+ * Type of the content (text)
6368
+ */
6369
+ type?: string;
6370
+ /**
6371
+ * Text content
6372
+ */
6373
+ text?: string;
6374
+ }[];
5632
6375
  }[];
5633
6376
  functions?: {
5634
6377
  name: string;
@@ -6284,7 +7027,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
6284
7027
  */
6285
7028
  role?: string;
6286
7029
  /**
6287
- * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
7030
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6288
7031
  */
6289
7032
  tool_call_id?: string;
6290
7033
  content?:
@@ -6411,7 +7154,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
6411
7154
  }
6412
7155
  )[];
6413
7156
  /**
6414
- * JSON schema that should be fulfilled for the response.
7157
+ * JSON schema that should be fufilled for the response.
6415
7158
  */
6416
7159
  guided_json?: object;
6417
7160
  /**
@@ -6685,7 +7428,7 @@ interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6685
7428
  }
6686
7429
  )[];
6687
7430
  /**
6688
- * JSON schema that should be fulfilled for the response.
7431
+ * JSON schema that should be fufilled for the response.
6689
7432
  */
6690
7433
  guided_json?: object;
6691
7434
  /**
@@ -6778,7 +7521,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6778
7521
  */
6779
7522
  prompt: string;
6780
7523
  /**
6781
- * JSON schema that should be fulfilled for the response.
7524
+ * JSON schema that should be fufilled for the response.
6782
7525
  */
6783
7526
  guided_json?: object;
6784
7527
  /**
@@ -6942,7 +7685,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6942
7685
  }
6943
7686
  )[];
6944
7687
  /**
6945
- * JSON schema that should be fulfilled for the response.
7688
+ * JSON schema that should be fufilled for the response.
6946
7689
  */
6947
7690
  guided_json?: object;
6948
7691
  /**
@@ -7223,7 +7966,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7223
7966
  )[];
7224
7967
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7225
7968
  /**
7226
- * JSON schema that should be fulfilled for the response.
7969
+ * JSON schema that should be fufilled for the response.
7227
7970
  */
7228
7971
  guided_json?: object;
7229
7972
  /**
@@ -7462,7 +8205,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7462
8205
  )[];
7463
8206
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7464
8207
  /**
7465
- * JSON schema that should be fulfilled for the response.
8208
+ * JSON schema that should be fufilled for the response.
7466
8209
  */
7467
8210
  guided_json?: object;
7468
8211
  /**
@@ -7627,10 +8370,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7627
8370
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7628
8371
  */
7629
8372
  role: string;
7630
- /**
7631
- * The content of the message as a string.
7632
- */
7633
- content: string;
8373
+ content:
8374
+ | string
8375
+ | {
8376
+ /**
8377
+ * Type of the content (text)
8378
+ */
8379
+ type?: string;
8380
+ /**
8381
+ * Text content
8382
+ */
8383
+ text?: string;
8384
+ }[];
7634
8385
  }[];
7635
8386
  functions?: {
7636
8387
  name: string;
@@ -7842,10 +8593,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7842
8593
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7843
8594
  */
7844
8595
  role: string;
7845
- /**
7846
- * The content of the message as a string.
7847
- */
7848
- content: string;
8596
+ content:
8597
+ | string
8598
+ | {
8599
+ /**
8600
+ * Type of the content (text)
8601
+ */
8602
+ type?: string;
8603
+ /**
8604
+ * Text content
8605
+ */
8606
+ text?: string;
8607
+ }[];
7849
8608
  }[];
7850
8609
  functions?: {
7851
8610
  name: string;
@@ -8413,12 +9172,12 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8413
9172
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8414
9173
  }
8415
9174
  declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8416
- inputs: ResponsesInput;
8417
- postProcessedOutputs: ResponsesOutput;
9175
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9176
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8418
9177
  }
8419
9178
  declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8420
- inputs: ResponsesInput;
8421
- postProcessedOutputs: ResponsesOutput;
9179
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9180
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8422
9181
  }
8423
9182
  interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8424
9183
  /**
@@ -8550,7 +9309,7 @@ interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8550
9309
  */
8551
9310
  text: string | string[];
8552
9311
  /**
8553
- * Target language to translate to
9312
+ * Target langauge to translate to
8554
9313
  */
8555
9314
  target_language:
8556
9315
  | "asm_Beng"
@@ -8666,10 +9425,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8666
9425
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8667
9426
  */
8668
9427
  role: string;
8669
- /**
8670
- * The content of the message as a string.
8671
- */
8672
- content: string;
9428
+ content:
9429
+ | string
9430
+ | {
9431
+ /**
9432
+ * Type of the content (text)
9433
+ */
9434
+ type?: string;
9435
+ /**
9436
+ * Text content
9437
+ */
9438
+ text?: string;
9439
+ }[];
8673
9440
  }[];
8674
9441
  functions?: {
8675
9442
  name: string;
@@ -8881,10 +9648,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8881
9648
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8882
9649
  */
8883
9650
  role: string;
8884
- /**
8885
- * The content of the message as a string.
8886
- */
8887
- content: string;
9651
+ content:
9652
+ | string
9653
+ | {
9654
+ /**
9655
+ * Type of the content (text)
9656
+ */
9657
+ type?: string;
9658
+ /**
9659
+ * Text content
9660
+ */
9661
+ text?: string;
9662
+ }[];
8888
9663
  }[];
8889
9664
  functions?: {
8890
9665
  name: string;
@@ -9439,6 +10214,66 @@ declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9439
10214
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9440
10215
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9441
10216
  }
10217
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
10218
+ multipart: {
10219
+ body?: object;
10220
+ contentType?: string;
10221
+ };
10222
+ }
10223
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
10224
+ /**
10225
+ * Generated image as Base64 string.
10226
+ */
10227
+ image?: string;
10228
+ }
10229
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
10230
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
10231
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
10232
+ }
10233
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
10234
+ multipart: {
10235
+ body?: object;
10236
+ contentType?: string;
10237
+ };
10238
+ }
10239
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
10240
+ /**
10241
+ * Generated image as Base64 string.
10242
+ */
10243
+ image?: string;
10244
+ }
10245
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
10246
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
10247
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
10248
+ }
10249
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
10250
+ multipart: {
10251
+ body?: object;
10252
+ contentType?: string;
10253
+ };
10254
+ }
10255
+ interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
10256
+ /**
10257
+ * Generated image as Base64 string.
10258
+ */
10259
+ image?: string;
10260
+ }
10261
+ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
10262
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
10263
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
10264
+ }
10265
+ declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
10266
+ inputs: ChatCompletionsInput;
10267
+ postProcessedOutputs: ChatCompletionsOutput;
10268
+ }
10269
+ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
10270
+ inputs: ChatCompletionsInput;
10271
+ postProcessedOutputs: ChatCompletionsOutput;
10272
+ }
10273
+ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
10274
+ inputs: ChatCompletionsInput;
10275
+ postProcessedOutputs: ChatCompletionsOutput;
10276
+ }
9442
10277
  interface AiModels {
9443
10278
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9444
10279
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9457,7 +10292,6 @@ interface AiModels {
9457
10292
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9458
10293
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9459
10294
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9460
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9461
10295
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9462
10296
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9463
10297
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9524,6 +10358,12 @@ interface AiModels {
9524
10358
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9525
10359
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9526
10360
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10361
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10362
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10363
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10364
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10365
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10366
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9527
10367
  }
9528
10368
  type AiOptions = {
9529
10369
  /**
@@ -9549,6 +10389,7 @@ type AiOptions = {
9549
10389
  returnRawResponse?: boolean;
9550
10390
  prefix?: string;
9551
10391
  extraHeaders?: object;
10392
+ signal?: AbortSignal;
9552
10393
  };
9553
10394
  type AiModelsSearchParams = {
9554
10395
  author?: string;
@@ -9575,6 +10416,16 @@ type AiModelsSearchObject = {
9575
10416
  value: string;
9576
10417
  }[];
9577
10418
  };
10419
+ type ChatCompletionsBase = XOR<
10420
+ ChatCompletionsPromptInput,
10421
+ ChatCompletionsMessagesInput
10422
+ >;
10423
+ type ChatCompletionsInput = XOR<
10424
+ ChatCompletionsBase,
10425
+ {
10426
+ requests: ChatCompletionsBase[];
10427
+ }
10428
+ >;
9578
10429
  interface InferenceUpstreamError extends Error {}
9579
10430
  interface AiInternalError extends Error {}
9580
10431
  type AiModelListType = Record<string, any>;
@@ -9582,46 +10433,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
9582
10433
  aiGatewayLogId: string | null;
9583
10434
  gateway(gatewayId: string): AiGateway;
9584
10435
  /**
9585
- * Access the AI Search API for managing AI-powered search instances.
9586
- *
9587
- * This is the new API that replaces AutoRAG with better namespace separation:
9588
- * - Account-level operations: `list()`, `create()`
9589
- * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
9590
- *
9591
- * @example
9592
- * ```typescript
9593
- * // List all AI Search instances
9594
- * const instances = await env.AI.aiSearch.list();
9595
- *
9596
- * // Search an instance
9597
- * const results = await env.AI.aiSearch.get('my-search').search({
9598
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9599
- * ai_search_options: {
9600
- * retrieval: { max_num_results: 10 }
9601
- * }
9602
- * });
9603
- *
9604
- * // Generate chat completions with AI Search context
9605
- * const response = await env.AI.aiSearch.get('my-search').chatCompletions({
9606
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9607
- * model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
9608
- * });
9609
- * ```
10436
+ * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10437
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9610
10438
  */
9611
- aiSearch(): AiSearchAccountService;
10439
+ aiSearch(): AiSearchNamespace;
9612
10440
  /**
9613
10441
  * @deprecated AutoRAG has been replaced by AI Search.
9614
- * Use `env.AI.aiSearch` instead for better API design and new features.
9615
- *
9616
- * Migration guide:
9617
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9618
- * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
9619
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
10442
+ * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10443
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9620
10444
  *
9621
- * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
9622
- *
9623
- * @see AiSearchAccountService
9624
- * @param autoragId Optional instance ID (omit for account-level operations)
10445
+ * @param autoragId Instance ID
9625
10446
  */
9626
10447
  autorag(autoragId: string): AutoRAG;
9627
10448
  run<
@@ -9780,22 +10601,23 @@ declare abstract class AiGateway {
9780
10601
  getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
9781
10602
  }
9782
10603
  /**
9783
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
9784
- * @see AiSearchInternalError
10604
+ * @deprecated Use the standalone AI Search Workers binding instead.
10605
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9785
10606
  */
9786
10607
  interface AutoRAGInternalError extends Error {}
9787
10608
  /**
9788
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
9789
- * @see AiSearchNotFoundError
10609
+ * @deprecated Use the standalone AI Search Workers binding instead.
10610
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9790
10611
  */
9791
10612
  interface AutoRAGNotFoundError extends Error {}
9792
10613
  /**
9793
- * @deprecated This error type is no longer used in the AI Search API.
10614
+ * @deprecated Use the standalone AI Search Workers binding instead.
10615
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9794
10616
  */
9795
10617
  interface AutoRAGUnauthorizedError extends Error {}
9796
10618
  /**
9797
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
9798
- * @see AiSearchNameNotSetError
10619
+ * @deprecated Use the standalone AI Search Workers binding instead.
10620
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9799
10621
  */
9800
10622
  interface AutoRAGNameNotSetError extends Error {}
9801
10623
  type ComparisonFilter = {
@@ -9808,9 +10630,8 @@ type CompoundFilter = {
9808
10630
  filters: ComparisonFilter[];
9809
10631
  };
9810
10632
  /**
9811
- * @deprecated AutoRAG has been replaced by AI Search.
9812
- * Use AiSearchSearchRequest with the new API instead.
9813
- * @see AiSearchSearchRequest
10633
+ * @deprecated Use the standalone AI Search Workers binding instead.
10634
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9814
10635
  */
9815
10636
  type AutoRagSearchRequest = {
9816
10637
  query: string;
@@ -9827,18 +10648,16 @@ type AutoRagSearchRequest = {
9827
10648
  rewrite_query?: boolean;
9828
10649
  };
9829
10650
  /**
9830
- * @deprecated AutoRAG has been replaced by AI Search.
9831
- * Use AiSearchChatCompletionsRequest with the new API instead.
9832
- * @see AiSearchChatCompletionsRequest
10651
+ * @deprecated Use the standalone AI Search Workers binding instead.
10652
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9833
10653
  */
9834
10654
  type AutoRagAiSearchRequest = AutoRagSearchRequest & {
9835
10655
  stream?: boolean;
9836
10656
  system_prompt?: string;
9837
10657
  };
9838
10658
  /**
9839
- * @deprecated AutoRAG has been replaced by AI Search.
9840
- * Use AiSearchChatCompletionsRequest with stream: true instead.
9841
- * @see AiSearchChatCompletionsRequest
10659
+ * @deprecated Use the standalone AI Search Workers binding instead.
10660
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9842
10661
  */
9843
10662
  type AutoRagAiSearchRequestStreaming = Omit<
9844
10663
  AutoRagAiSearchRequest,
@@ -9847,9 +10666,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
9847
10666
  stream: true;
9848
10667
  };
9849
10668
  /**
9850
- * @deprecated AutoRAG has been replaced by AI Search.
9851
- * Use AiSearchSearchResponse with the new API instead.
9852
- * @see AiSearchSearchResponse
10669
+ * @deprecated Use the standalone AI Search Workers binding instead.
10670
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9853
10671
  */
9854
10672
  type AutoRagSearchResponse = {
9855
10673
  object: "vector_store.search_results.page";
@@ -9868,9 +10686,8 @@ type AutoRagSearchResponse = {
9868
10686
  next_page: string | null;
9869
10687
  };
9870
10688
  /**
9871
- * @deprecated AutoRAG has been replaced by AI Search.
9872
- * Use AiSearchListResponse with the new API instead.
9873
- * @see AiSearchListResponse
10689
+ * @deprecated Use the standalone AI Search Workers binding instead.
10690
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9874
10691
  */
9875
10692
  type AutoRagListResponse = {
9876
10693
  id: string;
@@ -9882,49 +10699,40 @@ type AutoRagListResponse = {
9882
10699
  status: string;
9883
10700
  }[];
9884
10701
  /**
9885
- * @deprecated AutoRAG has been replaced by AI Search.
9886
- * The new API returns different response formats for chat completions.
10702
+ * @deprecated Use the standalone AI Search Workers binding instead.
10703
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9887
10704
  */
9888
10705
  type AutoRagAiSearchResponse = AutoRagSearchResponse & {
9889
10706
  response: string;
9890
10707
  };
9891
10708
  /**
9892
- * @deprecated AutoRAG has been replaced by AI Search.
9893
- * Use the new AI Search API instead: `env.AI.aiSearch`
9894
- *
9895
- * Migration guide:
9896
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9897
- * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
9898
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
9899
- *
9900
- * @see AiSearchAccountService
9901
- * @see AiSearchInstanceService
10709
+ * @deprecated Use the standalone AI Search Workers binding instead.
10710
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9902
10711
  */
9903
10712
  declare abstract class AutoRAG {
9904
10713
  /**
9905
- * @deprecated Use `env.AI.aiSearch.list()` instead.
9906
- * @see AiSearchAccountService.list
10714
+ * @deprecated Use the standalone AI Search Workers binding instead.
10715
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9907
10716
  */
9908
10717
  list(): Promise<AutoRagListResponse>;
9909
10718
  /**
9910
- * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
9911
- * Note: The new API uses a messages array instead of a query string.
9912
- * @see AiSearchInstanceService.search
10719
+ * @deprecated Use the standalone AI Search Workers binding instead.
10720
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9913
10721
  */
9914
10722
  search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
9915
10723
  /**
9916
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9917
- * @see AiSearchInstanceService.chatCompletions
10724
+ * @deprecated Use the standalone AI Search Workers binding instead.
10725
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9918
10726
  */
9919
10727
  aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
9920
10728
  /**
9921
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9922
- * @see AiSearchInstanceService.chatCompletions
10729
+ * @deprecated Use the standalone AI Search Workers binding instead.
10730
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9923
10731
  */
9924
10732
  aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
9925
10733
  /**
9926
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9927
- * @see AiSearchInstanceService.chatCompletions
10734
+ * @deprecated Use the standalone AI Search Workers binding instead.
10735
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9928
10736
  */
9929
10737
  aiSearch(
9930
10738
  params: AutoRagAiSearchRequest,
@@ -10049,6 +10857,41 @@ interface RequestInitCfProperties extends Record<string, unknown> {
10049
10857
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
10050
10858
  */
10051
10859
  cacheTtlByStatus?: Record<string, number>;
10860
+ /**
10861
+ * Explicit Cache-Control header value to set on the response stored in cache.
10862
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10863
+ *
10864
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10865
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10866
+ *
10867
+ * Can be used together with `cacheTtlByStatus`.
10868
+ */
10869
+ cacheControl?: string;
10870
+ /**
10871
+ * Whether the response should be eligible for Cache Reserve storage.
10872
+ */
10873
+ cacheReserveEligible?: boolean;
10874
+ /**
10875
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10876
+ */
10877
+ respectStrongEtag?: boolean;
10878
+ /**
10879
+ * Whether to strip ETag headers from the origin response before caching.
10880
+ */
10881
+ stripEtags?: boolean;
10882
+ /**
10883
+ * Whether to strip Last-Modified headers from the origin response before caching.
10884
+ */
10885
+ stripLastModified?: boolean;
10886
+ /**
10887
+ * Whether to enable Cache Deception Armor, which protects against web cache
10888
+ * deception attacks by verifying the Content-Type matches the URL extension.
10889
+ */
10890
+ cacheDeceptionArmor?: boolean;
10891
+ /**
10892
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10893
+ */
10894
+ cacheReserveMinimumFileSize?: number;
10052
10895
  scrapeShield?: boolean;
10053
10896
  apps?: boolean;
10054
10897
  image?: RequestInitCfPropertiesImage;
@@ -11961,6 +12804,7 @@ declare namespace CloudflareWorkersModule {
11961
12804
  constructor(ctx: ExecutionContext, env: Env);
11962
12805
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11963
12806
  fetch?(request: Request): Response | Promise<Response>;
12807
+ connect?(socket: Socket): void | Promise<void>;
11964
12808
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11965
12809
  scheduled?(controller: ScheduledController): void | Promise<void>;
11966
12810
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11981,6 +12825,7 @@ declare namespace CloudflareWorkersModule {
11981
12825
  constructor(ctx: DurableObjectState, env: Env);
11982
12826
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11983
12827
  fetch?(request: Request): Response | Promise<Response>;
12828
+ connect?(socket: Socket): void | Promise<void>;
11984
12829
  webSocketMessage?(
11985
12830
  ws: WebSocket,
11986
12831
  message: string | ArrayBuffer,
@@ -12131,17 +12976,6 @@ interface StreamBinding {
12131
12976
  * @returns A handle for per-video operations.
12132
12977
  */
12133
12978
  video(id: string): StreamVideoHandle;
12134
- /**
12135
- * Uploads a new video from a File.
12136
- * @param file The video file to upload.
12137
- * @returns The uploaded video details.
12138
- * @throws {BadRequestError} if the upload parameter is invalid
12139
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12140
- * @throws {MaxFileSizeError} if the file size is too large
12141
- * @throws {RateLimitedError} if the server received too many requests
12142
- * @throws {InternalError} if an unexpected error occurs
12143
- */
12144
- upload(file: File): Promise<StreamVideo>;
12145
12979
  /**
12146
12980
  * Uploads a new video from a provided URL.
12147
12981
  * @param url The URL to upload from.
@@ -12991,6 +13825,9 @@ declare namespace TailStream {
12991
13825
  readonly type: "fetch";
12992
13826
  readonly statusCode: number;
12993
13827
  }
13828
+ interface ConnectEventInfo {
13829
+ readonly type: "connect";
13830
+ }
12994
13831
  type EventOutcome =
12995
13832
  | "ok"
12996
13833
  | "canceled"
@@ -13021,6 +13858,7 @@ declare namespace TailStream {
13021
13858
  readonly scriptVersion?: ScriptVersion;
13022
13859
  readonly info:
13023
13860
  | FetchEventInfo
13861
+ | ConnectEventInfo
13024
13862
  | JsRpcEventInfo
13025
13863
  | ScheduledEventInfo
13026
13864
  | AlarmEventInfo