workerd 1.20260527.1 → 1.20260528.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/bin/workerd +1 -1
- package/install.js +4 -4
- package/lib/main.js +3 -3
- package/package.json +6 -6
- package/worker.mjs +525 -0
package/bin/workerd
CHANGED
|
@@ -122,7 +122,7 @@ by workerd to install the correct binary executable for your current platform.`)
|
|
|
122
122
|
"node_modules",
|
|
123
123
|
".cache",
|
|
124
124
|
"workerd",
|
|
125
|
-
`pnpapi-${pkg.replace("/", "-")}-${"1.
|
|
125
|
+
`pnpapi-${pkg.replace("/", "-")}-${"1.20260528.1"}-${import_path.default.basename(subpath)}`
|
|
126
126
|
);
|
|
127
127
|
if (!import_fs.default.existsSync(binTargetPath)) {
|
|
128
128
|
import_fs.default.mkdirSync(import_path.default.dirname(binTargetPath), { recursive: true });
|
package/install.js
CHANGED
|
@@ -94,10 +94,10 @@ operating system, or missing some shared libraries.`;
|
|
|
94
94
|
console.error(msg);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
if (stdout !== `workerd ${"2026-05-
|
|
97
|
+
if (stdout !== `workerd ${"2026-05-28"}`) {
|
|
98
98
|
throw new Error(
|
|
99
99
|
`Expected ${JSON.stringify(
|
|
100
|
-
"2026-05-
|
|
100
|
+
"2026-05-28"
|
|
101
101
|
)} but got ${JSON.stringify(stdout)}`
|
|
102
102
|
);
|
|
103
103
|
}
|
|
@@ -152,7 +152,7 @@ function installUsingNPM(pkg, subpath, binPath) {
|
|
|
152
152
|
try {
|
|
153
153
|
import_fs.default.writeFileSync(import_path2.default.join(installDir, "package.json"), "{}");
|
|
154
154
|
import_child_process.default.execSync(
|
|
155
|
-
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"1.
|
|
155
|
+
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"1.20260528.1"}`,
|
|
156
156
|
{ cwd: installDir, stdio: "pipe", env }
|
|
157
157
|
);
|
|
158
158
|
const installedBinPath = import_path2.default.join(
|
|
@@ -197,7 +197,7 @@ function maybeOptimizePackage(binPath) {
|
|
|
197
197
|
}
|
|
198
198
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
|
199
199
|
const unscopedPkg = pkg.substring(pkg.indexOf("/") + 1);
|
|
200
|
-
const url = `https://registry.npmjs.org/${pkg}/-/${unscopedPkg}-${"1.
|
|
200
|
+
const url = `https://registry.npmjs.org/${pkg}/-/${unscopedPkg}-${"1.20260528.1"}.tgz`;
|
|
201
201
|
console.error(`[workerd] Trying to download ${JSON.stringify(url)}`);
|
|
202
202
|
try {
|
|
203
203
|
import_fs.default.writeFileSync(
|
package/lib/main.js
CHANGED
|
@@ -136,7 +136,7 @@ by workerd to install the correct binary executable for your current platform.`)
|
|
|
136
136
|
"node_modules",
|
|
137
137
|
".cache",
|
|
138
138
|
"workerd",
|
|
139
|
-
`pnpapi-${pkg.replace("/", "-")}-${"1.
|
|
139
|
+
`pnpapi-${pkg.replace("/", "-")}-${"1.20260528.1"}-${import_path.default.basename(subpath)}`
|
|
140
140
|
);
|
|
141
141
|
if (!import_fs.default.existsSync(binTargetPath)) {
|
|
142
142
|
import_fs.default.mkdirSync(import_path.default.dirname(binTargetPath), { recursive: true });
|
|
@@ -151,8 +151,8 @@ by workerd to install the correct binary executable for your current platform.`)
|
|
|
151
151
|
// npm/lib/node-path.ts
|
|
152
152
|
var { binPath } = generateBinPath();
|
|
153
153
|
var node_path_default = binPath;
|
|
154
|
-
var compatibilityDate = "2026-05-
|
|
155
|
-
var version = "1.
|
|
154
|
+
var compatibilityDate = "2026-05-28";
|
|
155
|
+
var version = "1.20260528.1";
|
|
156
156
|
// Annotate the CommonJS export names for ESM import in node:
|
|
157
157
|
0 && (module.exports = {
|
|
158
158
|
compatibilityDate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workerd",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20260528.1",
|
|
4
4
|
"description": "👷 workerd, Cloudflare's JavaScript/Wasm Runtime",
|
|
5
5
|
"repository": "https://github.com/cloudflare/workerd",
|
|
6
6
|
"scripts": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"workerd": "bin/workerd"
|
|
15
15
|
},
|
|
16
16
|
"optionalDependencies": {
|
|
17
|
-
"@cloudflare/workerd-darwin-arm64": "1.
|
|
18
|
-
"@cloudflare/workerd-darwin-64": "1.
|
|
19
|
-
"@cloudflare/workerd-linux-arm64": "1.
|
|
20
|
-
"@cloudflare/workerd-linux-64": "1.
|
|
21
|
-
"@cloudflare/workerd-windows-64": "1.
|
|
17
|
+
"@cloudflare/workerd-darwin-arm64": "1.20260528.1",
|
|
18
|
+
"@cloudflare/workerd-darwin-64": "1.20260528.1",
|
|
19
|
+
"@cloudflare/workerd-linux-arm64": "1.20260528.1",
|
|
20
|
+
"@cloudflare/workerd-linux-64": "1.20260528.1",
|
|
21
|
+
"@cloudflare/workerd-windows-64": "1.20260528.1"
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0"
|
|
24
24
|
}
|
package/worker.mjs
CHANGED
|
@@ -7911,6 +7911,531 @@ export declare abstract class AutoRAG {
|
|
|
7911
7911
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
7912
7912
|
}
|
|
7913
7913
|
|
|
7914
|
+
type BrowserRunLifecycleEvent =
|
|
7915
|
+
| 'load'
|
|
7916
|
+
| 'domcontentloaded'
|
|
7917
|
+
| 'networkidle0'
|
|
7918
|
+
| 'networkidle2';
|
|
7919
|
+
|
|
7920
|
+
type BrowserRunResourceType =
|
|
7921
|
+
| 'document'
|
|
7922
|
+
| 'stylesheet'
|
|
7923
|
+
| 'image'
|
|
7924
|
+
| 'media'
|
|
7925
|
+
| 'font'
|
|
7926
|
+
| 'script'
|
|
7927
|
+
| 'texttrack'
|
|
7928
|
+
| 'xhr'
|
|
7929
|
+
| 'fetch'
|
|
7930
|
+
| 'prefetch'
|
|
7931
|
+
| 'eventsource'
|
|
7932
|
+
| 'websocket'
|
|
7933
|
+
| 'manifest'
|
|
7934
|
+
| 'signedexchange'
|
|
7935
|
+
| 'ping'
|
|
7936
|
+
| 'cspviolationreport'
|
|
7937
|
+
| 'preflight'
|
|
7938
|
+
| 'other';
|
|
7939
|
+
|
|
7940
|
+
/** Options fields shared by all quick actions. */
|
|
7941
|
+
interface BrowserRunBaseOptions {
|
|
7942
|
+
/** Adds \`<script>\` tags into the page with the desired URL or content.
|
|
7943
|
+
* @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions
|
|
7944
|
+
*/
|
|
7945
|
+
addScriptTag?: Array<{
|
|
7946
|
+
content?: string;
|
|
7947
|
+
url?: string;
|
|
7948
|
+
type?: string;
|
|
7949
|
+
id?: string;
|
|
7950
|
+
}>;
|
|
7951
|
+
/** Adds \`<link rel="stylesheet">\` or \`<style>\` tags into the page.
|
|
7952
|
+
* @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions
|
|
7953
|
+
*/
|
|
7954
|
+
addStyleTag?: Array<{ content?: string; url?: string }>;
|
|
7955
|
+
/** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */
|
|
7956
|
+
authenticate?: { username: string; password: string };
|
|
7957
|
+
/** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */
|
|
7958
|
+
cookies?: Array<{
|
|
7959
|
+
name: string;
|
|
7960
|
+
value: string;
|
|
7961
|
+
url?: string;
|
|
7962
|
+
domain?: string;
|
|
7963
|
+
path?: string;
|
|
7964
|
+
secure?: boolean;
|
|
7965
|
+
httpOnly?: boolean;
|
|
7966
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
7967
|
+
expires?: number;
|
|
7968
|
+
priority?: 'Low' | 'Medium' | 'High';
|
|
7969
|
+
sameParty?: boolean;
|
|
7970
|
+
sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
|
|
7971
|
+
sourcePort?: number;
|
|
7972
|
+
partitionKey?: string;
|
|
7973
|
+
}>;
|
|
7974
|
+
/** Emulate a specific CSS media type (e.g. \`"screen"\`, \`"print"\`). */
|
|
7975
|
+
emulateMediaType?: string;
|
|
7976
|
+
/** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */
|
|
7977
|
+
gotoOptions?: {
|
|
7978
|
+
/** Navigation timeout in milliseconds (max 60 000). @default 30000 */
|
|
7979
|
+
timeout?: number;
|
|
7980
|
+
/** When to consider navigation complete. @default "domcontentloaded" */
|
|
7981
|
+
waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];
|
|
7982
|
+
referer?: string;
|
|
7983
|
+
referrerPolicy?: string;
|
|
7984
|
+
};
|
|
7985
|
+
/** Block requests matching these regex patterns. Mutually exclusive with \`allowRequestPattern\`. */
|
|
7986
|
+
rejectRequestPattern?: string[];
|
|
7987
|
+
/** Only allow requests matching these regex patterns. Mutually exclusive with \`rejectRequestPattern\`. */
|
|
7988
|
+
allowRequestPattern?: string[];
|
|
7989
|
+
/** Block requests of these resource types. Mutually exclusive with \`allowResourceTypes\`. */
|
|
7990
|
+
rejectResourceTypes?: BrowserRunResourceType[];
|
|
7991
|
+
/** Only allow requests of these resource types. Mutually exclusive with \`rejectResourceTypes\`. */
|
|
7992
|
+
allowResourceTypes?: BrowserRunResourceType[];
|
|
7993
|
+
/** Additional HTTP headers sent with every request. */
|
|
7994
|
+
setExtraHTTPHeaders?: Record<string, string>;
|
|
7995
|
+
/** Whether JavaScript is enabled on the page. */
|
|
7996
|
+
setJavaScriptEnabled?: boolean;
|
|
7997
|
+
/** Override the default user agent string.
|
|
7998
|
+
* @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
|
|
7999
|
+
* */
|
|
8000
|
+
userAgent?: string;
|
|
8001
|
+
/** Set the browser viewport size.
|
|
8002
|
+
* @see https://pptr.dev/api/puppeteer.viewport
|
|
8003
|
+
* @default {width:1920,height:1080}
|
|
8004
|
+
* */
|
|
8005
|
+
viewport?: {
|
|
8006
|
+
width: number;
|
|
8007
|
+
height: number;
|
|
8008
|
+
deviceScaleFactor?: number;
|
|
8009
|
+
isMobile?: boolean;
|
|
8010
|
+
isLandscape?: boolean;
|
|
8011
|
+
hasTouch?: boolean;
|
|
8012
|
+
};
|
|
8013
|
+
/** Wait for a CSS selector to appear in the page before proceeding.
|
|
8014
|
+
* @see https://pptr.dev/api/puppeteer.waitforselectoroptions
|
|
8015
|
+
*/
|
|
8016
|
+
waitForSelector?: {
|
|
8017
|
+
selector: string;
|
|
8018
|
+
hidden?: true;
|
|
8019
|
+
visible?: true;
|
|
8020
|
+
/** Timeout in milliseconds. Max 120000 */
|
|
8021
|
+
timeout?: number;
|
|
8022
|
+
};
|
|
8023
|
+
/** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */
|
|
8024
|
+
waitForTimeout?: number;
|
|
8025
|
+
/** When true, continue on best-effort when awaited events fail or timeout. */
|
|
8026
|
+
bestAttempt?: boolean;
|
|
8027
|
+
/** Maximum duration in milliseconds for the browser action after page load. Max 120000 */
|
|
8028
|
+
actionTimeout?: number;
|
|
8029
|
+
/** Cache time to live in seconds (0-86400). Set to 0 to disable.
|
|
8030
|
+
* @default 5
|
|
8031
|
+
*/
|
|
8032
|
+
cacheTTL?: number;
|
|
8033
|
+
}
|
|
8034
|
+
|
|
8035
|
+
/** Common options shared by all quick actions. Exactly one of \`url\` or \`html\` must be provided.*/
|
|
8036
|
+
type BrowserRunCommonOptions =
|
|
8037
|
+
| (BrowserRunBaseOptions & {
|
|
8038
|
+
/** URL to navigate to, e.g. \`"https://example.com"\`. */
|
|
8039
|
+
url: string;
|
|
8040
|
+
})
|
|
8041
|
+
| (BrowserRunBaseOptions & {
|
|
8042
|
+
/** Set the HTML content of the page directly. */
|
|
8043
|
+
html: string;
|
|
8044
|
+
});
|
|
8045
|
+
|
|
8046
|
+
type BrowserRunPuppeteerScreenshotOptions = {
|
|
8047
|
+
/** @default "png" */
|
|
8048
|
+
type?: 'png' | 'jpeg' | 'webp';
|
|
8049
|
+
/** @default "binary" */
|
|
8050
|
+
encoding?: 'binary' | 'base64';
|
|
8051
|
+
quality?: number;
|
|
8052
|
+
fullPage?: boolean;
|
|
8053
|
+
clip?: {
|
|
8054
|
+
x: number;
|
|
8055
|
+
y: number;
|
|
8056
|
+
width: number;
|
|
8057
|
+
height: number;
|
|
8058
|
+
scale?: number;
|
|
8059
|
+
};
|
|
8060
|
+
omitBackground?: boolean;
|
|
8061
|
+
optimizeForSpeed?: boolean;
|
|
8062
|
+
captureBeyondViewport?: boolean;
|
|
8063
|
+
fromSurface?: boolean;
|
|
8064
|
+
};
|
|
8065
|
+
|
|
8066
|
+
type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
|
|
8067
|
+
/** CSS selector of the element to screenshot. */
|
|
8068
|
+
selector?: string;
|
|
8069
|
+
/** When true, scroll the entire page before taking the screenshot. */
|
|
8070
|
+
scrollPage?: boolean;
|
|
8071
|
+
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
|
|
8072
|
+
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
|
|
8073
|
+
};
|
|
8074
|
+
|
|
8075
|
+
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
|
|
8076
|
+
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
|
|
8077
|
+
pdfOptions?: {
|
|
8078
|
+
/** @default 1 */
|
|
8079
|
+
scale?: number;
|
|
8080
|
+
/** @default false */
|
|
8081
|
+
displayHeaderFooter?: boolean;
|
|
8082
|
+
headerTemplate?: string;
|
|
8083
|
+
footerTemplate?: string;
|
|
8084
|
+
/** @default false */
|
|
8085
|
+
printBackground?: boolean;
|
|
8086
|
+
/** @default false */
|
|
8087
|
+
landscape?: boolean;
|
|
8088
|
+
pageRanges?: string;
|
|
8089
|
+
/** @default "letter" */
|
|
8090
|
+
format?:
|
|
8091
|
+
| 'letter'
|
|
8092
|
+
| 'legal'
|
|
8093
|
+
| 'tabloid'
|
|
8094
|
+
| 'ledger'
|
|
8095
|
+
| 'a0'
|
|
8096
|
+
| 'a1'
|
|
8097
|
+
| 'a2'
|
|
8098
|
+
| 'a3'
|
|
8099
|
+
| 'a4'
|
|
8100
|
+
| 'a5'
|
|
8101
|
+
| 'a6';
|
|
8102
|
+
width?: string | number;
|
|
8103
|
+
height?: string | number;
|
|
8104
|
+
/** @default false */
|
|
8105
|
+
preferCSSPageSize?: boolean;
|
|
8106
|
+
margin?: {
|
|
8107
|
+
top?: string | number;
|
|
8108
|
+
right?: string | number;
|
|
8109
|
+
bottom?: string | number;
|
|
8110
|
+
left?: string | number;
|
|
8111
|
+
};
|
|
8112
|
+
/** @default false */
|
|
8113
|
+
omitBackground?: boolean;
|
|
8114
|
+
/** @default true */
|
|
8115
|
+
tagged?: boolean;
|
|
8116
|
+
/** @default false */
|
|
8117
|
+
outline?: boolean;
|
|
8118
|
+
/** @default 30000 */
|
|
8119
|
+
timeout?: number;
|
|
8120
|
+
};
|
|
8121
|
+
};
|
|
8122
|
+
|
|
8123
|
+
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
|
|
8124
|
+
/** CSS selectors to scrape. At least one element is required. */
|
|
8125
|
+
elements: Array<{ selector: string }>;
|
|
8126
|
+
};
|
|
8127
|
+
|
|
8128
|
+
type BrowserRunLinksOptions = BrowserRunCommonOptions & {
|
|
8129
|
+
/** When true, only return links that are visible on the page. @default false */
|
|
8130
|
+
visibleLinksOnly?: boolean;
|
|
8131
|
+
/** When true, exclude links pointing to external domains. @default false */
|
|
8132
|
+
excludeExternalLinks?: boolean;
|
|
8133
|
+
};
|
|
8134
|
+
|
|
8135
|
+
type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
|
|
8136
|
+
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
|
|
8137
|
+
screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
|
|
8138
|
+
};
|
|
8139
|
+
|
|
8140
|
+
interface BrowserRunJsonBaseOptions {
|
|
8141
|
+
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
|
|
8142
|
+
custom_ai?: Array<{
|
|
8143
|
+
/** Model ID in \`<provider>/<model_name>\` format, e.g. \`"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"\`. */
|
|
8144
|
+
model: string;
|
|
8145
|
+
/** Bearer token. Not needed for workers-ai models. */
|
|
8146
|
+
authorization?: string;
|
|
8147
|
+
}>;
|
|
8148
|
+
}
|
|
8149
|
+
|
|
8150
|
+
/**
|
|
8151
|
+
* Options for the \`json\` quick action.
|
|
8152
|
+
* At least one of \`prompt\` or \`response_format\` must be provided.
|
|
8153
|
+
*/
|
|
8154
|
+
type BrowserRunJsonOptions = BrowserRunCommonOptions &
|
|
8155
|
+
BrowserRunJsonBaseOptions &
|
|
8156
|
+
(
|
|
8157
|
+
| {
|
|
8158
|
+
/** Natural-language prompt describing what data to extract. */
|
|
8159
|
+
prompt: string;
|
|
8160
|
+
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
|
|
8161
|
+
response_format?: AiTextGenerationResponseFormat;
|
|
8162
|
+
}
|
|
8163
|
+
| {
|
|
8164
|
+
/** Natural-language prompt describing what data to extract. */
|
|
8165
|
+
prompt?: string;
|
|
8166
|
+
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
|
|
8167
|
+
response_format: AiTextGenerationResponseFormat;
|
|
8168
|
+
}
|
|
8169
|
+
);
|
|
8170
|
+
|
|
8171
|
+
type BrowserRunContentOptions = BrowserRunCommonOptions;
|
|
8172
|
+
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
|
|
8173
|
+
|
|
8174
|
+
type BrowserRunResponseMeta = {
|
|
8175
|
+
/** HTTP status code of the rendered page */
|
|
8176
|
+
status: number;
|
|
8177
|
+
/** Page title */
|
|
8178
|
+
title: string;
|
|
8179
|
+
};
|
|
8180
|
+
|
|
8181
|
+
/** Success response for \`content\` action. */
|
|
8182
|
+
type BrowserRunContentSuccessResponse = {
|
|
8183
|
+
success: true;
|
|
8184
|
+
/** Extracted HTML content */
|
|
8185
|
+
result: string;
|
|
8186
|
+
meta: BrowserRunResponseMeta;
|
|
8187
|
+
};
|
|
8188
|
+
|
|
8189
|
+
/** Success response for \`links\` action. */
|
|
8190
|
+
type BrowserRunLinksSuccessResponse = {
|
|
8191
|
+
success: true;
|
|
8192
|
+
/** Extracted links */
|
|
8193
|
+
result: string[];
|
|
8194
|
+
};
|
|
8195
|
+
|
|
8196
|
+
/** Success response for \`scrape\` action. */
|
|
8197
|
+
type BrowserRunScrapeSuccessResponse = {
|
|
8198
|
+
success: true;
|
|
8199
|
+
result: Array<{
|
|
8200
|
+
/** The CSS selector used to find elements. */
|
|
8201
|
+
selector: string;
|
|
8202
|
+
/** Array of elements matching the selector. */
|
|
8203
|
+
results: Array<{
|
|
8204
|
+
/** Outer HTML of the element. */
|
|
8205
|
+
html: string;
|
|
8206
|
+
/** Text content of the element. */
|
|
8207
|
+
text: string;
|
|
8208
|
+
/** Width of the element in pixels. */
|
|
8209
|
+
width: number;
|
|
8210
|
+
/** Height of the element in pixels. */
|
|
8211
|
+
height: number;
|
|
8212
|
+
/** Top position of the element relative to the viewport in pixels. */
|
|
8213
|
+
top: number;
|
|
8214
|
+
/** Left position of the element relative to the viewport in pixels. */
|
|
8215
|
+
left: number;
|
|
8216
|
+
/** Array of HTML attributes on the element. */
|
|
8217
|
+
attributes: Array<{
|
|
8218
|
+
/** Attribute name. */
|
|
8219
|
+
name: string;
|
|
8220
|
+
/** Attribute value. */
|
|
8221
|
+
value: string;
|
|
8222
|
+
}>;
|
|
8223
|
+
}>;
|
|
8224
|
+
}>;
|
|
8225
|
+
};
|
|
8226
|
+
|
|
8227
|
+
/** Success response for \`snapshot\` action. */
|
|
8228
|
+
type BrowserRunSnapshotSuccessResponse = {
|
|
8229
|
+
success: true;
|
|
8230
|
+
result: {
|
|
8231
|
+
/** HTML content of the page. */
|
|
8232
|
+
content: string;
|
|
8233
|
+
/** Base64-encoded screenshot image. */
|
|
8234
|
+
screenshot: string;
|
|
8235
|
+
};
|
|
8236
|
+
meta: BrowserRunResponseMeta;
|
|
8237
|
+
};
|
|
8238
|
+
|
|
8239
|
+
/** Success response for \`json\` action. */
|
|
8240
|
+
type BrowserRunJsonSuccessResponse = {
|
|
8241
|
+
success: true;
|
|
8242
|
+
/** JSON data extracted from the page using an AI model */
|
|
8243
|
+
result: Record<string, unknown>;
|
|
8244
|
+
};
|
|
8245
|
+
|
|
8246
|
+
/** Success response for \`markdown\` action. */
|
|
8247
|
+
type BrowserRunMarkdownSuccessResponse = {
|
|
8248
|
+
success: true;
|
|
8249
|
+
/** Extracted markdown content */
|
|
8250
|
+
result: string;
|
|
8251
|
+
};
|
|
8252
|
+
|
|
8253
|
+
/** Error response for BrowserRun actions. */
|
|
8254
|
+
type BrowserRunErrorResponse = {
|
|
8255
|
+
success: false;
|
|
8256
|
+
errors: { message: string; code?: number; detail?: string; path?: string }[];
|
|
8257
|
+
};
|
|
8258
|
+
|
|
8259
|
+
/** Error response for BrowserRun \`json\` action. */
|
|
8260
|
+
type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {
|
|
8261
|
+
/** Raw AI response text for debugging */
|
|
8262
|
+
rawAiResponse?: string;
|
|
8263
|
+
};
|
|
8264
|
+
|
|
8265
|
+
/**
|
|
8266
|
+
* Browser Run API binding for automating headless browsers.
|
|
8267
|
+
* @see https://developers.cloudflare.com/browser-run/
|
|
8268
|
+
*/
|
|
8269
|
+
declare abstract class BrowserRun {
|
|
8270
|
+
/**
|
|
8271
|
+
* Send a raw HTTP request to the Browser Run API.
|
|
8272
|
+
* Used by libraries like \`@cloudflare/puppeteer\` to acquire and connect to a browser instance.
|
|
8273
|
+
* @see https://developers.cloudflare.com/browser-run/
|
|
8274
|
+
*/
|
|
8275
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
8276
|
+
|
|
8277
|
+
/**
|
|
8278
|
+
* Take a screenshot of a web page.
|
|
8279
|
+
* @param action - Must be \`'screenshot'\`.
|
|
8280
|
+
* @param options - Screenshot options including viewport, selectors, and image format.
|
|
8281
|
+
* @returns A \`Response\` containing one of:
|
|
8282
|
+
*
|
|
8283
|
+
* **Success (HTTP 200):**
|
|
8284
|
+
* - Binary image data with \`Content-Type: image/png\`, \`image/jpeg\`, or \`image/webp\` (when \`encoding: 'binary'\`, the default)
|
|
8285
|
+
* - Data URI string with \`Content-Type: text/plain\` (when \`encoding: 'base64'\`)
|
|
8286
|
+
*
|
|
8287
|
+
* **Error:**
|
|
8288
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8289
|
+
*
|
|
8290
|
+
* **Headers:**
|
|
8291
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8292
|
+
*/
|
|
8293
|
+
quickAction(
|
|
8294
|
+
action: 'screenshot',
|
|
8295
|
+
options: BrowserRunScreenshotOptions
|
|
8296
|
+
): Promise<Response>;
|
|
8297
|
+
|
|
8298
|
+
/**
|
|
8299
|
+
* Generate a PDF of a web page.
|
|
8300
|
+
* @param action - Must be \`'pdf'\`.
|
|
8301
|
+
* @param options - PDF generation options including page size, margins, and headers/footers.
|
|
8302
|
+
* @returns A \`Response\` containing one of:
|
|
8303
|
+
*
|
|
8304
|
+
* **Success (HTTP 200):**
|
|
8305
|
+
* - Binary PDF data with \`Content-Type: application/pdf\`
|
|
8306
|
+
*
|
|
8307
|
+
* **Error:**
|
|
8308
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8309
|
+
*
|
|
8310
|
+
* **Headers:**
|
|
8311
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8312
|
+
*/
|
|
8313
|
+
quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;
|
|
8314
|
+
|
|
8315
|
+
/**
|
|
8316
|
+
* Get the HTML content of a web page.
|
|
8317
|
+
* @param action - Must be \`'content'\`.
|
|
8318
|
+
* @param options - Navigation and page interaction options.
|
|
8319
|
+
* @returns A \`Response\` containing one of:
|
|
8320
|
+
*
|
|
8321
|
+
* **Success (HTTP 200):**
|
|
8322
|
+
* - \`BrowserRunContentSuccessResponse\` JSON with \`Content-Type: application/json\`
|
|
8323
|
+
*
|
|
8324
|
+
* **Error:**
|
|
8325
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8326
|
+
*
|
|
8327
|
+
* **Headers:**
|
|
8328
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8329
|
+
*/
|
|
8330
|
+
quickAction(
|
|
8331
|
+
action: 'content',
|
|
8332
|
+
options: BrowserRunContentOptions
|
|
8333
|
+
): Promise<Response>;
|
|
8334
|
+
|
|
8335
|
+
/**
|
|
8336
|
+
* Scrape elements from a web page by CSS selector.
|
|
8337
|
+
* @param action - Must be \`'scrape'\`.
|
|
8338
|
+
* @param options - Scrape options with CSS selectors for elements to extract.
|
|
8339
|
+
* @returns A \`Response\` containing one of:
|
|
8340
|
+
*
|
|
8341
|
+
* **Success (HTTP 200):**
|
|
8342
|
+
* - \`BrowserRunScrapeSuccessResponse\` JSON with \`Content-Type: application/json\`
|
|
8343
|
+
*
|
|
8344
|
+
* **Error:**
|
|
8345
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8346
|
+
*
|
|
8347
|
+
* **Headers:**
|
|
8348
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8349
|
+
*/
|
|
8350
|
+
quickAction(
|
|
8351
|
+
action: 'scrape',
|
|
8352
|
+
options: BrowserRunScrapeOptions
|
|
8353
|
+
): Promise<Response>;
|
|
8354
|
+
|
|
8355
|
+
/**
|
|
8356
|
+
* Extract all links from a web page.
|
|
8357
|
+
* @param action - Must be \`'links'\`.
|
|
8358
|
+
* @param options - Options to filter visible or internal links only.
|
|
8359
|
+
* @returns A \`Response\` containing one of:
|
|
8360
|
+
*
|
|
8361
|
+
* **Success (HTTP 200):**
|
|
8362
|
+
* - \`BrowserRunLinksSuccessResponse\` JSON with \`Content-Type: application/json\`
|
|
8363
|
+
*
|
|
8364
|
+
* **Error:**
|
|
8365
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8366
|
+
*
|
|
8367
|
+
* **Headers:**
|
|
8368
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8369
|
+
*/
|
|
8370
|
+
quickAction(
|
|
8371
|
+
action: 'links',
|
|
8372
|
+
options: BrowserRunLinksOptions
|
|
8373
|
+
): Promise<Response>;
|
|
8374
|
+
|
|
8375
|
+
/**
|
|
8376
|
+
* Get both the HTML content and a base64-encoded screenshot of a web page.
|
|
8377
|
+
* @param action - Must be \`'snapshot'\`.
|
|
8378
|
+
* @param options - Snapshot options including screenshot settings (encoding is always base64).
|
|
8379
|
+
* @returns A \`Response\` containing one of:
|
|
8380
|
+
*
|
|
8381
|
+
* **Success (HTTP 200):**
|
|
8382
|
+
* - \`BrowserRunSnapshotSuccessResponse\` JSON with \`Content-Type: application/json\`
|
|
8383
|
+
*
|
|
8384
|
+
* **Error:**
|
|
8385
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8386
|
+
*
|
|
8387
|
+
* **Headers:**
|
|
8388
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8389
|
+
*/
|
|
8390
|
+
quickAction(
|
|
8391
|
+
action: 'snapshot',
|
|
8392
|
+
options: BrowserRunSnapshotOptions
|
|
8393
|
+
): Promise<Response>;
|
|
8394
|
+
|
|
8395
|
+
/**
|
|
8396
|
+
* Extract structured JSON data from a web page using AI.
|
|
8397
|
+
* @param action - Must be \`'json'\`.
|
|
8398
|
+
* @param options - JSON extraction options with prompt or response_format schema.
|
|
8399
|
+
* @returns A \`Response\` containing one of:
|
|
8400
|
+
*
|
|
8401
|
+
* **Success (HTTP 200):**
|
|
8402
|
+
* - \`BrowserRunJsonSuccessResponse\` JSON with \`Content-Type: application/json\`
|
|
8403
|
+
*
|
|
8404
|
+
* **Error:**
|
|
8405
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8406
|
+
* - HTTP 422 with code \`2012\` for HTML-to-markdown conversion failures
|
|
8407
|
+
* - HTTP 422/500 for AI extraction failures (may include \`rawAiResponse\` field)
|
|
8408
|
+
*
|
|
8409
|
+
* **Headers:**
|
|
8410
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8411
|
+
*/
|
|
8412
|
+
quickAction(
|
|
8413
|
+
action: 'json',
|
|
8414
|
+
options: BrowserRunJsonOptions
|
|
8415
|
+
): Promise<Response>;
|
|
8416
|
+
|
|
8417
|
+
/**
|
|
8418
|
+
* Convert a web page to Markdown.
|
|
8419
|
+
* @param action - Must be \`'markdown'\`.
|
|
8420
|
+
* @param options - Navigation and page interaction options.
|
|
8421
|
+
* @returns A \`Response\` containing one of:
|
|
8422
|
+
*
|
|
8423
|
+
* **Success (HTTP 200):**
|
|
8424
|
+
* - \`BrowserRunMarkdownSuccessResponse\` JSON with \`Content-Type: application/json\`
|
|
8425
|
+
*
|
|
8426
|
+
* **Error:**
|
|
8427
|
+
* - \`BrowserRunErrorResponse\` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
8428
|
+
* - HTTP 422 with code \`2012\` for HTML-to-markdown conversion failures
|
|
8429
|
+
*
|
|
8430
|
+
* **Headers:**
|
|
8431
|
+
* - \`X-Browser-Ms-Used\`: Browser time consumed in milliseconds (set when status < 500)
|
|
8432
|
+
*/
|
|
8433
|
+
quickAction(
|
|
8434
|
+
action: 'markdown',
|
|
8435
|
+
options: BrowserRunMarkdownOptions
|
|
8436
|
+
): Promise<Response>;
|
|
8437
|
+
}
|
|
8438
|
+
|
|
7914
8439
|
interface BasicImageTransformations {
|
|
7915
8440
|
/**
|
|
7916
8441
|
* Maximum width in image pixels. The value must be an integer.
|