@cloudflare/workers-types 4.20260520.1 → 4.20260522.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 +118 -1
- package/2021-11-03/index.ts +118 -1
- package/2022-01-31/index.d.ts +118 -1
- package/2022-01-31/index.ts +118 -1
- package/2022-03-21/index.d.ts +118 -1
- package/2022-03-21/index.ts +118 -1
- package/2022-08-04/index.d.ts +118 -1
- package/2022-08-04/index.ts +118 -1
- package/2022-10-31/index.d.ts +118 -1
- package/2022-10-31/index.ts +118 -1
- package/2022-11-30/index.d.ts +118 -1
- package/2022-11-30/index.ts +118 -1
- package/2023-03-01/index.d.ts +118 -1
- package/2023-03-01/index.ts +118 -1
- package/2023-07-01/index.d.ts +118 -1
- package/2023-07-01/index.ts +118 -1
- package/experimental/index.d.ts +118 -1
- package/experimental/index.ts +118 -1
- package/index.d.ts +118 -1
- package/index.ts +118 -1
- package/latest/index.d.ts +118 -1
- package/latest/index.ts +118 -1
- package/oldest/index.d.ts +118 -1
- package/oldest/index.ts +118 -1
- package/package.json +1 -1
package/experimental/index.d.ts
CHANGED
|
@@ -11402,12 +11402,16 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
11402
11402
|
inputs: ChatCompletionsInput;
|
|
11403
11403
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11404
11404
|
}
|
|
11405
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
11406
|
+
inputs: ChatCompletionsBase;
|
|
11407
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11408
|
+
}
|
|
11405
11409
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
11406
11410
|
inputs: ChatCompletionsInput;
|
|
11407
11411
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11408
11412
|
}
|
|
11409
11413
|
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
11410
|
-
inputs:
|
|
11414
|
+
inputs: ChatCompletionsBase;
|
|
11411
11415
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11412
11416
|
}
|
|
11413
11417
|
interface AiModels {
|
|
@@ -11499,7 +11503,9 @@ interface AiModels {
|
|
|
11499
11503
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
11500
11504
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
11501
11505
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
11506
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
11502
11507
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
11508
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
11503
11509
|
}
|
|
11504
11510
|
type AiOptions = {
|
|
11505
11511
|
/**
|
|
@@ -14420,15 +14426,29 @@ declare namespace CloudflareWorkersModule {
|
|
|
14420
14426
|
attempt: number;
|
|
14421
14427
|
config: WorkflowStepConfig;
|
|
14422
14428
|
};
|
|
14429
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
14430
|
+
error: Error;
|
|
14431
|
+
output: T | undefined;
|
|
14432
|
+
stepName: string;
|
|
14433
|
+
};
|
|
14434
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
14435
|
+
ctx: WorkflowRollbackContext<T>,
|
|
14436
|
+
) => Promise<void>;
|
|
14437
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
14438
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
14439
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
14440
|
+
};
|
|
14423
14441
|
export abstract class WorkflowStep {
|
|
14424
14442
|
do<T extends Rpc.Serializable<T>>(
|
|
14425
14443
|
name: string,
|
|
14426
14444
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
14445
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
14427
14446
|
): Promise<T>;
|
|
14428
14447
|
do<T extends Rpc.Serializable<T>>(
|
|
14429
14448
|
name: string,
|
|
14430
14449
|
config: WorkflowStepConfig,
|
|
14431
14450
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
14451
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
14432
14452
|
): Promise<T>;
|
|
14433
14453
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
14434
14454
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15820,6 +15840,103 @@ type WorkerVersionMetadata = {
|
|
|
15820
15840
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15821
15841
|
timestamp: string;
|
|
15822
15842
|
};
|
|
15843
|
+
// ============ Web Search Request Types ============
|
|
15844
|
+
/**
|
|
15845
|
+
* Options for a Web Search query.
|
|
15846
|
+
*/
|
|
15847
|
+
type WebSearchSearchOptions = {
|
|
15848
|
+
/** The search query. */
|
|
15849
|
+
query: string;
|
|
15850
|
+
/**
|
|
15851
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15852
|
+
* The actual count may be lower if fewer matches exist.
|
|
15853
|
+
*/
|
|
15854
|
+
limit?: number;
|
|
15855
|
+
};
|
|
15856
|
+
// ============ Web Search Response Types ============
|
|
15857
|
+
/**
|
|
15858
|
+
* A single Web Search result.
|
|
15859
|
+
*
|
|
15860
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15861
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15862
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15863
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15864
|
+
*/
|
|
15865
|
+
type WebSearchResult = {
|
|
15866
|
+
/** Canonical URL. */
|
|
15867
|
+
url: string;
|
|
15868
|
+
/** Page title. */
|
|
15869
|
+
title: string;
|
|
15870
|
+
/** Page-level description. May be absent. */
|
|
15871
|
+
description?: string;
|
|
15872
|
+
/**
|
|
15873
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15874
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15875
|
+
*/
|
|
15876
|
+
lastModifiedDate?: string;
|
|
15877
|
+
/**
|
|
15878
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15879
|
+
*/
|
|
15880
|
+
imageUrl?: string;
|
|
15881
|
+
/** Optional favicon URL for UI hints. */
|
|
15882
|
+
faviconUrl?: string;
|
|
15883
|
+
};
|
|
15884
|
+
/**
|
|
15885
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15886
|
+
* fields useful for support and debugging.
|
|
15887
|
+
*/
|
|
15888
|
+
type WebSearchResponseMetadata = {
|
|
15889
|
+
/** The query that was executed. */
|
|
15890
|
+
query: string;
|
|
15891
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15892
|
+
requestId: string;
|
|
15893
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15894
|
+
latencyMs: number;
|
|
15895
|
+
};
|
|
15896
|
+
/**
|
|
15897
|
+
* Response from a Web Search query.
|
|
15898
|
+
*/
|
|
15899
|
+
type WebSearchSearchResponse = {
|
|
15900
|
+
items: WebSearchResult[];
|
|
15901
|
+
metadata: WebSearchResponseMetadata;
|
|
15902
|
+
};
|
|
15903
|
+
// ============ Web Search Binding Class ============
|
|
15904
|
+
/**
|
|
15905
|
+
* Cloudflare Web Search binding.
|
|
15906
|
+
*
|
|
15907
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15908
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15909
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15910
|
+
*
|
|
15911
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15912
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15913
|
+
*
|
|
15914
|
+
* ```jsonc
|
|
15915
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15916
|
+
* ```
|
|
15917
|
+
*
|
|
15918
|
+
* @example
|
|
15919
|
+
* ```ts
|
|
15920
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15921
|
+
* query: "Cloudflare Workers",
|
|
15922
|
+
* });
|
|
15923
|
+
*
|
|
15924
|
+
* const top = items[0];
|
|
15925
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15926
|
+
*
|
|
15927
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15928
|
+
* // controls apply at the fetch site, not at search time.
|
|
15929
|
+
* const page = await fetch(top.url);
|
|
15930
|
+
* ```
|
|
15931
|
+
*/
|
|
15932
|
+
declare abstract class WebSearch {
|
|
15933
|
+
/**
|
|
15934
|
+
* Run a Web Search query.
|
|
15935
|
+
* @param options Search options. Only `query` is required.
|
|
15936
|
+
* @returns The matching results plus per-response metadata.
|
|
15937
|
+
*/
|
|
15938
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15939
|
+
}
|
|
15823
15940
|
interface DynamicDispatchLimits {
|
|
15824
15941
|
/**
|
|
15825
15942
|
* Limit CPU time in milliseconds.
|
package/experimental/index.ts
CHANGED
|
@@ -11412,12 +11412,16 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
11412
11412
|
inputs: ChatCompletionsInput;
|
|
11413
11413
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11414
11414
|
}
|
|
11415
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
11416
|
+
inputs: ChatCompletionsBase;
|
|
11417
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
11418
|
+
}
|
|
11415
11419
|
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
11416
11420
|
inputs: ChatCompletionsInput;
|
|
11417
11421
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11418
11422
|
}
|
|
11419
11423
|
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
11420
|
-
inputs:
|
|
11424
|
+
inputs: ChatCompletionsBase;
|
|
11421
11425
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
11422
11426
|
}
|
|
11423
11427
|
export interface AiModels {
|
|
@@ -11509,7 +11513,9 @@ export interface AiModels {
|
|
|
11509
11513
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
11510
11514
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
11511
11515
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
11516
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
11512
11517
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
11518
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
11513
11519
|
}
|
|
11514
11520
|
export type AiOptions = {
|
|
11515
11521
|
/**
|
|
@@ -14391,15 +14397,29 @@ export declare namespace CloudflareWorkersModule {
|
|
|
14391
14397
|
attempt: number;
|
|
14392
14398
|
config: WorkflowStepConfig;
|
|
14393
14399
|
};
|
|
14400
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
14401
|
+
error: Error;
|
|
14402
|
+
output: T | undefined;
|
|
14403
|
+
stepName: string;
|
|
14404
|
+
};
|
|
14405
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
14406
|
+
ctx: WorkflowRollbackContext<T>,
|
|
14407
|
+
) => Promise<void>;
|
|
14408
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
14409
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
14410
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
14411
|
+
};
|
|
14394
14412
|
export abstract class WorkflowStep {
|
|
14395
14413
|
do<T extends Rpc.Serializable<T>>(
|
|
14396
14414
|
name: string,
|
|
14397
14415
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
14416
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
14398
14417
|
): Promise<T>;
|
|
14399
14418
|
do<T extends Rpc.Serializable<T>>(
|
|
14400
14419
|
name: string,
|
|
14401
14420
|
config: WorkflowStepConfig,
|
|
14402
14421
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
14422
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
14403
14423
|
): Promise<T>;
|
|
14404
14424
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
14405
14425
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15781,6 +15801,103 @@ export type WorkerVersionMetadata = {
|
|
|
15781
15801
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15782
15802
|
timestamp: string;
|
|
15783
15803
|
};
|
|
15804
|
+
// ============ Web Search Request Types ============
|
|
15805
|
+
/**
|
|
15806
|
+
* Options for a Web Search query.
|
|
15807
|
+
*/
|
|
15808
|
+
export type WebSearchSearchOptions = {
|
|
15809
|
+
/** The search query. */
|
|
15810
|
+
query: string;
|
|
15811
|
+
/**
|
|
15812
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15813
|
+
* The actual count may be lower if fewer matches exist.
|
|
15814
|
+
*/
|
|
15815
|
+
limit?: number;
|
|
15816
|
+
};
|
|
15817
|
+
// ============ Web Search Response Types ============
|
|
15818
|
+
/**
|
|
15819
|
+
* A single Web Search result.
|
|
15820
|
+
*
|
|
15821
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15822
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15823
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15824
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15825
|
+
*/
|
|
15826
|
+
export type WebSearchResult = {
|
|
15827
|
+
/** Canonical URL. */
|
|
15828
|
+
url: string;
|
|
15829
|
+
/** Page title. */
|
|
15830
|
+
title: string;
|
|
15831
|
+
/** Page-level description. May be absent. */
|
|
15832
|
+
description?: string;
|
|
15833
|
+
/**
|
|
15834
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15835
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15836
|
+
*/
|
|
15837
|
+
lastModifiedDate?: string;
|
|
15838
|
+
/**
|
|
15839
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15840
|
+
*/
|
|
15841
|
+
imageUrl?: string;
|
|
15842
|
+
/** Optional favicon URL for UI hints. */
|
|
15843
|
+
faviconUrl?: string;
|
|
15844
|
+
};
|
|
15845
|
+
/**
|
|
15846
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15847
|
+
* fields useful for support and debugging.
|
|
15848
|
+
*/
|
|
15849
|
+
export type WebSearchResponseMetadata = {
|
|
15850
|
+
/** The query that was executed. */
|
|
15851
|
+
query: string;
|
|
15852
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15853
|
+
requestId: string;
|
|
15854
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15855
|
+
latencyMs: number;
|
|
15856
|
+
};
|
|
15857
|
+
/**
|
|
15858
|
+
* Response from a Web Search query.
|
|
15859
|
+
*/
|
|
15860
|
+
export type WebSearchSearchResponse = {
|
|
15861
|
+
items: WebSearchResult[];
|
|
15862
|
+
metadata: WebSearchResponseMetadata;
|
|
15863
|
+
};
|
|
15864
|
+
// ============ Web Search Binding Class ============
|
|
15865
|
+
/**
|
|
15866
|
+
* Cloudflare Web Search binding.
|
|
15867
|
+
*
|
|
15868
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15869
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15870
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15871
|
+
*
|
|
15872
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15873
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15874
|
+
*
|
|
15875
|
+
* ```jsonc
|
|
15876
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15877
|
+
* ```
|
|
15878
|
+
*
|
|
15879
|
+
* @example
|
|
15880
|
+
* ```ts
|
|
15881
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15882
|
+
* query: "Cloudflare Workers",
|
|
15883
|
+
* });
|
|
15884
|
+
*
|
|
15885
|
+
* const top = items[0];
|
|
15886
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15887
|
+
*
|
|
15888
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15889
|
+
* // controls apply at the fetch site, not at search time.
|
|
15890
|
+
* const page = await fetch(top.url);
|
|
15891
|
+
* ```
|
|
15892
|
+
*/
|
|
15893
|
+
export declare abstract class WebSearch {
|
|
15894
|
+
/**
|
|
15895
|
+
* Run a Web Search query.
|
|
15896
|
+
* @param options Search options. Only `query` is required.
|
|
15897
|
+
* @returns The matching results plus per-response metadata.
|
|
15898
|
+
*/
|
|
15899
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15900
|
+
}
|
|
15784
15901
|
export interface DynamicDispatchLimits {
|
|
15785
15902
|
/**
|
|
15786
15903
|
* Limit CPU time in milliseconds.
|
package/index.d.ts
CHANGED
|
@@ -10593,12 +10593,16 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10593
10593
|
inputs: ChatCompletionsInput;
|
|
10594
10594
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10595
10595
|
}
|
|
10596
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10597
|
+
inputs: ChatCompletionsBase;
|
|
10598
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10599
|
+
}
|
|
10596
10600
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10597
10601
|
inputs: ChatCompletionsInput;
|
|
10598
10602
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10599
10603
|
}
|
|
10600
10604
|
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10601
|
-
inputs:
|
|
10605
|
+
inputs: ChatCompletionsBase;
|
|
10602
10606
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10603
10607
|
}
|
|
10604
10608
|
interface AiModels {
|
|
@@ -10690,7 +10694,9 @@ interface AiModels {
|
|
|
10690
10694
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10691
10695
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10692
10696
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10697
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10693
10698
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10699
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10694
10700
|
}
|
|
10695
10701
|
type AiOptions = {
|
|
10696
10702
|
/**
|
|
@@ -13611,15 +13617,29 @@ declare namespace CloudflareWorkersModule {
|
|
|
13611
13617
|
attempt: number;
|
|
13612
13618
|
config: WorkflowStepConfig;
|
|
13613
13619
|
};
|
|
13620
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13621
|
+
error: Error;
|
|
13622
|
+
output: T | undefined;
|
|
13623
|
+
stepName: string;
|
|
13624
|
+
};
|
|
13625
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13626
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13627
|
+
) => Promise<void>;
|
|
13628
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13629
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13630
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13631
|
+
};
|
|
13614
13632
|
export abstract class WorkflowStep {
|
|
13615
13633
|
do<T extends Rpc.Serializable<T>>(
|
|
13616
13634
|
name: string,
|
|
13617
13635
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13636
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13618
13637
|
): Promise<T>;
|
|
13619
13638
|
do<T extends Rpc.Serializable<T>>(
|
|
13620
13639
|
name: string,
|
|
13621
13640
|
config: WorkflowStepConfig,
|
|
13622
13641
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13642
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13623
13643
|
): Promise<T>;
|
|
13624
13644
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13625
13645
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15011,6 +15031,103 @@ type WorkerVersionMetadata = {
|
|
|
15011
15031
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15012
15032
|
timestamp: string;
|
|
15013
15033
|
};
|
|
15034
|
+
// ============ Web Search Request Types ============
|
|
15035
|
+
/**
|
|
15036
|
+
* Options for a Web Search query.
|
|
15037
|
+
*/
|
|
15038
|
+
type WebSearchSearchOptions = {
|
|
15039
|
+
/** The search query. */
|
|
15040
|
+
query: string;
|
|
15041
|
+
/**
|
|
15042
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15043
|
+
* The actual count may be lower if fewer matches exist.
|
|
15044
|
+
*/
|
|
15045
|
+
limit?: number;
|
|
15046
|
+
};
|
|
15047
|
+
// ============ Web Search Response Types ============
|
|
15048
|
+
/**
|
|
15049
|
+
* A single Web Search result.
|
|
15050
|
+
*
|
|
15051
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15052
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15053
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15054
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15055
|
+
*/
|
|
15056
|
+
type WebSearchResult = {
|
|
15057
|
+
/** Canonical URL. */
|
|
15058
|
+
url: string;
|
|
15059
|
+
/** Page title. */
|
|
15060
|
+
title: string;
|
|
15061
|
+
/** Page-level description. May be absent. */
|
|
15062
|
+
description?: string;
|
|
15063
|
+
/**
|
|
15064
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15065
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15066
|
+
*/
|
|
15067
|
+
lastModifiedDate?: string;
|
|
15068
|
+
/**
|
|
15069
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15070
|
+
*/
|
|
15071
|
+
imageUrl?: string;
|
|
15072
|
+
/** Optional favicon URL for UI hints. */
|
|
15073
|
+
faviconUrl?: string;
|
|
15074
|
+
};
|
|
15075
|
+
/**
|
|
15076
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15077
|
+
* fields useful for support and debugging.
|
|
15078
|
+
*/
|
|
15079
|
+
type WebSearchResponseMetadata = {
|
|
15080
|
+
/** The query that was executed. */
|
|
15081
|
+
query: string;
|
|
15082
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15083
|
+
requestId: string;
|
|
15084
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15085
|
+
latencyMs: number;
|
|
15086
|
+
};
|
|
15087
|
+
/**
|
|
15088
|
+
* Response from a Web Search query.
|
|
15089
|
+
*/
|
|
15090
|
+
type WebSearchSearchResponse = {
|
|
15091
|
+
items: WebSearchResult[];
|
|
15092
|
+
metadata: WebSearchResponseMetadata;
|
|
15093
|
+
};
|
|
15094
|
+
// ============ Web Search Binding Class ============
|
|
15095
|
+
/**
|
|
15096
|
+
* Cloudflare Web Search binding.
|
|
15097
|
+
*
|
|
15098
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15099
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15100
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15101
|
+
*
|
|
15102
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15103
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15104
|
+
*
|
|
15105
|
+
* ```jsonc
|
|
15106
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15107
|
+
* ```
|
|
15108
|
+
*
|
|
15109
|
+
* @example
|
|
15110
|
+
* ```ts
|
|
15111
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15112
|
+
* query: "Cloudflare Workers",
|
|
15113
|
+
* });
|
|
15114
|
+
*
|
|
15115
|
+
* const top = items[0];
|
|
15116
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15117
|
+
*
|
|
15118
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15119
|
+
* // controls apply at the fetch site, not at search time.
|
|
15120
|
+
* const page = await fetch(top.url);
|
|
15121
|
+
* ```
|
|
15122
|
+
*/
|
|
15123
|
+
declare abstract class WebSearch {
|
|
15124
|
+
/**
|
|
15125
|
+
* Run a Web Search query.
|
|
15126
|
+
* @param options Search options. Only `query` is required.
|
|
15127
|
+
* @returns The matching results plus per-response metadata.
|
|
15128
|
+
*/
|
|
15129
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15130
|
+
}
|
|
15014
15131
|
interface DynamicDispatchLimits {
|
|
15015
15132
|
/**
|
|
15016
15133
|
* Limit CPU time in milliseconds.
|
package/index.ts
CHANGED
|
@@ -10603,12 +10603,16 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10603
10603
|
inputs: ChatCompletionsInput;
|
|
10604
10604
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10605
10605
|
}
|
|
10606
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10607
|
+
inputs: ChatCompletionsBase;
|
|
10608
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10609
|
+
}
|
|
10606
10610
|
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10607
10611
|
inputs: ChatCompletionsInput;
|
|
10608
10612
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10609
10613
|
}
|
|
10610
10614
|
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10611
|
-
inputs:
|
|
10615
|
+
inputs: ChatCompletionsBase;
|
|
10612
10616
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10613
10617
|
}
|
|
10614
10618
|
export interface AiModels {
|
|
@@ -10700,7 +10704,9 @@ export interface AiModels {
|
|
|
10700
10704
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10701
10705
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10702
10706
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10707
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10703
10708
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10709
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10704
10710
|
}
|
|
10705
10711
|
export type AiOptions = {
|
|
10706
10712
|
/**
|
|
@@ -13582,15 +13588,29 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13582
13588
|
attempt: number;
|
|
13583
13589
|
config: WorkflowStepConfig;
|
|
13584
13590
|
};
|
|
13591
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13592
|
+
error: Error;
|
|
13593
|
+
output: T | undefined;
|
|
13594
|
+
stepName: string;
|
|
13595
|
+
};
|
|
13596
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13597
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13598
|
+
) => Promise<void>;
|
|
13599
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13600
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13601
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13602
|
+
};
|
|
13585
13603
|
export abstract class WorkflowStep {
|
|
13586
13604
|
do<T extends Rpc.Serializable<T>>(
|
|
13587
13605
|
name: string,
|
|
13588
13606
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13607
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13589
13608
|
): Promise<T>;
|
|
13590
13609
|
do<T extends Rpc.Serializable<T>>(
|
|
13591
13610
|
name: string,
|
|
13592
13611
|
config: WorkflowStepConfig,
|
|
13593
13612
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13613
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13594
13614
|
): Promise<T>;
|
|
13595
13615
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13596
13616
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -14972,6 +14992,103 @@ export type WorkerVersionMetadata = {
|
|
|
14972
14992
|
/** The timestamp of when the Worker Version was uploaded */
|
|
14973
14993
|
timestamp: string;
|
|
14974
14994
|
};
|
|
14995
|
+
// ============ Web Search Request Types ============
|
|
14996
|
+
/**
|
|
14997
|
+
* Options for a Web Search query.
|
|
14998
|
+
*/
|
|
14999
|
+
export type WebSearchSearchOptions = {
|
|
15000
|
+
/** The search query. */
|
|
15001
|
+
query: string;
|
|
15002
|
+
/**
|
|
15003
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15004
|
+
* The actual count may be lower if fewer matches exist.
|
|
15005
|
+
*/
|
|
15006
|
+
limit?: number;
|
|
15007
|
+
};
|
|
15008
|
+
// ============ Web Search Response Types ============
|
|
15009
|
+
/**
|
|
15010
|
+
* A single Web Search result.
|
|
15011
|
+
*
|
|
15012
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15013
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15014
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15015
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15016
|
+
*/
|
|
15017
|
+
export type WebSearchResult = {
|
|
15018
|
+
/** Canonical URL. */
|
|
15019
|
+
url: string;
|
|
15020
|
+
/** Page title. */
|
|
15021
|
+
title: string;
|
|
15022
|
+
/** Page-level description. May be absent. */
|
|
15023
|
+
description?: string;
|
|
15024
|
+
/**
|
|
15025
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15026
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15027
|
+
*/
|
|
15028
|
+
lastModifiedDate?: string;
|
|
15029
|
+
/**
|
|
15030
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15031
|
+
*/
|
|
15032
|
+
imageUrl?: string;
|
|
15033
|
+
/** Optional favicon URL for UI hints. */
|
|
15034
|
+
faviconUrl?: string;
|
|
15035
|
+
};
|
|
15036
|
+
/**
|
|
15037
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15038
|
+
* fields useful for support and debugging.
|
|
15039
|
+
*/
|
|
15040
|
+
export type WebSearchResponseMetadata = {
|
|
15041
|
+
/** The query that was executed. */
|
|
15042
|
+
query: string;
|
|
15043
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15044
|
+
requestId: string;
|
|
15045
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15046
|
+
latencyMs: number;
|
|
15047
|
+
};
|
|
15048
|
+
/**
|
|
15049
|
+
* Response from a Web Search query.
|
|
15050
|
+
*/
|
|
15051
|
+
export type WebSearchSearchResponse = {
|
|
15052
|
+
items: WebSearchResult[];
|
|
15053
|
+
metadata: WebSearchResponseMetadata;
|
|
15054
|
+
};
|
|
15055
|
+
// ============ Web Search Binding Class ============
|
|
15056
|
+
/**
|
|
15057
|
+
* Cloudflare Web Search binding.
|
|
15058
|
+
*
|
|
15059
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15060
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15061
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15062
|
+
*
|
|
15063
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15064
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15065
|
+
*
|
|
15066
|
+
* ```jsonc
|
|
15067
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15068
|
+
* ```
|
|
15069
|
+
*
|
|
15070
|
+
* @example
|
|
15071
|
+
* ```ts
|
|
15072
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15073
|
+
* query: "Cloudflare Workers",
|
|
15074
|
+
* });
|
|
15075
|
+
*
|
|
15076
|
+
* const top = items[0];
|
|
15077
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15078
|
+
*
|
|
15079
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15080
|
+
* // controls apply at the fetch site, not at search time.
|
|
15081
|
+
* const page = await fetch(top.url);
|
|
15082
|
+
* ```
|
|
15083
|
+
*/
|
|
15084
|
+
export declare abstract class WebSearch {
|
|
15085
|
+
/**
|
|
15086
|
+
* Run a Web Search query.
|
|
15087
|
+
* @param options Search options. Only `query` is required.
|
|
15088
|
+
* @returns The matching results plus per-response metadata.
|
|
15089
|
+
*/
|
|
15090
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15091
|
+
}
|
|
14975
15092
|
export interface DynamicDispatchLimits {
|
|
14976
15093
|
/**
|
|
14977
15094
|
* Limit CPU time in milliseconds.
|