@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/2022-10-31/index.d.ts
CHANGED
|
@@ -471,6 +471,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
471
471
|
waitUntil(promise: Promise<any>): void;
|
|
472
472
|
passThroughOnException(): void;
|
|
473
473
|
readonly props: Props;
|
|
474
|
+
cache?: CacheContext;
|
|
474
475
|
}
|
|
475
476
|
type ExportedHandlerFetchHandler<
|
|
476
477
|
Env = unknown,
|
|
@@ -552,6 +553,23 @@ interface AlarmInvocationInfo {
|
|
|
552
553
|
interface Cloudflare {
|
|
553
554
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
554
555
|
}
|
|
556
|
+
interface CachePurgeError {
|
|
557
|
+
code: number;
|
|
558
|
+
message: string;
|
|
559
|
+
}
|
|
560
|
+
interface CachePurgeResult {
|
|
561
|
+
success: boolean;
|
|
562
|
+
zoneTag: string;
|
|
563
|
+
errors: CachePurgeError[];
|
|
564
|
+
}
|
|
565
|
+
interface CachePurgeOptions {
|
|
566
|
+
tags?: string[];
|
|
567
|
+
pathPrefixes?: string[];
|
|
568
|
+
purgeEverything?: boolean;
|
|
569
|
+
}
|
|
570
|
+
interface CacheContext {
|
|
571
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
572
|
+
}
|
|
555
573
|
declare abstract class ColoLocalActorNamespace {
|
|
556
574
|
get(actorId: string): Fetcher;
|
|
557
575
|
}
|
|
@@ -10287,6 +10305,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10287
10305
|
inputs: ChatCompletionsInput;
|
|
10288
10306
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10289
10307
|
}
|
|
10308
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10309
|
+
inputs: ChatCompletionsInput;
|
|
10310
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10311
|
+
}
|
|
10290
10312
|
interface AiModels {
|
|
10291
10313
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10292
10314
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10442,6 +10464,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10442
10464
|
interface InferenceUpstreamError extends Error {}
|
|
10443
10465
|
interface AiInternalError extends Error {}
|
|
10444
10466
|
type AiModelListType = Record<string, any>;
|
|
10467
|
+
type AiAsyncBatchResponse = {
|
|
10468
|
+
request_id: string;
|
|
10469
|
+
};
|
|
10445
10470
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10446
10471
|
aiGatewayLogId: string | null;
|
|
10447
10472
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10458,29 +10483,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10458
10483
|
* @param autoragId Instance ID
|
|
10459
10484
|
*/
|
|
10460
10485
|
autorag(autoragId: string): AutoRAG;
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
Options extends AiOptions,
|
|
10464
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10465
|
-
>(
|
|
10486
|
+
// Batch request
|
|
10487
|
+
run<Name extends keyof AiModelList>(
|
|
10466
10488
|
model: Name,
|
|
10467
|
-
inputs:
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10489
|
+
inputs: {
|
|
10490
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10491
|
+
},
|
|
10492
|
+
options: AiOptions & {
|
|
10493
|
+
queueRequest: true;
|
|
10494
|
+
},
|
|
10495
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10496
|
+
// Raw response
|
|
10497
|
+
run<Name extends keyof AiModelList>(
|
|
10498
|
+
model: Name,
|
|
10499
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10500
|
+
options: AiOptions & {
|
|
10501
|
+
returnRawResponse: true;
|
|
10502
|
+
},
|
|
10503
|
+
): Promise<Response>;
|
|
10504
|
+
// WebSocket
|
|
10505
|
+
run<Name extends keyof AiModelList>(
|
|
10506
|
+
model: Name,
|
|
10507
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10508
|
+
options: AiOptions & {
|
|
10509
|
+
websocket: true;
|
|
10510
|
+
},
|
|
10511
|
+
): Promise<Response>;
|
|
10512
|
+
// Streaming
|
|
10513
|
+
run<Name extends keyof AiModelList>(
|
|
10514
|
+
model: Name,
|
|
10515
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10516
|
+
stream: true;
|
|
10517
|
+
},
|
|
10518
|
+
options?: AiOptions,
|
|
10519
|
+
): Promise<ReadableStream>;
|
|
10520
|
+
// Normal (default) - known model
|
|
10521
|
+
run<Name extends keyof AiModelList>(
|
|
10522
|
+
model: Name,
|
|
10523
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10524
|
+
options?: AiOptions,
|
|
10525
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10526
|
+
// Unknown model (gateway fallback)
|
|
10527
|
+
run(
|
|
10528
|
+
model: string & {},
|
|
10529
|
+
inputs: Record<string, unknown>,
|
|
10530
|
+
options?: AiOptions,
|
|
10531
|
+
): Promise<Record<string, unknown>>;
|
|
10484
10532
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10485
10533
|
toMarkdown(): ToMarkdownService;
|
|
10486
10534
|
toMarkdown(
|
|
@@ -10609,6 +10657,7 @@ declare abstract class AiGateway {
|
|
|
10609
10657
|
options?: {
|
|
10610
10658
|
gateway?: UniversalGatewayOptions;
|
|
10611
10659
|
extraHeaders?: object;
|
|
10660
|
+
signal?: AbortSignal;
|
|
10612
10661
|
},
|
|
10613
10662
|
): Promise<Response>;
|
|
10614
10663
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12956,7 +13005,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12956
13005
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12957
13006
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12958
13007
|
connect?(socket: Socket): void | Promise<void>;
|
|
12959
|
-
queue?(batch: MessageBatch
|
|
13008
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12960
13009
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12961
13010
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12962
13011
|
tailStream?(
|
package/2022-10-31/index.ts
CHANGED
|
@@ -473,6 +473,7 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
473
473
|
waitUntil(promise: Promise<any>): void;
|
|
474
474
|
passThroughOnException(): void;
|
|
475
475
|
readonly props: Props;
|
|
476
|
+
cache?: CacheContext;
|
|
476
477
|
}
|
|
477
478
|
export type ExportedHandlerFetchHandler<
|
|
478
479
|
Env = unknown,
|
|
@@ -554,6 +555,23 @@ export interface AlarmInvocationInfo {
|
|
|
554
555
|
export interface Cloudflare {
|
|
555
556
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
556
557
|
}
|
|
558
|
+
export interface CachePurgeError {
|
|
559
|
+
code: number;
|
|
560
|
+
message: string;
|
|
561
|
+
}
|
|
562
|
+
export interface CachePurgeResult {
|
|
563
|
+
success: boolean;
|
|
564
|
+
zoneTag: string;
|
|
565
|
+
errors: CachePurgeError[];
|
|
566
|
+
}
|
|
567
|
+
export interface CachePurgeOptions {
|
|
568
|
+
tags?: string[];
|
|
569
|
+
pathPrefixes?: string[];
|
|
570
|
+
purgeEverything?: boolean;
|
|
571
|
+
}
|
|
572
|
+
export interface CacheContext {
|
|
573
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
574
|
+
}
|
|
557
575
|
export declare abstract class ColoLocalActorNamespace {
|
|
558
576
|
get(actorId: string): Fetcher;
|
|
559
577
|
}
|
|
@@ -10296,6 +10314,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10296
10314
|
inputs: ChatCompletionsInput;
|
|
10297
10315
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10298
10316
|
}
|
|
10317
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10318
|
+
inputs: ChatCompletionsInput;
|
|
10319
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10320
|
+
}
|
|
10299
10321
|
export interface AiModels {
|
|
10300
10322
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10301
10323
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10451,6 +10473,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
10451
10473
|
export interface InferenceUpstreamError extends Error {}
|
|
10452
10474
|
export interface AiInternalError extends Error {}
|
|
10453
10475
|
export type AiModelListType = Record<string, any>;
|
|
10476
|
+
export type AiAsyncBatchResponse = {
|
|
10477
|
+
request_id: string;
|
|
10478
|
+
};
|
|
10454
10479
|
export declare abstract class Ai<
|
|
10455
10480
|
AiModelList extends AiModelListType = AiModels,
|
|
10456
10481
|
> {
|
|
@@ -10469,29 +10494,52 @@ export declare abstract class Ai<
|
|
|
10469
10494
|
* @param autoragId Instance ID
|
|
10470
10495
|
*/
|
|
10471
10496
|
autorag(autoragId: string): AutoRAG;
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
Options extends AiOptions,
|
|
10475
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10476
|
-
>(
|
|
10497
|
+
// Batch request
|
|
10498
|
+
run<Name extends keyof AiModelList>(
|
|
10477
10499
|
model: Name,
|
|
10478
|
-
inputs:
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10500
|
+
inputs: {
|
|
10501
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10502
|
+
},
|
|
10503
|
+
options: AiOptions & {
|
|
10504
|
+
queueRequest: true;
|
|
10505
|
+
},
|
|
10506
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10507
|
+
// Raw response
|
|
10508
|
+
run<Name extends keyof AiModelList>(
|
|
10509
|
+
model: Name,
|
|
10510
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10511
|
+
options: AiOptions & {
|
|
10512
|
+
returnRawResponse: true;
|
|
10513
|
+
},
|
|
10514
|
+
): Promise<Response>;
|
|
10515
|
+
// WebSocket
|
|
10516
|
+
run<Name extends keyof AiModelList>(
|
|
10517
|
+
model: Name,
|
|
10518
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10519
|
+
options: AiOptions & {
|
|
10520
|
+
websocket: true;
|
|
10521
|
+
},
|
|
10522
|
+
): Promise<Response>;
|
|
10523
|
+
// Streaming
|
|
10524
|
+
run<Name extends keyof AiModelList>(
|
|
10525
|
+
model: Name,
|
|
10526
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10527
|
+
stream: true;
|
|
10528
|
+
},
|
|
10529
|
+
options?: AiOptions,
|
|
10530
|
+
): Promise<ReadableStream>;
|
|
10531
|
+
// Normal (default) - known model
|
|
10532
|
+
run<Name extends keyof AiModelList>(
|
|
10533
|
+
model: Name,
|
|
10534
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10535
|
+
options?: AiOptions,
|
|
10536
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10537
|
+
// Unknown model (gateway fallback)
|
|
10538
|
+
run(
|
|
10539
|
+
model: string & {},
|
|
10540
|
+
inputs: Record<string, unknown>,
|
|
10541
|
+
options?: AiOptions,
|
|
10542
|
+
): Promise<Record<string, unknown>>;
|
|
10495
10543
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10496
10544
|
toMarkdown(): ToMarkdownService;
|
|
10497
10545
|
toMarkdown(
|
|
@@ -10620,6 +10668,7 @@ export declare abstract class AiGateway {
|
|
|
10620
10668
|
options?: {
|
|
10621
10669
|
gateway?: UniversalGatewayOptions;
|
|
10622
10670
|
extraHeaders?: object;
|
|
10671
|
+
signal?: AbortSignal;
|
|
10623
10672
|
},
|
|
10624
10673
|
): Promise<Response>;
|
|
10625
10674
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12923,7 +12972,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12923
12972
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12924
12973
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12925
12974
|
connect?(socket: Socket): void | Promise<void>;
|
|
12926
|
-
queue?(batch: MessageBatch
|
|
12975
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12927
12976
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12928
12977
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12929
12978
|
tailStream?(
|
package/2022-11-30/index.d.ts
CHANGED
|
@@ -476,6 +476,7 @@ interface ExecutionContext<Props = unknown> {
|
|
|
476
476
|
waitUntil(promise: Promise<any>): void;
|
|
477
477
|
passThroughOnException(): void;
|
|
478
478
|
readonly props: Props;
|
|
479
|
+
cache?: CacheContext;
|
|
479
480
|
}
|
|
480
481
|
type ExportedHandlerFetchHandler<
|
|
481
482
|
Env = unknown,
|
|
@@ -557,6 +558,23 @@ interface AlarmInvocationInfo {
|
|
|
557
558
|
interface Cloudflare {
|
|
558
559
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
559
560
|
}
|
|
561
|
+
interface CachePurgeError {
|
|
562
|
+
code: number;
|
|
563
|
+
message: string;
|
|
564
|
+
}
|
|
565
|
+
interface CachePurgeResult {
|
|
566
|
+
success: boolean;
|
|
567
|
+
zoneTag: string;
|
|
568
|
+
errors: CachePurgeError[];
|
|
569
|
+
}
|
|
570
|
+
interface CachePurgeOptions {
|
|
571
|
+
tags?: string[];
|
|
572
|
+
pathPrefixes?: string[];
|
|
573
|
+
purgeEverything?: boolean;
|
|
574
|
+
}
|
|
575
|
+
interface CacheContext {
|
|
576
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
577
|
+
}
|
|
560
578
|
declare abstract class ColoLocalActorNamespace {
|
|
561
579
|
get(actorId: string): Fetcher;
|
|
562
580
|
}
|
|
@@ -10292,6 +10310,10 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10292
10310
|
inputs: ChatCompletionsInput;
|
|
10293
10311
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10294
10312
|
}
|
|
10313
|
+
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10314
|
+
inputs: ChatCompletionsInput;
|
|
10315
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10316
|
+
}
|
|
10295
10317
|
interface AiModels {
|
|
10296
10318
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10297
10319
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10447,6 +10469,9 @@ type ChatCompletionsInput = XOR<
|
|
|
10447
10469
|
interface InferenceUpstreamError extends Error {}
|
|
10448
10470
|
interface AiInternalError extends Error {}
|
|
10449
10471
|
type AiModelListType = Record<string, any>;
|
|
10472
|
+
type AiAsyncBatchResponse = {
|
|
10473
|
+
request_id: string;
|
|
10474
|
+
};
|
|
10450
10475
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
10451
10476
|
aiGatewayLogId: string | null;
|
|
10452
10477
|
gateway(gatewayId: string): AiGateway;
|
|
@@ -10463,29 +10488,52 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10463
10488
|
* @param autoragId Instance ID
|
|
10464
10489
|
*/
|
|
10465
10490
|
autorag(autoragId: string): AutoRAG;
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
Options extends AiOptions,
|
|
10469
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10470
|
-
>(
|
|
10491
|
+
// Batch request
|
|
10492
|
+
run<Name extends keyof AiModelList>(
|
|
10471
10493
|
model: Name,
|
|
10472
|
-
inputs:
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10494
|
+
inputs: {
|
|
10495
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10496
|
+
},
|
|
10497
|
+
options: AiOptions & {
|
|
10498
|
+
queueRequest: true;
|
|
10499
|
+
},
|
|
10500
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10501
|
+
// Raw response
|
|
10502
|
+
run<Name extends keyof AiModelList>(
|
|
10503
|
+
model: Name,
|
|
10504
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10505
|
+
options: AiOptions & {
|
|
10506
|
+
returnRawResponse: true;
|
|
10507
|
+
},
|
|
10508
|
+
): Promise<Response>;
|
|
10509
|
+
// WebSocket
|
|
10510
|
+
run<Name extends keyof AiModelList>(
|
|
10511
|
+
model: Name,
|
|
10512
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10513
|
+
options: AiOptions & {
|
|
10514
|
+
websocket: true;
|
|
10515
|
+
},
|
|
10516
|
+
): Promise<Response>;
|
|
10517
|
+
// Streaming
|
|
10518
|
+
run<Name extends keyof AiModelList>(
|
|
10519
|
+
model: Name,
|
|
10520
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10521
|
+
stream: true;
|
|
10522
|
+
},
|
|
10523
|
+
options?: AiOptions,
|
|
10524
|
+
): Promise<ReadableStream>;
|
|
10525
|
+
// Normal (default) - known model
|
|
10526
|
+
run<Name extends keyof AiModelList>(
|
|
10527
|
+
model: Name,
|
|
10528
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10529
|
+
options?: AiOptions,
|
|
10530
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10531
|
+
// Unknown model (gateway fallback)
|
|
10532
|
+
run(
|
|
10533
|
+
model: string & {},
|
|
10534
|
+
inputs: Record<string, unknown>,
|
|
10535
|
+
options?: AiOptions,
|
|
10536
|
+
): Promise<Record<string, unknown>>;
|
|
10489
10537
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10490
10538
|
toMarkdown(): ToMarkdownService;
|
|
10491
10539
|
toMarkdown(
|
|
@@ -10614,6 +10662,7 @@ declare abstract class AiGateway {
|
|
|
10614
10662
|
options?: {
|
|
10615
10663
|
gateway?: UniversalGatewayOptions;
|
|
10616
10664
|
extraHeaders?: object;
|
|
10665
|
+
signal?: AbortSignal;
|
|
10617
10666
|
},
|
|
10618
10667
|
): Promise<Response>;
|
|
10619
10668
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12961,7 +13010,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12961
13010
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12962
13011
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12963
13012
|
connect?(socket: Socket): void | Promise<void>;
|
|
12964
|
-
queue?(batch: MessageBatch
|
|
13013
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12965
13014
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12966
13015
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12967
13016
|
tailStream?(
|
package/2022-11-30/index.ts
CHANGED
|
@@ -478,6 +478,7 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
478
478
|
waitUntil(promise: Promise<any>): void;
|
|
479
479
|
passThroughOnException(): void;
|
|
480
480
|
readonly props: Props;
|
|
481
|
+
cache?: CacheContext;
|
|
481
482
|
}
|
|
482
483
|
export type ExportedHandlerFetchHandler<
|
|
483
484
|
Env = unknown,
|
|
@@ -559,6 +560,23 @@ export interface AlarmInvocationInfo {
|
|
|
559
560
|
export interface Cloudflare {
|
|
560
561
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
561
562
|
}
|
|
563
|
+
export interface CachePurgeError {
|
|
564
|
+
code: number;
|
|
565
|
+
message: string;
|
|
566
|
+
}
|
|
567
|
+
export interface CachePurgeResult {
|
|
568
|
+
success: boolean;
|
|
569
|
+
zoneTag: string;
|
|
570
|
+
errors: CachePurgeError[];
|
|
571
|
+
}
|
|
572
|
+
export interface CachePurgeOptions {
|
|
573
|
+
tags?: string[];
|
|
574
|
+
pathPrefixes?: string[];
|
|
575
|
+
purgeEverything?: boolean;
|
|
576
|
+
}
|
|
577
|
+
export interface CacheContext {
|
|
578
|
+
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
579
|
+
}
|
|
562
580
|
export declare abstract class ColoLocalActorNamespace {
|
|
563
581
|
get(actorId: string): Fetcher;
|
|
564
582
|
}
|
|
@@ -10301,6 +10319,10 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
|
10301
10319
|
inputs: ChatCompletionsInput;
|
|
10302
10320
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10303
10321
|
}
|
|
10322
|
+
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10323
|
+
inputs: ChatCompletionsInput;
|
|
10324
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10325
|
+
}
|
|
10304
10326
|
export interface AiModels {
|
|
10305
10327
|
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
10306
10328
|
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
@@ -10456,6 +10478,9 @@ export type ChatCompletionsInput = XOR<
|
|
|
10456
10478
|
export interface InferenceUpstreamError extends Error {}
|
|
10457
10479
|
export interface AiInternalError extends Error {}
|
|
10458
10480
|
export type AiModelListType = Record<string, any>;
|
|
10481
|
+
export type AiAsyncBatchResponse = {
|
|
10482
|
+
request_id: string;
|
|
10483
|
+
};
|
|
10459
10484
|
export declare abstract class Ai<
|
|
10460
10485
|
AiModelList extends AiModelListType = AiModels,
|
|
10461
10486
|
> {
|
|
@@ -10474,29 +10499,52 @@ export declare abstract class Ai<
|
|
|
10474
10499
|
* @param autoragId Instance ID
|
|
10475
10500
|
*/
|
|
10476
10501
|
autorag(autoragId: string): AutoRAG;
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
Options extends AiOptions,
|
|
10480
|
-
InputOptions extends AiModelList[Name]["inputs"],
|
|
10481
|
-
>(
|
|
10502
|
+
// Batch request
|
|
10503
|
+
run<Name extends keyof AiModelList>(
|
|
10482
10504
|
model: Name,
|
|
10483
|
-
inputs:
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10505
|
+
inputs: {
|
|
10506
|
+
requests: AiModelList[Name]["inputs"][];
|
|
10507
|
+
},
|
|
10508
|
+
options: AiOptions & {
|
|
10509
|
+
queueRequest: true;
|
|
10510
|
+
},
|
|
10511
|
+
): Promise<AiAsyncBatchResponse>;
|
|
10512
|
+
// Raw response
|
|
10513
|
+
run<Name extends keyof AiModelList>(
|
|
10514
|
+
model: Name,
|
|
10515
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10516
|
+
options: AiOptions & {
|
|
10517
|
+
returnRawResponse: true;
|
|
10518
|
+
},
|
|
10519
|
+
): Promise<Response>;
|
|
10520
|
+
// WebSocket
|
|
10521
|
+
run<Name extends keyof AiModelList>(
|
|
10522
|
+
model: Name,
|
|
10523
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10524
|
+
options: AiOptions & {
|
|
10525
|
+
websocket: true;
|
|
10526
|
+
},
|
|
10527
|
+
): Promise<Response>;
|
|
10528
|
+
// Streaming
|
|
10529
|
+
run<Name extends keyof AiModelList>(
|
|
10530
|
+
model: Name,
|
|
10531
|
+
inputs: AiModelList[Name]["inputs"] & {
|
|
10532
|
+
stream: true;
|
|
10533
|
+
},
|
|
10534
|
+
options?: AiOptions,
|
|
10535
|
+
): Promise<ReadableStream>;
|
|
10536
|
+
// Normal (default) - known model
|
|
10537
|
+
run<Name extends keyof AiModelList>(
|
|
10538
|
+
model: Name,
|
|
10539
|
+
inputs: AiModelList[Name]["inputs"],
|
|
10540
|
+
options?: AiOptions,
|
|
10541
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
10542
|
+
// Unknown model (gateway fallback)
|
|
10543
|
+
run(
|
|
10544
|
+
model: string & {},
|
|
10545
|
+
inputs: Record<string, unknown>,
|
|
10546
|
+
options?: AiOptions,
|
|
10547
|
+
): Promise<Record<string, unknown>>;
|
|
10500
10548
|
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
10501
10549
|
toMarkdown(): ToMarkdownService;
|
|
10502
10550
|
toMarkdown(
|
|
@@ -10625,6 +10673,7 @@ export declare abstract class AiGateway {
|
|
|
10625
10673
|
options?: {
|
|
10626
10674
|
gateway?: UniversalGatewayOptions;
|
|
10627
10675
|
extraHeaders?: object;
|
|
10676
|
+
signal?: AbortSignal;
|
|
10628
10677
|
},
|
|
10629
10678
|
): Promise<Response>;
|
|
10630
10679
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12928,7 +12977,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12928
12977
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12929
12978
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12930
12979
|
connect?(socket: Socket): void | Promise<void>;
|
|
12931
|
-
queue?(batch: MessageBatch
|
|
12980
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12932
12981
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12933
12982
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12934
12983
|
tailStream?(
|