BT  ·  2026-10-10

worker-configuration.d.ts

    1/* eslint-disable */
    2// Generated by Wrangler by running `wrangler types` (hash: d426b395fe86b1645db94896afb4e08d)
    3// Runtime types generated with [email protected] 2026-10-01
    4interface __BaseEnv_Env {
    5	EMAIL: SendEmail;
    6	ENDPOINTS: ["https://mymood.at/healthz","https://infra.sovrn.at/healthz"];
    7	CHECK_INTERVAL_SECONDS: 180;
    8	TIMEOUT_MS: 10000;
    9	REMINDER_HOURS: 6;
   10	ALERT_FROM: "[email protected]";
   11	ALERT_TO: "[email protected]";
   12	PUBLIC_URL: "https://monitor.rtw.run";
   13	AUTH_USER: string;
   14	AUTH_PASS: string;
   15	MONITOR: DurableObjectNamespace<import("./src/index").MonitorDO>;
   16}
   17declare namespace Cloudflare {
   18	interface GlobalProps {
   19		mainModule: typeof import("./src/index");
   20		durableNamespaces: "MonitorDO";
   21	}
   22	interface Env extends __BaseEnv_Env {}
   23}
   24interface Env extends __BaseEnv_Env {}
   25type StringifyValues<EnvType extends Record<string, unknown>> = {
   26	[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
   27};
   28declare namespace NodeJS {
   29	interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "ENDPOINTS" | "CHECK_INTERVAL_SECONDS" | "TIMEOUT_MS" | "REMINDER_HOURS" | "ALERT_FROM" | "ALERT_TO" | "PUBLIC_URL" | "AUTH_USER" | "AUTH_PASS">> {}
   30}
   31declare module "*.txt" {
   32	const value: string;
   33	export default value;
   34}
   35declare module "*.html" {
   36	const value: string;
   37	export default value;
   38}
   39declare module "*.sql" {
   40	const value: string;
   41	export default value;
   42}
   43declare module "*.bin" {
   44	const value: ArrayBuffer;
   45	export default value;
   46}
   47declare module "*.wasm" {
   48	const value: WebAssembly.Module;
   49	export default value;
   50}
   51declare module "*.wasm?module" {
   52	const value: WebAssembly.Module;
   53	export default value;
   54}
   55// Begin runtime types
   56/*! *****************************************************************************
   57Copyright (c) Cloudflare. All rights reserved.
   58Copyright (c) Microsoft Corporation. All rights reserved.
   59
   60Licensed under the Apache License, Version 2.0 (the "License"); you may not use
   61this file except in compliance with the License. You may obtain a copy of the
   62License at http://www.apache.org/licenses/LICENSE-2.0
   63THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   64KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
   65WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
   66MERCHANTABLITY OR NON-INFRINGEMENT.
   67See the Apache Version 2.0 License for specific language governing permissions
   68and limitations under the License.
   69***************************************************************************** */
   70/* eslint-disable */
   71// noinspection JSUnusedGlobalSymbols
   72declare var onmessage: never;
   73/**
   74 * 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. This is how error conditions are described in web APIs.
   75 *
   76 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
   77 */
   78declare class DOMException extends Error {
   79    constructor(message?: string, name?: string);
   80    /**
   81     * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
   82     *
   83     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
   84     */
   85    readonly message: string;
   86    /**
   87     * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
   88     *
   89     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
   90     */
   91    readonly name: string;
   92    /**
   93     * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
   94     * @deprecated
   95     *
   96     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
   97     */
   98    readonly code: number;
   99    static readonly INDEX_SIZE_ERR: number;
  100    static readonly DOMSTRING_SIZE_ERR: number;
  101    static readonly HIERARCHY_REQUEST_ERR: number;
  102    static readonly WRONG_DOCUMENT_ERR: number;
  103    static readonly INVALID_CHARACTER_ERR: number;
  104    static readonly NO_DATA_ALLOWED_ERR: number;
  105    static readonly NO_MODIFICATION_ALLOWED_ERR: number;
  106    static readonly NOT_FOUND_ERR: number;
  107    static readonly NOT_SUPPORTED_ERR: number;
  108    static readonly INUSE_ATTRIBUTE_ERR: number;
  109    static readonly INVALID_STATE_ERR: number;
  110    static readonly SYNTAX_ERR: number;
  111    static readonly INVALID_MODIFICATION_ERR: number;
  112    static readonly NAMESPACE_ERR: number;
  113    static readonly INVALID_ACCESS_ERR: number;
  114    static readonly VALIDATION_ERR: number;
  115    static readonly TYPE_MISMATCH_ERR: number;
  116    static readonly SECURITY_ERR: number;
  117    static readonly NETWORK_ERR: number;
  118    static readonly ABORT_ERR: number;
  119    static readonly URL_MISMATCH_ERR: number;
  120    static readonly QUOTA_EXCEEDED_ERR: number;
  121    static readonly TIMEOUT_ERR: number;
  122    static readonly INVALID_NODE_TYPE_ERR: number;
  123    static readonly DATA_CLONE_ERR: number;
  124    get stack(): any;
  125    set stack(value: any);
  126}
  127type WorkerGlobalScopeEventMap = {
  128    fetch: FetchEvent;
  129    scheduled: ScheduledEvent;
  130    queue: QueueEvent;
  131    unhandledrejection: PromiseRejectionEvent;
  132    rejectionhandled: PromiseRejectionEvent;
  133};
  134declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
  135    EventTarget: typeof EventTarget;
  136}
  137/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *
  138 * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).
  139 *
  140 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)
  141 */
  142interface Console {
  143    "assert"(condition?: boolean, ...data: any[]): void;
  144    /**
  145     * The **`console.clear()`** static method clears the console if possible.
  146     *
  147     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)
  148     */
  149    clear(): void;
  150    /**
  151     * The **`console.count()`** static method logs the number of times that this particular call to count() has been called.
  152     *
  153     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)
  154     */
  155    count(label?: string): void;
  156    /**
  157     * The **`console.countReset()`** static method resets counter used with console.count().
  158     *
  159     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
  160     */
  161    countReset(label?: string): void;
  162    /**
  163     * The **`console.debug()`** static method outputs a message to the console at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output. In most cases, the log level is configured within the console UI. This log level might correspond to the Debug or Verbose log level.
  164     *
  165     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
  166     */
  167    debug(...data: any[]): void;
  168    /**
  169     * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. In browser consoles, the output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.
  170     *
  171     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
  172     */
  173    dir(item?: any, options?: any): void;
  174    /**
  175     * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes.
  176     *
  177     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
  178     */
  179    dirxml(...data: any[]): void;
  180    /**
  181     * The **`console.error()`** static method outputs a message to the console at the "error" log level. The message is only displayed to the user if the console is configured to display error output. In most cases, the log level is configured within the console UI. The message may be formatted as an error, with red colors and call stack information.
  182     *
  183     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
  184     */
  185    error(...data: any[]): void;
  186    /**
  187     * 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() is called.
  188     *
  189     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
  190     */
  191    group(...data: any[]): void;
  192    /**
  193     * The **`console.groupCollapsed()`** static method creates a new inline group in the console. Unlike console.group(), however, the new group is created collapsed. The user will need to use the disclosure button next to it to expand it, revealing the entries created in the group.
  194     *
  195     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
  196     */
  197    groupCollapsed(...data: any[]): void;
  198    /**
  199     * The **`console.groupEnd()`** static method exits the current inline group in the console. See Using groups in the console in the console documentation for details and examples.
  200     *
  201     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
  202     */
  203    groupEnd(): void;
  204    /**
  205     * The **`console.info()`** static method outputs a message to the console at the "info" log level. The message is only displayed to the user if the console is configured to display info output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as a small "i" icon next to it.
  206     *
  207     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
  208     */
  209    info(...data: any[]): void;
  210    /**
  211     * The **`console.log()`** static method outputs a message to the console.
  212     *
  213     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
  214     */
  215    log(...data: any[]): void;
  216    /**
  217     * The **`console.table()`** static method displays tabular data as a table.
  218     *
  219     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)
  220     */
  221    table(tabularData?: any, properties?: string[]): void;
  222    /**
  223     * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started.
  224     *
  225     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
  226     */
  227    time(label?: string): void;
  228    /**
  229     * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
  230     *
  231     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
  232     */
  233    timeEnd(label?: string): void;
  234    /**
  235     * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
  236     *
  237     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
  238     */
  239    timeLog(label?: string, ...data: any[]): void;
  240    /* The **`console.timeStamp()`** static method adds a single marker to the browser's Performance tool (Firefox bug 1387528, Chrome). This lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. */
  241    timeStamp(label?: string): void;
  242    /**
  243     * The **`console.trace()`** static method outputs a stack trace to the console.
  244     *
  245     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
  246     */
  247    trace(...data: any[]): void;
  248    /**
  249     * The **`console.warn()`** static method outputs a warning message to the console at the "warning" log level. The message is only displayed to the user if the console is configured to display warning output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as yellow colors and a warning icon.
  250     *
  251     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
  252     */
  253    warn(...data: any[]): void;
  254}
  255declare const console: Console;
  256type BufferSource = ArrayBufferView | ArrayBuffer;
  257type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
  258declare namespace WebAssembly {
  259    class CompileError extends Error {
  260        constructor(message?: string);
  261    }
  262    class RuntimeError extends Error {
  263        constructor(message?: string);
  264    }
  265    type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";
  266    interface GlobalDescriptor {
  267        value: ValueType;
  268        mutable?: boolean;
  269    }
  270    class Global {
  271        constructor(descriptor: GlobalDescriptor, value?: any);
  272        value: any;
  273        valueOf(): any;
  274    }
  275    type ImportValue = ExportValue | number;
  276    type ModuleImports = Record<string, ImportValue>;
  277    type Imports = Record<string, ModuleImports>;
  278    type ExportValue = Function | Global | Memory | Table;
  279    type Exports = Record<string, ExportValue>;
  280    class Instance {
  281        constructor(module: Module, imports?: Imports);
  282        readonly exports: Exports;
  283    }
  284    interface MemoryDescriptor {
  285        initial: number;
  286        maximum?: number;
  287        shared?: boolean;
  288    }
  289    class Memory {
  290        constructor(descriptor: MemoryDescriptor);
  291        readonly buffer: ArrayBuffer;
  292        grow(delta: number): number;
  293    }
  294    type ImportExportKind = "function" | "global" | "memory" | "table";
  295    interface ModuleExportDescriptor {
  296        kind: ImportExportKind;
  297        name: string;
  298    }
  299    interface ModuleImportDescriptor {
  300        kind: ImportExportKind;
  301        module: string;
  302        name: string;
  303    }
  304    abstract class Module {
  305        static customSections(module: Module, sectionName: string): ArrayBuffer[];
  306        static exports(module: Module): ModuleExportDescriptor[];
  307        static imports(module: Module): ModuleImportDescriptor[];
  308    }
  309    type TableKind = "anyfunc" | "externref";
  310    interface TableDescriptor {
  311        element: TableKind;
  312        initial: number;
  313        maximum?: number;
  314    }
  315    class Table {
  316        constructor(descriptor: TableDescriptor, value?: any);
  317        readonly length: number;
  318        get(index: number): any;
  319        grow(delta: number, value?: any): number;
  320        set(index: number, value?: any): void;
  321    }
  322    function instantiate(module: Module, imports?: Imports): Promise<Instance>;
  323    function validate(bytes: BufferSource): boolean;
  324}
  325/**
  326 * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.
  327 * Available only in secure contexts.
  328 *
  329 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
  330 */
  331interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
  332    DOMException: typeof DOMException;
  333    WorkerGlobalScope: typeof WorkerGlobalScope;
  334    btoa(data: string): string;
  335    atob(data: string): string;
  336    setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
  337    setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
  338    clearTimeout(timeoutId: number | null): void;
  339    setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
  340    setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
  341    clearInterval(timeoutId: number | null): void;
  342    queueMicrotask(task: Function): void;
  343    structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
  344    reportError(error: any): void;
  345    fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
  346    self: ServiceWorkerGlobalScope;
  347    crypto: Crypto;
  348    caches: CacheStorage;
  349    scheduler: Scheduler;
  350    performance: Performance;
  351    Cloudflare: Cloudflare;
  352    readonly origin: string;
  353    Event: typeof Event;
  354    ExtendableEvent: typeof ExtendableEvent;
  355    CustomEvent: typeof CustomEvent;
  356    PromiseRejectionEvent: typeof PromiseRejectionEvent;
  357    FetchEvent: typeof FetchEvent;
  358    TailEvent: typeof TailEvent;
  359    TraceEvent: typeof TailEvent;
  360    ScheduledEvent: typeof ScheduledEvent;
  361    MessageEvent: typeof MessageEvent;
  362    CloseEvent: typeof CloseEvent;
  363    ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
  364    ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
  365    ReadableStream: typeof ReadableStream;
  366    WritableStream: typeof WritableStream;
  367    WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
  368    TransformStream: typeof TransformStream;
  369    ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
  370    CountQueuingStrategy: typeof CountQueuingStrategy;
  371    ErrorEvent: typeof ErrorEvent;
  372    MessageChannel: typeof MessageChannel;
  373    MessagePort: typeof MessagePort;
  374    EventSource: typeof EventSource;
  375    ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
  376    ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
  377    ReadableByteStreamController: typeof ReadableByteStreamController;
  378    WritableStreamDefaultController: typeof WritableStreamDefaultController;
  379    TransformStreamDefaultController: typeof TransformStreamDefaultController;
  380    CompressionStream: typeof CompressionStream;
  381    DecompressionStream: typeof DecompressionStream;
  382    TextEncoderStream: typeof TextEncoderStream;
  383    TextDecoderStream: typeof TextDecoderStream;
  384    Headers: typeof Headers;
  385    Body: typeof Body;
  386    Request: typeof Request;
  387    Response: typeof Response;
  388    WebSocket: typeof WebSocket;
  389    WebSocketPair: typeof WebSocketPair;
  390    WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
  391    AbortController: typeof AbortController;
  392    AbortSignal: typeof AbortSignal;
  393    TextDecoder: typeof TextDecoder;
  394    TextEncoder: typeof TextEncoder;
  395    navigator: Navigator;
  396    Navigator: typeof Navigator;
  397    URL: typeof URL;
  398    URLSearchParams: typeof URLSearchParams;
  399    URLPattern: typeof URLPattern;
  400    Blob: typeof Blob;
  401    File: typeof File;
  402    FormData: typeof FormData;
  403    Crypto: typeof Crypto;
  404    SubtleCrypto: typeof SubtleCrypto;
  405    CryptoKey: typeof CryptoKey;
  406    CacheStorage: typeof CacheStorage;
  407    Cache: typeof Cache;
  408    FixedLengthStream: typeof FixedLengthStream;
  409    IdentityTransformStream: typeof IdentityTransformStream;
  410    HTMLRewriter: typeof HTMLRewriter;
  411}
  412declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
  413declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
  414/**
  415 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
  416 *
  417 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
  418 */
  419declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
  420/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
  421declare function btoa(data: string): string;
  422/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
  423declare function atob(data: string): string;
  424/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
  425declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
  426/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
  427declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
  428/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
  429declare function clearTimeout(timeoutId: number | null): void;
  430/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
  431declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
  432/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
  433declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
  434/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
  435declare function clearInterval(timeoutId: number | null): void;
  436/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
  437declare function queueMicrotask(task: Function): void;
  438/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
  439declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
  440/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
  441declare function reportError(error: any): void;
  442/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
  443declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
  444declare const self: ServiceWorkerGlobalScope;
  445/**
  446* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
  447* The Workers runtime implements the full surface of this API, but with some differences in
  448* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
  449* compared to those implemented in most browsers.
  450*
  451* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
  452*/
  453declare const crypto: Crypto;
  454/**
  455* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
  456*
  457* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
  458*/
  459declare const caches: CacheStorage;
  460/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scheduler) */
  461declare const scheduler: Scheduler;
  462/**
  463* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
  464* as well as timing of subrequests and other operations.
  465*
  466* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
  467*/
  468declare const performance: Performance;
  469declare const Cloudflare: Cloudflare;
  470declare const origin: string;
  471declare const navigator: Navigator;
  472interface TestController {
  473}
  474interface ExecutionContext<Props = unknown> {
  475    waitUntil(promise: Promise<any>): void;
  476    passThroughOnException(): void;
  477    readonly exports: Cloudflare.Exports;
  478    readonly props: Props;
  479    cache?: CacheContext;
  480    readonly access?: CloudflareAccessContext;
  481    tracing: Tracing;
  482    abort(reason?: any): void;
  483}
  484type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
  485type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  486type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  487type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  488type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | undefined | Promise<TailStream.TailEventHandlerType | undefined>;
  489type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  490type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  491type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
  492interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {
  493    fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
  494    connect?: ExportedHandlerConnectHandler<Env, Props>;
  495    tail?: ExportedHandlerTailHandler<Env, Props>;
  496    trace?: ExportedHandlerTraceHandler<Env, Props>;
  497    tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
  498    scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
  499    test?: ExportedHandlerTestHandler<Env, Props>;
  500    email?: EmailExportedHandler<Env, Props>;
  501    queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
  502}
  503interface StructuredSerializeOptions {
  504    transfer?: any[];
  505}
  506declare abstract class Navigator {
  507    sendBeacon(url: string, body?: BodyInit): boolean;
  508    readonly userAgent: string;
  509    readonly hardwareConcurrency: number;
  510    readonly platform: string;
  511    readonly language: string;
  512    readonly languages: string[];
  513}
  514interface AlarmInvocationInfo {
  515    readonly isRetry: boolean;
  516    readonly retryCount: number;
  517    readonly scheduledTime: number;
  518}
  519interface Cloudflare {
  520    readonly compatibilityFlags: Record<string, boolean>;
  521}
  522interface CachePurgeError {
  523    code: number;
  524    message: string;
  525}
  526interface CachePurgeResult {
  527    success: boolean;
  528    errors: CachePurgeError[];
  529}
  530interface CachePurgeOptions {
  531    tags?: string[];
  532    pathPrefixes?: string[];
  533    purgeEverything?: boolean;
  534}
  535interface CacheContext {
  536    purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
  537    invalidate(options: CachePurgeOptions): Promise<CachePurgeResult>;
  538}
  539interface CloudflareAccessContext {
  540    readonly aud: string;
  541    getIdentity(): Promise<CloudflareAccessIdentity | undefined>;
  542}
  543declare abstract class ColoLocalActorNamespace {
  544    get(actorId: string): Fetcher;
  545}
  546interface DurableObject {
  547    fetch(request: Request): Response | Promise<Response>;
  548    connect?(socket: Socket): void | Promise<void>;
  549    alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
  550    webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
  551    webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
  552    webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
  553}
  554type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & {
  555    readonly id: DurableObjectId;
  556    readonly name?: string;
  557};
  558interface DurableObjectId {
  559    toString(): string;
  560    equals(other: DurableObjectId): boolean;
  561    readonly name?: string;
  562    readonly jurisdiction?: string;
  563}
  564declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {
  565    newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
  566    idFromName(name: string): DurableObjectId;
  567    idFromString(id: string): DurableObjectId;
  568    get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
  569    getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
  570    jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
  571}
  572type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
  573interface DurableObjectNamespaceNewUniqueIdOptions {
  574    jurisdiction?: DurableObjectJurisdiction;
  575}
  576type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";
  577type DurableObjectRoutingMode = "primary-only";
  578interface DurableObjectNamespaceGetDurableObjectOptions {
  579    locationHint?: DurableObjectLocationHint;
  580    routingMode?: DurableObjectRoutingMode;
  581}
  582interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {
  583}
  584interface DurableObjectState<Props = unknown> {
  585    waitUntil(promise: Promise<any>): void;
  586    readonly exports: Cloudflare.Exports;
  587    readonly props: Props;
  588    readonly id: DurableObjectId;
  589    readonly storage: DurableObjectStorage;
  590    container?: Container;
  591    facets: DurableObjectFacets;
  592    blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
  593    acceptWebSocket(ws: WebSocket, tags?: string[]): void;
  594    getWebSockets(tag?: string): WebSocket[];
  595    setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
  596    getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
  597    getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
  598    setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
  599    getHibernatableWebSocketEventTimeout(): number | null;
  600    getTags(ws: WebSocket): string[];
  601    abort(reason?: string, options?: DurableObjectAbortOptions): void;
  602}
  603interface DurableObjectTransaction {
  604    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
  605    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
  606    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
  607    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
  608    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
  609    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
  610    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
  611    rollback(): void;
  612    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
  613    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
  614    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
  615}
  616interface DurableObjectStorage {
  617    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
  618    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
  619    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
  620    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
  621    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
  622    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
  623    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
  624    deleteAll(options?: DurableObjectPutOptions): Promise<void>;
  625    transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
  626    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
  627    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
  628    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
  629    sync(): Promise<void>;
  630    sql: SqlStorage;
  631    kv: SyncKvStorage;
  632    transactionSync<T>(closure: () => T): T;
  633    getCurrentBookmark(): Promise<string>;
  634    getBookmarkForTime(timestamp: number | Date): Promise<string>;
  635    onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
  636}
  637interface DurableObjectAbortOptions {
  638    retryAlarm?: boolean;
  639}
  640interface DurableObjectListOptions {
  641    start?: string;
  642    startAfter?: string;
  643    end?: string;
  644    prefix?: string;
  645    reverse?: boolean;
  646    limit?: number;
  647    allowConcurrency?: boolean;
  648    noCache?: boolean;
  649}
  650interface DurableObjectGetOptions {
  651    allowConcurrency?: boolean;
  652    noCache?: boolean;
  653}
  654interface DurableObjectGetAlarmOptions {
  655    allowConcurrency?: boolean;
  656}
  657interface DurableObjectPutOptions {
  658    allowConcurrency?: boolean;
  659    allowUnconfirmed?: boolean;
  660    noCache?: boolean;
  661}
  662interface DurableObjectSetAlarmOptions {
  663    allowConcurrency?: boolean;
  664    allowUnconfirmed?: boolean;
  665}
  666declare class WebSocketRequestResponsePair {
  667    constructor(request: string, response: string);
  668    get request(): string;
  669    get response(): string;
  670}
  671interface DurableObjectFacets {
  672    get<T extends Rpc.DurableObjectBranded | undefined = undefined>(name: string, getStartupOptions: () => FacetStartupOptions<T> | Promise<FacetStartupOptions<T>>): Fetcher<T>;
  673    abort(name: string, reason: any): void;
  674    delete(name: string): void;
  675    clone(src: string, dst: string): void;
  676}
  677interface FacetStartupOptions<T extends Rpc.DurableObjectBranded | undefined = undefined> {
  678    id?: DurableObjectId | string;
  679    class: DurableObjectClass<T>;
  680}
  681interface AnalyticsEngineDataset {
  682    writeDataPoint(event?: AnalyticsEngineDataPoint): void;
  683}
  684interface AnalyticsEngineDataPoint {
  685    indexes?: ((ArrayBuffer | string) | null)[];
  686    doubles?: number[];
  687    blobs?: ((ArrayBuffer | string) | null)[];
  688}
  689/**
  690 * The **`Event`** interface represents an event which takes place on an EventTarget.
  691 *
  692 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
  693 */
  694declare class Event {
  695    constructor(type: string, init?: EventInit);
  696    /**
  697     * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error.
  698     *
  699     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
  700     */
  701    get type(): string;
  702    /**
  703     * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
  704     *
  705     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
  706     */
  707    get eventPhase(): number;
  708    /**
  709     * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.
  710     *
  711     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
  712     */
  713    get composed(): boolean;
  714    /**
  715     * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
  716     *
  717     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
  718     */
  719    get bubbles(): boolean;
  720    /**
  721     * 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.
  722     *
  723     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
  724     */
  725    get cancelable(): boolean;
  726    /**
  727     * 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.
  728     *
  729     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
  730     */
  731    get defaultPrevented(): boolean;
  732    /**
  733     * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
  734     * @deprecated
  735     *
  736     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
  737     */
  738    get returnValue(): boolean;
  739    /**
  740     * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
  741     *
  742     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
  743     */
  744    get currentTarget(): EventTarget | undefined;
  745    /**
  746     * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.
  747     *
  748     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
  749     */
  750    get target(): EventTarget | undefined;
  751    /**
  752     * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
  753     * @deprecated
  754     *
  755     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
  756     */
  757    get srcElement(): EventTarget | undefined;
  758    /**
  759     * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
  760     *
  761     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
  762     */
  763    get timeStamp(): number;
  764    /**
  765     * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true 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 EventTarget.dispatchEvent(). The only exception is the click event, which initializes the isTrusted property to false in user agents.
  766     *
  767     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
  768     */
  769    get isTrusted(): boolean;
  770    /**
  771     * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.
  772     * @deprecated
  773     *
  774     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
  775     */
  776    get cancelBubble(): boolean;
  777    /**
  778     * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.
  779     * @deprecated
  780     *
  781     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
  782     */
  783    set cancelBubble(value: boolean);
  784    /**
  785     * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
  786     *
  787     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
  788     */
  789    stopImmediatePropagation(): void;
  790    /**
  791     * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken.
  792     *
  793     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
  794     */
  795    preventDefault(): void;
  796    /**
  797     * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation().
  798     *
  799     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
  800     */
  801    stopPropagation(): void;
  802    /**
  803     * 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. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed.
  804     *
  805     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
  806     */
  807    composedPath(): EventTarget[];
  808    static readonly NONE: number;
  809    static readonly CAPTURING_PHASE: number;
  810    static readonly AT_TARGET: number;
  811    static readonly BUBBLING_PHASE: number;
  812}
  813interface EventInit {
  814    bubbles?: boolean;
  815    cancelable?: boolean;
  816    composed?: boolean;
  817}
  818type EventListener<EventType extends Event = Event> = (event: EventType) => void;
  819interface EventListenerObject<EventType extends Event = Event> {
  820    handleEvent(event: EventType): void;
  821}
  822type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
  823/**
  824 * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.
  825 *
  826 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
  827 */
  828declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {
  829    constructor();
  830    /**
  831     * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
  832     *
  833     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
  834     */
  835    addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
  836    /**
  837     * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
  838     *
  839     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
  840     */
  841    removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
  842    /**
  843     * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
  844     *
  845     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
  846     */
  847    dispatchEvent(event: EventMap[keyof EventMap]): boolean;
  848}
  849interface EventTargetEventListenerOptions {
  850    capture?: boolean;
  851}
  852interface EventTargetAddEventListenerOptions {
  853    capture?: boolean;
  854    passive?: boolean;
  855    once?: boolean;
  856    signal?: AbortSignal;
  857}
  858interface EventTargetHandlerObject {
  859    handleEvent: (event: Event) => any | undefined;
  860}
  861/**
  862 * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
  863 *
  864 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
  865 */
  866declare class AbortController {
  867    constructor();
  868    /**
  869     * 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.
  870     *
  871     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
  872     */
  873    get signal(): AbortSignal;
  874    /**
  875     * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.
  876     *
  877     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
  878     */
  879    abort(reason?: any): void;
  880}
  881/**
  882 * 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.
  883 *
  884 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
  885 */
  886declare abstract class AbortSignal extends EventTarget {
  887    /**
  888     * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).
  889     *
  890     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
  891     */
  892    static abort(reason?: any): AbortSignal;
  893    /**
  894     * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.
  895     *
  896     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)
  897     */
  898    static timeout(delay: number): AbortSignal;
  899    /**
  900     * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. The returned abort signal is aborted when any of the input iterable abort signals are aborted. The abort reason will be set to the reason of the first signal that is aborted. If any of the given abort signals are already aborted then so will be the returned AbortSignal.
  901     *
  902     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
  903     */
  904    static any(signals: AbortSignal[]): AbortSignal;
  905    /**
  906     * 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).
  907     *
  908     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
  909     */
  910    get aborted(): boolean;
  911    /**
  912     * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
  913     *
  914     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
  915     */
  916    get reason(): any;
  917    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
  918    get onabort(): any | null;
  919    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
  920    set onabort(value: any | null);
  921    /**
  922     * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.
  923     *
  924     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
  925     */
  926    throwIfAborted(): void;
  927}
  928/**
  929 * The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks.
  930 *
  931 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler)
  932 */
  933interface Scheduler {
  934    wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
  935}
  936interface SchedulerWaitOptions {
  937    signal?: AbortSignal;
  938}
  939/**
  940 * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
  941 *
  942 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
  943 */
  944declare abstract class ExtendableEvent extends Event {
  945    /**
  946     * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
  947     *
  948     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
  949     */
  950    waitUntil(promise: Promise<any>): void;
  951}
  952/**
  953 * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
  954 *
  955 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
  956 */
  957declare class CustomEvent<T = any> extends Event {
  958    constructor(type: string, init?: CustomEventCustomEventInit);
  959    /**
  960     * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
  961     *
  962     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
  963     */
  964    get detail(): T;
  965}
  966interface CustomEventCustomEventInit {
  967    bubbles?: boolean;
  968    cancelable?: boolean;
  969    composed?: boolean;
  970    detail?: any;
  971}
  972/**
  973 * 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.
  974 *
  975 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
  976 */
  977declare class Blob {
  978    constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
  979    /**
  980     * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.
  981     *
  982     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)
  983     */
  984    get size(): number;
  985    /**
  986     * The **`type`** read-only property of the Blob interface returns the MIME type of the file.
  987     *
  988     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)
  989     */
  990    get type(): string;
  991    /**
  992     * 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.
  993     *
  994     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)
  995     */
  996    slice(start?: number, end?: number, type?: string): Blob;
  997    /**
  998     * 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.
  999     *
 1000     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)
 1001     */
 1002    arrayBuffer(): Promise<ArrayBuffer>;
 1003    /**
 1004     * 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.
 1005     *
 1006     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)
 1007     */
 1008    bytes(): Promise<Uint8Array>;
 1009    /**
 1010     * The **`text()`** method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.
 1011     *
 1012     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
 1013     */
 1014    text(): Promise<string>;
 1015    /**
 1016     * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.
 1017     *
 1018     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)
 1019     */
 1020    stream(): ReadableStream;
 1021}
 1022interface BlobOptions {
 1023    type?: string;
 1024}
 1025/**
 1026 * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.
 1027 *
 1028 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
 1029 */
 1030declare class File extends Blob {
 1031    constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);
 1032    /**
 1033     * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property.
 1034     *
 1035     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
 1036     */
 1037    get name(): string;
 1038    /**
 1039     * 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). Files without a known last modified date return the current date.
 1040     *
 1041     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
 1042     */
 1043    get lastModified(): number;
 1044}
 1045interface FileOptions {
 1046    type?: string;
 1047    lastModified?: number;
 1048}
 1049/**
 1050* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
 1051*
 1052* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
 1053*/
 1054declare abstract class CacheStorage {
 1055    /**
 1056     * The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
 1057     *
 1058     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
 1059     */
 1060    open(cacheName: string): Promise<Cache>;
 1061    readonly default: Cache;
 1062}
 1063/**
 1064* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
 1065*
 1066* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
 1067*/
 1068declare abstract class Cache {
 1069    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
 1070    delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;
 1071    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
 1072    match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;
 1073    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
 1074    put(request: RequestInfo | URL, response: Response): Promise<void>;
 1075}
 1076interface CacheQueryOptions {
 1077    ignoreMethod?: boolean;
 1078}
 1079/**
 1080* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
 1081* The Workers runtime implements the full surface of this API, but with some differences in
 1082* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
 1083* compared to those implemented in most browsers.
 1084*
 1085* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
 1086*/
 1087declare abstract class Crypto {
 1088    /**
 1089     * The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.
 1090     * Available only in secure contexts.
 1091     *
 1092     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
 1093     */
 1094    get subtle(): SubtleCrypto;
 1095    /**
 1096     * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. The array given as the parameter is filled with random numbers (random in its cryptographic meaning).
 1097     *
 1098     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
 1099     */
 1100    getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;
 1101    /**
 1102     * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.
 1103     * Available only in secure contexts.
 1104     *
 1105     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
 1106     */
 1107    randomUUID(): string;
 1108    DigestStream: typeof DigestStream;
 1109}
 1110/**
 1111 * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.
 1112 * Available only in secure contexts.
 1113 *
 1114 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
 1115 */
 1116declare abstract class SubtleCrypto {
 1117    /**
 1118     * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.
 1119     *
 1120     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)
 1121     */
 1122    encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
 1123    /**
 1124     * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. It takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). It returns a Promise which will be fulfilled with the decrypted data (also known as "plaintext").
 1125     *
 1126     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
 1127     */
 1128    decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
 1129    /**
 1130     * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.
 1131     *
 1132     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)
 1133     */
 1134    sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
 1135    /**
 1136     * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.
 1137     *
 1138     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)
 1139     */
 1140    verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
 1141    /**
 1142     * The **`digest()`** method of the SubtleCrypto interface generates a digest of the given data, using the specified hash function. A digest is a short fixed-length value derived from some variable-length input. Cryptographic digests should exhibit collision-resistance, meaning that it's hard to come up with two different inputs that have the same digest value.
 1143     *
 1144     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
 1145     */
 1146    digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
 1147    /**
 1148     * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).
 1149     *
 1150     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)
 1151     */
 1152    generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
 1153    /**
 1154     * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.
 1155     *
 1156     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)
 1157     */
 1158    deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
 1159    /**
 1160     * The **`deriveBits()`** method of the SubtleCrypto interface can be used to derive an array of bits from a base key.
 1161     *
 1162     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
 1163     */
 1164    deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;
 1165    /**
 1166     * 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.
 1167     *
 1168     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)
 1169     */
 1170    importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
 1171    /**
 1172     * 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.
 1173     *
 1174     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)
 1175     */
 1176    exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
 1177    /**
 1178     * The **`wrapKey()`** method of the SubtleCrypto interface "wraps" a key. This means that it exports the key in an external, portable format, then encrypts the exported key. Wrapping a key helps protect it in untrusted environments, such as inside an otherwise unprotected data store or in transmission over an unprotected network.
 1179     *
 1180     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
 1181     */
 1182    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
 1183    /**
 1184     * The **`unwrapKey()`** method of the SubtleCrypto interface "unwraps" a key. This means that it takes as its input a key that has been exported and then encrypted (also called "wrapped"). It decrypts the key and then imports it, returning a CryptoKey object that can be used in the Web Crypto API.
 1185     *
 1186     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
 1187     */
 1188    unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
 1189    timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;
 1190}
 1191/**
 1192 * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), importKey(), or unwrapKey().
 1193 * Available only in secure contexts.
 1194 *
 1195 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
 1196 */
 1197declare abstract class CryptoKey {
 1198    /**
 1199     * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. It can have the following values:
 1200     *
 1201     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
 1202     */
 1203    readonly type: string;
 1204    /**
 1205     * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey().
 1206     *
 1207     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)
 1208     */
 1209    readonly extractable: boolean;
 1210    /**
 1211     * 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.
 1212     *
 1213     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)
 1214     */
 1215    readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;
 1216    /**
 1217     * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.
 1218     *
 1219     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)
 1220     */
 1221    readonly usages: string[];
 1222}
 1223interface CryptoKeyPair {
 1224    publicKey: CryptoKey;
 1225    privateKey: CryptoKey;
 1226}
 1227interface JsonWebKey {
 1228    kty: string;
 1229    use?: string;
 1230    key_ops?: string[];
 1231    alg?: string;
 1232    ext?: boolean;
 1233    crv?: string;
 1234    x?: string;
 1235    y?: string;
 1236    d?: string;
 1237    n?: string;
 1238    e?: string;
 1239    p?: string;
 1240    q?: string;
 1241    dp?: string;
 1242    dq?: string;
 1243    qi?: string;
 1244    oth?: RsaOtherPrimesInfo[];
 1245    k?: string;
 1246    pub?: string;
 1247    priv?: string;
 1248}
 1249interface RsaOtherPrimesInfo {
 1250    r?: string;
 1251    d?: string;
 1252    t?: string;
 1253}
 1254interface SubtleCryptoDeriveKeyAlgorithm {
 1255    name: string;
 1256    salt?: (ArrayBuffer | ArrayBufferView);
 1257    iterations?: number;
 1258    hash?: (string | SubtleCryptoHashAlgorithm);
 1259    $public?: CryptoKey;
 1260    info?: (ArrayBuffer | ArrayBufferView);
 1261}
 1262interface SubtleCryptoEncryptAlgorithm {
 1263    name: string;
 1264    iv?: (ArrayBuffer | ArrayBufferView);
 1265    additionalData?: (ArrayBuffer | ArrayBufferView);
 1266    tagLength?: number;
 1267    counter?: (ArrayBuffer | ArrayBufferView);
 1268    length?: number;
 1269    label?: (ArrayBuffer | ArrayBufferView);
 1270}
 1271interface SubtleCryptoGenerateKeyAlgorithm {
 1272    name: string;
 1273    hash?: (string | SubtleCryptoHashAlgorithm);
 1274    modulusLength?: number;
 1275    publicExponent?: (ArrayBuffer | ArrayBufferView);
 1276    length?: number;
 1277    namedCurve?: string;
 1278}
 1279interface SubtleCryptoHashAlgorithm {
 1280    name: string;
 1281}
 1282interface SubtleCryptoImportKeyAlgorithm {
 1283    name: string;
 1284    hash?: (string | SubtleCryptoHashAlgorithm);
 1285    length?: number;
 1286    namedCurve?: string;
 1287    compressed?: boolean;
 1288}
 1289interface SubtleCryptoSignAlgorithm {
 1290    name: string;
 1291    hash?: (string | SubtleCryptoHashAlgorithm);
 1292    dataLength?: number;
 1293    saltLength?: number;
 1294    context?: ArrayBuffer | ArrayBufferView;
 1295}
 1296interface CryptoKeyKeyAlgorithm {
 1297    name: string;
 1298}
 1299interface CryptoKeyAesKeyAlgorithm {
 1300    name: string;
 1301    length: number;
 1302}
 1303interface CryptoKeyHmacKeyAlgorithm {
 1304    name: string;
 1305    hash: CryptoKeyKeyAlgorithm;
 1306    length: number;
 1307}
 1308interface CryptoKeyRsaKeyAlgorithm {
 1309    name: string;
 1310    modulusLength: number;
 1311    publicExponent: ArrayBuffer | ArrayBufferView;
 1312    hash?: CryptoKeyKeyAlgorithm;
 1313}
 1314interface CryptoKeyEllipticKeyAlgorithm {
 1315    name: string;
 1316    namedCurve: string;
 1317}
 1318interface CryptoKeyArbitraryKeyAlgorithm {
 1319    name: string;
 1320    hash?: CryptoKeyKeyAlgorithm;
 1321    namedCurve?: string;
 1322    length?: number;
 1323}
 1324declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
 1325    constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
 1326    readonly digest: Promise<ArrayBuffer>;
 1327    get bytesWritten(): number | bigint;
 1328}
 1329interface DigestStreamOptions {
 1330    toWellFormed?: boolean;
 1331}
 1332/**
 1333 * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.
 1334 *
 1335 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
 1336 */
 1337declare class TextDecoder {
 1338    constructor(label?: string, options?: TextDecoderConstructorOptions);
 1339    /**
 1340     * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.
 1341     *
 1342     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
 1343     */
 1344    decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;
 1345    get encoding(): string;
 1346    get fatal(): boolean;
 1347    get ignoreBOM(): boolean;
 1348}
 1349/**
 1350 * The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.
 1351 *
 1352 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
 1353 */
 1354declare class TextEncoder {
 1355    constructor();
 1356    /**
 1357     * The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.
 1358     *
 1359     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
 1360     */
 1361    encode(input?: string): Uint8Array;
 1362    /**
 1363     * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns an object indicating the progress of the encoding. This is potentially more performant than the encode() method — especially when the target buffer is a view into a Wasm heap.
 1364     *
 1365     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
 1366     */
 1367    encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
 1368    get encoding(): string;
 1369}
 1370interface TextDecoderConstructorOptions {
 1371    fatal: boolean;
 1372    ignoreBOM: boolean;
 1373}
 1374interface TextDecoderDecodeOptions {
 1375    stream: boolean;
 1376}
 1377interface TextEncoderEncodeIntoResult {
 1378    read: number;
 1379    written: number;
 1380}
 1381/**
 1382 * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
 1383 *
 1384 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
 1385 */
 1386declare class ErrorEvent extends Event {
 1387    constructor(type: string, init?: ErrorEventErrorEventInit);
 1388    /**
 1389     * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.
 1390     *
 1391     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)
 1392     */
 1393    get filename(): string;
 1394    /**
 1395     * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.
 1396     *
 1397     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)
 1398     */
 1399    get message(): string;
 1400    /**
 1401     * 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.
 1402     *
 1403     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)
 1404     */
 1405    get lineno(): number;
 1406    /**
 1407     * 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.
 1408     *
 1409     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)
 1410     */
 1411    get colno(): number;
 1412    /**
 1413     * 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.
 1414     *
 1415     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)
 1416     */
 1417    get error(): any;
 1418}
 1419interface ErrorEventErrorEventInit {
 1420    bubbles?: boolean;
 1421    cancelable?: boolean;
 1422    composed?: boolean;
 1423    message?: string;
 1424    filename?: string;
 1425    lineno?: number;
 1426    colno?: number;
 1427    error?: any;
 1428}
 1429/**
 1430 * The **`MessageEvent`** interface represents a message received by a target object.
 1431 *
 1432 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
 1433 */
 1434declare class MessageEvent extends Event {
 1435    constructor(type: string, initializer?: MessageEventInit);
 1436    /**
 1437     * The **`data`** read-only property of the MessageEvent interface represents the data sent by the message emitter.
 1438     *
 1439     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
 1440     */
 1441    readonly data: any;
 1442    /**
 1443     * The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.
 1444     *
 1445     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
 1446     */
 1447    readonly origin: string | null;
 1448    /**
 1449     * The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.
 1450     *
 1451     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
 1452     */
 1453    readonly lastEventId: string;
 1454    /**
 1455     * The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
 1456     *
 1457     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
 1458     */
 1459    readonly source: MessagePort | null;
 1460    /**
 1461     * The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
 1462     *
 1463     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
 1464     */
 1465    readonly ports: MessagePort[];
 1466}
 1467interface MessageEventInit {
 1468    bubbles?: boolean;
 1469    cancelable?: boolean;
 1470    composed?: boolean;
 1471    data?: any;
 1472    origin?: string;
 1473    lastEventId?: string;
 1474    source?: (MessagePort | null);
 1475    ports?: MessagePort[];
 1476}
 1477/**
 1478 * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes.
 1479 *
 1480 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
 1481 */
 1482declare abstract class PromiseRejectionEvent extends Event {
 1483    /**
 1484     * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.
 1485     *
 1486     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
 1487     */
 1488    readonly promise: Promise<any>;
 1489    /**
 1490     * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
 1491     *
 1492     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
 1493     */
 1494    readonly reason: any;
 1495}
 1496/**
 1497 * 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 fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
 1498 *
 1499 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
 1500 */
 1501declare class FormData {
 1502    constructor();
 1503    /**
 1504     * 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.
 1505     *
 1506     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
 1507     */
 1508    append(name: string, value: string | Blob): void;
 1509    /**
 1510     * 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.
 1511     *
 1512     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
 1513     */
 1514    append(name: string, value: string): void;
 1515    /**
 1516     * 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.
 1517     *
 1518     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
 1519     */
 1520    append(name: string, value: Blob, filename?: string): void;
 1521    /**
 1522     * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a FormData object.
 1523     *
 1524     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)
 1525     */
 1526    delete(name: string): void;
 1527    /**
 1528     * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead.
 1529     *
 1530     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
 1531     */
 1532    get(name: string): (File | string) | null;
 1533    /**
 1534     * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.
 1535     *
 1536     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
 1537     */
 1538    getAll(name: string): (File | string)[];
 1539    /**
 1540     * The **`has()`** method of the FormData interface returns whether a FormData object contains a certain key.
 1541     *
 1542     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)
 1543     */
 1544    has(name: string): boolean;
 1545    /**
 1546     * 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.
 1547     *
 1548     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
 1549     */
 1550    set(name: string, value: string | Blob): void;
 1551    /**
 1552     * 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.
 1553     *
 1554     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
 1555     */
 1556    set(name: string, value: string): void;
 1557    /**
 1558     * 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.
 1559     *
 1560     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
 1561     */
 1562    set(name: string, value: Blob, filename?: string): void;
 1563    entries(): IterableIterator<[
 1564        key: string,
 1565        value: File | string
 1566    ]>;
 1567    keys(): IterableIterator<string>;
 1568    values(): IterableIterator<(File | string)>;
 1569    forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
 1570    [Symbol.iterator](): IterableIterator<[
 1571        key: string,
 1572        value: File | string
 1573    ]>;
 1574}
 1575interface ContentOptions {
 1576    html?: boolean;
 1577}
 1578declare class HTMLRewriter {
 1579    constructor();
 1580    on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
 1581    onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
 1582    transform(response: Response): Response;
 1583}
 1584interface HTMLRewriterElementContentHandlers {
 1585    element?(element: Element): void | Promise<void>;
 1586    comments?(comment: Comment): void | Promise<void>;
 1587    text?(element: Text): void | Promise<void>;
 1588}
 1589interface HTMLRewriterDocumentContentHandlers {
 1590    doctype?(doctype: Doctype): void | Promise<void>;
 1591    comments?(comment: Comment): void | Promise<void>;
 1592    text?(text: Text): void | Promise<void>;
 1593    end?(end: DocumentEnd): void | Promise<void>;
 1594}
 1595interface Doctype {
 1596    readonly name: string | null;
 1597    readonly publicId: string | null;
 1598    readonly systemId: string | null;
 1599}
 1600interface Element {
 1601    tagName: string;
 1602    readonly attributes: IterableIterator<string[]>;
 1603    readonly removed: boolean;
 1604    readonly namespaceURI: string;
 1605    getAttribute(name: string): string | null;
 1606    hasAttribute(name: string): boolean;
 1607    setAttribute(name: string, value: string): Element;
 1608    removeAttribute(name: string): Element;
 1609    before(content: string | ReadableStream | Response, options?: ContentOptions): Element;
 1610    after(content: string | ReadableStream | Response, options?: ContentOptions): Element;
 1611    prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;
 1612    append(content: string | ReadableStream | Response, options?: ContentOptions): Element;
 1613    replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;
 1614    remove(): Element;
 1615    removeAndKeepContent(): Element;
 1616    setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;
 1617    onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
 1618}
 1619interface EndTag {
 1620    name: string;
 1621    before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
 1622    after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
 1623    remove(): EndTag;
 1624}
 1625interface Comment {
 1626    text: string;
 1627    readonly removed: boolean;
 1628    before(content: string, options?: ContentOptions): Comment;
 1629    after(content: string, options?: ContentOptions): Comment;
 1630    replace(content: string, options?: ContentOptions): Comment;
 1631    remove(): Comment;
 1632}
 1633interface Text {
 1634    readonly text: string;
 1635    readonly lastInTextNode: boolean;
 1636    readonly removed: boolean;
 1637    before(content: string | ReadableStream | Response, options?: ContentOptions): Text;
 1638    after(content: string | ReadableStream | Response, options?: ContentOptions): Text;
 1639    replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;
 1640    remove(): Text;
 1641}
 1642interface DocumentEnd {
 1643    append(content: string, options?: ContentOptions): DocumentEnd;
 1644}
 1645/**
 1646 * This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
 1647 *
 1648 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
 1649 */
 1650declare abstract class FetchEvent extends ExtendableEvent {
 1651    /**
 1652     * The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.
 1653     *
 1654     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
 1655     */
 1656    readonly request: Request;
 1657    /**
 1658     * The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.
 1659     *
 1660     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
 1661     */
 1662    respondWith(promise: Response | Promise<Response>): void;
 1663    passThroughOnException(): void;
 1664}
 1665type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
 1666/**
 1667 * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.
 1668 *
 1669 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
 1670 */
 1671declare class Headers {
 1672    constructor(init?: HeadersInit);
 1673    /**
 1674     * 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. If the requested header doesn't exist in the Headers object, it returns null.
 1675     *
 1676     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
 1677     */
 1678    get(name: string): string | null;
 1679    getAll(name: string): string[];
 1680    /**
 1681     * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. This allows Headers objects to handle having multiple Set-Cookie headers, which wasn't possible prior to its implementation.
 1682     *
 1683     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
 1684     */
 1685    getSetCookie(): string[];
 1686    /**
 1687     * The **`has()`** method of the Headers interface returns a boolean stating whether a Headers object contains a certain header.
 1688     *
 1689     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)
 1690     */
 1691    has(name: string): boolean;
 1692    /**
 1693     * 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.
 1694     *
 1695     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)
 1696     */
 1697    set(name: string, value: string): void;
 1698    /**
 1699     * 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.
 1700     *
 1701     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)
 1702     */
 1703    append(name: string, value: string): void;
 1704    /**
 1705     * The **`delete()`** method of the Headers interface deletes a header from the current Headers object.
 1706     *
 1707     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)
 1708     */
 1709    delete(name: string): void;
 1710    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
 1711    entries(): IterableIterator<[
 1712        key: string,
 1713        value: string
 1714    ]>;
 1715    keys(): IterableIterator<string>;
 1716    values(): IterableIterator<string>;
 1717    [Symbol.iterator](): IterableIterator<[
 1718        key: string,
 1719        value: string
 1720    ]>;
 1721}
 1722type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
 1723declare abstract class Body {
 1724    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
 1725    get body(): ReadableStream | null;
 1726    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
 1727    get bodyUsed(): boolean;
 1728    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
 1729    arrayBuffer(): Promise<ArrayBuffer>;
 1730    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
 1731    bytes(): Promise<Uint8Array>;
 1732    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
 1733    text(): Promise<string>;
 1734    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */
 1735    json<T>(): Promise<T>;
 1736    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
 1737    formData(): Promise<FormData>;
 1738    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
 1739    blob(): Promise<Blob>;
 1740}
 1741/**
 1742 * The **`Response`** interface of the Fetch API represents the response to a request.
 1743 *
 1744 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
 1745 */
 1746declare var Response: {
 1747    prototype: Response;
 1748    new (body?: BodyInit | null, init?: ResponseInit): Response;
 1749    error(): Response;
 1750    redirect(url: string, status?: number): Response;
 1751    json(any: any, maybeInit?: (ResponseInit | Response)): Response;
 1752};
 1753/**
 1754 * The **`Response`** interface of the Fetch API represents the response to a request.
 1755 *
 1756 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
 1757 */
 1758interface Response extends Body {
 1759    /**
 1760     * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.
 1761     *
 1762     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)
 1763     */
 1764    clone(): Response;
 1765    /**
 1766     * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.
 1767     *
 1768     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)
 1769     */
 1770    status: number;
 1771    /**
 1772     * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.
 1773     *
 1774     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)
 1775     */
 1776    statusText: string;
 1777    /**
 1778     * The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.
 1779     *
 1780     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
 1781     */
 1782    headers: Headers;
 1783    /**
 1784     * 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.
 1785     *
 1786     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)
 1787     */
 1788    ok: boolean;
 1789    /**
 1790     * 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.
 1791     *
 1792     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)
 1793     */
 1794    redirected: boolean;
 1795    /**
 1796     * The **`url`** read-only property of the Response interface contains the URL of the response. The value of the url property will be the final URL obtained after any redirects.
 1797     *
 1798     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
 1799     */
 1800    url: string;
 1801    webSocket: WebSocket | null;
 1802    cf: any | undefined;
 1803    /**
 1804     * The **`type`** read-only property of the Response interface contains the type of the response. The type determines whether scripts are able to access the response body and headers.
 1805     *
 1806     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
 1807     */
 1808    type: "default" | "error";
 1809}
 1810interface ResponseInit {
 1811    status?: number;
 1812    statusText?: string;
 1813    headers?: HeadersInit;
 1814    cf?: any;
 1815    webSocket?: (WebSocket | null);
 1816    encodeBody?: "automatic" | "manual";
 1817}
 1818type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;
 1819/**
 1820 * The **`Request`** interface of the Fetch API represents a resource request.
 1821 *
 1822 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
 1823 */
 1824declare var Request: {
 1825    prototype: Request;
 1826    new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;
 1827};
 1828/**
 1829 * The **`Request`** interface of the Fetch API represents a resource request.
 1830 *
 1831 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
 1832 */
 1833interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {
 1834    /**
 1835     * The **`clone()`** method of the Request interface creates a copy of the current Request object.
 1836     *
 1837     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)
 1838     */
 1839    clone(): Request<CfHostMetadata, Cf>;
 1840    /**
 1841     * The **`method`** read-only property of the Request interface contains the request's method (GET, POST, etc.)
 1842     *
 1843     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
 1844     */
 1845    method: string;
 1846    /**
 1847     * The **`url`** read-only property of the Request interface contains the URL of the request.
 1848     *
 1849     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
 1850     */
 1851    url: string;
 1852    /**
 1853     * The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.
 1854     *
 1855     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
 1856     */
 1857    headers: Headers;
 1858    /**
 1859     * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.
 1860     *
 1861     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
 1862     */
 1863    redirect: string;
 1864    fetcher: Fetcher | null;
 1865    /**
 1866     * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.
 1867     *
 1868     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
 1869     */
 1870    signal: AbortSignal;
 1871    cf?: Cf;
 1872    /**
 1873     * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.
 1874     *
 1875     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
 1876     */
 1877    integrity: string;
 1878    /**
 1879     * 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.
 1880     *
 1881     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
 1882     */
 1883    keepalive: boolean;
 1884    /**
 1885     * The **`cache`** read-only property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache.
 1886     *
 1887     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
 1888     */
 1889    cache?: "no-store" | "no-cache";
 1890}
 1891interface RequestInit<Cf = CfProperties> {
 1892    /* A string to set request's method. */
 1893    method?: string;
 1894    /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
 1895    headers?: HeadersInit;
 1896    /* A BodyInit object or null to set request's body. */
 1897    body?: BodyInit | null;
 1898    /* 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. */
 1899    redirect?: string;
 1900    fetcher?: (Fetcher | null);
 1901    cf?: Cf;
 1902    /* A string indicating how the request will interact with the browser's cache to set request's cache. */
 1903    cache?: "no-store" | "no-cache";
 1904    /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
 1905    integrity?: string;
 1906    /* An AbortSignal to set request's signal. */
 1907    signal?: (AbortSignal | null);
 1908    encodeResponseBody?: "automatic" | "manual";
 1909}
 1910type 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>;
 1911type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {
 1912    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
 1913    connect(address: SocketAddress | string, options?: SocketOptions): Socket;
 1914};
 1915interface KVNamespaceListKey<Metadata, Key extends string = string> {
 1916    name: Key;
 1917    expiration?: number;
 1918    metadata?: Metadata;
 1919}
 1920type KVNamespaceListResult<Metadata, Key extends string = string> = {
 1921    list_complete: false;
 1922    keys: KVNamespaceListKey<Metadata, Key>[];
 1923    cursor: string;
 1924    cacheStatus: string | null;
 1925} | {
 1926    list_complete: true;
 1927    keys: KVNamespaceListKey<Metadata, Key>[];
 1928    cacheStatus: string | null;
 1929};
 1930interface KVNamespace<Key extends string = string> {
 1931    get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;
 1932    get(key: Key, type: "text"): Promise<string | null>;
 1933    get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;
 1934    get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
 1935    get(key: Key, type: "stream"): Promise<ReadableStream | null>;
 1936    get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>;
 1937    get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;
 1938    get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;
 1939    get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;
 1940    get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;
 1941    get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>;
 1942    get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;
 1943    get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>;
 1944    get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>;
 1945    list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;
 1946    put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;
 1947    getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
 1948    getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
 1949    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
 1950    getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
 1951    getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
 1952    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
 1953    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
 1954    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
 1955    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
 1956    getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
 1957    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;
 1958    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
 1959    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
 1960    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;
 1961    delete(key: Key): Promise<void>;
 1962}
 1963interface KVNamespaceListOptions {
 1964    limit?: number;
 1965    prefix?: (string | null);
 1966    cursor?: (string | null);
 1967}
 1968interface KVNamespaceGetOptions<Type> {
 1969    type: Type;
 1970    cacheTtl?: number;
 1971}
 1972interface KVNamespacePutOptions {
 1973    expiration?: number;
 1974    expirationTtl?: number;
 1975    metadata?: (any | null);
 1976}
 1977interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
 1978    value: Value | null;
 1979    metadata: Metadata | null;
 1980    cacheStatus: string | null;
 1981}
 1982type QueueContentType = "text" | "bytes" | "json" | "v8";
 1983interface Queue<Body = unknown> {
 1984    metrics(): Promise<QueueMetrics>;
 1985    send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;
 1986    sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<QueueSendBatchResponse>;
 1987}
 1988interface QueueSendMetrics {
 1989    backlogCount: number;
 1990    backlogBytes: number;
 1991    oldestMessageTimestamp?: Date;
 1992}
 1993interface QueueSendMetadata {
 1994    metrics: QueueSendMetrics;
 1995}
 1996interface QueueSendResponse {
 1997    metadata: QueueSendMetadata;
 1998}
 1999interface QueueSendBatchMetrics {
 2000    backlogCount: number;
 2001    backlogBytes: number;
 2002    oldestMessageTimestamp?: Date;
 2003}
 2004interface QueueSendBatchMetadata {
 2005    metrics: QueueSendBatchMetrics;
 2006}
 2007interface QueueSendBatchResponse {
 2008    metadata: QueueSendBatchMetadata;
 2009}
 2010interface QueueSendOptions {
 2011    contentType?: QueueContentType;
 2012    delaySeconds?: number;
 2013}
 2014interface QueueSendBatchOptions {
 2015    delaySeconds?: number;
 2016}
 2017interface MessageSendRequest<Body = unknown> {
 2018    body: Body;
 2019    contentType?: QueueContentType;
 2020    delaySeconds?: number;
 2021}
 2022interface QueueMetrics {
 2023    backlogCount: number;
 2024    backlogBytes: number;
 2025    oldestMessageTimestamp?: Date;
 2026}
 2027interface MessageBatchMetrics {
 2028    backlogCount: number;
 2029    backlogBytes: number;
 2030    oldestMessageTimestamp?: Date;
 2031}
 2032interface MessageBatchMetadata {
 2033    metrics: MessageBatchMetrics;
 2034}
 2035interface QueueRetryOptions {
 2036    delaySeconds?: number;
 2037}
 2038interface Message<Body = unknown> {
 2039    readonly id: string;
 2040    readonly timestamp: Date;
 2041    readonly body: Body;
 2042    readonly attempts: number;
 2043    retry(options?: QueueRetryOptions): void;
 2044    ack(): void;
 2045}
 2046interface QueueEvent<Body = unknown> extends ExtendableEvent {
 2047    readonly messages: readonly Message<Body>[];
 2048    readonly queue: string;
 2049    readonly metadata: MessageBatchMetadata;
 2050    retryAll(options?: QueueRetryOptions): void;
 2051    ackAll(): void;
 2052}
 2053interface MessageBatch<Body = unknown> {
 2054    readonly messages: readonly Message<Body>[];
 2055    readonly queue: string;
 2056    readonly metadata: MessageBatchMetadata;
 2057    retryAll(options?: QueueRetryOptions): void;
 2058    ackAll(): void;
 2059}
 2060interface R2Error extends Error {
 2061    readonly name: string;
 2062    readonly code: number;
 2063    readonly message: string;
 2064    readonly action: string;
 2065    readonly stack: any;
 2066}
 2067interface R2ListOptions {
 2068    limit?: number;
 2069    prefix?: string;
 2070    cursor?: string;
 2071    delimiter?: string;
 2072    startAfter?: string;
 2073    include?: ("httpMetadata" | "customMetadata")[];
 2074}
 2075interface R2Bucket {
 2076    head(key: string): Promise<R2Object | null>;
 2077    get(key: string, options: R2GetOptions & {
 2078        onlyIf: R2Conditional | Headers;
 2079    }): Promise<R2ObjectBody | R2Object | null>;
 2080    get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
 2081    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {
 2082        onlyIf: R2Conditional | Headers;
 2083    }): Promise<R2Object | null>;
 2084    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;
 2085    createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;
 2086    resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
 2087    delete(keys: string | string[]): Promise<void>;
 2088    list(options?: R2ListOptions): Promise<R2Objects>;
 2089}
 2090interface R2MultipartUpload {
 2091    readonly key: string;
 2092    readonly uploadId: string;
 2093    uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;
 2094    abort(): Promise<void>;
 2095    complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
 2096}
 2097interface R2UploadedPart {
 2098    partNumber: number;
 2099    etag: string;
 2100}
 2101declare abstract class R2Object {
 2102    readonly key: string;
 2103    readonly version: string;
 2104    readonly size: number;
 2105    readonly etag: string;
 2106    readonly httpEtag: string;
 2107    readonly checksums: R2Checksums;
 2108    readonly uploaded: Date;
 2109    readonly httpMetadata?: R2HTTPMetadata;
 2110    readonly customMetadata?: Record<string, string>;
 2111    readonly range?: R2Range;
 2112    readonly storageClass: string;
 2113    readonly ssecKeyMd5?: string;
 2114    writeHttpMetadata(headers: Headers): void;
 2115}
 2116interface R2ObjectBody extends R2Object {
 2117    get body(): ReadableStream;
 2118    get bodyUsed(): boolean;
 2119    arrayBuffer(): Promise<ArrayBuffer>;
 2120    bytes(): Promise<Uint8Array>;
 2121    text(): Promise<string>;
 2122    json<T>(): Promise<T>;
 2123    blob(): Promise<Blob>;
 2124}
 2125type R2Range = {
 2126    offset: number;
 2127    length?: number;
 2128} | {
 2129    offset?: number;
 2130    length: number;
 2131} | {
 2132    suffix: number;
 2133};
 2134interface R2Conditional {
 2135    etagMatches?: string;
 2136    etagDoesNotMatch?: string;
 2137    uploadedBefore?: Date;
 2138    uploadedAfter?: Date;
 2139    secondsGranularity?: boolean;
 2140}
 2141interface R2GetOptions {
 2142    onlyIf?: (R2Conditional | Headers);
 2143    range?: (R2Range | Headers);
 2144    ssecKey?: (ArrayBuffer | string);
 2145}
 2146interface R2PutOptions {
 2147    onlyIf?: (R2Conditional | Headers);
 2148    httpMetadata?: (R2HTTPMetadata | Headers);
 2149    customMetadata?: Record<string, string>;
 2150    md5?: ((ArrayBuffer | ArrayBufferView) | string);
 2151    sha1?: ((ArrayBuffer | ArrayBufferView) | string);
 2152    sha256?: ((ArrayBuffer | ArrayBufferView) | string);
 2153    sha384?: ((ArrayBuffer | ArrayBufferView) | string);
 2154    sha512?: ((ArrayBuffer | ArrayBufferView) | string);
 2155    storageClass?: string;
 2156    ssecKey?: (ArrayBuffer | string);
 2157}
 2158interface R2MultipartOptions {
 2159    httpMetadata?: (R2HTTPMetadata | Headers);
 2160    customMetadata?: Record<string, string>;
 2161    storageClass?: string;
 2162    ssecKey?: (ArrayBuffer | string);
 2163}
 2164interface R2Checksums {
 2165    readonly md5?: ArrayBuffer;
 2166    readonly sha1?: ArrayBuffer;
 2167    readonly sha256?: ArrayBuffer;
 2168    readonly sha384?: ArrayBuffer;
 2169    readonly sha512?: ArrayBuffer;
 2170    toJSON(): R2StringChecksums;
 2171}
 2172interface R2StringChecksums {
 2173    md5?: string;
 2174    sha1?: string;
 2175    sha256?: string;
 2176    sha384?: string;
 2177    sha512?: string;
 2178}
 2179interface R2HTTPMetadata {
 2180    contentType?: string;
 2181    contentLanguage?: string;
 2182    contentDisposition?: string;
 2183    contentEncoding?: string;
 2184    cacheControl?: string;
 2185    cacheExpiry?: Date;
 2186}
 2187type R2Objects = {
 2188    objects: R2Object[];
 2189    delimitedPrefixes: string[];
 2190} & ({
 2191    truncated: true;
 2192    cursor: string;
 2193} | {
 2194    truncated: false;
 2195});
 2196interface R2UploadPartOptions {
 2197    ssecKey?: (ArrayBuffer | string);
 2198}
 2199declare abstract class ScheduledEvent extends ExtendableEvent {
 2200    readonly scheduledTime: number;
 2201    readonly cron: string;
 2202    noRetry(): void;
 2203}
 2204interface ScheduledController {
 2205    readonly scheduledTime: number;
 2206    readonly cron: string;
 2207    noRetry(): void;
 2208}
 2209interface QueuingStrategy<T = any> {
 2210    highWaterMark?: (number | bigint);
 2211    size?: (chunk: T) => number | bigint;
 2212}
 2213interface UnderlyingSink<W = any> {
 2214    type?: string;
 2215    start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
 2216    write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;
 2217    abort?: (reason: any) => void | Promise<void>;
 2218    close?: () => void | Promise<void>;
 2219}
 2220interface UnderlyingByteSource {
 2221    type: "bytes";
 2222    autoAllocateChunkSize?: number;
 2223    start?: (controller: ReadableByteStreamController) => void | Promise<void>;
 2224    pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
 2225    cancel?: (reason: any) => void | Promise<void>;
 2226}
 2227interface UnderlyingSource<R = any> {
 2228    type?: "" | undefined;
 2229    start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;
 2230    pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;
 2231    cancel?: (reason: any) => void | Promise<void>;
 2232    expectedLength?: (number | bigint);
 2233}
 2234interface Transformer<I = any, O = any> {
 2235    readableType?: string;
 2236    writableType?: string;
 2237    start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;
 2238    transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;
 2239    flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;
 2240    cancel?: (reason: any) => void | Promise<void>;
 2241    expectedLength?: number;
 2242}
 2243interface StreamPipeOptions {
 2244    preventAbort?: boolean;
 2245    preventCancel?: boolean;
 2246    /**
 2247     * 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.
 2248     *
 2249     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
 2250     *
 2251     * Errors and closures of the source and destination streams propagate as follows:
 2252     *
 2253     * 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.
 2254     *
 2255     * 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.
 2256     *
 2257     * 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.
 2258     *
 2259     * 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.
 2260     *
 2261     * 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.
 2262     */
 2263    preventClose?: boolean;
 2264    signal?: AbortSignal;
 2265}
 2266type ReadableStreamReadResult<R = any> = {
 2267    done: false;
 2268    value: R;
 2269} | {
 2270    done: true;
 2271    value?: undefined;
 2272};
 2273/**
 2274 * The **`ReadableStream`** interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
 2275 *
 2276 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
 2277 */
 2278interface ReadableStream<R = any> {
 2279    /**
 2280     * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.
 2281     *
 2282     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)
 2283     */
 2284    get locked(): boolean;
 2285    /**
 2286     * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.
 2287     *
 2288     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)
 2289     */
 2290    cancel(reason?: any): Promise<void>;
 2291    /**
 2292     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released.
 2293     *
 2294     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
 2295     */
 2296    getReader(): ReadableStreamDefaultReader<R>;
 2297    /**
 2298     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released.
 2299     *
 2300     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
 2301     */
 2302    getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
 2303    /**
 2304     * 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.
 2305     *
 2306     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)
 2307     */
 2308    pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
 2309    /**
 2310     * 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.
 2311     *
 2312     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)
 2313     */
 2314    pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
 2315    /**
 2316     * The **`tee()`** method of the ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
 2317     *
 2318     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
 2319     */
 2320    tee(): [
 2321        ReadableStream<R>,
 2322        ReadableStream<R>
 2323    ];
 2324    values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
 2325    [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
 2326}
 2327/**
 2328 * The **`ReadableStream`** interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
 2329 *
 2330 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
 2331 */
 2332declare const ReadableStream: {
 2333    prototype: ReadableStream;
 2334    new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
 2335    new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
 2336};
 2337/**
 2338 * 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).
 2339 *
 2340 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)
 2341 */
 2342declare class ReadableStreamDefaultReader<R = any> {
 2343    constructor(stream: ReadableStream);
 2344    get closed(): Promise<void>;
 2345    cancel(reason?: any): Promise<void>;
 2346    /**
 2347     * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.
 2348     *
 2349     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)
 2350     */
 2351    read(): Promise<ReadableStreamReadResult<R>>;
 2352    /**
 2353     * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.
 2354     *
 2355     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)
 2356     */
 2357    releaseLock(): void;
 2358}
 2359/**
 2360 * The **`ReadableStreamBYOBReader`** interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.
 2361 *
 2362 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
 2363 */
 2364declare class ReadableStreamBYOBReader {
 2365    constructor(stream: ReadableStream);
 2366    get closed(): Promise<void>;
 2367    cancel(reason?: any): Promise<void>;
 2368    /**
 2369     * 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. A request for data will be satisfied from the stream's internal queues if there is any data present. If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source.
 2370     *
 2371     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
 2372     */
 2373    read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
 2374    /**
 2375     * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active.
 2376     *
 2377     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
 2378     */
 2379    releaseLock(): void;
 2380    readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;
 2381}
 2382interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
 2383    min?: number;
 2384}
 2385interface ReadableStreamGetReaderOptions {
 2386    /**
 2387     * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
 2388     *
 2389     * 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.
 2390     */
 2391    mode: "byob";
 2392}
 2393/**
 2394 * 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).
 2395 *
 2396 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)
 2397 */
 2398declare abstract class ReadableStreamBYOBRequest {
 2399    /**
 2400     * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.
 2401     *
 2402     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)
 2403     */
 2404    get view(): Uint8Array | null;
 2405    /**
 2406     * 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.
 2407     *
 2408     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)
 2409     */
 2410    respond(bytesWritten: number): void;
 2411    /**
 2412     * 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.
 2413     *
 2414     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)
 2415     */
 2416    respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
 2417    get atLeast(): number | null;
 2418}
 2419/**
 2420 * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams.
 2421 *
 2422 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
 2423 */
 2424declare abstract class ReadableStreamDefaultController<R = any> {
 2425    /**
 2426     * The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.
 2427     *
 2428     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
 2429     */
 2430    get desiredSize(): number | null;
 2431    /**
 2432     * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.
 2433     *
 2434     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)
 2435     */
 2436    close(): void;
 2437    /**
 2438     * The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.
 2439     *
 2440     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
 2441     */
 2442    enqueue(chunk?: R): void;
 2443    /**
 2444     * The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.
 2445     *
 2446     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
 2447     */
 2448    error(reason: any): void;
 2449}
 2450/**
 2451 * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. It allows control of the state and internal queue of a ReadableStream with an underlying byte source, and enables efficient zero-copy transfer of data from the underlying source to a consumer when the stream's internal queue is empty.
 2452 *
 2453 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
 2454 */
 2455declare abstract class ReadableByteStreamController {
 2456    /**
 2457     * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
 2458     *
 2459     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)
 2460     */
 2461    get byobRequest(): ReadableStreamBYOBRequest | null;
 2462    /**
 2463     * 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".
 2464     *
 2465     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)
 2466     */
 2467    get desiredSize(): number | null;
 2468    /**
 2469     * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.
 2470     *
 2471     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)
 2472     */
 2473    close(): void;
 2474    /**
 2475     * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is transferred into the stream's internal queues).
 2476     *
 2477     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
 2478     */
 2479    enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
 2480    /**
 2481     * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.
 2482     *
 2483     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)
 2484     */
 2485    error(reason: any): void;
 2486}
 2487/**
 2488 * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
 2489 *
 2490 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
 2491 */
 2492declare abstract class WritableStreamDefaultController {
 2493    /**
 2494     * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.
 2495     *
 2496     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)
 2497     */
 2498    get signal(): AbortSignal;
 2499    /**
 2500     * The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.
 2501     *
 2502     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
 2503     */
 2504    error(reason?: any): void;
 2505}
 2506/**
 2507 * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.
 2508 *
 2509 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)
 2510 */
 2511declare abstract class TransformStreamDefaultController<O = any> {
 2512    /**
 2513     * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.
 2514     *
 2515     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)
 2516     */
 2517    get desiredSize(): number | null;
 2518    /**
 2519     * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.
 2520     *
 2521     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)
 2522     */
 2523    enqueue(chunk?: O): void;
 2524    /**
 2525     * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. Any further interactions with it will fail with the given error message, and any chunks in the queue will be discarded.
 2526     *
 2527     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
 2528     */
 2529    error(reason: any): void;
 2530    /**
 2531     * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.
 2532     *
 2533     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)
 2534     */
 2535    terminate(): void;
 2536}
 2537interface ReadableWritablePair<R = any, W = any> {
 2538    readable: ReadableStream<R>;
 2539    /**
 2540     * 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.
 2541     *
 2542     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
 2543     */
 2544    writable: WritableStream<W>;
 2545}
 2546/**
 2547 * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
 2548 *
 2549 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
 2550 */
 2551declare class WritableStream<W = any> {
 2552    constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
 2553    /**
 2554     * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer.
 2555     *
 2556     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)
 2557     */
 2558    get locked(): boolean;
 2559    /**
 2560     * 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.
 2561     *
 2562     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)
 2563     */
 2564    abort(reason?: any): Promise<void>;
 2565    /**
 2566     * The **`close()`** method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled.
 2567     *
 2568     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
 2569     */
 2570    close(): Promise<void>;
 2571    /**
 2572     * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released.
 2573     *
 2574     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
 2575     */
 2576    getWriter(): WritableStreamDefaultWriter<W>;
 2577}
 2578/**
 2579 * 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.
 2580 *
 2581 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)
 2582 */
 2583declare class WritableStreamDefaultWriter<W = any> {
 2584    constructor(stream: WritableStream);
 2585    /**
 2586     * The **`closed`** read-only property of the WritableStreamDefaultWriter interface returns a Promise that fulfills if the stream becomes closed, or rejects if the stream errors or the writer's lock is released.
 2587     *
 2588     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
 2589     */
 2590    get closed(): Promise<void>;
 2591    /**
 2592     * The **`ready`** read-only property of the WritableStreamDefaultWriter interface returns a Promise 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.
 2593     *
 2594     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
 2595     */
 2596    get ready(): Promise<void>;
 2597    /**
 2598     * The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.
 2599     *
 2600     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
 2601     */
 2602    get desiredSize(): number | null;
 2603    /**
 2604     * The **`abort()`** method of the WritableStreamDefaultWriter 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.
 2605     *
 2606     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
 2607     */
 2608    abort(reason?: any): Promise<void>;
 2609    /**
 2610     * The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.
 2611     *
 2612     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
 2613     */
 2614    close(): Promise<void>;
 2615    /**
 2616     * The **`write()`** method of the WritableStreamDefaultWriter interface writes a passed chunk of data to a WritableStream and its underlying sink, then returns a Promise that resolves to indicate the success or failure of the write operation.
 2617     *
 2618     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
 2619     */
 2620    write(chunk?: W): Promise<void>;
 2621    /**
 2622     * The **`releaseLock()`** method of the WritableStreamDefaultWriter interface releases the writer's lock on the corresponding stream. After the lock is released, the writer is no longer active. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed.
 2623     *
 2624     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)
 2625     */
 2626    releaseLock(): void;
 2627}
 2628/**
 2629 * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain transform stream concept.
 2630 *
 2631 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)
 2632 */
 2633declare class TransformStream<I = any, O = any> {
 2634    constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
 2635    /**
 2636     * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream. This stream emits the transformed output data.
 2637     *
 2638     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
 2639     */
 2640    get readable(): ReadableStream<O>;
 2641    /**
 2642     * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream. This stream accepts input data that will be transformed and emitted to the readable stream.
 2643     *
 2644     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
 2645     */
 2646    get writable(): WritableStream<I>;
 2647}
 2648declare class FixedLengthStream extends IdentityTransformStream {
 2649    constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);
 2650}
 2651declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
 2652    constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
 2653}
 2654interface IdentityTransformStreamQueuingStrategy {
 2655    highWaterMark?: (number | bigint);
 2656}
 2657interface ReadableStreamValuesOptions {
 2658    preventCancel?: boolean;
 2659}
 2660/**
 2661 * The **`CompressionStream`** interface of the Compression Streams API compresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.
 2662 *
 2663 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
 2664 */
 2665declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
 2666    constructor(format: "gzip" | "deflate" | "deflate-raw");
 2667}
 2668/**
 2669 * The **`DecompressionStream`** interface of the Compression Streams API decompresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.
 2670 *
 2671 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
 2672 */
 2673declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
 2674    constructor(format: "gzip" | "deflate" | "deflate-raw");
 2675}
 2676/**
 2677 * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.
 2678 *
 2679 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
 2680 */
 2681declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
 2682    constructor();
 2683    get encoding(): string;
 2684}
 2685/**
 2686 * 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. It is the streaming equivalent of TextDecoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.
 2687 *
 2688 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
 2689 */
 2690declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {
 2691    constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
 2692    get encoding(): string;
 2693    get fatal(): boolean;
 2694    get ignoreBOM(): boolean;
 2695}
 2696interface TextDecoderStreamTextDecoderStreamInit {
 2697    fatal?: boolean;
 2698    ignoreBOM?: boolean;
 2699}
 2700/**
 2701 * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.
 2702 *
 2703 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)
 2704 */
 2705declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {
 2706    constructor(init: QueuingStrategyInit);
 2707    /**
 2708     * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.
 2709     *
 2710     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)
 2711     */
 2712    get highWaterMark(): number;
 2713    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
 2714    get size(): (chunk?: any) => number;
 2715}
 2716/**
 2717 * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.
 2718 *
 2719 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
 2720 */
 2721declare class CountQueuingStrategy implements QueuingStrategy {
 2722    constructor(init: QueuingStrategyInit);
 2723    /**
 2724     * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.
 2725     *
 2726     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)
 2727     */
 2728    get highWaterMark(): number;
 2729    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
 2730    get size(): (chunk?: any) => number;
 2731}
 2732interface QueuingStrategyInit {
 2733    /**
 2734     * Creates a new ByteLengthQueuingStrategy with the provided high water mark.
 2735     *
 2736     * 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.
 2737     */
 2738    highWaterMark: number;
 2739}
 2740interface TracePreviewInfo {
 2741    id: string;
 2742    slug: string;
 2743    name: string;
 2744}
 2745interface ScriptVersion {
 2746    id?: string;
 2747    tag?: string;
 2748    message?: string;
 2749}
 2750declare abstract class TailEvent extends ExtendableEvent {
 2751    readonly events: TraceItem[];
 2752    readonly traces: TraceItem[];
 2753}
 2754interface TraceItem {
 2755    readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;
 2756    readonly eventTimestamp: number | null;
 2757    readonly logs: TraceLog[];
 2758    readonly exceptions: TraceException[];
 2759    readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
 2760    readonly scriptName: string | null;
 2761    readonly entrypoint?: string;
 2762    readonly scriptVersion?: ScriptVersion;
 2763    readonly dispatchNamespace?: string;
 2764    readonly scriptTags?: string[];
 2765    readonly tailAttributes?: Record<string, boolean | number | string>;
 2766    readonly preview?: TracePreviewInfo;
 2767    readonly durableObjectId?: string;
 2768    readonly outcome: string;
 2769    readonly executionModel: string;
 2770    readonly truncated: boolean;
 2771    readonly cpuTime: number;
 2772    readonly wallTime: number;
 2773}
 2774interface TraceItemAlarmEventInfo {
 2775    readonly scheduledTime: Date;
 2776}
 2777interface TraceItemConnectEventInfo {
 2778}
 2779interface TraceItemCustomEventInfo {
 2780}
 2781interface TraceItemScheduledEventInfo {
 2782    readonly scheduledTime: number;
 2783    readonly cron: string;
 2784}
 2785interface TraceItemQueueEventInfo {
 2786    readonly queue: string;
 2787    readonly batchSize: number;
 2788}
 2789interface TraceItemEmailEventInfo {
 2790    readonly mailFrom: string;
 2791    readonly rcptTo: string;
 2792    readonly rawSize: number;
 2793}
 2794interface TraceItemTailEventInfo {
 2795    readonly consumedEvents: TraceItemTailEventInfoTailItem[];
 2796}
 2797interface TraceItemTailEventInfoTailItem {
 2798    readonly scriptName: string | null;
 2799}
 2800interface TraceItemFetchEventInfo {
 2801    readonly response?: TraceItemFetchEventInfoResponse;
 2802    readonly request: TraceItemFetchEventInfoRequest;
 2803}
 2804interface TraceItemFetchEventInfoRequest {
 2805    readonly cf?: any;
 2806    readonly headers: Record<string, string>;
 2807    readonly method: string;
 2808    readonly url: string;
 2809    getUnredacted(): TraceItemFetchEventInfoRequest;
 2810}
 2811interface TraceItemFetchEventInfoResponse {
 2812    readonly status: number;
 2813}
 2814interface TraceItemJsRpcEventInfo {
 2815    readonly rpcMethod: string;
 2816}
 2817interface TraceItemHibernatableWebSocketEventInfo {
 2818    readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;
 2819}
 2820interface TraceItemHibernatableWebSocketEventInfoMessage {
 2821    readonly webSocketEventType: string;
 2822}
 2823interface TraceItemHibernatableWebSocketEventInfoClose {
 2824    readonly webSocketEventType: string;
 2825    readonly code: number;
 2826    readonly wasClean: boolean;
 2827}
 2828interface TraceItemHibernatableWebSocketEventInfoError {
 2829    readonly webSocketEventType: string;
 2830}
 2831interface TraceLog {
 2832    readonly timestamp: number;
 2833    readonly level: string;
 2834    readonly message: any;
 2835    readonly errorInfo?: (TraceLogErrorInfo | null)[];
 2836}
 2837interface TraceLogErrorInfo {
 2838    name: string;
 2839    message: string;
 2840    stack?: string;
 2841}
 2842interface TraceException {
 2843    readonly timestamp: number;
 2844    readonly message: string;
 2845    readonly name: string;
 2846    readonly stack?: string;
 2847}
 2848interface TraceDiagnosticChannelEvent {
 2849    readonly timestamp: number;
 2850    readonly channel: string;
 2851    readonly message: any;
 2852}
 2853interface TraceMetrics {
 2854    readonly cpuTime: number;
 2855    readonly wallTime: number;
 2856}
 2857interface UnsafeTraceMetrics {
 2858    fromTrace(item: TraceItem): TraceMetrics;
 2859}
 2860/**
 2861 * The **`URL`** interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL.
 2862 *
 2863 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
 2864 */
 2865declare class URL {
 2866    constructor(url: string | URL, base?: string | URL);
 2867    /**
 2868     * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
 2869     *
 2870     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
 2871     */
 2872    get origin(): string;
 2873    /**
 2874     * The **`href`** property of the URL interface is a string containing the whole URL.
 2875     *
 2876     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
 2877     */
 2878    get href(): string;
 2879    /**
 2880     * The **`href`** property of the URL interface is a string containing the whole URL.
 2881     *
 2882     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
 2883     */
 2884    set href(value: string);
 2885    /**
 2886     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".
 2887     *
 2888     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
 2889     */
 2890    get protocol(): string;
 2891    /**
 2892     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".
 2893     *
 2894     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
 2895     */
 2896    set protocol(value: string);
 2897    /**
 2898     * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "".
 2899     *
 2900     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
 2901     */
 2902    get username(): string;
 2903    /**
 2904     * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "".
 2905     *
 2906     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
 2907     */
 2908    set username(value: string);
 2909    /**
 2910     * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "".
 2911     *
 2912     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
 2913     */
 2914    get password(): string;
 2915    /**
 2916     * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "".
 2917     *
 2918     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
 2919     */
 2920    set password(value: string);
 2921    /**
 2922     * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "".
 2923     *
 2924     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
 2925     */
 2926    get host(): string;
 2927    /**
 2928     * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "".
 2929     *
 2930     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
 2931     */
 2932    set host(value: string);
 2933    /**
 2934     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN.
 2935     *
 2936     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
 2937     */
 2938    get hostname(): string;
 2939    /**
 2940     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN.
 2941     *
 2942     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
 2943     */
 2944    set hostname(value: string);
 2945    /**
 2946     * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "".
 2947     *
 2948     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
 2949     */
 2950    get port(): string;
 2951    /**
 2952     * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "".
 2953     *
 2954     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
 2955     */
 2956    set port(value: string);
 2957    /**
 2958     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character.
 2959     *
 2960     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
 2961     */
 2962    get pathname(): string;
 2963    /**
 2964     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character.
 2965     *
 2966     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
 2967     */
 2968    set pathname(value: string);
 2969    /**
 2970     * 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. If the URL does not have a search query, this property contains an empty string, "".
 2971     *
 2972     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
 2973     */
 2974    get search(): string;
 2975    /**
 2976     * 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. If the URL does not have a search query, this property contains an empty string, "".
 2977     *
 2978     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
 2979     */
 2980    set search(value: string);
 2981    /**
 2982     * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "".
 2983     *
 2984     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
 2985     */
 2986    get hash(): string;
 2987    /**
 2988     * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "".
 2989     *
 2990     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
 2991     */
 2992    set hash(value: string);
 2993    /**
 2994     * The **`searchParams`** read-only property of the URL interface returns a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.
 2995     *
 2996     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
 2997     */
 2998    get searchParams(): URLSearchParams;
 2999    /**
 3000     * 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 URL.toString().
 3001     *
 3002     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
 3003     */
 3004    toJSON(): string;
 3005    /*function toString() { [native code] }*/
 3006    toString(): string;
 3007    /**
 3008     * 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.
 3009     *
 3010     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
 3011     */
 3012    static canParse(url: string, base?: string): boolean;
 3013    /**
 3014     * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
 3015     *
 3016     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
 3017     */
 3018    static parse(url: string, base?: string): URL | null;
 3019    /**
 3020     * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter.
 3021     *
 3022     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
 3023     */
 3024    static createObjectURL(object: File | Blob): string;
 3025    /**
 3026     * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
 3027     *
 3028     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
 3029     */
 3030    static revokeObjectURL(object_url: string): void;
 3031}
 3032/**
 3033 * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
 3034 *
 3035 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
 3036 */
 3037declare class URLSearchParams {
 3038    constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));
 3039    /**
 3040     * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
 3041     *
 3042     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)
 3043     */
 3044    get size(): number;
 3045    /**
 3046     * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
 3047     *
 3048     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
 3049     */
 3050    append(name: string, value: string): void;
 3051    /**
 3052     * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.
 3053     *
 3054     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
 3055     */
 3056    delete(name: string, value?: string): void;
 3057    /**
 3058     * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.
 3059     *
 3060     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
 3061     */
 3062    get(name: string): string | null;
 3063    /**
 3064     * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
 3065     *
 3066     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
 3067     */
 3068    getAll(name: string): string[];
 3069    /**
 3070     * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.
 3071     *
 3072     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
 3073     */
 3074    has(name: string, value?: string): boolean;
 3075    /**
 3076     * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
 3077     *
 3078     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
 3079     */
 3080    set(name: string, value: string): void;
 3081    /**
 3082     * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns undefined. Key/value pairs are sorted by the values of the UTF-16 code units of the keys. This method uses a stable sorting algorithm (i.e., the relative order between key/value pairs with equal keys will be preserved).
 3083     *
 3084     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
 3085     */
 3086    sort(): void;
 3087    entries(): IterableIterator<[
 3088        key: string,
 3089        value: string
 3090    ]>;
 3091    keys(): IterableIterator<string>;
 3092    values(): IterableIterator<string>;
 3093    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
 3094    /*function toString() { [native code] }*/
 3095    toString(): string;
 3096    [Symbol.iterator](): IterableIterator<[
 3097        key: string,
 3098        value: string
 3099    ]>;
 3100}
 3101/**
 3102 * The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern. The pattern can contain capturing groups that extract parts of the matched URL.
 3103 *
 3104 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
 3105 */
 3106declare class URLPattern {
 3107    constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);
 3108    /**
 3109     * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
 3110     *
 3111     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
 3112     */
 3113    get protocol(): string;
 3114    /**
 3115     * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
 3116     *
 3117     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
 3118     */
 3119    get username(): string;
 3120    /**
 3121     * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
 3122     *
 3123     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
 3124     */
 3125    get password(): string;
 3126    /**
 3127     * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
 3128     *
 3129     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
 3130     */
 3131    get hostname(): string;
 3132    /**
 3133     * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
 3134     *
 3135     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
 3136     */
 3137    get port(): string;
 3138    /**
 3139     * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
 3140     *
 3141     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
 3142     */
 3143    get pathname(): string;
 3144    /**
 3145     * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
 3146     *
 3147     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
 3148     */
 3149    get search(): string;
 3150    /**
 3151     * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
 3152     *
 3153     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
 3154     */
 3155    get hash(): string;
 3156    /**
 3157     * The **`hasRegExpGroups`** read-only property of the URLPattern interface is a boolean indicating whether or not any of the URLPattern components contain regular expression capturing groups.
 3158     *
 3159     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)
 3160     */
 3161    get hasRegExpGroups(): boolean;
 3162    /**
 3163     * The **`test()`** method of the URLPattern interface takes a URL string or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.
 3164     *
 3165     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
 3166     */
 3167    test(input?: (string | URLPatternInit), baseURL?: string): boolean;
 3168    /**
 3169     * The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or null if the URL does not match the pattern.
 3170     *
 3171     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
 3172     */
 3173    exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;
 3174}
 3175interface URLPatternInit {
 3176    protocol?: string;
 3177    username?: string;
 3178    password?: string;
 3179    hostname?: string;
 3180    port?: string;
 3181    pathname?: string;
 3182    search?: string;
 3183    hash?: string;
 3184    baseURL?: string;
 3185}
 3186interface URLPatternComponentResult {
 3187    input: string;
 3188    groups: Record<string, string>;
 3189}
 3190interface URLPatternResult {
 3191    inputs: (string | URLPatternInit)[];
 3192    protocol: URLPatternComponentResult;
 3193    username: URLPatternComponentResult;
 3194    password: URLPatternComponentResult;
 3195    hostname: URLPatternComponentResult;
 3196    port: URLPatternComponentResult;
 3197    pathname: URLPatternComponentResult;
 3198    search: URLPatternComponentResult;
 3199    hash: URLPatternComponentResult;
 3200}
 3201interface URLPatternOptions {
 3202    ignoreCase?: boolean;
 3203}
 3204/**
 3205 * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
 3206 *
 3207 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
 3208 */
 3209declare class CloseEvent extends Event {
 3210    constructor(type: string, initializer?: CloseEventInit);
 3211    /**
 3212     * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
 3213     *
 3214     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
 3215     */
 3216    readonly code: number;
 3217    /**
 3218     * 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.
 3219     *
 3220     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
 3221     */
 3222    readonly reason: string;
 3223    /**
 3224     * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
 3225     *
 3226     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
 3227     */
 3228    readonly wasClean: boolean;
 3229}
 3230interface CloseEventInit {
 3231    bubbles?: boolean;
 3232    cancelable?: boolean;
 3233    composed?: boolean;
 3234    code?: number;
 3235    reason?: string;
 3236    wasClean?: boolean;
 3237}
 3238type WebSocketEventMap = {
 3239    close: CloseEvent;
 3240    message: MessageEvent;
 3241    open: Event;
 3242    error: ErrorEvent;
 3243};
 3244/**
 3245 * 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.
 3246 *
 3247 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
 3248 */
 3249declare var WebSocket: {
 3250    prototype: WebSocket;
 3251    new (url: string, protocols?: (string[] | string)): WebSocket;
 3252    readonly READY_STATE_CONNECTING: number;
 3253    readonly CONNECTING: number;
 3254    readonly READY_STATE_OPEN: number;
 3255    readonly OPEN: number;
 3256    readonly READY_STATE_CLOSING: number;
 3257    readonly CLOSING: number;
 3258    readonly READY_STATE_CLOSED: number;
 3259    readonly CLOSED: number;
 3260};
 3261/**
 3262 * 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.
 3263 *
 3264 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
 3265 */
 3266interface WebSocket extends EventTarget<WebSocketEventMap> {
 3267    accept(options?: WebSocketAcceptOptions): void;
 3268    /**
 3269     * 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. If the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. The browser will throw an exception if you call send() when the connection is in the CONNECTING state. If you call send() when the connection is in the CLOSING or CLOSED states, the browser will silently discard the data.
 3270     *
 3271     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
 3272     */
 3273    send(message: (ArrayBuffer | ArrayBufferView) | string): void;
 3274    /**
 3275     * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
 3276     *
 3277     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
 3278     */
 3279    close(code?: number, reason?: string): void;
 3280    serializeAttachment(attachment: any): void;
 3281    deserializeAttachment(): any | null;
 3282    /**
 3283     * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.
 3284     *
 3285     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
 3286     */
 3287    readyState: number;
 3288    /**
 3289     * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
 3290     *
 3291     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
 3292     */
 3293    url: string | null;
 3294    /**
 3295     * 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.
 3296     *
 3297     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
 3298     */
 3299    protocol: string | null;
 3300    /**
 3301     * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. This is currently only the empty string or a list of extensions as negotiated by the connection.
 3302     *
 3303     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
 3304     */
 3305    extensions: string | null;
 3306    /**
 3307     * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
 3308     *
 3309     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)
 3310     */
 3311    binaryType: "blob" | "arraybuffer";
 3312}
 3313interface WebSocketAcceptOptions {
 3314    /**
 3315     * When set to `true`, receiving a server-initiated WebSocket Close frame will not
 3316     * automatically send a reciprocal Close frame, leaving the connection in a half-open
 3317     * state. This is useful for proxying scenarios where you need to coordinate closing
 3318     * both sides independently. Defaults to `false` when the
 3319     * `no_web_socket_half_open_by_default` compatibility flag is enabled.
 3320     */
 3321    allowHalfOpen?: boolean;
 3322}
 3323declare const WebSocketPair: {
 3324    new (): {
 3325        0: WebSocket;
 3326        1: WebSocket;
 3327    };
 3328};
 3329interface SqlStorage {
 3330    exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;
 3331    get databaseSize(): number;
 3332    Cursor: typeof SqlStorageCursor;
 3333    Statement: typeof SqlStorageStatement;
 3334}
 3335declare abstract class SqlStorageStatement {
 3336}
 3337type SqlStorageValue = ArrayBuffer | string | number | null;
 3338declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {
 3339    next(): {
 3340        done?: false;
 3341        value: T;
 3342    } | {
 3343        done: true;
 3344        value?: never;
 3345    };
 3346    toArray(): T[];
 3347    one(): T;
 3348    raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
 3349    columnNames: string[];
 3350    get rowsRead(): number;
 3351    get rowsWritten(): number;
 3352    [Symbol.iterator](): IterableIterator<T>;
 3353}
 3354interface Socket {
 3355    get readable(): ReadableStream;
 3356    get writable(): WritableStream;
 3357    get closed(): Promise<void>;
 3358    get opened(): Promise<SocketInfo>;
 3359    get upgraded(): boolean;
 3360    get secureTransport(): "on" | "off" | "starttls";
 3361    close(): Promise<void>;
 3362    startTls(options?: TlsOptions): Socket;
 3363}
 3364interface SocketOptions {
 3365    secureTransport?: string;
 3366    allowHalfOpen: boolean;
 3367    highWaterMark?: (number | bigint);
 3368}
 3369interface SocketAddress {
 3370    hostname: string;
 3371    port: number;
 3372}
 3373interface TlsOptions {
 3374    expectedServerHostname?: string;
 3375}
 3376interface SocketInfo {
 3377    remoteAddress?: string;
 3378    localAddress?: string;
 3379}
 3380/**
 3381 * The **`EventSource`** interface is web content's interface to server-sent events.
 3382 *
 3383 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
 3384 */
 3385declare class EventSource extends EventTarget {
 3386    constructor(url: string, init?: EventSourceEventSourceInit);
 3387    /**
 3388     * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).
 3389     *
 3390     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
 3391     */
 3392    close(): void;
 3393    /**
 3394     * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
 3395     *
 3396     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
 3397     */
 3398    get url(): string;
 3399    /**
 3400     * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
 3401     *
 3402     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
 3403     */
 3404    get withCredentials(): boolean;
 3405    /**
 3406     * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
 3407     *
 3408     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
 3409     */
 3410    get readyState(): number;
 3411    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
 3412    get onopen(): any | null;
 3413    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
 3414    set onopen(value: any | null);
 3415    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
 3416    get onmessage(): any | null;
 3417    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
 3418    set onmessage(value: any | null);
 3419    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
 3420    get onerror(): any | null;
 3421    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
 3422    set onerror(value: any | null);
 3423    static readonly CONNECTING: number;
 3424    static readonly OPEN: number;
 3425    static readonly CLOSED: number;
 3426    static from(stream: ReadableStream): EventSource;
 3427}
 3428interface EventSourceEventSourceInit {
 3429    withCredentials?: boolean;
 3430    fetcher?: Fetcher;
 3431}
 3432interface ExecOutput {
 3433    readonly stdout: ArrayBuffer;
 3434    readonly stderr: ArrayBuffer;
 3435    readonly exitCode: number;
 3436}
 3437interface ContainerExecOptions {
 3438    cwd?: string;
 3439    env?: Record<string, string>;
 3440    user?: string;
 3441    signal?: AbortSignal;
 3442    pty?: boolean | ContainerExecPtyOptions;
 3443    stdin?: ReadableStream | "pipe";
 3444    stdout?: "pipe" | "ignore";
 3445    stderr?: "pipe" | "ignore" | "combined";
 3446}
 3447interface ContainerExecPtyOptions {
 3448    cols?: number;
 3449    rows?: number;
 3450}
 3451interface ExecProcess {
 3452    readonly stdin: WritableStream | null;
 3453    readonly stdout: ReadableStream | null;
 3454    readonly stderr: ReadableStream | null;
 3455    readonly pid: number;
 3456    readonly isPty: boolean;
 3457    readonly exitCode: Promise<number>;
 3458    output(): Promise<ExecOutput>;
 3459    kill(signal?: number): void;
 3460    resize(cols: number, rows: number): void;
 3461}
 3462interface Container {
 3463    get running(): boolean;
 3464    get images(): Record<string, string>;
 3465    start(options?: ContainerStartupOptions): void;
 3466    monitor(): Promise<void>;
 3467    destroy(error?: any): Promise<void>;
 3468    signal(signo: number): void;
 3469    getTcpPort(port: number): Fetcher;
 3470    setInactivityTimeout(durationMs: number | bigint): Promise<void>;
 3471    interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
 3472    interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
 3473    snapshotContainer(options?: ContainerSnapshotOptions): Promise<ContainerSnapshot>;
 3474    interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
 3475    exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
 3476    inspect(): Promise<ContainerInfo | null>;
 3477}
 3478interface ContainerDirectorySnapshot {
 3479    id: string;
 3480    size: number;
 3481    dir: string;
 3482    name?: string;
 3483}
 3484type ContainerDirectorySnapshotRestoreParams = {
 3485    snapshot: ContainerDirectorySnapshot;
 3486    mountPoint?: string;
 3487} | {
 3488    snapshot?: undefined;
 3489    mountPoint: string;
 3490};
 3491interface ContainerSnapshot {
 3492    id: string;
 3493    size: number;
 3494    name?: string;
 3495}
 3496interface ContainerSnapshotRestoreParams {
 3497    id: string;
 3498}
 3499interface ContainerSnapshotOptions {
 3500    name?: string;
 3501}
 3502type ContainerStartupOptions = {
 3503    entrypoint?: string[];
 3504    enableInternet: boolean;
 3505    env?: Record<string, string>;
 3506    instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;
 3507    labels?: Record<string, string>;
 3508    directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
 3509} & ({
 3510    image: string;
 3511    containerSnapshot?: never;
 3512} | {
 3513    image?: never;
 3514    containerSnapshot?: ContainerSnapshotRestoreParams;
 3515});
 3516interface ContainerInfo {
 3517    labels: Record<string, string>;
 3518    image: string;
 3519}
 3520interface ContainerStartResources {
 3521    vcpu: number;
 3522    memoryMib: number;
 3523    diskMb: number;
 3524}
 3525/**
 3526 * 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.
 3527 *
 3528 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
 3529 */
 3530declare abstract class MessagePort extends EventTarget {
 3531    /**
 3532     * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
 3533     *
 3534     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
 3535     */
 3536    postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
 3537    /**
 3538     * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
 3539     *
 3540     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
 3541     */
 3542    close(): void;
 3543    /**
 3544     * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
 3545     *
 3546     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
 3547     */
 3548    start(): void;
 3549    get onmessage(): any | null;
 3550    set onmessage(value: any | null);
 3551}
 3552/**
 3553 * 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.
 3554 *
 3555 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
 3556 */
 3557declare class MessageChannel {
 3558    constructor();
 3559    /**
 3560     * The **`port1`** read-only property of the MessageChannel interface returns the first port of the message channel — the port attached to the context that originated the channel.
 3561     *
 3562     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
 3563     */
 3564    readonly port1: MessagePort;
 3565    /**
 3566     * The **`port2`** read-only property of the MessageChannel interface returns the second port of the message channel — the port attached to the context at the other end of the channel, which the message is initially sent to.
 3567     *
 3568     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
 3569     */
 3570    readonly port2: MessagePort;
 3571}
 3572interface MessagePortPostMessageOptions {
 3573    transfer?: any[];
 3574}
 3575type 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 new (...args: any[]) => CloudflareWorkersModule.WorkflowEntrypoint<any, infer Params> ? Workflow<Params> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;
 3576type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {
 3577    props?: Props;
 3578}) => Fetcher<T> : (opts: {
 3579    props?: any;
 3580}) => Fetcher<T>);
 3581type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {
 3582    props?: Props;
 3583}) => DurableObjectClass<T> : (opts: {
 3584    props?: any;
 3585}) => DurableObjectClass<T>);
 3586interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {
 3587}
 3588interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {
 3589}
 3590interface SyncKvStorage {
 3591    get<T = unknown>(key: string): T | undefined;
 3592    list<T = unknown>(options?: SyncKvListOptions): Iterable<[
 3593        string,
 3594        T
 3595    ]>;
 3596    put<T>(key: string, value: T): void;
 3597    delete(key: string): boolean;
 3598}
 3599interface SyncKvListOptions {
 3600    start?: string;
 3601    startAfter?: string;
 3602    end?: string;
 3603    prefix?: string;
 3604    reverse?: boolean;
 3605    limit?: number;
 3606}
 3607interface WorkerStub {
 3608    getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;
 3609    getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): DurableObjectClass<T>;
 3610}
 3611interface WorkerStubEntrypointOptions {
 3612    props?: any;
 3613    limits?: workerdResourceLimits;
 3614}
 3615interface WorkerLoader {
 3616    get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;
 3617    load(code: WorkerLoaderWorkerCode): WorkerStub;
 3618}
 3619interface WorkerLoaderModule {
 3620    js?: string;
 3621    cjs?: string;
 3622    text?: string;
 3623    data?: ArrayBuffer;
 3624    json?: any;
 3625    py?: string;
 3626    wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
 3627}
 3628interface WorkerLoaderWorkerCode {
 3629    compatibilityDate: string;
 3630    compatibilityFlags?: string[];
 3631    allowExperimental?: boolean;
 3632    limits?: workerdResourceLimits;
 3633    mainModule: string;
 3634    modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
 3635    env?: any;
 3636    globalOutbound?: (Fetcher | null);
 3637    tails?: Fetcher[];
 3638    streamingTails?: Fetcher[];
 3639}
 3640interface workerdResourceLimits {
 3641    cpuMs?: number;
 3642    subRequests?: number;
 3643}
 3644/**
 3645* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
 3646* as well as timing of subrequests and other operations.
 3647*
 3648* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
 3649*/
 3650declare abstract class Performance {
 3651    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
 3652    get timeOrigin(): number;
 3653    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
 3654    now(): number;
 3655    /**
 3656     * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object.
 3657     *
 3658     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
 3659     */
 3660    toJSON(): object;
 3661}
 3662interface Tracing {
 3663    enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
 3664    startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
 3665    startSpan(name: string): Span;
 3666    getActiveSpan(): Span | undefined;
 3667    Span: typeof Span;
 3668}
 3669declare abstract class Span {
 3670    get isTraced(): boolean;
 3671    setAttribute(key: string, value: boolean | number | string): this;
 3672    setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
 3673    recordException(exception: string | {
 3674        code: string | number;
 3675        name?: string;
 3676        message?: string;
 3677        stack?: string;
 3678    } | {
 3679        code?: string | number;
 3680        name: string;
 3681        message?: string;
 3682        stack?: string;
 3683    } | {
 3684        code?: string | number;
 3685        name?: string;
 3686        message: string;
 3687        stack?: string;
 3688    }): void;
 3689    updateName(name: string): this;
 3690    setStatus(status: TracingSpanStatus): this;
 3691    end(): void;
 3692}
 3693type TracingSpanStatusCode = "unset" | "ok" | "error";
 3694interface TracingSpanStatus {
 3695    code: TracingSpanStatusCode;
 3696    message?: string;
 3697}
 3698/**
 3699 * Represents the identity of a user authenticated via Cloudflare Access.
 3700 * This matches the result of calling /cdn-cgi/access/get-identity.
 3701 *
 3702 * The exact structure of the returned object depends on the identity provider
 3703 * configuration for the Access application. The fields below represent commonly
 3704 * available properties, but additional provider-specific fields may be present.
 3705 */
 3706interface CloudflareAccessIdentity extends Record<string, unknown> {
 3707    /** The user's email address, if available from the identity provider. */
 3708    email?: string;
 3709    /** The user's display name. */
 3710    name?: string;
 3711    /** The user's unique identifier. */
 3712    user_uuid?: string;
 3713    /** The Cloudflare account ID. */
 3714    account_id?: string;
 3715    /** Login timestamp (Unix epoch seconds). */
 3716    iat?: number;
 3717    /** The user's IP address at authentication time. */
 3718    ip?: string;
 3719    /** Authentication methods used (e.g., "pwd"). */
 3720    amr?: string[];
 3721    /** Identity provider information. */
 3722    idp?: {
 3723        id: string;
 3724        type: string;
 3725    };
 3726    /** Geographic information about where the user authenticated. */
 3727    geo?: {
 3728        country: string;
 3729    };
 3730    /** Group memberships from the identity provider. */
 3731    groups?: Array<{
 3732        id: string;
 3733        name: string;
 3734        email?: string;
 3735    }>;
 3736    /** Device posture check results, keyed by check ID. */
 3737    devicePosture?: Record<string, unknown>;
 3738    /** True if the user connected via Cloudflare WARP. */
 3739    is_warp?: boolean;
 3740    /** True if the user is authenticated via Cloudflare Gateway. */
 3741    is_gateway?: boolean;
 3742}
 3743// ============================================================================
 3744// Agent Memory
 3745//
 3746// Public type surface for user Workers binding to an Agent Memory namespace.
 3747// ============================================================================
 3748/** Memory type — every memory is classified into exactly one. */
 3749type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";
 3750/** Search intensity for recall. */
 3751type AgentMemoryThinkingLevel = "low" | "medium" | "high";
 3752/** Response verbosity for recall. */
 3753type AgentMemoryResponseLength = "short" | "medium" | "long";
 3754/** A conversation message passed to ingest(). */
 3755interface AgentMemoryMessage {
 3756    role: "system" | "user" | "assistant";
 3757    content: string;
 3758    /** Optional message timestamp. */
 3759    timestamp?: Date;
 3760}
 3761/** Raw memory content passed to remember(). */
 3762interface AgentMemoryIncomingMemory {
 3763    /** Raw memory content. The service classifies and summarizes automatically. */
 3764    content: string;
 3765    /** Optional session identifier to associate with this memory. */
 3766    sessionId?: string | null | undefined;
 3767}
 3768/** A stored memory returned from remember(), get(), and delete(). */
 3769interface AgentMemoryMemory {
 3770    /** Memory ID. */
 3771    id: string;
 3772    /** Memory type. */
 3773    type: AgentMemoryMemoryType;
 3774    /** Text summary. */
 3775    summary: string;
 3776    /** Memory text. */
 3777    content: string;
 3778    /** Session that created this memory. */
 3779    sessionId: string | null;
 3780    /** Memory creation time. */
 3781    createdAt: Date;
 3782    /** Memory last-update time. */
 3783    updatedAt: Date;
 3784}
 3785/** Single entry in a list() response. Same shape as Memory minus full content. */
 3786type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;
 3787/** A scored memory candidate in a recall result. */
 3788interface AgentMemoryScoredCandidate {
 3789    /** Candidate ID. */
 3790    id: string;
 3791    /** Text summary. */
 3792    summary: string;
 3793    /** Session that created this candidate, when known. */
 3794    sessionId: string | null;
 3795    /** Relevance score (higher is better). Comparable only within a single query. */
 3796    score: number;
 3797}
 3798/** Options for the ingest() method. */
 3799interface AgentMemoryIngestOptions {
 3800    /** Session identifier to associate with memories created during ingestion. */
 3801    sessionId?: string | null | undefined;
 3802}
 3803/** Options for the getSummary() method. */
 3804interface AgentMemoryGetSummaryOptions {
 3805    /** Session identifier to retrieve session summary for. */
 3806    sessionId?: string | null | undefined;
 3807}
 3808/** Response from the getSummary() method. */
 3809interface AgentMemoryGetSummaryResponse {
 3810    /** Markdown summary. */
 3811    summary: string;
 3812}
 3813/**
 3814 * Options for the recall() method.
 3815 *
 3816 * `referenceDate` accepts a Date object, an ISO-8601 date string
 3817 * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this
 3818 * date is used as "today" for resolving relative time references
 3819 * ("how many days ago", "last week") instead of the server's wall-clock time.
 3820 */
 3821interface AgentMemoryRecallOptions {
 3822    /** Recall intensity: "low" (default), "medium", or "high". */
 3823    thinkingLevel?: AgentMemoryThinkingLevel;
 3824    /** Response verbosity: "short", "medium" (default), or "long". */
 3825    responseLength?: AgentMemoryResponseLength;
 3826    /** Temporal anchor for date arithmetic. */
 3827    referenceDate?: Date | string;
 3828}
 3829/** Response from the recall() method. */
 3830interface AgentMemoryRecallResult {
 3831    /** Number of memories retrieved. */
 3832    count: number;
 3833    /** LLM-generated answer synthesizing the matching memories. */
 3834    answer: string;
 3835    /** Matching memories ranked by relevance. */
 3836    candidates: AgentMemoryScoredCandidate[];
 3837}
 3838/**
 3839 * Options for the list() method.
 3840 *
 3841 * `cursor` is the opaque continuation token returned by the previous page;
 3842 * pass it back unchanged to fetch the next page. `sessionId` and `type`
 3843 * are exact-match filters; combining them is allowed.
 3844 */
 3845interface AgentMemoryListMemoriesOptions {
 3846    /** Maximum number of memories to return. Default 20, max 500. */
 3847    limit?: number;
 3848    /** Opaque cursor from a previous page. */
 3849    cursor?: string;
 3850    /** Exact-match session filter. */
 3851    sessionId?: string;
 3852    /** Exact-match memory-type filter. */
 3853    type?: AgentMemoryMemoryType;
 3854}
 3855/** Response from the list() method. */
 3856interface AgentMemoryListMemoriesResult {
 3857    memories: AgentMemoryMemoryListEntry[];
 3858    /** Continuation cursor; absent when this page exhausted the result set. */
 3859    cursor?: string;
 3860}
 3861/**
 3862 * A single Agent Memory profile, scoped to a profile name.
 3863 *
 3864 * Returned by {@link AgentMemoryNamespace.getProfile}.
 3865 */
 3866declare abstract class AgentMemoryProfile {
 3867    /**
 3868     * Retrieve a memory by ID.
 3869     *
 3870     * @param memoryId - ULID of the memory to retrieve.
 3871     * @throws if the memory does not exist.
 3872     */
 3873    get(memoryId: string): Promise<AgentMemoryMemory>;
 3874    /**
 3875     * Delete a memory by ID.
 3876     *
 3877     * Removes the memory and any source messages linked by the memory's
 3878     * source message IDs.
 3879     *
 3880     * @param memoryId - ULID of the memory to delete.
 3881     * @throws if the memory does not exist.
 3882     */
 3883    delete(memoryId: string): Promise<AgentMemoryMemory>;
 3884    /**
 3885     * Store a memory in this profile. The content is automatically classified,
 3886     * summarized, and indexed.
 3887     *
 3888     * @param memory - Raw memory content to persist.
 3889     */
 3890    remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;
 3891    /**
 3892     * Extract memories from a conversation.
 3893     *
 3894     * @param messages - Conversation messages to extract memories from.
 3895     * @param options  - Optional ingest options.
 3896     */
 3897    ingest(messages: Iterable<AgentMemoryMessage>, options?: AgentMemoryIngestOptions): Promise<void>;
 3898    /**
 3899     * Get a profile summary.
 3900     *
 3901     * @param options - Optional getSummary options.
 3902     */
 3903    getSummary(options?: AgentMemoryGetSummaryOptions): Promise<AgentMemoryGetSummaryResponse>;
 3904    /**
 3905     * Recall memories in this profile.
 3906     *
 3907     * @param query   - Recall query matched against memory content and keywords.
 3908     * @param options - Optional recall parameters.
 3909     * @returns Matching memories with relevance scores and a synthesized answer.
 3910     */
 3911    recall(query: string, options?: AgentMemoryRecallOptions): Promise<AgentMemoryRecallResult>;
 3912    /**
 3913     * List active memories in this profile.
 3914     *
 3915     * Returns a paginated, filterable view of stored memories. Superseded
 3916     * versions are excluded. Use the returned `cursor` (when present) to
 3917     * fetch the next page.
 3918     *
 3919     * @param options - Optional pagination and filter options.
 3920     */
 3921    list(options?: AgentMemoryListMemoriesOptions): Promise<AgentMemoryListMemoriesResult>;
 3922    /**
 3923     * Soft-delete every memory and message in this profile that is tagged
 3924     * with `sessionId`.
 3925     *
 3926     * Idempotent: deleting a sessionId that has no rows is a no-op.
 3927     *
 3928     * @param sessionId - Session to delete.
 3929     */
 3930    deleteSession(sessionId: string): Promise<void>;
 3931}
 3932/**
 3933 * Namespace-level Agent Memory binding.
 3934 *
 3935 * Used as the type of an `env.MEMORY`-style binding backed by the Agent
 3936 * Memory product.
 3937 *
 3938 * @example
 3939 * ```ts
 3940 * export default {
 3941 *   async fetch(_request: Request, env: Env): Promise<Response> {
 3942 *     const profile = await env.MEMORY.getProfile("wrangler-e2e");
 3943 *     const summary = await profile.getSummary();
 3944 *     return Response.json(summary);
 3945 *   },
 3946 * };
 3947 * ```
 3948 */
 3949declare abstract class AgentMemoryNamespace {
 3950    /**
 3951     * Get a memory profile by name. Profiles are isolated by namespace and
 3952     * addressed by a compound key (namespaceId:profileName).
 3953     *
 3954     * @param profileName - Profile name (validated against naming rules).
 3955     * @returns RPC target for interacting with the profile.
 3956     */
 3957    getProfile(profileName: string): Promise<AgentMemoryProfile>;
 3958    /**
 3959     * Soft-delete a profile and schedule deferred purge. Marks all
 3960     * memories and messages as deleted.
 3961     *
 3962     * @param profileName - Name of the profile to delete.
 3963     */
 3964    deleteProfile(profileName: string): Promise<void>;
 3965}
 3966// ============ AI Search Error Interfaces ============
 3967interface AiSearchInternalError extends Error {
 3968}
 3969interface AiSearchNotFoundError extends Error {
 3970}
 3971// ============ AI Search Common Types ============
 3972/** A single message in a conversation-style search or chat request. */
 3973type AiSearchMessage = {
 3974    role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
 3975    content: string | null;
 3976};
 3977/**
 3978 * Common shape for `ai_search_options` used by both single-instance and multi-instance requests.
 3979 * Contains retrieval, query rewrite, reranking, and cache sub-options.
 3980 */
 3981type AiSearchOptions = {
 3982    retrieval?: {
 3983        /** Which retrieval backend to use. Defaults to the instance's configured index_method. */
 3984        retrieval_type?: 'vector' | 'keyword' | 'hybrid';
 3985        /** Fusion method for combining vector + keyword results. */
 3986        fusion_method?: 'max' | 'rrf';
 3987        /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */
 3988        keyword_match_mode?: 'and' | 'or';
 3989        /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */
 3990        match_threshold?: number;
 3991        /** Maximum number of results to return (1-50). Default 10. */
 3992        max_num_results?: number;
 3993        /** Vectorize metadata filters applied to the search. */
 3994        filters?: VectorizeVectorMetadataFilter;
 3995        /** Number of surrounding chunks to include for context (0-3). Default 0. */
 3996        context_expansion?: number;
 3997        /** If true, return only item metadata without chunk text. */
 3998        metadata_only?: boolean;
 3999        /** If true (default), return empty results on retrieval failure instead of throwing. */
 4000        return_on_failure?: boolean;
 4001        /** Boost results by metadata field values. Max 3 entries. */
 4002        boost_by?: Array<{
 4003            field: string;
 4004            direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
 4005        }>;
 4006        [key: string]: unknown;
 4007    };
 4008    query_rewrite?: {
 4009        enabled?: boolean;
 4010        model?: string;
 4011        rewrite_prompt?: string;
 4012        [key: string]: unknown;
 4013    };
 4014    reranking?: {
 4015        enabled?: boolean;
 4016        model?: string;
 4017        /** Match threshold (0-1, default 0.4) */
 4018        match_threshold?: number;
 4019        [key: string]: unknown;
 4020    };
 4021    cache?: {
 4022        enabled?: boolean;
 4023        cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';
 4024    };
 4025    [key: string]: unknown;
 4026};
 4027// ============ AI Search Request Types ============
 4028/**
 4029 * Request body for single-instance search.
 4030 * Exactly one of `query` or `messages` must be provided.
 4031 */
 4032type AiSearchSearchRequest = {
 4033    /** Simple query string. */
 4034    query: string;
 4035    messages?: never;
 4036    ai_search_options?: AiSearchOptions;
 4037} | {
 4038    query?: never;
 4039    /** Conversation-style input. At least one user message with non-empty content is required. */
 4040    messages: AiSearchMessage[];
 4041    ai_search_options?: AiSearchOptions;
 4042};
 4043type AiSearchChatCompletionsRequest = {
 4044    messages: AiSearchMessage[];
 4045    model?: string;
 4046    stream?: boolean;
 4047    ai_search_options?: AiSearchOptions;
 4048    [key: string]: unknown;
 4049};
 4050// ============ AI Search Multi-Instance Types (Namespace-Scoped) ============
 4051/** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */
 4052type AiSearchMultiSearchOptions = AiSearchOptions & {
 4053    /** Instance IDs to search across (1-10). */
 4054    instance_ids: string[];
 4055};
 4056/**
 4057 * Request for searching across multiple instances within a namespace.
 4058 * `ai_search_options` is required and must include `instance_ids`.
 4059 * Exactly one of `query` or `messages` must be provided.
 4060 */
 4061type AiSearchMultiSearchRequest = {
 4062    /** Simple query string. */
 4063    query: string;
 4064    messages?: never;
 4065    ai_search_options: AiSearchMultiSearchOptions;
 4066} | {
 4067    query?: never;
 4068    /** Conversation-style input. */
 4069    messages: AiSearchMessage[];
 4070    ai_search_options: AiSearchMultiSearchOptions;
 4071};
 4072/** A search result chunk tagged with the instance it originated from. */
 4073type AiSearchMultiSearchChunk = AiSearchSearchResponse['chunks'][number] & {
 4074    instance_id: string;
 4075};
 4076/** Describes a per-instance error during a multi-instance operation. */
 4077type AiSearchMultiSearchError = {
 4078    instance_id: string;
 4079    message: string;
 4080};
 4081/** Response from a multi-instance search, with chunks tagged by instance and optional partial-failure errors. */
 4082type AiSearchMultiSearchResponse = {
 4083    search_query: string;
 4084    chunks: AiSearchMultiSearchChunk[];
 4085    errors?: AiSearchMultiSearchError[];
 4086};
 4087/** Request for chat completions across multiple instances within a namespace. `ai_search_options` is required and must include `instance_ids`. */
 4088type AiSearchMultiChatCompletionsRequest = Omit<AiSearchChatCompletionsRequest, 'ai_search_options'> & {
 4089    ai_search_options: AiSearchMultiSearchOptions;
 4090};
 4091/** Response from multi-instance chat completions, with chunks tagged by instance and optional partial-failure errors. */
 4092type AiSearchMultiChatCompletionsResponse = Omit<AiSearchChatCompletionsResponse, 'chunks'> & {
 4093    chunks: AiSearchMultiSearchChunk[];
 4094    errors?: AiSearchMultiSearchError[];
 4095};
 4096// ============ AI Search Response Types ============
 4097type AiSearchSearchResponse = {
 4098    search_query: string;
 4099    chunks: Array<{
 4100        id: string;
 4101        type: string;
 4102        /** Match score (0-1) */
 4103        score: number;
 4104        text: string;
 4105        item: {
 4106            timestamp?: number;
 4107            key: string;
 4108            metadata?: Record<string, unknown>;
 4109        };
 4110        scoring_details?: {
 4111            /** Keyword match score (0-1) */
 4112            keyword_score?: number;
 4113            /** Vector similarity score (0-1) */
 4114            vector_score?: number;
 4115            /** Keyword rank position */
 4116            keyword_rank?: number;
 4117            /** Vector rank position */
 4118            vector_rank?: number;
 4119            /** Reranking model score */
 4120            reranking_score?: number;
 4121            /** Fusion method used to combine results */
 4122            fusion_method?: 'rrf' | 'max';
 4123            [key: string]: unknown;
 4124        };
 4125    }>;
 4126};
 4127type AiSearchChatCompletionsResponse = {
 4128    id?: string;
 4129    object?: string;
 4130    model?: string;
 4131    choices: Array<{
 4132        index?: number;
 4133        message: {
 4134            role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
 4135            content: string | null;
 4136            [key: string]: unknown;
 4137        };
 4138        [key: string]: unknown;
 4139    }>;
 4140    chunks: AiSearchSearchResponse['chunks'];
 4141    [key: string]: unknown;
 4142};
 4143type AiSearchStatsResponse = {
 4144    queued?: number;
 4145    running?: number;
 4146    completed?: number;
 4147    error?: number;
 4148    skipped?: number;
 4149    outdated?: number;
 4150    last_activity?: string;
 4151    /** Storage engine statistics. */
 4152    engine?: {
 4153        vectorize?: {
 4154            vectorsCount: number;
 4155            dimensions: number;
 4156        };
 4157        r2?: {
 4158            payloadSizeBytes: number;
 4159            metadataSizeBytes: number;
 4160            objectCount: number;
 4161        };
 4162    };
 4163};
 4164// ============ AI Search Instance Info Types ============
 4165type AiSearchInstanceInfo = {
 4166    id: string;
 4167    type?: 'r2' | 'web-crawler' | string;
 4168    source?: string;
 4169    source_params?: unknown;
 4170    paused?: boolean;
 4171    status?: string;
 4172    namespace?: string;
 4173    created_at?: string;
 4174    modified_at?: string;
 4175    token_id?: string;
 4176    ai_gateway_id?: string;
 4177    rewrite_query?: boolean;
 4178    reranking?: boolean;
 4179    embedding_model?: string;
 4180    ai_search_model?: string;
 4181    rewrite_model?: string;
 4182    reranking_model?: string;
 4183    /** @deprecated Use index_method instead. */
 4184    hybrid_search_enabled?: boolean;
 4185    /** Controls which storage backends are active. */
 4186    index_method?: {
 4187        vector?: boolean;
 4188        keyword?: boolean;
 4189    };
 4190    /** Fusion method for combining vector and keyword results. */
 4191    fusion_method?: 'max' | 'rrf';
 4192    indexing_options?: {
 4193        keyword_tokenizer?: 'porter' | 'trigram';
 4194    } | null;
 4195    retrieval_options?: {
 4196        keyword_match_mode?: 'and' | 'or';
 4197        boost_by?: Array<{
 4198            field: string;
 4199            direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
 4200        }>;
 4201    } | null;
 4202    chunk?: boolean;
 4203    chunk_size?: number;
 4204    chunk_overlap?: number;
 4205    score_threshold?: number;
 4206    max_num_results?: number;
 4207    cache?: boolean;
 4208    cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';
 4209    custom_metadata?: Array<{
 4210        field_name: string;
 4211        data_type: 'text' | 'number' | 'boolean' | 'datetime';
 4212    }>;
 4213    /** Sync interval in seconds. */
 4214    sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;
 4215    metadata?: Record<string, unknown>;
 4216    [key: string]: unknown;
 4217};
 4218/** Pagination, search, and ordering parameters for listing instances within a namespace. */
 4219type AiSearchListInstancesParams = {
 4220    page?: number;
 4221    per_page?: number;
 4222    /** Search instances by ID. */
 4223    search?: string;
 4224    /** Field to sort by. */
 4225    order_by?: 'created_at';
 4226    /** Sort direction. */
 4227    order_by_direction?: 'asc' | 'desc';
 4228};
 4229type AiSearchListResponse = {
 4230    result: AiSearchInstanceInfo[];
 4231    result_info?: {
 4232        count: number;
 4233        page: number;
 4234        per_page: number;
 4235        total_count: number;
 4236    };
 4237};
 4238// ============ AI Search Config Types ============
 4239type AiSearchConfig = {
 4240    /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
 4241    id: string;
 4242    /** Instance type. Omit to create with built-in storage. */
 4243    type?: 'r2' | 'web-crawler' | string;
 4244    /** Source URL (required for web-crawler type). */
 4245    source?: string;
 4246    source_params?: unknown;
 4247    /** Token ID (UUID format) */
 4248    token_id?: string;
 4249    ai_gateway_id?: string;
 4250    /** Enable query rewriting (default false) */
 4251    rewrite_query?: boolean;
 4252    /** Enable reranking (default false) */
 4253    reranking?: boolean;
 4254    embedding_model?: string;
 4255    ai_search_model?: string;
 4256    rewrite_model?: string;
 4257    reranking_model?: string;
 4258    /** @deprecated Use index_method instead. */
 4259    hybrid_search_enabled?: boolean;
 4260    /** Controls which storage backends are used during indexing. Defaults to vector-only. */
 4261    index_method?: {
 4262        vector?: boolean;
 4263        keyword?: boolean;
 4264    };
 4265    /** Fusion method for combining vector and keyword results. "rrf" = reciprocal rank fusion (default), "max" = maximum score. */
 4266    fusion_method?: 'max' | 'rrf';
 4267    indexing_options?: {
 4268        keyword_tokenizer?: 'porter' | 'trigram';
 4269    } | null;
 4270    retrieval_options?: {
 4271        keyword_match_mode?: 'and' | 'or';
 4272        boost_by?: Array<{
 4273            field: string;
 4274            direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
 4275        }>;
 4276    } | null;
 4277    chunk?: boolean;
 4278    chunk_size?: number;
 4279    chunk_overlap?: number;
 4280    /** Minimum similarity score (0-1) for a result to be included. */
 4281    score_threshold?: number;
 4282    max_num_results?: number;
 4283    cache?: boolean;
 4284    /** Similarity threshold for cache hits. Stricter = fewer cache hits but higher relevance. */
 4285    cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';
 4286    custom_metadata?: Array<{
 4287        field_name: string;
 4288        data_type: 'text' | 'number' | 'boolean' | 'datetime';
 4289    }>;
 4290    namespace?: string;
 4291    /** Sync interval in seconds. 3600=1h, 7200=2h, 14400=4h, 21600=6h, 43200=12h, 86400=24h. */
 4292    sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;
 4293    metadata?: Record<string, unknown>;
 4294    [key: string]: unknown;
 4295};
 4296// ============ AI Search Item Types ============
 4297type AiSearchItemInfo = {
 4298    id: string;
 4299    key: string;
 4300    status: 'completed' | 'error' | 'skipped' | 'queued' | 'running' | 'outdated';
 4301    next_action?: 'INDEX' | 'DELETE' | null;
 4302    error?: string;
 4303    checksum?: string;
 4304    namespace?: string;
 4305    chunks_count?: number | null;
 4306    file_size?: number | null;
 4307    source_id?: string | null;
 4308    last_seen_at?: string;
 4309    created_at?: string;
 4310    metadata?: Record<string, unknown>;
 4311    [key: string]: unknown;
 4312};
 4313type AiSearchItemContentResult = {
 4314    body: ReadableStream;
 4315    contentType: string;
 4316    filename: string;
 4317    size: number;
 4318};
 4319type AiSearchUploadItemOptions = {
 4320    metadata?: Record<string, unknown>;
 4321};
 4322type AiSearchListItemsParams = {
 4323    page?: number;
 4324    per_page?: number;
 4325    /** Search items by key name. */
 4326    search?: string;
 4327    /** Sort order for results. */
 4328    sort_by?: 'status' | 'modified_at';
 4329    /** Filter items by processing status. */
 4330    status?: 'queued' | 'running' | 'completed' | 'error' | 'skipped' | 'outdated';
 4331    /** Filter items by source (e.g. "builtin" or "web-crawler:https://example.com"). */
 4332    source?: string;
 4333    /** JSON-encoded Vectorize filter for metadata filtering. */
 4334    metadata_filter?: string;
 4335    /** Filter items by their unique ID. Returns at most one item. */
 4336    item_id?: string;
 4337    /**
 4338     * Filter items by their exact key (object key / filename). Keys are unique
 4339     * per source, so combine with `source` to disambiguate across data sources.
 4340     */
 4341    key?: string;
 4342};
 4343type AiSearchListItemsResponse = {
 4344    result: AiSearchItemInfo[];
 4345    result_info?: {
 4346        count: number;
 4347        page: number;
 4348        per_page: number;
 4349        total_count: number;
 4350    };
 4351};
 4352// ============ AI Search Item Logs Types ============
 4353type AiSearchItemLogsParams = {
 4354    /** Maximum number of log entries to return (1-100, default 50). */
 4355    limit?: number;
 4356    /** Opaque cursor for pagination. Pass the `cursor` value from a previous response. */
 4357    cursor?: string;
 4358};
 4359type AiSearchItemLog = {
 4360    timestamp: string;
 4361    action: string;
 4362    message: string;
 4363    fileKey?: string;
 4364    chunkCount?: number;
 4365    processingTimeMs?: number;
 4366    errorType?: string;
 4367};
 4368/** Paginated response for item processing logs (cursor-based). */
 4369type AiSearchItemLogsResponse = {
 4370    result: AiSearchItemLog[];
 4371    result_info: {
 4372        count: number;
 4373        per_page: number;
 4374        cursor: string | null;
 4375        truncated: boolean;
 4376    };
 4377};
 4378// ============ AI Search Item Chunks Types ============
 4379type AiSearchItemChunksParams = {
 4380    /** Maximum number of chunks to return (1-100, default 20). */
 4381    limit?: number;
 4382    /** Offset into the chunks list (default 0). */
 4383    offset?: number;
 4384};
 4385/** A single indexed chunk belonging to an item, including its text content and byte range. */
 4386type AiSearchItemChunk = {
 4387    id: string;
 4388    text: string;
 4389    start_byte: number;
 4390    end_byte: number;
 4391    item?: {
 4392        timestamp?: number;
 4393        key: string;
 4394        metadata?: Record<string, unknown>;
 4395    };
 4396};
 4397/** Paginated response for item chunks (offset-based). */
 4398type AiSearchItemChunksResponse = {
 4399    result: AiSearchItemChunk[];
 4400    result_info: {
 4401        count: number;
 4402        total: number;
 4403        limit: number;
 4404        offset: number;
 4405    };
 4406};
 4407// ============ AI Search Job Types ============
 4408type AiSearchJobInfo = {
 4409    id: string;
 4410    source: 'user' | 'schedule';
 4411    description?: string;
 4412    last_seen_at?: string;
 4413    started_at?: string;
 4414    ended_at?: string;
 4415    end_reason?: string;
 4416};
 4417type AiSearchJobLog = {
 4418    id: number;
 4419    message: string;
 4420    message_type: number;
 4421    created_at: number;
 4422};
 4423type AiSearchCreateJobParams = {
 4424    description?: string;
 4425};
 4426type AiSearchListJobsParams = {
 4427    page?: number;
 4428    per_page?: number;
 4429};
 4430type AiSearchListJobsResponse = {
 4431    result: AiSearchJobInfo[];
 4432    result_info?: {
 4433        count: number;
 4434        page: number;
 4435        per_page: number;
 4436        total_count: number;
 4437    };
 4438};
 4439type AiSearchJobLogsParams = {
 4440    page?: number;
 4441    per_page?: number;
 4442};
 4443type AiSearchJobLogsResponse = {
 4444    result: AiSearchJobLog[];
 4445    result_info?: {
 4446        count: number;
 4447        page: number;
 4448        per_page: number;
 4449        total_count: number;
 4450    };
 4451};
 4452// ============ AI Search Sub-Service Classes ============
 4453/**
 4454 * Single item service for an AI Search instance.
 4455 * Provides info, download, sync, logs, and chunks operations on a specific item.
 4456 */
 4457declare abstract class AiSearchItem {
 4458    /** Get metadata about this item. */
 4459    info(): Promise<AiSearchItemInfo>;
 4460    /**
 4461     * Download the item's content.
 4462     * @returns Object with body stream, content type, filename, and size.
 4463     */
 4464    download(): Promise<AiSearchItemContentResult>;
 4465    /**
 4466     * Trigger re-indexing of this item.
 4467     * @returns The updated item info.
 4468     */
 4469    sync(): Promise<AiSearchItemInfo>;
 4470    /**
 4471     * Retrieve processing logs for this item (cursor-based pagination).
 4472     * @param params Optional pagination parameters (limit, cursor).
 4473     * @returns Paginated log entries for this item.
 4474     */
 4475    logs(params?: AiSearchItemLogsParams): Promise<AiSearchItemLogsResponse>;
 4476    /**
 4477     * List indexed chunks for this item (offset-based pagination).
 4478     * @param params Optional pagination parameters (limit, offset).
 4479     * @returns Paginated chunk entries for this item.
 4480     */
 4481    chunks(params?: AiSearchItemChunksParams): Promise<AiSearchItemChunksResponse>;
 4482}
 4483/**
 4484 * Items collection service for an AI Search instance.
 4485 * Provides list, upload, and access to individual items.
 4486 */
 4487declare abstract class AiSearchItems {
 4488    /** List items in this instance. */
 4489    list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
 4490    /**
 4491     * Upload a file as an item. Behaves as an upsert: if an item with the same
 4492     * filename already exists, it is overwritten and re-indexed.
 4493     * @param name Filename for the uploaded item.
 4494     * @param content File content as a ReadableStream, Blob, or string.
 4495     * @param options Optional metadata to attach to the item.
 4496     * @returns The created item info.
 4497     */
 4498    upload(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions): Promise<AiSearchItemInfo>;
 4499    /**
 4500     * Upload a file and poll until processing completes.
 4501     * Behaves as an upsert: if an item with the same filename already exists,
 4502     * it is overwritten and re-indexed.
 4503     * @param name Filename for the uploaded item.
 4504     * @param content File content as a ReadableStream, Blob, or string.
 4505     * @param options Optional metadata and polling configuration.
 4506     * @returns The item info after processing completes (or timeout).
 4507     */
 4508    uploadAndPoll(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions & {
 4509        /** Polling interval in milliseconds (default 1000). */
 4510        pollIntervalMs?: number;
 4511        /** Maximum time to wait in milliseconds (default 30000). */
 4512        timeoutMs?: number;
 4513    }): Promise<AiSearchItemInfo>;
 4514    /**
 4515     * Get an item by ID.
 4516     * @param itemId The item identifier.
 4517     * @returns Item service for info, download, sync, logs, and chunks operations.
 4518     */
 4519    get(itemId: string): AiSearchItem;
 4520    /**
 4521     * Delete an item from the instance.
 4522     * @param itemId The item identifier.
 4523     */
 4524    delete(itemId: string): Promise<void>;
 4525}
 4526/**
 4527 * Single job service for an AI Search instance.
 4528 * Provides info, logs, and cancel operations for a specific job.
 4529 */
 4530declare abstract class AiSearchJob {
 4531    /** Get metadata about this job. */
 4532    info(): Promise<AiSearchJobInfo>;
 4533    /** Get logs for this job. */
 4534    logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
 4535    /**
 4536     * Cancel a running job.
 4537     * @returns The updated job info.
 4538     * @throws AiSearchNotFoundError if the job does not exist.
 4539     */
 4540    cancel(): Promise<AiSearchJobInfo>;
 4541}
 4542/**
 4543 * Jobs collection service for an AI Search instance.
 4544 * Provides list, create, and access to individual jobs.
 4545 */
 4546declare abstract class AiSearchJobs {
 4547    /** List jobs for this instance. */
 4548    list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
 4549    /**
 4550     * Create a new indexing job.
 4551     * @param params Optional job parameters.
 4552     * @returns The created job info.
 4553     */
 4554    create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
 4555    /**
 4556     * Get a job by ID.
 4557     * @param jobId The job identifier.
 4558     * @returns Job service for info, logs, and cancel operations.
 4559     */
 4560    get(jobId: string): AiSearchJob;
 4561}
 4562// ============ AI Search Binding Classes ============
 4563/**
 4564 * Instance-level AI Search service.
 4565 *
 4566 * Used as:
 4567 * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
 4568 * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
 4569 *
 4570 * Provides search, chat, update, stats, items, and jobs operations.
 4571 *
 4572 * @example
 4573 * ```ts
 4574 * // Via namespace binding
 4575 * const instance = env.AI_SEARCH.get("blog");
 4576 * const results = await instance.search({
 4577 *   query: "How does caching work?",
 4578 * });
 4579 *
 4580 * // Via single instance binding
 4581 * const results = await env.BLOG_SEARCH.search({
 4582 *   messages: [{ role: "user", content: "How does caching work?" }],
 4583 * });
 4584 * ```
 4585 */
 4586declare abstract class AiSearchInstance {
 4587    /**
 4588     * Search the AI Search instance for relevant chunks.
 4589     * @param params Search request with query or messages and optional AI search options.
 4590     * @returns Search response with matching chunks and search query.
 4591     */
 4592    search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
 4593    /**
 4594     * Generate chat completions with AI Search context (streaming).
 4595     * @param params Chat completions request with stream: true.
 4596     * @returns ReadableStream of server-sent events.
 4597     */
 4598    chatCompletions(params: AiSearchChatCompletionsRequest & {
 4599        stream: true;
 4600    }): Promise<ReadableStream>;
 4601    /**
 4602     * Generate chat completions with AI Search context.
 4603     * @param params Chat completions request.
 4604     * @returns Chat completion response with choices and RAG chunks.
 4605     */
 4606    chatCompletions(params: AiSearchChatCompletionsRequest): Promise<AiSearchChatCompletionsResponse>;
 4607    /**
 4608     * Update the instance configuration.
 4609     * @param config Partial configuration to update.
 4610     * @returns Updated instance info.
 4611     */
 4612    update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
 4613    /** Get metadata about this instance. */
 4614    info(): Promise<AiSearchInstanceInfo>;
 4615    /**
 4616     * Get instance statistics (item count, indexing status, etc.).
 4617     * @returns Statistics with counts per status, last activity time, and engine details.
 4618     */
 4619    stats(): Promise<AiSearchStatsResponse>;
 4620    /** Items collection — list, upload, and manage items in this instance. */
 4621    get items(): AiSearchItems;
 4622    /** Jobs collection — list, create, and inspect indexing jobs. */
 4623    get jobs(): AiSearchJobs;
 4624}
 4625/**
 4626 * Namespace-level AI Search service.
 4627 *
 4628 * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
 4629 * Scoped to a single namespace. Provides dynamic instance access, creation, deletion,
 4630 * and multi-instance search/chat operations.
 4631 *
 4632 * @example
 4633 * ```ts
 4634 * // Access an instance within the namespace
 4635 * const blog = env.AI_SEARCH.get("blog");
 4636 * const results = await blog.search({ query: "How does caching work?" });
 4637 *
 4638 * // List all instances in the namespace
 4639 * const instances = await env.AI_SEARCH.list();
 4640 *
 4641 * // Create a new instance with built-in storage
 4642 * const tenant = await env.AI_SEARCH.create({ id: "tenant-123" });
 4643 *
 4644 * // Upload items into the instance
 4645 * await tenant.items.upload("doc.pdf", fileContent);
 4646 *
 4647 * // Search across multiple instances
 4648 * const multi = await env.AI_SEARCH.search({
 4649 *   query: "caching",
 4650 *   ai_search_options: { instance_ids: ["blog", "docs"] },
 4651 * });
 4652 *
 4653 * // Delete an instance
 4654 * await env.AI_SEARCH.delete("tenant-123");
 4655 * ```
 4656 */
 4657declare abstract class AiSearchNamespace {
 4658    /**
 4659     * Get an instance by name within the bound namespace.
 4660     * @param name Instance name.
 4661     * @returns Instance service for search, chat, update, stats, items, and jobs.
 4662     */
 4663    get(name: string): AiSearchInstance;
 4664    /**
 4665     * List instances in the bound namespace.
 4666     * @param params Optional pagination, search, and ordering parameters.
 4667     * @returns Array of instance metadata with pagination info.
 4668     */
 4669    list(params?: AiSearchListInstancesParams): Promise<AiSearchListResponse>;
 4670    /**
 4671     * Create a new instance within the bound namespace.
 4672     * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
 4673     * @returns Instance service for the newly created instance.
 4674     *
 4675     * @example
 4676     * ```ts
 4677     * // Create with built-in storage (upload items manually)
 4678     * const instance = await env.AI_SEARCH.create({ id: "my-search" });
 4679     *
 4680     * // Create with web crawler source
 4681     * const instance = await env.AI_SEARCH.create({
 4682     *   id: "docs-search",
 4683     *   type: "web-crawler",
 4684     *   source: "https://developers.cloudflare.com",
 4685     * });
 4686     * ```
 4687     */
 4688    create(config: AiSearchConfig): Promise<AiSearchInstance>;
 4689    /**
 4690     * Delete an instance from the bound namespace.
 4691     * @param name Instance name to delete.
 4692     */
 4693    delete(name: string): Promise<void>;
 4694    /**
 4695     * Search across multiple instances within the bound namespace.
 4696     * Fans out to the specified instance_ids and merges results.
 4697     * @param params Search request with required `ai_search_options.instance_ids`.
 4698     * @returns Search response with chunks tagged by instance_id and optional partial-failure errors.
 4699     */
 4700    search(params: AiSearchMultiSearchRequest): Promise<AiSearchMultiSearchResponse>;
 4701    /**
 4702     * Generate chat completions across multiple instances within the bound namespace (streaming).
 4703     * Fans out to the specified instance_ids, merges context, and generates a response.
 4704     * @param params Chat completions request with stream: true and required `ai_search_options.instance_ids`.
 4705     * @returns ReadableStream of server-sent events.
 4706     */
 4707    chatCompletions(params: AiSearchMultiChatCompletionsRequest & {
 4708        stream: true;
 4709    }): Promise<ReadableStream>;
 4710    /**
 4711     * Generate chat completions across multiple instances within the bound namespace.
 4712     * Fans out to the specified instance_ids, merges context, and generates a response.
 4713     * @param params Chat completions request with required `ai_search_options.instance_ids`.
 4714     * @returns Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors.
 4715     */
 4716    chatCompletions(params: AiSearchMultiChatCompletionsRequest): Promise<AiSearchMultiChatCompletionsResponse>;
 4717}
 4718type AiImageClassificationInput = {
 4719    image: number[];
 4720};
 4721type AiImageClassificationOutput = {
 4722    score?: number;
 4723    label?: string;
 4724}[];
 4725declare abstract class BaseAiImageClassification {
 4726    inputs: AiImageClassificationInput;
 4727    postProcessedOutputs: AiImageClassificationOutput;
 4728}
 4729type AiImageToTextInput = {
 4730    image: number[];
 4731    prompt?: string;
 4732    max_tokens?: number;
 4733    temperature?: number;
 4734    top_p?: number;
 4735    top_k?: number;
 4736    seed?: number;
 4737    repetition_penalty?: number;
 4738    frequency_penalty?: number;
 4739    presence_penalty?: number;
 4740    raw?: boolean;
 4741    messages?: RoleScopedChatInput[];
 4742};
 4743type AiImageToTextOutput = {
 4744    description: string;
 4745};
 4746declare abstract class BaseAiImageToText {
 4747    inputs: AiImageToTextInput;
 4748    postProcessedOutputs: AiImageToTextOutput;
 4749}
 4750type AiImageTextToTextInput = {
 4751    image: string;
 4752    prompt?: string;
 4753    max_tokens?: number;
 4754    temperature?: number;
 4755    ignore_eos?: boolean;
 4756    top_p?: number;
 4757    top_k?: number;
 4758    seed?: number;
 4759    repetition_penalty?: number;
 4760    frequency_penalty?: number;
 4761    presence_penalty?: number;
 4762    raw?: boolean;
 4763    messages?: RoleScopedChatInput[];
 4764};
 4765type AiImageTextToTextOutput = {
 4766    description: string;
 4767};
 4768declare abstract class BaseAiImageTextToText {
 4769    inputs: AiImageTextToTextInput;
 4770    postProcessedOutputs: AiImageTextToTextOutput;
 4771}
 4772type AiMultimodalEmbeddingsInput = {
 4773    image: string;
 4774    text: string[];
 4775};
 4776type AiIMultimodalEmbeddingsOutput = {
 4777    data: number[][];
 4778    shape: number[];
 4779};
 4780declare abstract class BaseAiMultimodalEmbeddings {
 4781    inputs: AiImageTextToTextInput;
 4782    postProcessedOutputs: AiImageTextToTextOutput;
 4783}
 4784type AiObjectDetectionInput = {
 4785    image: number[];
 4786};
 4787type AiObjectDetectionOutput = {
 4788    score?: number;
 4789    label?: string;
 4790}[];
 4791declare abstract class BaseAiObjectDetection {
 4792    inputs: AiObjectDetectionInput;
 4793    postProcessedOutputs: AiObjectDetectionOutput;
 4794}
 4795type AiSentenceSimilarityInput = {
 4796    source: string;
 4797    sentences: string[];
 4798};
 4799type AiSentenceSimilarityOutput = number[];
 4800declare abstract class BaseAiSentenceSimilarity {
 4801    inputs: AiSentenceSimilarityInput;
 4802    postProcessedOutputs: AiSentenceSimilarityOutput;
 4803}
 4804type AiAutomaticSpeechRecognitionInput = {
 4805    audio: number[];
 4806};
 4807type AiAutomaticSpeechRecognitionOutput = {
 4808    text?: string;
 4809    words?: {
 4810        word: string;
 4811        start: number;
 4812        end: number;
 4813    }[];
 4814    vtt?: string;
 4815};
 4816declare abstract class BaseAiAutomaticSpeechRecognition {
 4817    inputs: AiAutomaticSpeechRecognitionInput;
 4818    postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
 4819}
 4820type AiSummarizationInput = {
 4821    input_text: string;
 4822    max_length?: number;
 4823};
 4824type AiSummarizationOutput = {
 4825    summary: string;
 4826};
 4827declare abstract class BaseAiSummarization {
 4828    inputs: AiSummarizationInput;
 4829    postProcessedOutputs: AiSummarizationOutput;
 4830}
 4831type AiTextClassificationInput = {
 4832    text: string;
 4833};
 4834type AiTextClassificationOutput = {
 4835    score?: number;
 4836    label?: string;
 4837}[];
 4838declare abstract class BaseAiTextClassification {
 4839    inputs: AiTextClassificationInput;
 4840    postProcessedOutputs: AiTextClassificationOutput;
 4841}
 4842type AiTextEmbeddingsInput = {
 4843    text: string | string[];
 4844};
 4845type AiTextEmbeddingsOutput = {
 4846    shape: number[];
 4847    data: number[][];
 4848};
 4849declare abstract class BaseAiTextEmbeddings {
 4850    inputs: AiTextEmbeddingsInput;
 4851    postProcessedOutputs: AiTextEmbeddingsOutput;
 4852}
 4853type RoleScopedChatInput = {
 4854    role: "user" | "assistant" | "system" | "tool" | (string & NonNullable<unknown>);
 4855    content: string;
 4856    name?: string;
 4857};
 4858type AiTextGenerationToolLegacyInput = {
 4859    name: string;
 4860    description: string;
 4861    parameters?: {
 4862        type: "object" | (string & NonNullable<unknown>);
 4863        properties: {
 4864            [key: string]: {
 4865                type: string;
 4866                description?: string;
 4867            };
 4868        };
 4869        required: string[];
 4870    };
 4871};
 4872type AiTextGenerationToolInput = {
 4873    type: "function" | (string & NonNullable<unknown>);
 4874    function: {
 4875        name: string;
 4876        description: string;
 4877        parameters?: {
 4878            type: "object" | (string & NonNullable<unknown>);
 4879            properties: {
 4880                [key: string]: {
 4881                    type: string;
 4882                    description?: string;
 4883                };
 4884            };
 4885            required: string[];
 4886        };
 4887    };
 4888};
 4889type AiTextGenerationFunctionsInput = {
 4890    name: string;
 4891    code: string;
 4892};
 4893type AiTextGenerationResponseFormat = {
 4894    type: string;
 4895    json_schema?: any;
 4896};
 4897type AiTextGenerationInput = {
 4898    prompt?: string;
 4899    raw?: boolean;
 4900    stream?: boolean;
 4901    max_tokens?: number;
 4902    temperature?: number;
 4903    top_p?: number;
 4904    top_k?: number;
 4905    seed?: number;
 4906    repetition_penalty?: number;
 4907    frequency_penalty?: number;
 4908    presence_penalty?: number;
 4909    messages?: RoleScopedChatInput[];
 4910    response_format?: AiTextGenerationResponseFormat;
 4911    tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);
 4912    functions?: AiTextGenerationFunctionsInput[];
 4913};
 4914type AiTextGenerationToolLegacyOutput = {
 4915    name: string;
 4916    arguments: unknown;
 4917};
 4918type AiTextGenerationToolOutput = {
 4919    id: string;
 4920    type: "function";
 4921    function: {
 4922        name: string;
 4923        arguments: string;
 4924    };
 4925};
 4926type UsageTags = {
 4927    prompt_tokens: number;
 4928    completion_tokens: number;
 4929    total_tokens: number;
 4930};
 4931type AiTextGenerationOutput = {
 4932    response?: string;
 4933    tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];
 4934    usage?: UsageTags;
 4935};
 4936declare abstract class BaseAiTextGeneration {
 4937    inputs: AiTextGenerationInput;
 4938    postProcessedOutputs: AiTextGenerationOutput;
 4939}
 4940type AiTextToSpeechInput = {
 4941    prompt: string;
 4942    lang?: string;
 4943};
 4944type AiTextToSpeechOutput = Uint8Array | {
 4945    audio: string;
 4946};
 4947declare abstract class BaseAiTextToSpeech {
 4948    inputs: AiTextToSpeechInput;
 4949    postProcessedOutputs: AiTextToSpeechOutput;
 4950}
 4951type AiTextToImageInput = {
 4952    prompt: string;
 4953    negative_prompt?: string;
 4954    height?: number;
 4955    width?: number;
 4956    image?: number[];
 4957    image_b64?: string;
 4958    mask?: number[];
 4959    num_steps?: number;
 4960    strength?: number;
 4961    guidance?: number;
 4962    seed?: number;
 4963};
 4964type AiTextToImageOutput = ReadableStream<Uint8Array>;
 4965declare abstract class BaseAiTextToImage {
 4966    inputs: AiTextToImageInput;
 4967    postProcessedOutputs: AiTextToImageOutput;
 4968}
 4969type AiTranslationInput = {
 4970    text: string;
 4971    target_lang: string;
 4972    source_lang?: string;
 4973};
 4974type AiTranslationOutput = {
 4975    translated_text?: string;
 4976};
 4977declare abstract class BaseAiTranslation {
 4978    inputs: AiTranslationInput;
 4979    postProcessedOutputs: AiTranslationOutput;
 4980}
 4981/**
 4982 * Workers AI support for OpenAI's Chat Completions API
 4983 */
 4984type ChatCompletionContentPartText = {
 4985    type: "text";
 4986    text: string;
 4987};
 4988type ChatCompletionContentPartImage = {
 4989    type: "image_url";
 4990    image_url: {
 4991        url: string;
 4992        detail?: "auto" | "low" | "high";
 4993    };
 4994};
 4995type ChatCompletionContentPartInputAudio = {
 4996    type: "input_audio";
 4997    input_audio: {
 4998        /** Base64 encoded audio data. */
 4999        data: string;
 5000        format: "wav" | "mp3";
 5001    };
 5002};
 5003type ChatCompletionContentPartFile = {
 5004    type: "file";
 5005    file: {
 5006        /** Base64 encoded file data. */
 5007        file_data?: string;
 5008        /** The ID of an uploaded file. */
 5009        file_id?: string;
 5010        filename?: string;
 5011    };
 5012};
 5013type ChatCompletionContentPartRefusal = {
 5014    type: "refusal";
 5015    refusal: string;
 5016};
 5017type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartInputAudio | ChatCompletionContentPartFile;
 5018type FunctionDefinition = {
 5019    name: string;
 5020    description?: string;
 5021    parameters?: Record<string, unknown>;
 5022    strict?: boolean | null;
 5023};
 5024type ChatCompletionFunctionTool = {
 5025    type: "function";
 5026    function: FunctionDefinition;
 5027};
 5028type ChatCompletionCustomToolGrammarFormat = {
 5029    type: "grammar";
 5030    grammar: {
 5031        definition: string;
 5032        syntax: "lark" | "regex";
 5033    };
 5034};
 5035type ChatCompletionCustomToolTextFormat = {
 5036    type: "text";
 5037};
 5038type ChatCompletionCustomToolFormat = ChatCompletionCustomToolTextFormat | ChatCompletionCustomToolGrammarFormat;
 5039type ChatCompletionCustomTool = {
 5040    type: "custom";
 5041    custom: {
 5042        name: string;
 5043        description?: string;
 5044        format?: ChatCompletionCustomToolFormat;
 5045    };
 5046};
 5047type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
 5048type ChatCompletionMessageFunctionToolCall = {
 5049    id: string;
 5050    type: "function";
 5051    function: {
 5052        name: string;
 5053        /** JSON-encoded arguments string. */
 5054        arguments: string;
 5055    };
 5056};
 5057type ChatCompletionMessageCustomToolCall = {
 5058    id: string;
 5059    type: "custom";
 5060    custom: {
 5061        name: string;
 5062        input: string;
 5063    };
 5064};
 5065type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall;
 5066type ChatCompletionToolChoiceFunction = {
 5067    type: "function";
 5068    function: {
 5069        name: string;
 5070    };
 5071};
 5072type ChatCompletionToolChoiceCustom = {
 5073    type: "custom";
 5074    custom: {
 5075        name: string;
 5076    };
 5077};
 5078type ChatCompletionToolChoiceAllowedTools = {
 5079    type: "allowed_tools";
 5080    allowed_tools: {
 5081        mode: "auto" | "required";
 5082        tools: Array<Record<string, unknown>>;
 5083    };
 5084};
 5085type ChatCompletionToolChoiceOption = "none" | "auto" | "required" | ChatCompletionToolChoiceFunction | ChatCompletionToolChoiceCustom | ChatCompletionToolChoiceAllowedTools;
 5086type DeveloperMessage = {
 5087    role: "developer";
 5088    content: string | Array<{
 5089        type: "text";
 5090        text: string;
 5091    }>;
 5092    name?: string;
 5093};
 5094type SystemMessage = {
 5095    role: "system";
 5096    content: string | Array<{
 5097        type: "text";
 5098        text: string;
 5099    }>;
 5100    name?: string;
 5101};
 5102/**
 5103 * Permissive merged content part used inside UserMessage arrays.
 5104 *
 5105 * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination
 5106 * inside nested array items does not correctly match different branches for
 5107 * different array elements, so the schema uses a single merged object.
 5108 */
 5109type UserMessageContentPart = {
 5110    type: "text" | "image_url" | "input_audio" | "file";
 5111    text?: string;
 5112    image_url?: {
 5113        url?: string;
 5114        detail?: "auto" | "low" | "high";
 5115    };
 5116    input_audio?: {
 5117        data?: string;
 5118        format?: "wav" | "mp3";
 5119    };
 5120    file?: {
 5121        file_data?: string;
 5122        file_id?: string;
 5123        filename?: string;
 5124    };
 5125};
 5126type UserMessage = {
 5127    role: "user";
 5128    content: string | Array<UserMessageContentPart>;
 5129    name?: string;
 5130};
 5131type AssistantMessageContentPart = {
 5132    type: "text" | "refusal";
 5133    text?: string;
 5134    refusal?: string;
 5135};
 5136type AssistantMessage = {
 5137    role: "assistant";
 5138    content?: string | null | Array<AssistantMessageContentPart>;
 5139    refusal?: string | null;
 5140    name?: string;
 5141    audio?: {
 5142        id: string;
 5143    };
 5144    tool_calls?: Array<ChatCompletionMessageToolCall>;
 5145    function_call?: {
 5146        name: string;
 5147        arguments: string;
 5148    };
 5149};
 5150type ToolMessage = {
 5151    role: "tool";
 5152    content: string | Array<{
 5153        type: "text";
 5154        text: string;
 5155    }>;
 5156    tool_call_id: string;
 5157};
 5158type FunctionMessage = {
 5159    role: "function";
 5160    content: string;
 5161    name: string;
 5162};
 5163type ChatCompletionMessageParam = DeveloperMessage | SystemMessage | UserMessage | AssistantMessage | ToolMessage | FunctionMessage;
 5164type ChatCompletionsResponseFormatText = {
 5165    type: "text";
 5166};
 5167type ChatCompletionsResponseFormatJSONObject = {
 5168    type: "json_object";
 5169};
 5170type ResponseFormatJSONSchema = {
 5171    type: "json_schema";
 5172    json_schema: {
 5173        name: string;
 5174        description?: string;
 5175        schema?: Record<string, unknown>;
 5176        strict?: boolean | null;
 5177    };
 5178};
 5179type ResponseFormat = ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJSONObject | ResponseFormatJSONSchema;
 5180type ChatCompletionsStreamOptions = {
 5181    include_usage?: boolean;
 5182    include_obfuscation?: boolean;
 5183};
 5184type PredictionContent = {
 5185    type: "content";
 5186    content: string | Array<{
 5187        type: "text";
 5188        text: string;
 5189    }>;
 5190};
 5191type AudioParams = {
 5192    voice: string | {
 5193        id: string;
 5194    };
 5195    format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";
 5196};
 5197type WebSearchUserLocation = {
 5198    type: "approximate";
 5199    approximate: {
 5200        city?: string;
 5201        country?: string;
 5202        region?: string;
 5203        timezone?: string;
 5204    };
 5205};
 5206type WebSearchOptions = {
 5207    search_context_size?: "low" | "medium" | "high";
 5208    user_location?: WebSearchUserLocation;
 5209};
 5210// Source of truth for per-model reasoning types: each model's `reasoning_effort` metadata
 5211// in Workers AI ConfigAPI (supported efforts, aliases, defaults, and whether reasoning can
 5212// be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk,
 5213// apps/worker-constellation-entry/scripts/build-types) turns it into the per-model
 5214// `inputs` types below; the developer docs model schemas come from the same metadata.
 5215type ChatTemplateKwargs = {
 5216    /** Whether to enable reasoning. Support and defaults depend on the model. */
 5217    enable_thinking?: boolean;
 5218    /** If false, preserves reasoning context between turns. */
 5219    clear_thinking?: boolean;
 5220};
 5221/** Shared optional properties used by both Prompt and Messages input branches. */
 5222type ChatCompletionsCommonOptions = {
 5223    model?: string;
 5224    audio?: AudioParams;
 5225    frequency_penalty?: number | null;
 5226    logit_bias?: Record<string, unknown> | null;
 5227    logprobs?: boolean | null;
 5228    top_logprobs?: number | null;
 5229    max_tokens?: number | null;
 5230    max_completion_tokens?: number | null;
 5231    metadata?: Record<string, unknown> | null;
 5232    modalities?: Array<"text" | "audio"> | null;
 5233    n?: number | null;
 5234    parallel_tool_calls?: boolean;
 5235    prediction?: PredictionContent;
 5236    presence_penalty?: number | null;
 5237    /** Reasoning effort. Supported levels depend on the model. */
 5238    reasoning_effort?: "low" | "medium" | "high" | null;
 5239    chat_template_kwargs?: ChatTemplateKwargs;
 5240    response_format?: ResponseFormat;
 5241    seed?: number | null;
 5242    service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
 5243    stop?: string | Array<string> | null;
 5244    store?: boolean | null;
 5245    stream?: boolean | null;
 5246    stream_options?: ChatCompletionsStreamOptions;
 5247    temperature?: number | null;
 5248    tool_choice?: ChatCompletionToolChoiceOption;
 5249    tools?: Array<ChatCompletionTool>;
 5250    top_p?: number | null;
 5251    user?: string;
 5252    web_search_options?: WebSearchOptions;
 5253    function_call?: "none" | "auto" | {
 5254        name: string;
 5255    };
 5256    functions?: Array<FunctionDefinition>;
 5257};
 5258type PromptTokensDetails = {
 5259    cached_tokens?: number;
 5260    audio_tokens?: number;
 5261};
 5262type CompletionTokensDetails = {
 5263    reasoning_tokens?: number;
 5264    audio_tokens?: number;
 5265    accepted_prediction_tokens?: number;
 5266    rejected_prediction_tokens?: number;
 5267};
 5268type CompletionUsage = {
 5269    prompt_tokens: number;
 5270    completion_tokens: number;
 5271    total_tokens: number;
 5272    prompt_tokens_details?: PromptTokensDetails;
 5273    completion_tokens_details?: CompletionTokensDetails;
 5274};
 5275type ChatCompletionTopLogprob = {
 5276    token: string;
 5277    logprob: number;
 5278    bytes: Array<number> | null;
 5279};
 5280type ChatCompletionTokenLogprob = {
 5281    token: string;
 5282    logprob: number;
 5283    bytes: Array<number> | null;
 5284    top_logprobs: Array<ChatCompletionTopLogprob>;
 5285};
 5286type ChatCompletionAudio = {
 5287    id: string;
 5288    /** Base64 encoded audio bytes. */
 5289    data: string;
 5290    expires_at: number;
 5291    transcript: string;
 5292};
 5293type ChatCompletionUrlCitation = {
 5294    type: "url_citation";
 5295    url_citation: {
 5296        url: string;
 5297        title: string;
 5298        start_index: number;
 5299        end_index: number;
 5300    };
 5301};
 5302type ChatCompletionResponseMessage = {
 5303    role: "assistant";
 5304    content: string | null;
 5305    refusal: string | null;
 5306    annotations?: Array<ChatCompletionUrlCitation>;
 5307    audio?: ChatCompletionAudio;
 5308    tool_calls?: Array<ChatCompletionMessageToolCall>;
 5309    function_call?: {
 5310        name: string;
 5311        arguments: string;
 5312    } | null;
 5313};
 5314type ChatCompletionLogprobs = {
 5315    content: Array<ChatCompletionTokenLogprob> | null;
 5316    refusal?: Array<ChatCompletionTokenLogprob> | null;
 5317};
 5318type ChatCompletionChoice = {
 5319    index: number;
 5320    message: ChatCompletionResponseMessage;
 5321    finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
 5322    logprobs: ChatCompletionLogprobs | null;
 5323};
 5324type ChatCompletionsMessagesInput = {
 5325    messages: Array<ChatCompletionMessageParam>;
 5326} & ChatCompletionsCommonOptions;
 5327type ChatCompletionsOutput = {
 5328    id: string;
 5329    object: string;
 5330    created: number;
 5331    model: string;
 5332    choices: Array<ChatCompletionChoice>;
 5333    usage?: CompletionUsage;
 5334    system_fingerprint?: string | null;
 5335    service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
 5336};
 5337/**
 5338 * Workers AI support for OpenAI's Responses API
 5339 * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
 5340 *
 5341 * It's a stripped down version from its source.
 5342 * It currently supports basic function calling, json mode and accepts images as input.
 5343 *
 5344 * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.
 5345 * We plan to add those incrementally as model + platform capabilities evolve.
 5346 */
 5347type ResponsesInput = {
 5348    background?: boolean | null;
 5349    conversation?: string | ResponseConversationParam | null;
 5350    include?: Array<ResponseIncludable> | null;
 5351    input?: string | ResponseInput;
 5352    instructions?: string | null;
 5353    max_output_tokens?: number | null;
 5354    parallel_tool_calls?: boolean | null;
 5355    previous_response_id?: string | null;
 5356    prompt_cache_key?: string;
 5357    reasoning?: Reasoning | null;
 5358    safety_identifier?: string;
 5359    service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
 5360    stream?: boolean | null;
 5361    stream_options?: StreamOptions | null;
 5362    temperature?: number | null;
 5363    text?: ResponseTextConfig;
 5364    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;
 5365    tools?: Array<Tool>;
 5366    top_p?: number | null;
 5367    truncation?: "auto" | "disabled" | null;
 5368};
 5369type ResponsesOutput = {
 5370    id?: string;
 5371    created_at?: number;
 5372    output_text?: string;
 5373    error?: ResponseError | null;
 5374    incomplete_details?: ResponseIncompleteDetails | null;
 5375    instructions?: string | Array<ResponseInputItem> | null;
 5376    object?: "response";
 5377    output?: Array<ResponseOutputItem>;
 5378    parallel_tool_calls?: boolean;
 5379    temperature?: number | null;
 5380    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;
 5381    tools?: Array<Tool>;
 5382    top_p?: number | null;
 5383    max_output_tokens?: number | null;
 5384    previous_response_id?: string | null;
 5385    prompt?: ResponsePrompt | null;
 5386    reasoning?: Reasoning | null;
 5387    safety_identifier?: string;
 5388    service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
 5389    status?: ResponseStatus;
 5390    text?: ResponseTextConfig;
 5391    truncation?: "auto" | "disabled" | null;
 5392    usage?: ResponseUsage;
 5393};
 5394type EasyInputMessage = {
 5395    content: string | ResponseInputMessageContentList;
 5396    role: "user" | "assistant" | "system" | "developer";
 5397    type?: "message";
 5398};
 5399type ResponsesFunctionTool = {
 5400    name: string;
 5401    parameters: {
 5402        [key: string]: unknown;
 5403    } | null;
 5404    strict: boolean | null;
 5405    type: "function";
 5406    description?: string | null;
 5407};
 5408type ResponseIncompleteDetails = {
 5409    reason?: "max_output_tokens" | "content_filter";
 5410};
 5411type ResponsePrompt = {
 5412    id: string;
 5413    variables?: {
 5414        [key: string]: string | ResponseInputText | ResponseInputImage;
 5415    } | null;
 5416    version?: string | null;
 5417};
 5418type Reasoning = {
 5419    effort?: ReasoningEffort | null;
 5420    generate_summary?: "auto" | "concise" | "detailed" | null;
 5421    summary?: "auto" | "concise" | "detailed" | null;
 5422};
 5423type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;
 5424type ResponseContentReasoningText = {
 5425    text: string;
 5426    type: "reasoning_text";
 5427};
 5428type ResponseConversationParam = {
 5429    id: string;
 5430};
 5431type ResponseCreatedEvent = {
 5432    response: Response;
 5433    sequence_number: number;
 5434    type: "response.created";
 5435};
 5436type ResponseCustomToolCallOutput = {
 5437    call_id: string;
 5438    output: string | Array<ResponseInputText | ResponseInputImage>;
 5439    type: "custom_tool_call_output";
 5440    id?: string;
 5441};
 5442type ResponseError = {
 5443    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";
 5444    message: string;
 5445};
 5446type ResponseErrorEvent = {
 5447    code: string | null;
 5448    message: string;
 5449    param: string | null;
 5450    sequence_number: number;
 5451    type: "error";
 5452};
 5453type ResponseFailedEvent = {
 5454    response: Response;
 5455    sequence_number: number;
 5456    type: "response.failed";
 5457};
 5458type ResponseFormatText = {
 5459    type: "text";
 5460};
 5461type ResponseFormatJSONObject = {
 5462    type: "json_object";
 5463};
 5464type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;
 5465type ResponseFormatTextJSONSchemaConfig = {
 5466    name: string;
 5467    schema: {
 5468        [key: string]: unknown;
 5469    };
 5470    type: "json_schema";
 5471    description?: string;
 5472    strict?: boolean | null;
 5473};
 5474type ResponseFunctionCallArgumentsDeltaEvent = {
 5475    delta: string;
 5476    item_id: string;
 5477    output_index: number;
 5478    sequence_number: number;
 5479    type: "response.function_call_arguments.delta";
 5480};
 5481type ResponseFunctionCallArgumentsDoneEvent = {
 5482    arguments: string;
 5483    item_id: string;
 5484    name: string;
 5485    output_index: number;
 5486    sequence_number: number;
 5487    type: "response.function_call_arguments.done";
 5488};
 5489type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;
 5490type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;
 5491type ResponseFunctionToolCall = {
 5492    arguments: string;
 5493    call_id: string;
 5494    name: string;
 5495    type: "function_call";
 5496    id?: string;
 5497    status?: "in_progress" | "completed" | "incomplete";
 5498};
 5499interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {
 5500    id: string;
 5501}
 5502type ResponseFunctionToolCallOutputItem = {
 5503    id: string;
 5504    call_id: string;
 5505    output: string | Array<ResponseInputText | ResponseInputImage>;
 5506    type: "function_call_output";
 5507    status?: "in_progress" | "completed" | "incomplete";
 5508};
 5509type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs";
 5510type ResponseIncompleteEvent = {
 5511    response: Response;
 5512    sequence_number: number;
 5513    type: "response.incomplete";
 5514};
 5515type ResponseInput = Array<ResponseInputItem>;
 5516type ResponseInputContent = ResponseInputText | ResponseInputImage;
 5517type ResponseInputImage = {
 5518    detail: "low" | "high" | "auto";
 5519    type: "input_image";
 5520    /**
 5521     * Base64 encoded image
 5522     */
 5523    image_url?: string | null;
 5524};
 5525type ResponseInputImageContent = {
 5526    type: "input_image";
 5527    detail?: "low" | "high" | "auto" | null;
 5528    /**
 5529     * Base64 encoded image
 5530     */
 5531    image_url?: string | null;
 5532};
 5533type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;
 5534type ResponseInputItemFunctionCallOutput = {
 5535    call_id: string;
 5536    output: string | ResponseFunctionCallOutputItemList;
 5537    type: "function_call_output";
 5538    id?: string | null;
 5539    status?: "in_progress" | "completed" | "incomplete" | null;
 5540};
 5541type ResponseInputItemMessage = {
 5542    content: ResponseInputMessageContentList;
 5543    role: "user" | "system" | "developer";
 5544    status?: "in_progress" | "completed" | "incomplete";
 5545    type?: "message";
 5546};
 5547type ResponseInputMessageContentList = Array<ResponseInputContent>;
 5548type ResponseInputMessageItem = {
 5549    id: string;
 5550    content: ResponseInputMessageContentList;
 5551    role: "user" | "system" | "developer";
 5552    status?: "in_progress" | "completed" | "incomplete";
 5553    type?: "message";
 5554};
 5555type ResponseInputText = {
 5556    text: string;
 5557    type: "input_text";
 5558};
 5559type ResponseInputTextContent = {
 5560    text: string;
 5561    type: "input_text";
 5562};
 5563type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;
 5564type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;
 5565type ResponseOutputItemAddedEvent = {
 5566    item: ResponseOutputItem;
 5567    output_index: number;
 5568    sequence_number: number;
 5569    type: "response.output_item.added";
 5570};
 5571type ResponseOutputItemDoneEvent = {
 5572    item: ResponseOutputItem;
 5573    output_index: number;
 5574    sequence_number: number;
 5575    type: "response.output_item.done";
 5576};
 5577type ResponseOutputMessage = {
 5578    id: string;
 5579    content: Array<ResponseOutputText | ResponseOutputRefusal>;
 5580    role: "assistant";
 5581    status: "in_progress" | "completed" | "incomplete";
 5582    type: "message";
 5583};
 5584type ResponseOutputRefusal = {
 5585    refusal: string;
 5586    type: "refusal";
 5587};
 5588type ResponseOutputText = {
 5589    text: string;
 5590    type: "output_text";
 5591    logprobs?: Array<Logprob>;
 5592};
 5593type ResponseReasoningItem = {
 5594    id: string;
 5595    summary: Array<ResponseReasoningSummaryItem>;
 5596    type: "reasoning";
 5597    content?: Array<ResponseReasoningContentItem>;
 5598    encrypted_content?: string | null;
 5599    status?: "in_progress" | "completed" | "incomplete";
 5600};
 5601type ResponseReasoningSummaryItem = {
 5602    text: string;
 5603    type: "summary_text";
 5604};
 5605type ResponseReasoningContentItem = {
 5606    text: string;
 5607    type: "reasoning_text";
 5608};
 5609type ResponseReasoningTextDeltaEvent = {
 5610    content_index: number;
 5611    delta: string;
 5612    item_id: string;
 5613    output_index: number;
 5614    sequence_number: number;
 5615    type: "response.reasoning_text.delta";
 5616};
 5617type ResponseReasoningTextDoneEvent = {
 5618    content_index: number;
 5619    item_id: string;
 5620    output_index: number;
 5621    sequence_number: number;
 5622    text: string;
 5623    type: "response.reasoning_text.done";
 5624};
 5625type ResponseRefusalDeltaEvent = {
 5626    content_index: number;
 5627    delta: string;
 5628    item_id: string;
 5629    output_index: number;
 5630    sequence_number: number;
 5631    type: "response.refusal.delta";
 5632};
 5633type ResponseRefusalDoneEvent = {
 5634    content_index: number;
 5635    item_id: string;
 5636    output_index: number;
 5637    refusal: string;
 5638    sequence_number: number;
 5639    type: "response.refusal.done";
 5640};
 5641type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete";
 5642type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;
 5643type ResponseCompletedEvent = {
 5644    response: Response;
 5645    sequence_number: number;
 5646    type: "response.completed";
 5647};
 5648type ResponseTextConfig = {
 5649    format?: ResponseFormatTextConfig;
 5650    verbosity?: "low" | "medium" | "high" | null;
 5651};
 5652type ResponseTextDeltaEvent = {
 5653    content_index: number;
 5654    delta: string;
 5655    item_id: string;
 5656    logprobs: Array<Logprob>;
 5657    output_index: number;
 5658    sequence_number: number;
 5659    type: "response.output_text.delta";
 5660};
 5661type ResponseTextDoneEvent = {
 5662    content_index: number;
 5663    item_id: string;
 5664    logprobs: Array<Logprob>;
 5665    output_index: number;
 5666    sequence_number: number;
 5667    text: string;
 5668    type: "response.output_text.done";
 5669};
 5670type Logprob = {
 5671    token: string;
 5672    logprob: number;
 5673    top_logprobs?: Array<TopLogprob>;
 5674};
 5675type TopLogprob = {
 5676    token?: string;
 5677    logprob?: number;
 5678};
 5679type ResponseUsage = {
 5680    input_tokens: number;
 5681    output_tokens: number;
 5682    total_tokens: number;
 5683};
 5684type Tool = ResponsesFunctionTool;
 5685type ToolChoiceFunction = {
 5686    name: string;
 5687    type: "function";
 5688};
 5689type ToolChoiceOptions = "none";
 5690type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
 5691type StreamOptions = {
 5692    include_obfuscation?: boolean;
 5693};
 5694/** Marks keys from T that aren't in U as optional never */
 5695type Without<T, U> = {
 5696    [P in Exclude<keyof T, keyof U>]?: never;
 5697};
 5698/** Either T or U, but not both (mutually exclusive) */
 5699type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);
 5700type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {
 5701    text: string | string[];
 5702    /**
 5703     * 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.
 5704     */
 5705    pooling?: "mean" | "cls";
 5706} | {
 5707    /**
 5708     * Batch of the embeddings requests to run using async-queue
 5709     */
 5710    requests: {
 5711        text: string | string[];
 5712        /**
 5713         * 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.
 5714         */
 5715        pooling?: "mean" | "cls";
 5716    }[];
 5717};
 5718type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {
 5719    shape?: number[];
 5720    /**
 5721     * Embeddings of the requested text values
 5722     */
 5723    data?: number[][];
 5724    /**
 5725     * The pooling method used in the embedding process.
 5726     */
 5727    pooling?: "mean" | "cls";
 5728} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;
 5729interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {
 5730    /**
 5731     * The async request id that can be used to obtain the results.
 5732     */
 5733    request_id?: string;
 5734}
 5735declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {
 5736    inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;
 5737    postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;
 5738}
 5739type Ai_Cf_Openai_Whisper_Input = string | {
 5740    /**
 5741     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
 5742     */
 5743    audio: number[];
 5744};
 5745interface Ai_Cf_Openai_Whisper_Output {
 5746    /**
 5747     * The transcription
 5748     */
 5749    text: string;
 5750    word_count?: number;
 5751    words?: {
 5752        word?: string;
 5753        /**
 5754         * The second this word begins in the recording
 5755         */
 5756        start?: number;
 5757        /**
 5758         * The ending second when the word completes
 5759         */
 5760        end?: number;
 5761    }[];
 5762    vtt?: string;
 5763}
 5764declare abstract class Base_Ai_Cf_Openai_Whisper {
 5765    inputs: Ai_Cf_Openai_Whisper_Input;
 5766    postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
 5767}
 5768type Ai_Cf_Meta_M2M100_1_2B_Input = {
 5769    /**
 5770     * The text to be translated
 5771     */
 5772    text: string;
 5773    /**
 5774     * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
 5775     */
 5776    source_lang?: string;
 5777    /**
 5778     * The language code to translate the text into (e.g., 'es' for Spanish)
 5779     */
 5780    target_lang: string;
 5781} | {
 5782    /**
 5783     * Batch of the embeddings requests to run using async-queue
 5784     */
 5785    requests: {
 5786        /**
 5787         * The text to be translated
 5788         */
 5789        text: string;
 5790        /**
 5791         * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified
 5792         */
 5793        source_lang?: string;
 5794        /**
 5795         * The language code to translate the text into (e.g., 'es' for Spanish)
 5796         */
 5797        target_lang: string;
 5798    }[];
 5799};
 5800type Ai_Cf_Meta_M2M100_1_2B_Output = {
 5801    /**
 5802     * The translated text in the target language
 5803     */
 5804    translated_text?: string;
 5805} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;
 5806interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {
 5807    /**
 5808     * The async request id that can be used to obtain the results.
 5809     */
 5810    request_id?: string;
 5811}
 5812declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {
 5813    inputs: Ai_Cf_Meta_M2M100_1_2B_Input;
 5814    postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;
 5815}
 5816type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {
 5817    text: string | string[];
 5818    /**
 5819     * 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.
 5820     */
 5821    pooling?: "mean" | "cls";
 5822} | {
 5823    /**
 5824     * Batch of the embeddings requests to run using async-queue
 5825     */
 5826    requests: {
 5827        text: string | string[];
 5828        /**
 5829         * 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.
 5830         */
 5831        pooling?: "mean" | "cls";
 5832    }[];
 5833};
 5834type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {
 5835    shape?: number[];
 5836    /**
 5837     * Embeddings of the requested text values
 5838     */
 5839    data?: number[][];
 5840    /**
 5841     * The pooling method used in the embedding process.
 5842     */
 5843    pooling?: "mean" | "cls";
 5844} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;
 5845interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {
 5846    /**
 5847     * The async request id that can be used to obtain the results.
 5848     */
 5849    request_id?: string;
 5850}
 5851declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {
 5852    inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;
 5853    postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;
 5854}
 5855type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {
 5856    text: string | string[];
 5857    /**
 5858     * 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.
 5859     */
 5860    pooling?: "mean" | "cls";
 5861} | {
 5862    /**
 5863     * Batch of the embeddings requests to run using async-queue
 5864     */
 5865    requests: {
 5866        text: string | string[];
 5867        /**
 5868         * 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.
 5869         */
 5870        pooling?: "mean" | "cls";
 5871    }[];
 5872};
 5873type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {
 5874    shape?: number[];
 5875    /**
 5876     * Embeddings of the requested text values
 5877     */
 5878    data?: number[][];
 5879    /**
 5880     * The pooling method used in the embedding process.
 5881     */
 5882    pooling?: "mean" | "cls";
 5883} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;
 5884interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {
 5885    /**
 5886     * The async request id that can be used to obtain the results.
 5887     */
 5888    request_id?: string;
 5889}
 5890declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {
 5891    inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;
 5892    postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;
 5893}
 5894type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {
 5895    /**
 5896     * The input text prompt for the model to generate a response.
 5897     */
 5898    prompt?: string;
 5899    /**
 5900     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 5901     */
 5902    raw?: boolean;
 5903    /**
 5904     * 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.
 5905     */
 5906    top_p?: number;
 5907    /**
 5908     * 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.
 5909     */
 5910    top_k?: number;
 5911    /**
 5912     * Random seed for reproducibility of the generation.
 5913     */
 5914    seed?: number;
 5915    /**
 5916     * Penalty for repeated tokens; higher values discourage repetition.
 5917     */
 5918    repetition_penalty?: number;
 5919    /**
 5920     * Decreases the likelihood of the model repeating the same lines verbatim.
 5921     */
 5922    frequency_penalty?: number;
 5923    /**
 5924     * Increases the likelihood of the model introducing new topics.
 5925     */
 5926    presence_penalty?: number;
 5927    image: number[] | (string & NonNullable<unknown>);
 5928    /**
 5929     * The maximum number of tokens to generate in the response.
 5930     */
 5931    max_tokens?: number;
 5932};
 5933interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {
 5934    description?: string;
 5935}
 5936declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {
 5937    inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;
 5938    postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;
 5939}
 5940type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {
 5941    /**
 5942     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
 5943     */
 5944    audio: number[];
 5945};
 5946interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
 5947    /**
 5948     * The transcription
 5949     */
 5950    text: string;
 5951    word_count?: number;
 5952    words?: {
 5953        word?: string;
 5954        /**
 5955         * The second this word begins in the recording
 5956         */
 5957        start?: number;
 5958        /**
 5959         * The ending second when the word completes
 5960         */
 5961        end?: number;
 5962    }[];
 5963    vtt?: string;
 5964}
 5965declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
 5966    inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
 5967    postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
 5968}
 5969interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
 5970    audio: string | {
 5971        body?: object;
 5972        contentType?: string;
 5973    };
 5974    /**
 5975     * Supported tasks are 'translate' or 'transcribe'.
 5976     */
 5977    task?: string;
 5978    /**
 5979     * The language of the audio being transcribed or translated.
 5980     */
 5981    language?: string;
 5982    /**
 5983     * Preprocess the audio with a voice activity detection model.
 5984     */
 5985    vad_filter?: boolean;
 5986    /**
 5987     * A text prompt to help provide context to the model on the contents of the audio.
 5988     */
 5989    initial_prompt?: string;
 5990    /**
 5991     * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.
 5992     */
 5993    prefix?: string;
 5994    /**
 5995     * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.
 5996     */
 5997    beam_size?: number;
 5998    /**
 5999     * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.
 6000     */
 6001    condition_on_previous_text?: boolean;
 6002    /**
 6003     * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.
 6004     */
 6005    no_speech_threshold?: number;
 6006    /**
 6007     * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.
 6008     */
 6009    compression_ratio_threshold?: number;
 6010    /**
 6011     * Threshold for filtering out segments with low average log probability, indicating low confidence.
 6012     */
 6013    log_prob_threshold?: number;
 6014    /**
 6015     * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.
 6016     */
 6017    hallucination_silence_threshold?: number;
 6018}
 6019interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
 6020    transcription_info?: {
 6021        /**
 6022         * The language of the audio being transcribed or translated.
 6023         */
 6024        language?: string;
 6025        /**
 6026         * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
 6027         */
 6028        language_probability?: number;
 6029        /**
 6030         * The total duration of the original audio file, in seconds.
 6031         */
 6032        duration?: number;
 6033        /**
 6034         * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
 6035         */
 6036        duration_after_vad?: number;
 6037    };
 6038    /**
 6039     * The complete transcription of the audio.
 6040     */
 6041    text: string;
 6042    /**
 6043     * The total number of words in the transcription.
 6044     */
 6045    word_count?: number;
 6046    segments?: {
 6047        /**
 6048         * The starting time of the segment within the audio, in seconds.
 6049         */
 6050        start?: number;
 6051        /**
 6052         * The ending time of the segment within the audio, in seconds.
 6053         */
 6054        end?: number;
 6055        /**
 6056         * The transcription of the segment.
 6057         */
 6058        text?: string;
 6059        /**
 6060         * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
 6061         */
 6062        temperature?: number;
 6063        /**
 6064         * The average log probability of the predictions for the words in this segment, indicating overall confidence.
 6065         */
 6066        avg_logprob?: number;
 6067        /**
 6068         * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
 6069         */
 6070        compression_ratio?: number;
 6071        /**
 6072         * The probability that the segment contains no speech, represented as a decimal between 0 and 1.
 6073         */
 6074        no_speech_prob?: number;
 6075        words?: {
 6076            /**
 6077             * The individual word transcribed from the audio.
 6078             */
 6079            word?: string;
 6080            /**
 6081             * The starting time of the word within the audio, in seconds.
 6082             */
 6083            start?: number;
 6084            /**
 6085             * The ending time of the word within the audio, in seconds.
 6086             */
 6087            end?: number;
 6088        }[];
 6089    }[];
 6090    /**
 6091     * The transcription in WebVTT format, which includes timing and text information for use in subtitles.
 6092     */
 6093    vtt?: string;
 6094}
 6095declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
 6096    inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
 6097    postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
 6098}
 6099type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {
 6100    /**
 6101     * Batch of the embeddings requests to run using async-queue
 6102     */
 6103    requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];
 6104};
 6105interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {
 6106    /**
 6107     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
 6108     */
 6109    query?: string;
 6110    /**
 6111     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
 6112     */
 6113    contexts: {
 6114        /**
 6115         * One of the provided context content
 6116         */
 6117        text?: string;
 6118    }[];
 6119    /**
 6120     * When provided with too long context should the model error out or truncate the context to fit?
 6121     */
 6122    truncate_inputs?: boolean;
 6123}
 6124interface Ai_Cf_Baai_Bge_M3_Input_Embedding {
 6125    text: string | string[];
 6126    /**
 6127     * When provided with too long context should the model error out or truncate the context to fit?
 6128     */
 6129    truncate_inputs?: boolean;
 6130}
 6131interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {
 6132    /**
 6133     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
 6134     */
 6135    query?: string;
 6136    /**
 6137     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
 6138     */
 6139    contexts: {
 6140        /**
 6141         * One of the provided context content
 6142         */
 6143        text?: string;
 6144    }[];
 6145    /**
 6146     * When provided with too long context should the model error out or truncate the context to fit?
 6147     */
 6148    truncate_inputs?: boolean;
 6149}
 6150interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
 6151    text: string | string[];
 6152    /**
 6153     * When provided with too long context should the model error out or truncate the context to fit?
 6154     */
 6155    truncate_inputs?: boolean;
 6156}
 6157type 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;
 6158interface Ai_Cf_Baai_Bge_M3_Output_Query {
 6159    response?: {
 6160        /**
 6161         * Index of the context in the request
 6162         */
 6163        id?: number;
 6164        /**
 6165         * Score of the context under the index.
 6166         */
 6167        score?: number;
 6168    }[];
 6169}
 6170interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
 6171    response?: number[][];
 6172    shape?: number[];
 6173    /**
 6174     * The pooling method used in the embedding process.
 6175     */
 6176    pooling?: "mean" | "cls";
 6177}
 6178interface Ai_Cf_Baai_Bge_M3_Output_Embedding {
 6179    shape?: number[];
 6180    /**
 6181     * Embeddings of the requested text values
 6182     */
 6183    data?: number[][];
 6184    /**
 6185     * The pooling method used in the embedding process.
 6186     */
 6187    pooling?: "mean" | "cls";
 6188}
 6189interface Ai_Cf_Baai_Bge_M3_AsyncResponse {
 6190    /**
 6191     * The async request id that can be used to obtain the results.
 6192     */
 6193    request_id?: string;
 6194}
 6195declare abstract class Base_Ai_Cf_Baai_Bge_M3 {
 6196    inputs: Ai_Cf_Baai_Bge_M3_Input;
 6197    postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;
 6198}
 6199interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
 6200    /**
 6201     * A text description of the image you want to generate.
 6202     */
 6203    prompt: string;
 6204    /**
 6205     * The number of diffusion steps; higher values can improve quality but take longer.
 6206     */
 6207    steps?: number;
 6208}
 6209interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
 6210    /**
 6211     * The generated image in Base64 format.
 6212     */
 6213    image?: string;
 6214}
 6215declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
 6216    inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
 6217    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
 6218}
 6219type 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;
 6220interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {
 6221    /**
 6222     * The input text prompt for the model to generate a response.
 6223     */
 6224    prompt: string;
 6225    image?: number[] | (string & NonNullable<unknown>);
 6226    /**
 6227     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 6228     */
 6229    raw?: boolean;
 6230    /**
 6231     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 6232     */
 6233    stream?: boolean;
 6234    /**
 6235     * The maximum number of tokens to generate in the response.
 6236     */
 6237    max_tokens?: number;
 6238    /**
 6239     * Controls the randomness of the output; higher values produce more random results.
 6240     */
 6241    temperature?: number;
 6242    /**
 6243     * 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.
 6244     */
 6245    top_p?: number;
 6246    /**
 6247     * 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.
 6248     */
 6249    top_k?: number;
 6250    /**
 6251     * Random seed for reproducibility of the generation.
 6252     */
 6253    seed?: number;
 6254    /**
 6255     * Penalty for repeated tokens; higher values discourage repetition.
 6256     */
 6257    repetition_penalty?: number;
 6258    /**
 6259     * Decreases the likelihood of the model repeating the same lines verbatim.
 6260     */
 6261    frequency_penalty?: number;
 6262    /**
 6263     * Increases the likelihood of the model introducing new topics.
 6264     */
 6265    presence_penalty?: number;
 6266    /**
 6267     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 6268     */
 6269    lora?: string;
 6270}
 6271interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
 6272    /**
 6273     * An array of message objects representing the conversation history.
 6274     */
 6275    messages: {
 6276        /**
 6277         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 6278         */
 6279        role?: string;
 6280        /**
 6281         * The tool call id. If you don't know what to put here you can fall back to 000000001
 6282         */
 6283        tool_call_id?: string;
 6284        content?: string | {
 6285            /**
 6286             * Type of the content provided
 6287             */
 6288            type?: string;
 6289            text?: string;
 6290            image_url?: {
 6291                /**
 6292                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 6293                 */
 6294                url?: string;
 6295            };
 6296        }[] | {
 6297            /**
 6298             * Type of the content provided
 6299             */
 6300            type?: string;
 6301            text?: string;
 6302            image_url?: {
 6303                /**
 6304                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 6305                 */
 6306                url?: string;
 6307            };
 6308        };
 6309    }[];
 6310    image?: number[] | (string & NonNullable<unknown>);
 6311    functions?: {
 6312        name: string;
 6313        code: string;
 6314    }[];
 6315    /**
 6316     * A list of tools available for the assistant to use.
 6317     */
 6318    tools?: ({
 6319        /**
 6320         * The name of the tool. More descriptive the better.
 6321         */
 6322        name: string;
 6323        /**
 6324         * A brief description of what the tool does.
 6325         */
 6326        description: string;
 6327        /**
 6328         * Schema defining the parameters accepted by the tool.
 6329         */
 6330        parameters: {
 6331            /**
 6332             * The type of the parameters object (usually 'object').
 6333             */
 6334            type: string;
 6335            /**
 6336             * List of required parameter names.
 6337             */
 6338            required?: string[];
 6339            /**
 6340             * Definitions of each parameter.
 6341             */
 6342            properties: {
 6343                [k: string]: {
 6344                    /**
 6345                     * The data type of the parameter.
 6346                     */
 6347                    type: string;
 6348                    /**
 6349                     * A description of the expected parameter.
 6350                     */
 6351                    description: string;
 6352                };
 6353            };
 6354        };
 6355    } | {
 6356        /**
 6357         * Specifies the type of tool (e.g., 'function').
 6358         */
 6359        type: string;
 6360        /**
 6361         * Details of the function tool.
 6362         */
 6363        function: {
 6364            /**
 6365             * The name of the function.
 6366             */
 6367            name: string;
 6368            /**
 6369             * A brief description of what the function does.
 6370             */
 6371            description: string;
 6372            /**
 6373             * Schema defining the parameters accepted by the function.
 6374             */
 6375            parameters: {
 6376                /**
 6377                 * The type of the parameters object (usually 'object').
 6378                 */
 6379                type: string;
 6380                /**
 6381                 * List of required parameter names.
 6382                 */
 6383                required?: string[];
 6384                /**
 6385                 * Definitions of each parameter.
 6386                 */
 6387                properties: {
 6388                    [k: string]: {
 6389                        /**
 6390                         * The data type of the parameter.
 6391                         */
 6392                        type: string;
 6393                        /**
 6394                         * A description of the expected parameter.
 6395                         */
 6396                        description: string;
 6397                    };
 6398                };
 6399            };
 6400        };
 6401    })[];
 6402    /**
 6403     * If true, the response will be streamed back incrementally.
 6404     */
 6405    stream?: boolean;
 6406    /**
 6407     * The maximum number of tokens to generate in the response.
 6408     */
 6409    max_tokens?: number;
 6410    /**
 6411     * Controls the randomness of the output; higher values produce more random results.
 6412     */
 6413    temperature?: number;
 6414    /**
 6415     * 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.
 6416     */
 6417    top_p?: number;
 6418    /**
 6419     * 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.
 6420     */
 6421    top_k?: number;
 6422    /**
 6423     * Random seed for reproducibility of the generation.
 6424     */
 6425    seed?: number;
 6426    /**
 6427     * Penalty for repeated tokens; higher values discourage repetition.
 6428     */
 6429    repetition_penalty?: number;
 6430    /**
 6431     * Decreases the likelihood of the model repeating the same lines verbatim.
 6432     */
 6433    frequency_penalty?: number;
 6434    /**
 6435     * Increases the likelihood of the model introducing new topics.
 6436     */
 6437    presence_penalty?: number;
 6438}
 6439type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {
 6440    /**
 6441     * The generated text response from the model
 6442     */
 6443    response?: string;
 6444    /**
 6445     * An array of tool calls requests made during the response generation
 6446     */
 6447    tool_calls?: {
 6448        /**
 6449         * The arguments passed to be passed to the tool call request
 6450         */
 6451        arguments?: object;
 6452        /**
 6453         * The name of the tool to be called
 6454         */
 6455        name?: string;
 6456    }[];
 6457};
 6458declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
 6459    inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
 6460    postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
 6461}
 6462type 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;
 6463interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {
 6464    /**
 6465     * The input text prompt for the model to generate a response.
 6466     */
 6467    prompt: string;
 6468    /**
 6469     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 6470     */
 6471    lora?: string;
 6472    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;
 6473    /**
 6474     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 6475     */
 6476    raw?: boolean;
 6477    /**
 6478     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 6479     */
 6480    stream?: boolean;
 6481    /**
 6482     * The maximum number of tokens to generate in the response.
 6483     */
 6484    max_tokens?: number;
 6485    /**
 6486     * Controls the randomness of the output; higher values produce more random results.
 6487     */
 6488    temperature?: number;
 6489    /**
 6490     * 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.
 6491     */
 6492    top_p?: number;
 6493    /**
 6494     * 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.
 6495     */
 6496    top_k?: number;
 6497    /**
 6498     * Random seed for reproducibility of the generation.
 6499     */
 6500    seed?: number;
 6501    /**
 6502     * Penalty for repeated tokens; higher values discourage repetition.
 6503     */
 6504    repetition_penalty?: number;
 6505    /**
 6506     * Decreases the likelihood of the model repeating the same lines verbatim.
 6507     */
 6508    frequency_penalty?: number;
 6509    /**
 6510     * Increases the likelihood of the model introducing new topics.
 6511     */
 6512    presence_penalty?: number;
 6513}
 6514interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {
 6515    type?: "json_object" | "json_schema";
 6516    json_schema?: unknown;
 6517}
 6518interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
 6519    /**
 6520     * An array of message objects representing the conversation history.
 6521     */
 6522    messages: {
 6523        /**
 6524         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 6525         */
 6526        role: string;
 6527        content: string | {
 6528            /**
 6529             * Type of the content (text)
 6530             */
 6531            type?: string;
 6532            /**
 6533             * Text content
 6534             */
 6535            text?: string;
 6536        }[];
 6537    }[];
 6538    functions?: {
 6539        name: string;
 6540        code: string;
 6541    }[];
 6542    /**
 6543     * A list of tools available for the assistant to use.
 6544     */
 6545    tools?: ({
 6546        /**
 6547         * The name of the tool. More descriptive the better.
 6548         */
 6549        name: string;
 6550        /**
 6551         * A brief description of what the tool does.
 6552         */
 6553        description: string;
 6554        /**
 6555         * Schema defining the parameters accepted by the tool.
 6556         */
 6557        parameters: {
 6558            /**
 6559             * The type of the parameters object (usually 'object').
 6560             */
 6561            type: string;
 6562            /**
 6563             * List of required parameter names.
 6564             */
 6565            required?: string[];
 6566            /**
 6567             * Definitions of each parameter.
 6568             */
 6569            properties: {
 6570                [k: string]: {
 6571                    /**
 6572                     * The data type of the parameter.
 6573                     */
 6574                    type: string;
 6575                    /**
 6576                     * A description of the expected parameter.
 6577                     */
 6578                    description: string;
 6579                };
 6580            };
 6581        };
 6582    } | {
 6583        /**
 6584         * Specifies the type of tool (e.g., 'function').
 6585         */
 6586        type: string;
 6587        /**
 6588         * Details of the function tool.
 6589         */
 6590        function: {
 6591            /**
 6592             * The name of the function.
 6593             */
 6594            name: string;
 6595            /**
 6596             * A brief description of what the function does.
 6597             */
 6598            description: string;
 6599            /**
 6600             * Schema defining the parameters accepted by the function.
 6601             */
 6602            parameters: {
 6603                /**
 6604                 * The type of the parameters object (usually 'object').
 6605                 */
 6606                type: string;
 6607                /**
 6608                 * List of required parameter names.
 6609                 */
 6610                required?: string[];
 6611                /**
 6612                 * Definitions of each parameter.
 6613                 */
 6614                properties: {
 6615                    [k: string]: {
 6616                        /**
 6617                         * The data type of the parameter.
 6618                         */
 6619                        type: string;
 6620                        /**
 6621                         * A description of the expected parameter.
 6622                         */
 6623                        description: string;
 6624                    };
 6625                };
 6626            };
 6627        };
 6628    })[];
 6629    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;
 6630    /**
 6631     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 6632     */
 6633    raw?: boolean;
 6634    /**
 6635     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 6636     */
 6637    stream?: boolean;
 6638    /**
 6639     * The maximum number of tokens to generate in the response.
 6640     */
 6641    max_tokens?: number;
 6642    /**
 6643     * Controls the randomness of the output; higher values produce more random results.
 6644     */
 6645    temperature?: number;
 6646    /**
 6647     * 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.
 6648     */
 6649    top_p?: number;
 6650    /**
 6651     * 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.
 6652     */
 6653    top_k?: number;
 6654    /**
 6655     * Random seed for reproducibility of the generation.
 6656     */
 6657    seed?: number;
 6658    /**
 6659     * Penalty for repeated tokens; higher values discourage repetition.
 6660     */
 6661    repetition_penalty?: number;
 6662    /**
 6663     * Decreases the likelihood of the model repeating the same lines verbatim.
 6664     */
 6665    frequency_penalty?: number;
 6666    /**
 6667     * Increases the likelihood of the model introducing new topics.
 6668     */
 6669    presence_penalty?: number;
 6670}
 6671interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {
 6672    type?: "json_object" | "json_schema";
 6673    json_schema?: unknown;
 6674}
 6675interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {
 6676    requests?: {
 6677        /**
 6678         * 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.
 6679         */
 6680        external_reference?: string;
 6681        /**
 6682         * Prompt for the text generation model
 6683         */
 6684        prompt?: string;
 6685        /**
 6686         * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 6687         */
 6688        stream?: boolean;
 6689        /**
 6690         * The maximum number of tokens to generate in the response.
 6691         */
 6692        max_tokens?: number;
 6693        /**
 6694         * Controls the randomness of the output; higher values produce more random results.
 6695         */
 6696        temperature?: number;
 6697        /**
 6698         * 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.
 6699         */
 6700        top_p?: number;
 6701        /**
 6702         * Random seed for reproducibility of the generation.
 6703         */
 6704        seed?: number;
 6705        /**
 6706         * Penalty for repeated tokens; higher values discourage repetition.
 6707         */
 6708        repetition_penalty?: number;
 6709        /**
 6710         * Decreases the likelihood of the model repeating the same lines verbatim.
 6711         */
 6712        frequency_penalty?: number;
 6713        /**
 6714         * Increases the likelihood of the model introducing new topics.
 6715         */
 6716        presence_penalty?: number;
 6717        response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;
 6718    }[];
 6719}
 6720interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {
 6721    type?: "json_object" | "json_schema";
 6722    json_schema?: unknown;
 6723}
 6724type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {
 6725    /**
 6726     * The generated text response from the model
 6727     */
 6728    response: string;
 6729    /**
 6730     * Usage statistics for the inference request
 6731     */
 6732    usage?: {
 6733        /**
 6734         * Total number of tokens in input
 6735         */
 6736        prompt_tokens?: number;
 6737        /**
 6738         * Total number of tokens in output
 6739         */
 6740        completion_tokens?: number;
 6741        /**
 6742         * Total number of input and output tokens
 6743         */
 6744        total_tokens?: number;
 6745    };
 6746    /**
 6747     * An array of tool calls requests made during the response generation
 6748     */
 6749    tool_calls?: {
 6750        /**
 6751         * The arguments passed to be passed to the tool call request
 6752         */
 6753        arguments?: object;
 6754        /**
 6755         * The name of the tool to be called
 6756         */
 6757        name?: string;
 6758    }[];
 6759} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;
 6760interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {
 6761    /**
 6762     * The async request id that can be used to obtain the results.
 6763     */
 6764    request_id?: string;
 6765}
 6766declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {
 6767    inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;
 6768    postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;
 6769}
 6770interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {
 6771    /**
 6772     * An array of message objects representing the conversation history.
 6773     */
 6774    messages: {
 6775        /**
 6776         * The role of the message sender must alternate between 'user' and 'assistant'.
 6777         */
 6778        role: "user" | "assistant";
 6779        /**
 6780         * The content of the message as a string.
 6781         */
 6782        content: string;
 6783    }[];
 6784    /**
 6785     * The maximum number of tokens to generate in the response.
 6786     */
 6787    max_tokens?: number;
 6788    /**
 6789     * Controls the randomness of the output; higher values produce more random results.
 6790     */
 6791    temperature?: number;
 6792    /**
 6793     * Dictate the output format of the generated response.
 6794     */
 6795    response_format?: {
 6796        /**
 6797         * Set to json_object to process and output generated text as JSON.
 6798         */
 6799        type?: string;
 6800    };
 6801}
 6802interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {
 6803    response?: string | {
 6804        /**
 6805         * Whether the conversation is safe or not.
 6806         */
 6807        safe?: boolean;
 6808        /**
 6809         * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.
 6810         */
 6811        categories?: string[];
 6812    };
 6813    /**
 6814     * Usage statistics for the inference request
 6815     */
 6816    usage?: {
 6817        /**
 6818         * Total number of tokens in input
 6819         */
 6820        prompt_tokens?: number;
 6821        /**
 6822         * Total number of tokens in output
 6823         */
 6824        completion_tokens?: number;
 6825        /**
 6826         * Total number of input and output tokens
 6827         */
 6828        total_tokens?: number;
 6829    };
 6830}
 6831declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {
 6832    inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;
 6833    postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;
 6834}
 6835interface Ai_Cf_Baai_Bge_Reranker_Base_Input {
 6836    /**
 6837     * A query you wish to perform against the provided contexts.
 6838     */
 6839    /**
 6840     * Number of returned results starting with the best score.
 6841     */
 6842    top_k?: number;
 6843    /**
 6844     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.
 6845     */
 6846    contexts: {
 6847        /**
 6848         * One of the provided context content
 6849         */
 6850        text?: string;
 6851    }[];
 6852}
 6853interface Ai_Cf_Baai_Bge_Reranker_Base_Output {
 6854    response?: {
 6855        /**
 6856         * Index of the context in the request
 6857         */
 6858        id?: number;
 6859        /**
 6860         * Score of the context under the index.
 6861         */
 6862        score?: number;
 6863    }[];
 6864}
 6865declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {
 6866    inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;
 6867    postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;
 6868}
 6869type 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;
 6870interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {
 6871    /**
 6872     * The input text prompt for the model to generate a response.
 6873     */
 6874    prompt: string;
 6875    /**
 6876     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 6877     */
 6878    lora?: string;
 6879    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;
 6880    /**
 6881     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 6882     */
 6883    raw?: boolean;
 6884    /**
 6885     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 6886     */
 6887    stream?: boolean;
 6888    /**
 6889     * The maximum number of tokens to generate in the response.
 6890     */
 6891    max_tokens?: number;
 6892    /**
 6893     * Controls the randomness of the output; higher values produce more random results.
 6894     */
 6895    temperature?: number;
 6896    /**
 6897     * 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.
 6898     */
 6899    top_p?: number;
 6900    /**
 6901     * 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.
 6902     */
 6903    top_k?: number;
 6904    /**
 6905     * Random seed for reproducibility of the generation.
 6906     */
 6907    seed?: number;
 6908    /**
 6909     * Penalty for repeated tokens; higher values discourage repetition.
 6910     */
 6911    repetition_penalty?: number;
 6912    /**
 6913     * Decreases the likelihood of the model repeating the same lines verbatim.
 6914     */
 6915    frequency_penalty?: number;
 6916    /**
 6917     * Increases the likelihood of the model introducing new topics.
 6918     */
 6919    presence_penalty?: number;
 6920}
 6921interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {
 6922    type?: "json_object" | "json_schema";
 6923    json_schema?: unknown;
 6924}
 6925interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {
 6926    /**
 6927     * An array of message objects representing the conversation history.
 6928     */
 6929    messages: {
 6930        /**
 6931         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 6932         */
 6933        role: string;
 6934        /**
 6935         * The content of the message as a string.
 6936         */
 6937        content: string;
 6938    }[];
 6939    functions?: {
 6940        name: string;
 6941        code: string;
 6942    }[];
 6943    /**
 6944     * A list of tools available for the assistant to use.
 6945     */
 6946    tools?: ({
 6947        /**
 6948         * The name of the tool. More descriptive the better.
 6949         */
 6950        name: string;
 6951        /**
 6952         * A brief description of what the tool does.
 6953         */
 6954        description: string;
 6955        /**
 6956         * Schema defining the parameters accepted by the tool.
 6957         */
 6958        parameters: {
 6959            /**
 6960             * The type of the parameters object (usually 'object').
 6961             */
 6962            type: string;
 6963            /**
 6964             * List of required parameter names.
 6965             */
 6966            required?: string[];
 6967            /**
 6968             * Definitions of each parameter.
 6969             */
 6970            properties: {
 6971                [k: string]: {
 6972                    /**
 6973                     * The data type of the parameter.
 6974                     */
 6975                    type: string;
 6976                    /**
 6977                     * A description of the expected parameter.
 6978                     */
 6979                    description: string;
 6980                };
 6981            };
 6982        };
 6983    } | {
 6984        /**
 6985         * Specifies the type of tool (e.g., 'function').
 6986         */
 6987        type: string;
 6988        /**
 6989         * Details of the function tool.
 6990         */
 6991        function: {
 6992            /**
 6993             * The name of the function.
 6994             */
 6995            name: string;
 6996            /**
 6997             * A brief description of what the function does.
 6998             */
 6999            description: string;
 7000            /**
 7001             * Schema defining the parameters accepted by the function.
 7002             */
 7003            parameters: {
 7004                /**
 7005                 * The type of the parameters object (usually 'object').
 7006                 */
 7007                type: string;
 7008                /**
 7009                 * List of required parameter names.
 7010                 */
 7011                required?: string[];
 7012                /**
 7013                 * Definitions of each parameter.
 7014                 */
 7015                properties: {
 7016                    [k: string]: {
 7017                        /**
 7018                         * The data type of the parameter.
 7019                         */
 7020                        type: string;
 7021                        /**
 7022                         * A description of the expected parameter.
 7023                         */
 7024                        description: string;
 7025                    };
 7026                };
 7027            };
 7028        };
 7029    })[];
 7030    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;
 7031    /**
 7032     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7033     */
 7034    raw?: boolean;
 7035    /**
 7036     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7037     */
 7038    stream?: boolean;
 7039    /**
 7040     * The maximum number of tokens to generate in the response.
 7041     */
 7042    max_tokens?: number;
 7043    /**
 7044     * Controls the randomness of the output; higher values produce more random results.
 7045     */
 7046    temperature?: number;
 7047    /**
 7048     * 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.
 7049     */
 7050    top_p?: number;
 7051    /**
 7052     * 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.
 7053     */
 7054    top_k?: number;
 7055    /**
 7056     * Random seed for reproducibility of the generation.
 7057     */
 7058    seed?: number;
 7059    /**
 7060     * Penalty for repeated tokens; higher values discourage repetition.
 7061     */
 7062    repetition_penalty?: number;
 7063    /**
 7064     * Decreases the likelihood of the model repeating the same lines verbatim.
 7065     */
 7066    frequency_penalty?: number;
 7067    /**
 7068     * Increases the likelihood of the model introducing new topics.
 7069     */
 7070    presence_penalty?: number;
 7071}
 7072interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {
 7073    type?: "json_object" | "json_schema";
 7074    json_schema?: unknown;
 7075}
 7076type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {
 7077    /**
 7078     * The generated text response from the model
 7079     */
 7080    response: string;
 7081    /**
 7082     * Usage statistics for the inference request
 7083     */
 7084    usage?: {
 7085        /**
 7086         * Total number of tokens in input
 7087         */
 7088        prompt_tokens?: number;
 7089        /**
 7090         * Total number of tokens in output
 7091         */
 7092        completion_tokens?: number;
 7093        /**
 7094         * Total number of input and output tokens
 7095         */
 7096        total_tokens?: number;
 7097    };
 7098    /**
 7099     * An array of tool calls requests made during the response generation
 7100     */
 7101    tool_calls?: {
 7102        /**
 7103         * The arguments passed to be passed to the tool call request
 7104         */
 7105        arguments?: object;
 7106        /**
 7107         * The name of the tool to be called
 7108         */
 7109        name?: string;
 7110    }[];
 7111};
 7112declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {
 7113    inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;
 7114    postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;
 7115}
 7116type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;
 7117interface Ai_Cf_Qwen_Qwq_32B_Prompt {
 7118    /**
 7119     * The input text prompt for the model to generate a response.
 7120     */
 7121    prompt: string;
 7122    /**
 7123     * JSON schema that should be fulfilled for the response.
 7124     */
 7125    guided_json?: object;
 7126    /**
 7127     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7128     */
 7129    raw?: boolean;
 7130    /**
 7131     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7132     */
 7133    stream?: boolean;
 7134    /**
 7135     * The maximum number of tokens to generate in the response.
 7136     */
 7137    max_tokens?: number;
 7138    /**
 7139     * Controls the randomness of the output; higher values produce more random results.
 7140     */
 7141    temperature?: number;
 7142    /**
 7143     * 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.
 7144     */
 7145    top_p?: number;
 7146    /**
 7147     * 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.
 7148     */
 7149    top_k?: number;
 7150    /**
 7151     * Random seed for reproducibility of the generation.
 7152     */
 7153    seed?: number;
 7154    /**
 7155     * Penalty for repeated tokens; higher values discourage repetition.
 7156     */
 7157    repetition_penalty?: number;
 7158    /**
 7159     * Decreases the likelihood of the model repeating the same lines verbatim.
 7160     */
 7161    frequency_penalty?: number;
 7162    /**
 7163     * Increases the likelihood of the model introducing new topics.
 7164     */
 7165    presence_penalty?: number;
 7166}
 7167interface Ai_Cf_Qwen_Qwq_32B_Messages {
 7168    /**
 7169     * An array of message objects representing the conversation history.
 7170     */
 7171    messages: {
 7172        /**
 7173         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 7174         */
 7175        role?: string;
 7176        /**
 7177         * The tool call id. If you don't know what to put here you can fall back to 000000001
 7178         */
 7179        tool_call_id?: string;
 7180        content?: string | {
 7181            /**
 7182             * Type of the content provided
 7183             */
 7184            type?: string;
 7185            text?: string;
 7186            image_url?: {
 7187                /**
 7188                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7189                 */
 7190                url?: string;
 7191            };
 7192        }[] | {
 7193            /**
 7194             * Type of the content provided
 7195             */
 7196            type?: string;
 7197            text?: string;
 7198            image_url?: {
 7199                /**
 7200                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7201                 */
 7202                url?: string;
 7203            };
 7204        };
 7205    }[];
 7206    functions?: {
 7207        name: string;
 7208        code: string;
 7209    }[];
 7210    /**
 7211     * A list of tools available for the assistant to use.
 7212     */
 7213    tools?: ({
 7214        /**
 7215         * The name of the tool. More descriptive the better.
 7216         */
 7217        name: string;
 7218        /**
 7219         * A brief description of what the tool does.
 7220         */
 7221        description: string;
 7222        /**
 7223         * Schema defining the parameters accepted by the tool.
 7224         */
 7225        parameters: {
 7226            /**
 7227             * The type of the parameters object (usually 'object').
 7228             */
 7229            type: string;
 7230            /**
 7231             * List of required parameter names.
 7232             */
 7233            required?: string[];
 7234            /**
 7235             * Definitions of each parameter.
 7236             */
 7237            properties: {
 7238                [k: string]: {
 7239                    /**
 7240                     * The data type of the parameter.
 7241                     */
 7242                    type: string;
 7243                    /**
 7244                     * A description of the expected parameter.
 7245                     */
 7246                    description: string;
 7247                };
 7248            };
 7249        };
 7250    } | {
 7251        /**
 7252         * Specifies the type of tool (e.g., 'function').
 7253         */
 7254        type: string;
 7255        /**
 7256         * Details of the function tool.
 7257         */
 7258        function: {
 7259            /**
 7260             * The name of the function.
 7261             */
 7262            name: string;
 7263            /**
 7264             * A brief description of what the function does.
 7265             */
 7266            description: string;
 7267            /**
 7268             * Schema defining the parameters accepted by the function.
 7269             */
 7270            parameters: {
 7271                /**
 7272                 * The type of the parameters object (usually 'object').
 7273                 */
 7274                type: string;
 7275                /**
 7276                 * List of required parameter names.
 7277                 */
 7278                required?: string[];
 7279                /**
 7280                 * Definitions of each parameter.
 7281                 */
 7282                properties: {
 7283                    [k: string]: {
 7284                        /**
 7285                         * The data type of the parameter.
 7286                         */
 7287                        type: string;
 7288                        /**
 7289                         * A description of the expected parameter.
 7290                         */
 7291                        description: string;
 7292                    };
 7293                };
 7294            };
 7295        };
 7296    })[];
 7297    /**
 7298     * JSON schema that should be fufilled for the response.
 7299     */
 7300    guided_json?: object;
 7301    /**
 7302     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7303     */
 7304    raw?: boolean;
 7305    /**
 7306     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7307     */
 7308    stream?: boolean;
 7309    /**
 7310     * The maximum number of tokens to generate in the response.
 7311     */
 7312    max_tokens?: number;
 7313    /**
 7314     * Controls the randomness of the output; higher values produce more random results.
 7315     */
 7316    temperature?: number;
 7317    /**
 7318     * 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.
 7319     */
 7320    top_p?: number;
 7321    /**
 7322     * 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.
 7323     */
 7324    top_k?: number;
 7325    /**
 7326     * Random seed for reproducibility of the generation.
 7327     */
 7328    seed?: number;
 7329    /**
 7330     * Penalty for repeated tokens; higher values discourage repetition.
 7331     */
 7332    repetition_penalty?: number;
 7333    /**
 7334     * Decreases the likelihood of the model repeating the same lines verbatim.
 7335     */
 7336    frequency_penalty?: number;
 7337    /**
 7338     * Increases the likelihood of the model introducing new topics.
 7339     */
 7340    presence_penalty?: number;
 7341}
 7342type Ai_Cf_Qwen_Qwq_32B_Output = {
 7343    /**
 7344     * The generated text response from the model
 7345     */
 7346    response: string;
 7347    /**
 7348     * Usage statistics for the inference request
 7349     */
 7350    usage?: {
 7351        /**
 7352         * Total number of tokens in input
 7353         */
 7354        prompt_tokens?: number;
 7355        /**
 7356         * Total number of tokens in output
 7357         */
 7358        completion_tokens?: number;
 7359        /**
 7360         * Total number of input and output tokens
 7361         */
 7362        total_tokens?: number;
 7363    };
 7364    /**
 7365     * An array of tool calls requests made during the response generation
 7366     */
 7367    tool_calls?: {
 7368        /**
 7369         * The arguments passed to be passed to the tool call request
 7370         */
 7371        arguments?: object;
 7372        /**
 7373         * The name of the tool to be called
 7374         */
 7375        name?: string;
 7376    }[];
 7377};
 7378declare abstract class Base_Ai_Cf_Qwen_Qwq_32B {
 7379    inputs: Ai_Cf_Qwen_Qwq_32B_Input;
 7380    postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;
 7381}
 7382type 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;
 7383interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {
 7384    /**
 7385     * The input text prompt for the model to generate a response.
 7386     */
 7387    prompt: string;
 7388    /**
 7389     * JSON schema that should be fulfilled for the response.
 7390     */
 7391    guided_json?: object;
 7392    /**
 7393     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7394     */
 7395    raw?: boolean;
 7396    /**
 7397     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7398     */
 7399    stream?: boolean;
 7400    /**
 7401     * The maximum number of tokens to generate in the response.
 7402     */
 7403    max_tokens?: number;
 7404    /**
 7405     * Controls the randomness of the output; higher values produce more random results.
 7406     */
 7407    temperature?: number;
 7408    /**
 7409     * 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.
 7410     */
 7411    top_p?: number;
 7412    /**
 7413     * 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.
 7414     */
 7415    top_k?: number;
 7416    /**
 7417     * Random seed for reproducibility of the generation.
 7418     */
 7419    seed?: number;
 7420    /**
 7421     * Penalty for repeated tokens; higher values discourage repetition.
 7422     */
 7423    repetition_penalty?: number;
 7424    /**
 7425     * Decreases the likelihood of the model repeating the same lines verbatim.
 7426     */
 7427    frequency_penalty?: number;
 7428    /**
 7429     * Increases the likelihood of the model introducing new topics.
 7430     */
 7431    presence_penalty?: number;
 7432}
 7433interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
 7434    /**
 7435     * An array of message objects representing the conversation history.
 7436     */
 7437    messages: {
 7438        /**
 7439         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 7440         */
 7441        role?: string;
 7442        /**
 7443         * 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
 7444         */
 7445        tool_call_id?: string;
 7446        content?: string | {
 7447            /**
 7448             * Type of the content provided
 7449             */
 7450            type?: string;
 7451            text?: string;
 7452            image_url?: {
 7453                /**
 7454                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7455                 */
 7456                url?: string;
 7457            };
 7458        }[] | {
 7459            /**
 7460             * Type of the content provided
 7461             */
 7462            type?: string;
 7463            text?: string;
 7464            image_url?: {
 7465                /**
 7466                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7467                 */
 7468                url?: string;
 7469            };
 7470        };
 7471    }[];
 7472    functions?: {
 7473        name: string;
 7474        code: string;
 7475    }[];
 7476    /**
 7477     * A list of tools available for the assistant to use.
 7478     */
 7479    tools?: ({
 7480        /**
 7481         * The name of the tool. More descriptive the better.
 7482         */
 7483        name: string;
 7484        /**
 7485         * A brief description of what the tool does.
 7486         */
 7487        description: string;
 7488        /**
 7489         * Schema defining the parameters accepted by the tool.
 7490         */
 7491        parameters: {
 7492            /**
 7493             * The type of the parameters object (usually 'object').
 7494             */
 7495            type: string;
 7496            /**
 7497             * List of required parameter names.
 7498             */
 7499            required?: string[];
 7500            /**
 7501             * Definitions of each parameter.
 7502             */
 7503            properties: {
 7504                [k: string]: {
 7505                    /**
 7506                     * The data type of the parameter.
 7507                     */
 7508                    type: string;
 7509                    /**
 7510                     * A description of the expected parameter.
 7511                     */
 7512                    description: string;
 7513                };
 7514            };
 7515        };
 7516    } | {
 7517        /**
 7518         * Specifies the type of tool (e.g., 'function').
 7519         */
 7520        type: string;
 7521        /**
 7522         * Details of the function tool.
 7523         */
 7524        function: {
 7525            /**
 7526             * The name of the function.
 7527             */
 7528            name: string;
 7529            /**
 7530             * A brief description of what the function does.
 7531             */
 7532            description: string;
 7533            /**
 7534             * Schema defining the parameters accepted by the function.
 7535             */
 7536            parameters: {
 7537                /**
 7538                 * The type of the parameters object (usually 'object').
 7539                 */
 7540                type: string;
 7541                /**
 7542                 * List of required parameter names.
 7543                 */
 7544                required?: string[];
 7545                /**
 7546                 * Definitions of each parameter.
 7547                 */
 7548                properties: {
 7549                    [k: string]: {
 7550                        /**
 7551                         * The data type of the parameter.
 7552                         */
 7553                        type: string;
 7554                        /**
 7555                         * A description of the expected parameter.
 7556                         */
 7557                        description: string;
 7558                    };
 7559                };
 7560            };
 7561        };
 7562    })[];
 7563    /**
 7564     * JSON schema that should be fufilled for the response.
 7565     */
 7566    guided_json?: object;
 7567    /**
 7568     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7569     */
 7570    raw?: boolean;
 7571    /**
 7572     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7573     */
 7574    stream?: boolean;
 7575    /**
 7576     * The maximum number of tokens to generate in the response.
 7577     */
 7578    max_tokens?: number;
 7579    /**
 7580     * Controls the randomness of the output; higher values produce more random results.
 7581     */
 7582    temperature?: number;
 7583    /**
 7584     * 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.
 7585     */
 7586    top_p?: number;
 7587    /**
 7588     * 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.
 7589     */
 7590    top_k?: number;
 7591    /**
 7592     * Random seed for reproducibility of the generation.
 7593     */
 7594    seed?: number;
 7595    /**
 7596     * Penalty for repeated tokens; higher values discourage repetition.
 7597     */
 7598    repetition_penalty?: number;
 7599    /**
 7600     * Decreases the likelihood of the model repeating the same lines verbatim.
 7601     */
 7602    frequency_penalty?: number;
 7603    /**
 7604     * Increases the likelihood of the model introducing new topics.
 7605     */
 7606    presence_penalty?: number;
 7607}
 7608type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {
 7609    /**
 7610     * The generated text response from the model
 7611     */
 7612    response: string;
 7613    /**
 7614     * Usage statistics for the inference request
 7615     */
 7616    usage?: {
 7617        /**
 7618         * Total number of tokens in input
 7619         */
 7620        prompt_tokens?: number;
 7621        /**
 7622         * Total number of tokens in output
 7623         */
 7624        completion_tokens?: number;
 7625        /**
 7626         * Total number of input and output tokens
 7627         */
 7628        total_tokens?: number;
 7629    };
 7630    /**
 7631     * An array of tool calls requests made during the response generation
 7632     */
 7633    tool_calls?: {
 7634        /**
 7635         * The arguments passed to be passed to the tool call request
 7636         */
 7637        arguments?: object;
 7638        /**
 7639         * The name of the tool to be called
 7640         */
 7641        name?: string;
 7642    }[];
 7643};
 7644declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {
 7645    inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;
 7646    postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;
 7647}
 7648type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;
 7649interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
 7650    /**
 7651     * The input text prompt for the model to generate a response.
 7652     */
 7653    prompt: string;
 7654    /**
 7655     * JSON schema that should be fufilled for the response.
 7656     */
 7657    guided_json?: object;
 7658    /**
 7659     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7660     */
 7661    raw?: boolean;
 7662    /**
 7663     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7664     */
 7665    stream?: boolean;
 7666    /**
 7667     * The maximum number of tokens to generate in the response.
 7668     */
 7669    max_tokens?: number;
 7670    /**
 7671     * Controls the randomness of the output; higher values produce more random results.
 7672     */
 7673    temperature?: number;
 7674    /**
 7675     * 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.
 7676     */
 7677    top_p?: number;
 7678    /**
 7679     * 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.
 7680     */
 7681    top_k?: number;
 7682    /**
 7683     * Random seed for reproducibility of the generation.
 7684     */
 7685    seed?: number;
 7686    /**
 7687     * Penalty for repeated tokens; higher values discourage repetition.
 7688     */
 7689    repetition_penalty?: number;
 7690    /**
 7691     * Decreases the likelihood of the model repeating the same lines verbatim.
 7692     */
 7693    frequency_penalty?: number;
 7694    /**
 7695     * Increases the likelihood of the model introducing new topics.
 7696     */
 7697    presence_penalty?: number;
 7698}
 7699interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
 7700    /**
 7701     * An array of message objects representing the conversation history.
 7702     */
 7703    messages: {
 7704        /**
 7705         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 7706         */
 7707        role?: string;
 7708        content?: string | {
 7709            /**
 7710             * Type of the content provided
 7711             */
 7712            type?: string;
 7713            text?: string;
 7714            image_url?: {
 7715                /**
 7716                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7717                 */
 7718                url?: string;
 7719            };
 7720        }[];
 7721    }[];
 7722    functions?: {
 7723        name: string;
 7724        code: string;
 7725    }[];
 7726    /**
 7727     * A list of tools available for the assistant to use.
 7728     */
 7729    tools?: ({
 7730        /**
 7731         * The name of the tool. More descriptive the better.
 7732         */
 7733        name: string;
 7734        /**
 7735         * A brief description of what the tool does.
 7736         */
 7737        description: string;
 7738        /**
 7739         * Schema defining the parameters accepted by the tool.
 7740         */
 7741        parameters: {
 7742            /**
 7743             * The type of the parameters object (usually 'object').
 7744             */
 7745            type: string;
 7746            /**
 7747             * List of required parameter names.
 7748             */
 7749            required?: string[];
 7750            /**
 7751             * Definitions of each parameter.
 7752             */
 7753            properties: {
 7754                [k: string]: {
 7755                    /**
 7756                     * The data type of the parameter.
 7757                     */
 7758                    type: string;
 7759                    /**
 7760                     * A description of the expected parameter.
 7761                     */
 7762                    description: string;
 7763                };
 7764            };
 7765        };
 7766    } | {
 7767        /**
 7768         * Specifies the type of tool (e.g., 'function').
 7769         */
 7770        type: string;
 7771        /**
 7772         * Details of the function tool.
 7773         */
 7774        function: {
 7775            /**
 7776             * The name of the function.
 7777             */
 7778            name: string;
 7779            /**
 7780             * A brief description of what the function does.
 7781             */
 7782            description: string;
 7783            /**
 7784             * Schema defining the parameters accepted by the function.
 7785             */
 7786            parameters: {
 7787                /**
 7788                 * The type of the parameters object (usually 'object').
 7789                 */
 7790                type: string;
 7791                /**
 7792                 * List of required parameter names.
 7793                 */
 7794                required?: string[];
 7795                /**
 7796                 * Definitions of each parameter.
 7797                 */
 7798                properties: {
 7799                    [k: string]: {
 7800                        /**
 7801                         * The data type of the parameter.
 7802                         */
 7803                        type: string;
 7804                        /**
 7805                         * A description of the expected parameter.
 7806                         */
 7807                        description: string;
 7808                    };
 7809                };
 7810            };
 7811        };
 7812    })[];
 7813    /**
 7814     * JSON schema that should be fufilled for the response.
 7815     */
 7816    guided_json?: object;
 7817    /**
 7818     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7819     */
 7820    raw?: boolean;
 7821    /**
 7822     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7823     */
 7824    stream?: boolean;
 7825    /**
 7826     * The maximum number of tokens to generate in the response.
 7827     */
 7828    max_tokens?: number;
 7829    /**
 7830     * Controls the randomness of the output; higher values produce more random results.
 7831     */
 7832    temperature?: number;
 7833    /**
 7834     * 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.
 7835     */
 7836    top_p?: number;
 7837    /**
 7838     * 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.
 7839     */
 7840    top_k?: number;
 7841    /**
 7842     * Random seed for reproducibility of the generation.
 7843     */
 7844    seed?: number;
 7845    /**
 7846     * Penalty for repeated tokens; higher values discourage repetition.
 7847     */
 7848    repetition_penalty?: number;
 7849    /**
 7850     * Decreases the likelihood of the model repeating the same lines verbatim.
 7851     */
 7852    frequency_penalty?: number;
 7853    /**
 7854     * Increases the likelihood of the model introducing new topics.
 7855     */
 7856    presence_penalty?: number;
 7857}
 7858type Ai_Cf_Google_Gemma_3_12B_It_Output = {
 7859    /**
 7860     * The generated text response from the model
 7861     */
 7862    response: string;
 7863    /**
 7864     * Usage statistics for the inference request
 7865     */
 7866    usage?: {
 7867        /**
 7868         * Total number of tokens in input
 7869         */
 7870        prompt_tokens?: number;
 7871        /**
 7872         * Total number of tokens in output
 7873         */
 7874        completion_tokens?: number;
 7875        /**
 7876         * Total number of input and output tokens
 7877         */
 7878        total_tokens?: number;
 7879    };
 7880    /**
 7881     * An array of tool calls requests made during the response generation
 7882     */
 7883    tool_calls?: {
 7884        /**
 7885         * The arguments passed to be passed to the tool call request
 7886         */
 7887        arguments?: object;
 7888        /**
 7889         * The name of the tool to be called
 7890         */
 7891        name?: string;
 7892    }[];
 7893};
 7894declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {
 7895    inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;
 7896    postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;
 7897}
 7898type 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;
 7899interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {
 7900    /**
 7901     * The input text prompt for the model to generate a response.
 7902     */
 7903    prompt: string;
 7904    /**
 7905     * JSON schema that should be fulfilled for the response.
 7906     */
 7907    guided_json?: object;
 7908    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
 7909    /**
 7910     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 7911     */
 7912    raw?: boolean;
 7913    /**
 7914     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 7915     */
 7916    stream?: boolean;
 7917    /**
 7918     * The maximum number of tokens to generate in the response.
 7919     */
 7920    max_tokens?: number;
 7921    /**
 7922     * Controls the randomness of the output; higher values produce more random results.
 7923     */
 7924    temperature?: number;
 7925    /**
 7926     * 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.
 7927     */
 7928    top_p?: number;
 7929    /**
 7930     * 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.
 7931     */
 7932    top_k?: number;
 7933    /**
 7934     * Random seed for reproducibility of the generation.
 7935     */
 7936    seed?: number;
 7937    /**
 7938     * Penalty for repeated tokens; higher values discourage repetition.
 7939     */
 7940    repetition_penalty?: number;
 7941    /**
 7942     * Decreases the likelihood of the model repeating the same lines verbatim.
 7943     */
 7944    frequency_penalty?: number;
 7945    /**
 7946     * Increases the likelihood of the model introducing new topics.
 7947     */
 7948    presence_penalty?: number;
 7949}
 7950interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {
 7951    type?: "json_object" | "json_schema";
 7952    json_schema?: unknown;
 7953}
 7954interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
 7955    /**
 7956     * An array of message objects representing the conversation history.
 7957     */
 7958    messages: {
 7959        /**
 7960         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 7961         */
 7962        role?: string;
 7963        /**
 7964         * The tool call id. If you don't know what to put here you can fall back to 000000001
 7965         */
 7966        tool_call_id?: string;
 7967        content?: string | {
 7968            /**
 7969             * Type of the content provided
 7970             */
 7971            type?: string;
 7972            text?: string;
 7973            image_url?: {
 7974                /**
 7975                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7976                 */
 7977                url?: string;
 7978            };
 7979        }[] | {
 7980            /**
 7981             * Type of the content provided
 7982             */
 7983            type?: string;
 7984            text?: string;
 7985            image_url?: {
 7986                /**
 7987                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 7988                 */
 7989                url?: string;
 7990            };
 7991        };
 7992    }[];
 7993    functions?: {
 7994        name: string;
 7995        code: string;
 7996    }[];
 7997    /**
 7998     * A list of tools available for the assistant to use.
 7999     */
 8000    tools?: ({
 8001        /**
 8002         * The name of the tool. More descriptive the better.
 8003         */
 8004        name: string;
 8005        /**
 8006         * A brief description of what the tool does.
 8007         */
 8008        description: string;
 8009        /**
 8010         * Schema defining the parameters accepted by the tool.
 8011         */
 8012        parameters: {
 8013            /**
 8014             * The type of the parameters object (usually 'object').
 8015             */
 8016            type: string;
 8017            /**
 8018             * List of required parameter names.
 8019             */
 8020            required?: string[];
 8021            /**
 8022             * Definitions of each parameter.
 8023             */
 8024            properties: {
 8025                [k: string]: {
 8026                    /**
 8027                     * The data type of the parameter.
 8028                     */
 8029                    type: string;
 8030                    /**
 8031                     * A description of the expected parameter.
 8032                     */
 8033                    description: string;
 8034                };
 8035            };
 8036        };
 8037    } | {
 8038        /**
 8039         * Specifies the type of tool (e.g., 'function').
 8040         */
 8041        type: string;
 8042        /**
 8043         * Details of the function tool.
 8044         */
 8045        function: {
 8046            /**
 8047             * The name of the function.
 8048             */
 8049            name: string;
 8050            /**
 8051             * A brief description of what the function does.
 8052             */
 8053            description: string;
 8054            /**
 8055             * Schema defining the parameters accepted by the function.
 8056             */
 8057            parameters: {
 8058                /**
 8059                 * The type of the parameters object (usually 'object').
 8060                 */
 8061                type: string;
 8062                /**
 8063                 * List of required parameter names.
 8064                 */
 8065                required?: string[];
 8066                /**
 8067                 * Definitions of each parameter.
 8068                 */
 8069                properties: {
 8070                    [k: string]: {
 8071                        /**
 8072                         * The data type of the parameter.
 8073                         */
 8074                        type: string;
 8075                        /**
 8076                         * A description of the expected parameter.
 8077                         */
 8078                        description: string;
 8079                    };
 8080                };
 8081            };
 8082        };
 8083    })[];
 8084    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
 8085    /**
 8086     * JSON schema that should be fufilled for the response.
 8087     */
 8088    guided_json?: object;
 8089    /**
 8090     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8091     */
 8092    raw?: boolean;
 8093    /**
 8094     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8095     */
 8096    stream?: boolean;
 8097    /**
 8098     * The maximum number of tokens to generate in the response.
 8099     */
 8100    max_tokens?: number;
 8101    /**
 8102     * Controls the randomness of the output; higher values produce more random results.
 8103     */
 8104    temperature?: number;
 8105    /**
 8106     * 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.
 8107     */
 8108    top_p?: number;
 8109    /**
 8110     * 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.
 8111     */
 8112    top_k?: number;
 8113    /**
 8114     * Random seed for reproducibility of the generation.
 8115     */
 8116    seed?: number;
 8117    /**
 8118     * Penalty for repeated tokens; higher values discourage repetition.
 8119     */
 8120    repetition_penalty?: number;
 8121    /**
 8122     * Decreases the likelihood of the model repeating the same lines verbatim.
 8123     */
 8124    frequency_penalty?: number;
 8125    /**
 8126     * Increases the likelihood of the model introducing new topics.
 8127     */
 8128    presence_penalty?: number;
 8129}
 8130interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {
 8131    requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];
 8132}
 8133interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {
 8134    /**
 8135     * The input text prompt for the model to generate a response.
 8136     */
 8137    prompt: string;
 8138    /**
 8139     * JSON schema that should be fulfilled for the response.
 8140     */
 8141    guided_json?: object;
 8142    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
 8143    /**
 8144     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8145     */
 8146    raw?: boolean;
 8147    /**
 8148     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8149     */
 8150    stream?: boolean;
 8151    /**
 8152     * The maximum number of tokens to generate in the response.
 8153     */
 8154    max_tokens?: number;
 8155    /**
 8156     * Controls the randomness of the output; higher values produce more random results.
 8157     */
 8158    temperature?: number;
 8159    /**
 8160     * 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.
 8161     */
 8162    top_p?: number;
 8163    /**
 8164     * 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.
 8165     */
 8166    top_k?: number;
 8167    /**
 8168     * Random seed for reproducibility of the generation.
 8169     */
 8170    seed?: number;
 8171    /**
 8172     * Penalty for repeated tokens; higher values discourage repetition.
 8173     */
 8174    repetition_penalty?: number;
 8175    /**
 8176     * Decreases the likelihood of the model repeating the same lines verbatim.
 8177     */
 8178    frequency_penalty?: number;
 8179    /**
 8180     * Increases the likelihood of the model introducing new topics.
 8181     */
 8182    presence_penalty?: number;
 8183}
 8184interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
 8185    /**
 8186     * An array of message objects representing the conversation history.
 8187     */
 8188    messages: {
 8189        /**
 8190         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 8191         */
 8192        role?: string;
 8193        /**
 8194         * The tool call id. If you don't know what to put here you can fall back to 000000001
 8195         */
 8196        tool_call_id?: string;
 8197        content?: string | {
 8198            /**
 8199             * Type of the content provided
 8200             */
 8201            type?: string;
 8202            text?: string;
 8203            image_url?: {
 8204                /**
 8205                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 8206                 */
 8207                url?: string;
 8208            };
 8209        }[] | {
 8210            /**
 8211             * Type of the content provided
 8212             */
 8213            type?: string;
 8214            text?: string;
 8215            image_url?: {
 8216                /**
 8217                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted
 8218                 */
 8219                url?: string;
 8220            };
 8221        };
 8222    }[];
 8223    functions?: {
 8224        name: string;
 8225        code: string;
 8226    }[];
 8227    /**
 8228     * A list of tools available for the assistant to use.
 8229     */
 8230    tools?: ({
 8231        /**
 8232         * The name of the tool. More descriptive the better.
 8233         */
 8234        name: string;
 8235        /**
 8236         * A brief description of what the tool does.
 8237         */
 8238        description: string;
 8239        /**
 8240         * Schema defining the parameters accepted by the tool.
 8241         */
 8242        parameters: {
 8243            /**
 8244             * The type of the parameters object (usually 'object').
 8245             */
 8246            type: string;
 8247            /**
 8248             * List of required parameter names.
 8249             */
 8250            required?: string[];
 8251            /**
 8252             * Definitions of each parameter.
 8253             */
 8254            properties: {
 8255                [k: string]: {
 8256                    /**
 8257                     * The data type of the parameter.
 8258                     */
 8259                    type: string;
 8260                    /**
 8261                     * A description of the expected parameter.
 8262                     */
 8263                    description: string;
 8264                };
 8265            };
 8266        };
 8267    } | {
 8268        /**
 8269         * Specifies the type of tool (e.g., 'function').
 8270         */
 8271        type: string;
 8272        /**
 8273         * Details of the function tool.
 8274         */
 8275        function: {
 8276            /**
 8277             * The name of the function.
 8278             */
 8279            name: string;
 8280            /**
 8281             * A brief description of what the function does.
 8282             */
 8283            description: string;
 8284            /**
 8285             * Schema defining the parameters accepted by the function.
 8286             */
 8287            parameters: {
 8288                /**
 8289                 * The type of the parameters object (usually 'object').
 8290                 */
 8291                type: string;
 8292                /**
 8293                 * List of required parameter names.
 8294                 */
 8295                required?: string[];
 8296                /**
 8297                 * Definitions of each parameter.
 8298                 */
 8299                properties: {
 8300                    [k: string]: {
 8301                        /**
 8302                         * The data type of the parameter.
 8303                         */
 8304                        type: string;
 8305                        /**
 8306                         * A description of the expected parameter.
 8307                         */
 8308                        description: string;
 8309                    };
 8310                };
 8311            };
 8312        };
 8313    })[];
 8314    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
 8315    /**
 8316     * JSON schema that should be fufilled for the response.
 8317     */
 8318    guided_json?: object;
 8319    /**
 8320     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8321     */
 8322    raw?: boolean;
 8323    /**
 8324     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8325     */
 8326    stream?: boolean;
 8327    /**
 8328     * The maximum number of tokens to generate in the response.
 8329     */
 8330    max_tokens?: number;
 8331    /**
 8332     * Controls the randomness of the output; higher values produce more random results.
 8333     */
 8334    temperature?: number;
 8335    /**
 8336     * 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.
 8337     */
 8338    top_p?: number;
 8339    /**
 8340     * 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.
 8341     */
 8342    top_k?: number;
 8343    /**
 8344     * Random seed for reproducibility of the generation.
 8345     */
 8346    seed?: number;
 8347    /**
 8348     * Penalty for repeated tokens; higher values discourage repetition.
 8349     */
 8350    repetition_penalty?: number;
 8351    /**
 8352     * Decreases the likelihood of the model repeating the same lines verbatim.
 8353     */
 8354    frequency_penalty?: number;
 8355    /**
 8356     * Increases the likelihood of the model introducing new topics.
 8357     */
 8358    presence_penalty?: number;
 8359}
 8360type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
 8361    /**
 8362     * The generated text response from the model
 8363     */
 8364    response: string;
 8365    /**
 8366     * Usage statistics for the inference request
 8367     */
 8368    usage?: {
 8369        /**
 8370         * Total number of tokens in input
 8371         */
 8372        prompt_tokens?: number;
 8373        /**
 8374         * Total number of tokens in output
 8375         */
 8376        completion_tokens?: number;
 8377        /**
 8378         * Total number of input and output tokens
 8379         */
 8380        total_tokens?: number;
 8381    };
 8382    /**
 8383     * An array of tool calls requests made during the response generation
 8384     */
 8385    tool_calls?: {
 8386        /**
 8387         * The tool call id.
 8388         */
 8389        id?: string;
 8390        /**
 8391         * Specifies the type of tool (e.g., 'function').
 8392         */
 8393        type?: string;
 8394        /**
 8395         * Details of the function tool.
 8396         */
 8397        function?: {
 8398            /**
 8399             * The name of the tool to be called
 8400             */
 8401            name?: string;
 8402            /**
 8403             * The arguments passed to be passed to the tool call request
 8404             */
 8405            arguments?: object;
 8406        };
 8407    }[];
 8408};
 8409declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {
 8410    inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;
 8411    postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;
 8412}
 8413type 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;
 8414interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {
 8415    /**
 8416     * The input text prompt for the model to generate a response.
 8417     */
 8418    prompt: string;
 8419    /**
 8420     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 8421     */
 8422    lora?: string;
 8423    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;
 8424    /**
 8425     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8426     */
 8427    raw?: boolean;
 8428    /**
 8429     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8430     */
 8431    stream?: boolean;
 8432    /**
 8433     * The maximum number of tokens to generate in the response.
 8434     */
 8435    max_tokens?: number;
 8436    /**
 8437     * Controls the randomness of the output; higher values produce more random results.
 8438     */
 8439    temperature?: number;
 8440    /**
 8441     * 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.
 8442     */
 8443    top_p?: number;
 8444    /**
 8445     * 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.
 8446     */
 8447    top_k?: number;
 8448    /**
 8449     * Random seed for reproducibility of the generation.
 8450     */
 8451    seed?: number;
 8452    /**
 8453     * Penalty for repeated tokens; higher values discourage repetition.
 8454     */
 8455    repetition_penalty?: number;
 8456    /**
 8457     * Decreases the likelihood of the model repeating the same lines verbatim.
 8458     */
 8459    frequency_penalty?: number;
 8460    /**
 8461     * Increases the likelihood of the model introducing new topics.
 8462     */
 8463    presence_penalty?: number;
 8464}
 8465interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {
 8466    type?: "json_object" | "json_schema";
 8467    json_schema?: unknown;
 8468}
 8469interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
 8470    /**
 8471     * An array of message objects representing the conversation history.
 8472     */
 8473    messages: {
 8474        /**
 8475         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 8476         */
 8477        role: string;
 8478        content: string | {
 8479            /**
 8480             * Type of the content (text)
 8481             */
 8482            type?: string;
 8483            /**
 8484             * Text content
 8485             */
 8486            text?: string;
 8487        }[];
 8488    }[];
 8489    functions?: {
 8490        name: string;
 8491        code: string;
 8492    }[];
 8493    /**
 8494     * A list of tools available for the assistant to use.
 8495     */
 8496    tools?: ({
 8497        /**
 8498         * The name of the tool. More descriptive the better.
 8499         */
 8500        name: string;
 8501        /**
 8502         * A brief description of what the tool does.
 8503         */
 8504        description: string;
 8505        /**
 8506         * Schema defining the parameters accepted by the tool.
 8507         */
 8508        parameters: {
 8509            /**
 8510             * The type of the parameters object (usually 'object').
 8511             */
 8512            type: string;
 8513            /**
 8514             * List of required parameter names.
 8515             */
 8516            required?: string[];
 8517            /**
 8518             * Definitions of each parameter.
 8519             */
 8520            properties: {
 8521                [k: string]: {
 8522                    /**
 8523                     * The data type of the parameter.
 8524                     */
 8525                    type: string;
 8526                    /**
 8527                     * A description of the expected parameter.
 8528                     */
 8529                    description: string;
 8530                };
 8531            };
 8532        };
 8533    } | {
 8534        /**
 8535         * Specifies the type of tool (e.g., 'function').
 8536         */
 8537        type: string;
 8538        /**
 8539         * Details of the function tool.
 8540         */
 8541        function: {
 8542            /**
 8543             * The name of the function.
 8544             */
 8545            name: string;
 8546            /**
 8547             * A brief description of what the function does.
 8548             */
 8549            description: string;
 8550            /**
 8551             * Schema defining the parameters accepted by the function.
 8552             */
 8553            parameters: {
 8554                /**
 8555                 * The type of the parameters object (usually 'object').
 8556                 */
 8557                type: string;
 8558                /**
 8559                 * List of required parameter names.
 8560                 */
 8561                required?: string[];
 8562                /**
 8563                 * Definitions of each parameter.
 8564                 */
 8565                properties: {
 8566                    [k: string]: {
 8567                        /**
 8568                         * The data type of the parameter.
 8569                         */
 8570                        type: string;
 8571                        /**
 8572                         * A description of the expected parameter.
 8573                         */
 8574                        description: string;
 8575                    };
 8576                };
 8577            };
 8578        };
 8579    })[];
 8580    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;
 8581    /**
 8582     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8583     */
 8584    raw?: boolean;
 8585    /**
 8586     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8587     */
 8588    stream?: boolean;
 8589    /**
 8590     * The maximum number of tokens to generate in the response.
 8591     */
 8592    max_tokens?: number;
 8593    /**
 8594     * Controls the randomness of the output; higher values produce more random results.
 8595     */
 8596    temperature?: number;
 8597    /**
 8598     * 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.
 8599     */
 8600    top_p?: number;
 8601    /**
 8602     * 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.
 8603     */
 8604    top_k?: number;
 8605    /**
 8606     * Random seed for reproducibility of the generation.
 8607     */
 8608    seed?: number;
 8609    /**
 8610     * Penalty for repeated tokens; higher values discourage repetition.
 8611     */
 8612    repetition_penalty?: number;
 8613    /**
 8614     * Decreases the likelihood of the model repeating the same lines verbatim.
 8615     */
 8616    frequency_penalty?: number;
 8617    /**
 8618     * Increases the likelihood of the model introducing new topics.
 8619     */
 8620    presence_penalty?: number;
 8621}
 8622interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {
 8623    type?: "json_object" | "json_schema";
 8624    json_schema?: unknown;
 8625}
 8626interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {
 8627    requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];
 8628}
 8629interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {
 8630    /**
 8631     * The input text prompt for the model to generate a response.
 8632     */
 8633    prompt: string;
 8634    /**
 8635     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 8636     */
 8637    lora?: string;
 8638    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;
 8639    /**
 8640     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8641     */
 8642    raw?: boolean;
 8643    /**
 8644     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8645     */
 8646    stream?: boolean;
 8647    /**
 8648     * The maximum number of tokens to generate in the response.
 8649     */
 8650    max_tokens?: number;
 8651    /**
 8652     * Controls the randomness of the output; higher values produce more random results.
 8653     */
 8654    temperature?: number;
 8655    /**
 8656     * 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.
 8657     */
 8658    top_p?: number;
 8659    /**
 8660     * 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.
 8661     */
 8662    top_k?: number;
 8663    /**
 8664     * Random seed for reproducibility of the generation.
 8665     */
 8666    seed?: number;
 8667    /**
 8668     * Penalty for repeated tokens; higher values discourage repetition.
 8669     */
 8670    repetition_penalty?: number;
 8671    /**
 8672     * Decreases the likelihood of the model repeating the same lines verbatim.
 8673     */
 8674    frequency_penalty?: number;
 8675    /**
 8676     * Increases the likelihood of the model introducing new topics.
 8677     */
 8678    presence_penalty?: number;
 8679}
 8680interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {
 8681    type?: "json_object" | "json_schema";
 8682    json_schema?: unknown;
 8683}
 8684interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
 8685    /**
 8686     * An array of message objects representing the conversation history.
 8687     */
 8688    messages: {
 8689        /**
 8690         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 8691         */
 8692        role: string;
 8693        content: string | {
 8694            /**
 8695             * Type of the content (text)
 8696             */
 8697            type?: string;
 8698            /**
 8699             * Text content
 8700             */
 8701            text?: string;
 8702        }[];
 8703    }[];
 8704    functions?: {
 8705        name: string;
 8706        code: string;
 8707    }[];
 8708    /**
 8709     * A list of tools available for the assistant to use.
 8710     */
 8711    tools?: ({
 8712        /**
 8713         * The name of the tool. More descriptive the better.
 8714         */
 8715        name: string;
 8716        /**
 8717         * A brief description of what the tool does.
 8718         */
 8719        description: string;
 8720        /**
 8721         * Schema defining the parameters accepted by the tool.
 8722         */
 8723        parameters: {
 8724            /**
 8725             * The type of the parameters object (usually 'object').
 8726             */
 8727            type: string;
 8728            /**
 8729             * List of required parameter names.
 8730             */
 8731            required?: string[];
 8732            /**
 8733             * Definitions of each parameter.
 8734             */
 8735            properties: {
 8736                [k: string]: {
 8737                    /**
 8738                     * The data type of the parameter.
 8739                     */
 8740                    type: string;
 8741                    /**
 8742                     * A description of the expected parameter.
 8743                     */
 8744                    description: string;
 8745                };
 8746            };
 8747        };
 8748    } | {
 8749        /**
 8750         * Specifies the type of tool (e.g., 'function').
 8751         */
 8752        type: string;
 8753        /**
 8754         * Details of the function tool.
 8755         */
 8756        function: {
 8757            /**
 8758             * The name of the function.
 8759             */
 8760            name: string;
 8761            /**
 8762             * A brief description of what the function does.
 8763             */
 8764            description: string;
 8765            /**
 8766             * Schema defining the parameters accepted by the function.
 8767             */
 8768            parameters: {
 8769                /**
 8770                 * The type of the parameters object (usually 'object').
 8771                 */
 8772                type: string;
 8773                /**
 8774                 * List of required parameter names.
 8775                 */
 8776                required?: string[];
 8777                /**
 8778                 * Definitions of each parameter.
 8779                 */
 8780                properties: {
 8781                    [k: string]: {
 8782                        /**
 8783                         * The data type of the parameter.
 8784                         */
 8785                        type: string;
 8786                        /**
 8787                         * A description of the expected parameter.
 8788                         */
 8789                        description: string;
 8790                    };
 8791                };
 8792            };
 8793        };
 8794    })[];
 8795    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;
 8796    /**
 8797     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 8798     */
 8799    raw?: boolean;
 8800    /**
 8801     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 8802     */
 8803    stream?: boolean;
 8804    /**
 8805     * The maximum number of tokens to generate in the response.
 8806     */
 8807    max_tokens?: number;
 8808    /**
 8809     * Controls the randomness of the output; higher values produce more random results.
 8810     */
 8811    temperature?: number;
 8812    /**
 8813     * 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.
 8814     */
 8815    top_p?: number;
 8816    /**
 8817     * 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.
 8818     */
 8819    top_k?: number;
 8820    /**
 8821     * Random seed for reproducibility of the generation.
 8822     */
 8823    seed?: number;
 8824    /**
 8825     * Penalty for repeated tokens; higher values discourage repetition.
 8826     */
 8827    repetition_penalty?: number;
 8828    /**
 8829     * Decreases the likelihood of the model repeating the same lines verbatim.
 8830     */
 8831    frequency_penalty?: number;
 8832    /**
 8833     * Increases the likelihood of the model introducing new topics.
 8834     */
 8835    presence_penalty?: number;
 8836}
 8837interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {
 8838    type?: "json_object" | "json_schema";
 8839    json_schema?: unknown;
 8840}
 8841type 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;
 8842interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {
 8843    /**
 8844     * Unique identifier for the completion
 8845     */
 8846    id?: string;
 8847    /**
 8848     * Object type identifier
 8849     */
 8850    object?: "chat.completion";
 8851    /**
 8852     * Unix timestamp of when the completion was created
 8853     */
 8854    created?: number;
 8855    /**
 8856     * Model used for the completion
 8857     */
 8858    model?: string;
 8859    /**
 8860     * List of completion choices
 8861     */
 8862    choices?: {
 8863        /**
 8864         * Index of the choice in the list
 8865         */
 8866        index?: number;
 8867        /**
 8868         * The message generated by the model
 8869         */
 8870        message?: {
 8871            /**
 8872             * Role of the message author
 8873             */
 8874            role: string;
 8875            /**
 8876             * The content of the message
 8877             */
 8878            content: string;
 8879            /**
 8880             * Internal reasoning content (if available)
 8881             */
 8882            reasoning_content?: string;
 8883            /**
 8884             * Tool calls made by the assistant
 8885             */
 8886            tool_calls?: {
 8887                /**
 8888                 * Unique identifier for the tool call
 8889                 */
 8890                id: string;
 8891                /**
 8892                 * Type of tool call
 8893                 */
 8894                type: "function";
 8895                function: {
 8896                    /**
 8897                     * Name of the function to call
 8898                     */
 8899                    name: string;
 8900                    /**
 8901                     * JSON string of arguments for the function
 8902                     */
 8903                    arguments: string;
 8904                };
 8905            }[];
 8906        };
 8907        /**
 8908         * Reason why the model stopped generating
 8909         */
 8910        finish_reason?: string;
 8911        /**
 8912         * Stop reason (may be null)
 8913         */
 8914        stop_reason?: string | null;
 8915        /**
 8916         * Log probabilities (if requested)
 8917         */
 8918        logprobs?: {} | null;
 8919    }[];
 8920    /**
 8921     * Usage statistics for the inference request
 8922     */
 8923    usage?: {
 8924        /**
 8925         * Total number of tokens in input
 8926         */
 8927        prompt_tokens?: number;
 8928        /**
 8929         * Total number of tokens in output
 8930         */
 8931        completion_tokens?: number;
 8932        /**
 8933         * Total number of input and output tokens
 8934         */
 8935        total_tokens?: number;
 8936    };
 8937    /**
 8938     * Log probabilities for the prompt (if requested)
 8939     */
 8940    prompt_logprobs?: {} | null;
 8941}
 8942interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {
 8943    /**
 8944     * Unique identifier for the completion
 8945     */
 8946    id?: string;
 8947    /**
 8948     * Object type identifier
 8949     */
 8950    object?: "text_completion";
 8951    /**
 8952     * Unix timestamp of when the completion was created
 8953     */
 8954    created?: number;
 8955    /**
 8956     * Model used for the completion
 8957     */
 8958    model?: string;
 8959    /**
 8960     * List of completion choices
 8961     */
 8962    choices?: {
 8963        /**
 8964         * Index of the choice in the list
 8965         */
 8966        index: number;
 8967        /**
 8968         * The generated text completion
 8969         */
 8970        text: string;
 8971        /**
 8972         * Reason why the model stopped generating
 8973         */
 8974        finish_reason: string;
 8975        /**
 8976         * Stop reason (may be null)
 8977         */
 8978        stop_reason?: string | null;
 8979        /**
 8980         * Log probabilities (if requested)
 8981         */
 8982        logprobs?: {} | null;
 8983        /**
 8984         * Log probabilities for the prompt (if requested)
 8985         */
 8986        prompt_logprobs?: {} | null;
 8987    }[];
 8988    /**
 8989     * Usage statistics for the inference request
 8990     */
 8991    usage?: {
 8992        /**
 8993         * Total number of tokens in input
 8994         */
 8995        prompt_tokens?: number;
 8996        /**
 8997         * Total number of tokens in output
 8998         */
 8999        completion_tokens?: number;
 9000        /**
 9001         * Total number of input and output tokens
 9002         */
 9003        total_tokens?: number;
 9004    };
 9005}
 9006interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {
 9007    /**
 9008     * The async request id that can be used to obtain the results.
 9009     */
 9010    request_id?: string;
 9011}
 9012declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {
 9013    inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;
 9014    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;
 9015}
 9016interface Ai_Cf_Deepgram_Nova_3_Input {
 9017    audio: {
 9018        body: object;
 9019        contentType: string;
 9020    };
 9021    /**
 9022     * 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.
 9023     */
 9024    custom_topic_mode?: "extended" | "strict";
 9025    /**
 9026     * Custom topics you want the model to detect within your input audio or text if present Submit up to 100
 9027     */
 9028    custom_topic?: string;
 9029    /**
 9030     * 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
 9031     */
 9032    custom_intent_mode?: "extended" | "strict";
 9033    /**
 9034     * Custom intents you want the model to detect within your input audio if present
 9035     */
 9036    custom_intent?: string;
 9037    /**
 9038     * Identifies and extracts key entities from content in submitted audio
 9039     */
 9040    detect_entities?: boolean;
 9041    /**
 9042     * Identifies the dominant language spoken in submitted audio
 9043     */
 9044    detect_language?: boolean;
 9045    /**
 9046     * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0
 9047     */
 9048    diarize?: boolean;
 9049    /**
 9050     * Identify and extract key entities from content in submitted audio
 9051     */
 9052    dictation?: boolean;
 9053    /**
 9054     * Specify the expected encoding of your submitted audio
 9055     */
 9056    encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729";
 9057    /**
 9058     * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing
 9059     */
 9060    extra?: string;
 9061    /**
 9062     * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'
 9063     */
 9064    filler_words?: boolean;
 9065    /**
 9066     * Key term prompting can boost or suppress specialized terminology and brands.
 9067     */
 9068    keyterm?: string;
 9069    /**
 9070     * Keywords can boost or suppress specialized terminology and brands.
 9071     */
 9072    keywords?: string;
 9073    /**
 9074     * 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.
 9075     */
 9076    language?: string;
 9077    /**
 9078     * Spoken measurements will be converted to their corresponding abbreviations.
 9079     */
 9080    measurements?: boolean;
 9081    /**
 9082     * 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.
 9083     */
 9084    mip_opt_out?: boolean;
 9085    /**
 9086     * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio
 9087     */
 9088    mode?: "general" | "medical" | "finance";
 9089    /**
 9090     * Transcribe each audio channel independently.
 9091     */
 9092    multichannel?: boolean;
 9093    /**
 9094     * Numerals converts numbers from written format to numerical format.
 9095     */
 9096    numerals?: boolean;
 9097    /**
 9098     * Splits audio into paragraphs to improve transcript readability.
 9099     */
 9100    paragraphs?: boolean;
 9101    /**
 9102     * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.
 9103     */
 9104    profanity_filter?: boolean;
 9105    /**
 9106     * Add punctuation and capitalization to the transcript.
 9107     */
 9108    punctuate?: boolean;
 9109    /**
 9110     * Redaction removes sensitive information from your transcripts.
 9111     */
 9112    redact?: string;
 9113    /**
 9114     * Search for terms or phrases in submitted audio and replaces them.
 9115     */
 9116    replace?: string;
 9117    /**
 9118     * Search for terms or phrases in submitted audio.
 9119     */
 9120    search?: string;
 9121    /**
 9122     * Recognizes the sentiment throughout a transcript or text.
 9123     */
 9124    sentiment?: boolean;
 9125    /**
 9126     * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.
 9127     */
 9128    smart_format?: boolean;
 9129    /**
 9130     * Detect topics throughout a transcript or text.
 9131     */
 9132    topics?: boolean;
 9133    /**
 9134     * Segments speech into meaningful semantic units.
 9135     */
 9136    utterances?: boolean;
 9137    /**
 9138     * Seconds to wait before detecting a pause between words in submitted audio.
 9139     */
 9140    utt_split?: number;
 9141    /**
 9142     * The number of channels in the submitted audio
 9143     */
 9144    channels?: number;
 9145    /**
 9146     * 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.
 9147     */
 9148    interim_results?: boolean;
 9149    /**
 9150     * 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
 9151     */
 9152    endpointing?: string;
 9153    /**
 9154     * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.
 9155     */
 9156    vad_events?: boolean;
 9157    /**
 9158     * 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.
 9159     */
 9160    utterance_end_ms?: boolean;
 9161}
 9162interface Ai_Cf_Deepgram_Nova_3_Output {
 9163    results?: {
 9164        channels?: {
 9165            alternatives?: {
 9166                confidence?: number;
 9167                transcript?: string;
 9168                words?: {
 9169                    confidence?: number;
 9170                    end?: number;
 9171                    start?: number;
 9172                    word?: string;
 9173                }[];
 9174            }[];
 9175        }[];
 9176        summary?: {
 9177            result?: string;
 9178            short?: string;
 9179        };
 9180        sentiments?: {
 9181            segments?: {
 9182                text?: string;
 9183                start_word?: number;
 9184                end_word?: number;
 9185                sentiment?: string;
 9186                sentiment_score?: number;
 9187            }[];
 9188            average?: {
 9189                sentiment?: string;
 9190                sentiment_score?: number;
 9191            };
 9192        };
 9193    };
 9194}
 9195declare abstract class Base_Ai_Cf_Deepgram_Nova_3 {
 9196    inputs: Ai_Cf_Deepgram_Nova_3_Input;
 9197    postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;
 9198}
 9199interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {
 9200    queries?: string | string[];
 9201    /**
 9202     * Optional instruction for the task
 9203     */
 9204    instruction?: string;
 9205    documents?: string | string[];
 9206    text?: string | string[];
 9207}
 9208interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {
 9209    data?: number[][];
 9210    shape?: number[];
 9211}
 9212declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {
 9213    inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;
 9214    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;
 9215}
 9216type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {
 9217    /**
 9218     * readable stream with audio data and content-type specified for that data
 9219     */
 9220    audio: {
 9221        body: object;
 9222        contentType: string;
 9223    };
 9224    /**
 9225     * type of data PCM data that's sent to the inference server as raw array
 9226     */
 9227    dtype?: "uint8" | "float32" | "float64";
 9228} | {
 9229    /**
 9230     * base64 encoded audio data
 9231     */
 9232    audio: string;
 9233    /**
 9234     * type of data PCM data that's sent to the inference server as raw array
 9235     */
 9236    dtype?: "uint8" | "float32" | "float64";
 9237};
 9238interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {
 9239    /**
 9240     * if true, end-of-turn was detected
 9241     */
 9242    is_complete?: boolean;
 9243    /**
 9244     * probability of the end-of-turn detection
 9245     */
 9246    probability?: number;
 9247}
 9248declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
 9249    inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;
 9250    postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
 9251}
 9252declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
 9253    inputs: XOR<Omit<ResponsesInput, "reasoning"> & {
 9254        reasoning?: (Omit<Reasoning, "effort"> & {
 9255            /**
 9256             * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled.
 9257             *
 9258             * @default "medium"
 9259             */
 9260            effort?: "low" | "medium" | "high" | null;
 9261        }) | null;
 9262    }, Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
 9263        /**
 9264         * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled.
 9265         *
 9266         * @default "medium"
 9267         */
 9268        reasoning_effort?: "low" | "medium" | "high" | null;
 9269        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
 9270            /**
 9271             * Reasoning is always enabled for this model and cannot be disabled.
 9272             *
 9273             * @default true
 9274             */
 9275            enable_thinking?: true;
 9276        };
 9277    }>;
 9278    postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
 9279}
 9280declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
 9281    inputs: XOR<Omit<ResponsesInput, "reasoning"> & {
 9282        reasoning?: (Omit<Reasoning, "effort"> & {
 9283            /**
 9284             * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled.
 9285             *
 9286             * @default "medium"
 9287             */
 9288            effort?: "low" | "medium" | "high" | null;
 9289        }) | null;
 9290    }, Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
 9291        /**
 9292         * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled.
 9293         *
 9294         * @default "medium"
 9295         */
 9296        reasoning_effort?: "low" | "medium" | "high" | null;
 9297        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
 9298            /**
 9299             * Reasoning is always enabled for this model and cannot be disabled.
 9300             *
 9301             * @default true
 9302             */
 9303            enable_thinking?: true;
 9304        };
 9305    }>;
 9306    postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;
 9307}
 9308interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
 9309    /**
 9310     * A text description of the image you want to generate.
 9311     */
 9312    prompt: string;
 9313    /**
 9314     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
 9315     */
 9316    guidance?: number;
 9317    /**
 9318     * Random seed for reproducibility of the image generation
 9319     */
 9320    seed?: number;
 9321    /**
 9322     * The height of the generated image in pixels
 9323     */
 9324    height?: number;
 9325    /**
 9326     * The width of the generated image in pixels
 9327     */
 9328    width?: number;
 9329    /**
 9330     * The number of diffusion steps; higher values can improve quality but take longer
 9331     */
 9332    num_steps?: number;
 9333    /**
 9334     * Specify what to exclude from the generated images
 9335     */
 9336    negative_prompt?: string;
 9337}
 9338/**
 9339 * The generated image in JPEG format
 9340 */
 9341type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;
 9342declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {
 9343    inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;
 9344    postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;
 9345}
 9346interface Ai_Cf_Leonardo_Lucid_Origin_Input {
 9347    /**
 9348     * A text description of the image you want to generate.
 9349     */
 9350    prompt: string;
 9351    /**
 9352     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
 9353     */
 9354    guidance?: number;
 9355    /**
 9356     * Random seed for reproducibility of the image generation
 9357     */
 9358    seed?: number;
 9359    /**
 9360     * The height of the generated image in pixels
 9361     */
 9362    height?: number;
 9363    /**
 9364     * The width of the generated image in pixels
 9365     */
 9366    width?: number;
 9367    /**
 9368     * The number of diffusion steps; higher values can improve quality but take longer
 9369     */
 9370    num_steps?: number;
 9371    /**
 9372     * The number of diffusion steps; higher values can improve quality but take longer
 9373     */
 9374    steps?: number;
 9375}
 9376interface Ai_Cf_Leonardo_Lucid_Origin_Output {
 9377    /**
 9378     * The generated image in Base64 format.
 9379     */
 9380    image?: string;
 9381}
 9382declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {
 9383    inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;
 9384    postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;
 9385}
 9386interface Ai_Cf_Deepgram_Aura_1_Input {
 9387    /**
 9388     * Speaker used to produce the audio.
 9389     */
 9390    speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella";
 9391    /**
 9392     * Encoding of the output audio.
 9393     */
 9394    encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
 9395    /**
 9396     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
 9397     */
 9398    container?: "none" | "wav" | "ogg";
 9399    /**
 9400     * The text content to be converted to speech
 9401     */
 9402    text: string;
 9403    /**
 9404     * 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
 9405     */
 9406    sample_rate?: number;
 9407    /**
 9408     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
 9409     */
 9410    bit_rate?: number;
 9411}
 9412/**
 9413 * The generated audio in MP3 format
 9414 */
 9415type Ai_Cf_Deepgram_Aura_1_Output = string;
 9416declare abstract class Base_Ai_Cf_Deepgram_Aura_1 {
 9417    inputs: Ai_Cf_Deepgram_Aura_1_Input;
 9418    postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;
 9419}
 9420interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
 9421    /**
 9422     * Input text to translate. Can be a single string or a list of strings.
 9423     */
 9424    text: string | string[];
 9425    /**
 9426     * Target langauge to translate to
 9427     */
 9428    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";
 9429}
 9430interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {
 9431    /**
 9432     * Translated texts
 9433     */
 9434    translations: string[];
 9435}
 9436declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {
 9437    inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;
 9438    postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;
 9439}
 9440type 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;
 9441interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {
 9442    /**
 9443     * The input text prompt for the model to generate a response.
 9444     */
 9445    prompt: string;
 9446    /**
 9447     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 9448     */
 9449    lora?: string;
 9450    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;
 9451    /**
 9452     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 9453     */
 9454    raw?: boolean;
 9455    /**
 9456     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 9457     */
 9458    stream?: boolean;
 9459    /**
 9460     * The maximum number of tokens to generate in the response.
 9461     */
 9462    max_tokens?: number;
 9463    /**
 9464     * Controls the randomness of the output; higher values produce more random results.
 9465     */
 9466    temperature?: number;
 9467    /**
 9468     * 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.
 9469     */
 9470    top_p?: number;
 9471    /**
 9472     * 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.
 9473     */
 9474    top_k?: number;
 9475    /**
 9476     * Random seed for reproducibility of the generation.
 9477     */
 9478    seed?: number;
 9479    /**
 9480     * Penalty for repeated tokens; higher values discourage repetition.
 9481     */
 9482    repetition_penalty?: number;
 9483    /**
 9484     * Decreases the likelihood of the model repeating the same lines verbatim.
 9485     */
 9486    frequency_penalty?: number;
 9487    /**
 9488     * Increases the likelihood of the model introducing new topics.
 9489     */
 9490    presence_penalty?: number;
 9491}
 9492interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {
 9493    type?: "json_object" | "json_schema";
 9494    json_schema?: unknown;
 9495}
 9496interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
 9497    /**
 9498     * An array of message objects representing the conversation history.
 9499     */
 9500    messages: {
 9501        /**
 9502         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 9503         */
 9504        role: string;
 9505        content: string | {
 9506            /**
 9507             * Type of the content (text)
 9508             */
 9509            type?: string;
 9510            /**
 9511             * Text content
 9512             */
 9513            text?: string;
 9514        }[];
 9515    }[];
 9516    functions?: {
 9517        name: string;
 9518        code: string;
 9519    }[];
 9520    /**
 9521     * A list of tools available for the assistant to use.
 9522     */
 9523    tools?: ({
 9524        /**
 9525         * The name of the tool. More descriptive the better.
 9526         */
 9527        name: string;
 9528        /**
 9529         * A brief description of what the tool does.
 9530         */
 9531        description: string;
 9532        /**
 9533         * Schema defining the parameters accepted by the tool.
 9534         */
 9535        parameters: {
 9536            /**
 9537             * The type of the parameters object (usually 'object').
 9538             */
 9539            type: string;
 9540            /**
 9541             * List of required parameter names.
 9542             */
 9543            required?: string[];
 9544            /**
 9545             * Definitions of each parameter.
 9546             */
 9547            properties: {
 9548                [k: string]: {
 9549                    /**
 9550                     * The data type of the parameter.
 9551                     */
 9552                    type: string;
 9553                    /**
 9554                     * A description of the expected parameter.
 9555                     */
 9556                    description: string;
 9557                };
 9558            };
 9559        };
 9560    } | {
 9561        /**
 9562         * Specifies the type of tool (e.g., 'function').
 9563         */
 9564        type: string;
 9565        /**
 9566         * Details of the function tool.
 9567         */
 9568        function: {
 9569            /**
 9570             * The name of the function.
 9571             */
 9572            name: string;
 9573            /**
 9574             * A brief description of what the function does.
 9575             */
 9576            description: string;
 9577            /**
 9578             * Schema defining the parameters accepted by the function.
 9579             */
 9580            parameters: {
 9581                /**
 9582                 * The type of the parameters object (usually 'object').
 9583                 */
 9584                type: string;
 9585                /**
 9586                 * List of required parameter names.
 9587                 */
 9588                required?: string[];
 9589                /**
 9590                 * Definitions of each parameter.
 9591                 */
 9592                properties: {
 9593                    [k: string]: {
 9594                        /**
 9595                         * The data type of the parameter.
 9596                         */
 9597                        type: string;
 9598                        /**
 9599                         * A description of the expected parameter.
 9600                         */
 9601                        description: string;
 9602                    };
 9603                };
 9604            };
 9605        };
 9606    })[];
 9607    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;
 9608    /**
 9609     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 9610     */
 9611    raw?: boolean;
 9612    /**
 9613     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 9614     */
 9615    stream?: boolean;
 9616    /**
 9617     * The maximum number of tokens to generate in the response.
 9618     */
 9619    max_tokens?: number;
 9620    /**
 9621     * Controls the randomness of the output; higher values produce more random results.
 9622     */
 9623    temperature?: number;
 9624    /**
 9625     * 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.
 9626     */
 9627    top_p?: number;
 9628    /**
 9629     * 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.
 9630     */
 9631    top_k?: number;
 9632    /**
 9633     * Random seed for reproducibility of the generation.
 9634     */
 9635    seed?: number;
 9636    /**
 9637     * Penalty for repeated tokens; higher values discourage repetition.
 9638     */
 9639    repetition_penalty?: number;
 9640    /**
 9641     * Decreases the likelihood of the model repeating the same lines verbatim.
 9642     */
 9643    frequency_penalty?: number;
 9644    /**
 9645     * Increases the likelihood of the model introducing new topics.
 9646     */
 9647    presence_penalty?: number;
 9648}
 9649interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {
 9650    type?: "json_object" | "json_schema";
 9651    json_schema?: unknown;
 9652}
 9653interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {
 9654    requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];
 9655}
 9656interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {
 9657    /**
 9658     * The input text prompt for the model to generate a response.
 9659     */
 9660    prompt: string;
 9661    /**
 9662     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
 9663     */
 9664    lora?: string;
 9665    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;
 9666    /**
 9667     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 9668     */
 9669    raw?: boolean;
 9670    /**
 9671     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 9672     */
 9673    stream?: boolean;
 9674    /**
 9675     * The maximum number of tokens to generate in the response.
 9676     */
 9677    max_tokens?: number;
 9678    /**
 9679     * Controls the randomness of the output; higher values produce more random results.
 9680     */
 9681    temperature?: number;
 9682    /**
 9683     * 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.
 9684     */
 9685    top_p?: number;
 9686    /**
 9687     * 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.
 9688     */
 9689    top_k?: number;
 9690    /**
 9691     * Random seed for reproducibility of the generation.
 9692     */
 9693    seed?: number;
 9694    /**
 9695     * Penalty for repeated tokens; higher values discourage repetition.
 9696     */
 9697    repetition_penalty?: number;
 9698    /**
 9699     * Decreases the likelihood of the model repeating the same lines verbatim.
 9700     */
 9701    frequency_penalty?: number;
 9702    /**
 9703     * Increases the likelihood of the model introducing new topics.
 9704     */
 9705    presence_penalty?: number;
 9706}
 9707interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {
 9708    type?: "json_object" | "json_schema";
 9709    json_schema?: unknown;
 9710}
 9711interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
 9712    /**
 9713     * An array of message objects representing the conversation history.
 9714     */
 9715    messages: {
 9716        /**
 9717         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
 9718         */
 9719        role: string;
 9720        content: string | {
 9721            /**
 9722             * Type of the content (text)
 9723             */
 9724            type?: string;
 9725            /**
 9726             * Text content
 9727             */
 9728            text?: string;
 9729        }[];
 9730    }[];
 9731    functions?: {
 9732        name: string;
 9733        code: string;
 9734    }[];
 9735    /**
 9736     * A list of tools available for the assistant to use.
 9737     */
 9738    tools?: ({
 9739        /**
 9740         * The name of the tool. More descriptive the better.
 9741         */
 9742        name: string;
 9743        /**
 9744         * A brief description of what the tool does.
 9745         */
 9746        description: string;
 9747        /**
 9748         * Schema defining the parameters accepted by the tool.
 9749         */
 9750        parameters: {
 9751            /**
 9752             * The type of the parameters object (usually 'object').
 9753             */
 9754            type: string;
 9755            /**
 9756             * List of required parameter names.
 9757             */
 9758            required?: string[];
 9759            /**
 9760             * Definitions of each parameter.
 9761             */
 9762            properties: {
 9763                [k: string]: {
 9764                    /**
 9765                     * The data type of the parameter.
 9766                     */
 9767                    type: string;
 9768                    /**
 9769                     * A description of the expected parameter.
 9770                     */
 9771                    description: string;
 9772                };
 9773            };
 9774        };
 9775    } | {
 9776        /**
 9777         * Specifies the type of tool (e.g., 'function').
 9778         */
 9779        type: string;
 9780        /**
 9781         * Details of the function tool.
 9782         */
 9783        function: {
 9784            /**
 9785             * The name of the function.
 9786             */
 9787            name: string;
 9788            /**
 9789             * A brief description of what the function does.
 9790             */
 9791            description: string;
 9792            /**
 9793             * Schema defining the parameters accepted by the function.
 9794             */
 9795            parameters: {
 9796                /**
 9797                 * The type of the parameters object (usually 'object').
 9798                 */
 9799                type: string;
 9800                /**
 9801                 * List of required parameter names.
 9802                 */
 9803                required?: string[];
 9804                /**
 9805                 * Definitions of each parameter.
 9806                 */
 9807                properties: {
 9808                    [k: string]: {
 9809                        /**
 9810                         * The data type of the parameter.
 9811                         */
 9812                        type: string;
 9813                        /**
 9814                         * A description of the expected parameter.
 9815                         */
 9816                        description: string;
 9817                    };
 9818                };
 9819            };
 9820        };
 9821    })[];
 9822    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;
 9823    /**
 9824     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
 9825     */
 9826    raw?: boolean;
 9827    /**
 9828     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
 9829     */
 9830    stream?: boolean;
 9831    /**
 9832     * The maximum number of tokens to generate in the response.
 9833     */
 9834    max_tokens?: number;
 9835    /**
 9836     * Controls the randomness of the output; higher values produce more random results.
 9837     */
 9838    temperature?: number;
 9839    /**
 9840     * 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.
 9841     */
 9842    top_p?: number;
 9843    /**
 9844     * 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.
 9845     */
 9846    top_k?: number;
 9847    /**
 9848     * Random seed for reproducibility of the generation.
 9849     */
 9850    seed?: number;
 9851    /**
 9852     * Penalty for repeated tokens; higher values discourage repetition.
 9853     */
 9854    repetition_penalty?: number;
 9855    /**
 9856     * Decreases the likelihood of the model repeating the same lines verbatim.
 9857     */
 9858    frequency_penalty?: number;
 9859    /**
 9860     * Increases the likelihood of the model introducing new topics.
 9861     */
 9862    presence_penalty?: number;
 9863}
 9864interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {
 9865    type?: "json_object" | "json_schema";
 9866    json_schema?: unknown;
 9867}
 9868type 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;
 9869interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {
 9870    /**
 9871     * Unique identifier for the completion
 9872     */
 9873    id?: string;
 9874    /**
 9875     * Object type identifier
 9876     */
 9877    object?: "chat.completion";
 9878    /**
 9879     * Unix timestamp of when the completion was created
 9880     */
 9881    created?: number;
 9882    /**
 9883     * Model used for the completion
 9884     */
 9885    model?: string;
 9886    /**
 9887     * List of completion choices
 9888     */
 9889    choices?: {
 9890        /**
 9891         * Index of the choice in the list
 9892         */
 9893        index?: number;
 9894        /**
 9895         * The message generated by the model
 9896         */
 9897        message?: {
 9898            /**
 9899             * Role of the message author
 9900             */
 9901            role: string;
 9902            /**
 9903             * The content of the message
 9904             */
 9905            content: string;
 9906            /**
 9907             * Internal reasoning content (if available)
 9908             */
 9909            reasoning_content?: string;
 9910            /**
 9911             * Tool calls made by the assistant
 9912             */
 9913            tool_calls?: {
 9914                /**
 9915                 * Unique identifier for the tool call
 9916                 */
 9917                id: string;
 9918                /**
 9919                 * Type of tool call
 9920                 */
 9921                type: "function";
 9922                function: {
 9923                    /**
 9924                     * Name of the function to call
 9925                     */
 9926                    name: string;
 9927                    /**
 9928                     * JSON string of arguments for the function
 9929                     */
 9930                    arguments: string;
 9931                };
 9932            }[];
 9933        };
 9934        /**
 9935         * Reason why the model stopped generating
 9936         */
 9937        finish_reason?: string;
 9938        /**
 9939         * Stop reason (may be null)
 9940         */
 9941        stop_reason?: string | null;
 9942        /**
 9943         * Log probabilities (if requested)
 9944         */
 9945        logprobs?: {} | null;
 9946    }[];
 9947    /**
 9948     * Usage statistics for the inference request
 9949     */
 9950    usage?: {
 9951        /**
 9952         * Total number of tokens in input
 9953         */
 9954        prompt_tokens?: number;
 9955        /**
 9956         * Total number of tokens in output
 9957         */
 9958        completion_tokens?: number;
 9959        /**
 9960         * Total number of input and output tokens
 9961         */
 9962        total_tokens?: number;
 9963    };
 9964    /**
 9965     * Log probabilities for the prompt (if requested)
 9966     */
 9967    prompt_logprobs?: {} | null;
 9968}
 9969interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {
 9970    /**
 9971     * Unique identifier for the completion
 9972     */
 9973    id?: string;
 9974    /**
 9975     * Object type identifier
 9976     */
 9977    object?: "text_completion";
 9978    /**
 9979     * Unix timestamp of when the completion was created
 9980     */
 9981    created?: number;
 9982    /**
 9983     * Model used for the completion
 9984     */
 9985    model?: string;
 9986    /**
 9987     * List of completion choices
 9988     */
 9989    choices?: {
 9990        /**
 9991         * Index of the choice in the list
 9992         */
 9993        index: number;
 9994        /**
 9995         * The generated text completion
 9996         */
 9997        text: string;
 9998        /**
 9999         * Reason why the model stopped generating
10000         */
10001        finish_reason: string;
10002        /**
10003         * Stop reason (may be null)
10004         */
10005        stop_reason?: string | null;
10006        /**
10007         * Log probabilities (if requested)
10008         */
10009        logprobs?: {} | null;
10010        /**
10011         * Log probabilities for the prompt (if requested)
10012         */
10013        prompt_logprobs?: {} | null;
10014    }[];
10015    /**
10016     * Usage statistics for the inference request
10017     */
10018    usage?: {
10019        /**
10020         * Total number of tokens in input
10021         */
10022        prompt_tokens?: number;
10023        /**
10024         * Total number of tokens in output
10025         */
10026        completion_tokens?: number;
10027        /**
10028         * Total number of input and output tokens
10029         */
10030        total_tokens?: number;
10031    };
10032}
10033interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {
10034    /**
10035     * The async request id that can be used to obtain the results.
10036     */
10037    request_id?: string;
10038}
10039declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {
10040    inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;
10041    postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;
10042}
10043interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {
10044    /**
10045     * Input text to embed. Can be a single string or a list of strings.
10046     */
10047    text: string | string[];
10048}
10049interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {
10050    /**
10051     * Embedding vectors, where each vector is a list of floats.
10052     */
10053    data: number[][];
10054    /**
10055     * Shape of the embedding data as [number_of_embeddings, embedding_dimension].
10056     *
10057     * @minItems 2
10058     * @maxItems 2
10059     */
10060    shape: [
10061        number,
10062        number
10063    ];
10064}
10065declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {
10066    inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;
10067    postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;
10068}
10069interface Ai_Cf_Deepgram_Flux_Input {
10070    /**
10071     * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.
10072     */
10073    encoding: "linear16";
10074    /**
10075     * Sample rate of the audio stream in Hz.
10076     */
10077    sample_rate: string;
10078    /**
10079     * 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.
10080     */
10081    eager_eot_threshold?: string;
10082    /**
10083     * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.
10084     */
10085    eot_threshold?: string;
10086    /**
10087     * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.
10088     */
10089    eot_timeout_ms?: string;
10090    /**
10091     * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.
10092     */
10093    keyterm?: string;
10094    /**
10095     * 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
10096     */
10097    mip_opt_out?: "true" | "false";
10098    /**
10099     * Label your requests for the purpose of identification during usage reporting
10100     */
10101    tag?: string;
10102}
10103/**
10104 * Output will be returned as websocket messages.
10105 */
10106interface Ai_Cf_Deepgram_Flux_Output {
10107    /**
10108     * The unique identifier of the request (uuid)
10109     */
10110    request_id?: string;
10111    /**
10112     * Starts at 0 and increments for each message the server sends to the client.
10113     */
10114    sequence_id?: number;
10115    /**
10116     * The type of event being reported.
10117     */
10118    event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn";
10119    /**
10120     * The index of the current turn
10121     */
10122    turn_index?: number;
10123    /**
10124     * Start time in seconds of the audio range that was transcribed
10125     */
10126    audio_window_start?: number;
10127    /**
10128     * End time in seconds of the audio range that was transcribed
10129     */
10130    audio_window_end?: number;
10131    /**
10132     * Text that was said over the course of the current turn
10133     */
10134    transcript?: string;
10135    /**
10136     * The words in the transcript
10137     */
10138    words?: {
10139        /**
10140         * The individual punctuated, properly-cased word from the transcript
10141         */
10142        word: string;
10143        /**
10144         * Confidence that this word was transcribed correctly
10145         */
10146        confidence: number;
10147    }[];
10148    /**
10149     * Confidence that no more speech is coming in this turn
10150     */
10151    end_of_turn_confidence?: number;
10152}
10153declare abstract class Base_Ai_Cf_Deepgram_Flux {
10154    inputs: Ai_Cf_Deepgram_Flux_Input;
10155    postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;
10156}
10157interface Ai_Cf_Deepgram_Aura_2_En_Input {
10158    /**
10159     * Speaker used to produce the audio.
10160     */
10161    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";
10162    /**
10163     * Encoding of the output audio.
10164     */
10165    encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
10166    /**
10167     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
10168     */
10169    container?: "none" | "wav" | "ogg";
10170    /**
10171     * The text content to be converted to speech
10172     */
10173    text: string;
10174    /**
10175     * 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
10176     */
10177    sample_rate?: number;
10178    /**
10179     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
10180     */
10181    bit_rate?: number;
10182}
10183/**
10184 * The generated audio in MP3 format
10185 */
10186type Ai_Cf_Deepgram_Aura_2_En_Output = string;
10187declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {
10188    inputs: Ai_Cf_Deepgram_Aura_2_En_Input;
10189    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;
10190}
10191interface Ai_Cf_Deepgram_Aura_2_Es_Input {
10192    /**
10193     * Speaker used to produce the audio.
10194     */
10195    speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier";
10196    /**
10197     * Encoding of the output audio.
10198     */
10199    encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
10200    /**
10201     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
10202     */
10203    container?: "none" | "wav" | "ogg";
10204    /**
10205     * The text content to be converted to speech
10206     */
10207    text: string;
10208    /**
10209     * 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
10210     */
10211    sample_rate?: number;
10212    /**
10213     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
10214     */
10215    bit_rate?: number;
10216}
10217/**
10218 * The generated audio in MP3 format
10219 */
10220type Ai_Cf_Deepgram_Aura_2_Es_Output = string;
10221declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
10222    inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
10223    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
10224}
10225interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {
10226    multipart: {
10227        body?: object;
10228        contentType?: string;
10229    };
10230}
10231interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {
10232    /**
10233     * Generated image as Base64 string.
10234     */
10235    image?: string;
10236}
10237declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {
10238    inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;
10239    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;
10240}
10241interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {
10242    multipart: {
10243        body?: object;
10244        contentType?: string;
10245    };
10246}
10247interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {
10248    /**
10249     * Generated image as Base64 string.
10250     */
10251    image?: string;
10252}
10253declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {
10254    inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;
10255    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;
10256}
10257interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {
10258    multipart: {
10259        body?: object;
10260        contentType?: string;
10261    };
10262}
10263interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {
10264    /**
10265     * Generated image as Base64 string.
10266     */
10267    image?: string;
10268}
10269declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {
10270    inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;
10271    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;
10272}
10273declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {
10274    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10275        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10276            /**
10277             * Whether to enable reasoning for this model. This model has no reasoning effort levels.
10278             *
10279             * @default true
10280             */
10281            enable_thinking?: boolean;
10282        };
10283    };
10284    postProcessedOutputs: ChatCompletionsOutput;
10285}
10286declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {
10287    inputs: ChatCompletionsInput;
10288    postProcessedOutputs: ChatCompletionsOutput;
10289}
10290declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {
10291    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10292        /**
10293         * Reasoning effort. Supported levels: high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; max maps to high.
10294         *
10295         * @default "high"
10296         */
10297        reasoning_effort?: "high" | "none" | null;
10298        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10299            /**
10300             * Whether to enable reasoning for this model.
10301             *
10302             * @default true
10303             */
10304            enable_thinking?: boolean;
10305        };
10306    };
10307    postProcessedOutputs: ChatCompletionsOutput;
10308}
10309type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit<ChatCompletionsInput, "model" | "max_tokens" | "metadata" | "modalities" | "chat_template_kwargs" | "store" | "reasoning_effort"> & {
10310    /**
10311     * ID of the model to use (for example, '@cf/nvidia/nemotron-3-120b-a12b').
10312     */
10313    model?: ChatCompletionsInput["model"];
10314    /**
10315     * The maximum number of tokens to generate.
10316     */
10317    max_tokens?: ChatCompletionsInput["max_tokens"];
10318    /**
10319     * Set of key-value pairs that can be attached to the object.
10320     */
10321    metadata?: ChatCompletionsInput["metadata"];
10322    /**
10323     * Output types requested from the model.
10324     */
10325    modalities?: ChatCompletionsInput["modalities"];
10326    /**
10327     * Nemotron chat-template controls for normal reasoning, low-effort reasoning, and non-reasoning responses.
10328     */
10329    chat_template_kwargs?: {
10330        /**
10331         * Whether to enable reasoning. Reasoning is enabled by default.
10332         */
10333        enable_thinking?: boolean;
10334        /**
10335         * When reasoning is enabled, use Nemotron's low-effort reasoning mode, which uses significantly fewer reasoning tokens.
10336         */
10337        low_effort?: boolean;
10338        /**
10339         * For coding agent use, Nvidia suggests setting force_nonempty_content=true
10340         */
10341        force_nonempty_content?: boolean;
10342    };
10343    /**
10344     * Whether to store the output for model distillation or evaluation.
10345     *
10346     * @default false
10347     */
10348    store?: ChatCompletionsInput["store"];
10349};
10350declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {
10351    inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input;
10352    postProcessedOutputs: ChatCompletionsOutput;
10353}
10354type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10355    chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10356        /**
10357         * Whether to enable reasoning for this model. This model has no reasoning effort levels.
10358         *
10359         * @default true
10360         */
10361        enable_thinking?: boolean;
10362    };
10363} & {
10364    /**
10365     * @default false
10366     */
10367    skip_special_tokens?: boolean;
10368};
10369declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {
10370    inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input;
10371    postProcessedOutputs: ChatCompletionsOutput;
10372}
10373/** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */
10374declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {
10375}
10376type Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input = {
10377    /**
10378     * readable stream with audio data and content-type specified for that data
10379     */
10380    audio: {
10381        body: object;
10382        contentType: string;
10383    };
10384} | {
10385    /**
10386     * base64 encoded audio data
10387     */
10388    audio: string;
10389    encoding?: "wav" | "flac" | "ogg" | "linear16";
10390    sample_rate?: number;
10391    channels?: number;
10392};
10393interface Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output {
10394    text?: string;
10395    duration?: number;
10396}
10397declare abstract class Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B {
10398    inputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input;
10399    postProcessedOutputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output;
10400}
10401declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code {
10402    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10403        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10404            /**
10405             * Reasoning is always enabled for this model and cannot be disabled. This model has no reasoning effort levels.
10406             *
10407             * @default true
10408             */
10409            enable_thinking?: true;
10410        };
10411    };
10412    postProcessedOutputs: ChatCompletionsOutput;
10413}
10414declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 {
10415    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10416        /**
10417         * Reasoning effort. Supported levels: max, high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; xhigh maps to max; minimal maps to none.
10418         *
10419         * @default "max"
10420         */
10421        reasoning_effort?: "max" | "high" | "none" | null;
10422        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10423            /**
10424             * Whether to enable reasoning for this model.
10425             *
10426             * @default true
10427             */
10428            enable_thinking?: boolean;
10429        };
10430    };
10431    postProcessedOutputs: ChatCompletionsOutput;
10432}
10433interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input {
10434    /**
10435     * Which Moondream skill to run.
10436     */
10437    task?: "query" | "caption" | "point" | "detect";
10438    /**
10439     * Input image as a public HTTPS URL or base64 data URI. Optional for `query`; required for `caption`, `point`, and `detect`.
10440     */
10441    image?: string;
10442    /**
10443     * Question for the `query` task.
10444     */
10445    question?: string;
10446    /**
10447     * Caption length for the `caption` task.
10448     */
10449    caption_length?: "short" | "normal" | "long";
10450    /**
10451     * Object phrase to locate for `point` and `detect` tasks (e.g. 'person wearing a red shirt').
10452     */
10453    target?: string;
10454    /**
10455     * Enable reasoning trace for the `query` task.
10456     */
10457    reasoning?: boolean;
10458    /**
10459     * Sampling temperature.
10460     */
10461    temperature?: number;
10462    /**
10463     * Top-p (nucleus) sampling.
10464     */
10465    top_p?: number;
10466    /**
10467     * Max tokens to generate for `query` and `caption`.
10468     */
10469    max_tokens?: number;
10470    /**
10471     * Max objects to return for `point` and `detect`.
10472     */
10473    max_objects?: number;
10474    /**
10475     * Return incremental tokens for `query` and `caption`. `point` and `detect` do not support streaming.
10476     */
10477    stream?: boolean;
10478}
10479interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output {
10480    /**
10481     * Reason the generation finished.
10482     */
10483    finish_reason: string;
10484    metrics: {
10485        /**
10486         * Number of input tokens consumed.
10487         */
10488        input_tokens: number;
10489        /**
10490         * Number of output tokens generated.
10491         */
10492        output_tokens: number;
10493        /**
10494         * Prefill time in milliseconds.
10495         */
10496        prefill_time_ms: number;
10497        /**
10498         * Decode time in milliseconds.
10499         */
10500        decode_time_ms: number;
10501        /**
10502         * Time to first token in milliseconds.
10503         */
10504        ttft_ms: number;
10505    };
10506    /**
10507     * Answer text for the `query` task. Null for other tasks.
10508     */
10509    answer?: string;
10510    /**
10511     * Caption text for the `caption` task. Null for other tasks.
10512     */
10513    caption?: string;
10514    /**
10515     * Located points for the `point` task. Null for other tasks.
10516     */
10517    points?: {
10518        /**
10519         * X coordinate.
10520         */
10521        x: number;
10522        /**
10523         * Y coordinate.
10524         */
10525        y: number;
10526    }[];
10527    /**
10528     * Detected bounding boxes for the `detect` task. Null for other tasks.
10529     */
10530    objects?: {
10531        /**
10532         * Minimum X coordinate.
10533         */
10534        x_min: number;
10535        /**
10536         * Minimum Y coordinate.
10537         */
10538        y_min: number;
10539        /**
10540         * Maximum X coordinate.
10541         */
10542        x_max: number;
10543        /**
10544         * Maximum Y coordinate.
10545         */
10546        y_max: number;
10547    }[];
10548    /**
10549     * Reasoning trace for the `query` task when reasoning=true. Null otherwise.
10550     */
10551    reasoning?: {
10552        /**
10553         * Reasoning text.
10554         */
10555        text: string;
10556        /**
10557         * Grounding information.
10558         */
10559        grounding?: {}[];
10560    };
10561}
10562declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B {
10563    inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input;
10564    postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output;
10565}
10566declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 {
10567    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10568        /**
10569         * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high.
10570         *
10571         * @default "high"
10572         */
10573        reasoning_effort?: "max" | "high" | "low" | "none" | null;
10574        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10575            /**
10576             * Whether to enable reasoning for this model.
10577             *
10578             * @default true
10579             */
10580            enable_thinking?: boolean;
10581        };
10582    };
10583    postProcessedOutputs: ChatCompletionsOutput;
10584}
10585declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 {
10586    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10587        /**
10588         * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high.
10589         *
10590         * @default "high"
10591         */
10592        reasoning_effort?: "max" | "high" | "low" | "none" | null;
10593        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10594            /**
10595             * Whether to enable reasoning for this model.
10596             *
10597             * @default true
10598             */
10599            enable_thinking?: boolean;
10600        };
10601    };
10602    postProcessedOutputs: ChatCompletionsOutput;
10603}
10604declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B {
10605    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10606        /**
10607         * Reasoning effort. Supported levels: low, medium, xhigh.
10608         *
10609         * @default "xhigh"
10610         */
10611        reasoning_effort?: "low" | "medium" | "xhigh" | null;
10612        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10613            /**
10614             * Whether to enable reasoning for this model.
10615             *
10616             * @default true
10617             */
10618            enable_thinking?: boolean;
10619        };
10620    };
10621    postProcessedOutputs: ChatCompletionsOutput;
10622}
10623declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 {
10624    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10625        /**
10626         * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max.
10627         *
10628         * @default "max"
10629         */
10630        reasoning_effort?: "max" | "high" | "low" | null;
10631        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10632            /**
10633             * Reasoning is always enabled for this model and cannot be disabled.
10634             *
10635             * @default true
10636             */
10637            enable_thinking?: true;
10638        };
10639    };
10640    postProcessedOutputs: ChatCompletionsOutput;
10641}
10642declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash {
10643    inputs: Omit<ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs"> & {
10644        /**
10645         * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max.
10646         *
10647         * @default "max"
10648         */
10649        reasoning_effort?: "max" | "high" | "low" | null;
10650        chat_template_kwargs?: Omit<ChatTemplateKwargs, "enable_thinking"> & {
10651            /**
10652             * Reasoning is always enabled for this model and cannot be disabled.
10653             *
10654             * @default true
10655             */
10656            enable_thinking?: true;
10657        };
10658    };
10659    postProcessedOutputs: ChatCompletionsOutput;
10660}
10661interface AiModels {
10662    "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
10663    "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
10664    "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
10665    "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
10666    "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
10667    "@cf/myshell-ai/melotts": BaseAiTextToSpeech;
10668    "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings;
10669    "@cf/microsoft/resnet-50": BaseAiImageClassification;
10670    "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
10671    "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
10672    "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
10673    "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
10674    "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
10675    "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
10676    "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
10677    "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
10678    "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
10679    "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
10680    "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
10681    "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
10682    "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
10683    "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
10684    "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
10685    "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
10686    "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
10687    "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
10688    "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
10689    "@cf/microsoft/phi-2": BaseAiTextGeneration;
10690    "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
10691    "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
10692    "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
10693    "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
10694    "@hf/google/gemma-7b-it": BaseAiTextGeneration;
10695    "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
10696    "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
10697    "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
10698    "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
10699    "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
10700    "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
10701    "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
10702    "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
10703    "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
10704    "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
10705    "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
10706    "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration;
10707    "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration;
10708    "@cf/facebook/bart-large-cnn": BaseAiSummarization;
10709    "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
10710    "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;
10711    "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
10712    "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B;
10713    "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;
10714    "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;
10715    "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;
10716    "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
10717    "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
10718    "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3;
10719    "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
10720    "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
10721    "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;
10722    "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B;
10723    "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base;
10724    "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;
10725    "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B;
10726    "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;
10727    "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It;
10728    "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;
10729    "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;
10730    "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3;
10731    "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;
10732    "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;
10733    "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B;
10734    "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B;
10735    "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0;
10736    "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin;
10737    "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1;
10738    "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;
10739    "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;
10740    "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;
10741    "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
10742    "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
10743    "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
10744    "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;
10745    "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;
10746    "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;
10747    "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;
10748    "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;
10749    "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;
10750    "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;
10751    "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It;
10752    "@cf/nvidia/nemotron-speech-streaming-en-0.6b": Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B;
10753    "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code;
10754    "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2;
10755    "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B;
10756    "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731;
10757    "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813;
10758    "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B;
10759    "@cf/zai-org/glm-5.3": Base_Ai_Cf_Zai_Org_Glm_5_3;
10760    "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash;
10761}
10762type AiOptions = {
10763    /**
10764     * Send requests as an asynchronous batch job, only works for supported models
10765     * https://developers.cloudflare.com/workers-ai/features/batch-api
10766     */
10767    queueRequest?: boolean;
10768    /**
10769     * Establish websocket connections, only works for supported models
10770     */
10771    websocket?: boolean;
10772    /**
10773     * Tag your requests to group and view them in Cloudflare dashboard.
10774     *
10775     * Rules:
10776     * Tags must only contain letters, numbers, and the symbols: : - . / @
10777     * Each tag can have maximum 50 characters.
10778     * Maximum 5 tags are allowed each request.
10779     * Duplicate tags will removed.
10780     */
10781    tags?: string[];
10782    gateway?: GatewayOptions;
10783    returnRawResponse?: boolean;
10784    prefix?: string;
10785    extraHeaders?: object;
10786    signal?: AbortSignal;
10787};
10788type AiModelsSearchParams = {
10789    author?: string;
10790    hide_experimental?: boolean;
10791    page?: number;
10792    per_page?: number;
10793    search?: string;
10794    source?: number;
10795    task?: string;
10796};
10797type AiModelsSearchObject = {
10798    id: string;
10799    source: number;
10800    name: string;
10801    description: string;
10802    task: {
10803        id: string;
10804        name: string;
10805        description: string;
10806    };
10807    tags: string[];
10808    properties: {
10809        property_id: string;
10810        value: string;
10811    }[];
10812};
10813type ChatCompletionsBase = ChatCompletionsMessagesInput;
10814type ChatCompletionsInput = ChatCompletionsMessagesInput;
10815interface InferenceUpstreamError extends Error {
10816}
10817interface AiInternalError extends Error {
10818}
10819type AiModelListType = Record<string, any>;
10820type AiAsyncBatchResponse = {
10821    request_id: string;
10822};
10823type AiWebSearchRequest = {
10824    /** AI Gateway configuration used for this request. */
10825    gatewayId: string;
10826    /** Search query. */
10827    query: string;
10828    /** Maximum number of results. Defaults to 10 and is capped at 20. */
10829    limit?: number;
10830    /** Optional BYOK web-search provider configured on the gateway. */
10831    provider?: string;
10832    /** Optional BYOK key alias. Defaults to `default`. */
10833    byokAlias?: string;
10834};
10835declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
10836    aiGatewayLogId: string | null;
10837    gateway(gatewayId: string): AiGateway;
10838    websearch(request: AiWebSearchRequest): Promise<Response>;
10839    /**
10840     * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10841     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10842     */
10843    aiSearch(): AiSearchNamespace;
10844    /**
10845     * @deprecated AutoRAG has been replaced by AI Search.
10846     * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10847     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10848     *
10849     * @param autoragId Instance ID
10850     */
10851    autorag(autoragId: string): AutoRAG;
10852    // Batch request
10853    run<Name extends keyof AiModelList>(model: Name, inputs: {
10854        requests: AiModelList[Name]['inputs'][];
10855    }, options: AiOptions & {
10856        queueRequest: true;
10857    }): Promise<AiAsyncBatchResponse>;
10858    // Raw response
10859    run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {
10860        returnRawResponse: true;
10861    }): Promise<Response>;
10862    // WebSocket
10863    run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {
10864        websocket: true;
10865    }): Promise<Response>;
10866    // Streaming
10867    run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'] & {
10868        stream: true;
10869    }, options?: AiOptions): Promise<ReadableStream>;
10870    // Normal (default) - known model
10871    run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise<AiModelList[Name]['postProcessedOutputs']>;
10872    // Unknown model (fallback).
10873    //
10874    // The `Exclude<..., keyof AiModelList>` constraint forces TypeScript to
10875    // route any model name that is a literal key of `AiModelList` to one of
10876    // the known-model overloads above (so input/output mismatches surface as
10877    // type errors rather than silently falling back to `Record<string, unknown>`).
10878    // Names that aren't in `AiModelList` — e.g. third-party gateway models
10879    // like `"google/nano-banana"` — still hit this overload.
10880    run<Model extends string>(model: Model extends keyof AiModelList ? never : Model, inputs: Record<string, unknown>, options?: AiOptions): Promise<Record<string, unknown>>;
10881    models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
10882    toMarkdown(): ToMarkdownService;
10883    toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
10884    toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;
10885}
10886type GatewayRetries = {
10887    maxAttempts?: 1 | 2 | 3 | 4 | 5;
10888    retryDelayMs?: number;
10889    backoff?: 'constant' | 'linear' | 'exponential';
10890};
10891type GatewayOptions = {
10892    id: string;
10893    cacheKey?: string;
10894    cacheTtl?: number;
10895    skipCache?: boolean;
10896    metadata?: Record<string, number | string | boolean | null | bigint>;
10897    collectLog?: boolean;
10898    eventId?: string;
10899    requestTimeoutMs?: number;
10900    retries?: GatewayRetries;
10901};
10902type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {
10903    /**
10904     ** @deprecated
10905     */
10906    id?: string;
10907};
10908type AiGatewayPatchLog = {
10909    score?: number | null;
10910    feedback?: -1 | 1 | null;
10911    metadata?: Record<string, number | string | boolean | null | bigint> | null;
10912};
10913type AiGatewayLog = {
10914    id: string;
10915    provider: string;
10916    model: string;
10917    model_type?: string;
10918    path: string;
10919    duration: number;
10920    request_type?: string;
10921    request_content_type?: string;
10922    status_code: number;
10923    response_content_type?: string;
10924    success: boolean;
10925    cached: boolean;
10926    tokens_in?: number;
10927    tokens_out?: number;
10928    metadata?: Record<string, number | string | boolean | null | bigint>;
10929    step?: number;
10930    cost?: number;
10931    custom_cost?: boolean;
10932    request_size: number;
10933    request_head?: string;
10934    request_head_complete: boolean;
10935    response_size: number;
10936    response_head?: string;
10937    response_head_complete: boolean;
10938    created_at: Date;
10939};
10940type 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';
10941type AIGatewayHeaders = {
10942    'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;
10943    'cf-aig-custom-cost': {
10944        per_token_in?: number;
10945        per_token_out?: number;
10946    } | {
10947        total_cost?: number;
10948    } | string;
10949    'cf-aig-cache-ttl': number | string;
10950    'cf-aig-skip-cache': boolean | string;
10951    'cf-aig-cache-key': string;
10952    'cf-aig-event-id': string;
10953    'cf-aig-request-timeout': number | string;
10954    'cf-aig-max-attempts': number | string;
10955    'cf-aig-retry-delay': number | string;
10956    'cf-aig-backoff': string;
10957    'cf-aig-collect-log': boolean | string;
10958    Authorization: string;
10959    'Content-Type': string;
10960    [key: string]: string | number | boolean | object;
10961};
10962type AIGatewayUniversalRequest = {
10963    provider: AIGatewayProviders | string; // eslint-disable-line
10964    endpoint: string;
10965    headers: Partial<AIGatewayHeaders>;
10966    query: unknown;
10967};
10968interface AiGatewayInternalError extends Error {
10969}
10970interface AiGatewayLogNotFound extends Error {
10971}
10972declare abstract class AiGateway {
10973    patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
10974    getLog(logId: string): Promise<AiGatewayLog>;
10975    run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {
10976        gateway?: UniversalGatewayOptions;
10977        extraHeaders?: object;
10978        signal?: AbortSignal;
10979    }): Promise<Response>;
10980    getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
10981}
10982/** A parameter accepted by an Analytics SQL query. */
10983type AnalyticsSQLParameter = string | number | boolean | null;
10984/** An Analytics SQL query and its optional positional or named parameters. */
10985interface AnalyticsSQLQuery {
10986    query: string;
10987    params?: readonly AnalyticsSQLParameter[] | Readonly<Record<string, AnalyticsSQLParameter>>;
10988}
10989/** Execution statistics returned by Analytics SQL. */
10990interface AnalyticsSQLStatistics {
10991    elapsed_ms: number;
10992    rows_read: number;
10993    bytes_read: number;
10994}
10995/** The rows and execution statistics returned by an Analytics SQL query. */
10996interface AnalyticsSQLResult<T extends Record<string, unknown> = Record<string, unknown>> {
10997    data: T[];
10998    rows: number;
10999    statistics: AnalyticsSQLStatistics;
11000}
11001/** An Analytics SQL binding. */
11002interface AnalyticsSQLBinding {
11003    query<T extends Record<string, unknown> = Record<string, unknown>>(request: AnalyticsSQLQuery): Promise<AnalyticsSQLResult<T>>;
11004}
11005// Copyright (c) 2022-2025 Cloudflare, Inc.
11006// Licensed under the Apache 2.0 license found in the LICENSE file or at:
11007//     https://opensource.org/licenses/Apache-2.0
11008/**
11009 * Artifacts — Git-compatible file storage on Cloudflare Workers.
11010 *
11011 * Provides programmatic access to create, manage, and fork repositories,
11012 * and to issue and revoke scoped access tokens.
11013 */
11014/** Information about a repository. */
11015interface ArtifactsRepoInfo {
11016    /** Unique repository ID. */
11017    id: string;
11018    /** Repository name. */
11019    name: string;
11020    /** Repository description, or null if not set. */
11021    description: string | null;
11022    /** Default branch name (e.g. "main"). */
11023    defaultBranch: string;
11024    /** ISO 8601 creation timestamp. */
11025    createdAt: string;
11026    /** ISO 8601 last-updated timestamp. */
11027    updatedAt: string;
11028    /** ISO 8601 timestamp of the last push, or null if never pushed. */
11029    lastPushAt: string | null;
11030    /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */
11031    source: string | null;
11032    /** Whether the repository is read-only. */
11033    readOnly: boolean;
11034    /** HTTPS git remote URL. */
11035    remote: string;
11036}
11037/** Result of creating a repository — includes the initial access token. */
11038interface ArtifactsCreateRepoResult {
11039    /** Unique repository ID. */
11040    id: string;
11041    /** Repository name. */
11042    name: string;
11043    /** Repository description, or null if not set. */
11044    description: string | null;
11045    /** Default branch name. */
11046    defaultBranch: string;
11047    /** HTTPS git remote URL. */
11048    remote: string;
11049    /** Plaintext access token (only returned at creation time). */
11050    token: string;
11051}
11052/** Paginated list of repositories. */
11053interface ArtifactsRepoListResult {
11054    /** Repositories in this page (without the `remote` field). */
11055    repos: Omit<ArtifactsRepoInfo, 'remote'>[];
11056    /** Total number of repositories in the namespace. */
11057    total: number;
11058    /** Cursor for the next page, if there are more results. */
11059    cursor?: string;
11060}
11061/** Result of creating an access token. */
11062interface ArtifactsCreateTokenResult {
11063    /** Unique token ID. */
11064    id: string;
11065    /** Plaintext token (only returned at creation time). */
11066    plaintext: string;
11067    /** Token scope: "read" or "write". */
11068    scope: 'read' | 'write';
11069    /** ISO 8601 token expiry timestamp. */
11070    expiresAt: string;
11071}
11072/** Token metadata (no plaintext). */
11073interface ArtifactsTokenInfo {
11074    /** Unique token ID. */
11075    id: string;
11076    /** Token scope: "read" or "write". */
11077    scope: 'read' | 'write';
11078    /** Token state: "active", "expired", or "revoked". */
11079    state: 'active' | 'expired' | 'revoked';
11080    /** ISO 8601 creation timestamp. */
11081    createdAt: string;
11082    /** ISO 8601 expiry timestamp. */
11083    expiresAt: string;
11084}
11085/** Paginated list of tokens for a repository. */
11086interface ArtifactsTokenListResult {
11087    /** Tokens in this page. */
11088    tokens: ArtifactsTokenInfo[];
11089    /** Total number of tokens for the repository. */
11090    total: number;
11091}
11092/**
11093 * Classification of a Git tree entry derived from its mode.
11094 *
11095 * `tree` is a directory, `blob` is a regular file, `symlink` is a symbolic link,
11096 * `gitlink` is a submodule reference, and `exec` is an executable file.
11097 */
11098type ArtifactsTreeEntryType = 'tree' | 'blob' | 'symlink' | 'gitlink' | 'exec';
11099/** An immediate child of a Git tree returned by {@link ArtifactsRepo.readTree}. */
11100interface ArtifactsTreeEntry {
11101    /** Name relative to the tree being read. */
11102    name: string;
11103    /** Canonical Git mode, such as `100644` for a file or `40000` for a tree. */
11104    mode: string;
11105    /** Lowercase, 40-character SHA-1 object ID. */
11106    hash: string;
11107    /** Classification derived from `mode`. */
11108    type: ArtifactsTreeEntryType;
11109}
11110/** Decoded metadata returned by {@link ArtifactsRepo.readCommit} and {@link ArtifactsRepo.log}. */
11111interface ArtifactsCommitMetadata {
11112    /** Lowercase, 40-character SHA-1 commit ID. */
11113    hash: string;
11114    /** Lowercase, 40-character SHA-1 ID of the commit's root tree. */
11115    treeHash: string;
11116    /** Commit message with one trailing newline removed, if present. */
11117    message: string;
11118    /** Author identity from the commit. */
11119    author: {
11120        /** Author name. */
11121        name: string;
11122        /** Author email address. */
11123        email: string;
11124    };
11125    /** Committer identity from the commit. */
11126    committer: {
11127        /** Committer name. */
11128        name: string;
11129        /** Committer email address. */
11130        email: string;
11131    };
11132    /** Parent commit IDs in Git order; empty for a root commit. */
11133    parents: string[];
11134    /** Author timestamp in Unix seconds. */
11135    authoredAt: number;
11136    /** Committer timestamp in Unix seconds. */
11137    committedAt: number;
11138}
11139/**
11140 * Repository capability returned by {@link Artifacts.get}.
11141 *
11142 * Metadata is available through {@link info}, not as properties on the capability.
11143 * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.
11144 *
11145 * The capability is an RPC stub. Dispose of it when finished, for example with
11146 * `using repo = await env.ARTIFACTS.get(name);`, to release it before the request ends.
11147 */
11148interface ArtifactsRepo extends Disposable {
11149    /**
11150     * Create an access token for this repo.
11151     * @param scope Token scope: "write" (default) or "read".
11152     * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000).
11153     * @throws {ArtifactsError} with code `INVALID_TTL` if ttl is out of range.
11154     */
11155    createToken(scope?: 'write' | 'read', ttl?: number): Promise<ArtifactsCreateTokenResult>;
11156    /** List tokens for this repo (metadata only, no plaintext). */
11157    listTokens(): Promise<ArtifactsTokenListResult>;
11158    /**
11159     * Revoke a token by plaintext or ID.
11160     * @param tokenOrId Plaintext token or token ID.
11161     * @returns true if revoked, false if not found.
11162     * @throws {ArtifactsError} with code `INVALID_INPUT` if tokenOrId is empty.
11163     */
11164    revokeToken(tokenOrId: string): Promise<boolean>;
11165    /**
11166     * Retrieve current repository metadata. Each call performs a fresh lookup.
11167     * @returns Current public repository metadata.
11168     * @throws {ArtifactsError} `NOT_FOUND` if the repository was deleted, or `INTERNAL_ERROR` on
11169     * an unexpected lookup failure.
11170     */
11171    info(): Promise<ArtifactsRepoInfo>;
11172    /**
11173     * Read the raw bytes of a Git blob by object ID.
11174     * @param hash Lowercase, 40-character SHA-1 object ID.
11175     * @returns An untyped {@link Blob}, or `null` if the object is missing or is not a Git blob.
11176     * @throws {ArtifactsError} `INVALID_INPUT` for a malformed hash, `MEMORY_LIMIT` if the object
11177     * cannot be buffered safely, or `INTERNAL_ERROR` on an unexpected read failure.
11178     * @see {@link ArtifactsRepo.readFile} to resolve a file by ref and path.
11179     */
11180    readBlob(hash: string): Promise<Blob | null>;
11181    /**
11182     * Read the immediate children of a Git tree by object ID.
11183     * @param hash Lowercase, 40-character SHA-1 tree ID.
11184     * @returns Tree entries, or `null` if the object is missing.
11185     * @throws {ArtifactsError} `INVALID_INPUT` for a malformed hash, or `INTERNAL_ERROR` if the
11186     * object is not a valid tree or the read fails unexpectedly.
11187     * @see {@link ArtifactsTreeEntry}
11188     */
11189    readTree(hash: string): Promise<ArtifactsTreeEntry[] | null>;
11190    /**
11191     * Decode a Git commit by object ID.
11192     * @param hash Lowercase, 40-character SHA-1 commit ID.
11193     * @returns Commit metadata, or `null` if the object is missing.
11194     * @throws {ArtifactsError} `INVALID_INPUT` for a malformed hash, or `INTERNAL_ERROR` if the
11195     * object is not a valid commit or the read fails unexpectedly.
11196     * @see {@link ArtifactsCommitMetadata}
11197     */
11198    readCommit(hash: string): Promise<ArtifactsCommitMetadata | null>;
11199    /**
11200     * Resolve a file from a branch, tag, or commit ID and return its bytes with a browser-safe
11201     * content type in {@link Blob.type}.
11202     * @param args File lookup options.
11203     * @param args.ref Branch, tag, or commit ID to resolve.
11204     * @param args.path Non-empty repository-relative path.
11205     * @returns A MIME-typed {@link Blob}, or `null` if the ref or path cannot resolve to a file.
11206     * @throws {ArtifactsError} `INVALID_INPUT` if either argument is empty, `MEMORY_LIMIT` if the
11207     * file cannot be buffered safely, or `INTERNAL_ERROR` on an unexpected read failure.
11208     */
11209    readFile(args: {
11210        ref: string;
11211        path: string;
11212    }): Promise<Blob | null>;
11213    /**
11214     * List commits along the first-parent chain, newest first.
11215     * @param opts History options. All fields are optional.
11216     * @param opts.ref Branch, tag, or commit ID; defaults to `HEAD`.
11217     * @param opts.limit Maximum results; defaults to `50` and is capped at `1000`.
11218     * @param opts.offset Number of matching commits to skip; defaults to `0`.
11219     * @returns Commit metadata, or an empty array if the ref cannot be resolved.
11220     * @throws {ArtifactsError} `INTERNAL_ERROR` on an unexpected traversal failure.
11221     * @see {@link ArtifactsCommitMetadata}
11222     */
11223    log(opts?: {
11224        ref?: string;
11225        limit?: number;
11226        offset?: number;
11227    }): Promise<ArtifactsCommitMetadata[]>;
11228    // ── Fork ──
11229    /**
11230     * Fork this repo to a new repo.
11231     * @param name Target repository name.
11232     * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true).
11233     * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
11234     * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.
11235     * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if a fork is already running.
11236     */
11237    fork(name: string, opts?: {
11238        description?: string;
11239        readOnly?: boolean;
11240        defaultBranchOnly?: boolean;
11241    }): Promise<ArtifactsCreateRepoResult>;
11242}
11243// ── Error types ──────────────────────────────────────────────────────────────
11244/**
11245 * Error codes returned by Artifacts binding operations.
11246 *
11247 * Each code maps to a numeric code available on `ArtifactsError.numericCode`.
11248 */
11249type ArtifactsErrorCode = 'ALREADY_EXISTS' | 'NOT_FOUND' | 'CREATE_IN_PROGRESS' | 'IMPORT_IN_PROGRESS' | 'FORK_IN_PROGRESS' | 'INVALID_INPUT' | 'INVALID_REPO_NAME' | 'INVALID_TTL' | 'INVALID_URL' | 'REMOTE_AUTH_REQUIRED' | 'UPSTREAM_UNAVAILABLE' | 'MEMORY_LIMIT' | 'INTERNAL_ERROR';
11250/**
11251 * Error thrown by Artifacts binding operations.
11252 *
11253 * Uses a string `.code` discriminator following the Cloudflare platform
11254 * convention (StreamError, ImagesError, etc.). The `.numericCode` matches
11255 * the REST API `errors[].code` values.
11256 */
11257interface ArtifactsError extends Error {
11258    readonly name: 'ArtifactsError';
11259    /** String error code for programmatic matching. */
11260    readonly code: ArtifactsErrorCode;
11261    /** Numeric error code matching the REST API. */
11262    readonly numericCode: number;
11263}
11264// ── Binding ──────────────────────────────────────────────────────────────────
11265/**
11266 * Artifacts binding — namespace-level operations.
11267 *
11268 * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.
11269 */
11270interface Artifacts {
11271    /**
11272     * Create a new repository with an initial access token.
11273     * @param name Repository name (alphanumeric, dots, hyphens, underscores).
11274     * @param opts Optional: readOnly flag, description, default branch name.
11275     * @returns Repo metadata with initial token.
11276     * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
11277     * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the repo already exists.
11278     */
11279    create(name: string, opts?: {
11280        readOnly?: boolean;
11281        description?: string;
11282        setDefaultBranch?: string;
11283    }): Promise<ArtifactsCreateRepoResult>;
11284    /**
11285     * Get a handle to an existing repository.
11286     * @param name Repository name.
11287     * @returns Repo handle.
11288     * @throws {ArtifactsError} with code `NOT_FOUND` if the repo does not exist.
11289     * @throws {ArtifactsError} with code `CREATE_IN_PROGRESS` if the repo is still being created.
11290     * @throws {ArtifactsError} with code `IMPORT_IN_PROGRESS` if the repo is still importing.
11291     * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if the repo is still forking.
11292     */
11293    get(name: string): Promise<ArtifactsRepo>;
11294    /**
11295     * Import a repository from an external git remote.
11296     * @param params Source URL and optional branch/depth, plus target name and options.
11297     * @returns Repo metadata with initial token.
11298     * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if the target name is invalid.
11299     * @throws {ArtifactsError} with code `INVALID_INPUT` if the source URL is not valid HTTPS.
11300     * @throws {ArtifactsError} with code `INVALID_URL` if the source URL does not point to a git repository.
11301     * @throws {ArtifactsError} with code `REMOTE_AUTH_REQUIRED` if the remote requires authentication.
11302     * @throws {ArtifactsError} with code `NOT_FOUND` if the remote repository does not exist.
11303     * @throws {ArtifactsError} with code `UPSTREAM_UNAVAILABLE` if the remote cannot be reached.
11304     * @throws {ArtifactsError} with code `MEMORY_LIMIT` if the import exceeds service memory limits.
11305     * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.
11306     */
11307    import(params: {
11308        source: {
11309            url: string;
11310            branch?: string;
11311            depth?: number;
11312        };
11313        target: {
11314            name: string;
11315            opts?: {
11316                description?: string;
11317                readOnly?: boolean;
11318            };
11319        };
11320    }): Promise<ArtifactsCreateRepoResult>;
11321    /**
11322     * List repositories with cursor-based pagination.
11323     * @param opts Optional: limit (1–200, default 50), cursor for next page.
11324     */
11325    list(opts?: {
11326        limit?: number;
11327        cursor?: string;
11328    }): Promise<ArtifactsRepoListResult>;
11329    /**
11330     * Delete a repository and all associated tokens.
11331     * @param name Repository name.
11332     * @returns true if deleted, false if not found.
11333     * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.
11334     */
11335    delete(name: string): Promise<boolean>;
11336}
11337/**
11338 * @deprecated Use the standalone AI Search Workers binding instead.
11339 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11340 */
11341interface AutoRAGInternalError extends Error {
11342}
11343/**
11344 * @deprecated Use the standalone AI Search Workers binding instead.
11345 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11346 */
11347interface AutoRAGNotFoundError extends Error {
11348}
11349/**
11350 * @deprecated Use the standalone AI Search Workers binding instead.
11351 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11352 */
11353interface AutoRAGUnauthorizedError extends Error {
11354}
11355/**
11356 * @deprecated Use the standalone AI Search Workers binding instead.
11357 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11358 */
11359interface AutoRAGNameNotSetError extends Error {
11360}
11361type ComparisonFilter = {
11362    key: string;
11363    type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
11364    value: string | number | boolean;
11365};
11366type CompoundFilter = {
11367    type: 'and' | 'or';
11368    filters: ComparisonFilter[];
11369};
11370/**
11371 * @deprecated Use the standalone AI Search Workers binding instead.
11372 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11373 */
11374type AutoRagSearchRequest = {
11375    query: string;
11376    filters?: CompoundFilter | ComparisonFilter;
11377    max_num_results?: number;
11378    ranking_options?: {
11379        ranker?: string;
11380        score_threshold?: number;
11381    };
11382    reranking?: {
11383        enabled?: boolean;
11384        model?: string;
11385    };
11386    rewrite_query?: boolean;
11387};
11388/**
11389 * @deprecated Use the standalone AI Search Workers binding instead.
11390 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11391 */
11392type AutoRagAiSearchRequest = AutoRagSearchRequest & {
11393    stream?: boolean;
11394    system_prompt?: string;
11395};
11396/**
11397 * @deprecated Use the standalone AI Search Workers binding instead.
11398 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11399 */
11400type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {
11401    stream: true;
11402};
11403/**
11404 * @deprecated Use the standalone AI Search Workers binding instead.
11405 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11406 */
11407type AutoRagSearchResponse = {
11408    object: 'vector_store.search_results.page';
11409    search_query: string;
11410    data: {
11411        file_id: string;
11412        filename: string;
11413        score: number;
11414        attributes: Record<string, string | number | boolean | null>;
11415        content: {
11416            type: 'text';
11417            text: string;
11418        }[];
11419    }[];
11420    has_more: boolean;
11421    next_page: string | null;
11422};
11423/**
11424 * @deprecated Use the standalone AI Search Workers binding instead.
11425 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11426 */
11427type AutoRagListResponse = {
11428    id: string;
11429    enable: boolean;
11430    type: string;
11431    source: string;
11432    vectorize_name: string;
11433    paused: boolean;
11434    status: string;
11435}[];
11436/**
11437 * @deprecated Use the standalone AI Search Workers binding instead.
11438 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11439 */
11440type AutoRagAiSearchResponse = AutoRagSearchResponse & {
11441    response: string;
11442};
11443/**
11444 * @deprecated Use the standalone AI Search Workers binding instead.
11445 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11446 */
11447declare abstract class AutoRAG {
11448    /**
11449     * @deprecated Use the standalone AI Search Workers binding instead.
11450     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11451     */
11452    list(): Promise<AutoRagListResponse>;
11453    /**
11454     * @deprecated Use the standalone AI Search Workers binding instead.
11455     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11456     */
11457    search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
11458    /**
11459     * @deprecated Use the standalone AI Search Workers binding instead.
11460     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11461     */
11462    aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
11463    /**
11464     * @deprecated Use the standalone AI Search Workers binding instead.
11465     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11466     */
11467    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
11468    /**
11469     * @deprecated Use the standalone AI Search Workers binding instead.
11470     * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
11471     */
11472    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
11473}
11474type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
11475type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other';
11476/** Options fields shared by all quick actions. */
11477interface BrowserRunBaseOptions {
11478    /** Adds `<script>` tags into the page with the desired URL or content.
11479     * @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions
11480     */
11481    addScriptTag?: Array<{
11482        content?: string;
11483        url?: string;
11484        type?: string;
11485        id?: string;
11486    }>;
11487    /** Adds `<link rel="stylesheet">` or `<style>` tags into the page.
11488     * @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions
11489     */
11490    addStyleTag?: Array<{
11491        content?: string;
11492        url?: string;
11493    }>;
11494    /** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */
11495    authenticate?: {
11496        username: string;
11497        password: string;
11498    };
11499    /** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */
11500    cookies?: Array<{
11501        name: string;
11502        value: string;
11503        url?: string;
11504        domain?: string;
11505        path?: string;
11506        secure?: boolean;
11507        httpOnly?: boolean;
11508        sameSite?: 'Strict' | 'Lax' | 'None';
11509        expires?: number;
11510        priority?: 'Low' | 'Medium' | 'High';
11511        sameParty?: boolean;
11512        sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
11513        sourcePort?: number;
11514        partitionKey?: string;
11515    }>;
11516    /** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */
11517    emulateMediaType?: string;
11518    /** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */
11519    gotoOptions?: {
11520        /** Navigation timeout in milliseconds (max 60 000). @default 30000 */
11521        timeout?: number;
11522        /** When to consider navigation complete. @default "domcontentloaded" */
11523        waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];
11524        referer?: string;
11525        referrerPolicy?: string;
11526    };
11527    /** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */
11528    rejectRequestPattern?: string[];
11529    /** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */
11530    allowRequestPattern?: string[];
11531    /** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */
11532    rejectResourceTypes?: BrowserRunResourceType[];
11533    /** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */
11534    allowResourceTypes?: BrowserRunResourceType[];
11535    /** Additional HTTP headers sent with every request. */
11536    setExtraHTTPHeaders?: Record<string, string>;
11537    /** Whether JavaScript is enabled on the page. */
11538    setJavaScriptEnabled?: boolean;
11539    /** Override the default user agent string.
11540     * @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
11541     * */
11542    userAgent?: string;
11543    /** Set the browser viewport size.
11544     * @see https://pptr.dev/api/puppeteer.viewport
11545     * @default {width:1920,height:1080}
11546     * */
11547    viewport?: {
11548        width: number;
11549        height: number;
11550        deviceScaleFactor?: number;
11551        isMobile?: boolean;
11552        isLandscape?: boolean;
11553        hasTouch?: boolean;
11554    };
11555    /** Wait for a CSS selector to appear in the page before proceeding.
11556     * @see https://pptr.dev/api/puppeteer.waitforselectoroptions
11557     */
11558    waitForSelector?: {
11559        selector: string;
11560        hidden?: true;
11561        visible?: true;
11562        /** Timeout in milliseconds. Max 120000 */
11563        timeout?: number;
11564    };
11565    /** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */
11566    waitForTimeout?: number;
11567    /** When true, continue on best-effort when awaited events fail or timeout. */
11568    bestAttempt?: boolean;
11569    /** Maximum duration in milliseconds for the browser action after page load. Max 120000 */
11570    actionTimeout?: number;
11571    /** Cache time to live in seconds (0-86400). Set to 0 to disable.
11572     * @default 5
11573     */
11574    cacheTTL?: number;
11575}
11576/**
11577 * Backend selection, mixed into the options of the quick actions that support it.
11578 * Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`
11579 * reject an alternate backend, so they must not accept the field.
11580 */
11581interface BrowserRunAlternateBackendOptions {
11582    /** Render with an alternate browser backend instead of the default one. */
11583    browser?: 'kitesurf';
11584}
11585/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
11586type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
11587    /** URL to navigate to, e.g. `"https://example.com"`. */
11588    url: string;
11589}) | (BrowserRunBaseOptions & {
11590    /** Set the HTML content of the page directly. */
11591    html: string;
11592});
11593type BrowserRunPuppeteerScreenshotOptions = {
11594    /** @default "png" */
11595    type?: 'png' | 'jpeg' | 'webp';
11596    /** @default "binary" */
11597    encoding?: 'binary' | 'base64';
11598    quality?: number;
11599    fullPage?: boolean;
11600    clip?: {
11601        x: number;
11602        y: number;
11603        width: number;
11604        height: number;
11605        scale?: number;
11606    };
11607    omitBackground?: boolean;
11608    optimizeForSpeed?: boolean;
11609    captureBeyondViewport?: boolean;
11610    fromSurface?: boolean;
11611};
11612type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
11613    /** CSS selector of the element to screenshot. */
11614    selector?: string;
11615    /** When true, scroll the entire page before taking the screenshot. */
11616    scrollPage?: boolean;
11617    /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
11618    screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
11619} & BrowserRunAlternateBackendOptions;
11620type BrowserRunPDFOptions = BrowserRunCommonOptions & {
11621    /** @see https://pptr.dev/api/puppeteer.pdfoptions */
11622    pdfOptions?: {
11623        /** @default 1 */
11624        scale?: number;
11625        /** @default false */
11626        displayHeaderFooter?: boolean;
11627        headerTemplate?: string;
11628        footerTemplate?: string;
11629        /** @default false */
11630        printBackground?: boolean;
11631        /** @default false */
11632        landscape?: boolean;
11633        pageRanges?: string;
11634        /** @default "letter" */
11635        format?: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
11636        width?: string | number;
11637        height?: string | number;
11638        /** @default false */
11639        preferCSSPageSize?: boolean;
11640        margin?: {
11641            top?: string | number;
11642            right?: string | number;
11643            bottom?: string | number;
11644            left?: string | number;
11645        };
11646        /** @default false */
11647        omitBackground?: boolean;
11648        /** @default true */
11649        tagged?: boolean;
11650        /** @default false */
11651        outline?: boolean;
11652        /** @default 30000 */
11653        timeout?: number;
11654    };
11655} & BrowserRunAlternateBackendOptions;
11656type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
11657    /** CSS selectors to scrape. At least one element is required. */
11658    elements: Array<{
11659        selector: string;
11660    }>;
11661};
11662type BrowserRunLinksOptions = BrowserRunCommonOptions & {
11663    /** When true, only return links that are visible on the page. @default false */
11664    visibleLinksOnly?: boolean;
11665    /** When true, exclude links pointing to external domains. @default false */
11666    excludeExternalLinks?: boolean;
11667};
11668type BrowserRunSnapshotFormat = 'content' | 'screenshot' | 'markdown' | 'accessibilityTree';
11669type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
11670    /** Which representations of the page to return. At least two distinct formats
11671     * are required; request a single format from its dedicated action instead.
11672     * @default ["content","screenshot"]
11673     */
11674    formats?: BrowserRunSnapshotFormat[];
11675    /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
11676    screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
11677};
11678/** Options for the `accessibilityTree` quick action. */
11679type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {
11680    /** When true, prune nodes that carry no semantic meaning, such as generic
11681     * containers. Defaults to true, or to false when `root` is set so that the
11682     * requested subtree is returned as-is.
11683     */
11684    interestingOnly?: boolean;
11685    /** CSS selector limiting the tree to the matching element's subtree.
11686     * A selector that matches nothing yields `accessibilityTree: null` with
11687     * HTTP 200; a malformed selector is an error.
11688     */
11689    root?: string;
11690} & BrowserRunAlternateBackendOptions;
11691interface BrowserRunJsonBaseOptions {
11692    /** Custom AI models to try in order. Max 3. Falls back to next on error. */
11693    custom_ai?: Array<{
11694        /** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */
11695        model: string;
11696        /** Bearer token. Not needed for workers-ai models. */
11697        authorization?: string;
11698    }>;
11699}
11700/**
11701 * Options for the `json` quick action.
11702 * At least one of `prompt` or `response_format` must be provided.
11703 */
11704type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
11705    /** Natural-language prompt describing what data to extract. */
11706    prompt: string;
11707    /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
11708    response_format?: AiTextGenerationResponseFormat;
11709} | {
11710    /** Natural-language prompt describing what data to extract. */
11711    prompt?: string;
11712    /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
11713    response_format: AiTextGenerationResponseFormat;
11714});
11715type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
11716type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
11717type BrowserRunRedirectHop = {
11718    /** URL that returned the redirect. */
11719    url: string;
11720    /** HTTP status of the redirect. */
11721    status: number;
11722    /** Redirect response headers, including `location`. */
11723    headers: Record<string, string>;
11724};
11725type BrowserRunResponseMeta = {
11726    /** HTTP status code of the rendered page */
11727    status: number;
11728    /** Page title */
11729    title: string;
11730    /** Origin response headers, lowercased. Repeated headers are joined with a newline. Credential and transport-only headers that do not survive rendering are omitted. */
11731    headers?: Record<string, string>;
11732    /** URL that served the response, after any redirects the browser followed. */
11733    finalUrl?: string;
11734    /** HTTP redirects followed to reach `finalUrl`, oldest first. Omitted for direct navigation and for client-side redirects such as meta refresh. An empty array means redirects occurred but their intermediate responses could not be read. */
11735    redirectChain?: BrowserRunRedirectHop[];
11736};
11737/**
11738 * A node in the page's accessibility tree, as exposed to assistive technology.
11739 * `role` is the only field always present; the rest are populated when the
11740 * underlying element defines them.
11741 * @see https://pptr.dev/api/puppeteer.serializedaxnode
11742 */
11743interface BrowserRunSerializedAXNode {
11744    /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */
11745    role: string;
11746    /** The `aria-autocomplete` value. */
11747    autocomplete?: string;
11748    /** Checked state of a checkbox, radio, or menu item. */
11749    checked?: boolean | 'mixed';
11750    /** Accessible description, typically from `aria-describedby` or `title`. */
11751    description?: string;
11752    disabled?: boolean;
11753    expanded?: boolean;
11754    /** Whether the element currently holds keyboard focus. */
11755    focused?: boolean;
11756    /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */
11757    haspopup?: string;
11758    /** The `aria-invalid` value. */
11759    invalid?: string;
11760    /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */
11761    keyshortcuts?: string;
11762    /** Hierarchical level, e.g. the heading level of an `<h2>`. */
11763    level?: number;
11764    /** Whether the element is a modal dialog. */
11765    modal?: boolean;
11766    /** Whether a text input accepts multiple lines. */
11767    multiline?: boolean;
11768    /** Whether more than one option can be selected. */
11769    multiselectable?: boolean;
11770    /** Accessible name, e.g. a button's label or an image's alt text. */
11771    name?: string;
11772    orientation?: string;
11773    /** Pressed state of a toggle button. */
11774    pressed?: boolean | 'mixed';
11775    readonly?: boolean;
11776    required?: boolean;
11777    /** Author-supplied role description, from `aria-roledescription`. */
11778    roledescription?: string;
11779    selected?: boolean;
11780    /** Current value of an input or range element. */
11781    value?: string | number;
11782    valuemax?: number;
11783    valuemin?: number;
11784    /** Human-readable form of `value`, from `aria-valuetext`. */
11785    valuetext?: string;
11786    /** Child nodes. Absent for leaf nodes. */
11787    children?: BrowserRunSerializedAXNode[];
11788}
11789/** Success response for `content` action. */
11790type BrowserRunContentSuccessResponse = {
11791    success: true;
11792    /** Extracted HTML content */
11793    result: string;
11794    meta: BrowserRunResponseMeta;
11795};
11796/** Success response for `links` action. */
11797type BrowserRunLinksSuccessResponse = {
11798    success: true;
11799    /** Extracted links */
11800    result: string[];
11801    meta: BrowserRunResponseMeta;
11802};
11803/** Success response for `scrape` action. */
11804type BrowserRunScrapeSuccessResponse = {
11805    success: true;
11806    result: Array<{
11807        /** The CSS selector used to find elements. */
11808        selector: string;
11809        /** Array of elements matching the selector. */
11810        results: Array<{
11811            /** Outer HTML of the element. */
11812            html: string;
11813            /** Text content of the element. */
11814            text: string;
11815            /** Width of the element in pixels. */
11816            width: number;
11817            /** Height of the element in pixels. */
11818            height: number;
11819            /** Top position of the element relative to the viewport in pixels. */
11820            top: number;
11821            /** Left position of the element relative to the viewport in pixels. */
11822            left: number;
11823            /** Array of HTML attributes on the element. */
11824            attributes: Array<{
11825                /** Attribute name. */
11826                name: string;
11827                /** Attribute value. */
11828                value: string;
11829            }>;
11830        }>;
11831    }>;
11832    meta: BrowserRunResponseMeta;
11833};
11834/** Success response for `snapshot` action. Each field is present only when the
11835 * corresponding entry was requested in `formats`.
11836 */
11837type BrowserRunSnapshotSuccessResponse = {
11838    success: true;
11839    result: {
11840        /** HTML content of the page. */
11841        content?: string;
11842        /** Base64-encoded screenshot image. */
11843        screenshot?: string;
11844        /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the
11845         * page provides that metadata.
11846         */
11847        markdown?: string;
11848        /** Root of the page's accessibility tree. */
11849        accessibilityTree?: BrowserRunSerializedAXNode;
11850    };
11851    meta: BrowserRunResponseMeta;
11852};
11853/** Success response for `accessibilityTree` action. */
11854type BrowserRunAccessibilityTreeSuccessResponse = {
11855    success: true;
11856    result: {
11857        /** Root of the accessibility tree, or `null` when `root` matched no element. */
11858        accessibilityTree: BrowserRunSerializedAXNode | null;
11859    };
11860    meta: BrowserRunResponseMeta;
11861};
11862/** Success response for `json` action. */
11863type BrowserRunJsonSuccessResponse = {
11864    success: true;
11865    /** JSON data extracted from the page using an AI model */
11866    result: Record<string, unknown>;
11867    meta: BrowserRunResponseMeta;
11868};
11869/** Success response for `markdown` action. */
11870type BrowserRunMarkdownSuccessResponse = {
11871    success: true;
11872    /** Extracted markdown content */
11873    result: string;
11874    meta: BrowserRunResponseMeta;
11875};
11876/** Error response for BrowserRun actions. */
11877type BrowserRunErrorResponse = {
11878    success: false;
11879    errors: {
11880        message: string;
11881        code?: number;
11882        detail?: string;
11883        path?: string;
11884    }[];
11885};
11886/** Error response for BrowserRun `json` action. */
11887type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {
11888    /** Raw AI response text for debugging */
11889    rawAiResponse?: string;
11890};
11891/** Session-scoped guardrails applied when acquiring a browser session. */
11892type BrowserRunAcquireGuardrails = {
11893    /** Domains that the browser may access. An empty list denies all domains. */
11894    allowedDomains?: string[];
11895    /** Named domain sets that the browser may access. */
11896    allowedDomainSets?: string[];
11897};
11898/** Options for acquiring a new browser session. */
11899type BrowserRunAcquireOptions = {
11900    /** Idle session lifetime in milliseconds. */
11901    keepAlive?: number;
11902    /** Record the browser session. */
11903    recording?: boolean;
11904    /** Geoegress hint as an ISO-3166 alpha-2 country code. */
11905    location?: string;
11906    /** Map hostnames to caller-provided Workers that handle outbound requests. */
11907    outboundByHost?: Record<string, Fetcher>;
11908    /** Session-scoped network guardrails. */
11909    guardrails?: BrowserRunAcquireGuardrails;
11910    /** Include the session's DevTools targets in the result. */
11911    targets?: boolean;
11912    /** Lifetime of target live-view URLs in milliseconds. */
11913    liveViewUrlExpiresInMs?: number;
11914};
11915/** Metadata returned when a browser session is acquired. */
11916type BrowserRunAcquireResult = {
11917    sessionId: string;
11918    targets?: BrowserRunDevToolsTarget[];
11919};
11920/** Options for connecting to an already-acquired browser session. */
11921type BrowserRunConnectOptions = {
11922    /** Connect to a specific page target instead of the browser-level CDP endpoint. */
11923    targetId?: string;
11924};
11925/** Connection capability returned by `connectSession()` and `launch()`. */
11926type BrowserRunConnection = {
11927    sessionId: string;
11928    /** A session-pinned Fetcher. Use its `fetch()` method for a WebSocket upgrade. */
11929    webSocket: Fetcher;
11930    targets?: BrowserRunDevToolsTarget[];
11931};
11932/** The UI mode for a live-view link. */
11933type BrowserRunLiveViewMode = 'devtools' | 'tab' | 'full';
11934/** Connection-scoped guardrails applied to a live-view link. */
11935type BrowserRunConnectionGuardrails = {
11936    mode: 'readonly';
11937};
11938/** Options for minting a live-view link. */
11939type BrowserRunLiveViewOptions = {
11940    mode?: BrowserRunLiveViewMode;
11941    targetId?: string;
11942    expiresInMs?: number;
11943    guardrails?: BrowserRunConnectionGuardrails;
11944};
11945/** Live-view link metadata. */
11946type BrowserRunLiveView = {
11947    webSocketDebuggerUrl: string;
11948    devtoolsFrontendUrl: string;
11949    id: string;
11950    options: {
11951        mode: BrowserRunLiveViewMode;
11952        guardrails?: BrowserRunConnectionGuardrails;
11953    };
11954};
11955/** Options for listing active browser sessions. */
11956type BrowserRunListSessionsOptions = {
11957    limit?: number;
11958    offset?: number;
11959};
11960/** Options for listing session history. */
11961type BrowserRunHistoryOptions = {
11962    limit?: number;
11963    offset?: number;
11964};
11965/** A browser session returned by the session-management methods. */
11966type BrowserRunSession = {
11967    sessionId: string;
11968    startTime?: number;
11969    endTime?: number;
11970    closeReason?: number;
11971    closeReasonText?: string;
11972    connectionId?: string;
11973    connectionStartTime?: number;
11974    connectionEndTime?: number;
11975    lastUpdated?: number;
11976    webSocketDebuggerUrl?: string;
11977    devtoolsFrontendUrl?: string;
11978};
11979/** Account browser-session and browser-time limits. */
11980type BrowserRunLimits = {
11981    activeSessions: Array<{
11982        id: string;
11983    }>;
11984    maxConcurrentSessions: number;
11985    allowedBrowserAcquisitions: number;
11986    timeUntilNextAllowedBrowserAcquisition: number;
11987    usedBrowserTimeSeconds?: number;
11988};
11989/** A browser target returned by the DevTools JSON methods. */
11990type BrowserRunDevToolsTarget = {
11991    id: string;
11992    type: string;
11993    url: string;
11994    title?: string;
11995    description?: string;
11996    webSocketDebuggerUrl?: string;
11997    devtoolsFrontendUrl?: string;
11998};
11999/** Browser and protocol version metadata. */
12000type BrowserRunDevToolsVersion = {
12001    Browser: string;
12002    'Protocol-Version': string;
12003    'User-Agent': string;
12004    'V8-Version': string;
12005    'WebKit-Version': string;
12006    webSocketDebuggerUrl: string;
12007};
12008/** A DevTools protocol domain. Protocol definitions may gain additional fields over time. */
12009interface BrowserRunDevToolsProtocolDomain extends Record<string, unknown> {
12010    domain: string;
12011    experimental?: boolean;
12012    dependencies?: string[];
12013    types?: Array<Record<string, any>>;
12014    commands?: Array<Record<string, any>>;
12015    events?: Array<Record<string, any>>;
12016}
12017/** The DevTools protocol definition. Additional protocol fields may be returned by Chrome. */
12018interface BrowserRunDevToolsProtocol extends Record<string, any> {
12019    domains: BrowserRunDevToolsProtocolDomain[];
12020    version?: {
12021        major: string;
12022        minor: string;
12023    };
12024}
12025/** Options shared by DevTools target-listing and target-creation methods. */
12026type BrowserRunTargetOptions = {
12027    liveViewUrlExpiresInMs?: number;
12028};
12029/** Result returned by DevTools target activation and close methods. */
12030type BrowserRunTargetActionResult = {
12031    message: string;
12032};
12033/** Methods exposed by the nested `devtools` binding target. */
12034type BrowserRunDevtools = {
12035    getVersion(sessionId: string): Promise<BrowserRunDevToolsVersion>;
12036    getProtocol(sessionId: string): Promise<BrowserRunDevToolsProtocol>;
12037    listTargets(sessionId: string, options?: BrowserRunTargetOptions): Promise<BrowserRunDevToolsTarget[]>;
12038    getTarget(sessionId: string, targetId: string): Promise<BrowserRunDevToolsTarget>;
12039    newTarget(sessionId: string, url?: string, options?: BrowserRunTargetOptions): Promise<BrowserRunDevToolsTarget>;
12040    activateTarget(sessionId: string, targetId: string): Promise<BrowserRunTargetActionResult>;
12041    closeTarget(sessionId: string, targetId: string): Promise<BrowserRunTargetActionResult>;
12042};
12043/** Result returned when closing a browser session. */
12044type BrowserRunCloseSessionResult = {
12045    status: 'closing' | 'closed';
12046};
12047/**
12048 * Browser Run API binding for automating headless browsers.
12049 * @see https://developers.cloudflare.com/browser-run/
12050 */
12051declare abstract class BrowserRun {
12052    /**
12053     * Send a raw HTTP request to the Browser Run API.
12054     * Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.
12055     * @see https://developers.cloudflare.com/browser-run/
12056     */
12057    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
12058    /**
12059     * Take a screenshot of a web page.
12060     * @param action - Must be `'screenshot'`.
12061     * @param options - Screenshot options including viewport, selectors, and image format.
12062     * @returns A `Response` containing one of:
12063     *
12064     * **Success (HTTP 200):**
12065     * - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)
12066     * - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)
12067     *
12068     * **Error:**
12069     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12070     *
12071     * **Headers:**
12072     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12073     */
12074    quickAction(action: 'screenshot', options: BrowserRunScreenshotOptions): Promise<Response>;
12075    /**
12076     * Generate a PDF of a web page.
12077     * @param action - Must be `'pdf'`.
12078     * @param options - PDF generation options including page size, margins, and headers/footers.
12079     * @returns A `Response` containing one of:
12080     *
12081     * **Success (HTTP 200):**
12082     * - Binary PDF data with `Content-Type: application/pdf`
12083     *
12084     * **Error:**
12085     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12086     *
12087     * **Headers:**
12088     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12089     */
12090    quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;
12091    /**
12092     * Get the HTML content of a web page.
12093     * @param action - Must be `'content'`.
12094     * @param options - Navigation and page interaction options.
12095     * @returns A `Response` containing one of:
12096     *
12097     * **Success (HTTP 200):**
12098     * - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`
12099     *
12100     * **Error:**
12101     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12102     *
12103     * **Headers:**
12104     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12105     */
12106    quickAction(action: 'content', options: BrowserRunContentOptions): Promise<Response>;
12107    /**
12108     * Scrape elements from a web page by CSS selector.
12109     * @param action - Must be `'scrape'`.
12110     * @param options - Scrape options with CSS selectors for elements to extract.
12111     * @returns A `Response` containing one of:
12112     *
12113     * **Success (HTTP 200):**
12114     * - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`
12115     *
12116     * **Error:**
12117     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12118     *
12119     * **Headers:**
12120     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12121     */
12122    quickAction(action: 'scrape', options: BrowserRunScrapeOptions): Promise<Response>;
12123    /**
12124     * Extract all links from a web page.
12125     * @param action - Must be `'links'`.
12126     * @param options - Options to filter visible or internal links only.
12127     * @returns A `Response` containing one of:
12128     *
12129     * **Success (HTTP 200):**
12130     * - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`
12131     *
12132     * **Error:**
12133     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12134     *
12135     * **Headers:**
12136     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12137     */
12138    quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
12139    /**
12140     * Get several representations of a web page in one request.
12141     * @param action - Must be `'snapshot'`.
12142     * @param options - Snapshot options including the `formats` to return and
12143     * screenshot settings (encoding is always base64).
12144     * @returns A `Response` containing one of:
12145     *
12146     * **Success (HTTP 200):**
12147     * - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`
12148     *
12149     * **Error:**
12150     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12151     *
12152     * **Headers:**
12153     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12154     */
12155    quickAction(action: 'snapshot', options: BrowserRunSnapshotOptions): Promise<Response>;
12156    /**
12157     * Extract structured JSON data from a web page using AI.
12158     * @param action - Must be `'json'`.
12159     * @param options - JSON extraction options with prompt or response_format schema.
12160     * @returns A `Response` containing one of:
12161     *
12162     * **Success (HTTP 200):**
12163     * - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`
12164     *
12165     * **Error:**
12166     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12167     * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
12168     * - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)
12169     *
12170     * **Headers:**
12171     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12172     */
12173    quickAction(action: 'json', options: BrowserRunJsonOptions): Promise<Response>;
12174    /**
12175     * Convert a web page to Markdown.
12176     * @param action - Must be `'markdown'`.
12177     * @param options - Navigation and page interaction options.
12178     * @returns A `Response` containing one of:
12179     *
12180     * **Success (HTTP 200):**
12181     * - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`
12182     *
12183     * **Error:**
12184     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12185     * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
12186     *
12187     * **Headers:**
12188     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12189     */
12190    quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
12191    /**
12192     * Get the accessibility tree of a web page.
12193     * @param action - Must be `'accessibilityTree'`.
12194     * @param options - Options to scope the tree to a subtree and to control
12195     * whether semantically uninteresting nodes are pruned.
12196     * @returns A `Response` containing one of:
12197     *
12198     * **Success (HTTP 200):**
12199     * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`
12200     * - `result.accessibilityTree` is `null` when `root` matched no element
12201     *
12202     * **Error:**
12203     * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12204     * - HTTP 422 for a malformed `root` selector
12205     * - HTTP 500 with code `2017` or `2018` when the tree could not be built
12206     *
12207     * **Headers:**
12208     * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12209     */
12210    quickAction(action: 'accessibilityTree', options: BrowserRunAccessibilityTreeOptions): Promise<Response>;
12211    /** Acquire a new browser session and return its metadata. */
12212    acquire(options?: BrowserRunAcquireOptions): Promise<BrowserRunAcquireResult>;
12213    /** Acquire a browser session and return a session-pinned WebSocket capability. */
12214    launch(options?: BrowserRunAcquireOptions): Promise<BrowserRunConnection>;
12215    /** Return a session-pinned WebSocket capability for an existing session. */
12216    connectSession(sessionId: string, options?: BrowserRunConnectOptions): Promise<BrowserRunConnection>;
12217    /** Mint an authenticated live-view link for a browser session. */
12218    getLiveView(sessionId: string, options?: BrowserRunLiveViewOptions): Promise<BrowserRunLiveView>;
12219    /** List the caller's active browser sessions. */
12220    listSessions(options?: BrowserRunListSessionsOptions): Promise<BrowserRunSession[]>;
12221    /** List recent active and closed browser sessions. */
12222    history(options?: BrowserRunHistoryOptions): Promise<BrowserRunSession[]>;
12223    /** Return the caller's browser-session and browser-time limits. */
12224    limits(): Promise<BrowserRunLimits>;
12225    /** Return details for one browser session, or `null` when it does not exist. */
12226    getSession(sessionId: string): Promise<BrowserRunSession | null>;
12227    /** Close a browser session. */
12228    closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
12229    /** DevTools JSON methods exposed through one nested binding target. */
12230    get devtools(): BrowserRunDevtools;
12231}
12232/**
12233 * In addition to the properties you can set in the RequestInit dict
12234 * that you pass as an argument to the Request constructor, you can
12235 * set certain properties of a `cf` object to control how Cloudflare
12236 * features are applied to that new Request.
12237 *
12238 * Note: Currently, these properties cannot be tested in the
12239 * playground.
12240 */
12241interface RequestInitCfProperties extends Record<string, unknown> {
12242    cacheEverything?: boolean;
12243    /**
12244     * A request's cache key is what determines if two requests are
12245     * "the same" for caching purposes. If a request has the same cache key
12246     * as some previous request, then we can serve the same cached response for
12247     * both. (e.g. 'some-key')
12248     *
12249     * Only available for Enterprise customers.
12250     */
12251    cacheKey?: string;
12252    /**
12253     * This allows you to append additional Cache-Tag response headers
12254     * to the origin response without modifications to the origin server.
12255     * This will allow for greater control over the Purge by Cache Tag feature
12256     * utilizing changes only in the Workers process.
12257     *
12258     * Only available for Enterprise customers.
12259     */
12260    cacheTags?: string[];
12261    /**
12262     * Force response to be cached for a given number of seconds. (e.g. 300)
12263     */
12264    cacheTtl?: number;
12265    /**
12266     * Force response to be cached for a given number of seconds based on the Origin status code.
12267     * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
12268     */
12269    cacheTtlByStatus?: Record<string, number>;
12270    /**
12271     * Controls whether Cloudflare uses range requests when fetching the response
12272     * from the origin.
12273     *
12274     * - `"on"`: enable origin range requests for this request.
12275     * - `"off"`: disable origin range requests for this request.
12276     */
12277    originRangeRequests?: "on" | "off";
12278    /** Controls how responses with a `Vary` header are cached for this request. */
12279    vary?: RequestInitCfPropertiesVary;
12280    /**
12281     * Explicit Cache-Control header value to set on the response stored in cache.
12282     * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
12283     *
12284     * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),
12285     * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.
12286     *
12287     * Can be used together with `cacheTtlByStatus`.
12288     */
12289    cacheControl?: string;
12290    /**
12291     * Whether the response should be eligible for Cache Reserve storage.
12292     */
12293    cacheReserveEligible?: boolean;
12294    /**
12295     * Whether to respect strong ETags (as opposed to weak ETags) from the origin.
12296     */
12297    respectStrongEtag?: boolean;
12298    /**
12299     * Whether to strip ETag headers from the origin response before caching.
12300     */
12301    stripEtags?: boolean;
12302    /**
12303     * Whether to strip Last-Modified headers from the origin response before caching.
12304     */
12305    stripLastModified?: boolean;
12306    /**
12307     * Whether to enable Cache Deception Armor, which protects against web cache
12308     * deception attacks by verifying the Content-Type matches the URL extension.
12309     */
12310    cacheDeceptionArmor?: boolean;
12311    /**
12312     * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.
12313     */
12314    cacheReserveMinimumFileSize?: number;
12315    scrapeShield?: boolean;
12316    apps?: boolean;
12317    /**
12318     * Controls whether an outbound gRPC-web subrequest from this Worker is
12319     * converted to gRPC at the Cloudflare edge.
12320     *
12321     * - `"passthrough"`: forward the subrequest unchanged as gRPC-web (default).
12322     * - `"convert"`: convert the gRPC-web subrequest to gRPC at the edge.
12323     *
12324     * Provides per-request control over the same edge conversion behavior
12325     * gated by the `auto_grpc_convert` compatibility flag.
12326     */
12327    grpcWeb?: "passthrough" | "convert";
12328    image?: RequestInitCfPropertiesImage;
12329    minify?: RequestInitCfPropertiesImageMinify;
12330    mirage?: boolean;
12331    polish?: "lossy" | "lossless" | "off";
12332    r2?: RequestInitCfPropertiesR2;
12333    /**
12334     * Redirects the request to an alternate origin server. You can use this,
12335     * for example, to implement load balancing across several origins.
12336     * (e.g.us-east.example.com)
12337     *
12338     * Note - For security reasons, the hostname set in resolveOverride must
12339     * be proxied on the same Cloudflare zone of the incoming request.
12340     * Otherwise, the setting is ignored. CNAME hosts are allowed, so to
12341     * resolve to a host under a different domain or a DNS only domain first
12342     * declare a CNAME record within your own zone’s DNS mapping to the
12343     * external hostname, set proxy on Cloudflare, then set resolveOverride
12344     * to point to that CNAME record.
12345     */
12346    resolveOverride?: string;
12347}
12348/**
12349 * Controls how Workers Standard Vary handles a request header listed by an
12350 * origin `Vary` response header:
12351 *
12352 * - `"normalize"`: normalize the request header value before it is used in the
12353 *   cache variance key.
12354 * - `"passthrough"`: use the raw request header value in the cache variance
12355 *   key.
12356 * - `"bypass"`: bypass cache when the header appears in the origin `Vary`
12357 *   response header.
12358 */
12359type RequestInitCfPropertiesVaryAction = "normalize" | "passthrough" | "bypass";
12360/** Configuration for Workers Standard Vary support. */
12361interface RequestInitCfPropertiesVary {
12362    /** The fallback action for varied request headers not listed in `headers`. */
12363    default: RequestInitCfPropertiesVaryHeader;
12364    /**
12365     * Lowercase request header names and their Vary configuration.
12366     *
12367     * The `accept` header can include `media_types`, the `accept-language`
12368     * header can include `languages`, and other headers support only `action`.
12369     */
12370    headers?: RequestInitCfPropertiesVaryHeaders;
12371}
12372/** Common Vary behavior for a single request header. */
12373interface RequestInitCfPropertiesVaryHeader {
12374    /** How this request header contributes to cache variance. */
12375    action: RequestInitCfPropertiesVaryAction;
12376}
12377/** Vary behavior for the `accept` request header. */
12378interface RequestInitCfPropertiesVaryAcceptHeader extends RequestInitCfPropertiesVaryHeader {
12379    /**
12380     * Media types to keep when normalizing the `Accept` request header.
12381     *
12382     * Named `media_types` to match the serialized `cf.vary` configuration.
12383     */
12384    media_types?: string[];
12385}
12386/** Vary behavior for the `accept-language` request header. */
12387interface RequestInitCfPropertiesVaryAcceptLanguageHeader extends RequestInitCfPropertiesVaryHeader {
12388    /**
12389     * Language tags to keep when normalizing the `Accept-Language` request
12390     * header.
12391     */
12392    languages?: string[];
12393}
12394/**
12395 * Lowercase request header names and their Vary behavior.
12396 *
12397 * The index signature allows arbitrary custom request headers beyond the
12398 * well-known `accept` and `accept-language` specializations.
12399 */
12400interface RequestInitCfPropertiesVaryHeaders {
12401    accept?: RequestInitCfPropertiesVaryAcceptHeader;
12402    "accept-language"?: RequestInitCfPropertiesVaryAcceptLanguageHeader;
12403    [header: string]: RequestInitCfPropertiesVaryHeader | RequestInitCfPropertiesVaryAcceptHeader | RequestInitCfPropertiesVaryAcceptLanguageHeader | undefined;
12404}
12405interface BasicImageTransformations {
12406    /**
12407     * Maximum width in image pixels. The value must be an integer.
12408     */
12409    width?: number;
12410    /**
12411     * Maximum height in image pixels. The value must be an integer.
12412     */
12413    height?: number;
12414    /**
12415     * When cropping with fit: "cover", this defines the side or point that should
12416     * be left uncropped. The value is either a string
12417     * "left", "right", "top", "bottom", "auto", or "center" (the default),
12418     * or an object {x, y} containing focal point coordinates in the original
12419     * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12420     * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12421     * crop bottom or left and right sides as necessary, but won’t crop anything
12422     * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12423     * preserve as much as possible around a point at 20% of the height of the
12424     * source image.
12425     */
12426    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;
12427    /**
12428     * Specifies how closely the image is cropped toward detected faces when combined
12429     * with the gravity=face option. Accepts a valid range between 0.0 (includes as much
12430     * of the background as possible) and 1.0 (crops the image as closely to the face as
12431     * possible). The default is 0.
12432     */
12433    zoom?: number;
12434    /**
12435     * Resizing mode as a string. It affects interpretation of width and height
12436     * options:
12437     *  - scale-down: Similar to contain, but the image is never enlarged. If
12438     *    the image is larger than given width or height, it will be resized.
12439     *    Otherwise its original size will be kept.
12440     *  - scale-up: Similar to contain, but the image is never shrunk. If the
12441     *    image is smaller than the given width or height, it will be resized.
12442     *    Otherwise its original size will be kept.
12443     *  - contain: Resizes to maximum size that fits within the given width and
12444     *    height. If only a single dimension is given (e.g. only width), the
12445     *    image will be shrunk or enlarged to exactly match that dimension.
12446     *    Aspect ratio is always preserved.
12447     *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12448     *    and height. If the image has an aspect ratio different from the ratio
12449     *    of width and height, it will be cropped to fit.
12450     *  - crop: The image will be shrunk and cropped to fit within the area
12451     *    specified by width and height. The image will not be enlarged. For images
12452     *    smaller than the given dimensions it's the same as scale-down. For
12453     *    images larger than the given dimensions, it's the same as cover.
12454     *    See also trim.
12455     *  - pad: Resizes to the maximum size that fits within the given width and
12456     *    height, and then fills the remaining area with a background color
12457     *    (white by default). Use of this mode is not recommended, as the same
12458     *    effect can be more efficiently achieved with the contain mode and the
12459     *    CSS object-fit: contain property.
12460     *  - squeeze: Stretches and deforms to the width and height given, even if it
12461     *    breaks aspect ratio
12462     */
12463    fit?: "scale-down" | "scale-up" | "contain" | "cover" | "crop" | "pad" | "squeeze";
12464    /**
12465     * Allows you to trim your image. Takes dpr into account and is performed before
12466     * resizing or rotation.
12467     *
12468     * It can be used as:
12469     * - left, top, right, bottom - it will specify the number of pixels to cut
12470     *   off each side
12471     * - width, height - the width/height you'd like to end up with - can be used
12472     *   in combination with the properties above
12473     * - border - this will automatically trim the surroundings of an image based on
12474     *   it's color. It consists of three properties:
12475     *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12476     *    - tolerance: difference from color to treat as color
12477     *    - keep: the number of pixels of border to keep
12478     */
12479    trim?: "border" | {
12480        top?: number;
12481        bottom?: number;
12482        left?: number;
12483        right?: number;
12484        width?: number;
12485        height?: number;
12486        border?: boolean | {
12487            color?: string;
12488            tolerance?: number;
12489            keep?: number;
12490        };
12491    };
12492    /**
12493     * Background color to add underneath the image. Applies only to images with
12494     * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12495     * hsl(…), etc.)
12496     */
12497    background?: string;
12498    /**
12499     * Flips the images horizontally, vertically, or both. Flipping is applied before
12500     * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12501     * horizontally, then rotated by 90 degrees.
12502     */
12503    flip?: 'h' | 'v' | 'hv';
12504    /**
12505     * Number of degrees (90, 180, 270) to rotate the image by. width and height
12506     * options refer to axes after rotation.
12507     */
12508    rotate?: 0 | 90 | 180 | 270 | 360;
12509    /**
12510     * Strength of sharpening filter to apply to the image. Floating-point
12511     * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12512     * recommended value for downscaled images.
12513     */
12514    sharpen?: number;
12515    /**
12516     * Radius of a blur filter (approximate gaussian). Maximum supported radius
12517     * is 250.
12518     */
12519    blur?: number;
12520    /**
12521     * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12522     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12523     * ignored.
12524     */
12525    contrast?: number;
12526    /**
12527     * Increase brightness by a factor. A value of 1.0 equals no change, a value
12528     * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12529     * 0 is ignored.
12530     */
12531    brightness?: number;
12532    /**
12533     * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12534     * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12535     */
12536    gamma?: number;
12537    /**
12538     * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12539     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12540     * ignored.
12541     */
12542    saturation?: number;
12543    /**
12544     * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12545     * easier to specify higher-DPI sizes in <img srcset>.
12546     */
12547    dpr?: number;
12548    /**
12549     * Adds a border around the image. The border is added after resizing. Border
12550     * width takes dpr into account, and can be specified either using a single
12551     * width property, or individually for each side.
12552     */
12553    border?: {
12554        color: string;
12555        width: number;
12556    } | {
12557        color: string;
12558        top: number;
12559        right: number;
12560        bottom: number;
12561        left: number;
12562    };
12563    /**
12564     * Image segmentation using artificial intelligence models. Sets pixels not
12565     * within selected segment area to transparent e.g "foreground" sets every
12566     * background pixel as transparent.
12567     */
12568    segment?: "foreground";
12569    /**
12570     * Controls the algorithm used when an image needs to be enlarged. This
12571     * parameter works with any fit mode that upscales, such as `contain`,
12572     * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
12573     * the target dimensions are smaller than the source.
12574     * - interpolate: Uses bicubic interpolation, which may reduce image quality.
12575     *   This is the default behavior when `upscale` is not specified.
12576     * - generate: Uses AI upscaling to produce sharper, more detailed results
12577     *   when enlarging images.
12578     */
12579    upscale?: "interpolate" | "generate";
12580}
12581interface BasicImageTransformationsGravityCoordinates {
12582    x?: number;
12583    y?: number;
12584    mode?: 'remainder' | 'box-center';
12585}
12586interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12587    /**
12588     * Absolute URL of the image file to use for the drawing. It can be any of
12589     * the supported file formats. For drawing of watermarks or non-rectangular
12590     * overlays we recommend using PNG or WebP images.
12591     */
12592    url: string;
12593    /**
12594     * Floating-point number between 0 (transparent) and 1 (opaque).
12595     * For example, opacity: 0.5 makes overlay semitransparent.
12596     */
12597    opacity?: number;
12598    /**
12599     * - If set to true, the overlay image will be tiled to cover the entire
12600     *   area. This is useful for stock-photo-like watermarks.
12601     * - If set to "x", the overlay image will be tiled horizontally only
12602     *   (form a line).
12603     * - If set to "y", the overlay image will be tiled vertically only
12604     *   (form a line).
12605     */
12606    repeat?: true | "x" | "y";
12607    /**
12608     * How to combine the foreground and backdrop pixels to create the result
12609     */
12610    composite?: 
12611    /** Foreground drawn on top of backdrop (default) */
12612    'over'
12613    /** Foreground shown only where backdrop is opaque */
12614     | 'in'
12615    /** Foreground drawn on top, but clipped to the backdrop's shape */
12616     | 'atop'
12617    /** Foreground shown only where backdrop is transparent */
12618     | 'out'
12619    /** Foreground and backdrop visible only where the other is not */
12620     | 'xor'
12621    /** Foreground and backdrop channels added (brightening) */
12622     | 'lighter';
12623    /**
12624     * Position of the overlay image relative to a given edge. Each property is
12625     * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
12626     * positions left side of the overlay 10 pixels from the left edge of the
12627     * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
12628     * of the background image.
12629     *
12630     * Setting both left & right, or both top & bottom is an error.
12631     *
12632     * If no position is specified, the image will be centered.
12633     */
12634    top?: number;
12635    left?: number;
12636    bottom?: number;
12637    right?: number;
12638}
12639interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12640    /**
12641     * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
12642     * make images look worse, but load faster. The default is 85. It applies only
12643     * to JPEG and WebP images. It doesn’t have any effect on PNG.
12644     */
12645    quality?: number | "low" | "medium-low" | "medium-high" | "high";
12646    /**
12647     * Output format to generate. It can be:
12648     *  - avif: generate images in AVIF format.
12649     *  - webp: generate images in Google WebP format. Set quality to 100 to get
12650     *    the WebP-lossless format.
12651     *  - json: instead of generating an image, outputs information about the
12652     *    image, in JSON format. The JSON object will contain image size
12653     *    (before and after resizing), source image’s MIME type, file size, etc.
12654     * - jpeg: generate images in JPEG format.
12655     * - png: generate images in PNG format.
12656     */
12657    format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg";
12658    /**
12659     * Whether to preserve animation frames from input files. Default is true.
12660     * Setting it to false reduces animations to still images. This setting is
12661     * recommended when enlarging images or processing arbitrary user content,
12662     * because large GIF animations can weigh tens or even hundreds of megabytes.
12663     * It is also useful to set anim:false when using format:"json" to get the
12664     * response quicker without the number of frames.
12665     */
12666    anim?: boolean;
12667    /**
12668     * What EXIF data should be preserved in the output image. Note that EXIF
12669     * rotation and embedded color profiles are always applied ("baked in" into
12670     * the image), and aren't affected by this option. Note that if the Polish
12671     * feature is enabled, all metadata may have been removed already and this
12672     * option may have no effect.
12673     *  - keep: Preserve most of EXIF metadata, including GPS location if there's
12674     *    any.
12675     *  - copyright: Only keep the copyright tag, and discard everything else.
12676     *    This is the default behavior for JPEG files.
12677     *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG
12678     *    output formats always discard metadata.
12679     */
12680    metadata?: "keep" | "copyright" | "none";
12681    /**
12682     * Overlays are drawn in the order they appear in the array (last array
12683     * entry is the topmost layer).
12684     */
12685    draw?: RequestInitCfPropertiesImageDraw[];
12686    /**
12687     * Fetching image from authenticated origin. Setting this property will
12688     * pass authentication headers (Authorization, Cookie, etc.) through to
12689     * the origin.
12690     */
12691    "origin-auth"?: "share-publicly";
12692    /**
12693     * Slightly reduces latency on a cache miss by selecting a
12694     * quickest-to-compress file format, at a cost of increased file size and
12695     * lower image quality. It will usually override the format option and choose
12696     * JPEG over WebP or AVIF. We do not recommend using this option, except in
12697     * unusual circumstances like resizing uncacheable dynamically-generated
12698     * images.
12699     */
12700    compression?: "fast";
12701}
12702interface RequestInitCfPropertiesImageMinify {
12703    javascript?: boolean;
12704    css?: boolean;
12705    html?: boolean;
12706}
12707interface RequestInitCfPropertiesR2 {
12708    /**
12709     * Colo id of bucket that an object is stored in
12710     */
12711    bucketColoId?: number;
12712}
12713/**
12714 * Request metadata provided by Cloudflare's edge.
12715 */
12716type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
12717interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {
12718    /**
12719     * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
12720     *
12721     * @example 395747
12722     */
12723    asn?: number;
12724    /**
12725     * The organization which owns the ASN of the incoming request.
12726     *
12727     * @example "Google Cloud"
12728     */
12729    asOrganization?: string;
12730    /**
12731     * The original value of the `Accept-Encoding` header if Cloudflare modified it.
12732     *
12733     * @example "gzip, deflate, br"
12734     */
12735    clientAcceptEncoding?: string;
12736    /**
12737     * The number of milliseconds it took for the request to reach your worker.
12738     *
12739     * @example 22
12740     */
12741    clientTcpRtt?: number;
12742    /**
12743     * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)
12744     * airport code of the data center that the request hit.
12745     *
12746     * @example "DFW"
12747     */
12748    colo: string;
12749    /**
12750     * Represents the upstream's response to a
12751     * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)
12752     * from cloudflare.
12753     *
12754     * For workers with no upstream, this will always be `1`.
12755     *
12756     * @example 3
12757     */
12758    edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;
12759    /**
12760     * The HTTP Protocol the request used.
12761     *
12762     * @example "HTTP/2"
12763     */
12764    httpProtocol: string;
12765    /**
12766     * The browser-requested prioritization information in the request object.
12767     *
12768     * If no information was set, defaults to the empty string `""`
12769     *
12770     * @example "weight=192;exclusive=0;group=3;group-weight=127"
12771     * @default ""
12772     */
12773    requestPriority: string;
12774    /**
12775     * The TLS version of the connection to Cloudflare.
12776     * In requests served over plaintext (without TLS), this property is the empty string `""`.
12777     *
12778     * @example "TLSv1.3"
12779     */
12780    tlsVersion: string;
12781    /**
12782     * The cipher for the connection to Cloudflare.
12783     * In requests served over plaintext (without TLS), this property is the empty string `""`.
12784     *
12785     * @example "AEAD-AES128-GCM-SHA256"
12786     */
12787    tlsCipher: string;
12788    /**
12789     * 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.
12790     *
12791     * If the incoming request was served over plaintext (without TLS) this field is undefined.
12792     */
12793    tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
12794}
12795interface IncomingRequestCfPropertiesBotManagementBase {
12796    /**
12797     * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
12798     * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
12799     *
12800     * @example 54
12801     */
12802    score: number;
12803    /**
12804     * A boolean value that is true if the request comes from a good bot, like Google or Bing.
12805     * 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).
12806     */
12807    verifiedBot: boolean;
12808    /**
12809     * A boolean value that is true if the request originates from a
12810     * Cloudflare-verified proxy service.
12811     */
12812    corporateProxy: boolean;
12813    /**
12814     * 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.
12815     */
12816    staticResource: boolean;
12817    /**
12818     * 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).
12819     */
12820    detectionIds: number[];
12821}
12822interface IncomingRequestCfPropertiesBotManagement {
12823    /**
12824     * Results of Cloudflare's Bot Management analysis
12825     */
12826    botManagement: IncomingRequestCfPropertiesBotManagementBase;
12827    /**
12828     * Duplicate of `botManagement.score`.
12829     *
12830     * @deprecated
12831     */
12832    clientTrustScore: number;
12833}
12834interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {
12835    /**
12836     * Results of Cloudflare's Bot Management analysis
12837     */
12838    botManagement: IncomingRequestCfPropertiesBotManagementBase & {
12839        /**
12840         * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients
12841         * across different destination IPs, Ports, and X509 certificates.
12842         */
12843        ja3Hash: string;
12844    };
12845}
12846interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {
12847    /**
12848     * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
12849     *
12850     * This field is only present if you have Cloudflare for SaaS enabled on your account
12851     * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).
12852     */
12853    hostMetadata?: HostMetadata;
12854}
12855interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
12856    /**
12857     * Information about the client certificate presented to Cloudflare.
12858     *
12859     * This is populated when the incoming request is served over TLS using
12860     * either Cloudflare Access or API Shield (mTLS)
12861     * and the presented SSL certificate has a valid
12862     * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)
12863     * (i.e., not `null` or `""`).
12864     *
12865     * Otherwise, a set of placeholder values are used.
12866     *
12867     * The property `certPresented` will be set to `"1"` when
12868     * the object is populated (i.e. the above conditions were met).
12869     */
12870    tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
12871}
12872/**
12873 * Metadata about the request's TLS handshake
12874 */
12875interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
12876    /**
12877     * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
12878     *
12879     * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
12880     */
12881    clientHandshake: string;
12882    /**
12883     * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
12884     *
12885     * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
12886     */
12887    serverHandshake: string;
12888    /**
12889     * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
12890     *
12891     * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
12892     */
12893    clientFinished: string;
12894    /**
12895     * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
12896     *
12897     * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
12898     */
12899    serverFinished: string;
12900}
12901/**
12902 * Geographic data about the request's origin.
12903 */
12904interface IncomingRequestCfPropertiesGeographicInformation {
12905    /**
12906     * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
12907     *
12908     * 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.
12909     *
12910     * If Cloudflare is unable to determine where the request originated this property is omitted.
12911     *
12912     * The country code `"T1"` is used for requests originating on TOR.
12913     *
12914     * @example "GB"
12915     */
12916    country?: Iso3166Alpha2Code | "T1";
12917    /**
12918     * If present, this property indicates that the request originated in the EU
12919     *
12920     * @example "1"
12921     */
12922    isEUCountry?: "1";
12923    /**
12924     * A two-letter code indicating the continent the request originated from.
12925     *
12926     * @example "AN"
12927     */
12928    continent?: ContinentCode;
12929    /**
12930     * The city the request originated from
12931     *
12932     * @example "Austin"
12933     */
12934    city?: string;
12935    /**
12936     * Postal code of the incoming request
12937     *
12938     * @example "78701"
12939     */
12940    postalCode?: string;
12941    /**
12942     * Latitude of the incoming request
12943     *
12944     * @example "30.27130"
12945     */
12946    latitude?: string;
12947    /**
12948     * Longitude of the incoming request
12949     *
12950     * @example "-97.74260"
12951     */
12952    longitude?: string;
12953    /**
12954     * Timezone of the incoming request
12955     *
12956     * @example "America/Chicago"
12957     */
12958    timezone?: string;
12959    /**
12960     * If known, the ISO 3166-2 name for the first level region associated with
12961     * the IP address of the incoming request
12962     *
12963     * @example "Texas"
12964     */
12965    region?: string;
12966    /**
12967     * If known, the ISO 3166-2 code for the first-level region associated with
12968     * the IP address of the incoming request
12969     *
12970     * @example "TX"
12971     */
12972    regionCode?: string;
12973    /**
12974     * Metro code (DMA) of the incoming request
12975     *
12976     * @example "635"
12977     */
12978    metroCode?: string;
12979}
12980/** Data about the incoming request's TLS certificate */
12981interface IncomingRequestCfPropertiesTLSClientAuth {
12982    /** Always `"1"`, indicating that the certificate was presented */
12983    certPresented: "1";
12984    /**
12985     * Result of certificate verification.
12986     *
12987     * @example "FAILED:self signed certificate"
12988     */
12989    certVerified: Exclude<CertVerificationStatus, "NONE">;
12990    /** The presented certificate's revokation status.
12991     *
12992     * - A value of `"1"` indicates the certificate has been revoked
12993     * - A value of `"0"` indicates the certificate has not been revoked
12994     */
12995    certRevoked: "1" | "0";
12996    /**
12997     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
12998     *
12999     * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
13000     */
13001    certIssuerDN: string;
13002    /**
13003     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
13004     *
13005     * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
13006     */
13007    certSubjectDN: string;
13008    /**
13009     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
13010     *
13011     * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
13012     */
13013    certIssuerDNRFC2253: string;
13014    /**
13015     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
13016     *
13017     * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
13018     */
13019    certSubjectDNRFC2253: string;
13020    /** The certificate issuer's distinguished name (legacy policies) */
13021    certIssuerDNLegacy: string;
13022    /** The certificate subject's distinguished name (legacy policies) */
13023    certSubjectDNLegacy: string;
13024    /**
13025     * The certificate's serial number
13026     *
13027     * @example "00936EACBE07F201DF"
13028     */
13029    certSerial: string;
13030    /**
13031     * The certificate issuer's serial number
13032     *
13033     * @example "2489002934BDFEA34"
13034     */
13035    certIssuerSerial: string;
13036    /**
13037     * The certificate's Subject Key Identifier
13038     *
13039     * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
13040     */
13041    certSKI: string;
13042    /**
13043     * The certificate issuer's Subject Key Identifier
13044     *
13045     * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
13046     */
13047    certIssuerSKI: string;
13048    /**
13049     * The certificate's SHA-1 fingerprint
13050     *
13051     * @example "6b9109f323999e52259cda7373ff0b4d26bd232e"
13052     */
13053    certFingerprintSHA1: string;
13054    /**
13055     * The certificate's SHA-256 fingerprint
13056     *
13057     * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"
13058     */
13059    certFingerprintSHA256: string;
13060    /**
13061     * The effective starting date of the certificate
13062     *
13063     * @example "Dec 22 19:39:00 2018 GMT"
13064     */
13065    certNotBefore: string;
13066    /**
13067     * The effective expiration date of the certificate
13068     *
13069     * @example "Dec 22 19:39:00 2018 GMT"
13070     */
13071    certNotAfter: string;
13072    /**
13073     * The client leaf certificate in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
13074     * format (`:base64-DER:`). Empty if no client certificate was presented or if
13075     * the leaf certificate exceeded 10 KB (see {@link certRFC9440TooLarge}).
13076     *
13077     * Suitable for forwarding to an origin via the `Client-Cert` HTTP header.
13078     */
13079    certRFC9440: string;
13080    /**
13081     * `true` if the leaf certificate exceeded 10 KB and was omitted from
13082     * {@link certRFC9440}.
13083     */
13084    certRFC9440TooLarge: boolean;
13085    /**
13086     * The intermediate certificate chain in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
13087     * format as a comma-separated list. Empty if no intermediates were sent or
13088     * if the chain exceeded 16 KB (see {@link certChainRFC9440TooLarge}).
13089     *
13090     * Suitable for forwarding to an origin via the `Client-Cert-Chain` HTTP header.
13091     */
13092    certChainRFC9440: string;
13093    /**
13094     * `true` if the intermediate chain exceeded 16 KB and was omitted from
13095     * {@link certChainRFC9440}.
13096     */
13097    certChainRFC9440TooLarge: boolean;
13098}
13099/** Placeholder values for TLS Client Authorization */
13100interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
13101    certPresented: "0";
13102    certVerified: "NONE";
13103    certRevoked: "0";
13104    certIssuerDN: "";
13105    certSubjectDN: "";
13106    certIssuerDNRFC2253: "";
13107    certSubjectDNRFC2253: "";
13108    certIssuerDNLegacy: "";
13109    certSubjectDNLegacy: "";
13110    certSerial: "";
13111    certIssuerSerial: "";
13112    certSKI: "";
13113    certIssuerSKI: "";
13114    certFingerprintSHA1: "";
13115    certFingerprintSHA256: "";
13116    certNotBefore: "";
13117    certNotAfter: "";
13118    certRFC9440: "";
13119    certRFC9440TooLarge: false;
13120    certChainRFC9440: "";
13121    certChainRFC9440TooLarge: false;
13122}
13123/** Possible outcomes of TLS verification */
13124declare type CertVerificationStatus = 
13125/** Authentication succeeded */
13126"SUCCESS"
13127/** No certificate was presented */
13128 | "NONE"
13129/** Failed because the certificate was self-signed */
13130 | "FAILED:self signed certificate"
13131/** Failed because the certificate failed a trust chain check */
13132 | "FAILED:unable to verify the first certificate"
13133/** Failed because the certificate not yet valid */
13134 | "FAILED:certificate is not yet valid"
13135/** Failed because the certificate is expired */
13136 | "FAILED:certificate has expired"
13137/** Failed for another unspecified reason */
13138 | "FAILED";
13139/**
13140 * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
13141 */
13142declare 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 */
13143/** ISO 3166-1 Alpha-2 codes */
13144declare 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";
13145/** The 2-letter continent codes Cloudflare uses */
13146declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
13147type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;
13148interface D1Meta {
13149    duration: number;
13150    size_after: number;
13151    rows_read: number;
13152    rows_written: number;
13153    last_row_id: number;
13154    changed_db: boolean;
13155    changes: number;
13156    /**
13157     * The region of the database instance that executed the query.
13158     */
13159    served_by_region?: string;
13160    /**
13161     * The three letters airport code of the colo that executed the query.
13162     */
13163    served_by_colo?: string;
13164    /**
13165     * True if-and-only-if the database instance that executed the query was the primary.
13166     */
13167    served_by_primary?: boolean;
13168    timings?: {
13169        /**
13170         * The duration of the SQL query execution by the database instance. It doesn't include any network time.
13171         */
13172        sql_duration_ms: number;
13173    };
13174    /**
13175     * Number of total attempts to execute the query, due to automatic retries.
13176     * Note: All other fields in the response like `timings` only apply to the last attempt.
13177     */
13178    total_attempts?: number;
13179}
13180interface D1Response {
13181    success: true;
13182    meta: D1Meta & Record<string, unknown>;
13183    error?: never;
13184}
13185type D1Result<T = unknown> = D1Response & {
13186    results: T[];
13187};
13188interface D1ExecResult {
13189    count: number;
13190    duration: number;
13191}
13192type D1SessionConstraint = 
13193// Indicates that the first query should go to the primary, and the rest queries
13194// using the same D1DatabaseSession will go to any replica that is consistent with
13195// the bookmark maintained by the session (returned by the first query).
13196'first-primary'
13197// Indicates that the first query can go anywhere (primary or replica), and the rest queries
13198// using the same D1DatabaseSession will go to any replica that is consistent with
13199// the bookmark maintained by the session (returned by the first query).
13200 | 'first-unconstrained';
13201type D1SessionBookmark = string;
13202declare abstract class D1Database {
13203    prepare(query: string): D1PreparedStatement;
13204    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
13205    exec(query: string): Promise<D1ExecResult>;
13206    /**
13207     * Creates a new D1 Session anchored at the given constraint or the bookmark.
13208     * All queries executed using the created session will have sequential consistency,
13209     * meaning that all writes done through the session will be visible in subsequent reads.
13210     *
13211     * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.
13212     */
13213    withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;
13214    /**
13215     * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.
13216     */
13217    dump(): Promise<ArrayBuffer>;
13218}
13219declare abstract class D1DatabaseSession {
13220    prepare(query: string): D1PreparedStatement;
13221    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
13222    /**
13223     * @returns The latest session bookmark across all executed queries on the session.
13224     *          If no query has been executed yet, `null` is returned.
13225     */
13226    getBookmark(): D1SessionBookmark | null;
13227}
13228declare abstract class D1PreparedStatement {
13229    bind(...values: unknown[]): D1PreparedStatement;
13230    first<T = unknown>(colName: string): Promise<T | null>;
13231    first<T = Record<string, unknown>>(): Promise<T | null>;
13232    run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
13233    all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
13234    raw<T = unknown[]>(options: {
13235        columnNames: true;
13236    }): Promise<[
13237        string[],
13238        ...T[]
13239    ]>;
13240    raw<T = unknown[]>(options?: {
13241        columnNames?: false;
13242    }): Promise<T[]>;
13243}
13244// `Disposable` was added to TypeScript's standard lib types in version 5.2.
13245// To support older TypeScript versions, define an empty `Disposable` interface.
13246// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
13247// but this will ensure type checking on older versions still passes.
13248// TypeScript's interface merging will ensure our empty interface is effectively
13249// ignored when `Disposable` is included in the standard lib.
13250interface Disposable {
13251}
13252declare module 'cloudflare:durable-objects' {
13253    /**
13254     * Marks a Durable Object method as safe to run more than once. The runtime may then retry calls
13255     * to it after a disconnect that might have happened after the method started. It does not
13256     * enable retries or change how many are made.
13257     *
13258     * Each attempt creates its own return value, so if the method returns an `RpcTarget`, its
13259     * `[Symbol.dispose]()` may run once per attempt.
13260     *
13261     * Only public instance methods can be decorated. When composing decorators, apply `@retryable`
13262     * outermost (first in source order) so it marks the method that is finally installed.
13263     * Otherwise `@retryable` has no effect, and constructing the object logs a warning.
13264     * Requires standard (not `experimentalDecorators`) decorators and a bundler that transforms
13265     * them, such as Wrangler.
13266     */
13267    export function retryable<This, Args extends unknown[], Return>(value: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>): (this: This, ...args: Args) => Return;
13268}
13269/**
13270 * The returned data after sending an email
13271 */
13272interface EmailSendResult {
13273    /**
13274     * The Email Message ID
13275     */
13276    messageId: string;
13277}
13278/**
13279 * An email message that can be sent from a Worker.
13280 */
13281interface EmailMessage {
13282    /**
13283     * Envelope From attribute of the email message.
13284     */
13285    readonly from: string;
13286    /**
13287     * Envelope To attribute of the email message.
13288     */
13289    readonly to: string;
13290}
13291/**
13292 * An email message that is sent to a consumer Worker and can be rejected/forwarded.
13293 */
13294interface ForwardableEmailMessage extends EmailMessage {
13295    /**
13296     * Stream of the email message content.
13297     */
13298    readonly raw: ReadableStream<Uint8Array>;
13299    /**
13300     * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
13301     */
13302    readonly headers: Headers;
13303    /**
13304     * Size of the email message content.
13305     */
13306    readonly rawSize: number;
13307    /**
13308     * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
13309     * @param reason The reject reason.
13310     * @returns void
13311     */
13312    setReject(reason: string): void;
13313    /**
13314     * Forward this email message to a verified destination address of the account.
13315     * @param rcptTo Verified destination address.
13316     * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
13317     * @returns A promise that resolves when the email message is forwarded.
13318     */
13319    forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;
13320    /**
13321     * Reply to the sender of this email message with a new EmailMessage object.
13322     * @param message The reply message.
13323     * @returns A promise that resolves when the email message is replied.
13324     */
13325    reply(message: EmailMessage): Promise<EmailSendResult>;
13326    /**
13327     * Reply to the sender of this email message with a message built from the given
13328     * fields. Threading headers (In-Reply-To/References) are set automatically.
13329     * @param builder The reply message contents.
13330     * @returns A promise that resolves when the email message is replied.
13331     */
13332    reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
13333}
13334/** A file attachment for an email message */
13335type EmailAttachment = {
13336    disposition: 'inline';
13337    contentId: string;
13338    filename: string;
13339    type: string;
13340    content: string | ArrayBuffer | ArrayBufferView;
13341} | {
13342    disposition: 'attachment';
13343    contentId?: undefined;
13344    filename: string;
13345    type: string;
13346    content: string | ArrayBuffer | ArrayBufferView;
13347};
13348/** An Email Address */
13349interface EmailAddress {
13350    name: string;
13351    email: string;
13352}
13353/**
13354 * Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
13355 * `bcc` must be provided.
13356 */
13357type EmailDestinations = {
13358    to?: string | EmailAddress | (string | EmailAddress)[];
13359    cc?: string | EmailAddress | (string | EmailAddress)[];
13360    bcc?: string | EmailAddress | (string | EmailAddress)[];
13361} & ({
13362    to: string | EmailAddress | (string | EmailAddress)[];
13363} | {
13364    cc: string | EmailAddress | (string | EmailAddress)[];
13365} | {
13366    bcc: string | EmailAddress | (string | EmailAddress)[];
13367});
13368/**
13369 * Fields shared by all composed emails (no recipients). Used directly by
13370 * `ForwardableEmailMessage.reply()`, which always replies to the original
13371 * sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
13372 */
13373interface EmailReplyMessageBuilder {
13374    from: string | EmailAddress;
13375    subject: string;
13376    replyTo?: string | EmailAddress;
13377    headers?: Record<string, string>;
13378    text?: string;
13379    html?: string;
13380    attachments?: EmailAttachment[];
13381}
13382/**
13383 * Fields for composing an email without constructing raw MIME, for
13384 * `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
13385 */
13386type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
13387/**
13388 * A binding that allows a Worker to send email messages.
13389 */
13390interface SendEmail {
13391    send(message: EmailMessage): Promise<EmailSendResult>;
13392    send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
13393}
13394declare abstract class EmailEvent extends ExtendableEvent {
13395    readonly message: ForwardableEmailMessage;
13396}
13397declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
13398declare module "cloudflare:email" {
13399    let _EmailMessage: {
13400        prototype: EmailMessage;
13401        new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
13402    };
13403    export { _EmailMessage as EmailMessage };
13404}
13405/**
13406 * Evaluation context for targeting rules.
13407 * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
13408 */
13409type FlagshipEvaluationContext = Record<string, string | number | boolean>;
13410interface FlagshipEvaluationDetails<T> {
13411    flagKey: string;
13412    value: T;
13413    variant?: string | undefined;
13414    reason?: string | undefined;
13415    errorCode?: string | undefined;
13416    errorMessage?: string | undefined;
13417}
13418interface FlagshipEvaluationError extends Error {
13419}
13420/**
13421 * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
13422 *
13423 * @example
13424 * ```typescript
13425 * // Get a boolean flag value with a default
13426 * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
13427 *
13428 * // Get a flag value with evaluation context for targeting
13429 * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
13430 *   userId: 'user-123',
13431 *   country: 'US',
13432 * });
13433 *
13434 * // Get full evaluation details including variant and reason
13435 * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
13436 * console.log(details.variant, details.reason);
13437 * ```
13438 */
13439declare abstract class Flagship {
13440    /**
13441     * Get a flag value without type checking.
13442     * @param flagKey The key of the flag to evaluate.
13443     * @param defaultValue Optional default value returned when evaluation fails.
13444     * @param context Optional evaluation context for targeting rules.
13445     */
13446    get(flagKey: string, defaultValue?: unknown, context?: FlagshipEvaluationContext): Promise<unknown>;
13447    /**
13448     * Get a boolean flag value.
13449     * @param flagKey The key of the flag to evaluate.
13450     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13451     * @param context Optional evaluation context for targeting rules.
13452     */
13453    getBooleanValue(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<boolean>;
13454    /**
13455     * Get a string flag value.
13456     * @param flagKey The key of the flag to evaluate.
13457     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13458     * @param context Optional evaluation context for targeting rules.
13459     */
13460    getStringValue(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<string>;
13461    /**
13462     * Get a number flag value.
13463     * @param flagKey The key of the flag to evaluate.
13464     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13465     * @param context Optional evaluation context for targeting rules.
13466     */
13467    getNumberValue(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<number>;
13468    /**
13469     * Get an object flag value.
13470     * @param flagKey The key of the flag to evaluate.
13471     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13472     * @param context Optional evaluation context for targeting rules.
13473     */
13474    getObjectValue<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<T>;
13475    /**
13476     * Get a boolean flag value with full evaluation details.
13477     * @param flagKey The key of the flag to evaluate.
13478     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13479     * @param context Optional evaluation context for targeting rules.
13480     */
13481    getBooleanDetails(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<boolean>>;
13482    /**
13483     * Get a string flag value with full evaluation details.
13484     * @param flagKey The key of the flag to evaluate.
13485     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13486     * @param context Optional evaluation context for targeting rules.
13487     */
13488    getStringDetails(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<string>>;
13489    /**
13490     * Get a number flag value with full evaluation details.
13491     * @param flagKey The key of the flag to evaluate.
13492     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13493     * @param context Optional evaluation context for targeting rules.
13494     */
13495    getNumberDetails(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<number>>;
13496    /**
13497     * Get an object flag value with full evaluation details.
13498     * @param flagKey The key of the flag to evaluate.
13499     * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
13500     * @param context Optional evaluation context for targeting rules.
13501     */
13502    getObjectDetails<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<T>>;
13503}
13504/**
13505 * Hello World binding to serve as an explanatory example. DO NOT USE
13506 */
13507interface HelloWorldBinding {
13508    /**
13509     * Retrieve the current stored value
13510     */
13511    get(): Promise<{
13512        value: string;
13513        ms?: number;
13514    }>;
13515    /**
13516     * Set a new stored value
13517     */
13518    set(value: string): Promise<void>;
13519}
13520interface Hyperdrive {
13521    /**
13522     * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
13523     *
13524     * Calling this method returns an identical socket to if you call
13525     * `connect("host:port")` using the `host` and `port` fields from this object.
13526     * Pick whichever approach works better with your preferred DB client library.
13527     *
13528     * Note that this socket is not yet authenticated -- it's expected that your
13529     * code (or preferably, the client library of your choice) will authenticate
13530     * using the information in this class's readonly fields.
13531     */
13532    connect(): Socket;
13533    /**
13534     * A valid DB connection string that can be passed straight into the typical
13535     * client library/driver/ORM. This will typically be the easiest way to use
13536     * Hyperdrive.
13537     */
13538    readonly connectionString: string;
13539    /*
13540     * A randomly generated hostname that is only valid within the context of the
13541     * currently running Worker which, when passed into `connect()` function from
13542     * the "cloudflare:sockets" module, will connect to the Hyperdrive instance
13543     * for your database.
13544     */
13545    readonly host: string;
13546    /*
13547     * A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the
13548     * host field, is only valid within the context of the currently running
13549     * Worker and, when passed into the `connect()` function from the
13550     * "cloudflare:sockets" module, will connect to the Hyperdrive instance for
13551     * your database. This is provided for database drivers that require the host
13552     * to be an IP literal rather than a hostname.
13553     */
13554    readonly ip: string;
13555    /*
13556     * The port that must be paired the the host field when connecting.
13557     */
13558    readonly port: number;
13559    /*
13560     * The username to use when authenticating to your database via Hyperdrive.
13561     * Unlike the host and password, this will be the same every time
13562     */
13563    readonly user: string;
13564    /*
13565     * The randomly generated password to use when authenticating to your
13566     * database via Hyperdrive. Like the host field, this password is only valid
13567     * within the context of the currently running Worker instance from which
13568     * it's read.
13569     */
13570    readonly password: string;
13571    /*
13572     * The name of the database to connect to.
13573     */
13574    readonly database: string;
13575}
13576/**
13577 * A handle to a dynamically-provisioned Hyperdrive connection, returned by
13578 * `HyperdriveApi.get()`.
13579 */
13580interface HyperdriveDynamic extends Disposable {
13581    /**
13582     * The database name to use when connecting through this Hyperdrive.
13583     */
13584    readonly database: Promise<string>;
13585    /*
13586     * The randomly generated user to use when authenticating to your
13587     * database via Hyperdrive.
13588     */
13589    readonly user: Promise<string>;
13590    /*
13591     * The randomly generated password to use when authenticating to your
13592     * database via Hyperdrive.
13593     */
13594    readonly password: Promise<string>;
13595    /**
13596     * Open a TCP socket to the target database through this Hyperdrive.
13597     *
13598     */
13599    connect(): Promise<Socket>;
13600}
13601/**
13602 * Binding that provisions Hyperdrive connections at request time, rather than
13603 * from static configuration.
13604 */
13605interface HyperdriveDynamicApi {
13606    /**
13607     * Provision a connection for the database described by `args`.
13608     *
13609     */
13610    get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;
13611    /**
13612     * Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
13613     */
13614    getHyperdriveConnectionString(connectionString: string): Promise<string>;
13615}
13616/**
13617 * Parameters identifying the database that a dynamically-provisioned
13618 * Hyperdrive connection should target.
13619 */
13620interface HyperdriveDynamicConfig {
13621    /**
13622     * Generated connection string to pass into the dynamic worker.
13623     *
13624     */
13625    dynamicHyperdriveConnectionString: string;
13626    /**
13627     * Connection string for the origin database Hyperdrive should connect to.
13628     * Contains credentials, so treat it as a secret.
13629     *
13630     * The scheme selects the database engine. PostgreSQL origins are supported.
13631     */
13632    connectionString: string;
13633    /**
13634     * Region in which to place the connection pool. See the Hyperdrive
13635     * documentation for the set of supported regions.
13636     */
13637    targetRegion: string;
13638    /**
13639     * Whether Hyperdrive should cache query results for this connection.
13640     */
13641    cachingEnabled?: boolean;
13642    /**
13643     * Maximum number of connections the pool may open to the origin database.
13644     * Defaults to 60.
13645     */
13646    maxConnections?: number;
13647}
13648// Copyright (c) 2024 Cloudflare, Inc.
13649// Licensed under the Apache 2.0 license found in the LICENSE file or at:
13650//     https://opensource.org/licenses/Apache-2.0
13651type ImageInfoResponse = {
13652    format: 'image/svg+xml';
13653} | {
13654    format: string;
13655    fileSize: number;
13656    width: number;
13657    height: number;
13658};
13659/**
13660 * Parameters for rasterizing text into an image.
13661 */
13662type TextRasterize = {
13663    /** The text content to render */
13664    content: string;
13665    /** rasterization options for the text **/
13666    options: TextOptions;
13667};
13668type TextOptions = {
13669    /** Font configuration */
13670    font: {
13671        /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */
13672        url: string;
13673    };
13674    /** Font size in points (pt) */
13675    size?: number;
13676    /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */
13677    color?: string;
13678};
13679type ImageSource = ReadableStream<Uint8Array> | TextRasterize;
13680type ImageTransform = {
13681    width?: number;
13682    height?: number;
13683    background?: string;
13684    blur?: number;
13685    border?: {
13686        color?: string;
13687        width?: number;
13688    } | {
13689        top?: number;
13690        bottom?: number;
13691        left?: number;
13692        right?: number;
13693    };
13694    brightness?: number;
13695    contrast?: number;
13696    fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';
13697    flip?: 'h' | 'v' | 'hv';
13698    gamma?: number;
13699    segment?: 'foreground';
13700    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {
13701        x?: number;
13702        y?: number;
13703        mode: 'remainder' | 'box-center';
13704    };
13705    rotate?: 0 | 90 | 180 | 270;
13706    saturation?: number;
13707    sharpen?: number;
13708    trim?: 'border' | {
13709        top?: number;
13710        bottom?: number;
13711        left?: number;
13712        right?: number;
13713        width?: number;
13714        height?: number;
13715        border?: boolean | {
13716            color?: string;
13717            tolerance?: number;
13718            keep?: number;
13719        };
13720    };
13721};
13722type ImageDrawOptions = {
13723    opacity?: number;
13724    repeat?: boolean | string;
13725    composite?: ImageCompositeMode;
13726    top?: number;
13727    left?: number;
13728    bottom?: number;
13729    right?: number;
13730};
13731type ImageCompositeMode = 
13732/** Foreground drawn on top of backdrop (default) */
13733'over'
13734/** Foreground shown only where backdrop is opaque */
13735 | 'in'
13736/** Foreground drawn on top, but clipped to the backdrop's shape */
13737 | 'atop'
13738/** Foreground shown only where backdrop is transparent */
13739 | 'out'
13740/** Foreground and backdrop visible only where the other is not */
13741 | 'xor'
13742/** Foreground and backdrop channels added (brightening) */
13743 | 'lighter';
13744type ImageInputOptions = {
13745    encoding?: 'base64';
13746};
13747type ImageOutputOptions = {
13748    format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';
13749    quality?: number;
13750    background?: string;
13751    anim?: boolean;
13752};
13753interface ImageMetadata {
13754    id: string;
13755    filename?: string;
13756    uploaded?: string;
13757    requireSignedURLs: boolean;
13758    meta?: Record<string, unknown>;
13759    variants: string[];
13760    draft?: boolean;
13761    creator?: string;
13762}
13763interface ImageUploadOptions {
13764    id?: string;
13765    filename?: string;
13766    requireSignedURLs?: boolean;
13767    metadata?: Record<string, unknown>;
13768    creator?: string;
13769    /**
13770     * If 'base64', the input data will be decoded from base64 before processing
13771     */
13772    encoding?: 'base64';
13773}
13774interface ImageUpdateOptions {
13775    requireSignedURLs?: boolean;
13776    metadata?: Record<string, unknown>;
13777    creator?: string;
13778}
13779type ImageMetadataFilterOperators = {
13780    eq?: string | number | boolean;
13781    in?: string[] | number[];
13782    gt?: number;
13783    gte?: number;
13784    lt?: number;
13785    lte?: number;
13786};
13787type ImageMetadataFilterValue = string | number | boolean | ImageMetadataFilterOperators;
13788interface ImageListFilter {
13789    metadata?: Record<string, ImageMetadataFilterValue>;
13790}
13791interface ImageListOptions {
13792    limit?: number;
13793    cursor?: string;
13794    sortOrder?: 'asc' | 'desc';
13795    creator?: string;
13796    filter?: ImageListFilter;
13797}
13798interface ImageSignedUrlOptions {
13799    variant: string;
13800    expiresIn?: number;
13801    keyName?: string;
13802}
13803interface ImageDirectUploadOptions {
13804    id?: string;
13805    requireSignedURLs?: boolean;
13806    metadata?: Record<string, unknown>;
13807    creator?: string;
13808    expiresIn?: number;
13809}
13810interface ImageDirectUploadResult {
13811    id: string;
13812    uploadURL: string;
13813}
13814interface ImageList {
13815    images: ImageMetadata[];
13816    cursor?: string;
13817    listComplete: boolean;
13818}
13819interface ImageHandle {
13820    /**
13821     * Get metadata for a hosted image
13822     * @returns Image metadata, or null if not found
13823     */
13824    details(): Promise<ImageMetadata | null>;
13825    /**
13826     * Get the raw image data for a hosted image
13827     * @returns ReadableStream of image bytes, or null if not found
13828     */
13829    bytes(): Promise<ReadableStream<Uint8Array> | null>;
13830    /**
13831     * Generate a signed delivery URL for this hosted image.
13832     * @param options Signing configuration
13833     * @returns A signed image delivery URL
13834     * @throws {@link ImagesError} if signing fails
13835     */
13836    signedUrl(options: ImageSignedUrlOptions): Promise<string>;
13837    /**
13838     * Update hosted image metadata
13839     * @param options Properties to update
13840     * @returns Updated image metadata
13841     * @throws {@link ImagesError} if update fails
13842     */
13843    update(options: ImageUpdateOptions): Promise<ImageMetadata>;
13844    /**
13845     * Delete a hosted image
13846     * @returns True if deleted, false if not found
13847     */
13848    delete(): Promise<boolean>;
13849}
13850interface HostedImagesBinding {
13851    /**
13852     * Get a handle for a hosted image
13853     * @param imageId The ID of the image (UUID or custom ID)
13854     * @returns A handle for per-image operations
13855     */
13856    image(imageId: string): ImageHandle;
13857    /**
13858     * Upload a new hosted image
13859     * @param image The image file to upload
13860     * @param options Upload configuration
13861     * @returns Metadata for the uploaded image
13862     * @throws {@link ImagesError} if upload fails
13863     */
13864    upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;
13865    /**
13866     * List hosted images with pagination
13867     * @param options List configuration
13868     * @returns List of images with pagination info
13869     * @throws {@link ImagesError} if list fails
13870     */
13871    list(options?: ImageListOptions): Promise<ImageList>;
13872    /**
13873     * Create a Direct Creator Upload link, letting an end user upload an
13874     * image straight to Cloudflare without exposing an API token
13875     * @param options Upload link configuration
13876     * @returns The new image ID and the upload URL to hand to the end user
13877     * @throws {@link ImagesError} if creation fails
13878     */
13879    createDirectUpload(options?: ImageDirectUploadOptions): Promise<ImageDirectUploadResult>;
13880}
13881interface ImagesBinding {
13882    /**
13883     * Get image metadata (type, width and height)
13884     * @throws {@link ImagesError} with code 9412 if input is not an image
13885     * @param stream The image bytes
13886     */
13887    info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;
13888    /**
13889     * Begin applying a series of transformations to an image
13890     * @param stream The image bytes
13891     * @returns A transform handle
13892     */
13893    input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;
13894    /**
13895     * Begin applying a series of transformations to text
13896     * @param content string to be rendered
13897     * @param options font, optional color and size to use in rendering text
13898     * @returns A transform handle
13899     */
13900    text(content: string, options: TextOptions): ImageTransformer;
13901    /**
13902     * Access hosted images CRUD operations
13903     */
13904    readonly hosted: HostedImagesBinding;
13905}
13906interface ImageTransformer {
13907    /**
13908     * Apply transform next, returning a transform handle.
13909     * You can then apply more transformations, draw, or retrieve the output.
13910     * @param transform
13911     */
13912    transform(transform: ImageTransform): ImageTransformer;
13913    /**
13914     * Draw an image on this transformer, returning a transform handle.
13915     * You can then apply more transformations, draw, or retrieve the output.
13916     * @param image The image (or transformer that will give the image) to draw
13917     * @param options The options configuring how to draw the image
13918     */
13919    draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;
13920    /**
13921     * Retrieve the image that results from applying the transforms to the
13922     * provided input
13923     * @param options Options that apply to the output e.g. output format
13924     */
13925    output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
13926}
13927type ImageTransformationOutputOptions = {
13928    encoding?: 'base64';
13929};
13930type ImageTransformationResponseOptions = {
13931    headers?: HeadersInit;
13932};
13933interface ImageTransformationResult {
13934    /**
13935     * The image as a response, ready to store in cache or return to users
13936     * @param options Options that apply to the returned response, e.g. additional headers
13937     */
13938    response(options?: ImageTransformationResponseOptions): Response;
13939    /**
13940     * The content type of the returned image
13941     */
13942    contentType(): string;
13943    /**
13944     * The bytes of the response
13945     */
13946    image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;
13947}
13948interface ImagesError extends Error {
13949    readonly code: number;
13950    readonly message: string;
13951    readonly stack?: string;
13952}
13953/**
13954 * Media binding for transforming media streams.
13955 * Provides the entry point for media transformation operations.
13956 */
13957interface MediaBinding {
13958    /**
13959     * Creates a media transformer from an input stream.
13960     * @param media - The input media bytes
13961     * @returns A MediaTransformer instance for applying transformations
13962     */
13963    input(media: ReadableStream<Uint8Array>): MediaTransformer;
13964}
13965/**
13966 * Media transformer for applying transformation operations to media content.
13967 * Handles sizing, fitting, and other input transformation parameters.
13968 */
13969interface MediaTransformer {
13970    /**
13971     * Applies transformation options to the media content.
13972     * @param transform - Configuration for how the media should be transformed
13973     * @returns A generator for producing the transformed media output
13974     */
13975    transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;
13976    /**
13977     * Generates the final media output with specified options.
13978     * @param output - Configuration for the output format and parameters
13979     * @returns The final transformation result containing the transformed media
13980     */
13981    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
13982}
13983/**
13984 * Generator for producing media transformation results.
13985 * Configures the output format and parameters for the transformed media.
13986 */
13987interface MediaTransformationGenerator {
13988    /**
13989     * Generates the final media output with specified options.
13990     * @param output - Configuration for the output format and parameters
13991     * @returns The final transformation result containing the transformed media
13992     */
13993    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
13994}
13995/**
13996 * Result of a media transformation operation.
13997 * Provides multiple ways to access the transformed media content.
13998 */
13999interface MediaTransformationResult {
14000    /**
14001     * Returns the transformed media as a readable stream of bytes.
14002     * @returns A promise containing a readable stream with the transformed media
14003     */
14004    media(): Promise<ReadableStream<Uint8Array>>;
14005    /**
14006     * Returns the transformed media as an HTTP response object.
14007     * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
14008     */
14009    response(): Promise<Response>;
14010    /**
14011     * Returns the MIME type of the transformed media.
14012     * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
14013     */
14014    contentType(): Promise<string>;
14015}
14016/**
14017 * Configuration options for transforming media input.
14018 * Controls how the media should be resized and fitted.
14019 */
14020type MediaTransformationInputOptions = {
14021    /** How the media should be resized to fit the specified dimensions */
14022    fit?: 'contain' | 'cover' | 'scale-down';
14023    /** Target width in pixels */
14024    width?: number;
14025    /** Target height in pixels */
14026    height?: number;
14027};
14028/**
14029 * Configuration options for Media Transformations output.
14030 * Controls the format, timing, and type of the generated output.
14031 */
14032type MediaTransformationOutputOptions = {
14033    /**
14034     * Output mode determining the type of media to generate
14035     */
14036    mode?: 'video' | 'spritesheet' | 'frame' | 'audio';
14037    /** Whether to include audio in the output */
14038    audio?: boolean;
14039    /**
14040     * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
14041     */
14042    time?: string;
14043    /**
14044     * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
14045     */
14046    duration?: string;
14047    /**
14048     * Number of frames in the spritesheet.
14049     */
14050    imageCount?: number;
14051    /**
14052     * Output format for the generated media.
14053     */
14054    format?: 'jpg' | 'png' | 'm4a';
14055};
14056/**
14057 * Error object for media transformation operations.
14058 * Extends the standard Error interface with additional media-specific information.
14059 */
14060interface MediaError extends Error {
14061    readonly code: number;
14062    readonly message: string;
14063    readonly stack?: string;
14064}
14065declare module 'cloudflare:node' {
14066    interface NodeStyleServer {
14067        listen(...args: unknown[]): this;
14068        address(): {
14069            port?: number | null | undefined;
14070        } | null;
14071    }
14072    export function httpServerHandler(port: number): ExportedHandler;
14073    export function httpServerHandler(options: {
14074        port: number;
14075    }): ExportedHandler;
14076    export function httpServerHandler(server: NodeStyleServer): ExportedHandler;
14077    /**
14078     * Dispatches a request to the `http.Server` listening on the given port and
14079     * resolves with its response. The direct form of `httpServerHandler()`.
14080     */
14081    export function handleAsNodeRequest(port: number | {
14082        port: number;
14083    }, request: Request, env?: unknown, ctx?: ExecutionContext): Promise<Response>;
14084    /**
14085     * Routes inbound sockets to the `net.Server` listening on the port each
14086     * socket arrived on.
14087     */
14088    export function connectHandler(): ExportedHandler;
14089    /**
14090     * Dispatches an inbound socket to the `net.Server` listening on the port it
14091     * arrived on, resolving when the connection has closed. The direct form of
14092     * `connectHandler()`, for use inside a `connect()` handler, such as a
14093     * Durable Object's.
14094     */
14095    export function handleAsNodeConnection(socket: Socket, env?: unknown, ctx?: ExecutionContext): Promise<void>;
14096}
14097type Params<P extends string = any> = Record<P, string | string[]>;
14098type EventContext<Env, P extends string, Data> = {
14099    request: Request<unknown, IncomingRequestCfProperties<unknown>>;
14100    functionPath: string;
14101    waitUntil: (promise: Promise<any>) => void;
14102    passThroughOnException: () => void;
14103    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
14104    env: Env & {
14105        ASSETS: {
14106            fetch: typeof fetch;
14107        };
14108    };
14109    params: Params<P>;
14110    data: Data;
14111};
14112type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
14113type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
14114    request: Request<unknown, IncomingRequestCfProperties<unknown>>;
14115    functionPath: string;
14116    waitUntil: (promise: Promise<any>) => void;
14117    passThroughOnException: () => void;
14118    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
14119    env: Env & {
14120        ASSETS: {
14121            fetch: typeof fetch;
14122        };
14123    };
14124    params: Params<P>;
14125    data: Data;
14126    pluginArgs: PluginArgs;
14127};
14128type 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>;
14129declare module "assets:*" {
14130    export const onRequest: PagesFunction;
14131}
14132// Copyright (c) 2022-2023 Cloudflare, Inc.
14133// Licensed under the Apache 2.0 license found in the LICENSE file or at:
14134//     https://opensource.org/licenses/Apache-2.0
14135declare module "cloudflare:pipelines" {
14136    export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {
14137        protected env: Env;
14138        protected ctx: ExecutionContext;
14139        constructor(ctx: ExecutionContext, env: Env);
14140        /**
14141         * run receives an array of PipelineRecord which can be
14142         * transformed and returned to the pipeline
14143         * @param records Incoming records from the pipeline to be transformed
14144         * @param metadata Information about the specific pipeline calling the transformation entrypoint
14145         * @returns A promise containing the transformed PipelineRecord array
14146         */
14147        public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;
14148    }
14149    export type PipelineRecord = Record<string, unknown>;
14150    export type PipelineBatchMetadata = {
14151        pipelineId: string;
14152        pipelineName: string;
14153    };
14154    export interface Pipeline<T extends PipelineRecord = PipelineRecord> {
14155        /**
14156         * The Pipeline interface represents the type of a binding to a Pipeline
14157         *
14158         * @param records The records to send to the pipeline
14159         */
14160        send(records: T[]): Promise<void>;
14161    }
14162}
14163// PubSubMessage represents an incoming PubSub message.
14164// The message includes metadata about the broker, the client, and the payload
14165// itself.
14166// https://developers.cloudflare.com/pub-sub/
14167interface PubSubMessage {
14168    // Message ID
14169    readonly mid: number;
14170    // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
14171    readonly broker: string;
14172    // The MQTT topic the message was sent on.
14173    readonly topic: string;
14174    // The client ID of the client that published this message.
14175    readonly clientId: string;
14176    // The unique identifier (JWT ID) used by the client to authenticate, if token
14177    // auth was used.
14178    readonly jti?: string;
14179    // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
14180    // received the message from the client.
14181    readonly receivedAt: number;
14182    // An (optional) string with the MIME type of the payload, if set by the
14183    // client.
14184    readonly contentType: string;
14185    // Set to 1 when the payload is a UTF-8 string
14186    // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
14187    readonly payloadFormatIndicator: number;
14188    // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
14189    // You can use payloadFormatIndicator to inspect this before decoding.
14190    payload: string | Uint8Array;
14191}
14192// JsonWebKey extended by kid parameter
14193interface JsonWebKeyWithKid extends JsonWebKey {
14194    // Key Identifier of the JWK
14195    readonly kid: string;
14196}
14197interface RateLimitOptions {
14198    key: string;
14199}
14200interface RateLimitOutcome {
14201    success: boolean;
14202}
14203interface RateLimit {
14204    /**
14205     * Rate limit a request based on the provided options.
14206     * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/
14207     * @returns A promise that resolves with the outcome of the rate limit.
14208     */
14209    limit(options: RateLimitOptions): Promise<RateLimitOutcome>;
14210}
14211// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
14212// to referenced by `Fetcher`. This is included in the "importable" version of the types which
14213// strips all `module` blocks.
14214declare namespace Rpc {
14215    // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
14216    // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
14217    // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
14218    // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
14219    export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';
14220    export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';
14221    export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';
14222    export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';
14223    export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';
14224    export interface RpcTargetBranded {
14225        [__RPC_TARGET_BRAND]: never;
14226    }
14227    export interface WorkerEntrypointBranded {
14228        [__WORKER_ENTRYPOINT_BRAND]: never;
14229    }
14230    export interface DurableObjectBranded {
14231        [__DURABLE_OBJECT_BRAND]: never;
14232    }
14233    export interface WorkflowEntrypointBranded {
14234        [__WORKFLOW_ENTRYPOINT_BRAND]: never;
14235    }
14236    export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;
14237    // Types that can be used through `Stub`s
14238    export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
14239    // Types that can be passed over RPC
14240    // The reason for using a generic type here is to build a serializable subset of structured
14241    //   cloneable composite types. This allows types defined with the "interface" keyword to pass the
14242    //   serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
14243    type Serializable<T> = 
14244    // Structured cloneables
14245    BaseType
14246    // Structured cloneable composites
14247     | 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> | {
14248        [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
14249    }
14250    // Special types
14251     | Stub<Stubable>
14252    // Serialized as stubs, see `Stubify`
14253     | Stubable;
14254    // Base type for all RPC stubs, including common memory management methods.
14255    // `T` is used as a marker type for unwrapping `Stub`s later.
14256    interface StubBase<T extends Stubable> extends Disposable {
14257        [__RPC_STUB_BRAND]: T;
14258        dup(): this;
14259    }
14260    export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
14261    // This represents all the types that can be sent as-is over an RPC boundary
14262    type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;
14263    // Recursively rewrite all `Stubable` types with `Stub`s
14264    // prettier-ignore
14265    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 {
14266        [key: string | number]: any;
14267    } ? {
14268        [K in keyof T]: Stubify<T[K]>;
14269    } : T;
14270    // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
14271    // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
14272    // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
14273    // prettier-ignore
14274    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 {
14275        [key: string | number]: unknown;
14276    } ? {
14277        [K in keyof T]: Unstubify<T[K]>;
14278    } : T;
14279    type UnstubifyAll<A extends any[]> = {
14280        [I in keyof A]: Unstubify<A[I]>;
14281    };
14282    // Utility type for adding `Provider`/`Disposable`s to `object` types only.
14283    // Note `unknown & T` is equivalent to `T`.
14284    type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
14285    type MaybeDisposable<T> = T extends object ? Disposable : unknown;
14286    // Type for method return or property on an RPC interface.
14287    // - Stubable types are replaced by stubs.
14288    // - Serializable types are passed by value, with stubable types replaced by stubs
14289    //   and a top-level `Disposer`.
14290    // Everything else can't be passed over PRC.
14291    // Technically, we use custom thenables here, but they quack like `Promise`s.
14292    // Intersecting with `(Maybe)Provider` allows pipelining.
14293    // prettier-ignore
14294    type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;
14295    // Type for method or property on an RPC interface.
14296    // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
14297    // Unwrapping `Stub`s allows calling with `Stubable` arguments.
14298    // For properties, rewrite types to be `Result`s.
14299    // In each case, unwrap `Promise`s.
14300    type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;
14301    // Type for the callable part of an `Provider` if `T` is callable.
14302    // This is intersected with methods/properties.
14303    type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;
14304    // Base type for all other types providing RPC-like interfaces.
14305    // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
14306    // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
14307    export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{
14308        [K in keyof T]: MethodOrProperty<T[K]>;
14309    }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;
14310}
14311declare namespace Cloudflare {
14312    // Type of `env`.
14313    //
14314    // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript
14315    // will merge all declarations.
14316    //
14317    // You can use `wrangler types` to generate the `Env` type automatically.
14318    interface Env {
14319    }
14320    // Project-specific parameters used to inform types.
14321    //
14322    // This interface is, again, intended to be declared in project-specific files, and then that
14323    // declaration will be merged with this one.
14324    //
14325    // A project should have a declaration like this:
14326    //
14327    //     interface GlobalProps {
14328    //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type
14329    //       // of `ctx.exports`.
14330    //       mainModule: typeof import("my-main-module");
14331    //
14332    //       // Declares which of the main module's exports are configured with durable storage, and
14333    //       // thus should behave as Durable Object namsepace bindings.
14334    //       durableNamespaces: "MyDurableObject" | "AnotherDurableObject";
14335    //     }
14336    //
14337    // You can use `wrangler types` to generate `GlobalProps` automatically.
14338    interface GlobalProps {
14339    }
14340    // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not
14341    // present.
14342    type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;
14343    // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the
14344    // `mainModule` property.
14345    type MainModule = GlobalProp<"mainModule", {}>;
14346    // The type of ctx.exports, which contains loopback bindings for all top-level exports.
14347    type Exports = {
14348        [K in keyof MainModule]: LoopbackForExport<MainModule[K]>
14349        // If the export is listed in `durableNamespaces`, then it is also a
14350        // DurableObjectNamespace.
14351         & (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});
14352    };
14353}
14354declare namespace CloudflareWorkersModule {
14355    export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
14356    export const RpcStub: {
14357        new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
14358    };
14359    export abstract class RpcTarget implements Rpc.RpcTargetBranded {
14360        [Rpc.__RPC_TARGET_BRAND]: never;
14361    }
14362    // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
14363    export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {
14364        [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
14365        protected ctx: ExecutionContext<Props>;
14366        protected env: Env;
14367        constructor(ctx: ExecutionContext, env: Env);
14368        email?(message: ForwardableEmailMessage): void | Promise<void>;
14369        fetch?(request: Request): Response | Promise<Response>;
14370        connect?(socket: Socket): void | Promise<void>;
14371        queue?(batch: MessageBatch): void | Promise<void>;
14372        scheduled?(controller: ScheduledController): void | Promise<void>;
14373        tail?(events: TraceItem[]): void | Promise<void>;
14374        tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | undefined | Promise<TailStream.TailEventHandlerType | undefined>;
14375        test?(controller: TestController): void | Promise<void>;
14376        trace?(traces: TraceItem[]): void | Promise<void>;
14377    }
14378    export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {
14379        [Rpc.__DURABLE_OBJECT_BRAND]: never;
14380        protected ctx: DurableObjectState<Props>;
14381        protected env: Env;
14382        constructor(ctx: DurableObjectState, env: Env);
14383        alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
14384        fetch?(request: Request): Response | Promise<Response>;
14385        connect?(socket: Socket): void | Promise<void>;
14386        webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
14387        webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
14388        webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
14389    }
14390    export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
14391    export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
14392    export type WorkflowDelayDuration = WorkflowSleepDuration;
14393    export type WorkflowDynamicDelayContext = {
14394        ctx: WorkflowStepContext<WorkflowDelayFunction>;
14395        error: Error;
14396    };
14397    export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
14398    export type WorkflowTimeoutDuration = WorkflowSleepDuration;
14399    export type WorkflowRetentionDuration = WorkflowSleepDuration;
14400    export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
14401    export type WorkflowStepSensitivity = 'output';
14402    export type WorkflowStepConfig = {
14403        retries?: {
14404            limit: number;
14405            delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
14406            backoff?: WorkflowBackoff;
14407        };
14408        timeout?: WorkflowTimeoutDuration | number;
14409        sensitive?: WorkflowStepSensitivity;
14410    };
14411    // Internal discriminators used only for `WorkflowStep.do` overload
14412    // resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a
14413    // single kind so the callback context can be narrowed based on the shape of
14414    // the config argument (rather than on an inferred type parameter, which is
14415    // lost when the caller supplies an explicit return-type argument). Not
14416    // exported: they must not widen the public type surface.
14417    type WorkflowStepConfigWithStaticDelay = Omit<WorkflowStepConfig, 'retries'> & {
14418        retries?: {
14419            limit: number;
14420            delay: WorkflowDelayDuration | number;
14421            backoff?: WorkflowBackoff;
14422        };
14423    };
14424    type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
14425        retries: {
14426            limit: number;
14427            delay: WorkflowDelayFunction;
14428            backoff?: WorkflowBackoff;
14429        };
14430    };
14431    export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
14432    export type WorkflowCronSchedule = {
14433        /** Cron expression that triggered this event. */
14434        cron: string;
14435        /** Timestamp of the scheduled trigger, in milliseconds since the Unix epoch. */
14436        scheduledTime: number;
14437    };
14438    export type WorkflowEvent<T> = {
14439        payload: Readonly<T>;
14440        timestamp: Date;
14441        instanceId: string;
14442        workflowName: string;
14443        schedule?: WorkflowCronSchedule;
14444    };
14445    export type WorkflowStepEvent<T> = {
14446        payload: Readonly<T>;
14447        timestamp: Date;
14448        type: string;
14449        sensitive?: WorkflowStepSensitivity;
14450    };
14451    export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
14452        step: {
14453            name: string;
14454            count: number;
14455        };
14456        attempt: number;
14457        config: {
14458            retries?: {
14459                limit: number;
14460                backoff?: WorkflowBackoff;
14461            } & (Delay extends WorkflowDelayFunction ? {} : {
14462                delay: WorkflowDelayDuration | number;
14463            });
14464            timeout?: WorkflowTimeoutDuration | number;
14465            sensitive?: WorkflowStepSensitivity;
14466        };
14467    };
14468    // The rollback handler receives the step context, so it mirrors the same
14469    // delay discriminant as the step callback: when the step was configured with
14470    // a dynamic delay function the resolved `config.retries.delay` is omitted,
14471    // otherwise it is present. `Delay` is threaded from the `WorkflowStep.do`
14472    // overload that matched the step config.
14473    export type WorkflowRollbackContext<T = unknown, Delay = WorkflowDelayDuration | number> = {
14474        ctx: WorkflowStepContext<Delay>;
14475        error: Error;
14476        output: T | undefined;
14477        /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
14478        stepName: string;
14479    };
14480    export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
14481    export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
14482        rollback: WorkflowRollbackHandler<T, Delay>;
14483        rollbackConfig?: WorkflowStepRollbackConfig;
14484    };
14485    export abstract class WorkflowStep {
14486        do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
14487        // The config overloads discriminate on the shape of `config.retries.delay`
14488        // so the callback context reflects whether the resolved delay is present
14489        // (static delay) or omitted (dynamic delay function). Each has a single
14490        // type parameter, so an explicit return-type argument (`do<T>(...)`) still
14491        // resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig`
14492        // fallback MUST remain last, otherwise it shadows the discriminating
14493        // overloads and narrowing is silently lost.
14494        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
14495        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
14496        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
14497        sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
14498        sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
14499        waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
14500            type: string;
14501            timeout?: WorkflowTimeoutDuration | number;
14502        }): Promise<WorkflowStepEvent<T>>;
14503    }
14504    export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';
14505    export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {
14506        [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;
14507        protected ctx: ExecutionContext;
14508        protected env: Env;
14509        constructor(ctx: ExecutionContext, env: Env);
14510        run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
14511    }
14512    export function waitUntil(promise: Promise<unknown>): void;
14513    export function withEnv(newEnv: unknown, fn: () => unknown): unknown;
14514    export function withExports(newExports: unknown, fn: () => unknown): unknown;
14515    export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;
14516    export const env: Cloudflare.Env;
14517    export const exports: Cloudflare.Exports;
14518    export const cache: CacheContext;
14519    export const tracing: Tracing;
14520}
14521declare module 'cloudflare:workers' {
14522    export = CloudflareWorkersModule;
14523}
14524interface SecretsStoreSecret {
14525    /**
14526     * Get a secret from the Secrets Store, returning a string of the secret value
14527     * if it exists, or throws an error if it does not exist
14528     */
14529    get(): Promise<string>;
14530}
14531declare module "cloudflare:sockets" {
14532    function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;
14533    export { _connect as connect };
14534}
14535/**
14536 * Binding entrypoint for Cloudflare Stream.
14537 *
14538 * Usage:
14539 * - Binding-level operations:
14540 *   `await env.STREAM.videos.upload`
14541 *   `await env.STREAM.videos.createDirectUpload`
14542 *   `await env.STREAM.videos.*`
14543 *   `await env.STREAM.watermarks.*`
14544 * - Per-video operations:
14545 *   `await env.STREAM.video(id).downloads.*`
14546 *   `await env.STREAM.video(id).captions.*`
14547 *
14548 * Example usage:
14549 * ```ts
14550 * await env.STREAM.video(id).downloads.generate();
14551 *
14552 * const video = env.STREAM.video(id)
14553 * const captions = video.captions.list();
14554 * const videoDetails = video.details()
14555 * ```
14556 */
14557interface StreamBinding {
14558    /**
14559     * Returns a handle scoped to a single video for per-video operations.
14560     * @param id The unique identifier for the video.
14561     * @returns A handle for per-video operations.
14562     */
14563    video(id: string): StreamVideoHandle;
14564    /**
14565     * Uploads a new video from a provided URL.
14566     * @param url The URL to upload from.
14567     * @param params Optional upload parameters.
14568     * @returns The uploaded video details.
14569     * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid
14570     * @throws {QuotaReachedError} if the account storage capacity is exceeded
14571     * @throws {MaxFileSizeError} if the file size is too large
14572     * @throws {RateLimitedError} if the server received too many requests
14573     * @throws {AlreadyUploadedError} if a video was already uploaded to this URL
14574     * @throws {InternalError} if an unexpected error occurs
14575     */
14576    upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;
14577    /**
14578     * Creates a direct upload that allows video uploads without an API key.
14579     * @param params Parameters for the direct upload
14580     * @returns The direct upload details.
14581     * @throws {BadRequestError} if the parameters are invalid
14582     * @throws {RateLimitedError} if the server received too many requests
14583     * @throws {InternalError} if an unexpected error occurs
14584     */
14585    createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;
14586    videos: StreamVideos;
14587    watermarks: StreamWatermarks;
14588}
14589/**
14590 * Handle for operations scoped to a single Stream video.
14591 */
14592interface StreamVideoHandle {
14593    /**
14594     * The unique identifier for the video.
14595     */
14596    id: string;
14597    /**
14598     * Get a full videos details
14599     * @returns The full video details.
14600     * @throws {NotFoundError} if the video is not found
14601     * @throws {InternalError} if an unexpected error occurs
14602     */
14603    details(): Promise<StreamVideo>;
14604    /**
14605     * Update details for a single video.
14606     * @param params The fields to update for the video.
14607     * @returns The updated video details.
14608     * @throws {NotFoundError} if the video is not found
14609     * @throws {BadRequestError} if the parameters are invalid
14610     * @throws {InternalError} if an unexpected error occurs
14611     */
14612    update(params: StreamUpdateVideoParams): Promise<StreamVideo>;
14613    /**
14614     * Deletes a video and its copies from Cloudflare Stream.
14615     * @returns A promise that resolves when deletion completes.
14616     * @throws {NotFoundError} if the video is not found
14617     * @throws {InternalError} if an unexpected error occurs
14618     */
14619    delete(): Promise<void>;
14620    /**
14621     * Creates a signed URL token for a video.
14622     * @returns The signed token that was created.
14623     * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
14624     */
14625    generateToken(): Promise<string>;
14626    downloads: StreamScopedDownloads;
14627    captions: StreamScopedCaptions;
14628}
14629interface StreamVideo {
14630    /**
14631     * The unique identifier for the video.
14632     */
14633    id: string;
14634    /**
14635     * A user-defined identifier for the media creator.
14636     */
14637    creator: string | null;
14638    /**
14639     * The thumbnail URL for the video.
14640     */
14641    thumbnail: string;
14642    /**
14643     * The thumbnail timestamp percentage.
14644     */
14645    thumbnailTimestampPct: number;
14646    /**
14647     * Indicates whether the video is ready to stream.
14648     */
14649    readyToStream: boolean;
14650    /**
14651     * The date and time the video became ready to stream.
14652     */
14653    readyToStreamAt: string | null;
14654    /**
14655     * Processing status information.
14656     */
14657    status: StreamVideoStatus;
14658    /**
14659     * A user modifiable key-value store.
14660     */
14661    meta: Record<string, string>;
14662    /**
14663     * The date and time the video was created.
14664     */
14665    created: string;
14666    /**
14667     * The date and time the video was last modified.
14668     */
14669    modified: string;
14670    /**
14671     * The date and time at which the video will be deleted.
14672     */
14673    scheduledDeletion: string | null;
14674    /**
14675     * The size of the video in bytes.
14676     */
14677    size: number;
14678    /**
14679     * The preview URL for the video.
14680     */
14681    preview?: string;
14682    /**
14683     * Origins allowed to display the video.
14684     */
14685    allowedOrigins: Array<string>;
14686    /**
14687     * Indicates whether signed URLs are required.
14688     */
14689    requireSignedURLs: boolean | null;
14690    /**
14691     * The date and time the video was uploaded.
14692     */
14693    uploaded: string | null;
14694    /**
14695     * The date and time when the upload URL expires.
14696     */
14697    uploadExpiry: string | null;
14698    /**
14699     * The maximum size in bytes for direct uploads.
14700     */
14701    maxSizeBytes: number | null;
14702    /**
14703     * The maximum duration in seconds for direct uploads.
14704     */
14705    maxDurationSeconds: number | null;
14706    /**
14707     * The video duration in seconds. -1 indicates unknown.
14708     */
14709    duration: number;
14710    /**
14711     * Input metadata for the original upload.
14712     */
14713    input: StreamVideoInput;
14714    /**
14715     * Playback URLs for the video.
14716     */
14717    hlsPlaybackUrl: string;
14718    dashPlaybackUrl: string;
14719    /**
14720     * The watermark applied to the video, if any.
14721     */
14722    watermark: StreamWatermark | null;
14723    /**
14724     * The live input id associated with the video, if any.
14725     */
14726    liveInputId?: string | null;
14727    /**
14728     * The source video id if this is a clip.
14729     */
14730    clippedFromId: string | null;
14731    /**
14732     * Public details associated with the video.
14733     */
14734    publicDetails: StreamPublicDetails | null;
14735}
14736type StreamVideoStatus = {
14737    /**
14738     * The current processing state.
14739     */
14740    state: string;
14741    /**
14742     * The current processing step.
14743     */
14744    step?: string;
14745    /**
14746     * The percent complete as a string.
14747     */
14748    pctComplete?: string;
14749    /**
14750     * An error reason code, if applicable.
14751     */
14752    errorReasonCode: string;
14753    /**
14754     * An error reason text, if applicable.
14755     */
14756    errorReasonText: string;
14757};
14758type StreamVideoInput = {
14759    /**
14760     * The input width in pixels.
14761     */
14762    width: number;
14763    /**
14764     * The input height in pixels.
14765     */
14766    height: number;
14767};
14768type StreamPublicDetails = {
14769    /**
14770     * The public title for the video.
14771     */
14772    title: string | null;
14773    /**
14774     * The public share link.
14775     */
14776    share_link: string | null;
14777    /**
14778     * The public channel link.
14779     */
14780    channel_link: string | null;
14781    /**
14782     * The public logo URL.
14783     */
14784    logo: string | null;
14785};
14786type StreamDirectUpload = {
14787    /**
14788     * The URL an unauthenticated upload can use for a single multipart request.
14789     */
14790    uploadURL: string;
14791    /**
14792     * A Cloudflare-generated unique identifier for a media item.
14793     */
14794    id: string;
14795    /**
14796     * The watermark profile applied to the upload.
14797     */
14798    watermark: StreamWatermark | null;
14799    /**
14800     * The scheduled deletion time, if any.
14801     */
14802    scheduledDeletion: string | null;
14803};
14804type StreamDirectUploadCreateParams = {
14805    /**
14806     * The maximum duration in seconds for a video upload.
14807     */
14808    maxDurationSeconds: number;
14809    /**
14810     * The date and time after upload when videos will not be accepted.
14811     */
14812    expiry?: string;
14813    /**
14814     * A user-defined identifier for the media creator.
14815     */
14816    creator?: string;
14817    /**
14818     * A user modifiable key-value store used to reference other systems of record for
14819     * managing videos.
14820     */
14821    meta?: Record<string, string>;
14822    /**
14823     * Lists the origins allowed to display the video.
14824     */
14825    allowedOrigins?: Array<string>;
14826    /**
14827     * Indicates whether the video can be accessed using the id. When set to `true`,
14828     * a signed token must be generated with a signing key to view the video.
14829     */
14830    requireSignedURLs?: boolean;
14831    /**
14832     * The thumbnail timestamp percentage.
14833     */
14834    thumbnailTimestampPct?: number;
14835    /**
14836     * The date and time at which the video will be deleted. Include `null` to remove
14837     * a scheduled deletion.
14838     */
14839    scheduledDeletion?: string | null;
14840    /**
14841     * The watermark profile to apply.
14842     */
14843    watermark?: StreamDirectUploadWatermark;
14844};
14845type StreamDirectUploadWatermark = {
14846    /**
14847     * The unique identifier for the watermark profile.
14848     */
14849    id: string;
14850};
14851type StreamUrlUploadParams = {
14852    /**
14853     * Lists the origins allowed to display the video. Enter allowed origin
14854     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
14855     * video to be viewed on any origin.
14856     */
14857    allowedOrigins?: Array<string>;
14858    /**
14859     * A user-defined identifier for the media creator.
14860     */
14861    creator?: string;
14862    /**
14863     * A user modifiable key-value store used to reference other systems of
14864     * record for managing videos.
14865     */
14866    meta?: Record<string, string>;
14867    /**
14868     * Indicates whether the video can be a accessed using the id. When
14869     * set to `true`, a signed token must be generated with a signing key to view the
14870     * video.
14871     */
14872    requireSignedURLs?: boolean;
14873    /**
14874     * Indicates the date and time at which the video will be deleted. Omit
14875     * the field to indicate no change, or include with a `null` value to remove an
14876     * existing scheduled deletion. If specified, must be at least 30 days from upload
14877     * time.
14878     */
14879    scheduledDeletion?: string | null;
14880    /**
14881     * The timestamp for a thumbnail image calculated as a percentage value
14882     * of the video's duration. To convert from a second-wise timestamp to a
14883     * percentage, divide the desired timestamp by the total duration of the video. If
14884     * this value is not set, the default thumbnail image is taken from 0s of the
14885     * video.
14886     */
14887    thumbnailTimestampPct?: number;
14888    /**
14889     * The identifier for the watermark profile
14890     */
14891    watermarkId?: string;
14892};
14893interface StreamScopedCaptions {
14894    /**
14895     * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
14896     * One caption or subtitle file per language is allowed.
14897     * @param language The BCP 47 language tag for the caption or subtitle.
14898     * @param input The caption or subtitle stream to upload.
14899     * @returns The created caption entry.
14900     * @throws {NotFoundError} if the video is not found
14901     * @throws {BadRequestError} if the language or file is invalid
14902     * @throws {InternalError} if an unexpected error occurs
14903     */
14904    upload(language: string, input: ReadableStream): Promise<StreamCaption>;
14905    /**
14906     * Generate captions or subtitles for the provided language via AI.
14907     * @param language The BCP 47 language tag to generate.
14908     * @returns The generated caption entry.
14909     * @throws {NotFoundError} if the video is not found
14910     * @throws {BadRequestError} if the language is invalid
14911     * @throws {StreamError} if a generated caption already exists
14912     * @throws {StreamError} if the video duration is too long
14913     * @throws {StreamError} if the video is missing audio
14914     * @throws {StreamError} if the requested language is not supported
14915     * @throws {InternalError} if an unexpected error occurs
14916     */
14917    generate(language: string): Promise<StreamCaption>;
14918    /**
14919     * Lists the captions or subtitles.
14920     * Use the language parameter to filter by a specific language.
14921     * @param language The optional BCP 47 language tag to filter by.
14922     * @returns The list of captions or subtitles.
14923     * @throws {NotFoundError} if the video or caption is not found
14924     * @throws {InternalError} if an unexpected error occurs
14925     */
14926    list(language?: string): Promise<StreamCaption[]>;
14927    /**
14928     * Removes the captions or subtitles from a video.
14929     * @param language The BCP 47 language tag to remove.
14930     * @returns A promise that resolves when deletion completes.
14931     * @throws {NotFoundError} if the video or caption is not found
14932     * @throws {InternalError} if an unexpected error occurs
14933     */
14934    delete(language: string): Promise<void>;
14935}
14936interface StreamScopedDownloads {
14937    /**
14938     * Generates a download for a video when a video is ready to view. Available
14939     * types are `default` and `audio`. Defaults to `default` when omitted.
14940     * @param downloadType The download type to create.
14941     * @returns The current downloads for the video.
14942     * @throws {NotFoundError} if the video is not found
14943     * @throws {BadRequestError} if the download type is invalid
14944     * @throws {StreamError} if the video duration is too long to generate a download
14945     * @throws {StreamError} if the video is not ready to stream
14946     * @throws {InternalError} if an unexpected error occurs
14947     */
14948    generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;
14949    /**
14950     * Lists the downloads created for a video.
14951     * @returns The current downloads for the video.
14952     * @throws {NotFoundError} if the video or downloads are not found
14953     * @throws {InternalError} if an unexpected error occurs
14954     */
14955    get(): Promise<StreamDownloadGetResponse>;
14956    /**
14957     * Delete the downloads for a video. Available types are `default` and `audio`.
14958     * Defaults to `default` when omitted.
14959     * @param downloadType The download type to delete.
14960     * @returns A promise that resolves when deletion completes.
14961     * @throws {NotFoundError} if the video or downloads are not found
14962     * @throws {InternalError} if an unexpected error occurs
14963     */
14964    delete(downloadType?: StreamDownloadType): Promise<void>;
14965}
14966interface StreamVideos {
14967    /**
14968     * Lists all videos in a users account.
14969     * @returns The list of videos.
14970     * @throws {BadRequestError} if the parameters are invalid
14971     * @throws {InternalError} if an unexpected error occurs
14972     */
14973    list(params?: StreamVideosListParams): Promise<StreamVideo[]>;
14974}
14975interface StreamWatermarks {
14976    /**
14977     * Generate a new watermark profile
14978     * @param input The image stream to upload
14979     * @param params The watermark creation parameters.
14980     * @returns The created watermark profile.
14981     * @throws {BadRequestError} if the parameters are invalid
14982     * @throws {InvalidURLError} if the URL is invalid
14983     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
14984     * @throws {InternalError} if an unexpected error occurs
14985     */
14986    generate(input: ReadableStream, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
14987    /**
14988     * Generate a new watermark profile
14989     * @param url The image url to upload
14990     * @param params The watermark creation parameters.
14991     * @returns The created watermark profile.
14992     * @throws {BadRequestError} if the parameters are invalid
14993     * @throws {InvalidURLError} if the URL is invalid
14994     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
14995     * @throws {InternalError} if an unexpected error occurs
14996     */
14997    generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
14998    /**
14999     * Lists all watermark profiles for an account.
15000     * @returns The list of watermark profiles.
15001     * @throws {InternalError} if an unexpected error occurs
15002     */
15003    list(): Promise<StreamWatermark[]>;
15004    /**
15005     * Retrieves details for a single watermark profile.
15006     * @param watermarkId The watermark profile identifier.
15007     * @returns The watermark profile details.
15008     * @throws {NotFoundError} if the watermark is not found
15009     * @throws {InternalError} if an unexpected error occurs
15010     */
15011    get(watermarkId: string): Promise<StreamWatermark>;
15012    /**
15013     * Deletes a watermark profile.
15014     * @param watermarkId The watermark profile identifier.
15015     * @returns A promise that resolves when deletion completes.
15016     * @throws {NotFoundError} if the watermark is not found
15017     * @throws {InternalError} if an unexpected error occurs
15018     */
15019    delete(watermarkId: string): Promise<void>;
15020}
15021type StreamUpdateVideoParams = {
15022    /**
15023     * Lists the origins allowed to display the video. Enter allowed origin
15024     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
15025     * video to be viewed on any origin.
15026     */
15027    allowedOrigins?: Array<string>;
15028    /**
15029     * A user-defined identifier for the media creator.
15030     */
15031    creator?: string;
15032    /**
15033     * The maximum duration in seconds for a video upload. Can be set for a
15034     * video that is not yet uploaded to limit its duration. Uploads that exceed the
15035     * specified duration will fail during processing. A value of `-1` means the value
15036     * is unknown.
15037     */
15038    maxDurationSeconds?: number;
15039    /**
15040     * A user modifiable key-value store used to reference other systems of
15041     * record for managing videos.
15042     */
15043    meta?: Record<string, string>;
15044    /**
15045     * Indicates whether the video can be a accessed using the id. When
15046     * set to `true`, a signed token must be generated with a signing key to view the
15047     * video.
15048     */
15049    requireSignedURLs?: boolean;
15050    /**
15051     * Indicates the date and time at which the video will be deleted. Omit
15052     * the field to indicate no change, or include with a `null` value to remove an
15053     * existing scheduled deletion. If specified, must be at least 30 days from upload
15054     * time.
15055     */
15056    scheduledDeletion?: string | null;
15057    /**
15058     * The timestamp for a thumbnail image calculated as a percentage value
15059     * of the video's duration. To convert from a second-wise timestamp to a
15060     * percentage, divide the desired timestamp by the total duration of the video. If
15061     * this value is not set, the default thumbnail image is taken from 0s of the
15062     * video.
15063     */
15064    thumbnailTimestampPct?: number;
15065};
15066type StreamCaption = {
15067    /**
15068     * Whether the caption was generated via AI.
15069     */
15070    generated?: boolean;
15071    /**
15072     * The language label displayed in the native language to users.
15073     */
15074    label: string;
15075    /**
15076     * The language tag in BCP 47 format.
15077     */
15078    language: string;
15079    /**
15080     * The status of a generated caption.
15081     */
15082    status?: 'ready' | 'inprogress' | 'error';
15083};
15084type StreamDownloadStatus = 'ready' | 'inprogress' | 'error';
15085type StreamDownloadType = 'default' | 'audio';
15086type StreamDownload = {
15087    /**
15088     * Indicates the progress as a percentage between 0 and 100.
15089     */
15090    percentComplete: number;
15091    /**
15092     * The status of a generated download.
15093     */
15094    status: StreamDownloadStatus;
15095    /**
15096     * The URL to access the generated download.
15097     */
15098    url?: string;
15099};
15100/**
15101 * An object with download type keys. Each key is optional and only present if that
15102 * download type has been created.
15103 */
15104type StreamDownloadGetResponse = {
15105    /**
15106     * The audio-only download. Only present if this download type has been created.
15107     */
15108    audio?: StreamDownload;
15109    /**
15110     * The default video download. Only present if this download type has been created.
15111     */
15112    default?: StreamDownload;
15113};
15114type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';
15115type StreamWatermark = {
15116    /**
15117     * The unique identifier for a watermark profile.
15118     */
15119    id: string;
15120    /**
15121     * The size of the image in bytes.
15122     */
15123    size: number;
15124    /**
15125     * The height of the image in pixels.
15126     */
15127    height: number;
15128    /**
15129     * The width of the image in pixels.
15130     */
15131    width: number;
15132    /**
15133     * The date and a time a watermark profile was created.
15134     */
15135    created: string;
15136    /**
15137     * The source URL for a downloaded image. If the watermark profile was created via
15138     * direct upload, this field is null.
15139     */
15140    downloadedFrom: string | null;
15141    /**
15142     * A short description of the watermark profile.
15143     */
15144    name: string;
15145    /**
15146     * The translucency of the image. A value of `0.0` makes the image completely
15147     * transparent, and `1.0` makes the image completely opaque. Note that if the image
15148     * is already semi-transparent, setting this to `1.0` will not make the image
15149     * completely opaque.
15150     */
15151    opacity: number;
15152    /**
15153     * The whitespace between the adjacent edges (determined by position) of the video
15154     * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded
15155     * video width or length, as determined by the algorithm.
15156     */
15157    padding: number;
15158    /**
15159     * The size of the image relative to the overall size of the video. This parameter
15160     * will adapt to horizontal and vertical videos automatically. `0.0` indicates no
15161     * scaling (use the size of the image as-is), and `1.0 `fills the entire video.
15162     */
15163    scale: number;
15164    /**
15165     * The location of the image. Valid positions are: `upperRight`, `upperLeft`,
15166     * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the
15167     * `padding` parameter.
15168     */
15169    position: StreamWatermarkPosition;
15170};
15171type StreamWatermarkCreateParams = {
15172    /**
15173     * A short description of the watermark profile.
15174     */
15175    name?: string;
15176    /**
15177     * The translucency of the image. A value of `0.0` makes the image completely
15178     * transparent, and `1.0` makes the image completely opaque. Note that if the
15179     * image is already semi-transparent, setting this to `1.0` will not make the
15180     * image completely opaque.
15181     */
15182    opacity?: number;
15183    /**
15184     * The whitespace between the adjacent edges (determined by position) of the
15185     * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully
15186     * padded video width or length, as determined by the algorithm.
15187     */
15188    padding?: number;
15189    /**
15190     * The size of the image relative to the overall size of the video. This
15191     * parameter will adapt to horizontal and vertical videos automatically. `0.0`
15192     * indicates no scaling (use the size of the image as-is), and `1.0 `fills the
15193     * entire video.
15194     */
15195    scale?: number;
15196    /**
15197     * The location of the image.
15198     */
15199    position?: StreamWatermarkPosition;
15200};
15201type StreamVideosListParams = {
15202    /**
15203     * The maximum number of videos to return.
15204     */
15205    limit?: number;
15206    /**
15207     * Return videos created before this timestamp.
15208     * (RFC3339/RFC3339Nano)
15209     */
15210    before?: string;
15211    /**
15212     * Comparison operator for the `before` field.
15213     * @default 'lt'
15214     */
15215    beforeComp?: StreamPaginationComparison;
15216    /**
15217     * Return videos created after this timestamp.
15218     * (RFC3339/RFC3339Nano)
15219     */
15220    after?: string;
15221    /**
15222     * Comparison operator for the `after` field.
15223     * @default 'gte'
15224     */
15225    afterComp?: StreamPaginationComparison;
15226};
15227type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
15228/**
15229 * Error object for Stream binding operations.
15230 */
15231interface StreamError extends Error {
15232    readonly code: number;
15233    readonly statusCode: number;
15234    readonly message: string;
15235    readonly stack?: string;
15236}
15237interface InternalError extends StreamError {
15238    name: 'InternalError';
15239}
15240interface BadRequestError extends StreamError {
15241    name: 'BadRequestError';
15242}
15243interface NotFoundError extends StreamError {
15244    name: 'NotFoundError';
15245}
15246interface ForbiddenError extends StreamError {
15247    name: 'ForbiddenError';
15248}
15249interface RateLimitedError extends StreamError {
15250    name: 'RateLimitedError';
15251}
15252interface QuotaReachedError extends StreamError {
15253    name: 'QuotaReachedError';
15254}
15255interface MaxFileSizeError extends StreamError {
15256    name: 'MaxFileSizeError';
15257}
15258interface InvalidURLError extends StreamError {
15259    name: 'InvalidURLError';
15260}
15261interface AlreadyUploadedError extends StreamError {
15262    name: 'AlreadyUploadedError';
15263}
15264interface TooManyWatermarksError extends StreamError {
15265    name: 'TooManyWatermarksError';
15266}
15267type MarkdownDocument = {
15268    name: string;
15269    blob: Blob;
15270};
15271type OutputFormat = 'markdown' | 'text';
15272type ConversionResponse = {
15273    id: string;
15274    name: string;
15275    mimeType: string;
15276    format: OutputFormat;
15277    tokens: number;
15278    data: string;
15279} | {
15280    id: string;
15281    name: string;
15282    mimeType: string;
15283    format: 'error';
15284    error: string;
15285};
15286type ImageConversionOptions = {
15287    descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';
15288};
15289type EmbeddedImageConversionOptions = ImageConversionOptions & {
15290    convert?: boolean;
15291    maxConvertedImages?: number;
15292};
15293type ConversionOutputOptions = {
15294    format?: OutputFormat;
15295};
15296type ConversionOptions = {
15297    output?: ConversionOutputOptions;
15298    html?: {
15299        images?: EmbeddedImageConversionOptions & {
15300            convertOGImage?: boolean;
15301        };
15302        hostname?: string;
15303        cssSelector?: string;
15304    };
15305    docx?: {
15306        images?: EmbeddedImageConversionOptions;
15307    };
15308    image?: ImageConversionOptions;
15309    pdf?: {
15310        images?: EmbeddedImageConversionOptions;
15311        metadata?: boolean;
15312    };
15313};
15314type ConversionRequestOptions = {
15315    gateway?: GatewayOptions;
15316    extraHeaders?: object;
15317    conversionOptions?: ConversionOptions;
15318};
15319type SupportedFileFormat = {
15320    mimeType: string;
15321    extension: string;
15322};
15323declare abstract class ToMarkdownService {
15324    transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
15325    transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;
15326    supported(): Promise<SupportedFileFormat[]>;
15327}
15328declare namespace TailStream {
15329    interface Header {
15330        readonly name: string;
15331        readonly value: string;
15332    }
15333    interface FetchEventInfo {
15334        readonly type: "fetch";
15335        readonly method: string;
15336        readonly url: string;
15337        readonly cfJson?: object;
15338        readonly headers: Header[];
15339    }
15340    interface JsRpcEventInfo {
15341        readonly type: "jsrpc";
15342    }
15343    interface ScheduledEventInfo {
15344        readonly type: "scheduled";
15345        readonly scheduledTime: Date;
15346        readonly cron: string;
15347    }
15348    interface AlarmEventInfo {
15349        readonly type: "alarm";
15350        readonly scheduledTime: Date;
15351    }
15352    interface QueueEventInfo {
15353        readonly type: "queue";
15354        readonly queueName: string;
15355        readonly batchSize: number;
15356    }
15357    interface EmailEventInfo {
15358        readonly type: "email";
15359        readonly mailFrom: string;
15360        readonly rcptTo: string;
15361        readonly rawSize: number;
15362    }
15363    interface TraceEventInfo {
15364        readonly type: "trace";
15365        readonly traces: (string | null)[];
15366    }
15367    interface HibernatableWebSocketEventInfoMessage {
15368        readonly type: "message";
15369    }
15370    interface HibernatableWebSocketEventInfoError {
15371        readonly type: "error";
15372    }
15373    interface HibernatableWebSocketEventInfoClose {
15374        readonly type: "close";
15375        readonly code: number;
15376        readonly wasClean: boolean;
15377    }
15378    interface HibernatableWebSocketEventInfo {
15379        readonly type: "hibernatableWebSocket";
15380        readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;
15381    }
15382    interface CustomEventInfo {
15383        readonly type: "custom";
15384    }
15385    interface FetchResponseInfo {
15386        readonly type: "fetch";
15387        readonly statusCode: number;
15388    }
15389    interface ConnectEventInfo {
15390        readonly type: "connect";
15391    }
15392    type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";
15393    interface ScriptVersion {
15394        readonly id: string;
15395        readonly tag?: string;
15396        readonly message?: string;
15397    }
15398    interface TracePreviewInfo {
15399        readonly id: string;
15400        readonly slug: string;
15401        readonly name: string;
15402    }
15403    interface Onset {
15404        readonly type: "onset";
15405        readonly attributes: Attribute[];
15406        // id for the span being opened by this Onset event.
15407        readonly spanId: string;
15408        readonly dispatchNamespace?: string;
15409        readonly entrypoint?: string;
15410        readonly executionModel: string;
15411        readonly durableObjectId?: string;
15412        readonly scriptName?: string;
15413        readonly scriptTags?: string[];
15414        readonly scriptVersion?: ScriptVersion;
15415        readonly preview?: TracePreviewInfo;
15416        readonly info: FetchEventInfo | ConnectEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;
15417    }
15418    interface Outcome {
15419        readonly type: "outcome";
15420        readonly outcome: EventOutcome;
15421        readonly cpuTime: number;
15422        readonly wallTime: number;
15423    }
15424    type SpanStatusCode = "unset" | "ok" | "error";
15425    interface SpanStatus {
15426        readonly code: SpanStatusCode;
15427        /** A developer-facing error message, present only when code is "error". */
15428        readonly message?: string;
15429    }
15430    interface SpanOpen {
15431        readonly type: "spanOpen";
15432        readonly name: string;
15433        // id for the span being opened by this SpanOpen event.
15434        readonly spanId: string;
15435        readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
15436    }
15437    interface SpanClose {
15438        readonly type: "spanClose";
15439        readonly outcome: EventOutcome;
15440    }
15441    type SpanUpdateInfo = {
15442        readonly type: "name";
15443        readonly name: string;
15444    } | {
15445        readonly type: "status";
15446        readonly status: SpanStatus;
15447    };
15448    interface SpanUpdate {
15449        readonly type: "spanUpdate";
15450        readonly info: SpanUpdateInfo;
15451    }
15452    interface DiagnosticChannelEvent {
15453        readonly type: "diagnosticChannel";
15454        readonly channel: string;
15455        readonly message: any;
15456    }
15457    interface Exception {
15458        readonly type: "exception";
15459        readonly code?: string | number;
15460        readonly name: string;
15461        readonly message: string;
15462        readonly stack?: string;
15463    }
15464    interface TailStreamErrorInfo {
15465        readonly name: string;
15466        readonly message: string;
15467        readonly stack?: string;
15468    }
15469    type Log = {
15470        readonly type: "log";
15471        readonly level: "debug" | "error" | "info" | "log" | "warn";
15472        readonly errorInfo?: readonly (TailStreamErrorInfo | null)[];
15473    } & ({
15474        readonly message: object;
15475        readonly truncated?: false;
15476    } | {
15477        readonly message: string;
15478        readonly truncated: true;
15479    });
15480    interface DroppedEventsDiagnostic {
15481        readonly diagnosticsType: "droppedEvents";
15482        readonly count: number;
15483    }
15484    interface StreamDiagnostic {
15485        readonly type: 'streamDiagnostic';
15486        // To add new diagnostic types, define a new interface and add it to this union type.
15487        readonly diagnostic: DroppedEventsDiagnostic;
15488    }
15489    // This marks the worker handler return information.
15490    // This is separate from Outcome because the worker invocation can live for a long time after
15491    // returning. For example - Websockets that return an http upgrade response but then continue
15492    // streaming information or SSE http connections.
15493    interface Return {
15494        readonly type: "return";
15495        readonly info?: FetchResponseInfo;
15496    }
15497    interface Attribute {
15498        readonly name: string;
15499        readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];
15500    }
15501    interface Attributes {
15502        readonly type: "attributes";
15503        readonly info: Attribute[];
15504    }
15505    type EventType = Onset | Outcome | SpanOpen | SpanClose | SpanUpdate | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;
15506    // Context in which this trace event lives.
15507    interface SpanContext {
15508        // Single id for the entire top-level invocation
15509        // This should be a new traceId for the first worker stage invoked in the eyeball request and then
15510        // same-account service-bindings should reuse the same traceId but cross-account service-bindings
15511        // should use a new traceId.
15512        readonly traceId: string;
15513        // spanId in which this event is handled
15514        // for Onset and SpanOpen events this would be the parent span id
15515        // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
15516        // For Hibernate and Mark this would be the span under which they were emitted.
15517        // spanId is not set ONLY if:
15518        //  1. This is an Onset event
15519        //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
15520        readonly spanId?: string;
15521        // W3C trace flags from an upstream traceparent. Absent when no upstream
15522        // sampling decision was made.
15523        readonly traceFlags?: number;
15524    }
15525    interface TailEvent<Event extends EventType> {
15526        // invocation id of the currently invoked worker stage.
15527        // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
15528        readonly invocationId: string;
15529        // Inherited spanContext for this event.
15530        readonly spanContext: SpanContext;
15531        readonly timestamp: Date;
15532        readonly sequence: number;
15533        readonly event: Event;
15534    }
15535    type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;
15536    type TailEventHandlerObject = {
15537        outcome?: TailEventHandler<Outcome>;
15538        spanOpen?: TailEventHandler<SpanOpen>;
15539        spanClose?: TailEventHandler<SpanClose>;
15540        spanUpdate?: TailEventHandler<SpanUpdate>;
15541        diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
15542        exception?: TailEventHandler<Exception>;
15543        log?: TailEventHandler<Log>;
15544        return?: TailEventHandler<Return>;
15545        attributes?: TailEventHandler<Attributes>;
15546    };
15547    type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
15548}
15549// Copyright (c) 2022-2023 Cloudflare, Inc.
15550// Licensed under the Apache 2.0 license found in the LICENSE file or at:
15551//     https://opensource.org/licenses/Apache-2.0
15552/**
15553 * Data types supported for holding vector metadata.
15554 */
15555type VectorizeVectorMetadataValue = string | number | boolean | string[];
15556/**
15557 * Additional information to associate with a vector.
15558 */
15559type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;
15560type VectorFloatArray = Float32Array | Float64Array;
15561interface VectorizeError {
15562    code?: number;
15563    error: string;
15564}
15565/**
15566 * Comparison logic/operation to use for metadata filtering.
15567 *
15568 * This list is expected to grow as support for more operations are released.
15569 */
15570type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';
15571type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';
15572/**
15573 * Filter criteria for vector metadata used to limit the retrieved query result set.
15574 */
15575type VectorizeVectorMetadataFilter = {
15576    [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {
15577        [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;
15578    } | {
15579        [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];
15580    };
15581};
15582/**
15583 * Supported distance metrics for an index.
15584 * Distance metrics determine how other "similar" vectors are determined.
15585 */
15586type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
15587/**
15588 * Metadata return levels for a Vectorize query.
15589 *
15590 * Default to "none".
15591 *
15592 * @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.
15593 * @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).
15594 * @property none     No indexed metadata will be returned.
15595 */
15596type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
15597interface VectorizeQueryOptions {
15598    topK?: number;
15599    namespace?: string;
15600    returnValues?: boolean;
15601    returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
15602    filter?: VectorizeVectorMetadataFilter;
15603}
15604/**
15605 * Information about the configuration of an index.
15606 */
15607type VectorizeIndexConfig = {
15608    dimensions: number;
15609    metric: VectorizeDistanceMetric;
15610} | {
15611    preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
15612};
15613/**
15614 * Metadata about an existing index.
15615 *
15616 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
15617 * See {@link VectorizeIndexInfo} for its post-beta equivalent.
15618 */
15619interface VectorizeIndexDetails {
15620    /** The unique ID of the index */
15621    readonly id: string;
15622    /** The name of the index. */
15623    name: string;
15624    /** (optional) A human readable description for the index. */
15625    description?: string;
15626    /** The index configuration, including the dimension size and distance metric. */
15627    config: VectorizeIndexConfig;
15628    /** The number of records containing vectors within the index. */
15629    vectorsCount: number;
15630}
15631/**
15632 * Metadata about an existing index.
15633 */
15634interface VectorizeIndexInfo {
15635    /** The number of records containing vectors within the index. */
15636    vectorCount: number;
15637    /** Number of dimensions the index has been configured for. */
15638    dimensions: number;
15639    /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
15640    processedUpToDatetime: number;
15641    /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
15642    processedUpToMutation: number;
15643}
15644/**
15645 * Represents a single vector value set along with its associated metadata.
15646 */
15647interface VectorizeVector {
15648    /** 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. */
15649    id: string;
15650    /** The vector values */
15651    values: VectorFloatArray | number[];
15652    /** The namespace this vector belongs to. */
15653    namespace?: string;
15654    /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
15655    metadata?: Record<string, VectorizeVectorMetadata>;
15656}
15657/**
15658 * Represents a matched vector for a query along with its score and (if specified) the matching vector information.
15659 */
15660type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<VectorizeVector, "values"> & {
15661    /** The score or rank for similarity, when returned as a result */
15662    score: number;
15663};
15664/**
15665 * A set of matching {@link VectorizeMatch} for a particular query.
15666 */
15667interface VectorizeMatches {
15668    matches: VectorizeMatch[];
15669    count: number;
15670}
15671/**
15672 * Results of an operation that performed a mutation on a set of vectors.
15673 * Here, `ids` is a list of vectors that were successfully processed.
15674 *
15675 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
15676 * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
15677 */
15678interface VectorizeVectorMutation {
15679    /* List of ids of vectors that were successfully processed. */
15680    ids: string[];
15681    /* Total count of the number of processed vectors. */
15682    count: number;
15683}
15684/**
15685 * Result type indicating a mutation on the Vectorize Index.
15686 * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
15687 */
15688interface VectorizeAsyncMutation {
15689    /** The unique identifier for the async mutation operation containing the changeset. */
15690    mutationId: string;
15691}
15692/**
15693 * A Vectorize Vector Search Index for querying vectors/embeddings.
15694 *
15695 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
15696 * See {@link Vectorize} for its new implementation.
15697 */
15698declare abstract class VectorizeIndex {
15699    /**
15700     * Get information about the currently bound index.
15701     * @returns A promise that resolves with information about the current index.
15702     */
15703    public describe(): Promise<VectorizeIndexDetails>;
15704    /**
15705     * Use the provided vector to perform a similarity search across the index.
15706     * @param vector Input vector that will be used to drive the similarity search.
15707     * @param options Configuration options to massage the returned data.
15708     * @returns A promise that resolves with matched and scored vectors.
15709     */
15710    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
15711    /**
15712     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
15713     * @param vectors List of vectors that will be inserted.
15714     * @returns A promise that resolves with the ids & count of records that were successfully processed.
15715     */
15716    public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
15717    /**
15718     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
15719     * @param vectors List of vectors that will be upserted.
15720     * @returns A promise that resolves with the ids & count of records that were successfully processed.
15721     */
15722    public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
15723    /**
15724     * Delete a list of vectors with a matching id.
15725     * @param ids List of vector ids that should be deleted.
15726     * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
15727     */
15728    public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
15729    /**
15730     * Get a list of vectors with a matching id.
15731     * @param ids List of vector ids that should be returned.
15732     * @returns A promise that resolves with the raw unscored vectors matching the id set.
15733     */
15734    public getByIds(ids: string[]): Promise<VectorizeVector[]>;
15735}
15736/**
15737 * A Vectorize Vector Search Index for querying vectors/embeddings.
15738 *
15739 * Mutations in this version are async, returning a mutation id.
15740 */
15741declare abstract class Vectorize {
15742    /**
15743     * Get information about the currently bound index.
15744     * @returns A promise that resolves with information about the current index.
15745     */
15746    public describe(): Promise<VectorizeIndexInfo>;
15747    /**
15748     * Use the provided vector to perform a similarity search across the index.
15749     * @param vector Input vector that will be used to drive the similarity search.
15750     * @param options Configuration options to massage the returned data.
15751     * @returns A promise that resolves with matched and scored vectors.
15752     */
15753    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
15754    /**
15755     * Use the provided vector-id to perform a similarity search across the index.
15756     * @param vectorId Id for a vector in the index against which the index should be queried.
15757     * @param options Configuration options to massage the returned data.
15758     * @returns A promise that resolves with matched and scored vectors.
15759     */
15760    public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;
15761    /**
15762     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
15763     * @param vectors List of vectors that will be inserted.
15764     * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
15765     */
15766    public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
15767    /**
15768     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
15769     * @param vectors List of vectors that will be upserted.
15770     * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
15771     */
15772    public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
15773    /**
15774     * Delete a list of vectors with a matching id.
15775     * @param ids List of vector ids that should be deleted.
15776     * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
15777     */
15778    public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
15779    /**
15780     * Get a list of vectors with a matching id.
15781     * @param ids List of vector ids that should be returned.
15782     * @returns A promise that resolves with the raw unscored vectors matching the id set.
15783     */
15784    public getByIds(ids: string[]): Promise<VectorizeVector[]>;
15785}
15786/**
15787 * The interface for "version_metadata" binding
15788 * providing metadata about the Worker Version using this binding.
15789 */
15790type WorkerVersionMetadata = {
15791    /** The ID of the Worker Version using this binding */
15792    id: string;
15793    /** The tag of the Worker Version using this binding */
15794    tag: string;
15795    /** The timestamp of when the Worker Version was uploaded */
15796    timestamp: string;
15797};
15798// ============ Web Search Request Types ============
15799/**
15800 * Options for a Web Search query.
15801 */
15802type WebSearchSearchOptions = {
15803    /** The search query. */
15804    query: string;
15805    /**
15806     * Maximum number of results to return. Defaults to 10, capped at 20.
15807     * The actual count may be lower if fewer matches exist.
15808     */
15809    limit?: number;
15810};
15811// ============ Web Search Response Types ============
15812/**
15813 * A single Web Search result.
15814 *
15815 * Web Search is discovery-only -- results carry catalog metadata about a page
15816 * but never the page body. To read a result's content the caller invokes the
15817 * global `fetch()` API against the result's `url`, at which point the
15818 * destination's own access controls apply (including Cloudflare Pay-per-Crawl).
15819 */
15820type WebSearchResult = {
15821    /** Canonical URL. */
15822    url: string;
15823    /** Page title. */
15824    title: string;
15825    /** Page-level description. May be absent. */
15826    description?: string;
15827    /**
15828     * Last-modified date for the page, when known. Naive (no timezone)
15829     * ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.
15830     */
15831    lastModifiedDate?: string;
15832    /**
15833     * Page meta image URL (typically the `og:image`). May be absent.
15834     */
15835    imageUrl?: string;
15836    /** Optional favicon URL for UI hints. */
15837    faviconUrl?: string;
15838};
15839/**
15840 * Per-response metadata for a Web Search query. Carries operational
15841 * fields useful for support and debugging.
15842 */
15843type WebSearchResponseMetadata = {
15844    /** The query that was executed. */
15845    query: string;
15846    /** Opaque request identifier used for support and debugging. */
15847    requestId: string;
15848    /** End-to-end latency for this search request, in milliseconds. */
15849    latencyMs: number;
15850};
15851/**
15852 * Response from a Web Search query.
15853 */
15854type WebSearchSearchResponse = {
15855    items: WebSearchResult[];
15856    metadata: WebSearchResponseMetadata;
15857};
15858// ============ Web Search Binding Class ============
15859/**
15860 * Cloudflare Web Search binding.
15861 *
15862 * Discovery-only primitive for agents and Workers. Returns URLs and catalog
15863 * metadata for a query; never returns page content or excerpts. To read a
15864 * result's body, fetch the URL with the global `fetch()` API.
15865 *
15866 * Declared in wrangler with a single object (there is exactly one corpus, the
15867 * public web, so there is no name, namespace, or instance to specify):
15868 *
15869 * ```jsonc
15870 * { "web_search": { "binding": "WEBSEARCH" } }
15871 * ```
15872 *
15873 * @example
15874 * ```ts
15875 * const { items, metadata } = await env.WEBSEARCH.search({
15876 *   query: "Cloudflare Workers",
15877 * });
15878 *
15879 * const top = items[0];
15880 * console.log(top.url, top.title, metadata.latencyMs);
15881 *
15882 * // Read content yourself; pay-per-crawl and other publisher
15883 * // controls apply at the fetch site, not at search time.
15884 * const page = await fetch(top.url);
15885 * ```
15886 */
15887declare abstract class WebSearch {
15888    /**
15889     * Run a Web Search query.
15890     * @param options Search options. Only `query` is required.
15891     * @returns The matching results plus per-response metadata.
15892     */
15893    search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;
15894}
15895interface DynamicDispatchLimits {
15896    /**
15897     * Limit CPU time in milliseconds.
15898     */
15899    cpuMs?: number;
15900    /**
15901     * Limit number of subrequests.
15902     */
15903    subRequests?: number;
15904}
15905interface DynamicDispatchOptions {
15906    /**
15907     * Limit resources of invoked Worker script.
15908     */
15909    limits?: DynamicDispatchLimits;
15910    /**
15911     * Arguments for outbound Worker script, if configured.
15912     */
15913    outbound?: {
15914        [key: string]: any;
15915    };
15916}
15917interface DispatchNamespace {
15918    /**
15919    * @param name Name of the Worker script.
15920    * @param args Arguments to Worker script.
15921    * @param options Options for Dynamic Dispatch invocation.
15922    * @returns A Fetcher object that allows you to send requests to the Worker script.
15923    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
15924    */
15925    get(name: string, args?: {
15926        [key: string]: any;
15927    }, options?: DynamicDispatchOptions): Fetcher;
15928}
15929declare module 'cloudflare:workflows' {
15930    /**
15931     * NonRetryableError allows for a user to throw a fatal error
15932     * that makes a Workflow instance fail immediately without triggering a retry
15933     */
15934    export class NonRetryableError extends Error {
15935        public constructor(message: string, name?: string);
15936    }
15937}
15938declare abstract class Workflow<PARAMS = unknown> {
15939    /**
15940     * Get a handle to an existing instance of the Workflow.
15941     * @param id Id for the instance of this Workflow
15942     * @returns A promise that resolves with a handle for the Instance
15943     */
15944    public get(id: string): Promise<WorkflowInstance>;
15945    /**
15946     * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
15947     * @param options Options when creating an instance including id and params
15948     * @returns A promise that resolves with a handle for the Instance
15949     */
15950    public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;
15951    /**
15952     * Create a batch of instances and return handles for the created instances and any per-instance errors.
15953     * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.
15954     * @param options Options for creating instances by count or from a list of instance options
15955     * @returns A promise that resolves with the created instance handles and any per-instance errors.
15956     */
15957    public createBatch(options: WorkflowBatchCreateOptions<PARAMS>): Promise<WorkflowBatchCreateResult>;
15958    /**
15959     * Create a batch of instances and return handles for the ones that were created.
15960     * Instances that could not be created, for example because their ID already exists, are omitted from the result without an error.
15961     * @deprecated Use the object form of `createBatch` instead of the array form.
15962     */
15963    public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
15964    /**
15965     * Delete a batch of Workflow instances and their stored state.
15966     * `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once.
15967     * The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors.
15968     * @param instanceIds IDs of the Workflow instances to delete
15969     * @returns A promise that resolves with the successfully deleted instances and any per-instance errors.
15970     */
15971    public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;
15972}
15973type WorkflowBatchCreateOptions<PARAMS = unknown> = {
15974    count: number;
15975    params?: PARAMS;
15976    retention?: {
15977        successRetention?: WorkflowRetentionDuration;
15978        errorRetention?: WorkflowRetentionDuration;
15979    };
15980    locationHint?: WorkflowInstanceLocationHint;
15981    instances?: never;
15982} | {
15983    instances: WorkflowInstanceCreateOptions<PARAMS>[];
15984    count?: never;
15985    params?: never;
15986    retention?: never;
15987    locationHint?: never;
15988};
15989type WorkflowBatchCreateResult = {
15990    created: WorkflowInstance[];
15991    errors: {
15992        index: number;
15993        id?: string;
15994        code: number;
15995        message: string;
15996    }[];
15997};
15998type WorkflowBatchDeleteResult = {
15999    deleted: {
16000        id: string;
16001    }[];
16002    errors: {
16003        id: string;
16004        code: number;
16005        message: string;
16006    }[];
16007};
16008type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
16009type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
16010type WorkflowRetentionDuration = WorkflowSleepDuration;
16011/** Geographic regions supported when creating a Workflow instance.
16012 * Location hints are best-effort placement preferences. */
16013type WorkflowInstanceLocationHint = 'wnam' | 'enam' | 'sam' | 'weur' | 'eeur' | 'apac' | 'apac-ne' | 'apac-se' | 'oc' | 'afr' | 'me';
16014interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16015    /**
16016     * An id for your Workflow instance. Must be unique within the Workflow.
16017     */
16018    id?: string;
16019    /**
16020     * The event payload the Workflow instance is triggered with
16021     */
16022    params?: PARAMS;
16023    /**
16024     * The retention policy for Workflow instance.
16025     * Defaults to the maximum retention period available for the owner's account.
16026     */
16027    retention?: {
16028        successRetention?: WorkflowRetentionDuration;
16029        errorRetention?: WorkflowRetentionDuration;
16030    };
16031    /** A best-effort geographic placement preference for the Workflow instance.
16032     * See `WorkflowInstanceLocationHint` for supported regions. */
16033    locationHint?: WorkflowInstanceLocationHint;
16034}
16035type InstanceStatus = {
16036    status: 'queued' // means that instance is waiting to be started (see concurrency limits)
16037     | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running
16038     | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish
16039     | 'waitingForPause' // instance is finishing the current work to pause
16040     | 'rollingBack' | 'unknown';
16041    error?: {
16042        name: string;
16043        message: string;
16044    };
16045    output?: unknown;
16046};
16047interface WorkflowError {
16048    code?: number;
16049    message: string;
16050}
16051interface WorkflowInstanceTerminateOptions {
16052    /**
16053     * If true, run registered rollback handlers before terminating the instance.
16054     * Only steps that registered rollback handlers are rolled back.
16055     */
16056    rollback?: boolean;
16057}
16058interface WorkflowInstanceRestartOptions {
16059    /**
16060     * Restart from a specific step. If omitted, the instance restarts from the beginning.
16061     * The step must exist in the instance's execution history.
16062     */
16063    from?: {
16064        /**
16065         * The step name as defined in your workflow code.
16066         */
16067        name: string;
16068        /**
16069         * 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).
16070         * @default 1
16071         */
16072        count?: number;
16073        /**
16074         * Step type filter. Use when different step types share the same name.
16075         */
16076        type?: 'do' | 'sleep' | 'waitForEvent';
16077    };
16078}
16079/** An event emitted by a Workflow instance. */
16080type WorkflowInstanceEvent = {
16081    instanceId: string;
16082    eventId: number;
16083    timestamp: number;
16084} & ({
16085    type: 'workflow_queued';
16086} | {
16087    type: 'workflow_started';
16088    params?: unknown;
16089} | {
16090    type: 'workflow_running';
16091} | {
16092    type: 'workflow_paused';
16093} | {
16094    type: 'workflow_waiting_for_pause';
16095} | {
16096    type: 'workflow_waiting';
16097} | {
16098    type: 'workflow_completed';
16099    output?: unknown;
16100} | {
16101    type: 'workflow_errored';
16102    error: {
16103        name: string;
16104        message: string;
16105    };
16106} | {
16107    type: 'workflow_terminated';
16108} | {
16109    type: 'step_started';
16110    stepName: string;
16111    config?: {
16112        retries: {
16113            limit: number;
16114            delay: WorkflowSleepDuration | '[dynamic]';
16115            backoff?: 'constant' | 'linear' | 'exponential';
16116        };
16117        timeout: WorkflowSleepDuration;
16118        sensitive?: 'output';
16119    };
16120} | {
16121    type: 'step_completed';
16122    stepName: string;
16123    output?: unknown;
16124} | {
16125    type: 'step_errored';
16126    stepName: string;
16127} | {
16128    type: 'attempt_started';
16129    stepName: string;
16130    attempt: number;
16131} | {
16132    type: 'attempt_completed';
16133    stepName: string;
16134    attempt: number;
16135} | {
16136    type: 'attempt_errored';
16137    stepName: string;
16138    attempt: number;
16139    retryDelayMs?: number;
16140    error: {
16141        name: string;
16142        message: string;
16143    };
16144} | {
16145    type: 'sleep_started';
16146    stepName: string;
16147    durationMs: number;
16148} | {
16149    type: 'sleep_completed';
16150    stepName: string;
16151} | {
16152    type: 'wait_started';
16153    stepName: string;
16154    eventType: string;
16155} | {
16156    type: 'wait_completed';
16157    stepName: string;
16158} | {
16159    type: 'wait_timed_out';
16160    stepName: string;
16161} | {
16162    type: 'rollback_started';
16163} | {
16164    type: 'rollback_step_started';
16165    stepName: string;
16166    config?: {
16167        retries: {
16168            limit: number;
16169            delay: WorkflowSleepDuration | '[dynamic]';
16170            backoff?: 'constant' | 'linear' | 'exponential';
16171        };
16172        timeout: WorkflowSleepDuration;
16173        sensitive?: 'output';
16174    };
16175} | {
16176    type: 'rollback_step_completed';
16177    stepName: string;
16178} | {
16179    type: 'rollback_step_errored';
16180    stepName: string;
16181    error: {
16182        name: string;
16183        message: string;
16184    };
16185} | {
16186    type: 'rollback_attempt_started';
16187    stepName: string;
16188    attempt: number;
16189} | {
16190    type: 'rollback_attempt_completed';
16191    stepName: string;
16192    attempt: number;
16193} | {
16194    type: 'rollback_attempt_errored';
16195    stepName: string;
16196    attempt: number;
16197    retryDelayMs?: number;
16198    error: {
16199        name: string;
16200        message: string;
16201    };
16202} | {
16203    type: 'rollback_completed';
16204} | {
16205    type: 'rollback_errored';
16206});
16207type WorkflowInstanceEventType = WorkflowInstanceEvent['type'];
16208/** Options available for a Workflow instance subscription. */
16209type WorkflowInstanceSubscribeOptions = {
16210    /** The value from which to start the subscription. */
16211    cursor?: number;
16212    /** The event types to include in the subscription. */
16213    filter?: WorkflowInstanceEventType[];
16214};
16215/** A disposable subscription to a Workflow instance's events. */
16216interface WorkflowInstanceSubscription extends Disposable {
16217    next(): Promise<IteratorResult<WorkflowInstanceEvent, void>>;
16218}
16219declare abstract class WorkflowInstance {
16220    public id: string;
16221    /**
16222     * Pause the instance.
16223     */
16224    public pause(): Promise<void>;
16225    /**
16226     * Resume the instance. If it is already running, an error will be thrown.
16227     */
16228    public resume(): Promise<void>;
16229    /**
16230     * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
16231     * @param options Options for termination, including whether registered rollback handlers should run.
16232     */
16233    public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
16234    /**
16235     * Restart the instance. Optionally restart from a specific step, preserving
16236     * cached results for all steps before it.
16237     * @param options Options for the restart, including an optional step to restart from.
16238     */
16239    public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
16240    /**
16241     * Delete the instance and its stored state.
16242     */
16243    public delete(): Promise<void>;
16244    /**
16245     * Returns the current status of the instance.
16246     */
16247    public status(): Promise<InstanceStatus>;
16248    /**
16249     * Send an event to this instance.
16250     */
16251    public sendEvent({ type, payload, }: {
16252        type: string;
16253        payload: unknown;
16254    }): Promise<void>;
16255    /**
16256     * Subscribe to events emitted by this instance.
16257     */
16258    public subscribe(options?: WorkflowInstanceSubscribeOptions): Promise<WorkflowInstanceSubscription>;
16259}