@cloudflare/workers-types 4.20260409.1 → 4.20260411.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 +72 -23
- package/2021-11-03/index.ts +72 -23
- package/2022-01-31/index.d.ts +72 -23
- package/2022-01-31/index.ts +72 -23
- package/2022-03-21/index.d.ts +72 -23
- package/2022-03-21/index.ts +72 -23
- package/2022-08-04/index.d.ts +72 -23
- package/2022-08-04/index.ts +72 -23
- package/2022-10-31/index.d.ts +72 -23
- package/2022-10-31/index.ts +72 -23
- package/2022-11-30/index.d.ts +72 -23
- package/2022-11-30/index.ts +72 -23
- package/2023-03-01/index.d.ts +72 -23
- package/2023-03-01/index.ts +72 -23
- package/2023-07-01/index.d.ts +72 -23
- package/2023-07-01/index.ts +72 -23
- package/experimental/index.d.ts +72 -23
- package/experimental/index.ts +72 -23
- package/index.d.ts +72 -23
- package/index.ts +72 -23
- package/latest/index.d.ts +72 -23
- package/latest/index.ts +72 -23
- package/oldest/index.d.ts +72 -23
- package/oldest/index.ts +72 -23
- package/package.json +1 -1
package/experimental/index.d.ts
CHANGED
|
@@ -492,6 +492,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
492
492
|
passThroughOnException(): void;
|
|
493
493
|
readonly exports: Cloudflare.Exports;
|
|
494
494
|
readonly props: Props;
|
|
495
|
+
cache?: CacheContext;
|
|
495
496
|
readonly version?: {
|
|
496
497
|
readonly metadata?: {
|
|
497
498
|
readonly id: string;
|
|
@@ -585,6 +586,23 @@ interface AlarmInvocationInfo {
|
|
|
585
586
|
interface Cloudflare {
|
|
586
587
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
587
588
|
}
|
|
589
|
+
interface CachePurgeError {
|
|
590
|
+
code: number;
|
|
591
|
+
message: string;
|
|
592
|
+
}
|
|
593
|
+
interface CachePurgeResult {
|
|
594
|
+
success: boolean;
|
|
595
|
+
zoneTag: string;
|
|
596
|
+
errors: CachePurgeError[];
|
|
597
|
+
}
|
|
598
|
+
interface CachePurgeOptions {
|
|
599
|
+
tags?: string[];
|
|
600
|
+
pathPrefixes?: string[];
|
|
601
|
+
purgeEverything?: boolean;
|
|
602
|
+
}
|
|
603
|
+
interface CacheContext {
|
|
604
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
605
|
+
}
|
|
588
606
|
declare abstract class ColoLocalActorNamespace {
|
|
589
607
|
get(actorId: string): Fetcher;
|
|
590
608
|
}
|
|
@@ -11023,6 +11041,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
11023
11041
|
inputs: ChatCompletionsInput;
|
|
11024
11042
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11025
11043
|
}
|
|
11044
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
11045
|
+
inputs: ChatCompletionsInput;
|
|
11046
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11047
|
+
}
|
|
11026
11048
|
interface AiModels {
|
|
11027
11049
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
11028
11050
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -11178,6 +11200,9 @@ type ChatCompletionsInput = XOR<
|
|
|
11178
11200
|
interface InferenceUpstreamError extends Error {}
|
|
11179
11201
|
interface AiInternalError extends Error {}
|
|
11180
11202
|
type AiModelListType = Record<string, any>;
|
|
11203
|
+
type AiAsyncBatchResponse = {
|
|
11204
|
+
request_id: string;
|
|
11205
|
+
};
|
|
11181
11206
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
11182
11207
|
aiGatewayLogId: string | null;
|
|
11183
11208
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -11194,29 +11219,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
11194
11219
|
* @param autoragId Instance ID
|
|
11195
11220
|
*/
|
|
11196
11221
|
autorag(autoragId: string): AutoRAG;
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
Options extends AiOptions,
|
|
11200
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
11201
|
-
>(
|
|
11222
|
+
// Batch request
|
|
11223
|
+
run<Name extends keyof AiModelList>(
|
|
11202
11224
|
model: Name,
|
|
11203
|
-
inputs:
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11225
|
+
inputs: {
|
|
11226
|
+
requests: AiModelList[Name]["inputs"][];
|
|
11227
|
+
},
|
|
11228
|
+
options: AiOptions & {
|
|
11229
|
+
queueRequest: true;
|
|
11230
|
+
},
|
|
11231
|
+
): Promise<AiAsyncBatchResponse>;
|
|
11232
|
+
// Raw response
|
|
11233
|
+
run<Name extends keyof AiModelList>(
|
|
11234
|
+
model: Name,
|
|
11235
|
+
inputs: AiModelList[Name]["inputs"],
|
|
11236
|
+
options: AiOptions & {
|
|
11237
|
+
returnRawResponse: true;
|
|
11238
|
+
},
|
|
11239
|
+
): Promise<Response>;
|
|
11240
|
+
// WebSocket
|
|
11241
|
+
run<Name extends keyof AiModelList>(
|
|
11242
|
+
model: Name,
|
|
11243
|
+
inputs: AiModelList[Name]["inputs"],
|
|
11244
|
+
options: AiOptions & {
|
|
11245
|
+
websocket: true;
|
|
11246
|
+
},
|
|
11247
|
+
): Promise<Response>;
|
|
11248
|
+
// Streaming
|
|
11249
|
+
run<Name extends keyof AiModelList>(
|
|
11250
|
+
model: Name,
|
|
11251
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
11252
|
+
stream: true;
|
|
11253
|
+
},
|
|
11254
|
+
options?: AiOptions,
|
|
11255
|
+
): Promise<ReadableStream>;
|
|
11256
|
+
// Normal (default) - known model
|
|
11257
|
+
run<Name extends keyof AiModelList>(
|
|
11258
|
+
model: Name,
|
|
11259
|
+
inputs: AiModelList[Name]["inputs"],
|
|
11260
|
+
options?: AiOptions,
|
|
11261
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
11262
|
+
// Unknown model (gateway fallback)
|
|
11263
|
+
run(
|
|
11264
|
+
model: string & {},
|
|
11265
|
+
inputs: Record<string, unknown>,
|
|
11266
|
+
options?: AiOptions,
|
|
11267
|
+
): Promise<Record<string, unknown>>;
|
|
11220
11268
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
11221
11269
|
toMarkdown(): ToMarkdownService;
|
|
11222
11270
|
toMarkdown(
|
|
@@ -11345,6 +11393,7 @@ declare abstract class AiGateway {
|
|
|
11345
11393
|
options?: {
|
|
11346
11394
|
gateway?: UniversalGatewayOptions;
|
|
11347
11395
|
extraHeaders?: object;
|
|
11396
|
+
signal?: AbortSignal;
|
|
11348
11397
|
},
|
|
11349
11398
|
): Promise<Response>;
|
|
11350
11399
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -13692,7 +13741,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
13692
13741
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
13693
13742
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13694
13743
|
connect?(socket: Socket): void | Promise<void>;
|
|
13695
|
-
queue?(batch: MessageBatch
|
|
13744
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
13696
13745
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
13697
13746
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
13698
13747
|
tailStream?(
|
package/experimental/index.ts
CHANGED
|
@@ -494,6 +494,7 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
494
494
|
passThroughOnException(): void;
|
|
495
495
|
readonly exports: Cloudflare.Exports;
|
|
496
496
|
readonly props: Props;
|
|
497
|
+
cache?: CacheContext;
|
|
497
498
|
readonly version?: {
|
|
498
499
|
readonly metadata?: {
|
|
499
500
|
readonly id: string;
|
|
@@ -587,6 +588,23 @@ export interface AlarmInvocationInfo {
|
|
|
587
588
|
export interface Cloudflare {
|
|
588
589
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
589
590
|
}
|
|
591
|
+
export interface CachePurgeError {
|
|
592
|
+
code: number;
|
|
593
|
+
message: string;
|
|
594
|
+
}
|
|
595
|
+
export interface CachePurgeResult {
|
|
596
|
+
success: boolean;
|
|
597
|
+
zoneTag: string;
|
|
598
|
+
errors: CachePurgeError[];
|
|
599
|
+
}
|
|
600
|
+
export interface CachePurgeOptions {
|
|
601
|
+
tags?: string[];
|
|
602
|
+
pathPrefixes?: string[];
|
|
603
|
+
purgeEverything?: boolean;
|
|
604
|
+
}
|
|
605
|
+
export interface CacheContext {
|
|
606
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
607
|
+
}
|
|
590
608
|
export declare abstract class ColoLocalActorNamespace {
|
|
591
609
|
get(actorId: string): Fetcher;
|
|
592
610
|
}
|
|
@@ -11032,6 +11050,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
11032
11050
|
inputs: ChatCompletionsInput;
|
|
11033
11051
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11034
11052
|
}
|
|
11053
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
11054
|
+
inputs: ChatCompletionsInput;
|
|
11055
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11056
|
+
}
|
|
11035
11057
|
export interface AiModels {
|
|
11036
11058
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
11037
11059
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -11187,6 +11209,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
11187
11209
|
export interface InferenceUpstreamError extends Error {}
|
|
11188
11210
|
export interface AiInternalError extends Error {}
|
|
11189
11211
|
export type AiModelListType = Record<string, any>;
|
|
11212
|
+
export type AiAsyncBatchResponse = {
|
|
11213
|
+
request_id: string;
|
|
11214
|
+
};
|
|
11190
11215
|
export declare abstract class Ai<
|
|
11191
11216
|
AiModelList extends AiModelListType = AiModels,
|
|
11192
11217
|
> {
|
|
@@ -11205,29 +11230,52 @@ export declare abstract class Ai<
|
|
|
11205
11230
|
* @param autoragId Instance ID
|
|
11206
11231
|
*/
|
|
11207
11232
|
autorag(autoragId: string): AutoRAG;
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
Options extends AiOptions,
|
|
11211
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
11212
|
-
>(
|
|
11233
|
+
// Batch request
|
|
11234
|
+
run<Name extends keyof AiModelList>(
|
|
11213
11235
|
model: Name,
|
|
11214
|
-
inputs:
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11236
|
+
inputs: {
|
|
11237
|
+
requests: AiModelList[Name]["inputs"][];
|
|
11238
|
+
},
|
|
11239
|
+
options: AiOptions & {
|
|
11240
|
+
queueRequest: true;
|
|
11241
|
+
},
|
|
11242
|
+
): Promise<AiAsyncBatchResponse>;
|
|
11243
|
+
// Raw response
|
|
11244
|
+
run<Name extends keyof AiModelList>(
|
|
11245
|
+
model: Name,
|
|
11246
|
+
inputs: AiModelList[Name]["inputs"],
|
|
11247
|
+
options: AiOptions & {
|
|
11248
|
+
returnRawResponse: true;
|
|
11249
|
+
},
|
|
11250
|
+
): Promise<Response>;
|
|
11251
|
+
// WebSocket
|
|
11252
|
+
run<Name extends keyof AiModelList>(
|
|
11253
|
+
model: Name,
|
|
11254
|
+
inputs: AiModelList[Name]["inputs"],
|
|
11255
|
+
options: AiOptions & {
|
|
11256
|
+
websocket: true;
|
|
11257
|
+
},
|
|
11258
|
+
): Promise<Response>;
|
|
11259
|
+
// Streaming
|
|
11260
|
+
run<Name extends keyof AiModelList>(
|
|
11261
|
+
model: Name,
|
|
11262
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
11263
|
+
stream: true;
|
|
11264
|
+
},
|
|
11265
|
+
options?: AiOptions,
|
|
11266
|
+
): Promise<ReadableStream>;
|
|
11267
|
+
// Normal (default) - known model
|
|
11268
|
+
run<Name extends keyof AiModelList>(
|
|
11269
|
+
model: Name,
|
|
11270
|
+
inputs: AiModelList[Name]["inputs"],
|
|
11271
|
+
options?: AiOptions,
|
|
11272
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
11273
|
+
// Unknown model (gateway fallback)
|
|
11274
|
+
run(
|
|
11275
|
+
model: string & {},
|
|
11276
|
+
inputs: Record<string, unknown>,
|
|
11277
|
+
options?: AiOptions,
|
|
11278
|
+
): Promise<Record<string, unknown>>;
|
|
11231
11279
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
11232
11280
|
toMarkdown(): ToMarkdownService;
|
|
11233
11281
|
toMarkdown(
|
|
@@ -11356,6 +11404,7 @@ export declare abstract class AiGateway {
|
|
|
11356
11404
|
options?: {
|
|
11357
11405
|
gateway?: UniversalGatewayOptions;
|
|
11358
11406
|
extraHeaders?: object;
|
|
11407
|
+
signal?: AbortSignal;
|
|
11359
11408
|
},
|
|
11360
11409
|
): Promise<Response>;
|
|
11361
11410
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -13659,7 +13708,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13659
13708
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
13660
13709
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13661
13710
|
connect?(socket: Socket): void | Promise<void>;
|
|
13662
|
-
queue?(batch: MessageBatch
|
|
13711
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
13663
13712
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
13664
13713
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
13665
13714
|
tailStream?(
|
package/index.d.ts
CHANGED
|
@@ -468,6 +468,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
468
468
|
waitUntil(promise: Promise<any>): void;
|
|
469
469
|
passThroughOnException(): void;
|
|
470
470
|
readonly props: Props;
|
|
471
|
+
cache?: CacheContext;
|
|
471
472
|
}
|
|
472
473
|
type ExportedHandlerFetchHandler<
|
|
473
474
|
Env = unknown,
|
|
@@ -544,6 +545,23 @@ interface AlarmInvocationInfo {
|
|
|
544
545
|
interface Cloudflare {
|
|
545
546
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
546
547
|
}
|
|
548
|
+
interface CachePurgeError {
|
|
549
|
+
code: number;
|
|
550
|
+
message: string;
|
|
551
|
+
}
|
|
552
|
+
interface CachePurgeResult {
|
|
553
|
+
success: boolean;
|
|
554
|
+
zoneTag: string;
|
|
555
|
+
errors: CachePurgeError[];
|
|
556
|
+
}
|
|
557
|
+
interface CachePurgeOptions {
|
|
558
|
+
tags?: string[];
|
|
559
|
+
pathPrefixes?: string[];
|
|
560
|
+
purgeEverything?: boolean;
|
|
561
|
+
}
|
|
562
|
+
interface CacheContext {
|
|
563
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
564
|
+
}
|
|
547
565
|
declare abstract class ColoLocalActorNamespace {
|
|
548
566
|
get(actorId: string): Fetcher;
|
|
549
567
|
}
|
|
@@ -10191,6 +10209,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10191
10209
|
inputs: ChatCompletionsInput;
|
|
10192
10210
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10193
10211
|
}
|
|
10212
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10213
|
+
inputs: ChatCompletionsInput;
|
|
10214
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10215
|
+
}
|
|
10194
10216
|
interface AiModels {
|
|
10195
10217
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10196
10218
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10346,6 +10368,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10346
10368
|
interface InferenceUpstreamError extends Error {}
|
|
10347
10369
|
interface AiInternalError extends Error {}
|
|
10348
10370
|
type AiModelListType = Record<string, any>;
|
|
10371
|
+
type AiAsyncBatchResponse = {
|
|
10372
|
+
request_id: string;
|
|
10373
|
+
};
|
|
10349
10374
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10350
10375
|
aiGatewayLogId: string | null;
|
|
10351
10376
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10362,29 +10387,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10362
10387
|
* @param autoragId Instance ID
|
|
10363
10388
|
*/
|
|
10364
10389
|
autorag(autoragId: string): AutoRAG;
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
Options extends AiOptions,
|
|
10368
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10369
|
-
>(
|
|
10390
|
+
// Batch request
|
|
10391
|
+
run<Name extends keyof AiModelList>(
|
|
10370
10392
|
model: Name,
|
|
10371
|
-
inputs:
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10393
|
+
inputs: {
|
|
10394
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10395
|
+
},
|
|
10396
|
+
options: AiOptions & {
|
|
10397
|
+
queueRequest: true;
|
|
10398
|
+
},
|
|
10399
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10400
|
+
// Raw response
|
|
10401
|
+
run<Name extends keyof AiModelList>(
|
|
10402
|
+
model: Name,
|
|
10403
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10404
|
+
options: AiOptions & {
|
|
10405
|
+
returnRawResponse: true;
|
|
10406
|
+
},
|
|
10407
|
+
): Promise<Response>;
|
|
10408
|
+
// WebSocket
|
|
10409
|
+
run<Name extends keyof AiModelList>(
|
|
10410
|
+
model: Name,
|
|
10411
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10412
|
+
options: AiOptions & {
|
|
10413
|
+
websocket: true;
|
|
10414
|
+
},
|
|
10415
|
+
): Promise<Response>;
|
|
10416
|
+
// Streaming
|
|
10417
|
+
run<Name extends keyof AiModelList>(
|
|
10418
|
+
model: Name,
|
|
10419
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10420
|
+
stream: true;
|
|
10421
|
+
},
|
|
10422
|
+
options?: AiOptions,
|
|
10423
|
+
): Promise<ReadableStream>;
|
|
10424
|
+
// Normal (default) - known model
|
|
10425
|
+
run<Name extends keyof AiModelList>(
|
|
10426
|
+
model: Name,
|
|
10427
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10428
|
+
options?: AiOptions,
|
|
10429
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10430
|
+
// Unknown model (gateway fallback)
|
|
10431
|
+
run(
|
|
10432
|
+
model: string & {},
|
|
10433
|
+
inputs: Record<string, unknown>,
|
|
10434
|
+
options?: AiOptions,
|
|
10435
|
+
): Promise<Record<string, unknown>>;
|
|
10388
10436
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10389
10437
|
toMarkdown(): ToMarkdownService;
|
|
10390
10438
|
toMarkdown(
|
|
@@ -10513,6 +10561,7 @@ declare abstract class AiGateway {
|
|
|
10513
10561
|
options?: {
|
|
10514
10562
|
gateway?: UniversalGatewayOptions;
|
|
10515
10563
|
extraHeaders?: object;
|
|
10564
|
+
signal?: AbortSignal;
|
|
10516
10565
|
},
|
|
10517
10566
|
): Promise<Response>;
|
|
10518
10567
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12860,7 +12909,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12860
12909
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12861
12910
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12862
12911
|
connect?(socket: Socket): void | Promise<void>;
|
|
12863
|
-
queue?(batch: MessageBatch
|
|
12912
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12864
12913
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12865
12914
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12866
12915
|
tailStream?(
|
package/index.ts
CHANGED
|
@@ -470,6 +470,7 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
470
470
|
waitUntil(promise: Promise<any>): void;
|
|
471
471
|
passThroughOnException(): void;
|
|
472
472
|
readonly props: Props;
|
|
473
|
+
cache?: CacheContext;
|
|
473
474
|
}
|
|
474
475
|
export type ExportedHandlerFetchHandler<
|
|
475
476
|
Env = unknown,
|
|
@@ -546,6 +547,23 @@ export interface AlarmInvocationInfo {
|
|
|
546
547
|
export interface Cloudflare {
|
|
547
548
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
548
549
|
}
|
|
550
|
+
export interface CachePurgeError {
|
|
551
|
+
code: number;
|
|
552
|
+
message: string;
|
|
553
|
+
}
|
|
554
|
+
export interface CachePurgeResult {
|
|
555
|
+
success: boolean;
|
|
556
|
+
zoneTag: string;
|
|
557
|
+
errors: CachePurgeError[];
|
|
558
|
+
}
|
|
559
|
+
export interface CachePurgeOptions {
|
|
560
|
+
tags?: string[];
|
|
561
|
+
pathPrefixes?: string[];
|
|
562
|
+
purgeEverything?: boolean;
|
|
563
|
+
}
|
|
564
|
+
export interface CacheContext {
|
|
565
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
566
|
+
}
|
|
549
567
|
export declare abstract class ColoLocalActorNamespace {
|
|
550
568
|
get(actorId: string): Fetcher;
|
|
551
569
|
}
|
|
@@ -10200,6 +10218,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10200
10218
|
inputs: ChatCompletionsInput;
|
|
10201
10219
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10202
10220
|
}
|
|
10221
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10222
|
+
inputs: ChatCompletionsInput;
|
|
10223
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10224
|
+
}
|
|
10203
10225
|
export interface AiModels {
|
|
10204
10226
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10205
10227
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10355,6 +10377,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
10355
10377
|
export interface InferenceUpstreamError extends Error {}
|
|
10356
10378
|
export interface AiInternalError extends Error {}
|
|
10357
10379
|
export type AiModelListType = Record<string, any>;
|
|
10380
|
+
export type AiAsyncBatchResponse = {
|
|
10381
|
+
request_id: string;
|
|
10382
|
+
};
|
|
10358
10383
|
export declare abstract class Ai<
|
|
10359
10384
|
AiModelList extends AiModelListType = AiModels,
|
|
10360
10385
|
> {
|
|
@@ -10373,29 +10398,52 @@ export declare abstract class Ai<
|
|
|
10373
10398
|
* @param autoragId Instance ID
|
|
10374
10399
|
*/
|
|
10375
10400
|
autorag(autoragId: string): AutoRAG;
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
Options extends AiOptions,
|
|
10379
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10380
|
-
>(
|
|
10401
|
+
// Batch request
|
|
10402
|
+
run<Name extends keyof AiModelList>(
|
|
10381
10403
|
model: Name,
|
|
10382
|
-
inputs:
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10404
|
+
inputs: {
|
|
10405
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10406
|
+
},
|
|
10407
|
+
options: AiOptions & {
|
|
10408
|
+
queueRequest: true;
|
|
10409
|
+
},
|
|
10410
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10411
|
+
// Raw response
|
|
10412
|
+
run<Name extends keyof AiModelList>(
|
|
10413
|
+
model: Name,
|
|
10414
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10415
|
+
options: AiOptions & {
|
|
10416
|
+
returnRawResponse: true;
|
|
10417
|
+
},
|
|
10418
|
+
): Promise<Response>;
|
|
10419
|
+
// WebSocket
|
|
10420
|
+
run<Name extends keyof AiModelList>(
|
|
10421
|
+
model: Name,
|
|
10422
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10423
|
+
options: AiOptions & {
|
|
10424
|
+
websocket: true;
|
|
10425
|
+
},
|
|
10426
|
+
): Promise<Response>;
|
|
10427
|
+
// Streaming
|
|
10428
|
+
run<Name extends keyof AiModelList>(
|
|
10429
|
+
model: Name,
|
|
10430
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10431
|
+
stream: true;
|
|
10432
|
+
},
|
|
10433
|
+
options?: AiOptions,
|
|
10434
|
+
): Promise<ReadableStream>;
|
|
10435
|
+
// Normal (default) - known model
|
|
10436
|
+
run<Name extends keyof AiModelList>(
|
|
10437
|
+
model: Name,
|
|
10438
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10439
|
+
options?: AiOptions,
|
|
10440
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10441
|
+
// Unknown model (gateway fallback)
|
|
10442
|
+
run(
|
|
10443
|
+
model: string & {},
|
|
10444
|
+
inputs: Record<string, unknown>,
|
|
10445
|
+
options?: AiOptions,
|
|
10446
|
+
): Promise<Record<string, unknown>>;
|
|
10399
10447
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10400
10448
|
toMarkdown(): ToMarkdownService;
|
|
10401
10449
|
toMarkdown(
|
|
@@ -10524,6 +10572,7 @@ export declare abstract class AiGateway {
|
|
|
10524
10572
|
options?: {
|
|
10525
10573
|
gateway?: UniversalGatewayOptions;
|
|
10526
10574
|
extraHeaders?: object;
|
|
10575
|
+
signal?: AbortSignal;
|
|
10527
10576
|
},
|
|
10528
10577
|
): Promise<Response>;
|
|
10529
10578
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12827,7 +12876,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12827
12876
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12828
12877
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12829
12878
|
connect?(socket: Socket): void | Promise<void>;
|
|
12830
|
-
queue?(batch: MessageBatch
|
|
12879
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12831
12880
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12832
12881
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12833
12882
|
tailStream?(
|