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