@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/2021-11-03/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/2021-11-03/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?(
|
package/2022-01-31/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
|
}
|
|
@@ -10258,6 +10276,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10258
10276
|
inputs: ChatCompletionsInput;
|
|
10259
10277
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10260
10278
|
}
|
|
10279
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10280
|
+
inputs: ChatCompletionsInput;
|
|
10281
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10282
|
+
}
|
|
10261
10283
|
interface AiModels {
|
|
10262
10284
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10263
10285
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10413,6 +10435,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10413
10435
|
interface InferenceUpstreamError extends Error {}
|
|
10414
10436
|
interface AiInternalError extends Error {}
|
|
10415
10437
|
type AiModelListType = Record<string, any>;
|
|
10438
|
+
type AiAsyncBatchResponse = {
|
|
10439
|
+
request_id: string;
|
|
10440
|
+
};
|
|
10416
10441
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10417
10442
|
aiGatewayLogId: string | null;
|
|
10418
10443
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10429,29 +10454,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10429
10454
|
* @param autoragId Instance ID
|
|
10430
10455
|
*/
|
|
10431
10456
|
autorag(autoragId: string): AutoRAG;
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
Options extends AiOptions,
|
|
10435
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10436
|
-
>(
|
|
10457
|
+
// Batch request
|
|
10458
|
+
run<Name extends keyof AiModelList>(
|
|
10437
10459
|
model: Name,
|
|
10438
|
-
inputs:
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10460
|
+
inputs: {
|
|
10461
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10462
|
+
},
|
|
10463
|
+
options: AiOptions & {
|
|
10464
|
+
queueRequest: true;
|
|
10465
|
+
},
|
|
10466
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10467
|
+
// Raw response
|
|
10468
|
+
run<Name extends keyof AiModelList>(
|
|
10469
|
+
model: Name,
|
|
10470
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10471
|
+
options: AiOptions & {
|
|
10472
|
+
returnRawResponse: true;
|
|
10473
|
+
},
|
|
10474
|
+
): Promise<Response>;
|
|
10475
|
+
// WebSocket
|
|
10476
|
+
run<Name extends keyof AiModelList>(
|
|
10477
|
+
model: Name,
|
|
10478
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10479
|
+
options: AiOptions & {
|
|
10480
|
+
websocket: true;
|
|
10481
|
+
},
|
|
10482
|
+
): Promise<Response>;
|
|
10483
|
+
// Streaming
|
|
10484
|
+
run<Name extends keyof AiModelList>(
|
|
10485
|
+
model: Name,
|
|
10486
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10487
|
+
stream: true;
|
|
10488
|
+
},
|
|
10489
|
+
options?: AiOptions,
|
|
10490
|
+
): Promise<ReadableStream>;
|
|
10491
|
+
// Normal (default) - known model
|
|
10492
|
+
run<Name extends keyof AiModelList>(
|
|
10493
|
+
model: Name,
|
|
10494
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10495
|
+
options?: AiOptions,
|
|
10496
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10497
|
+
// Unknown model (gateway fallback)
|
|
10498
|
+
run(
|
|
10499
|
+
model: string & {},
|
|
10500
|
+
inputs: Record<string, unknown>,
|
|
10501
|
+
options?: AiOptions,
|
|
10502
|
+
): Promise<Record<string, unknown>>;
|
|
10455
10503
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10456
10504
|
toMarkdown(): ToMarkdownService;
|
|
10457
10505
|
toMarkdown(
|
|
@@ -10580,6 +10628,7 @@ declare abstract class AiGateway {
|
|
|
10580
10628
|
options?: {
|
|
10581
10629
|
gateway?: UniversalGatewayOptions;
|
|
10582
10630
|
extraHeaders?: object;
|
|
10631
|
+
signal?: AbortSignal;
|
|
10583
10632
|
},
|
|
10584
10633
|
): Promise<Response>;
|
|
10585
10634
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12927,7 +12976,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12927
12976
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12928
12977
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12929
12978
|
connect?(socket: Socket): void | Promise<void>;
|
|
12930
|
-
queue?(batch: MessageBatch
|
|
12979
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12931
12980
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12932
12981
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12933
12982
|
tailStream?(
|
package/2022-01-31/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
|
}
|
|
@@ -10267,6 +10285,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10267
10285
|
inputs: ChatCompletionsInput;
|
|
10268
10286
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10269
10287
|
}
|
|
10288
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10289
|
+
inputs: ChatCompletionsInput;
|
|
10290
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10291
|
+
}
|
|
10270
10292
|
export interface AiModels {
|
|
10271
10293
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10272
10294
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10422,6 +10444,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
10422
10444
|
export interface InferenceUpstreamError extends Error {}
|
|
10423
10445
|
export interface AiInternalError extends Error {}
|
|
10424
10446
|
export type AiModelListType = Record<string, any>;
|
|
10447
|
+
export type AiAsyncBatchResponse = {
|
|
10448
|
+
request_id: string;
|
|
10449
|
+
};
|
|
10425
10450
|
export declare abstract class Ai<
|
|
10426
10451
|
AiModelList extends AiModelListType = AiModels,
|
|
10427
10452
|
> {
|
|
@@ -10440,29 +10465,52 @@ export declare abstract class Ai<
|
|
|
10440
10465
|
* @param autoragId Instance ID
|
|
10441
10466
|
*/
|
|
10442
10467
|
autorag(autoragId: string): AutoRAG;
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
Options extends AiOptions,
|
|
10446
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10447
|
-
>(
|
|
10468
|
+
// Batch request
|
|
10469
|
+
run<Name extends keyof AiModelList>(
|
|
10448
10470
|
model: Name,
|
|
10449
|
-
inputs:
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10471
|
+
inputs: {
|
|
10472
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10473
|
+
},
|
|
10474
|
+
options: AiOptions & {
|
|
10475
|
+
queueRequest: true;
|
|
10476
|
+
},
|
|
10477
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10478
|
+
// Raw response
|
|
10479
|
+
run<Name extends keyof AiModelList>(
|
|
10480
|
+
model: Name,
|
|
10481
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10482
|
+
options: AiOptions & {
|
|
10483
|
+
returnRawResponse: true;
|
|
10484
|
+
},
|
|
10485
|
+
): Promise<Response>;
|
|
10486
|
+
// WebSocket
|
|
10487
|
+
run<Name extends keyof AiModelList>(
|
|
10488
|
+
model: Name,
|
|
10489
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10490
|
+
options: AiOptions & {
|
|
10491
|
+
websocket: true;
|
|
10492
|
+
},
|
|
10493
|
+
): Promise<Response>;
|
|
10494
|
+
// Streaming
|
|
10495
|
+
run<Name extends keyof AiModelList>(
|
|
10496
|
+
model: Name,
|
|
10497
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10498
|
+
stream: true;
|
|
10499
|
+
},
|
|
10500
|
+
options?: AiOptions,
|
|
10501
|
+
): Promise<ReadableStream>;
|
|
10502
|
+
// Normal (default) - known model
|
|
10503
|
+
run<Name extends keyof AiModelList>(
|
|
10504
|
+
model: Name,
|
|
10505
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10506
|
+
options?: AiOptions,
|
|
10507
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10508
|
+
// Unknown model (gateway fallback)
|
|
10509
|
+
run(
|
|
10510
|
+
model: string & {},
|
|
10511
|
+
inputs: Record<string, unknown>,
|
|
10512
|
+
options?: AiOptions,
|
|
10513
|
+
): Promise<Record<string, unknown>>;
|
|
10466
10514
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10467
10515
|
toMarkdown(): ToMarkdownService;
|
|
10468
10516
|
toMarkdown(
|
|
@@ -10591,6 +10639,7 @@ export declare abstract class AiGateway {
|
|
|
10591
10639
|
options?: {
|
|
10592
10640
|
gateway?: UniversalGatewayOptions;
|
|
10593
10641
|
extraHeaders?: object;
|
|
10642
|
+
signal?: AbortSignal;
|
|
10594
10643
|
},
|
|
10595
10644
|
): Promise<Response>;
|
|
10596
10645
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12894,7 +12943,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12894
12943
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12895
12944
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12896
12945
|
connect?(socket: Socket): void | Promise<void>;
|
|
12897
|
-
queue?(batch: MessageBatch
|
|
12946
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12898
12947
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12899
12948
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12900
12949
|
tailStream?(
|