@cloudflare/workers-types 4.20260521.1 → 4.20260523.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/2022-03-21/index.d.ts
CHANGED
|
@@ -10669,12 +10669,16 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10669
10669
|
inputs: ChatCompletionsInput;
|
|
10670
10670
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10671
10671
|
}
|
|
10672
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10673
|
+
inputs: ChatCompletionsBase;
|
|
10674
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10675
|
+
}
|
|
10672
10676
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10673
10677
|
inputs: ChatCompletionsInput;
|
|
10674
10678
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10675
10679
|
}
|
|
10676
10680
|
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10677
|
-
inputs:
|
|
10681
|
+
inputs: ChatCompletionsBase;
|
|
10678
10682
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10679
10683
|
}
|
|
10680
10684
|
interface AiModels {
|
|
@@ -10766,7 +10770,9 @@ interface AiModels {
|
|
|
10766
10770
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10767
10771
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10768
10772
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10773
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10769
10774
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10775
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10770
10776
|
}
|
|
10771
10777
|
type AiOptions = {
|
|
10772
10778
|
/**
|
|
@@ -13687,15 +13693,29 @@ declare namespace CloudflareWorkersModule {
|
|
|
13687
13693
|
attempt: number;
|
|
13688
13694
|
config: WorkflowStepConfig;
|
|
13689
13695
|
};
|
|
13696
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13697
|
+
error: Error;
|
|
13698
|
+
output: T | undefined;
|
|
13699
|
+
stepName: string;
|
|
13700
|
+
};
|
|
13701
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13702
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13703
|
+
) => Promise<void>;
|
|
13704
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13705
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13706
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13707
|
+
};
|
|
13690
13708
|
export abstract class WorkflowStep {
|
|
13691
13709
|
do<T extends Rpc.Serializable<T>>(
|
|
13692
13710
|
name: string,
|
|
13693
13711
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13712
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13694
13713
|
): Promise<T>;
|
|
13695
13714
|
do<T extends Rpc.Serializable<T>>(
|
|
13696
13715
|
name: string,
|
|
13697
13716
|
config: WorkflowStepConfig,
|
|
13698
13717
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13718
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13699
13719
|
): Promise<T>;
|
|
13700
13720
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13701
13721
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15087,6 +15107,103 @@ type WorkerVersionMetadata = {
|
|
|
15087
15107
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15088
15108
|
timestamp: string;
|
|
15089
15109
|
};
|
|
15110
|
+
// ============ Web Search Request Types ============
|
|
15111
|
+
/**
|
|
15112
|
+
* Options for a Web Search query.
|
|
15113
|
+
*/
|
|
15114
|
+
type WebSearchSearchOptions = {
|
|
15115
|
+
/** The search query. */
|
|
15116
|
+
query: string;
|
|
15117
|
+
/**
|
|
15118
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15119
|
+
* The actual count may be lower if fewer matches exist.
|
|
15120
|
+
*/
|
|
15121
|
+
limit?: number;
|
|
15122
|
+
};
|
|
15123
|
+
// ============ Web Search Response Types ============
|
|
15124
|
+
/**
|
|
15125
|
+
* A single Web Search result.
|
|
15126
|
+
*
|
|
15127
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15128
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15129
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15130
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15131
|
+
*/
|
|
15132
|
+
type WebSearchResult = {
|
|
15133
|
+
/** Canonical URL. */
|
|
15134
|
+
url: string;
|
|
15135
|
+
/** Page title. */
|
|
15136
|
+
title: string;
|
|
15137
|
+
/** Page-level description. May be absent. */
|
|
15138
|
+
description?: string;
|
|
15139
|
+
/**
|
|
15140
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15141
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15142
|
+
*/
|
|
15143
|
+
lastModifiedDate?: string;
|
|
15144
|
+
/**
|
|
15145
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15146
|
+
*/
|
|
15147
|
+
imageUrl?: string;
|
|
15148
|
+
/** Optional favicon URL for UI hints. */
|
|
15149
|
+
faviconUrl?: string;
|
|
15150
|
+
};
|
|
15151
|
+
/**
|
|
15152
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15153
|
+
* fields useful for support and debugging.
|
|
15154
|
+
*/
|
|
15155
|
+
type WebSearchResponseMetadata = {
|
|
15156
|
+
/** The query that was executed. */
|
|
15157
|
+
query: string;
|
|
15158
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15159
|
+
requestId: string;
|
|
15160
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15161
|
+
latencyMs: number;
|
|
15162
|
+
};
|
|
15163
|
+
/**
|
|
15164
|
+
* Response from a Web Search query.
|
|
15165
|
+
*/
|
|
15166
|
+
type WebSearchSearchResponse = {
|
|
15167
|
+
items: WebSearchResult[];
|
|
15168
|
+
metadata: WebSearchResponseMetadata;
|
|
15169
|
+
};
|
|
15170
|
+
// ============ Web Search Binding Class ============
|
|
15171
|
+
/**
|
|
15172
|
+
* Cloudflare Web Search binding.
|
|
15173
|
+
*
|
|
15174
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15175
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15176
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15177
|
+
*
|
|
15178
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15179
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15180
|
+
*
|
|
15181
|
+
* ```jsonc
|
|
15182
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15183
|
+
* ```
|
|
15184
|
+
*
|
|
15185
|
+
* @example
|
|
15186
|
+
* ```ts
|
|
15187
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15188
|
+
* query: "Cloudflare Workers",
|
|
15189
|
+
* });
|
|
15190
|
+
*
|
|
15191
|
+
* const top = items[0];
|
|
15192
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15193
|
+
*
|
|
15194
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15195
|
+
* // controls apply at the fetch site, not at search time.
|
|
15196
|
+
* const page = await fetch(top.url);
|
|
15197
|
+
* ```
|
|
15198
|
+
*/
|
|
15199
|
+
declare abstract class WebSearch {
|
|
15200
|
+
/**
|
|
15201
|
+
* Run a Web Search query.
|
|
15202
|
+
* @param options Search options. Only `query` is required.
|
|
15203
|
+
* @returns The matching results plus per-response metadata.
|
|
15204
|
+
*/
|
|
15205
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15206
|
+
}
|
|
15090
15207
|
interface DynamicDispatchLimits {
|
|
15091
15208
|
/**
|
|
15092
15209
|
* Limit CPU time in milliseconds.
|
package/2022-03-21/index.ts
CHANGED
|
@@ -10679,12 +10679,16 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10679
10679
|
inputs: ChatCompletionsInput;
|
|
10680
10680
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10681
10681
|
}
|
|
10682
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10683
|
+
inputs: ChatCompletionsBase;
|
|
10684
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10685
|
+
}
|
|
10682
10686
|
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10683
10687
|
inputs: ChatCompletionsInput;
|
|
10684
10688
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10685
10689
|
}
|
|
10686
10690
|
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10687
|
-
inputs:
|
|
10691
|
+
inputs: ChatCompletionsBase;
|
|
10688
10692
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10689
10693
|
}
|
|
10690
10694
|
export interface AiModels {
|
|
@@ -10776,7 +10780,9 @@ export interface AiModels {
|
|
|
10776
10780
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10777
10781
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10778
10782
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10783
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10779
10784
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10785
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10780
10786
|
}
|
|
10781
10787
|
export type AiOptions = {
|
|
10782
10788
|
/**
|
|
@@ -13658,15 +13664,29 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13658
13664
|
attempt: number;
|
|
13659
13665
|
config: WorkflowStepConfig;
|
|
13660
13666
|
};
|
|
13667
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13668
|
+
error: Error;
|
|
13669
|
+
output: T | undefined;
|
|
13670
|
+
stepName: string;
|
|
13671
|
+
};
|
|
13672
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13673
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13674
|
+
) => Promise<void>;
|
|
13675
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13676
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13677
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13678
|
+
};
|
|
13661
13679
|
export abstract class WorkflowStep {
|
|
13662
13680
|
do<T extends Rpc.Serializable<T>>(
|
|
13663
13681
|
name: string,
|
|
13664
13682
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13683
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13665
13684
|
): Promise<T>;
|
|
13666
13685
|
do<T extends Rpc.Serializable<T>>(
|
|
13667
13686
|
name: string,
|
|
13668
13687
|
config: WorkflowStepConfig,
|
|
13669
13688
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13689
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13670
13690
|
): Promise<T>;
|
|
13671
13691
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13672
13692
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15048,6 +15068,103 @@ export type WorkerVersionMetadata = {
|
|
|
15048
15068
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15049
15069
|
timestamp: string;
|
|
15050
15070
|
};
|
|
15071
|
+
// ============ Web Search Request Types ============
|
|
15072
|
+
/**
|
|
15073
|
+
* Options for a Web Search query.
|
|
15074
|
+
*/
|
|
15075
|
+
export type WebSearchSearchOptions = {
|
|
15076
|
+
/** The search query. */
|
|
15077
|
+
query: string;
|
|
15078
|
+
/**
|
|
15079
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15080
|
+
* The actual count may be lower if fewer matches exist.
|
|
15081
|
+
*/
|
|
15082
|
+
limit?: number;
|
|
15083
|
+
};
|
|
15084
|
+
// ============ Web Search Response Types ============
|
|
15085
|
+
/**
|
|
15086
|
+
* A single Web Search result.
|
|
15087
|
+
*
|
|
15088
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15089
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15090
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15091
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15092
|
+
*/
|
|
15093
|
+
export type WebSearchResult = {
|
|
15094
|
+
/** Canonical URL. */
|
|
15095
|
+
url: string;
|
|
15096
|
+
/** Page title. */
|
|
15097
|
+
title: string;
|
|
15098
|
+
/** Page-level description. May be absent. */
|
|
15099
|
+
description?: string;
|
|
15100
|
+
/**
|
|
15101
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15102
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15103
|
+
*/
|
|
15104
|
+
lastModifiedDate?: string;
|
|
15105
|
+
/**
|
|
15106
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15107
|
+
*/
|
|
15108
|
+
imageUrl?: string;
|
|
15109
|
+
/** Optional favicon URL for UI hints. */
|
|
15110
|
+
faviconUrl?: string;
|
|
15111
|
+
};
|
|
15112
|
+
/**
|
|
15113
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15114
|
+
* fields useful for support and debugging.
|
|
15115
|
+
*/
|
|
15116
|
+
export type WebSearchResponseMetadata = {
|
|
15117
|
+
/** The query that was executed. */
|
|
15118
|
+
query: string;
|
|
15119
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15120
|
+
requestId: string;
|
|
15121
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15122
|
+
latencyMs: number;
|
|
15123
|
+
};
|
|
15124
|
+
/**
|
|
15125
|
+
* Response from a Web Search query.
|
|
15126
|
+
*/
|
|
15127
|
+
export type WebSearchSearchResponse = {
|
|
15128
|
+
items: WebSearchResult[];
|
|
15129
|
+
metadata: WebSearchResponseMetadata;
|
|
15130
|
+
};
|
|
15131
|
+
// ============ Web Search Binding Class ============
|
|
15132
|
+
/**
|
|
15133
|
+
* Cloudflare Web Search binding.
|
|
15134
|
+
*
|
|
15135
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15136
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15137
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15138
|
+
*
|
|
15139
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15140
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15141
|
+
*
|
|
15142
|
+
* ```jsonc
|
|
15143
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15144
|
+
* ```
|
|
15145
|
+
*
|
|
15146
|
+
* @example
|
|
15147
|
+
* ```ts
|
|
15148
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15149
|
+
* query: "Cloudflare Workers",
|
|
15150
|
+
* });
|
|
15151
|
+
*
|
|
15152
|
+
* const top = items[0];
|
|
15153
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15154
|
+
*
|
|
15155
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15156
|
+
* // controls apply at the fetch site, not at search time.
|
|
15157
|
+
* const page = await fetch(top.url);
|
|
15158
|
+
* ```
|
|
15159
|
+
*/
|
|
15160
|
+
export declare abstract class WebSearch {
|
|
15161
|
+
/**
|
|
15162
|
+
* Run a Web Search query.
|
|
15163
|
+
* @param options Search options. Only `query` is required.
|
|
15164
|
+
* @returns The matching results plus per-response metadata.
|
|
15165
|
+
*/
|
|
15166
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15167
|
+
}
|
|
15051
15168
|
export interface DynamicDispatchLimits {
|
|
15052
15169
|
/**
|
|
15053
15170
|
* Limit CPU time in milliseconds.
|
package/2022-08-04/index.d.ts
CHANGED
|
@@ -10670,12 +10670,16 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10670
10670
|
inputs: ChatCompletionsInput;
|
|
10671
10671
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10672
10672
|
}
|
|
10673
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10674
|
+
inputs: ChatCompletionsBase;
|
|
10675
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10676
|
+
}
|
|
10673
10677
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10674
10678
|
inputs: ChatCompletionsInput;
|
|
10675
10679
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10676
10680
|
}
|
|
10677
10681
|
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10678
|
-
inputs:
|
|
10682
|
+
inputs: ChatCompletionsBase;
|
|
10679
10683
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10680
10684
|
}
|
|
10681
10685
|
interface AiModels {
|
|
@@ -10767,7 +10771,9 @@ interface AiModels {
|
|
|
10767
10771
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10768
10772
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10769
10773
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10774
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10770
10775
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10776
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10771
10777
|
}
|
|
10772
10778
|
type AiOptions = {
|
|
10773
10779
|
/**
|
|
@@ -13688,15 +13694,29 @@ declare namespace CloudflareWorkersModule {
|
|
|
13688
13694
|
attempt: number;
|
|
13689
13695
|
config: WorkflowStepConfig;
|
|
13690
13696
|
};
|
|
13697
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13698
|
+
error: Error;
|
|
13699
|
+
output: T | undefined;
|
|
13700
|
+
stepName: string;
|
|
13701
|
+
};
|
|
13702
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13703
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13704
|
+
) => Promise<void>;
|
|
13705
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13706
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13707
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13708
|
+
};
|
|
13691
13709
|
export abstract class WorkflowStep {
|
|
13692
13710
|
do<T extends Rpc.Serializable<T>>(
|
|
13693
13711
|
name: string,
|
|
13694
13712
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13713
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13695
13714
|
): Promise<T>;
|
|
13696
13715
|
do<T extends Rpc.Serializable<T>>(
|
|
13697
13716
|
name: string,
|
|
13698
13717
|
config: WorkflowStepConfig,
|
|
13699
13718
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13719
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13700
13720
|
): Promise<T>;
|
|
13701
13721
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13702
13722
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15088,6 +15108,103 @@ type WorkerVersionMetadata = {
|
|
|
15088
15108
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15089
15109
|
timestamp: string;
|
|
15090
15110
|
};
|
|
15111
|
+
// ============ Web Search Request Types ============
|
|
15112
|
+
/**
|
|
15113
|
+
* Options for a Web Search query.
|
|
15114
|
+
*/
|
|
15115
|
+
type WebSearchSearchOptions = {
|
|
15116
|
+
/** The search query. */
|
|
15117
|
+
query: string;
|
|
15118
|
+
/**
|
|
15119
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15120
|
+
* The actual count may be lower if fewer matches exist.
|
|
15121
|
+
*/
|
|
15122
|
+
limit?: number;
|
|
15123
|
+
};
|
|
15124
|
+
// ============ Web Search Response Types ============
|
|
15125
|
+
/**
|
|
15126
|
+
* A single Web Search result.
|
|
15127
|
+
*
|
|
15128
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15129
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15130
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15131
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15132
|
+
*/
|
|
15133
|
+
type WebSearchResult = {
|
|
15134
|
+
/** Canonical URL. */
|
|
15135
|
+
url: string;
|
|
15136
|
+
/** Page title. */
|
|
15137
|
+
title: string;
|
|
15138
|
+
/** Page-level description. May be absent. */
|
|
15139
|
+
description?: string;
|
|
15140
|
+
/**
|
|
15141
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15142
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15143
|
+
*/
|
|
15144
|
+
lastModifiedDate?: string;
|
|
15145
|
+
/**
|
|
15146
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15147
|
+
*/
|
|
15148
|
+
imageUrl?: string;
|
|
15149
|
+
/** Optional favicon URL for UI hints. */
|
|
15150
|
+
faviconUrl?: string;
|
|
15151
|
+
};
|
|
15152
|
+
/**
|
|
15153
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15154
|
+
* fields useful for support and debugging.
|
|
15155
|
+
*/
|
|
15156
|
+
type WebSearchResponseMetadata = {
|
|
15157
|
+
/** The query that was executed. */
|
|
15158
|
+
query: string;
|
|
15159
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15160
|
+
requestId: string;
|
|
15161
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15162
|
+
latencyMs: number;
|
|
15163
|
+
};
|
|
15164
|
+
/**
|
|
15165
|
+
* Response from a Web Search query.
|
|
15166
|
+
*/
|
|
15167
|
+
type WebSearchSearchResponse = {
|
|
15168
|
+
items: WebSearchResult[];
|
|
15169
|
+
metadata: WebSearchResponseMetadata;
|
|
15170
|
+
};
|
|
15171
|
+
// ============ Web Search Binding Class ============
|
|
15172
|
+
/**
|
|
15173
|
+
* Cloudflare Web Search binding.
|
|
15174
|
+
*
|
|
15175
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15176
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15177
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15178
|
+
*
|
|
15179
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15180
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15181
|
+
*
|
|
15182
|
+
* ```jsonc
|
|
15183
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15184
|
+
* ```
|
|
15185
|
+
*
|
|
15186
|
+
* @example
|
|
15187
|
+
* ```ts
|
|
15188
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15189
|
+
* query: "Cloudflare Workers",
|
|
15190
|
+
* });
|
|
15191
|
+
*
|
|
15192
|
+
* const top = items[0];
|
|
15193
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15194
|
+
*
|
|
15195
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15196
|
+
* // controls apply at the fetch site, not at search time.
|
|
15197
|
+
* const page = await fetch(top.url);
|
|
15198
|
+
* ```
|
|
15199
|
+
*/
|
|
15200
|
+
declare abstract class WebSearch {
|
|
15201
|
+
/**
|
|
15202
|
+
* Run a Web Search query.
|
|
15203
|
+
* @param options Search options. Only `query` is required.
|
|
15204
|
+
* @returns The matching results plus per-response metadata.
|
|
15205
|
+
*/
|
|
15206
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15207
|
+
}
|
|
15091
15208
|
interface DynamicDispatchLimits {
|
|
15092
15209
|
/**
|
|
15093
15210
|
* Limit CPU time in milliseconds.
|
package/2022-08-04/index.ts
CHANGED
|
@@ -10680,12 +10680,16 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10680
10680
|
inputs: ChatCompletionsInput;
|
|
10681
10681
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10682
10682
|
}
|
|
10683
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10684
|
+
inputs: ChatCompletionsBase;
|
|
10685
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10686
|
+
}
|
|
10683
10687
|
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10684
10688
|
inputs: ChatCompletionsInput;
|
|
10685
10689
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10686
10690
|
}
|
|
10687
10691
|
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10688
|
-
inputs:
|
|
10692
|
+
inputs: ChatCompletionsBase;
|
|
10689
10693
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10690
10694
|
}
|
|
10691
10695
|
export interface AiModels {
|
|
@@ -10777,7 +10781,9 @@ export interface AiModels {
|
|
|
10777
10781
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10778
10782
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10779
10783
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10784
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10780
10785
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10786
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10781
10787
|
}
|
|
10782
10788
|
export type AiOptions = {
|
|
10783
10789
|
/**
|
|
@@ -13659,15 +13665,29 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13659
13665
|
attempt: number;
|
|
13660
13666
|
config: WorkflowStepConfig;
|
|
13661
13667
|
};
|
|
13668
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13669
|
+
error: Error;
|
|
13670
|
+
output: T | undefined;
|
|
13671
|
+
stepName: string;
|
|
13672
|
+
};
|
|
13673
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13674
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13675
|
+
) => Promise<void>;
|
|
13676
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13677
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13678
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13679
|
+
};
|
|
13662
13680
|
export abstract class WorkflowStep {
|
|
13663
13681
|
do<T extends Rpc.Serializable<T>>(
|
|
13664
13682
|
name: string,
|
|
13665
13683
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13684
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13666
13685
|
): Promise<T>;
|
|
13667
13686
|
do<T extends Rpc.Serializable<T>>(
|
|
13668
13687
|
name: string,
|
|
13669
13688
|
config: WorkflowStepConfig,
|
|
13670
13689
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13690
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13671
13691
|
): Promise<T>;
|
|
13672
13692
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13673
13693
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15049,6 +15069,103 @@ export type WorkerVersionMetadata = {
|
|
|
15049
15069
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15050
15070
|
timestamp: string;
|
|
15051
15071
|
};
|
|
15072
|
+
// ============ Web Search Request Types ============
|
|
15073
|
+
/**
|
|
15074
|
+
* Options for a Web Search query.
|
|
15075
|
+
*/
|
|
15076
|
+
export type WebSearchSearchOptions = {
|
|
15077
|
+
/** The search query. */
|
|
15078
|
+
query: string;
|
|
15079
|
+
/**
|
|
15080
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15081
|
+
* The actual count may be lower if fewer matches exist.
|
|
15082
|
+
*/
|
|
15083
|
+
limit?: number;
|
|
15084
|
+
};
|
|
15085
|
+
// ============ Web Search Response Types ============
|
|
15086
|
+
/**
|
|
15087
|
+
* A single Web Search result.
|
|
15088
|
+
*
|
|
15089
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15090
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15091
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15092
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15093
|
+
*/
|
|
15094
|
+
export type WebSearchResult = {
|
|
15095
|
+
/** Canonical URL. */
|
|
15096
|
+
url: string;
|
|
15097
|
+
/** Page title. */
|
|
15098
|
+
title: string;
|
|
15099
|
+
/** Page-level description. May be absent. */
|
|
15100
|
+
description?: string;
|
|
15101
|
+
/**
|
|
15102
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15103
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15104
|
+
*/
|
|
15105
|
+
lastModifiedDate?: string;
|
|
15106
|
+
/**
|
|
15107
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15108
|
+
*/
|
|
15109
|
+
imageUrl?: string;
|
|
15110
|
+
/** Optional favicon URL for UI hints. */
|
|
15111
|
+
faviconUrl?: string;
|
|
15112
|
+
};
|
|
15113
|
+
/**
|
|
15114
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15115
|
+
* fields useful for support and debugging.
|
|
15116
|
+
*/
|
|
15117
|
+
export type WebSearchResponseMetadata = {
|
|
15118
|
+
/** The query that was executed. */
|
|
15119
|
+
query: string;
|
|
15120
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15121
|
+
requestId: string;
|
|
15122
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15123
|
+
latencyMs: number;
|
|
15124
|
+
};
|
|
15125
|
+
/**
|
|
15126
|
+
* Response from a Web Search query.
|
|
15127
|
+
*/
|
|
15128
|
+
export type WebSearchSearchResponse = {
|
|
15129
|
+
items: WebSearchResult[];
|
|
15130
|
+
metadata: WebSearchResponseMetadata;
|
|
15131
|
+
};
|
|
15132
|
+
// ============ Web Search Binding Class ============
|
|
15133
|
+
/**
|
|
15134
|
+
* Cloudflare Web Search binding.
|
|
15135
|
+
*
|
|
15136
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15137
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15138
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15139
|
+
*
|
|
15140
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15141
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15142
|
+
*
|
|
15143
|
+
* ```jsonc
|
|
15144
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15145
|
+
* ```
|
|
15146
|
+
*
|
|
15147
|
+
* @example
|
|
15148
|
+
* ```ts
|
|
15149
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15150
|
+
* query: "Cloudflare Workers",
|
|
15151
|
+
* });
|
|
15152
|
+
*
|
|
15153
|
+
* const top = items[0];
|
|
15154
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15155
|
+
*
|
|
15156
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15157
|
+
* // controls apply at the fetch site, not at search time.
|
|
15158
|
+
* const page = await fetch(top.url);
|
|
15159
|
+
* ```
|
|
15160
|
+
*/
|
|
15161
|
+
export declare abstract class WebSearch {
|
|
15162
|
+
/**
|
|
15163
|
+
* Run a Web Search query.
|
|
15164
|
+
* @param options Search options. Only `query` is required.
|
|
15165
|
+
* @returns The matching results plus per-response metadata.
|
|
15166
|
+
*/
|
|
15167
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15168
|
+
}
|
|
15052
15169
|
export interface DynamicDispatchLimits {
|
|
15053
15170
|
/**
|
|
15054
15171
|
* Limit CPU time in milliseconds.
|