@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/2022-10-31/index.d.ts
CHANGED
|
@@ -10690,12 +10690,16 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10690
10690
|
inputs: ChatCompletionsInput;
|
|
10691
10691
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10692
10692
|
}
|
|
10693
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10694
|
+
inputs: ChatCompletionsBase;
|
|
10695
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10696
|
+
}
|
|
10693
10697
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10694
10698
|
inputs: ChatCompletionsInput;
|
|
10695
10699
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10696
10700
|
}
|
|
10697
10701
|
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10698
|
-
inputs:
|
|
10702
|
+
inputs: ChatCompletionsBase;
|
|
10699
10703
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10700
10704
|
}
|
|
10701
10705
|
interface AiModels {
|
|
@@ -10787,7 +10791,9 @@ interface AiModels {
|
|
|
10787
10791
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10788
10792
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10789
10793
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10794
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10790
10795
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10796
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10791
10797
|
}
|
|
10792
10798
|
type AiOptions = {
|
|
10793
10799
|
/**
|
|
@@ -13708,15 +13714,29 @@ declare namespace CloudflareWorkersModule {
|
|
|
13708
13714
|
attempt: number;
|
|
13709
13715
|
config: WorkflowStepConfig;
|
|
13710
13716
|
};
|
|
13717
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13718
|
+
error: Error;
|
|
13719
|
+
output: T | undefined;
|
|
13720
|
+
stepName: string;
|
|
13721
|
+
};
|
|
13722
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13723
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13724
|
+
) => Promise<void>;
|
|
13725
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13726
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13727
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13728
|
+
};
|
|
13711
13729
|
export abstract class WorkflowStep {
|
|
13712
13730
|
do<T extends Rpc.Serializable<T>>(
|
|
13713
13731
|
name: string,
|
|
13714
13732
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13733
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13715
13734
|
): Promise<T>;
|
|
13716
13735
|
do<T extends Rpc.Serializable<T>>(
|
|
13717
13736
|
name: string,
|
|
13718
13737
|
config: WorkflowStepConfig,
|
|
13719
13738
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13739
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13720
13740
|
): Promise<T>;
|
|
13721
13741
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13722
13742
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15108,6 +15128,103 @@ type WorkerVersionMetadata = {
|
|
|
15108
15128
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15109
15129
|
timestamp: string;
|
|
15110
15130
|
};
|
|
15131
|
+
// ============ Web Search Request Types ============
|
|
15132
|
+
/**
|
|
15133
|
+
* Options for a Web Search query.
|
|
15134
|
+
*/
|
|
15135
|
+
type WebSearchSearchOptions = {
|
|
15136
|
+
/** The search query. */
|
|
15137
|
+
query: string;
|
|
15138
|
+
/**
|
|
15139
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15140
|
+
* The actual count may be lower if fewer matches exist.
|
|
15141
|
+
*/
|
|
15142
|
+
limit?: number;
|
|
15143
|
+
};
|
|
15144
|
+
// ============ Web Search Response Types ============
|
|
15145
|
+
/**
|
|
15146
|
+
* A single Web Search result.
|
|
15147
|
+
*
|
|
15148
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15149
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15150
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15151
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15152
|
+
*/
|
|
15153
|
+
type WebSearchResult = {
|
|
15154
|
+
/** Canonical URL. */
|
|
15155
|
+
url: string;
|
|
15156
|
+
/** Page title. */
|
|
15157
|
+
title: string;
|
|
15158
|
+
/** Page-level description. May be absent. */
|
|
15159
|
+
description?: string;
|
|
15160
|
+
/**
|
|
15161
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15162
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15163
|
+
*/
|
|
15164
|
+
lastModifiedDate?: string;
|
|
15165
|
+
/**
|
|
15166
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15167
|
+
*/
|
|
15168
|
+
imageUrl?: string;
|
|
15169
|
+
/** Optional favicon URL for UI hints. */
|
|
15170
|
+
faviconUrl?: string;
|
|
15171
|
+
};
|
|
15172
|
+
/**
|
|
15173
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15174
|
+
* fields useful for support and debugging.
|
|
15175
|
+
*/
|
|
15176
|
+
type WebSearchResponseMetadata = {
|
|
15177
|
+
/** The query that was executed. */
|
|
15178
|
+
query: string;
|
|
15179
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15180
|
+
requestId: string;
|
|
15181
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15182
|
+
latencyMs: number;
|
|
15183
|
+
};
|
|
15184
|
+
/**
|
|
15185
|
+
* Response from a Web Search query.
|
|
15186
|
+
*/
|
|
15187
|
+
type WebSearchSearchResponse = {
|
|
15188
|
+
items: WebSearchResult[];
|
|
15189
|
+
metadata: WebSearchResponseMetadata;
|
|
15190
|
+
};
|
|
15191
|
+
// ============ Web Search Binding Class ============
|
|
15192
|
+
/**
|
|
15193
|
+
* Cloudflare Web Search binding.
|
|
15194
|
+
*
|
|
15195
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15196
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15197
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15198
|
+
*
|
|
15199
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15200
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15201
|
+
*
|
|
15202
|
+
* ```jsonc
|
|
15203
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15204
|
+
* ```
|
|
15205
|
+
*
|
|
15206
|
+
* @example
|
|
15207
|
+
* ```ts
|
|
15208
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15209
|
+
* query: "Cloudflare Workers",
|
|
15210
|
+
* });
|
|
15211
|
+
*
|
|
15212
|
+
* const top = items[0];
|
|
15213
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15214
|
+
*
|
|
15215
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15216
|
+
* // controls apply at the fetch site, not at search time.
|
|
15217
|
+
* const page = await fetch(top.url);
|
|
15218
|
+
* ```
|
|
15219
|
+
*/
|
|
15220
|
+
declare abstract class WebSearch {
|
|
15221
|
+
/**
|
|
15222
|
+
* Run a Web Search query.
|
|
15223
|
+
* @param options Search options. Only `query` is required.
|
|
15224
|
+
* @returns The matching results plus per-response metadata.
|
|
15225
|
+
*/
|
|
15226
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15227
|
+
}
|
|
15111
15228
|
interface DynamicDispatchLimits {
|
|
15112
15229
|
/**
|
|
15113
15230
|
* Limit CPU time in milliseconds.
|
package/2022-10-31/index.ts
CHANGED
|
@@ -10700,12 +10700,16 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10700
10700
|
inputs: ChatCompletionsInput;
|
|
10701
10701
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10702
10702
|
}
|
|
10703
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10704
|
+
inputs: ChatCompletionsBase;
|
|
10705
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10706
|
+
}
|
|
10703
10707
|
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10704
10708
|
inputs: ChatCompletionsInput;
|
|
10705
10709
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10706
10710
|
}
|
|
10707
10711
|
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10708
|
-
inputs:
|
|
10712
|
+
inputs: ChatCompletionsBase;
|
|
10709
10713
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10710
10714
|
}
|
|
10711
10715
|
export interface AiModels {
|
|
@@ -10797,7 +10801,9 @@ export interface AiModels {
|
|
|
10797
10801
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10798
10802
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10799
10803
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10804
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10800
10805
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10806
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10801
10807
|
}
|
|
10802
10808
|
export type AiOptions = {
|
|
10803
10809
|
/**
|
|
@@ -13679,15 +13685,29 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13679
13685
|
attempt: number;
|
|
13680
13686
|
config: WorkflowStepConfig;
|
|
13681
13687
|
};
|
|
13688
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13689
|
+
error: Error;
|
|
13690
|
+
output: T | undefined;
|
|
13691
|
+
stepName: string;
|
|
13692
|
+
};
|
|
13693
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13694
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13695
|
+
) => Promise<void>;
|
|
13696
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13697
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13698
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13699
|
+
};
|
|
13682
13700
|
export abstract class WorkflowStep {
|
|
13683
13701
|
do<T extends Rpc.Serializable<T>>(
|
|
13684
13702
|
name: string,
|
|
13685
13703
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13704
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13686
13705
|
): Promise<T>;
|
|
13687
13706
|
do<T extends Rpc.Serializable<T>>(
|
|
13688
13707
|
name: string,
|
|
13689
13708
|
config: WorkflowStepConfig,
|
|
13690
13709
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13710
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13691
13711
|
): Promise<T>;
|
|
13692
13712
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13693
13713
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15069,6 +15089,103 @@ export type WorkerVersionMetadata = {
|
|
|
15069
15089
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15070
15090
|
timestamp: string;
|
|
15071
15091
|
};
|
|
15092
|
+
// ============ Web Search Request Types ============
|
|
15093
|
+
/**
|
|
15094
|
+
* Options for a Web Search query.
|
|
15095
|
+
*/
|
|
15096
|
+
export type WebSearchSearchOptions = {
|
|
15097
|
+
/** The search query. */
|
|
15098
|
+
query: string;
|
|
15099
|
+
/**
|
|
15100
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15101
|
+
* The actual count may be lower if fewer matches exist.
|
|
15102
|
+
*/
|
|
15103
|
+
limit?: number;
|
|
15104
|
+
};
|
|
15105
|
+
// ============ Web Search Response Types ============
|
|
15106
|
+
/**
|
|
15107
|
+
* A single Web Search result.
|
|
15108
|
+
*
|
|
15109
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15110
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15111
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15112
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15113
|
+
*/
|
|
15114
|
+
export type WebSearchResult = {
|
|
15115
|
+
/** Canonical URL. */
|
|
15116
|
+
url: string;
|
|
15117
|
+
/** Page title. */
|
|
15118
|
+
title: string;
|
|
15119
|
+
/** Page-level description. May be absent. */
|
|
15120
|
+
description?: string;
|
|
15121
|
+
/**
|
|
15122
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15123
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15124
|
+
*/
|
|
15125
|
+
lastModifiedDate?: string;
|
|
15126
|
+
/**
|
|
15127
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15128
|
+
*/
|
|
15129
|
+
imageUrl?: string;
|
|
15130
|
+
/** Optional favicon URL for UI hints. */
|
|
15131
|
+
faviconUrl?: string;
|
|
15132
|
+
};
|
|
15133
|
+
/**
|
|
15134
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15135
|
+
* fields useful for support and debugging.
|
|
15136
|
+
*/
|
|
15137
|
+
export type WebSearchResponseMetadata = {
|
|
15138
|
+
/** The query that was executed. */
|
|
15139
|
+
query: string;
|
|
15140
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15141
|
+
requestId: string;
|
|
15142
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15143
|
+
latencyMs: number;
|
|
15144
|
+
};
|
|
15145
|
+
/**
|
|
15146
|
+
* Response from a Web Search query.
|
|
15147
|
+
*/
|
|
15148
|
+
export type WebSearchSearchResponse = {
|
|
15149
|
+
items: WebSearchResult[];
|
|
15150
|
+
metadata: WebSearchResponseMetadata;
|
|
15151
|
+
};
|
|
15152
|
+
// ============ Web Search Binding Class ============
|
|
15153
|
+
/**
|
|
15154
|
+
* Cloudflare Web Search binding.
|
|
15155
|
+
*
|
|
15156
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15157
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15158
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15159
|
+
*
|
|
15160
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15161
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15162
|
+
*
|
|
15163
|
+
* ```jsonc
|
|
15164
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15165
|
+
* ```
|
|
15166
|
+
*
|
|
15167
|
+
* @example
|
|
15168
|
+
* ```ts
|
|
15169
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15170
|
+
* query: "Cloudflare Workers",
|
|
15171
|
+
* });
|
|
15172
|
+
*
|
|
15173
|
+
* const top = items[0];
|
|
15174
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15175
|
+
*
|
|
15176
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15177
|
+
* // controls apply at the fetch site, not at search time.
|
|
15178
|
+
* const page = await fetch(top.url);
|
|
15179
|
+
* ```
|
|
15180
|
+
*/
|
|
15181
|
+
export declare abstract class WebSearch {
|
|
15182
|
+
/**
|
|
15183
|
+
* Run a Web Search query.
|
|
15184
|
+
* @param options Search options. Only `query` is required.
|
|
15185
|
+
* @returns The matching results plus per-response metadata.
|
|
15186
|
+
*/
|
|
15187
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15188
|
+
}
|
|
15072
15189
|
export interface DynamicDispatchLimits {
|
|
15073
15190
|
/**
|
|
15074
15191
|
* Limit CPU time in milliseconds.
|
package/2022-11-30/index.d.ts
CHANGED
|
@@ -10695,12 +10695,16 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10695
10695
|
inputs: ChatCompletionsInput;
|
|
10696
10696
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10697
10697
|
}
|
|
10698
|
+
declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10699
|
+
inputs: ChatCompletionsBase;
|
|
10700
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10701
|
+
}
|
|
10698
10702
|
declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10699
10703
|
inputs: ChatCompletionsInput;
|
|
10700
10704
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10701
10705
|
}
|
|
10702
10706
|
declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10703
|
-
inputs:
|
|
10707
|
+
inputs: ChatCompletionsBase;
|
|
10704
10708
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10705
10709
|
}
|
|
10706
10710
|
interface AiModels {
|
|
@@ -10792,7 +10796,9 @@ interface AiModels {
|
|
|
10792
10796
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10793
10797
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10794
10798
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10799
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10795
10800
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10801
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10796
10802
|
}
|
|
10797
10803
|
type AiOptions = {
|
|
10798
10804
|
/**
|
|
@@ -13713,15 +13719,29 @@ declare namespace CloudflareWorkersModule {
|
|
|
13713
13719
|
attempt: number;
|
|
13714
13720
|
config: WorkflowStepConfig;
|
|
13715
13721
|
};
|
|
13722
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13723
|
+
error: Error;
|
|
13724
|
+
output: T | undefined;
|
|
13725
|
+
stepName: string;
|
|
13726
|
+
};
|
|
13727
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13728
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13729
|
+
) => Promise<void>;
|
|
13730
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13731
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13732
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13733
|
+
};
|
|
13716
13734
|
export abstract class WorkflowStep {
|
|
13717
13735
|
do<T extends Rpc.Serializable<T>>(
|
|
13718
13736
|
name: string,
|
|
13719
13737
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13738
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13720
13739
|
): Promise<T>;
|
|
13721
13740
|
do<T extends Rpc.Serializable<T>>(
|
|
13722
13741
|
name: string,
|
|
13723
13742
|
config: WorkflowStepConfig,
|
|
13724
13743
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13744
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13725
13745
|
): Promise<T>;
|
|
13726
13746
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13727
13747
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15113,6 +15133,103 @@ type WorkerVersionMetadata = {
|
|
|
15113
15133
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15114
15134
|
timestamp: string;
|
|
15115
15135
|
};
|
|
15136
|
+
// ============ Web Search Request Types ============
|
|
15137
|
+
/**
|
|
15138
|
+
* Options for a Web Search query.
|
|
15139
|
+
*/
|
|
15140
|
+
type WebSearchSearchOptions = {
|
|
15141
|
+
/** The search query. */
|
|
15142
|
+
query: string;
|
|
15143
|
+
/**
|
|
15144
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15145
|
+
* The actual count may be lower if fewer matches exist.
|
|
15146
|
+
*/
|
|
15147
|
+
limit?: number;
|
|
15148
|
+
};
|
|
15149
|
+
// ============ Web Search Response Types ============
|
|
15150
|
+
/**
|
|
15151
|
+
* A single Web Search result.
|
|
15152
|
+
*
|
|
15153
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15154
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15155
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15156
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15157
|
+
*/
|
|
15158
|
+
type WebSearchResult = {
|
|
15159
|
+
/** Canonical URL. */
|
|
15160
|
+
url: string;
|
|
15161
|
+
/** Page title. */
|
|
15162
|
+
title: string;
|
|
15163
|
+
/** Page-level description. May be absent. */
|
|
15164
|
+
description?: string;
|
|
15165
|
+
/**
|
|
15166
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15167
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15168
|
+
*/
|
|
15169
|
+
lastModifiedDate?: string;
|
|
15170
|
+
/**
|
|
15171
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15172
|
+
*/
|
|
15173
|
+
imageUrl?: string;
|
|
15174
|
+
/** Optional favicon URL for UI hints. */
|
|
15175
|
+
faviconUrl?: string;
|
|
15176
|
+
};
|
|
15177
|
+
/**
|
|
15178
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15179
|
+
* fields useful for support and debugging.
|
|
15180
|
+
*/
|
|
15181
|
+
type WebSearchResponseMetadata = {
|
|
15182
|
+
/** The query that was executed. */
|
|
15183
|
+
query: string;
|
|
15184
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15185
|
+
requestId: string;
|
|
15186
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15187
|
+
latencyMs: number;
|
|
15188
|
+
};
|
|
15189
|
+
/**
|
|
15190
|
+
* Response from a Web Search query.
|
|
15191
|
+
*/
|
|
15192
|
+
type WebSearchSearchResponse = {
|
|
15193
|
+
items: WebSearchResult[];
|
|
15194
|
+
metadata: WebSearchResponseMetadata;
|
|
15195
|
+
};
|
|
15196
|
+
// ============ Web Search Binding Class ============
|
|
15197
|
+
/**
|
|
15198
|
+
* Cloudflare Web Search binding.
|
|
15199
|
+
*
|
|
15200
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15201
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15202
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15203
|
+
*
|
|
15204
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15205
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15206
|
+
*
|
|
15207
|
+
* ```jsonc
|
|
15208
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15209
|
+
* ```
|
|
15210
|
+
*
|
|
15211
|
+
* @example
|
|
15212
|
+
* ```ts
|
|
15213
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15214
|
+
* query: "Cloudflare Workers",
|
|
15215
|
+
* });
|
|
15216
|
+
*
|
|
15217
|
+
* const top = items[0];
|
|
15218
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15219
|
+
*
|
|
15220
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15221
|
+
* // controls apply at the fetch site, not at search time.
|
|
15222
|
+
* const page = await fetch(top.url);
|
|
15223
|
+
* ```
|
|
15224
|
+
*/
|
|
15225
|
+
declare abstract class WebSearch {
|
|
15226
|
+
/**
|
|
15227
|
+
* Run a Web Search query.
|
|
15228
|
+
* @param options Search options. Only `query` is required.
|
|
15229
|
+
* @returns The matching results plus per-response metadata.
|
|
15230
|
+
*/
|
|
15231
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15232
|
+
}
|
|
15116
15233
|
interface DynamicDispatchLimits {
|
|
15117
15234
|
/**
|
|
15118
15235
|
* Limit CPU time in milliseconds.
|
package/2022-11-30/index.ts
CHANGED
|
@@ -10705,12 +10705,16 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
|
|
|
10705
10705
|
inputs: ChatCompletionsInput;
|
|
10706
10706
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10707
10707
|
}
|
|
10708
|
+
export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
|
|
10709
|
+
inputs: ChatCompletionsBase;
|
|
10710
|
+
postProcessedOutputs: ChatCompletionsOutput;
|
|
10711
|
+
}
|
|
10708
10712
|
export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
|
|
10709
10713
|
inputs: ChatCompletionsInput;
|
|
10710
10714
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10711
10715
|
}
|
|
10712
10716
|
export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
|
|
10713
|
-
inputs:
|
|
10717
|
+
inputs: ChatCompletionsBase;
|
|
10714
10718
|
postProcessedOutputs: ChatCompletionsOutput;
|
|
10715
10719
|
}
|
|
10716
10720
|
export interface AiModels {
|
|
@@ -10802,7 +10806,9 @@ export interface AiModels {
|
|
|
10802
10806
|
"@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
|
|
10803
10807
|
"@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
|
|
10804
10808
|
"@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
|
|
10809
|
+
"@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
|
|
10805
10810
|
"@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
|
|
10811
|
+
"@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
|
|
10806
10812
|
}
|
|
10807
10813
|
export type AiOptions = {
|
|
10808
10814
|
/**
|
|
@@ -13684,15 +13690,29 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13684
13690
|
attempt: number;
|
|
13685
13691
|
config: WorkflowStepConfig;
|
|
13686
13692
|
};
|
|
13693
|
+
export type WorkflowRollbackContext<T = unknown> = {
|
|
13694
|
+
error: Error;
|
|
13695
|
+
output: T | undefined;
|
|
13696
|
+
stepName: string;
|
|
13697
|
+
};
|
|
13698
|
+
export type WorkflowRollbackHandler<T = unknown> = (
|
|
13699
|
+
ctx: WorkflowRollbackContext<T>,
|
|
13700
|
+
) => Promise<void>;
|
|
13701
|
+
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
13702
|
+
rollback?: WorkflowRollbackHandler<T>;
|
|
13703
|
+
rollbackConfig?: WorkflowStepConfig;
|
|
13704
|
+
};
|
|
13687
13705
|
export abstract class WorkflowStep {
|
|
13688
13706
|
do<T extends Rpc.Serializable<T>>(
|
|
13689
13707
|
name: string,
|
|
13690
13708
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13709
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13691
13710
|
): Promise<T>;
|
|
13692
13711
|
do<T extends Rpc.Serializable<T>>(
|
|
13693
13712
|
name: string,
|
|
13694
13713
|
config: WorkflowStepConfig,
|
|
13695
13714
|
callback: (ctx: WorkflowStepContext) => Promise<T>,
|
|
13715
|
+
rollbackOptions?: WorkflowStepRollbackOptions<T>,
|
|
13696
13716
|
): Promise<T>;
|
|
13697
13717
|
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
13698
13718
|
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
@@ -15074,6 +15094,103 @@ export type WorkerVersionMetadata = {
|
|
|
15074
15094
|
/** The timestamp of when the Worker Version was uploaded */
|
|
15075
15095
|
timestamp: string;
|
|
15076
15096
|
};
|
|
15097
|
+
// ============ Web Search Request Types ============
|
|
15098
|
+
/**
|
|
15099
|
+
* Options for a Web Search query.
|
|
15100
|
+
*/
|
|
15101
|
+
export type WebSearchSearchOptions = {
|
|
15102
|
+
/** The search query. */
|
|
15103
|
+
query: string;
|
|
15104
|
+
/**
|
|
15105
|
+
* Maximum number of results to return. Defaults to 10, capped at 20.
|
|
15106
|
+
* The actual count may be lower if fewer matches exist.
|
|
15107
|
+
*/
|
|
15108
|
+
limit?: number;
|
|
15109
|
+
};
|
|
15110
|
+
// ============ Web Search Response Types ============
|
|
15111
|
+
/**
|
|
15112
|
+
* A single Web Search result.
|
|
15113
|
+
*
|
|
15114
|
+
* Web Search is discovery-only -- results carry catalog metadata about a page
|
|
15115
|
+
* but never the page body. To read a result's content the caller invokes the
|
|
15116
|
+
* global `fetch()` API against the result's `url`, at which point the
|
|
15117
|
+
* destination's own access controls apply (including Cloudflare Pay-per-Crawl).
|
|
15118
|
+
*/
|
|
15119
|
+
export type WebSearchResult = {
|
|
15120
|
+
/** Canonical URL. */
|
|
15121
|
+
url: string;
|
|
15122
|
+
/** Page title. */
|
|
15123
|
+
title: string;
|
|
15124
|
+
/** Page-level description. May be absent. */
|
|
15125
|
+
description?: string;
|
|
15126
|
+
/**
|
|
15127
|
+
* Last-modified date for the page, when known. Naive (no timezone)
|
|
15128
|
+
* ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
|
|
15129
|
+
*/
|
|
15130
|
+
lastModifiedDate?: string;
|
|
15131
|
+
/**
|
|
15132
|
+
* Page meta image URL (typically the `og:image`). May be absent.
|
|
15133
|
+
*/
|
|
15134
|
+
imageUrl?: string;
|
|
15135
|
+
/** Optional favicon URL for UI hints. */
|
|
15136
|
+
faviconUrl?: string;
|
|
15137
|
+
};
|
|
15138
|
+
/**
|
|
15139
|
+
* Per-response metadata for a Web Search query. Carries operational
|
|
15140
|
+
* fields useful for support and debugging.
|
|
15141
|
+
*/
|
|
15142
|
+
export type WebSearchResponseMetadata = {
|
|
15143
|
+
/** The query that was executed. */
|
|
15144
|
+
query: string;
|
|
15145
|
+
/** Opaque request identifier used for support and debugging. */
|
|
15146
|
+
requestId: string;
|
|
15147
|
+
/** End-to-end latency for this search request, in milliseconds. */
|
|
15148
|
+
latencyMs: number;
|
|
15149
|
+
};
|
|
15150
|
+
/**
|
|
15151
|
+
* Response from a Web Search query.
|
|
15152
|
+
*/
|
|
15153
|
+
export type WebSearchSearchResponse = {
|
|
15154
|
+
items: WebSearchResult[];
|
|
15155
|
+
metadata: WebSearchResponseMetadata;
|
|
15156
|
+
};
|
|
15157
|
+
// ============ Web Search Binding Class ============
|
|
15158
|
+
/**
|
|
15159
|
+
* Cloudflare Web Search binding.
|
|
15160
|
+
*
|
|
15161
|
+
* Discovery-only primitive for agents and Workers. Returns URLs and catalog
|
|
15162
|
+
* metadata for a query; never returns page content or excerpts. To read a
|
|
15163
|
+
* result's body, fetch the URL with the global `fetch()` API.
|
|
15164
|
+
*
|
|
15165
|
+
* Declared in wrangler with a single object (there is exactly one corpus, the
|
|
15166
|
+
* public web, so there is no name, namespace, or instance to specify):
|
|
15167
|
+
*
|
|
15168
|
+
* ```jsonc
|
|
15169
|
+
* { "web_search": { "binding": "WEBSEARCH" } }
|
|
15170
|
+
* ```
|
|
15171
|
+
*
|
|
15172
|
+
* @example
|
|
15173
|
+
* ```ts
|
|
15174
|
+
* const { items, metadata } = await env.WEBSEARCH.search({
|
|
15175
|
+
* query: "Cloudflare Workers",
|
|
15176
|
+
* });
|
|
15177
|
+
*
|
|
15178
|
+
* const top = items[0];
|
|
15179
|
+
* console.log(top.url, top.title, metadata.latencyMs);
|
|
15180
|
+
*
|
|
15181
|
+
* // Read content yourself; pay-per-crawl and other publisher
|
|
15182
|
+
* // controls apply at the fetch site, not at search time.
|
|
15183
|
+
* const page = await fetch(top.url);
|
|
15184
|
+
* ```
|
|
15185
|
+
*/
|
|
15186
|
+
export declare abstract class WebSearch {
|
|
15187
|
+
/**
|
|
15188
|
+
* Run a Web Search query.
|
|
15189
|
+
* @param options Search options. Only `query` is required.
|
|
15190
|
+
* @returns The matching results plus per-response metadata.
|
|
15191
|
+
*/
|
|
15192
|
+
search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
|
|
15193
|
+
}
|
|
15077
15194
|
export interface DynamicDispatchLimits {
|
|
15078
15195
|
/**
|
|
15079
15196
|
* Limit CPU time in milliseconds.
|