@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,
@@ -3088,6 +3097,11 @@ export interface QueuingStrategyInit {
3088
3097
  */
3089
3098
  highWaterMark: number;
3090
3099
  }
3100
+ export interface TracePreviewInfo {
3101
+ id: string;
3102
+ slug: string;
3103
+ name: string;
3104
+ }
3091
3105
  export interface ScriptVersion {
3092
3106
  id?: string;
3093
3107
  tag?: string;
@@ -3102,6 +3116,7 @@ export interface TraceItem {
3102
3116
  | (
3103
3117
  | TraceItemFetchEventInfo
3104
3118
  | TraceItemJsRpcEventInfo
3119
+ | TraceItemConnectEventInfo
3105
3120
  | TraceItemScheduledEventInfo
3106
3121
  | TraceItemAlarmEventInfo
3107
3122
  | TraceItemQueueEventInfo
@@ -3120,6 +3135,8 @@ export interface TraceItem {
3120
3135
  readonly scriptVersion?: ScriptVersion;
3121
3136
  readonly dispatchNamespace?: string;
3122
3137
  readonly scriptTags?: string[];
3138
+ readonly tailAttributes?: Record<string, boolean | number | string>;
3139
+ readonly preview?: TracePreviewInfo;
3123
3140
  readonly durableObjectId?: string;
3124
3141
  readonly outcome: string;
3125
3142
  readonly executionModel: string;
@@ -3130,6 +3147,7 @@ export interface TraceItem {
3130
3147
  export interface TraceItemAlarmEventInfo {
3131
3148
  readonly scheduledTime: Date;
3132
3149
  }
3150
+ export interface TraceItemConnectEventInfo {}
3133
3151
  export interface TraceItemCustomEventInfo {}
3134
3152
  export interface TraceItemScheduledEventInfo {
3135
3153
  readonly scheduledTime: number;
@@ -3730,7 +3748,7 @@ export interface ContainerStartupOptions {
3730
3748
  entrypoint?: string[];
3731
3749
  enableInternet: boolean;
3732
3750
  env?: Record<string, string>;
3733
- hardTimeout?: number | bigint;
3751
+ labels?: Record<string, string>;
3734
3752
  }
3735
3753
  /**
3736
3754
  * 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.
@@ -3857,11 +3875,10 @@ export declare abstract class Performance {
3857
3875
  */
3858
3876
  toJSON(): object;
3859
3877
  }
3860
- // AI Search V2 API Error Interfaces
3878
+ // ============ AI Search Error Interfaces ============
3861
3879
  export interface AiSearchInternalError extends Error {}
3862
3880
  export interface AiSearchNotFoundError extends Error {}
3863
- export interface AiSearchNameNotSetError extends Error {}
3864
- // AI Search V2 Request Types
3881
+ // ============ AI Search Request Types ============
3865
3882
  export type AiSearchSearchRequest = {
3866
3883
  messages: Array<{
3867
3884
  role: "system" | "developer" | "user" | "assistant" | "tool";
@@ -3886,9 +3903,8 @@ export type AiSearchSearchRequest = {
3886
3903
  [key: string]: unknown;
3887
3904
  };
3888
3905
  reranking?: {
3889
- /** Enable reranking (default false) */
3890
3906
  enabled?: boolean;
3891
- model?: "@cf/baai/bge-reranker-base" | "";
3907
+ model?: "@cf/baai/bge-reranker-base" | string;
3892
3908
  /** Match threshold (0-1, default 0.4) */
3893
3909
  match_threshold?: number;
3894
3910
  [key: string]: unknown;
@@ -3900,6 +3916,7 @@ export type AiSearchChatCompletionsRequest = {
3900
3916
  messages: Array<{
3901
3917
  role: "system" | "developer" | "user" | "assistant" | "tool";
3902
3918
  content: string | null;
3919
+ [key: string]: unknown;
3903
3920
  }>;
3904
3921
  model?: string;
3905
3922
  stream?: boolean;
@@ -3920,7 +3937,7 @@ export type AiSearchChatCompletionsRequest = {
3920
3937
  };
3921
3938
  reranking?: {
3922
3939
  enabled?: boolean;
3923
- model?: "@cf/baai/bge-reranker-base" | "";
3940
+ model?: "@cf/baai/bge-reranker-base" | string;
3924
3941
  match_threshold?: number;
3925
3942
  [key: string]: unknown;
3926
3943
  };
@@ -3928,7 +3945,7 @@ export type AiSearchChatCompletionsRequest = {
3928
3945
  };
3929
3946
  [key: string]: unknown;
3930
3947
  };
3931
- // AI Search V2 Response Types
3948
+ // ============ AI Search Response Types ============
3932
3949
  export type AiSearchSearchResponse = {
3933
3950
  search_query: string;
3934
3951
  chunks: Array<{
@@ -3947,26 +3964,65 @@ export type AiSearchSearchResponse = {
3947
3964
  keyword_score?: number;
3948
3965
  /** Vector similarity score (0-1) */
3949
3966
  vector_score?: number;
3967
+ [key: string]: unknown;
3968
+ };
3969
+ }>;
3970
+ };
3971
+ export type AiSearchChatCompletionsResponse = {
3972
+ id?: string;
3973
+ object?: string;
3974
+ model?: string;
3975
+ choices: Array<{
3976
+ index?: number;
3977
+ message: {
3978
+ role: "system" | "developer" | "user" | "assistant" | "tool";
3979
+ content: string | null;
3980
+ [key: string]: unknown;
3950
3981
  };
3982
+ [key: string]: unknown;
3951
3983
  }>;
3984
+ chunks: AiSearchSearchResponse["chunks"];
3985
+ [key: string]: unknown;
3952
3986
  };
3953
- export type AiSearchListResponse = Array<{
3987
+ export type AiSearchStatsResponse = {
3988
+ queued?: number;
3989
+ running?: number;
3990
+ completed?: number;
3991
+ error?: number;
3992
+ skipped?: number;
3993
+ outdated?: number;
3994
+ last_activity?: string;
3995
+ };
3996
+ // ============ AI Search Instance Info Types ============
3997
+ export type AiSearchInstanceInfo = {
3954
3998
  id: string;
3955
- internal_id?: string;
3956
- account_id?: string;
3957
- account_tag?: string;
3958
- /** Whether the instance is enabled (default true) */
3959
- enable?: boolean;
3960
- type?: "r2" | "web-crawler";
3999
+ type?: "r2" | "web-crawler" | string;
3961
4000
  source?: string;
4001
+ paused?: boolean;
4002
+ status?: string;
4003
+ namespace?: string;
4004
+ created_at?: string;
4005
+ modified_at?: string;
3962
4006
  [key: string]: unknown;
3963
- }>;
4007
+ };
4008
+ export type AiSearchListResponse = {
4009
+ result: AiSearchInstanceInfo[];
4010
+ result_info?: {
4011
+ count: number;
4012
+ page: number;
4013
+ per_page: number;
4014
+ total_count: number;
4015
+ };
4016
+ };
4017
+ // ============ AI Search Config Types ============
3964
4018
  export type AiSearchConfig = {
3965
4019
  /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
3966
4020
  id: string;
3967
- type: "r2" | "web-crawler";
3968
- source: string;
3969
- source_params?: object;
4021
+ /** Instance type. Omit to create with built-in storage. */
4022
+ type?: "r2" | "web-crawler" | string;
4023
+ /** Source URL (required for web-crawler type). */
4024
+ source?: string;
4025
+ source_params?: unknown;
3970
4026
  /** Token ID (UUID format) */
3971
4027
  token_id?: string;
3972
4028
  ai_gateway_id?: string;
@@ -3976,54 +4032,307 @@ export type AiSearchConfig = {
3976
4032
  reranking?: boolean;
3977
4033
  embedding_model?: string;
3978
4034
  ai_search_model?: string;
4035
+ [key: string]: unknown;
3979
4036
  };
3980
- export type AiSearchInstance = {
4037
+ // ============ AI Search Item Types ============
4038
+ export type AiSearchItemInfo = {
3981
4039
  id: string;
3982
- enable?: boolean;
3983
- type?: "r2" | "web-crawler";
3984
- source?: string;
4040
+ key: string;
4041
+ status:
4042
+ | "completed"
4043
+ | "error"
4044
+ | "skipped"
4045
+ | "queued"
4046
+ | "processing"
4047
+ | "outdated";
4048
+ metadata?: Record<string, unknown>;
3985
4049
  [key: string]: unknown;
3986
4050
  };
3987
- // AI Search Instance Service - Instance-level operations
3988
- export declare abstract class AiSearchInstanceService {
4051
+ export type AiSearchItemContentResult = {
4052
+ body: ReadableStream;
4053
+ contentType: string;
4054
+ filename: string;
4055
+ size: number;
4056
+ };
4057
+ export type AiSearchUploadItemOptions = {
4058
+ metadata?: Record<string, unknown>;
4059
+ };
4060
+ export type AiSearchListItemsParams = {
4061
+ page?: number;
4062
+ per_page?: number;
4063
+ };
4064
+ export type AiSearchListItemsResponse = {
4065
+ result: AiSearchItemInfo[];
4066
+ result_info?: {
4067
+ count: number;
4068
+ page: number;
4069
+ per_page: number;
4070
+ total_count: number;
4071
+ };
4072
+ };
4073
+ // ============ AI Search Job Types ============
4074
+ export type AiSearchJobInfo = {
4075
+ id: string;
4076
+ source: "user" | "schedule";
4077
+ description?: string;
4078
+ last_seen_at?: string;
4079
+ started_at?: string;
4080
+ ended_at?: string;
4081
+ end_reason?: string;
4082
+ };
4083
+ export type AiSearchJobLog = {
4084
+ id: number;
4085
+ message: string;
4086
+ message_type: number;
4087
+ created_at: number;
4088
+ };
4089
+ export type AiSearchCreateJobParams = {
4090
+ description?: string;
4091
+ };
4092
+ export type AiSearchListJobsParams = {
4093
+ page?: number;
4094
+ per_page?: number;
4095
+ };
4096
+ export type AiSearchListJobsResponse = {
4097
+ result: AiSearchJobInfo[];
4098
+ result_info?: {
4099
+ count: number;
4100
+ page: number;
4101
+ per_page: number;
4102
+ total_count: number;
4103
+ };
4104
+ };
4105
+ export type AiSearchJobLogsParams = {
4106
+ page?: number;
4107
+ per_page?: number;
4108
+ };
4109
+ export type AiSearchJobLogsResponse = {
4110
+ result: AiSearchJobLog[];
4111
+ result_info?: {
4112
+ count: number;
4113
+ page: number;
4114
+ per_page: number;
4115
+ total_count: number;
4116
+ };
4117
+ };
4118
+ // ============ AI Search Sub-Service Classes ============
4119
+ /**
4120
+ * Single item service for an AI Search instance.
4121
+ * Provides info, delete, and download operations on a specific item.
4122
+ */
4123
+ export declare abstract class AiSearchItem {
4124
+ /** Get metadata about this item. */
4125
+ info(): Promise<AiSearchItemInfo>;
4126
+ /**
4127
+ * Download the item's content.
4128
+ * @returns Object with body stream, content type, filename, and size.
4129
+ */
4130
+ download(): Promise<AiSearchItemContentResult>;
4131
+ }
4132
+ /**
4133
+ * Items collection service for an AI Search instance.
4134
+ * Provides list, upload, and access to individual items.
4135
+ */
4136
+ export declare abstract class AiSearchItems {
4137
+ /** List items in this instance. */
4138
+ list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
4139
+ /**
4140
+ * Upload a file as an item.
4141
+ * @param name Filename for the uploaded item.
4142
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4143
+ * @param options Optional metadata to attach to the item.
4144
+ * @returns The created item info.
4145
+ */
4146
+ upload(
4147
+ name: string,
4148
+ content: ReadableStream | ArrayBuffer | string,
4149
+ options?: AiSearchUploadItemOptions,
4150
+ ): Promise<AiSearchItemInfo>;
4151
+ /**
4152
+ * Upload a file and poll until processing completes.
4153
+ * @param name Filename for the uploaded item.
4154
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4155
+ * @param options Optional metadata to attach to the item.
4156
+ * @returns The item info after processing completes (or timeout).
4157
+ */
4158
+ uploadAndPoll(
4159
+ name: string,
4160
+ content: ReadableStream | ArrayBuffer | string,
4161
+ options?: AiSearchUploadItemOptions,
4162
+ ): Promise<AiSearchItemInfo>;
4163
+ /**
4164
+ * Get an item by ID.
4165
+ * @param itemId The item identifier.
4166
+ * @returns Item service for info, delete, and download operations.
4167
+ */
4168
+ get(itemId: string): AiSearchItem;
4169
+ /** Delete this item from the instance.
4170
+ * @param itemId The item identifier.
4171
+ */
4172
+ delete(itemId: string): Promise<void>;
4173
+ }
4174
+ /**
4175
+ * Single job service for an AI Search instance.
4176
+ * Provides info and logs for a specific job.
4177
+ */
4178
+ export declare abstract class AiSearchJob {
4179
+ /** Get metadata about this job. */
4180
+ info(): Promise<AiSearchJobInfo>;
4181
+ /** Get logs for this job. */
4182
+ logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
4183
+ }
4184
+ /**
4185
+ * Jobs collection service for an AI Search instance.
4186
+ * Provides list, create, and access to individual jobs.
4187
+ */
4188
+ export declare abstract class AiSearchJobs {
4189
+ /** List jobs for this instance. */
4190
+ list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
4191
+ /**
4192
+ * Create a new indexing job.
4193
+ * @param params Optional job parameters.
4194
+ * @returns The created job info.
4195
+ */
4196
+ create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
4197
+ /**
4198
+ * Get a job by ID.
4199
+ * @param jobId The job identifier.
4200
+ * @returns Job service for info and logs operations.
4201
+ */
4202
+ get(jobId: string): AiSearchJob;
4203
+ }
4204
+ // ============ AI Search Binding Classes ============
4205
+ /**
4206
+ * Instance-level AI Search service.
4207
+ *
4208
+ * Used as:
4209
+ * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
4210
+ * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
4211
+ *
4212
+ * Provides search, chat, update, stats, items, and jobs operations.
4213
+ *
4214
+ * @example
4215
+ * ```ts
4216
+ * // Via namespace binding
4217
+ * const instance = env.AI_SEARCH.get("blog");
4218
+ * const results = await instance.search({
4219
+ * messages: [{ role: "user", content: "How does caching work?" }],
4220
+ * });
4221
+ *
4222
+ * // Via single instance binding
4223
+ * const results = await env.BLOG_SEARCH.search({
4224
+ * messages: [{ role: "user", content: "How does caching work?" }],
4225
+ * });
4226
+ * ```
4227
+ */
4228
+ export declare abstract class AiSearchInstance {
3989
4229
  /**
3990
4230
  * Search the AI Search instance for relevant chunks.
3991
- * @param params Search request with messages and AI search options
3992
- * @returns Search response with matching chunks
4231
+ * @param params Search request with messages and optional AI search options.
4232
+ * @returns Search response with matching chunks and search query.
3993
4233
  */
3994
4234
  search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
4235
+ /**
4236
+ * Generate chat completions with AI Search context (streaming).
4237
+ * @param params Chat completions request with stream: true.
4238
+ * @returns ReadableStream of server-sent events.
4239
+ */
4240
+ chatCompletions(
4241
+ params: AiSearchChatCompletionsRequest & {
4242
+ stream: true;
4243
+ },
4244
+ ): Promise<ReadableStream>;
3995
4245
  /**
3996
4246
  * Generate chat completions with AI Search context.
3997
- * @param params Chat completions request with optional streaming
3998
- * @returns Response object (if streaming) or chat completion result
4247
+ * @param params Chat completions request.
4248
+ * @returns Chat completion response with choices and RAG chunks.
3999
4249
  */
4000
4250
  chatCompletions(
4001
4251
  params: AiSearchChatCompletionsRequest,
4002
- ): Promise<Response | object>;
4252
+ ): Promise<AiSearchChatCompletionsResponse>;
4003
4253
  /**
4004
- * Delete this AI Search instance.
4254
+ * Update the instance configuration.
4255
+ * @param config Partial configuration to update.
4256
+ * @returns Updated instance info.
4005
4257
  */
4006
- delete(): Promise<void>;
4258
+ update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
4259
+ /** Get metadata about this instance. */
4260
+ info(): Promise<AiSearchInstanceInfo>;
4261
+ /**
4262
+ * Get instance statistics (item count, indexing status, etc.).
4263
+ * @returns Statistics with counts per status and last activity time.
4264
+ */
4265
+ stats(): Promise<AiSearchStatsResponse>;
4266
+ /** Items collection — list, upload, and manage items in this instance. */
4267
+ get items(): AiSearchItems;
4268
+ /** Jobs collection — list, create, and inspect indexing jobs. */
4269
+ get jobs(): AiSearchJobs;
4007
4270
  }
4008
- // AI Search Account Service - Account-level operations
4009
- export declare abstract class AiSearchAccountService {
4271
+ /**
4272
+ * Namespace-level AI Search service.
4273
+ *
4274
+ * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
4275
+ * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
4276
+ *
4277
+ * @example
4278
+ * ```ts
4279
+ * // Access an instance within the namespace
4280
+ * const blog = env.AI_SEARCH.get("blog");
4281
+ * const results = await blog.search({
4282
+ * messages: [{ role: "user", content: "How does caching work?" }],
4283
+ * });
4284
+ *
4285
+ * // List all instances in the namespace
4286
+ * const instances = await env.AI_SEARCH.list();
4287
+ *
4288
+ * // Create a new instance with built-in storage
4289
+ * const tenant = await env.AI_SEARCH.create({
4290
+ * id: "tenant-123",
4291
+ * });
4292
+ *
4293
+ * // Upload items into the instance
4294
+ * await tenant.items.upload("doc.pdf", fileContent);
4295
+ *
4296
+ * // Delete an instance
4297
+ * await env.AI_SEARCH.delete("tenant-123");
4298
+ * ```
4299
+ */
4300
+ export declare abstract class AiSearchNamespace {
4010
4301
  /**
4011
- * List all AI Search instances in the account.
4012
- * @returns Array of AI Search instances
4302
+ * Get an instance by name within the bound namespace.
4303
+ * @param name Instance name.
4304
+ * @returns Instance service for search, chat, update, stats, items, and jobs.
4305
+ */
4306
+ get(name: string): AiSearchInstance;
4307
+ /**
4308
+ * List all instances in the bound namespace.
4309
+ * @returns Array of instance metadata.
4013
4310
  */
4014
4311
  list(): Promise<AiSearchListResponse>;
4015
4312
  /**
4016
- * Get an AI Search instance by ID.
4017
- * @param name Instance ID
4018
- * @returns Instance service for performing operations
4313
+ * Create a new instance within the bound namespace.
4314
+ * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
4315
+ * @returns Instance service for the newly created instance.
4316
+ *
4317
+ * @example
4318
+ * ```ts
4319
+ * // Create with built-in storage (upload items manually)
4320
+ * const instance = await env.AI_SEARCH.create({ id: "my-search" });
4321
+ *
4322
+ * // Create with web crawler source
4323
+ * const instance = await env.AI_SEARCH.create({
4324
+ * id: "docs-search",
4325
+ * type: "web-crawler",
4326
+ * source: "https://developers.cloudflare.com",
4327
+ * });
4328
+ * ```
4019
4329
  */
4020
- get(name: string): AiSearchInstanceService;
4330
+ create(config: AiSearchConfig): Promise<AiSearchInstance>;
4021
4331
  /**
4022
- * Create a new AI Search instance.
4023
- * @param config Instance configuration
4024
- * @returns Instance service for performing operations
4332
+ * Delete an instance from the bound namespace.
4333
+ * @param name Instance name to delete.
4025
4334
  */
4026
- create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
4335
+ delete(name: string): Promise<void>;
4027
4336
  }
4028
4337
  export type AiImageClassificationInput = {
4029
4338
  image: number[];
@@ -4299,6 +4608,402 @@ export declare abstract class BaseAiTranslation {
4299
4608
  inputs: AiTranslationInput;
4300
4609
  postProcessedOutputs: AiTranslationOutput;
4301
4610
  }
4611
+ /**
4612
+ * Workers AI support for OpenAI's Chat Completions API
4613
+ */
4614
+ export type ChatCompletionContentPartText = {
4615
+ type: "text";
4616
+ text: string;
4617
+ };
4618
+ export type ChatCompletionContentPartImage = {
4619
+ type: "image_url";
4620
+ image_url: {
4621
+ url: string;
4622
+ detail?: "auto" | "low" | "high";
4623
+ };
4624
+ };
4625
+ export type ChatCompletionContentPartInputAudio = {
4626
+ type: "input_audio";
4627
+ input_audio: {
4628
+ /** Base64 encoded audio data. */
4629
+ data: string;
4630
+ format: "wav" | "mp3";
4631
+ };
4632
+ };
4633
+ export type ChatCompletionContentPartFile = {
4634
+ type: "file";
4635
+ file: {
4636
+ /** Base64 encoded file data. */
4637
+ file_data?: string;
4638
+ /** The ID of an uploaded file. */
4639
+ file_id?: string;
4640
+ filename?: string;
4641
+ };
4642
+ };
4643
+ export type ChatCompletionContentPartRefusal = {
4644
+ type: "refusal";
4645
+ refusal: string;
4646
+ };
4647
+ export type ChatCompletionContentPart =
4648
+ | ChatCompletionContentPartText
4649
+ | ChatCompletionContentPartImage
4650
+ | ChatCompletionContentPartInputAudio
4651
+ | ChatCompletionContentPartFile;
4652
+ export type FunctionDefinition = {
4653
+ name: string;
4654
+ description?: string;
4655
+ parameters?: Record<string, unknown>;
4656
+ strict?: boolean | null;
4657
+ };
4658
+ export type ChatCompletionFunctionTool = {
4659
+ type: "function";
4660
+ function: FunctionDefinition;
4661
+ };
4662
+ export type ChatCompletionCustomToolGrammarFormat = {
4663
+ type: "grammar";
4664
+ grammar: {
4665
+ definition: string;
4666
+ syntax: "lark" | "regex";
4667
+ };
4668
+ };
4669
+ export type ChatCompletionCustomToolTextFormat = {
4670
+ type: "text";
4671
+ };
4672
+ export type ChatCompletionCustomToolFormat =
4673
+ | ChatCompletionCustomToolTextFormat
4674
+ | ChatCompletionCustomToolGrammarFormat;
4675
+ export type ChatCompletionCustomTool = {
4676
+ type: "custom";
4677
+ custom: {
4678
+ name: string;
4679
+ description?: string;
4680
+ format?: ChatCompletionCustomToolFormat;
4681
+ };
4682
+ };
4683
+ export type ChatCompletionTool =
4684
+ | ChatCompletionFunctionTool
4685
+ | ChatCompletionCustomTool;
4686
+ export type ChatCompletionMessageFunctionToolCall = {
4687
+ id: string;
4688
+ type: "function";
4689
+ function: {
4690
+ name: string;
4691
+ /** JSON-encoded arguments string. */
4692
+ arguments: string;
4693
+ };
4694
+ };
4695
+ export type ChatCompletionMessageCustomToolCall = {
4696
+ id: string;
4697
+ type: "custom";
4698
+ custom: {
4699
+ name: string;
4700
+ input: string;
4701
+ };
4702
+ };
4703
+ export type ChatCompletionMessageToolCall =
4704
+ | ChatCompletionMessageFunctionToolCall
4705
+ | ChatCompletionMessageCustomToolCall;
4706
+ export type ChatCompletionToolChoiceFunction = {
4707
+ type: "function";
4708
+ function: {
4709
+ name: string;
4710
+ };
4711
+ };
4712
+ export type ChatCompletionToolChoiceCustom = {
4713
+ type: "custom";
4714
+ custom: {
4715
+ name: string;
4716
+ };
4717
+ };
4718
+ export type ChatCompletionToolChoiceAllowedTools = {
4719
+ type: "allowed_tools";
4720
+ allowed_tools: {
4721
+ mode: "auto" | "required";
4722
+ tools: Array<Record<string, unknown>>;
4723
+ };
4724
+ };
4725
+ export type ChatCompletionToolChoiceOption =
4726
+ | "none"
4727
+ | "auto"
4728
+ | "required"
4729
+ | ChatCompletionToolChoiceFunction
4730
+ | ChatCompletionToolChoiceCustom
4731
+ | ChatCompletionToolChoiceAllowedTools;
4732
+ export type DeveloperMessage = {
4733
+ role: "developer";
4734
+ content:
4735
+ | string
4736
+ | Array<{
4737
+ type: "text";
4738
+ text: string;
4739
+ }>;
4740
+ name?: string;
4741
+ };
4742
+ export type SystemMessage = {
4743
+ role: "system";
4744
+ content:
4745
+ | string
4746
+ | Array<{
4747
+ type: "text";
4748
+ text: string;
4749
+ }>;
4750
+ name?: string;
4751
+ };
4752
+ /**
4753
+ * Permissive merged content part used inside UserMessage arrays.
4754
+ *
4755
+ * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
4756
+ * inside nested array items does not correctly match different branches for
4757
+ * different array elements, so the schema uses a single merged object.
4758
+ */
4759
+ export type UserMessageContentPart = {
4760
+ type: "text" | "image_url" | "input_audio" | "file";
4761
+ text?: string;
4762
+ image_url?: {
4763
+ url?: string;
4764
+ detail?: "auto" | "low" | "high";
4765
+ };
4766
+ input_audio?: {
4767
+ data?: string;
4768
+ format?: "wav" | "mp3";
4769
+ };
4770
+ file?: {
4771
+ file_data?: string;
4772
+ file_id?: string;
4773
+ filename?: string;
4774
+ };
4775
+ };
4776
+ export type UserMessage = {
4777
+ role: "user";
4778
+ content: string | Array<UserMessageContentPart>;
4779
+ name?: string;
4780
+ };
4781
+ export type AssistantMessageContentPart = {
4782
+ type: "text" | "refusal";
4783
+ text?: string;
4784
+ refusal?: string;
4785
+ };
4786
+ export type AssistantMessage = {
4787
+ role: "assistant";
4788
+ content?: string | null | Array<AssistantMessageContentPart>;
4789
+ refusal?: string | null;
4790
+ name?: string;
4791
+ audio?: {
4792
+ id: string;
4793
+ };
4794
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4795
+ function_call?: {
4796
+ name: string;
4797
+ arguments: string;
4798
+ };
4799
+ };
4800
+ export type ToolMessage = {
4801
+ role: "tool";
4802
+ content:
4803
+ | string
4804
+ | Array<{
4805
+ type: "text";
4806
+ text: string;
4807
+ }>;
4808
+ tool_call_id: string;
4809
+ };
4810
+ export type FunctionMessage = {
4811
+ role: "function";
4812
+ content: string;
4813
+ name: string;
4814
+ };
4815
+ export type ChatCompletionMessageParam =
4816
+ | DeveloperMessage
4817
+ | SystemMessage
4818
+ | UserMessage
4819
+ | AssistantMessage
4820
+ | ToolMessage
4821
+ | FunctionMessage;
4822
+ export type ChatCompletionsResponseFormatText = {
4823
+ type: "text";
4824
+ };
4825
+ export type ChatCompletionsResponseFormatJSONObject = {
4826
+ type: "json_object";
4827
+ };
4828
+ export type ResponseFormatJSONSchema = {
4829
+ type: "json_schema";
4830
+ json_schema: {
4831
+ name: string;
4832
+ description?: string;
4833
+ schema?: Record<string, unknown>;
4834
+ strict?: boolean | null;
4835
+ };
4836
+ };
4837
+ export type ResponseFormat =
4838
+ | ChatCompletionsResponseFormatText
4839
+ | ChatCompletionsResponseFormatJSONObject
4840
+ | ResponseFormatJSONSchema;
4841
+ export type ChatCompletionsStreamOptions = {
4842
+ include_usage?: boolean;
4843
+ include_obfuscation?: boolean;
4844
+ };
4845
+ export type PredictionContent = {
4846
+ type: "content";
4847
+ content:
4848
+ | string
4849
+ | Array<{
4850
+ type: "text";
4851
+ text: string;
4852
+ }>;
4853
+ };
4854
+ export type AudioParams = {
4855
+ voice:
4856
+ | string
4857
+ | {
4858
+ id: string;
4859
+ };
4860
+ format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
4861
+ };
4862
+ export type WebSearchUserLocation = {
4863
+ type: "approximate";
4864
+ approximate: {
4865
+ city?: string;
4866
+ country?: string;
4867
+ region?: string;
4868
+ timezone?: string;
4869
+ };
4870
+ };
4871
+ export type WebSearchOptions = {
4872
+ search_context_size?: "low" | "medium" | "high";
4873
+ user_location?: WebSearchUserLocation;
4874
+ };
4875
+ export type ChatTemplateKwargs = {
4876
+ /** Whether to enable reasoning, enabled by default. */
4877
+ enable_thinking?: boolean;
4878
+ /** If false, preserves reasoning context between turns. */
4879
+ clear_thinking?: boolean;
4880
+ };
4881
+ /** Shared optional properties used by both Prompt and Messages input branches. */
4882
+ export type ChatCompletionsCommonOptions = {
4883
+ model?: string;
4884
+ audio?: AudioParams;
4885
+ frequency_penalty?: number | null;
4886
+ logit_bias?: Record<string, unknown> | null;
4887
+ logprobs?: boolean | null;
4888
+ top_logprobs?: number | null;
4889
+ max_tokens?: number | null;
4890
+ max_completion_tokens?: number | null;
4891
+ metadata?: Record<string, unknown> | null;
4892
+ modalities?: Array<"text" | "audio"> | null;
4893
+ n?: number | null;
4894
+ parallel_tool_calls?: boolean;
4895
+ prediction?: PredictionContent;
4896
+ presence_penalty?: number | null;
4897
+ reasoning_effort?: "low" | "medium" | "high" | null;
4898
+ chat_template_kwargs?: ChatTemplateKwargs;
4899
+ response_format?: ResponseFormat;
4900
+ seed?: number | null;
4901
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
4902
+ stop?: string | Array<string> | null;
4903
+ store?: boolean | null;
4904
+ stream?: boolean | null;
4905
+ stream_options?: ChatCompletionsStreamOptions;
4906
+ temperature?: number | null;
4907
+ tool_choice?: ChatCompletionToolChoiceOption;
4908
+ tools?: Array<ChatCompletionTool>;
4909
+ top_p?: number | null;
4910
+ user?: string;
4911
+ web_search_options?: WebSearchOptions;
4912
+ function_call?:
4913
+ | "none"
4914
+ | "auto"
4915
+ | {
4916
+ name: string;
4917
+ };
4918
+ functions?: Array<FunctionDefinition>;
4919
+ };
4920
+ export type PromptTokensDetails = {
4921
+ cached_tokens?: number;
4922
+ audio_tokens?: number;
4923
+ };
4924
+ export type CompletionTokensDetails = {
4925
+ reasoning_tokens?: number;
4926
+ audio_tokens?: number;
4927
+ accepted_prediction_tokens?: number;
4928
+ rejected_prediction_tokens?: number;
4929
+ };
4930
+ export type CompletionUsage = {
4931
+ prompt_tokens: number;
4932
+ completion_tokens: number;
4933
+ total_tokens: number;
4934
+ prompt_tokens_details?: PromptTokensDetails;
4935
+ completion_tokens_details?: CompletionTokensDetails;
4936
+ };
4937
+ export type ChatCompletionTopLogprob = {
4938
+ token: string;
4939
+ logprob: number;
4940
+ bytes: Array<number> | null;
4941
+ };
4942
+ export type ChatCompletionTokenLogprob = {
4943
+ token: string;
4944
+ logprob: number;
4945
+ bytes: Array<number> | null;
4946
+ top_logprobs: Array<ChatCompletionTopLogprob>;
4947
+ };
4948
+ export type ChatCompletionAudio = {
4949
+ id: string;
4950
+ /** Base64 encoded audio bytes. */
4951
+ data: string;
4952
+ expires_at: number;
4953
+ transcript: string;
4954
+ };
4955
+ export type ChatCompletionUrlCitation = {
4956
+ type: "url_citation";
4957
+ url_citation: {
4958
+ url: string;
4959
+ title: string;
4960
+ start_index: number;
4961
+ end_index: number;
4962
+ };
4963
+ };
4964
+ export type ChatCompletionResponseMessage = {
4965
+ role: "assistant";
4966
+ content: string | null;
4967
+ refusal: string | null;
4968
+ annotations?: Array<ChatCompletionUrlCitation>;
4969
+ audio?: ChatCompletionAudio;
4970
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
4971
+ function_call?: {
4972
+ name: string;
4973
+ arguments: string;
4974
+ } | null;
4975
+ };
4976
+ export type ChatCompletionLogprobs = {
4977
+ content: Array<ChatCompletionTokenLogprob> | null;
4978
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
4979
+ };
4980
+ export type ChatCompletionChoice = {
4981
+ index: number;
4982
+ message: ChatCompletionResponseMessage;
4983
+ finish_reason:
4984
+ | "stop"
4985
+ | "length"
4986
+ | "tool_calls"
4987
+ | "content_filter"
4988
+ | "function_call";
4989
+ logprobs: ChatCompletionLogprobs | null;
4990
+ };
4991
+ export type ChatCompletionsPromptInput = {
4992
+ prompt: string;
4993
+ } & ChatCompletionsCommonOptions;
4994
+ export type ChatCompletionsMessagesInput = {
4995
+ messages: Array<ChatCompletionMessageParam>;
4996
+ } & ChatCompletionsCommonOptions;
4997
+ export type ChatCompletionsOutput = {
4998
+ id: string;
4999
+ object: string;
5000
+ created: number;
5001
+ model: string;
5002
+ choices: Array<ChatCompletionChoice>;
5003
+ usage?: CompletionUsage;
5004
+ system_fingerprint?: string | null;
5005
+ service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
5006
+ };
4302
5007
  /**
4303
5008
  * Workers AI support for OpenAI's Responses API
4304
5009
  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
@@ -4721,6 +5426,12 @@ export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
4721
5426
  export type StreamOptions = {
4722
5427
  include_obfuscation?: boolean;
4723
5428
  };
5429
+ /** Marks keys from T that aren't in U as optional never */
5430
+ export type Without<T, U> = {
5431
+ [P in Exclude<keyof T, keyof U>]?: never;
5432
+ };
5433
+ /** Either T or U, but not both (mutually exclusive) */
5434
+ export type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
4724
5435
  export type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
4725
5436
  | {
4726
5437
  text: string | string[];
@@ -5013,10 +5724,12 @@ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
5013
5724
  postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
5014
5725
  }
5015
5726
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5016
- /**
5017
- * Base64 encoded value of the audio data.
5018
- */
5019
- audio: string;
5727
+ audio:
5728
+ | string
5729
+ | {
5730
+ body?: object;
5731
+ contentType?: string;
5732
+ };
5020
5733
  /**
5021
5734
  * Supported tasks are 'translate' or 'transcribe'.
5022
5735
  */
@@ -5034,9 +5747,33 @@ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
5034
5747
  */
5035
5748
  initial_prompt?: string;
5036
5749
  /**
5037
- * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
5750
+ * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
5038
5751
  */
5039
5752
  prefix?: string;
5753
+ /**
5754
+ * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
5755
+ */
5756
+ beam_size?: number;
5757
+ /**
5758
+ * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
5759
+ */
5760
+ condition_on_previous_text?: boolean;
5761
+ /**
5762
+ * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
5763
+ */
5764
+ no_speech_threshold?: number;
5765
+ /**
5766
+ * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
5767
+ */
5768
+ compression_ratio_threshold?: number;
5769
+ /**
5770
+ * Threshold for filtering out segments with low average log probability, indicating low confidence.
5771
+ */
5772
+ log_prob_threshold?: number;
5773
+ /**
5774
+ * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
5775
+ */
5776
+ hallucination_silence_threshold?: number;
5040
5777
  }
5041
5778
  export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
5042
5779
  transcription_info?: {
@@ -5183,11 +5920,11 @@ export interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
5183
5920
  truncate_inputs?: boolean;
5184
5921
  }
5185
5922
  export type Ai_Cf_Baai_Bge_M3_Output =
5186
- | Ai_Cf_Baai_Bge_M3_Ouput_Query
5923
+ | Ai_Cf_Baai_Bge_M3_Output_Query
5187
5924
  | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
5188
- | Ai_Cf_Baai_Bge_M3_Ouput_Embedding
5925
+ | Ai_Cf_Baai_Bge_M3_Output_Embedding
5189
5926
  | Ai_Cf_Baai_Bge_M3_AsyncResponse;
5190
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
5927
+ export interface Ai_Cf_Baai_Bge_M3_Output_Query {
5191
5928
  response?: {
5192
5929
  /**
5193
5930
  * Index of the context in the request
@@ -5207,7 +5944,7 @@ export interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
5207
5944
  */
5208
5945
  pooling?: "mean" | "cls";
5209
5946
  }
5210
- export interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
5947
+ export interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
5211
5948
  shape?: number[];
5212
5949
  /**
5213
5950
  * Embeddings of the requested text values
@@ -5312,7 +6049,7 @@ export interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
5312
6049
  */
5313
6050
  role?: string;
5314
6051
  /**
5315
- * 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
6052
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
5316
6053
  */
5317
6054
  tool_call_id?: string;
5318
6055
  content?:
@@ -5567,10 +6304,18 @@ export interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
5567
6304
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
5568
6305
  */
5569
6306
  role: string;
5570
- /**
5571
- * The content of the message as a string.
5572
- */
5573
- content: string;
6307
+ content:
6308
+ | string
6309
+ | {
6310
+ /**
6311
+ * Type of the content (text)
6312
+ */
6313
+ type?: string;
6314
+ /**
6315
+ * Text content
6316
+ */
6317
+ text?: string;
6318
+ }[];
5574
6319
  }[];
5575
6320
  functions?: {
5576
6321
  name: string;
@@ -6226,7 +6971,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6226
6971
  */
6227
6972
  role?: string;
6228
6973
  /**
6229
- * 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
6974
+ * The tool call id. If you don't know what to put here you can fall back to 000000001
6230
6975
  */
6231
6976
  tool_call_id?: string;
6232
6977
  content?:
@@ -6353,7 +7098,7 @@ export interface Ai_Cf_Qwen_Qwq_32B_Messages {
6353
7098
  }
6354
7099
  )[];
6355
7100
  /**
6356
- * JSON schema that should be fulfilled for the response.
7101
+ * JSON schema that should be fufilled for the response.
6357
7102
  */
6358
7103
  guided_json?: object;
6359
7104
  /**
@@ -6627,7 +7372,7 @@ export interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
6627
7372
  }
6628
7373
  )[];
6629
7374
  /**
6630
- * JSON schema that should be fulfilled for the response.
7375
+ * JSON schema that should be fufilled for the response.
6631
7376
  */
6632
7377
  guided_json?: object;
6633
7378
  /**
@@ -6720,7 +7465,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
6720
7465
  */
6721
7466
  prompt: string;
6722
7467
  /**
6723
- * JSON schema that should be fulfilled for the response.
7468
+ * JSON schema that should be fufilled for the response.
6724
7469
  */
6725
7470
  guided_json?: object;
6726
7471
  /**
@@ -6884,7 +7629,7 @@ export interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
6884
7629
  }
6885
7630
  )[];
6886
7631
  /**
6887
- * JSON schema that should be fulfilled for the response.
7632
+ * JSON schema that should be fufilled for the response.
6888
7633
  */
6889
7634
  guided_json?: object;
6890
7635
  /**
@@ -7165,7 +7910,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
7165
7910
  )[];
7166
7911
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7167
7912
  /**
7168
- * JSON schema that should be fulfilled for the response.
7913
+ * JSON schema that should be fufilled for the response.
7169
7914
  */
7170
7915
  guided_json?: object;
7171
7916
  /**
@@ -7404,7 +8149,7 @@ export interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
7404
8149
  )[];
7405
8150
  response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
7406
8151
  /**
7407
- * JSON schema that should be fulfilled for the response.
8152
+ * JSON schema that should be fufilled for the response.
7408
8153
  */
7409
8154
  guided_json?: object;
7410
8155
  /**
@@ -7569,10 +8314,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
7569
8314
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7570
8315
  */
7571
8316
  role: string;
7572
- /**
7573
- * The content of the message as a string.
7574
- */
7575
- content: string;
8317
+ content:
8318
+ | string
8319
+ | {
8320
+ /**
8321
+ * Type of the content (text)
8322
+ */
8323
+ type?: string;
8324
+ /**
8325
+ * Text content
8326
+ */
8327
+ text?: string;
8328
+ }[];
7576
8329
  }[];
7577
8330
  functions?: {
7578
8331
  name: string;
@@ -7784,10 +8537,18 @@ export interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
7784
8537
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
7785
8538
  */
7786
8539
  role: string;
7787
- /**
7788
- * The content of the message as a string.
7789
- */
7790
- content: string;
8540
+ content:
8541
+ | string
8542
+ | {
8543
+ /**
8544
+ * Type of the content (text)
8545
+ */
8546
+ type?: string;
8547
+ /**
8548
+ * Text content
8549
+ */
8550
+ text?: string;
8551
+ }[];
7791
8552
  }[];
7792
8553
  functions?: {
7793
8554
  name: string;
@@ -8355,12 +9116,12 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
8355
9116
  postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
8356
9117
  }
8357
9118
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
8358
- inputs: ResponsesInput;
8359
- postProcessedOutputs: ResponsesOutput;
9119
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9120
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8360
9121
  }
8361
9122
  export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
8362
- inputs: ResponsesInput;
8363
- postProcessedOutputs: ResponsesOutput;
9123
+ inputs: XOR<ResponsesInput, ChatCompletionsInput>;
9124
+ postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
8364
9125
  }
8365
9126
  export interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
8366
9127
  /**
@@ -8492,7 +9253,7 @@ export interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
8492
9253
  */
8493
9254
  text: string | string[];
8494
9255
  /**
8495
- * Target language to translate to
9256
+ * Target langauge to translate to
8496
9257
  */
8497
9258
  target_language:
8498
9259
  | "asm_Beng"
@@ -8608,10 +9369,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
8608
9369
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8609
9370
  */
8610
9371
  role: string;
8611
- /**
8612
- * The content of the message as a string.
8613
- */
8614
- content: string;
9372
+ content:
9373
+ | string
9374
+ | {
9375
+ /**
9376
+ * Type of the content (text)
9377
+ */
9378
+ type?: string;
9379
+ /**
9380
+ * Text content
9381
+ */
9382
+ text?: string;
9383
+ }[];
8615
9384
  }[];
8616
9385
  functions?: {
8617
9386
  name: string;
@@ -8823,10 +9592,18 @@ export interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
8823
9592
  * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
8824
9593
  */
8825
9594
  role: string;
8826
- /**
8827
- * The content of the message as a string.
8828
- */
8829
- content: string;
9595
+ content:
9596
+ | string
9597
+ | {
9598
+ /**
9599
+ * Type of the content (text)
9600
+ */
9601
+ type?: string;
9602
+ /**
9603
+ * Text content
9604
+ */
9605
+ text?: string;
9606
+ }[];
8830
9607
  }[];
8831
9608
  functions?: {
8832
9609
  name: string;
@@ -9381,6 +10158,66 @@ export declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
9381
10158
  inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
9382
10159
  postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
9383
10160
  }
10161
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
10162
+ multipart: {
10163
+ body?: object;
10164
+ contentType?: string;
10165
+ };
10166
+ }
10167
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
10168
+ /**
10169
+ * Generated image as Base64 string.
10170
+ */
10171
+ image?: string;
10172
+ }
10173
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
10174
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
10175
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
10176
+ }
10177
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
10178
+ multipart: {
10179
+ body?: object;
10180
+ contentType?: string;
10181
+ };
10182
+ }
10183
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
10184
+ /**
10185
+ * Generated image as Base64 string.
10186
+ */
10187
+ image?: string;
10188
+ }
10189
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
10190
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
10191
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
10192
+ }
10193
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
10194
+ multipart: {
10195
+ body?: object;
10196
+ contentType?: string;
10197
+ };
10198
+ }
10199
+ export interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
10200
+ /**
10201
+ * Generated image as Base64 string.
10202
+ */
10203
+ image?: string;
10204
+ }
10205
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
10206
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
10207
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
10208
+ }
10209
+ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
10210
+ inputs: ChatCompletionsInput;
10211
+ postProcessedOutputs: ChatCompletionsOutput;
10212
+ }
10213
+ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
10214
+ inputs: ChatCompletionsInput;
10215
+ postProcessedOutputs: ChatCompletionsOutput;
10216
+ }
10217
+ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
10218
+ inputs: ChatCompletionsInput;
10219
+ postProcessedOutputs: ChatCompletionsOutput;
10220
+ }
9384
10221
  export interface AiModels {
9385
10222
  "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
9386
10223
  "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -9399,7 +10236,6 @@ export interface AiModels {
9399
10236
  "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
9400
10237
  "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
9401
10238
  "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
9402
- "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
9403
10239
  "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
9404
10240
  "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
9405
10241
  "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
@@ -9466,6 +10302,12 @@ export interface AiModels {
9466
10302
  "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
9467
10303
  "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
9468
10304
  "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10305
+ "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10306
+ "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10307
+ "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10308
+ "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10309
+ "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10310
+ "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
9469
10311
  }
9470
10312
  export type AiOptions = {
9471
10313
  /**
@@ -9491,6 +10333,7 @@ export type AiOptions = {
9491
10333
  returnRawResponse?: boolean;
9492
10334
  prefix?: string;
9493
10335
  extraHeaders?: object;
10336
+ signal?: AbortSignal;
9494
10337
  };
9495
10338
  export type AiModelsSearchParams = {
9496
10339
  author?: string;
@@ -9517,6 +10360,16 @@ export type AiModelsSearchObject = {
9517
10360
  value: string;
9518
10361
  }[];
9519
10362
  };
10363
+ export type ChatCompletionsBase = XOR<
10364
+ ChatCompletionsPromptInput,
10365
+ ChatCompletionsMessagesInput
10366
+ >;
10367
+ export type ChatCompletionsInput = XOR<
10368
+ ChatCompletionsBase,
10369
+ {
10370
+ requests: ChatCompletionsBase[];
10371
+ }
10372
+ >;
9520
10373
  export interface InferenceUpstreamError extends Error {}
9521
10374
  export interface AiInternalError extends Error {}
9522
10375
  export type AiModelListType = Record<string, any>;
@@ -9526,46 +10379,16 @@ export declare abstract class Ai<
9526
10379
  aiGatewayLogId: string | null;
9527
10380
  gateway(gatewayId: string): AiGateway;
9528
10381
  /**
9529
- * Access the AI Search API for managing AI-powered search instances.
9530
- *
9531
- * This is the new API that replaces AutoRAG with better namespace separation:
9532
- * - Account-level operations: `list()`, `create()`
9533
- * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
9534
- *
9535
- * @example
9536
- * ```typescript
9537
- * // List all AI Search instances
9538
- * const instances = await env.AI.aiSearch.list();
9539
- *
9540
- * // Search an instance
9541
- * const results = await env.AI.aiSearch.get('my-search').search({
9542
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9543
- * ai_search_options: {
9544
- * retrieval: { max_num_results: 10 }
9545
- * }
9546
- * });
9547
- *
9548
- * // Generate chat completions with AI Search context
9549
- * const response = await env.AI.aiSearch.get('my-search').chatCompletions({
9550
- * messages: [{ role: 'user', content: 'What is the policy?' }],
9551
- * model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
9552
- * });
9553
- * ```
10382
+ * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10383
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9554
10384
  */
9555
- aiSearch(): AiSearchAccountService;
10385
+ aiSearch(): AiSearchNamespace;
9556
10386
  /**
9557
10387
  * @deprecated AutoRAG has been replaced by AI Search.
9558
- * Use `env.AI.aiSearch` instead for better API design and new features.
9559
- *
9560
- * Migration guide:
9561
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9562
- * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
9563
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
10388
+ * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10389
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9564
10390
  *
9565
- * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
9566
- *
9567
- * @see AiSearchAccountService
9568
- * @param autoragId Optional instance ID (omit for account-level operations)
10391
+ * @param autoragId Instance ID
9569
10392
  */
9570
10393
  autorag(autoragId: string): AutoRAG;
9571
10394
  run<
@@ -9724,22 +10547,23 @@ export declare abstract class AiGateway {
9724
10547
  getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
9725
10548
  }
9726
10549
  /**
9727
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
9728
- * @see AiSearchInternalError
10550
+ * @deprecated Use the standalone AI Search Workers binding instead.
10551
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9729
10552
  */
9730
10553
  export interface AutoRAGInternalError extends Error {}
9731
10554
  /**
9732
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
9733
- * @see AiSearchNotFoundError
10555
+ * @deprecated Use the standalone AI Search Workers binding instead.
10556
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9734
10557
  */
9735
10558
  export interface AutoRAGNotFoundError extends Error {}
9736
10559
  /**
9737
- * @deprecated This error type is no longer used in the AI Search API.
10560
+ * @deprecated Use the standalone AI Search Workers binding instead.
10561
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9738
10562
  */
9739
10563
  export interface AutoRAGUnauthorizedError extends Error {}
9740
10564
  /**
9741
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
9742
- * @see AiSearchNameNotSetError
10565
+ * @deprecated Use the standalone AI Search Workers binding instead.
10566
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9743
10567
  */
9744
10568
  export interface AutoRAGNameNotSetError extends Error {}
9745
10569
  export type ComparisonFilter = {
@@ -9752,9 +10576,8 @@ export type CompoundFilter = {
9752
10576
  filters: ComparisonFilter[];
9753
10577
  };
9754
10578
  /**
9755
- * @deprecated AutoRAG has been replaced by AI Search.
9756
- * Use AiSearchSearchRequest with the new API instead.
9757
- * @see AiSearchSearchRequest
10579
+ * @deprecated Use the standalone AI Search Workers binding instead.
10580
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9758
10581
  */
9759
10582
  export type AutoRagSearchRequest = {
9760
10583
  query: string;
@@ -9771,18 +10594,16 @@ export type AutoRagSearchRequest = {
9771
10594
  rewrite_query?: boolean;
9772
10595
  };
9773
10596
  /**
9774
- * @deprecated AutoRAG has been replaced by AI Search.
9775
- * Use AiSearchChatCompletionsRequest with the new API instead.
9776
- * @see AiSearchChatCompletionsRequest
10597
+ * @deprecated Use the standalone AI Search Workers binding instead.
10598
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9777
10599
  */
9778
10600
  export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
9779
10601
  stream?: boolean;
9780
10602
  system_prompt?: string;
9781
10603
  };
9782
10604
  /**
9783
- * @deprecated AutoRAG has been replaced by AI Search.
9784
- * Use AiSearchChatCompletionsRequest with stream: true instead.
9785
- * @see AiSearchChatCompletionsRequest
10605
+ * @deprecated Use the standalone AI Search Workers binding instead.
10606
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9786
10607
  */
9787
10608
  export type AutoRagAiSearchRequestStreaming = Omit<
9788
10609
  AutoRagAiSearchRequest,
@@ -9791,9 +10612,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
9791
10612
  stream: true;
9792
10613
  };
9793
10614
  /**
9794
- * @deprecated AutoRAG has been replaced by AI Search.
9795
- * Use AiSearchSearchResponse with the new API instead.
9796
- * @see AiSearchSearchResponse
10615
+ * @deprecated Use the standalone AI Search Workers binding instead.
10616
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9797
10617
  */
9798
10618
  export type AutoRagSearchResponse = {
9799
10619
  object: "vector_store.search_results.page";
@@ -9812,9 +10632,8 @@ export type AutoRagSearchResponse = {
9812
10632
  next_page: string | null;
9813
10633
  };
9814
10634
  /**
9815
- * @deprecated AutoRAG has been replaced by AI Search.
9816
- * Use AiSearchListResponse with the new API instead.
9817
- * @see AiSearchListResponse
10635
+ * @deprecated Use the standalone AI Search Workers binding instead.
10636
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9818
10637
  */
9819
10638
  export type AutoRagListResponse = {
9820
10639
  id: string;
@@ -9826,49 +10645,40 @@ export type AutoRagListResponse = {
9826
10645
  status: string;
9827
10646
  }[];
9828
10647
  /**
9829
- * @deprecated AutoRAG has been replaced by AI Search.
9830
- * The new API returns different response formats for chat completions.
10648
+ * @deprecated Use the standalone AI Search Workers binding instead.
10649
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9831
10650
  */
9832
10651
  export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
9833
10652
  response: string;
9834
10653
  };
9835
10654
  /**
9836
- * @deprecated AutoRAG has been replaced by AI Search.
9837
- * Use the new AI Search API instead: `env.AI.aiSearch`
9838
- *
9839
- * Migration guide:
9840
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
9841
- * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
9842
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
9843
- *
9844
- * @see AiSearchAccountService
9845
- * @see AiSearchInstanceService
10655
+ * @deprecated Use the standalone AI Search Workers binding instead.
10656
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9846
10657
  */
9847
10658
  export declare abstract class AutoRAG {
9848
10659
  /**
9849
- * @deprecated Use `env.AI.aiSearch.list()` instead.
9850
- * @see AiSearchAccountService.list
10660
+ * @deprecated Use the standalone AI Search Workers binding instead.
10661
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9851
10662
  */
9852
10663
  list(): Promise<AutoRagListResponse>;
9853
10664
  /**
9854
- * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
9855
- * Note: The new API uses a messages array instead of a query string.
9856
- * @see AiSearchInstanceService.search
10665
+ * @deprecated Use the standalone AI Search Workers binding instead.
10666
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9857
10667
  */
9858
10668
  search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
9859
10669
  /**
9860
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9861
- * @see AiSearchInstanceService.chatCompletions
10670
+ * @deprecated Use the standalone AI Search Workers binding instead.
10671
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9862
10672
  */
9863
10673
  aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
9864
10674
  /**
9865
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9866
- * @see AiSearchInstanceService.chatCompletions
10675
+ * @deprecated Use the standalone AI Search Workers binding instead.
10676
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9867
10677
  */
9868
10678
  aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
9869
10679
  /**
9870
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9871
- * @see AiSearchInstanceService.chatCompletions
10680
+ * @deprecated Use the standalone AI Search Workers binding instead.
10681
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
9872
10682
  */
9873
10683
  aiSearch(
9874
10684
  params: AutoRagAiSearchRequest,
@@ -9993,6 +10803,41 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
9993
10803
  * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
9994
10804
  */
9995
10805
  cacheTtlByStatus?: Record<string, number>;
10806
+ /**
10807
+ * Explicit Cache-Control header value to set on the response stored in cache.
10808
+ * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
10809
+ *
10810
+ * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
10811
+ * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
10812
+ *
10813
+ * Can be used together with `cacheTtlByStatus`.
10814
+ */
10815
+ cacheControl?: string;
10816
+ /**
10817
+ * Whether the response should be eligible for Cache Reserve storage.
10818
+ */
10819
+ cacheReserveEligible?: boolean;
10820
+ /**
10821
+ * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
10822
+ */
10823
+ respectStrongEtag?: boolean;
10824
+ /**
10825
+ * Whether to strip ETag headers from the origin response before caching.
10826
+ */
10827
+ stripEtags?: boolean;
10828
+ /**
10829
+ * Whether to strip Last-Modified headers from the origin response before caching.
10830
+ */
10831
+ stripLastModified?: boolean;
10832
+ /**
10833
+ * Whether to enable Cache Deception Armor, which protects against web cache
10834
+ * deception attacks by verifying the Content-Type matches the URL extension.
10835
+ */
10836
+ cacheDeceptionArmor?: boolean;
10837
+ /**
10838
+ * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
10839
+ */
10840
+ cacheReserveMinimumFileSize?: number;
9996
10841
  scrapeShield?: boolean;
9997
10842
  apps?: boolean;
9998
10843
  image?: RequestInitCfPropertiesImage;
@@ -11861,6 +12706,7 @@ export declare namespace CloudflareWorkersModule {
11861
12706
  constructor(ctx: ExecutionContext, env: Env);
11862
12707
  email?(message: ForwardableEmailMessage): void | Promise<void>;
11863
12708
  fetch?(request: Request): Response | Promise<Response>;
12709
+ connect?(socket: Socket): void | Promise<void>;
11864
12710
  queue?(batch: MessageBatch<unknown>): void | Promise<void>;
11865
12711
  scheduled?(controller: ScheduledController): void | Promise<void>;
11866
12712
  tail?(events: TraceItem[]): void | Promise<void>;
@@ -11881,6 +12727,7 @@ export declare namespace CloudflareWorkersModule {
11881
12727
  constructor(ctx: DurableObjectState, env: Env);
11882
12728
  alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
11883
12729
  fetch?(request: Request): Response | Promise<Response>;
12730
+ connect?(socket: Socket): void | Promise<void>;
11884
12731
  webSocketMessage?(
11885
12732
  ws: WebSocket,
11886
12733
  message: string | ArrayBuffer,
@@ -12021,17 +12868,6 @@ export interface StreamBinding {
12021
12868
  * @returns A handle for per-video operations.
12022
12869
  */
12023
12870
  video(id: string): StreamVideoHandle;
12024
- /**
12025
- * Uploads a new video from a File.
12026
- * @param file The video file to upload.
12027
- * @returns The uploaded video details.
12028
- * @throws {BadRequestError} if the upload parameter is invalid
12029
- * @throws {QuotaReachedError} if the account storage capacity is exceeded
12030
- * @throws {MaxFileSizeError} if the file size is too large
12031
- * @throws {RateLimitedError} if the server received too many requests
12032
- * @throws {InternalError} if an unexpected error occurs
12033
- */
12034
- upload(file: File): Promise<StreamVideo>;
12035
12871
  /**
12036
12872
  * Uploads a new video from a provided URL.
12037
12873
  * @param url The URL to upload from.
@@ -12881,6 +13717,9 @@ export declare namespace TailStream {
12881
13717
  readonly type: "fetch";
12882
13718
  readonly statusCode: number;
12883
13719
  }
13720
+ interface ConnectEventInfo {
13721
+ readonly type: "connect";
13722
+ }
12884
13723
  type EventOutcome =
12885
13724
  | "ok"
12886
13725
  | "canceled"
@@ -12911,6 +13750,7 @@ export declare namespace TailStream {
12911
13750
  readonly scriptVersion?: ScriptVersion;
12912
13751
  readonly info:
12913
13752
  | FetchEventInfo
13753
+ | ConnectEventInfo
12914
13754
  | JsRpcEventInfo
12915
13755
  | ScheduledEventInfo
12916
13756
  | AlarmEventInfo