webtools

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

cloudflare-env.d.ts (551172B)


      1 /* eslint-disable */
      2 // Generated by Wrangler by running `wrangler types --env-interface=CloudflareEnv ./cloudflare-env.d.ts` (hash: 62bf5ae1024ecc3e8bbdd8e23501c93d)
      3 // Runtime types generated with workerd@1.20260722.1 2026-07-30 global_fetch_strictly_public,nodejs_compat
      4 interface __BaseEnv_CloudflareEnv {
      5 	IMAGES: ImagesBinding;
      6 	ASSETS: Fetcher;
      7 	NEXTJS_ENV: string;
      8 	WORKER_SELF_REFERENCE: Fetcher /* my-next-app */;
      9 }
     10 declare namespace Cloudflare {
     11 	interface Env extends __BaseEnv_CloudflareEnv {}
     12 }
     13 interface CloudflareEnv extends __BaseEnv_CloudflareEnv {}
     14 type StringifyValues<EnvType extends Record<string, unknown>> = {
     15 	[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
     16 };
     17 declare namespace NodeJS {
     18 	interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "NEXTJS_ENV">> {}
     19 }
     20 
     21 // Begin runtime types
     22 /*! *****************************************************************************
     23 Copyright (c) Cloudflare. All rights reserved.
     24 Copyright (c) Microsoft Corporation. All rights reserved.
     25 
     26 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
     27 this file except in compliance with the License. You may obtain a copy of the
     28 License at http://www.apache.org/licenses/LICENSE-2.0
     29 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     30 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
     31 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
     32 MERCHANTABLITY OR NON-INFRINGEMENT.
     33 See the Apache Version 2.0 License for specific language governing permissions
     34 and limitations under the License.
     35 ***************************************************************************** */
     36 /* eslint-disable */
     37 // noinspection JSUnusedGlobalSymbols
     38 declare var onmessage: never;
     39 /**
     40  * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
     41  *
     42  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
     43  */
     44 declare class DOMException extends Error {
     45     constructor(message?: string, name?: string);
     46     /**
     47      * The **`message`** read-only property of the a message or description associated with the given error name.
     48      *
     49      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
     50      */
     51     readonly message: string;
     52     /**
     53      * The **`name`** read-only property of the one of the strings associated with an error name.
     54      *
     55      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
     56      */
     57     readonly name: string;
     58     /**
     59      * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.
     60      * @deprecated
     61      *
     62      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
     63      */
     64     readonly code: number;
     65     static readonly INDEX_SIZE_ERR: number;
     66     static readonly DOMSTRING_SIZE_ERR: number;
     67     static readonly HIERARCHY_REQUEST_ERR: number;
     68     static readonly WRONG_DOCUMENT_ERR: number;
     69     static readonly INVALID_CHARACTER_ERR: number;
     70     static readonly NO_DATA_ALLOWED_ERR: number;
     71     static readonly NO_MODIFICATION_ALLOWED_ERR: number;
     72     static readonly NOT_FOUND_ERR: number;
     73     static readonly NOT_SUPPORTED_ERR: number;
     74     static readonly INUSE_ATTRIBUTE_ERR: number;
     75     static readonly INVALID_STATE_ERR: number;
     76     static readonly SYNTAX_ERR: number;
     77     static readonly INVALID_MODIFICATION_ERR: number;
     78     static readonly NAMESPACE_ERR: number;
     79     static readonly INVALID_ACCESS_ERR: number;
     80     static readonly VALIDATION_ERR: number;
     81     static readonly TYPE_MISMATCH_ERR: number;
     82     static readonly SECURITY_ERR: number;
     83     static readonly NETWORK_ERR: number;
     84     static readonly ABORT_ERR: number;
     85     static readonly URL_MISMATCH_ERR: number;
     86     static readonly QUOTA_EXCEEDED_ERR: number;
     87     static readonly TIMEOUT_ERR: number;
     88     static readonly INVALID_NODE_TYPE_ERR: number;
     89     static readonly DATA_CLONE_ERR: number;
     90     get stack(): any;
     91     set stack(value: any);
     92 }
     93 type WorkerGlobalScopeEventMap = {
     94     fetch: FetchEvent;
     95     scheduled: ScheduledEvent;
     96     queue: QueueEvent;
     97     unhandledrejection: PromiseRejectionEvent;
     98     rejectionhandled: PromiseRejectionEvent;
     99 };
    100 declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
    101     EventTarget: typeof EventTarget;
    102 }
    103 /* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *
    104  * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).
    105  *
    106  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)
    107  */
    108 interface Console {
    109     "assert"(condition?: boolean, ...data: any[]): void;
    110     /**
    111      * The **`console.clear()`** static method clears the console if possible.
    112      *
    113      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)
    114      */
    115     clear(): void;
    116     /**
    117      * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.
    118      *
    119      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)
    120      */
    121     count(label?: string): void;
    122     /**
    123      * The **`console.countReset()`** static method resets counter used with console/count_static.
    124      *
    125      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
    126      */
    127     countReset(label?: string): void;
    128     /**
    129      * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
    130      *
    131      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
    132      */
    133     debug(...data: any[]): void;
    134     /**
    135      * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
    136      *
    137      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
    138      */
    139     dir(item?: any, options?: any): void;
    140     /**
    141      * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
    142      *
    143      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
    144      */
    145     dirxml(...data: any[]): void;
    146     /**
    147      * The **`console.error()`** static method outputs a message to the console at the 'error' log level.
    148      *
    149      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
    150      */
    151     error(...data: any[]): void;
    152     /**
    153      * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
    154      *
    155      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
    156      */
    157     group(...data: any[]): void;
    158     /**
    159      * The **`console.groupCollapsed()`** static method creates a new inline group in the console.
    160      *
    161      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
    162      */
    163     groupCollapsed(...data: any[]): void;
    164     /**
    165      * The **`console.groupEnd()`** static method exits the current inline group in the console.
    166      *
    167      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
    168      */
    169     groupEnd(): void;
    170     /**
    171      * The **`console.info()`** static method outputs a message to the console at the 'info' log level.
    172      *
    173      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
    174      */
    175     info(...data: any[]): void;
    176     /**
    177      * The **`console.log()`** static method outputs a message to the console.
    178      *
    179      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
    180      */
    181     log(...data: any[]): void;
    182     /**
    183      * The **`console.table()`** static method displays tabular data as a table.
    184      *
    185      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)
    186      */
    187     table(tabularData?: any, properties?: string[]): void;
    188     /**
    189      * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
    190      *
    191      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
    192      */
    193     time(label?: string): void;
    194     /**
    195      * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
    196      *
    197      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
    198      */
    199     timeEnd(label?: string): void;
    200     /**
    201      * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
    202      *
    203      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
    204      */
    205     timeLog(label?: string, ...data: any[]): void;
    206     timeStamp(label?: string): void;
    207     /**
    208      * The **`console.trace()`** static method outputs a stack trace to the console.
    209      *
    210      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
    211      */
    212     trace(...data: any[]): void;
    213     /**
    214      * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
    215      *
    216      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
    217      */
    218     warn(...data: any[]): void;
    219 }
    220 declare const console: Console;
    221 type BufferSource = ArrayBufferView | ArrayBuffer;
    222 type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
    223 declare namespace WebAssembly {
    224     class CompileError extends Error {
    225         constructor(message?: string);
    226     }
    227     class RuntimeError extends Error {
    228         constructor(message?: string);
    229     }
    230     type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";
    231     interface GlobalDescriptor {
    232         value: ValueType;
    233         mutable?: boolean;
    234     }
    235     class Global {
    236         constructor(descriptor: GlobalDescriptor, value?: any);
    237         value: any;
    238         valueOf(): any;
    239     }
    240     type ImportValue = ExportValue | number;
    241     type ModuleImports = Record<string, ImportValue>;
    242     type Imports = Record<string, ModuleImports>;
    243     type ExportValue = Function | Global | Memory | Table;
    244     type Exports = Record<string, ExportValue>;
    245     class Instance {
    246         constructor(module: Module, imports?: Imports);
    247         readonly exports: Exports;
    248     }
    249     interface MemoryDescriptor {
    250         initial: number;
    251         maximum?: number;
    252         shared?: boolean;
    253     }
    254     class Memory {
    255         constructor(descriptor: MemoryDescriptor);
    256         readonly buffer: ArrayBuffer;
    257         grow(delta: number): number;
    258     }
    259     type ImportExportKind = "function" | "global" | "memory" | "table";
    260     interface ModuleExportDescriptor {
    261         kind: ImportExportKind;
    262         name: string;
    263     }
    264     interface ModuleImportDescriptor {
    265         kind: ImportExportKind;
    266         module: string;
    267         name: string;
    268     }
    269     abstract class Module {
    270         static customSections(module: Module, sectionName: string): ArrayBuffer[];
    271         static exports(module: Module): ModuleExportDescriptor[];
    272         static imports(module: Module): ModuleImportDescriptor[];
    273     }
    274     type TableKind = "anyfunc" | "externref";
    275     interface TableDescriptor {
    276         element: TableKind;
    277         initial: number;
    278         maximum?: number;
    279     }
    280     class Table {
    281         constructor(descriptor: TableDescriptor, value?: any);
    282         readonly length: number;
    283         get(index: number): any;
    284         grow(delta: number, value?: any): number;
    285         set(index: number, value?: any): void;
    286     }
    287     function instantiate(module: Module, imports?: Imports): Promise<Instance>;
    288     function validate(bytes: BufferSource): boolean;
    289 }
    290 /**
    291  * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.
    292  * Available only in secure contexts.
    293  *
    294  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
    295  */
    296 interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
    297     DOMException: typeof DOMException;
    298     WorkerGlobalScope: typeof WorkerGlobalScope;
    299     btoa(data: string): string;
    300     atob(data: string): string;
    301     setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
    302     setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
    303     clearTimeout(timeoutId: number | null): void;
    304     setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
    305     setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
    306     clearInterval(timeoutId: number | null): void;
    307     queueMicrotask(task: Function): void;
    308     structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
    309     reportError(error: any): void;
    310     fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
    311     self: ServiceWorkerGlobalScope;
    312     crypto: Crypto;
    313     caches: CacheStorage;
    314     scheduler: Scheduler;
    315     performance: Performance;
    316     Cloudflare: Cloudflare;
    317     readonly origin: string;
    318     Event: typeof Event;
    319     ExtendableEvent: typeof ExtendableEvent;
    320     CustomEvent: typeof CustomEvent;
    321     PromiseRejectionEvent: typeof PromiseRejectionEvent;
    322     FetchEvent: typeof FetchEvent;
    323     TailEvent: typeof TailEvent;
    324     TraceEvent: typeof TailEvent;
    325     ScheduledEvent: typeof ScheduledEvent;
    326     MessageEvent: typeof MessageEvent;
    327     CloseEvent: typeof CloseEvent;
    328     ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
    329     ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
    330     ReadableStream: typeof ReadableStream;
    331     WritableStream: typeof WritableStream;
    332     WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
    333     TransformStream: typeof TransformStream;
    334     ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
    335     CountQueuingStrategy: typeof CountQueuingStrategy;
    336     ErrorEvent: typeof ErrorEvent;
    337     MessageChannel: typeof MessageChannel;
    338     MessagePort: typeof MessagePort;
    339     EventSource: typeof EventSource;
    340     ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
    341     ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
    342     ReadableByteStreamController: typeof ReadableByteStreamController;
    343     WritableStreamDefaultController: typeof WritableStreamDefaultController;
    344     TransformStreamDefaultController: typeof TransformStreamDefaultController;
    345     CompressionStream: typeof CompressionStream;
    346     DecompressionStream: typeof DecompressionStream;
    347     TextEncoderStream: typeof TextEncoderStream;
    348     TextDecoderStream: typeof TextDecoderStream;
    349     Headers: typeof Headers;
    350     Body: typeof Body;
    351     Request: typeof Request;
    352     Response: typeof Response;
    353     WebSocket: typeof WebSocket;
    354     WebSocketPair: typeof WebSocketPair;
    355     WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
    356     AbortController: typeof AbortController;
    357     AbortSignal: typeof AbortSignal;
    358     TextDecoder: typeof TextDecoder;
    359     TextEncoder: typeof TextEncoder;
    360     navigator: Navigator;
    361     Navigator: typeof Navigator;
    362     URL: typeof URL;
    363     URLSearchParams: typeof URLSearchParams;
    364     URLPattern: typeof URLPattern;
    365     Blob: typeof Blob;
    366     File: typeof File;
    367     FormData: typeof FormData;
    368     Crypto: typeof Crypto;
    369     SubtleCrypto: typeof SubtleCrypto;
    370     CryptoKey: typeof CryptoKey;
    371     CacheStorage: typeof CacheStorage;
    372     Cache: typeof Cache;
    373     FixedLengthStream: typeof FixedLengthStream;
    374     IdentityTransformStream: typeof IdentityTransformStream;
    375     HTMLRewriter: typeof HTMLRewriter;
    376 }
    377 declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
    378 declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
    379 /**
    380  * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
    381  *
    382  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
    383  */
    384 declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
    385 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
    386 declare function btoa(data: string): string;
    387 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
    388 declare function atob(data: string): string;
    389 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
    390 declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
    391 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
    392 declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
    393 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
    394 declare function clearTimeout(timeoutId: number | null): void;
    395 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
    396 declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
    397 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
    398 declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
    399 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
    400 declare function clearInterval(timeoutId: number | null): void;
    401 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
    402 declare function queueMicrotask(task: Function): void;
    403 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
    404 declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
    405 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
    406 declare function reportError(error: any): void;
    407 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
    408 declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
    409 declare const self: ServiceWorkerGlobalScope;
    410 /**
    411 * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
    412 * The Workers runtime implements the full surface of this API, but with some differences in
    413 * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
    414 * compared to those implemented in most browsers.
    415 *
    416 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
    417 */
    418 declare const crypto: Crypto;
    419 /**
    420 * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
    421 *
    422 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
    423 */
    424 declare const caches: CacheStorage;
    425 declare const scheduler: Scheduler;
    426 /**
    427 * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
    428 * as well as timing of subrequests and other operations.
    429 *
    430 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
    431 */
    432 declare const performance: Performance;
    433 declare const Cloudflare: Cloudflare;
    434 declare const origin: string;
    435 declare const navigator: Navigator;
    436 interface TestController {
    437 }
    438 interface ExecutionContext<Props = unknown> {
    439     waitUntil(promise: Promise<any>): void;
    440     passThroughOnException(): void;
    441     readonly exports: Cloudflare.Exports;
    442     readonly props: Props;
    443     cache?: CacheContext;
    444     readonly access?: CloudflareAccessContext;
    445     tracing: Tracing;
    446 }
    447 type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
    448 type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
    449 type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
    450 type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
    451 type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
    452 type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
    453 type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
    454 type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
    455 interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {
    456     fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
    457     connect?: ExportedHandlerConnectHandler<Env, Props>;
    458     tail?: ExportedHandlerTailHandler<Env, Props>;
    459     trace?: ExportedHandlerTraceHandler<Env, Props>;
    460     tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
    461     scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
    462     test?: ExportedHandlerTestHandler<Env, Props>;
    463     email?: EmailExportedHandler<Env, Props>;
    464     queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
    465 }
    466 interface StructuredSerializeOptions {
    467     transfer?: any[];
    468 }
    469 declare abstract class Navigator {
    470     sendBeacon(url: string, body?: BodyInit): boolean;
    471     readonly userAgent: string;
    472     readonly hardwareConcurrency: number;
    473     readonly platform: string;
    474     readonly language: string;
    475     readonly languages: string[];
    476 }
    477 interface AlarmInvocationInfo {
    478     readonly isRetry: boolean;
    479     readonly retryCount: number;
    480     readonly scheduledTime: number;
    481 }
    482 interface Cloudflare {
    483     readonly compatibilityFlags: Record<string, boolean>;
    484 }
    485 interface CachePurgeError {
    486     code: number;
    487     message: string;
    488 }
    489 interface CachePurgeResult {
    490     success: boolean;
    491     errors: CachePurgeError[];
    492 }
    493 interface CachePurgeOptions {
    494     tags?: string[];
    495     pathPrefixes?: string[];
    496     purgeEverything?: boolean;
    497 }
    498 interface CacheContext {
    499     purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
    500 }
    501 interface CloudflareAccessContext {
    502     readonly aud: string;
    503     getIdentity(): Promise<CloudflareAccessIdentity | undefined>;
    504 }
    505 declare abstract class ColoLocalActorNamespace {
    506     get(actorId: string): Fetcher;
    507 }
    508 interface DurableObject {
    509     fetch(request: Request): Response | Promise<Response>;
    510     connect?(socket: Socket): void | Promise<void>;
    511     alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
    512     webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
    513     webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
    514     webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
    515 }
    516 type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & {
    517     readonly id: DurableObjectId;
    518     readonly name?: string;
    519 };
    520 interface DurableObjectId {
    521     toString(): string;
    522     equals(other: DurableObjectId): boolean;
    523     readonly name?: string;
    524     readonly jurisdiction?: string;
    525 }
    526 declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {
    527     newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
    528     idFromName(name: string): DurableObjectId;
    529     idFromString(id: string): DurableObjectId;
    530     get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
    531     getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
    532     jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
    533 }
    534 type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
    535 interface DurableObjectNamespaceNewUniqueIdOptions {
    536     jurisdiction?: DurableObjectJurisdiction;
    537 }
    538 type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";
    539 type DurableObjectRoutingMode = "primary-only";
    540 interface DurableObjectNamespaceGetDurableObjectOptions {
    541     locationHint?: DurableObjectLocationHint;
    542     routingMode?: DurableObjectRoutingMode;
    543 }
    544 interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {
    545 }
    546 interface DurableObjectState<Props = unknown> {
    547     waitUntil(promise: Promise<any>): void;
    548     readonly exports: Cloudflare.Exports;
    549     readonly props: Props;
    550     readonly id: DurableObjectId;
    551     readonly storage: DurableObjectStorage;
    552     container?: Container;
    553     facets: DurableObjectFacets;
    554     blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
    555     acceptWebSocket(ws: WebSocket, tags?: string[]): void;
    556     getWebSockets(tag?: string): WebSocket[];
    557     setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
    558     getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
    559     getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
    560     setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
    561     getHibernatableWebSocketEventTimeout(): number | null;
    562     getTags(ws: WebSocket): string[];
    563     abort(reason?: string): void;
    564 }
    565 interface DurableObjectTransaction {
    566     get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
    567     get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
    568     list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
    569     put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
    570     put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
    571     delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
    572     delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
    573     rollback(): void;
    574     getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
    575     setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
    576     deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
    577 }
    578 interface DurableObjectStorage {
    579     get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
    580     get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
    581     list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
    582     put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
    583     put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
    584     delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
    585     delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
    586     deleteAll(options?: DurableObjectPutOptions): Promise<void>;
    587     transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
    588     getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
    589     setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
    590     deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
    591     sync(): Promise<void>;
    592     sql: SqlStorage;
    593     kv: SyncKvStorage;
    594     transactionSync<T>(closure: () => T): T;
    595     getCurrentBookmark(): Promise<string>;
    596     getBookmarkForTime(timestamp: number | Date): Promise<string>;
    597     onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
    598 }
    599 interface DurableObjectListOptions {
    600     start?: string;
    601     startAfter?: string;
    602     end?: string;
    603     prefix?: string;
    604     reverse?: boolean;
    605     limit?: number;
    606     allowConcurrency?: boolean;
    607     noCache?: boolean;
    608 }
    609 interface DurableObjectGetOptions {
    610     allowConcurrency?: boolean;
    611     noCache?: boolean;
    612 }
    613 interface DurableObjectGetAlarmOptions {
    614     allowConcurrency?: boolean;
    615 }
    616 interface DurableObjectPutOptions {
    617     allowConcurrency?: boolean;
    618     allowUnconfirmed?: boolean;
    619     noCache?: boolean;
    620 }
    621 interface DurableObjectSetAlarmOptions {
    622     allowConcurrency?: boolean;
    623     allowUnconfirmed?: boolean;
    624 }
    625 declare class WebSocketRequestResponsePair {
    626     constructor(request: string, response: string);
    627     get request(): string;
    628     get response(): string;
    629 }
    630 interface DurableObjectFacets {
    631     get<T extends Rpc.DurableObjectBranded | undefined = undefined>(name: string, getStartupOptions: () => FacetStartupOptions<T> | Promise<FacetStartupOptions<T>>): Fetcher<T>;
    632     abort(name: string, reason: any): void;
    633     delete(name: string): void;
    634     clone(src: string, dst: string): void;
    635 }
    636 interface FacetStartupOptions<T extends Rpc.DurableObjectBranded | undefined = undefined> {
    637     id?: DurableObjectId | string;
    638     class: DurableObjectClass<T>;
    639 }
    640 interface AnalyticsEngineDataset {
    641     writeDataPoint(event?: AnalyticsEngineDataPoint): void;
    642 }
    643 interface AnalyticsEngineDataPoint {
    644     indexes?: ((ArrayBuffer | string) | null)[];
    645     doubles?: number[];
    646     blobs?: ((ArrayBuffer | string) | null)[];
    647 }
    648 /**
    649  * The **`Event`** interface represents an event which takes place on an `EventTarget`.
    650  *
    651  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
    652  */
    653 declare class Event {
    654     constructor(type: string, init?: EventInit);
    655     /**
    656      * The **`type`** read-only property of the Event interface returns a string containing the event's type.
    657      *
    658      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
    659      */
    660     get type(): string;
    661     /**
    662      * The **`eventPhase`** read-only property of the being evaluated.
    663      *
    664      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
    665      */
    666     get eventPhase(): number;
    667     /**
    668      * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
    669      *
    670      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
    671      */
    672     get composed(): boolean;
    673     /**
    674      * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
    675      *
    676      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
    677      */
    678     get bubbles(): boolean;
    679     /**
    680      * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
    681      *
    682      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
    683      */
    684     get cancelable(): boolean;
    685     /**
    686      * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
    687      *
    688      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
    689      */
    690     get defaultPrevented(): boolean;
    691     /**
    692      * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
    693      * @deprecated
    694      *
    695      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
    696      */
    697     get returnValue(): boolean;
    698     /**
    699      * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
    700      *
    701      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
    702      */
    703     get currentTarget(): EventTarget | undefined;
    704     /**
    705      * The read-only **`target`** property of the dispatched.
    706      *
    707      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
    708      */
    709     get target(): EventTarget | undefined;
    710     /**
    711      * The deprecated **`Event.srcElement`** is an alias for the Event.target property.
    712      * @deprecated
    713      *
    714      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
    715      */
    716     get srcElement(): EventTarget | undefined;
    717     /**
    718      * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
    719      *
    720      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
    721      */
    722     get timeStamp(): number;
    723     /**
    724      * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
    725      *
    726      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
    727      */
    728     get isTrusted(): boolean;
    729     /**
    730      * The **`cancelBubble`** property of the Event interface is deprecated.
    731      * @deprecated
    732      *
    733      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
    734      */
    735     get cancelBubble(): boolean;
    736     /**
    737      * The **`cancelBubble`** property of the Event interface is deprecated.
    738      * @deprecated
    739      *
    740      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
    741      */
    742     set cancelBubble(value: boolean);
    743     /**
    744      * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
    745      *
    746      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
    747      */
    748     stopImmediatePropagation(): void;
    749     /**
    750      * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
    751      *
    752      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
    753      */
    754     preventDefault(): void;
    755     /**
    756      * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
    757      *
    758      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
    759      */
    760     stopPropagation(): void;
    761     /**
    762      * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
    763      *
    764      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
    765      */
    766     composedPath(): EventTarget[];
    767     static readonly NONE: number;
    768     static readonly CAPTURING_PHASE: number;
    769     static readonly AT_TARGET: number;
    770     static readonly BUBBLING_PHASE: number;
    771 }
    772 interface EventInit {
    773     bubbles?: boolean;
    774     cancelable?: boolean;
    775     composed?: boolean;
    776 }
    777 type EventListener<EventType extends Event = Event> = (event: EventType) => void;
    778 interface EventListenerObject<EventType extends Event = Event> {
    779     handleEvent(event: EventType): void;
    780 }
    781 type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
    782 /**
    783  * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
    784  *
    785  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
    786  */
    787 declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {
    788     constructor();
    789     /**
    790      * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
    791      *
    792      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
    793      */
    794     addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
    795     /**
    796      * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
    797      *
    798      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
    799      */
    800     removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
    801     /**
    802      * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
    803      *
    804      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
    805      */
    806     dispatchEvent(event: EventMap[keyof EventMap]): boolean;
    807 }
    808 interface EventTargetEventListenerOptions {
    809     capture?: boolean;
    810 }
    811 interface EventTargetAddEventListenerOptions {
    812     capture?: boolean;
    813     passive?: boolean;
    814     once?: boolean;
    815     signal?: AbortSignal;
    816 }
    817 interface EventTargetHandlerObject {
    818     handleEvent: (event: Event) => any | undefined;
    819 }
    820 /**
    821  * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
    822  *
    823  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
    824  */
    825 declare class AbortController {
    826     constructor();
    827     /**
    828      * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.
    829      *
    830      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
    831      */
    832     get signal(): AbortSignal;
    833     /**
    834      * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
    835      *
    836      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
    837      */
    838     abort(reason?: any): void;
    839 }
    840 /**
    841  * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.
    842  *
    843  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
    844  */
    845 declare abstract class AbortSignal extends EventTarget {
    846     /**
    847      * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
    848      *
    849      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
    850      */
    851     static abort(reason?: any): AbortSignal;
    852     /**
    853      * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.
    854      *
    855      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)
    856      */
    857     static timeout(delay: number): AbortSignal;
    858     /**
    859      * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
    860      *
    861      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
    862      */
    863     static any(signals: AbortSignal[]): AbortSignal;
    864     /**
    865      * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).
    866      *
    867      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
    868      */
    869     get aborted(): boolean;
    870     /**
    871      * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
    872      *
    873      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
    874      */
    875     get reason(): any;
    876     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
    877     get onabort(): any | null;
    878     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
    879     set onabort(value: any | null);
    880     /**
    881      * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
    882      *
    883      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
    884      */
    885     throwIfAborted(): void;
    886 }
    887 interface Scheduler {
    888     wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
    889 }
    890 interface SchedulerWaitOptions {
    891     signal?: AbortSignal;
    892 }
    893 /**
    894  * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
    895  *
    896  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
    897  */
    898 declare abstract class ExtendableEvent extends Event {
    899     /**
    900      * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
    901      *
    902      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
    903      */
    904     waitUntil(promise: Promise<any>): void;
    905 }
    906 /**
    907  * The **`CustomEvent`** interface represents events initialized by an application for any purpose.
    908  *
    909  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
    910  */
    911 declare class CustomEvent<T = any> extends Event {
    912     constructor(type: string, init?: CustomEventCustomEventInit);
    913     /**
    914      * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
    915      *
    916      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
    917      */
    918     get detail(): T;
    919 }
    920 interface CustomEventCustomEventInit {
    921     bubbles?: boolean;
    922     cancelable?: boolean;
    923     composed?: boolean;
    924     detail?: any;
    925 }
    926 /**
    927  * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
    928  *
    929  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
    930  */
    931 declare class Blob {
    932     constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
    933     /**
    934      * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.
    935      *
    936      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)
    937      */
    938     get size(): number;
    939     /**
    940      * The **`type`** read-only property of the Blob interface returns the MIME type of the file.
    941      *
    942      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)
    943      */
    944     get type(): string;
    945     /**
    946      * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.
    947      *
    948      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)
    949      */
    950     slice(start?: number, end?: number, type?: string): Blob;
    951     /**
    952      * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.
    953      *
    954      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)
    955      */
    956     arrayBuffer(): Promise<ArrayBuffer>;
    957     /**
    958      * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.
    959      *
    960      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)
    961      */
    962     bytes(): Promise<Uint8Array>;
    963     /**
    964      * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
    965      *
    966      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
    967      */
    968     text(): Promise<string>;
    969     /**
    970      * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.
    971      *
    972      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)
    973      */
    974     stream(): ReadableStream;
    975 }
    976 interface BlobOptions {
    977     type?: string;
    978 }
    979 /**
    980  * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.
    981  *
    982  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
    983  */
    984 declare class File extends Blob {
    985     constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);
    986     /**
    987      * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
    988      *
    989      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
    990      */
    991     get name(): string;
    992     /**
    993      * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
    994      *
    995      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
    996      */
    997     get lastModified(): number;
    998 }
    999 interface FileOptions {
   1000     type?: string;
   1001     lastModified?: number;
   1002 }
   1003 /**
   1004 * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
   1005 *
   1006 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
   1007 */
   1008 declare abstract class CacheStorage {
   1009     /**
   1010      * The **`open()`** method of the the Cache object matching the `cacheName`.
   1011      *
   1012      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
   1013      */
   1014     open(cacheName: string): Promise<Cache>;
   1015     readonly default: Cache;
   1016 }
   1017 /**
   1018 * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
   1019 *
   1020 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
   1021 */
   1022 declare abstract class Cache {
   1023     /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
   1024     delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;
   1025     /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
   1026     match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;
   1027     /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
   1028     put(request: RequestInfo | URL, response: Response): Promise<void>;
   1029 }
   1030 interface CacheQueryOptions {
   1031     ignoreMethod?: boolean;
   1032 }
   1033 /**
   1034 * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
   1035 * The Workers runtime implements the full surface of this API, but with some differences in
   1036 * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
   1037 * compared to those implemented in most browsers.
   1038 *
   1039 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
   1040 */
   1041 declare abstract class Crypto {
   1042     /**
   1043      * The **`Crypto.subtle`** read-only property returns a cryptographic operations.
   1044      * Available only in secure contexts.
   1045      *
   1046      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
   1047      */
   1048     get subtle(): SubtleCrypto;
   1049     /**
   1050      * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
   1051      *
   1052      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
   1053      */
   1054     getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;
   1055     /**
   1056      * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.
   1057      * Available only in secure contexts.
   1058      *
   1059      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
   1060      */
   1061     randomUUID(): string;
   1062     DigestStream: typeof DigestStream;
   1063 }
   1064 /**
   1065  * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.
   1066  * Available only in secure contexts.
   1067  *
   1068  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
   1069  */
   1070 declare abstract class SubtleCrypto {
   1071     /**
   1072      * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.
   1073      *
   1074      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)
   1075      */
   1076     encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
   1077     /**
   1078      * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
   1079      *
   1080      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
   1081      */
   1082     decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
   1083     /**
   1084      * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.
   1085      *
   1086      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)
   1087      */
   1088     sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
   1089     /**
   1090      * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.
   1091      *
   1092      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)
   1093      */
   1094     verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
   1095     /**
   1096      * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
   1097      *
   1098      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
   1099      */
   1100     digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
   1101     /**
   1102      * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).
   1103      *
   1104      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)
   1105      */
   1106     generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
   1107     /**
   1108      * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.
   1109      *
   1110      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)
   1111      */
   1112     deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
   1113     /**
   1114      * The **`deriveBits()`** method of the key.
   1115      *
   1116      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
   1117      */
   1118     deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;
   1119     /**
   1120      * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.
   1121      *
   1122      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)
   1123      */
   1124     importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
   1125     /**
   1126      * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.
   1127      *
   1128      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)
   1129      */
   1130     exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
   1131     /**
   1132      * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
   1133      *
   1134      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
   1135      */
   1136     wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
   1137     /**
   1138      * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
   1139      *
   1140      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
   1141      */
   1142     unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
   1143     timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;
   1144 }
   1145 /**
   1146  * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
   1147  * Available only in secure contexts.
   1148  *
   1149  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
   1150  */
   1151 declare abstract class CryptoKey {
   1152     /**
   1153      * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
   1154      *
   1155      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
   1156      */
   1157     readonly type: string;
   1158     /**
   1159      * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.
   1160      *
   1161      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)
   1162      */
   1163     readonly extractable: boolean;
   1164     /**
   1165      * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.
   1166      *
   1167      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)
   1168      */
   1169     readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;
   1170     /**
   1171      * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.
   1172      *
   1173      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)
   1174      */
   1175     readonly usages: string[];
   1176 }
   1177 interface CryptoKeyPair {
   1178     publicKey: CryptoKey;
   1179     privateKey: CryptoKey;
   1180 }
   1181 interface JsonWebKey {
   1182     kty: string;
   1183     use?: string;
   1184     key_ops?: string[];
   1185     alg?: string;
   1186     ext?: boolean;
   1187     crv?: string;
   1188     x?: string;
   1189     y?: string;
   1190     d?: string;
   1191     n?: string;
   1192     e?: string;
   1193     p?: string;
   1194     q?: string;
   1195     dp?: string;
   1196     dq?: string;
   1197     qi?: string;
   1198     oth?: RsaOtherPrimesInfo[];
   1199     k?: string;
   1200 }
   1201 interface RsaOtherPrimesInfo {
   1202     r?: string;
   1203     d?: string;
   1204     t?: string;
   1205 }
   1206 interface SubtleCryptoDeriveKeyAlgorithm {
   1207     name: string;
   1208     salt?: (ArrayBuffer | ArrayBufferView);
   1209     iterations?: number;
   1210     hash?: (string | SubtleCryptoHashAlgorithm);
   1211     $public?: CryptoKey;
   1212     info?: (ArrayBuffer | ArrayBufferView);
   1213 }
   1214 interface SubtleCryptoEncryptAlgorithm {
   1215     name: string;
   1216     iv?: (ArrayBuffer | ArrayBufferView);
   1217     additionalData?: (ArrayBuffer | ArrayBufferView);
   1218     tagLength?: number;
   1219     counter?: (ArrayBuffer | ArrayBufferView);
   1220     length?: number;
   1221     label?: (ArrayBuffer | ArrayBufferView);
   1222 }
   1223 interface SubtleCryptoGenerateKeyAlgorithm {
   1224     name: string;
   1225     hash?: (string | SubtleCryptoHashAlgorithm);
   1226     modulusLength?: number;
   1227     publicExponent?: (ArrayBuffer | ArrayBufferView);
   1228     length?: number;
   1229     namedCurve?: string;
   1230 }
   1231 interface SubtleCryptoHashAlgorithm {
   1232     name: string;
   1233 }
   1234 interface SubtleCryptoImportKeyAlgorithm {
   1235     name: string;
   1236     hash?: (string | SubtleCryptoHashAlgorithm);
   1237     length?: number;
   1238     namedCurve?: string;
   1239     compressed?: boolean;
   1240 }
   1241 interface SubtleCryptoSignAlgorithm {
   1242     name: string;
   1243     hash?: (string | SubtleCryptoHashAlgorithm);
   1244     dataLength?: number;
   1245     saltLength?: number;
   1246 }
   1247 interface CryptoKeyKeyAlgorithm {
   1248     name: string;
   1249 }
   1250 interface CryptoKeyAesKeyAlgorithm {
   1251     name: string;
   1252     length: number;
   1253 }
   1254 interface CryptoKeyHmacKeyAlgorithm {
   1255     name: string;
   1256     hash: CryptoKeyKeyAlgorithm;
   1257     length: number;
   1258 }
   1259 interface CryptoKeyRsaKeyAlgorithm {
   1260     name: string;
   1261     modulusLength: number;
   1262     publicExponent: ArrayBuffer | ArrayBufferView;
   1263     hash?: CryptoKeyKeyAlgorithm;
   1264 }
   1265 interface CryptoKeyEllipticKeyAlgorithm {
   1266     name: string;
   1267     namedCurve: string;
   1268 }
   1269 interface CryptoKeyArbitraryKeyAlgorithm {
   1270     name: string;
   1271     hash?: CryptoKeyKeyAlgorithm;
   1272     namedCurve?: string;
   1273     length?: number;
   1274 }
   1275 declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
   1276     constructor(algorithm: string | SubtleCryptoHashAlgorithm);
   1277     readonly digest: Promise<ArrayBuffer>;
   1278     get bytesWritten(): number | bigint;
   1279 }
   1280 /**
   1281  * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
   1282  *
   1283  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
   1284  */
   1285 declare class TextDecoder {
   1286     constructor(label?: string, options?: TextDecoderConstructorOptions);
   1287     /**
   1288      * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.
   1289      *
   1290      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
   1291      */
   1292     decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;
   1293     get encoding(): string;
   1294     get fatal(): boolean;
   1295     get ignoreBOM(): boolean;
   1296 }
   1297 /**
   1298  * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
   1299  *
   1300  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
   1301  */
   1302 declare class TextEncoder {
   1303     constructor();
   1304     /**
   1305      * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
   1306      *
   1307      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
   1308      */
   1309     encode(input?: string): Uint8Array;
   1310     /**
   1311      * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
   1312      *
   1313      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
   1314      */
   1315     encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
   1316     get encoding(): string;
   1317 }
   1318 interface TextDecoderConstructorOptions {
   1319     fatal: boolean;
   1320     ignoreBOM: boolean;
   1321 }
   1322 interface TextDecoderDecodeOptions {
   1323     stream: boolean;
   1324 }
   1325 interface TextEncoderEncodeIntoResult {
   1326     read: number;
   1327     written: number;
   1328 }
   1329 /**
   1330  * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
   1331  *
   1332  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
   1333  */
   1334 declare class ErrorEvent extends Event {
   1335     constructor(type: string, init?: ErrorEventErrorEventInit);
   1336     /**
   1337      * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.
   1338      *
   1339      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)
   1340      */
   1341     get filename(): string;
   1342     /**
   1343      * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.
   1344      *
   1345      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)
   1346      */
   1347     get message(): string;
   1348     /**
   1349      * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.
   1350      *
   1351      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)
   1352      */
   1353     get lineno(): number;
   1354     /**
   1355      * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.
   1356      *
   1357      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)
   1358      */
   1359     get colno(): number;
   1360     /**
   1361      * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.
   1362      *
   1363      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)
   1364      */
   1365     get error(): any;
   1366 }
   1367 interface ErrorEventErrorEventInit {
   1368     message?: string;
   1369     filename?: string;
   1370     lineno?: number;
   1371     colno?: number;
   1372     error?: any;
   1373 }
   1374 /**
   1375  * The **`MessageEvent`** interface represents a message received by a target object.
   1376  *
   1377  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
   1378  */
   1379 declare class MessageEvent extends Event {
   1380     constructor(type: string, initializer: MessageEventInit);
   1381     /**
   1382      * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
   1383      *
   1384      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
   1385      */
   1386     readonly data: any;
   1387     /**
   1388      * The **`origin`** read-only property of the origin of the message emitter.
   1389      *
   1390      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
   1391      */
   1392     readonly origin: string | null;
   1393     /**
   1394      * The **`lastEventId`** read-only property of the unique ID for the event.
   1395      *
   1396      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
   1397      */
   1398     readonly lastEventId: string;
   1399     /**
   1400      * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
   1401      *
   1402      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
   1403      */
   1404     readonly source: MessagePort | null;
   1405     /**
   1406      * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
   1407      *
   1408      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
   1409      */
   1410     readonly ports: MessagePort[];
   1411 }
   1412 interface MessageEventInit {
   1413     data: ArrayBuffer | string;
   1414 }
   1415 /**
   1416  * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
   1417  *
   1418  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
   1419  */
   1420 declare abstract class PromiseRejectionEvent extends Event {
   1421     /**
   1422      * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
   1423      *
   1424      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
   1425      */
   1426     readonly promise: Promise<any>;
   1427     /**
   1428      * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
   1429      *
   1430      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
   1431      */
   1432     readonly reason: any;
   1433 }
   1434 /**
   1435  * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
   1436  *
   1437  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
   1438  */
   1439 declare class FormData {
   1440     constructor();
   1441     /**
   1442      * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
   1443      *
   1444      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
   1445      */
   1446     append(name: string, value: string | Blob): void;
   1447     /**
   1448      * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
   1449      *
   1450      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
   1451      */
   1452     append(name: string, value: string): void;
   1453     /**
   1454      * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
   1455      *
   1456      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
   1457      */
   1458     append(name: string, value: Blob, filename?: string): void;
   1459     /**
   1460      * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.
   1461      *
   1462      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)
   1463      */
   1464     delete(name: string): void;
   1465     /**
   1466      * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
   1467      *
   1468      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
   1469      */
   1470     get(name: string): (File | string) | null;
   1471     /**
   1472      * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.
   1473      *
   1474      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
   1475      */
   1476     getAll(name: string): (File | string)[];
   1477     /**
   1478      * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.
   1479      *
   1480      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)
   1481      */
   1482     has(name: string): boolean;
   1483     /**
   1484      * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
   1485      *
   1486      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
   1487      */
   1488     set(name: string, value: string | Blob): void;
   1489     /**
   1490      * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
   1491      *
   1492      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
   1493      */
   1494     set(name: string, value: string): void;
   1495     /**
   1496      * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
   1497      *
   1498      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
   1499      */
   1500     set(name: string, value: Blob, filename?: string): void;
   1501     /* Returns an array of key, value pairs for every entry in the list. */
   1502     entries(): IterableIterator<[
   1503         key: string,
   1504         value: File | string
   1505     ]>;
   1506     /* Returns a list of keys in the list. */
   1507     keys(): IterableIterator<string>;
   1508     /* Returns a list of values in the list. */
   1509     values(): IterableIterator<(File | string)>;
   1510     forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
   1511     [Symbol.iterator](): IterableIterator<[
   1512         key: string,
   1513         value: File | string
   1514     ]>;
   1515 }
   1516 interface ContentOptions {
   1517     html?: boolean;
   1518 }
   1519 declare class HTMLRewriter {
   1520     constructor();
   1521     on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
   1522     onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
   1523     transform(response: Response): Response;
   1524 }
   1525 interface HTMLRewriterElementContentHandlers {
   1526     element?(element: Element): void | Promise<void>;
   1527     comments?(comment: Comment): void | Promise<void>;
   1528     text?(element: Text): void | Promise<void>;
   1529 }
   1530 interface HTMLRewriterDocumentContentHandlers {
   1531     doctype?(doctype: Doctype): void | Promise<void>;
   1532     comments?(comment: Comment): void | Promise<void>;
   1533     text?(text: Text): void | Promise<void>;
   1534     end?(end: DocumentEnd): void | Promise<void>;
   1535 }
   1536 interface Doctype {
   1537     readonly name: string | null;
   1538     readonly publicId: string | null;
   1539     readonly systemId: string | null;
   1540 }
   1541 interface Element {
   1542     tagName: string;
   1543     readonly attributes: IterableIterator<string[]>;
   1544     readonly removed: boolean;
   1545     readonly namespaceURI: string;
   1546     getAttribute(name: string): string | null;
   1547     hasAttribute(name: string): boolean;
   1548     setAttribute(name: string, value: string): Element;
   1549     removeAttribute(name: string): Element;
   1550     before(content: string | ReadableStream | Response, options?: ContentOptions): Element;
   1551     after(content: string | ReadableStream | Response, options?: ContentOptions): Element;
   1552     prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;
   1553     append(content: string | ReadableStream | Response, options?: ContentOptions): Element;
   1554     replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;
   1555     remove(): Element;
   1556     removeAndKeepContent(): Element;
   1557     setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;
   1558     onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
   1559 }
   1560 interface EndTag {
   1561     name: string;
   1562     before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
   1563     after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
   1564     remove(): EndTag;
   1565 }
   1566 interface Comment {
   1567     text: string;
   1568     readonly removed: boolean;
   1569     before(content: string, options?: ContentOptions): Comment;
   1570     after(content: string, options?: ContentOptions): Comment;
   1571     replace(content: string, options?: ContentOptions): Comment;
   1572     remove(): Comment;
   1573 }
   1574 interface Text {
   1575     readonly text: string;
   1576     readonly lastInTextNode: boolean;
   1577     readonly removed: boolean;
   1578     before(content: string | ReadableStream | Response, options?: ContentOptions): Text;
   1579     after(content: string | ReadableStream | Response, options?: ContentOptions): Text;
   1580     replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;
   1581     remove(): Text;
   1582 }
   1583 interface DocumentEnd {
   1584     append(content: string, options?: ContentOptions): DocumentEnd;
   1585 }
   1586 /**
   1587  * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
   1588  *
   1589  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
   1590  */
   1591 declare abstract class FetchEvent extends ExtendableEvent {
   1592     /**
   1593      * The **`request`** read-only property of the the event handler.
   1594      *
   1595      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
   1596      */
   1597     readonly request: Request;
   1598     /**
   1599      * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
   1600      *
   1601      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
   1602      */
   1603     respondWith(promise: Response | Promise<Response>): void;
   1604     passThroughOnException(): void;
   1605 }
   1606 type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
   1607 /**
   1608  * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
   1609  *
   1610  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
   1611  */
   1612 declare class Headers {
   1613     constructor(init?: HeadersInit);
   1614     /**
   1615      * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
   1616      *
   1617      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
   1618      */
   1619     get(name: string): string | null;
   1620     getAll(name: string): string[];
   1621     /**
   1622      * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
   1623      *
   1624      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
   1625      */
   1626     getSetCookie(): string[];
   1627     /**
   1628      * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.
   1629      *
   1630      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)
   1631      */
   1632     has(name: string): boolean;
   1633     /**
   1634      * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
   1635      *
   1636      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)
   1637      */
   1638     set(name: string, value: string): void;
   1639     /**
   1640      * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
   1641      *
   1642      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)
   1643      */
   1644     append(name: string, value: string): void;
   1645     /**
   1646      * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.
   1647      *
   1648      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)
   1649      */
   1650     delete(name: string): void;
   1651     forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
   1652     /* Returns an iterator allowing to go through all key/value pairs contained in this object. */
   1653     entries(): IterableIterator<[
   1654         key: string,
   1655         value: string
   1656     ]>;
   1657     /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
   1658     keys(): IterableIterator<string>;
   1659     /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
   1660     values(): IterableIterator<string>;
   1661     [Symbol.iterator](): IterableIterator<[
   1662         key: string,
   1663         value: string
   1664     ]>;
   1665 }
   1666 type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
   1667 declare abstract class Body {
   1668     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
   1669     get body(): ReadableStream | null;
   1670     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
   1671     get bodyUsed(): boolean;
   1672     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
   1673     arrayBuffer(): Promise<ArrayBuffer>;
   1674     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
   1675     bytes(): Promise<Uint8Array>;
   1676     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
   1677     text(): Promise<string>;
   1678     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */
   1679     json<T>(): Promise<T>;
   1680     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
   1681     formData(): Promise<FormData>;
   1682     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
   1683     blob(): Promise<Blob>;
   1684 }
   1685 /**
   1686  * The **`Response`** interface of the Fetch API represents the response to a request.
   1687  *
   1688  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
   1689  */
   1690 declare var Response: {
   1691     prototype: Response;
   1692     new (body?: BodyInit | null, init?: ResponseInit): Response;
   1693     error(): Response;
   1694     redirect(url: string, status?: number): Response;
   1695     json(any: any, maybeInit?: (ResponseInit | Response)): Response;
   1696 };
   1697 /**
   1698  * The **`Response`** interface of the Fetch API represents the response to a request.
   1699  *
   1700  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
   1701  */
   1702 interface Response extends Body {
   1703     /**
   1704      * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.
   1705      *
   1706      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)
   1707      */
   1708     clone(): Response;
   1709     /**
   1710      * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.
   1711      *
   1712      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)
   1713      */
   1714     status: number;
   1715     /**
   1716      * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.
   1717      *
   1718      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)
   1719      */
   1720     statusText: string;
   1721     /**
   1722      * The **`headers`** read-only property of the with the response.
   1723      *
   1724      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
   1725      */
   1726     headers: Headers;
   1727     /**
   1728      * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
   1729      *
   1730      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)
   1731      */
   1732     ok: boolean;
   1733     /**
   1734      * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.
   1735      *
   1736      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)
   1737      */
   1738     redirected: boolean;
   1739     /**
   1740      * The **`url`** read-only property of the Response interface contains the URL of the response.
   1741      *
   1742      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
   1743      */
   1744     url: string;
   1745     webSocket: WebSocket | null;
   1746     cf: any | undefined;
   1747     /**
   1748      * The **`type`** read-only property of the Response interface contains the type of the response.
   1749      *
   1750      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
   1751      */
   1752     type: "default" | "error";
   1753 }
   1754 interface ResponseInit {
   1755     status?: number;
   1756     statusText?: string;
   1757     headers?: HeadersInit;
   1758     cf?: any;
   1759     webSocket?: (WebSocket | null);
   1760     encodeBody?: "automatic" | "manual";
   1761 }
   1762 type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;
   1763 /**
   1764  * The **`Request`** interface of the Fetch API represents a resource request.
   1765  *
   1766  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
   1767  */
   1768 declare var Request: {
   1769     prototype: Request;
   1770     new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;
   1771 };
   1772 /**
   1773  * The **`Request`** interface of the Fetch API represents a resource request.
   1774  *
   1775  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
   1776  */
   1777 interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {
   1778     /**
   1779      * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.
   1780      *
   1781      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)
   1782      */
   1783     clone(): Request<CfHostMetadata, Cf>;
   1784     /**
   1785      * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
   1786      *
   1787      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
   1788      */
   1789     method: string;
   1790     /**
   1791      * The **`url`** read-only property of the Request interface contains the URL of the request.
   1792      *
   1793      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
   1794      */
   1795     url: string;
   1796     /**
   1797      * The **`headers`** read-only property of the with the request.
   1798      *
   1799      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
   1800      */
   1801     headers: Headers;
   1802     /**
   1803      * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.
   1804      *
   1805      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
   1806      */
   1807     redirect: string;
   1808     fetcher: Fetcher | null;
   1809     /**
   1810      * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.
   1811      *
   1812      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
   1813      */
   1814     signal: AbortSignal;
   1815     cf?: Cf;
   1816     /**
   1817      * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.
   1818      *
   1819      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
   1820      */
   1821     integrity: string;
   1822     /**
   1823      * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.
   1824      *
   1825      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
   1826      */
   1827     keepalive: boolean;
   1828     /**
   1829      * The **`cache`** read-only property of the Request interface contains the cache mode of the request.
   1830      *
   1831      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
   1832      */
   1833     cache?: "no-store" | "no-cache";
   1834 }
   1835 interface RequestInit<Cf = CfProperties> {
   1836     /* A string to set request's method. */
   1837     method?: string;
   1838     /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
   1839     headers?: HeadersInit;
   1840     /* A BodyInit object or null to set request's body. */
   1841     body?: BodyInit | null;
   1842     /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
   1843     redirect?: string;
   1844     fetcher?: (Fetcher | null);
   1845     cf?: Cf;
   1846     /* A string indicating how the request will interact with the browser's cache to set request's cache. */
   1847     cache?: "no-store" | "no-cache";
   1848     /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
   1849     integrity?: string;
   1850     /* An AbortSignal to set request's signal. */
   1851     signal?: (AbortSignal | null);
   1852     encodeResponseBody?: "automatic" | "manual";
   1853 }
   1854 type Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;
   1855 type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {
   1856     fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
   1857     connect(address: SocketAddress | string, options?: SocketOptions): Socket;
   1858 };
   1859 interface KVNamespaceListKey<Metadata, Key extends string = string> {
   1860     name: Key;
   1861     expiration?: number;
   1862     metadata?: Metadata;
   1863 }
   1864 type KVNamespaceListResult<Metadata, Key extends string = string> = {
   1865     list_complete: false;
   1866     keys: KVNamespaceListKey<Metadata, Key>[];
   1867     cursor: string;
   1868     cacheStatus: string | null;
   1869 } | {
   1870     list_complete: true;
   1871     keys: KVNamespaceListKey<Metadata, Key>[];
   1872     cacheStatus: string | null;
   1873 };
   1874 interface KVNamespace<Key extends string = string> {
   1875     get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;
   1876     get(key: Key, type: "text"): Promise<string | null>;
   1877     get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;
   1878     get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
   1879     get(key: Key, type: "stream"): Promise<ReadableStream | null>;
   1880     get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>;
   1881     get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;
   1882     get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;
   1883     get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;
   1884     get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;
   1885     get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>;
   1886     get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;
   1887     get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>;
   1888     get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>;
   1889     list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;
   1890     put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;
   1891     getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
   1892     getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
   1893     getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
   1894     getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
   1895     getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
   1896     getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
   1897     getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
   1898     getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
   1899     getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
   1900     getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
   1901     getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;
   1902     getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
   1903     getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
   1904     getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;
   1905     delete(key: Key): Promise<void>;
   1906 }
   1907 interface KVNamespaceListOptions {
   1908     limit?: number;
   1909     prefix?: (string | null);
   1910     cursor?: (string | null);
   1911 }
   1912 interface KVNamespaceGetOptions<Type> {
   1913     type: Type;
   1914     cacheTtl?: number;
   1915 }
   1916 interface KVNamespacePutOptions {
   1917     expiration?: number;
   1918     expirationTtl?: number;
   1919     metadata?: (any | null);
   1920 }
   1921 interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
   1922     value: Value | null;
   1923     metadata: Metadata | null;
   1924     cacheStatus: string | null;
   1925 }
   1926 type QueueContentType = "text" | "bytes" | "json" | "v8";
   1927 interface Queue<Body = unknown> {
   1928     metrics(): Promise<QueueMetrics>;
   1929     send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;
   1930     sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<QueueSendBatchResponse>;
   1931 }
   1932 interface QueueSendMetrics {
   1933     backlogCount: number;
   1934     backlogBytes: number;
   1935     oldestMessageTimestamp?: Date;
   1936 }
   1937 interface QueueSendMetadata {
   1938     metrics: QueueSendMetrics;
   1939 }
   1940 interface QueueSendResponse {
   1941     metadata: QueueSendMetadata;
   1942 }
   1943 interface QueueSendBatchMetrics {
   1944     backlogCount: number;
   1945     backlogBytes: number;
   1946     oldestMessageTimestamp?: Date;
   1947 }
   1948 interface QueueSendBatchMetadata {
   1949     metrics: QueueSendBatchMetrics;
   1950 }
   1951 interface QueueSendBatchResponse {
   1952     metadata: QueueSendBatchMetadata;
   1953 }
   1954 interface QueueSendOptions {
   1955     contentType?: QueueContentType;
   1956     delaySeconds?: number;
   1957 }
   1958 interface QueueSendBatchOptions {
   1959     delaySeconds?: number;
   1960 }
   1961 interface MessageSendRequest<Body = unknown> {
   1962     body: Body;
   1963     contentType?: QueueContentType;
   1964     delaySeconds?: number;
   1965 }
   1966 interface QueueMetrics {
   1967     backlogCount: number;
   1968     backlogBytes: number;
   1969     oldestMessageTimestamp?: Date;
   1970 }
   1971 interface MessageBatchMetrics {
   1972     backlogCount: number;
   1973     backlogBytes: number;
   1974     oldestMessageTimestamp?: Date;
   1975 }
   1976 interface MessageBatchMetadata {
   1977     metrics: MessageBatchMetrics;
   1978 }
   1979 interface QueueRetryOptions {
   1980     delaySeconds?: number;
   1981 }
   1982 interface Message<Body = unknown> {
   1983     readonly id: string;
   1984     readonly timestamp: Date;
   1985     readonly body: Body;
   1986     readonly attempts: number;
   1987     retry(options?: QueueRetryOptions): void;
   1988     ack(): void;
   1989 }
   1990 interface QueueEvent<Body = unknown> extends ExtendableEvent {
   1991     readonly messages: readonly Message<Body>[];
   1992     readonly queue: string;
   1993     readonly metadata: MessageBatchMetadata;
   1994     retryAll(options?: QueueRetryOptions): void;
   1995     ackAll(): void;
   1996 }
   1997 interface MessageBatch<Body = unknown> {
   1998     readonly messages: readonly Message<Body>[];
   1999     readonly queue: string;
   2000     readonly metadata: MessageBatchMetadata;
   2001     retryAll(options?: QueueRetryOptions): void;
   2002     ackAll(): void;
   2003 }
   2004 interface R2Error extends Error {
   2005     readonly name: string;
   2006     readonly code: number;
   2007     readonly message: string;
   2008     readonly action: string;
   2009     readonly stack: any;
   2010 }
   2011 interface R2ListOptions {
   2012     limit?: number;
   2013     prefix?: string;
   2014     cursor?: string;
   2015     delimiter?: string;
   2016     startAfter?: string;
   2017     include?: ("httpMetadata" | "customMetadata")[];
   2018 }
   2019 interface R2Bucket {
   2020     head(key: string): Promise<R2Object | null>;
   2021     get(key: string, options: R2GetOptions & {
   2022         onlyIf: R2Conditional | Headers;
   2023     }): Promise<R2ObjectBody | R2Object | null>;
   2024     get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
   2025     put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {
   2026         onlyIf: R2Conditional | Headers;
   2027     }): Promise<R2Object | null>;
   2028     put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;
   2029     createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;
   2030     resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
   2031     delete(keys: string | string[]): Promise<void>;
   2032     list(options?: R2ListOptions): Promise<R2Objects>;
   2033 }
   2034 interface R2MultipartUpload {
   2035     readonly key: string;
   2036     readonly uploadId: string;
   2037     uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;
   2038     abort(): Promise<void>;
   2039     complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
   2040 }
   2041 interface R2UploadedPart {
   2042     partNumber: number;
   2043     etag: string;
   2044 }
   2045 declare abstract class R2Object {
   2046     readonly key: string;
   2047     readonly version: string;
   2048     readonly size: number;
   2049     readonly etag: string;
   2050     readonly httpEtag: string;
   2051     readonly checksums: R2Checksums;
   2052     readonly uploaded: Date;
   2053     readonly httpMetadata?: R2HTTPMetadata;
   2054     readonly customMetadata?: Record<string, string>;
   2055     readonly range?: R2Range;
   2056     readonly storageClass: string;
   2057     readonly ssecKeyMd5?: string;
   2058     writeHttpMetadata(headers: Headers): void;
   2059 }
   2060 interface R2ObjectBody extends R2Object {
   2061     get body(): ReadableStream;
   2062     get bodyUsed(): boolean;
   2063     arrayBuffer(): Promise<ArrayBuffer>;
   2064     bytes(): Promise<Uint8Array>;
   2065     text(): Promise<string>;
   2066     json<T>(): Promise<T>;
   2067     blob(): Promise<Blob>;
   2068 }
   2069 type R2Range = {
   2070     offset: number;
   2071     length?: number;
   2072 } | {
   2073     offset?: number;
   2074     length: number;
   2075 } | {
   2076     suffix: number;
   2077 };
   2078 interface R2Conditional {
   2079     etagMatches?: string;
   2080     etagDoesNotMatch?: string;
   2081     uploadedBefore?: Date;
   2082     uploadedAfter?: Date;
   2083     secondsGranularity?: boolean;
   2084 }
   2085 interface R2GetOptions {
   2086     onlyIf?: (R2Conditional | Headers);
   2087     range?: (R2Range | Headers);
   2088     ssecKey?: (ArrayBuffer | string);
   2089 }
   2090 interface R2PutOptions {
   2091     onlyIf?: (R2Conditional | Headers);
   2092     httpMetadata?: (R2HTTPMetadata | Headers);
   2093     customMetadata?: Record<string, string>;
   2094     md5?: ((ArrayBuffer | ArrayBufferView) | string);
   2095     sha1?: ((ArrayBuffer | ArrayBufferView) | string);
   2096     sha256?: ((ArrayBuffer | ArrayBufferView) | string);
   2097     sha384?: ((ArrayBuffer | ArrayBufferView) | string);
   2098     sha512?: ((ArrayBuffer | ArrayBufferView) | string);
   2099     storageClass?: string;
   2100     ssecKey?: (ArrayBuffer | string);
   2101 }
   2102 interface R2MultipartOptions {
   2103     httpMetadata?: (R2HTTPMetadata | Headers);
   2104     customMetadata?: Record<string, string>;
   2105     storageClass?: string;
   2106     ssecKey?: (ArrayBuffer | string);
   2107 }
   2108 interface R2Checksums {
   2109     readonly md5?: ArrayBuffer;
   2110     readonly sha1?: ArrayBuffer;
   2111     readonly sha256?: ArrayBuffer;
   2112     readonly sha384?: ArrayBuffer;
   2113     readonly sha512?: ArrayBuffer;
   2114     toJSON(): R2StringChecksums;
   2115 }
   2116 interface R2StringChecksums {
   2117     md5?: string;
   2118     sha1?: string;
   2119     sha256?: string;
   2120     sha384?: string;
   2121     sha512?: string;
   2122 }
   2123 interface R2HTTPMetadata {
   2124     contentType?: string;
   2125     contentLanguage?: string;
   2126     contentDisposition?: string;
   2127     contentEncoding?: string;
   2128     cacheControl?: string;
   2129     cacheExpiry?: Date;
   2130 }
   2131 type R2Objects = {
   2132     objects: R2Object[];
   2133     delimitedPrefixes: string[];
   2134 } & ({
   2135     truncated: true;
   2136     cursor: string;
   2137 } | {
   2138     truncated: false;
   2139 });
   2140 interface R2UploadPartOptions {
   2141     ssecKey?: (ArrayBuffer | string);
   2142 }
   2143 declare abstract class ScheduledEvent extends ExtendableEvent {
   2144     readonly scheduledTime: number;
   2145     readonly cron: string;
   2146     noRetry(): void;
   2147 }
   2148 interface ScheduledController {
   2149     readonly scheduledTime: number;
   2150     readonly cron: string;
   2151     noRetry(): void;
   2152 }
   2153 interface QueuingStrategy<T = any> {
   2154     highWaterMark?: (number | bigint);
   2155     size?: (chunk: T) => number | bigint;
   2156 }
   2157 interface UnderlyingSink<W = any> {
   2158     type?: string;
   2159     start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
   2160     write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;
   2161     abort?: (reason: any) => void | Promise<void>;
   2162     close?: () => void | Promise<void>;
   2163 }
   2164 interface UnderlyingByteSource {
   2165     type: "bytes";
   2166     autoAllocateChunkSize?: number;
   2167     start?: (controller: ReadableByteStreamController) => void | Promise<void>;
   2168     pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
   2169     cancel?: (reason: any) => void | Promise<void>;
   2170 }
   2171 interface UnderlyingSource<R = any> {
   2172     type?: "" | undefined;
   2173     start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;
   2174     pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;
   2175     cancel?: (reason: any) => void | Promise<void>;
   2176     expectedLength?: (number | bigint);
   2177 }
   2178 interface Transformer<I = any, O = any> {
   2179     readableType?: string;
   2180     writableType?: string;
   2181     start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;
   2182     transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;
   2183     flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;
   2184     cancel?: (reason: any) => void | Promise<void>;
   2185     expectedLength?: number;
   2186 }
   2187 interface StreamPipeOptions {
   2188     preventAbort?: boolean;
   2189     preventCancel?: boolean;
   2190     /**
   2191      * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
   2192      *
   2193      * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
   2194      *
   2195      * Errors and closures of the source and destination streams propagate as follows:
   2196      *
   2197      * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
   2198      *
   2199      * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
   2200      *
   2201      * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
   2202      *
   2203      * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
   2204      *
   2205      * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
   2206      */
   2207     preventClose?: boolean;
   2208     signal?: AbortSignal;
   2209 }
   2210 type ReadableStreamReadResult<R = any> = {
   2211     done: false;
   2212     value: R;
   2213 } | {
   2214     done: true;
   2215     value?: undefined;
   2216 };
   2217 /**
   2218  * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
   2219  *
   2220  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
   2221  */
   2222 interface ReadableStream<R = any> {
   2223     /**
   2224      * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.
   2225      *
   2226      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)
   2227      */
   2228     get locked(): boolean;
   2229     /**
   2230      * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.
   2231      *
   2232      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)
   2233      */
   2234     cancel(reason?: any): Promise<void>;
   2235     /**
   2236      * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
   2237      *
   2238      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
   2239      */
   2240     getReader(): ReadableStreamDefaultReader<R>;
   2241     /**
   2242      * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
   2243      *
   2244      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
   2245      */
   2246     getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
   2247     /**
   2248      * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.
   2249      *
   2250      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)
   2251      */
   2252     pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
   2253     /**
   2254      * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
   2255      *
   2256      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)
   2257      */
   2258     pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
   2259     /**
   2260      * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
   2261      *
   2262      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
   2263      */
   2264     tee(): [
   2265         ReadableStream<R>,
   2266         ReadableStream<R>
   2267     ];
   2268     values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
   2269     [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
   2270 }
   2271 /**
   2272  * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
   2273  *
   2274  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
   2275  */
   2276 declare const ReadableStream: {
   2277     prototype: ReadableStream;
   2278     new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
   2279     new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
   2280 };
   2281 /**
   2282  * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).
   2283  *
   2284  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)
   2285  */
   2286 declare class ReadableStreamDefaultReader<R = any> {
   2287     constructor(stream: ReadableStream);
   2288     get closed(): Promise<void>;
   2289     cancel(reason?: any): Promise<void>;
   2290     /**
   2291      * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.
   2292      *
   2293      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)
   2294      */
   2295     read(): Promise<ReadableStreamReadResult<R>>;
   2296     /**
   2297      * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.
   2298      *
   2299      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)
   2300      */
   2301     releaseLock(): void;
   2302 }
   2303 /**
   2304  * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
   2305  *
   2306  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
   2307  */
   2308 declare class ReadableStreamBYOBReader {
   2309     constructor(stream: ReadableStream);
   2310     get closed(): Promise<void>;
   2311     cancel(reason?: any): Promise<void>;
   2312     /**
   2313      * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
   2314      *
   2315      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
   2316      */
   2317     read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
   2318     /**
   2319      * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
   2320      *
   2321      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
   2322      */
   2323     releaseLock(): void;
   2324     readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;
   2325 }
   2326 interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
   2327     min?: number;
   2328 }
   2329 interface ReadableStreamGetReaderOptions {
   2330     /**
   2331      * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
   2332      *
   2333      * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
   2334      */
   2335     mode: "byob";
   2336 }
   2337 /**
   2338  * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).
   2339  *
   2340  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)
   2341  */
   2342 declare abstract class ReadableStreamBYOBRequest {
   2343     /**
   2344      * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.
   2345      *
   2346      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)
   2347      */
   2348     get view(): Uint8Array | null;
   2349     /**
   2350      * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.
   2351      *
   2352      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)
   2353      */
   2354     respond(bytesWritten: number): void;
   2355     /**
   2356      * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.
   2357      *
   2358      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)
   2359      */
   2360     respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
   2361     get atLeast(): number | null;
   2362 }
   2363 /**
   2364  * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
   2365  *
   2366  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
   2367  */
   2368 declare abstract class ReadableStreamDefaultController<R = any> {
   2369     /**
   2370      * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
   2371      *
   2372      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
   2373      */
   2374     get desiredSize(): number | null;
   2375     /**
   2376      * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.
   2377      *
   2378      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)
   2379      */
   2380     close(): void;
   2381     /**
   2382      * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
   2383      *
   2384      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
   2385      */
   2386     enqueue(chunk?: R): void;
   2387     /**
   2388      * The **`error()`** method of the with the associated stream to error.
   2389      *
   2390      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
   2391      */
   2392     error(reason: any): void;
   2393 }
   2394 /**
   2395  * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
   2396  *
   2397  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
   2398  */
   2399 declare abstract class ReadableByteStreamController {
   2400     /**
   2401      * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.
   2402      *
   2403      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)
   2404      */
   2405     get byobRequest(): ReadableStreamBYOBRequest | null;
   2406     /**
   2407      * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.
   2408      *
   2409      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)
   2410      */
   2411     get desiredSize(): number | null;
   2412     /**
   2413      * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.
   2414      *
   2415      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)
   2416      */
   2417     close(): void;
   2418     /**
   2419      * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).
   2420      *
   2421      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
   2422      */
   2423     enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
   2424     /**
   2425      * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.
   2426      *
   2427      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)
   2428      */
   2429     error(reason: any): void;
   2430 }
   2431 /**
   2432  * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
   2433  *
   2434  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
   2435  */
   2436 declare abstract class WritableStreamDefaultController {
   2437     /**
   2438      * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.
   2439      *
   2440      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)
   2441      */
   2442     get signal(): AbortSignal;
   2443     /**
   2444      * The **`error()`** method of the with the associated stream to error.
   2445      *
   2446      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
   2447      */
   2448     error(reason?: any): void;
   2449 }
   2450 /**
   2451  * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.
   2452  *
   2453  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)
   2454  */
   2455 declare abstract class TransformStreamDefaultController<O = any> {
   2456     /**
   2457      * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.
   2458      *
   2459      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)
   2460      */
   2461     get desiredSize(): number | null;
   2462     /**
   2463      * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.
   2464      *
   2465      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)
   2466      */
   2467     enqueue(chunk?: O): void;
   2468     /**
   2469      * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
   2470      *
   2471      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
   2472      */
   2473     error(reason: any): void;
   2474     /**
   2475      * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.
   2476      *
   2477      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)
   2478      */
   2479     terminate(): void;
   2480 }
   2481 interface ReadableWritablePair<R = any, W = any> {
   2482     readable: ReadableStream<R>;
   2483     /**
   2484      * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
   2485      *
   2486      * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
   2487      */
   2488     writable: WritableStream<W>;
   2489 }
   2490 /**
   2491  * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
   2492  *
   2493  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
   2494  */
   2495 declare class WritableStream<W = any> {
   2496     constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
   2497     /**
   2498      * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.
   2499      *
   2500      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)
   2501      */
   2502     get locked(): boolean;
   2503     /**
   2504      * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
   2505      *
   2506      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)
   2507      */
   2508     abort(reason?: any): Promise<void>;
   2509     /**
   2510      * The **`close()`** method of the WritableStream interface closes the associated stream.
   2511      *
   2512      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
   2513      */
   2514     close(): Promise<void>;
   2515     /**
   2516      * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
   2517      *
   2518      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
   2519      */
   2520     getWriter(): WritableStreamDefaultWriter<W>;
   2521 }
   2522 /**
   2523  * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.
   2524  *
   2525  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)
   2526  */
   2527 declare class WritableStreamDefaultWriter<W = any> {
   2528     constructor(stream: WritableStream);
   2529     /**
   2530      * The **`closed`** read-only property of the the stream errors or the writer's lock is released.
   2531      *
   2532      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
   2533      */
   2534     get closed(): Promise<void>;
   2535     /**
   2536      * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
   2537      *
   2538      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
   2539      */
   2540     get ready(): Promise<void>;
   2541     /**
   2542      * The **`desiredSize`** read-only property of the to fill the stream's internal queue.
   2543      *
   2544      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
   2545      */
   2546     get desiredSize(): number | null;
   2547     /**
   2548      * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
   2549      *
   2550      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
   2551      */
   2552     abort(reason?: any): Promise<void>;
   2553     /**
   2554      * The **`close()`** method of the stream.
   2555      *
   2556      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
   2557      */
   2558     close(): Promise<void>;
   2559     /**
   2560      * The **`write()`** method of the operation.
   2561      *
   2562      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
   2563      */
   2564     write(chunk?: W): Promise<void>;
   2565     /**
   2566      * The **`releaseLock()`** method of the corresponding stream.
   2567      *
   2568      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)
   2569      */
   2570     releaseLock(): void;
   2571 }
   2572 /**
   2573  * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.
   2574  *
   2575  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)
   2576  */
   2577 declare class TransformStream<I = any, O = any> {
   2578     constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
   2579     /**
   2580      * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
   2581      *
   2582      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
   2583      */
   2584     get readable(): ReadableStream<O>;
   2585     /**
   2586      * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
   2587      *
   2588      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
   2589      */
   2590     get writable(): WritableStream<I>;
   2591 }
   2592 declare class FixedLengthStream extends IdentityTransformStream {
   2593     constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);
   2594 }
   2595 declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
   2596     constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
   2597 }
   2598 interface IdentityTransformStreamQueuingStrategy {
   2599     highWaterMark?: (number | bigint);
   2600 }
   2601 interface ReadableStreamValuesOptions {
   2602     preventCancel?: boolean;
   2603 }
   2604 /**
   2605  * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
   2606  *
   2607  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
   2608  */
   2609 declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
   2610     constructor(format: "gzip" | "deflate" | "deflate-raw");
   2611 }
   2612 /**
   2613  * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
   2614  *
   2615  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
   2616  */
   2617 declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
   2618     constructor(format: "gzip" | "deflate" | "deflate-raw");
   2619 }
   2620 /**
   2621  * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
   2622  *
   2623  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
   2624  */
   2625 declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
   2626     constructor();
   2627     get encoding(): string;
   2628 }
   2629 /**
   2630  * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
   2631  *
   2632  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
   2633  */
   2634 declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {
   2635     constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
   2636     get encoding(): string;
   2637     get fatal(): boolean;
   2638     get ignoreBOM(): boolean;
   2639 }
   2640 interface TextDecoderStreamTextDecoderStreamInit {
   2641     fatal?: boolean;
   2642     ignoreBOM?: boolean;
   2643 }
   2644 /**
   2645  * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.
   2646  *
   2647  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)
   2648  */
   2649 declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {
   2650     constructor(init: QueuingStrategyInit);
   2651     /**
   2652      * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.
   2653      *
   2654      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)
   2655      */
   2656     get highWaterMark(): number;
   2657     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
   2658     get size(): (chunk?: any) => number;
   2659 }
   2660 /**
   2661  * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.
   2662  *
   2663  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
   2664  */
   2665 declare class CountQueuingStrategy implements QueuingStrategy {
   2666     constructor(init: QueuingStrategyInit);
   2667     /**
   2668      * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.
   2669      *
   2670      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)
   2671      */
   2672     get highWaterMark(): number;
   2673     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
   2674     get size(): (chunk?: any) => number;
   2675 }
   2676 interface QueuingStrategyInit {
   2677     /**
   2678      * Creates a new ByteLengthQueuingStrategy with the provided high water mark.
   2679      *
   2680      * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
   2681      */
   2682     highWaterMark: number;
   2683 }
   2684 interface TracePreviewInfo {
   2685     id: string;
   2686     slug: string;
   2687     name: string;
   2688 }
   2689 interface ScriptVersion {
   2690     id?: string;
   2691     tag?: string;
   2692     message?: string;
   2693 }
   2694 declare abstract class TailEvent extends ExtendableEvent {
   2695     readonly events: TraceItem[];
   2696     readonly traces: TraceItem[];
   2697 }
   2698 interface TraceItem {
   2699     readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;
   2700     readonly eventTimestamp: number | null;
   2701     readonly logs: TraceLog[];
   2702     readonly exceptions: TraceException[];
   2703     readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
   2704     readonly scriptName: string | null;
   2705     readonly entrypoint?: string;
   2706     readonly scriptVersion?: ScriptVersion;
   2707     readonly dispatchNamespace?: string;
   2708     readonly scriptTags?: string[];
   2709     readonly tailAttributes?: Record<string, boolean | number | string>;
   2710     readonly preview?: TracePreviewInfo;
   2711     readonly durableObjectId?: string;
   2712     readonly outcome: string;
   2713     readonly executionModel: string;
   2714     readonly truncated: boolean;
   2715     readonly cpuTime: number;
   2716     readonly wallTime: number;
   2717 }
   2718 interface TraceItemAlarmEventInfo {
   2719     readonly scheduledTime: Date;
   2720 }
   2721 interface TraceItemConnectEventInfo {
   2722 }
   2723 interface TraceItemCustomEventInfo {
   2724 }
   2725 interface TraceItemScheduledEventInfo {
   2726     readonly scheduledTime: number;
   2727     readonly cron: string;
   2728 }
   2729 interface TraceItemQueueEventInfo {
   2730     readonly queue: string;
   2731     readonly batchSize: number;
   2732 }
   2733 interface TraceItemEmailEventInfo {
   2734     readonly mailFrom: string;
   2735     readonly rcptTo: string;
   2736     readonly rawSize: number;
   2737 }
   2738 interface TraceItemTailEventInfo {
   2739     readonly consumedEvents: TraceItemTailEventInfoTailItem[];
   2740 }
   2741 interface TraceItemTailEventInfoTailItem {
   2742     readonly scriptName: string | null;
   2743 }
   2744 interface TraceItemFetchEventInfo {
   2745     readonly response?: TraceItemFetchEventInfoResponse;
   2746     readonly request: TraceItemFetchEventInfoRequest;
   2747 }
   2748 interface TraceItemFetchEventInfoRequest {
   2749     readonly cf?: any;
   2750     readonly headers: Record<string, string>;
   2751     readonly method: string;
   2752     readonly url: string;
   2753     getUnredacted(): TraceItemFetchEventInfoRequest;
   2754 }
   2755 interface TraceItemFetchEventInfoResponse {
   2756     readonly status: number;
   2757 }
   2758 interface TraceItemJsRpcEventInfo {
   2759     readonly rpcMethod: string;
   2760 }
   2761 interface TraceItemHibernatableWebSocketEventInfo {
   2762     readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;
   2763 }
   2764 interface TraceItemHibernatableWebSocketEventInfoMessage {
   2765     readonly webSocketEventType: string;
   2766 }
   2767 interface TraceItemHibernatableWebSocketEventInfoClose {
   2768     readonly webSocketEventType: string;
   2769     readonly code: number;
   2770     readonly wasClean: boolean;
   2771 }
   2772 interface TraceItemHibernatableWebSocketEventInfoError {
   2773     readonly webSocketEventType: string;
   2774 }
   2775 interface TraceLog {
   2776     readonly timestamp: number;
   2777     readonly level: string;
   2778     readonly message: any;
   2779 }
   2780 interface TraceException {
   2781     readonly timestamp: number;
   2782     readonly message: string;
   2783     readonly name: string;
   2784     readonly stack?: string;
   2785 }
   2786 interface TraceDiagnosticChannelEvent {
   2787     readonly timestamp: number;
   2788     readonly channel: string;
   2789     readonly message: any;
   2790 }
   2791 interface TraceMetrics {
   2792     readonly cpuTime: number;
   2793     readonly wallTime: number;
   2794 }
   2795 interface UnsafeTraceMetrics {
   2796     fromTrace(item: TraceItem): TraceMetrics;
   2797 }
   2798 /**
   2799  * The **`URL`** interface is used to parse, construct, normalize, and encode URL.
   2800  *
   2801  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
   2802  */
   2803 declare class URL {
   2804     constructor(url: string | URL, base?: string | URL);
   2805     /**
   2806      * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
   2807      *
   2808      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
   2809      */
   2810     get origin(): string;
   2811     /**
   2812      * The **`href`** property of the URL interface is a string containing the whole URL.
   2813      *
   2814      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
   2815      */
   2816     get href(): string;
   2817     /**
   2818      * The **`href`** property of the URL interface is a string containing the whole URL.
   2819      *
   2820      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
   2821      */
   2822     set href(value: string);
   2823     /**
   2824      * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
   2825      *
   2826      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
   2827      */
   2828     get protocol(): string;
   2829     /**
   2830      * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
   2831      *
   2832      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
   2833      */
   2834     set protocol(value: string);
   2835     /**
   2836      * The **`username`** property of the URL interface is a string containing the username component of the URL.
   2837      *
   2838      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
   2839      */
   2840     get username(): string;
   2841     /**
   2842      * The **`username`** property of the URL interface is a string containing the username component of the URL.
   2843      *
   2844      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
   2845      */
   2846     set username(value: string);
   2847     /**
   2848      * The **`password`** property of the URL interface is a string containing the password component of the URL.
   2849      *
   2850      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
   2851      */
   2852     get password(): string;
   2853     /**
   2854      * The **`password`** property of the URL interface is a string containing the password component of the URL.
   2855      *
   2856      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
   2857      */
   2858     set password(value: string);
   2859     /**
   2860      * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
   2861      *
   2862      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
   2863      */
   2864     get host(): string;
   2865     /**
   2866      * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
   2867      *
   2868      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
   2869      */
   2870     set host(value: string);
   2871     /**
   2872      * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
   2873      *
   2874      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
   2875      */
   2876     get hostname(): string;
   2877     /**
   2878      * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
   2879      *
   2880      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
   2881      */
   2882     set hostname(value: string);
   2883     /**
   2884      * The **`port`** property of the URL interface is a string containing the port number of the URL.
   2885      *
   2886      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
   2887      */
   2888     get port(): string;
   2889     /**
   2890      * The **`port`** property of the URL interface is a string containing the port number of the URL.
   2891      *
   2892      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
   2893      */
   2894     set port(value: string);
   2895     /**
   2896      * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
   2897      *
   2898      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
   2899      */
   2900     get pathname(): string;
   2901     /**
   2902      * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
   2903      *
   2904      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
   2905      */
   2906     set pathname(value: string);
   2907     /**
   2908      * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
   2909      *
   2910      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
   2911      */
   2912     get search(): string;
   2913     /**
   2914      * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
   2915      *
   2916      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
   2917      */
   2918     set search(value: string);
   2919     /**
   2920      * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
   2921      *
   2922      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
   2923      */
   2924     get hash(): string;
   2925     /**
   2926      * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
   2927      *
   2928      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
   2929      */
   2930     set hash(value: string);
   2931     /**
   2932      * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
   2933      *
   2934      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
   2935      */
   2936     get searchParams(): URLSearchParams;
   2937     /**
   2938      * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
   2939      *
   2940      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
   2941      */
   2942     toJSON(): string;
   2943     /*function toString() { [native code] }*/
   2944     toString(): string;
   2945     /**
   2946      * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.
   2947      *
   2948      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
   2949      */
   2950     static canParse(url: string, base?: string): boolean;
   2951     /**
   2952      * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
   2953      *
   2954      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
   2955      */
   2956     static parse(url: string, base?: string): URL | null;
   2957     /**
   2958      * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
   2959      *
   2960      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
   2961      */
   2962     static createObjectURL(object: File | Blob): string;
   2963     /**
   2964      * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
   2965      *
   2966      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
   2967      */
   2968     static revokeObjectURL(object_url: string): void;
   2969 }
   2970 /**
   2971  * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
   2972  *
   2973  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
   2974  */
   2975 declare class URLSearchParams {
   2976     constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));
   2977     /**
   2978      * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
   2979      *
   2980      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)
   2981      */
   2982     get size(): number;
   2983     /**
   2984      * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
   2985      *
   2986      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
   2987      */
   2988     append(name: string, value: string): void;
   2989     /**
   2990      * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.
   2991      *
   2992      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
   2993      */
   2994     delete(name: string, value?: string): void;
   2995     /**
   2996      * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.
   2997      *
   2998      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
   2999      */
   3000     get(name: string): string | null;
   3001     /**
   3002      * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
   3003      *
   3004      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
   3005      */
   3006     getAll(name: string): string[];
   3007     /**
   3008      * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.
   3009      *
   3010      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
   3011      */
   3012     has(name: string, value?: string): boolean;
   3013     /**
   3014      * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
   3015      *
   3016      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
   3017      */
   3018     set(name: string, value: string): void;
   3019     /**
   3020      * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
   3021      *
   3022      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
   3023      */
   3024     sort(): void;
   3025     /* Returns an array of key, value pairs for every entry in the search params. */
   3026     entries(): IterableIterator<[
   3027         key: string,
   3028         value: string
   3029     ]>;
   3030     /* Returns a list of keys in the search params. */
   3031     keys(): IterableIterator<string>;
   3032     /* Returns a list of values in the search params. */
   3033     values(): IterableIterator<string>;
   3034     forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
   3035     /*function toString() { [native code] }*/
   3036     toString(): string;
   3037     [Symbol.iterator](): IterableIterator<[
   3038         key: string,
   3039         value: string
   3040     ]>;
   3041 }
   3042 declare class URLPattern {
   3043     constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);
   3044     get protocol(): string;
   3045     get username(): string;
   3046     get password(): string;
   3047     get hostname(): string;
   3048     get port(): string;
   3049     get pathname(): string;
   3050     get search(): string;
   3051     get hash(): string;
   3052     get hasRegExpGroups(): boolean;
   3053     test(input?: (string | URLPatternInit), baseURL?: string): boolean;
   3054     exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;
   3055 }
   3056 interface URLPatternInit {
   3057     protocol?: string;
   3058     username?: string;
   3059     password?: string;
   3060     hostname?: string;
   3061     port?: string;
   3062     pathname?: string;
   3063     search?: string;
   3064     hash?: string;
   3065     baseURL?: string;
   3066 }
   3067 interface URLPatternComponentResult {
   3068     input: string;
   3069     groups: Record<string, string>;
   3070 }
   3071 interface URLPatternResult {
   3072     inputs: (string | URLPatternInit)[];
   3073     protocol: URLPatternComponentResult;
   3074     username: URLPatternComponentResult;
   3075     password: URLPatternComponentResult;
   3076     hostname: URLPatternComponentResult;
   3077     port: URLPatternComponentResult;
   3078     pathname: URLPatternComponentResult;
   3079     search: URLPatternComponentResult;
   3080     hash: URLPatternComponentResult;
   3081 }
   3082 interface URLPatternOptions {
   3083     ignoreCase?: boolean;
   3084 }
   3085 /**
   3086  * A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
   3087  *
   3088  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
   3089  */
   3090 declare class CloseEvent extends Event {
   3091     constructor(type: string, initializer?: CloseEventInit);
   3092     /**
   3093      * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
   3094      *
   3095      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
   3096      */
   3097     readonly code: number;
   3098     /**
   3099      * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
   3100      *
   3101      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
   3102      */
   3103     readonly reason: string;
   3104     /**
   3105      * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.
   3106      *
   3107      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
   3108      */
   3109     readonly wasClean: boolean;
   3110 }
   3111 interface CloseEventInit {
   3112     code?: number;
   3113     reason?: string;
   3114     wasClean?: boolean;
   3115 }
   3116 type WebSocketEventMap = {
   3117     close: CloseEvent;
   3118     message: MessageEvent;
   3119     open: Event;
   3120     error: ErrorEvent;
   3121 };
   3122 /**
   3123  * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
   3124  *
   3125  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
   3126  */
   3127 declare var WebSocket: {
   3128     prototype: WebSocket;
   3129     new (url: string, protocols?: (string[] | string)): WebSocket;
   3130     readonly READY_STATE_CONNECTING: number;
   3131     readonly CONNECTING: number;
   3132     readonly READY_STATE_OPEN: number;
   3133     readonly OPEN: number;
   3134     readonly READY_STATE_CLOSING: number;
   3135     readonly CLOSING: number;
   3136     readonly READY_STATE_CLOSED: number;
   3137     readonly CLOSED: number;
   3138 };
   3139 /**
   3140  * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
   3141  *
   3142  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
   3143  */
   3144 interface WebSocket extends EventTarget<WebSocketEventMap> {
   3145     accept(options?: WebSocketAcceptOptions): void;
   3146     /**
   3147      * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
   3148      *
   3149      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
   3150      */
   3151     send(message: (ArrayBuffer | ArrayBufferView) | string): void;
   3152     /**
   3153      * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
   3154      *
   3155      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
   3156      */
   3157     close(code?: number, reason?: string): void;
   3158     serializeAttachment(attachment: any): void;
   3159     deserializeAttachment(): any | null;
   3160     /**
   3161      * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.
   3162      *
   3163      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
   3164      */
   3165     readyState: number;
   3166     /**
   3167      * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
   3168      *
   3169      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
   3170      */
   3171     url: string | null;
   3172     /**
   3173      * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.
   3174      *
   3175      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
   3176      */
   3177     protocol: string | null;
   3178     /**
   3179      * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
   3180      *
   3181      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
   3182      */
   3183     extensions: string | null;
   3184     /**
   3185      * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
   3186      *
   3187      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)
   3188      */
   3189     binaryType: "blob" | "arraybuffer";
   3190 }
   3191 interface WebSocketAcceptOptions {
   3192     /**
   3193      * When set to `true`, receiving a server-initiated WebSocket Close frame will not
   3194      * automatically send a reciprocal Close frame, leaving the connection in a half-open
   3195      * state. This is useful for proxying scenarios where you need to coordinate closing
   3196      * both sides independently. Defaults to `false` when the
   3197      * `no_web_socket_half_open_by_default` compatibility flag is enabled.
   3198      */
   3199     allowHalfOpen?: boolean;
   3200 }
   3201 declare const WebSocketPair: {
   3202     new (): {
   3203         0: WebSocket;
   3204         1: WebSocket;
   3205     };
   3206 };
   3207 interface SqlStorage {
   3208     exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;
   3209     get databaseSize(): number;
   3210     Cursor: typeof SqlStorageCursor;
   3211     Statement: typeof SqlStorageStatement;
   3212 }
   3213 declare abstract class SqlStorageStatement {
   3214 }
   3215 type SqlStorageValue = ArrayBuffer | string | number | null;
   3216 declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {
   3217     next(): {
   3218         done?: false;
   3219         value: T;
   3220     } | {
   3221         done: true;
   3222         value?: never;
   3223     };
   3224     toArray(): T[];
   3225     one(): T;
   3226     raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
   3227     columnNames: string[];
   3228     get rowsRead(): number;
   3229     get rowsWritten(): number;
   3230     [Symbol.iterator](): IterableIterator<T>;
   3231 }
   3232 interface Socket {
   3233     get readable(): ReadableStream;
   3234     get writable(): WritableStream;
   3235     get closed(): Promise<void>;
   3236     get opened(): Promise<SocketInfo>;
   3237     get upgraded(): boolean;
   3238     get secureTransport(): "on" | "off" | "starttls";
   3239     close(): Promise<void>;
   3240     startTls(options?: TlsOptions): Socket;
   3241 }
   3242 interface SocketOptions {
   3243     secureTransport?: string;
   3244     allowHalfOpen: boolean;
   3245     highWaterMark?: (number | bigint);
   3246 }
   3247 interface SocketAddress {
   3248     hostname: string;
   3249     port: number;
   3250 }
   3251 interface TlsOptions {
   3252     expectedServerHostname?: string;
   3253 }
   3254 interface SocketInfo {
   3255     remoteAddress?: string;
   3256     localAddress?: string;
   3257 }
   3258 /**
   3259  * The **`EventSource`** interface is web content's interface to server-sent events.
   3260  *
   3261  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
   3262  */
   3263 declare class EventSource extends EventTarget {
   3264     constructor(url: string, init?: EventSourceEventSourceInit);
   3265     /**
   3266      * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
   3267      *
   3268      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
   3269      */
   3270     close(): void;
   3271     /**
   3272      * The **`url`** read-only property of the URL of the source.
   3273      *
   3274      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
   3275      */
   3276     get url(): string;
   3277     /**
   3278      * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
   3279      *
   3280      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
   3281      */
   3282     get withCredentials(): boolean;
   3283     /**
   3284      * The **`readyState`** read-only property of the connection.
   3285      *
   3286      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
   3287      */
   3288     get readyState(): number;
   3289     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
   3290     get onopen(): any | null;
   3291     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
   3292     set onopen(value: any | null);
   3293     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
   3294     get onmessage(): any | null;
   3295     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
   3296     set onmessage(value: any | null);
   3297     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
   3298     get onerror(): any | null;
   3299     /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
   3300     set onerror(value: any | null);
   3301     static readonly CONNECTING: number;
   3302     static readonly OPEN: number;
   3303     static readonly CLOSED: number;
   3304     static from(stream: ReadableStream): EventSource;
   3305 }
   3306 interface EventSourceEventSourceInit {
   3307     withCredentials?: boolean;
   3308     fetcher?: Fetcher;
   3309 }
   3310 interface ExecOutput {
   3311     readonly stdout: ArrayBuffer;
   3312     readonly stderr: ArrayBuffer;
   3313     readonly exitCode: number;
   3314 }
   3315 interface ContainerExecOptions {
   3316     cwd?: string;
   3317     env?: Record<string, string>;
   3318     user?: string;
   3319     stdin?: ReadableStream | "pipe";
   3320     stdout?: "pipe" | "ignore";
   3321     stderr?: "pipe" | "ignore" | "combined";
   3322 }
   3323 interface ExecProcess {
   3324     readonly stdin: WritableStream | null;
   3325     readonly stdout: ReadableStream | null;
   3326     readonly stderr: ReadableStream | null;
   3327     readonly pid: number;
   3328     readonly exitCode: Promise<number>;
   3329     output(): Promise<ExecOutput>;
   3330     kill(signal?: number): void;
   3331 }
   3332 interface Container {
   3333     get running(): boolean;
   3334     start(options?: ContainerStartupOptions): void;
   3335     monitor(): Promise<void>;
   3336     destroy(error?: any): Promise<void>;
   3337     signal(signo: number): void;
   3338     getTcpPort(port: number): Fetcher;
   3339     setInactivityTimeout(durationMs: number | bigint): Promise<void>;
   3340     interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
   3341     interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
   3342     snapshotDirectory(options: ContainerDirectorySnapshotOptions): Promise<ContainerDirectorySnapshot>;
   3343     snapshotContainer(options: ContainerSnapshotOptions): Promise<ContainerSnapshot>;
   3344     interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
   3345     exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
   3346 }
   3347 interface ContainerDirectorySnapshot {
   3348     id: string;
   3349     size: number;
   3350     dir: string;
   3351     name?: string;
   3352 }
   3353 interface ContainerDirectorySnapshotOptions {
   3354     dir: string;
   3355     name?: string;
   3356 }
   3357 interface ContainerDirectorySnapshotRestoreParams {
   3358     snapshot: ContainerDirectorySnapshot;
   3359     mountPoint?: string;
   3360 }
   3361 interface ContainerSnapshot {
   3362     id: string;
   3363     size: number;
   3364     name?: string;
   3365 }
   3366 interface ContainerSnapshotOptions {
   3367     name?: string;
   3368 }
   3369 interface ContainerStartupOptions {
   3370     entrypoint?: string[];
   3371     enableInternet: boolean;
   3372     env?: Record<string, string>;
   3373     labels?: Record<string, string>;
   3374     directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
   3375     containerSnapshot?: ContainerSnapshot;
   3376 }
   3377 /**
   3378  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
   3379  *
   3380  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
   3381  */
   3382 declare abstract class MessagePort extends EventTarget {
   3383     /**
   3384      * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
   3385      *
   3386      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
   3387      */
   3388     postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
   3389     /**
   3390      * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
   3391      *
   3392      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
   3393      */
   3394     close(): void;
   3395     /**
   3396      * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
   3397      *
   3398      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
   3399      */
   3400     start(): void;
   3401     get onmessage(): any | null;
   3402     set onmessage(value: any | null);
   3403 }
   3404 /**
   3405  * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
   3406  *
   3407  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
   3408  */
   3409 declare class MessageChannel {
   3410     constructor();
   3411     /**
   3412      * The **`port1`** read-only property of the the port attached to the context that originated the channel.
   3413      *
   3414      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
   3415      */
   3416     readonly port1: MessagePort;
   3417     /**
   3418      * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
   3419      *
   3420      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
   3421      */
   3422     readonly port2: MessagePort;
   3423 }
   3424 interface MessagePortPostMessageOptions {
   3425     transfer?: any[];
   3426 }
   3427 type LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;
   3428 type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {
   3429     props?: Props;
   3430 }) => Fetcher<T> : (opts: {
   3431     props?: any;
   3432 }) => Fetcher<T>);
   3433 type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {
   3434     props?: Props;
   3435 }) => DurableObjectClass<T> : (opts: {
   3436     props?: any;
   3437 }) => DurableObjectClass<T>);
   3438 interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {
   3439 }
   3440 interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {
   3441 }
   3442 interface SyncKvStorage {
   3443     get<T = unknown>(key: string): T | undefined;
   3444     list<T = unknown>(options?: SyncKvListOptions): Iterable<[
   3445         string,
   3446         T
   3447     ]>;
   3448     put<T>(key: string, value: T): void;
   3449     delete(key: string): boolean;
   3450 }
   3451 interface SyncKvListOptions {
   3452     start?: string;
   3453     startAfter?: string;
   3454     end?: string;
   3455     prefix?: string;
   3456     reverse?: boolean;
   3457     limit?: number;
   3458 }
   3459 interface WorkerStub {
   3460     getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;
   3461     getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): DurableObjectClass<T>;
   3462 }
   3463 interface WorkerStubEntrypointOptions {
   3464     props?: any;
   3465     limits?: workerdResourceLimits;
   3466 }
   3467 interface WorkerLoader {
   3468     get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;
   3469     load(code: WorkerLoaderWorkerCode): WorkerStub;
   3470 }
   3471 interface WorkerLoaderModule {
   3472     js?: string;
   3473     cjs?: string;
   3474     text?: string;
   3475     data?: ArrayBuffer;
   3476     json?: any;
   3477     py?: string;
   3478     wasm?: ArrayBuffer;
   3479 }
   3480 interface WorkerLoaderWorkerCode {
   3481     compatibilityDate: string;
   3482     compatibilityFlags?: string[];
   3483     allowExperimental?: boolean;
   3484     limits?: workerdResourceLimits;
   3485     mainModule: string;
   3486     modules: Record<string, WorkerLoaderModule | string>;
   3487     env?: any;
   3488     globalOutbound?: (Fetcher | null);
   3489     tails?: Fetcher[];
   3490     streamingTails?: Fetcher[];
   3491 }
   3492 interface workerdResourceLimits {
   3493     cpuMs?: number;
   3494     subRequests?: number;
   3495 }
   3496 /**
   3497 * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
   3498 * as well as timing of subrequests and other operations.
   3499 *
   3500 * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
   3501 */
   3502 declare abstract class Performance {
   3503     /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
   3504     get timeOrigin(): number;
   3505     /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
   3506     now(): number;
   3507     /**
   3508      * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
   3509      *
   3510      * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
   3511      */
   3512     toJSON(): object;
   3513 }
   3514 interface Tracing {
   3515     enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
   3516     startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
   3517     Span: typeof Span;
   3518 }
   3519 declare abstract class Span {
   3520     get isTraced(): boolean;
   3521     setAttribute(key: string, value?: (boolean | number | string)): void;
   3522     end(): void;
   3523 }
   3524 /**
   3525  * Represents the identity of a user authenticated via Cloudflare Access.
   3526  * This matches the result of calling /cdn-cgi/access/get-identity.
   3527  *
   3528  * The exact structure of the returned object depends on the identity provider
   3529  * configuration for the Access application. The fields below represent commonly
   3530  * available properties, but additional provider-specific fields may be present.
   3531  */
   3532 interface CloudflareAccessIdentity extends Record<string, unknown> {
   3533     /** The user's email address, if available from the identity provider. */
   3534     email?: string;
   3535     /** The user's display name. */
   3536     name?: string;
   3537     /** The user's unique identifier. */
   3538     user_uuid?: string;
   3539     /** The Cloudflare account ID. */
   3540     account_id?: string;
   3541     /** Login timestamp (Unix epoch seconds). */
   3542     iat?: number;
   3543     /** The user's IP address at authentication time. */
   3544     ip?: string;
   3545     /** Authentication methods used (e.g., "pwd"). */
   3546     amr?: string[];
   3547     /** Identity provider information. */
   3548     idp?: {
   3549         id: string;
   3550         type: string;
   3551     };
   3552     /** Geographic information about where the user authenticated. */
   3553     geo?: {
   3554         country: string;
   3555     };
   3556     /** Group memberships from the identity provider. */
   3557     groups?: Array<{
   3558         id: string;
   3559         name: string;
   3560         email?: string;
   3561     }>;
   3562     /** Device posture check results, keyed by check ID. */
   3563     devicePosture?: Record<string, unknown>;
   3564     /** True if the user connected via Cloudflare WARP. */
   3565     is_warp?: boolean;
   3566     /** True if the user is authenticated via Cloudflare Gateway. */
   3567     is_gateway?: boolean;
   3568 }
   3569 // ============================================================================
   3570 // Agent Memory
   3571 //
   3572 // Public type surface for user Workers binding to an Agent Memory namespace.
   3573 // ============================================================================
   3574 /** Memory type — every memory is classified into exactly one. */
   3575 type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";
   3576 /** Search intensity for recall. */
   3577 type AgentMemoryThinkingLevel = "low" | "medium" | "high";
   3578 /** Response verbosity for recall. */
   3579 type AgentMemoryResponseLength = "short" | "medium" | "long";
   3580 /** A conversation message passed to ingest(). */
   3581 interface AgentMemoryMessage {
   3582     role: "system" | "user" | "assistant";
   3583     content: string;
   3584     /** Optional message timestamp. */
   3585     timestamp?: Date;
   3586 }
   3587 /** Raw memory content passed to remember(). */
   3588 interface AgentMemoryIncomingMemory {
   3589     /** Raw memory content. The service classifies and summarizes automatically. */
   3590     content: string;
   3591     /** Optional session identifier to associate with this memory. */
   3592     sessionId?: string | null | undefined;
   3593 }
   3594 /** A stored memory returned from remember(), get(), and delete(). */
   3595 interface AgentMemoryMemory {
   3596     /** Memory ID. */
   3597     id: string;
   3598     /** Memory type. */
   3599     type: AgentMemoryMemoryType;
   3600     /** Text summary. */
   3601     summary: string;
   3602     /** Memory text. */
   3603     content: string;
   3604     /** Session that created this memory. */
   3605     sessionId: string | null;
   3606     /** Memory creation time. */
   3607     createdAt: Date;
   3608     /** Memory last-update time. */
   3609     updatedAt: Date;
   3610 }
   3611 /** Single entry in a list() response. Same shape as Memory minus full content. */
   3612 type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;
   3613 /** A scored memory candidate in a recall result. */
   3614 interface AgentMemoryScoredCandidate {
   3615     /** Candidate ID. */
   3616     id: string;
   3617     /** Text summary. */
   3618     summary: string;
   3619     /** Session that created this candidate, when known. */
   3620     sessionId: string | null;
   3621     /** Relevance score (higher is better). Comparable only within a single query. */
   3622     score: number;
   3623 }
   3624 /** Options for the ingest() method. */
   3625 interface AgentMemoryIngestOptions {
   3626     /** Session identifier to associate with memories created during ingestion. */
   3627     sessionId?: string | null | undefined;
   3628 }
   3629 /** Options for the getSummary() method. */
   3630 interface AgentMemoryGetSummaryOptions {
   3631     /** Session identifier to retrieve session summary for. */
   3632     sessionId?: string | null | undefined;
   3633 }
   3634 /** Response from the getSummary() method. */
   3635 interface AgentMemoryGetSummaryResponse {
   3636     /** Markdown summary. */
   3637     summary: string;
   3638 }
   3639 /**
   3640  * Options for the recall() method.
   3641  *
   3642  * `referenceDate` accepts a Date object, an ISO-8601 date string
   3643  * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this
   3644  * date is used as "today" for resolving relative time references
   3645  * ("how many days ago", "last week") instead of the server's wall-clock time.
   3646  */
   3647 interface AgentMemoryRecallOptions {
   3648     /** Recall intensity: "low" (default), "medium", or "high". */
   3649     thinkingLevel?: AgentMemoryThinkingLevel;
   3650     /** Response verbosity: "short", "medium" (default), or "long". */
   3651     responseLength?: AgentMemoryResponseLength;
   3652     /** Temporal anchor for date arithmetic. */
   3653     referenceDate?: Date | string;
   3654 }
   3655 /** Response from the recall() method. */
   3656 interface AgentMemoryRecallResult {
   3657     /** Number of memories retrieved. */
   3658     count: number;
   3659     /** LLM-generated answer synthesizing the matching memories. */
   3660     answer: string;
   3661     /** Matching memories ranked by relevance. */
   3662     candidates: AgentMemoryScoredCandidate[];
   3663 }
   3664 /**
   3665  * Options for the list() method.
   3666  *
   3667  * `cursor` is the opaque continuation token returned by the previous page;
   3668  * pass it back unchanged to fetch the next page. `sessionId` and `type`
   3669  * are exact-match filters; combining them is allowed.
   3670  */
   3671 interface AgentMemoryListMemoriesOptions {
   3672     /** Maximum number of memories to return. Default 20, max 500. */
   3673     limit?: number;
   3674     /** Opaque cursor from a previous page. */
   3675     cursor?: string;
   3676     /** Exact-match session filter. */
   3677     sessionId?: string;
   3678     /** Exact-match memory-type filter. */
   3679     type?: AgentMemoryMemoryType;
   3680 }
   3681 /** Response from the list() method. */
   3682 interface AgentMemoryListMemoriesResult {
   3683     memories: AgentMemoryMemoryListEntry[];
   3684     /** Continuation cursor; absent when this page exhausted the result set. */
   3685     cursor?: string;
   3686 }
   3687 /**
   3688  * A single Agent Memory profile, scoped to a profile name.
   3689  *
   3690  * Returned by {@link AgentMemoryNamespace.getProfile}.
   3691  */
   3692 declare abstract class AgentMemoryProfile {
   3693     /**
   3694      * Retrieve a memory by ID.
   3695      *
   3696      * @param memoryId - ULID of the memory to retrieve.
   3697      * @throws if the memory does not exist.
   3698      */
   3699     get(memoryId: string): Promise<AgentMemoryMemory>;
   3700     /**
   3701      * Delete a memory by ID.
   3702      *
   3703      * Removes the memory and any source messages linked by the memory's
   3704      * source message IDs.
   3705      *
   3706      * @param memoryId - ULID of the memory to delete.
   3707      * @throws if the memory does not exist.
   3708      */
   3709     delete(memoryId: string): Promise<AgentMemoryMemory>;
   3710     /**
   3711      * Store a memory in this profile. The content is automatically classified,
   3712      * summarized, and indexed.
   3713      *
   3714      * @param memory - Raw memory content to persist.
   3715      */
   3716     remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;
   3717     /**
   3718      * Extract memories from a conversation.
   3719      *
   3720      * @param messages - Conversation messages to extract memories from.
   3721      * @param options  - Optional ingest options.
   3722      */
   3723     ingest(messages: Iterable<AgentMemoryMessage>, options?: AgentMemoryIngestOptions): Promise<void>;
   3724     /**
   3725      * Get a profile summary.
   3726      *
   3727      * @param options - Optional getSummary options.
   3728      */
   3729     getSummary(options?: AgentMemoryGetSummaryOptions): Promise<AgentMemoryGetSummaryResponse>;
   3730     /**
   3731      * Recall memories in this profile.
   3732      *
   3733      * @param query   - Recall query matched against memory content and keywords.
   3734      * @param options - Optional recall parameters.
   3735      * @returns Matching memories with relevance scores and a synthesized answer.
   3736      */
   3737     recall(query: string, options?: AgentMemoryRecallOptions): Promise<AgentMemoryRecallResult>;
   3738     /**
   3739      * List active memories in this profile.
   3740      *
   3741      * Returns a paginated, filterable view of stored memories. Superseded
   3742      * versions are excluded. Use the returned `cursor` (when present) to
   3743      * fetch the next page.
   3744      *
   3745      * @param options - Optional pagination and filter options.
   3746      */
   3747     list(options?: AgentMemoryListMemoriesOptions): Promise<AgentMemoryListMemoriesResult>;
   3748     /**
   3749      * Soft-delete every memory and message in this profile that is tagged
   3750      * with `sessionId`.
   3751      *
   3752      * Idempotent: deleting a sessionId that has no rows is a no-op.
   3753      *
   3754      * @param sessionId - Session to delete.
   3755      */
   3756     deleteSession(sessionId: string): Promise<void>;
   3757 }
   3758 /**
   3759  * Namespace-level Agent Memory binding.
   3760  *
   3761  * Used as the type of an `env.MEMORY`-style binding backed by the Agent
   3762  * Memory product.
   3763  *
   3764  * @example
   3765  * ```ts
   3766  * export default {
   3767  *   async fetch(_request: Request, env: Env): Promise<Response> {
   3768  *     const profile = await env.MEMORY.getProfile("wrangler-e2e");
   3769  *     const summary = await profile.getSummary();
   3770  *     return Response.json(summary);
   3771  *   },
   3772  * };
   3773  * ```
   3774  */
   3775 declare abstract class AgentMemoryNamespace {
   3776     /**
   3777      * Get a memory profile by name. Profiles are isolated by namespace and
   3778      * addressed by a compound key (namespaceId:profileName).
   3779      *
   3780      * @param profileName - Profile name (validated against naming rules).
   3781      * @returns RPC target for interacting with the profile.
   3782      */
   3783     getProfile(profileName: string): Promise<AgentMemoryProfile>;
   3784     /**
   3785      * Soft-delete a profile and schedule deferred purge. Marks all
   3786      * memories and messages as deleted.
   3787      *
   3788      * @param profileName - Name of the profile to delete.
   3789      */
   3790     deleteProfile(profileName: string): Promise<void>;
   3791 }
   3792 // ============ AI Search Error Interfaces ============
   3793 interface AiSearchInternalError extends Error {
   3794 }
   3795 interface AiSearchNotFoundError extends Error {
   3796 }
   3797 // ============ AI Search Common Types ============
   3798 /** A single message in a conversation-style search or chat request. */
   3799 type AiSearchMessage = {
   3800     role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
   3801     content: string | null;
   3802 };
   3803 /**
   3804  * Common shape for `ai_search_options` used by both single-instance and multi-instance requests.
   3805  * Contains retrieval, query rewrite, reranking, and cache sub-options.
   3806  */
   3807 type AiSearchOptions = {
   3808     retrieval?: {
   3809         /** Which retrieval backend to use. Defaults to the instance's configured index_method. */
   3810         retrieval_type?: 'vector' | 'keyword' | 'hybrid';
   3811         /** Fusion method for combining vector + keyword results. */
   3812         fusion_method?: 'max' | 'rrf';
   3813         /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */
   3814         keyword_match_mode?: 'and' | 'or';
   3815         /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */
   3816         match_threshold?: number;
   3817         /** Maximum number of results to return (1-50). Default 10. */
   3818         max_num_results?: number;
   3819         /** Vectorize metadata filters applied to the search. */
   3820         filters?: VectorizeVectorMetadataFilter;
   3821         /** Number of surrounding chunks to include for context (0-3). Default 0. */
   3822         context_expansion?: number;
   3823         /** If true, return only item metadata without chunk text. */
   3824         metadata_only?: boolean;
   3825         /** If true (default), return empty results on retrieval failure instead of throwing. */
   3826         return_on_failure?: boolean;
   3827         /** Boost results by metadata field values. Max 3 entries. */
   3828         boost_by?: Array<{
   3829             field: string;
   3830             direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
   3831         }>;
   3832         [key: string]: unknown;
   3833     };
   3834     query_rewrite?: {
   3835         enabled?: boolean;
   3836         model?: string;
   3837         rewrite_prompt?: string;
   3838         [key: string]: unknown;
   3839     };
   3840     reranking?: {
   3841         enabled?: boolean;
   3842         model?: string;
   3843         /** Match threshold (0-1, default 0.4) */
   3844         match_threshold?: number;
   3845         [key: string]: unknown;
   3846     };
   3847     cache?: {
   3848         enabled?: boolean;
   3849         cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';
   3850     };
   3851     [key: string]: unknown;
   3852 };
   3853 // ============ AI Search Request Types ============
   3854 /**
   3855  * Request body for single-instance search.
   3856  * Exactly one of `query` or `messages` must be provided.
   3857  */
   3858 type AiSearchSearchRequest = {
   3859     /** Simple query string. */
   3860     query: string;
   3861     messages?: never;
   3862     ai_search_options?: AiSearchOptions;
   3863 } | {
   3864     query?: never;
   3865     /** Conversation-style input. At least one user message with non-empty content is required. */
   3866     messages: AiSearchMessage[];
   3867     ai_search_options?: AiSearchOptions;
   3868 };
   3869 type AiSearchChatCompletionsRequest = {
   3870     messages: AiSearchMessage[];
   3871     model?: string;
   3872     stream?: boolean;
   3873     ai_search_options?: AiSearchOptions;
   3874     [key: string]: unknown;
   3875 };
   3876 // ============ AI Search Multi-Instance Types (Namespace-Scoped) ============
   3877 /** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */
   3878 type AiSearchMultiSearchOptions = AiSearchOptions & {
   3879     /** Instance IDs to search across (1-10). */
   3880     instance_ids: string[];
   3881 };
   3882 /**
   3883  * Request for searching across multiple instances within a namespace.
   3884  * `ai_search_options` is required and must include `instance_ids`.
   3885  * Exactly one of `query` or `messages` must be provided.
   3886  */
   3887 type AiSearchMultiSearchRequest = {
   3888     /** Simple query string. */
   3889     query: string;
   3890     messages?: never;
   3891     ai_search_options: AiSearchMultiSearchOptions;
   3892 } | {
   3893     query?: never;
   3894     /** Conversation-style input. */
   3895     messages: AiSearchMessage[];
   3896     ai_search_options: AiSearchMultiSearchOptions;
   3897 };
   3898 /** A search result chunk tagged with the instance it originated from. */
   3899 type AiSearchMultiSearchChunk = AiSearchSearchResponse['chunks'][number] & {
   3900     instance_id: string;
   3901 };
   3902 /** Describes a per-instance error during a multi-instance operation. */
   3903 type AiSearchMultiSearchError = {
   3904     instance_id: string;
   3905     message: string;
   3906 };
   3907 /** Response from a multi-instance search, with chunks tagged by instance and optional partial-failure errors. */
   3908 type AiSearchMultiSearchResponse = {
   3909     search_query: string;
   3910     chunks: AiSearchMultiSearchChunk[];
   3911     errors?: AiSearchMultiSearchError[];
   3912 };
   3913 /** Request for chat completions across multiple instances within a namespace. `ai_search_options` is required and must include `instance_ids`. */
   3914 type AiSearchMultiChatCompletionsRequest = Omit<AiSearchChatCompletionsRequest, 'ai_search_options'> & {
   3915     ai_search_options: AiSearchMultiSearchOptions;
   3916 };
   3917 /** Response from multi-instance chat completions, with chunks tagged by instance and optional partial-failure errors. */
   3918 type AiSearchMultiChatCompletionsResponse = Omit<AiSearchChatCompletionsResponse, 'chunks'> & {
   3919     chunks: AiSearchMultiSearchChunk[];
   3920     errors?: AiSearchMultiSearchError[];
   3921 };
   3922 // ============ AI Search Response Types ============
   3923 type AiSearchSearchResponse = {
   3924     search_query: string;
   3925     chunks: Array<{
   3926         id: string;
   3927         type: string;
   3928         /** Match score (0-1) */
   3929         score: number;
   3930         text: string;
   3931         item: {
   3932             timestamp?: number;
   3933             key: string;
   3934             metadata?: Record<string, unknown>;
   3935         };
   3936         scoring_details?: {
   3937             /** Keyword match score (0-1) */
   3938             keyword_score?: number;
   3939             /** Vector similarity score (0-1) */
   3940             vector_score?: number;
   3941             /** Keyword rank position */
   3942             keyword_rank?: number;
   3943             /** Vector rank position */
   3944             vector_rank?: number;
   3945             /** Reranking model score */
   3946             reranking_score?: number;
   3947             /** Fusion method used to combine results */
   3948             fusion_method?: 'rrf' | 'max';
   3949             [key: string]: unknown;
   3950         };
   3951     }>;
   3952 };
   3953 type AiSearchChatCompletionsResponse = {
   3954     id?: string;
   3955     object?: string;
   3956     model?: string;
   3957     choices: Array<{
   3958         index?: number;
   3959         message: {
   3960             role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
   3961             content: string | null;
   3962             [key: string]: unknown;
   3963         };
   3964         [key: string]: unknown;
   3965     }>;
   3966     chunks: AiSearchSearchResponse['chunks'];
   3967     [key: string]: unknown;
   3968 };
   3969 type AiSearchStatsResponse = {
   3970     queued?: number;
   3971     running?: number;
   3972     completed?: number;
   3973     error?: number;
   3974     skipped?: number;
   3975     outdated?: number;
   3976     last_activity?: string;
   3977     /** Storage engine statistics. */
   3978     engine?: {
   3979         vectorize?: {
   3980             vectorsCount: number;
   3981             dimensions: number;
   3982         };
   3983         r2?: {
   3984             payloadSizeBytes: number;
   3985             metadataSizeBytes: number;
   3986             objectCount: number;
   3987         };
   3988     };
   3989 };
   3990 // ============ AI Search Instance Info Types ============
   3991 type AiSearchInstanceInfo = {
   3992     id: string;
   3993     type?: 'r2' | 'web-crawler' | string;
   3994     source?: string;
   3995     source_params?: unknown;
   3996     paused?: boolean;
   3997     status?: string;
   3998     namespace?: string;
   3999     created_at?: string;
   4000     modified_at?: string;
   4001     token_id?: string;
   4002     ai_gateway_id?: string;
   4003     rewrite_query?: boolean;
   4004     reranking?: boolean;
   4005     embedding_model?: string;
   4006     ai_search_model?: string;
   4007     rewrite_model?: string;
   4008     reranking_model?: string;
   4009     /** @deprecated Use index_method instead. */
   4010     hybrid_search_enabled?: boolean;
   4011     /** Controls which storage backends are active. */
   4012     index_method?: {
   4013         vector?: boolean;
   4014         keyword?: boolean;
   4015     };
   4016     /** Fusion method for combining vector and keyword results. */
   4017     fusion_method?: 'max' | 'rrf';
   4018     indexing_options?: {
   4019         keyword_tokenizer?: 'porter' | 'trigram';
   4020     } | null;
   4021     retrieval_options?: {
   4022         keyword_match_mode?: 'and' | 'or';
   4023         boost_by?: Array<{
   4024             field: string;
   4025             direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
   4026         }>;
   4027     } | null;
   4028     chunk?: boolean;
   4029     chunk_size?: number;
   4030     chunk_overlap?: number;
   4031     score_threshold?: number;
   4032     max_num_results?: number;
   4033     cache?: boolean;
   4034     cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';
   4035     custom_metadata?: Array<{
   4036         field_name: string;
   4037         data_type: 'text' | 'number' | 'boolean' | 'datetime';
   4038     }>;
   4039     /** Sync interval in seconds. */
   4040     sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;
   4041     metadata?: Record<string, unknown>;
   4042     [key: string]: unknown;
   4043 };
   4044 /** Pagination, search, and ordering parameters for listing instances within a namespace. */
   4045 type AiSearchListInstancesParams = {
   4046     page?: number;
   4047     per_page?: number;
   4048     /** Search instances by ID. */
   4049     search?: string;
   4050     /** Field to sort by. */
   4051     order_by?: 'created_at';
   4052     /** Sort direction. */
   4053     order_by_direction?: 'asc' | 'desc';
   4054 };
   4055 type AiSearchListResponse = {
   4056     result: AiSearchInstanceInfo[];
   4057     result_info?: {
   4058         count: number;
   4059         page: number;
   4060         per_page: number;
   4061         total_count: number;
   4062     };
   4063 };
   4064 // ============ AI Search Config Types ============
   4065 type AiSearchConfig = {
   4066     /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
   4067     id: string;
   4068     /** Instance type. Omit to create with built-in storage. */
   4069     type?: 'r2' | 'web-crawler' | string;
   4070     /** Source URL (required for web-crawler type). */
   4071     source?: string;
   4072     source_params?: unknown;
   4073     /** Token ID (UUID format) */
   4074     token_id?: string;
   4075     ai_gateway_id?: string;
   4076     /** Enable query rewriting (default false) */
   4077     rewrite_query?: boolean;
   4078     /** Enable reranking (default false) */
   4079     reranking?: boolean;
   4080     embedding_model?: string;
   4081     ai_search_model?: string;
   4082     rewrite_model?: string;
   4083     reranking_model?: string;
   4084     /** @deprecated Use index_method instead. */
   4085     hybrid_search_enabled?: boolean;
   4086     /** Controls which storage backends are used during indexing. Defaults to vector-only. */
   4087     index_method?: {
   4088         vector?: boolean;
   4089         keyword?: boolean;
   4090     };
   4091     /** Fusion method for combining vector and keyword results. "rrf" = reciprocal rank fusion (default), "max" = maximum score. */
   4092     fusion_method?: 'max' | 'rrf';
   4093     indexing_options?: {
   4094         keyword_tokenizer?: 'porter' | 'trigram';
   4095     } | null;
   4096     retrieval_options?: {
   4097         keyword_match_mode?: 'and' | 'or';
   4098         boost_by?: Array<{
   4099             field: string;
   4100             direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
   4101         }>;
   4102     } | null;
   4103     chunk?: boolean;
   4104     chunk_size?: number;
   4105     chunk_overlap?: number;
   4106     /** Minimum similarity score (0-1) for a result to be included. */
   4107     score_threshold?: number;
   4108     max_num_results?: number;
   4109     cache?: boolean;
   4110     /** Similarity threshold for cache hits. Stricter = fewer cache hits but higher relevance. */
   4111     cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';
   4112     custom_metadata?: Array<{
   4113         field_name: string;
   4114         data_type: 'text' | 'number' | 'boolean' | 'datetime';
   4115     }>;
   4116     namespace?: string;
   4117     /** Sync interval in seconds. 3600=1h, 7200=2h, 14400=4h, 21600=6h, 43200=12h, 86400=24h. */
   4118     sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;
   4119     metadata?: Record<string, unknown>;
   4120     [key: string]: unknown;
   4121 };
   4122 // ============ AI Search Item Types ============
   4123 type AiSearchItemInfo = {
   4124     id: string;
   4125     key: string;
   4126     status: 'completed' | 'error' | 'skipped' | 'queued' | 'running' | 'outdated';
   4127     next_action?: 'INDEX' | 'DELETE' | null;
   4128     error?: string;
   4129     checksum?: string;
   4130     namespace?: string;
   4131     chunks_count?: number | null;
   4132     file_size?: number | null;
   4133     source_id?: string | null;
   4134     last_seen_at?: string;
   4135     created_at?: string;
   4136     metadata?: Record<string, unknown>;
   4137     [key: string]: unknown;
   4138 };
   4139 type AiSearchItemContentResult = {
   4140     body: ReadableStream;
   4141     contentType: string;
   4142     filename: string;
   4143     size: number;
   4144 };
   4145 type AiSearchUploadItemOptions = {
   4146     metadata?: Record<string, unknown>;
   4147 };
   4148 type AiSearchListItemsParams = {
   4149     page?: number;
   4150     per_page?: number;
   4151     /** Search items by key name. */
   4152     search?: string;
   4153     /** Sort order for results. */
   4154     sort_by?: 'status' | 'modified_at';
   4155     /** Filter items by processing status. */
   4156     status?: 'queued' | 'running' | 'completed' | 'error' | 'skipped' | 'outdated';
   4157     /** Filter items by source (e.g. "builtin" or "web-crawler:https://example.com"). */
   4158     source?: string;
   4159     /** JSON-encoded Vectorize filter for metadata filtering. */
   4160     metadata_filter?: string;
   4161 };
   4162 type AiSearchListItemsResponse = {
   4163     result: AiSearchItemInfo[];
   4164     result_info?: {
   4165         count: number;
   4166         page: number;
   4167         per_page: number;
   4168         total_count: number;
   4169     };
   4170 };
   4171 // ============ AI Search Item Logs Types ============
   4172 type AiSearchItemLogsParams = {
   4173     /** Maximum number of log entries to return (1-100, default 50). */
   4174     limit?: number;
   4175     /** Opaque cursor for pagination. Pass the `cursor` value from a previous response. */
   4176     cursor?: string;
   4177 };
   4178 type AiSearchItemLog = {
   4179     timestamp: string;
   4180     action: string;
   4181     message: string;
   4182     fileKey?: string;
   4183     chunkCount?: number;
   4184     processingTimeMs?: number;
   4185     errorType?: string;
   4186 };
   4187 /** Paginated response for item processing logs (cursor-based). */
   4188 type AiSearchItemLogsResponse = {
   4189     result: AiSearchItemLog[];
   4190     result_info: {
   4191         count: number;
   4192         per_page: number;
   4193         cursor: string | null;
   4194         truncated: boolean;
   4195     };
   4196 };
   4197 // ============ AI Search Item Chunks Types ============
   4198 type AiSearchItemChunksParams = {
   4199     /** Maximum number of chunks to return (1-100, default 20). */
   4200     limit?: number;
   4201     /** Offset into the chunks list (default 0). */
   4202     offset?: number;
   4203 };
   4204 /** A single indexed chunk belonging to an item, including its text content and byte range. */
   4205 type AiSearchItemChunk = {
   4206     id: string;
   4207     text: string;
   4208     start_byte: number;
   4209     end_byte: number;
   4210     item?: {
   4211         timestamp?: number;
   4212         key: string;
   4213         metadata?: Record<string, unknown>;
   4214     };
   4215 };
   4216 /** Paginated response for item chunks (offset-based). */
   4217 type AiSearchItemChunksResponse = {
   4218     result: AiSearchItemChunk[];
   4219     result_info: {
   4220         count: number;
   4221         total: number;
   4222         limit: number;
   4223         offset: number;
   4224     };
   4225 };
   4226 // ============ AI Search Job Types ============
   4227 type AiSearchJobInfo = {
   4228     id: string;
   4229     source: 'user' | 'schedule';
   4230     description?: string;
   4231     last_seen_at?: string;
   4232     started_at?: string;
   4233     ended_at?: string;
   4234     end_reason?: string;
   4235 };
   4236 type AiSearchJobLog = {
   4237     id: number;
   4238     message: string;
   4239     message_type: number;
   4240     created_at: number;
   4241 };
   4242 type AiSearchCreateJobParams = {
   4243     description?: string;
   4244 };
   4245 type AiSearchListJobsParams = {
   4246     page?: number;
   4247     per_page?: number;
   4248 };
   4249 type AiSearchListJobsResponse = {
   4250     result: AiSearchJobInfo[];
   4251     result_info?: {
   4252         count: number;
   4253         page: number;
   4254         per_page: number;
   4255         total_count: number;
   4256     };
   4257 };
   4258 type AiSearchJobLogsParams = {
   4259     page?: number;
   4260     per_page?: number;
   4261 };
   4262 type AiSearchJobLogsResponse = {
   4263     result: AiSearchJobLog[];
   4264     result_info?: {
   4265         count: number;
   4266         page: number;
   4267         per_page: number;
   4268         total_count: number;
   4269     };
   4270 };
   4271 // ============ AI Search Sub-Service Classes ============
   4272 /**
   4273  * Single item service for an AI Search instance.
   4274  * Provides info, download, sync, logs, and chunks operations on a specific item.
   4275  */
   4276 declare abstract class AiSearchItem {
   4277     /** Get metadata about this item. */
   4278     info(): Promise<AiSearchItemInfo>;
   4279     /**
   4280      * Download the item's content.
   4281      * @returns Object with body stream, content type, filename, and size.
   4282      */
   4283     download(): Promise<AiSearchItemContentResult>;
   4284     /**
   4285      * Trigger re-indexing of this item.
   4286      * @returns The updated item info.
   4287      */
   4288     sync(): Promise<AiSearchItemInfo>;
   4289     /**
   4290      * Retrieve processing logs for this item (cursor-based pagination).
   4291      * @param params Optional pagination parameters (limit, cursor).
   4292      * @returns Paginated log entries for this item.
   4293      */
   4294     logs(params?: AiSearchItemLogsParams): Promise<AiSearchItemLogsResponse>;
   4295     /**
   4296      * List indexed chunks for this item (offset-based pagination).
   4297      * @param params Optional pagination parameters (limit, offset).
   4298      * @returns Paginated chunk entries for this item.
   4299      */
   4300     chunks(params?: AiSearchItemChunksParams): Promise<AiSearchItemChunksResponse>;
   4301 }
   4302 /**
   4303  * Items collection service for an AI Search instance.
   4304  * Provides list, upload, and access to individual items.
   4305  */
   4306 declare abstract class AiSearchItems {
   4307     /** List items in this instance. */
   4308     list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
   4309     /**
   4310      * Upload a file as an item. Behaves as an upsert: if an item with the same
   4311      * filename already exists, it is overwritten and re-indexed.
   4312      * @param name Filename for the uploaded item.
   4313      * @param content File content as a ReadableStream, Blob, or string.
   4314      * @param options Optional metadata to attach to the item.
   4315      * @returns The created item info.
   4316      */
   4317     upload(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions): Promise<AiSearchItemInfo>;
   4318     /**
   4319      * Upload a file and poll until processing completes.
   4320      * Behaves as an upsert: if an item with the same filename already exists,
   4321      * it is overwritten and re-indexed.
   4322      * @param name Filename for the uploaded item.
   4323      * @param content File content as a ReadableStream, Blob, or string.
   4324      * @param options Optional metadata and polling configuration.
   4325      * @returns The item info after processing completes (or timeout).
   4326      */
   4327     uploadAndPoll(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions & {
   4328         /** Polling interval in milliseconds (default 1000). */
   4329         pollIntervalMs?: number;
   4330         /** Maximum time to wait in milliseconds (default 30000). */
   4331         timeoutMs?: number;
   4332     }): Promise<AiSearchItemInfo>;
   4333     /**
   4334      * Get an item by ID.
   4335      * @param itemId The item identifier.
   4336      * @returns Item service for info, download, sync, logs, and chunks operations.
   4337      */
   4338     get(itemId: string): AiSearchItem;
   4339     /**
   4340      * Delete an item from the instance.
   4341      * @param itemId The item identifier.
   4342      */
   4343     delete(itemId: string): Promise<void>;
   4344 }
   4345 /**
   4346  * Single job service for an AI Search instance.
   4347  * Provides info, logs, and cancel operations for a specific job.
   4348  */
   4349 declare abstract class AiSearchJob {
   4350     /** Get metadata about this job. */
   4351     info(): Promise<AiSearchJobInfo>;
   4352     /** Get logs for this job. */
   4353     logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
   4354     /**
   4355      * Cancel a running job.
   4356      * @returns The updated job info.
   4357      * @throws AiSearchNotFoundError if the job does not exist.
   4358      */
   4359     cancel(): Promise<AiSearchJobInfo>;
   4360 }
   4361 /**
   4362  * Jobs collection service for an AI Search instance.
   4363  * Provides list, create, and access to individual jobs.
   4364  */
   4365 declare abstract class AiSearchJobs {
   4366     /** List jobs for this instance. */
   4367     list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
   4368     /**
   4369      * Create a new indexing job.
   4370      * @param params Optional job parameters.
   4371      * @returns The created job info.
   4372      */
   4373     create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
   4374     /**
   4375      * Get a job by ID.
   4376      * @param jobId The job identifier.
   4377      * @returns Job service for info, logs, and cancel operations.
   4378      */
   4379     get(jobId: string): AiSearchJob;
   4380 }
   4381 // ============ AI Search Binding Classes ============
   4382 /**
   4383  * Instance-level AI Search service.
   4384  *
   4385  * Used as:
   4386  * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
   4387  * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
   4388  *
   4389  * Provides search, chat, update, stats, items, and jobs operations.
   4390  *
   4391  * @example
   4392  * ```ts
   4393  * // Via namespace binding
   4394  * const instance = env.AI_SEARCH.get("blog");
   4395  * const results = await instance.search({
   4396  *   query: "How does caching work?",
   4397  * });
   4398  *
   4399  * // Via single instance binding
   4400  * const results = await env.BLOG_SEARCH.search({
   4401  *   messages: [{ role: "user", content: "How does caching work?" }],
   4402  * });
   4403  * ```
   4404  */
   4405 declare abstract class AiSearchInstance {
   4406     /**
   4407      * Search the AI Search instance for relevant chunks.
   4408      * @param params Search request with query or messages and optional AI search options.
   4409      * @returns Search response with matching chunks and search query.
   4410      */
   4411     search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
   4412     /**
   4413      * Generate chat completions with AI Search context (streaming).
   4414      * @param params Chat completions request with stream: true.
   4415      * @returns ReadableStream of server-sent events.
   4416      */
   4417     chatCompletions(params: AiSearchChatCompletionsRequest & {
   4418         stream: true;
   4419     }): Promise<ReadableStream>;
   4420     /**
   4421      * Generate chat completions with AI Search context.
   4422      * @param params Chat completions request.
   4423      * @returns Chat completion response with choices and RAG chunks.
   4424      */
   4425     chatCompletions(params: AiSearchChatCompletionsRequest): Promise<AiSearchChatCompletionsResponse>;
   4426     /**
   4427      * Update the instance configuration.
   4428      * @param config Partial configuration to update.
   4429      * @returns Updated instance info.
   4430      */
   4431     update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
   4432     /** Get metadata about this instance. */
   4433     info(): Promise<AiSearchInstanceInfo>;
   4434     /**
   4435      * Get instance statistics (item count, indexing status, etc.).
   4436      * @returns Statistics with counts per status, last activity time, and engine details.
   4437      */
   4438     stats(): Promise<AiSearchStatsResponse>;
   4439     /** Items collection — list, upload, and manage items in this instance. */
   4440     get items(): AiSearchItems;
   4441     /** Jobs collection — list, create, and inspect indexing jobs. */
   4442     get jobs(): AiSearchJobs;
   4443 }
   4444 /**
   4445  * Namespace-level AI Search service.
   4446  *
   4447  * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
   4448  * Scoped to a single namespace. Provides dynamic instance access, creation, deletion,
   4449  * and multi-instance search/chat operations.
   4450  *
   4451  * @example
   4452  * ```ts
   4453  * // Access an instance within the namespace
   4454  * const blog = env.AI_SEARCH.get("blog");
   4455  * const results = await blog.search({ query: "How does caching work?" });
   4456  *
   4457  * // List all instances in the namespace
   4458  * const instances = await env.AI_SEARCH.list();
   4459  *
   4460  * // Create a new instance with built-in storage
   4461  * const tenant = await env.AI_SEARCH.create({ id: "tenant-123" });
   4462  *
   4463  * // Upload items into the instance
   4464  * await tenant.items.upload("doc.pdf", fileContent);
   4465  *
   4466  * // Search across multiple instances
   4467  * const multi = await env.AI_SEARCH.search({
   4468  *   query: "caching",
   4469  *   ai_search_options: { instance_ids: ["blog", "docs"] },
   4470  * });
   4471  *
   4472  * // Delete an instance
   4473  * await env.AI_SEARCH.delete("tenant-123");
   4474  * ```
   4475  */
   4476 declare abstract class AiSearchNamespace {
   4477     /**
   4478      * Get an instance by name within the bound namespace.
   4479      * @param name Instance name.
   4480      * @returns Instance service for search, chat, update, stats, items, and jobs.
   4481      */
   4482     get(name: string): AiSearchInstance;
   4483     /**
   4484      * List instances in the bound namespace.
   4485      * @param params Optional pagination, search, and ordering parameters.
   4486      * @returns Array of instance metadata with pagination info.
   4487      */
   4488     list(params?: AiSearchListInstancesParams): Promise<AiSearchListResponse>;
   4489     /**
   4490      * Create a new instance within the bound namespace.
   4491      * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
   4492      * @returns Instance service for the newly created instance.
   4493      *
   4494      * @example
   4495      * ```ts
   4496      * // Create with built-in storage (upload items manually)
   4497      * const instance = await env.AI_SEARCH.create({ id: "my-search" });
   4498      *
   4499      * // Create with web crawler source
   4500      * const instance = await env.AI_SEARCH.create({
   4501      *   id: "docs-search",
   4502      *   type: "web-crawler",
   4503      *   source: "https://developers.cloudflare.com",
   4504      * });
   4505      * ```
   4506      */
   4507     create(config: AiSearchConfig): Promise<AiSearchInstance>;
   4508     /**
   4509      * Delete an instance from the bound namespace.
   4510      * @param name Instance name to delete.
   4511      */
   4512     delete(name: string): Promise<void>;
   4513     /**
   4514      * Search across multiple instances within the bound namespace.
   4515      * Fans out to the specified instance_ids and merges results.
   4516      * @param params Search request with required `ai_search_options.instance_ids`.
   4517      * @returns Search response with chunks tagged by instance_id and optional partial-failure errors.
   4518      */
   4519     search(params: AiSearchMultiSearchRequest): Promise<AiSearchMultiSearchResponse>;
   4520     /**
   4521      * Generate chat completions across multiple instances within the bound namespace (streaming).
   4522      * Fans out to the specified instance_ids, merges context, and generates a response.
   4523      * @param params Chat completions request with stream: true and required `ai_search_options.instance_ids`.
   4524      * @returns ReadableStream of server-sent events.
   4525      */
   4526     chatCompletions(params: AiSearchMultiChatCompletionsRequest & {
   4527         stream: true;
   4528     }): Promise<ReadableStream>;
   4529     /**
   4530      * Generate chat completions across multiple instances within the bound namespace.
   4531      * Fans out to the specified instance_ids, merges context, and generates a response.
   4532      * @param params Chat completions request with required `ai_search_options.instance_ids`.
   4533      * @returns Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors.
   4534      */
   4535     chatCompletions(params: AiSearchMultiChatCompletionsRequest): Promise<AiSearchMultiChatCompletionsResponse>;
   4536 }
   4537 type AiImageClassificationInput = {
   4538     image: number[];
   4539 };
   4540 type AiImageClassificationOutput = {
   4541     score?: number;
   4542     label?: string;
   4543 }[];
   4544 declare abstract class BaseAiImageClassification {
   4545     inputs: AiImageClassificationInput;
   4546     postProcessedOutputs: AiImageClassificationOutput;
   4547 }
   4548 type AiImageToTextInput = {
   4549     image: number[];
   4550     prompt?: string;
   4551     max_tokens?: number;
   4552     temperature?: number;
   4553     top_p?: number;
   4554     top_k?: number;
   4555     seed?: number;
   4556     repetition_penalty?: number;
   4557     frequency_penalty?: number;
   4558     presence_penalty?: number;
   4559     raw?: boolean;
   4560     messages?: RoleScopedChatInput[];
   4561 };
   4562 type AiImageToTextOutput = {
   4563     description: string;
   4564 };
   4565 declare abstract class BaseAiImageToText {
   4566     inputs: AiImageToTextInput;
   4567     postProcessedOutputs: AiImageToTextOutput;
   4568 }
   4569 type AiImageTextToTextInput = {
   4570     image: string;
   4571     prompt?: string;
   4572     max_tokens?: number;
   4573     temperature?: number;
   4574     ignore_eos?: boolean;
   4575     top_p?: number;
   4576     top_k?: number;
   4577     seed?: number;
   4578     repetition_penalty?: number;
   4579     frequency_penalty?: number;
   4580     presence_penalty?: number;
   4581     raw?: boolean;
   4582     messages?: RoleScopedChatInput[];
   4583 };
   4584 type AiImageTextToTextOutput = {
   4585     description: string;
   4586 };
   4587 declare abstract class BaseAiImageTextToText {
   4588     inputs: AiImageTextToTextInput;
   4589     postProcessedOutputs: AiImageTextToTextOutput;
   4590 }
   4591 type AiMultimodalEmbeddingsInput = {
   4592     image: string;
   4593     text: string[];
   4594 };
   4595 type AiIMultimodalEmbeddingsOutput = {
   4596     data: number[][];
   4597     shape: number[];
   4598 };
   4599 declare abstract class BaseAiMultimodalEmbeddings {
   4600     inputs: AiImageTextToTextInput;
   4601     postProcessedOutputs: AiImageTextToTextOutput;
   4602 }
   4603 type AiObjectDetectionInput = {
   4604     image: number[];
   4605 };
   4606 type AiObjectDetectionOutput = {
   4607     score?: number;
   4608     label?: string;
   4609 }[];
   4610 declare abstract class BaseAiObjectDetection {
   4611     inputs: AiObjectDetectionInput;
   4612     postProcessedOutputs: AiObjectDetectionOutput;
   4613 }
   4614 type AiSentenceSimilarityInput = {
   4615     source: string;
   4616     sentences: string[];
   4617 };
   4618 type AiSentenceSimilarityOutput = number[];
   4619 declare abstract class BaseAiSentenceSimilarity {
   4620     inputs: AiSentenceSimilarityInput;
   4621     postProcessedOutputs: AiSentenceSimilarityOutput;
   4622 }
   4623 type AiAutomaticSpeechRecognitionInput = {
   4624     audio: number[];
   4625 };
   4626 type AiAutomaticSpeechRecognitionOutput = {
   4627     text?: string;
   4628     words?: {
   4629         word: string;
   4630         start: number;
   4631         end: number;
   4632     }[];
   4633     vtt?: string;
   4634 };
   4635 declare abstract class BaseAiAutomaticSpeechRecognition {
   4636     inputs: AiAutomaticSpeechRecognitionInput;
   4637     postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
   4638 }
   4639 type AiSummarizationInput = {
   4640     input_text: string;
   4641     max_length?: number;
   4642 };
   4643 type AiSummarizationOutput = {
   4644     summary: string;
   4645 };
   4646 declare abstract class BaseAiSummarization {
   4647     inputs: AiSummarizationInput;
   4648     postProcessedOutputs: AiSummarizationOutput;
   4649 }
   4650 type AiTextClassificationInput = {
   4651     text: string;
   4652 };
   4653 type AiTextClassificationOutput = {
   4654     score?: number;
   4655     label?: string;
   4656 }[];
   4657 declare abstract class BaseAiTextClassification {
   4658     inputs: AiTextClassificationInput;
   4659     postProcessedOutputs: AiTextClassificationOutput;
   4660 }
   4661 type AiTextEmbeddingsInput = {
   4662     text: string | string[];
   4663 };
   4664 type AiTextEmbeddingsOutput = {
   4665     shape: number[];
   4666     data: number[][];
   4667 };
   4668 declare abstract class BaseAiTextEmbeddings {
   4669     inputs: AiTextEmbeddingsInput;
   4670     postProcessedOutputs: AiTextEmbeddingsOutput;
   4671 }
   4672 type RoleScopedChatInput = {
   4673     role: "user" | "assistant" | "system" | "tool" | (string & NonNullable<unknown>);
   4674     content: string;
   4675     name?: string;
   4676 };
   4677 type AiTextGenerationToolLegacyInput = {
   4678     name: string;
   4679     description: string;
   4680     parameters?: {
   4681         type: "object" | (string & NonNullable<unknown>);
   4682         properties: {
   4683             [key: string]: {
   4684                 type: string;
   4685                 description?: string;
   4686             };
   4687         };
   4688         required: string[];
   4689     };
   4690 };
   4691 type AiTextGenerationToolInput = {
   4692     type: "function" | (string & NonNullable<unknown>);
   4693     function: {
   4694         name: string;
   4695         description: string;
   4696         parameters?: {
   4697             type: "object" | (string & NonNullable<unknown>);
   4698             properties: {
   4699                 [key: string]: {
   4700                     type: string;
   4701                     description?: string;
   4702                 };
   4703             };
   4704             required: string[];
   4705         };
   4706     };
   4707 };
   4708 type AiTextGenerationFunctionsInput = {
   4709     name: string;
   4710     code: string;
   4711 };
   4712 type AiTextGenerationResponseFormat = {
   4713     type: string;
   4714     json_schema?: any;
   4715 };
   4716 type AiTextGenerationInput = {
   4717     prompt?: string;
   4718     raw?: boolean;
   4719     stream?: boolean;
   4720     max_tokens?: number;
   4721     temperature?: number;
   4722     top_p?: number;
   4723     top_k?: number;
   4724     seed?: number;
   4725     repetition_penalty?: number;
   4726     frequency_penalty?: number;
   4727     presence_penalty?: number;
   4728     messages?: RoleScopedChatInput[];
   4729     response_format?: AiTextGenerationResponseFormat;
   4730     tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);
   4731     functions?: AiTextGenerationFunctionsInput[];
   4732 };
   4733 type AiTextGenerationToolLegacyOutput = {
   4734     name: string;
   4735     arguments: unknown;
   4736 };
   4737 type AiTextGenerationToolOutput = {
   4738     id: string;
   4739     type: "function";
   4740     function: {
   4741         name: string;
   4742         arguments: string;
   4743     };
   4744 };
   4745 type UsageTags = {
   4746     prompt_tokens: number;
   4747     completion_tokens: number;
   4748     total_tokens: number;
   4749 };
   4750 type AiTextGenerationOutput = {
   4751     response?: string;
   4752     tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];
   4753     usage?: UsageTags;
   4754 };
   4755 declare abstract class BaseAiTextGeneration {
   4756     inputs: AiTextGenerationInput;
   4757     postProcessedOutputs: AiTextGenerationOutput;
   4758 }
   4759 type AiTextToSpeechInput = {
   4760     prompt: string;
   4761     lang?: string;
   4762 };
   4763 type AiTextToSpeechOutput = Uint8Array | {
   4764     audio: string;
   4765 };
   4766 declare abstract class BaseAiTextToSpeech {
   4767     inputs: AiTextToSpeechInput;
   4768     postProcessedOutputs: AiTextToSpeechOutput;
   4769 }
   4770 type AiTextToImageInput = {
   4771     prompt: string;
   4772     negative_prompt?: string;
   4773     height?: number;
   4774     width?: number;
   4775     image?: number[];
   4776     image_b64?: string;
   4777     mask?: number[];
   4778     num_steps?: number;
   4779     strength?: number;
   4780     guidance?: number;
   4781     seed?: number;
   4782 };
   4783 type AiTextToImageOutput = ReadableStream<Uint8Array>;
   4784 declare abstract class BaseAiTextToImage {
   4785     inputs: AiTextToImageInput;
   4786     postProcessedOutputs: AiTextToImageOutput;
   4787 }
   4788 type AiTranslationInput = {
   4789     text: string;
   4790     target_lang: string;
   4791     source_lang?: string;
   4792 };
   4793 type AiTranslationOutput = {
   4794     translated_text?: string;
   4795 };
   4796 declare abstract class BaseAiTranslation {
   4797     inputs: AiTranslationInput;
   4798     postProcessedOutputs: AiTranslationOutput;
   4799 }
   4800 /**
   4801  * Workers AI support for OpenAI's Chat Completions API
   4802  */
   4803 type ChatCompletionContentPartText = {
   4804     type: "text";
   4805     text: string;
   4806 };
   4807 type ChatCompletionContentPartImage = {
   4808     type: "image_url";
   4809     image_url: {
   4810         url: string;
   4811         detail?: "auto" | "low" | "high";
   4812     };
   4813 };
   4814 type ChatCompletionContentPartInputAudio = {
   4815     type: "input_audio";
   4816     input_audio: {
   4817         /** Base64 encoded audio data. */
   4818         data: string;
   4819         format: "wav" | "mp3";
   4820     };
   4821 };
   4822 type ChatCompletionContentPartFile = {
   4823     type: "file";
   4824     file: {
   4825         /** Base64 encoded file data. */
   4826         file_data?: string;
   4827         /** The ID of an uploaded file. */
   4828         file_id?: string;
   4829         filename?: string;
   4830     };
   4831 };
   4832 type ChatCompletionContentPartRefusal = {
   4833     type: "refusal";
   4834     refusal: string;
   4835 };
   4836 type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartInputAudio | ChatCompletionContentPartFile;
   4837 type FunctionDefinition = {
   4838     name: string;
   4839     description?: string;
   4840     parameters?: Record<string, unknown>;
   4841     strict?: boolean | null;
   4842 };
   4843 type ChatCompletionFunctionTool = {
   4844     type: "function";
   4845     function: FunctionDefinition;
   4846 };
   4847 type ChatCompletionCustomToolGrammarFormat = {
   4848     type: "grammar";
   4849     grammar: {
   4850         definition: string;
   4851         syntax: "lark" | "regex";
   4852     };
   4853 };
   4854 type ChatCompletionCustomToolTextFormat = {
   4855     type: "text";
   4856 };
   4857 type ChatCompletionCustomToolFormat = ChatCompletionCustomToolTextFormat | ChatCompletionCustomToolGrammarFormat;
   4858 type ChatCompletionCustomTool = {
   4859     type: "custom";
   4860     custom: {
   4861         name: string;
   4862         description?: string;
   4863         format?: ChatCompletionCustomToolFormat;
   4864     };
   4865 };
   4866 type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
   4867 type ChatCompletionMessageFunctionToolCall = {
   4868     id: string;
   4869     type: "function";
   4870     function: {
   4871         name: string;
   4872         /** JSON-encoded arguments string. */
   4873         arguments: string;
   4874     };
   4875 };
   4876 type ChatCompletionMessageCustomToolCall = {
   4877     id: string;
   4878     type: "custom";
   4879     custom: {
   4880         name: string;
   4881         input: string;
   4882     };
   4883 };
   4884 type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall;
   4885 type ChatCompletionToolChoiceFunction = {
   4886     type: "function";
   4887     function: {
   4888         name: string;
   4889     };
   4890 };
   4891 type ChatCompletionToolChoiceCustom = {
   4892     type: "custom";
   4893     custom: {
   4894         name: string;
   4895     };
   4896 };
   4897 type ChatCompletionToolChoiceAllowedTools = {
   4898     type: "allowed_tools";
   4899     allowed_tools: {
   4900         mode: "auto" | "required";
   4901         tools: Array<Record<string, unknown>>;
   4902     };
   4903 };
   4904 type ChatCompletionToolChoiceOption = "none" | "auto" | "required" | ChatCompletionToolChoiceFunction | ChatCompletionToolChoiceCustom | ChatCompletionToolChoiceAllowedTools;
   4905 type DeveloperMessage = {
   4906     role: "developer";
   4907     content: string | Array<{
   4908         type: "text";
   4909         text: string;
   4910     }>;
   4911     name?: string;
   4912 };
   4913 type SystemMessage = {
   4914     role: "system";
   4915     content: string | Array<{
   4916         type: "text";
   4917         text: string;
   4918     }>;
   4919     name?: string;
   4920 };
   4921 /**
   4922  * Permissive merged content part used inside UserMessage arrays.
   4923  *
   4924  * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
   4925  * inside nested array items does not correctly match different branches for
   4926  * different array elements, so the schema uses a single merged object.
   4927  */
   4928 type UserMessageContentPart = {
   4929     type: "text" | "image_url" | "input_audio" | "file";
   4930     text?: string;
   4931     image_url?: {
   4932         url?: string;
   4933         detail?: "auto" | "low" | "high";
   4934     };
   4935     input_audio?: {
   4936         data?: string;
   4937         format?: "wav" | "mp3";
   4938     };
   4939     file?: {
   4940         file_data?: string;
   4941         file_id?: string;
   4942         filename?: string;
   4943     };
   4944 };
   4945 type UserMessage = {
   4946     role: "user";
   4947     content: string | Array<UserMessageContentPart>;
   4948     name?: string;
   4949 };
   4950 type AssistantMessageContentPart = {
   4951     type: "text" | "refusal";
   4952     text?: string;
   4953     refusal?: string;
   4954 };
   4955 type AssistantMessage = {
   4956     role: "assistant";
   4957     content?: string | null | Array<AssistantMessageContentPart>;
   4958     refusal?: string | null;
   4959     name?: string;
   4960     audio?: {
   4961         id: string;
   4962     };
   4963     tool_calls?: Array<ChatCompletionMessageToolCall>;
   4964     function_call?: {
   4965         name: string;
   4966         arguments: string;
   4967     };
   4968 };
   4969 type ToolMessage = {
   4970     role: "tool";
   4971     content: string | Array<{
   4972         type: "text";
   4973         text: string;
   4974     }>;
   4975     tool_call_id: string;
   4976 };
   4977 type FunctionMessage = {
   4978     role: "function";
   4979     content: string;
   4980     name: string;
   4981 };
   4982 type ChatCompletionMessageParam = DeveloperMessage | SystemMessage | UserMessage | AssistantMessage | ToolMessage | FunctionMessage;
   4983 type ChatCompletionsResponseFormatText = {
   4984     type: "text";
   4985 };
   4986 type ChatCompletionsResponseFormatJSONObject = {
   4987     type: "json_object";
   4988 };
   4989 type ResponseFormatJSONSchema = {
   4990     type: "json_schema";
   4991     json_schema: {
   4992         name: string;
   4993         description?: string;
   4994         schema?: Record<string, unknown>;
   4995         strict?: boolean | null;
   4996     };
   4997 };
   4998 type ResponseFormat = ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJSONObject | ResponseFormatJSONSchema;
   4999 type ChatCompletionsStreamOptions = {
   5000     include_usage?: boolean;
   5001     include_obfuscation?: boolean;
   5002 };
   5003 type PredictionContent = {
   5004     type: "content";
   5005     content: string | Array<{
   5006         type: "text";
   5007         text: string;
   5008     }>;
   5009 };
   5010 type AudioParams = {
   5011     voice: string | {
   5012         id: string;
   5013     };
   5014     format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
   5015 };
   5016 type WebSearchUserLocation = {
   5017     type: "approximate";
   5018     approximate: {
   5019         city?: string;
   5020         country?: string;
   5021         region?: string;
   5022         timezone?: string;
   5023     };
   5024 };
   5025 type WebSearchOptions = {
   5026     search_context_size?: "low" | "medium" | "high";
   5027     user_location?: WebSearchUserLocation;
   5028 };
   5029 type ChatTemplateKwargs = {
   5030     /** Whether to enable reasoning, enabled by default. */
   5031     enable_thinking?: boolean;
   5032     /** If false, preserves reasoning context between turns. */
   5033     clear_thinking?: boolean;
   5034 };
   5035 /** Shared optional properties used by both Prompt and Messages input branches. */
   5036 type ChatCompletionsCommonOptions = {
   5037     model?: string;
   5038     audio?: AudioParams;
   5039     frequency_penalty?: number | null;
   5040     logit_bias?: Record<string, unknown> | null;
   5041     logprobs?: boolean | null;
   5042     top_logprobs?: number | null;
   5043     max_tokens?: number | null;
   5044     max_completion_tokens?: number | null;
   5045     metadata?: Record<string, unknown> | null;
   5046     modalities?: Array<"text" | "audio"> | null;
   5047     n?: number | null;
   5048     parallel_tool_calls?: boolean;
   5049     prediction?: PredictionContent;
   5050     presence_penalty?: number | null;
   5051     reasoning_effort?: "low" | "medium" | "high" | null;
   5052     chat_template_kwargs?: ChatTemplateKwargs;
   5053     response_format?: ResponseFormat;
   5054     seed?: number | null;
   5055     service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
   5056     stop?: string | Array<string> | null;
   5057     store?: boolean | null;
   5058     stream?: boolean | null;
   5059     stream_options?: ChatCompletionsStreamOptions;
   5060     temperature?: number | null;
   5061     tool_choice?: ChatCompletionToolChoiceOption;
   5062     tools?: Array<ChatCompletionTool>;
   5063     top_p?: number | null;
   5064     user?: string;
   5065     web_search_options?: WebSearchOptions;
   5066     function_call?: "none" | "auto" | {
   5067         name: string;
   5068     };
   5069     functions?: Array<FunctionDefinition>;
   5070 };
   5071 type PromptTokensDetails = {
   5072     cached_tokens?: number;
   5073     audio_tokens?: number;
   5074 };
   5075 type CompletionTokensDetails = {
   5076     reasoning_tokens?: number;
   5077     audio_tokens?: number;
   5078     accepted_prediction_tokens?: number;
   5079     rejected_prediction_tokens?: number;
   5080 };
   5081 type CompletionUsage = {
   5082     prompt_tokens: number;
   5083     completion_tokens: number;
   5084     total_tokens: number;
   5085     prompt_tokens_details?: PromptTokensDetails;
   5086     completion_tokens_details?: CompletionTokensDetails;
   5087 };
   5088 type ChatCompletionTopLogprob = {
   5089     token: string;
   5090     logprob: number;
   5091     bytes: Array<number> | null;
   5092 };
   5093 type ChatCompletionTokenLogprob = {
   5094     token: string;
   5095     logprob: number;
   5096     bytes: Array<number> | null;
   5097     top_logprobs: Array<ChatCompletionTopLogprob>;
   5098 };
   5099 type ChatCompletionAudio = {
   5100     id: string;
   5101     /** Base64 encoded audio bytes. */
   5102     data: string;
   5103     expires_at: number;
   5104     transcript: string;
   5105 };
   5106 type ChatCompletionUrlCitation = {
   5107     type: "url_citation";
   5108     url_citation: {
   5109         url: string;
   5110         title: string;
   5111         start_index: number;
   5112         end_index: number;
   5113     };
   5114 };
   5115 type ChatCompletionResponseMessage = {
   5116     role: "assistant";
   5117     content: string | null;
   5118     refusal: string | null;
   5119     annotations?: Array<ChatCompletionUrlCitation>;
   5120     audio?: ChatCompletionAudio;
   5121     tool_calls?: Array<ChatCompletionMessageToolCall>;
   5122     function_call?: {
   5123         name: string;
   5124         arguments: string;
   5125     } | null;
   5126 };
   5127 type ChatCompletionLogprobs = {
   5128     content: Array<ChatCompletionTokenLogprob> | null;
   5129     refusal?: Array<ChatCompletionTokenLogprob> | null;
   5130 };
   5131 type ChatCompletionChoice = {
   5132     index: number;
   5133     message: ChatCompletionResponseMessage;
   5134     finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
   5135     logprobs: ChatCompletionLogprobs | null;
   5136 };
   5137 type ChatCompletionsMessagesInput = {
   5138     messages: Array<ChatCompletionMessageParam>;
   5139 } & ChatCompletionsCommonOptions;
   5140 type ChatCompletionsOutput = {
   5141     id: string;
   5142     object: string;
   5143     created: number;
   5144     model: string;
   5145     choices: Array<ChatCompletionChoice>;
   5146     usage?: CompletionUsage;
   5147     system_fingerprint?: string | null;
   5148     service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
   5149 };
   5150 /**
   5151  * Workers AI support for OpenAI's Responses API
   5152  * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
   5153  *
   5154  * It's a stripped down version from its source.
   5155  * It currently supports basic function calling, json mode and accepts images as input.
   5156  *
   5157  * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.
   5158  * We plan to add those incrementally as model + platform capabilities evolve.
   5159  */
   5160 type ResponsesInput = {
   5161     background?: boolean | null;
   5162     conversation?: string | ResponseConversationParam | null;
   5163     include?: Array<ResponseIncludable> | null;
   5164     input?: string | ResponseInput;
   5165     instructions?: string | null;
   5166     max_output_tokens?: number | null;
   5167     parallel_tool_calls?: boolean | null;
   5168     previous_response_id?: string | null;
   5169     prompt_cache_key?: string;
   5170     reasoning?: Reasoning | null;
   5171     safety_identifier?: string;
   5172     service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
   5173     stream?: boolean | null;
   5174     stream_options?: StreamOptions | null;
   5175     temperature?: number | null;
   5176     text?: ResponseTextConfig;
   5177     tool_choice?: ToolChoiceOptions | ToolChoiceFunction;
   5178     tools?: Array<Tool>;
   5179     top_p?: number | null;
   5180     truncation?: "auto" | "disabled" | null;
   5181 };
   5182 type ResponsesOutput = {
   5183     id?: string;
   5184     created_at?: number;
   5185     output_text?: string;
   5186     error?: ResponseError | null;
   5187     incomplete_details?: ResponseIncompleteDetails | null;
   5188     instructions?: string | Array<ResponseInputItem> | null;
   5189     object?: "response";
   5190     output?: Array<ResponseOutputItem>;
   5191     parallel_tool_calls?: boolean;
   5192     temperature?: number | null;
   5193     tool_choice?: ToolChoiceOptions | ToolChoiceFunction;
   5194     tools?: Array<Tool>;
   5195     top_p?: number | null;
   5196     max_output_tokens?: number | null;
   5197     previous_response_id?: string | null;
   5198     prompt?: ResponsePrompt | null;
   5199     reasoning?: Reasoning | null;
   5200     safety_identifier?: string;
   5201     service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
   5202     status?: ResponseStatus;
   5203     text?: ResponseTextConfig;
   5204     truncation?: "auto" | "disabled" | null;
   5205     usage?: ResponseUsage;
   5206 };
   5207 type EasyInputMessage = {
   5208     content: string | ResponseInputMessageContentList;
   5209     role: "user" | "assistant" | "system" | "developer";
   5210     type?: "message";
   5211 };
   5212 type ResponsesFunctionTool = {
   5213     name: string;
   5214     parameters: {
   5215         [key: string]: unknown;
   5216     } | null;
   5217     strict: boolean | null;
   5218     type: "function";
   5219     description?: string | null;
   5220 };
   5221 type ResponseIncompleteDetails = {
   5222     reason?: "max_output_tokens" | "content_filter";
   5223 };
   5224 type ResponsePrompt = {
   5225     id: string;
   5226     variables?: {
   5227         [key: string]: string | ResponseInputText | ResponseInputImage;
   5228     } | null;
   5229     version?: string | null;
   5230 };
   5231 type Reasoning = {
   5232     effort?: ReasoningEffort | null;
   5233     generate_summary?: "auto" | "concise" | "detailed" | null;
   5234     summary?: "auto" | "concise" | "detailed" | null;
   5235 };
   5236 type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;
   5237 type ResponseContentReasoningText = {
   5238     text: string;
   5239     type: "reasoning_text";
   5240 };
   5241 type ResponseConversationParam = {
   5242     id: string;
   5243 };
   5244 type ResponseCreatedEvent = {
   5245     response: Response;
   5246     sequence_number: number;
   5247     type: "response.created";
   5248 };
   5249 type ResponseCustomToolCallOutput = {
   5250     call_id: string;
   5251     output: string | Array<ResponseInputText | ResponseInputImage>;
   5252     type: "custom_tool_call_output";
   5253     id?: string;
   5254 };
   5255 type ResponseError = {
   5256     code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | "vector_store_timeout" | "invalid_image" | "invalid_image_format" | "invalid_base64_image" | "invalid_image_url" | "image_too_large" | "image_too_small" | "image_parse_error" | "image_content_policy_violation" | "invalid_image_mode" | "image_file_too_large" | "unsupported_image_media_type" | "empty_image_file" | "failed_to_download_image" | "image_file_not_found";
   5257     message: string;
   5258 };
   5259 type ResponseErrorEvent = {
   5260     code: string | null;
   5261     message: string;
   5262     param: string | null;
   5263     sequence_number: number;
   5264     type: "error";
   5265 };
   5266 type ResponseFailedEvent = {
   5267     response: Response;
   5268     sequence_number: number;
   5269     type: "response.failed";
   5270 };
   5271 type ResponseFormatText = {
   5272     type: "text";
   5273 };
   5274 type ResponseFormatJSONObject = {
   5275     type: "json_object";
   5276 };
   5277 type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;
   5278 type ResponseFormatTextJSONSchemaConfig = {
   5279     name: string;
   5280     schema: {
   5281         [key: string]: unknown;
   5282     };
   5283     type: "json_schema";
   5284     description?: string;
   5285     strict?: boolean | null;
   5286 };
   5287 type ResponseFunctionCallArgumentsDeltaEvent = {
   5288     delta: string;
   5289     item_id: string;
   5290     output_index: number;
   5291     sequence_number: number;
   5292     type: "response.function_call_arguments.delta";
   5293 };
   5294 type ResponseFunctionCallArgumentsDoneEvent = {
   5295     arguments: string;
   5296     item_id: string;
   5297     name: string;
   5298     output_index: number;
   5299     sequence_number: number;
   5300     type: "response.function_call_arguments.done";
   5301 };
   5302 type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;
   5303 type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;
   5304 type ResponseFunctionToolCall = {
   5305     arguments: string;
   5306     call_id: string;
   5307     name: string;
   5308     type: "function_call";
   5309     id?: string;
   5310     status?: "in_progress" | "completed" | "incomplete";
   5311 };
   5312 interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {
   5313     id: string;
   5314 }
   5315 type ResponseFunctionToolCallOutputItem = {
   5316     id: string;
   5317     call_id: string;
   5318     output: string | Array<ResponseInputText | ResponseInputImage>;
   5319     type: "function_call_output";
   5320     status?: "in_progress" | "completed" | "incomplete";
   5321 };
   5322 type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs";
   5323 type ResponseIncompleteEvent = {
   5324     response: Response;
   5325     sequence_number: number;
   5326     type: "response.incomplete";
   5327 };
   5328 type ResponseInput = Array<ResponseInputItem>;
   5329 type ResponseInputContent = ResponseInputText | ResponseInputImage;
   5330 type ResponseInputImage = {
   5331     detail: "low" | "high" | "auto";
   5332     type: "input_image";
   5333     /**
   5334      * Base64 encoded image
   5335      */
   5336     image_url?: string | null;
   5337 };
   5338 type ResponseInputImageContent = {
   5339     type: "input_image";
   5340     detail?: "low" | "high" | "auto" | null;
   5341     /**
   5342      * Base64 encoded image
   5343      */
   5344     image_url?: string | null;
   5345 };
   5346 type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;
   5347 type ResponseInputItemFunctionCallOutput = {
   5348     call_id: string;
   5349     output: string | ResponseFunctionCallOutputItemList;
   5350     type: "function_call_output";
   5351     id?: string | null;
   5352     status?: "in_progress" | "completed" | "incomplete" | null;
   5353 };
   5354 type ResponseInputItemMessage = {
   5355     content: ResponseInputMessageContentList;
   5356     role: "user" | "system" | "developer";
   5357     status?: "in_progress" | "completed" | "incomplete";
   5358     type?: "message";
   5359 };
   5360 type ResponseInputMessageContentList = Array<ResponseInputContent>;
   5361 type ResponseInputMessageItem = {
   5362     id: string;
   5363     content: ResponseInputMessageContentList;
   5364     role: "user" | "system" | "developer";
   5365     status?: "in_progress" | "completed" | "incomplete";
   5366     type?: "message";
   5367 };
   5368 type ResponseInputText = {
   5369     text: string;
   5370     type: "input_text";
   5371 };
   5372 type ResponseInputTextContent = {
   5373     text: string;
   5374     type: "input_text";
   5375 };
   5376 type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;
   5377 type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;
   5378 type ResponseOutputItemAddedEvent = {
   5379     item: ResponseOutputItem;
   5380     output_index: number;
   5381     sequence_number: number;
   5382     type: "response.output_item.added";
   5383 };
   5384 type ResponseOutputItemDoneEvent = {
   5385     item: ResponseOutputItem;
   5386     output_index: number;
   5387     sequence_number: number;
   5388     type: "response.output_item.done";
   5389 };
   5390 type ResponseOutputMessage = {
   5391     id: string;
   5392     content: Array<ResponseOutputText | ResponseOutputRefusal>;
   5393     role: "assistant";
   5394     status: "in_progress" | "completed" | "incomplete";
   5395     type: "message";
   5396 };
   5397 type ResponseOutputRefusal = {
   5398     refusal: string;
   5399     type: "refusal";
   5400 };
   5401 type ResponseOutputText = {
   5402     text: string;
   5403     type: "output_text";
   5404     logprobs?: Array<Logprob>;
   5405 };
   5406 type ResponseReasoningItem = {
   5407     id: string;
   5408     summary: Array<ResponseReasoningSummaryItem>;
   5409     type: "reasoning";
   5410     content?: Array<ResponseReasoningContentItem>;
   5411     encrypted_content?: string | null;
   5412     status?: "in_progress" | "completed" | "incomplete";
   5413 };
   5414 type ResponseReasoningSummaryItem = {
   5415     text: string;
   5416     type: "summary_text";
   5417 };
   5418 type ResponseReasoningContentItem = {
   5419     text: string;
   5420     type: "reasoning_text";
   5421 };
   5422 type ResponseReasoningTextDeltaEvent = {
   5423     content_index: number;
   5424     delta: string;
   5425     item_id: string;
   5426     output_index: number;
   5427     sequence_number: number;
   5428     type: "response.reasoning_text.delta";
   5429 };
   5430 type ResponseReasoningTextDoneEvent = {
   5431     content_index: number;
   5432     item_id: string;
   5433     output_index: number;
   5434     sequence_number: number;
   5435     text: string;
   5436     type: "response.reasoning_text.done";
   5437 };
   5438 type ResponseRefusalDeltaEvent = {
   5439     content_index: number;
   5440     delta: string;
   5441     item_id: string;
   5442     output_index: number;
   5443     sequence_number: number;
   5444     type: "response.refusal.delta";
   5445 };
   5446 type ResponseRefusalDoneEvent = {
   5447     content_index: number;
   5448     item_id: string;
   5449     output_index: number;
   5450     refusal: string;
   5451     sequence_number: number;
   5452     type: "response.refusal.done";
   5453 };
   5454 type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete";
   5455 type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;
   5456 type ResponseCompletedEvent = {
   5457     response: Response;
   5458     sequence_number: number;
   5459     type: "response.completed";
   5460 };
   5461 type ResponseTextConfig = {
   5462     format?: ResponseFormatTextConfig;
   5463     verbosity?: "low" | "medium" | "high" | null;
   5464 };
   5465 type ResponseTextDeltaEvent = {
   5466     content_index: number;
   5467     delta: string;
   5468     item_id: string;
   5469     logprobs: Array<Logprob>;
   5470     output_index: number;
   5471     sequence_number: number;
   5472     type: "response.output_text.delta";
   5473 };
   5474 type ResponseTextDoneEvent = {
   5475     content_index: number;
   5476     item_id: string;
   5477     logprobs: Array<Logprob>;
   5478     output_index: number;
   5479     sequence_number: number;
   5480     text: string;
   5481     type: "response.output_text.done";
   5482 };
   5483 type Logprob = {
   5484     token: string;
   5485     logprob: number;
   5486     top_logprobs?: Array<TopLogprob>;
   5487 };
   5488 type TopLogprob = {
   5489     token?: string;
   5490     logprob?: number;
   5491 };
   5492 type ResponseUsage = {
   5493     input_tokens: number;
   5494     output_tokens: number;
   5495     total_tokens: number;
   5496 };
   5497 type Tool = ResponsesFunctionTool;
   5498 type ToolChoiceFunction = {
   5499     name: string;
   5500     type: "function";
   5501 };
   5502 type ToolChoiceOptions = "none";
   5503 type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
   5504 type StreamOptions = {
   5505     include_obfuscation?: boolean;
   5506 };
   5507 /** Marks keys from T that aren't in U as optional never */
   5508 type Without<T, U> = {
   5509     [P in Exclude<keyof T, keyof U>]?: never;
   5510 };
   5511 /** Either T or U, but not both (mutually exclusive) */
   5512 type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
   5513 type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {
   5514     text: string | string[];
   5515     /**
   5516      * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
   5517      */
   5518     pooling?: "mean" | "cls";
   5519 } | {
   5520     /**
   5521      * Batch of the embeddings requests to run using async-queue
   5522      */
   5523     requests: {
   5524         text: string | string[];
   5525         /**
   5526          * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
   5527          */
   5528         pooling?: "mean" | "cls";
   5529     }[];
   5530 };
   5531 type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {
   5532     shape?: number[];
   5533     /**
   5534      * Embeddings of the requested text values
   5535      */
   5536     data?: number[][];
   5537     /**
   5538      * The pooling method used in the embedding process.
   5539      */
   5540     pooling?: "mean" | "cls";
   5541 } | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;
   5542 interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {
   5543     /**
   5544      * The async request id that can be used to obtain the results.
   5545      */
   5546     request_id?: string;
   5547 }
   5548 declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {
   5549     inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;
   5550     postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;
   5551 }
   5552 type Ai_Cf_Openai_Whisper_Input = string | {
   5553     /**
   5554      * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
   5555      */
   5556     audio: number[];
   5557 };
   5558 interface Ai_Cf_Openai_Whisper_Output {
   5559     /**
   5560      * The transcription
   5561      */
   5562     text: string;
   5563     word_count?: number;
   5564     words?: {
   5565         word?: string;
   5566         /**
   5567          * The second this word begins in the recording
   5568          */
   5569         start?: number;
   5570         /**
   5571          * The ending second when the word completes
   5572          */
   5573         end?: number;
   5574     }[];
   5575     vtt?: string;
   5576 }
   5577 declare abstract class Base_Ai_Cf_Openai_Whisper {
   5578     inputs: Ai_Cf_Openai_Whisper_Input;
   5579     postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
   5580 }
   5581 type Ai_Cf_Meta_M2M100_1_2B_Input = {
   5582     /**
   5583      * The text to be translated
   5584      */
   5585     text: string;
   5586     /**
   5587      * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
   5588      */
   5589     source_lang?: string;
   5590     /**
   5591      * The language code to translate the text into (e.g., 'es' for Spanish)
   5592      */
   5593     target_lang: string;
   5594 } | {
   5595     /**
   5596      * Batch of the embeddings requests to run using async-queue
   5597      */
   5598     requests: {
   5599         /**
   5600          * The text to be translated
   5601          */
   5602         text: string;
   5603         /**
   5604          * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
   5605          */
   5606         source_lang?: string;
   5607         /**
   5608          * The language code to translate the text into (e.g., 'es' for Spanish)
   5609          */
   5610         target_lang: string;
   5611     }[];
   5612 };
   5613 type Ai_Cf_Meta_M2M100_1_2B_Output = {
   5614     /**
   5615      * The translated text in the target language
   5616      */
   5617     translated_text?: string;
   5618 } | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;
   5619 interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {
   5620     /**
   5621      * The async request id that can be used to obtain the results.
   5622      */
   5623     request_id?: string;
   5624 }
   5625 declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {
   5626     inputs: Ai_Cf_Meta_M2M100_1_2B_Input;
   5627     postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;
   5628 }
   5629 type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {
   5630     text: string | string[];
   5631     /**
   5632      * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
   5633      */
   5634     pooling?: "mean" | "cls";
   5635 } | {
   5636     /**
   5637      * Batch of the embeddings requests to run using async-queue
   5638      */
   5639     requests: {
   5640         text: string | string[];
   5641         /**
   5642          * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
   5643          */
   5644         pooling?: "mean" | "cls";
   5645     }[];
   5646 };
   5647 type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {
   5648     shape?: number[];
   5649     /**
   5650      * Embeddings of the requested text values
   5651      */
   5652     data?: number[][];
   5653     /**
   5654      * The pooling method used in the embedding process.
   5655      */
   5656     pooling?: "mean" | "cls";
   5657 } | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;
   5658 interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {
   5659     /**
   5660      * The async request id that can be used to obtain the results.
   5661      */
   5662     request_id?: string;
   5663 }
   5664 declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {
   5665     inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;
   5666     postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;
   5667 }
   5668 type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {
   5669     text: string | string[];
   5670     /**
   5671      * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
   5672      */
   5673     pooling?: "mean" | "cls";
   5674 } | {
   5675     /**
   5676      * Batch of the embeddings requests to run using async-queue
   5677      */
   5678     requests: {
   5679         text: string | string[];
   5680         /**
   5681          * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.
   5682          */
   5683         pooling?: "mean" | "cls";
   5684     }[];
   5685 };
   5686 type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {
   5687     shape?: number[];
   5688     /**
   5689      * Embeddings of the requested text values
   5690      */
   5691     data?: number[][];
   5692     /**
   5693      * The pooling method used in the embedding process.
   5694      */
   5695     pooling?: "mean" | "cls";
   5696 } | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;
   5697 interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {
   5698     /**
   5699      * The async request id that can be used to obtain the results.
   5700      */
   5701     request_id?: string;
   5702 }
   5703 declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {
   5704     inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;
   5705     postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;
   5706 }
   5707 type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {
   5708     /**
   5709      * The input text prompt for the model to generate a response.
   5710      */
   5711     prompt?: string;
   5712     /**
   5713      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   5714      */
   5715     raw?: boolean;
   5716     /**
   5717      * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   5718      */
   5719     top_p?: number;
   5720     /**
   5721      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   5722      */
   5723     top_k?: number;
   5724     /**
   5725      * Random seed for reproducibility of the generation.
   5726      */
   5727     seed?: number;
   5728     /**
   5729      * Penalty for repeated tokens; higher values discourage repetition.
   5730      */
   5731     repetition_penalty?: number;
   5732     /**
   5733      * Decreases the likelihood of the model repeating the same lines verbatim.
   5734      */
   5735     frequency_penalty?: number;
   5736     /**
   5737      * Increases the likelihood of the model introducing new topics.
   5738      */
   5739     presence_penalty?: number;
   5740     image: number[] | (string & NonNullable<unknown>);
   5741     /**
   5742      * The maximum number of tokens to generate in the response.
   5743      */
   5744     max_tokens?: number;
   5745 };
   5746 interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {
   5747     description?: string;
   5748 }
   5749 declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {
   5750     inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;
   5751     postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;
   5752 }
   5753 type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {
   5754     /**
   5755      * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
   5756      */
   5757     audio: number[];
   5758 };
   5759 interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
   5760     /**
   5761      * The transcription
   5762      */
   5763     text: string;
   5764     word_count?: number;
   5765     words?: {
   5766         word?: string;
   5767         /**
   5768          * The second this word begins in the recording
   5769          */
   5770         start?: number;
   5771         /**
   5772          * The ending second when the word completes
   5773          */
   5774         end?: number;
   5775     }[];
   5776     vtt?: string;
   5777 }
   5778 declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
   5779     inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
   5780     postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
   5781 }
   5782 interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
   5783     audio: string | {
   5784         body?: object;
   5785         contentType?: string;
   5786     };
   5787     /**
   5788      * Supported tasks are 'translate' or 'transcribe'.
   5789      */
   5790     task?: string;
   5791     /**
   5792      * The language of the audio being transcribed or translated.
   5793      */
   5794     language?: string;
   5795     /**
   5796      * Preprocess the audio with a voice activity detection model.
   5797      */
   5798     vad_filter?: boolean;
   5799     /**
   5800      * A text prompt to help provide context to the model on the contents of the audio.
   5801      */
   5802     initial_prompt?: string;
   5803     /**
   5804      * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
   5805      */
   5806     prefix?: string;
   5807     /**
   5808      * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
   5809      */
   5810     beam_size?: number;
   5811     /**
   5812      * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
   5813      */
   5814     condition_on_previous_text?: boolean;
   5815     /**
   5816      * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
   5817      */
   5818     no_speech_threshold?: number;
   5819     /**
   5820      * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
   5821      */
   5822     compression_ratio_threshold?: number;
   5823     /**
   5824      * Threshold for filtering out segments with low average log probability, indicating low confidence.
   5825      */
   5826     log_prob_threshold?: number;
   5827     /**
   5828      * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
   5829      */
   5830     hallucination_silence_threshold?: number;
   5831 }
   5832 interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
   5833     transcription_info?: {
   5834         /**
   5835          * The language of the audio being transcribed or translated.
   5836          */
   5837         language?: string;
   5838         /**
   5839          * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
   5840          */
   5841         language_probability?: number;
   5842         /**
   5843          * The total duration of the original audio file, in seconds.
   5844          */
   5845         duration?: number;
   5846         /**
   5847          * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
   5848          */
   5849         duration_after_vad?: number;
   5850     };
   5851     /**
   5852      * The complete transcription of the audio.
   5853      */
   5854     text: string;
   5855     /**
   5856      * The total number of words in the transcription.
   5857      */
   5858     word_count?: number;
   5859     segments?: {
   5860         /**
   5861          * The starting time of the segment within the audio, in seconds.
   5862          */
   5863         start?: number;
   5864         /**
   5865          * The ending time of the segment within the audio, in seconds.
   5866          */
   5867         end?: number;
   5868         /**
   5869          * The transcription of the segment.
   5870          */
   5871         text?: string;
   5872         /**
   5873          * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
   5874          */
   5875         temperature?: number;
   5876         /**
   5877          * The average log probability of the predictions for the words in this segment, indicating overall confidence.
   5878          */
   5879         avg_logprob?: number;
   5880         /**
   5881          * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
   5882          */
   5883         compression_ratio?: number;
   5884         /**
   5885          * The probability that the segment contains no speech, represented as a decimal between 0 and 1.
   5886          */
   5887         no_speech_prob?: number;
   5888         words?: {
   5889             /**
   5890              * The individual word transcribed from the audio.
   5891              */
   5892             word?: string;
   5893             /**
   5894              * The starting time of the word within the audio, in seconds.
   5895              */
   5896             start?: number;
   5897             /**
   5898              * The ending time of the word within the audio, in seconds.
   5899              */
   5900             end?: number;
   5901         }[];
   5902     }[];
   5903     /**
   5904      * The transcription in WebVTT format, which includes timing and text information for use in subtitles.
   5905      */
   5906     vtt?: string;
   5907 }
   5908 declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
   5909     inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
   5910     postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
   5911 }
   5912 type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {
   5913     /**
   5914      * Batch of the embeddings requests to run using async-queue
   5915      */
   5916     requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];
   5917 };
   5918 interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {
   5919     /**
   5920      * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
   5921      */
   5922     query?: string;
   5923     /**
   5924      * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
   5925      */
   5926     contexts: {
   5927         /**
   5928          * One of the provided context content
   5929          */
   5930         text?: string;
   5931     }[];
   5932     /**
   5933      * When provided with too long context should the model error out or truncate the context to fit?
   5934      */
   5935     truncate_inputs?: boolean;
   5936 }
   5937 interface Ai_Cf_Baai_Bge_M3_Input_Embedding {
   5938     text: string | string[];
   5939     /**
   5940      * When provided with too long context should the model error out or truncate the context to fit?
   5941      */
   5942     truncate_inputs?: boolean;
   5943 }
   5944 interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {
   5945     /**
   5946      * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
   5947      */
   5948     query?: string;
   5949     /**
   5950      * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
   5951      */
   5952     contexts: {
   5953         /**
   5954          * One of the provided context content
   5955          */
   5956         text?: string;
   5957     }[];
   5958     /**
   5959      * When provided with too long context should the model error out or truncate the context to fit?
   5960      */
   5961     truncate_inputs?: boolean;
   5962 }
   5963 interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
   5964     text: string | string[];
   5965     /**
   5966      * When provided with too long context should the model error out or truncate the context to fit?
   5967      */
   5968     truncate_inputs?: boolean;
   5969 }
   5970 type Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Output_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Output_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;
   5971 interface Ai_Cf_Baai_Bge_M3_Output_Query {
   5972     response?: {
   5973         /**
   5974          * Index of the context in the request
   5975          */
   5976         id?: number;
   5977         /**
   5978          * Score of the context under the index.
   5979          */
   5980         score?: number;
   5981     }[];
   5982 }
   5983 interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
   5984     response?: number[][];
   5985     shape?: number[];
   5986     /**
   5987      * The pooling method used in the embedding process.
   5988      */
   5989     pooling?: "mean" | "cls";
   5990 }
   5991 interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
   5992     shape?: number[];
   5993     /**
   5994      * Embeddings of the requested text values
   5995      */
   5996     data?: number[][];
   5997     /**
   5998      * The pooling method used in the embedding process.
   5999      */
   6000     pooling?: "mean" | "cls";
   6001 }
   6002 interface Ai_Cf_Baai_Bge_M3_AsyncResponse {
   6003     /**
   6004      * The async request id that can be used to obtain the results.
   6005      */
   6006     request_id?: string;
   6007 }
   6008 declare abstract class Base_Ai_Cf_Baai_Bge_M3 {
   6009     inputs: Ai_Cf_Baai_Bge_M3_Input;
   6010     postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;
   6011 }
   6012 interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
   6013     /**
   6014      * A text description of the image you want to generate.
   6015      */
   6016     prompt: string;
   6017     /**
   6018      * The number of diffusion steps; higher values can improve quality but take longer.
   6019      */
   6020     steps?: number;
   6021 }
   6022 interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
   6023     /**
   6024      * The generated image in Base64 format.
   6025      */
   6026     image?: string;
   6027 }
   6028 declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
   6029     inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
   6030     postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
   6031 }
   6032 type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;
   6033 interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {
   6034     /**
   6035      * The input text prompt for the model to generate a response.
   6036      */
   6037     prompt: string;
   6038     image?: number[] | (string & NonNullable<unknown>);
   6039     /**
   6040      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   6041      */
   6042     raw?: boolean;
   6043     /**
   6044      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6045      */
   6046     stream?: boolean;
   6047     /**
   6048      * The maximum number of tokens to generate in the response.
   6049      */
   6050     max_tokens?: number;
   6051     /**
   6052      * Controls the randomness of the output; higher values produce more random results.
   6053      */
   6054     temperature?: number;
   6055     /**
   6056      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6057      */
   6058     top_p?: number;
   6059     /**
   6060      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6061      */
   6062     top_k?: number;
   6063     /**
   6064      * Random seed for reproducibility of the generation.
   6065      */
   6066     seed?: number;
   6067     /**
   6068      * Penalty for repeated tokens; higher values discourage repetition.
   6069      */
   6070     repetition_penalty?: number;
   6071     /**
   6072      * Decreases the likelihood of the model repeating the same lines verbatim.
   6073      */
   6074     frequency_penalty?: number;
   6075     /**
   6076      * Increases the likelihood of the model introducing new topics.
   6077      */
   6078     presence_penalty?: number;
   6079     /**
   6080      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   6081      */
   6082     lora?: string;
   6083 }
   6084 interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
   6085     /**
   6086      * An array of message objects representing the conversation history.
   6087      */
   6088     messages: {
   6089         /**
   6090          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   6091          */
   6092         role?: string;
   6093         /**
   6094          * The tool call id. If you don't know what to put here you can fall back to 000000001
   6095          */
   6096         tool_call_id?: string;
   6097         content?: string | {
   6098             /**
   6099              * Type of the content provided
   6100              */
   6101             type?: string;
   6102             text?: string;
   6103             image_url?: {
   6104                 /**
   6105                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   6106                  */
   6107                 url?: string;
   6108             };
   6109         }[] | {
   6110             /**
   6111              * Type of the content provided
   6112              */
   6113             type?: string;
   6114             text?: string;
   6115             image_url?: {
   6116                 /**
   6117                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   6118                  */
   6119                 url?: string;
   6120             };
   6121         };
   6122     }[];
   6123     image?: number[] | (string & NonNullable<unknown>);
   6124     functions?: {
   6125         name: string;
   6126         code: string;
   6127     }[];
   6128     /**
   6129      * A list of tools available for the assistant to use.
   6130      */
   6131     tools?: ({
   6132         /**
   6133          * The name of the tool. More descriptive the better.
   6134          */
   6135         name: string;
   6136         /**
   6137          * A brief description of what the tool does.
   6138          */
   6139         description: string;
   6140         /**
   6141          * Schema defining the parameters accepted by the tool.
   6142          */
   6143         parameters: {
   6144             /**
   6145              * The type of the parameters object (usually 'object').
   6146              */
   6147             type: string;
   6148             /**
   6149              * List of required parameter names.
   6150              */
   6151             required?: string[];
   6152             /**
   6153              * Definitions of each parameter.
   6154              */
   6155             properties: {
   6156                 [k: string]: {
   6157                     /**
   6158                      * The data type of the parameter.
   6159                      */
   6160                     type: string;
   6161                     /**
   6162                      * A description of the expected parameter.
   6163                      */
   6164                     description: string;
   6165                 };
   6166             };
   6167         };
   6168     } | {
   6169         /**
   6170          * Specifies the type of tool (e.g., 'function').
   6171          */
   6172         type: string;
   6173         /**
   6174          * Details of the function tool.
   6175          */
   6176         function: {
   6177             /**
   6178              * The name of the function.
   6179              */
   6180             name: string;
   6181             /**
   6182              * A brief description of what the function does.
   6183              */
   6184             description: string;
   6185             /**
   6186              * Schema defining the parameters accepted by the function.
   6187              */
   6188             parameters: {
   6189                 /**
   6190                  * The type of the parameters object (usually 'object').
   6191                  */
   6192                 type: string;
   6193                 /**
   6194                  * List of required parameter names.
   6195                  */
   6196                 required?: string[];
   6197                 /**
   6198                  * Definitions of each parameter.
   6199                  */
   6200                 properties: {
   6201                     [k: string]: {
   6202                         /**
   6203                          * The data type of the parameter.
   6204                          */
   6205                         type: string;
   6206                         /**
   6207                          * A description of the expected parameter.
   6208                          */
   6209                         description: string;
   6210                     };
   6211                 };
   6212             };
   6213         };
   6214     })[];
   6215     /**
   6216      * If true, the response will be streamed back incrementally.
   6217      */
   6218     stream?: boolean;
   6219     /**
   6220      * The maximum number of tokens to generate in the response.
   6221      */
   6222     max_tokens?: number;
   6223     /**
   6224      * Controls the randomness of the output; higher values produce more random results.
   6225      */
   6226     temperature?: number;
   6227     /**
   6228      * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6229      */
   6230     top_p?: number;
   6231     /**
   6232      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6233      */
   6234     top_k?: number;
   6235     /**
   6236      * Random seed for reproducibility of the generation.
   6237      */
   6238     seed?: number;
   6239     /**
   6240      * Penalty for repeated tokens; higher values discourage repetition.
   6241      */
   6242     repetition_penalty?: number;
   6243     /**
   6244      * Decreases the likelihood of the model repeating the same lines verbatim.
   6245      */
   6246     frequency_penalty?: number;
   6247     /**
   6248      * Increases the likelihood of the model introducing new topics.
   6249      */
   6250     presence_penalty?: number;
   6251 }
   6252 type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {
   6253     /**
   6254      * The generated text response from the model
   6255      */
   6256     response?: string;
   6257     /**
   6258      * An array of tool calls requests made during the response generation
   6259      */
   6260     tool_calls?: {
   6261         /**
   6262          * The arguments passed to be passed to the tool call request
   6263          */
   6264         arguments?: object;
   6265         /**
   6266          * The name of the tool to be called
   6267          */
   6268         name?: string;
   6269     }[];
   6270 };
   6271 declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
   6272     inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
   6273     postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
   6274 }
   6275 type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;
   6276 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {
   6277     /**
   6278      * The input text prompt for the model to generate a response.
   6279      */
   6280     prompt: string;
   6281     /**
   6282      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   6283      */
   6284     lora?: string;
   6285     response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;
   6286     /**
   6287      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   6288      */
   6289     raw?: boolean;
   6290     /**
   6291      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6292      */
   6293     stream?: boolean;
   6294     /**
   6295      * The maximum number of tokens to generate in the response.
   6296      */
   6297     max_tokens?: number;
   6298     /**
   6299      * Controls the randomness of the output; higher values produce more random results.
   6300      */
   6301     temperature?: number;
   6302     /**
   6303      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6304      */
   6305     top_p?: number;
   6306     /**
   6307      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6308      */
   6309     top_k?: number;
   6310     /**
   6311      * Random seed for reproducibility of the generation.
   6312      */
   6313     seed?: number;
   6314     /**
   6315      * Penalty for repeated tokens; higher values discourage repetition.
   6316      */
   6317     repetition_penalty?: number;
   6318     /**
   6319      * Decreases the likelihood of the model repeating the same lines verbatim.
   6320      */
   6321     frequency_penalty?: number;
   6322     /**
   6323      * Increases the likelihood of the model introducing new topics.
   6324      */
   6325     presence_penalty?: number;
   6326 }
   6327 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {
   6328     type?: "json_object" | "json_schema";
   6329     json_schema?: unknown;
   6330 }
   6331 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
   6332     /**
   6333      * An array of message objects representing the conversation history.
   6334      */
   6335     messages: {
   6336         /**
   6337          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   6338          */
   6339         role: string;
   6340         content: string | {
   6341             /**
   6342              * Type of the content (text)
   6343              */
   6344             type?: string;
   6345             /**
   6346              * Text content
   6347              */
   6348             text?: string;
   6349         }[];
   6350     }[];
   6351     functions?: {
   6352         name: string;
   6353         code: string;
   6354     }[];
   6355     /**
   6356      * A list of tools available for the assistant to use.
   6357      */
   6358     tools?: ({
   6359         /**
   6360          * The name of the tool. More descriptive the better.
   6361          */
   6362         name: string;
   6363         /**
   6364          * A brief description of what the tool does.
   6365          */
   6366         description: string;
   6367         /**
   6368          * Schema defining the parameters accepted by the tool.
   6369          */
   6370         parameters: {
   6371             /**
   6372              * The type of the parameters object (usually 'object').
   6373              */
   6374             type: string;
   6375             /**
   6376              * List of required parameter names.
   6377              */
   6378             required?: string[];
   6379             /**
   6380              * Definitions of each parameter.
   6381              */
   6382             properties: {
   6383                 [k: string]: {
   6384                     /**
   6385                      * The data type of the parameter.
   6386                      */
   6387                     type: string;
   6388                     /**
   6389                      * A description of the expected parameter.
   6390                      */
   6391                     description: string;
   6392                 };
   6393             };
   6394         };
   6395     } | {
   6396         /**
   6397          * Specifies the type of tool (e.g., 'function').
   6398          */
   6399         type: string;
   6400         /**
   6401          * Details of the function tool.
   6402          */
   6403         function: {
   6404             /**
   6405              * The name of the function.
   6406              */
   6407             name: string;
   6408             /**
   6409              * A brief description of what the function does.
   6410              */
   6411             description: string;
   6412             /**
   6413              * Schema defining the parameters accepted by the function.
   6414              */
   6415             parameters: {
   6416                 /**
   6417                  * The type of the parameters object (usually 'object').
   6418                  */
   6419                 type: string;
   6420                 /**
   6421                  * List of required parameter names.
   6422                  */
   6423                 required?: string[];
   6424                 /**
   6425                  * Definitions of each parameter.
   6426                  */
   6427                 properties: {
   6428                     [k: string]: {
   6429                         /**
   6430                          * The data type of the parameter.
   6431                          */
   6432                         type: string;
   6433                         /**
   6434                          * A description of the expected parameter.
   6435                          */
   6436                         description: string;
   6437                     };
   6438                 };
   6439             };
   6440         };
   6441     })[];
   6442     response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;
   6443     /**
   6444      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   6445      */
   6446     raw?: boolean;
   6447     /**
   6448      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6449      */
   6450     stream?: boolean;
   6451     /**
   6452      * The maximum number of tokens to generate in the response.
   6453      */
   6454     max_tokens?: number;
   6455     /**
   6456      * Controls the randomness of the output; higher values produce more random results.
   6457      */
   6458     temperature?: number;
   6459     /**
   6460      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6461      */
   6462     top_p?: number;
   6463     /**
   6464      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6465      */
   6466     top_k?: number;
   6467     /**
   6468      * Random seed for reproducibility of the generation.
   6469      */
   6470     seed?: number;
   6471     /**
   6472      * Penalty for repeated tokens; higher values discourage repetition.
   6473      */
   6474     repetition_penalty?: number;
   6475     /**
   6476      * Decreases the likelihood of the model repeating the same lines verbatim.
   6477      */
   6478     frequency_penalty?: number;
   6479     /**
   6480      * Increases the likelihood of the model introducing new topics.
   6481      */
   6482     presence_penalty?: number;
   6483 }
   6484 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {
   6485     type?: "json_object" | "json_schema";
   6486     json_schema?: unknown;
   6487 }
   6488 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {
   6489     requests?: {
   6490         /**
   6491          * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.
   6492          */
   6493         external_reference?: string;
   6494         /**
   6495          * Prompt for the text generation model
   6496          */
   6497         prompt?: string;
   6498         /**
   6499          * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6500          */
   6501         stream?: boolean;
   6502         /**
   6503          * The maximum number of tokens to generate in the response.
   6504          */
   6505         max_tokens?: number;
   6506         /**
   6507          * Controls the randomness of the output; higher values produce more random results.
   6508          */
   6509         temperature?: number;
   6510         /**
   6511          * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6512          */
   6513         top_p?: number;
   6514         /**
   6515          * Random seed for reproducibility of the generation.
   6516          */
   6517         seed?: number;
   6518         /**
   6519          * Penalty for repeated tokens; higher values discourage repetition.
   6520          */
   6521         repetition_penalty?: number;
   6522         /**
   6523          * Decreases the likelihood of the model repeating the same lines verbatim.
   6524          */
   6525         frequency_penalty?: number;
   6526         /**
   6527          * Increases the likelihood of the model introducing new topics.
   6528          */
   6529         presence_penalty?: number;
   6530         response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;
   6531     }[];
   6532 }
   6533 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {
   6534     type?: "json_object" | "json_schema";
   6535     json_schema?: unknown;
   6536 }
   6537 type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {
   6538     /**
   6539      * The generated text response from the model
   6540      */
   6541     response: string;
   6542     /**
   6543      * Usage statistics for the inference request
   6544      */
   6545     usage?: {
   6546         /**
   6547          * Total number of tokens in input
   6548          */
   6549         prompt_tokens?: number;
   6550         /**
   6551          * Total number of tokens in output
   6552          */
   6553         completion_tokens?: number;
   6554         /**
   6555          * Total number of input and output tokens
   6556          */
   6557         total_tokens?: number;
   6558     };
   6559     /**
   6560      * An array of tool calls requests made during the response generation
   6561      */
   6562     tool_calls?: {
   6563         /**
   6564          * The arguments passed to be passed to the tool call request
   6565          */
   6566         arguments?: object;
   6567         /**
   6568          * The name of the tool to be called
   6569          */
   6570         name?: string;
   6571     }[];
   6572 } | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;
   6573 interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {
   6574     /**
   6575      * The async request id that can be used to obtain the results.
   6576      */
   6577     request_id?: string;
   6578 }
   6579 declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {
   6580     inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;
   6581     postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;
   6582 }
   6583 interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {
   6584     /**
   6585      * An array of message objects representing the conversation history.
   6586      */
   6587     messages: {
   6588         /**
   6589          * The role of the message sender must alternate between 'user' and 'assistant'.
   6590          */
   6591         role: "user" | "assistant";
   6592         /**
   6593          * The content of the message as a string.
   6594          */
   6595         content: string;
   6596     }[];
   6597     /**
   6598      * The maximum number of tokens to generate in the response.
   6599      */
   6600     max_tokens?: number;
   6601     /**
   6602      * Controls the randomness of the output; higher values produce more random results.
   6603      */
   6604     temperature?: number;
   6605     /**
   6606      * Dictate the output format of the generated response.
   6607      */
   6608     response_format?: {
   6609         /**
   6610          * Set to json_object to process and output generated text as JSON.
   6611          */
   6612         type?: string;
   6613     };
   6614 }
   6615 interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {
   6616     response?: string | {
   6617         /**
   6618          * Whether the conversation is safe or not.
   6619          */
   6620         safe?: boolean;
   6621         /**
   6622          * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.
   6623          */
   6624         categories?: string[];
   6625     };
   6626     /**
   6627      * Usage statistics for the inference request
   6628      */
   6629     usage?: {
   6630         /**
   6631          * Total number of tokens in input
   6632          */
   6633         prompt_tokens?: number;
   6634         /**
   6635          * Total number of tokens in output
   6636          */
   6637         completion_tokens?: number;
   6638         /**
   6639          * Total number of input and output tokens
   6640          */
   6641         total_tokens?: number;
   6642     };
   6643 }
   6644 declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {
   6645     inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;
   6646     postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;
   6647 }
   6648 interface Ai_Cf_Baai_Bge_Reranker_Base_Input {
   6649     /**
   6650      * A query you wish to perform against the provided contexts.
   6651      */
   6652     /**
   6653      * Number of returned results starting with the best score.
   6654      */
   6655     top_k?: number;
   6656     /**
   6657      * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
   6658      */
   6659     contexts: {
   6660         /**
   6661          * One of the provided context content
   6662          */
   6663         text?: string;
   6664     }[];
   6665 }
   6666 interface Ai_Cf_Baai_Bge_Reranker_Base_Output {
   6667     response?: {
   6668         /**
   6669          * Index of the context in the request
   6670          */
   6671         id?: number;
   6672         /**
   6673          * Score of the context under the index.
   6674          */
   6675         score?: number;
   6676     }[];
   6677 }
   6678 declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {
   6679     inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;
   6680     postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;
   6681 }
   6682 type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;
   6683 interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {
   6684     /**
   6685      * The input text prompt for the model to generate a response.
   6686      */
   6687     prompt: string;
   6688     /**
   6689      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   6690      */
   6691     lora?: string;
   6692     response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;
   6693     /**
   6694      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   6695      */
   6696     raw?: boolean;
   6697     /**
   6698      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6699      */
   6700     stream?: boolean;
   6701     /**
   6702      * The maximum number of tokens to generate in the response.
   6703      */
   6704     max_tokens?: number;
   6705     /**
   6706      * Controls the randomness of the output; higher values produce more random results.
   6707      */
   6708     temperature?: number;
   6709     /**
   6710      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6711      */
   6712     top_p?: number;
   6713     /**
   6714      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6715      */
   6716     top_k?: number;
   6717     /**
   6718      * Random seed for reproducibility of the generation.
   6719      */
   6720     seed?: number;
   6721     /**
   6722      * Penalty for repeated tokens; higher values discourage repetition.
   6723      */
   6724     repetition_penalty?: number;
   6725     /**
   6726      * Decreases the likelihood of the model repeating the same lines verbatim.
   6727      */
   6728     frequency_penalty?: number;
   6729     /**
   6730      * Increases the likelihood of the model introducing new topics.
   6731      */
   6732     presence_penalty?: number;
   6733 }
   6734 interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {
   6735     type?: "json_object" | "json_schema";
   6736     json_schema?: unknown;
   6737 }
   6738 interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {
   6739     /**
   6740      * An array of message objects representing the conversation history.
   6741      */
   6742     messages: {
   6743         /**
   6744          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   6745          */
   6746         role: string;
   6747         /**
   6748          * The content of the message as a string.
   6749          */
   6750         content: string;
   6751     }[];
   6752     functions?: {
   6753         name: string;
   6754         code: string;
   6755     }[];
   6756     /**
   6757      * A list of tools available for the assistant to use.
   6758      */
   6759     tools?: ({
   6760         /**
   6761          * The name of the tool. More descriptive the better.
   6762          */
   6763         name: string;
   6764         /**
   6765          * A brief description of what the tool does.
   6766          */
   6767         description: string;
   6768         /**
   6769          * Schema defining the parameters accepted by the tool.
   6770          */
   6771         parameters: {
   6772             /**
   6773              * The type of the parameters object (usually 'object').
   6774              */
   6775             type: string;
   6776             /**
   6777              * List of required parameter names.
   6778              */
   6779             required?: string[];
   6780             /**
   6781              * Definitions of each parameter.
   6782              */
   6783             properties: {
   6784                 [k: string]: {
   6785                     /**
   6786                      * The data type of the parameter.
   6787                      */
   6788                     type: string;
   6789                     /**
   6790                      * A description of the expected parameter.
   6791                      */
   6792                     description: string;
   6793                 };
   6794             };
   6795         };
   6796     } | {
   6797         /**
   6798          * Specifies the type of tool (e.g., 'function').
   6799          */
   6800         type: string;
   6801         /**
   6802          * Details of the function tool.
   6803          */
   6804         function: {
   6805             /**
   6806              * The name of the function.
   6807              */
   6808             name: string;
   6809             /**
   6810              * A brief description of what the function does.
   6811              */
   6812             description: string;
   6813             /**
   6814              * Schema defining the parameters accepted by the function.
   6815              */
   6816             parameters: {
   6817                 /**
   6818                  * The type of the parameters object (usually 'object').
   6819                  */
   6820                 type: string;
   6821                 /**
   6822                  * List of required parameter names.
   6823                  */
   6824                 required?: string[];
   6825                 /**
   6826                  * Definitions of each parameter.
   6827                  */
   6828                 properties: {
   6829                     [k: string]: {
   6830                         /**
   6831                          * The data type of the parameter.
   6832                          */
   6833                         type: string;
   6834                         /**
   6835                          * A description of the expected parameter.
   6836                          */
   6837                         description: string;
   6838                     };
   6839                 };
   6840             };
   6841         };
   6842     })[];
   6843     response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;
   6844     /**
   6845      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   6846      */
   6847     raw?: boolean;
   6848     /**
   6849      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6850      */
   6851     stream?: boolean;
   6852     /**
   6853      * The maximum number of tokens to generate in the response.
   6854      */
   6855     max_tokens?: number;
   6856     /**
   6857      * Controls the randomness of the output; higher values produce more random results.
   6858      */
   6859     temperature?: number;
   6860     /**
   6861      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6862      */
   6863     top_p?: number;
   6864     /**
   6865      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6866      */
   6867     top_k?: number;
   6868     /**
   6869      * Random seed for reproducibility of the generation.
   6870      */
   6871     seed?: number;
   6872     /**
   6873      * Penalty for repeated tokens; higher values discourage repetition.
   6874      */
   6875     repetition_penalty?: number;
   6876     /**
   6877      * Decreases the likelihood of the model repeating the same lines verbatim.
   6878      */
   6879     frequency_penalty?: number;
   6880     /**
   6881      * Increases the likelihood of the model introducing new topics.
   6882      */
   6883     presence_penalty?: number;
   6884 }
   6885 interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {
   6886     type?: "json_object" | "json_schema";
   6887     json_schema?: unknown;
   6888 }
   6889 type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {
   6890     /**
   6891      * The generated text response from the model
   6892      */
   6893     response: string;
   6894     /**
   6895      * Usage statistics for the inference request
   6896      */
   6897     usage?: {
   6898         /**
   6899          * Total number of tokens in input
   6900          */
   6901         prompt_tokens?: number;
   6902         /**
   6903          * Total number of tokens in output
   6904          */
   6905         completion_tokens?: number;
   6906         /**
   6907          * Total number of input and output tokens
   6908          */
   6909         total_tokens?: number;
   6910     };
   6911     /**
   6912      * An array of tool calls requests made during the response generation
   6913      */
   6914     tool_calls?: {
   6915         /**
   6916          * The arguments passed to be passed to the tool call request
   6917          */
   6918         arguments?: object;
   6919         /**
   6920          * The name of the tool to be called
   6921          */
   6922         name?: string;
   6923     }[];
   6924 };
   6925 declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {
   6926     inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;
   6927     postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;
   6928 }
   6929 type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;
   6930 interface Ai_Cf_Qwen_Qwq_32B_Prompt {
   6931     /**
   6932      * The input text prompt for the model to generate a response.
   6933      */
   6934     prompt: string;
   6935     /**
   6936      * JSON schema that should be fulfilled for the response.
   6937      */
   6938     guided_json?: object;
   6939     /**
   6940      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   6941      */
   6942     raw?: boolean;
   6943     /**
   6944      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   6945      */
   6946     stream?: boolean;
   6947     /**
   6948      * The maximum number of tokens to generate in the response.
   6949      */
   6950     max_tokens?: number;
   6951     /**
   6952      * Controls the randomness of the output; higher values produce more random results.
   6953      */
   6954     temperature?: number;
   6955     /**
   6956      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   6957      */
   6958     top_p?: number;
   6959     /**
   6960      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   6961      */
   6962     top_k?: number;
   6963     /**
   6964      * Random seed for reproducibility of the generation.
   6965      */
   6966     seed?: number;
   6967     /**
   6968      * Penalty for repeated tokens; higher values discourage repetition.
   6969      */
   6970     repetition_penalty?: number;
   6971     /**
   6972      * Decreases the likelihood of the model repeating the same lines verbatim.
   6973      */
   6974     frequency_penalty?: number;
   6975     /**
   6976      * Increases the likelihood of the model introducing new topics.
   6977      */
   6978     presence_penalty?: number;
   6979 }
   6980 interface Ai_Cf_Qwen_Qwq_32B_Messages {
   6981     /**
   6982      * An array of message objects representing the conversation history.
   6983      */
   6984     messages: {
   6985         /**
   6986          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   6987          */
   6988         role?: string;
   6989         /**
   6990          * The tool call id. If you don't know what to put here you can fall back to 000000001
   6991          */
   6992         tool_call_id?: string;
   6993         content?: string | {
   6994             /**
   6995              * Type of the content provided
   6996              */
   6997             type?: string;
   6998             text?: string;
   6999             image_url?: {
   7000                 /**
   7001                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7002                  */
   7003                 url?: string;
   7004             };
   7005         }[] | {
   7006             /**
   7007              * Type of the content provided
   7008              */
   7009             type?: string;
   7010             text?: string;
   7011             image_url?: {
   7012                 /**
   7013                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7014                  */
   7015                 url?: string;
   7016             };
   7017         };
   7018     }[];
   7019     functions?: {
   7020         name: string;
   7021         code: string;
   7022     }[];
   7023     /**
   7024      * A list of tools available for the assistant to use.
   7025      */
   7026     tools?: ({
   7027         /**
   7028          * The name of the tool. More descriptive the better.
   7029          */
   7030         name: string;
   7031         /**
   7032          * A brief description of what the tool does.
   7033          */
   7034         description: string;
   7035         /**
   7036          * Schema defining the parameters accepted by the tool.
   7037          */
   7038         parameters: {
   7039             /**
   7040              * The type of the parameters object (usually 'object').
   7041              */
   7042             type: string;
   7043             /**
   7044              * List of required parameter names.
   7045              */
   7046             required?: string[];
   7047             /**
   7048              * Definitions of each parameter.
   7049              */
   7050             properties: {
   7051                 [k: string]: {
   7052                     /**
   7053                      * The data type of the parameter.
   7054                      */
   7055                     type: string;
   7056                     /**
   7057                      * A description of the expected parameter.
   7058                      */
   7059                     description: string;
   7060                 };
   7061             };
   7062         };
   7063     } | {
   7064         /**
   7065          * Specifies the type of tool (e.g., 'function').
   7066          */
   7067         type: string;
   7068         /**
   7069          * Details of the function tool.
   7070          */
   7071         function: {
   7072             /**
   7073              * The name of the function.
   7074              */
   7075             name: string;
   7076             /**
   7077              * A brief description of what the function does.
   7078              */
   7079             description: string;
   7080             /**
   7081              * Schema defining the parameters accepted by the function.
   7082              */
   7083             parameters: {
   7084                 /**
   7085                  * The type of the parameters object (usually 'object').
   7086                  */
   7087                 type: string;
   7088                 /**
   7089                  * List of required parameter names.
   7090                  */
   7091                 required?: string[];
   7092                 /**
   7093                  * Definitions of each parameter.
   7094                  */
   7095                 properties: {
   7096                     [k: string]: {
   7097                         /**
   7098                          * The data type of the parameter.
   7099                          */
   7100                         type: string;
   7101                         /**
   7102                          * A description of the expected parameter.
   7103                          */
   7104                         description: string;
   7105                     };
   7106                 };
   7107             };
   7108         };
   7109     })[];
   7110     /**
   7111      * JSON schema that should be fufilled for the response.
   7112      */
   7113     guided_json?: object;
   7114     /**
   7115      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7116      */
   7117     raw?: boolean;
   7118     /**
   7119      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7120      */
   7121     stream?: boolean;
   7122     /**
   7123      * The maximum number of tokens to generate in the response.
   7124      */
   7125     max_tokens?: number;
   7126     /**
   7127      * Controls the randomness of the output; higher values produce more random results.
   7128      */
   7129     temperature?: number;
   7130     /**
   7131      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7132      */
   7133     top_p?: number;
   7134     /**
   7135      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7136      */
   7137     top_k?: number;
   7138     /**
   7139      * Random seed for reproducibility of the generation.
   7140      */
   7141     seed?: number;
   7142     /**
   7143      * Penalty for repeated tokens; higher values discourage repetition.
   7144      */
   7145     repetition_penalty?: number;
   7146     /**
   7147      * Decreases the likelihood of the model repeating the same lines verbatim.
   7148      */
   7149     frequency_penalty?: number;
   7150     /**
   7151      * Increases the likelihood of the model introducing new topics.
   7152      */
   7153     presence_penalty?: number;
   7154 }
   7155 type Ai_Cf_Qwen_Qwq_32B_Output = {
   7156     /**
   7157      * The generated text response from the model
   7158      */
   7159     response: string;
   7160     /**
   7161      * Usage statistics for the inference request
   7162      */
   7163     usage?: {
   7164         /**
   7165          * Total number of tokens in input
   7166          */
   7167         prompt_tokens?: number;
   7168         /**
   7169          * Total number of tokens in output
   7170          */
   7171         completion_tokens?: number;
   7172         /**
   7173          * Total number of input and output tokens
   7174          */
   7175         total_tokens?: number;
   7176     };
   7177     /**
   7178      * An array of tool calls requests made during the response generation
   7179      */
   7180     tool_calls?: {
   7181         /**
   7182          * The arguments passed to be passed to the tool call request
   7183          */
   7184         arguments?: object;
   7185         /**
   7186          * The name of the tool to be called
   7187          */
   7188         name?: string;
   7189     }[];
   7190 };
   7191 declare abstract class Base_Ai_Cf_Qwen_Qwq_32B {
   7192     inputs: Ai_Cf_Qwen_Qwq_32B_Input;
   7193     postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;
   7194 }
   7195 type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;
   7196 interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {
   7197     /**
   7198      * The input text prompt for the model to generate a response.
   7199      */
   7200     prompt: string;
   7201     /**
   7202      * JSON schema that should be fulfilled for the response.
   7203      */
   7204     guided_json?: object;
   7205     /**
   7206      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7207      */
   7208     raw?: boolean;
   7209     /**
   7210      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7211      */
   7212     stream?: boolean;
   7213     /**
   7214      * The maximum number of tokens to generate in the response.
   7215      */
   7216     max_tokens?: number;
   7217     /**
   7218      * Controls the randomness of the output; higher values produce more random results.
   7219      */
   7220     temperature?: number;
   7221     /**
   7222      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7223      */
   7224     top_p?: number;
   7225     /**
   7226      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7227      */
   7228     top_k?: number;
   7229     /**
   7230      * Random seed for reproducibility of the generation.
   7231      */
   7232     seed?: number;
   7233     /**
   7234      * Penalty for repeated tokens; higher values discourage repetition.
   7235      */
   7236     repetition_penalty?: number;
   7237     /**
   7238      * Decreases the likelihood of the model repeating the same lines verbatim.
   7239      */
   7240     frequency_penalty?: number;
   7241     /**
   7242      * Increases the likelihood of the model introducing new topics.
   7243      */
   7244     presence_penalty?: number;
   7245 }
   7246 interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
   7247     /**
   7248      * An array of message objects representing the conversation history.
   7249      */
   7250     messages: {
   7251         /**
   7252          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   7253          */
   7254         role?: string;
   7255         /**
   7256          * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001
   7257          */
   7258         tool_call_id?: string;
   7259         content?: string | {
   7260             /**
   7261              * Type of the content provided
   7262              */
   7263             type?: string;
   7264             text?: string;
   7265             image_url?: {
   7266                 /**
   7267                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7268                  */
   7269                 url?: string;
   7270             };
   7271         }[] | {
   7272             /**
   7273              * Type of the content provided
   7274              */
   7275             type?: string;
   7276             text?: string;
   7277             image_url?: {
   7278                 /**
   7279                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7280                  */
   7281                 url?: string;
   7282             };
   7283         };
   7284     }[];
   7285     functions?: {
   7286         name: string;
   7287         code: string;
   7288     }[];
   7289     /**
   7290      * A list of tools available for the assistant to use.
   7291      */
   7292     tools?: ({
   7293         /**
   7294          * The name of the tool. More descriptive the better.
   7295          */
   7296         name: string;
   7297         /**
   7298          * A brief description of what the tool does.
   7299          */
   7300         description: string;
   7301         /**
   7302          * Schema defining the parameters accepted by the tool.
   7303          */
   7304         parameters: {
   7305             /**
   7306              * The type of the parameters object (usually 'object').
   7307              */
   7308             type: string;
   7309             /**
   7310              * List of required parameter names.
   7311              */
   7312             required?: string[];
   7313             /**
   7314              * Definitions of each parameter.
   7315              */
   7316             properties: {
   7317                 [k: string]: {
   7318                     /**
   7319                      * The data type of the parameter.
   7320                      */
   7321                     type: string;
   7322                     /**
   7323                      * A description of the expected parameter.
   7324                      */
   7325                     description: string;
   7326                 };
   7327             };
   7328         };
   7329     } | {
   7330         /**
   7331          * Specifies the type of tool (e.g., 'function').
   7332          */
   7333         type: string;
   7334         /**
   7335          * Details of the function tool.
   7336          */
   7337         function: {
   7338             /**
   7339              * The name of the function.
   7340              */
   7341             name: string;
   7342             /**
   7343              * A brief description of what the function does.
   7344              */
   7345             description: string;
   7346             /**
   7347              * Schema defining the parameters accepted by the function.
   7348              */
   7349             parameters: {
   7350                 /**
   7351                  * The type of the parameters object (usually 'object').
   7352                  */
   7353                 type: string;
   7354                 /**
   7355                  * List of required parameter names.
   7356                  */
   7357                 required?: string[];
   7358                 /**
   7359                  * Definitions of each parameter.
   7360                  */
   7361                 properties: {
   7362                     [k: string]: {
   7363                         /**
   7364                          * The data type of the parameter.
   7365                          */
   7366                         type: string;
   7367                         /**
   7368                          * A description of the expected parameter.
   7369                          */
   7370                         description: string;
   7371                     };
   7372                 };
   7373             };
   7374         };
   7375     })[];
   7376     /**
   7377      * JSON schema that should be fufilled for the response.
   7378      */
   7379     guided_json?: object;
   7380     /**
   7381      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7382      */
   7383     raw?: boolean;
   7384     /**
   7385      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7386      */
   7387     stream?: boolean;
   7388     /**
   7389      * The maximum number of tokens to generate in the response.
   7390      */
   7391     max_tokens?: number;
   7392     /**
   7393      * Controls the randomness of the output; higher values produce more random results.
   7394      */
   7395     temperature?: number;
   7396     /**
   7397      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7398      */
   7399     top_p?: number;
   7400     /**
   7401      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7402      */
   7403     top_k?: number;
   7404     /**
   7405      * Random seed for reproducibility of the generation.
   7406      */
   7407     seed?: number;
   7408     /**
   7409      * Penalty for repeated tokens; higher values discourage repetition.
   7410      */
   7411     repetition_penalty?: number;
   7412     /**
   7413      * Decreases the likelihood of the model repeating the same lines verbatim.
   7414      */
   7415     frequency_penalty?: number;
   7416     /**
   7417      * Increases the likelihood of the model introducing new topics.
   7418      */
   7419     presence_penalty?: number;
   7420 }
   7421 type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {
   7422     /**
   7423      * The generated text response from the model
   7424      */
   7425     response: string;
   7426     /**
   7427      * Usage statistics for the inference request
   7428      */
   7429     usage?: {
   7430         /**
   7431          * Total number of tokens in input
   7432          */
   7433         prompt_tokens?: number;
   7434         /**
   7435          * Total number of tokens in output
   7436          */
   7437         completion_tokens?: number;
   7438         /**
   7439          * Total number of input and output tokens
   7440          */
   7441         total_tokens?: number;
   7442     };
   7443     /**
   7444      * An array of tool calls requests made during the response generation
   7445      */
   7446     tool_calls?: {
   7447         /**
   7448          * The arguments passed to be passed to the tool call request
   7449          */
   7450         arguments?: object;
   7451         /**
   7452          * The name of the tool to be called
   7453          */
   7454         name?: string;
   7455     }[];
   7456 };
   7457 declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {
   7458     inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;
   7459     postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;
   7460 }
   7461 type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;
   7462 interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
   7463     /**
   7464      * The input text prompt for the model to generate a response.
   7465      */
   7466     prompt: string;
   7467     /**
   7468      * JSON schema that should be fufilled for the response.
   7469      */
   7470     guided_json?: object;
   7471     /**
   7472      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7473      */
   7474     raw?: boolean;
   7475     /**
   7476      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7477      */
   7478     stream?: boolean;
   7479     /**
   7480      * The maximum number of tokens to generate in the response.
   7481      */
   7482     max_tokens?: number;
   7483     /**
   7484      * Controls the randomness of the output; higher values produce more random results.
   7485      */
   7486     temperature?: number;
   7487     /**
   7488      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7489      */
   7490     top_p?: number;
   7491     /**
   7492      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7493      */
   7494     top_k?: number;
   7495     /**
   7496      * Random seed for reproducibility of the generation.
   7497      */
   7498     seed?: number;
   7499     /**
   7500      * Penalty for repeated tokens; higher values discourage repetition.
   7501      */
   7502     repetition_penalty?: number;
   7503     /**
   7504      * Decreases the likelihood of the model repeating the same lines verbatim.
   7505      */
   7506     frequency_penalty?: number;
   7507     /**
   7508      * Increases the likelihood of the model introducing new topics.
   7509      */
   7510     presence_penalty?: number;
   7511 }
   7512 interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
   7513     /**
   7514      * An array of message objects representing the conversation history.
   7515      */
   7516     messages: {
   7517         /**
   7518          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   7519          */
   7520         role?: string;
   7521         content?: string | {
   7522             /**
   7523              * Type of the content provided
   7524              */
   7525             type?: string;
   7526             text?: string;
   7527             image_url?: {
   7528                 /**
   7529                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7530                  */
   7531                 url?: string;
   7532             };
   7533         }[];
   7534     }[];
   7535     functions?: {
   7536         name: string;
   7537         code: string;
   7538     }[];
   7539     /**
   7540      * A list of tools available for the assistant to use.
   7541      */
   7542     tools?: ({
   7543         /**
   7544          * The name of the tool. More descriptive the better.
   7545          */
   7546         name: string;
   7547         /**
   7548          * A brief description of what the tool does.
   7549          */
   7550         description: string;
   7551         /**
   7552          * Schema defining the parameters accepted by the tool.
   7553          */
   7554         parameters: {
   7555             /**
   7556              * The type of the parameters object (usually 'object').
   7557              */
   7558             type: string;
   7559             /**
   7560              * List of required parameter names.
   7561              */
   7562             required?: string[];
   7563             /**
   7564              * Definitions of each parameter.
   7565              */
   7566             properties: {
   7567                 [k: string]: {
   7568                     /**
   7569                      * The data type of the parameter.
   7570                      */
   7571                     type: string;
   7572                     /**
   7573                      * A description of the expected parameter.
   7574                      */
   7575                     description: string;
   7576                 };
   7577             };
   7578         };
   7579     } | {
   7580         /**
   7581          * Specifies the type of tool (e.g., 'function').
   7582          */
   7583         type: string;
   7584         /**
   7585          * Details of the function tool.
   7586          */
   7587         function: {
   7588             /**
   7589              * The name of the function.
   7590              */
   7591             name: string;
   7592             /**
   7593              * A brief description of what the function does.
   7594              */
   7595             description: string;
   7596             /**
   7597              * Schema defining the parameters accepted by the function.
   7598              */
   7599             parameters: {
   7600                 /**
   7601                  * The type of the parameters object (usually 'object').
   7602                  */
   7603                 type: string;
   7604                 /**
   7605                  * List of required parameter names.
   7606                  */
   7607                 required?: string[];
   7608                 /**
   7609                  * Definitions of each parameter.
   7610                  */
   7611                 properties: {
   7612                     [k: string]: {
   7613                         /**
   7614                          * The data type of the parameter.
   7615                          */
   7616                         type: string;
   7617                         /**
   7618                          * A description of the expected parameter.
   7619                          */
   7620                         description: string;
   7621                     };
   7622                 };
   7623             };
   7624         };
   7625     })[];
   7626     /**
   7627      * JSON schema that should be fufilled for the response.
   7628      */
   7629     guided_json?: object;
   7630     /**
   7631      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7632      */
   7633     raw?: boolean;
   7634     /**
   7635      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7636      */
   7637     stream?: boolean;
   7638     /**
   7639      * The maximum number of tokens to generate in the response.
   7640      */
   7641     max_tokens?: number;
   7642     /**
   7643      * Controls the randomness of the output; higher values produce more random results.
   7644      */
   7645     temperature?: number;
   7646     /**
   7647      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7648      */
   7649     top_p?: number;
   7650     /**
   7651      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7652      */
   7653     top_k?: number;
   7654     /**
   7655      * Random seed for reproducibility of the generation.
   7656      */
   7657     seed?: number;
   7658     /**
   7659      * Penalty for repeated tokens; higher values discourage repetition.
   7660      */
   7661     repetition_penalty?: number;
   7662     /**
   7663      * Decreases the likelihood of the model repeating the same lines verbatim.
   7664      */
   7665     frequency_penalty?: number;
   7666     /**
   7667      * Increases the likelihood of the model introducing new topics.
   7668      */
   7669     presence_penalty?: number;
   7670 }
   7671 type Ai_Cf_Google_Gemma_3_12B_It_Output = {
   7672     /**
   7673      * The generated text response from the model
   7674      */
   7675     response: string;
   7676     /**
   7677      * Usage statistics for the inference request
   7678      */
   7679     usage?: {
   7680         /**
   7681          * Total number of tokens in input
   7682          */
   7683         prompt_tokens?: number;
   7684         /**
   7685          * Total number of tokens in output
   7686          */
   7687         completion_tokens?: number;
   7688         /**
   7689          * Total number of input and output tokens
   7690          */
   7691         total_tokens?: number;
   7692     };
   7693     /**
   7694      * An array of tool calls requests made during the response generation
   7695      */
   7696     tool_calls?: {
   7697         /**
   7698          * The arguments passed to be passed to the tool call request
   7699          */
   7700         arguments?: object;
   7701         /**
   7702          * The name of the tool to be called
   7703          */
   7704         name?: string;
   7705     }[];
   7706 };
   7707 declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {
   7708     inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;
   7709     postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;
   7710 }
   7711 type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;
   7712 interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {
   7713     /**
   7714      * The input text prompt for the model to generate a response.
   7715      */
   7716     prompt: string;
   7717     /**
   7718      * JSON schema that should be fulfilled for the response.
   7719      */
   7720     guided_json?: object;
   7721     response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
   7722     /**
   7723      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7724      */
   7725     raw?: boolean;
   7726     /**
   7727      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7728      */
   7729     stream?: boolean;
   7730     /**
   7731      * The maximum number of tokens to generate in the response.
   7732      */
   7733     max_tokens?: number;
   7734     /**
   7735      * Controls the randomness of the output; higher values produce more random results.
   7736      */
   7737     temperature?: number;
   7738     /**
   7739      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7740      */
   7741     top_p?: number;
   7742     /**
   7743      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7744      */
   7745     top_k?: number;
   7746     /**
   7747      * Random seed for reproducibility of the generation.
   7748      */
   7749     seed?: number;
   7750     /**
   7751      * Penalty for repeated tokens; higher values discourage repetition.
   7752      */
   7753     repetition_penalty?: number;
   7754     /**
   7755      * Decreases the likelihood of the model repeating the same lines verbatim.
   7756      */
   7757     frequency_penalty?: number;
   7758     /**
   7759      * Increases the likelihood of the model introducing new topics.
   7760      */
   7761     presence_penalty?: number;
   7762 }
   7763 interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {
   7764     type?: "json_object" | "json_schema";
   7765     json_schema?: unknown;
   7766 }
   7767 interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
   7768     /**
   7769      * An array of message objects representing the conversation history.
   7770      */
   7771     messages: {
   7772         /**
   7773          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   7774          */
   7775         role?: string;
   7776         /**
   7777          * The tool call id. If you don't know what to put here you can fall back to 000000001
   7778          */
   7779         tool_call_id?: string;
   7780         content?: string | {
   7781             /**
   7782              * Type of the content provided
   7783              */
   7784             type?: string;
   7785             text?: string;
   7786             image_url?: {
   7787                 /**
   7788                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7789                  */
   7790                 url?: string;
   7791             };
   7792         }[] | {
   7793             /**
   7794              * Type of the content provided
   7795              */
   7796             type?: string;
   7797             text?: string;
   7798             image_url?: {
   7799                 /**
   7800                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   7801                  */
   7802                 url?: string;
   7803             };
   7804         };
   7805     }[];
   7806     functions?: {
   7807         name: string;
   7808         code: string;
   7809     }[];
   7810     /**
   7811      * A list of tools available for the assistant to use.
   7812      */
   7813     tools?: ({
   7814         /**
   7815          * The name of the tool. More descriptive the better.
   7816          */
   7817         name: string;
   7818         /**
   7819          * A brief description of what the tool does.
   7820          */
   7821         description: string;
   7822         /**
   7823          * Schema defining the parameters accepted by the tool.
   7824          */
   7825         parameters: {
   7826             /**
   7827              * The type of the parameters object (usually 'object').
   7828              */
   7829             type: string;
   7830             /**
   7831              * List of required parameter names.
   7832              */
   7833             required?: string[];
   7834             /**
   7835              * Definitions of each parameter.
   7836              */
   7837             properties: {
   7838                 [k: string]: {
   7839                     /**
   7840                      * The data type of the parameter.
   7841                      */
   7842                     type: string;
   7843                     /**
   7844                      * A description of the expected parameter.
   7845                      */
   7846                     description: string;
   7847                 };
   7848             };
   7849         };
   7850     } | {
   7851         /**
   7852          * Specifies the type of tool (e.g., 'function').
   7853          */
   7854         type: string;
   7855         /**
   7856          * Details of the function tool.
   7857          */
   7858         function: {
   7859             /**
   7860              * The name of the function.
   7861              */
   7862             name: string;
   7863             /**
   7864              * A brief description of what the function does.
   7865              */
   7866             description: string;
   7867             /**
   7868              * Schema defining the parameters accepted by the function.
   7869              */
   7870             parameters: {
   7871                 /**
   7872                  * The type of the parameters object (usually 'object').
   7873                  */
   7874                 type: string;
   7875                 /**
   7876                  * List of required parameter names.
   7877                  */
   7878                 required?: string[];
   7879                 /**
   7880                  * Definitions of each parameter.
   7881                  */
   7882                 properties: {
   7883                     [k: string]: {
   7884                         /**
   7885                          * The data type of the parameter.
   7886                          */
   7887                         type: string;
   7888                         /**
   7889                          * A description of the expected parameter.
   7890                          */
   7891                         description: string;
   7892                     };
   7893                 };
   7894             };
   7895         };
   7896     })[];
   7897     response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
   7898     /**
   7899      * JSON schema that should be fufilled for the response.
   7900      */
   7901     guided_json?: object;
   7902     /**
   7903      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7904      */
   7905     raw?: boolean;
   7906     /**
   7907      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7908      */
   7909     stream?: boolean;
   7910     /**
   7911      * The maximum number of tokens to generate in the response.
   7912      */
   7913     max_tokens?: number;
   7914     /**
   7915      * Controls the randomness of the output; higher values produce more random results.
   7916      */
   7917     temperature?: number;
   7918     /**
   7919      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7920      */
   7921     top_p?: number;
   7922     /**
   7923      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7924      */
   7925     top_k?: number;
   7926     /**
   7927      * Random seed for reproducibility of the generation.
   7928      */
   7929     seed?: number;
   7930     /**
   7931      * Penalty for repeated tokens; higher values discourage repetition.
   7932      */
   7933     repetition_penalty?: number;
   7934     /**
   7935      * Decreases the likelihood of the model repeating the same lines verbatim.
   7936      */
   7937     frequency_penalty?: number;
   7938     /**
   7939      * Increases the likelihood of the model introducing new topics.
   7940      */
   7941     presence_penalty?: number;
   7942 }
   7943 interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {
   7944     requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];
   7945 }
   7946 interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {
   7947     /**
   7948      * The input text prompt for the model to generate a response.
   7949      */
   7950     prompt: string;
   7951     /**
   7952      * JSON schema that should be fulfilled for the response.
   7953      */
   7954     guided_json?: object;
   7955     response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
   7956     /**
   7957      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   7958      */
   7959     raw?: boolean;
   7960     /**
   7961      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   7962      */
   7963     stream?: boolean;
   7964     /**
   7965      * The maximum number of tokens to generate in the response.
   7966      */
   7967     max_tokens?: number;
   7968     /**
   7969      * Controls the randomness of the output; higher values produce more random results.
   7970      */
   7971     temperature?: number;
   7972     /**
   7973      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   7974      */
   7975     top_p?: number;
   7976     /**
   7977      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   7978      */
   7979     top_k?: number;
   7980     /**
   7981      * Random seed for reproducibility of the generation.
   7982      */
   7983     seed?: number;
   7984     /**
   7985      * Penalty for repeated tokens; higher values discourage repetition.
   7986      */
   7987     repetition_penalty?: number;
   7988     /**
   7989      * Decreases the likelihood of the model repeating the same lines verbatim.
   7990      */
   7991     frequency_penalty?: number;
   7992     /**
   7993      * Increases the likelihood of the model introducing new topics.
   7994      */
   7995     presence_penalty?: number;
   7996 }
   7997 interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
   7998     /**
   7999      * An array of message objects representing the conversation history.
   8000      */
   8001     messages: {
   8002         /**
   8003          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   8004          */
   8005         role?: string;
   8006         /**
   8007          * The tool call id. If you don't know what to put here you can fall back to 000000001
   8008          */
   8009         tool_call_id?: string;
   8010         content?: string | {
   8011             /**
   8012              * Type of the content provided
   8013              */
   8014             type?: string;
   8015             text?: string;
   8016             image_url?: {
   8017                 /**
   8018                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   8019                  */
   8020                 url?: string;
   8021             };
   8022         }[] | {
   8023             /**
   8024              * Type of the content provided
   8025              */
   8026             type?: string;
   8027             text?: string;
   8028             image_url?: {
   8029                 /**
   8030                  * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
   8031                  */
   8032                 url?: string;
   8033             };
   8034         };
   8035     }[];
   8036     functions?: {
   8037         name: string;
   8038         code: string;
   8039     }[];
   8040     /**
   8041      * A list of tools available for the assistant to use.
   8042      */
   8043     tools?: ({
   8044         /**
   8045          * The name of the tool. More descriptive the better.
   8046          */
   8047         name: string;
   8048         /**
   8049          * A brief description of what the tool does.
   8050          */
   8051         description: string;
   8052         /**
   8053          * Schema defining the parameters accepted by the tool.
   8054          */
   8055         parameters: {
   8056             /**
   8057              * The type of the parameters object (usually 'object').
   8058              */
   8059             type: string;
   8060             /**
   8061              * List of required parameter names.
   8062              */
   8063             required?: string[];
   8064             /**
   8065              * Definitions of each parameter.
   8066              */
   8067             properties: {
   8068                 [k: string]: {
   8069                     /**
   8070                      * The data type of the parameter.
   8071                      */
   8072                     type: string;
   8073                     /**
   8074                      * A description of the expected parameter.
   8075                      */
   8076                     description: string;
   8077                 };
   8078             };
   8079         };
   8080     } | {
   8081         /**
   8082          * Specifies the type of tool (e.g., 'function').
   8083          */
   8084         type: string;
   8085         /**
   8086          * Details of the function tool.
   8087          */
   8088         function: {
   8089             /**
   8090              * The name of the function.
   8091              */
   8092             name: string;
   8093             /**
   8094              * A brief description of what the function does.
   8095              */
   8096             description: string;
   8097             /**
   8098              * Schema defining the parameters accepted by the function.
   8099              */
   8100             parameters: {
   8101                 /**
   8102                  * The type of the parameters object (usually 'object').
   8103                  */
   8104                 type: string;
   8105                 /**
   8106                  * List of required parameter names.
   8107                  */
   8108                 required?: string[];
   8109                 /**
   8110                  * Definitions of each parameter.
   8111                  */
   8112                 properties: {
   8113                     [k: string]: {
   8114                         /**
   8115                          * The data type of the parameter.
   8116                          */
   8117                         type: string;
   8118                         /**
   8119                          * A description of the expected parameter.
   8120                          */
   8121                         description: string;
   8122                     };
   8123                 };
   8124             };
   8125         };
   8126     })[];
   8127     response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
   8128     /**
   8129      * JSON schema that should be fufilled for the response.
   8130      */
   8131     guided_json?: object;
   8132     /**
   8133      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   8134      */
   8135     raw?: boolean;
   8136     /**
   8137      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   8138      */
   8139     stream?: boolean;
   8140     /**
   8141      * The maximum number of tokens to generate in the response.
   8142      */
   8143     max_tokens?: number;
   8144     /**
   8145      * Controls the randomness of the output; higher values produce more random results.
   8146      */
   8147     temperature?: number;
   8148     /**
   8149      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   8150      */
   8151     top_p?: number;
   8152     /**
   8153      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   8154      */
   8155     top_k?: number;
   8156     /**
   8157      * Random seed for reproducibility of the generation.
   8158      */
   8159     seed?: number;
   8160     /**
   8161      * Penalty for repeated tokens; higher values discourage repetition.
   8162      */
   8163     repetition_penalty?: number;
   8164     /**
   8165      * Decreases the likelihood of the model repeating the same lines verbatim.
   8166      */
   8167     frequency_penalty?: number;
   8168     /**
   8169      * Increases the likelihood of the model introducing new topics.
   8170      */
   8171     presence_penalty?: number;
   8172 }
   8173 type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
   8174     /**
   8175      * The generated text response from the model
   8176      */
   8177     response: string;
   8178     /**
   8179      * Usage statistics for the inference request
   8180      */
   8181     usage?: {
   8182         /**
   8183          * Total number of tokens in input
   8184          */
   8185         prompt_tokens?: number;
   8186         /**
   8187          * Total number of tokens in output
   8188          */
   8189         completion_tokens?: number;
   8190         /**
   8191          * Total number of input and output tokens
   8192          */
   8193         total_tokens?: number;
   8194     };
   8195     /**
   8196      * An array of tool calls requests made during the response generation
   8197      */
   8198     tool_calls?: {
   8199         /**
   8200          * The tool call id.
   8201          */
   8202         id?: string;
   8203         /**
   8204          * Specifies the type of tool (e.g., 'function').
   8205          */
   8206         type?: string;
   8207         /**
   8208          * Details of the function tool.
   8209          */
   8210         function?: {
   8211             /**
   8212              * The name of the tool to be called
   8213              */
   8214             name?: string;
   8215             /**
   8216              * The arguments passed to be passed to the tool call request
   8217              */
   8218             arguments?: object;
   8219         };
   8220     }[];
   8221 };
   8222 declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {
   8223     inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;
   8224     postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;
   8225 }
   8226 type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;
   8227 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {
   8228     /**
   8229      * The input text prompt for the model to generate a response.
   8230      */
   8231     prompt: string;
   8232     /**
   8233      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   8234      */
   8235     lora?: string;
   8236     response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;
   8237     /**
   8238      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   8239      */
   8240     raw?: boolean;
   8241     /**
   8242      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   8243      */
   8244     stream?: boolean;
   8245     /**
   8246      * The maximum number of tokens to generate in the response.
   8247      */
   8248     max_tokens?: number;
   8249     /**
   8250      * Controls the randomness of the output; higher values produce more random results.
   8251      */
   8252     temperature?: number;
   8253     /**
   8254      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   8255      */
   8256     top_p?: number;
   8257     /**
   8258      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   8259      */
   8260     top_k?: number;
   8261     /**
   8262      * Random seed for reproducibility of the generation.
   8263      */
   8264     seed?: number;
   8265     /**
   8266      * Penalty for repeated tokens; higher values discourage repetition.
   8267      */
   8268     repetition_penalty?: number;
   8269     /**
   8270      * Decreases the likelihood of the model repeating the same lines verbatim.
   8271      */
   8272     frequency_penalty?: number;
   8273     /**
   8274      * Increases the likelihood of the model introducing new topics.
   8275      */
   8276     presence_penalty?: number;
   8277 }
   8278 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {
   8279     type?: "json_object" | "json_schema";
   8280     json_schema?: unknown;
   8281 }
   8282 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
   8283     /**
   8284      * An array of message objects representing the conversation history.
   8285      */
   8286     messages: {
   8287         /**
   8288          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   8289          */
   8290         role: string;
   8291         content: string | {
   8292             /**
   8293              * Type of the content (text)
   8294              */
   8295             type?: string;
   8296             /**
   8297              * Text content
   8298              */
   8299             text?: string;
   8300         }[];
   8301     }[];
   8302     functions?: {
   8303         name: string;
   8304         code: string;
   8305     }[];
   8306     /**
   8307      * A list of tools available for the assistant to use.
   8308      */
   8309     tools?: ({
   8310         /**
   8311          * The name of the tool. More descriptive the better.
   8312          */
   8313         name: string;
   8314         /**
   8315          * A brief description of what the tool does.
   8316          */
   8317         description: string;
   8318         /**
   8319          * Schema defining the parameters accepted by the tool.
   8320          */
   8321         parameters: {
   8322             /**
   8323              * The type of the parameters object (usually 'object').
   8324              */
   8325             type: string;
   8326             /**
   8327              * List of required parameter names.
   8328              */
   8329             required?: string[];
   8330             /**
   8331              * Definitions of each parameter.
   8332              */
   8333             properties: {
   8334                 [k: string]: {
   8335                     /**
   8336                      * The data type of the parameter.
   8337                      */
   8338                     type: string;
   8339                     /**
   8340                      * A description of the expected parameter.
   8341                      */
   8342                     description: string;
   8343                 };
   8344             };
   8345         };
   8346     } | {
   8347         /**
   8348          * Specifies the type of tool (e.g., 'function').
   8349          */
   8350         type: string;
   8351         /**
   8352          * Details of the function tool.
   8353          */
   8354         function: {
   8355             /**
   8356              * The name of the function.
   8357              */
   8358             name: string;
   8359             /**
   8360              * A brief description of what the function does.
   8361              */
   8362             description: string;
   8363             /**
   8364              * Schema defining the parameters accepted by the function.
   8365              */
   8366             parameters: {
   8367                 /**
   8368                  * The type of the parameters object (usually 'object').
   8369                  */
   8370                 type: string;
   8371                 /**
   8372                  * List of required parameter names.
   8373                  */
   8374                 required?: string[];
   8375                 /**
   8376                  * Definitions of each parameter.
   8377                  */
   8378                 properties: {
   8379                     [k: string]: {
   8380                         /**
   8381                          * The data type of the parameter.
   8382                          */
   8383                         type: string;
   8384                         /**
   8385                          * A description of the expected parameter.
   8386                          */
   8387                         description: string;
   8388                     };
   8389                 };
   8390             };
   8391         };
   8392     })[];
   8393     response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;
   8394     /**
   8395      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   8396      */
   8397     raw?: boolean;
   8398     /**
   8399      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   8400      */
   8401     stream?: boolean;
   8402     /**
   8403      * The maximum number of tokens to generate in the response.
   8404      */
   8405     max_tokens?: number;
   8406     /**
   8407      * Controls the randomness of the output; higher values produce more random results.
   8408      */
   8409     temperature?: number;
   8410     /**
   8411      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   8412      */
   8413     top_p?: number;
   8414     /**
   8415      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   8416      */
   8417     top_k?: number;
   8418     /**
   8419      * Random seed for reproducibility of the generation.
   8420      */
   8421     seed?: number;
   8422     /**
   8423      * Penalty for repeated tokens; higher values discourage repetition.
   8424      */
   8425     repetition_penalty?: number;
   8426     /**
   8427      * Decreases the likelihood of the model repeating the same lines verbatim.
   8428      */
   8429     frequency_penalty?: number;
   8430     /**
   8431      * Increases the likelihood of the model introducing new topics.
   8432      */
   8433     presence_penalty?: number;
   8434 }
   8435 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {
   8436     type?: "json_object" | "json_schema";
   8437     json_schema?: unknown;
   8438 }
   8439 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {
   8440     requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];
   8441 }
   8442 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {
   8443     /**
   8444      * The input text prompt for the model to generate a response.
   8445      */
   8446     prompt: string;
   8447     /**
   8448      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   8449      */
   8450     lora?: string;
   8451     response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;
   8452     /**
   8453      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   8454      */
   8455     raw?: boolean;
   8456     /**
   8457      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   8458      */
   8459     stream?: boolean;
   8460     /**
   8461      * The maximum number of tokens to generate in the response.
   8462      */
   8463     max_tokens?: number;
   8464     /**
   8465      * Controls the randomness of the output; higher values produce more random results.
   8466      */
   8467     temperature?: number;
   8468     /**
   8469      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   8470      */
   8471     top_p?: number;
   8472     /**
   8473      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   8474      */
   8475     top_k?: number;
   8476     /**
   8477      * Random seed for reproducibility of the generation.
   8478      */
   8479     seed?: number;
   8480     /**
   8481      * Penalty for repeated tokens; higher values discourage repetition.
   8482      */
   8483     repetition_penalty?: number;
   8484     /**
   8485      * Decreases the likelihood of the model repeating the same lines verbatim.
   8486      */
   8487     frequency_penalty?: number;
   8488     /**
   8489      * Increases the likelihood of the model introducing new topics.
   8490      */
   8491     presence_penalty?: number;
   8492 }
   8493 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {
   8494     type?: "json_object" | "json_schema";
   8495     json_schema?: unknown;
   8496 }
   8497 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
   8498     /**
   8499      * An array of message objects representing the conversation history.
   8500      */
   8501     messages: {
   8502         /**
   8503          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   8504          */
   8505         role: string;
   8506         content: string | {
   8507             /**
   8508              * Type of the content (text)
   8509              */
   8510             type?: string;
   8511             /**
   8512              * Text content
   8513              */
   8514             text?: string;
   8515         }[];
   8516     }[];
   8517     functions?: {
   8518         name: string;
   8519         code: string;
   8520     }[];
   8521     /**
   8522      * A list of tools available for the assistant to use.
   8523      */
   8524     tools?: ({
   8525         /**
   8526          * The name of the tool. More descriptive the better.
   8527          */
   8528         name: string;
   8529         /**
   8530          * A brief description of what the tool does.
   8531          */
   8532         description: string;
   8533         /**
   8534          * Schema defining the parameters accepted by the tool.
   8535          */
   8536         parameters: {
   8537             /**
   8538              * The type of the parameters object (usually 'object').
   8539              */
   8540             type: string;
   8541             /**
   8542              * List of required parameter names.
   8543              */
   8544             required?: string[];
   8545             /**
   8546              * Definitions of each parameter.
   8547              */
   8548             properties: {
   8549                 [k: string]: {
   8550                     /**
   8551                      * The data type of the parameter.
   8552                      */
   8553                     type: string;
   8554                     /**
   8555                      * A description of the expected parameter.
   8556                      */
   8557                     description: string;
   8558                 };
   8559             };
   8560         };
   8561     } | {
   8562         /**
   8563          * Specifies the type of tool (e.g., 'function').
   8564          */
   8565         type: string;
   8566         /**
   8567          * Details of the function tool.
   8568          */
   8569         function: {
   8570             /**
   8571              * The name of the function.
   8572              */
   8573             name: string;
   8574             /**
   8575              * A brief description of what the function does.
   8576              */
   8577             description: string;
   8578             /**
   8579              * Schema defining the parameters accepted by the function.
   8580              */
   8581             parameters: {
   8582                 /**
   8583                  * The type of the parameters object (usually 'object').
   8584                  */
   8585                 type: string;
   8586                 /**
   8587                  * List of required parameter names.
   8588                  */
   8589                 required?: string[];
   8590                 /**
   8591                  * Definitions of each parameter.
   8592                  */
   8593                 properties: {
   8594                     [k: string]: {
   8595                         /**
   8596                          * The data type of the parameter.
   8597                          */
   8598                         type: string;
   8599                         /**
   8600                          * A description of the expected parameter.
   8601                          */
   8602                         description: string;
   8603                     };
   8604                 };
   8605             };
   8606         };
   8607     })[];
   8608     response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;
   8609     /**
   8610      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   8611      */
   8612     raw?: boolean;
   8613     /**
   8614      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   8615      */
   8616     stream?: boolean;
   8617     /**
   8618      * The maximum number of tokens to generate in the response.
   8619      */
   8620     max_tokens?: number;
   8621     /**
   8622      * Controls the randomness of the output; higher values produce more random results.
   8623      */
   8624     temperature?: number;
   8625     /**
   8626      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   8627      */
   8628     top_p?: number;
   8629     /**
   8630      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   8631      */
   8632     top_k?: number;
   8633     /**
   8634      * Random seed for reproducibility of the generation.
   8635      */
   8636     seed?: number;
   8637     /**
   8638      * Penalty for repeated tokens; higher values discourage repetition.
   8639      */
   8640     repetition_penalty?: number;
   8641     /**
   8642      * Decreases the likelihood of the model repeating the same lines verbatim.
   8643      */
   8644     frequency_penalty?: number;
   8645     /**
   8646      * Increases the likelihood of the model introducing new topics.
   8647      */
   8648     presence_penalty?: number;
   8649 }
   8650 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {
   8651     type?: "json_object" | "json_schema";
   8652     json_schema?: unknown;
   8653 }
   8654 type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;
   8655 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {
   8656     /**
   8657      * Unique identifier for the completion
   8658      */
   8659     id?: string;
   8660     /**
   8661      * Object type identifier
   8662      */
   8663     object?: "chat.completion";
   8664     /**
   8665      * Unix timestamp of when the completion was created
   8666      */
   8667     created?: number;
   8668     /**
   8669      * Model used for the completion
   8670      */
   8671     model?: string;
   8672     /**
   8673      * List of completion choices
   8674      */
   8675     choices?: {
   8676         /**
   8677          * Index of the choice in the list
   8678          */
   8679         index?: number;
   8680         /**
   8681          * The message generated by the model
   8682          */
   8683         message?: {
   8684             /**
   8685              * Role of the message author
   8686              */
   8687             role: string;
   8688             /**
   8689              * The content of the message
   8690              */
   8691             content: string;
   8692             /**
   8693              * Internal reasoning content (if available)
   8694              */
   8695             reasoning_content?: string;
   8696             /**
   8697              * Tool calls made by the assistant
   8698              */
   8699             tool_calls?: {
   8700                 /**
   8701                  * Unique identifier for the tool call
   8702                  */
   8703                 id: string;
   8704                 /**
   8705                  * Type of tool call
   8706                  */
   8707                 type: "function";
   8708                 function: {
   8709                     /**
   8710                      * Name of the function to call
   8711                      */
   8712                     name: string;
   8713                     /**
   8714                      * JSON string of arguments for the function
   8715                      */
   8716                     arguments: string;
   8717                 };
   8718             }[];
   8719         };
   8720         /**
   8721          * Reason why the model stopped generating
   8722          */
   8723         finish_reason?: string;
   8724         /**
   8725          * Stop reason (may be null)
   8726          */
   8727         stop_reason?: string | null;
   8728         /**
   8729          * Log probabilities (if requested)
   8730          */
   8731         logprobs?: {} | null;
   8732     }[];
   8733     /**
   8734      * Usage statistics for the inference request
   8735      */
   8736     usage?: {
   8737         /**
   8738          * Total number of tokens in input
   8739          */
   8740         prompt_tokens?: number;
   8741         /**
   8742          * Total number of tokens in output
   8743          */
   8744         completion_tokens?: number;
   8745         /**
   8746          * Total number of input and output tokens
   8747          */
   8748         total_tokens?: number;
   8749     };
   8750     /**
   8751      * Log probabilities for the prompt (if requested)
   8752      */
   8753     prompt_logprobs?: {} | null;
   8754 }
   8755 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {
   8756     /**
   8757      * Unique identifier for the completion
   8758      */
   8759     id?: string;
   8760     /**
   8761      * Object type identifier
   8762      */
   8763     object?: "text_completion";
   8764     /**
   8765      * Unix timestamp of when the completion was created
   8766      */
   8767     created?: number;
   8768     /**
   8769      * Model used for the completion
   8770      */
   8771     model?: string;
   8772     /**
   8773      * List of completion choices
   8774      */
   8775     choices?: {
   8776         /**
   8777          * Index of the choice in the list
   8778          */
   8779         index: number;
   8780         /**
   8781          * The generated text completion
   8782          */
   8783         text: string;
   8784         /**
   8785          * Reason why the model stopped generating
   8786          */
   8787         finish_reason: string;
   8788         /**
   8789          * Stop reason (may be null)
   8790          */
   8791         stop_reason?: string | null;
   8792         /**
   8793          * Log probabilities (if requested)
   8794          */
   8795         logprobs?: {} | null;
   8796         /**
   8797          * Log probabilities for the prompt (if requested)
   8798          */
   8799         prompt_logprobs?: {} | null;
   8800     }[];
   8801     /**
   8802      * Usage statistics for the inference request
   8803      */
   8804     usage?: {
   8805         /**
   8806          * Total number of tokens in input
   8807          */
   8808         prompt_tokens?: number;
   8809         /**
   8810          * Total number of tokens in output
   8811          */
   8812         completion_tokens?: number;
   8813         /**
   8814          * Total number of input and output tokens
   8815          */
   8816         total_tokens?: number;
   8817     };
   8818 }
   8819 interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {
   8820     /**
   8821      * The async request id that can be used to obtain the results.
   8822      */
   8823     request_id?: string;
   8824 }
   8825 declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {
   8826     inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;
   8827     postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;
   8828 }
   8829 interface Ai_Cf_Deepgram_Nova_3_Input {
   8830     audio: {
   8831         body: object;
   8832         contentType: string;
   8833     };
   8834     /**
   8835      * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.
   8836      */
   8837     custom_topic_mode?: "extended" | "strict";
   8838     /**
   8839      * Custom topics you want the model to detect within your input audio or text if present Submit up to 100
   8840      */
   8841     custom_topic?: string;
   8842     /**
   8843      * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param
   8844      */
   8845     custom_intent_mode?: "extended" | "strict";
   8846     /**
   8847      * Custom intents you want the model to detect within your input audio if present
   8848      */
   8849     custom_intent?: string;
   8850     /**
   8851      * Identifies and extracts key entities from content in submitted audio
   8852      */
   8853     detect_entities?: boolean;
   8854     /**
   8855      * Identifies the dominant language spoken in submitted audio
   8856      */
   8857     detect_language?: boolean;
   8858     /**
   8859      * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0
   8860      */
   8861     diarize?: boolean;
   8862     /**
   8863      * Identify and extract key entities from content in submitted audio
   8864      */
   8865     dictation?: boolean;
   8866     /**
   8867      * Specify the expected encoding of your submitted audio
   8868      */
   8869     encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729";
   8870     /**
   8871      * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing
   8872      */
   8873     extra?: string;
   8874     /**
   8875      * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'
   8876      */
   8877     filler_words?: boolean;
   8878     /**
   8879      * Key term prompting can boost or suppress specialized terminology and brands.
   8880      */
   8881     keyterm?: string;
   8882     /**
   8883      * Keywords can boost or suppress specialized terminology and brands.
   8884      */
   8885     keywords?: string;
   8886     /**
   8887      * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.
   8888      */
   8889     language?: string;
   8890     /**
   8891      * Spoken measurements will be converted to their corresponding abbreviations.
   8892      */
   8893     measurements?: boolean;
   8894     /**
   8895      * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.
   8896      */
   8897     mip_opt_out?: boolean;
   8898     /**
   8899      * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio
   8900      */
   8901     mode?: "general" | "medical" | "finance";
   8902     /**
   8903      * Transcribe each audio channel independently.
   8904      */
   8905     multichannel?: boolean;
   8906     /**
   8907      * Numerals converts numbers from written format to numerical format.
   8908      */
   8909     numerals?: boolean;
   8910     /**
   8911      * Splits audio into paragraphs to improve transcript readability.
   8912      */
   8913     paragraphs?: boolean;
   8914     /**
   8915      * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.
   8916      */
   8917     profanity_filter?: boolean;
   8918     /**
   8919      * Add punctuation and capitalization to the transcript.
   8920      */
   8921     punctuate?: boolean;
   8922     /**
   8923      * Redaction removes sensitive information from your transcripts.
   8924      */
   8925     redact?: string;
   8926     /**
   8927      * Search for terms or phrases in submitted audio and replaces them.
   8928      */
   8929     replace?: string;
   8930     /**
   8931      * Search for terms or phrases in submitted audio.
   8932      */
   8933     search?: string;
   8934     /**
   8935      * Recognizes the sentiment throughout a transcript or text.
   8936      */
   8937     sentiment?: boolean;
   8938     /**
   8939      * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.
   8940      */
   8941     smart_format?: boolean;
   8942     /**
   8943      * Detect topics throughout a transcript or text.
   8944      */
   8945     topics?: boolean;
   8946     /**
   8947      * Segments speech into meaningful semantic units.
   8948      */
   8949     utterances?: boolean;
   8950     /**
   8951      * Seconds to wait before detecting a pause between words in submitted audio.
   8952      */
   8953     utt_split?: number;
   8954     /**
   8955      * The number of channels in the submitted audio
   8956      */
   8957     channels?: number;
   8958     /**
   8959      * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.
   8960      */
   8961     interim_results?: boolean;
   8962     /**
   8963      * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing
   8964      */
   8965     endpointing?: string;
   8966     /**
   8967      * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.
   8968      */
   8969     vad_events?: boolean;
   8970     /**
   8971      * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.
   8972      */
   8973     utterance_end_ms?: boolean;
   8974 }
   8975 interface Ai_Cf_Deepgram_Nova_3_Output {
   8976     results?: {
   8977         channels?: {
   8978             alternatives?: {
   8979                 confidence?: number;
   8980                 transcript?: string;
   8981                 words?: {
   8982                     confidence?: number;
   8983                     end?: number;
   8984                     start?: number;
   8985                     word?: string;
   8986                 }[];
   8987             }[];
   8988         }[];
   8989         summary?: {
   8990             result?: string;
   8991             short?: string;
   8992         };
   8993         sentiments?: {
   8994             segments?: {
   8995                 text?: string;
   8996                 start_word?: number;
   8997                 end_word?: number;
   8998                 sentiment?: string;
   8999                 sentiment_score?: number;
   9000             }[];
   9001             average?: {
   9002                 sentiment?: string;
   9003                 sentiment_score?: number;
   9004             };
   9005         };
   9006     };
   9007 }
   9008 declare abstract class Base_Ai_Cf_Deepgram_Nova_3 {
   9009     inputs: Ai_Cf_Deepgram_Nova_3_Input;
   9010     postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;
   9011 }
   9012 interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {
   9013     queries?: string | string[];
   9014     /**
   9015      * Optional instruction for the task
   9016      */
   9017     instruction?: string;
   9018     documents?: string | string[];
   9019     text?: string | string[];
   9020 }
   9021 interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {
   9022     data?: number[][];
   9023     shape?: number[];
   9024 }
   9025 declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {
   9026     inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;
   9027     postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;
   9028 }
   9029 type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {
   9030     /**
   9031      * readable stream with audio data and content-type specified for that data
   9032      */
   9033     audio: {
   9034         body: object;
   9035         contentType: string;
   9036     };
   9037     /**
   9038      * type of data PCM data that's sent to the inference server as raw array
   9039      */
   9040     dtype?: "uint8" | "float32" | "float64";
   9041 } | {
   9042     /**
   9043      * base64 encoded audio data
   9044      */
   9045     audio: string;
   9046     /**
   9047      * type of data PCM data that's sent to the inference server as raw array
   9048      */
   9049     dtype?: "uint8" | "float32" | "float64";
   9050 };
   9051 interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {
   9052     /**
   9053      * if true, end-of-turn was detected
   9054      */
   9055     is_complete?: boolean;
   9056     /**
   9057      * probability of the end-of-turn detection
   9058      */
   9059     probability?: number;
   9060 }
   9061 declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
   9062     inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;
   9063     postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
   9064 }
   9065 declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
   9066     inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;
   9067     postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
   9068 }
   9069 declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
   9070     inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;
   9071     postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
   9072 }
   9073 interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
   9074     /**
   9075      * A text description of the image you want to generate.
   9076      */
   9077     prompt: string;
   9078     /**
   9079      * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
   9080      */
   9081     guidance?: number;
   9082     /**
   9083      * Random seed for reproducibility of the image generation
   9084      */
   9085     seed?: number;
   9086     /**
   9087      * The height of the generated image in pixels
   9088      */
   9089     height?: number;
   9090     /**
   9091      * The width of the generated image in pixels
   9092      */
   9093     width?: number;
   9094     /**
   9095      * The number of diffusion steps; higher values can improve quality but take longer
   9096      */
   9097     num_steps?: number;
   9098     /**
   9099      * Specify what to exclude from the generated images
   9100      */
   9101     negative_prompt?: string;
   9102 }
   9103 /**
   9104  * The generated image in JPEG format
   9105  */
   9106 type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;
   9107 declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {
   9108     inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;
   9109     postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;
   9110 }
   9111 interface Ai_Cf_Leonardo_Lucid_Origin_Input {
   9112     /**
   9113      * A text description of the image you want to generate.
   9114      */
   9115     prompt: string;
   9116     /**
   9117      * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
   9118      */
   9119     guidance?: number;
   9120     /**
   9121      * Random seed for reproducibility of the image generation
   9122      */
   9123     seed?: number;
   9124     /**
   9125      * The height of the generated image in pixels
   9126      */
   9127     height?: number;
   9128     /**
   9129      * The width of the generated image in pixels
   9130      */
   9131     width?: number;
   9132     /**
   9133      * The number of diffusion steps; higher values can improve quality but take longer
   9134      */
   9135     num_steps?: number;
   9136     /**
   9137      * The number of diffusion steps; higher values can improve quality but take longer
   9138      */
   9139     steps?: number;
   9140 }
   9141 interface Ai_Cf_Leonardo_Lucid_Origin_Output {
   9142     /**
   9143      * The generated image in Base64 format.
   9144      */
   9145     image?: string;
   9146 }
   9147 declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {
   9148     inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;
   9149     postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;
   9150 }
   9151 interface Ai_Cf_Deepgram_Aura_1_Input {
   9152     /**
   9153      * Speaker used to produce the audio.
   9154      */
   9155     speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella";
   9156     /**
   9157      * Encoding of the output audio.
   9158      */
   9159     encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
   9160     /**
   9161      * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
   9162      */
   9163     container?: "none" | "wav" | "ogg";
   9164     /**
   9165      * The text content to be converted to speech
   9166      */
   9167     text: string;
   9168     /**
   9169      * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
   9170      */
   9171     sample_rate?: number;
   9172     /**
   9173      * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
   9174      */
   9175     bit_rate?: number;
   9176 }
   9177 /**
   9178  * The generated audio in MP3 format
   9179  */
   9180 type Ai_Cf_Deepgram_Aura_1_Output = string;
   9181 declare abstract class Base_Ai_Cf_Deepgram_Aura_1 {
   9182     inputs: Ai_Cf_Deepgram_Aura_1_Input;
   9183     postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;
   9184 }
   9185 interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
   9186     /**
   9187      * Input text to translate. Can be a single string or a list of strings.
   9188      */
   9189     text: string | string[];
   9190     /**
   9191      * Target langauge to translate to
   9192      */
   9193     target_language: "asm_Beng" | "awa_Deva" | "ben_Beng" | "bho_Deva" | "brx_Deva" | "doi_Deva" | "eng_Latn" | "gom_Deva" | "gon_Deva" | "guj_Gujr" | "hin_Deva" | "hne_Deva" | "kan_Knda" | "kas_Arab" | "kas_Deva" | "kha_Latn" | "lus_Latn" | "mag_Deva" | "mai_Deva" | "mal_Mlym" | "mar_Deva" | "mni_Beng" | "mni_Mtei" | "npi_Deva" | "ory_Orya" | "pan_Guru" | "san_Deva" | "sat_Olck" | "snd_Arab" | "snd_Deva" | "tam_Taml" | "tel_Telu" | "urd_Arab" | "unr_Deva";
   9194 }
   9195 interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {
   9196     /**
   9197      * Translated texts
   9198      */
   9199     translations: string[];
   9200 }
   9201 declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {
   9202     inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;
   9203     postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;
   9204 }
   9205 type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;
   9206 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {
   9207     /**
   9208      * The input text prompt for the model to generate a response.
   9209      */
   9210     prompt: string;
   9211     /**
   9212      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   9213      */
   9214     lora?: string;
   9215     response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;
   9216     /**
   9217      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   9218      */
   9219     raw?: boolean;
   9220     /**
   9221      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   9222      */
   9223     stream?: boolean;
   9224     /**
   9225      * The maximum number of tokens to generate in the response.
   9226      */
   9227     max_tokens?: number;
   9228     /**
   9229      * Controls the randomness of the output; higher values produce more random results.
   9230      */
   9231     temperature?: number;
   9232     /**
   9233      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   9234      */
   9235     top_p?: number;
   9236     /**
   9237      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   9238      */
   9239     top_k?: number;
   9240     /**
   9241      * Random seed for reproducibility of the generation.
   9242      */
   9243     seed?: number;
   9244     /**
   9245      * Penalty for repeated tokens; higher values discourage repetition.
   9246      */
   9247     repetition_penalty?: number;
   9248     /**
   9249      * Decreases the likelihood of the model repeating the same lines verbatim.
   9250      */
   9251     frequency_penalty?: number;
   9252     /**
   9253      * Increases the likelihood of the model introducing new topics.
   9254      */
   9255     presence_penalty?: number;
   9256 }
   9257 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {
   9258     type?: "json_object" | "json_schema";
   9259     json_schema?: unknown;
   9260 }
   9261 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
   9262     /**
   9263      * An array of message objects representing the conversation history.
   9264      */
   9265     messages: {
   9266         /**
   9267          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   9268          */
   9269         role: string;
   9270         content: string | {
   9271             /**
   9272              * Type of the content (text)
   9273              */
   9274             type?: string;
   9275             /**
   9276              * Text content
   9277              */
   9278             text?: string;
   9279         }[];
   9280     }[];
   9281     functions?: {
   9282         name: string;
   9283         code: string;
   9284     }[];
   9285     /**
   9286      * A list of tools available for the assistant to use.
   9287      */
   9288     tools?: ({
   9289         /**
   9290          * The name of the tool. More descriptive the better.
   9291          */
   9292         name: string;
   9293         /**
   9294          * A brief description of what the tool does.
   9295          */
   9296         description: string;
   9297         /**
   9298          * Schema defining the parameters accepted by the tool.
   9299          */
   9300         parameters: {
   9301             /**
   9302              * The type of the parameters object (usually 'object').
   9303              */
   9304             type: string;
   9305             /**
   9306              * List of required parameter names.
   9307              */
   9308             required?: string[];
   9309             /**
   9310              * Definitions of each parameter.
   9311              */
   9312             properties: {
   9313                 [k: string]: {
   9314                     /**
   9315                      * The data type of the parameter.
   9316                      */
   9317                     type: string;
   9318                     /**
   9319                      * A description of the expected parameter.
   9320                      */
   9321                     description: string;
   9322                 };
   9323             };
   9324         };
   9325     } | {
   9326         /**
   9327          * Specifies the type of tool (e.g., 'function').
   9328          */
   9329         type: string;
   9330         /**
   9331          * Details of the function tool.
   9332          */
   9333         function: {
   9334             /**
   9335              * The name of the function.
   9336              */
   9337             name: string;
   9338             /**
   9339              * A brief description of what the function does.
   9340              */
   9341             description: string;
   9342             /**
   9343              * Schema defining the parameters accepted by the function.
   9344              */
   9345             parameters: {
   9346                 /**
   9347                  * The type of the parameters object (usually 'object').
   9348                  */
   9349                 type: string;
   9350                 /**
   9351                  * List of required parameter names.
   9352                  */
   9353                 required?: string[];
   9354                 /**
   9355                  * Definitions of each parameter.
   9356                  */
   9357                 properties: {
   9358                     [k: string]: {
   9359                         /**
   9360                          * The data type of the parameter.
   9361                          */
   9362                         type: string;
   9363                         /**
   9364                          * A description of the expected parameter.
   9365                          */
   9366                         description: string;
   9367                     };
   9368                 };
   9369             };
   9370         };
   9371     })[];
   9372     response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;
   9373     /**
   9374      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   9375      */
   9376     raw?: boolean;
   9377     /**
   9378      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   9379      */
   9380     stream?: boolean;
   9381     /**
   9382      * The maximum number of tokens to generate in the response.
   9383      */
   9384     max_tokens?: number;
   9385     /**
   9386      * Controls the randomness of the output; higher values produce more random results.
   9387      */
   9388     temperature?: number;
   9389     /**
   9390      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   9391      */
   9392     top_p?: number;
   9393     /**
   9394      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   9395      */
   9396     top_k?: number;
   9397     /**
   9398      * Random seed for reproducibility of the generation.
   9399      */
   9400     seed?: number;
   9401     /**
   9402      * Penalty for repeated tokens; higher values discourage repetition.
   9403      */
   9404     repetition_penalty?: number;
   9405     /**
   9406      * Decreases the likelihood of the model repeating the same lines verbatim.
   9407      */
   9408     frequency_penalty?: number;
   9409     /**
   9410      * Increases the likelihood of the model introducing new topics.
   9411      */
   9412     presence_penalty?: number;
   9413 }
   9414 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {
   9415     type?: "json_object" | "json_schema";
   9416     json_schema?: unknown;
   9417 }
   9418 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {
   9419     requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];
   9420 }
   9421 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {
   9422     /**
   9423      * The input text prompt for the model to generate a response.
   9424      */
   9425     prompt: string;
   9426     /**
   9427      * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
   9428      */
   9429     lora?: string;
   9430     response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;
   9431     /**
   9432      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   9433      */
   9434     raw?: boolean;
   9435     /**
   9436      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   9437      */
   9438     stream?: boolean;
   9439     /**
   9440      * The maximum number of tokens to generate in the response.
   9441      */
   9442     max_tokens?: number;
   9443     /**
   9444      * Controls the randomness of the output; higher values produce more random results.
   9445      */
   9446     temperature?: number;
   9447     /**
   9448      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   9449      */
   9450     top_p?: number;
   9451     /**
   9452      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   9453      */
   9454     top_k?: number;
   9455     /**
   9456      * Random seed for reproducibility of the generation.
   9457      */
   9458     seed?: number;
   9459     /**
   9460      * Penalty for repeated tokens; higher values discourage repetition.
   9461      */
   9462     repetition_penalty?: number;
   9463     /**
   9464      * Decreases the likelihood of the model repeating the same lines verbatim.
   9465      */
   9466     frequency_penalty?: number;
   9467     /**
   9468      * Increases the likelihood of the model introducing new topics.
   9469      */
   9470     presence_penalty?: number;
   9471 }
   9472 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {
   9473     type?: "json_object" | "json_schema";
   9474     json_schema?: unknown;
   9475 }
   9476 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
   9477     /**
   9478      * An array of message objects representing the conversation history.
   9479      */
   9480     messages: {
   9481         /**
   9482          * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
   9483          */
   9484         role: string;
   9485         content: string | {
   9486             /**
   9487              * Type of the content (text)
   9488              */
   9489             type?: string;
   9490             /**
   9491              * Text content
   9492              */
   9493             text?: string;
   9494         }[];
   9495     }[];
   9496     functions?: {
   9497         name: string;
   9498         code: string;
   9499     }[];
   9500     /**
   9501      * A list of tools available for the assistant to use.
   9502      */
   9503     tools?: ({
   9504         /**
   9505          * The name of the tool. More descriptive the better.
   9506          */
   9507         name: string;
   9508         /**
   9509          * A brief description of what the tool does.
   9510          */
   9511         description: string;
   9512         /**
   9513          * Schema defining the parameters accepted by the tool.
   9514          */
   9515         parameters: {
   9516             /**
   9517              * The type of the parameters object (usually 'object').
   9518              */
   9519             type: string;
   9520             /**
   9521              * List of required parameter names.
   9522              */
   9523             required?: string[];
   9524             /**
   9525              * Definitions of each parameter.
   9526              */
   9527             properties: {
   9528                 [k: string]: {
   9529                     /**
   9530                      * The data type of the parameter.
   9531                      */
   9532                     type: string;
   9533                     /**
   9534                      * A description of the expected parameter.
   9535                      */
   9536                     description: string;
   9537                 };
   9538             };
   9539         };
   9540     } | {
   9541         /**
   9542          * Specifies the type of tool (e.g., 'function').
   9543          */
   9544         type: string;
   9545         /**
   9546          * Details of the function tool.
   9547          */
   9548         function: {
   9549             /**
   9550              * The name of the function.
   9551              */
   9552             name: string;
   9553             /**
   9554              * A brief description of what the function does.
   9555              */
   9556             description: string;
   9557             /**
   9558              * Schema defining the parameters accepted by the function.
   9559              */
   9560             parameters: {
   9561                 /**
   9562                  * The type of the parameters object (usually 'object').
   9563                  */
   9564                 type: string;
   9565                 /**
   9566                  * List of required parameter names.
   9567                  */
   9568                 required?: string[];
   9569                 /**
   9570                  * Definitions of each parameter.
   9571                  */
   9572                 properties: {
   9573                     [k: string]: {
   9574                         /**
   9575                          * The data type of the parameter.
   9576                          */
   9577                         type: string;
   9578                         /**
   9579                          * A description of the expected parameter.
   9580                          */
   9581                         description: string;
   9582                     };
   9583                 };
   9584             };
   9585         };
   9586     })[];
   9587     response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;
   9588     /**
   9589      * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
   9590      */
   9591     raw?: boolean;
   9592     /**
   9593      * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
   9594      */
   9595     stream?: boolean;
   9596     /**
   9597      * The maximum number of tokens to generate in the response.
   9598      */
   9599     max_tokens?: number;
   9600     /**
   9601      * Controls the randomness of the output; higher values produce more random results.
   9602      */
   9603     temperature?: number;
   9604     /**
   9605      * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
   9606      */
   9607     top_p?: number;
   9608     /**
   9609      * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
   9610      */
   9611     top_k?: number;
   9612     /**
   9613      * Random seed for reproducibility of the generation.
   9614      */
   9615     seed?: number;
   9616     /**
   9617      * Penalty for repeated tokens; higher values discourage repetition.
   9618      */
   9619     repetition_penalty?: number;
   9620     /**
   9621      * Decreases the likelihood of the model repeating the same lines verbatim.
   9622      */
   9623     frequency_penalty?: number;
   9624     /**
   9625      * Increases the likelihood of the model introducing new topics.
   9626      */
   9627     presence_penalty?: number;
   9628 }
   9629 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {
   9630     type?: "json_object" | "json_schema";
   9631     json_schema?: unknown;
   9632 }
   9633 type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;
   9634 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {
   9635     /**
   9636      * Unique identifier for the completion
   9637      */
   9638     id?: string;
   9639     /**
   9640      * Object type identifier
   9641      */
   9642     object?: "chat.completion";
   9643     /**
   9644      * Unix timestamp of when the completion was created
   9645      */
   9646     created?: number;
   9647     /**
   9648      * Model used for the completion
   9649      */
   9650     model?: string;
   9651     /**
   9652      * List of completion choices
   9653      */
   9654     choices?: {
   9655         /**
   9656          * Index of the choice in the list
   9657          */
   9658         index?: number;
   9659         /**
   9660          * The message generated by the model
   9661          */
   9662         message?: {
   9663             /**
   9664              * Role of the message author
   9665              */
   9666             role: string;
   9667             /**
   9668              * The content of the message
   9669              */
   9670             content: string;
   9671             /**
   9672              * Internal reasoning content (if available)
   9673              */
   9674             reasoning_content?: string;
   9675             /**
   9676              * Tool calls made by the assistant
   9677              */
   9678             tool_calls?: {
   9679                 /**
   9680                  * Unique identifier for the tool call
   9681                  */
   9682                 id: string;
   9683                 /**
   9684                  * Type of tool call
   9685                  */
   9686                 type: "function";
   9687                 function: {
   9688                     /**
   9689                      * Name of the function to call
   9690                      */
   9691                     name: string;
   9692                     /**
   9693                      * JSON string of arguments for the function
   9694                      */
   9695                     arguments: string;
   9696                 };
   9697             }[];
   9698         };
   9699         /**
   9700          * Reason why the model stopped generating
   9701          */
   9702         finish_reason?: string;
   9703         /**
   9704          * Stop reason (may be null)
   9705          */
   9706         stop_reason?: string | null;
   9707         /**
   9708          * Log probabilities (if requested)
   9709          */
   9710         logprobs?: {} | null;
   9711     }[];
   9712     /**
   9713      * Usage statistics for the inference request
   9714      */
   9715     usage?: {
   9716         /**
   9717          * Total number of tokens in input
   9718          */
   9719         prompt_tokens?: number;
   9720         /**
   9721          * Total number of tokens in output
   9722          */
   9723         completion_tokens?: number;
   9724         /**
   9725          * Total number of input and output tokens
   9726          */
   9727         total_tokens?: number;
   9728     };
   9729     /**
   9730      * Log probabilities for the prompt (if requested)
   9731      */
   9732     prompt_logprobs?: {} | null;
   9733 }
   9734 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {
   9735     /**
   9736      * Unique identifier for the completion
   9737      */
   9738     id?: string;
   9739     /**
   9740      * Object type identifier
   9741      */
   9742     object?: "text_completion";
   9743     /**
   9744      * Unix timestamp of when the completion was created
   9745      */
   9746     created?: number;
   9747     /**
   9748      * Model used for the completion
   9749      */
   9750     model?: string;
   9751     /**
   9752      * List of completion choices
   9753      */
   9754     choices?: {
   9755         /**
   9756          * Index of the choice in the list
   9757          */
   9758         index: number;
   9759         /**
   9760          * The generated text completion
   9761          */
   9762         text: string;
   9763         /**
   9764          * Reason why the model stopped generating
   9765          */
   9766         finish_reason: string;
   9767         /**
   9768          * Stop reason (may be null)
   9769          */
   9770         stop_reason?: string | null;
   9771         /**
   9772          * Log probabilities (if requested)
   9773          */
   9774         logprobs?: {} | null;
   9775         /**
   9776          * Log probabilities for the prompt (if requested)
   9777          */
   9778         prompt_logprobs?: {} | null;
   9779     }[];
   9780     /**
   9781      * Usage statistics for the inference request
   9782      */
   9783     usage?: {
   9784         /**
   9785          * Total number of tokens in input
   9786          */
   9787         prompt_tokens?: number;
   9788         /**
   9789          * Total number of tokens in output
   9790          */
   9791         completion_tokens?: number;
   9792         /**
   9793          * Total number of input and output tokens
   9794          */
   9795         total_tokens?: number;
   9796     };
   9797 }
   9798 interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {
   9799     /**
   9800      * The async request id that can be used to obtain the results.
   9801      */
   9802     request_id?: string;
   9803 }
   9804 declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {
   9805     inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;
   9806     postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;
   9807 }
   9808 interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {
   9809     /**
   9810      * Input text to embed. Can be a single string or a list of strings.
   9811      */
   9812     text: string | string[];
   9813 }
   9814 interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {
   9815     /**
   9816      * Embedding vectors, where each vector is a list of floats.
   9817      */
   9818     data: number[][];
   9819     /**
   9820      * Shape of the embedding data as [number_of_embeddings, embedding_dimension].
   9821      *
   9822      * @minItems 2
   9823      * @maxItems 2
   9824      */
   9825     shape: [
   9826         number,
   9827         number
   9828     ];
   9829 }
   9830 declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {
   9831     inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;
   9832     postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;
   9833 }
   9834 interface Ai_Cf_Deepgram_Flux_Input {
   9835     /**
   9836      * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.
   9837      */
   9838     encoding: "linear16";
   9839     /**
   9840      * Sample rate of the audio stream in Hz.
   9841      */
   9842     sample_rate: string;
   9843     /**
   9844      * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.
   9845      */
   9846     eager_eot_threshold?: string;
   9847     /**
   9848      * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.
   9849      */
   9850     eot_threshold?: string;
   9851     /**
   9852      * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.
   9853      */
   9854     eot_timeout_ms?: string;
   9855     /**
   9856      * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.
   9857      */
   9858     keyterm?: string;
   9859     /**
   9860      * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip
   9861      */
   9862     mip_opt_out?: "true" | "false";
   9863     /**
   9864      * Label your requests for the purpose of identification during usage reporting
   9865      */
   9866     tag?: string;
   9867 }
   9868 /**
   9869  * Output will be returned as websocket messages.
   9870  */
   9871 interface Ai_Cf_Deepgram_Flux_Output {
   9872     /**
   9873      * The unique identifier of the request (uuid)
   9874      */
   9875     request_id?: string;
   9876     /**
   9877      * Starts at 0 and increments for each message the server sends to the client.
   9878      */
   9879     sequence_id?: number;
   9880     /**
   9881      * The type of event being reported.
   9882      */
   9883     event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn";
   9884     /**
   9885      * The index of the current turn
   9886      */
   9887     turn_index?: number;
   9888     /**
   9889      * Start time in seconds of the audio range that was transcribed
   9890      */
   9891     audio_window_start?: number;
   9892     /**
   9893      * End time in seconds of the audio range that was transcribed
   9894      */
   9895     audio_window_end?: number;
   9896     /**
   9897      * Text that was said over the course of the current turn
   9898      */
   9899     transcript?: string;
   9900     /**
   9901      * The words in the transcript
   9902      */
   9903     words?: {
   9904         /**
   9905          * The individual punctuated, properly-cased word from the transcript
   9906          */
   9907         word: string;
   9908         /**
   9909          * Confidence that this word was transcribed correctly
   9910          */
   9911         confidence: number;
   9912     }[];
   9913     /**
   9914      * Confidence that no more speech is coming in this turn
   9915      */
   9916     end_of_turn_confidence?: number;
   9917 }
   9918 declare abstract class Base_Ai_Cf_Deepgram_Flux {
   9919     inputs: Ai_Cf_Deepgram_Flux_Input;
   9920     postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;
   9921 }
   9922 interface Ai_Cf_Deepgram_Aura_2_En_Input {
   9923     /**
   9924      * Speaker used to produce the audio.
   9925      */
   9926     speaker?: "amalthea" | "andromeda" | "apollo" | "arcas" | "aries" | "asteria" | "athena" | "atlas" | "aurora" | "callista" | "cora" | "cordelia" | "delia" | "draco" | "electra" | "harmonia" | "helena" | "hera" | "hermes" | "hyperion" | "iris" | "janus" | "juno" | "jupiter" | "luna" | "mars" | "minerva" | "neptune" | "odysseus" | "ophelia" | "orion" | "orpheus" | "pandora" | "phoebe" | "pluto" | "saturn" | "thalia" | "theia" | "vesta" | "zeus";
   9927     /**
   9928      * Encoding of the output audio.
   9929      */
   9930     encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
   9931     /**
   9932      * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
   9933      */
   9934     container?: "none" | "wav" | "ogg";
   9935     /**
   9936      * The text content to be converted to speech
   9937      */
   9938     text: string;
   9939     /**
   9940      * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
   9941      */
   9942     sample_rate?: number;
   9943     /**
   9944      * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
   9945      */
   9946     bit_rate?: number;
   9947 }
   9948 /**
   9949  * The generated audio in MP3 format
   9950  */
   9951 type Ai_Cf_Deepgram_Aura_2_En_Output = string;
   9952 declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {
   9953     inputs: Ai_Cf_Deepgram_Aura_2_En_Input;
   9954     postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;
   9955 }
   9956 interface Ai_Cf_Deepgram_Aura_2_Es_Input {
   9957     /**
   9958      * Speaker used to produce the audio.
   9959      */
   9960     speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier";
   9961     /**
   9962      * Encoding of the output audio.
   9963      */
   9964     encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
   9965     /**
   9966      * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
   9967      */
   9968     container?: "none" | "wav" | "ogg";
   9969     /**
   9970      * The text content to be converted to speech
   9971      */
   9972     text: string;
   9973     /**
   9974      * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
   9975      */
   9976     sample_rate?: number;
   9977     /**
   9978      * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
   9979      */
   9980     bit_rate?: number;
   9981 }
   9982 /**
   9983  * The generated audio in MP3 format
   9984  */
   9985 type Ai_Cf_Deepgram_Aura_2_Es_Output = string;
   9986 declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
   9987     inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
   9988     postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
   9989 }
   9990 interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
   9991     multipart: {
   9992         body?: object;
   9993         contentType?: string;
   9994     };
   9995 }
   9996 interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
   9997     /**
   9998      * Generated image as Base64 string.
   9999      */
  10000     image?: string;
  10001 }
  10002 declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
  10003     inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
  10004     postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
  10005 }
  10006 interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
  10007     multipart: {
  10008         body?: object;
  10009         contentType?: string;
  10010     };
  10011 }
  10012 interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
  10013     /**
  10014      * Generated image as Base64 string.
  10015      */
  10016     image?: string;
  10017 }
  10018 declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
  10019     inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
  10020     postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
  10021 }
  10022 interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
  10023     multipart: {
  10024         body?: object;
  10025         contentType?: string;
  10026     };
  10027 }
  10028 interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
  10029     /**
  10030      * Generated image as Base64 string.
  10031      */
  10032     image?: string;
  10033 }
  10034 declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
  10035     inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
  10036     postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
  10037 }
  10038 declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
  10039     inputs: ChatCompletionsInput;
  10040     postProcessedOutputs: ChatCompletionsOutput;
  10041 }
  10042 declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
  10043     inputs: ChatCompletionsInput;
  10044     postProcessedOutputs: ChatCompletionsOutput;
  10045 }
  10046 declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
  10047     inputs: ChatCompletionsInput;
  10048     postProcessedOutputs: ChatCompletionsOutput;
  10049 }
  10050 declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
  10051     inputs: ChatCompletionsInput;
  10052     postProcessedOutputs: ChatCompletionsOutput;
  10053 }
  10054 declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {
  10055     inputs: ChatCompletionsInput;
  10056     postProcessedOutputs: ChatCompletionsOutput;
  10057 }
  10058 interface AiModels {
  10059     "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
  10060     "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
  10061     "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
  10062     "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
  10063     "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
  10064     "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
  10065     "@cf/myshell-ai/melotts": BaseAiTextToSpeech;
  10066     "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings;
  10067     "@cf/microsoft/resnet-50": BaseAiImageClassification;
  10068     "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
  10069     "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
  10070     "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
  10071     "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
  10072     "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
  10073     "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
  10074     "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
  10075     "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
  10076     "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
  10077     "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
  10078     "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
  10079     "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
  10080     "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
  10081     "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
  10082     "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
  10083     "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
  10084     "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
  10085     "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
  10086     "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
  10087     "@cf/microsoft/phi-2": BaseAiTextGeneration;
  10088     "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
  10089     "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
  10090     "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
  10091     "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
  10092     "@hf/google/gemma-7b-it": BaseAiTextGeneration;
  10093     "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
  10094     "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
  10095     "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
  10096     "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
  10097     "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
  10098     "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
  10099     "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
  10100     "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
  10101     "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
  10102     "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
  10103     "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
  10104     "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration;
  10105     "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration;
  10106     "@cf/facebook/bart-large-cnn": BaseAiSummarization;
  10107     "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
  10108     "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;
  10109     "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
  10110     "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B;
  10111     "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;
  10112     "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;
  10113     "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;
  10114     "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
  10115     "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
  10116     "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3;
  10117     "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
  10118     "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
  10119     "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;
  10120     "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B;
  10121     "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base;
  10122     "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;
  10123     "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B;
  10124     "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;
  10125     "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It;
  10126     "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;
  10127     "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;
  10128     "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3;
  10129     "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;
  10130     "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;
  10131     "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B;
  10132     "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B;
  10133     "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0;
  10134     "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin;
  10135     "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1;
  10136     "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;
  10137     "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;
  10138     "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;
  10139     "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
  10140     "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
  10141     "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
  10142     "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
  10143     "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
  10144     "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
  10145     "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
  10146     "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
  10147     "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
  10148     "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
  10149     "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;
  10150 }
  10151 type AiOptions = {
  10152     /**
  10153      * Send requests as an asynchronous batch job, only works for supported models
  10154      * https://developers.cloudflare.com/workers-ai/features/batch-api
  10155      */
  10156     queueRequest?: boolean;
  10157     /**
  10158      * Establish websocket connections, only works for supported models
  10159      */
  10160     websocket?: boolean;
  10161     /**
  10162      * Tag your requests to group and view them in Cloudflare dashboard.
  10163      *
  10164      * Rules:
  10165      * Tags must only contain letters, numbers, and the symbols: : - . / @
  10166      * Each tag can have maximum 50 characters.
  10167      * Maximum 5 tags are allowed each request.
  10168      * Duplicate tags will removed.
  10169      */
  10170     tags?: string[];
  10171     gateway?: GatewayOptions;
  10172     returnRawResponse?: boolean;
  10173     prefix?: string;
  10174     extraHeaders?: object;
  10175     signal?: AbortSignal;
  10176 };
  10177 type AiModelsSearchParams = {
  10178     author?: string;
  10179     hide_experimental?: boolean;
  10180     page?: number;
  10181     per_page?: number;
  10182     search?: string;
  10183     source?: number;
  10184     task?: string;
  10185 };
  10186 type AiModelsSearchObject = {
  10187     id: string;
  10188     source: number;
  10189     name: string;
  10190     description: string;
  10191     task: {
  10192         id: string;
  10193         name: string;
  10194         description: string;
  10195     };
  10196     tags: string[];
  10197     properties: {
  10198         property_id: string;
  10199         value: string;
  10200     }[];
  10201 };
  10202 type ChatCompletionsBase = ChatCompletionsMessagesInput;
  10203 type ChatCompletionsInput = ChatCompletionsMessagesInput;
  10204 interface InferenceUpstreamError extends Error {
  10205 }
  10206 interface AiInternalError extends Error {
  10207 }
  10208 type AiModelListType = Record<string, any>;
  10209 type AiAsyncBatchResponse = {
  10210     request_id: string;
  10211 };
  10212 declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
  10213     aiGatewayLogId: string | null;
  10214     gateway(gatewayId: string): AiGateway;
  10215     /**
  10216      * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
  10217      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10218      */
  10219     aiSearch(): AiSearchNamespace;
  10220     /**
  10221      * @deprecated AutoRAG has been replaced by AI Search.
  10222      * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
  10223      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10224      *
  10225      * @param autoragId Instance ID
  10226      */
  10227     autorag(autoragId: string): AutoRAG;
  10228     // Batch request
  10229     run<Name extends keyof AiModelList>(model: Name, inputs: {
  10230         requests: AiModelList[Name]['inputs'][];
  10231     }, options: AiOptions & {
  10232         queueRequest: true;
  10233     }): Promise<AiAsyncBatchResponse>;
  10234     // Raw response
  10235     run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {
  10236         returnRawResponse: true;
  10237     }): Promise<Response>;
  10238     // WebSocket
  10239     run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {
  10240         websocket: true;
  10241     }): Promise<Response>;
  10242     // Streaming
  10243     run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'] & {
  10244         stream: true;
  10245     }, options?: AiOptions): Promise<ReadableStream>;
  10246     // Normal (default) - known model
  10247     run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise<AiModelList[Name]['postProcessedOutputs']>;
  10248     // Unknown model (fallback).
  10249     //
  10250     // The `Exclude<..., keyof AiModelList>` constraint forces TypeScript to
  10251     // route any model name that is a literal key of `AiModelList` to one of
  10252     // the known-model overloads above (so input/output mismatches surface as
  10253     // type errors rather than silently falling back to `Record<string, unknown>`).
  10254     // Names that aren't in `AiModelList` — e.g. third-party gateway models
  10255     // like `"google/nano-banana"` — still hit this overload.
  10256     run<Model extends string>(model: Model extends keyof AiModelList ? never : Model, inputs: Record<string, unknown>, options?: AiOptions): Promise<Record<string, unknown>>;
  10257     models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
  10258     toMarkdown(): ToMarkdownService;
  10259     toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
  10260     toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;
  10261 }
  10262 type GatewayRetries = {
  10263     maxAttempts?: 1 | 2 | 3 | 4 | 5;
  10264     retryDelayMs?: number;
  10265     backoff?: 'constant' | 'linear' | 'exponential';
  10266 };
  10267 type GatewayOptions = {
  10268     id: string;
  10269     cacheKey?: string;
  10270     cacheTtl?: number;
  10271     skipCache?: boolean;
  10272     metadata?: Record<string, number | string | boolean | null | bigint>;
  10273     collectLog?: boolean;
  10274     eventId?: string;
  10275     requestTimeoutMs?: number;
  10276     retries?: GatewayRetries;
  10277 };
  10278 type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {
  10279     /**
  10280      ** @deprecated
  10281      */
  10282     id?: string;
  10283 };
  10284 type AiGatewayPatchLog = {
  10285     score?: number | null;
  10286     feedback?: -1 | 1 | null;
  10287     metadata?: Record<string, number | string | boolean | null | bigint> | null;
  10288 };
  10289 type AiGatewayLog = {
  10290     id: string;
  10291     provider: string;
  10292     model: string;
  10293     model_type?: string;
  10294     path: string;
  10295     duration: number;
  10296     request_type?: string;
  10297     request_content_type?: string;
  10298     status_code: number;
  10299     response_content_type?: string;
  10300     success: boolean;
  10301     cached: boolean;
  10302     tokens_in?: number;
  10303     tokens_out?: number;
  10304     metadata?: Record<string, number | string | boolean | null | bigint>;
  10305     step?: number;
  10306     cost?: number;
  10307     custom_cost?: boolean;
  10308     request_size: number;
  10309     request_head?: string;
  10310     request_head_complete: boolean;
  10311     response_size: number;
  10312     response_head?: string;
  10313     response_head_complete: boolean;
  10314     created_at: Date;
  10315 };
  10316 type AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';
  10317 type AIGatewayHeaders = {
  10318     'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;
  10319     'cf-aig-custom-cost': {
  10320         per_token_in?: number;
  10321         per_token_out?: number;
  10322     } | {
  10323         total_cost?: number;
  10324     } | string;
  10325     'cf-aig-cache-ttl': number | string;
  10326     'cf-aig-skip-cache': boolean | string;
  10327     'cf-aig-cache-key': string;
  10328     'cf-aig-event-id': string;
  10329     'cf-aig-request-timeout': number | string;
  10330     'cf-aig-max-attempts': number | string;
  10331     'cf-aig-retry-delay': number | string;
  10332     'cf-aig-backoff': string;
  10333     'cf-aig-collect-log': boolean | string;
  10334     Authorization: string;
  10335     'Content-Type': string;
  10336     [key: string]: string | number | boolean | object;
  10337 };
  10338 type AIGatewayUniversalRequest = {
  10339     provider: AIGatewayProviders | string; // eslint-disable-line
  10340     endpoint: string;
  10341     headers: Partial<AIGatewayHeaders>;
  10342     query: unknown;
  10343 };
  10344 interface AiGatewayInternalError extends Error {
  10345 }
  10346 interface AiGatewayLogNotFound extends Error {
  10347 }
  10348 declare abstract class AiGateway {
  10349     patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
  10350     getLog(logId: string): Promise<AiGatewayLog>;
  10351     run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {
  10352         gateway?: UniversalGatewayOptions;
  10353         extraHeaders?: object;
  10354         signal?: AbortSignal;
  10355     }): Promise<Response>;
  10356     getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
  10357 }
  10358 // Copyright (c) 2022-2025 Cloudflare, Inc.
  10359 // Licensed under the Apache 2.0 license found in the LICENSE file or at:
  10360 //     https://opensource.org/licenses/Apache-2.0
  10361 /**
  10362  * Artifacts — Git-compatible file storage on Cloudflare Workers.
  10363  *
  10364  * Provides programmatic access to create, manage, and fork repositories,
  10365  * and to issue and revoke scoped access tokens.
  10366  */
  10367 /** Information about a repository. */
  10368 interface ArtifactsRepoInfo {
  10369     /** Unique repository ID. */
  10370     id: string;
  10371     /** Repository name. */
  10372     name: string;
  10373     /** Repository description, or null if not set. */
  10374     description: string | null;
  10375     /** Default branch name (e.g. "main"). */
  10376     defaultBranch: string;
  10377     /** ISO 8601 creation timestamp. */
  10378     createdAt: string;
  10379     /** ISO 8601 last-updated timestamp. */
  10380     updatedAt: string;
  10381     /** ISO 8601 timestamp of the last push, or null if never pushed. */
  10382     lastPushAt: string | null;
  10383     /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */
  10384     source: string | null;
  10385     /** Whether the repository is read-only. */
  10386     readOnly: boolean;
  10387     /** HTTPS git remote URL. */
  10388     remote: string;
  10389 }
  10390 /** Result of creating a repository — includes the initial access token. */
  10391 interface ArtifactsCreateRepoResult {
  10392     /** Unique repository ID. */
  10393     id: string;
  10394     /** Repository name. */
  10395     name: string;
  10396     /** Repository description, or null if not set. */
  10397     description: string | null;
  10398     /** Default branch name. */
  10399     defaultBranch: string;
  10400     /** HTTPS git remote URL. */
  10401     remote: string;
  10402     /** Plaintext access token (only returned at creation time). */
  10403     token: string;
  10404     /** ISO 8601 token expiry timestamp. */
  10405     tokenExpiresAt: string;
  10406 }
  10407 /** Paginated list of repositories. */
  10408 interface ArtifactsRepoListResult {
  10409     /** Repositories in this page (without the `remote` field). */
  10410     repos: Omit<ArtifactsRepoInfo, 'remote'>[];
  10411     /** Total number of repositories in the namespace. */
  10412     total: number;
  10413     /** Cursor for the next page, if there are more results. */
  10414     cursor?: string;
  10415 }
  10416 /** Result of creating an access token. */
  10417 interface ArtifactsCreateTokenResult {
  10418     /** Unique token ID. */
  10419     id: string;
  10420     /** Plaintext token (only returned at creation time). */
  10421     plaintext: string;
  10422     /** Token scope: "read" or "write". */
  10423     scope: 'read' | 'write';
  10424     /** ISO 8601 token expiry timestamp. */
  10425     expiresAt: string;
  10426 }
  10427 /** Token metadata (no plaintext). */
  10428 interface ArtifactsTokenInfo {
  10429     /** Unique token ID. */
  10430     id: string;
  10431     /** Token scope: "read" or "write". */
  10432     scope: 'read' | 'write';
  10433     /** Token state: "active", "expired", or "revoked". */
  10434     state: 'active' | 'expired' | 'revoked';
  10435     /** ISO 8601 creation timestamp. */
  10436     createdAt: string;
  10437     /** ISO 8601 expiry timestamp. */
  10438     expiresAt: string;
  10439 }
  10440 /** Paginated list of tokens for a repository. */
  10441 interface ArtifactsTokenListResult {
  10442     /** Tokens in this page. */
  10443     tokens: ArtifactsTokenInfo[];
  10444     /** Total number of tokens for the repository. */
  10445     total: number;
  10446 }
  10447 /**
  10448  * Handle for a single repository. Returned by Artifacts.get().
  10449  *
  10450  * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.
  10451  */
  10452 interface ArtifactsRepo extends ArtifactsRepoInfo {
  10453     /**
  10454      * Create an access token for this repo.
  10455      * @param scope Token scope: "write" (default) or "read".
  10456      * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000).
  10457      * @throws {ArtifactsError} with code `INVALID_TTL` if ttl is out of range.
  10458      */
  10459     createToken(scope?: 'write' | 'read', ttl?: number): Promise<ArtifactsCreateTokenResult>;
  10460     /** List tokens for this repo (metadata only, no plaintext). */
  10461     listTokens(): Promise<ArtifactsTokenListResult>;
  10462     /**
  10463      * Revoke a token by plaintext or ID.
  10464      * @param tokenOrId Plaintext token or token ID.
  10465      * @returns true if revoked, false if not found.
  10466      * @throws {ArtifactsError} with code `INVALID_INPUT` if tokenOrId is empty.
  10467      */
  10468     revokeToken(tokenOrId: string): Promise<boolean>;
  10469     // ── Fork ──
  10470     /**
  10471      * Fork this repo to a new repo.
  10472      * @param name Target repository name.
  10473      * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true).
  10474      * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
  10475      * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.
  10476      * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if a fork is already running.
  10477      */
  10478     fork(name: string, opts?: {
  10479         description?: string;
  10480         readOnly?: boolean;
  10481         defaultBranchOnly?: boolean;
  10482     }): Promise<ArtifactsCreateRepoResult>;
  10483 }
  10484 // ── Error types ──────────────────────────────────────────────────────────────
  10485 /**
  10486  * Error codes returned by Artifacts binding operations.
  10487  *
  10488  * Each code maps to a numeric code available on `ArtifactsError.numericCode`.
  10489  */
  10490 type ArtifactsErrorCode = 'ALREADY_EXISTS' | 'NOT_FOUND' | 'IMPORT_IN_PROGRESS' | 'FORK_IN_PROGRESS' | 'INVALID_INPUT' | 'INVALID_REPO_NAME' | 'INVALID_TTL' | 'INVALID_URL' | 'REMOTE_AUTH_REQUIRED' | 'UPSTREAM_UNAVAILABLE' | 'MEMORY_LIMIT' | 'INTERNAL_ERROR';
  10491 /**
  10492  * Error thrown by Artifacts binding operations.
  10493  *
  10494  * Uses a string `.code` discriminator following the Cloudflare platform
  10495  * convention (StreamError, ImagesError, etc.). The `.numericCode` matches
  10496  * the REST API `errors[].code` values.
  10497  */
  10498 interface ArtifactsError extends Error {
  10499     readonly name: 'ArtifactsError';
  10500     /** String error code for programmatic matching. */
  10501     readonly code: ArtifactsErrorCode;
  10502     /** Numeric error code matching the REST API. */
  10503     readonly numericCode: number;
  10504 }
  10505 // ── Binding ──────────────────────────────────────────────────────────────────
  10506 /**
  10507  * Artifacts binding — namespace-level operations.
  10508  *
  10509  * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.
  10510  */
  10511 interface Artifacts {
  10512     /**
  10513      * Create a new repository with an initial access token.
  10514      * @param name Repository name (alphanumeric, dots, hyphens, underscores).
  10515      * @param opts Optional: readOnly flag, description, default branch name.
  10516      * @returns Repo metadata with initial token.
  10517      * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
  10518      * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the repo already exists.
  10519      */
  10520     create(name: string, opts?: {
  10521         readOnly?: boolean;
  10522         description?: string;
  10523         setDefaultBranch?: string;
  10524     }): Promise<ArtifactsCreateRepoResult>;
  10525     /**
  10526      * Get a handle to an existing repository.
  10527      * @param name Repository name.
  10528      * @returns Repo handle.
  10529      * @throws {ArtifactsError} with code `NOT_FOUND` if the repo does not exist.
  10530      * @throws {ArtifactsError} with code `IMPORT_IN_PROGRESS` if the repo is still importing.
  10531      * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if the repo is still forking.
  10532      */
  10533     get(name: string): Promise<ArtifactsRepo>;
  10534     /**
  10535      * Import a repository from an external git remote.
  10536      * @param params Source URL and optional branch/depth, plus target name and options.
  10537      * @returns Repo metadata with initial token.
  10538      * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if the target name is invalid.
  10539      * @throws {ArtifactsError} with code `INVALID_INPUT` if the source URL is not valid HTTPS.
  10540      * @throws {ArtifactsError} with code `INVALID_URL` if the source URL does not point to a git repository.
  10541      * @throws {ArtifactsError} with code `REMOTE_AUTH_REQUIRED` if the remote requires authentication.
  10542      * @throws {ArtifactsError} with code `NOT_FOUND` if the remote repository does not exist.
  10543      * @throws {ArtifactsError} with code `UPSTREAM_UNAVAILABLE` if the remote cannot be reached.
  10544      * @throws {ArtifactsError} with code `MEMORY_LIMIT` if the import exceeds service memory limits.
  10545      * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.
  10546      */
  10547     import(params: {
  10548         source: {
  10549             url: string;
  10550             branch?: string;
  10551             depth?: number;
  10552         };
  10553         target: {
  10554             name: string;
  10555             opts?: {
  10556                 description?: string;
  10557                 readOnly?: boolean;
  10558             };
  10559         };
  10560     }): Promise<ArtifactsCreateRepoResult>;
  10561     /**
  10562      * List repositories with cursor-based pagination.
  10563      * @param opts Optional: limit (1–200, default 50), cursor for next page.
  10564      */
  10565     list(opts?: {
  10566         limit?: number;
  10567         cursor?: string;
  10568     }): Promise<ArtifactsRepoListResult>;
  10569     /**
  10570      * Delete a repository and all associated tokens.
  10571      * @param name Repository name.
  10572      * @returns true if deleted, false if not found.
  10573      * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
  10574      */
  10575     delete(name: string): Promise<boolean>;
  10576 }
  10577 /**
  10578  * @deprecated Use the standalone AI Search Workers binding instead.
  10579  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10580  */
  10581 interface AutoRAGInternalError extends Error {
  10582 }
  10583 /**
  10584  * @deprecated Use the standalone AI Search Workers binding instead.
  10585  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10586  */
  10587 interface AutoRAGNotFoundError extends Error {
  10588 }
  10589 /**
  10590  * @deprecated Use the standalone AI Search Workers binding instead.
  10591  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10592  */
  10593 interface AutoRAGUnauthorizedError extends Error {
  10594 }
  10595 /**
  10596  * @deprecated Use the standalone AI Search Workers binding instead.
  10597  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10598  */
  10599 interface AutoRAGNameNotSetError extends Error {
  10600 }
  10601 type ComparisonFilter = {
  10602     key: string;
  10603     type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
  10604     value: string | number | boolean;
  10605 };
  10606 type CompoundFilter = {
  10607     type: 'and' | 'or';
  10608     filters: ComparisonFilter[];
  10609 };
  10610 /**
  10611  * @deprecated Use the standalone AI Search Workers binding instead.
  10612  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10613  */
  10614 type AutoRagSearchRequest = {
  10615     query: string;
  10616     filters?: CompoundFilter | ComparisonFilter;
  10617     max_num_results?: number;
  10618     ranking_options?: {
  10619         ranker?: string;
  10620         score_threshold?: number;
  10621     };
  10622     reranking?: {
  10623         enabled?: boolean;
  10624         model?: string;
  10625     };
  10626     rewrite_query?: boolean;
  10627 };
  10628 /**
  10629  * @deprecated Use the standalone AI Search Workers binding instead.
  10630  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10631  */
  10632 type AutoRagAiSearchRequest = AutoRagSearchRequest & {
  10633     stream?: boolean;
  10634     system_prompt?: string;
  10635 };
  10636 /**
  10637  * @deprecated Use the standalone AI Search Workers binding instead.
  10638  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10639  */
  10640 type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {
  10641     stream: true;
  10642 };
  10643 /**
  10644  * @deprecated Use the standalone AI Search Workers binding instead.
  10645  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10646  */
  10647 type AutoRagSearchResponse = {
  10648     object: 'vector_store.search_results.page';
  10649     search_query: string;
  10650     data: {
  10651         file_id: string;
  10652         filename: string;
  10653         score: number;
  10654         attributes: Record<string, string | number | boolean | null>;
  10655         content: {
  10656             type: 'text';
  10657             text: string;
  10658         }[];
  10659     }[];
  10660     has_more: boolean;
  10661     next_page: string | null;
  10662 };
  10663 /**
  10664  * @deprecated Use the standalone AI Search Workers binding instead.
  10665  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10666  */
  10667 type AutoRagListResponse = {
  10668     id: string;
  10669     enable: boolean;
  10670     type: string;
  10671     source: string;
  10672     vectorize_name: string;
  10673     paused: boolean;
  10674     status: string;
  10675 }[];
  10676 /**
  10677  * @deprecated Use the standalone AI Search Workers binding instead.
  10678  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10679  */
  10680 type AutoRagAiSearchResponse = AutoRagSearchResponse & {
  10681     response: string;
  10682 };
  10683 /**
  10684  * @deprecated Use the standalone AI Search Workers binding instead.
  10685  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10686  */
  10687 declare abstract class AutoRAG {
  10688     /**
  10689      * @deprecated Use the standalone AI Search Workers binding instead.
  10690      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10691      */
  10692     list(): Promise<AutoRagListResponse>;
  10693     /**
  10694      * @deprecated Use the standalone AI Search Workers binding instead.
  10695      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10696      */
  10697     search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
  10698     /**
  10699      * @deprecated Use the standalone AI Search Workers binding instead.
  10700      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10701      */
  10702     aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
  10703     /**
  10704      * @deprecated Use the standalone AI Search Workers binding instead.
  10705      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10706      */
  10707     aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
  10708     /**
  10709      * @deprecated Use the standalone AI Search Workers binding instead.
  10710      * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
  10711      */
  10712     aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
  10713 }
  10714 type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  10715 type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other';
  10716 /** Options fields shared by all quick actions. */
  10717 interface BrowserRunBaseOptions {
  10718     /** Adds `<script>` tags into the page with the desired URL or content.
  10719      * @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions
  10720      */
  10721     addScriptTag?: Array<{
  10722         content?: string;
  10723         url?: string;
  10724         type?: string;
  10725         id?: string;
  10726     }>;
  10727     /** Adds `<link rel="stylesheet">` or `<style>` tags into the page.
  10728      * @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions
  10729      */
  10730     addStyleTag?: Array<{
  10731         content?: string;
  10732         url?: string;
  10733     }>;
  10734     /** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */
  10735     authenticate?: {
  10736         username: string;
  10737         password: string;
  10738     };
  10739     /** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */
  10740     cookies?: Array<{
  10741         name: string;
  10742         value: string;
  10743         url?: string;
  10744         domain?: string;
  10745         path?: string;
  10746         secure?: boolean;
  10747         httpOnly?: boolean;
  10748         sameSite?: 'Strict' | 'Lax' | 'None';
  10749         expires?: number;
  10750         priority?: 'Low' | 'Medium' | 'High';
  10751         sameParty?: boolean;
  10752         sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
  10753         sourcePort?: number;
  10754         partitionKey?: string;
  10755     }>;
  10756     /** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */
  10757     emulateMediaType?: string;
  10758     /** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */
  10759     gotoOptions?: {
  10760         /** Navigation timeout in milliseconds (max 60 000). @default 30000 */
  10761         timeout?: number;
  10762         /** When to consider navigation complete. @default "domcontentloaded" */
  10763         waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];
  10764         referer?: string;
  10765         referrerPolicy?: string;
  10766     };
  10767     /** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */
  10768     rejectRequestPattern?: string[];
  10769     /** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */
  10770     allowRequestPattern?: string[];
  10771     /** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */
  10772     rejectResourceTypes?: BrowserRunResourceType[];
  10773     /** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */
  10774     allowResourceTypes?: BrowserRunResourceType[];
  10775     /** Additional HTTP headers sent with every request. */
  10776     setExtraHTTPHeaders?: Record<string, string>;
  10777     /** Whether JavaScript is enabled on the page. */
  10778     setJavaScriptEnabled?: boolean;
  10779     /** Override the default user agent string.
  10780      * @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
  10781      * */
  10782     userAgent?: string;
  10783     /** Set the browser viewport size.
  10784      * @see https://pptr.dev/api/puppeteer.viewport
  10785      * @default {width:1920,height:1080}
  10786      * */
  10787     viewport?: {
  10788         width: number;
  10789         height: number;
  10790         deviceScaleFactor?: number;
  10791         isMobile?: boolean;
  10792         isLandscape?: boolean;
  10793         hasTouch?: boolean;
  10794     };
  10795     /** Wait for a CSS selector to appear in the page before proceeding.
  10796      * @see https://pptr.dev/api/puppeteer.waitforselectoroptions
  10797      */
  10798     waitForSelector?: {
  10799         selector: string;
  10800         hidden?: true;
  10801         visible?: true;
  10802         /** Timeout in milliseconds. Max 120000 */
  10803         timeout?: number;
  10804     };
  10805     /** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */
  10806     waitForTimeout?: number;
  10807     /** When true, continue on best-effort when awaited events fail or timeout. */
  10808     bestAttempt?: boolean;
  10809     /** Maximum duration in milliseconds for the browser action after page load. Max 120000 */
  10810     actionTimeout?: number;
  10811     /** Cache time to live in seconds (0-86400). Set to 0 to disable.
  10812      * @default 5
  10813      */
  10814     cacheTTL?: number;
  10815 }
  10816 /** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
  10817 type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
  10818     /** URL to navigate to, e.g. `"https://example.com"`. */
  10819     url: string;
  10820 }) | (BrowserRunBaseOptions & {
  10821     /** Set the HTML content of the page directly. */
  10822     html: string;
  10823 });
  10824 type BrowserRunPuppeteerScreenshotOptions = {
  10825     /** @default "png" */
  10826     type?: 'png' | 'jpeg' | 'webp';
  10827     /** @default "binary" */
  10828     encoding?: 'binary' | 'base64';
  10829     quality?: number;
  10830     fullPage?: boolean;
  10831     clip?: {
  10832         x: number;
  10833         y: number;
  10834         width: number;
  10835         height: number;
  10836         scale?: number;
  10837     };
  10838     omitBackground?: boolean;
  10839     optimizeForSpeed?: boolean;
  10840     captureBeyondViewport?: boolean;
  10841     fromSurface?: boolean;
  10842 };
  10843 type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
  10844     /** CSS selector of the element to screenshot. */
  10845     selector?: string;
  10846     /** When true, scroll the entire page before taking the screenshot. */
  10847     scrollPage?: boolean;
  10848     /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
  10849     screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
  10850 };
  10851 type BrowserRunPDFOptions = BrowserRunCommonOptions & {
  10852     /** @see https://pptr.dev/api/puppeteer.pdfoptions */
  10853     pdfOptions?: {
  10854         /** @default 1 */
  10855         scale?: number;
  10856         /** @default false */
  10857         displayHeaderFooter?: boolean;
  10858         headerTemplate?: string;
  10859         footerTemplate?: string;
  10860         /** @default false */
  10861         printBackground?: boolean;
  10862         /** @default false */
  10863         landscape?: boolean;
  10864         pageRanges?: string;
  10865         /** @default "letter" */
  10866         format?: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
  10867         width?: string | number;
  10868         height?: string | number;
  10869         /** @default false */
  10870         preferCSSPageSize?: boolean;
  10871         margin?: {
  10872             top?: string | number;
  10873             right?: string | number;
  10874             bottom?: string | number;
  10875             left?: string | number;
  10876         };
  10877         /** @default false */
  10878         omitBackground?: boolean;
  10879         /** @default true */
  10880         tagged?: boolean;
  10881         /** @default false */
  10882         outline?: boolean;
  10883         /** @default 30000 */
  10884         timeout?: number;
  10885     };
  10886 };
  10887 type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
  10888     /** CSS selectors to scrape. At least one element is required. */
  10889     elements: Array<{
  10890         selector: string;
  10891     }>;
  10892 };
  10893 type BrowserRunLinksOptions = BrowserRunCommonOptions & {
  10894     /** When true, only return links that are visible on the page. @default false */
  10895     visibleLinksOnly?: boolean;
  10896     /** When true, exclude links pointing to external domains. @default false */
  10897     excludeExternalLinks?: boolean;
  10898 };
  10899 type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
  10900     /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
  10901     screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
  10902 };
  10903 interface BrowserRunJsonBaseOptions {
  10904     /** Custom AI models to try in order. Max 3. Falls back to next on error. */
  10905     custom_ai?: Array<{
  10906         /** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */
  10907         model: string;
  10908         /** Bearer token. Not needed for workers-ai models. */
  10909         authorization?: string;
  10910     }>;
  10911 }
  10912 /**
  10913  * Options for the `json` quick action.
  10914  * At least one of `prompt` or `response_format` must be provided.
  10915  */
  10916 type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
  10917     /** Natural-language prompt describing what data to extract. */
  10918     prompt: string;
  10919     /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
  10920     response_format?: AiTextGenerationResponseFormat;
  10921 } | {
  10922     /** Natural-language prompt describing what data to extract. */
  10923     prompt?: string;
  10924     /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
  10925     response_format: AiTextGenerationResponseFormat;
  10926 });
  10927 type BrowserRunContentOptions = BrowserRunCommonOptions;
  10928 type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
  10929 type BrowserRunResponseMeta = {
  10930     /** HTTP status code of the rendered page */
  10931     status: number;
  10932     /** Page title */
  10933     title: string;
  10934 };
  10935 /** Success response for `content` action. */
  10936 type BrowserRunContentSuccessResponse = {
  10937     success: true;
  10938     /** Extracted HTML content */
  10939     result: string;
  10940     meta: BrowserRunResponseMeta;
  10941 };
  10942 /** Success response for `links` action. */
  10943 type BrowserRunLinksSuccessResponse = {
  10944     success: true;
  10945     /** Extracted links */
  10946     result: string[];
  10947 };
  10948 /** Success response for `scrape` action. */
  10949 type BrowserRunScrapeSuccessResponse = {
  10950     success: true;
  10951     result: Array<{
  10952         /** The CSS selector used to find elements. */
  10953         selector: string;
  10954         /** Array of elements matching the selector. */
  10955         results: Array<{
  10956             /** Outer HTML of the element. */
  10957             html: string;
  10958             /** Text content of the element. */
  10959             text: string;
  10960             /** Width of the element in pixels. */
  10961             width: number;
  10962             /** Height of the element in pixels. */
  10963             height: number;
  10964             /** Top position of the element relative to the viewport in pixels. */
  10965             top: number;
  10966             /** Left position of the element relative to the viewport in pixels. */
  10967             left: number;
  10968             /** Array of HTML attributes on the element. */
  10969             attributes: Array<{
  10970                 /** Attribute name. */
  10971                 name: string;
  10972                 /** Attribute value. */
  10973                 value: string;
  10974             }>;
  10975         }>;
  10976     }>;
  10977 };
  10978 /** Success response for `snapshot` action. */
  10979 type BrowserRunSnapshotSuccessResponse = {
  10980     success: true;
  10981     result: {
  10982         /** HTML content of the page. */
  10983         content: string;
  10984         /** Base64-encoded screenshot image. */
  10985         screenshot: string;
  10986     };
  10987     meta: BrowserRunResponseMeta;
  10988 };
  10989 /** Success response for `json` action. */
  10990 type BrowserRunJsonSuccessResponse = {
  10991     success: true;
  10992     /** JSON data extracted from the page using an AI model */
  10993     result: Record<string, unknown>;
  10994 };
  10995 /** Success response for `markdown` action. */
  10996 type BrowserRunMarkdownSuccessResponse = {
  10997     success: true;
  10998     /** Extracted markdown content */
  10999     result: string;
  11000 };
  11001 /** Error response for BrowserRun actions. */
  11002 type BrowserRunErrorResponse = {
  11003     success: false;
  11004     errors: {
  11005         message: string;
  11006         code?: number;
  11007         detail?: string;
  11008         path?: string;
  11009     }[];
  11010 };
  11011 /** Error response for BrowserRun `json` action. */
  11012 type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {
  11013     /** Raw AI response text for debugging */
  11014     rawAiResponse?: string;
  11015 };
  11016 /**
  11017  * Browser Run API binding for automating headless browsers.
  11018  * @see https://developers.cloudflare.com/browser-run/
  11019  */
  11020 declare abstract class BrowserRun {
  11021     /**
  11022      * Send a raw HTTP request to the Browser Run API.
  11023      * Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.
  11024      * @see https://developers.cloudflare.com/browser-run/
  11025      */
  11026     fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
  11027     /**
  11028      * Take a screenshot of a web page.
  11029      * @param action - Must be `'screenshot'`.
  11030      * @param options - Screenshot options including viewport, selectors, and image format.
  11031      * @returns A `Response` containing one of:
  11032      *
  11033      * **Success (HTTP 200):**
  11034      * - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)
  11035      * - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)
  11036      *
  11037      * **Error:**
  11038      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11039      *
  11040      * **Headers:**
  11041      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11042      */
  11043     quickAction(action: 'screenshot', options: BrowserRunScreenshotOptions): Promise<Response>;
  11044     /**
  11045      * Generate a PDF of a web page.
  11046      * @param action - Must be `'pdf'`.
  11047      * @param options - PDF generation options including page size, margins, and headers/footers.
  11048      * @returns A `Response` containing one of:
  11049      *
  11050      * **Success (HTTP 200):**
  11051      * - Binary PDF data with `Content-Type: application/pdf`
  11052      *
  11053      * **Error:**
  11054      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11055      *
  11056      * **Headers:**
  11057      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11058      */
  11059     quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;
  11060     /**
  11061      * Get the HTML content of a web page.
  11062      * @param action - Must be `'content'`.
  11063      * @param options - Navigation and page interaction options.
  11064      * @returns A `Response` containing one of:
  11065      *
  11066      * **Success (HTTP 200):**
  11067      * - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`
  11068      *
  11069      * **Error:**
  11070      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11071      *
  11072      * **Headers:**
  11073      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11074      */
  11075     quickAction(action: 'content', options: BrowserRunContentOptions): Promise<Response>;
  11076     /**
  11077      * Scrape elements from a web page by CSS selector.
  11078      * @param action - Must be `'scrape'`.
  11079      * @param options - Scrape options with CSS selectors for elements to extract.
  11080      * @returns A `Response` containing one of:
  11081      *
  11082      * **Success (HTTP 200):**
  11083      * - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`
  11084      *
  11085      * **Error:**
  11086      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11087      *
  11088      * **Headers:**
  11089      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11090      */
  11091     quickAction(action: 'scrape', options: BrowserRunScrapeOptions): Promise<Response>;
  11092     /**
  11093      * Extract all links from a web page.
  11094      * @param action - Must be `'links'`.
  11095      * @param options - Options to filter visible or internal links only.
  11096      * @returns A `Response` containing one of:
  11097      *
  11098      * **Success (HTTP 200):**
  11099      * - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`
  11100      *
  11101      * **Error:**
  11102      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11103      *
  11104      * **Headers:**
  11105      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11106      */
  11107     quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
  11108     /**
  11109      * Get both the HTML content and a base64-encoded screenshot of a web page.
  11110      * @param action - Must be `'snapshot'`.
  11111      * @param options - Snapshot options including screenshot settings (encoding is always base64).
  11112      * @returns A `Response` containing one of:
  11113      *
  11114      * **Success (HTTP 200):**
  11115      * - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`
  11116      *
  11117      * **Error:**
  11118      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11119      *
  11120      * **Headers:**
  11121      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11122      */
  11123     quickAction(action: 'snapshot', options: BrowserRunSnapshotOptions): Promise<Response>;
  11124     /**
  11125      * Extract structured JSON data from a web page using AI.
  11126      * @param action - Must be `'json'`.
  11127      * @param options - JSON extraction options with prompt or response_format schema.
  11128      * @returns A `Response` containing one of:
  11129      *
  11130      * **Success (HTTP 200):**
  11131      * - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`
  11132      *
  11133      * **Error:**
  11134      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11135      * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
  11136      * - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)
  11137      *
  11138      * **Headers:**
  11139      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11140      */
  11141     quickAction(action: 'json', options: BrowserRunJsonOptions): Promise<Response>;
  11142     /**
  11143      * Convert a web page to Markdown.
  11144      * @param action - Must be `'markdown'`.
  11145      * @param options - Navigation and page interaction options.
  11146      * @returns A `Response` containing one of:
  11147      *
  11148      * **Success (HTTP 200):**
  11149      * - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`
  11150      *
  11151      * **Error:**
  11152      * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
  11153      * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
  11154      *
  11155      * **Headers:**
  11156      * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
  11157      */
  11158     quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
  11159 }
  11160 /**
  11161  * In addition to the properties you can set in the RequestInit dict
  11162  * that you pass as an argument to the Request constructor, you can
  11163  * set certain properties of a `cf` object to control how Cloudflare
  11164  * features are applied to that new Request.
  11165  *
  11166  * Note: Currently, these properties cannot be tested in the
  11167  * playground.
  11168  */
  11169 interface RequestInitCfProperties extends Record<string, unknown> {
  11170     cacheEverything?: boolean;
  11171     /**
  11172      * A request's cache key is what determines if two requests are
  11173      * "the same" for caching purposes. If a request has the same cache key
  11174      * as some previous request, then we can serve the same cached response for
  11175      * both. (e.g. 'some-key')
  11176      *
  11177      * Only available for Enterprise customers.
  11178      */
  11179     cacheKey?: string;
  11180     /**
  11181      * This allows you to append additional Cache-Tag response headers
  11182      * to the origin response without modifications to the origin server.
  11183      * This will allow for greater control over the Purge by Cache Tag feature
  11184      * utilizing changes only in the Workers process.
  11185      *
  11186      * Only available for Enterprise customers.
  11187      */
  11188     cacheTags?: string[];
  11189     /**
  11190      * Force response to be cached for a given number of seconds. (e.g. 300)
  11191      */
  11192     cacheTtl?: number;
  11193     /**
  11194      * Force response to be cached for a given number of seconds based on the Origin status code.
  11195      * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
  11196      */
  11197     cacheTtlByStatus?: Record<string, number>;
  11198     /** Controls how responses with a `Vary` header are cached for this request. */
  11199     vary?: RequestInitCfPropertiesVary;
  11200     /**
  11201      * Explicit Cache-Control header value to set on the response stored in cache.
  11202      * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
  11203      *
  11204      * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
  11205      * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
  11206      *
  11207      * Can be used together with `cacheTtlByStatus`.
  11208      */
  11209     cacheControl?: string;
  11210     /**
  11211      * Whether the response should be eligible for Cache Reserve storage.
  11212      */
  11213     cacheReserveEligible?: boolean;
  11214     /**
  11215      * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
  11216      */
  11217     respectStrongEtag?: boolean;
  11218     /**
  11219      * Whether to strip ETag headers from the origin response before caching.
  11220      */
  11221     stripEtags?: boolean;
  11222     /**
  11223      * Whether to strip Last-Modified headers from the origin response before caching.
  11224      */
  11225     stripLastModified?: boolean;
  11226     /**
  11227      * Whether to enable Cache Deception Armor, which protects against web cache
  11228      * deception attacks by verifying the Content-Type matches the URL extension.
  11229      */
  11230     cacheDeceptionArmor?: boolean;
  11231     /**
  11232      * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
  11233      */
  11234     cacheReserveMinimumFileSize?: number;
  11235     scrapeShield?: boolean;
  11236     apps?: boolean;
  11237     /**
  11238      * Controls whether an outbound gRPC-web subrequest from this Worker is
  11239      * converted to gRPC at the Cloudflare edge.
  11240      *
  11241      * - `"passthrough"`: forward the subrequest unchanged as gRPC-web (default).
  11242      * - `"convert"`: convert the gRPC-web subrequest to gRPC at the edge.
  11243      *
  11244      * Provides per-request control over the same edge conversion behavior
  11245      * gated by the `auto_grpc_convert` compatibility flag.
  11246      */
  11247     grpcWeb?: "passthrough" | "convert";
  11248     image?: RequestInitCfPropertiesImage;
  11249     minify?: RequestInitCfPropertiesImageMinify;
  11250     mirage?: boolean;
  11251     polish?: "lossy" | "lossless" | "off";
  11252     r2?: RequestInitCfPropertiesR2;
  11253     /**
  11254      * Redirects the request to an alternate origin server. You can use this,
  11255      * for example, to implement load balancing across several origins.
  11256      * (e.g.us-east.example.com)
  11257      *
  11258      * Note - For security reasons, the hostname set in resolveOverride must
  11259      * be proxied on the same Cloudflare zone of the incoming request.
  11260      * Otherwise, the setting is ignored. CNAME hosts are allowed, so to
  11261      * resolve to a host under a different domain or a DNS only domain first
  11262      * declare a CNAME record within your own zone’s DNS mapping to the
  11263      * external hostname, set proxy on Cloudflare, then set resolveOverride
  11264      * to point to that CNAME record.
  11265      */
  11266     resolveOverride?: string;
  11267 }
  11268 /**
  11269  * Controls how Workers Standard Vary handles a request header listed by an
  11270  * origin `Vary` response header:
  11271  *
  11272  * - `"normalize"`: normalize the request header value before it is used in the
  11273  *   cache variance key.
  11274  * - `"passthrough"`: use the raw request header value in the cache variance
  11275  *   key.
  11276  * - `"bypass"`: bypass cache when the header appears in the origin `Vary`
  11277  *   response header.
  11278  */
  11279 type RequestInitCfPropertiesVaryAction = "normalize" | "passthrough" | "bypass";
  11280 /** Configuration for Workers Standard Vary support. */
  11281 interface RequestInitCfPropertiesVary {
  11282     /** The fallback action for varied request headers not listed in `headers`. */
  11283     default: RequestInitCfPropertiesVaryHeader;
  11284     /**
  11285      * Lowercase request header names and their Vary configuration.
  11286      *
  11287      * The `accept` header can include `media_types`, the `accept-language`
  11288      * header can include `languages`, and other headers support only `action`.
  11289      */
  11290     headers?: RequestInitCfPropertiesVaryHeaders;
  11291 }
  11292 /** Common Vary behavior for a single request header. */
  11293 interface RequestInitCfPropertiesVaryHeader {
  11294     /** How this request header contributes to cache variance. */
  11295     action: RequestInitCfPropertiesVaryAction;
  11296 }
  11297 /** Vary behavior for the `accept` request header. */
  11298 interface RequestInitCfPropertiesVaryAcceptHeader extends RequestInitCfPropertiesVaryHeader {
  11299     /**
  11300      * Media types to keep when normalizing the `Accept` request header.
  11301      *
  11302      * Named `media_types` to match the serialized `cf.vary` configuration.
  11303      */
  11304     media_types?: string[];
  11305 }
  11306 /** Vary behavior for the `accept-language` request header. */
  11307 interface RequestInitCfPropertiesVaryAcceptLanguageHeader extends RequestInitCfPropertiesVaryHeader {
  11308     /**
  11309      * Language tags to keep when normalizing the `Accept-Language` request
  11310      * header.
  11311      */
  11312     languages?: string[];
  11313 }
  11314 /**
  11315  * Lowercase request header names and their Vary behavior.
  11316  *
  11317  * The index signature allows arbitrary custom request headers beyond the
  11318  * well-known `accept` and `accept-language` specializations.
  11319  */
  11320 interface RequestInitCfPropertiesVaryHeaders {
  11321     accept?: RequestInitCfPropertiesVaryAcceptHeader;
  11322     "accept-language"?: RequestInitCfPropertiesVaryAcceptLanguageHeader;
  11323     [header: string]: RequestInitCfPropertiesVaryHeader | RequestInitCfPropertiesVaryAcceptHeader | RequestInitCfPropertiesVaryAcceptLanguageHeader | undefined;
  11324 }
  11325 interface BasicImageTransformations {
  11326     /**
  11327      * Maximum width in image pixels. The value must be an integer.
  11328      */
  11329     width?: number;
  11330     /**
  11331      * Maximum height in image pixels. The value must be an integer.
  11332      */
  11333     height?: number;
  11334     /**
  11335      * When cropping with fit: "cover", this defines the side or point that should
  11336      * be left uncropped. The value is either a string
  11337      * "left", "right", "top", "bottom", "auto", or "center" (the default),
  11338      * or an object {x, y} containing focal point coordinates in the original
  11339      * image expressed as fractions ranging from 0.0 (top or left) to 1.0
  11340      * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
  11341      * crop bottom or left and right sides as necessary, but won’t crop anything
  11342      * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
  11343      * preserve as much as possible around a point at 20% of the height of the
  11344      * source image.
  11345      */
  11346     gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;
  11347     /**
  11348      * Specifies how closely the image is cropped toward detected faces when combined
  11349      * with the gravity=face option. Accepts a valid range between 0.0 (includes as much
  11350      * of the background as possible) and 1.0 (crops the image as closely to the face as
  11351      * possible). The default is 0.
  11352      */
  11353     zoom?: number;
  11354     /**
  11355      * Resizing mode as a string. It affects interpretation of width and height
  11356      * options:
  11357      *  - scale-down: Similar to contain, but the image is never enlarged. If
  11358      *    the image is larger than given width or height, it will be resized.
  11359      *    Otherwise its original size will be kept.
  11360      *  - scale-up: Similar to contain, but the image is never shrunk. If the
  11361      *    image is smaller than the given width or height, it will be resized.
  11362      *    Otherwise its original size will be kept.
  11363      *  - contain: Resizes to maximum size that fits within the given width and
  11364      *    height. If only a single dimension is given (e.g. only width), the
  11365      *    image will be shrunk or enlarged to exactly match that dimension.
  11366      *    Aspect ratio is always preserved.
  11367      *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width
  11368      *    and height. If the image has an aspect ratio different from the ratio
  11369      *    of width and height, it will be cropped to fit.
  11370      *  - crop: The image will be shrunk and cropped to fit within the area
  11371      *    specified by width and height. The image will not be enlarged. For images
  11372      *    smaller than the given dimensions it's the same as scale-down. For
  11373      *    images larger than the given dimensions, it's the same as cover.
  11374      *    See also trim.
  11375      *  - pad: Resizes to the maximum size that fits within the given width and
  11376      *    height, and then fills the remaining area with a background color
  11377      *    (white by default). Use of this mode is not recommended, as the same
  11378      *    effect can be more efficiently achieved with the contain mode and the
  11379      *    CSS object-fit: contain property.
  11380      *  - squeeze: Stretches and deforms to the width and height given, even if it
  11381      *    breaks aspect ratio
  11382      */
  11383     fit?: "scale-down" | "scale-up" | "contain" | "cover" | "crop" | "pad" | "squeeze";
  11384     /**
  11385      * Allows you to trim your image. Takes dpr into account and is performed before
  11386      * resizing or rotation.
  11387      *
  11388      * It can be used as:
  11389      * - left, top, right, bottom - it will specify the number of pixels to cut
  11390      *   off each side
  11391      * - width, height - the width/height you'd like to end up with - can be used
  11392      *   in combination with the properties above
  11393      * - border - this will automatically trim the surroundings of an image based on
  11394      *   it's color. It consists of three properties:
  11395      *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
  11396      *    - tolerance: difference from color to treat as color
  11397      *    - keep: the number of pixels of border to keep
  11398      */
  11399     trim?: "border" | {
  11400         top?: number;
  11401         bottom?: number;
  11402         left?: number;
  11403         right?: number;
  11404         width?: number;
  11405         height?: number;
  11406         border?: boolean | {
  11407             color?: string;
  11408             tolerance?: number;
  11409             keep?: number;
  11410         };
  11411     };
  11412     /**
  11413      * Background color to add underneath the image. Applies only to images with
  11414      * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
  11415      * hsl(…), etc.)
  11416      */
  11417     background?: string;
  11418     /**
  11419      * Flips the images horizontally, vertically, or both. Flipping is applied before
  11420      * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
  11421      * horizontally, then rotated by 90 degrees.
  11422      */
  11423     flip?: 'h' | 'v' | 'hv';
  11424     /**
  11425      * Number of degrees (90, 180, 270) to rotate the image by. width and height
  11426      * options refer to axes after rotation.
  11427      */
  11428     rotate?: 0 | 90 | 180 | 270 | 360;
  11429     /**
  11430      * Strength of sharpening filter to apply to the image. Floating-point
  11431      * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
  11432      * recommended value for downscaled images.
  11433      */
  11434     sharpen?: number;
  11435     /**
  11436      * Radius of a blur filter (approximate gaussian). Maximum supported radius
  11437      * is 250.
  11438      */
  11439     blur?: number;
  11440     /**
  11441      * Increase contrast by a factor. A value of 1.0 equals no change, a value of
  11442      * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
  11443      * ignored.
  11444      */
  11445     contrast?: number;
  11446     /**
  11447      * Increase brightness by a factor. A value of 1.0 equals no change, a value
  11448      * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
  11449      * 0 is ignored.
  11450      */
  11451     brightness?: number;
  11452     /**
  11453      * Increase exposure by a factor. A value of 1.0 equals no change, a value of
  11454      * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
  11455      */
  11456     gamma?: number;
  11457     /**
  11458      * Increase contrast by a factor. A value of 1.0 equals no change, a value of
  11459      * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
  11460      * ignored.
  11461      */
  11462     saturation?: number;
  11463     /**
  11464      * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
  11465      * easier to specify higher-DPI sizes in <img srcset>.
  11466      */
  11467     dpr?: number;
  11468     /**
  11469      * Adds a border around the image. The border is added after resizing. Border
  11470      * width takes dpr into account, and can be specified either using a single
  11471      * width property, or individually for each side.
  11472      */
  11473     border?: {
  11474         color: string;
  11475         width: number;
  11476     } | {
  11477         color: string;
  11478         top: number;
  11479         right: number;
  11480         bottom: number;
  11481         left: number;
  11482     };
  11483     /**
  11484      * Image segmentation using artificial intelligence models. Sets pixels not
  11485      * within selected segment area to transparent e.g "foreground" sets every
  11486      * background pixel as transparent.
  11487      */
  11488     segment?: "foreground";
  11489     /**
  11490      * Controls the algorithm used when an image needs to be enlarged. This
  11491      * parameter works with any fit mode that upscales, such as `contain`,
  11492      * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
  11493      * the target dimensions are smaller than the source.
  11494      * - interpolate: Uses bicubic interpolation, which may reduce image quality.
  11495      *   This is the default behavior when `upscale` is not specified.
  11496      * - generate: Uses AI upscaling to produce sharper, more detailed results
  11497      *   when enlarging images.
  11498      */
  11499     upscale?: "interpolate" | "generate";
  11500 }
  11501 interface BasicImageTransformationsGravityCoordinates {
  11502     x?: number;
  11503     y?: number;
  11504     mode?: 'remainder' | 'box-center';
  11505 }
  11506 interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
  11507     /**
  11508      * Absolute URL of the image file to use for the drawing. It can be any of
  11509      * the supported file formats. For drawing of watermarks or non-rectangular
  11510      * overlays we recommend using PNG or WebP images.
  11511      */
  11512     url: string;
  11513     /**
  11514      * Floating-point number between 0 (transparent) and 1 (opaque).
  11515      * For example, opacity: 0.5 makes overlay semitransparent.
  11516      */
  11517     opacity?: number;
  11518     /**
  11519      * - If set to true, the overlay image will be tiled to cover the entire
  11520      *   area. This is useful for stock-photo-like watermarks.
  11521      * - If set to "x", the overlay image will be tiled horizontally only
  11522      *   (form a line).
  11523      * - If set to "y", the overlay image will be tiled vertically only
  11524      *   (form a line).
  11525      */
  11526     repeat?: true | "x" | "y";
  11527     /**
  11528      * How to combine the foreground and backdrop pixels to create the result
  11529      */
  11530     composite?: 
  11531     /** Foreground drawn on top of backdrop (default) */
  11532     'over'
  11533     /** Foreground shown only where backdrop is opaque */
  11534      | 'in'
  11535     /** Foreground drawn on top, but clipped to the backdrop's shape */
  11536      | 'atop'
  11537     /** Foreground shown only where backdrop is transparent */
  11538      | 'out'
  11539     /** Foreground and backdrop visible only where the other is not */
  11540      | 'xor'
  11541     /** Foreground and backdrop channels added (brightening) */
  11542      | 'lighter';
  11543     /**
  11544      * Position of the overlay image relative to a given edge. Each property is
  11545      * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
  11546      * positions left side of the overlay 10 pixels from the left edge of the
  11547      * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
  11548      * of the background image.
  11549      *
  11550      * Setting both left & right, or both top & bottom is an error.
  11551      *
  11552      * If no position is specified, the image will be centered.
  11553      */
  11554     top?: number;
  11555     left?: number;
  11556     bottom?: number;
  11557     right?: number;
  11558 }
  11559 interface RequestInitCfPropertiesImage extends BasicImageTransformations {
  11560     /**
  11561      * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
  11562      * make images look worse, but load faster. The default is 85. It applies only
  11563      * to JPEG and WebP images. It doesn’t have any effect on PNG.
  11564      */
  11565     quality?: number | "low" | "medium-low" | "medium-high" | "high";
  11566     /**
  11567      * Output format to generate. It can be:
  11568      *  - avif: generate images in AVIF format.
  11569      *  - webp: generate images in Google WebP format. Set quality to 100 to get
  11570      *    the WebP-lossless format.
  11571      *  - json: instead of generating an image, outputs information about the
  11572      *    image, in JSON format. The JSON object will contain image size
  11573      *    (before and after resizing), source image’s MIME type, file size, etc.
  11574      * - jpeg: generate images in JPEG format.
  11575      * - png: generate images in PNG format.
  11576      */
  11577     format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg";
  11578     /**
  11579      * Whether to preserve animation frames from input files. Default is true.
  11580      * Setting it to false reduces animations to still images. This setting is
  11581      * recommended when enlarging images or processing arbitrary user content,
  11582      * because large GIF animations can weigh tens or even hundreds of megabytes.
  11583      * It is also useful to set anim:false when using format:"json" to get the
  11584      * response quicker without the number of frames.
  11585      */
  11586     anim?: boolean;
  11587     /**
  11588      * What EXIF data should be preserved in the output image. Note that EXIF
  11589      * rotation and embedded color profiles are always applied ("baked in" into
  11590      * the image), and aren't affected by this option. Note that if the Polish
  11591      * feature is enabled, all metadata may have been removed already and this
  11592      * option may have no effect.
  11593      *  - keep: Preserve most of EXIF metadata, including GPS location if there's
  11594      *    any.
  11595      *  - copyright: Only keep the copyright tag, and discard everything else.
  11596      *    This is the default behavior for JPEG files.
  11597      *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG
  11598      *    output formats always discard metadata.
  11599      */
  11600     metadata?: "keep" | "copyright" | "none";
  11601     /**
  11602      * Overlays are drawn in the order they appear in the array (last array
  11603      * entry is the topmost layer).
  11604      */
  11605     draw?: RequestInitCfPropertiesImageDraw[];
  11606     /**
  11607      * Fetching image from authenticated origin. Setting this property will
  11608      * pass authentication headers (Authorization, Cookie, etc.) through to
  11609      * the origin.
  11610      */
  11611     "origin-auth"?: "share-publicly";
  11612     /**
  11613      * Slightly reduces latency on a cache miss by selecting a
  11614      * quickest-to-compress file format, at a cost of increased file size and
  11615      * lower image quality. It will usually override the format option and choose
  11616      * JPEG over WebP or AVIF. We do not recommend using this option, except in
  11617      * unusual circumstances like resizing uncacheable dynamically-generated
  11618      * images.
  11619      */
  11620     compression?: "fast";
  11621 }
  11622 interface RequestInitCfPropertiesImageMinify {
  11623     javascript?: boolean;
  11624     css?: boolean;
  11625     html?: boolean;
  11626 }
  11627 interface RequestInitCfPropertiesR2 {
  11628     /**
  11629      * Colo id of bucket that an object is stored in
  11630      */
  11631     bucketColoId?: number;
  11632 }
  11633 /**
  11634  * Request metadata provided by Cloudflare's edge.
  11635  */
  11636 type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
  11637 interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {
  11638     /**
  11639      * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
  11640      *
  11641      * @example 395747
  11642      */
  11643     asn?: number;
  11644     /**
  11645      * The organization which owns the ASN of the incoming request.
  11646      *
  11647      * @example "Google Cloud"
  11648      */
  11649     asOrganization?: string;
  11650     /**
  11651      * The original value of the `Accept-Encoding` header if Cloudflare modified it.
  11652      *
  11653      * @example "gzip, deflate, br"
  11654      */
  11655     clientAcceptEncoding?: string;
  11656     /**
  11657      * The number of milliseconds it took for the request to reach your worker.
  11658      *
  11659      * @example 22
  11660      */
  11661     clientTcpRtt?: number;
  11662     /**
  11663      * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)
  11664      * airport code of the data center that the request hit.
  11665      *
  11666      * @example "DFW"
  11667      */
  11668     colo: string;
  11669     /**
  11670      * Represents the upstream's response to a
  11671      * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)
  11672      * from cloudflare.
  11673      *
  11674      * For workers with no upstream, this will always be `1`.
  11675      *
  11676      * @example 3
  11677      */
  11678     edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;
  11679     /**
  11680      * The HTTP Protocol the request used.
  11681      *
  11682      * @example "HTTP/2"
  11683      */
  11684     httpProtocol: string;
  11685     /**
  11686      * The browser-requested prioritization information in the request object.
  11687      *
  11688      * If no information was set, defaults to the empty string `""`
  11689      *
  11690      * @example "weight=192;exclusive=0;group=3;group-weight=127"
  11691      * @default ""
  11692      */
  11693     requestPriority: string;
  11694     /**
  11695      * The TLS version of the connection to Cloudflare.
  11696      * In requests served over plaintext (without TLS), this property is the empty string `""`.
  11697      *
  11698      * @example "TLSv1.3"
  11699      */
  11700     tlsVersion: string;
  11701     /**
  11702      * The cipher for the connection to Cloudflare.
  11703      * In requests served over plaintext (without TLS), this property is the empty string `""`.
  11704      *
  11705      * @example "AEAD-AES128-GCM-SHA256"
  11706      */
  11707     tlsCipher: string;
  11708     /**
  11709      * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.
  11710      *
  11711      * If the incoming request was served over plaintext (without TLS) this field is undefined.
  11712      */
  11713     tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
  11714 }
  11715 interface IncomingRequestCfPropertiesBotManagementBase {
  11716     /**
  11717      * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
  11718      * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
  11719      *
  11720      * @example 54
  11721      */
  11722     score: number;
  11723     /**
  11724      * A boolean value that is true if the request comes from a good bot, like Google or Bing.
  11725      * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).
  11726      */
  11727     verifiedBot: boolean;
  11728     /**
  11729      * A boolean value that is true if the request originates from a
  11730      * Cloudflare-verified proxy service.
  11731      */
  11732     corporateProxy: boolean;
  11733     /**
  11734      * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
  11735      */
  11736     staticResource: boolean;
  11737     /**
  11738      * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
  11739      */
  11740     detectionIds: number[];
  11741 }
  11742 interface IncomingRequestCfPropertiesBotManagement {
  11743     /**
  11744      * Results of Cloudflare's Bot Management analysis
  11745      */
  11746     botManagement: IncomingRequestCfPropertiesBotManagementBase;
  11747     /**
  11748      * Duplicate of `botManagement.score`.
  11749      *
  11750      * @deprecated
  11751      */
  11752     clientTrustScore: number;
  11753 }
  11754 interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {
  11755     /**
  11756      * Results of Cloudflare's Bot Management analysis
  11757      */
  11758     botManagement: IncomingRequestCfPropertiesBotManagementBase & {
  11759         /**
  11760          * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients
  11761          * across different destination IPs, Ports, and X509 certificates.
  11762          */
  11763         ja3Hash: string;
  11764     };
  11765 }
  11766 interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {
  11767     /**
  11768      * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
  11769      *
  11770      * This field is only present if you have Cloudflare for SaaS enabled on your account
  11771      * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).
  11772      */
  11773     hostMetadata?: HostMetadata;
  11774 }
  11775 interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
  11776     /**
  11777      * Information about the client certificate presented to Cloudflare.
  11778      *
  11779      * This is populated when the incoming request is served over TLS using
  11780      * either Cloudflare Access or API Shield (mTLS)
  11781      * and the presented SSL certificate has a valid
  11782      * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)
  11783      * (i.e., not `null` or `""`).
  11784      *
  11785      * Otherwise, a set of placeholder values are used.
  11786      *
  11787      * The property `certPresented` will be set to `"1"` when
  11788      * the object is populated (i.e. the above conditions were met).
  11789      */
  11790     tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
  11791 }
  11792 /**
  11793  * Metadata about the request's TLS handshake
  11794  */
  11795 interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
  11796     /**
  11797      * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
  11798      *
  11799      * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
  11800      */
  11801     clientHandshake: string;
  11802     /**
  11803      * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
  11804      *
  11805      * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
  11806      */
  11807     serverHandshake: string;
  11808     /**
  11809      * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
  11810      *
  11811      * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
  11812      */
  11813     clientFinished: string;
  11814     /**
  11815      * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
  11816      *
  11817      * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
  11818      */
  11819     serverFinished: string;
  11820 }
  11821 /**
  11822  * Geographic data about the request's origin.
  11823  */
  11824 interface IncomingRequestCfPropertiesGeographicInformation {
  11825     /**
  11826      * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
  11827      *
  11828      * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
  11829      *
  11830      * If Cloudflare is unable to determine where the request originated this property is omitted.
  11831      *
  11832      * The country code `"T1"` is used for requests originating on TOR.
  11833      *
  11834      * @example "GB"
  11835      */
  11836     country?: Iso3166Alpha2Code | "T1";
  11837     /**
  11838      * If present, this property indicates that the request originated in the EU
  11839      *
  11840      * @example "1"
  11841      */
  11842     isEUCountry?: "1";
  11843     /**
  11844      * A two-letter code indicating the continent the request originated from.
  11845      *
  11846      * @example "AN"
  11847      */
  11848     continent?: ContinentCode;
  11849     /**
  11850      * The city the request originated from
  11851      *
  11852      * @example "Austin"
  11853      */
  11854     city?: string;
  11855     /**
  11856      * Postal code of the incoming request
  11857      *
  11858      * @example "78701"
  11859      */
  11860     postalCode?: string;
  11861     /**
  11862      * Latitude of the incoming request
  11863      *
  11864      * @example "30.27130"
  11865      */
  11866     latitude?: string;
  11867     /**
  11868      * Longitude of the incoming request
  11869      *
  11870      * @example "-97.74260"
  11871      */
  11872     longitude?: string;
  11873     /**
  11874      * Timezone of the incoming request
  11875      *
  11876      * @example "America/Chicago"
  11877      */
  11878     timezone?: string;
  11879     /**
  11880      * If known, the ISO 3166-2 name for the first level region associated with
  11881      * the IP address of the incoming request
  11882      *
  11883      * @example "Texas"
  11884      */
  11885     region?: string;
  11886     /**
  11887      * If known, the ISO 3166-2 code for the first-level region associated with
  11888      * the IP address of the incoming request
  11889      *
  11890      * @example "TX"
  11891      */
  11892     regionCode?: string;
  11893     /**
  11894      * Metro code (DMA) of the incoming request
  11895      *
  11896      * @example "635"
  11897      */
  11898     metroCode?: string;
  11899 }
  11900 /** Data about the incoming request's TLS certificate */
  11901 interface IncomingRequestCfPropertiesTLSClientAuth {
  11902     /** Always `"1"`, indicating that the certificate was presented */
  11903     certPresented: "1";
  11904     /**
  11905      * Result of certificate verification.
  11906      *
  11907      * @example "FAILED:self signed certificate"
  11908      */
  11909     certVerified: Exclude<CertVerificationStatus, "NONE">;
  11910     /** The presented certificate's revokation status.
  11911      *
  11912      * - A value of `"1"` indicates the certificate has been revoked
  11913      * - A value of `"0"` indicates the certificate has not been revoked
  11914      */
  11915     certRevoked: "1" | "0";
  11916     /**
  11917      * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
  11918      *
  11919      * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
  11920      */
  11921     certIssuerDN: string;
  11922     /**
  11923      * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
  11924      *
  11925      * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
  11926      */
  11927     certSubjectDN: string;
  11928     /**
  11929      * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
  11930      *
  11931      * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
  11932      */
  11933     certIssuerDNRFC2253: string;
  11934     /**
  11935      * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
  11936      *
  11937      * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
  11938      */
  11939     certSubjectDNRFC2253: string;
  11940     /** The certificate issuer's distinguished name (legacy policies) */
  11941     certIssuerDNLegacy: string;
  11942     /** The certificate subject's distinguished name (legacy policies) */
  11943     certSubjectDNLegacy: string;
  11944     /**
  11945      * The certificate's serial number
  11946      *
  11947      * @example "00936EACBE07F201DF"
  11948      */
  11949     certSerial: string;
  11950     /**
  11951      * The certificate issuer's serial number
  11952      *
  11953      * @example "2489002934BDFEA34"
  11954      */
  11955     certIssuerSerial: string;
  11956     /**
  11957      * The certificate's Subject Key Identifier
  11958      *
  11959      * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
  11960      */
  11961     certSKI: string;
  11962     /**
  11963      * The certificate issuer's Subject Key Identifier
  11964      *
  11965      * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
  11966      */
  11967     certIssuerSKI: string;
  11968     /**
  11969      * The certificate's SHA-1 fingerprint
  11970      *
  11971      * @example "6b9109f323999e52259cda7373ff0b4d26bd232e"
  11972      */
  11973     certFingerprintSHA1: string;
  11974     /**
  11975      * The certificate's SHA-256 fingerprint
  11976      *
  11977      * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"
  11978      */
  11979     certFingerprintSHA256: string;
  11980     /**
  11981      * The effective starting date of the certificate
  11982      *
  11983      * @example "Dec 22 19:39:00 2018 GMT"
  11984      */
  11985     certNotBefore: string;
  11986     /**
  11987      * The effective expiration date of the certificate
  11988      *
  11989      * @example "Dec 22 19:39:00 2018 GMT"
  11990      */
  11991     certNotAfter: string;
  11992     /**
  11993      * The client leaf certificate in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
  11994      * format (`:base64-DER:`). Empty if no client certificate was presented or if
  11995      * the leaf certificate exceeded 10 KB (see {@link certRFC9440TooLarge}).
  11996      *
  11997      * Suitable for forwarding to an origin via the `Client-Cert` HTTP header.
  11998      */
  11999     certRFC9440: string;
  12000     /**
  12001      * `true` if the leaf certificate exceeded 10 KB and was omitted from
  12002      * {@link certRFC9440}.
  12003      */
  12004     certRFC9440TooLarge: boolean;
  12005     /**
  12006      * The intermediate certificate chain in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
  12007      * format as a comma-separated list. Empty if no intermediates were sent or
  12008      * if the chain exceeded 16 KB (see {@link certChainRFC9440TooLarge}).
  12009      *
  12010      * Suitable for forwarding to an origin via the `Client-Cert-Chain` HTTP header.
  12011      */
  12012     certChainRFC9440: string;
  12013     /**
  12014      * `true` if the intermediate chain exceeded 16 KB and was omitted from
  12015      * {@link certChainRFC9440}.
  12016      */
  12017     certChainRFC9440TooLarge: boolean;
  12018 }
  12019 /** Placeholder values for TLS Client Authorization */
  12020 interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
  12021     certPresented: "0";
  12022     certVerified: "NONE";
  12023     certRevoked: "0";
  12024     certIssuerDN: "";
  12025     certSubjectDN: "";
  12026     certIssuerDNRFC2253: "";
  12027     certSubjectDNRFC2253: "";
  12028     certIssuerDNLegacy: "";
  12029     certSubjectDNLegacy: "";
  12030     certSerial: "";
  12031     certIssuerSerial: "";
  12032     certSKI: "";
  12033     certIssuerSKI: "";
  12034     certFingerprintSHA1: "";
  12035     certFingerprintSHA256: "";
  12036     certNotBefore: "";
  12037     certNotAfter: "";
  12038     certRFC9440: "";
  12039     certRFC9440TooLarge: false;
  12040     certChainRFC9440: "";
  12041     certChainRFC9440TooLarge: false;
  12042 }
  12043 /** Possible outcomes of TLS verification */
  12044 declare type CertVerificationStatus = 
  12045 /** Authentication succeeded */
  12046 "SUCCESS"
  12047 /** No certificate was presented */
  12048  | "NONE"
  12049 /** Failed because the certificate was self-signed */
  12050  | "FAILED:self signed certificate"
  12051 /** Failed because the certificate failed a trust chain check */
  12052  | "FAILED:unable to verify the first certificate"
  12053 /** Failed because the certificate not yet valid */
  12054  | "FAILED:certificate is not yet valid"
  12055 /** Failed because the certificate is expired */
  12056  | "FAILED:certificate has expired"
  12057 /** Failed for another unspecified reason */
  12058  | "FAILED";
  12059 /**
  12060  * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
  12061  */
  12062 declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */
  12063 /** ISO 3166-1 Alpha-2 codes */
  12064 declare type Iso3166Alpha2Code = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
  12065 /** The 2-letter continent codes Cloudflare uses */
  12066 declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
  12067 type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;
  12068 interface D1Meta {
  12069     duration: number;
  12070     size_after: number;
  12071     rows_read: number;
  12072     rows_written: number;
  12073     last_row_id: number;
  12074     changed_db: boolean;
  12075     changes: number;
  12076     /**
  12077      * The region of the database instance that executed the query.
  12078      */
  12079     served_by_region?: string;
  12080     /**
  12081      * The three letters airport code of the colo that executed the query.
  12082      */
  12083     served_by_colo?: string;
  12084     /**
  12085      * True if-and-only-if the database instance that executed the query was the primary.
  12086      */
  12087     served_by_primary?: boolean;
  12088     timings?: {
  12089         /**
  12090          * The duration of the SQL query execution by the database instance. It doesn't include any network time.
  12091          */
  12092         sql_duration_ms: number;
  12093     };
  12094     /**
  12095      * Number of total attempts to execute the query, due to automatic retries.
  12096      * Note: All other fields in the response like `timings` only apply to the last attempt.
  12097      */
  12098     total_attempts?: number;
  12099 }
  12100 interface D1Response {
  12101     success: true;
  12102     meta: D1Meta & Record<string, unknown>;
  12103     error?: never;
  12104 }
  12105 type D1Result<T = unknown> = D1Response & {
  12106     results: T[];
  12107 };
  12108 interface D1ExecResult {
  12109     count: number;
  12110     duration: number;
  12111 }
  12112 type D1SessionConstraint = 
  12113 // Indicates that the first query should go to the primary, and the rest queries
  12114 // using the same D1DatabaseSession will go to any replica that is consistent with
  12115 // the bookmark maintained by the session (returned by the first query).
  12116 'first-primary'
  12117 // Indicates that the first query can go anywhere (primary or replica), and the rest queries
  12118 // using the same D1DatabaseSession will go to any replica that is consistent with
  12119 // the bookmark maintained by the session (returned by the first query).
  12120  | 'first-unconstrained';
  12121 type D1SessionBookmark = string;
  12122 declare abstract class D1Database {
  12123     prepare(query: string): D1PreparedStatement;
  12124     batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
  12125     exec(query: string): Promise<D1ExecResult>;
  12126     /**
  12127      * Creates a new D1 Session anchored at the given constraint or the bookmark.
  12128      * All queries executed using the created session will have sequential consistency,
  12129      * meaning that all writes done through the session will be visible in subsequent reads.
  12130      *
  12131      * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
  12132      */
  12133     withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;
  12134     /**
  12135      * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
  12136      */
  12137     dump(): Promise<ArrayBuffer>;
  12138 }
  12139 declare abstract class D1DatabaseSession {
  12140     prepare(query: string): D1PreparedStatement;
  12141     batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
  12142     /**
  12143      * @returns The latest session bookmark across all executed queries on the session.
  12144      *          If no query has been executed yet, `null` is returned.
  12145      */
  12146     getBookmark(): D1SessionBookmark | null;
  12147 }
  12148 declare abstract class D1PreparedStatement {
  12149     bind(...values: unknown[]): D1PreparedStatement;
  12150     first<T = unknown>(colName: string): Promise<T | null>;
  12151     first<T = Record<string, unknown>>(): Promise<T | null>;
  12152     run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
  12153     all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
  12154     raw<T = unknown[]>(options: {
  12155         columnNames: true;
  12156     }): Promise<[
  12157         string[],
  12158         ...T[]
  12159     ]>;
  12160     raw<T = unknown[]>(options?: {
  12161         columnNames?: false;
  12162     }): Promise<T[]>;
  12163 }
  12164 // `Disposable` was added to TypeScript's standard lib types in version 5.2.
  12165 // To support older TypeScript versions, define an empty `Disposable` interface.
  12166 // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
  12167 // but this will ensure type checking on older versions still passes.
  12168 // TypeScript's interface merging will ensure our empty interface is effectively
  12169 // ignored when `Disposable` is included in the standard lib.
  12170 interface Disposable {
  12171 }
  12172 /**
  12173  * The returned data after sending an email
  12174  */
  12175 interface EmailSendResult {
  12176     /**
  12177      * The Email Message ID
  12178      */
  12179     messageId: string;
  12180 }
  12181 /**
  12182  * An email message that can be sent from a Worker.
  12183  */
  12184 interface EmailMessage {
  12185     /**
  12186      * Envelope From attribute of the email message.
  12187      */
  12188     readonly from: string;
  12189     /**
  12190      * Envelope To attribute of the email message.
  12191      */
  12192     readonly to: string;
  12193 }
  12194 /**
  12195  * An email message that is sent to a consumer Worker and can be rejected/forwarded.
  12196  */
  12197 interface ForwardableEmailMessage extends EmailMessage {
  12198     /**
  12199      * Stream of the email message content.
  12200      */
  12201     readonly raw: ReadableStream<Uint8Array>;
  12202     /**
  12203      * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
  12204      */
  12205     readonly headers: Headers;
  12206     /**
  12207      * Size of the email message content.
  12208      */
  12209     readonly rawSize: number;
  12210     /**
  12211      * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
  12212      * @param reason The reject reason.
  12213      * @returns void
  12214      */
  12215     setReject(reason: string): void;
  12216     /**
  12217      * Forward this email message to a verified destination address of the account.
  12218      * @param rcptTo Verified destination address.
  12219      * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
  12220      * @returns A promise that resolves when the email message is forwarded.
  12221      */
  12222     forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;
  12223     /**
  12224      * Reply to the sender of this email message with a new EmailMessage object.
  12225      * @param message The reply message.
  12226      * @returns A promise that resolves when the email message is replied.
  12227      */
  12228     reply(message: EmailMessage): Promise<EmailSendResult>;
  12229     /**
  12230      * Reply to the sender of this email message with a message built from the given
  12231      * fields. Threading headers (In-Reply-To/References) are set automatically.
  12232      * @param builder The reply message contents.
  12233      * @returns A promise that resolves when the email message is replied.
  12234      */
  12235     reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
  12236 }
  12237 /** A file attachment for an email message */
  12238 type EmailAttachment = {
  12239     disposition: 'inline';
  12240     contentId: string;
  12241     filename: string;
  12242     type: string;
  12243     content: string | ArrayBuffer | ArrayBufferView;
  12244 } | {
  12245     disposition: 'attachment';
  12246     contentId?: undefined;
  12247     filename: string;
  12248     type: string;
  12249     content: string | ArrayBuffer | ArrayBufferView;
  12250 };
  12251 /** An Email Address */
  12252 interface EmailAddress {
  12253     name: string;
  12254     email: string;
  12255 }
  12256 /**
  12257  * Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
  12258  * `bcc` must be provided.
  12259  */
  12260 type EmailDestinations = {
  12261     to?: string | EmailAddress | (string | EmailAddress)[];
  12262     cc?: string | EmailAddress | (string | EmailAddress)[];
  12263     bcc?: string | EmailAddress | (string | EmailAddress)[];
  12264 } & ({
  12265     to: string | EmailAddress | (string | EmailAddress)[];
  12266 } | {
  12267     cc: string | EmailAddress | (string | EmailAddress)[];
  12268 } | {
  12269     bcc: string | EmailAddress | (string | EmailAddress)[];
  12270 });
  12271 /**
  12272  * Fields shared by all composed emails (no recipients). Used directly by
  12273  * `ForwardableEmailMessage.reply()`, which always replies to the original
  12274  * sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
  12275  */
  12276 interface EmailReplyMessageBuilder {
  12277     from: string | EmailAddress;
  12278     subject: string;
  12279     replyTo?: string | EmailAddress;
  12280     headers?: Record<string, string>;
  12281     text?: string;
  12282     html?: string;
  12283     attachments?: EmailAttachment[];
  12284 }
  12285 /**
  12286  * Fields for composing an email without constructing raw MIME, for
  12287  * `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
  12288  */
  12289 type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
  12290 /**
  12291  * A binding that allows a Worker to send email messages.
  12292  */
  12293 interface SendEmail {
  12294     send(message: EmailMessage): Promise<EmailSendResult>;
  12295     send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
  12296 }
  12297 declare abstract class EmailEvent extends ExtendableEvent {
  12298     readonly message: ForwardableEmailMessage;
  12299 }
  12300 declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  12301 declare module "cloudflare:email" {
  12302     let _EmailMessage: {
  12303         prototype: EmailMessage;
  12304         new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
  12305     };
  12306     export { _EmailMessage as EmailMessage };
  12307 }
  12308 /**
  12309  * Evaluation context for targeting rules.
  12310  * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
  12311  */
  12312 type FlagshipEvaluationContext = Record<string, string | number | boolean>;
  12313 interface FlagshipEvaluationDetails<T> {
  12314     flagKey: string;
  12315     value: T;
  12316     variant?: string | undefined;
  12317     reason?: string | undefined;
  12318     errorCode?: string | undefined;
  12319     errorMessage?: string | undefined;
  12320 }
  12321 interface FlagshipEvaluationError extends Error {
  12322 }
  12323 /**
  12324  * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
  12325  *
  12326  * @example
  12327  * ```typescript
  12328  * // Get a boolean flag value with a default
  12329  * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
  12330  *
  12331  * // Get a flag value with evaluation context for targeting
  12332  * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
  12333  *   userId: 'user-123',
  12334  *   country: 'US',
  12335  * });
  12336  *
  12337  * // Get full evaluation details including variant and reason
  12338  * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
  12339  * console.log(details.variant, details.reason);
  12340  * ```
  12341  */
  12342 declare abstract class Flagship {
  12343     /**
  12344      * Get a flag value without type checking.
  12345      * @param flagKey The key of the flag to evaluate.
  12346      * @param defaultValue Optional default value returned when evaluation fails.
  12347      * @param context Optional evaluation context for targeting rules.
  12348      */
  12349     get(flagKey: string, defaultValue?: unknown, context?: FlagshipEvaluationContext): Promise<unknown>;
  12350     /**
  12351      * Get a boolean flag value.
  12352      * @param flagKey The key of the flag to evaluate.
  12353      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12354      * @param context Optional evaluation context for targeting rules.
  12355      */
  12356     getBooleanValue(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<boolean>;
  12357     /**
  12358      * Get a string flag value.
  12359      * @param flagKey The key of the flag to evaluate.
  12360      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12361      * @param context Optional evaluation context for targeting rules.
  12362      */
  12363     getStringValue(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<string>;
  12364     /**
  12365      * Get a number flag value.
  12366      * @param flagKey The key of the flag to evaluate.
  12367      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12368      * @param context Optional evaluation context for targeting rules.
  12369      */
  12370     getNumberValue(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<number>;
  12371     /**
  12372      * Get an object flag value.
  12373      * @param flagKey The key of the flag to evaluate.
  12374      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12375      * @param context Optional evaluation context for targeting rules.
  12376      */
  12377     getObjectValue<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<T>;
  12378     /**
  12379      * Get a boolean flag value with full evaluation details.
  12380      * @param flagKey The key of the flag to evaluate.
  12381      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12382      * @param context Optional evaluation context for targeting rules.
  12383      */
  12384     getBooleanDetails(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<boolean>>;
  12385     /**
  12386      * Get a string flag value with full evaluation details.
  12387      * @param flagKey The key of the flag to evaluate.
  12388      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12389      * @param context Optional evaluation context for targeting rules.
  12390      */
  12391     getStringDetails(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<string>>;
  12392     /**
  12393      * Get a number flag value with full evaluation details.
  12394      * @param flagKey The key of the flag to evaluate.
  12395      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12396      * @param context Optional evaluation context for targeting rules.
  12397      */
  12398     getNumberDetails(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<number>>;
  12399     /**
  12400      * Get an object flag value with full evaluation details.
  12401      * @param flagKey The key of the flag to evaluate.
  12402      * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
  12403      * @param context Optional evaluation context for targeting rules.
  12404      */
  12405     getObjectDetails<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<T>>;
  12406 }
  12407 /**
  12408  * Hello World binding to serve as an explanatory example. DO NOT USE
  12409  */
  12410 interface HelloWorldBinding {
  12411     /**
  12412      * Retrieve the current stored value
  12413      */
  12414     get(): Promise<{
  12415         value: string;
  12416         ms?: number;
  12417     }>;
  12418     /**
  12419      * Set a new stored value
  12420      */
  12421     set(value: string): Promise<void>;
  12422 }
  12423 interface Hyperdrive {
  12424     /**
  12425      * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
  12426      *
  12427      * Calling this method returns an identical socket to if you call
  12428      * `connect("host:port")` using the `host` and `port` fields from this object.
  12429      * Pick whichever approach works better with your preferred DB client library.
  12430      *
  12431      * Note that this socket is not yet authenticated -- it's expected that your
  12432      * code (or preferably, the client library of your choice) will authenticate
  12433      * using the information in this class's readonly fields.
  12434      */
  12435     connect(): Socket;
  12436     /**
  12437      * A valid DB connection string that can be passed straight into the typical
  12438      * client library/driver/ORM. This will typically be the easiest way to use
  12439      * Hyperdrive.
  12440      */
  12441     readonly connectionString: string;
  12442     /*
  12443      * A randomly generated hostname that is only valid within the context of the
  12444      * currently running Worker which, when passed into `connect()` function from
  12445      * the "cloudflare:sockets" module, will connect to the Hyperdrive instance
  12446      * for your database.
  12447      */
  12448     readonly host: string;
  12449     /*
  12450      * The port that must be paired the the host field when connecting.
  12451      */
  12452     readonly port: number;
  12453     /*
  12454      * The username to use when authenticating to your database via Hyperdrive.
  12455      * Unlike the host and password, this will be the same every time
  12456      */
  12457     readonly user: string;
  12458     /*
  12459      * The randomly generated password to use when authenticating to your
  12460      * database via Hyperdrive. Like the host field, this password is only valid
  12461      * within the context of the currently running Worker instance from which
  12462      * it's read.
  12463      */
  12464     readonly password: string;
  12465     /*
  12466      * The name of the database to connect to.
  12467      */
  12468     readonly database: string;
  12469 }
  12470 // Copyright (c) 2024 Cloudflare, Inc.
  12471 // Licensed under the Apache 2.0 license found in the LICENSE file or at:
  12472 //     https://opensource.org/licenses/Apache-2.0
  12473 type ImageInfoResponse = {
  12474     format: 'image/svg+xml';
  12475 } | {
  12476     format: string;
  12477     fileSize: number;
  12478     width: number;
  12479     height: number;
  12480 };
  12481 type ImageTransform = {
  12482     width?: number;
  12483     height?: number;
  12484     background?: string;
  12485     blur?: number;
  12486     border?: {
  12487         color?: string;
  12488         width?: number;
  12489     } | {
  12490         top?: number;
  12491         bottom?: number;
  12492         left?: number;
  12493         right?: number;
  12494     };
  12495     brightness?: number;
  12496     contrast?: number;
  12497     fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';
  12498     flip?: 'h' | 'v' | 'hv';
  12499     gamma?: number;
  12500     segment?: 'foreground';
  12501     gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {
  12502         x?: number;
  12503         y?: number;
  12504         mode: 'remainder' | 'box-center';
  12505     };
  12506     rotate?: 0 | 90 | 180 | 270;
  12507     saturation?: number;
  12508     sharpen?: number;
  12509     trim?: 'border' | {
  12510         top?: number;
  12511         bottom?: number;
  12512         left?: number;
  12513         right?: number;
  12514         width?: number;
  12515         height?: number;
  12516         border?: boolean | {
  12517             color?: string;
  12518             tolerance?: number;
  12519             keep?: number;
  12520         };
  12521     };
  12522 };
  12523 type ImageDrawOptions = {
  12524     opacity?: number;
  12525     repeat?: boolean | string;
  12526     composite?: ImageCompositeMode;
  12527     top?: number;
  12528     left?: number;
  12529     bottom?: number;
  12530     right?: number;
  12531 };
  12532 type ImageCompositeMode = 
  12533 /** Foreground drawn on top of backdrop (default) */
  12534 'over'
  12535 /** Foreground shown only where backdrop is opaque */
  12536  | 'in'
  12537 /** Foreground drawn on top, but clipped to the backdrop's shape */
  12538  | 'atop'
  12539 /** Foreground shown only where backdrop is transparent */
  12540  | 'out'
  12541 /** Foreground and backdrop visible only where the other is not */
  12542  | 'xor'
  12543 /** Foreground and backdrop channels added (brightening) */
  12544  | 'lighter';
  12545 type ImageInputOptions = {
  12546     encoding?: 'base64';
  12547 };
  12548 type ImageOutputOptions = {
  12549     format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';
  12550     quality?: number;
  12551     background?: string;
  12552     anim?: boolean;
  12553 };
  12554 interface ImageMetadata {
  12555     id: string;
  12556     filename?: string;
  12557     uploaded?: string;
  12558     requireSignedURLs: boolean;
  12559     meta?: Record<string, unknown>;
  12560     variants: string[];
  12561     draft?: boolean;
  12562     creator?: string;
  12563 }
  12564 interface ImageUploadOptions {
  12565     id?: string;
  12566     filename?: string;
  12567     requireSignedURLs?: boolean;
  12568     metadata?: Record<string, unknown>;
  12569     creator?: string;
  12570     encoding?: 'base64';
  12571 }
  12572 interface ImageUpdateOptions {
  12573     requireSignedURLs?: boolean;
  12574     metadata?: Record<string, unknown>;
  12575     creator?: string;
  12576 }
  12577 interface ImageListOptions {
  12578     limit?: number;
  12579     cursor?: string;
  12580     sortOrder?: 'asc' | 'desc';
  12581     creator?: string;
  12582 }
  12583 interface ImageList {
  12584     images: ImageMetadata[];
  12585     cursor?: string;
  12586     listComplete: boolean;
  12587 }
  12588 interface ImageHandle {
  12589     /**
  12590      * Get metadata for a hosted image
  12591      * @returns Image metadata, or null if not found
  12592      */
  12593     details(): Promise<ImageMetadata | null>;
  12594     /**
  12595      * Get the raw image data for a hosted image
  12596      * @returns ReadableStream of image bytes, or null if not found
  12597      */
  12598     bytes(): Promise<ReadableStream<Uint8Array> | null>;
  12599     /**
  12600      * Update hosted image metadata
  12601      * @param options Properties to update
  12602      * @returns Updated image metadata
  12603      * @throws {@link ImagesError} if update fails
  12604      */
  12605     update(options: ImageUpdateOptions): Promise<ImageMetadata>;
  12606     /**
  12607      * Delete a hosted image
  12608      * @returns True if deleted, false if not found
  12609      */
  12610     delete(): Promise<boolean>;
  12611 }
  12612 interface HostedImagesBinding {
  12613     /**
  12614      * Get a handle for a hosted image
  12615      * @param imageId The ID of the image (UUID or custom ID)
  12616      * @returns A handle for per-image operations
  12617      */
  12618     image(imageId: string): ImageHandle;
  12619     /**
  12620      * Upload a new hosted image
  12621      * @param image The image file to upload
  12622      * @param options Upload configuration
  12623      * @returns Metadata for the uploaded image
  12624      * @throws {@link ImagesError} if upload fails
  12625      */
  12626     upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;
  12627     /**
  12628      * List hosted images with pagination
  12629      * @param options List configuration
  12630      * @returns List of images with pagination info
  12631      * @throws {@link ImagesError} if list fails
  12632      */
  12633     list(options?: ImageListOptions): Promise<ImageList>;
  12634 }
  12635 interface ImagesBinding {
  12636     /**
  12637      * Get image metadata (type, width and height)
  12638      * @throws {@link ImagesError} with code 9412 if input is not an image
  12639      * @param stream The image bytes
  12640      */
  12641     info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;
  12642     /**
  12643      * Begin applying a series of transformations to an image
  12644      * @param stream The image bytes
  12645      * @returns A transform handle
  12646      */
  12647     input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;
  12648     /**
  12649      * Access hosted images CRUD operations
  12650      */
  12651     readonly hosted: HostedImagesBinding;
  12652 }
  12653 interface ImageTransformer {
  12654     /**
  12655      * Apply transform next, returning a transform handle.
  12656      * You can then apply more transformations, draw, or retrieve the output.
  12657      * @param transform
  12658      */
  12659     transform(transform: ImageTransform): ImageTransformer;
  12660     /**
  12661      * Draw an image on this transformer, returning a transform handle.
  12662      * You can then apply more transformations, draw, or retrieve the output.
  12663      * @param image The image (or transformer that will give the image) to draw
  12664      * @param options The options configuring how to draw the image
  12665      */
  12666     draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;
  12667     /**
  12668      * Retrieve the image that results from applying the transforms to the
  12669      * provided input
  12670      * @param options Options that apply to the output e.g. output format
  12671      */
  12672     output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
  12673 }
  12674 type ImageTransformationOutputOptions = {
  12675     encoding?: 'base64';
  12676 };
  12677 interface ImageTransformationResult {
  12678     /**
  12679      * The image as a response, ready to store in cache or return to users
  12680      */
  12681     response(): Response;
  12682     /**
  12683      * The content type of the returned image
  12684      */
  12685     contentType(): string;
  12686     /**
  12687      * The bytes of the response
  12688      */
  12689     image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;
  12690 }
  12691 interface ImagesError extends Error {
  12692     readonly code: number;
  12693     readonly message: string;
  12694     readonly stack?: string;
  12695 }
  12696 /**
  12697  * Media binding for transforming media streams.
  12698  * Provides the entry point for media transformation operations.
  12699  */
  12700 interface MediaBinding {
  12701     /**
  12702      * Creates a media transformer from an input stream.
  12703      * @param media - The input media bytes
  12704      * @returns A MediaTransformer instance for applying transformations
  12705      */
  12706     input(media: ReadableStream<Uint8Array>): MediaTransformer;
  12707 }
  12708 /**
  12709  * Media transformer for applying transformation operations to media content.
  12710  * Handles sizing, fitting, and other input transformation parameters.
  12711  */
  12712 interface MediaTransformer {
  12713     /**
  12714      * Applies transformation options to the media content.
  12715      * @param transform - Configuration for how the media should be transformed
  12716      * @returns A generator for producing the transformed media output
  12717      */
  12718     transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;
  12719     /**
  12720      * Generates the final media output with specified options.
  12721      * @param output - Configuration for the output format and parameters
  12722      * @returns The final transformation result containing the transformed media
  12723      */
  12724     output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
  12725 }
  12726 /**
  12727  * Generator for producing media transformation results.
  12728  * Configures the output format and parameters for the transformed media.
  12729  */
  12730 interface MediaTransformationGenerator {
  12731     /**
  12732      * Generates the final media output with specified options.
  12733      * @param output - Configuration for the output format and parameters
  12734      * @returns The final transformation result containing the transformed media
  12735      */
  12736     output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
  12737 }
  12738 /**
  12739  * Result of a media transformation operation.
  12740  * Provides multiple ways to access the transformed media content.
  12741  */
  12742 interface MediaTransformationResult {
  12743     /**
  12744      * Returns the transformed media as a readable stream of bytes.
  12745      * @returns A promise containing a readable stream with the transformed media
  12746      */
  12747     media(): Promise<ReadableStream<Uint8Array>>;
  12748     /**
  12749      * Returns the transformed media as an HTTP response object.
  12750      * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
  12751      */
  12752     response(): Promise<Response>;
  12753     /**
  12754      * Returns the MIME type of the transformed media.
  12755      * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
  12756      */
  12757     contentType(): Promise<string>;
  12758 }
  12759 /**
  12760  * Configuration options for transforming media input.
  12761  * Controls how the media should be resized and fitted.
  12762  */
  12763 type MediaTransformationInputOptions = {
  12764     /** How the media should be resized to fit the specified dimensions */
  12765     fit?: 'contain' | 'cover' | 'scale-down';
  12766     /** Target width in pixels */
  12767     width?: number;
  12768     /** Target height in pixels */
  12769     height?: number;
  12770 };
  12771 /**
  12772  * Configuration options for Media Transformations output.
  12773  * Controls the format, timing, and type of the generated output.
  12774  */
  12775 type MediaTransformationOutputOptions = {
  12776     /**
  12777      * Output mode determining the type of media to generate
  12778      */
  12779     mode?: 'video' | 'spritesheet' | 'frame' | 'audio';
  12780     /** Whether to include audio in the output */
  12781     audio?: boolean;
  12782     /**
  12783      * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
  12784      */
  12785     time?: string;
  12786     /**
  12787      * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
  12788      */
  12789     duration?: string;
  12790     /**
  12791      * Number of frames in the spritesheet.
  12792      */
  12793     imageCount?: number;
  12794     /**
  12795      * Output format for the generated media.
  12796      */
  12797     format?: 'jpg' | 'png' | 'm4a';
  12798 };
  12799 /**
  12800  * Error object for media transformation operations.
  12801  * Extends the standard Error interface with additional media-specific information.
  12802  */
  12803 interface MediaError extends Error {
  12804     readonly code: number;
  12805     readonly message: string;
  12806     readonly stack?: string;
  12807 }
  12808 declare module 'cloudflare:node' {
  12809     interface NodeStyleServer {
  12810         listen(...args: unknown[]): this;
  12811         address(): {
  12812             port?: number | null | undefined;
  12813         };
  12814     }
  12815     export function httpServerHandler(port: number): ExportedHandler;
  12816     export function httpServerHandler(options: {
  12817         port: number;
  12818     }): ExportedHandler;
  12819     export function httpServerHandler(server: NodeStyleServer): ExportedHandler;
  12820 }
  12821 type Params<P extends string = any> = Record<P, string | string[]>;
  12822 type EventContext<Env, P extends string, Data> = {
  12823     request: Request<unknown, IncomingRequestCfProperties<unknown>>;
  12824     functionPath: string;
  12825     waitUntil: (promise: Promise<any>) => void;
  12826     passThroughOnException: () => void;
  12827     next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
  12828     env: Env & {
  12829         ASSETS: {
  12830             fetch: typeof fetch;
  12831         };
  12832     };
  12833     params: Params<P>;
  12834     data: Data;
  12835 };
  12836 type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
  12837 type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
  12838     request: Request<unknown, IncomingRequestCfProperties<unknown>>;
  12839     functionPath: string;
  12840     waitUntil: (promise: Promise<any>) => void;
  12841     passThroughOnException: () => void;
  12842     next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
  12843     env: Env & {
  12844         ASSETS: {
  12845             fetch: typeof fetch;
  12846         };
  12847     };
  12848     params: Params<P>;
  12849     data: Data;
  12850     pluginArgs: PluginArgs;
  12851 };
  12852 type PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;
  12853 declare module "assets:*" {
  12854     export const onRequest: PagesFunction;
  12855 }
  12856 // Copyright (c) 2022-2023 Cloudflare, Inc.
  12857 // Licensed under the Apache 2.0 license found in the LICENSE file or at:
  12858 //     https://opensource.org/licenses/Apache-2.0
  12859 declare module "cloudflare:pipelines" {
  12860     export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {
  12861         protected env: Env;
  12862         protected ctx: ExecutionContext;
  12863         constructor(ctx: ExecutionContext, env: Env);
  12864         /**
  12865          * run receives an array of PipelineRecord which can be
  12866          * transformed and returned to the pipeline
  12867          * @param records Incoming records from the pipeline to be transformed
  12868          * @param metadata Information about the specific pipeline calling the transformation entrypoint
  12869          * @returns A promise containing the transformed PipelineRecord array
  12870          */
  12871         public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
  12872     }
  12873     export type PipelineRecord = Record<string, unknown>;
  12874     export type PipelineBatchMetadata = {
  12875         pipelineId: string;
  12876         pipelineName: string;
  12877     };
  12878     export interface Pipeline<T extends PipelineRecord = PipelineRecord> {
  12879         /**
  12880          * The Pipeline interface represents the type of a binding to a Pipeline
  12881          *
  12882          * @param records The records to send to the pipeline
  12883          */
  12884         send(records: T[]): Promise<void>;
  12885     }
  12886 }
  12887 // PubSubMessage represents an incoming PubSub message.
  12888 // The message includes metadata about the broker, the client, and the payload
  12889 // itself.
  12890 // https://developers.cloudflare.com/pub-sub/
  12891 interface PubSubMessage {
  12892     // Message ID
  12893     readonly mid: number;
  12894     // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
  12895     readonly broker: string;
  12896     // The MQTT topic the message was sent on.
  12897     readonly topic: string;
  12898     // The client ID of the client that published this message.
  12899     readonly clientId: string;
  12900     // The unique identifier (JWT ID) used by the client to authenticate, if token
  12901     // auth was used.
  12902     readonly jti?: string;
  12903     // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
  12904     // received the message from the client.
  12905     readonly receivedAt: number;
  12906     // An (optional) string with the MIME type of the payload, if set by the
  12907     // client.
  12908     readonly contentType: string;
  12909     // Set to 1 when the payload is a UTF-8 string
  12910     // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
  12911     readonly payloadFormatIndicator: number;
  12912     // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
  12913     // You can use payloadFormatIndicator to inspect this before decoding.
  12914     payload: string | Uint8Array;
  12915 }
  12916 // JsonWebKey extended by kid parameter
  12917 interface JsonWebKeyWithKid extends JsonWebKey {
  12918     // Key Identifier of the JWK
  12919     readonly kid: string;
  12920 }
  12921 interface RateLimitOptions {
  12922     key: string;
  12923 }
  12924 interface RateLimitOutcome {
  12925     success: boolean;
  12926 }
  12927 interface RateLimit {
  12928     /**
  12929      * Rate limit a request based on the provided options.
  12930      * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/
  12931      * @returns A promise that resolves with the outcome of the rate limit.
  12932      */
  12933     limit(options: RateLimitOptions): Promise<RateLimitOutcome>;
  12934 }
  12935 // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
  12936 // to referenced by `Fetcher`. This is included in the "importable" version of the types which
  12937 // strips all `module` blocks.
  12938 declare namespace Rpc {
  12939     // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
  12940     // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
  12941     // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
  12942     // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
  12943     export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';
  12944     export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';
  12945     export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';
  12946     export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';
  12947     export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';
  12948     export interface RpcTargetBranded {
  12949         [__RPC_TARGET_BRAND]: never;
  12950     }
  12951     export interface WorkerEntrypointBranded {
  12952         [__WORKER_ENTRYPOINT_BRAND]: never;
  12953     }
  12954     export interface DurableObjectBranded {
  12955         [__DURABLE_OBJECT_BRAND]: never;
  12956     }
  12957     export interface WorkflowEntrypointBranded {
  12958         [__WORKFLOW_ENTRYPOINT_BRAND]: never;
  12959     }
  12960     export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;
  12961     // Types that can be used through `Stub`s
  12962     export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
  12963     // Types that can be passed over RPC
  12964     // The reason for using a generic type here is to build a serializable subset of structured
  12965     //   cloneable composite types. This allows types defined with the "interface" keyword to pass the
  12966     //   serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
  12967     type Serializable<T> = 
  12968     // Structured cloneables
  12969     BaseType
  12970     // Structured cloneable composites
  12971      | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {
  12972         [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
  12973     }
  12974     // Special types
  12975      | Stub<Stubable>
  12976     // Serialized as stubs, see `Stubify`
  12977      | Stubable;
  12978     // Base type for all RPC stubs, including common memory management methods.
  12979     // `T` is used as a marker type for unwrapping `Stub`s later.
  12980     interface StubBase<T extends Stubable> extends Disposable {
  12981         [__RPC_STUB_BRAND]: T;
  12982         dup(): this;
  12983     }
  12984     export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
  12985     // This represents all the types that can be sent as-is over an RPC boundary
  12986     type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;
  12987     // Recursively rewrite all `Stubable` types with `Stub`s
  12988     // prettier-ignore
  12989     type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {
  12990         [key: string | number]: any;
  12991     } ? {
  12992         [K in keyof T]: Stubify<T[K]>;
  12993     } : T;
  12994     // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
  12995     // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
  12996     // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
  12997     // prettier-ignore
  12998     type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {
  12999         [key: string | number]: unknown;
  13000     } ? {
  13001         [K in keyof T]: Unstubify<T[K]>;
  13002     } : T;
  13003     type UnstubifyAll<A extends any[]> = {
  13004         [I in keyof A]: Unstubify<A[I]>;
  13005     };
  13006     // Utility type for adding `Provider`/`Disposable`s to `object` types only.
  13007     // Note `unknown & T` is equivalent to `T`.
  13008     type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
  13009     type MaybeDisposable<T> = T extends object ? Disposable : unknown;
  13010     // Type for method return or property on an RPC interface.
  13011     // - Stubable types are replaced by stubs.
  13012     // - Serializable types are passed by value, with stubable types replaced by stubs
  13013     //   and a top-level `Disposer`.
  13014     // Everything else can't be passed over PRC.
  13015     // Technically, we use custom thenables here, but they quack like `Promise`s.
  13016     // Intersecting with `(Maybe)Provider` allows pipelining.
  13017     // prettier-ignore
  13018     type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;
  13019     // Type for method or property on an RPC interface.
  13020     // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
  13021     // Unwrapping `Stub`s allows calling with `Stubable` arguments.
  13022     // For properties, rewrite types to be `Result`s.
  13023     // In each case, unwrap `Promise`s.
  13024     type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;
  13025     // Type for the callable part of an `Provider` if `T` is callable.
  13026     // This is intersected with methods/properties.
  13027     type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;
  13028     // Base type for all other types providing RPC-like interfaces.
  13029     // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
  13030     // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
  13031     export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{
  13032         [K in keyof T]: MethodOrProperty<T[K]>;
  13033     }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;
  13034 }
  13035 declare namespace Cloudflare {
  13036     // Type of `env`.
  13037     //
  13038     // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript
  13039     // will merge all declarations.
  13040     //
  13041     // You can use `wrangler types` to generate the `Env` type automatically.
  13042     interface Env {
  13043     }
  13044     // Project-specific parameters used to inform types.
  13045     //
  13046     // This interface is, again, intended to be declared in project-specific files, and then that
  13047     // declaration will be merged with this one.
  13048     //
  13049     // A project should have a declaration like this:
  13050     //
  13051     //     interface GlobalProps {
  13052     //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type
  13053     //       // of `ctx.exports`.
  13054     //       mainModule: typeof import("my-main-module");
  13055     //
  13056     //       // Declares which of the main module's exports are configured with durable storage, and
  13057     //       // thus should behave as Durable Object namsepace bindings.
  13058     //       durableNamespaces: "MyDurableObject" | "AnotherDurableObject";
  13059     //     }
  13060     //
  13061     // You can use `wrangler types` to generate `GlobalProps` automatically.
  13062     interface GlobalProps {
  13063     }
  13064     // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not
  13065     // present.
  13066     type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;
  13067     // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the
  13068     // `mainModule` property.
  13069     type MainModule = GlobalProp<"mainModule", {}>;
  13070     // The type of ctx.exports, which contains loopback bindings for all top-level exports.
  13071     type Exports = {
  13072         [K in keyof MainModule]: LoopbackForExport<MainModule[K]>
  13073         // If the export is listed in `durableNamespaces`, then it is also a
  13074         // DurableObjectNamespace.
  13075          & (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});
  13076     };
  13077 }
  13078 declare namespace CloudflareWorkersModule {
  13079     export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
  13080     export const RpcStub: {
  13081         new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
  13082     };
  13083     export abstract class RpcTarget implements Rpc.RpcTargetBranded {
  13084         [Rpc.__RPC_TARGET_BRAND]: never;
  13085     }
  13086     // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
  13087     export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {
  13088         [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
  13089         protected ctx: ExecutionContext<Props>;
  13090         protected env: Env;
  13091         constructor(ctx: ExecutionContext, env: Env);
  13092         email?(message: ForwardableEmailMessage): void | Promise<void>;
  13093         fetch?(request: Request): Response | Promise<Response>;
  13094         connect?(socket: Socket): void | Promise<void>;
  13095         queue?(batch: MessageBatch): void | Promise<void>;
  13096         scheduled?(controller: ScheduledController): void | Promise<void>;
  13097         tail?(events: TraceItem[]): void | Promise<void>;
  13098         tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
  13099         test?(controller: TestController): void | Promise<void>;
  13100         trace?(traces: TraceItem[]): void | Promise<void>;
  13101     }
  13102     export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {
  13103         [Rpc.__DURABLE_OBJECT_BRAND]: never;
  13104         protected ctx: DurableObjectState<Props>;
  13105         protected env: Env;
  13106         constructor(ctx: DurableObjectState, env: Env);
  13107         alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
  13108         fetch?(request: Request): Response | Promise<Response>;
  13109         connect?(socket: Socket): void | Promise<void>;
  13110         webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
  13111         webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
  13112         webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
  13113     }
  13114     export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
  13115     export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
  13116     export type WorkflowDelayDuration = WorkflowSleepDuration;
  13117     export type WorkflowDynamicDelayContext = {
  13118         ctx: WorkflowStepContext<WorkflowDelayFunction>;
  13119         error: Error;
  13120     };
  13121     export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
  13122     export type WorkflowTimeoutDuration = WorkflowSleepDuration;
  13123     export type WorkflowRetentionDuration = WorkflowSleepDuration;
  13124     export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
  13125     export type WorkflowStepSensitivity = 'output';
  13126     export type WorkflowStepConfig = {
  13127         retries?: {
  13128             limit: number;
  13129             delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
  13130             backoff?: WorkflowBackoff;
  13131         };
  13132         timeout?: WorkflowTimeoutDuration | number;
  13133         sensitive?: WorkflowStepSensitivity;
  13134     };
  13135     export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
  13136     export type WorkflowCronSchedule = {
  13137         /** Cron expression that triggered this event. */
  13138         cron: string;
  13139         /** Timestamp of the scheduled trigger, in milliseconds since the Unix epoch. */
  13140         scheduledTime: number;
  13141     };
  13142     export type WorkflowEvent<T> = {
  13143         payload: Readonly<T>;
  13144         timestamp: Date;
  13145         instanceId: string;
  13146         workflowName: string;
  13147         schedule?: WorkflowCronSchedule;
  13148     };
  13149     export type WorkflowStepEvent<T> = {
  13150         payload: Readonly<T>;
  13151         timestamp: Date;
  13152         type: string;
  13153         sensitive?: WorkflowStepSensitivity;
  13154     };
  13155     export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
  13156         step: {
  13157             name: string;
  13158             count: number;
  13159         };
  13160         attempt: number;
  13161         config: {
  13162             retries?: {
  13163                 limit: number;
  13164                 backoff?: WorkflowBackoff;
  13165             } & (Delay extends WorkflowDelayFunction ? {} : {
  13166                 delay: WorkflowDelayDuration | number;
  13167             });
  13168             timeout?: WorkflowTimeoutDuration | number;
  13169             sensitive?: WorkflowStepSensitivity;
  13170         };
  13171     };
  13172     export type WorkflowRollbackContext<T = unknown> = {
  13173         ctx: WorkflowStepContext;
  13174         error: Error;
  13175         output: T | undefined;
  13176         /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
  13177         stepName: string;
  13178     };
  13179     export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
  13180     export type WorkflowStepRollbackOptions<T = unknown> = {
  13181         rollback: WorkflowRollbackHandler<T>;
  13182         rollbackConfig?: WorkflowStepRollbackConfig;
  13183     };
  13184     export abstract class WorkflowStep {
  13185         do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
  13186         do<T extends Rpc.Serializable<T>, const C extends WorkflowStepConfig>(name: string, config: C, callback: (ctx: WorkflowStepContext<C['retries'] extends {
  13187             delay: infer D;
  13188         } ? D : WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
  13189         sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
  13190         sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
  13191         waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
  13192             type: string;
  13193             timeout?: WorkflowTimeoutDuration | number;
  13194         }): Promise<WorkflowStepEvent<T>>;
  13195     }
  13196     export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';
  13197     export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {
  13198         [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;
  13199         protected ctx: ExecutionContext;
  13200         protected env: Env;
  13201         constructor(ctx: ExecutionContext, env: Env);
  13202         run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
  13203     }
  13204     export function waitUntil(promise: Promise<unknown>): void;
  13205     export function withEnv(newEnv: unknown, fn: () => unknown): unknown;
  13206     export function withExports(newExports: unknown, fn: () => unknown): unknown;
  13207     export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;
  13208     export const env: Cloudflare.Env;
  13209     export const exports: Cloudflare.Exports;
  13210     export const cache: CacheContext;
  13211     export const tracing: Tracing;
  13212 }
  13213 declare module 'cloudflare:workers' {
  13214     export = CloudflareWorkersModule;
  13215 }
  13216 interface SecretsStoreSecret {
  13217     /**
  13218      * Get a secret from the Secrets Store, returning a string of the secret value
  13219      * if it exists, or throws an error if it does not exist
  13220      */
  13221     get(): Promise<string>;
  13222 }
  13223 declare module "cloudflare:sockets" {
  13224     function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;
  13225     export { _connect as connect };
  13226 }
  13227 /**
  13228  * Binding entrypoint for Cloudflare Stream.
  13229  *
  13230  * Usage:
  13231  * - Binding-level operations:
  13232  *   `await env.STREAM.videos.upload`
  13233  *   `await env.STREAM.videos.createDirectUpload`
  13234  *   `await env.STREAM.videos.*`
  13235  *   `await env.STREAM.watermarks.*`
  13236  * - Per-video operations:
  13237  *   `await env.STREAM.video(id).downloads.*`
  13238  *   `await env.STREAM.video(id).captions.*`
  13239  *
  13240  * Example usage:
  13241  * ```ts
  13242  * await env.STREAM.video(id).downloads.generate();
  13243  *
  13244  * const video = env.STREAM.video(id)
  13245  * const captions = video.captions.list();
  13246  * const videoDetails = video.details()
  13247  * ```
  13248  */
  13249 interface StreamBinding {
  13250     /**
  13251      * Returns a handle scoped to a single video for per-video operations.
  13252      * @param id The unique identifier for the video.
  13253      * @returns A handle for per-video operations.
  13254      */
  13255     video(id: string): StreamVideoHandle;
  13256     /**
  13257      * Uploads a new video from a provided URL.
  13258      * @param url The URL to upload from.
  13259      * @param params Optional upload parameters.
  13260      * @returns The uploaded video details.
  13261      * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid
  13262      * @throws {QuotaReachedError} if the account storage capacity is exceeded
  13263      * @throws {MaxFileSizeError} if the file size is too large
  13264      * @throws {RateLimitedError} if the server received too many requests
  13265      * @throws {AlreadyUploadedError} if a video was already uploaded to this URL
  13266      * @throws {InternalError} if an unexpected error occurs
  13267      */
  13268     upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;
  13269     /**
  13270      * Creates a direct upload that allows video uploads without an API key.
  13271      * @param params Parameters for the direct upload
  13272      * @returns The direct upload details.
  13273      * @throws {BadRequestError} if the parameters are invalid
  13274      * @throws {RateLimitedError} if the server received too many requests
  13275      * @throws {InternalError} if an unexpected error occurs
  13276      */
  13277     createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;
  13278     videos: StreamVideos;
  13279     watermarks: StreamWatermarks;
  13280 }
  13281 /**
  13282  * Handle for operations scoped to a single Stream video.
  13283  */
  13284 interface StreamVideoHandle {
  13285     /**
  13286      * The unique identifier for the video.
  13287      */
  13288     id: string;
  13289     /**
  13290      * Get a full videos details
  13291      * @returns The full video details.
  13292      * @throws {NotFoundError} if the video is not found
  13293      * @throws {InternalError} if an unexpected error occurs
  13294      */
  13295     details(): Promise<StreamVideo>;
  13296     /**
  13297      * Update details for a single video.
  13298      * @param params The fields to update for the video.
  13299      * @returns The updated video details.
  13300      * @throws {NotFoundError} if the video is not found
  13301      * @throws {BadRequestError} if the parameters are invalid
  13302      * @throws {InternalError} if an unexpected error occurs
  13303      */
  13304     update(params: StreamUpdateVideoParams): Promise<StreamVideo>;
  13305     /**
  13306      * Deletes a video and its copies from Cloudflare Stream.
  13307      * @returns A promise that resolves when deletion completes.
  13308      * @throws {NotFoundError} if the video is not found
  13309      * @throws {InternalError} if an unexpected error occurs
  13310      */
  13311     delete(): Promise<void>;
  13312     /**
  13313      * Creates a signed URL token for a video.
  13314      * @returns The signed token that was created.
  13315      * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
  13316      */
  13317     generateToken(): Promise<string>;
  13318     downloads: StreamScopedDownloads;
  13319     captions: StreamScopedCaptions;
  13320 }
  13321 interface StreamVideo {
  13322     /**
  13323      * The unique identifier for the video.
  13324      */
  13325     id: string;
  13326     /**
  13327      * A user-defined identifier for the media creator.
  13328      */
  13329     creator: string | null;
  13330     /**
  13331      * The thumbnail URL for the video.
  13332      */
  13333     thumbnail: string;
  13334     /**
  13335      * The thumbnail timestamp percentage.
  13336      */
  13337     thumbnailTimestampPct: number;
  13338     /**
  13339      * Indicates whether the video is ready to stream.
  13340      */
  13341     readyToStream: boolean;
  13342     /**
  13343      * The date and time the video became ready to stream.
  13344      */
  13345     readyToStreamAt: string | null;
  13346     /**
  13347      * Processing status information.
  13348      */
  13349     status: StreamVideoStatus;
  13350     /**
  13351      * A user modifiable key-value store.
  13352      */
  13353     meta: Record<string, string>;
  13354     /**
  13355      * The date and time the video was created.
  13356      */
  13357     created: string;
  13358     /**
  13359      * The date and time the video was last modified.
  13360      */
  13361     modified: string;
  13362     /**
  13363      * The date and time at which the video will be deleted.
  13364      */
  13365     scheduledDeletion: string | null;
  13366     /**
  13367      * The size of the video in bytes.
  13368      */
  13369     size: number;
  13370     /**
  13371      * The preview URL for the video.
  13372      */
  13373     preview?: string;
  13374     /**
  13375      * Origins allowed to display the video.
  13376      */
  13377     allowedOrigins: Array<string>;
  13378     /**
  13379      * Indicates whether signed URLs are required.
  13380      */
  13381     requireSignedURLs: boolean | null;
  13382     /**
  13383      * The date and time the video was uploaded.
  13384      */
  13385     uploaded: string | null;
  13386     /**
  13387      * The date and time when the upload URL expires.
  13388      */
  13389     uploadExpiry: string | null;
  13390     /**
  13391      * The maximum size in bytes for direct uploads.
  13392      */
  13393     maxSizeBytes: number | null;
  13394     /**
  13395      * The maximum duration in seconds for direct uploads.
  13396      */
  13397     maxDurationSeconds: number | null;
  13398     /**
  13399      * The video duration in seconds. -1 indicates unknown.
  13400      */
  13401     duration: number;
  13402     /**
  13403      * Input metadata for the original upload.
  13404      */
  13405     input: StreamVideoInput;
  13406     /**
  13407      * Playback URLs for the video.
  13408      */
  13409     hlsPlaybackUrl: string;
  13410     dashPlaybackUrl: string;
  13411     /**
  13412      * The watermark applied to the video, if any.
  13413      */
  13414     watermark: StreamWatermark | null;
  13415     /**
  13416      * The live input id associated with the video, if any.
  13417      */
  13418     liveInputId?: string | null;
  13419     /**
  13420      * The source video id if this is a clip.
  13421      */
  13422     clippedFromId: string | null;
  13423     /**
  13424      * Public details associated with the video.
  13425      */
  13426     publicDetails: StreamPublicDetails | null;
  13427 }
  13428 type StreamVideoStatus = {
  13429     /**
  13430      * The current processing state.
  13431      */
  13432     state: string;
  13433     /**
  13434      * The current processing step.
  13435      */
  13436     step?: string;
  13437     /**
  13438      * The percent complete as a string.
  13439      */
  13440     pctComplete?: string;
  13441     /**
  13442      * An error reason code, if applicable.
  13443      */
  13444     errorReasonCode: string;
  13445     /**
  13446      * An error reason text, if applicable.
  13447      */
  13448     errorReasonText: string;
  13449 };
  13450 type StreamVideoInput = {
  13451     /**
  13452      * The input width in pixels.
  13453      */
  13454     width: number;
  13455     /**
  13456      * The input height in pixels.
  13457      */
  13458     height: number;
  13459 };
  13460 type StreamPublicDetails = {
  13461     /**
  13462      * The public title for the video.
  13463      */
  13464     title: string | null;
  13465     /**
  13466      * The public share link.
  13467      */
  13468     share_link: string | null;
  13469     /**
  13470      * The public channel link.
  13471      */
  13472     channel_link: string | null;
  13473     /**
  13474      * The public logo URL.
  13475      */
  13476     logo: string | null;
  13477 };
  13478 type StreamDirectUpload = {
  13479     /**
  13480      * The URL an unauthenticated upload can use for a single multipart request.
  13481      */
  13482     uploadURL: string;
  13483     /**
  13484      * A Cloudflare-generated unique identifier for a media item.
  13485      */
  13486     id: string;
  13487     /**
  13488      * The watermark profile applied to the upload.
  13489      */
  13490     watermark: StreamWatermark | null;
  13491     /**
  13492      * The scheduled deletion time, if any.
  13493      */
  13494     scheduledDeletion: string | null;
  13495 };
  13496 type StreamDirectUploadCreateParams = {
  13497     /**
  13498      * The maximum duration in seconds for a video upload.
  13499      */
  13500     maxDurationSeconds: number;
  13501     /**
  13502      * The date and time after upload when videos will not be accepted.
  13503      */
  13504     expiry?: string;
  13505     /**
  13506      * A user-defined identifier for the media creator.
  13507      */
  13508     creator?: string;
  13509     /**
  13510      * A user modifiable key-value store used to reference other systems of record for
  13511      * managing videos.
  13512      */
  13513     meta?: Record<string, string>;
  13514     /**
  13515      * Lists the origins allowed to display the video.
  13516      */
  13517     allowedOrigins?: Array<string>;
  13518     /**
  13519      * Indicates whether the video can be accessed using the id. When set to `true`,
  13520      * a signed token must be generated with a signing key to view the video.
  13521      */
  13522     requireSignedURLs?: boolean;
  13523     /**
  13524      * The thumbnail timestamp percentage.
  13525      */
  13526     thumbnailTimestampPct?: number;
  13527     /**
  13528      * The date and time at which the video will be deleted. Include `null` to remove
  13529      * a scheduled deletion.
  13530      */
  13531     scheduledDeletion?: string | null;
  13532     /**
  13533      * The watermark profile to apply.
  13534      */
  13535     watermark?: StreamDirectUploadWatermark;
  13536 };
  13537 type StreamDirectUploadWatermark = {
  13538     /**
  13539      * The unique identifier for the watermark profile.
  13540      */
  13541     id: string;
  13542 };
  13543 type StreamUrlUploadParams = {
  13544     /**
  13545      * Lists the origins allowed to display the video. Enter allowed origin
  13546      * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
  13547      * video to be viewed on any origin.
  13548      */
  13549     allowedOrigins?: Array<string>;
  13550     /**
  13551      * A user-defined identifier for the media creator.
  13552      */
  13553     creator?: string;
  13554     /**
  13555      * A user modifiable key-value store used to reference other systems of
  13556      * record for managing videos.
  13557      */
  13558     meta?: Record<string, string>;
  13559     /**
  13560      * Indicates whether the video can be a accessed using the id. When
  13561      * set to `true`, a signed token must be generated with a signing key to view the
  13562      * video.
  13563      */
  13564     requireSignedURLs?: boolean;
  13565     /**
  13566      * Indicates the date and time at which the video will be deleted. Omit
  13567      * the field to indicate no change, or include with a `null` value to remove an
  13568      * existing scheduled deletion. If specified, must be at least 30 days from upload
  13569      * time.
  13570      */
  13571     scheduledDeletion?: string | null;
  13572     /**
  13573      * The timestamp for a thumbnail image calculated as a percentage value
  13574      * of the video's duration. To convert from a second-wise timestamp to a
  13575      * percentage, divide the desired timestamp by the total duration of the video. If
  13576      * this value is not set, the default thumbnail image is taken from 0s of the
  13577      * video.
  13578      */
  13579     thumbnailTimestampPct?: number;
  13580     /**
  13581      * The identifier for the watermark profile
  13582      */
  13583     watermarkId?: string;
  13584 };
  13585 interface StreamScopedCaptions {
  13586     /**
  13587      * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
  13588      * One caption or subtitle file per language is allowed.
  13589      * @param language The BCP 47 language tag for the caption or subtitle.
  13590      * @param input The caption or subtitle stream to upload.
  13591      * @returns The created caption entry.
  13592      * @throws {NotFoundError} if the video is not found
  13593      * @throws {BadRequestError} if the language or file is invalid
  13594      * @throws {InternalError} if an unexpected error occurs
  13595      */
  13596     upload(language: string, input: ReadableStream): Promise<StreamCaption>;
  13597     /**
  13598      * Generate captions or subtitles for the provided language via AI.
  13599      * @param language The BCP 47 language tag to generate.
  13600      * @returns The generated caption entry.
  13601      * @throws {NotFoundError} if the video is not found
  13602      * @throws {BadRequestError} if the language is invalid
  13603      * @throws {StreamError} if a generated caption already exists
  13604      * @throws {StreamError} if the video duration is too long
  13605      * @throws {StreamError} if the video is missing audio
  13606      * @throws {StreamError} if the requested language is not supported
  13607      * @throws {InternalError} if an unexpected error occurs
  13608      */
  13609     generate(language: string): Promise<StreamCaption>;
  13610     /**
  13611      * Lists the captions or subtitles.
  13612      * Use the language parameter to filter by a specific language.
  13613      * @param language The optional BCP 47 language tag to filter by.
  13614      * @returns The list of captions or subtitles.
  13615      * @throws {NotFoundError} if the video or caption is not found
  13616      * @throws {InternalError} if an unexpected error occurs
  13617      */
  13618     list(language?: string): Promise<StreamCaption[]>;
  13619     /**
  13620      * Removes the captions or subtitles from a video.
  13621      * @param language The BCP 47 language tag to remove.
  13622      * @returns A promise that resolves when deletion completes.
  13623      * @throws {NotFoundError} if the video or caption is not found
  13624      * @throws {InternalError} if an unexpected error occurs
  13625      */
  13626     delete(language: string): Promise<void>;
  13627 }
  13628 interface StreamScopedDownloads {
  13629     /**
  13630      * Generates a download for a video when a video is ready to view. Available
  13631      * types are `default` and `audio`. Defaults to `default` when omitted.
  13632      * @param downloadType The download type to create.
  13633      * @returns The current downloads for the video.
  13634      * @throws {NotFoundError} if the video is not found
  13635      * @throws {BadRequestError} if the download type is invalid
  13636      * @throws {StreamError} if the video duration is too long to generate a download
  13637      * @throws {StreamError} if the video is not ready to stream
  13638      * @throws {InternalError} if an unexpected error occurs
  13639      */
  13640     generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;
  13641     /**
  13642      * Lists the downloads created for a video.
  13643      * @returns The current downloads for the video.
  13644      * @throws {NotFoundError} if the video or downloads are not found
  13645      * @throws {InternalError} if an unexpected error occurs
  13646      */
  13647     get(): Promise<StreamDownloadGetResponse>;
  13648     /**
  13649      * Delete the downloads for a video. Available types are `default` and `audio`.
  13650      * Defaults to `default` when omitted.
  13651      * @param downloadType The download type to delete.
  13652      * @returns A promise that resolves when deletion completes.
  13653      * @throws {NotFoundError} if the video or downloads are not found
  13654      * @throws {InternalError} if an unexpected error occurs
  13655      */
  13656     delete(downloadType?: StreamDownloadType): Promise<void>;
  13657 }
  13658 interface StreamVideos {
  13659     /**
  13660      * Lists all videos in a users account.
  13661      * @returns The list of videos.
  13662      * @throws {BadRequestError} if the parameters are invalid
  13663      * @throws {InternalError} if an unexpected error occurs
  13664      */
  13665     list(params?: StreamVideosListParams): Promise<StreamVideo[]>;
  13666 }
  13667 interface StreamWatermarks {
  13668     /**
  13669      * Generate a new watermark profile
  13670      * @param input The image stream to upload
  13671      * @param params The watermark creation parameters.
  13672      * @returns The created watermark profile.
  13673      * @throws {BadRequestError} if the parameters are invalid
  13674      * @throws {InvalidURLError} if the URL is invalid
  13675      * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
  13676      * @throws {InternalError} if an unexpected error occurs
  13677      */
  13678     generate(input: ReadableStream, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
  13679     /**
  13680      * Generate a new watermark profile
  13681      * @param url The image url to upload
  13682      * @param params The watermark creation parameters.
  13683      * @returns The created watermark profile.
  13684      * @throws {BadRequestError} if the parameters are invalid
  13685      * @throws {InvalidURLError} if the URL is invalid
  13686      * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
  13687      * @throws {InternalError} if an unexpected error occurs
  13688      */
  13689     generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
  13690     /**
  13691      * Lists all watermark profiles for an account.
  13692      * @returns The list of watermark profiles.
  13693      * @throws {InternalError} if an unexpected error occurs
  13694      */
  13695     list(): Promise<StreamWatermark[]>;
  13696     /**
  13697      * Retrieves details for a single watermark profile.
  13698      * @param watermarkId The watermark profile identifier.
  13699      * @returns The watermark profile details.
  13700      * @throws {NotFoundError} if the watermark is not found
  13701      * @throws {InternalError} if an unexpected error occurs
  13702      */
  13703     get(watermarkId: string): Promise<StreamWatermark>;
  13704     /**
  13705      * Deletes a watermark profile.
  13706      * @param watermarkId The watermark profile identifier.
  13707      * @returns A promise that resolves when deletion completes.
  13708      * @throws {NotFoundError} if the watermark is not found
  13709      * @throws {InternalError} if an unexpected error occurs
  13710      */
  13711     delete(watermarkId: string): Promise<void>;
  13712 }
  13713 type StreamUpdateVideoParams = {
  13714     /**
  13715      * Lists the origins allowed to display the video. Enter allowed origin
  13716      * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
  13717      * video to be viewed on any origin.
  13718      */
  13719     allowedOrigins?: Array<string>;
  13720     /**
  13721      * A user-defined identifier for the media creator.
  13722      */
  13723     creator?: string;
  13724     /**
  13725      * The maximum duration in seconds for a video upload. Can be set for a
  13726      * video that is not yet uploaded to limit its duration. Uploads that exceed the
  13727      * specified duration will fail during processing. A value of `-1` means the value
  13728      * is unknown.
  13729      */
  13730     maxDurationSeconds?: number;
  13731     /**
  13732      * A user modifiable key-value store used to reference other systems of
  13733      * record for managing videos.
  13734      */
  13735     meta?: Record<string, string>;
  13736     /**
  13737      * Indicates whether the video can be a accessed using the id. When
  13738      * set to `true`, a signed token must be generated with a signing key to view the
  13739      * video.
  13740      */
  13741     requireSignedURLs?: boolean;
  13742     /**
  13743      * Indicates the date and time at which the video will be deleted. Omit
  13744      * the field to indicate no change, or include with a `null` value to remove an
  13745      * existing scheduled deletion. If specified, must be at least 30 days from upload
  13746      * time.
  13747      */
  13748     scheduledDeletion?: string | null;
  13749     /**
  13750      * The timestamp for a thumbnail image calculated as a percentage value
  13751      * of the video's duration. To convert from a second-wise timestamp to a
  13752      * percentage, divide the desired timestamp by the total duration of the video. If
  13753      * this value is not set, the default thumbnail image is taken from 0s of the
  13754      * video.
  13755      */
  13756     thumbnailTimestampPct?: number;
  13757 };
  13758 type StreamCaption = {
  13759     /**
  13760      * Whether the caption was generated via AI.
  13761      */
  13762     generated?: boolean;
  13763     /**
  13764      * The language label displayed in the native language to users.
  13765      */
  13766     label: string;
  13767     /**
  13768      * The language tag in BCP 47 format.
  13769      */
  13770     language: string;
  13771     /**
  13772      * The status of a generated caption.
  13773      */
  13774     status?: 'ready' | 'inprogress' | 'error';
  13775 };
  13776 type StreamDownloadStatus = 'ready' | 'inprogress' | 'error';
  13777 type StreamDownloadType = 'default' | 'audio';
  13778 type StreamDownload = {
  13779     /**
  13780      * Indicates the progress as a percentage between 0 and 100.
  13781      */
  13782     percentComplete: number;
  13783     /**
  13784      * The status of a generated download.
  13785      */
  13786     status: StreamDownloadStatus;
  13787     /**
  13788      * The URL to access the generated download.
  13789      */
  13790     url?: string;
  13791 };
  13792 /**
  13793  * An object with download type keys. Each key is optional and only present if that
  13794  * download type has been created.
  13795  */
  13796 type StreamDownloadGetResponse = {
  13797     /**
  13798      * The audio-only download. Only present if this download type has been created.
  13799      */
  13800     audio?: StreamDownload;
  13801     /**
  13802      * The default video download. Only present if this download type has been created.
  13803      */
  13804     default?: StreamDownload;
  13805 };
  13806 type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';
  13807 type StreamWatermark = {
  13808     /**
  13809      * The unique identifier for a watermark profile.
  13810      */
  13811     id: string;
  13812     /**
  13813      * The size of the image in bytes.
  13814      */
  13815     size: number;
  13816     /**
  13817      * The height of the image in pixels.
  13818      */
  13819     height: number;
  13820     /**
  13821      * The width of the image in pixels.
  13822      */
  13823     width: number;
  13824     /**
  13825      * The date and a time a watermark profile was created.
  13826      */
  13827     created: string;
  13828     /**
  13829      * The source URL for a downloaded image. If the watermark profile was created via
  13830      * direct upload, this field is null.
  13831      */
  13832     downloadedFrom: string | null;
  13833     /**
  13834      * A short description of the watermark profile.
  13835      */
  13836     name: string;
  13837     /**
  13838      * The translucency of the image. A value of `0.0` makes the image completely
  13839      * transparent, and `1.0` makes the image completely opaque. Note that if the image
  13840      * is already semi-transparent, setting this to `1.0` will not make the image
  13841      * completely opaque.
  13842      */
  13843     opacity: number;
  13844     /**
  13845      * The whitespace between the adjacent edges (determined by position) of the video
  13846      * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded
  13847      * video width or length, as determined by the algorithm.
  13848      */
  13849     padding: number;
  13850     /**
  13851      * The size of the image relative to the overall size of the video. This parameter
  13852      * will adapt to horizontal and vertical videos automatically. `0.0` indicates no
  13853      * scaling (use the size of the image as-is), and `1.0 `fills the entire video.
  13854      */
  13855     scale: number;
  13856     /**
  13857      * The location of the image. Valid positions are: `upperRight`, `upperLeft`,
  13858      * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the
  13859      * `padding` parameter.
  13860      */
  13861     position: StreamWatermarkPosition;
  13862 };
  13863 type StreamWatermarkCreateParams = {
  13864     /**
  13865      * A short description of the watermark profile.
  13866      */
  13867     name?: string;
  13868     /**
  13869      * The translucency of the image. A value of `0.0` makes the image completely
  13870      * transparent, and `1.0` makes the image completely opaque. Note that if the
  13871      * image is already semi-transparent, setting this to `1.0` will not make the
  13872      * image completely opaque.
  13873      */
  13874     opacity?: number;
  13875     /**
  13876      * The whitespace between the adjacent edges (determined by position) of the
  13877      * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully
  13878      * padded video width or length, as determined by the algorithm.
  13879      */
  13880     padding?: number;
  13881     /**
  13882      * The size of the image relative to the overall size of the video. This
  13883      * parameter will adapt to horizontal and vertical videos automatically. `0.0`
  13884      * indicates no scaling (use the size of the image as-is), and `1.0 `fills the
  13885      * entire video.
  13886      */
  13887     scale?: number;
  13888     /**
  13889      * The location of the image.
  13890      */
  13891     position?: StreamWatermarkPosition;
  13892 };
  13893 type StreamVideosListParams = {
  13894     /**
  13895      * The maximum number of videos to return.
  13896      */
  13897     limit?: number;
  13898     /**
  13899      * Return videos created before this timestamp.
  13900      * (RFC3339/RFC3339Nano)
  13901      */
  13902     before?: string;
  13903     /**
  13904      * Comparison operator for the `before` field.
  13905      * @default 'lt'
  13906      */
  13907     beforeComp?: StreamPaginationComparison;
  13908     /**
  13909      * Return videos created after this timestamp.
  13910      * (RFC3339/RFC3339Nano)
  13911      */
  13912     after?: string;
  13913     /**
  13914      * Comparison operator for the `after` field.
  13915      * @default 'gte'
  13916      */
  13917     afterComp?: StreamPaginationComparison;
  13918 };
  13919 type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
  13920 /**
  13921  * Error object for Stream binding operations.
  13922  */
  13923 interface StreamError extends Error {
  13924     readonly code: number;
  13925     readonly statusCode: number;
  13926     readonly message: string;
  13927     readonly stack?: string;
  13928 }
  13929 interface InternalError extends StreamError {
  13930     name: 'InternalError';
  13931 }
  13932 interface BadRequestError extends StreamError {
  13933     name: 'BadRequestError';
  13934 }
  13935 interface NotFoundError extends StreamError {
  13936     name: 'NotFoundError';
  13937 }
  13938 interface ForbiddenError extends StreamError {
  13939     name: 'ForbiddenError';
  13940 }
  13941 interface RateLimitedError extends StreamError {
  13942     name: 'RateLimitedError';
  13943 }
  13944 interface QuotaReachedError extends StreamError {
  13945     name: 'QuotaReachedError';
  13946 }
  13947 interface MaxFileSizeError extends StreamError {
  13948     name: 'MaxFileSizeError';
  13949 }
  13950 interface InvalidURLError extends StreamError {
  13951     name: 'InvalidURLError';
  13952 }
  13953 interface AlreadyUploadedError extends StreamError {
  13954     name: 'AlreadyUploadedError';
  13955 }
  13956 interface TooManyWatermarksError extends StreamError {
  13957     name: 'TooManyWatermarksError';
  13958 }
  13959 type MarkdownDocument = {
  13960     name: string;
  13961     blob: Blob;
  13962 };
  13963 type ConversionResponse = {
  13964     id: string;
  13965     name: string;
  13966     mimeType: string;
  13967     format: 'markdown';
  13968     tokens: number;
  13969     data: string;
  13970 } | {
  13971     id: string;
  13972     name: string;
  13973     mimeType: string;
  13974     format: 'error';
  13975     error: string;
  13976 };
  13977 type ImageConversionOptions = {
  13978     descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';
  13979 };
  13980 type EmbeddedImageConversionOptions = ImageConversionOptions & {
  13981     convert?: boolean;
  13982     maxConvertedImages?: number;
  13983 };
  13984 type ConversionOptions = {
  13985     html?: {
  13986         images?: EmbeddedImageConversionOptions & {
  13987             convertOGImage?: boolean;
  13988         };
  13989         hostname?: string;
  13990         cssSelector?: string;
  13991     };
  13992     docx?: {
  13993         images?: EmbeddedImageConversionOptions;
  13994     };
  13995     image?: ImageConversionOptions;
  13996     pdf?: {
  13997         images?: EmbeddedImageConversionOptions;
  13998         metadata?: boolean;
  13999     };
  14000 };
  14001 type ConversionRequestOptions = {
  14002     gateway?: GatewayOptions;
  14003     extraHeaders?: object;
  14004     conversionOptions?: ConversionOptions;
  14005 };
  14006 type SupportedFileFormat = {
  14007     mimeType: string;
  14008     extension: string;
  14009 };
  14010 declare abstract class ToMarkdownService {
  14011     transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
  14012     transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;
  14013     supported(): Promise<SupportedFileFormat[]>;
  14014 }
  14015 declare namespace TailStream {
  14016     interface Header {
  14017         readonly name: string;
  14018         readonly value: string;
  14019     }
  14020     interface FetchEventInfo {
  14021         readonly type: "fetch";
  14022         readonly method: string;
  14023         readonly url: string;
  14024         readonly cfJson?: object;
  14025         readonly headers: Header[];
  14026     }
  14027     interface JsRpcEventInfo {
  14028         readonly type: "jsrpc";
  14029     }
  14030     interface ScheduledEventInfo {
  14031         readonly type: "scheduled";
  14032         readonly scheduledTime: Date;
  14033         readonly cron: string;
  14034     }
  14035     interface AlarmEventInfo {
  14036         readonly type: "alarm";
  14037         readonly scheduledTime: Date;
  14038     }
  14039     interface QueueEventInfo {
  14040         readonly type: "queue";
  14041         readonly queueName: string;
  14042         readonly batchSize: number;
  14043     }
  14044     interface EmailEventInfo {
  14045         readonly type: "email";
  14046         readonly mailFrom: string;
  14047         readonly rcptTo: string;
  14048         readonly rawSize: number;
  14049     }
  14050     interface TraceEventInfo {
  14051         readonly type: "trace";
  14052         readonly traces: (string | null)[];
  14053     }
  14054     interface HibernatableWebSocketEventInfoMessage {
  14055         readonly type: "message";
  14056     }
  14057     interface HibernatableWebSocketEventInfoError {
  14058         readonly type: "error";
  14059     }
  14060     interface HibernatableWebSocketEventInfoClose {
  14061         readonly type: "close";
  14062         readonly code: number;
  14063         readonly wasClean: boolean;
  14064     }
  14065     interface HibernatableWebSocketEventInfo {
  14066         readonly type: "hibernatableWebSocket";
  14067         readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;
  14068     }
  14069     interface CustomEventInfo {
  14070         readonly type: "custom";
  14071     }
  14072     interface FetchResponseInfo {
  14073         readonly type: "fetch";
  14074         readonly statusCode: number;
  14075     }
  14076     interface ConnectEventInfo {
  14077         readonly type: "connect";
  14078     }
  14079     type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
  14080     interface ScriptVersion {
  14081         readonly id: string;
  14082         readonly tag?: string;
  14083         readonly message?: string;
  14084     }
  14085     interface TracePreviewInfo {
  14086         readonly id: string;
  14087         readonly slug: string;
  14088         readonly name: string;
  14089     }
  14090     interface Onset {
  14091         readonly type: "onset";
  14092         readonly attributes: Attribute[];
  14093         // id for the span being opened by this Onset event.
  14094         readonly spanId: string;
  14095         readonly dispatchNamespace?: string;
  14096         readonly entrypoint?: string;
  14097         readonly executionModel: string;
  14098         readonly durableObjectId?: string;
  14099         readonly scriptName?: string;
  14100         readonly scriptTags?: string[];
  14101         readonly scriptVersion?: ScriptVersion;
  14102         readonly preview?: TracePreviewInfo;
  14103         readonly info: FetchEventInfo | ConnectEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;
  14104     }
  14105     interface Outcome {
  14106         readonly type: "outcome";
  14107         readonly outcome: EventOutcome;
  14108         readonly cpuTime: number;
  14109         readonly wallTime: number;
  14110     }
  14111     interface SpanOpen {
  14112         readonly type: "spanOpen";
  14113         readonly name: string;
  14114         // id for the span being opened by this SpanOpen event.
  14115         readonly spanId: string;
  14116         readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
  14117     }
  14118     interface SpanClose {
  14119         readonly type: "spanClose";
  14120         readonly outcome: EventOutcome;
  14121     }
  14122     interface DiagnosticChannelEvent {
  14123         readonly type: "diagnosticChannel";
  14124         readonly channel: string;
  14125         readonly message: any;
  14126     }
  14127     interface Exception {
  14128         readonly type: "exception";
  14129         readonly name: string;
  14130         readonly message: string;
  14131         readonly stack?: string;
  14132     }
  14133     interface Log {
  14134         readonly type: "log";
  14135         readonly level: "debug" | "error" | "info" | "log" | "warn";
  14136         readonly message: object;
  14137     }
  14138     interface DroppedEventsDiagnostic {
  14139         readonly diagnosticsType: "droppedEvents";
  14140         readonly count: number;
  14141     }
  14142     interface StreamDiagnostic {
  14143         readonly type: 'streamDiagnostic';
  14144         // To add new diagnostic types, define a new interface and add it to this union type.
  14145         readonly diagnostic: DroppedEventsDiagnostic;
  14146     }
  14147     // This marks the worker handler return information.
  14148     // This is separate from Outcome because the worker invocation can live for a long time after
  14149     // returning. For example - Websockets that return an http upgrade response but then continue
  14150     // streaming information or SSE http connections.
  14151     interface Return {
  14152         readonly type: "return";
  14153         readonly info?: FetchResponseInfo;
  14154     }
  14155     interface Attribute {
  14156         readonly name: string;
  14157         readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];
  14158     }
  14159     interface Attributes {
  14160         readonly type: "attributes";
  14161         readonly info: Attribute[];
  14162     }
  14163     type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;
  14164     // Context in which this trace event lives.
  14165     interface SpanContext {
  14166         // Single id for the entire top-level invocation
  14167         // This should be a new traceId for the first worker stage invoked in the eyeball request and then
  14168         // same-account service-bindings should reuse the same traceId but cross-account service-bindings
  14169         // should use a new traceId.
  14170         readonly traceId: string;
  14171         // spanId in which this event is handled
  14172         // for Onset and SpanOpen events this would be the parent span id
  14173         // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
  14174         // For Hibernate and Mark this would be the span under which they were emitted.
  14175         // spanId is not set ONLY if:
  14176         //  1. This is an Onset event
  14177         //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
  14178         readonly spanId?: string;
  14179         // W3C trace flags from an upstream traceparent. Absent when no upstream
  14180         // sampling decision was made.
  14181         readonly traceFlags?: number;
  14182     }
  14183     interface TailEvent<Event extends EventType> {
  14184         // invocation id of the currently invoked worker stage.
  14185         // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
  14186         readonly invocationId: string;
  14187         // Inherited spanContext for this event.
  14188         readonly spanContext: SpanContext;
  14189         readonly timestamp: Date;
  14190         readonly sequence: number;
  14191         readonly event: Event;
  14192     }
  14193     type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;
  14194     type TailEventHandlerObject = {
  14195         outcome?: TailEventHandler<Outcome>;
  14196         spanOpen?: TailEventHandler<SpanOpen>;
  14197         spanClose?: TailEventHandler<SpanClose>;
  14198         diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
  14199         exception?: TailEventHandler<Exception>;
  14200         log?: TailEventHandler<Log>;
  14201         return?: TailEventHandler<Return>;
  14202         attributes?: TailEventHandler<Attributes>;
  14203     };
  14204     type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
  14205 }
  14206 // Copyright (c) 2022-2023 Cloudflare, Inc.
  14207 // Licensed under the Apache 2.0 license found in the LICENSE file or at:
  14208 //     https://opensource.org/licenses/Apache-2.0
  14209 /**
  14210  * Data types supported for holding vector metadata.
  14211  */
  14212 type VectorizeVectorMetadataValue = string | number | boolean | string[];
  14213 /**
  14214  * Additional information to associate with a vector.
  14215  */
  14216 type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;
  14217 type VectorFloatArray = Float32Array | Float64Array;
  14218 interface VectorizeError {
  14219     code?: number;
  14220     error: string;
  14221 }
  14222 /**
  14223  * Comparison logic/operation to use for metadata filtering.
  14224  *
  14225  * This list is expected to grow as support for more operations are released.
  14226  */
  14227 type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';
  14228 type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';
  14229 /**
  14230  * Filter criteria for vector metadata used to limit the retrieved query result set.
  14231  */
  14232 type VectorizeVectorMetadataFilter = {
  14233     [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {
  14234         [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;
  14235     } | {
  14236         [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];
  14237     };
  14238 };
  14239 /**
  14240  * Supported distance metrics for an index.
  14241  * Distance metrics determine how other "similar" vectors are determined.
  14242  */
  14243 type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
  14244 /**
  14245  * Metadata return levels for a Vectorize query.
  14246  *
  14247  * Default to "none".
  14248  *
  14249  * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
  14250  * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
  14251  * @property none     No indexed metadata will be returned.
  14252  */
  14253 type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
  14254 interface VectorizeQueryOptions {
  14255     topK?: number;
  14256     namespace?: string;
  14257     returnValues?: boolean;
  14258     returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
  14259     filter?: VectorizeVectorMetadataFilter;
  14260 }
  14261 /**
  14262  * Information about the configuration of an index.
  14263  */
  14264 type VectorizeIndexConfig = {
  14265     dimensions: number;
  14266     metric: VectorizeDistanceMetric;
  14267 } | {
  14268     preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
  14269 };
  14270 /**
  14271  * Metadata about an existing index.
  14272  *
  14273  * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
  14274  * See {@link VectorizeIndexInfo} for its post-beta equivalent.
  14275  */
  14276 interface VectorizeIndexDetails {
  14277     /** The unique ID of the index */
  14278     readonly id: string;
  14279     /** The name of the index. */
  14280     name: string;
  14281     /** (optional) A human readable description for the index. */
  14282     description?: string;
  14283     /** The index configuration, including the dimension size and distance metric. */
  14284     config: VectorizeIndexConfig;
  14285     /** The number of records containing vectors within the index. */
  14286     vectorsCount: number;
  14287 }
  14288 /**
  14289  * Metadata about an existing index.
  14290  */
  14291 interface VectorizeIndexInfo {
  14292     /** The number of records containing vectors within the index. */
  14293     vectorCount: number;
  14294     /** Number of dimensions the index has been configured for. */
  14295     dimensions: number;
  14296     /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
  14297     processedUpToDatetime: number;
  14298     /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
  14299     processedUpToMutation: number;
  14300 }
  14301 /**
  14302  * Represents a single vector value set along with its associated metadata.
  14303  */
  14304 interface VectorizeVector {
  14305     /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
  14306     id: string;
  14307     /** The vector values */
  14308     values: VectorFloatArray | number[];
  14309     /** The namespace this vector belongs to. */
  14310     namespace?: string;
  14311     /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
  14312     metadata?: Record<string, VectorizeVectorMetadata>;
  14313 }
  14314 /**
  14315  * Represents a matched vector for a query along with its score and (if specified) the matching vector information.
  14316  */
  14317 type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<VectorizeVector, "values"> & {
  14318     /** The score or rank for similarity, when returned as a result */
  14319     score: number;
  14320 };
  14321 /**
  14322  * A set of matching {@link VectorizeMatch} for a particular query.
  14323  */
  14324 interface VectorizeMatches {
  14325     matches: VectorizeMatch[];
  14326     count: number;
  14327 }
  14328 /**
  14329  * Results of an operation that performed a mutation on a set of vectors.
  14330  * Here, `ids` is a list of vectors that were successfully processed.
  14331  *
  14332  * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
  14333  * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
  14334  */
  14335 interface VectorizeVectorMutation {
  14336     /* List of ids of vectors that were successfully processed. */
  14337     ids: string[];
  14338     /* Total count of the number of processed vectors. */
  14339     count: number;
  14340 }
  14341 /**
  14342  * Result type indicating a mutation on the Vectorize Index.
  14343  * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
  14344  */
  14345 interface VectorizeAsyncMutation {
  14346     /** The unique identifier for the async mutation operation containing the changeset. */
  14347     mutationId: string;
  14348 }
  14349 /**
  14350  * A Vectorize Vector Search Index for querying vectors/embeddings.
  14351  *
  14352  * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
  14353  * See {@link Vectorize} for its new implementation.
  14354  */
  14355 declare abstract class VectorizeIndex {
  14356     /**
  14357      * Get information about the currently bound index.
  14358      * @returns A promise that resolves with information about the current index.
  14359      */
  14360     public describe(): Promise<VectorizeIndexDetails>;
  14361     /**
  14362      * Use the provided vector to perform a similarity search across the index.
  14363      * @param vector Input vector that will be used to drive the similarity search.
  14364      * @param options Configuration options to massage the returned data.
  14365      * @returns A promise that resolves with matched and scored vectors.
  14366      */
  14367     public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
  14368     /**
  14369      * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
  14370      * @param vectors List of vectors that will be inserted.
  14371      * @returns A promise that resolves with the ids & count of records that were successfully processed.
  14372      */
  14373     public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
  14374     /**
  14375      * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
  14376      * @param vectors List of vectors that will be upserted.
  14377      * @returns A promise that resolves with the ids & count of records that were successfully processed.
  14378      */
  14379     public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
  14380     /**
  14381      * Delete a list of vectors with a matching id.
  14382      * @param ids List of vector ids that should be deleted.
  14383      * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
  14384      */
  14385     public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
  14386     /**
  14387      * Get a list of vectors with a matching id.
  14388      * @param ids List of vector ids that should be returned.
  14389      * @returns A promise that resolves with the raw unscored vectors matching the id set.
  14390      */
  14391     public getByIds(ids: string[]): Promise<VectorizeVector[]>;
  14392 }
  14393 /**
  14394  * A Vectorize Vector Search Index for querying vectors/embeddings.
  14395  *
  14396  * Mutations in this version are async, returning a mutation id.
  14397  */
  14398 declare abstract class Vectorize {
  14399     /**
  14400      * Get information about the currently bound index.
  14401      * @returns A promise that resolves with information about the current index.
  14402      */
  14403     public describe(): Promise<VectorizeIndexInfo>;
  14404     /**
  14405      * Use the provided vector to perform a similarity search across the index.
  14406      * @param vector Input vector that will be used to drive the similarity search.
  14407      * @param options Configuration options to massage the returned data.
  14408      * @returns A promise that resolves with matched and scored vectors.
  14409      */
  14410     public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
  14411     /**
  14412      * Use the provided vector-id to perform a similarity search across the index.
  14413      * @param vectorId Id for a vector in the index against which the index should be queried.
  14414      * @param options Configuration options to massage the returned data.
  14415      * @returns A promise that resolves with matched and scored vectors.
  14416      */
  14417     public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
  14418     /**
  14419      * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
  14420      * @param vectors List of vectors that will be inserted.
  14421      * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
  14422      */
  14423     public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
  14424     /**
  14425      * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
  14426      * @param vectors List of vectors that will be upserted.
  14427      * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
  14428      */
  14429     public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
  14430     /**
  14431      * Delete a list of vectors with a matching id.
  14432      * @param ids List of vector ids that should be deleted.
  14433      * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
  14434      */
  14435     public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
  14436     /**
  14437      * Get a list of vectors with a matching id.
  14438      * @param ids List of vector ids that should be returned.
  14439      * @returns A promise that resolves with the raw unscored vectors matching the id set.
  14440      */
  14441     public getByIds(ids: string[]): Promise<VectorizeVector[]>;
  14442 }
  14443 /**
  14444  * The interface for "version_metadata" binding
  14445  * providing metadata about the Worker Version using this binding.
  14446  */
  14447 type WorkerVersionMetadata = {
  14448     /** The ID of the Worker Version using this binding */
  14449     id: string;
  14450     /** The tag of the Worker Version using this binding */
  14451     tag: string;
  14452     /** The timestamp of when the Worker Version was uploaded */
  14453     timestamp: string;
  14454 };
  14455 // ============ Web Search Request Types ============
  14456 /**
  14457  * Options for a Web Search query.
  14458  */
  14459 type WebSearchSearchOptions = {
  14460     /** The search query. */
  14461     query: string;
  14462     /**
  14463      * Maximum number of results to return. Defaults to 10, capped at 20.
  14464      * The actual count may be lower if fewer matches exist.
  14465      */
  14466     limit?: number;
  14467 };
  14468 // ============ Web Search Response Types ============
  14469 /**
  14470  * A single Web Search result.
  14471  *
  14472  * Web Search is discovery-only -- results carry catalog metadata about a page
  14473  * but never the page body. To read a result's content the caller invokes the
  14474  * global `fetch()` API against the result's `url`, at which point the
  14475  * destination's own access controls apply (including Cloudflare Pay-per-Crawl).
  14476  */
  14477 type WebSearchResult = {
  14478     /** Canonical URL. */
  14479     url: string;
  14480     /** Page title. */
  14481     title: string;
  14482     /** Page-level description. May be absent. */
  14483     description?: string;
  14484     /**
  14485      * Last-modified date for the page, when known. Naive (no timezone)
  14486      * ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
  14487      */
  14488     lastModifiedDate?: string;
  14489     /**
  14490      * Page meta image URL (typically the `og:image`). May be absent.
  14491      */
  14492     imageUrl?: string;
  14493     /** Optional favicon URL for UI hints. */
  14494     faviconUrl?: string;
  14495 };
  14496 /**
  14497  * Per-response metadata for a Web Search query. Carries operational
  14498  * fields useful for support and debugging.
  14499  */
  14500 type WebSearchResponseMetadata = {
  14501     /** The query that was executed. */
  14502     query: string;
  14503     /** Opaque request identifier used for support and debugging. */
  14504     requestId: string;
  14505     /** End-to-end latency for this search request, in milliseconds. */
  14506     latencyMs: number;
  14507 };
  14508 /**
  14509  * Response from a Web Search query.
  14510  */
  14511 type WebSearchSearchResponse = {
  14512     items: WebSearchResult[];
  14513     metadata: WebSearchResponseMetadata;
  14514 };
  14515 // ============ Web Search Binding Class ============
  14516 /**
  14517  * Cloudflare Web Search binding.
  14518  *
  14519  * Discovery-only primitive for agents and Workers. Returns URLs and catalog
  14520  * metadata for a query; never returns page content or excerpts. To read a
  14521  * result's body, fetch the URL with the global `fetch()` API.
  14522  *
  14523  * Declared in wrangler with a single object (there is exactly one corpus, the
  14524  * public web, so there is no name, namespace, or instance to specify):
  14525  *
  14526  * ```jsonc
  14527  * { "web_search": { "binding": "WEBSEARCH" } }
  14528  * ```
  14529  *
  14530  * @example
  14531  * ```ts
  14532  * const { items, metadata } = await env.WEBSEARCH.search({
  14533  *   query: "Cloudflare Workers",
  14534  * });
  14535  *
  14536  * const top = items[0];
  14537  * console.log(top.url, top.title, metadata.latencyMs);
  14538  *
  14539  * // Read content yourself; pay-per-crawl and other publisher
  14540  * // controls apply at the fetch site, not at search time.
  14541  * const page = await fetch(top.url);
  14542  * ```
  14543  */
  14544 declare abstract class WebSearch {
  14545     /**
  14546      * Run a Web Search query.
  14547      * @param options Search options. Only `query` is required.
  14548      * @returns The matching results plus per-response metadata.
  14549      */
  14550     search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
  14551 }
  14552 interface DynamicDispatchLimits {
  14553     /**
  14554      * Limit CPU time in milliseconds.
  14555      */
  14556     cpuMs?: number;
  14557     /**
  14558      * Limit number of subrequests.
  14559      */
  14560     subRequests?: number;
  14561 }
  14562 interface DynamicDispatchOptions {
  14563     /**
  14564      * Limit resources of invoked Worker script.
  14565      */
  14566     limits?: DynamicDispatchLimits;
  14567     /**
  14568      * Arguments for outbound Worker script, if configured.
  14569      */
  14570     outbound?: {
  14571         [key: string]: any;
  14572     };
  14573 }
  14574 interface DispatchNamespace {
  14575     /**
  14576     * @param name Name of the Worker script.
  14577     * @param args Arguments to Worker script.
  14578     * @param options Options for Dynamic Dispatch invocation.
  14579     * @returns A Fetcher object that allows you to send requests to the Worker script.
  14580     * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
  14581     */
  14582     get(name: string, args?: {
  14583         [key: string]: any;
  14584     }, options?: DynamicDispatchOptions): Fetcher;
  14585 }
  14586 declare module 'cloudflare:workflows' {
  14587     /**
  14588      * NonRetryableError allows for a user to throw a fatal error
  14589      * that makes a Workflow instance fail immediately without triggering a retry
  14590      */
  14591     export class NonRetryableError extends Error {
  14592         public constructor(message: string, name?: string);
  14593     }
  14594 }
  14595 declare abstract class Workflow<PARAMS = unknown> {
  14596     /**
  14597      * Get a handle to an existing instance of the Workflow.
  14598      * @param id Id for the instance of this Workflow
  14599      * @returns A promise that resolves with a handle for the Instance
  14600      */
  14601     public get(id: string): Promise<WorkflowInstance>;
  14602     /**
  14603      * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
  14604      * @param options Options when creating an instance including id and params
  14605      * @returns A promise that resolves with a handle for the Instance
  14606      */
  14607     public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;
  14608     /**
  14609      * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.
  14610      * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
  14611      * @param batch List of Options when creating an instance including name and params
  14612      * @returns A promise that resolves with a list of handles for the created instances.
  14613      */
  14614     public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
  14615 }
  14616 type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
  14617 type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
  14618 type WorkflowRetentionDuration = WorkflowSleepDuration;
  14619 interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
  14620     /**
  14621      * An id for your Workflow instance. Must be unique within the Workflow.
  14622      */
  14623     id?: string;
  14624     /**
  14625      * The event payload the Workflow instance is triggered with
  14626      */
  14627     params?: PARAMS;
  14628     /**
  14629      * The retention policy for Workflow instance.
  14630      * Defaults to the maximum retention period available for the owner's account.
  14631      */
  14632     retention?: {
  14633         successRetention?: WorkflowRetentionDuration;
  14634         errorRetention?: WorkflowRetentionDuration;
  14635     };
  14636 }
  14637 type InstanceStatus = {
  14638     status: 'queued' // means that instance is waiting to be started (see concurrency limits)
  14639      | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running
  14640      | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish
  14641      | 'waitingForPause' // instance is finishing the current work to pause
  14642      | 'unknown';
  14643     error?: {
  14644         name: string;
  14645         message: string;
  14646     };
  14647     output?: unknown;
  14648 };
  14649 interface WorkflowError {
  14650     code?: number;
  14651     message: string;
  14652 }
  14653 interface WorkflowInstanceTerminateOptions {
  14654     /**
  14655      * If true, run registered rollback handlers before terminating the instance.
  14656      * Only steps that registered rollback handlers are rolled back.
  14657      */
  14658     rollback?: boolean;
  14659 }
  14660 interface WorkflowInstanceRestartOptions {
  14661     /**
  14662      * Restart from a specific step. If omitted, the instance restarts from the beginning.
  14663      * The step must exist in the instance's execution history.
  14664      */
  14665     from?: {
  14666         /**
  14667          * The step name as defined in your workflow code.
  14668          */
  14669         name: string;
  14670         /**
  14671          * 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).
  14672          * @default 1
  14673          */
  14674         count?: number;
  14675         /**
  14676          * Step type filter. Use when different step types share the same name.
  14677          */
  14678         type?: 'do' | 'sleep' | 'waitForEvent';
  14679     };
  14680 }
  14681 declare abstract class WorkflowInstance {
  14682     public id: string;
  14683     /**
  14684      * Pause the instance.
  14685      */
  14686     public pause(): Promise<void>;
  14687     /**
  14688      * Resume the instance. If it is already running, an error will be thrown.
  14689      */
  14690     public resume(): Promise<void>;
  14691     /**
  14692      * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
  14693      * @param options Options for termination, including whether registered rollback handlers should run.
  14694      */
  14695     public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
  14696     /**
  14697      * Restart the instance. Optionally restart from a specific step, preserving
  14698      * cached results for all steps before it.
  14699      * @param options Options for the restart, including an optional step to restart from.
  14700      */
  14701     public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
  14702     /**
  14703      * Returns the current status of the instance.
  14704      */
  14705     public status(): Promise<InstanceStatus>;
  14706     /**
  14707      * Send an event to this instance.
  14708      */
  14709     public sendEvent({ type, payload, }: {
  14710         type: string;
  14711         payload: unknown;
  14712     }): Promise<void>;
  14713 }