@cloudflare/workers-types 4.20260317.1 → 4.20260331.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2021-11-03/index.d.ts +1018 -180
- package/2021-11-03/index.ts +1020 -180
- package/2022-01-31/index.d.ts +1018 -180
- package/2022-01-31/index.ts +1020 -180
- package/2022-03-21/index.d.ts +1018 -180
- package/2022-03-21/index.ts +1020 -180
- package/2022-08-04/index.d.ts +1018 -180
- package/2022-08-04/index.ts +1020 -180
- package/2022-10-31/index.d.ts +1018 -180
- package/2022-10-31/index.ts +1020 -180
- package/2022-11-30/index.d.ts +1018 -180
- package/2022-11-30/index.ts +1020 -180
- package/2023-03-01/index.d.ts +1018 -180
- package/2023-03-01/index.ts +1020 -180
- package/2023-07-01/index.d.ts +1018 -180
- package/2023-07-01/index.ts +1020 -180
- package/experimental/index.d.ts +1089 -181
- package/experimental/index.ts +1091 -181
- package/index.d.ts +1018 -180
- package/index.ts +1020 -180
- package/latest/index.d.ts +1018 -180
- package/latest/index.ts +1020 -180
- package/oldest/index.d.ts +1018 -180
- package/oldest/index.ts +1020 -180
- package/package.json +1 -1
package/experimental/index.d.ts
CHANGED
|
@@ -511,6 +511,11 @@ type ExportedHandlerFetchHandler<
|
|
|
511
511
|
env: Env,
|
|
512
512
|
ctx: ExecutionContext<Props>,
|
|
513
513
|
) => Response | Promise<Response>;
|
|
514
|
+
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (
|
|
515
|
+
socket: Socket,
|
|
516
|
+
env: Env,
|
|
517
|
+
ctx: ExecutionContext<Props>,
|
|
518
|
+
) => void | Promise<void>;
|
|
514
519
|
type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
515
520
|
events: TraceItem[],
|
|
516
521
|
env: Env,
|
|
@@ -552,6 +557,7 @@ interface ExportedHandler<
|
|
|
552
557
|
Props = unknown,
|
|
553
558
|
> {
|
|
554
559
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
560
|
+
connect?: ExportedHandlerConnectHandler<Env, Props>;
|
|
555
561
|
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
556
562
|
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
557
563
|
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
@@ -574,6 +580,7 @@ declare abstract class Navigator {
|
|
|
574
580
|
interface AlarmInvocationInfo {
|
|
575
581
|
readonly isRetry: boolean;
|
|
576
582
|
readonly retryCount: number;
|
|
583
|
+
readonly scheduledTime: number;
|
|
577
584
|
}
|
|
578
585
|
interface Cloudflare {
|
|
579
586
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
@@ -583,6 +590,7 @@ declare abstract class ColoLocalActorNamespace {
|
|
|
583
590
|
}
|
|
584
591
|
interface DurableObject {
|
|
585
592
|
fetch(request: Request): Response | Promise<Response>;
|
|
593
|
+
connect?(socket: Socket): void | Promise<void>;
|
|
586
594
|
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
587
595
|
webSocketMessage?(
|
|
588
596
|
ws: WebSocket,
|
|
@@ -600,7 +608,7 @@ type DurableObjectStub<
|
|
|
600
608
|
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
601
609
|
> = Fetcher<
|
|
602
610
|
T,
|
|
603
|
-
"alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
|
|
611
|
+
"alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
|
|
604
612
|
> & {
|
|
605
613
|
readonly id: DurableObjectId;
|
|
606
614
|
readonly name?: string;
|
|
@@ -2206,6 +2214,7 @@ type Fetcher<
|
|
|
2206
2214
|
queue(
|
|
2207
2215
|
queueName: string,
|
|
2208
2216
|
messages: ServiceBindingQueueMessage[],
|
|
2217
|
+
metadata?: MessageBatchMetadata,
|
|
2209
2218
|
): Promise<FetcherQueueResult>;
|
|
2210
2219
|
scheduled(options?: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
|
|
2211
2220
|
};
|
|
@@ -2390,11 +2399,34 @@ interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
2390
2399
|
}
|
|
2391
2400
|
type QueueContentType = "text" | "bytes" | "json" | "v8";
|
|
2392
2401
|
interface Queue<Body = unknown> {
|
|
2393
|
-
send(message: Body, options?: QueueSendOptions): Promise<
|
|
2402
|
+
send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;
|
|
2394
2403
|
sendBatch(
|
|
2395
2404
|
messages: Iterable<MessageSendRequest<Body>>,
|
|
2396
2405
|
options?: QueueSendBatchOptions,
|
|
2397
|
-
): Promise<
|
|
2406
|
+
): Promise<QueueSendBatchResponse>;
|
|
2407
|
+
metrics(): Promise<QueueMetrics>;
|
|
2408
|
+
}
|
|
2409
|
+
interface QueueSendMetrics {
|
|
2410
|
+
backlogCount: number;
|
|
2411
|
+
backlogBytes: number;
|
|
2412
|
+
oldestMessageTimestamp: number;
|
|
2413
|
+
}
|
|
2414
|
+
interface QueueSendMetadata {
|
|
2415
|
+
metrics: QueueSendMetrics;
|
|
2416
|
+
}
|
|
2417
|
+
interface QueueSendResponse {
|
|
2418
|
+
metadata: QueueSendMetadata;
|
|
2419
|
+
}
|
|
2420
|
+
interface QueueSendBatchMetrics {
|
|
2421
|
+
backlogCount: number;
|
|
2422
|
+
backlogBytes: number;
|
|
2423
|
+
oldestMessageTimestamp: number;
|
|
2424
|
+
}
|
|
2425
|
+
interface QueueSendBatchMetadata {
|
|
2426
|
+
metrics: QueueSendBatchMetrics;
|
|
2427
|
+
}
|
|
2428
|
+
interface QueueSendBatchResponse {
|
|
2429
|
+
metadata: QueueSendBatchMetadata;
|
|
2398
2430
|
}
|
|
2399
2431
|
interface QueueSendOptions {
|
|
2400
2432
|
contentType?: QueueContentType;
|
|
@@ -2408,6 +2440,19 @@ interface MessageSendRequest<Body = unknown> {
|
|
|
2408
2440
|
contentType?: QueueContentType;
|
|
2409
2441
|
delaySeconds?: number;
|
|
2410
2442
|
}
|
|
2443
|
+
interface QueueMetrics {
|
|
2444
|
+
backlogCount: number;
|
|
2445
|
+
backlogBytes: number;
|
|
2446
|
+
oldestMessageTimestamp: number;
|
|
2447
|
+
}
|
|
2448
|
+
interface MessageBatchMetrics {
|
|
2449
|
+
backlogCount: number;
|
|
2450
|
+
backlogBytes: number;
|
|
2451
|
+
oldestMessageTimestamp: number;
|
|
2452
|
+
}
|
|
2453
|
+
interface MessageBatchMetadata {
|
|
2454
|
+
metrics: MessageBatchMetrics;
|
|
2455
|
+
}
|
|
2411
2456
|
interface QueueRetryBatch {
|
|
2412
2457
|
retry: boolean;
|
|
2413
2458
|
delaySeconds?: number;
|
|
@@ -2430,12 +2475,14 @@ interface Message<Body = unknown> {
|
|
|
2430
2475
|
interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
2431
2476
|
readonly messages: readonly Message<Body>[];
|
|
2432
2477
|
readonly queue: string;
|
|
2478
|
+
readonly metadata: MessageBatchMetadata;
|
|
2433
2479
|
retryAll(options?: QueueRetryOptions): void;
|
|
2434
2480
|
ackAll(): void;
|
|
2435
2481
|
}
|
|
2436
2482
|
interface MessageBatch<Body = unknown> {
|
|
2437
2483
|
readonly messages: readonly Message<Body>[];
|
|
2438
2484
|
readonly queue: string;
|
|
2485
|
+
readonly metadata: MessageBatchMetadata;
|
|
2439
2486
|
retryAll(options?: QueueRetryOptions): void;
|
|
2440
2487
|
ackAll(): void;
|
|
2441
2488
|
}
|
|
@@ -3219,6 +3266,11 @@ interface QueuingStrategyInit {
|
|
|
3219
3266
|
*/
|
|
3220
3267
|
highWaterMark: number;
|
|
3221
3268
|
}
|
|
3269
|
+
interface TracePreviewInfo {
|
|
3270
|
+
id: string;
|
|
3271
|
+
slug: string;
|
|
3272
|
+
name: string;
|
|
3273
|
+
}
|
|
3222
3274
|
interface ScriptVersion {
|
|
3223
3275
|
id?: string;
|
|
3224
3276
|
tag?: string;
|
|
@@ -3233,6 +3285,7 @@ interface TraceItem {
|
|
|
3233
3285
|
| (
|
|
3234
3286
|
| TraceItemFetchEventInfo
|
|
3235
3287
|
| TraceItemJsRpcEventInfo
|
|
3288
|
+
| TraceItemConnectEventInfo
|
|
3236
3289
|
| TraceItemScheduledEventInfo
|
|
3237
3290
|
| TraceItemAlarmEventInfo
|
|
3238
3291
|
| TraceItemQueueEventInfo
|
|
@@ -3251,6 +3304,8 @@ interface TraceItem {
|
|
|
3251
3304
|
readonly scriptVersion?: ScriptVersion;
|
|
3252
3305
|
readonly dispatchNamespace?: string;
|
|
3253
3306
|
readonly scriptTags?: string[];
|
|
3307
|
+
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3308
|
+
readonly preview?: TracePreviewInfo;
|
|
3254
3309
|
readonly durableObjectId?: string;
|
|
3255
3310
|
readonly outcome: string;
|
|
3256
3311
|
readonly executionModel: string;
|
|
@@ -3261,6 +3316,7 @@ interface TraceItem {
|
|
|
3261
3316
|
interface TraceItemAlarmEventInfo {
|
|
3262
3317
|
readonly scheduledTime: Date;
|
|
3263
3318
|
}
|
|
3319
|
+
interface TraceItemConnectEventInfo {}
|
|
3264
3320
|
interface TraceItemCustomEventInfo {}
|
|
3265
3321
|
interface TraceItemScheduledEventInfo {
|
|
3266
3322
|
readonly scheduledTime: number;
|
|
@@ -3887,12 +3943,44 @@ interface Container {
|
|
|
3887
3943
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3888
3944
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3889
3945
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3946
|
+
interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
|
|
3947
|
+
snapshotDirectory(
|
|
3948
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3949
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3950
|
+
snapshotContainer(
|
|
3951
|
+
options: ContainerSnapshotOptions,
|
|
3952
|
+
): Promise<ContainerSnapshot>;
|
|
3953
|
+
}
|
|
3954
|
+
interface ContainerDirectorySnapshot {
|
|
3955
|
+
id: string;
|
|
3956
|
+
size: number;
|
|
3957
|
+
dir: string;
|
|
3958
|
+
name?: string;
|
|
3959
|
+
}
|
|
3960
|
+
interface ContainerDirectorySnapshotOptions {
|
|
3961
|
+
dir: string;
|
|
3962
|
+
name?: string;
|
|
3963
|
+
}
|
|
3964
|
+
interface ContainerDirectorySnapshotRestoreParams {
|
|
3965
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3966
|
+
mountPoint?: string;
|
|
3967
|
+
}
|
|
3968
|
+
interface ContainerSnapshot {
|
|
3969
|
+
id: string;
|
|
3970
|
+
size: number;
|
|
3971
|
+
name?: string;
|
|
3972
|
+
}
|
|
3973
|
+
interface ContainerSnapshotOptions {
|
|
3974
|
+
name?: string;
|
|
3890
3975
|
}
|
|
3891
3976
|
interface ContainerStartupOptions {
|
|
3892
3977
|
entrypoint?: string[];
|
|
3893
3978
|
enableInternet: boolean;
|
|
3894
3979
|
env?: Record<string, string>;
|
|
3895
3980
|
hardTimeout?: number | bigint;
|
|
3981
|
+
labels?: Record<string, string>;
|
|
3982
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3983
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3896
3984
|
}
|
|
3897
3985
|
/**
|
|
3898
3986
|
* The **`FileSystemHandle`** interface of the File System API is an object which represents a file or directory entry.
|
|
@@ -4571,11 +4659,10 @@ interface EventCounts {
|
|
|
4571
4659
|
): void;
|
|
4572
4660
|
[Symbol.iterator](): IterableIterator<string[]>;
|
|
4573
4661
|
}
|
|
4574
|
-
// AI Search
|
|
4662
|
+
// ============ AI Search Error Interfaces ============
|
|
4575
4663
|
interface AiSearchInternalError extends Error {}
|
|
4576
4664
|
interface AiSearchNotFoundError extends Error {}
|
|
4577
|
-
|
|
4578
|
-
// AI Search V2 Request Types
|
|
4665
|
+
// ============ AI Search Request Types ============
|
|
4579
4666
|
type AiSearchSearchRequest = {
|
|
4580
4667
|
messages: Array<{
|
|
4581
4668
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -4600,9 +4687,8 @@ type AiSearchSearchRequest = {
|
|
|
4600
4687
|
[key: string]: unknown;
|
|
4601
4688
|
};
|
|
4602
4689
|
reranking?: {
|
|
4603
|
-
/** Enable reranking (default false) */
|
|
4604
4690
|
enabled?: boolean;
|
|
4605
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4691
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4606
4692
|
/** Match threshold (0-1, default 0.4) */
|
|
4607
4693
|
match_threshold?: number;
|
|
4608
4694
|
[key: string]: unknown;
|
|
@@ -4614,6 +4700,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
4614
4700
|
messages: Array<{
|
|
4615
4701
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4616
4702
|
content: string | null;
|
|
4703
|
+
[key: string]: unknown;
|
|
4617
4704
|
}>;
|
|
4618
4705
|
model?: string;
|
|
4619
4706
|
stream?: boolean;
|
|
@@ -4634,7 +4721,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
4634
4721
|
};
|
|
4635
4722
|
reranking?: {
|
|
4636
4723
|
enabled?: boolean;
|
|
4637
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4724
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4638
4725
|
match_threshold?: number;
|
|
4639
4726
|
[key: string]: unknown;
|
|
4640
4727
|
};
|
|
@@ -4642,7 +4729,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
4642
4729
|
};
|
|
4643
4730
|
[key: string]: unknown;
|
|
4644
4731
|
};
|
|
4645
|
-
// AI Search
|
|
4732
|
+
// ============ AI Search Response Types ============
|
|
4646
4733
|
type AiSearchSearchResponse = {
|
|
4647
4734
|
search_query: string;
|
|
4648
4735
|
chunks: Array<{
|
|
@@ -4661,26 +4748,65 @@ type AiSearchSearchResponse = {
|
|
|
4661
4748
|
keyword_score?: number;
|
|
4662
4749
|
/** Vector similarity score (0-1) */
|
|
4663
4750
|
vector_score?: number;
|
|
4751
|
+
[key: string]: unknown;
|
|
4752
|
+
};
|
|
4753
|
+
}>;
|
|
4754
|
+
};
|
|
4755
|
+
type AiSearchChatCompletionsResponse = {
|
|
4756
|
+
id?: string;
|
|
4757
|
+
object?: string;
|
|
4758
|
+
model?: string;
|
|
4759
|
+
choices: Array<{
|
|
4760
|
+
index?: number;
|
|
4761
|
+
message: {
|
|
4762
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4763
|
+
content: string | null;
|
|
4764
|
+
[key: string]: unknown;
|
|
4664
4765
|
};
|
|
4766
|
+
[key: string]: unknown;
|
|
4665
4767
|
}>;
|
|
4768
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4769
|
+
[key: string]: unknown;
|
|
4666
4770
|
};
|
|
4667
|
-
type
|
|
4771
|
+
type AiSearchStatsResponse = {
|
|
4772
|
+
queued?: number;
|
|
4773
|
+
running?: number;
|
|
4774
|
+
completed?: number;
|
|
4775
|
+
error?: number;
|
|
4776
|
+
skipped?: number;
|
|
4777
|
+
outdated?: number;
|
|
4778
|
+
last_activity?: string;
|
|
4779
|
+
};
|
|
4780
|
+
// ============ AI Search Instance Info Types ============
|
|
4781
|
+
type AiSearchInstanceInfo = {
|
|
4668
4782
|
id: string;
|
|
4669
|
-
|
|
4670
|
-
account_id?: string;
|
|
4671
|
-
account_tag?: string;
|
|
4672
|
-
/** Whether the instance is enabled (default true) */
|
|
4673
|
-
enable?: boolean;
|
|
4674
|
-
type?: "r2" | "web-crawler";
|
|
4783
|
+
type?: "r2" | "web-crawler" | string;
|
|
4675
4784
|
source?: string;
|
|
4785
|
+
paused?: boolean;
|
|
4786
|
+
status?: string;
|
|
4787
|
+
namespace?: string;
|
|
4788
|
+
created_at?: string;
|
|
4789
|
+
modified_at?: string;
|
|
4676
4790
|
[key: string]: unknown;
|
|
4677
|
-
}
|
|
4791
|
+
};
|
|
4792
|
+
type AiSearchListResponse = {
|
|
4793
|
+
result: AiSearchInstanceInfo[];
|
|
4794
|
+
result_info?: {
|
|
4795
|
+
count: number;
|
|
4796
|
+
page: number;
|
|
4797
|
+
per_page: number;
|
|
4798
|
+
total_count: number;
|
|
4799
|
+
};
|
|
4800
|
+
};
|
|
4801
|
+
// ============ AI Search Config Types ============
|
|
4678
4802
|
type AiSearchConfig = {
|
|
4679
4803
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4680
4804
|
id: string;
|
|
4681
|
-
type
|
|
4682
|
-
|
|
4683
|
-
|
|
4805
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4806
|
+
type?: "r2" | "web-crawler" | string;
|
|
4807
|
+
/** Source URL (required for web-crawler type). */
|
|
4808
|
+
source?: string;
|
|
4809
|
+
source_params?: unknown;
|
|
4684
4810
|
/** Token ID (UUID format) */
|
|
4685
4811
|
token_id?: string;
|
|
4686
4812
|
ai_gateway_id?: string;
|
|
@@ -4690,54 +4816,307 @@ type AiSearchConfig = {
|
|
|
4690
4816
|
reranking?: boolean;
|
|
4691
4817
|
embedding_model?: string;
|
|
4692
4818
|
ai_search_model?: string;
|
|
4819
|
+
[key: string]: unknown;
|
|
4693
4820
|
};
|
|
4694
|
-
|
|
4821
|
+
// ============ AI Search Item Types ============
|
|
4822
|
+
type AiSearchItemInfo = {
|
|
4695
4823
|
id: string;
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4824
|
+
key: string;
|
|
4825
|
+
status:
|
|
4826
|
+
| "completed"
|
|
4827
|
+
| "error"
|
|
4828
|
+
| "skipped"
|
|
4829
|
+
| "queued"
|
|
4830
|
+
| "processing"
|
|
4831
|
+
| "outdated";
|
|
4832
|
+
metadata?: Record<string, unknown>;
|
|
4699
4833
|
[key: string]: unknown;
|
|
4700
4834
|
};
|
|
4701
|
-
|
|
4702
|
-
|
|
4835
|
+
type AiSearchItemContentResult = {
|
|
4836
|
+
body: ReadableStream;
|
|
4837
|
+
contentType: string;
|
|
4838
|
+
filename: string;
|
|
4839
|
+
size: number;
|
|
4840
|
+
};
|
|
4841
|
+
type AiSearchUploadItemOptions = {
|
|
4842
|
+
metadata?: Record<string, unknown>;
|
|
4843
|
+
};
|
|
4844
|
+
type AiSearchListItemsParams = {
|
|
4845
|
+
page?: number;
|
|
4846
|
+
per_page?: number;
|
|
4847
|
+
};
|
|
4848
|
+
type AiSearchListItemsResponse = {
|
|
4849
|
+
result: AiSearchItemInfo[];
|
|
4850
|
+
result_info?: {
|
|
4851
|
+
count: number;
|
|
4852
|
+
page: number;
|
|
4853
|
+
per_page: number;
|
|
4854
|
+
total_count: number;
|
|
4855
|
+
};
|
|
4856
|
+
};
|
|
4857
|
+
// ============ AI Search Job Types ============
|
|
4858
|
+
type AiSearchJobInfo = {
|
|
4859
|
+
id: string;
|
|
4860
|
+
source: "user" | "schedule";
|
|
4861
|
+
description?: string;
|
|
4862
|
+
last_seen_at?: string;
|
|
4863
|
+
started_at?: string;
|
|
4864
|
+
ended_at?: string;
|
|
4865
|
+
end_reason?: string;
|
|
4866
|
+
};
|
|
4867
|
+
type AiSearchJobLog = {
|
|
4868
|
+
id: number;
|
|
4869
|
+
message: string;
|
|
4870
|
+
message_type: number;
|
|
4871
|
+
created_at: number;
|
|
4872
|
+
};
|
|
4873
|
+
type AiSearchCreateJobParams = {
|
|
4874
|
+
description?: string;
|
|
4875
|
+
};
|
|
4876
|
+
type AiSearchListJobsParams = {
|
|
4877
|
+
page?: number;
|
|
4878
|
+
per_page?: number;
|
|
4879
|
+
};
|
|
4880
|
+
type AiSearchListJobsResponse = {
|
|
4881
|
+
result: AiSearchJobInfo[];
|
|
4882
|
+
result_info?: {
|
|
4883
|
+
count: number;
|
|
4884
|
+
page: number;
|
|
4885
|
+
per_page: number;
|
|
4886
|
+
total_count: number;
|
|
4887
|
+
};
|
|
4888
|
+
};
|
|
4889
|
+
type AiSearchJobLogsParams = {
|
|
4890
|
+
page?: number;
|
|
4891
|
+
per_page?: number;
|
|
4892
|
+
};
|
|
4893
|
+
type AiSearchJobLogsResponse = {
|
|
4894
|
+
result: AiSearchJobLog[];
|
|
4895
|
+
result_info?: {
|
|
4896
|
+
count: number;
|
|
4897
|
+
page: number;
|
|
4898
|
+
per_page: number;
|
|
4899
|
+
total_count: number;
|
|
4900
|
+
};
|
|
4901
|
+
};
|
|
4902
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4903
|
+
/**
|
|
4904
|
+
* Single item service for an AI Search instance.
|
|
4905
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4906
|
+
*/
|
|
4907
|
+
declare abstract class AiSearchItem {
|
|
4908
|
+
/** Get metadata about this item. */
|
|
4909
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4910
|
+
/**
|
|
4911
|
+
* Download the item's content.
|
|
4912
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4913
|
+
*/
|
|
4914
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4915
|
+
}
|
|
4916
|
+
/**
|
|
4917
|
+
* Items collection service for an AI Search instance.
|
|
4918
|
+
* Provides list, upload, and access to individual items.
|
|
4919
|
+
*/
|
|
4920
|
+
declare abstract class AiSearchItems {
|
|
4921
|
+
/** List items in this instance. */
|
|
4922
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4923
|
+
/**
|
|
4924
|
+
* Upload a file as an item.
|
|
4925
|
+
* @param name Filename for the uploaded item.
|
|
4926
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4927
|
+
* @param options Optional metadata to attach to the item.
|
|
4928
|
+
* @returns The created item info.
|
|
4929
|
+
*/
|
|
4930
|
+
upload(
|
|
4931
|
+
name: string,
|
|
4932
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4933
|
+
options?: AiSearchUploadItemOptions,
|
|
4934
|
+
): Promise<AiSearchItemInfo>;
|
|
4935
|
+
/**
|
|
4936
|
+
* Upload a file and poll until processing completes.
|
|
4937
|
+
* @param name Filename for the uploaded item.
|
|
4938
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4939
|
+
* @param options Optional metadata to attach to the item.
|
|
4940
|
+
* @returns The item info after processing completes (or timeout).
|
|
4941
|
+
*/
|
|
4942
|
+
uploadAndPoll(
|
|
4943
|
+
name: string,
|
|
4944
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4945
|
+
options?: AiSearchUploadItemOptions,
|
|
4946
|
+
): Promise<AiSearchItemInfo>;
|
|
4947
|
+
/**
|
|
4948
|
+
* Get an item by ID.
|
|
4949
|
+
* @param itemId The item identifier.
|
|
4950
|
+
* @returns Item service for info, delete, and download operations.
|
|
4951
|
+
*/
|
|
4952
|
+
get(itemId: string): AiSearchItem;
|
|
4953
|
+
/** Delete this item from the instance.
|
|
4954
|
+
* @param itemId The item identifier.
|
|
4955
|
+
*/
|
|
4956
|
+
delete(itemId: string): Promise<void>;
|
|
4957
|
+
}
|
|
4958
|
+
/**
|
|
4959
|
+
* Single job service for an AI Search instance.
|
|
4960
|
+
* Provides info and logs for a specific job.
|
|
4961
|
+
*/
|
|
4962
|
+
declare abstract class AiSearchJob {
|
|
4963
|
+
/** Get metadata about this job. */
|
|
4964
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4965
|
+
/** Get logs for this job. */
|
|
4966
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4967
|
+
}
|
|
4968
|
+
/**
|
|
4969
|
+
* Jobs collection service for an AI Search instance.
|
|
4970
|
+
* Provides list, create, and access to individual jobs.
|
|
4971
|
+
*/
|
|
4972
|
+
declare abstract class AiSearchJobs {
|
|
4973
|
+
/** List jobs for this instance. */
|
|
4974
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4975
|
+
/**
|
|
4976
|
+
* Create a new indexing job.
|
|
4977
|
+
* @param params Optional job parameters.
|
|
4978
|
+
* @returns The created job info.
|
|
4979
|
+
*/
|
|
4980
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4981
|
+
/**
|
|
4982
|
+
* Get a job by ID.
|
|
4983
|
+
* @param jobId The job identifier.
|
|
4984
|
+
* @returns Job service for info and logs operations.
|
|
4985
|
+
*/
|
|
4986
|
+
get(jobId: string): AiSearchJob;
|
|
4987
|
+
}
|
|
4988
|
+
// ============ AI Search Binding Classes ============
|
|
4989
|
+
/**
|
|
4990
|
+
* Instance-level AI Search service.
|
|
4991
|
+
*
|
|
4992
|
+
* Used as:
|
|
4993
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4994
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4995
|
+
*
|
|
4996
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4997
|
+
*
|
|
4998
|
+
* @example
|
|
4999
|
+
* ```ts
|
|
5000
|
+
* // Via namespace binding
|
|
5001
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
5002
|
+
* const results = await instance.search({
|
|
5003
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5004
|
+
* });
|
|
5005
|
+
*
|
|
5006
|
+
* // Via single instance binding
|
|
5007
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
5008
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5009
|
+
* });
|
|
5010
|
+
* ```
|
|
5011
|
+
*/
|
|
5012
|
+
declare abstract class AiSearchInstance {
|
|
4703
5013
|
/**
|
|
4704
5014
|
* Search the AI Search instance for relevant chunks.
|
|
4705
|
-
* @param params Search request with messages and AI search options
|
|
4706
|
-
* @returns Search response with matching chunks
|
|
5015
|
+
* @param params Search request with messages and optional AI search options.
|
|
5016
|
+
* @returns Search response with matching chunks and search query.
|
|
4707
5017
|
*/
|
|
4708
5018
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
5019
|
+
/**
|
|
5020
|
+
* Generate chat completions with AI Search context (streaming).
|
|
5021
|
+
* @param params Chat completions request with stream: true.
|
|
5022
|
+
* @returns ReadableStream of server-sent events.
|
|
5023
|
+
*/
|
|
5024
|
+
chatCompletions(
|
|
5025
|
+
params: AiSearchChatCompletionsRequest & {
|
|
5026
|
+
stream: true;
|
|
5027
|
+
},
|
|
5028
|
+
): Promise<ReadableStream>;
|
|
4709
5029
|
/**
|
|
4710
5030
|
* Generate chat completions with AI Search context.
|
|
4711
|
-
* @param params Chat completions request
|
|
4712
|
-
* @returns
|
|
5031
|
+
* @param params Chat completions request.
|
|
5032
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4713
5033
|
*/
|
|
4714
5034
|
chatCompletions(
|
|
4715
5035
|
params: AiSearchChatCompletionsRequest,
|
|
4716
|
-
): Promise<
|
|
5036
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4717
5037
|
/**
|
|
4718
|
-
*
|
|
5038
|
+
* Update the instance configuration.
|
|
5039
|
+
* @param config Partial configuration to update.
|
|
5040
|
+
* @returns Updated instance info.
|
|
4719
5041
|
*/
|
|
4720
|
-
|
|
5042
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
5043
|
+
/** Get metadata about this instance. */
|
|
5044
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
5045
|
+
/**
|
|
5046
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
5047
|
+
* @returns Statistics with counts per status and last activity time.
|
|
5048
|
+
*/
|
|
5049
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
5050
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
5051
|
+
get items(): AiSearchItems;
|
|
5052
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
5053
|
+
get jobs(): AiSearchJobs;
|
|
4721
5054
|
}
|
|
4722
|
-
|
|
4723
|
-
|
|
5055
|
+
/**
|
|
5056
|
+
* Namespace-level AI Search service.
|
|
5057
|
+
*
|
|
5058
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
5059
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
5060
|
+
*
|
|
5061
|
+
* @example
|
|
5062
|
+
* ```ts
|
|
5063
|
+
* // Access an instance within the namespace
|
|
5064
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
5065
|
+
* const results = await blog.search({
|
|
5066
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5067
|
+
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // List all instances in the namespace
|
|
5070
|
+
* const instances = await env.AI_SEARCH.list();
|
|
5071
|
+
*
|
|
5072
|
+
* // Create a new instance with built-in storage
|
|
5073
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
5074
|
+
* id: "tenant-123",
|
|
5075
|
+
* });
|
|
5076
|
+
*
|
|
5077
|
+
* // Upload items into the instance
|
|
5078
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
5079
|
+
*
|
|
5080
|
+
* // Delete an instance
|
|
5081
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
5082
|
+
* ```
|
|
5083
|
+
*/
|
|
5084
|
+
declare abstract class AiSearchNamespace {
|
|
5085
|
+
/**
|
|
5086
|
+
* Get an instance by name within the bound namespace.
|
|
5087
|
+
* @param name Instance name.
|
|
5088
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
5089
|
+
*/
|
|
5090
|
+
get(name: string): AiSearchInstance;
|
|
4724
5091
|
/**
|
|
4725
|
-
* List all
|
|
4726
|
-
* @returns Array of
|
|
5092
|
+
* List all instances in the bound namespace.
|
|
5093
|
+
* @returns Array of instance metadata.
|
|
4727
5094
|
*/
|
|
4728
5095
|
list(): Promise<AiSearchListResponse>;
|
|
4729
5096
|
/**
|
|
4730
|
-
*
|
|
4731
|
-
* @param
|
|
4732
|
-
* @returns Instance service for
|
|
5097
|
+
* Create a new instance within the bound namespace.
|
|
5098
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
5099
|
+
* @returns Instance service for the newly created instance.
|
|
5100
|
+
*
|
|
5101
|
+
* @example
|
|
5102
|
+
* ```ts
|
|
5103
|
+
* // Create with built-in storage (upload items manually)
|
|
5104
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
5105
|
+
*
|
|
5106
|
+
* // Create with web crawler source
|
|
5107
|
+
* const instance = await env.AI_SEARCH.create({
|
|
5108
|
+
* id: "docs-search",
|
|
5109
|
+
* type: "web-crawler",
|
|
5110
|
+
* source: "https://developers.cloudflare.com",
|
|
5111
|
+
* });
|
|
5112
|
+
* ```
|
|
4733
5113
|
*/
|
|
4734
|
-
|
|
5114
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4735
5115
|
/**
|
|
4736
|
-
*
|
|
4737
|
-
* @param
|
|
4738
|
-
* @returns Instance service for performing operations
|
|
5116
|
+
* Delete an instance from the bound namespace.
|
|
5117
|
+
* @param name Instance name to delete.
|
|
4739
5118
|
*/
|
|
4740
|
-
|
|
5119
|
+
delete(name: string): Promise<void>;
|
|
4741
5120
|
}
|
|
4742
5121
|
type AiImageClassificationInput = {
|
|
4743
5122
|
image: number[];
|
|
@@ -5013,6 +5392,400 @@ declare abstract class BaseAiTranslation {
|
|
|
5013
5392
|
inputs: AiTranslationInput;
|
|
5014
5393
|
postProcessedOutputs: AiTranslationOutput;
|
|
5015
5394
|
}
|
|
5395
|
+
/**
|
|
5396
|
+
* Workers AI support for OpenAI's Chat Completions API
|
|
5397
|
+
*/
|
|
5398
|
+
type ChatCompletionContentPartText = {
|
|
5399
|
+
type: "text";
|
|
5400
|
+
text: string;
|
|
5401
|
+
};
|
|
5402
|
+
type ChatCompletionContentPartImage = {
|
|
5403
|
+
type: "image_url";
|
|
5404
|
+
image_url: {
|
|
5405
|
+
url: string;
|
|
5406
|
+
detail?: "auto" | "low" | "high";
|
|
5407
|
+
};
|
|
5408
|
+
};
|
|
5409
|
+
type ChatCompletionContentPartInputAudio = {
|
|
5410
|
+
type: "input_audio";
|
|
5411
|
+
input_audio: {
|
|
5412
|
+
/** Base64 encoded audio data. */
|
|
5413
|
+
data: string;
|
|
5414
|
+
format: "wav" | "mp3";
|
|
5415
|
+
};
|
|
5416
|
+
};
|
|
5417
|
+
type ChatCompletionContentPartFile = {
|
|
5418
|
+
type: "file";
|
|
5419
|
+
file: {
|
|
5420
|
+
/** Base64 encoded file data. */
|
|
5421
|
+
file_data?: string;
|
|
5422
|
+
/** The ID of an uploaded file. */
|
|
5423
|
+
file_id?: string;
|
|
5424
|
+
filename?: string;
|
|
5425
|
+
};
|
|
5426
|
+
};
|
|
5427
|
+
type ChatCompletionContentPartRefusal = {
|
|
5428
|
+
type: "refusal";
|
|
5429
|
+
refusal: string;
|
|
5430
|
+
};
|
|
5431
|
+
type ChatCompletionContentPart =
|
|
5432
|
+
| ChatCompletionContentPartText
|
|
5433
|
+
| ChatCompletionContentPartImage
|
|
5434
|
+
| ChatCompletionContentPartInputAudio
|
|
5435
|
+
| ChatCompletionContentPartFile;
|
|
5436
|
+
type FunctionDefinition = {
|
|
5437
|
+
name: string;
|
|
5438
|
+
description?: string;
|
|
5439
|
+
parameters?: Record<string, unknown>;
|
|
5440
|
+
strict?: boolean | null;
|
|
5441
|
+
};
|
|
5442
|
+
type ChatCompletionFunctionTool = {
|
|
5443
|
+
type: "function";
|
|
5444
|
+
function: FunctionDefinition;
|
|
5445
|
+
};
|
|
5446
|
+
type ChatCompletionCustomToolGrammarFormat = {
|
|
5447
|
+
type: "grammar";
|
|
5448
|
+
grammar: {
|
|
5449
|
+
definition: string;
|
|
5450
|
+
syntax: "lark" | "regex";
|
|
5451
|
+
};
|
|
5452
|
+
};
|
|
5453
|
+
type ChatCompletionCustomToolTextFormat = {
|
|
5454
|
+
type: "text";
|
|
5455
|
+
};
|
|
5456
|
+
type ChatCompletionCustomToolFormat =
|
|
5457
|
+
| ChatCompletionCustomToolTextFormat
|
|
5458
|
+
| ChatCompletionCustomToolGrammarFormat;
|
|
5459
|
+
type ChatCompletionCustomTool = {
|
|
5460
|
+
type: "custom";
|
|
5461
|
+
custom: {
|
|
5462
|
+
name: string;
|
|
5463
|
+
description?: string;
|
|
5464
|
+
format?: ChatCompletionCustomToolFormat;
|
|
5465
|
+
};
|
|
5466
|
+
};
|
|
5467
|
+
type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
|
|
5468
|
+
type ChatCompletionMessageFunctionToolCall = {
|
|
5469
|
+
id: string;
|
|
5470
|
+
type: "function";
|
|
5471
|
+
function: {
|
|
5472
|
+
name: string;
|
|
5473
|
+
/** JSON-encoded arguments string. */
|
|
5474
|
+
arguments: string;
|
|
5475
|
+
};
|
|
5476
|
+
};
|
|
5477
|
+
type ChatCompletionMessageCustomToolCall = {
|
|
5478
|
+
id: string;
|
|
5479
|
+
type: "custom";
|
|
5480
|
+
custom: {
|
|
5481
|
+
name: string;
|
|
5482
|
+
input: string;
|
|
5483
|
+
};
|
|
5484
|
+
};
|
|
5485
|
+
type ChatCompletionMessageToolCall =
|
|
5486
|
+
| ChatCompletionMessageFunctionToolCall
|
|
5487
|
+
| ChatCompletionMessageCustomToolCall;
|
|
5488
|
+
type ChatCompletionToolChoiceFunction = {
|
|
5489
|
+
type: "function";
|
|
5490
|
+
function: {
|
|
5491
|
+
name: string;
|
|
5492
|
+
};
|
|
5493
|
+
};
|
|
5494
|
+
type ChatCompletionToolChoiceCustom = {
|
|
5495
|
+
type: "custom";
|
|
5496
|
+
custom: {
|
|
5497
|
+
name: string;
|
|
5498
|
+
};
|
|
5499
|
+
};
|
|
5500
|
+
type ChatCompletionToolChoiceAllowedTools = {
|
|
5501
|
+
type: "allowed_tools";
|
|
5502
|
+
allowed_tools: {
|
|
5503
|
+
mode: "auto" | "required";
|
|
5504
|
+
tools: Array<Record<string, unknown>>;
|
|
5505
|
+
};
|
|
5506
|
+
};
|
|
5507
|
+
type ChatCompletionToolChoiceOption =
|
|
5508
|
+
| "none"
|
|
5509
|
+
| "auto"
|
|
5510
|
+
| "required"
|
|
5511
|
+
| ChatCompletionToolChoiceFunction
|
|
5512
|
+
| ChatCompletionToolChoiceCustom
|
|
5513
|
+
| ChatCompletionToolChoiceAllowedTools;
|
|
5514
|
+
type DeveloperMessage = {
|
|
5515
|
+
role: "developer";
|
|
5516
|
+
content:
|
|
5517
|
+
| string
|
|
5518
|
+
| Array<{
|
|
5519
|
+
type: "text";
|
|
5520
|
+
text: string;
|
|
5521
|
+
}>;
|
|
5522
|
+
name?: string;
|
|
5523
|
+
};
|
|
5524
|
+
type SystemMessage = {
|
|
5525
|
+
role: "system";
|
|
5526
|
+
content:
|
|
5527
|
+
| string
|
|
5528
|
+
| Array<{
|
|
5529
|
+
type: "text";
|
|
5530
|
+
text: string;
|
|
5531
|
+
}>;
|
|
5532
|
+
name?: string;
|
|
5533
|
+
};
|
|
5534
|
+
/**
|
|
5535
|
+
* Permissive merged content part used inside UserMessage arrays.
|
|
5536
|
+
*
|
|
5537
|
+
* Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
|
|
5538
|
+
* inside nested array items does not correctly match different branches for
|
|
5539
|
+
* different array elements, so the schema uses a single merged object.
|
|
5540
|
+
*/
|
|
5541
|
+
type UserMessageContentPart = {
|
|
5542
|
+
type: "text" | "image_url" | "input_audio" | "file";
|
|
5543
|
+
text?: string;
|
|
5544
|
+
image_url?: {
|
|
5545
|
+
url?: string;
|
|
5546
|
+
detail?: "auto" | "low" | "high";
|
|
5547
|
+
};
|
|
5548
|
+
input_audio?: {
|
|
5549
|
+
data?: string;
|
|
5550
|
+
format?: "wav" | "mp3";
|
|
5551
|
+
};
|
|
5552
|
+
file?: {
|
|
5553
|
+
file_data?: string;
|
|
5554
|
+
file_id?: string;
|
|
5555
|
+
filename?: string;
|
|
5556
|
+
};
|
|
5557
|
+
};
|
|
5558
|
+
type UserMessage = {
|
|
5559
|
+
role: "user";
|
|
5560
|
+
content: string | Array<UserMessageContentPart>;
|
|
5561
|
+
name?: string;
|
|
5562
|
+
};
|
|
5563
|
+
type AssistantMessageContentPart = {
|
|
5564
|
+
type: "text" | "refusal";
|
|
5565
|
+
text?: string;
|
|
5566
|
+
refusal?: string;
|
|
5567
|
+
};
|
|
5568
|
+
type AssistantMessage = {
|
|
5569
|
+
role: "assistant";
|
|
5570
|
+
content?: string | null | Array<AssistantMessageContentPart>;
|
|
5571
|
+
refusal?: string | null;
|
|
5572
|
+
name?: string;
|
|
5573
|
+
audio?: {
|
|
5574
|
+
id: string;
|
|
5575
|
+
};
|
|
5576
|
+
tool_calls?: Array<ChatCompletionMessageToolCall>;
|
|
5577
|
+
function_call?: {
|
|
5578
|
+
name: string;
|
|
5579
|
+
arguments: string;
|
|
5580
|
+
};
|
|
5581
|
+
};
|
|
5582
|
+
type ToolMessage = {
|
|
5583
|
+
role: "tool";
|
|
5584
|
+
content:
|
|
5585
|
+
| string
|
|
5586
|
+
| Array<{
|
|
5587
|
+
type: "text";
|
|
5588
|
+
text: string;
|
|
5589
|
+
}>;
|
|
5590
|
+
tool_call_id: string;
|
|
5591
|
+
};
|
|
5592
|
+
type FunctionMessage = {
|
|
5593
|
+
role: "function";
|
|
5594
|
+
content: string;
|
|
5595
|
+
name: string;
|
|
5596
|
+
};
|
|
5597
|
+
type ChatCompletionMessageParam =
|
|
5598
|
+
| DeveloperMessage
|
|
5599
|
+
| SystemMessage
|
|
5600
|
+
| UserMessage
|
|
5601
|
+
| AssistantMessage
|
|
5602
|
+
| ToolMessage
|
|
5603
|
+
| FunctionMessage;
|
|
5604
|
+
type ChatCompletionsResponseFormatText = {
|
|
5605
|
+
type: "text";
|
|
5606
|
+
};
|
|
5607
|
+
type ChatCompletionsResponseFormatJSONObject = {
|
|
5608
|
+
type: "json_object";
|
|
5609
|
+
};
|
|
5610
|
+
type ResponseFormatJSONSchema = {
|
|
5611
|
+
type: "json_schema";
|
|
5612
|
+
json_schema: {
|
|
5613
|
+
name: string;
|
|
5614
|
+
description?: string;
|
|
5615
|
+
schema?: Record<string, unknown>;
|
|
5616
|
+
strict?: boolean | null;
|
|
5617
|
+
};
|
|
5618
|
+
};
|
|
5619
|
+
type ResponseFormat =
|
|
5620
|
+
| ChatCompletionsResponseFormatText
|
|
5621
|
+
| ChatCompletionsResponseFormatJSONObject
|
|
5622
|
+
| ResponseFormatJSONSchema;
|
|
5623
|
+
type ChatCompletionsStreamOptions = {
|
|
5624
|
+
include_usage?: boolean;
|
|
5625
|
+
include_obfuscation?: boolean;
|
|
5626
|
+
};
|
|
5627
|
+
type PredictionContent = {
|
|
5628
|
+
type: "content";
|
|
5629
|
+
content:
|
|
5630
|
+
| string
|
|
5631
|
+
| Array<{
|
|
5632
|
+
type: "text";
|
|
5633
|
+
text: string;
|
|
5634
|
+
}>;
|
|
5635
|
+
};
|
|
5636
|
+
type AudioParams = {
|
|
5637
|
+
voice:
|
|
5638
|
+
| string
|
|
5639
|
+
| {
|
|
5640
|
+
id: string;
|
|
5641
|
+
};
|
|
5642
|
+
format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
|
|
5643
|
+
};
|
|
5644
|
+
type WebSearchUserLocation = {
|
|
5645
|
+
type: "approximate";
|
|
5646
|
+
approximate: {
|
|
5647
|
+
city?: string;
|
|
5648
|
+
country?: string;
|
|
5649
|
+
region?: string;
|
|
5650
|
+
timezone?: string;
|
|
5651
|
+
};
|
|
5652
|
+
};
|
|
5653
|
+
type WebSearchOptions = {
|
|
5654
|
+
search_context_size?: "low" | "medium" | "high";
|
|
5655
|
+
user_location?: WebSearchUserLocation;
|
|
5656
|
+
};
|
|
5657
|
+
type ChatTemplateKwargs = {
|
|
5658
|
+
/** Whether to enable reasoning, enabled by default. */
|
|
5659
|
+
enable_thinking?: boolean;
|
|
5660
|
+
/** If false, preserves reasoning context between turns. */
|
|
5661
|
+
clear_thinking?: boolean;
|
|
5662
|
+
};
|
|
5663
|
+
/** Shared optional properties used by both Prompt and Messages input branches. */
|
|
5664
|
+
type ChatCompletionsCommonOptions = {
|
|
5665
|
+
model?: string;
|
|
5666
|
+
audio?: AudioParams;
|
|
5667
|
+
frequency_penalty?: number | null;
|
|
5668
|
+
logit_bias?: Record<string, unknown> | null;
|
|
5669
|
+
logprobs?: boolean | null;
|
|
5670
|
+
top_logprobs?: number | null;
|
|
5671
|
+
max_tokens?: number | null;
|
|
5672
|
+
max_completion_tokens?: number | null;
|
|
5673
|
+
metadata?: Record<string, unknown> | null;
|
|
5674
|
+
modalities?: Array<"text" | "audio"> | null;
|
|
5675
|
+
n?: number | null;
|
|
5676
|
+
parallel_tool_calls?: boolean;
|
|
5677
|
+
prediction?: PredictionContent;
|
|
5678
|
+
presence_penalty?: number | null;
|
|
5679
|
+
reasoning_effort?: "low" | "medium" | "high" | null;
|
|
5680
|
+
chat_template_kwargs?: ChatTemplateKwargs;
|
|
5681
|
+
response_format?: ResponseFormat;
|
|
5682
|
+
seed?: number | null;
|
|
5683
|
+
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
|
|
5684
|
+
stop?: string | Array<string> | null;
|
|
5685
|
+
store?: boolean | null;
|
|
5686
|
+
stream?: boolean | null;
|
|
5687
|
+
stream_options?: ChatCompletionsStreamOptions;
|
|
5688
|
+
temperature?: number | null;
|
|
5689
|
+
tool_choice?: ChatCompletionToolChoiceOption;
|
|
5690
|
+
tools?: Array<ChatCompletionTool>;
|
|
5691
|
+
top_p?: number | null;
|
|
5692
|
+
user?: string;
|
|
5693
|
+
web_search_options?: WebSearchOptions;
|
|
5694
|
+
function_call?:
|
|
5695
|
+
| "none"
|
|
5696
|
+
| "auto"
|
|
5697
|
+
| {
|
|
5698
|
+
name: string;
|
|
5699
|
+
};
|
|
5700
|
+
functions?: Array<FunctionDefinition>;
|
|
5701
|
+
};
|
|
5702
|
+
type PromptTokensDetails = {
|
|
5703
|
+
cached_tokens?: number;
|
|
5704
|
+
audio_tokens?: number;
|
|
5705
|
+
};
|
|
5706
|
+
type CompletionTokensDetails = {
|
|
5707
|
+
reasoning_tokens?: number;
|
|
5708
|
+
audio_tokens?: number;
|
|
5709
|
+
accepted_prediction_tokens?: number;
|
|
5710
|
+
rejected_prediction_tokens?: number;
|
|
5711
|
+
};
|
|
5712
|
+
type CompletionUsage = {
|
|
5713
|
+
prompt_tokens: number;
|
|
5714
|
+
completion_tokens: number;
|
|
5715
|
+
total_tokens: number;
|
|
5716
|
+
prompt_tokens_details?: PromptTokensDetails;
|
|
5717
|
+
completion_tokens_details?: CompletionTokensDetails;
|
|
5718
|
+
};
|
|
5719
|
+
type ChatCompletionTopLogprob = {
|
|
5720
|
+
token: string;
|
|
5721
|
+
logprob: number;
|
|
5722
|
+
bytes: Array<number> | null;
|
|
5723
|
+
};
|
|
5724
|
+
type ChatCompletionTokenLogprob = {
|
|
5725
|
+
token: string;
|
|
5726
|
+
logprob: number;
|
|
5727
|
+
bytes: Array<number> | null;
|
|
5728
|
+
top_logprobs: Array<ChatCompletionTopLogprob>;
|
|
5729
|
+
};
|
|
5730
|
+
type ChatCompletionAudio = {
|
|
5731
|
+
id: string;
|
|
5732
|
+
/** Base64 encoded audio bytes. */
|
|
5733
|
+
data: string;
|
|
5734
|
+
expires_at: number;
|
|
5735
|
+
transcript: string;
|
|
5736
|
+
};
|
|
5737
|
+
type ChatCompletionUrlCitation = {
|
|
5738
|
+
type: "url_citation";
|
|
5739
|
+
url_citation: {
|
|
5740
|
+
url: string;
|
|
5741
|
+
title: string;
|
|
5742
|
+
start_index: number;
|
|
5743
|
+
end_index: number;
|
|
5744
|
+
};
|
|
5745
|
+
};
|
|
5746
|
+
type ChatCompletionResponseMessage = {
|
|
5747
|
+
role: "assistant";
|
|
5748
|
+
content: string | null;
|
|
5749
|
+
refusal: string | null;
|
|
5750
|
+
annotations?: Array<ChatCompletionUrlCitation>;
|
|
5751
|
+
audio?: ChatCompletionAudio;
|
|
5752
|
+
tool_calls?: Array<ChatCompletionMessageToolCall>;
|
|
5753
|
+
function_call?: {
|
|
5754
|
+
name: string;
|
|
5755
|
+
arguments: string;
|
|
5756
|
+
} | null;
|
|
5757
|
+
};
|
|
5758
|
+
type ChatCompletionLogprobs = {
|
|
5759
|
+
content: Array<ChatCompletionTokenLogprob> | null;
|
|
5760
|
+
refusal?: Array<ChatCompletionTokenLogprob> | null;
|
|
5761
|
+
};
|
|
5762
|
+
type ChatCompletionChoice = {
|
|
5763
|
+
index: number;
|
|
5764
|
+
message: ChatCompletionResponseMessage;
|
|
5765
|
+
finish_reason:
|
|
5766
|
+
| "stop"
|
|
5767
|
+
| "length"
|
|
5768
|
+
| "tool_calls"
|
|
5769
|
+
| "content_filter"
|
|
5770
|
+
| "function_call";
|
|
5771
|
+
logprobs: ChatCompletionLogprobs | null;
|
|
5772
|
+
};
|
|
5773
|
+
type ChatCompletionsPromptInput = {
|
|
5774
|
+
prompt: string;
|
|
5775
|
+
} & ChatCompletionsCommonOptions;
|
|
5776
|
+
type ChatCompletionsMessagesInput = {
|
|
5777
|
+
messages: Array<ChatCompletionMessageParam>;
|
|
5778
|
+
} & ChatCompletionsCommonOptions;
|
|
5779
|
+
type ChatCompletionsOutput = {
|
|
5780
|
+
id: string;
|
|
5781
|
+
object: string;
|
|
5782
|
+
created: number;
|
|
5783
|
+
model: string;
|
|
5784
|
+
choices: Array<ChatCompletionChoice>;
|
|
5785
|
+
usage?: CompletionUsage;
|
|
5786
|
+
system_fingerprint?: string | null;
|
|
5787
|
+
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
|
|
5788
|
+
};
|
|
5016
5789
|
/**
|
|
5017
5790
|
* Workers AI support for OpenAI's Responses API
|
|
5018
5791
|
* Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
|
|
@@ -5434,6 +6207,12 @@ type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
|
|
|
5434
6207
|
type StreamOptions = {
|
|
5435
6208
|
include_obfuscation?: boolean;
|
|
5436
6209
|
};
|
|
6210
|
+
/** Marks keys from T that aren't in U as optional never */
|
|
6211
|
+
type Without<T, U> = {
|
|
6212
|
+
[P in Exclude<keyof T, keyof U>]?: never;
|
|
6213
|
+
};
|
|
6214
|
+
/** Either T or U, but not both (mutually exclusive) */
|
|
6215
|
+
type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
|
|
5437
6216
|
type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
|
|
5438
6217
|
| {
|
|
5439
6218
|
text: string | string[];
|
|
@@ -5726,10 +6505,12 @@ declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
|
5726
6505
|
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
5727
6506
|
}
|
|
5728
6507
|
interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
6508
|
+
audio:
|
|
6509
|
+
| string
|
|
6510
|
+
| {
|
|
6511
|
+
body?: object;
|
|
6512
|
+
contentType?: string;
|
|
6513
|
+
};
|
|
5733
6514
|
/**
|
|
5734
6515
|
* Supported tasks are 'translate' or 'transcribe'.
|
|
5735
6516
|
*/
|
|
@@ -5747,9 +6528,33 @@ interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
|
5747
6528
|
*/
|
|
5748
6529
|
initial_prompt?: string;
|
|
5749
6530
|
/**
|
|
5750
|
-
* The prefix
|
|
6531
|
+
* The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
|
|
5751
6532
|
*/
|
|
5752
6533
|
prefix?: string;
|
|
6534
|
+
/**
|
|
6535
|
+
* The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
|
|
6536
|
+
*/
|
|
6537
|
+
beam_size?: number;
|
|
6538
|
+
/**
|
|
6539
|
+
* Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
|
|
6540
|
+
*/
|
|
6541
|
+
condition_on_previous_text?: boolean;
|
|
6542
|
+
/**
|
|
6543
|
+
* Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
|
|
6544
|
+
*/
|
|
6545
|
+
no_speech_threshold?: number;
|
|
6546
|
+
/**
|
|
6547
|
+
* Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
|
|
6548
|
+
*/
|
|
6549
|
+
compression_ratio_threshold?: number;
|
|
6550
|
+
/**
|
|
6551
|
+
* Threshold for filtering out segments with low average log probability, indicating low confidence.
|
|
6552
|
+
*/
|
|
6553
|
+
log_prob_threshold?: number;
|
|
6554
|
+
/**
|
|
6555
|
+
* Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
|
|
6556
|
+
*/
|
|
6557
|
+
hallucination_silence_threshold?: number;
|
|
5753
6558
|
}
|
|
5754
6559
|
interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
5755
6560
|
transcription_info?: {
|
|
@@ -5896,11 +6701,11 @@ interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
|
|
|
5896
6701
|
truncate_inputs?: boolean;
|
|
5897
6702
|
}
|
|
5898
6703
|
type Ai_Cf_Baai_Bge_M3_Output =
|
|
5899
|
-
|
|
|
6704
|
+
| Ai_Cf_Baai_Bge_M3_Output_Query
|
|
5900
6705
|
| Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts
|
|
5901
|
-
|
|
|
6706
|
+
| Ai_Cf_Baai_Bge_M3_Output_Embedding
|
|
5902
6707
|
| Ai_Cf_Baai_Bge_M3_AsyncResponse;
|
|
5903
|
-
interface
|
|
6708
|
+
interface Ai_Cf_Baai_Bge_M3_Output_Query {
|
|
5904
6709
|
response?: {
|
|
5905
6710
|
/**
|
|
5906
6711
|
* Index of the context in the request
|
|
@@ -5920,7 +6725,7 @@ interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
|
|
|
5920
6725
|
*/
|
|
5921
6726
|
pooling?: "mean" | "cls";
|
|
5922
6727
|
}
|
|
5923
|
-
interface
|
|
6728
|
+
interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
|
|
5924
6729
|
shape?: number[];
|
|
5925
6730
|
/**
|
|
5926
6731
|
* Embeddings of the requested text values
|
|
@@ -6025,7 +6830,7 @@ interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
|
|
|
6025
6830
|
*/
|
|
6026
6831
|
role?: string;
|
|
6027
6832
|
/**
|
|
6028
|
-
* The tool call id.
|
|
6833
|
+
* The tool call id. If you don't know what to put here you can fall back to 000000001
|
|
6029
6834
|
*/
|
|
6030
6835
|
tool_call_id?: string;
|
|
6031
6836
|
content?:
|
|
@@ -6280,10 +7085,18 @@ interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
|
|
|
6280
7085
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
6281
7086
|
*/
|
|
6282
7087
|
role: string;
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
7088
|
+
content:
|
|
7089
|
+
| string
|
|
7090
|
+
| {
|
|
7091
|
+
/**
|
|
7092
|
+
* Type of the content (text)
|
|
7093
|
+
*/
|
|
7094
|
+
type?: string;
|
|
7095
|
+
/**
|
|
7096
|
+
* Text content
|
|
7097
|
+
*/
|
|
7098
|
+
text?: string;
|
|
7099
|
+
}[];
|
|
6287
7100
|
}[];
|
|
6288
7101
|
functions?: {
|
|
6289
7102
|
name: string;
|
|
@@ -6939,7 +7752,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
|
|
|
6939
7752
|
*/
|
|
6940
7753
|
role?: string;
|
|
6941
7754
|
/**
|
|
6942
|
-
* The tool call id.
|
|
7755
|
+
* The tool call id. If you don't know what to put here you can fall back to 000000001
|
|
6943
7756
|
*/
|
|
6944
7757
|
tool_call_id?: string;
|
|
6945
7758
|
content?:
|
|
@@ -7066,7 +7879,7 @@ interface Ai_Cf_Qwen_Qwq_32B_Messages {
|
|
|
7066
7879
|
}
|
|
7067
7880
|
)[];
|
|
7068
7881
|
/**
|
|
7069
|
-
* JSON schema that should be
|
|
7882
|
+
* JSON schema that should be fufilled for the response.
|
|
7070
7883
|
*/
|
|
7071
7884
|
guided_json?: object;
|
|
7072
7885
|
/**
|
|
@@ -7340,7 +8153,7 @@ interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
|
|
|
7340
8153
|
}
|
|
7341
8154
|
)[];
|
|
7342
8155
|
/**
|
|
7343
|
-
* JSON schema that should be
|
|
8156
|
+
* JSON schema that should be fufilled for the response.
|
|
7344
8157
|
*/
|
|
7345
8158
|
guided_json?: object;
|
|
7346
8159
|
/**
|
|
@@ -7433,7 +8246,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
|
|
|
7433
8246
|
*/
|
|
7434
8247
|
prompt: string;
|
|
7435
8248
|
/**
|
|
7436
|
-
* JSON schema that should be
|
|
8249
|
+
* JSON schema that should be fufilled for the response.
|
|
7437
8250
|
*/
|
|
7438
8251
|
guided_json?: object;
|
|
7439
8252
|
/**
|
|
@@ -7597,7 +8410,7 @@ interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
|
|
|
7597
8410
|
}
|
|
7598
8411
|
)[];
|
|
7599
8412
|
/**
|
|
7600
|
-
* JSON schema that should be
|
|
8413
|
+
* JSON schema that should be fufilled for the response.
|
|
7601
8414
|
*/
|
|
7602
8415
|
guided_json?: object;
|
|
7603
8416
|
/**
|
|
@@ -7878,7 +8691,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
|
|
|
7878
8691
|
)[];
|
|
7879
8692
|
response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
|
|
7880
8693
|
/**
|
|
7881
|
-
* JSON schema that should be
|
|
8694
|
+
* JSON schema that should be fufilled for the response.
|
|
7882
8695
|
*/
|
|
7883
8696
|
guided_json?: object;
|
|
7884
8697
|
/**
|
|
@@ -8117,7 +8930,7 @@ interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
|
|
|
8117
8930
|
)[];
|
|
8118
8931
|
response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
|
|
8119
8932
|
/**
|
|
8120
|
-
* JSON schema that should be
|
|
8933
|
+
* JSON schema that should be fufilled for the response.
|
|
8121
8934
|
*/
|
|
8122
8935
|
guided_json?: object;
|
|
8123
8936
|
/**
|
|
@@ -8282,10 +9095,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
|
|
|
8282
9095
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
8283
9096
|
*/
|
|
8284
9097
|
role: string;
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
9098
|
+
content:
|
|
9099
|
+
| string
|
|
9100
|
+
| {
|
|
9101
|
+
/**
|
|
9102
|
+
* Type of the content (text)
|
|
9103
|
+
*/
|
|
9104
|
+
type?: string;
|
|
9105
|
+
/**
|
|
9106
|
+
* Text content
|
|
9107
|
+
*/
|
|
9108
|
+
text?: string;
|
|
9109
|
+
}[];
|
|
8289
9110
|
}[];
|
|
8290
9111
|
functions?: {
|
|
8291
9112
|
name: string;
|
|
@@ -8497,10 +9318,18 @@ interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
|
|
|
8497
9318
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
8498
9319
|
*/
|
|
8499
9320
|
role: string;
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
9321
|
+
content:
|
|
9322
|
+
| string
|
|
9323
|
+
| {
|
|
9324
|
+
/**
|
|
9325
|
+
* Type of the content (text)
|
|
9326
|
+
*/
|
|
9327
|
+
type?: string;
|
|
9328
|
+
/**
|
|
9329
|
+
* Text content
|
|
9330
|
+
*/
|
|
9331
|
+
text?: string;
|
|
9332
|
+
}[];
|
|
8504
9333
|
}[];
|
|
8505
9334
|
functions?: {
|
|
8506
9335
|
name: string;
|
|
@@ -9068,12 +9897,12 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
|
|
|
9068
9897
|
postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
|
|
9069
9898
|
}
|
|
9070
9899
|
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
|
|
9071
|
-
inputs: ResponsesInput
|
|
9072
|
-
postProcessedOutputs: ResponsesOutput
|
|
9900
|
+
inputs: XOR<ResponsesInput, ChatCompletionsInput>;
|
|
9901
|
+
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
|
9073
9902
|
}
|
|
9074
9903
|
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
|
|
9075
|
-
inputs: ResponsesInput
|
|
9076
|
-
postProcessedOutputs: ResponsesOutput
|
|
9904
|
+
inputs: XOR<ResponsesInput, ChatCompletionsInput>;
|
|
9905
|
+
postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
|
|
9077
9906
|
}
|
|
9078
9907
|
interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
|
|
9079
9908
|
/**
|
|
@@ -9205,7 +10034,7 @@ interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
|
|
|
9205
10034
|
*/
|
|
9206
10035
|
text: string | string[];
|
|
9207
10036
|
/**
|
|
9208
|
-
* Target
|
|
10037
|
+
* Target langauge to translate to
|
|
9209
10038
|
*/
|
|
9210
10039
|
target_language:
|
|
9211
10040
|
| "asm_Beng"
|
|
@@ -9321,10 +10150,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
|
|
|
9321
10150
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
9322
10151
|
*/
|
|
9323
10152
|
role: string;
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
10153
|
+
content:
|
|
10154
|
+
| string
|
|
10155
|
+
| {
|
|
10156
|
+
/**
|
|
10157
|
+
* Type of the content (text)
|
|
10158
|
+
*/
|
|
10159
|
+
type?: string;
|
|
10160
|
+
/**
|
|
10161
|
+
* Text content
|
|
10162
|
+
*/
|
|
10163
|
+
text?: string;
|
|
10164
|
+
}[];
|
|
9328
10165
|
}[];
|
|
9329
10166
|
functions?: {
|
|
9330
10167
|
name: string;
|
|
@@ -9536,10 +10373,18 @@ interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
|
|
|
9536
10373
|
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
9537
10374
|
*/
|
|
9538
10375
|
role: string;
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
10376
|
+
content:
|
|
10377
|
+
| string
|
|
10378
|
+
| {
|
|
10379
|
+
/**
|
|
10380
|
+
* Type of the content (text)
|
|
10381
|
+
*/
|
|
10382
|
+
type?: string;
|
|
10383
|
+
/**
|
|
10384
|
+
* Text content
|
|
10385
|
+
*/
|
|
10386
|
+
text?: string;
|
|
10387
|
+
}[];
|
|
9543
10388
|
}[];
|
|
9544
10389
|
functions?: {
|
|
9545
10390
|
name: string;
|
|
@@ -10094,6 +10939,66 @@ declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
|
|
|
10094
10939
|
inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
|
|
10095
10940
|
postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
|
|
10096
10941
|
}
|
|
10942
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
|
|
10943
|
+
multipart: {
|
|
10944
|
+
body?: object;
|
|
10945
|
+
contentType?: string;
|
|
10946
|
+
};
|
|
10947
|
+
}
|
|
10948
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
|
|
10949
|
+
/**
|
|
10950
|
+
* Generated image as Base64 string.
|
|
10951
|
+
*/
|
|
10952
|
+
image?: string;
|
|
10953
|
+
}
|
|
10954
|
+
declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
|
|
10955
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
|
|
10956
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
|
|
10957
|
+
}
|
|
10958
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
|
|
10959
|
+
multipart: {
|
|
10960
|
+
body?: object;
|
|
10961
|
+
contentType?: string;
|
|
10962
|
+
};
|
|
10963
|
+
}
|
|
10964
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
|
|
10965
|
+
/**
|
|
10966
|
+
* Generated image as Base64 string.
|
|
10967
|
+
*/
|
|
10968
|
+
image?: string;
|
|
10969
|
+
}
|
|
10970
|
+
declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
|
|
10971
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
|
|
10972
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
|
|
10973
|
+
}
|
|
10974
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
|
|
10975
|
+
multipart: {
|
|
10976
|
+
body?: object;
|
|
10977
|
+
contentType?: string;
|
|
10978
|
+
};
|
|
10979
|
+
}
|
|
10980
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
|
|
10981
|
+
/**
|
|
10982
|
+
* Generated image as Base64 string.
|
|
10983
|
+
*/
|
|
10984
|
+
image?: string;
|
|
10985
|
+
}
|
|
10986
|
+
declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
|
|
10987
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
|
|
10988
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
|
|
10989
|
+
}
|
|
10990
|
+
declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
|
|
10991
|
+
inputs: ChatCompletionsInput;
|
|
10992
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10993
|
+
}
|
|
10994
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
10995
|
+
inputs: ChatCompletionsInput;
|
|
10996
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10997
|
+
}
|
|
10998
|
+
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10999
|
+
inputs: ChatCompletionsInput;
|
|
11000
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11001
|
+
}
|
|
10097
11002
|
interface AiModels {
|
|
10098
11003
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10099
11004
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10112,7 +11017,6 @@ interface AiModels {
|
|
|
10112
11017
|
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
10113
11018
|
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
10114
11019
|
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
10115
|
-
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
10116
11020
|
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
10117
11021
|
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
10118
11022
|
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
@@ -10179,6 +11083,12 @@ interface AiModels {
|
|
|
10179
11083
|
"@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
|
|
10180
11084
|
"@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
|
|
10181
11085
|
"@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
|
|
11086
|
+
"@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
|
|
11087
|
+
"@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
|
|
11088
|
+
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
11089
|
+
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
11090
|
+
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
11091
|
+
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10182
11092
|
}
|
|
10183
11093
|
type AiOptions = {
|
|
10184
11094
|
/**
|
|
@@ -10204,6 +11114,7 @@ type AiOptions = {
|
|
|
10204
11114
|
returnRawResponse?: boolean;
|
|
10205
11115
|
prefix?: string;
|
|
10206
11116
|
extraHeaders?: object;
|
|
11117
|
+
signal?: AbortSignal;
|
|
10207
11118
|
};
|
|
10208
11119
|
type AiModelsSearchParams = {
|
|
10209
11120
|
author?: string;
|
|
@@ -10230,6 +11141,16 @@ type AiModelsSearchObject = {
|
|
|
10230
11141
|
value: string;
|
|
10231
11142
|
}[];
|
|
10232
11143
|
};
|
|
11144
|
+
type ChatCompletionsBase = XOR<
|
|
11145
|
+
ChatCompletionsPromptInput,
|
|
11146
|
+
ChatCompletionsMessagesInput
|
|
11147
|
+
>;
|
|
11148
|
+
type ChatCompletionsInput = XOR<
|
|
11149
|
+
ChatCompletionsBase,
|
|
11150
|
+
{
|
|
11151
|
+
requests: ChatCompletionsBase[];
|
|
11152
|
+
}
|
|
11153
|
+
>;
|
|
10233
11154
|
interface InferenceUpstreamError extends Error {}
|
|
10234
11155
|
interface AiInternalError extends Error {}
|
|
10235
11156
|
type AiModelListType = Record<string, any>;
|
|
@@ -10237,46 +11158,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10237
11158
|
aiGatewayLogId: string | null;
|
|
10238
11159
|
gateway(gatewayId: string): AiGateway;
|
|
10239
11160
|
/**
|
|
10240
|
-
*
|
|
10241
|
-
*
|
|
10242
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10243
|
-
* - Account-level operations: `list()`, `create()`
|
|
10244
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10245
|
-
*
|
|
10246
|
-
* @example
|
|
10247
|
-
* ```typescript
|
|
10248
|
-
* // List all AI Search instances
|
|
10249
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10250
|
-
*
|
|
10251
|
-
* // Search an instance
|
|
10252
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10253
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10254
|
-
* ai_search_options: {
|
|
10255
|
-
* retrieval: { max_num_results: 10 }
|
|
10256
|
-
* }
|
|
10257
|
-
* });
|
|
10258
|
-
*
|
|
10259
|
-
* // Generate chat completions with AI Search context
|
|
10260
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10261
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10262
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10263
|
-
* });
|
|
10264
|
-
* ```
|
|
11161
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
11162
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10265
11163
|
*/
|
|
10266
|
-
aiSearch():
|
|
11164
|
+
aiSearch(): AiSearchNamespace;
|
|
10267
11165
|
/**
|
|
10268
11166
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10269
|
-
* Use `
|
|
10270
|
-
*
|
|
10271
|
-
* Migration guide:
|
|
10272
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10273
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10274
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10275
|
-
*
|
|
10276
|
-
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
11167
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
11168
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10277
11169
|
*
|
|
10278
|
-
* @
|
|
10279
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
11170
|
+
* @param autoragId Instance ID
|
|
10280
11171
|
*/
|
|
10281
11172
|
autorag(autoragId: string): AutoRAG;
|
|
10282
11173
|
run<
|
|
@@ -10435,22 +11326,23 @@ declare abstract class AiGateway {
|
|
|
10435
11326
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10436
11327
|
}
|
|
10437
11328
|
/**
|
|
10438
|
-
* @deprecated
|
|
10439
|
-
*
|
|
11329
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11330
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10440
11331
|
*/
|
|
10441
11332
|
interface AutoRAGInternalError extends Error {}
|
|
10442
11333
|
/**
|
|
10443
|
-
* @deprecated
|
|
10444
|
-
*
|
|
11334
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11335
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10445
11336
|
*/
|
|
10446
11337
|
interface AutoRAGNotFoundError extends Error {}
|
|
10447
11338
|
/**
|
|
10448
|
-
* @deprecated
|
|
11339
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11340
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10449
11341
|
*/
|
|
10450
11342
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10451
11343
|
/**
|
|
10452
|
-
* @deprecated
|
|
10453
|
-
*
|
|
11344
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11345
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10454
11346
|
*/
|
|
10455
11347
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10456
11348
|
type ComparisonFilter = {
|
|
@@ -10463,9 +11355,8 @@ type CompoundFilter = {
|
|
|
10463
11355
|
filters: ComparisonFilter[];
|
|
10464
11356
|
};
|
|
10465
11357
|
/**
|
|
10466
|
-
* @deprecated
|
|
10467
|
-
*
|
|
10468
|
-
* @see AiSearchSearchRequest
|
|
11358
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11359
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10469
11360
|
*/
|
|
10470
11361
|
type AutoRagSearchRequest = {
|
|
10471
11362
|
query: string;
|
|
@@ -10482,18 +11373,16 @@ type AutoRagSearchRequest = {
|
|
|
10482
11373
|
rewrite_query?: boolean;
|
|
10483
11374
|
};
|
|
10484
11375
|
/**
|
|
10485
|
-
* @deprecated
|
|
10486
|
-
*
|
|
10487
|
-
* @see AiSearchChatCompletionsRequest
|
|
11376
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11377
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10488
11378
|
*/
|
|
10489
11379
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10490
11380
|
stream?: boolean;
|
|
10491
11381
|
system_prompt?: string;
|
|
10492
11382
|
};
|
|
10493
11383
|
/**
|
|
10494
|
-
* @deprecated
|
|
10495
|
-
*
|
|
10496
|
-
* @see AiSearchChatCompletionsRequest
|
|
11384
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11385
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10497
11386
|
*/
|
|
10498
11387
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10499
11388
|
AutoRagAiSearchRequest,
|
|
@@ -10502,9 +11391,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10502
11391
|
stream: true;
|
|
10503
11392
|
};
|
|
10504
11393
|
/**
|
|
10505
|
-
* @deprecated
|
|
10506
|
-
*
|
|
10507
|
-
* @see AiSearchSearchResponse
|
|
11394
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11395
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10508
11396
|
*/
|
|
10509
11397
|
type AutoRagSearchResponse = {
|
|
10510
11398
|
object: "vector_store.search_results.page";
|
|
@@ -10523,9 +11411,8 @@ type AutoRagSearchResponse = {
|
|
|
10523
11411
|
next_page: string | null;
|
|
10524
11412
|
};
|
|
10525
11413
|
/**
|
|
10526
|
-
* @deprecated
|
|
10527
|
-
*
|
|
10528
|
-
* @see AiSearchListResponse
|
|
11414
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11415
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10529
11416
|
*/
|
|
10530
11417
|
type AutoRagListResponse = {
|
|
10531
11418
|
id: string;
|
|
@@ -10537,49 +11424,40 @@ type AutoRagListResponse = {
|
|
|
10537
11424
|
status: string;
|
|
10538
11425
|
}[];
|
|
10539
11426
|
/**
|
|
10540
|
-
* @deprecated
|
|
10541
|
-
*
|
|
11427
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11428
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10542
11429
|
*/
|
|
10543
11430
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10544
11431
|
response: string;
|
|
10545
11432
|
};
|
|
10546
11433
|
/**
|
|
10547
|
-
* @deprecated
|
|
10548
|
-
*
|
|
10549
|
-
*
|
|
10550
|
-
* Migration guide:
|
|
10551
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10552
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10553
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10554
|
-
*
|
|
10555
|
-
* @see AiSearchAccountService
|
|
10556
|
-
* @see AiSearchInstanceService
|
|
11434
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11435
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10557
11436
|
*/
|
|
10558
11437
|
declare abstract class AutoRAG {
|
|
10559
11438
|
/**
|
|
10560
|
-
* @deprecated Use
|
|
10561
|
-
*
|
|
11439
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11440
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10562
11441
|
*/
|
|
10563
11442
|
list(): Promise<AutoRagListResponse>;
|
|
10564
11443
|
/**
|
|
10565
|
-
* @deprecated Use
|
|
10566
|
-
*
|
|
10567
|
-
* @see AiSearchInstanceService.search
|
|
11444
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11445
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10568
11446
|
*/
|
|
10569
11447
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10570
11448
|
/**
|
|
10571
|
-
* @deprecated Use
|
|
10572
|
-
*
|
|
11449
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11450
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10573
11451
|
*/
|
|
10574
11452
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10575
11453
|
/**
|
|
10576
|
-
* @deprecated Use
|
|
10577
|
-
*
|
|
11454
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11455
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10578
11456
|
*/
|
|
10579
11457
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10580
11458
|
/**
|
|
10581
|
-
* @deprecated Use
|
|
10582
|
-
*
|
|
11459
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11460
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10583
11461
|
*/
|
|
10584
11462
|
aiSearch(
|
|
10585
11463
|
params: AutoRagAiSearchRequest,
|
|
@@ -10704,6 +11582,41 @@ interface RequestInitCfProperties extends Record<string, unknown> {
|
|
|
10704
11582
|
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
10705
11583
|
*/
|
|
10706
11584
|
cacheTtlByStatus?: Record<string, number>;
|
|
11585
|
+
/**
|
|
11586
|
+
* Explicit Cache-Control header value to set on the response stored in cache.
|
|
11587
|
+
* This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
|
|
11588
|
+
*
|
|
11589
|
+
* Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
|
|
11590
|
+
* as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
|
|
11591
|
+
*
|
|
11592
|
+
* Can be used together with `cacheTtlByStatus`.
|
|
11593
|
+
*/
|
|
11594
|
+
cacheControl?: string;
|
|
11595
|
+
/**
|
|
11596
|
+
* Whether the response should be eligible for Cache Reserve storage.
|
|
11597
|
+
*/
|
|
11598
|
+
cacheReserveEligible?: boolean;
|
|
11599
|
+
/**
|
|
11600
|
+
* Whether to respect strong ETags (as opposed to weak ETags) from the origin.
|
|
11601
|
+
*/
|
|
11602
|
+
respectStrongEtag?: boolean;
|
|
11603
|
+
/**
|
|
11604
|
+
* Whether to strip ETag headers from the origin response before caching.
|
|
11605
|
+
*/
|
|
11606
|
+
stripEtags?: boolean;
|
|
11607
|
+
/**
|
|
11608
|
+
* Whether to strip Last-Modified headers from the origin response before caching.
|
|
11609
|
+
*/
|
|
11610
|
+
stripLastModified?: boolean;
|
|
11611
|
+
/**
|
|
11612
|
+
* Whether to enable Cache Deception Armor, which protects against web cache
|
|
11613
|
+
* deception attacks by verifying the Content-Type matches the URL extension.
|
|
11614
|
+
*/
|
|
11615
|
+
cacheDeceptionArmor?: boolean;
|
|
11616
|
+
/**
|
|
11617
|
+
* Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
|
|
11618
|
+
*/
|
|
11619
|
+
cacheReserveMinimumFileSize?: number;
|
|
10707
11620
|
scrapeShield?: boolean;
|
|
10708
11621
|
apps?: boolean;
|
|
10709
11622
|
image?: RequestInitCfPropertiesImage;
|
|
@@ -12616,6 +13529,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12616
13529
|
constructor(ctx: ExecutionContext, env: Env);
|
|
12617
13530
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12618
13531
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13532
|
+
connect?(socket: Socket): void | Promise<void>;
|
|
12619
13533
|
queue?(batch: MessageBatch<unknown>): void | Promise<void>;
|
|
12620
13534
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12621
13535
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
@@ -12636,6 +13550,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12636
13550
|
constructor(ctx: DurableObjectState, env: Env);
|
|
12637
13551
|
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
12638
13552
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13553
|
+
connect?(socket: Socket): void | Promise<void>;
|
|
12639
13554
|
webSocketMessage?(
|
|
12640
13555
|
ws: WebSocket,
|
|
12641
13556
|
message: string | ArrayBuffer,
|
|
@@ -12786,17 +13701,6 @@ interface StreamBinding {
|
|
|
12786
13701
|
* @returns A handle for per-video operations.
|
|
12787
13702
|
*/
|
|
12788
13703
|
video(id: string): StreamVideoHandle;
|
|
12789
|
-
/**
|
|
12790
|
-
* Uploads a new video from a File.
|
|
12791
|
-
* @param file The video file to upload.
|
|
12792
|
-
* @returns The uploaded video details.
|
|
12793
|
-
* @throws {BadRequestError} if the upload parameter is invalid
|
|
12794
|
-
* @throws {QuotaReachedError} if the account storage capacity is exceeded
|
|
12795
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
12796
|
-
* @throws {RateLimitedError} if the server received too many requests
|
|
12797
|
-
* @throws {InternalError} if an unexpected error occurs
|
|
12798
|
-
*/
|
|
12799
|
-
upload(file: File): Promise<StreamVideo>;
|
|
12800
13704
|
/**
|
|
12801
13705
|
* Uploads a new video from a provided URL.
|
|
12802
13706
|
* @param url The URL to upload from.
|
|
@@ -13646,6 +14550,9 @@ declare namespace TailStream {
|
|
|
13646
14550
|
readonly type: "fetch";
|
|
13647
14551
|
readonly statusCode: number;
|
|
13648
14552
|
}
|
|
14553
|
+
interface ConnectEventInfo {
|
|
14554
|
+
readonly type: "connect";
|
|
14555
|
+
}
|
|
13649
14556
|
type EventOutcome =
|
|
13650
14557
|
| "ok"
|
|
13651
14558
|
| "canceled"
|
|
@@ -13676,6 +14583,7 @@ declare namespace TailStream {
|
|
|
13676
14583
|
readonly scriptVersion?: ScriptVersion;
|
|
13677
14584
|
readonly info:
|
|
13678
14585
|
| FetchEventInfo
|
|
14586
|
+
| ConnectEventInfo
|
|
13679
14587
|
| JsRpcEventInfo
|
|
13680
14588
|
| ScheduledEventInfo
|
|
13681
14589
|
| AlarmEventInfo
|