@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.
@@ -483,6 +483,11 @@ export type ExportedHandlerFetchHandler<
483
483
  env: Env,
484
484
  ctx: ExecutionContext<Props>,
485
485
  ) => Response | Promise<Response>;
486
+ export type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
487
+ socket: Socket,
488
+ env: Env,
489
+ ctx: ExecutionContext<Props>,
490
+ ) => void | Promise<void>;
486
491
  export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
487
492
  events: TraceItem[],
488
493
  env: Env,
@@ -524,6 +529,7 @@ export interface ExportedHandler<
524
529
  Props = unknown,
525
530
  > {
526
531
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
532
+ connect?: ExportedHandlerConnectHandler<Env, Props>;
527
533
  tail?: ExportedHandlerTailHandler<Env, Props>;
528
534
  trace?: ExportedHandlerTraceHandler<Env, Props>;
529
535
  tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
@@ -543,12 +549,14 @@ export declare abstract class Navigator {
543
549
  export interface AlarmInvocationInfo {
544
550
  readonly isRetry: boolean;
545
551
  readonly retryCount: number;
552
+ readonly scheduledTime: number;
546
553
  }
547
554
  export interface Cloudflare {
548
555
  readonly compatibilityFlags: Record<string, boolean>;
549
556
  }
550
557
  export interface DurableObject {
551
558
  fetch(request: Request): Response | Promise<Response>;
559
+ connect?(socket: Socket): void | Promise<void>;
552
560
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
553
561
  webSocketMessage?(
554
562
  ws: WebSocket,
@@ -566,7 +574,7 @@ export type DurableObjectStub<
566
574
  T extends Rpc.DurableObjectBranded | undefined = undefined,
567
575
  > = Fetcher<
568
576
  T,
569
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
577
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
570
578
  > & {
571
579
  readonly id: DurableObjectId;
572
580
  readonly name?: string;
@@ -575,6 +583,7 @@ export interface DurableObjectId {
575
583
  toString(): string;
576
584
  equals(other: DurableObjectId): boolean;
577
585
  readonly name?: string;
586
+ readonly jurisdiction?: string;
578
587
  }
579
588
  export declare abstract class DurableObjectNamespace<
580
589
  T extends Rpc.DurableObjectBranded | undefined = undefined,
@@ -3089,6 +3098,11 @@ export interface QueuingStrategyInit {
3089
3098
  */
3090
3099
  highWaterMark: number;
3091
3100
  }
3101
+ export interface TracePreviewInfo {
3102
+ id: string;
3103
+ slug: string;
3104
+ name: string;
3105
+ }
3092
3106
  export interface ScriptVersion {
3093
3107
  id?: string;
3094
3108
  tag?: string;
@@ -3103,6 +3117,7 @@ export interface TraceItem {
3103
3117
  | (
3104
3118
  | TraceItemFetchEventInfo
3105
3119
  | TraceItemJsRpcEventInfo
3120
+ | TraceItemConnectEventInfo
3106
3121
  | TraceItemScheduledEventInfo
3107
3122
  | TraceItemAlarmEventInfo
3108
3123
  | TraceItemQueueEventInfo
@@ -3121,6 +3136,8 @@ export interface TraceItem {
3121
3136
  readonly scriptVersion?: ScriptVersion;
3122
3137
  readonly dispatchNamespace?: string;
3123
3138
  readonly scriptTags?: string[];
3139
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3140
+ readonly preview?: TracePreviewInfo;
3124
3141
  readonly durableObjectId?: string;
3125
3142
  readonly outcome: string;
3126
3143
  readonly executionModel: string;
@@ -3131,6 +3148,7 @@ export interface TraceItem {
3131
3148
  export interface TraceItemAlarmEventInfo {
3132
3149
  readonly scheduledTime: Date;
3133
3150
  }
3151
+ export interface TraceItemConnectEventInfo {}
3134
3152
  export interface TraceItemCustomEventInfo {}
3135
3153
  export interface TraceItemScheduledEventInfo {
3136
3154
  readonly scheduledTime: number;
@@ -3751,7 +3769,7 @@ export interface ContainerStartupOptions {
3751
3769
  entrypoint?: string[];
3752
3770
  enableInternet: boolean;
3753
3771
  env?: Record<string, string>;
3754
- hardTimeout?: number | bigint;
3772
+ labels?: Record<string, string>;
3755
3773
  }
3756
3774
  /**
3757
3775
  * 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.
@@ -3878,11 +3896,10 @@ export declare abstract class Performance {
3878
3896
  */
3879
3897
  toJSON(): object;
3880
3898
  }
3881
- // AI Search V2 API Error Interfaces
3899
+ // ============ AI Search Error Interfaces ============
3882
3900
  export interface AiSearchInternalError extends Error {}
3883
3901
  export interface AiSearchNotFoundError extends Error {}
3884
- export interface AiSearchNameNotSetError extends Error {}
3885
- // AI Search V2 Request Types
3902
+ // ============ AI Search Request Types ============
3886
3903
  export type AiSearchSearchRequest = {
3887
3904
  messages: Array<{
3888
3905
  role: "system" | "developer" | "user" | "assistant" | "tool";
@@ -3907,9 +3924,8 @@ export type AiSearchSearchRequest = {
3907
3924
  [key: string]: unknown;
3908
3925
  };
3909
3926
  reranking?: {
3910
- /** Enable reranking (default false) */
3911
3927
  enabled?: boolean;
3912
- model?: "@cf/baai/bge-reranker-base" | "";
3928
+ model?: "@cf/baai/bge-reranker-base" | string;
3913
3929
  /** Match threshold (0-1, default 0.4) */
3914
3930
  match_threshold?: number;
3915
3931
  [key: string]: unknown;
@@ -3921,6 +3937,7 @@ export type AiSearchChatCompletionsRequest = {
3921
3937
  messages: Array<{
3922
3938
  role: "system" | "developer" | "user" | "assistant" | "tool";
3923
3939
  content: string | null;
3940
+ [key: string]: unknown;
3924
3941
  }>;
3925
3942
  model?: string;
3926
3943
  stream?: boolean;
@@ -3941,7 +3958,7 @@ export type AiSearchChatCompletionsRequest = {
3941
3958
  };
3942
3959
  reranking?: {
3943
3960
  enabled?: boolean;
3944
- model?: "@cf/baai/bge-reranker-base" | "";
3961
+ model?: "@cf/baai/bge-reranker-base" | string;
3945
3962
  match_threshold?: number;
3946
3963
  [key: string]: unknown;
3947
3964
  };
@@ -3949,7 +3966,7 @@ export type AiSearchChatCompletionsRequest = {
3949
3966
  };
3950
3967
  [key: string]: unknown;
3951
3968
  };
3952
- // AI Search V2 Response Types
3969
+ // ============ AI Search Response Types ============
3953
3970
  export type AiSearchSearchResponse = {
3954
3971
  search_query: string;
3955
3972
  chunks: Array<{
@@ -3968,26 +3985,65 @@ export type AiSearchSearchResponse = {
3968
3985
  keyword_score?: number;
3969
3986
  /** Vector similarity score (0-1) */
3970
3987
  vector_score?: number;
3988
+ [key: string]: unknown;
3989
+ };
3990
+ }>;
3991
+ };
3992
+ export type AiSearchChatCompletionsResponse = {
3993
+ id?: string;
3994
+ object?: string;
3995
+ model?: string;
3996
+ choices: Array<{
3997
+ index?: number;
3998
+ message: {
3999
+ role: "system" | "developer" | "user" | "assistant" | "tool";
4000
+ content: string | null;
4001
+ [key: string]: unknown;
3971
4002
  };
4003
+ [key: string]: unknown;
3972
4004
  }>;
4005
+ chunks: AiSearchSearchResponse["chunks"];
4006
+ [key: string]: unknown;
3973
4007
  };
3974
- export type AiSearchListResponse = Array<{
4008
+ export type AiSearchStatsResponse = {
4009
+ queued?: number;
4010
+ running?: number;
4011
+ completed?: number;
4012
+ error?: number;
4013
+ skipped?: number;
4014
+ outdated?: number;
4015
+ last_activity?: string;
4016
+ };
4017
+ // ============ AI Search Instance Info Types ============
4018
+ export type AiSearchInstanceInfo = {
3975
4019
  id: string;
3976
- internal_id?: string;
3977
- account_id?: string;
3978
- account_tag?: string;
3979
- /** Whether the instance is enabled (default true) */
3980
- enable?: boolean;
3981
- type?: "r2" | "web-crawler";
4020
+ type?: "r2" | "web-crawler" | string;
3982
4021
  source?: string;
4022
+ paused?: boolean;
4023
+ status?: string;
4024
+ namespace?: string;
4025
+ created_at?: string;
4026
+ modified_at?: string;
3983
4027
  [key: string]: unknown;
3984
- }>;
4028
+ };
4029
+ export type AiSearchListResponse = {
4030
+ result: AiSearchInstanceInfo[];
4031
+ result_info?: {
4032
+ count: number;
4033
+ page: number;
4034
+ per_page: number;
4035
+ total_count: number;
4036
+ };
4037
+ };
4038
+ // ============ AI Search Config Types ============
3985
4039
  export type AiSearchConfig = {
3986
4040
  /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
3987
4041
  id: string;
3988
- type: "r2" | "web-crawler";
3989
- source: string;
3990
- source_params?: object;
4042
+ /** Instance type. Omit to create with built-in storage. */
4043
+ type?: "r2" | "web-crawler" | string;
4044
+ /** Source URL (required for web-crawler type). */
4045
+ source?: string;
4046
+ source_params?: unknown;
3991
4047
  /** Token ID (UUID format) */
3992
4048
  token_id?: string;
3993
4049
  ai_gateway_id?: string;
@@ -3997,54 +4053,307 @@ export type AiSearchConfig = {
3997
4053
  reranking?: boolean;
3998
4054
  embedding_model?: string;
3999
4055
  ai_search_model?: string;
4056
+ [key: string]: unknown;
4000
4057
  };
4001
- export type AiSearchInstance = {
4058
+ // ============ AI Search Item Types ============
4059
+ export type AiSearchItemInfo = {
4002
4060
  id: string;
4003
- enable?: boolean;
4004
- type?: "r2" | "web-crawler";
4005
- source?: string;
4061
+ key: string;
4062
+ status:
4063
+ | "completed"
4064
+ | "error"
4065
+ | "skipped"
4066
+ | "queued"
4067
+ | "processing"
4068
+ | "outdated";
4069
+ metadata?: Record<string, unknown>;
4006
4070
  [key: string]: unknown;
4007
4071
  };
4008
- // AI Search Instance Service - Instance-level operations
4009
- export declare abstract class AiSearchInstanceService {
4072
+ export type AiSearchItemContentResult = {
4073
+ body: ReadableStream;
4074
+ contentType: string;
4075
+ filename: string;
4076
+ size: number;
4077
+ };
4078
+ export type AiSearchUploadItemOptions = {
4079
+ metadata?: Record<string, unknown>;
4080
+ };
4081
+ export type AiSearchListItemsParams = {
4082
+ page?: number;
4083
+ per_page?: number;
4084
+ };
4085
+ export type AiSearchListItemsResponse = {
4086
+ result: AiSearchItemInfo[];
4087
+ result_info?: {
4088
+ count: number;
4089
+ page: number;
4090
+ per_page: number;
4091
+ total_count: number;
4092
+ };
4093
+ };
4094
+ // ============ AI Search Job Types ============
4095
+ export type AiSearchJobInfo = {
4096
+ id: string;
4097
+ source: "user" | "schedule";
4098
+ description?: string;
4099
+ last_seen_at?: string;
4100
+ started_at?: string;
4101
+ ended_at?: string;
4102
+ end_reason?: string;
4103
+ };
4104
+ export type AiSearchJobLog = {
4105
+ id: number;
4106
+ message: string;
4107
+ message_type: number;
4108
+ created_at: number;
4109
+ };
4110
+ export type AiSearchCreateJobParams = {
4111
+ description?: string;
4112
+ };
4113
+ export type AiSearchListJobsParams = {
4114
+ page?: number;
4115
+ per_page?: number;
4116
+ };
4117
+ export type AiSearchListJobsResponse = {
4118
+ result: AiSearchJobInfo[];
4119
+ result_info?: {
4120
+ count: number;
4121
+ page: number;
4122
+ per_page: number;
4123
+ total_count: number;
4124
+ };
4125
+ };
4126
+ export type AiSearchJobLogsParams = {
4127
+ page?: number;
4128
+ per_page?: number;
4129
+ };
4130
+ export type AiSearchJobLogsResponse = {
4131
+ result: AiSearchJobLog[];
4132
+ result_info?: {
4133
+ count: number;
4134
+ page: number;
4135
+ per_page: number;
4136
+ total_count: number;
4137
+ };
4138
+ };
4139
+ // ============ AI Search Sub-Service Classes ============
4140
+ /**
4141
+ * Single item service for an AI Search instance.
4142
+ * Provides info, delete, and download operations on a specific item.
4143
+ */
4144
+ export declare abstract class AiSearchItem {
4145
+ /** Get metadata about this item. */
4146
+ info(): Promise<AiSearchItemInfo>;
4147
+ /**
4148
+ * Download the item's content.
4149
+ * @returns Object with body stream, content type, filename, and size.
4150
+ */
4151
+ download(): Promise<AiSearchItemContentResult>;
4152
+ }
4153
+ /**
4154
+ * Items collection service for an AI Search instance.
4155
+ * Provides list, upload, and access to individual items.
4156
+ */
4157
+ export declare abstract class AiSearchItems {
4158
+ /** List items in this instance. */
4159
+ list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
4160
+ /**
4161
+ * Upload a file as an item.
4162
+ * @param name Filename for the uploaded item.
4163
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4164
+ * @param options Optional metadata to attach to the item.
4165
+ * @returns The created item info.
4166
+ */
4167
+ upload(
4168
+ name: string,
4169
+ content: ReadableStream | ArrayBuffer | string,
4170
+ options?: AiSearchUploadItemOptions,
4171
+ ): Promise<AiSearchItemInfo>;
4172
+ /**
4173
+ * Upload a file and poll until processing completes.
4174
+ * @param name Filename for the uploaded item.
4175
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4176
+ * @param options Optional metadata to attach to the item.
4177
+ * @returns The item info after processing completes (or timeout).
4178
+ */
4179
+ uploadAndPoll(
4180
+ name: string,
4181
+ content: ReadableStream | ArrayBuffer | string,
4182
+ options?: AiSearchUploadItemOptions,
4183
+ ): Promise<AiSearchItemInfo>;
4184
+ /**
4185
+ * Get an item by ID.
4186
+ * @param itemId The item identifier.
4187
+ * @returns Item service for info, delete, and download operations.
4188
+ */
4189
+ get(itemId: string): AiSearchItem;
4190
+ /** Delete this item from the instance.
4191
+ * @param itemId The item identifier.
4192
+ */
4193
+ delete(itemId: string): Promise<void>;
4194
+ }
4195
+ /**
4196
+ * Single job service for an AI Search instance.
4197
+ * Provides info and logs for a specific job.
4198
+ */
4199
+ export declare abstract class AiSearchJob {
4200
+ /** Get metadata about this job. */
4201
+ info(): Promise<AiSearchJobInfo>;
4202
+ /** Get logs for this job. */
4203
+ logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
4204
+ }
4205
+ /**
4206
+ * Jobs collection service for an AI Search instance.
4207
+ * Provides list, create, and access to individual jobs.
4208
+ */
4209
+ export declare abstract class AiSearchJobs {
4210
+ /** List jobs for this instance. */
4211
+ list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
4212
+ /**
4213
+ * Create a new indexing job.
4214
+ * @param params Optional job parameters.
4215
+ * @returns The created job info.
4216
+ */
4217
+ create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
4218
+ /**
4219
+ * Get a job by ID.
4220
+ * @param jobId The job identifier.
4221
+ * @returns Job service for info and logs operations.
4222
+ */
4223
+ get(jobId: string): AiSearchJob;
4224
+ }
4225
+ // ============ AI Search Binding Classes ============
4226
+ /**
4227
+ * Instance-level AI Search service.
4228
+ *
4229
+ * Used as:
4230
+ * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
4231
+ * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
4232
+ *
4233
+ * Provides search, chat, update, stats, items, and jobs operations.
4234
+ *
4235
+ * @example
4236
+ * ```ts
4237
+ * // Via namespace binding
4238
+ * const instance = env.AI_SEARCH.get("blog");
4239
+ * const results = await instance.search({
4240
+ * messages: [{ role: "user", content: "How does caching work?" }],
4241
+ * });
4242
+ *
4243
+ * // Via single instance binding
4244
+ * const results = await env.BLOG_SEARCH.search({
4245
+ * messages: [{ role: "user", content: "How does caching work?" }],
4246
+ * });
4247
+ * ```
4248
+ */
4249
+ export declare abstract class AiSearchInstance {
4010
4250
  /**
4011
4251
  * Search the AI Search instance for relevant chunks.
4012
- * @param params Search request with messages and AI search options
4013
- * @returns Search response with matching chunks
4252
+ * @param params Search request with messages and optional AI search options.
4253
+ * @returns Search response with matching chunks and search query.
4014
4254
  */
4015
4255
  search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
4256
+ /**
4257
+ * Generate chat completions with AI Search context (streaming).
4258
+ * @param params Chat completions request with stream: true.
4259
+ * @returns ReadableStream of server-sent events.
4260
+ */
4261
+ chatCompletions(
4262
+ params: AiSearchChatCompletionsRequest & {
4263
+ stream: true;
4264
+ },
4265
+ ): Promise<ReadableStream>;
4016
4266
  /**
4017
4267
  * Generate chat completions with AI Search context.
4018
- * @param params Chat completions request with optional streaming
4019
- * @returns Response object (if streaming) or chat completion result
4268
+ * @param params Chat completions request.
4269
+ * @returns Chat completion response with choices and RAG chunks.
4020
4270
  */
4021
4271
  chatCompletions(
4022
4272
  params: AiSearchChatCompletionsRequest,
4023
- ): Promise<Response | object>;
4273
+ ): Promise<AiSearchChatCompletionsResponse>;
4024
4274
  /**
4025
- * Delete this AI Search instance.
4275
+ * Update the instance configuration.
4276
+ * @param config Partial configuration to update.
4277
+ * @returns Updated instance info.
4026
4278
  */
4027
- delete(): Promise<void>;
4279
+ update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
4280
+ /** Get metadata about this instance. */
4281
+ info(): Promise<AiSearchInstanceInfo>;
4282
+ /**
4283
+ * Get instance statistics (item count, indexing status, etc.).
4284
+ * @returns Statistics with counts per status and last activity time.
4285
+ */
4286
+ stats(): Promise<AiSearchStatsResponse>;
4287
+ /** Items collection — list, upload, and manage items in this instance. */
4288
+ get items(): AiSearchItems;
4289
+ /** Jobs collection — list, create, and inspect indexing jobs. */
4290
+ get jobs(): AiSearchJobs;
4028
4291
  }
4029
- // AI Search Account Service - Account-level operations
4030
- export declare abstract class AiSearchAccountService {
4292
+ /**
4293
+ * Namespace-level AI Search service.
4294
+ *
4295
+ * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
4296
+ * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
4297
+ *
4298
+ * @example
4299
+ * ```ts
4300
+ * // Access an instance within the namespace
4301
+ * const blog = env.AI_SEARCH.get("blog");
4302
+ * const results = await blog.search({
4303
+ * messages: [{ role: "user", content: "How does caching work?" }],
4304
+ * });
4305
+ *
4306
+ * // List all instances in the namespace
4307
+ * const instances = await env.AI_SEARCH.list();
4308
+ *
4309
+ * // Create a new instance with built-in storage
4310
+ * const tenant = await env.AI_SEARCH.create({
4311
+ * id: "tenant-123",
4312
+ * });
4313
+ *
4314
+ * // Upload items into the instance
4315
+ * await tenant.items.upload("doc.pdf", fileContent);
4316
+ *
4317
+ * // Delete an instance
4318
+ * await env.AI_SEARCH.delete("tenant-123");
4319
+ * ```
4320
+ */
4321
+ export declare abstract class AiSearchNamespace {
4031
4322
  /**
4032
- * List all AI Search instances in the account.
4033
- * @returns Array of AI Search instances
4323
+ * Get an instance by name within the bound namespace.
4324
+ * @param name Instance name.
4325
+ * @returns Instance service for search, chat, update, stats, items, and jobs.
4326
+ */
4327
+ get(name: string): AiSearchInstance;
4328
+ /**
4329
+ * List all instances in the bound namespace.
4330
+ * @returns Array of instance metadata.
4034
4331
  */
4035
4332
  list(): Promise<AiSearchListResponse>;
4036
4333
  /**
4037
- * Get an AI Search instance by ID.
4038
- * @param name Instance ID
4039
- * @returns Instance service for performing operations
4334
+ * Create a new instance within the bound namespace.
4335
+ * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
4336
+ * @returns Instance service for the newly created instance.
4337
+ *
4338
+ * @example
4339
+ * ```ts
4340
+ * // Create with built-in storage (upload items manually)
4341
+ * const instance = await env.AI_SEARCH.create({ id: "my-search" });
4342
+ *
4343
+ * // Create with web crawler source
4344
+ * const instance = await env.AI_SEARCH.create({
4345
+ * id: "docs-search",
4346
+ * type: "web-crawler",
4347
+ * source: "https://developers.cloudflare.com",
4348
+ * });
4349
+ * ```
4040
4350
  */
4041
- get(name: string): AiSearchInstanceService;
4351
+ create(config: AiSearchConfig): Promise<AiSearchInstance>;
4042
4352
  /**
4043
- * Create a new AI Search instance.
4044
- * @param config Instance configuration
4045
- * @returns Instance service for performing operations
4353
+ * Delete an instance from the bound namespace.
4354
+ * @param name Instance name to delete.
4046
4355
  */
4047
- create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
4356
+ delete(name: string): Promise<void>;
4048
4357
  }
4049
4358
  export type AiImageClassificationInput = {
4050
4359
  image: number[];
@@ -4320,6 +4629,402 @@ export declare abstract class BaseAiTranslation {
4320
4629
  inputs: AiTranslationInput;
4321
4630
  postProcessedOutputs: AiTranslationOutput;
4322
4631
  }
4632
+ /**
4633
+ * Workers AI support for OpenAI's Chat Completions API
4634
+ */
4635
+ export type ChatCompletionContentPartText = {
4636
+ type: "text";
4637
+ text: string;
4638
+ };
4639
+ export type ChatCompletionContentPartImage = {
4640
+ type: "image_url";
4641
+ image_url: {
4642
+ url: string;
4643
+ detail?: "auto" | "low" | "high";
4644
+ };
4645
+ };
4646
+ export type ChatCompletionContentPartInputAudio = {
4647
+ type: "input_audio";
4648
+ input_audio: {
4649
+ /** Base64 encoded audio data. */
4650
+ data: string;
4651
+ format: "wav" | "mp3";
4652
+ };
4653
+ };
4654
+ export type ChatCompletionContentPartFile = {
4655
+ type: "file";
4656
+ file: {
4657
+ /** Base64 encoded file data. */
4658
+ file_data?: string;
4659
+ /** The ID of an uploaded file. */
4660
+ file_id?: string;
4661
+ filename?: string;
4662
+ };
4663
+ };
4664
+ export type ChatCompletionContentPartRefusal = {
4665
+ type: "refusal";
4666
+ refusal: string;
4667
+ };
4668
+ export type ChatCompletionContentPart =
4669
+ | ChatCompletionContentPartText
4670
+ | ChatCompletionContentPartImage
4671
+ | ChatCompletionContentPartInputAudio
4672
+ | ChatCompletionContentPartFile;
4673
+ export type FunctionDefinition = {
4674
+ name: string;
4675
+ description?: string;
4676
+ parameters?: Record<string, unknown>;
4677
+ strict?: boolean | null;
4678
+ };
4679
+ export type ChatCompletionFunctionTool = {
4680
+ type: "function";
4681
+ function: FunctionDefinition;
4682
+ };
4683
+ export type ChatCompletionCustomToolGrammarFormat = {
4684
+ type: "grammar";
4685
+ grammar: {
4686
+ definition: string;
4687
+ syntax: "lark" | "regex";
4688
+ };
4689
+ };
4690
+ export type ChatCompletionCustomToolTextFormat = {
4691
+ type: "text";
4692
+ };
4693
+ export type ChatCompletionCustomToolFormat =
4694
+ | ChatCompletionCustomToolTextFormat
4695
+ | ChatCompletionCustomToolGrammarFormat;
4696
+ export type ChatCompletionCustomTool = {
4697
+ type: "custom";
4698
+ custom: {
4699
+ name: string;
4700
+ description?: string;
4701
+ format?: ChatCompletionCustomToolFormat;
4702
+ };
4703
+ };
4704
+ export type ChatCompletionTool =
4705
+ | ChatCompletionFunctionTool
4706
+ | ChatCompletionCustomTool;
4707
+ export type ChatCompletionMessageFunctionToolCall = {
4708
+ id: string;
4709
+ type: "function";
4710
+ function: {
4711
+ name: string;
4712
+ /** JSON-encoded arguments string. */
4713
+ arguments: string;
4714
+ };
4715
+ };
4716
+ export type ChatCompletionMessageCustomToolCall = {
4717
+ id: string;
4718
+ type: "custom";
4719
+ custom: {
4720
+ name: string;
4721
+ input: string;
4722
+ };
4723
+ };
4724
+ export type ChatCompletionMessageToolCall =
4725
+ | ChatCompletionMessageFunctionToolCall
4726
+ | ChatCompletionMessageCustomToolCall;
4727
+ export type ChatCompletionToolChoiceFunction = {
4728
+ type: "function";
4729
+ function: {
4730
+ name: string;
4731
+ };
4732
+ };
4733
+ export type ChatCompletionToolChoiceCustom = {
4734
+ type: "custom";
4735
+ custom: {
4736
+ name: string;
4737
+ };
4738
+ };
4739
+ export type ChatCompletionToolChoiceAllowedTools = {
4740
+ type: "allowed_tools";
4741
+ allowed_tools: {
4742
+ mode: "auto" | "required";
4743
+ tools: Array<Record<string, unknown>>;
4744
+ };
4745
+ };
4746
+ export type ChatCompletionToolChoiceOption =
4747
+ | "none"
4748
+ | "auto"
4749
+ | "required"
4750
+ | ChatCompletionToolChoiceFunction
4751
+ | ChatCompletionToolChoiceCustom
4752
+ | ChatCompletionToolChoiceAllowedTools;
4753
+ export type DeveloperMessage = {
4754
+ role: "developer";
4755
+ content:
4756
+ | string
4757
+ | Array<{
4758
+ type: "text";
4759
+ text: string;
4760
+ }>;
4761
+ name?: string;
4762
+ };
4763
+ export type SystemMessage = {
4764
+ role: "system";
4765
+ content:
4766
+ | string
4767
+ | Array<{
4768
+ type: "text";
4769
+ text: string;
4770
+ }>;
4771
+ name?: string;
4772
+ };
4773
+ /**
4774
+ * Permissive merged content part used inside UserMessage arrays.
4775
+ *
4776
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4777
+ * inside nested array items does not correctly match different branches for
4778
+ * different array elements, so the schema uses a single merged object.
4779
+ */
4780
+ export type UserMessageContentPart = {
4781
+ type: "text" | "image_url" | "input_audio" | "file";
4782
+ text?: string;
4783
+ image_url?: {
4784
+ url?: string;
4785
+ detail?: "auto" | "low" | "high";
4786
+ };
4787
+ input_audio?: {
4788
+ data?: string;
4789
+ format?: "wav" | "mp3";
4790
+ };
4791
+ file?: {
4792
+ file_data?: string;
4793
+ file_id?: string;
4794
+ filename?: string;
4795
+ };
4796
+ };
4797
+ export type UserMessage = {
4798
+ role: "user";
4799
+ content: string | Array<UserMessageContentPart>;
4800
+ name?: string;
4801
+ };
4802
+ export type AssistantMessageContentPart = {
4803
+ type: "text" | "refusal";
4804
+ text?: string;
4805
+ refusal?: string;
4806
+ };
4807
+ export type AssistantMessage = {
4808
+ role: "assistant";
4809
+ content?: string | null | Array<AssistantMessageContentPart>;
4810
+ refusal?: string | null;
4811
+ name?: string;
4812
+ audio?: {
4813
+ id: string;
4814
+ };
4815
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4816
+ function_call?: {
4817
+ name: string;
4818
+ arguments: string;
4819
+ };
4820
+ };
4821
+ export type ToolMessage = {
4822
+ role: "tool";
4823
+ content:
4824
+ | string
4825
+ | Array<{
4826
+ type: "text";
4827
+ text: string;
4828
+ }>;
4829
+ tool_call_id: string;
4830
+ };
4831
+ export type FunctionMessage = {
4832
+ role: "function";
4833
+ content: string;
4834
+ name: string;
4835
+ };
4836
+ export type ChatCompletionMessageParam =
4837
+ | DeveloperMessage
4838
+ | SystemMessage
4839
+ | UserMessage
4840
+ | AssistantMessage
4841
+ | ToolMessage
4842
+ | FunctionMessage;
4843
+ export type ChatCompletionsResponseFormatText = {
4844
+ type: "text";
4845
+ };
4846
+ export type ChatCompletionsResponseFormatJSONObject = {
4847
+ type: "json_object";
4848
+ };
4849
+ export type ResponseFormatJSONSchema = {
4850
+ type: "json_schema";
4851
+ json_schema: {
4852
+ name: string;
4853
+ description?: string;
4854
+ schema?: Record<string, unknown>;
4855
+ strict?: boolean | null;
4856
+ };
4857
+ };
4858
+ export type ResponseFormat =
4859
+ | ChatCompletionsResponseFormatText
4860
+ | ChatCompletionsResponseFormatJSONObject
4861
+ | ResponseFormatJSONSchema;
4862
+ export type ChatCompletionsStreamOptions = {
4863
+ include_usage?: boolean;
4864
+ include_obfuscation?: boolean;
4865
+ };
4866
+ export type PredictionContent = {
4867
+ type: "content";
4868
+ content:
4869
+ | string
4870
+ | Array<{
4871
+ type: "text";
4872
+ text: string;
4873
+ }>;
4874
+ };
4875
+ export type AudioParams = {
4876
+ voice:
4877
+ | string
4878
+ | {
4879
+ id: string;
4880
+ };
4881
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4882
+ };
4883
+ export type WebSearchUserLocation = {
4884
+ type: "approximate";
4885
+ approximate: {
4886
+ city?: string;
4887
+ country?: string;
4888
+ region?: string;
4889
+ timezone?: string;
4890
+ };
4891
+ };
4892
+ export type WebSearchOptions = {
4893
+ search_context_size?: "low" | "medium" | "high";
4894
+ user_location?: WebSearchUserLocation;
4895
+ };
4896
+ export type ChatTemplateKwargs = {
4897
+ /** Whether to enable reasoning, enabled by default. */
4898
+ enable_thinking?: boolean;
4899
+ /** If false, preserves reasoning context between turns. */
4900
+ clear_thinking?: boolean;
4901
+ };
4902
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4903
+ export type ChatCompletionsCommonOptions = {
4904
+ model?: string;
4905
+ audio?: AudioParams;
4906
+ frequency_penalty?: number | null;
4907
+ logit_bias?: Record<string, unknown> | null;
4908
+ logprobs?: boolean | null;
4909
+ top_logprobs?: number | null;
4910
+ max_tokens?: number | null;
4911
+ max_completion_tokens?: number | null;
4912
+ metadata?: Record<string, unknown> | null;
4913
+ modalities?: Array<"text" | "audio"> | null;
4914
+ n?: number | null;
4915
+ parallel_tool_calls?: boolean;
4916
+ prediction?: PredictionContent;
4917
+ presence_penalty?: number | null;
4918
+ reasoning_effort?: "low" | "medium" | "high" | null;
4919
+ chat_template_kwargs?: ChatTemplateKwargs;
4920
+ response_format?: ResponseFormat;
4921
+ seed?: number | null;
4922
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4923
+ stop?: string | Array<string> | null;
4924
+ store?: boolean | null;
4925
+ stream?: boolean | null;
4926
+ stream_options?: ChatCompletionsStreamOptions;
4927
+ temperature?: number | null;
4928
+ tool_choice?: ChatCompletionToolChoiceOption;
4929
+ tools?: Array<ChatCompletionTool>;
4930
+ top_p?: number | null;
4931
+ user?: string;
4932
+ web_search_options?: WebSearchOptions;
4933
+ function_call?:
4934
+ | "none"
4935
+ | "auto"
4936
+ | {
4937
+ name: string;
4938
+ };
4939
+ functions?: Array<FunctionDefinition>;
4940
+ };
4941
+ export type PromptTokensDetails = {
4942
+ cached_tokens?: number;
4943
+ audio_tokens?: number;
4944
+ };
4945
+ export type CompletionTokensDetails = {
4946
+ reasoning_tokens?: number;
4947
+ audio_tokens?: number;
4948
+ accepted_prediction_tokens?: number;
4949
+ rejected_prediction_tokens?: number;
4950
+ };
4951
+ export type CompletionUsage = {
4952
+ prompt_tokens: number;
4953
+ completion_tokens: number;
4954
+ total_tokens: number;
4955
+ prompt_tokens_details?: PromptTokensDetails;
4956
+ completion_tokens_details?: CompletionTokensDetails;
4957
+ };
4958
+ export type ChatCompletionTopLogprob = {
4959
+ token: string;
4960
+ logprob: number;
4961
+ bytes: Array<number> | null;
4962
+ };
4963
+ export type ChatCompletionTokenLogprob = {
4964
+ token: string;
4965
+ logprob: number;
4966
+ bytes: Array<number> | null;
4967
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4968
+ };
4969
+ export type ChatCompletionAudio = {
4970
+ id: string;
4971
+ /** Base64 encoded audio bytes. */
4972
+ data: string;
4973
+ expires_at: number;
4974
+ transcript: string;
4975
+ };
4976
+ export type ChatCompletionUrlCitation = {
4977
+ type: "url_citation";
4978
+ url_citation: {
4979
+ url: string;
4980
+ title: string;
4981
+ start_index: number;
4982
+ end_index: number;
4983
+ };
4984
+ };
4985
+ export type ChatCompletionResponseMessage = {
4986
+ role: "assistant";
4987
+ content: string | null;
4988
+ refusal: string | null;
4989
+ annotations?: Array<ChatCompletionUrlCitation>;
4990
+ audio?: ChatCompletionAudio;
4991
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4992
+ function_call?: {
4993
+ name: string;
4994
+ arguments: string;
4995
+ } | null;
4996
+ };
4997
+ export type ChatCompletionLogprobs = {
4998
+ content: Array<ChatCompletionTokenLogprob> | null;
4999
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
5000
+ };
5001
+ export type ChatCompletionChoice = {
5002
+ index: number;
5003
+ message: ChatCompletionResponseMessage;
5004
+ finish_reason:
5005
+ | "stop"
5006
+ | "length"
5007
+ | "tool_calls"
5008
+ | "content_filter"
5009
+ | "function_call";
5010
+ logprobs: ChatCompletionLogprobs | null;
5011
+ };
5012
+ export type ChatCompletionsPromptInput = {
5013
+ prompt: string;
5014
+ } & ChatCompletionsCommonOptions;
5015
+ export type ChatCompletionsMessagesInput = {
5016
+ messages: Array<ChatCompletionMessageParam>;
5017
+ } & ChatCompletionsCommonOptions;
5018
+ export type ChatCompletionsOutput = {
5019
+ id: string;
5020
+ object: string;
5021
+ created: number;
5022
+ model: string;
5023
+ choices: Array<ChatCompletionChoice>;
5024
+ usage?: CompletionUsage;
5025
+ system_fingerprint?: string | null;
5026
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
5027
+ };
4323
5028
  /**
4324
5029
  * Workers AI support for OpenAI's Responses API
4325
5030
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4742,6 +5447,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4742
5447
  export type StreamOptions = {
4743
5448
  include_obfuscation?: boolean;
4744
5449
  };
5450
+ /** Marks keys from T that aren't in U as optional never */
5451
+ export type Without<T, U> = {
5452
+ [P in Exclude<keyof T, keyof U>]?: never;
5453
+ };
5454
+ /** Either T or U, but not both (mutually exclusive) */
5455
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4745
5456
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4746
5457
  | {
4747
5458
  text: string | string[];
@@ -5034,10 +5745,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5034
5745
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5035
5746
  }
5036
5747
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5037
- /**
5038
- * Base64 encoded value of the audio data.
5039
- */
5040
- audio: string;
5748
+ audio:
5749
+ | string
5750
+ | {
5751
+ body?: object;
5752
+ contentType?: string;
5753
+ };
5041
5754
  /**
5042
5755
  * Supported tasks are 'translate' or 'transcribe'.
5043
5756
  */
@@ -5055,9 +5768,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5055
5768
  */
5056
5769
  initial_prompt?: string;
5057
5770
  /**
5058
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5771
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5059
5772
  */
5060
5773
  prefix?: string;
5774
+ /**
5775
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5776
+ */
5777
+ beam_size?: number;
5778
+ /**
5779
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5780
+ */
5781
+ condition_on_previous_text?: boolean;
5782
+ /**
5783
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5784
+ */
5785
+ no_speech_threshold?: number;
5786
+ /**
5787
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5788
+ */
5789
+ compression_ratio_threshold?: number;
5790
+ /**
5791
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5792
+ */
5793
+ log_prob_threshold?: number;
5794
+ /**
5795
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5796
+ */
5797
+ hallucination_silence_threshold?: number;
5061
5798
  }
5062
5799
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5063
5800
  transcription_info?: {
@@ -5204,11 +5941,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5204
5941
  truncate_inputs?: boolean;
5205
5942
  }
5206
5943
  export type Ai_Cf_Baai_Bge_M3_Output =
5207
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5944
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5208
5945
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5209
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5946
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5210
5947
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5211
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5948
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5212
5949
  response?: {
5213
5950
  /**
5214
5951
  * Index of the context in the request
@@ -5228,7 +5965,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5228
5965
  */
5229
5966
  pooling?: "mean" | "cls";
5230
5967
  }
5231
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5968
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5232
5969
  shape?: number[];
5233
5970
  /**
5234
5971
  * Embeddings of the requested text values
@@ -5333,7 +6070,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5333
6070
  */
5334
6071
  role?: string;
5335
6072
  /**
5336
- * 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
6073
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5337
6074
  */
5338
6075
  tool_call_id?: string;
5339
6076
  content?:
@@ -5588,10 +6325,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5588
6325
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5589
6326
  */
5590
6327
  role: string;
5591
- /**
5592
- * The content of the message as a string.
5593
- */
5594
- content: string;
6328
+ content:
6329
+ | string
6330
+ | {
6331
+ /**
6332
+ * Type of the content (text)
6333
+ */
6334
+ type?: string;
6335
+ /**
6336
+ * Text content
6337
+ */
6338
+ text?: string;
6339
+ }[];
5595
6340
  }[];
5596
6341
  functions?: {
5597
6342
  name: string;
@@ -6247,7 +6992,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6247
6992
  */
6248
6993
  role?: string;
6249
6994
  /**
6250
- * 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
6995
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6251
6996
  */
6252
6997
  tool_call_id?: string;
6253
6998
  content?:
@@ -6374,7 +7119,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6374
7119
  }
6375
7120
  )[];
6376
7121
  /**
6377
- * JSON schema that should be fulfilled for the response.
7122
+ * JSON schema that should be fufilled for the response.
6378
7123
  */
6379
7124
  guided_json?: object;
6380
7125
  /**
@@ -6648,7 +7393,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6648
7393
  }
6649
7394
  )[];
6650
7395
  /**
6651
- * JSON schema that should be fulfilled for the response.
7396
+ * JSON schema that should be fufilled for the response.
6652
7397
  */
6653
7398
  guided_json?: object;
6654
7399
  /**
@@ -6741,7 +7486,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6741
7486
  */
6742
7487
  prompt: string;
6743
7488
  /**
6744
- * JSON schema that should be fulfilled for the response.
7489
+ * JSON schema that should be fufilled for the response.
6745
7490
  */
6746
7491
  guided_json?: object;
6747
7492
  /**
@@ -6905,7 +7650,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6905
7650
  }
6906
7651
  )[];
6907
7652
  /**
6908
- * JSON schema that should be fulfilled for the response.
7653
+ * JSON schema that should be fufilled for the response.
6909
7654
  */
6910
7655
  guided_json?: object;
6911
7656
  /**
@@ -7186,7 +7931,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7186
7931
  )[];
7187
7932
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7188
7933
  /**
7189
- * JSON schema that should be fulfilled for the response.
7934
+ * JSON schema that should be fufilled for the response.
7190
7935
  */
7191
7936
  guided_json?: object;
7192
7937
  /**
@@ -7425,7 +8170,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7425
8170
  )[];
7426
8171
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7427
8172
  /**
7428
- * JSON schema that should be fulfilled for the response.
8173
+ * JSON schema that should be fufilled for the response.
7429
8174
  */
7430
8175
  guided_json?: object;
7431
8176
  /**
@@ -7590,10 +8335,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7590
8335
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7591
8336
  */
7592
8337
  role: string;
7593
- /**
7594
- * The content of the message as a string.
7595
- */
7596
- content: string;
8338
+ content:
8339
+ | string
8340
+ | {
8341
+ /**
8342
+ * Type of the content (text)
8343
+ */
8344
+ type?: string;
8345
+ /**
8346
+ * Text content
8347
+ */
8348
+ text?: string;
8349
+ }[];
7597
8350
  }[];
7598
8351
  functions?: {
7599
8352
  name: string;
@@ -7805,10 +8558,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7805
8558
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7806
8559
  */
7807
8560
  role: string;
7808
- /**
7809
- * The content of the message as a string.
7810
- */
7811
- content: string;
8561
+ content:
8562
+ | string
8563
+ | {
8564
+ /**
8565
+ * Type of the content (text)
8566
+ */
8567
+ type?: string;
8568
+ /**
8569
+ * Text content
8570
+ */
8571
+ text?: string;
8572
+ }[];
7812
8573
  }[];
7813
8574
  functions?: {
7814
8575
  name: string;
@@ -8376,12 +9137,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8376
9137
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8377
9138
  }
8378
9139
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8379
- inputs: ResponsesInput;
8380
- postProcessedOutputs: ResponsesOutput;
9140
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9141
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8381
9142
  }
8382
9143
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8383
- inputs: ResponsesInput;
8384
- postProcessedOutputs: ResponsesOutput;
9144
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9145
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8385
9146
  }
8386
9147
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8387
9148
  /**
@@ -8513,7 +9274,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8513
9274
  */
8514
9275
  text: string | string[];
8515
9276
  /**
8516
- * Target language to translate to
9277
+ * Target langauge to translate to
8517
9278
  */
8518
9279
  target_language:
8519
9280
  | "asm_Beng"
@@ -8629,10 +9390,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8629
9390
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8630
9391
  */
8631
9392
  role: string;
8632
- /**
8633
- * The content of the message as a string.
8634
- */
8635
- content: string;
9393
+ content:
9394
+ | string
9395
+ | {
9396
+ /**
9397
+ * Type of the content (text)
9398
+ */
9399
+ type?: string;
9400
+ /**
9401
+ * Text content
9402
+ */
9403
+ text?: string;
9404
+ }[];
8636
9405
  }[];
8637
9406
  functions?: {
8638
9407
  name: string;
@@ -8844,10 +9613,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8844
9613
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8845
9614
  */
8846
9615
  role: string;
8847
- /**
8848
- * The content of the message as a string.
8849
- */
8850
- content: string;
9616
+ content:
9617
+ | string
9618
+ | {
9619
+ /**
9620
+ * Type of the content (text)
9621
+ */
9622
+ type?: string;
9623
+ /**
9624
+ * Text content
9625
+ */
9626
+ text?: string;
9627
+ }[];
8851
9628
  }[];
8852
9629
  functions?: {
8853
9630
  name: string;
@@ -9402,6 +10179,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9402
10179
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9403
10180
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9404
10181
  }
10182
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
10183
+ multipart: {
10184
+ body?: object;
10185
+ contentType?: string;
10186
+ };
10187
+ }
10188
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
10189
+ /**
10190
+ * Generated image as Base64 string.
10191
+ */
10192
+ image?: string;
10193
+ }
10194
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
10195
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
10196
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
10197
+ }
10198
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
10199
+ multipart: {
10200
+ body?: object;
10201
+ contentType?: string;
10202
+ };
10203
+ }
10204
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
10205
+ /**
10206
+ * Generated image as Base64 string.
10207
+ */
10208
+ image?: string;
10209
+ }
10210
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
10211
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
10212
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
10213
+ }
10214
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
10215
+ multipart: {
10216
+ body?: object;
10217
+ contentType?: string;
10218
+ };
10219
+ }
10220
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
10221
+ /**
10222
+ * Generated image as Base64 string.
10223
+ */
10224
+ image?: string;
10225
+ }
10226
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
10227
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
10228
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
10229
+ }
10230
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
10231
+ inputs: ChatCompletionsInput;
10232
+ postProcessedOutputs: ChatCompletionsOutput;
10233
+ }
10234
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
10235
+ inputs: ChatCompletionsInput;
10236
+ postProcessedOutputs: ChatCompletionsOutput;
10237
+ }
10238
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
10239
+ inputs: ChatCompletionsInput;
10240
+ postProcessedOutputs: ChatCompletionsOutput;
10241
+ }
9405
10242
  export interface AiModels {
9406
10243
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9407
10244
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9420,7 +10257,6 @@ export interface AiModels {
9420
10257
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9421
10258
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9422
10259
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9423
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9424
10260
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9425
10261
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9426
10262
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9487,6 +10323,12 @@ export interface AiModels {
9487
10323
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9488
10324
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9489
10325
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10326
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10327
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10328
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10329
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10330
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10331
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9490
10332
  }
9491
10333
  export type AiOptions = {
9492
10334
  /**
@@ -9512,6 +10354,7 @@ export type AiOptions = {
9512
10354
  returnRawResponse?: boolean;
9513
10355
  prefix?: string;
9514
10356
  extraHeaders?: object;
10357
+ signal?: AbortSignal;
9515
10358
  };
9516
10359
  export type AiModelsSearchParams = {
9517
10360
  author?: string;
@@ -9538,6 +10381,16 @@ export type AiModelsSearchObject = {
9538
10381
  value: string;
9539
10382
  }[];
9540
10383
  };
10384
+ export type ChatCompletionsBase = XOR<
10385
+ ChatCompletionsPromptInput,
10386
+ ChatCompletionsMessagesInput
10387
+ >;
10388
+ export type ChatCompletionsInput = XOR<
10389
+ ChatCompletionsBase,
10390
+ {
10391
+ requests: ChatCompletionsBase[];
10392
+ }
10393
+ >;
9541
10394
  export interface InferenceUpstreamError extends Error {}
9542
10395
  export interface AiInternalError extends Error {}
9543
10396
  export type AiModelListType = Record<string, any>;
@@ -9547,46 +10400,16 @@ export declare abstract class Ai<
9547
10400
  aiGatewayLogId: string | null;
9548
10401
  gateway(gatewayId: string): AiGateway;
9549
10402
  /**
9550
- * Access the AI Search API for managing AI-powered search instances.
9551
- *
9552
- * This is the new API that replaces AutoRAG with better namespace separation:
9553
- * - Account-level operations: `list()`, `create()`
9554
- * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
9555
- *
9556
- * @example
9557
- * ```typescript
9558
- * // List all AI Search instances
9559
- * const instances = await env.AI.aiSearch.list();
9560
- *
9561
- * // Search an instance
9562
- * const results = await env.AI.aiSearch.get('my-search').search({
9563
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9564
- * ai_search_options: {
9565
- * retrieval: { max_num_results: 10 }
9566
- * }
9567
- * });
9568
- *
9569
- * // Generate chat completions with AI Search context
9570
- * const response = await env.AI.aiSearch.get('my-search').chatCompletions({
9571
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9572
- * model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
9573
- * });
9574
- * ```
10403
+ * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10404
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9575
10405
  */
9576
- aiSearch(): AiSearchAccountService;
10406
+ aiSearch(): AiSearchNamespace;
9577
10407
  /**
9578
10408
  * @deprecated AutoRAG has been replaced by AI Search.
9579
- * Use `env.AI.aiSearch` instead for better API design and new features.
9580
- *
9581
- * Migration guide:
9582
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9583
- * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
9584
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
10409
+ * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10410
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9585
10411
  *
9586
- * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
9587
- *
9588
- * @see AiSearchAccountService
9589
- * @param autoragId Optional instance ID (omit for account-level operations)
10412
+ * @param autoragId Instance ID
9590
10413
  */
9591
10414
  autorag(autoragId: string): AutoRAG;
9592
10415
  run<
@@ -9745,22 +10568,23 @@ export declare abstract class AiGateway {
9745
10568
  getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
9746
10569
  }
9747
10570
  /**
9748
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
9749
- * @see AiSearchInternalError
10571
+ * @deprecated Use the standalone AI Search Workers binding instead.
10572
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9750
10573
  */
9751
10574
  export interface AutoRAGInternalError extends Error {}
9752
10575
  /**
9753
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
9754
- * @see AiSearchNotFoundError
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 AutoRAGNotFoundError extends Error {}
9757
10580
  /**
9758
- * @deprecated This error type is no longer used in the AI Search API.
10581
+ * @deprecated Use the standalone AI Search Workers binding instead.
10582
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9759
10583
  */
9760
10584
  export interface AutoRAGUnauthorizedError extends Error {}
9761
10585
  /**
9762
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
9763
- * @see AiSearchNameNotSetError
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 AutoRAGNameNotSetError extends Error {}
9766
10590
  export type ComparisonFilter = {
@@ -9773,9 +10597,8 @@ export type CompoundFilter = {
9773
10597
  filters: ComparisonFilter[];
9774
10598
  };
9775
10599
  /**
9776
- * @deprecated AutoRAG has been replaced by AI Search.
9777
- * Use AiSearchSearchRequest with the new API instead.
9778
- * @see AiSearchSearchRequest
10600
+ * @deprecated Use the standalone AI Search Workers binding instead.
10601
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9779
10602
  */
9780
10603
  export type AutoRagSearchRequest = {
9781
10604
  query: string;
@@ -9792,18 +10615,16 @@ export type AutoRagSearchRequest = {
9792
10615
  rewrite_query?: boolean;
9793
10616
  };
9794
10617
  /**
9795
- * @deprecated AutoRAG has been replaced by AI Search.
9796
- * Use AiSearchChatCompletionsRequest with the new API instead.
9797
- * @see AiSearchChatCompletionsRequest
10618
+ * @deprecated Use the standalone AI Search Workers binding instead.
10619
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9798
10620
  */
9799
10621
  export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
9800
10622
  stream?: boolean;
9801
10623
  system_prompt?: string;
9802
10624
  };
9803
10625
  /**
9804
- * @deprecated AutoRAG has been replaced by AI Search.
9805
- * Use AiSearchChatCompletionsRequest with stream: true instead.
9806
- * @see AiSearchChatCompletionsRequest
10626
+ * @deprecated Use the standalone AI Search Workers binding instead.
10627
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9807
10628
  */
9808
10629
  export type AutoRagAiSearchRequestStreaming = Omit<
9809
10630
  AutoRagAiSearchRequest,
@@ -9812,9 +10633,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
9812
10633
  stream: true;
9813
10634
  };
9814
10635
  /**
9815
- * @deprecated AutoRAG has been replaced by AI Search.
9816
- * Use AiSearchSearchResponse with the new API instead.
9817
- * @see AiSearchSearchResponse
10636
+ * @deprecated Use the standalone AI Search Workers binding instead.
10637
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9818
10638
  */
9819
10639
  export type AutoRagSearchResponse = {
9820
10640
  object: "vector_store.search_results.page";
@@ -9833,9 +10653,8 @@ export type AutoRagSearchResponse = {
9833
10653
  next_page: string | null;
9834
10654
  };
9835
10655
  /**
9836
- * @deprecated AutoRAG has been replaced by AI Search.
9837
- * Use AiSearchListResponse with the new API instead.
9838
- * @see AiSearchListResponse
10656
+ * @deprecated Use the standalone AI Search Workers binding instead.
10657
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9839
10658
  */
9840
10659
  export type AutoRagListResponse = {
9841
10660
  id: string;
@@ -9847,49 +10666,40 @@ export type AutoRagListResponse = {
9847
10666
  status: string;
9848
10667
  }[];
9849
10668
  /**
9850
- * @deprecated AutoRAG has been replaced by AI Search.
9851
- * The new API returns different response formats for chat completions.
10669
+ * @deprecated Use the standalone AI Search Workers binding instead.
10670
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9852
10671
  */
9853
10672
  export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
9854
10673
  response: string;
9855
10674
  };
9856
10675
  /**
9857
- * @deprecated AutoRAG has been replaced by AI Search.
9858
- * Use the new AI Search API instead: `env.AI.aiSearch`
9859
- *
9860
- * Migration guide:
9861
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9862
- * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
9863
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
9864
- *
9865
- * @see AiSearchAccountService
9866
- * @see AiSearchInstanceService
10676
+ * @deprecated Use the standalone AI Search Workers binding instead.
10677
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9867
10678
  */
9868
10679
  export declare abstract class AutoRAG {
9869
10680
  /**
9870
- * @deprecated Use `env.AI.aiSearch.list()` instead.
9871
- * @see AiSearchAccountService.list
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
  list(): Promise<AutoRagListResponse>;
9874
10685
  /**
9875
- * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
9876
- * Note: The new API uses a messages array instead of a query string.
9877
- * @see AiSearchInstanceService.search
10686
+ * @deprecated Use the standalone AI Search Workers binding instead.
10687
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9878
10688
  */
9879
10689
  search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
9880
10690
  /**
9881
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9882
- * @see AiSearchInstanceService.chatCompletions
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
  aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
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: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
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(
9895
10705
  params: AutoRagAiSearchRequest,
@@ -10014,6 +10824,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
10014
10824
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
10015
10825
  */
10016
10826
  cacheTtlByStatus?: Record<string, number>;
10827
+ /**
10828
+ * Explicit Cache-Control header value to set on the response stored in cache.
10829
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10830
+ *
10831
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10832
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10833
+ *
10834
+ * Can be used together with `cacheTtlByStatus`.
10835
+ */
10836
+ cacheControl?: string;
10837
+ /**
10838
+ * Whether the response should be eligible for Cache Reserve storage.
10839
+ */
10840
+ cacheReserveEligible?: boolean;
10841
+ /**
10842
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10843
+ */
10844
+ respectStrongEtag?: boolean;
10845
+ /**
10846
+ * Whether to strip ETag headers from the origin response before caching.
10847
+ */
10848
+ stripEtags?: boolean;
10849
+ /**
10850
+ * Whether to strip Last-Modified headers from the origin response before caching.
10851
+ */
10852
+ stripLastModified?: boolean;
10853
+ /**
10854
+ * Whether to enable Cache Deception Armor, which protects against web cache
10855
+ * deception attacks by verifying the Content-Type matches the URL extension.
10856
+ */
10857
+ cacheDeceptionArmor?: boolean;
10858
+ /**
10859
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10860
+ */
10861
+ cacheReserveMinimumFileSize?: number;
10017
10862
  scrapeShield?: boolean;
10018
10863
  apps?: boolean;
10019
10864
  image?: RequestInitCfPropertiesImage;
@@ -11882,6 +12727,7 @@ export declare namespace CloudflareWorkersModule {
11882
12727
  constructor(ctx: ExecutionContext, env: Env);
11883
12728
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11884
12729
  fetch?(request: Request): Response | Promise<Response>;
12730
+ connect?(socket: Socket): void | Promise<void>;
11885
12731
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11886
12732
  scheduled?(controller: ScheduledController): void | Promise<void>;
11887
12733
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11902,6 +12748,7 @@ export declare namespace CloudflareWorkersModule {
11902
12748
  constructor(ctx: DurableObjectState, env: Env);
11903
12749
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11904
12750
  fetch?(request: Request): Response | Promise<Response>;
12751
+ connect?(socket: Socket): void | Promise<void>;
11905
12752
  webSocketMessage?(
11906
12753
  ws: WebSocket,
11907
12754
  message: string | ArrayBuffer,
@@ -12042,17 +12889,6 @@ export interface StreamBinding {
12042
12889
  * @returns A handle for per-video operations.
12043
12890
  */
12044
12891
  video(id: string): StreamVideoHandle;
12045
- /**
12046
- * Uploads a new video from a File.
12047
- * @param file The video file to upload.
12048
- * @returns The uploaded video details.
12049
- * @throws {BadRequestError} if the upload parameter is invalid
12050
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12051
- * @throws {MaxFileSizeError} if the file size is too large
12052
- * @throws {RateLimitedError} if the server received too many requests
12053
- * @throws {InternalError} if an unexpected error occurs
12054
- */
12055
- upload(file: File): Promise<StreamVideo>;
12056
12892
  /**
12057
12893
  * Uploads a new video from a provided URL.
12058
12894
  * @param url The URL to upload from.
@@ -12902,6 +13738,9 @@ export declare namespace TailStream {
12902
13738
  readonly type: "fetch";
12903
13739
  readonly statusCode: number;
12904
13740
  }
13741
+ interface ConnectEventInfo {
13742
+ readonly type: "connect";
13743
+ }
12905
13744
  type EventOutcome =
12906
13745
  | "ok"
12907
13746
  | "canceled"
@@ -12932,6 +13771,7 @@ export declare namespace TailStream {
12932
13771
  readonly scriptVersion?: ScriptVersion;
12933
13772
  readonly info:
12934
13773
  | FetchEventInfo
13774
+ | ConnectEventInfo
12935
13775
  | JsRpcEventInfo
12936
13776
  | ScheduledEventInfo
12937
13777
  | AlarmEventInfo