@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.
@@ -488,6 +488,11 @@ export type ExportedHandlerFetchHandler<
488
488
  env: Env,
489
489
  ctx: ExecutionContext<Props>,
490
490
  ) => Response | Promise<Response>;
491
+ export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
492
+ socket: Socket,
493
+ env: Env,
494
+ ctx: ExecutionContext<Props>,
495
+ ) => void | Promise<void>;
491
496
  export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
492
497
  events: TraceItem[],
493
498
  env: Env,
@@ -529,6 +534,7 @@ export interface ExportedHandler<
529
534
  Props = unknown,
530
535
  > {
531
536
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
537
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
532
538
  tail?: ExportedHandlerTailHandler<Env, Props>;
533
539
  trace?: ExportedHandlerTraceHandler<Env, Props>;
534
540
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -548,12 +554,14 @@ export declare abstract class Navigator {
548
554
  export interface AlarmInvocationInfo {
549
555
  readonly isRetry: boolean;
550
556
  readonly retryCount: number;
557
+ readonly scheduledTime: number;
551
558
  }
552
559
  export interface Cloudflare {
553
560
  readonly compatibilityFlags: Record<string, boolean>;
554
561
  }
555
562
  export interface DurableObject {
556
563
  fetch(request: Request): Response | Promise<Response>;
564
+ connect?(socket: Socket): void | Promise<void>;
557
565
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
558
566
  webSocketMessage?(
559
567
  ws: WebSocket,
@@ -571,7 +579,7 @@ export type DurableObjectStub<
571
579
  T extends Rpc.DurableObjectBranded | undefined = undefined,
572
580
  > = Fetcher<
573
581
  T,
574
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
582
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
575
583
  > & {
576
584
  readonly id: DurableObjectId;
577
585
  readonly name?: string;
@@ -580,6 +588,7 @@ export interface DurableObjectId {
580
588
  toString(): string;
581
589
  equals(other: DurableObjectId): boolean;
582
590
  readonly name?: string;
591
+ readonly jurisdiction?: string;
583
592
  }
584
593
  export declare abstract class DurableObjectNamespace<
585
594
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3094,6 +3103,11 @@ export interface QueuingStrategyInit {
3094
3103
  */
3095
3104
  highWaterMark: number;
3096
3105
  }
3106
+ export interface TracePreviewInfo {
3107
+ id: string;
3108
+ slug: string;
3109
+ name: string;
3110
+ }
3097
3111
  export interface ScriptVersion {
3098
3112
  id?: string;
3099
3113
  tag?: string;
@@ -3108,6 +3122,7 @@ export interface TraceItem {
3108
3122
  | (
3109
3123
  | TraceItemFetchEventInfo
3110
3124
  | TraceItemJsRpcEventInfo
3125
+ | TraceItemConnectEventInfo
3111
3126
  | TraceItemScheduledEventInfo
3112
3127
  | TraceItemAlarmEventInfo
3113
3128
  | TraceItemQueueEventInfo
@@ -3126,6 +3141,8 @@ export interface TraceItem {
3126
3141
  readonly scriptVersion?: ScriptVersion;
3127
3142
  readonly dispatchNamespace?: string;
3128
3143
  readonly scriptTags?: string[];
3144
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3145
+ readonly preview?: TracePreviewInfo;
3129
3146
  readonly durableObjectId?: string;
3130
3147
  readonly outcome: string;
3131
3148
  readonly executionModel: string;
@@ -3136,6 +3153,7 @@ export interface TraceItem {
3136
3153
  export interface TraceItemAlarmEventInfo {
3137
3154
  readonly scheduledTime: Date;
3138
3155
  }
3156
+ export interface TraceItemConnectEventInfo {}
3139
3157
  export interface TraceItemCustomEventInfo {}
3140
3158
  export interface TraceItemScheduledEventInfo {
3141
3159
  readonly scheduledTime: number;
@@ -3756,7 +3774,7 @@ export interface ContainerStartupOptions {
3756
3774
  entrypoint?: string[];
3757
3775
  enableInternet: boolean;
3758
3776
  env?: Record<string, string>;
3759
- hardTimeout?: number | bigint;
3777
+ labels?: Record<string, string>;
3760
3778
  }
3761
3779
  /**
3762
3780
  * 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.
@@ -3883,11 +3901,10 @@ export declare abstract class Performance {
3883
3901
  */
3884
3902
  toJSON(): object;
3885
3903
  }
3886
- // AI Search V2 API Error Interfaces
3904
+ // ============ AI Search Error Interfaces ============
3887
3905
  export interface AiSearchInternalError extends Error {}
3888
3906
  export interface AiSearchNotFoundError extends Error {}
3889
- export interface AiSearchNameNotSetError extends Error {}
3890
- // AI Search V2 Request Types
3907
+ // ============ AI Search Request Types ============
3891
3908
  export type AiSearchSearchRequest = {
3892
3909
  messages: Array<{
3893
3910
  role: "system" | "developer" | "user" | "assistant" | "tool";
@@ -3912,9 +3929,8 @@ export type AiSearchSearchRequest = {
3912
3929
  [key: string]: unknown;
3913
3930
  };
3914
3931
  reranking?: {
3915
- /** Enable reranking (default false) */
3916
3932
  enabled?: boolean;
3917
- model?: "@cf/baai/bge-reranker-base" | "";
3933
+ model?: "@cf/baai/bge-reranker-base" | string;
3918
3934
  /** Match threshold (0-1, default 0.4) */
3919
3935
  match_threshold?: number;
3920
3936
  [key: string]: unknown;
@@ -3926,6 +3942,7 @@ export type AiSearchChatCompletionsRequest = {
3926
3942
  messages: Array<{
3927
3943
  role: "system" | "developer" | "user" | "assistant" | "tool";
3928
3944
  content: string | null;
3945
+ [key: string]: unknown;
3929
3946
  }>;
3930
3947
  model?: string;
3931
3948
  stream?: boolean;
@@ -3946,7 +3963,7 @@ export type AiSearchChatCompletionsRequest = {
3946
3963
  };
3947
3964
  reranking?: {
3948
3965
  enabled?: boolean;
3949
- model?: "@cf/baai/bge-reranker-base" | "";
3966
+ model?: "@cf/baai/bge-reranker-base" | string;
3950
3967
  match_threshold?: number;
3951
3968
  [key: string]: unknown;
3952
3969
  };
@@ -3954,7 +3971,7 @@ export type AiSearchChatCompletionsRequest = {
3954
3971
  };
3955
3972
  [key: string]: unknown;
3956
3973
  };
3957
- // AI Search V2 Response Types
3974
+ // ============ AI Search Response Types ============
3958
3975
  export type AiSearchSearchResponse = {
3959
3976
  search_query: string;
3960
3977
  chunks: Array<{
@@ -3973,26 +3990,65 @@ export type AiSearchSearchResponse = {
3973
3990
  keyword_score?: number;
3974
3991
  /** Vector similarity score (0-1) */
3975
3992
  vector_score?: number;
3993
+ [key: string]: unknown;
3994
+ };
3995
+ }>;
3996
+ };
3997
+ export type AiSearchChatCompletionsResponse = {
3998
+ id?: string;
3999
+ object?: string;
4000
+ model?: string;
4001
+ choices: Array<{
4002
+ index?: number;
4003
+ message: {
4004
+ role: "system" | "developer" | "user" | "assistant" | "tool";
4005
+ content: string | null;
4006
+ [key: string]: unknown;
3976
4007
  };
4008
+ [key: string]: unknown;
3977
4009
  }>;
4010
+ chunks: AiSearchSearchResponse["chunks"];
4011
+ [key: string]: unknown;
3978
4012
  };
3979
- export type AiSearchListResponse = Array<{
4013
+ export type AiSearchStatsResponse = {
4014
+ queued?: number;
4015
+ running?: number;
4016
+ completed?: number;
4017
+ error?: number;
4018
+ skipped?: number;
4019
+ outdated?: number;
4020
+ last_activity?: string;
4021
+ };
4022
+ // ============ AI Search Instance Info Types ============
4023
+ export type AiSearchInstanceInfo = {
3980
4024
  id: string;
3981
- internal_id?: string;
3982
- account_id?: string;
3983
- account_tag?: string;
3984
- /** Whether the instance is enabled (default true) */
3985
- enable?: boolean;
3986
- type?: "r2" | "web-crawler";
4025
+ type?: "r2" | "web-crawler" | string;
3987
4026
  source?: string;
4027
+ paused?: boolean;
4028
+ status?: string;
4029
+ namespace?: string;
4030
+ created_at?: string;
4031
+ modified_at?: string;
3988
4032
  [key: string]: unknown;
3989
- }>;
4033
+ };
4034
+ export type AiSearchListResponse = {
4035
+ result: AiSearchInstanceInfo[];
4036
+ result_info?: {
4037
+ count: number;
4038
+ page: number;
4039
+ per_page: number;
4040
+ total_count: number;
4041
+ };
4042
+ };
4043
+ // ============ AI Search Config Types ============
3990
4044
  export type AiSearchConfig = {
3991
4045
  /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
3992
4046
  id: string;
3993
- type: "r2" | "web-crawler";
3994
- source: string;
3995
- source_params?: object;
4047
+ /** Instance type. Omit to create with built-in storage. */
4048
+ type?: "r2" | "web-crawler" | string;
4049
+ /** Source URL (required for web-crawler type). */
4050
+ source?: string;
4051
+ source_params?: unknown;
3996
4052
  /** Token ID (UUID format) */
3997
4053
  token_id?: string;
3998
4054
  ai_gateway_id?: string;
@@ -4002,54 +4058,307 @@ export type AiSearchConfig = {
4002
4058
  reranking?: boolean;
4003
4059
  embedding_model?: string;
4004
4060
  ai_search_model?: string;
4061
+ [key: string]: unknown;
4005
4062
  };
4006
- export type AiSearchInstance = {
4063
+ // ============ AI Search Item Types ============
4064
+ export type AiSearchItemInfo = {
4007
4065
  id: string;
4008
- enable?: boolean;
4009
- type?: "r2" | "web-crawler";
4010
- source?: string;
4066
+ key: string;
4067
+ status:
4068
+ | "completed"
4069
+ | "error"
4070
+ | "skipped"
4071
+ | "queued"
4072
+ | "processing"
4073
+ | "outdated";
4074
+ metadata?: Record<string, unknown>;
4011
4075
  [key: string]: unknown;
4012
4076
  };
4013
- // AI Search Instance Service - Instance-level operations
4014
- export declare abstract class AiSearchInstanceService {
4077
+ export type AiSearchItemContentResult = {
4078
+ body: ReadableStream;
4079
+ contentType: string;
4080
+ filename: string;
4081
+ size: number;
4082
+ };
4083
+ export type AiSearchUploadItemOptions = {
4084
+ metadata?: Record<string, unknown>;
4085
+ };
4086
+ export type AiSearchListItemsParams = {
4087
+ page?: number;
4088
+ per_page?: number;
4089
+ };
4090
+ export type AiSearchListItemsResponse = {
4091
+ result: AiSearchItemInfo[];
4092
+ result_info?: {
4093
+ count: number;
4094
+ page: number;
4095
+ per_page: number;
4096
+ total_count: number;
4097
+ };
4098
+ };
4099
+ // ============ AI Search Job Types ============
4100
+ export type AiSearchJobInfo = {
4101
+ id: string;
4102
+ source: "user" | "schedule";
4103
+ description?: string;
4104
+ last_seen_at?: string;
4105
+ started_at?: string;
4106
+ ended_at?: string;
4107
+ end_reason?: string;
4108
+ };
4109
+ export type AiSearchJobLog = {
4110
+ id: number;
4111
+ message: string;
4112
+ message_type: number;
4113
+ created_at: number;
4114
+ };
4115
+ export type AiSearchCreateJobParams = {
4116
+ description?: string;
4117
+ };
4118
+ export type AiSearchListJobsParams = {
4119
+ page?: number;
4120
+ per_page?: number;
4121
+ };
4122
+ export type AiSearchListJobsResponse = {
4123
+ result: AiSearchJobInfo[];
4124
+ result_info?: {
4125
+ count: number;
4126
+ page: number;
4127
+ per_page: number;
4128
+ total_count: number;
4129
+ };
4130
+ };
4131
+ export type AiSearchJobLogsParams = {
4132
+ page?: number;
4133
+ per_page?: number;
4134
+ };
4135
+ export type AiSearchJobLogsResponse = {
4136
+ result: AiSearchJobLog[];
4137
+ result_info?: {
4138
+ count: number;
4139
+ page: number;
4140
+ per_page: number;
4141
+ total_count: number;
4142
+ };
4143
+ };
4144
+ // ============ AI Search Sub-Service Classes ============
4145
+ /**
4146
+ * Single item service for an AI Search instance.
4147
+ * Provides info, delete, and download operations on a specific item.
4148
+ */
4149
+ export declare abstract class AiSearchItem {
4150
+ /** Get metadata about this item. */
4151
+ info(): Promise<AiSearchItemInfo>;
4152
+ /**
4153
+ * Download the item's content.
4154
+ * @returns Object with body stream, content type, filename, and size.
4155
+ */
4156
+ download(): Promise<AiSearchItemContentResult>;
4157
+ }
4158
+ /**
4159
+ * Items collection service for an AI Search instance.
4160
+ * Provides list, upload, and access to individual items.
4161
+ */
4162
+ export declare abstract class AiSearchItems {
4163
+ /** List items in this instance. */
4164
+ list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
4165
+ /**
4166
+ * Upload a file as an item.
4167
+ * @param name Filename for the uploaded item.
4168
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4169
+ * @param options Optional metadata to attach to the item.
4170
+ * @returns The created item info.
4171
+ */
4172
+ upload(
4173
+ name: string,
4174
+ content: ReadableStream | ArrayBuffer | string,
4175
+ options?: AiSearchUploadItemOptions,
4176
+ ): Promise<AiSearchItemInfo>;
4177
+ /**
4178
+ * Upload a file and poll until processing completes.
4179
+ * @param name Filename for the uploaded item.
4180
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4181
+ * @param options Optional metadata to attach to the item.
4182
+ * @returns The item info after processing completes (or timeout).
4183
+ */
4184
+ uploadAndPoll(
4185
+ name: string,
4186
+ content: ReadableStream | ArrayBuffer | string,
4187
+ options?: AiSearchUploadItemOptions,
4188
+ ): Promise<AiSearchItemInfo>;
4189
+ /**
4190
+ * Get an item by ID.
4191
+ * @param itemId The item identifier.
4192
+ * @returns Item service for info, delete, and download operations.
4193
+ */
4194
+ get(itemId: string): AiSearchItem;
4195
+ /** Delete this item from the instance.
4196
+ * @param itemId The item identifier.
4197
+ */
4198
+ delete(itemId: string): Promise<void>;
4199
+ }
4200
+ /**
4201
+ * Single job service for an AI Search instance.
4202
+ * Provides info and logs for a specific job.
4203
+ */
4204
+ export declare abstract class AiSearchJob {
4205
+ /** Get metadata about this job. */
4206
+ info(): Promise<AiSearchJobInfo>;
4207
+ /** Get logs for this job. */
4208
+ logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
4209
+ }
4210
+ /**
4211
+ * Jobs collection service for an AI Search instance.
4212
+ * Provides list, create, and access to individual jobs.
4213
+ */
4214
+ export declare abstract class AiSearchJobs {
4215
+ /** List jobs for this instance. */
4216
+ list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
4217
+ /**
4218
+ * Create a new indexing job.
4219
+ * @param params Optional job parameters.
4220
+ * @returns The created job info.
4221
+ */
4222
+ create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
4223
+ /**
4224
+ * Get a job by ID.
4225
+ * @param jobId The job identifier.
4226
+ * @returns Job service for info and logs operations.
4227
+ */
4228
+ get(jobId: string): AiSearchJob;
4229
+ }
4230
+ // ============ AI Search Binding Classes ============
4231
+ /**
4232
+ * Instance-level AI Search service.
4233
+ *
4234
+ * Used as:
4235
+ * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
4236
+ * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
4237
+ *
4238
+ * Provides search, chat, update, stats, items, and jobs operations.
4239
+ *
4240
+ * @example
4241
+ * ```ts
4242
+ * // Via namespace binding
4243
+ * const instance = env.AI_SEARCH.get("blog");
4244
+ * const results = await instance.search({
4245
+ * messages: [{ role: "user", content: "How does caching work?" }],
4246
+ * });
4247
+ *
4248
+ * // Via single instance binding
4249
+ * const results = await env.BLOG_SEARCH.search({
4250
+ * messages: [{ role: "user", content: "How does caching work?" }],
4251
+ * });
4252
+ * ```
4253
+ */
4254
+ export declare abstract class AiSearchInstance {
4015
4255
  /**
4016
4256
  * Search the AI Search instance for relevant chunks.
4017
- * @param params Search request with messages and AI search options
4018
- * @returns Search response with matching chunks
4257
+ * @param params Search request with messages and optional AI search options.
4258
+ * @returns Search response with matching chunks and search query.
4019
4259
  */
4020
4260
  search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
4261
+ /**
4262
+ * Generate chat completions with AI Search context (streaming).
4263
+ * @param params Chat completions request with stream: true.
4264
+ * @returns ReadableStream of server-sent events.
4265
+ */
4266
+ chatCompletions(
4267
+ params: AiSearchChatCompletionsRequest & {
4268
+ stream: true;
4269
+ },
4270
+ ): Promise<ReadableStream>;
4021
4271
  /**
4022
4272
  * Generate chat completions with AI Search context.
4023
- * @param params Chat completions request with optional streaming
4024
- * @returns Response object (if streaming) or chat completion result
4273
+ * @param params Chat completions request.
4274
+ * @returns Chat completion response with choices and RAG chunks.
4025
4275
  */
4026
4276
  chatCompletions(
4027
4277
  params: AiSearchChatCompletionsRequest,
4028
- ): Promise<Response | object>;
4278
+ ): Promise<AiSearchChatCompletionsResponse>;
4029
4279
  /**
4030
- * Delete this AI Search instance.
4280
+ * Update the instance configuration.
4281
+ * @param config Partial configuration to update.
4282
+ * @returns Updated instance info.
4031
4283
  */
4032
- delete(): Promise<void>;
4284
+ update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
4285
+ /** Get metadata about this instance. */
4286
+ info(): Promise<AiSearchInstanceInfo>;
4287
+ /**
4288
+ * Get instance statistics (item count, indexing status, etc.).
4289
+ * @returns Statistics with counts per status and last activity time.
4290
+ */
4291
+ stats(): Promise<AiSearchStatsResponse>;
4292
+ /** Items collection — list, upload, and manage items in this instance. */
4293
+ get items(): AiSearchItems;
4294
+ /** Jobs collection — list, create, and inspect indexing jobs. */
4295
+ get jobs(): AiSearchJobs;
4033
4296
  }
4034
- // AI Search Account Service - Account-level operations
4035
- export declare abstract class AiSearchAccountService {
4297
+ /**
4298
+ * Namespace-level AI Search service.
4299
+ *
4300
+ * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
4301
+ * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
4302
+ *
4303
+ * @example
4304
+ * ```ts
4305
+ * // Access an instance within the namespace
4306
+ * const blog = env.AI_SEARCH.get("blog");
4307
+ * const results = await blog.search({
4308
+ * messages: [{ role: "user", content: "How does caching work?" }],
4309
+ * });
4310
+ *
4311
+ * // List all instances in the namespace
4312
+ * const instances = await env.AI_SEARCH.list();
4313
+ *
4314
+ * // Create a new instance with built-in storage
4315
+ * const tenant = await env.AI_SEARCH.create({
4316
+ * id: "tenant-123",
4317
+ * });
4318
+ *
4319
+ * // Upload items into the instance
4320
+ * await tenant.items.upload("doc.pdf", fileContent);
4321
+ *
4322
+ * // Delete an instance
4323
+ * await env.AI_SEARCH.delete("tenant-123");
4324
+ * ```
4325
+ */
4326
+ export declare abstract class AiSearchNamespace {
4036
4327
  /**
4037
- * List all AI Search instances in the account.
4038
- * @returns Array of AI Search instances
4328
+ * Get an instance by name within the bound namespace.
4329
+ * @param name Instance name.
4330
+ * @returns Instance service for search, chat, update, stats, items, and jobs.
4331
+ */
4332
+ get(name: string): AiSearchInstance;
4333
+ /**
4334
+ * List all instances in the bound namespace.
4335
+ * @returns Array of instance metadata.
4039
4336
  */
4040
4337
  list(): Promise<AiSearchListResponse>;
4041
4338
  /**
4042
- * Get an AI Search instance by ID.
4043
- * @param name Instance ID
4044
- * @returns Instance service for performing operations
4339
+ * Create a new instance within the bound namespace.
4340
+ * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
4341
+ * @returns Instance service for the newly created instance.
4342
+ *
4343
+ * @example
4344
+ * ```ts
4345
+ * // Create with built-in storage (upload items manually)
4346
+ * const instance = await env.AI_SEARCH.create({ id: "my-search" });
4347
+ *
4348
+ * // Create with web crawler source
4349
+ * const instance = await env.AI_SEARCH.create({
4350
+ * id: "docs-search",
4351
+ * type: "web-crawler",
4352
+ * source: "https://developers.cloudflare.com",
4353
+ * });
4354
+ * ```
4045
4355
  */
4046
- get(name: string): AiSearchInstanceService;
4356
+ create(config: AiSearchConfig): Promise<AiSearchInstance>;
4047
4357
  /**
4048
- * Create a new AI Search instance.
4049
- * @param config Instance configuration
4050
- * @returns Instance service for performing operations
4358
+ * Delete an instance from the bound namespace.
4359
+ * @param name Instance name to delete.
4051
4360
  */
4052
- create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
4361
+ delete(name: string): Promise<void>;
4053
4362
  }
4054
4363
  export type AiImageClassificationInput = {
4055
4364
  image: number[];
@@ -4325,6 +4634,402 @@ export declare abstract class BaseAiTranslation {
4325
4634
  inputs: AiTranslationInput;
4326
4635
  postProcessedOutputs: AiTranslationOutput;
4327
4636
  }
4637
+ /**
4638
+ * Workers AI support for OpenAI's Chat Completions API
4639
+ */
4640
+ export type ChatCompletionContentPartText = {
4641
+ type: "text";
4642
+ text: string;
4643
+ };
4644
+ export type ChatCompletionContentPartImage = {
4645
+ type: "image_url";
4646
+ image_url: {
4647
+ url: string;
4648
+ detail?: "auto" | "low" | "high";
4649
+ };
4650
+ };
4651
+ export type ChatCompletionContentPartInputAudio = {
4652
+ type: "input_audio";
4653
+ input_audio: {
4654
+ /** Base64 encoded audio data. */
4655
+ data: string;
4656
+ format: "wav" | "mp3";
4657
+ };
4658
+ };
4659
+ export type ChatCompletionContentPartFile = {
4660
+ type: "file";
4661
+ file: {
4662
+ /** Base64 encoded file data. */
4663
+ file_data?: string;
4664
+ /** The ID of an uploaded file. */
4665
+ file_id?: string;
4666
+ filename?: string;
4667
+ };
4668
+ };
4669
+ export type ChatCompletionContentPartRefusal = {
4670
+ type: "refusal";
4671
+ refusal: string;
4672
+ };
4673
+ export type ChatCompletionContentPart =
4674
+ | ChatCompletionContentPartText
4675
+ | ChatCompletionContentPartImage
4676
+ | ChatCompletionContentPartInputAudio
4677
+ | ChatCompletionContentPartFile;
4678
+ export type FunctionDefinition = {
4679
+ name: string;
4680
+ description?: string;
4681
+ parameters?: Record<string, unknown>;
4682
+ strict?: boolean | null;
4683
+ };
4684
+ export type ChatCompletionFunctionTool = {
4685
+ type: "function";
4686
+ function: FunctionDefinition;
4687
+ };
4688
+ export type ChatCompletionCustomToolGrammarFormat = {
4689
+ type: "grammar";
4690
+ grammar: {
4691
+ definition: string;
4692
+ syntax: "lark" | "regex";
4693
+ };
4694
+ };
4695
+ export type ChatCompletionCustomToolTextFormat = {
4696
+ type: "text";
4697
+ };
4698
+ export type ChatCompletionCustomToolFormat =
4699
+ | ChatCompletionCustomToolTextFormat
4700
+ | ChatCompletionCustomToolGrammarFormat;
4701
+ export type ChatCompletionCustomTool = {
4702
+ type: "custom";
4703
+ custom: {
4704
+ name: string;
4705
+ description?: string;
4706
+ format?: ChatCompletionCustomToolFormat;
4707
+ };
4708
+ };
4709
+ export type ChatCompletionTool =
4710
+ | ChatCompletionFunctionTool
4711
+ | ChatCompletionCustomTool;
4712
+ export type ChatCompletionMessageFunctionToolCall = {
4713
+ id: string;
4714
+ type: "function";
4715
+ function: {
4716
+ name: string;
4717
+ /** JSON-encoded arguments string. */
4718
+ arguments: string;
4719
+ };
4720
+ };
4721
+ export type ChatCompletionMessageCustomToolCall = {
4722
+ id: string;
4723
+ type: "custom";
4724
+ custom: {
4725
+ name: string;
4726
+ input: string;
4727
+ };
4728
+ };
4729
+ export type ChatCompletionMessageToolCall =
4730
+ | ChatCompletionMessageFunctionToolCall
4731
+ | ChatCompletionMessageCustomToolCall;
4732
+ export type ChatCompletionToolChoiceFunction = {
4733
+ type: "function";
4734
+ function: {
4735
+ name: string;
4736
+ };
4737
+ };
4738
+ export type ChatCompletionToolChoiceCustom = {
4739
+ type: "custom";
4740
+ custom: {
4741
+ name: string;
4742
+ };
4743
+ };
4744
+ export type ChatCompletionToolChoiceAllowedTools = {
4745
+ type: "allowed_tools";
4746
+ allowed_tools: {
4747
+ mode: "auto" | "required";
4748
+ tools: Array<Record<string, unknown>>;
4749
+ };
4750
+ };
4751
+ export type ChatCompletionToolChoiceOption =
4752
+ | "none"
4753
+ | "auto"
4754
+ | "required"
4755
+ | ChatCompletionToolChoiceFunction
4756
+ | ChatCompletionToolChoiceCustom
4757
+ | ChatCompletionToolChoiceAllowedTools;
4758
+ export type DeveloperMessage = {
4759
+ role: "developer";
4760
+ content:
4761
+ | string
4762
+ | Array<{
4763
+ type: "text";
4764
+ text: string;
4765
+ }>;
4766
+ name?: string;
4767
+ };
4768
+ export type SystemMessage = {
4769
+ role: "system";
4770
+ content:
4771
+ | string
4772
+ | Array<{
4773
+ type: "text";
4774
+ text: string;
4775
+ }>;
4776
+ name?: string;
4777
+ };
4778
+ /**
4779
+ * Permissive merged content part used inside UserMessage arrays.
4780
+ *
4781
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4782
+ * inside nested array items does not correctly match different branches for
4783
+ * different array elements, so the schema uses a single merged object.
4784
+ */
4785
+ export type UserMessageContentPart = {
4786
+ type: "text" | "image_url" | "input_audio" | "file";
4787
+ text?: string;
4788
+ image_url?: {
4789
+ url?: string;
4790
+ detail?: "auto" | "low" | "high";
4791
+ };
4792
+ input_audio?: {
4793
+ data?: string;
4794
+ format?: "wav" | "mp3";
4795
+ };
4796
+ file?: {
4797
+ file_data?: string;
4798
+ file_id?: string;
4799
+ filename?: string;
4800
+ };
4801
+ };
4802
+ export type UserMessage = {
4803
+ role: "user";
4804
+ content: string | Array<UserMessageContentPart>;
4805
+ name?: string;
4806
+ };
4807
+ export type AssistantMessageContentPart = {
4808
+ type: "text" | "refusal";
4809
+ text?: string;
4810
+ refusal?: string;
4811
+ };
4812
+ export type AssistantMessage = {
4813
+ role: "assistant";
4814
+ content?: string | null | Array<AssistantMessageContentPart>;
4815
+ refusal?: string | null;
4816
+ name?: string;
4817
+ audio?: {
4818
+ id: string;
4819
+ };
4820
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4821
+ function_call?: {
4822
+ name: string;
4823
+ arguments: string;
4824
+ };
4825
+ };
4826
+ export type ToolMessage = {
4827
+ role: "tool";
4828
+ content:
4829
+ | string
4830
+ | Array<{
4831
+ type: "text";
4832
+ text: string;
4833
+ }>;
4834
+ tool_call_id: string;
4835
+ };
4836
+ export type FunctionMessage = {
4837
+ role: "function";
4838
+ content: string;
4839
+ name: string;
4840
+ };
4841
+ export type ChatCompletionMessageParam =
4842
+ | DeveloperMessage
4843
+ | SystemMessage
4844
+ | UserMessage
4845
+ | AssistantMessage
4846
+ | ToolMessage
4847
+ | FunctionMessage;
4848
+ export type ChatCompletionsResponseFormatText = {
4849
+ type: "text";
4850
+ };
4851
+ export type ChatCompletionsResponseFormatJSONObject = {
4852
+ type: "json_object";
4853
+ };
4854
+ export type ResponseFormatJSONSchema = {
4855
+ type: "json_schema";
4856
+ json_schema: {
4857
+ name: string;
4858
+ description?: string;
4859
+ schema?: Record<string, unknown>;
4860
+ strict?: boolean | null;
4861
+ };
4862
+ };
4863
+ export type ResponseFormat =
4864
+ | ChatCompletionsResponseFormatText
4865
+ | ChatCompletionsResponseFormatJSONObject
4866
+ | ResponseFormatJSONSchema;
4867
+ export type ChatCompletionsStreamOptions = {
4868
+ include_usage?: boolean;
4869
+ include_obfuscation?: boolean;
4870
+ };
4871
+ export type PredictionContent = {
4872
+ type: "content";
4873
+ content:
4874
+ | string
4875
+ | Array<{
4876
+ type: "text";
4877
+ text: string;
4878
+ }>;
4879
+ };
4880
+ export type AudioParams = {
4881
+ voice:
4882
+ | string
4883
+ | {
4884
+ id: string;
4885
+ };
4886
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4887
+ };
4888
+ export type WebSearchUserLocation = {
4889
+ type: "approximate";
4890
+ approximate: {
4891
+ city?: string;
4892
+ country?: string;
4893
+ region?: string;
4894
+ timezone?: string;
4895
+ };
4896
+ };
4897
+ export type WebSearchOptions = {
4898
+ search_context_size?: "low" | "medium" | "high";
4899
+ user_location?: WebSearchUserLocation;
4900
+ };
4901
+ export type ChatTemplateKwargs = {
4902
+ /** Whether to enable reasoning, enabled by default. */
4903
+ enable_thinking?: boolean;
4904
+ /** If false, preserves reasoning context between turns. */
4905
+ clear_thinking?: boolean;
4906
+ };
4907
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4908
+ export type ChatCompletionsCommonOptions = {
4909
+ model?: string;
4910
+ audio?: AudioParams;
4911
+ frequency_penalty?: number | null;
4912
+ logit_bias?: Record<string, unknown> | null;
4913
+ logprobs?: boolean | null;
4914
+ top_logprobs?: number | null;
4915
+ max_tokens?: number | null;
4916
+ max_completion_tokens?: number | null;
4917
+ metadata?: Record<string, unknown> | null;
4918
+ modalities?: Array<"text" | "audio"> | null;
4919
+ n?: number | null;
4920
+ parallel_tool_calls?: boolean;
4921
+ prediction?: PredictionContent;
4922
+ presence_penalty?: number | null;
4923
+ reasoning_effort?: "low" | "medium" | "high" | null;
4924
+ chat_template_kwargs?: ChatTemplateKwargs;
4925
+ response_format?: ResponseFormat;
4926
+ seed?: number | null;
4927
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4928
+ stop?: string | Array<string> | null;
4929
+ store?: boolean | null;
4930
+ stream?: boolean | null;
4931
+ stream_options?: ChatCompletionsStreamOptions;
4932
+ temperature?: number | null;
4933
+ tool_choice?: ChatCompletionToolChoiceOption;
4934
+ tools?: Array<ChatCompletionTool>;
4935
+ top_p?: number | null;
4936
+ user?: string;
4937
+ web_search_options?: WebSearchOptions;
4938
+ function_call?:
4939
+ | "none"
4940
+ | "auto"
4941
+ | {
4942
+ name: string;
4943
+ };
4944
+ functions?: Array<FunctionDefinition>;
4945
+ };
4946
+ export type PromptTokensDetails = {
4947
+ cached_tokens?: number;
4948
+ audio_tokens?: number;
4949
+ };
4950
+ export type CompletionTokensDetails = {
4951
+ reasoning_tokens?: number;
4952
+ audio_tokens?: number;
4953
+ accepted_prediction_tokens?: number;
4954
+ rejected_prediction_tokens?: number;
4955
+ };
4956
+ export type CompletionUsage = {
4957
+ prompt_tokens: number;
4958
+ completion_tokens: number;
4959
+ total_tokens: number;
4960
+ prompt_tokens_details?: PromptTokensDetails;
4961
+ completion_tokens_details?: CompletionTokensDetails;
4962
+ };
4963
+ export type ChatCompletionTopLogprob = {
4964
+ token: string;
4965
+ logprob: number;
4966
+ bytes: Array<number> | null;
4967
+ };
4968
+ export type ChatCompletionTokenLogprob = {
4969
+ token: string;
4970
+ logprob: number;
4971
+ bytes: Array<number> | null;
4972
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4973
+ };
4974
+ export type ChatCompletionAudio = {
4975
+ id: string;
4976
+ /** Base64 encoded audio bytes. */
4977
+ data: string;
4978
+ expires_at: number;
4979
+ transcript: string;
4980
+ };
4981
+ export type ChatCompletionUrlCitation = {
4982
+ type: "url_citation";
4983
+ url_citation: {
4984
+ url: string;
4985
+ title: string;
4986
+ start_index: number;
4987
+ end_index: number;
4988
+ };
4989
+ };
4990
+ export type ChatCompletionResponseMessage = {
4991
+ role: "assistant";
4992
+ content: string | null;
4993
+ refusal: string | null;
4994
+ annotations?: Array<ChatCompletionUrlCitation>;
4995
+ audio?: ChatCompletionAudio;
4996
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4997
+ function_call?: {
4998
+ name: string;
4999
+ arguments: string;
5000
+ } | null;
5001
+ };
5002
+ export type ChatCompletionLogprobs = {
5003
+ content: Array<ChatCompletionTokenLogprob> | null;
5004
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
5005
+ };
5006
+ export type ChatCompletionChoice = {
5007
+ index: number;
5008
+ message: ChatCompletionResponseMessage;
5009
+ finish_reason:
5010
+ | "stop"
5011
+ | "length"
5012
+ | "tool_calls"
5013
+ | "content_filter"
5014
+ | "function_call";
5015
+ logprobs: ChatCompletionLogprobs | null;
5016
+ };
5017
+ export type ChatCompletionsPromptInput = {
5018
+ prompt: string;
5019
+ } & ChatCompletionsCommonOptions;
5020
+ export type ChatCompletionsMessagesInput = {
5021
+ messages: Array<ChatCompletionMessageParam>;
5022
+ } & ChatCompletionsCommonOptions;
5023
+ export type ChatCompletionsOutput = {
5024
+ id: string;
5025
+ object: string;
5026
+ created: number;
5027
+ model: string;
5028
+ choices: Array<ChatCompletionChoice>;
5029
+ usage?: CompletionUsage;
5030
+ system_fingerprint?: string | null;
5031
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
5032
+ };
4328
5033
  /**
4329
5034
  * Workers AI support for OpenAI's Responses API
4330
5035
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4747,6 +5452,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4747
5452
  export type StreamOptions = {
4748
5453
  include_obfuscation?: boolean;
4749
5454
  };
5455
+ /** Marks keys from T that aren't in U as optional never */
5456
+ export type Without<T, U> = {
5457
+ [P in Exclude<keyof T, keyof U>]?: never;
5458
+ };
5459
+ /** Either T or U, but not both (mutually exclusive) */
5460
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4750
5461
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4751
5462
  | {
4752
5463
  text: string | string[];
@@ -5039,10 +5750,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5039
5750
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5040
5751
  }
5041
5752
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5042
- /**
5043
- * Base64 encoded value of the audio data.
5044
- */
5045
- audio: string;
5753
+ audio:
5754
+ | string
5755
+ | {
5756
+ body?: object;
5757
+ contentType?: string;
5758
+ };
5046
5759
  /**
5047
5760
  * Supported tasks are 'translate' or 'transcribe'.
5048
5761
  */
@@ -5060,9 +5773,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5060
5773
  */
5061
5774
  initial_prompt?: string;
5062
5775
  /**
5063
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5776
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5064
5777
  */
5065
5778
  prefix?: string;
5779
+ /**
5780
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5781
+ */
5782
+ beam_size?: number;
5783
+ /**
5784
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5785
+ */
5786
+ condition_on_previous_text?: boolean;
5787
+ /**
5788
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5789
+ */
5790
+ no_speech_threshold?: number;
5791
+ /**
5792
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5793
+ */
5794
+ compression_ratio_threshold?: number;
5795
+ /**
5796
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5797
+ */
5798
+ log_prob_threshold?: number;
5799
+ /**
5800
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5801
+ */
5802
+ hallucination_silence_threshold?: number;
5066
5803
  }
5067
5804
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5068
5805
  transcription_info?: {
@@ -5209,11 +5946,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5209
5946
  truncate_inputs?: boolean;
5210
5947
  }
5211
5948
  export type Ai_Cf_Baai_Bge_M3_Output =
5212
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5949
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5213
5950
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5214
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5951
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5215
5952
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5216
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5953
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5217
5954
  response?: {
5218
5955
  /**
5219
5956
  * Index of the context in the request
@@ -5233,7 +5970,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5233
5970
  */
5234
5971
  pooling?: "mean" | "cls";
5235
5972
  }
5236
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5973
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5237
5974
  shape?: number[];
5238
5975
  /**
5239
5976
  * Embeddings of the requested text values
@@ -5338,7 +6075,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5338
6075
  */
5339
6076
  role?: string;
5340
6077
  /**
5341
- * 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
6078
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5342
6079
  */
5343
6080
  tool_call_id?: string;
5344
6081
  content?:
@@ -5593,10 +6330,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5593
6330
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5594
6331
  */
5595
6332
  role: string;
5596
- /**
5597
- * The content of the message as a string.
5598
- */
5599
- content: string;
6333
+ content:
6334
+ | string
6335
+ | {
6336
+ /**
6337
+ * Type of the content (text)
6338
+ */
6339
+ type?: string;
6340
+ /**
6341
+ * Text content
6342
+ */
6343
+ text?: string;
6344
+ }[];
5600
6345
  }[];
5601
6346
  functions?: {
5602
6347
  name: string;
@@ -6252,7 +6997,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6252
6997
  */
6253
6998
  role?: string;
6254
6999
  /**
6255
- * 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
7000
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6256
7001
  */
6257
7002
  tool_call_id?: string;
6258
7003
  content?:
@@ -6379,7 +7124,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6379
7124
  }
6380
7125
  )[];
6381
7126
  /**
6382
- * JSON schema that should be fulfilled for the response.
7127
+ * JSON schema that should be fufilled for the response.
6383
7128
  */
6384
7129
  guided_json?: object;
6385
7130
  /**
@@ -6653,7 +7398,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6653
7398
  }
6654
7399
  )[];
6655
7400
  /**
6656
- * JSON schema that should be fulfilled for the response.
7401
+ * JSON schema that should be fufilled for the response.
6657
7402
  */
6658
7403
  guided_json?: object;
6659
7404
  /**
@@ -6746,7 +7491,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6746
7491
  */
6747
7492
  prompt: string;
6748
7493
  /**
6749
- * JSON schema that should be fulfilled for the response.
7494
+ * JSON schema that should be fufilled for the response.
6750
7495
  */
6751
7496
  guided_json?: object;
6752
7497
  /**
@@ -6910,7 +7655,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6910
7655
  }
6911
7656
  )[];
6912
7657
  /**
6913
- * JSON schema that should be fulfilled for the response.
7658
+ * JSON schema that should be fufilled for the response.
6914
7659
  */
6915
7660
  guided_json?: object;
6916
7661
  /**
@@ -7191,7 +7936,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7191
7936
  )[];
7192
7937
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7193
7938
  /**
7194
- * JSON schema that should be fulfilled for the response.
7939
+ * JSON schema that should be fufilled for the response.
7195
7940
  */
7196
7941
  guided_json?: object;
7197
7942
  /**
@@ -7430,7 +8175,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7430
8175
  )[];
7431
8176
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7432
8177
  /**
7433
- * JSON schema that should be fulfilled for the response.
8178
+ * JSON schema that should be fufilled for the response.
7434
8179
  */
7435
8180
  guided_json?: object;
7436
8181
  /**
@@ -7595,10 +8340,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7595
8340
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7596
8341
  */
7597
8342
  role: string;
7598
- /**
7599
- * The content of the message as a string.
7600
- */
7601
- content: string;
8343
+ content:
8344
+ | string
8345
+ | {
8346
+ /**
8347
+ * Type of the content (text)
8348
+ */
8349
+ type?: string;
8350
+ /**
8351
+ * Text content
8352
+ */
8353
+ text?: string;
8354
+ }[];
7602
8355
  }[];
7603
8356
  functions?: {
7604
8357
  name: string;
@@ -7810,10 +8563,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7810
8563
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7811
8564
  */
7812
8565
  role: string;
7813
- /**
7814
- * The content of the message as a string.
7815
- */
7816
- content: string;
8566
+ content:
8567
+ | string
8568
+ | {
8569
+ /**
8570
+ * Type of the content (text)
8571
+ */
8572
+ type?: string;
8573
+ /**
8574
+ * Text content
8575
+ */
8576
+ text?: string;
8577
+ }[];
7817
8578
  }[];
7818
8579
  functions?: {
7819
8580
  name: string;
@@ -8381,12 +9142,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8381
9142
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8382
9143
  }
8383
9144
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8384
- inputs: ResponsesInput;
8385
- postProcessedOutputs: ResponsesOutput;
9145
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9146
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8386
9147
  }
8387
9148
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8388
- inputs: ResponsesInput;
8389
- postProcessedOutputs: ResponsesOutput;
9149
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9150
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8390
9151
  }
8391
9152
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8392
9153
  /**
@@ -8518,7 +9279,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8518
9279
  */
8519
9280
  text: string | string[];
8520
9281
  /**
8521
- * Target language to translate to
9282
+ * Target langauge to translate to
8522
9283
  */
8523
9284
  target_language:
8524
9285
  | "asm_Beng"
@@ -8634,10 +9395,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8634
9395
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8635
9396
  */
8636
9397
  role: string;
8637
- /**
8638
- * The content of the message as a string.
8639
- */
8640
- content: string;
9398
+ content:
9399
+ | string
9400
+ | {
9401
+ /**
9402
+ * Type of the content (text)
9403
+ */
9404
+ type?: string;
9405
+ /**
9406
+ * Text content
9407
+ */
9408
+ text?: string;
9409
+ }[];
8641
9410
  }[];
8642
9411
  functions?: {
8643
9412
  name: string;
@@ -8849,10 +9618,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8849
9618
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8850
9619
  */
8851
9620
  role: string;
8852
- /**
8853
- * The content of the message as a string.
8854
- */
8855
- content: string;
9621
+ content:
9622
+ | string
9623
+ | {
9624
+ /**
9625
+ * Type of the content (text)
9626
+ */
9627
+ type?: string;
9628
+ /**
9629
+ * Text content
9630
+ */
9631
+ text?: string;
9632
+ }[];
8856
9633
  }[];
8857
9634
  functions?: {
8858
9635
  name: string;
@@ -9407,6 +10184,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9407
10184
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9408
10185
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9409
10186
  }
10187
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
10188
+ multipart: {
10189
+ body?: object;
10190
+ contentType?: string;
10191
+ };
10192
+ }
10193
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
10194
+ /**
10195
+ * Generated image as Base64 string.
10196
+ */
10197
+ image?: string;
10198
+ }
10199
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
10200
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
10201
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
10202
+ }
10203
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
10204
+ multipart: {
10205
+ body?: object;
10206
+ contentType?: string;
10207
+ };
10208
+ }
10209
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
10210
+ /**
10211
+ * Generated image as Base64 string.
10212
+ */
10213
+ image?: string;
10214
+ }
10215
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
10216
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
10217
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
10218
+ }
10219
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
10220
+ multipart: {
10221
+ body?: object;
10222
+ contentType?: string;
10223
+ };
10224
+ }
10225
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
10226
+ /**
10227
+ * Generated image as Base64 string.
10228
+ */
10229
+ image?: string;
10230
+ }
10231
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
10232
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
10233
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
10234
+ }
10235
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
10236
+ inputs: ChatCompletionsInput;
10237
+ postProcessedOutputs: ChatCompletionsOutput;
10238
+ }
10239
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
10240
+ inputs: ChatCompletionsInput;
10241
+ postProcessedOutputs: ChatCompletionsOutput;
10242
+ }
10243
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
10244
+ inputs: ChatCompletionsInput;
10245
+ postProcessedOutputs: ChatCompletionsOutput;
10246
+ }
9410
10247
  export interface AiModels {
9411
10248
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9412
10249
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9425,7 +10262,6 @@ export interface AiModels {
9425
10262
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9426
10263
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9427
10264
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9428
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9429
10265
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9430
10266
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9431
10267
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9492,6 +10328,12 @@ export interface AiModels {
9492
10328
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9493
10329
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9494
10330
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10331
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10332
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10333
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10334
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10335
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10336
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9495
10337
  }
9496
10338
  export type AiOptions = {
9497
10339
  /**
@@ -9517,6 +10359,7 @@ export type AiOptions = {
9517
10359
  returnRawResponse?: boolean;
9518
10360
  prefix?: string;
9519
10361
  extraHeaders?: object;
10362
+ signal?: AbortSignal;
9520
10363
  };
9521
10364
  export type AiModelsSearchParams = {
9522
10365
  author?: string;
@@ -9543,6 +10386,16 @@ export type AiModelsSearchObject = {
9543
10386
  value: string;
9544
10387
  }[];
9545
10388
  };
10389
+ export type ChatCompletionsBase = XOR<
10390
+ ChatCompletionsPromptInput,
10391
+ ChatCompletionsMessagesInput
10392
+ >;
10393
+ export type ChatCompletionsInput = XOR<
10394
+ ChatCompletionsBase,
10395
+ {
10396
+ requests: ChatCompletionsBase[];
10397
+ }
10398
+ >;
9546
10399
  export interface InferenceUpstreamError extends Error {}
9547
10400
  export interface AiInternalError extends Error {}
9548
10401
  export type AiModelListType = Record<string, any>;
@@ -9552,46 +10405,16 @@ export declare abstract class Ai<
9552
10405
  aiGatewayLogId: string | null;
9553
10406
  gateway(gatewayId: string): AiGateway;
9554
10407
  /**
9555
- * Access the AI Search API for managing AI-powered search instances.
9556
- *
9557
- * This is the new API that replaces AutoRAG with better namespace separation:
9558
- * - Account-level operations: `list()`, `create()`
9559
- * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
9560
- *
9561
- * @example
9562
- * ```typescript
9563
- * // List all AI Search instances
9564
- * const instances = await env.AI.aiSearch.list();
9565
- *
9566
- * // Search an instance
9567
- * const results = await env.AI.aiSearch.get('my-search').search({
9568
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9569
- * ai_search_options: {
9570
- * retrieval: { max_num_results: 10 }
9571
- * }
9572
- * });
9573
- *
9574
- * // Generate chat completions with AI Search context
9575
- * const response = await env.AI.aiSearch.get('my-search').chatCompletions({
9576
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9577
- * model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
9578
- * });
9579
- * ```
10408
+ * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10409
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9580
10410
  */
9581
- aiSearch(): AiSearchAccountService;
10411
+ aiSearch(): AiSearchNamespace;
9582
10412
  /**
9583
10413
  * @deprecated AutoRAG has been replaced by AI Search.
9584
- * Use `env.AI.aiSearch` instead for better API design and new features.
9585
- *
9586
- * Migration guide:
9587
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9588
- * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
9589
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
10414
+ * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10415
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9590
10416
  *
9591
- * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
9592
- *
9593
- * @see AiSearchAccountService
9594
- * @param autoragId Optional instance ID (omit for account-level operations)
10417
+ * @param autoragId Instance ID
9595
10418
  */
9596
10419
  autorag(autoragId: string): AutoRAG;
9597
10420
  run<
@@ -9750,22 +10573,23 @@ export declare abstract class AiGateway {
9750
10573
  getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
9751
10574
  }
9752
10575
  /**
9753
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
9754
- * @see AiSearchInternalError
10576
+ * @deprecated Use the standalone AI Search Workers binding instead.
10577
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9755
10578
  */
9756
10579
  export interface AutoRAGInternalError extends Error {}
9757
10580
  /**
9758
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
9759
- * @see AiSearchNotFoundError
10581
+ * @deprecated Use the standalone AI Search Workers binding instead.
10582
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9760
10583
  */
9761
10584
  export interface AutoRAGNotFoundError extends Error {}
9762
10585
  /**
9763
- * @deprecated This error type is no longer used in the AI Search API.
10586
+ * @deprecated Use the standalone AI Search Workers binding instead.
10587
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9764
10588
  */
9765
10589
  export interface AutoRAGUnauthorizedError extends Error {}
9766
10590
  /**
9767
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
9768
- * @see AiSearchNameNotSetError
10591
+ * @deprecated Use the standalone AI Search Workers binding instead.
10592
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9769
10593
  */
9770
10594
  export interface AutoRAGNameNotSetError extends Error {}
9771
10595
  export type ComparisonFilter = {
@@ -9778,9 +10602,8 @@ export type CompoundFilter = {
9778
10602
  filters: ComparisonFilter[];
9779
10603
  };
9780
10604
  /**
9781
- * @deprecated AutoRAG has been replaced by AI Search.
9782
- * Use AiSearchSearchRequest with the new API instead.
9783
- * @see AiSearchSearchRequest
10605
+ * @deprecated Use the standalone AI Search Workers binding instead.
10606
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9784
10607
  */
9785
10608
  export type AutoRagSearchRequest = {
9786
10609
  query: string;
@@ -9797,18 +10620,16 @@ export type AutoRagSearchRequest = {
9797
10620
  rewrite_query?: boolean;
9798
10621
  };
9799
10622
  /**
9800
- * @deprecated AutoRAG has been replaced by AI Search.
9801
- * Use AiSearchChatCompletionsRequest with the new API instead.
9802
- * @see AiSearchChatCompletionsRequest
10623
+ * @deprecated Use the standalone AI Search Workers binding instead.
10624
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9803
10625
  */
9804
10626
  export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
9805
10627
  stream?: boolean;
9806
10628
  system_prompt?: string;
9807
10629
  };
9808
10630
  /**
9809
- * @deprecated AutoRAG has been replaced by AI Search.
9810
- * Use AiSearchChatCompletionsRequest with stream: true instead.
9811
- * @see AiSearchChatCompletionsRequest
10631
+ * @deprecated Use the standalone AI Search Workers binding instead.
10632
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9812
10633
  */
9813
10634
  export type AutoRagAiSearchRequestStreaming = Omit<
9814
10635
  AutoRagAiSearchRequest,
@@ -9817,9 +10638,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
9817
10638
  stream: true;
9818
10639
  };
9819
10640
  /**
9820
- * @deprecated AutoRAG has been replaced by AI Search.
9821
- * Use AiSearchSearchResponse with the new API instead.
9822
- * @see AiSearchSearchResponse
10641
+ * @deprecated Use the standalone AI Search Workers binding instead.
10642
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9823
10643
  */
9824
10644
  export type AutoRagSearchResponse = {
9825
10645
  object: "vector_store.search_results.page";
@@ -9838,9 +10658,8 @@ export type AutoRagSearchResponse = {
9838
10658
  next_page: string | null;
9839
10659
  };
9840
10660
  /**
9841
- * @deprecated AutoRAG has been replaced by AI Search.
9842
- * Use AiSearchListResponse with the new API instead.
9843
- * @see AiSearchListResponse
10661
+ * @deprecated Use the standalone AI Search Workers binding instead.
10662
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9844
10663
  */
9845
10664
  export type AutoRagListResponse = {
9846
10665
  id: string;
@@ -9852,49 +10671,40 @@ export type AutoRagListResponse = {
9852
10671
  status: string;
9853
10672
  }[];
9854
10673
  /**
9855
- * @deprecated AutoRAG has been replaced by AI Search.
9856
- * The new API returns different response formats for chat completions.
10674
+ * @deprecated Use the standalone AI Search Workers binding instead.
10675
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9857
10676
  */
9858
10677
  export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
9859
10678
  response: string;
9860
10679
  };
9861
10680
  /**
9862
- * @deprecated AutoRAG has been replaced by AI Search.
9863
- * Use the new AI Search API instead: `env.AI.aiSearch`
9864
- *
9865
- * Migration guide:
9866
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9867
- * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
9868
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
9869
- *
9870
- * @see AiSearchAccountService
9871
- * @see AiSearchInstanceService
10681
+ * @deprecated Use the standalone AI Search Workers binding instead.
10682
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9872
10683
  */
9873
10684
  export declare abstract class AutoRAG {
9874
10685
  /**
9875
- * @deprecated Use `env.AI.aiSearch.list()` instead.
9876
- * @see AiSearchAccountService.list
10686
+ * @deprecated Use the standalone AI Search Workers binding instead.
10687
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9877
10688
  */
9878
10689
  list(): Promise<AutoRagListResponse>;
9879
10690
  /**
9880
- * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
9881
- * Note: The new API uses a messages array instead of a query string.
9882
- * @see AiSearchInstanceService.search
10691
+ * @deprecated Use the standalone AI Search Workers binding instead.
10692
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9883
10693
  */
9884
10694
  search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
9885
10695
  /**
9886
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9887
- * @see AiSearchInstanceService.chatCompletions
10696
+ * @deprecated Use the standalone AI Search Workers binding instead.
10697
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9888
10698
  */
9889
10699
  aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
9890
10700
  /**
9891
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9892
- * @see AiSearchInstanceService.chatCompletions
10701
+ * @deprecated Use the standalone AI Search Workers binding instead.
10702
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9893
10703
  */
9894
10704
  aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
9895
10705
  /**
9896
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9897
- * @see AiSearchInstanceService.chatCompletions
10706
+ * @deprecated Use the standalone AI Search Workers binding instead.
10707
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9898
10708
  */
9899
10709
  aiSearch(
9900
10710
  params: AutoRagAiSearchRequest,
@@ -10019,6 +10829,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
10019
10829
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
10020
10830
  */
10021
10831
  cacheTtlByStatus?: Record<string, number>;
10832
+ /**
10833
+ * Explicit Cache-Control header value to set on the response stored in cache.
10834
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10835
+ *
10836
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10837
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10838
+ *
10839
+ * Can be used together with `cacheTtlByStatus`.
10840
+ */
10841
+ cacheControl?: string;
10842
+ /**
10843
+ * Whether the response should be eligible for Cache Reserve storage.
10844
+ */
10845
+ cacheReserveEligible?: boolean;
10846
+ /**
10847
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10848
+ */
10849
+ respectStrongEtag?: boolean;
10850
+ /**
10851
+ * Whether to strip ETag headers from the origin response before caching.
10852
+ */
10853
+ stripEtags?: boolean;
10854
+ /**
10855
+ * Whether to strip Last-Modified headers from the origin response before caching.
10856
+ */
10857
+ stripLastModified?: boolean;
10858
+ /**
10859
+ * Whether to enable Cache Deception Armor, which protects against web cache
10860
+ * deception attacks by verifying the Content-Type matches the URL extension.
10861
+ */
10862
+ cacheDeceptionArmor?: boolean;
10863
+ /**
10864
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10865
+ */
10866
+ cacheReserveMinimumFileSize?: number;
10022
10867
  scrapeShield?: boolean;
10023
10868
  apps?: boolean;
10024
10869
  image?: RequestInitCfPropertiesImage;
@@ -11887,6 +12732,7 @@ export declare namespace CloudflareWorkersModule {
11887
12732
  constructor(ctx: ExecutionContext, env: Env);
11888
12733
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11889
12734
  fetch?(request: Request): Response | Promise<Response>;
12735
+ connect?(socket: Socket): void | Promise<void>;
11890
12736
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11891
12737
  scheduled?(controller: ScheduledController): void | Promise<void>;
11892
12738
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11907,6 +12753,7 @@ export declare namespace CloudflareWorkersModule {
11907
12753
  constructor(ctx: DurableObjectState, env: Env);
11908
12754
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11909
12755
  fetch?(request: Request): Response | Promise<Response>;
12756
+ connect?(socket: Socket): void | Promise<void>;
11910
12757
  webSocketMessage?(
11911
12758
  ws: WebSocket,
11912
12759
  message: string | ArrayBuffer,
@@ -12047,17 +12894,6 @@ export interface StreamBinding {
12047
12894
  * @returns A handle for per-video operations.
12048
12895
  */
12049
12896
  video(id: string): StreamVideoHandle;
12050
- /**
12051
- * Uploads a new video from a File.
12052
- * @param file The video file to upload.
12053
- * @returns The uploaded video details.
12054
- * @throws {BadRequestError} if the upload parameter is invalid
12055
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12056
- * @throws {MaxFileSizeError} if the file size is too large
12057
- * @throws {RateLimitedError} if the server received too many requests
12058
- * @throws {InternalError} if an unexpected error occurs
12059
- */
12060
- upload(file: File): Promise<StreamVideo>;
12061
12897
  /**
12062
12898
  * Uploads a new video from a provided URL.
12063
12899
  * @param url The URL to upload from.
@@ -12907,6 +13743,9 @@ export declare namespace TailStream {
12907
13743
  readonly type: "fetch";
12908
13744
  readonly statusCode: number;
12909
13745
  }
13746
+ interface ConnectEventInfo {
13747
+ readonly type: "connect";
13748
+ }
12910
13749
  type EventOutcome =
12911
13750
  | "ok"
12912
13751
  | "canceled"
@@ -12937,6 +13776,7 @@ export declare namespace TailStream {
12937
13776
  readonly scriptVersion?: ScriptVersion;
12938
13777
  readonly info:
12939
13778
  | FetchEventInfo
13779
+ | ConnectEventInfo
12940
13780
  | JsRpcEventInfo
12941
13781
  | ScheduledEventInfo
12942
13782
  | AlarmEventInfo